//resources
app.siteDefaultLocale = "pt-PT";
app.siteBrandID = "BB";
app.resources.MISSINGCHK = "Please check this checkbox";
app.resources.MISSINGVAL = "Please Enter {0}";
app.resources.MISSINGCITY = "Please enter your city";
app.resources.SERVER_ERROR = "Server connection failed!";
app.resources.MISSING_LIB = "jQuery is undefined.";
app.resources.BAD_RESPONSE = "Bad response, Parser error";
app.resources.INVALID_ADDRESS = "The address is not correct";
app.resources.INVALID_PHONE = "Please specify a valid phone number.";
app.resources.INVALID_EMAIL = "Please enter a valid email address.",
app.resources.EMAIL_WARNING = "The email was not found and/or could not be checked.",
app.resources.INVALID_CPF = "forms.address.CPF.field.invalid";
app.resources.INVALID_CITY = "City not recognized",
app.resources.DOB_INCOMPLETE = "The date of birth is incomplete.";
app.resources.DOB_AGE_ERROR = "Sorry, you need to be at least 13 years old to continue.";
app.resources.EQUALTO = "Please enter the same value again.",
app.resources.EQUALTOEMAIL = "Please confirm email address",
app.resources.INVALID_EMAILLIST = "The following email addresses are not correct:";
app.resources.REMOVE = "Remove";
app.resources.CLOSE = "Close";
app.resources.NEXT = "global.next";
app.resources.PREV = "Previous";
app.resources.QTY = "Qty";
app.resources.PLEASE_SELECT = "- please select -";
app.resources.MISSING_CREDIT_CARD_DATA = "Please fill all required credit card data.";
app.resources.CLICK_TO_EDIT = "click to edit";
app.resources.SUBMIT = "Submit";
app.resources.WRONG_DATE_FORMAT = "Please enter a date in the format mm/dd/yy";
app.resources.PRINT_NOW = "print now";
// Countrys
app.resources.countrysSelector = {};
app.resources.countrysSelector.regionAmericas = "Americas";
app.resources.countrysSelector.regionApac = "APAC / ASIA";
app.resources.countrysSelector.regionEurope = "Europe";
app.resources.countrysSelector.regionAfrica = "Africa";
app.resources.countrysSelector.europe = "Europe";
app.resources.countrysSelector.international = "International";
app.resources.sessioncountrycode = "pt";
app.resources.sessioncountry= "Portugal";
// Other State select option
app.resources.otherStateOptionName = "Other";
app.resources.otherStateOptionValue = "OTHER";
// Date Picker localisation
app.resources.dates = {};
app.resources.dates['TODAY'] = "Today";
app.resources.dates['WEEKHEADER'] = "CW";
app.resources.dates['DATE_FORMAT'] = "mm/dd/yy";
app.resources.dates['MONTH'] = [
"January"
, "February"
, "March"
, "April"
, "May"
, "June"
, "July"
, "August"
, "September"
, "October"
, "November"
, "December"
];
app.resources.dates['MONTH_SHORT'] = [
"Jan"
, "Feb"
, "Mar"
, "Apr"
, "May"
, "Jun"
, "Jul"
, "Aug"
, "Sep"
, "Oct"
, "Nov"
, "Dec"
];
app.resources.dates['DAY_NAMES'] = [
"Sunday"
, "Monday"
, "Tuesday"
, "Wednesday"
, "Thursday"
, "Friday"
, "Saturday"
];
app.resources.dates['DAY_NAMES_SHORT'] = [
"Sun"
, "Mon"
, "Tue"
, "Wed"
, "Thu"
, "Fri"
, "Sat"
];
app.resources.dates['DAY_NAMES_MIN'] = [
"S"
, "M"
, "T"
, "W"
, "Th"
, "F"
, "S"
];
// product availability messages
app.resources["IN_STOCK"] = "In Stock";
app.resources["QTY_IN_STOCK"] = "{0} Item(s) In Stock";
app.resources["PREORDER"] = "Pre-Order";
app.resources["QTY_PREORDER"] = "{0} item(s) are available for pre-order.";
app.resources["REMAIN_PREORDER"] = "The remaining items are available for pre-order.";
app.resources["BACKORDER"] = "Back Order";
app.resources["QTY_BACKORDER"] = "Back Order {0} item(s)";
app.resources["REMAIN_BACKORDER"] = "The remaining items are available on back order.";
app.resources["NOT_AVAILABLE"] = "Not available.";
app.resources["REMAIN_NOT_AVAILABLE"] = "The remaining items are currently not available. Please adjust the quantity.";
app.resources["IN_STOCK_DATE"] = "The expected in-stock date is {0}.";
app.resources["NON_SELECTED"] = "Not Selected";
app.resources["MISSING_VAL"] = "Select {0}";
app.resources["SIZECHART_TITLE"] = "Size Chart";
app.resources["SEND_TO_FRIEND"] = "Send to a Friend";
app.resources["MISSING_VAL"] = "Select {0}";
//shipping resources
app.resources["SHIP_STATE_LABEL"] ="State";
app.resources["SHIP_PROVINCE_LABEL"] ="State";
app.resources["SHIP_QualifiesFor"] = "This shipment qualifies for"
app.resources["STOREPICKUP"] = "Select pickup location"
app.resources["STOREPICKUP_POSTCODE"] = "Postcode value is required."
app.resources["STOREPICKUP_NO_GEO_MATCH"] = "Your current location seems to be outside of our shipping area. Please type an address to search directly."
app.resources["STOREPICKUP_GEO_TOOLTIP"] = "Click to use your current location."
app.resources["STOREPICKUP_EMPTY_RESULT"] = "No results found"
app.resources["SHIP_TO_COUNTRY_POST_LABEL"] = "(shipping to)";
//shipping resources
app.resources["BILL_GC"] = "GIFT_CERTIFICATE";
//billing resources
app.resources["CREDIT_CARD_TYPE"] = "dwfrm_billing_paymentMethods_creditCard_type";
// bonus products messages
app.resources["BONUS_PRODUCTS"] = "Bonus Product(s)";
app.resources["SELECT_BONUS_PRODUCT"] = "Select or Update";
app.resources["BONUS_PRODUCT_MAX"] = "The maximum number of bonus products have been selected. Please remove one in order to add additional bonus products.";
app.resources["SIMPLE_SEARCH"] = "Enter Keyword or Item #";
// Gift Cert resources
app.resources["REG_ADDR_ERROR"] = "Couldn't Load Address";
app.resources["GIFTCARD_CAN_NOT_BE_VALIDATED"] = "We're sorry, but the gift card number you entered is not correct.";
app.resources.loyalty = {};
app.resources.loyalty.notifyTCChange = "false";
app.resources.loyalty.getCustomerAcceptationUrl = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Account-LoyaltyGetTcAcceptationValue";
app.resources.loyalty.setCustomerAcceptationUrl = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Account-LoyaltySetTcAcceptationValue";
app.resources.loyalty.getTcAcceptationPop = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Account-LoyaltyGetTcAcceptationPopup";
app.resources.loyalty.saveCustomerEmailUrl = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Account-LoyaltySaveCustomerEmail";
//Store pickup page
app.resources.storepickup = {};
app.resources.storepickup.storesicon = "https://www.billabong.pt/on/demandware.static/Sites-BB-PT-Site/-/default/dw1674b497/images/icons/pushpin.png";
app.resources.storepickup.selectlabel = "Select";
app.resources.storepickup.storeicons_url = "/on/demandware.static/-/Sites-BB-PT-Library/pt_PT/v1584495439542/REPLACEME";
app.resources.storepickup.storeicons_config = null; // as JSON String
app.resources.storepickup.sessionlocale = "pt";
app.resources.storepickup.currency_symbol = "€";
app.resources.storepickup.deliveryTimeText1 = "checkout.pickstore.deliveryTimeText1";
app.resources.storepickup.deliveryTimeText2 = "checkout.pickstore.deliveryTimeText2";
app.resources.storepickup.noresultstitle = "No Results Found";
app.resources.storepickup.emptysearchfieldmsg = "checkout.pickstore.emptysearchfieldmsg";
//Store locator page
app.resources.storelocator = {};
app.resources.storelocator.dwClientID = "13d00e86-f1e5-4c51-abf5-af0c25ebf069";
app.resources.storelocator.sendlabel = "Send address via";
app.resources.storelocator.emaillink = "Email";
app.resources.storelocator.viewstorehours = "View store opening times";
app.resources.storelocator.phonelabel = "Tel:";
app.resources.storelocator.dayrange = "From Monday to Sunday";
app.resources.storelocator.monday = "Monday";
app.resources.storelocator.tuesday = "Tuesday";
app.resources.storelocator.wednesday = "Wednesday";
app.resources.storelocator.thursday = "Thursday";
app.resources.storelocator.friday = "Friday";
app.resources.storelocator.saturday = "Saturday";
app.resources.storelocator.sunday = "Sunday";
app.resources.storelocator.hoursrange = "from %OPEN% to %CLOSE%";
app.resources.storelocator.storesicon = "/on/demandware.static/Sites-BB-PT-Site/-/pt_PT/v1584495439542/images/icons/stores-icon.png";
app.resources.storelocator.outletsicon = "/on/demandware.static/Sites-BB-PT-Site/-/pt_PT/v1584495439542/images/icons/outlets-icon.png";
app.resources.storelocator.boardridersclubicon = "/on/demandware.static/Sites-BB-PT-Site/-/pt_PT/v1584495439542/images/icons/boardridersclub-icon.png";
app.resources.storelocator.dealersicon = "/on/demandware.static/Sites-BB-PT-Site/-/pt_PT/v1584495439542/images/icons/authorized-dealers-icon.png";
app.resources.storelocator.providerURL = "https://dev.virtualearth.net/REST/v1/Locations?query=";
app.resources.storelocator.providerKey = "Ait6vo6o9O126kS5OYoHkOclWg3-DY4ifecpLP3b3r49sPbXI-RoLy2fAdvP7vg_";
app.resources.storelocator.defaultLocations = '{"US":{"latitude":33.740053530431425,"longitude":-118.03146985054013},"FR":{"latitude":46.227638,"longitude":2.213749000000007},"DE":{"latitude":51.165691,"longitude":10.451526},"CH":{"latitude":46.818188,"longitude":8.227511999999933},"DK":{"latitude":56.26392,"longitude":9.50178500000004},"GB":{"latitude":55.378051,"longitude":-3.43597299999999},"RU":{"latitude":61.52401,"longitude":105.31875600000001},"ES":{"latitude":40.46366700000001,"longitude":-3.7492200000000366},"IE":{"latitude":53.41291,"longitude":-8.243889999999965},"IT":{"latitude":41.87194,"longitude":12.56738},"NL":{"latitude":52.132633,"longitude":5.2912659999999505},"BE":{"latitude":50.503887,"longitude":4.4699359999999615},"LU":{"latitude":49.815273,"longitude":6.129583000000025},"PT":{"latitude":39.39987199999999,"longitude":-8.224454000000037},"FI":{"latitude":61.92410999999999,"longitude":25.748151000000007},"BR":{"latitude":-23.5261522,"longitude":-46.6451321}}';
app.resources.storelocator.storeLocatorFilterOnline = "false";
app.resources.storelocator.noresultstitle = "No Results Found";
app.resources.storelocator.noresultsfound = "No locations were found using your search criteria";
app.resources.storelocator.noresultshelp = "Please ensure that you entered a city and state/province";
// Product tile
app.resources.COLOR = "Colour";
app.resources.COLORS = "Colours";
app.resources["GIFT_CERT_ID"] = "input[name=dwfrm_giftcert_balance_giftCertID]";
app.resources["GIFT_CERT_FROM"] = "dwfrm_giftcert_purchase_from";
app.resources["GIFT_CERT_RECIPIENT"] = "dwfrm_giftcert_purchase_recipient";
app.resources["GIFT_CERT_RECIPIENT_EMAIL"] = "dwfrm_giftcert_purchase_recipientEmail";
app.resources["GIFT_CERT_RECIPIENT_CONF_EMAIL"] = "dwfrm_giftcert_purchase_confirmRecipientEmail";
app.resources["GIFT_CERT_RECIPIENT_MSG"] = "dwfrm_giftcert_purchase_message";
app.resources["GIFT_CERT_AMT"] = "dwfrm_giftcert_purchase_amount";
app.resources["GIFT_CERT_BALANCE"] = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/GiftCert-CheckBalance";
app.resources["GIFT_CERT_CUR_BALANCE"] = "Your current gift certificate balance is";
app.resources["GIFT_CERT_MISSINGCODE"] = "Please enter Gift Certificate Code";
app.resources["GIFT_CERT_INVALIDCODE"] = "Please check Gift Certificate Code";
app.resources["GIFT_CERT_ERROR"] = "Please enter the correct information";
app.resources["GIFT_BALANCE_ERROR_CODE"] = "Please enter a gift certificate code";
app.resources["GIFT_BALANCE_ERROR_PIN"] = "Please enter a pin code";
app.resources["GIFT_BALANCE_ERROR_DIGIT"] = "Pin code must be 4 digits";
app.resources["WISHLIST_LIST"] = "";
app.resources["WISHLIST_PROGRESS_IMAGE"] = "/on/demandware.static/Sites-BB-PT-Site/-/default/dw49383a6d/images/loading-progress-98x22.gif";
// PDP
app.resources["SAVED_FOR_LATER"] = "Saved in your Favourites";
app.resources["SAVE_FOR_LATER"] = "Save";
// Cart Wishlist
app.resources["ADD_TO_WISHLIST"] = "Add to Wishlist";
app.resources["VIEW_IN_WISHLIST"] = "View In Favorites";
app.resources.verticalVideoLocation = "null";
app.resources["PHONE_VALIDATION"] = {"US":{"mask":"(999) 999-9999","placeholder":"(___) ___-____","regex":"^(\\+0?1\\s)?\\(?\\d{3}\\)?[\\s.-]\\d{3}[\\s.-]\\d{4}$|^[a-zA-Z0-9]{7,20}$"},"BR":{"mask":"(99)99999-9999","multiMask":["(00)00000-0000","(00)0000-00009"],"placeholder":"(__)____-____","regex":"^([0-9]{2})?(\\([0-9]{2}\\))([0-9]{4}|[0-9]{5})-[0-9]{4}$"},"NL":{"regex":"^[\\+]*([\\-0-9][ ]*){7,15}$"},"default":{"regex":"^[\\+]*([\\-0-9][ ]*){7,20}$"}};
app.resources["ZIP_MASK"] = "";
app.resources["ZIP_PLACEHOLDER"] = "0";
app.resources["CPF_MASK"] = "0";
app.resources["CPF_PLACEHOLDER"] = "0";
app.resources["GIFT_CARD_LIMIT"] = "Oops! Please enter a gift card value between $25 and $500.";
app.resources["GIFT_CARD_SELECT"] = "Select or indicate amount.";
app.resources["MONEY"] = "€ 0,00";
app.resources["CITY_VALIDATION"] = '^[^0-9]+$';
//The follow snippet is executed to pass some Demandare URLs into the script
app.minicart.url = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Cart-MiniAddProduct";
app.URLs.addProductToCart = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Cart-AddProduct";
app.URLs.updateLineItem = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Cart-UpdateLineItem";
app.URLs.wishlistAddress = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Wishlist-SetShippingAddress?AddressID=";
app.URLs.viewWishlist = "/wishlist/";
app.URLs.addProductToWishlist = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Wishlist-Add";
app.URLs.removeProductFromWishlist = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Wishlist-Remove";
app.URLs.SetShippingContext = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Hooking-SetShippingContext";
app.URLs.SetLocalization = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Geolocation-SetLocalization";
// S.E.O links scripting
app.URLs.userLogin = "https://www.billabong.pt/account/";
app.URLs.userRegister = "https://www.billabong.pt/account/register/";
app.URLs.renderForm = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Addresses-RenderForm";
app.URLs.sizeChartShow = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/SizeChart-Show";
app.URLs.accountShow = "https://www.billabong.pt/account/";
app.URLs.contactUs = "/customer-help/contact/";
app.URLs.logOut = "https://www.billabong.pt/login/";
app.URLs.getShippingMethodsList = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/COShipping-UpdateShippingMethodList";
app.URLs.updateOrderTotals = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/COBilling-UpdateOrderTotals";
app.URLs.storeBillingAddress = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/COShipping-StoreUnsavedBillingAddress";
app.URLs.getProductDetail = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-Detail";
app.URLs.getProductUrl = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-Show";
app.URLs.searchUrl = "/search/";
app.URLs.getVariants = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-GetVariants";
app.URLs.getAvailability = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-GetAvailability";
app.URLs.loadingSmallImg = "/on/demandware.static/Sites-BB-PT-Site/-/default/dw710920aa/images/loading-small.gif";
app.URLs.formatMoney = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-FormatPrices";
app.URLs.removeImg = "/on/demandware.static/Sites-BB-PT-Site/-/default/dwd943ae56/images/icon_remove.gif";
app.URLs.searchsuggest = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Search-GetSuggestions";
app.URLs.searchnavigation = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Search-IncludeLeftNavigation";
app.URLs.submitDialogURL = 'https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Page-AppResources';
app.URLs.productNav = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Product-Productnav";
app.URLs.SeverConnectionError = "Server connection failed!";
app.URLs.quickview_product_url = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Proxy-Product2JSON";
app.URLs.PIConfirmDelete = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/PaymentInstruments-ConfirmDelete";
app.URLs.addressConfirmDelete = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/Address-ConfirmDelete";
app.URLs.pageInclude = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Page-Include";
app.URLs.findInStoreTemplate = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/FindInStore-Show";
app.URLs.findInStoreSearch = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/FindInStore-ProductSearch";
app.URLs.findInStoreLineItems = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/FindInStore-DisplayStores";
app.URLs.cartShow = "https://www.billabong.pt/cart/";
app.resources["NO_STORES_FOUND"] = "Sorry, but there were no stores found in this area with inventory in stock. Please try using the search box above to search in other areas.";
app.resources["phone_input_no_results_text"] = "No results found";
app.resources.getOtherRegionWebsiteJSON = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/Home-GetOtherRegionsWebsiteJSON";
// DQE - Preferences
app.DqeProxyUrl = "https://www.billabong.pt/on/demandware.store/Sites-BB-PT-Site/pt_PT/DQE-Proxy";
app.DqeEmailCheckEnabled = false;
app.DqePhoneCheckEnabled = true;
app.DqeAddressCheckEnabled = true;
app.DqeClientRNVPCheckEnabled = true;
app.DqeEmailAutocheck = false;
app.DqeEmailSuggest = false;
app.DqePhoneAutocheck = false;
app.DqePhoneNumberFormat = 2;
app.DqeCitySearch = 0;
app.DqeSearchDelay = 500;
app.DqeSingleSearchDelay = 1000;
app.DqeZipPatterns = {
'PRT': /^\d{4}([\-]\d{3})?$/, //new
'IRL': /^[A-Za-z]\d{2}\s[A-Za-z\d]{4}$/, //new
'FRA': /^\d{5}$/,
'DEU': /^\d{5}$/,
'AUT': /^\d{4}$/,
'BEL': /^\d{4}$/,
'CAN': /^[A-Z\d]{3} ?[A-Z\d]{3}$/,
'KOR': /^\d{3}[ -]?\d{3}$/,
'ESP': /^\d{5}$/,
'USA': /^([A-Z]{2})?[ -]?\d{5}[ -]?(\d{4})?$/i,
'ISR': /^\d{5}$/,
'ITA': /^\d{5}$/,
'LUX': /^\d{4}$/i,
'NLD': /^\d{4} ?([A-Z]{2})?$/,
'POL': /^\d\d-?\d{3}$/,
'PRT': /^\d{4}-?\d{3}$/,
'CZE': /^\d{3} ?\d{2}$/,
'ROU': /^\d{6}$/,
'GBR': /^[A-Z][A-Z\d]{1,3} ?\d[A-Z]{2}$/i,
'SGP': /^\d{6}$/,
'SVN': /^\d{4}$/,
'SWE': /^(SE)?-?\d{3} ?\d{2}$/,
'CHE': /^\d{4}$/,
'TUR': /^\d{5}$/,
'CHN': /^\d{6}$/,
'CHN-en': /^\d{6}$/,
'RUS': /^\d{6}$/,
'NOR': /^\d{4}$/,
'DNK': /^\d{4}$/,
'FIN': /^\d{5}$/,
'THA': /^\d{5}$/,
'MAR': /^\d{5}$/,
'HUN': /^\d{4}$/,
'HKG': /^.*$/, //Hong-kong
'HKG-en': /^.*$/, //Hong-kong
'QAT': /^.*$/, //Qatar
'NZL': /^\d{4}$/, //Nouvelle-zélande
'HRV': /^(HR)?-?\d{5}$/ //Croatie
};
// form validation zip patterns
app.FormValidationZipPatterns = {
"AT": "^\\d{4}$",
"BE": "^\\d{4}$",
"BR": "^\\d{5}([\\-]?)(\\d{3})$",
"CA": "^[AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\\d[AaBbCcEeGgHhJ-Nj-nPpRrSsTtV-Zv-z][ ]?\\d[AaBbCcEeGgHhJ-Nj-nPpRrSsTtV-Zv-z]\\d$",
"CH": "^\\d{4}$",
"DE": "^\\d{5}$",
"DK": "^\\d{4}$",
"ES": "^\\d{5}$",
"FI": "^\\d{5}$",
"FR": "^\\d{5}$",
"GB": "^[A-Pa-pR-Ur-uWYZwyz](([A-Ha-hK-Yk-y]?\\d\\d?)|(\\d[A-Ha-hJKPSTUWjkpstuw])|([A-Ha-hK-Yk-y]\\d[ABEHMNPRabehmnprV-Yv-y]))\\s?\\d[ABabD-Hd-hJLNjlnP-Up-uW-Zw-z]{2}$",
"IT": "^\\d{5}$",
"LU": "^\\d{4}$",
"NL": "^\\d{4}[ ][A-Z]{2}$",
"PT": "^\\d{4}([\\-]\\d{3})?$",
"US": "^((\\d{5}[ -]{1,1}\\d{4})|(\\d{5})|([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\\d[A-Za-z]\\s?\\d[A-Za-z]\\d))$"
};
//Geolocation references
app.resources["GEO_COUNTRY_CODE"] = "US";
app.resources["SHIP_TO_COUNTRY_CODE"]= "PT";
app.globalRedirectURL = "http://global.billabong.com";
// translations for ARIA attributes
app.resources.aria = {};
app.resources.aria.closesearch = "Close Search";
// Abandonned cart preferences
app.resources.abandonedCart = {
enabled : true,
provider : "AdobeCampaign",
storeEmailUrl : "/on/demandware.store/Sites-BB-PT-Site/pt_PT/AbandonedCart-StoreEmail",
storeNpkUrl : "/on/demandware.store/Sites-BB-PT-Site/pt_PT/AbandonedCart-StoreNpk"
};
// Country Context Preferences
// switched on or off via site preference > general > Site Configuration
app.resources.categoryContext = {
enabled: true,
setCategoryContextUrl: "/on/demandware.store/Sites-BB-PT-Site/pt_PT/CategoryContext-Set",
cookieName: "brCategoryContext",
contextUrls: {"men":"/homem/","women":"/mulher/"}
};
// Tracking
app.resources.tracking = {
OmnitureTrackingServer : "null"
};
// translation of jQuery validate
(function ($) {
$.extend($.validator.messages, {
required : "This field is required.",
remote : "Please fix this field.",
email : "Please enter a valid email address.",
url : "Please enter a valid URL.",
cpf : "forms.address.CPF.field.invalid",
date : "Please enter a valid date.",
dateISO : "Please enter a valid date (ISO).",
number : "Please enter a valid number.",
digits : "Please enter only digits.",
creditcard : "Please enter a valid credit card number.",
equalTo : "Please enter the same value again.",
equalToIgnoreCase : "Please enter the same value again.",
maxlength : $.validator.format("Please enter no more than {0} characters."),
minlength : $.validator.format("Please enter at least {0} characters."),
rangelength : $.validator.format("Please enter a value between {0} and {1} characters long."),
range : $.validator.format("Please enter a value between {0} and {1}."),
max : $.validator.format("Please enter a value less than or equal to {0}."),
min : $.validator.format("Please enter a value greater than or equal to {0}."),
emailConfirmIgnoreCase : "Please confirm email address.",
validateCountryState : "Please select a state associated with the selected country.",
regex : "Your input appears to be in the wrong format.",
zip : {
DE : "Bitte gib deine Postleitzahl mit 5 Ziffern an",
US : "Please provide your zip code in the format: XXXXX or XXXXX-XXXX (digits only).",
FR : "Please provide your postal code with 5 digits.",
CA : "Please provide your postal code in a format like J8R 2A5.",
GB : "Please provide your postal code in a format like YO31 1EB.",
NL : "Please provide your postal code in a format like 1114 AA.",
PT : "Please provide your postal code in a format like 1114-185.",
IE : "Please provide your postal code in a format like D02 AF30.",
BR : "global.zip.validation.hint.format",
ES : "Your entered postal code does not match with a city in our database.",
IT : "Your entered postal code does not match with a city in our database.",
AT : "Your entered postal code does not match with a city in our database.",
BE : "Your entered postal code does not match with a city in our database.",
CH : "Your entered postal code does not match with a city in our database.",
DK : "Your entered postal code does not match with a city in our database.",
FI : "Your entered postal code does not match with a city in our database.",
LU : "Your entered postal code does not match with a city in our database."
}
});
$.validator.customOptions = {
showRequiredMessages : true
};
// Pre init
// initialize the category context feature, if enabled
if (app.resources.categoryContext.enabled) {
app.processPageContext();
// we check if we have a cookie
var oldCookieJson = $.cookie.json;
$.cookie.json = false;
var categoryContextCookie = $.cookie(app.resources.categoryContext.cookieName);
$.cookie.json = oldCookieJson;
var currentCategoryContext = app.PageContext.firstLevelCategoryId;
// we check if we are on a certain category page
// do we need to override the cookie with a new value?
if (currentCategoryContext && currentCategoryContext !== categoryContextCookie) {
categoryContextCookie = currentCategoryContext;
$.get(app.resources.categoryContext.setCategoryContextUrl + '?categoryContext=' + encodeURIComponent(categoryContextCookie));
}
// add the class, if we have a value
if (categoryContextCookie) {
$('body').addClass('category-context-' + categoryContextCookie);
}
}
}(jQuery));
for (var namespace in Widgets.widgetExecutions) {
Widgets.widgetExecutions[namespace][Widgets.widgetExecutions[namespace].length] = 'DQEAddressCompletion';
}
// Address Verification System widget
Widgets.registered['DQEAddressCompletion'] = function(elem) {
var config = myEval(elem.data('config'));
var dv_shipping, dv_billing;
if (config.context == 'shipping') {
dv_shipping = new DQEValidator(config);
} else {
config.context = 'billing';
dv_billing = new DQEValidator(config);
}
};
app.URLs.DQEValidationOverlay = "/on/demandware.store/Sites-BB-PT-Site/pt_PT/DQESingle-ValidateAddress";
Widgets.widgetExecutions.overlay.push('shippingFormSubmit');
Widgets.registered['shippingFormSubmit'] = function () {
var checkoutForm = $("form[name$='_singleshipping']");
checkoutForm.submit();
};
var DQEValidator = function(config) {
// Custom site preferences - DQE Options (load the prefs)
var options = {
proxyUrl : app.DqeProxyUrl // DW-Server Proxy Url - DqeProxyUrl
, phoneCheckEnabled : app.DqePhoneCheckEnabled // Enabled or disabled the phone number Check - DqePhoneCheckEnabled
, phoneAutocheck : app.DqePhoneAutocheck // When this parameter is at true, checking is launched automatically as soon as the phone entry field is left - DqePhoneAutocheck
, phoneNumberFormat : app.DqePhoneNumberFormat // Format 1: "+33 3 39 89 88 71", 2: "0033 3 39 89 88 71", 3: "+33339898871", 4: "0033339898871" - DqePhoneNumberFormat
, addressCheckEnabled : app.DqeAddressCheckEnabled // Enabled or disabled the address Check - DqeAddressCheckEnabled
, clientRNVPCheckEnabled : app.DqeClientRNVPCheckEnabled// Enabled or disabled the client side RNVP address check - DqeClientRNVPCheckEnabled
, citySearch : 0//app.DqeCitySearch // 0 or 1 (if this parameter is present and is 1, it is possible to search for a postal code from the city field) - DqeCitySearch
, zipPatterns : app.DqeZipPatterns // Global Preference that holds the Regular expressions to test if a postal code has been entered to start searching for cities. Overwrites the internal zip patterns.
, searchDelay : app.DqeSearchDelay // The delay in milliseconds between when a keystroke occurs and when a ajax search is performed. DqeSearchDelay
, singleSearchDelay : app.DqeSingleSearchDelay // The delay in milliseconds between when a keystroke occurs and when single line address search is performed. DqeSingleSearchDelay
}
var HASH = "#"; // if you write # directly, it ends in an unrecognised error.
// gets the form id
var getFormId = function(){
//return '#RegistrationForm';
var formId = HASH + $(HASH + config.address1FieldID).closest('form').attr('id');
return formId;
};
// gets the field prefix
var getFieldIdPrefix = function(){
//return '#dwfrm_profile_address_';
var prefix = HASH + config.address1FieldID.replace('address1','');
return prefix;
};
// set some vars and form field id's
var form_id = getFormId()
, prefix = getFieldIdPrefix()
, firstName_id = prefix + 'firstName'
, lastName_id = prefix + 'lastName'
, address1_id = prefix + 'address1'
, address2_id = prefix + 'address2'
, address3_id = prefix + 'address3'
, province_id = prefix + 'stateCode'
, zip_id = prefix + 'zip'
, city_id = prefix + 'city'
, countryCode_id = prefix + 'countryCode'
, phone_id = prefix + 'phone'
, email_id = prefix + 'email'
, dqeSingleClass = '.dqeSingle'
;
// add a hidden form field for submitting the address hash
var adrhash_id = prefix + 'adrhash';
$(form_id).append('');
$(form_id).append('');
// create the addressHash and stores in a hidden form field
var createAddressHash = function() {
// there is a problem with the URI encoding. client and server side it's not the same encoding result.
// therefore we can't use a client side hash to compare with the server side hash.
// instead we use 'SUCCESS'
$(adrhash_id).val('SUCCESS');
};
// removes the addressHash from the hidden form field
var removeAddressHash = function() {
$(adrhash_id).val('');
};
// init phone check // Please note the same logic exists under DQE/JSWidget.isml
// Country code field is required on the page for the validations to be working, phone numbers are validated for specific country
if (options.phoneCheckEnabled && $(countryCode_id).length) {
$(phone_id).off('input change');
var dqe_phone = $(phone_id).dqephone({
server: options.proxyUrl
, autocheck: options.phoneAutocheck
, country: countryCode_id
, format: 2 // we get only format 2, because we change the output ourselves
// input: "0033 3 39 89 88 71"
// output: "+33 3 39 89 88 71"
//, format: options.phoneNumberFormat // 0: Numerals only, 1: With separators, 2: Basic international, 3: Full international
});
var _phone_id = phone_id.replace(HASH, '');
var _id_phone_status = 'id_phone_status_' + config.context;
var id_phone_status = HASH + _id_phone_status;
//Append this only once, with presumptions that autocomplete hook could be loaded on more than one form in the page and get appended multiple times
//and that we might have only one phone field in one page
if (!$('#' + _id_phone_status).length) {
$(phone_id).parent().append('');
}
// we detach the phone validation and create a new one, form.validation.js must be load before app.js
$(phone_id).removeClass('phone'); // detach the 'phone' validation method
$(phone_id).addClass(_phone_id);
$.validator.addMethod(_phone_id, function(phone) {
if (!$(phone_id).hasClass('errorclient')) return true;
return false;
}, app.resources.INVALID_PHONE );
dqe_phone.on('checking', function() {
$(id_phone_status).attr('style','color:grey;');
$(id_phone_status).html("Checking");
}).on('checked', function(ui, data) {
$(id_phone_status).attr('style','');
if (data.status) { // ok = status = 1
$(phone_id).addClass('valid');
$(phone_id).removeClass('errorclient');
// Format 1: "+33 3 39 89 88 71", 2: "0033 3 39 89 88 71", 3: "+33339898871", 4: "0033339898871"
var newPhoneNumber = data.output;
if (options.phoneNumberFormat == 2 || options.phoneNumberFormat == 4) { // replacing leading '+' with '00'
newPhoneNumber = newPhoneNumber.replace(/[+]/g, '00');
}
if (options.phoneNumberFormat == 3 || options.phoneNumberFormat == 4) { // removes all spaces
newPhoneNumber = newPhoneNumber.replace(/-|\s/g, '');
}
$(phone_id).val(newPhoneNumber);
$(id_phone_status).html('');
} else { // nok = status = 0
$(phone_id).removeClass('valid');
$(phone_id).addClass('errorclient');
$(id_phone_status).html(app.resources.INVALID_PHONE);
}
}).on("keypress", function() {
$(phone_id).removeClass('errorclient');
$(id_phone_status).html('');
}).on("change", function() {
$(phone_id).removeClass('errorclient');
$(id_phone_status).html('');
});
}
//Work with address1 only if we have the field and the address check pref enabled
if (options.addressCheckEnabled && $(address1_id).length) {
$(address1_id).attr('data-ui-autocomplete','true');
var dqe_address = $(address1_id).dqe({
server : options.proxyUrl
, country : countryCode_id
, zip : zip_id
, city : city_id
, street : address1_id
, prov : province_id
, 'compl' : address2_id
, 'city_search' : options.citySearch
, single : address1_id
, searchDelay : options.searchDelay
, singleSearchDelay : options.singleSearchDelay
, minLengthForSuggestions : 5
});
$(zip_id).off('input change');
//Workaround to disable browser autofill on address1, so it doesnt mess with DQE Address Suggestions
$(address1_id).attr('autocomplete','disabled');
$(dqeSingleClass).attr('disabled', true);
if(config.context !== 'shipping') {
$(dqeSingleClass).attr('disabled', false);
}
if($(address1_id).val().trim().length > 0) {
$(dqeSingleClass).attr('disabled', false);
}
$('.ui-autocomplete .ui-menu-item').live('click', function() {
$(dqeSingleClass).attr('disabled', false);
});
var _id_address_status = 'id_address_status_' + config.context;
var id_address_status = HASH + _id_address_status;
$(address1_id).parent().append('');
/*
10 Address correct
20 Address correct (street not recognized, but this concerns a CEDEX or post office box)
21 Town, facade number outside limits
22 Town, facade number absent (the rest of the address is correct)
23 City, facade number outside limits
24 City, facade number absent (the rest of the address is correct)
25 If CEDEXA activated, CEDEX address unknown by CEDEXA
30 Town, street not recognized
31 Town, street not recognized (neighborhood recognized but unable to determine street)
40 Town, street absent (neighborhood recognized but unable to determine street)
41 Town, street absent
50 City, street not recognized
51 City, street not recognized (neighborhood recognized but unable to determine street)
60 City, street absent (neighborhood recognized but unable to determine street)
61 City, street absent
70 PC/City cannot be corrected (street exists)
80 PC/City cannot be corrected (street does not exist)
90 International address detected
*/
// only called if clientRNVPCheckEnabled = true
var callback_checkAddress_func_name = 'callback_checkAddress_' + config.context;
window[callback_checkAddress_func_name] = function(data) {
//console.log('callback_checkAddress called: data:' + data.data +', error:' + data.error + ', label:' + data.label);
var code = data.data;
var hasError = false;
switch(code) {
default: break;
case 10: case 20:
//console.log('address ok');
$(id_address_status).removeClass('errormessage');
$(id_address_status).html('');
createAddressHash();
break;
case 21: case 22: case 23: case 24: case 25:
//console.log('warning address not ok');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(app.resources.INVALID_ADDRESS);
createAddressHash();
hasError = true;
break;
case 30: case 31: case 40: case 41: case 50: case 51: case 60: case 61: case 70: case 80: case 90:
//console.log('address not ok');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(app.resources.INVALID_ADDRESS);
removeAddressHash();
hasError = true;
break;
}
if(hasError && $(form_id).valid()) {
app.showProgress();
app.ajax.load({
url: app.URLs.DQEValidationOverlay,
async: false,
callback: function (response) {
response = $.trim(response);
if (!response || response === '') {
$(form_id).submit();
} else {
$.colorbox({
html: response,
maxWidth: '635',
fixed: true,
className: 'DqeValidation-colorbox',
onComplete: function () {
app.hideProgress();
Widgets.initSome($("#cboxLoadedContent"), ['ajaxform']);
$(".btn_canceladdress").prop('type', 'button').on("click", function (e) {
e.preventDefault();
$.colorbox.close();
});
$.colorbox.resize();
return false;
}
});
}
}
});
return false;
} else {
$(".widget_addressValidation").unbind('click');
$(form_id).submit();
return true;
}
};
}
if (options.clientRNVPCheckEnabled) {
$(".widget_addressValidation").click(function (event) {
//No validation if there is selected store pickup address
if(!$('.js-selected-store-address').is(':visible')) {
event.preventDefault();
dqe_address.check(callback_checkAddress_func_name);
}
});
}
};
$(document).on('dqeSingle', function() {
var config = myEval($('.w_DQEAddressCompletion_initialized').data('config'));
if (config) {
new DQEValidator(config);
}
});
// filling the year select
var maxYear = ((new Date).getFullYear()) - 12;
var yearSelect = $('#dwfrm_signup_birthdayfields_year');
for (i = maxYear; i > 1896; i--){
yearSelect.append('');
}
/*
// preselect the fields
$( '#dwfrm_signup_birthdayfields_day option[value=' + daySelect.attr('data-targeted-value') + ']').attr('selected','selected');
$( '#dwfrm_signup_birthdayfields_month option[value=' + monthSelect.attr('data-targeted-value') + ']').attr('selected','selected');
*/
$('#dwfrm_signup_birthdayfields_year option[value="' + yearSelect.attr('data-targeted-value') + '"]').attr('selected','selected');
// set up the interest checkboxes from DW profile.custom.interests
var interests = ''.split(',');
if (interests != '') {
for (var i = 0; i < interests.length; i++) {
$('#dwfrm_signup_'+interests[i]).prop('checked', 'checked');
}
}
// check or uncheck all checkboxes
$("#dwfrm_signup_all").bind("change", function () {
$('.form-interests input:checkbox').prop('checked', this.checked);
});
// fill the hidden form field selectedInterests
$(".form-interests input:checkbox").bind("change", function () {
var target = $('#dwfrm_signup_selectedInterests');
if ($(this).attr('name') != $("#dwfrm_signup_all").attr('name')) $("#dwfrm_signup_all").prop('checked', '');
target.attr('value', '');
$('.form-interests input:checkbox').each(function ( index, value ) {
//if( value.checked && $(value).attr('name')!='dwfrm_signup_all') {
if( value.checked ) {
if ( target.attr('value') == "" ) target.attr('value', target.attr('value') + ',' + $(value).attr('name') + ',');
else target.attr('value', target.attr('value') + $(value).attr('name') + ',' );
}
});
target.attr('value', target.attr('value').replace(new RegExp('dwfrm_signup_', 'g'), '') );
target.attr('value', target.attr('value').substring(1, target.attr('value').length - 1) );
});