//resources
app.siteDefaultLocale = "pt-PT";
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 recognised",
app.resources.DOB_INCOMPLETE = "The date of birth is incomplete.";
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"] ="Province";
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_EMPTY_RESULT"] = "No results found"
//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-RX-PT-Site/pt_PT/Account-LoyaltyGetTcAcceptationValue";
app.resources.loyalty.setCustomerAcceptationUrl = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-LoyaltySetTcAcceptationValue";
app.resources.loyalty.getTcAcceptationPop = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-LoyaltyGetTcAcceptationPopup";
app.resources.loyalty.saveCustomerEmailUrl = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-LoyaltySaveCustomerEmail";
//Store pickup page
app.resources.storepickup = {};
app.resources.storepickup.storesicon = "https://www.roxy.pt/on/demandware.static/Sites-RX-PT-Site/-/default/dw009547d0/images/icons/pushpin.png";
app.resources.storepickup.selectlabel = "Select";
app.resources.storepickup.storeicons_url = "/on/demandware.static/-/Sites-RX-PT-Library/pt_PT/v1541905297270/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 = "38bb2962-3bb4-46ab-8068-d9840d414ba4";
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-RX-PT-Site/-/default/dw679134b0/images/icons/stores-icon.png";
app.resources.storelocator.outletsicon = "/on/demandware.static/Sites-RX-PT-Site/-/default/dw147f5503/images/icons/outlets-icon.png";
app.resources.storelocator.boardridersclubicon = "/on/demandware.static/Sites-RX-PT-Site/-/pt_PT/v1541905297270/images/icons/boardridersclub-icon.png";
app.resources.storelocator.dealersicon = "/on/demandware.static/Sites-RX-PT-Site/-/default/dw883b08f6/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}}';
app.resources.storelocator.storeLocatorFilterOnline = "true";
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-RX-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-RX-PT-Site/-/default/dw1bebffbb/images/loading-progress-98x22.gif";
// PDP
app.resources["SAVED_FOR_LATER"] = "Saved in your wishlist";
app.resources["SAVE_FOR_LATER"] = "Save";
app.resources["PHONE_REGEXP"] = /^[+]*([-0-9][ ]*){7,20}$/;
app.resources["PHONE_MASK"] = "";
app.resources["PHONE_MULTIPLEMASKS"]= [0];
app.resources["PHONE_PLACEHOLDER"] = "0";
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";
//The follow snippet is executed to pass some Demandare URLs into the script
app.minicart.url = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Cart-MiniAddProduct";
app.URLs.addProductToCart = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Cart-AddProduct";
app.URLs.wishlistAddress = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Wishlist-SetShippingAddress?AddressID=";
app.URLs.SetShippingContext = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Hooking-SetShippingContext";
app.URLs.SetLocalization = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Geolocation-SetLocalization";
// S.E.O links scripting
app.URLs.userLogin = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-Show";
app.URLs.userRegister = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-StartRegister";
app.URLs.sizeChartShow = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/SizeChart-Show";
app.URLs.accountShow = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Account-Show";
app.URLs.contactUs = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/CustomerService-ContactUs";
app.URLs.logOut = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Login-Logout";
app.URLs.getShippingMethodsList = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/COShipping-UpdateShippingMethodList";
app.URLs.updateOrderTotals = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/COBilling-UpdateOrderTotals";
app.URLs.storeBillingAddress = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/COShipping-StoreUnsavedBillingAddress";
app.URLs.getProductUrl = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Product-Show";
app.URLs.searchUrl = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Search-Show";
app.URLs.getVariants = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Product-GetVariants";
app.URLs.getAvailability = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Product-GetAvailability";
app.URLs.loadingSmallImg = "/on/demandware.static/Sites-RX-PT-Site/-/default/dwa70bd09f/images/loading-small.gif";
app.URLs.formatMoney = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Product-FormatPrices";
app.URLs.removeImg = "/on/demandware.static/Sites-RX-PT-Site/-/default/dwffb20893/images/icon_remove.gif";
app.URLs.searchsuggest = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Search-GetSuggestions";
app.URLs.submitDialogURL = 'https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Page-AppResources/C180089966';
app.URLs.productNav = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Product-Productnav";
app.URLs.SeverConnectionError = "Server connection failed!";
app.URLs.quickview_product_url = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Proxy-Product2JSON";
app.URLs.PIConfirmDelete = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/PaymentInstruments-ConfirmDelete";
app.URLs.addressConfirmDelete = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Address-ConfirmDelete";
app.URLs.pageInclude = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/Page-Include";
app.URLs.findInStoreTemplate = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/FindInStore-Show";
app.URLs.findInStoreSearch = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/FindInStore-ProductSearch";
app.URLs.findInStoreLineItems = "/on/demandware.store/Sites-RX-PT-Site/pt_PT/FindInStore-DisplayStores";
app.URLs.cartShow = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/Cart-Show";
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-RX-PT-Site/pt_PT/Home-GetOtherRegionsWebsiteJSON";
// DQE - Preferences
app.DqeProxyUrl = "https://www.roxy.pt/on/demandware.store/Sites-RX-PT-Site/pt_PT/DQE-Proxy";
app.DqeEmailCheckEnabled = true;
app.DqePhoneCheckEnabled = true;
app.DqeAddressCheckEnabled = true;
app.DqeClientRNVPCheckEnabled = false;
app.DqeEmailAutocheck = true;
app.DqeEmailSuggest = true;
app.DqePhoneAutocheck = true;
app.DqePhoneNumberFormat = 4;
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": "^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJ-NPRSTV-Z][ ]?\\d[ABCEGHJ-NPRSTV-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))$",
"IE": "^[A-Za-z]\\d{2}\\s[A-Za-z\\d]{4}$",
"SE": "^(SE)?-?\\d{3} ?\\d{2}$"
};
//Geolocation references
app.resources["GEO_COUNTRY_CODE"] = "PT";
app.resources["SHIP_TO_COUNTRY_CODE"]= "PT";
app.globalRedirectURL = "null";
// 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-RX-PT-Site/pt_PT/AbandonedCart-StoreEmail",
storeNpkUrl : "/on/demandware.store/Sites-RX-PT-Site/pt_PT/AbandonedCart-StoreNpk"
};
// Country Context Preferences
// switched on or off via site preference > general > Site Configuration
app.resources.categoryContext = {
enabled: false,
setCategoryContextUrl: "/on/demandware.store/Sites-RX-PT-Site/pt_PT/CategoryContext-Set",
cookieName: "brCategoryContext",
contextUrls: {"roxy-women":"/roxy-women/","collections":"/moda-senhora/","clothing":"/senhora-vestuario/","swim":"/swimwear/","accessories":"/acessorios-senhora/","shoes":"/calcado-senhora/","outdoor-fitness":"/fitness/","surf":"/surf/","wetsuits":"/steamer/","snow":"/snow/","kids":"/crianca/","blog":"/blog/","sales":"/saldos/","good-deals":"/good-deals/","offre_speciale":"/ofertas-especiais/","christmas-shop":"/natal/","fit-guide":"/fit-guide/","size-chart":"/size-chart/","gift-card":"/gift-card/","offre_speciale_blackfriday":"/black-friday/"}
};
// 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.",
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);
if (app.PageContext.pageType === 'StoreFront') {
console.log('Redirect to saved category context page');
window.location.href = app.resources.categoryContext.contextUrls[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'));
//console.log('start DQEAddressCompletion');
//console.log('address1FieldID: ' + config.address1FieldID);
//console.log('context: ' + config.context);
var dv_shipping, dv_billing;
if (config.context == 'shipping') {
dv_shipping = new DQEValidator(config);
} else {
config.context = 'billing';
dv_billing = new DQEValidator(config);
}
};
var DQEValidator = function(config) {
// console.log('run DQEValidator - ' + config.context);
// DQEValidator options -
// custom site preferences DQE Options (load the prefs)
var options = {
proxyUrl : app.DqeProxyUrl // DW-Server Proxy Url - DqeProxyUrl
, emailCheckEnabled : app.DqeEmailCheckEnabled // Enabled or disabled the email Check - DqeEmailCheckEnabled
, phoneCheckEnabled : app.DqePhoneCheckEnabled // Enabled or disabled the phone number Check - DqePhoneCheckEnabled
, addressCheckEnabled : app.DqeAddressCheckEnabled // Enabled or disabled the address Check - DqeAddressCheckEnabled
, clientRNVPCheckEnabled : app.DqeClientRNVPCheckEnabled// Enabled or disabled the client side RNVP address check - DqeClientRNVPCheckEnabled
, emailAutocheck : app.DqeEmailAutocheck // When this parameter is at true, checking is launched automatically as soon as the email address entry field is left - DqeEmailAutocheck
, emailSuggest : app.DqeEmailSuggest // When this parameter is at true, automatic completion of the address being entered is triggered: valid e-mail values are suggested to the user during entry - DqeEmailSuggest
, 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
, 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 + 'province'
, zip_id = prefix + 'zip'
, city_id = prefix + 'city'
, countryCode_id = prefix + 'countryCode'
, phone_id = prefix + 'phone'
, email_id = prefix + 'email'
, emailconfirm_id = prefix + 'emailconfirm'
;
// 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.
/*
var zip = $(zip_id).val()
, city = $(city_id).val()
, street = $(address1_id).val()
, compl = $(address2_id).val()
, prov = $(province_id).val()
;
var addr = compl + "|" + street + "|" + prov + "|" + zip + "|" + city;
var str = addr.toLowerCase();
str = str.replace(/ä/g, "ae");
str = str.replace(/ö/g, "oe");
str = str.replace(/ü/g, "ue");
str = str.replace(/ß/g, "ss");
str = encodeURIComponent(str);
var addressHash = b64_md5(str);
$(adrhash_id).val(addressHash);
*/
// instead we use 'SUCCESS'
$(adrhash_id).val('SUCCESS');
};
// removes the addressHash from the hidden form field
var removeAddressHash = function() {
$(adrhash_id).val('');
};
//console.log('form_id: ' + form_id);
//console.log('zip_id: ' + zip_id);
//console.log('city_id: ' + city_id);
//console.log('address1_id: ' + address1_id);
// ---------------------------------------------------
// init email check
if (options.emailCheckEnabled && !($(email_id).hasClass('dqeValidated'))) {
$(email_id).addClass('dqeValidated'); // mark field as dqeValidated
/* DQE tests if attrib 'data-ui-autocomplete' on the city field to show the autocomplete on focus.
To fix this problem, we add the attrib to the fields with autocomplete.
$(email_id).attr('data-ui-autocomplete','true');
*/
$(email_id).attr('data-ui-autocomplete','true');
var dqe_email = $(email_id).dqemail({
server: options.proxyUrl
, autocheck: options.emailAutocheck
, suggest: options.emailSuggest
, last_name: lastName_id
, first_name: firstName_id
});
var _email_id = email_id.replace(HASH, '');
var _id_email_status = 'id_email_status_' + config.context;
var id_email_status = HASH + _id_email_status;
$(email_id).parent().append('');
// we detach the email validation and create a new one, form.validation.js must be load before app.js
//$(email_id).removeClass('email'); // detach the 'email' validation method. class email iss needed, because initLoyaltyRegister in 005_account cannot get the email
$(email_id).addClass(_email_id);
dqe_email.on('checking', function() {
//console.log('checking');
$(id_email_status).attr('style','color:grey;');
$(id_email_status).html("Checking");
}).on('checked', function(ui, data) {
//console.log('checked - code: ' + data.code);
/*
91: Syntax error
92: Unknown domain
93: Blacklisted domain
94: E-mail address considered to be spam
99: Service not available
02: E-mail address not found for this domain
01: E-mail correct but name could not be checked
00: Valid e-mail
*/
$(id_email_status).attr('style','');
var code = data.code+'';
switch(code) {
default: break;
// ACCEPTED
case '00': case '99':
//console.log('email - accepted - code: ' + data.code);
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html('');
break;
// ACCEPTED WITH WARNING
case '01': case '02':
//console.log('email - accepted with warning - code: ' + data.code);
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html(app.resources.EMAIL_WARNING);
break;
// NOT ACCEPTED
case '91': case '92': case '93': case '94':
//console.log('email - not accepted - code: ' + data.code + ' msg: ' + data.msg);
$(email_id).removeClass('valid');
$(email_id).addClass('errorclient');
$(id_email_status).html(app.resources.INVALID_EMAIL);
break;
}
}).on("keypress", function() {
//console.log('keypress');
$(email_id).addClass('valid');
$(email_id).removeClass('errorclient');
$(id_email_status).html('');
});
/*
// we do not need the emailconfirm check
$.validator.addMethod('emailconfirmignorecase', function(phone) {
if ($(emailconfirm_id).hasClass('valid')) return true;
else return false; }, ''
);
var _id_emailconfirm_status = 'id_emailconfirm_status_' + config.context;
id_emailconfirm_status = HASH + _id_emailconfirm_status;
//$(emailconfirm_id).parent().append('');
$(emailconfirm_id).on('keyup', function() {
//console.log('on keyup');
if ($(email_id).val() != $(emailconfirm_id).val()) {
$(emailconfirm_id).removeClass('valid');
$(emailconfirm_id).addClass('errorclient');
$(id_emailconfirm_status).addClass('errormessage');
$(id_emailconfirm_status).html(app.resources.EQUALTOEMAIL);
} else {
$(emailconfirm_id).addClass('valid');
$(emailconfirm_id).removeClass('errorclient');
$(id_emailconfirm_status).html('');
$(id_emailconfirm_status).removeClass('errormessage');
}
});
*/
}
// ---------------------------------------------------
// init phone check
if (options.phoneCheckEnabled) {
var dqe_phone = $(phone_id).dqephone({
server: options.proxyUrl
, autocheck: options.phoneAutocheck
, country: countryCode_id
, format: 2 // we get only formtat 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;
$(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 );
/* not used
var callback_phoneCheck_func_name = 'callback_phone_' + config.context;
window[callback_phoneCheck_func_name] = function(data) {
//console.log('callback_phone: ' + config.context + ' - dqe_phone checked: ' + data.status);
};
*/
dqe_phone.on('checking', function() {
$(id_phone_status).attr('style','color:grey;');
$(id_phone_status).html("Checking");
}).on('checked', function(ui, data) {
//console.log('dqe_phone checked: ' + data.status);
$(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() {
if ( $(phone_id).val() ) {
//dqe_phone.check(callback_phoneCheck_func_name, 1, $(phone_id).val());
} else {
$(phone_id).removeClass('errorclient');
$(id_phone_status).html('');
}
});
}
// ---------------------------------------------------
// init address check
if (options.addressCheckEnabled) {
/* DQE tests if attrib 'data-ui-autocomplete' on the city field to show the autocomplete on focus.
To fix this problem, we add the attrib to the fields with autocomplete.
$(city_id).attr('data-ui-autocomplete','true');
*/
$(zip_id).attr('data-ui-autocomplete','true');
$(city_id).attr('data-ui-autocomplete','true');
$(address1_id).attr('data-ui-autocomplete','true');
$(address2_id).attr('data-ui-autocomplete','true');
$(province_id).attr('data-ui-autocomplete','true');
var dqe_address = $(form_id).dqe({
server : options.proxyUrl
, country : countryCode_id
, zip : zip_id
, city : city_id
, street : address1_id
, prov : province_id // only for IT
, 'compl' : address2_id
, 'city_search' : options.citySearch
, single : address3_id // dedicated address search field
, searchDelay : options.searchDelay
, singleSearchDelay : options.singleSearchDelay
//, neighbourhood : 0
//, neighboursize : 100
//, local : '#id_local'
//, company : '#id_company'
//, geoloc : "callback_geoloc1"
//, realtime_override : 1 // ? nothing found about this param
});
// update DQE internal zip patterns with the global preference DqeZipPatterns
var updateZipPatterns = function(dqe) {
for (var key in options.zipPatterns) {
dqe.zip_pattern[key] = options.zipPatterns[key]
}
};
//for (var key in dqe_address.zip_pattern) { console.log(key + ': ' + dqe_address.zip_pattern[key]); }
updateZipPatterns(dqe_address);
var _id_address_status = 'id_address_status_' + config.context;
var id_address_status = HASH + _id_address_status;
$(address1_id).parent().append('');
setField_ok= function(field_id, message) {
$(field_id).removeClass('errorclient');
$(field_id).addClass('valid');
$(id_address_status).removeClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
setField_error = function(field_id, message) {
$(field_id).removeClass('valid');
$(field_id).addClass('errorclient');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
setField_warn = function(field_id, message) {
$(field_id).addClass('errorclient');
$(id_address_status).addClass('errormessage');
$(id_address_status).html(message);
$(id_address_status).css('display', 'block');
}
dqe_address.on("override", function(event) {
if (!$(zip_id).val() || !$(address1_id).val()) {
$(id_address_status).html('');
} else {
var override = dqe_address.override();
//console.log('on override: ' + override.zip + '/' + override.city + '/' + override.street + ' -- "' + config.context + '"');
if (override.zip && !$(zip_id).val()) { setField_error(zip_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(zip_id, ''); }
if (override.city && !$(city_id).val()) { setField_error(city_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(city_id, ''); }
if (override.street && !$(address1_id).val()) { setField_error(address1_id, app.resources.INVALID_ADDRESS); }
else { setField_ok(address1_id, ''); }
/*
var error = override.zip || override.city || override.street;
if (error) {
if (override.zip) setField_error(zip_id, app.resources.INVALID_ADDRESS);
if (override.city) setField_error(city_id, app.resources.INVALID_ADDRESS);
if (override.street) setField_error(address1_id, app.resources.INVALID_ADDRESS);
removeAddressHash();
} else {
if (!override.zip) setField_ok(zip_id, '');
if (!override.city) setField_ok(city_id, '');
if (!override.street) setField_ok(address1_id, '');
createAddressHash();
}
*/
}
});
// the input order of the address is zip, city, address1, address2, then suggestions are available.
// If the address already been entered and you click on city or street, there are no suggestions available.
// This needs to be handled. (ECOM-6011)
var key = '';
// handles a click in the city field after reloading (outside of the input order)
dqe_address.city.on("click", function(event) {
if ( ($(zip_id).val() && !$(city_id).val()) || (!options.citySearch) ) {
var new_key = 'cityclick_'+$(zip_id).val();
if (key === new_key) return;
key = new_key;
dqe_address.show_cities(event, true);
}
/*
if ( $(zip_id).val() ) {
dqe_address.show_cities(event, true);
} else if ( !$(zip_id).val() && $(city_id).val() && options.citySearch) {
//dqe_address.show_cities(event, true);
dqe_address.search_cities();
}
*/
});
// handles a click in the street field after reloading (outside of the input order)
dqe_address.street.on("click", function(event) {
if ( $(zip_id).val() && $(city_id).val() && $(address1_id).val()) {
var new_key = 'streetclick_'+$(zip_id).val()+$(city_id).val()+$(address1_id).val();
if (key === new_key) return;
key = new_key;
// get the current_city_id and call show_streets()
var url = dqe_address.url({fn: 'CP', CodePostal: $(zip_id).val(), Alpha: 'false', Instance: 0, Pays: dqe_address.selected_country()});
dqe_address.ajax(url, function(result) {
if (result) {
var i = 1;
while (result[i]) {
//var cityName = dqe_address.trim(result[i]["Localite"]);
if ($(city_id).val() === result[i]["Localite"]) {
dqe_address.current_city_id = result[i]["IDLocalite"];
dqe_address.show_streets(true);
}
i++;
}
}
});
}
});
/*
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;
switch(code) {
default: break;
case 10: case 20:
//console.log('address ok');
$(id_address_status).removeClass('errormessage');
$(id_address_status).html('');
$(id_address_status).css('color', '#000');
$(id_address_status).css('display', 'block');
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);
$(id_address_status).css('color', '#070');
$(id_address_status).css('display', 'block');
createAddressHash();
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);
$(id_address_status).css('color', '#c00');
$(id_address_status).css('display', 'block');
removeAddressHash();
break;
}
};
// submit
$(form_id).on("submit", function() {
//console.log('submit');
if (options.clientRNVPCheckEnabled) {
dqe_address.check(callback_checkAddress_func_name);
}
return false;
});
}
};
// 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) );
});
// EULERIAN TAG MASTER
// OLD EATM_addtocart_collector function, renamed for more global name
function tag_container_addtocart_collector(response) {
var EA_minicart_added_product = $(response).filter('#EA_minicart_added_product');
if (EA_minicart_added_product) {
var prd_name = EA_minicart_added_product.data('name');
var prd_pid = EA_minicart_added_product.data('pid');
var prd_price = EA_minicart_added_product.data('price');
var prd_scart = EA_minicart_added_product.data('scart');
var prd_scartcumul = EA_minicart_added_product.data('scartcumul');
var prd_amount = EA_minicart_added_product.data('amount');
var prd_quantity = EA_minicart_added_product.data('quantity');
var prd_IDcolor = EA_minicart_added_product.data('IDcolor');
EA_response = EA_collector([ 'path', '/mini-panier' ]
,"scart", prd_scart
,"scartcumul", prd_scartcumul
,"amount", prd_amount
,"prdref",prd_pid
,"prdname",prd_name
,"prdamount",prd_price
,"prdquantity",prd_quantity
,"IDcolor",prd_IDcolor
);
}
}
// add widget to execution pipe
Widgets.widgetExecutions['checkout'].push('gcSmartSelect');
// the actual select widget
Widgets.registered['gcSmartSelect'] = function(elem) {
// if this widget is included, we are adding the google capcha script, not before
DOMUtils.addAsyncScript("https://www.google.com/recaptcha/api.js?hl=" + app.constants.SITE_LANGUAGE , 'google-recaptcha');
var fidField = elem.find('#dwfrm_billing_giftcardredeem_fidelityCardNumber').closest('.formfield')
, gcField = elem.find('#dwfrm_billing_giftCertCode')
, verifyButton = $('.verifygiftcard')
, simpleWidth = gcField.width()
, wideWidth = simpleWidth * 2 - verifyButton.width()
, applyButton = $('.applygiftcard')
, pinButton = $('.cardpin')
, checkCard = function (cardId) {
if (cardId.length === 8) {
return 'cegid';
} else if (cardId.length === 19) {
return 'svs'
} else {
return 'invalid';
}
}
, isMobile = function () {
return document.documentElement.clientWidth < 737;
}
, current_radio_val = function(){
return $('.gift-card input[type="radio"]:checked').val();
}
, radio_change = function(){
if (current_radio_val() == 'CEGID_GIFT_CARD') {
verifyButton.show();
if (isMobile()) {
verifyButton.css('margin-top', '10px');
verifyButton.find('button')[0].style.setProperty('margin', '0');
}
applyButton.hide();
fidField.hide();
} else {
verifyButton.hide();
pinButton.hide();
$('#CEGID_GIFT_CARD_multiple').hide();
$('.applygiftcard').show();
fidField.show();
}
}
, verify_number = function () {
var valid = true;
// we only validate, in case ther is actualy a value - this field is not rquired
if (current_radio_val() == 'CEGID_GIFT_CARD' && gcField.val()) {
if (checkCard(gcField.val()) == 'cegid') {
$('#CEGID_GIFT_CARD_multiple').show();
applyButton.show();
pinButton.hide();
$('.pin-information').hide();
gcField.width(wideWidth - 14);
verifyButton.hide();
// enable validation again
$('.giftcard-registrationform input').removeClass('ignore');
} else if (checkCard(gcField.val()) == 'svs') {
$('#CEGID_GIFT_CARD_multiple').hide();
applyButton.show();
pinButton.show();
$('.pin-information').show();
verifyButton.hide();
// we make the registration form ignore to pass the validation
$('.giftcard-registrationform input').addClass('ignore');
} else {
$('#CEGID_GIFT_CARD_multiple').hide();
$('.pin-information').hide();
valid = false;
}
}
return valid
}
;
$.validator.addMethod("multi-giftcard", verify_number, app.resources.GIFTCARD_CAN_NOT_BE_VALIDATED);
// ignore validation on pageload to enable cc only payments
$('.giftcard-registrationform input').addClass('ignore');
verifyButton.click(function(){
gcField.valid();
});
elem.find('input[type="radio"]').change(radio_change);
// init the field in case of error
radio_change();
};