{"version":3,"file":"app.min.js","sources":["app.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i= 40) {\n year += 2000;\n month -= 40;\n } else if (month >= 20) {\n year += 1800;\n month -= 20;\n } else {\n year += 1900;\n }\n\n date.year = year;\n date.month = month;\n date.day = day;\n\n return date;\n }\n\n function isValidDate(y, m, d) {\n var date = new Date(y, m - 1, d);\n return date && \n (date.getMonth() + 1) == m && date.getDate() == Number(d) &&\n checkGregorianCalendarFirstAdoption(y, m, d);\n }\n\n // Gregorian calendar adoption in 1916 in Bulgaria\n // 31/03/1916 > +13 days > 14/04/1916\n function checkGregorianCalendarFirstAdoption(year, month, day){\n if (year === 1916 &&\n month === 4 &&\n day <= 13){\n return false;\n }else{\n return true;\n } \n }\n\n function computeCheckSum(egn){\n var checkSum = 0;\n var weights = [2,4,8,5,10,9,7,3,6];\n\n for (var i = 0; i < weights.length; ++i) {\n checkSum += weights[i] * Number(egn.charAt(i));\n }\n\n checkSum %= 11;\n checkSum %= 10;\n\n return checkSum;\n }\n\n function isValidCheckSum(checkSum, egn){\n return checkSum === Number(egn.charAt(9));\n }\n \n /**\n * Check Croatian OIB (Unique citizenship number) codes for validity ( ISO 7064 ).\n * EGN examples: 99570283858, 86005927425\n * For further details: @link https://ec.europa.eu/taxation_customs/tin/pdf/it/TIN_-_country_sheet_HR_it.pdf\n *\n * @param {String} oibCode\n * @return {Boolean}\n */\n function validateCroatianOIB(oibCode) {\n \tvar checkDigit, num;\n\n \tvar code = oibCode.toString();\n\n \tif (code.length === 13 && code.substr(0, 2).toUpperCase() === 'HR') {\n \t\tcode = code.substr(2, 11);\n \t} else if (code.length !== 11) {\n \t\treturn false;\n \t}\n\n \tvar numCheck = parseInt(code, 10);\n \tif (isNaN(numCheck)) {\n \t\treturn false;\n \t}\n\n \tnum = 10;\n \tfor (var i = 0; i < 10; i++) {\n \t\tnum = num + parseInt(code.substr(i, 1), 10);\n \t\tnum = num % 10;\n \t\tif (num === 0) {\n \t\t\tnum = 10;\n \t\t}\n \t\tnum *= 2;\n \t\tnum = num % 11;\n \t}\n\n \tcheckDigit = 11 - num;\n \tif (checkDigit === 10) {\n \t\tcheckDigit = 0;\n \t}\n \t\n \treturn parseInt(code.substr(10, 1), 10) === checkDigit;\n }\n \n /**\n * Check Romanian CNP (Cod Numeric Personal) codes for validity ( ISO 7064 ).\n * EGN examples: 3130827011013, 1900920370892\n * \n * For further details: @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec\n * \t\t\t\t\t\t@link https://ro.wikipedia.org/wiki/Cod_numeric_personal\n * \t\t\t\t\t\t@link https://ec.europa.eu/taxation_customs/tin/pdf/it/TIN_-_country_sheet_RO_it.pdf\n *\n * @param {String} cnpCode\n * @return {Boolean}\n */\n \n function validateRomanianCNP(cnpCode) {\n \t// 0: cnp\n // 1: s (1-8)\n // 2: aa (00-99) year\n // 3: ll (01-12) month\n // 4: zz (01-31) day\n // 5: jj (1-46, 51-52)\n // 6: nnn (001-999) serial number\n var m = /^([1-8])(0[1-9]|[1-9][0-9])(0[1-9]|1[0-2])(\\d{2})(\\d{2})(\\d{3})(\\d)$/.exec(cnpCode);\n if (m) {\n var ll = parseInt(m[3]);\n var zz = parseInt(m[4]);\n switch (ll) {\n case 2:\n if (zz > 29) {\n return false;\n }\n case 3:\n case 4:\n case 6:\n case 9:\n case 11:\n if (zz > 30) {\n return false;\n }\n default:\n if (zz > 31) {\n return false;\n }\n }\n \n var jj = parseInt(m[5]);\n if (jj < 0 || (jj > 46 && jj < 51) || jj > 52) {\n return false;\n }\n \n var nnn = parseInt(m[6]);\n if (nnn < 0) {\n return false;\n }\n \n var multiplier = \"279146358279\";\n var sum = 0;\n for(var i = 0; i < multiplier.length; i++) {\n sum = sum + parseInt(m[0].charAt(i)) * multiplier.charAt(i);\n }\n var rest = sum % 11;\n return (((rest < 10) && (rest == m[0].charAt(12))) || ((rest == 10) && (m[0].charAt(12) == 1)));\n }\n \n return false;\n }\n \n},{}],3:[function(require,module,exports){\n /* eslint-disable */\n 'use strict';\n\n var util = require('./util'),\n ajax = require('./ajax');\n\n function pad(number) {\n if (number < 10) {\n return '0' + number;\n }\n return number;\n }\n /**\n * @function\n * @description Initializes Adyen Secured Fields Billing events\n */\n function initializeBillingEvents() {\n var isOneClick = false;\n $('#submit-payment').on('click', function (e) {\n var paymentSelected = $('.payment-method-options').find(':checked');\n var radioVal = paymentSelected.val();\n if ('CREDIT_CARD' == radioVal) {\n\n if (!window.CardValid) {\n window.AdyenCard.showValidation();\n return false;\n }\n clearCardData();\n var oneClickCard = window.AdyenOneClick;\n if (isOneClick) {\n $('#dwfrm_billing_creditCardFields_selectedCardID').val($('#adyenCreditCardList option:selected').attr('id'));\n $('#dwfrm_billing_creditCardFields_type').val($('#adyenCreditCardList option:selected').val());\n $('#dwfrm_billing_creditCardFields_adyenEncryptedSecurityCode').val(oneClickCard.state.data.encryptedSecurityCode);\n } else {\n $('#dwfrm_billing_creditCardFields_selectedCardID').val(\"\");\n copyCardData(window.AdyenCard);\n }\n } else {\n if (paymentSelected.attr(\"data-pay-type\") == \"Adyen\") {\n var selectedMethod = paymentSelected.attr(\"data-adyen-type\");\n return componentDetailsValid(selectedMethod);\n }\n }\n\n e.preventDefault();\n $('.form-data-error').html('');\n $('#billing-submit-hidden').trigger('click');\n });\n\n $('#adyenCreditCardList').on('change', function () {\n var selectedCard = $('#adyenCreditCardList').val();\n var AdyenCheckoutObject = new AdyenCheckout(window.Configuration);\n if (window.AdyenOneClick) {\n window.AdyenOneClick.unmount();\n }\n initializeOneClick(AdyenCheckoutObject, selectedCard);\n window.CardValid = false;\n if (selectedCard !== \"\") {\n isOneClick = true;\n $(\"#selectedCard\").slideDown(\"slow\");\n $(\"#newCard\").slideUp(\"slow\");\n\n } else {\n isOneClick = false;\n $(\"#selectedCard\").slideUp(\"slow\");\n $(\"#newCard\").slideDown(\"slow\");\n }\n });\n }\n\n function initializeOneClick(AdyenCheckoutObject, selectedCard) {\n var cardNode = document.getElementById('oneClickCard');\n window.AdyenOneClick = AdyenCheckoutObject.create('card', {\n // Mandatory fields\n brand: selectedCard,\n storedPaymentMethodId: \"1\",\n onChange: function (state) {\n $('#dwfrm_billing_creditCardFields_browserInfo').val(JSON.stringify(state.data.browserInfo));\n window.CardValid = state.isValid;\n }\n });\n window.AdyenOneClick.mount(cardNode);\n }\n\n function parseOpenInvoiceComponentData(state) {\n $('#dwfrm_adyPaydata_dateOfBirth').val(state.data.personalDetails.dateOfBirth);\n $('#dwfrm_adyPaydata_telephoneNumber').val(state.data.personalDetails.telephoneNumber);\n $('#dwfrm_adyPaydata_gender').val(state.data.personalDetails.gender);\n }\n\n //Check the validity of checkout component\n function componentDetailsValid(selectedMethod) {\n //set data from components\n switch (selectedMethod) {\n case \"ideal\":\n var issuerSelected = $(\".adyen-checkout__dropdown__list li[aria-selected='true']\");\n if (issuerSelected.length > 0) {\n var issuer = issuerSelected.eq(0).data('value');\n if (issuer) {\n $('#dwfrm_adyPaydata_issuer').val(issuer);\n return true;\n }\n }\n return false;\n break;\n case \"klarna\":\n if (klarnaComponent) {\n if (klarnaComponent.componentRef.state.isValid) {\n parseOpenInvoiceComponentData(klarnaComponent.componentRef.state);\n if ($('#ssnValue')) {\n $('#dwfrm_adyPaydata_socialSecurityNumber').val($('#ssnValue').val());\n }\n }\n return klarnaComponent.componentRef.state.isValid;\n } else {\n //New Klarna integration is without component\n return true;\n }\n break;\n case \"afterpay_default\":\n if (afterpayComponent.componentRef.state.isValid) {\n parseOpenInvoiceComponentData(afterpayComponent.componentRef.state);\n }\n return afterpayComponent.componentRef.state.isValid;\n break;\n case \"ratepay\":\n $('#dwfrm_adyPaydata_dateOfBirth').val($(\"#ratepay_dob\").val());\n $('#dwfrm_adyPaydata_gender').val($(\"#ratepay_gender\").val());\n return true;\n default:\n return true;\n }\n }\n\n function copyCardData(card) {\n $('#dwfrm_billing_creditCardFields_type').val(card.state.brand);\n $('#dwfrm_billing_creditCardFields_brand').val(card.state.selectedBrandValue);\n $('#dwfrm_billing_creditCardFields_adyenEncryptedCardNumber').val(card.state.data.encryptedCardNumber);\n $('#dwfrm_billing_creditCardFields_adyenEncryptedExpiryMonth').val(card.state.data.encryptedExpiryMonth);\n $('#dwfrm_billing_creditCardFields_adyenEncryptedExpiryYear').val(card.state.data.encryptedExpiryYear);\n $('#dwfrm_billing_creditCardFields_adyenEncryptedSecurityCode').val(card.state.data.encryptedSecurityCode);\n $('#dwfrm_billing_creditCardFields_owner').val(card.state.data.holderName);\n if (window.storeDetails) {\n $('#dwfrm_billing_creditCardFields_saveCard').val(window.storeDetails);\n } else {\n $('#dwfrm_billing_creditCardFields_saveCard').val(false);\n }\n }\n\n function clearCardData() {\n $('#dwfrm_billing_creditCardFields_type').val(\"\");\n $('#dwfrm_billing_creditCardFields_adyenEncryptedCardNumber').val(\"\");\n $('#dwfrm_billing_creditCardFields_adyenEncryptedExpiryMonth').val(\"\");\n $('#dwfrm_billing_creditCardFields_adyenEncryptedExpiryYear').val(\"\");\n $('#dwfrm_billing_creditCardFields_adyenEncryptedSecurityCode').val(\"\");\n $('#dwfrm_billing_creditCardFields_owner').val(\"\");\n }\n\n /**\n * @function\n * @description Initializes Adyen Checkout My Account events\n */\n function initializeAccountEvents() {\n $('#add-card-submit').on('click', function (e) {\n e.preventDefault();\n if (window.AdyenCard.isValid) {\n copyCardData(window.AdyenCard);\n $('#add-card-submit-hidden').trigger('click');\n }\n });\n }\n\n /**\n * If selectedCard is used do not encrypt the number and holderName field\n * @param selectedCard\n * @returns\n */\n function getCardData(selectedCard) {\n\n var cardData = {\n cvc: $('#creditCard_cvn').val(),\n expiryMonth: $('#creditCard_expiration_month').val(),\n expiryYear: $('#creditCard_expiration_year').val(),\n generationtime: $('#adyen_generationtime').val()\n };\n\n if (!selectedCard) {\n cardData.number = $('#creditCard_number').val();\n cardData.holderName = $('#creditCard_owner').val();\n }\n\n return cardData;\n }\n\n function maskValue(value) {\n if (value && value.length > 4) {\n return value.replace(/\\d(?=\\d{4})/g, '*');\n } else {\n return '';\n }\n }\n\n /**\n * @function\n * @description Initializes Adyen CSE billing events\n */\n\n exports.initBilling = function () {\n initializeBillingEvents();\n };\n\n exports.initAccount = function () {\n initializeAccountEvents();\n };\n\n},{\"./ajax\":4,\"./util\":79}],4:[function(require,module,exports){\n'use strict';\n\nvar progress = require('./progress'),\n util = require('./util');\n\nvar currentRequests = [];\n\n/**\n * @function\n * @description Ajax request to get json response\n * @param {Boolean} async Asynchronous or not\n * @param {String} url URI for the request\n * @param {Object} data Name/Value pair data request\n * @param {Function} callback Callback function to be called\n */\nvar getJson = function (options) {\n options.url = util.toAbsoluteUrl(options.url);\n // return if no url exists or url matches a current request\n if (!options.url || currentRequests[options.url]) {\n return;\n }\n\n currentRequests[options.url] = true;\n\n // make the server call\n $.ajax({\n dataType: 'json',\n type: options.type ? options.type : 'GET',\n url: util.appendParamToURL(options.url, 'format', 'ajax'),\n async: (typeof options.async === 'undefined' || options.async === null) ? true : options.async,\n data: options.data || {}\n })\n // success\n .done(function (response) {\n if (options.callback) {\n options.callback(response);\n }\n })\n // failed\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n }\n if (options.callback) {\n options.callback(null);\n }\n })\n // executed on success or fail\n .always(function () {\n // remove current request from hash\n if (currentRequests[options.url]) {\n delete currentRequests[options.url];\n }\n });\n};\n/**\n * @function\n * @description ajax request to load html response in a given container\n * @param {String} url URI for the request\n * @param {Object} data Name/Value pair data request\n * @param {Function} callback Callback function to be called\n * @param {Object} target Selector or element that will receive content\n */\nvar load = function (options) {\n options.url = util.toAbsoluteUrl(options.url);\n // return if no url exists or url matches a current request\n if (!options.url || currentRequests[options.url]) {\n return;\n }\n\n currentRequests[options.url] = true;\n\n // make the server call\n $.ajax({\n dataType: 'html',\n type: options.type ? options.type : 'GET',\n url: util.appendParamToURL(options.url, 'format', 'ajax'),\n data: options.data,\n async: options.async? options.async : true,\n xhrFields: {\n withCredentials: true\n }\n })\n\n .done(function (response) {\n // success\n \ttry {\n \t\tvar responseJson = JSON.parse(response.replace(/\\\\/g, \"\"));\n \t\tif(responseJson.redirect) {\n \t\t\twindow.location.href = responseJson.url;\n \t\t}\n \t} catch (e) {\n\t if (options.target) {\n\t $(options.target).empty().html(response);\n\t }\n\t if (options.callback) {\n\t options.callback(response);\n\t }\n \t}\n })\n .fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n }\n options.callback(null, textStatus);\n })\n .always(function () {\n progress.hide();\n // remove current request from hash\n if (currentRequests[options.url]) {\n delete currentRequests[options.url];\n }\n });\n};\n\nexports.getJson = getJson;\nexports.load = load;\n},{\"./progress\":66,\"./util\":79}],5:[function(require,module,exports){\n/**\n * (c) 2009-2014 Demandware Inc.\n * Subject to standard usage terms and conditions\n * For all details and documentation:\n * https://bitbucket.com/demandware/sitegenesis\n */\n'use strict';\n\nvar countries = require('./countries'),\n dialog = require('./dialog'),\n minicart = require('./minicart'),\n page = require('./page'),\n rating = require('./rating'),\n searchplaceholder = require('./searchplaceholder'),\n searchsuggest = require('./searchsuggest'),\n tooltip = require('./tooltip'),\n util = require('./util'),\n validator = require('./validator'),\n genericSidebar = require('./generic-sidebar'),\n impressions = require('./impressions'),\n tls = require('./tls'),\n addToCart = require('./pages/product/addToCart'),\n variantScript = require('./pages/product/variant'),\n csrf = require('./csrf'),\n contentUtils = require('./contentUtils'),\n gtmUtils = require('./gtmUtils'),\n login = require('./login'),\n thron = require('../../../../thron_sg_changes/cartridge/js/pages/product/index'),\n widgetChat = require('./widget-chat');\n\nvar recaptcha = require('../../../../plugin_recaptcha/cartridge/client/default/js/recaptcha/recaptcha');\nconst {\n slide\n} = require('./minicart');\n\n/* var cookie = document.createElement('script');\ncookie.setAttribute('id', 'Cookiebot');\ncookie.setAttribute('src', 'https://consent.cookiebot.com/uc.js');\ncookie.setAttribute('data-cbid', 'e297ee68-a11a-4d08-99a4-18babc5ffc9c');\ncookie.setAttribute('data-blockingmode', 'auto');\ncookie.setAttribute('type', 'text/javascript');\ndocument.getElementsByTagName('head')[0].firstElementChild.prepend(cookie); */\n\n// if jQuery has not been loaded, load from google cdn\nif (!window.jQuery) {\n var s = document.createElement('script');\n s.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');\n s.setAttribute('type', 'text/javascript');\n document.getElementsByTagName('head')[0].appendChild(s);\n}\n\nrequire('./jquery-ext')();\nrequire('./cookieprivacy')();\nrequire('./captcha')();\n\n\nfunction initializeEvents() {\n var controlKeys = ['8', '13', '46', '45', '36', '35', '38', '37', '40', '39'];\n $('body')\n .on('keydown', 'textarea[data-character-limit]', function (e) {\n var text = $.trim($(this).val()),\n charsLimit = $(this).data('character-limit'),\n charsUsed = text.length;\n\n if ((charsUsed >= charsLimit) && (controlKeys.indexOf(e.which.toString()) < 0)) {\n e.preventDefault();\n }\n })\n .on('change keyup mouseup', 'textarea[data-character-limit]', function () {\n var text = $.trim($(this).val()),\n charsLimit = $(this).data('character-limit'),\n charsUsed = text.length,\n charsRemain = charsLimit - charsUsed;\n\n if (charsRemain < 0) {\n $(this).val(text.slice(0, charsRemain));\n charsRemain = 0;\n }\n\n $(this).next('div.char-count').find('.char-remain-count').html(charsRemain);\n });\n\n /**\n * initialize search suggestions, pending the value of the site preference(enhancedSearchSuggestions)\n * this will either init the legacy(false) or the beta versions(true) of the the search suggest feature.\n * */\n var $searchContainer = $('.top-banner .header-search .search-container');\n searchsuggest.init($searchContainer, Resources.SIMPLE_SEARCH);\n\n // add show/hide navigation elements\n $('.secondary-navigation .toggle').click(function () {\n $(this).toggleClass('expanded').next('ul').toggle();\n });\n\n // add generic toggle functionality\n $('.toggle').next('.toggle-content').hide();\n $('.toggle').click(function () {\n $(this).toggleClass('expanded').next('.toggle-content').toggle();\n });\n\n //attivazione slider header-banner\n //gestione contenuti specifici per homepage\n if ($('.header-banner-content').find('.only-hp').length > 0) {\n if ($('#hp-main').length > 0) {\n $('.header-banner-content').find('.only-hp').show();\n } else {\n $('.header-banner-content').find('.only-hp').remove();\n }\n }\n $('.header-banner-content').slick({\n prevArrow: '',\n nextArrow: '',\n autoplay: true,\n infinite: true,\n speed: 1000,\n autoplaySpeed: 5000,\n pauseOnFocus: false,\n pauseOnHover: false\n });\n\n // subscribe email box\n var $subscribeEmail = $('.subscribe-email');\n if ($subscribeEmail.length > 0) {\n $subscribeEmail.focus(function () {\n var val = $(this.val());\n if (val.length > 0 && val !== Resources.SUBSCRIBE_EMAIL_DEFAULT) {\n return; // do not animate when contains non-default value\n }\n\n $(this).animate({\n color: '#999999'\n }, 500, 'linear', function () {\n $(this).val('').css('color', '#333333');\n });\n }).blur(function () {\n var val = $.trim($(this.val()));\n if (val.length > 0) {\n return; // do not animate when contains value\n }\n $(this).val(Resources.SUBSCRIBE_EMAIL_DEFAULT)\n .css('color', '#999999')\n .animate({\n color: '#333333'\n }, 500, 'linear');\n });\n }\n\n\n\n //SEZIONE DIALOG!\n $('.privacy-policy').on('click', function (e) {\n e.preventDefault();\n dialog.open({\n url: $(e.target).attr('href'),\n options: {\n height: 600\n }\n });\n });\n\n $('body').on('click', '.scrivi', function (event) {\n event.preventDefault();\n dialog.open({\n validator: validator,\n url: $(this).attr('data-contactus-popup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog',\n callback: function () {\n var maxLength = 500;\n var notesLength = $('#ContactUsForm .notescontent').val().length;\n updateNotesLengthCounter(notesLength, maxLength);\n\n $('#ContactUsForm .input-textarea').on('keyup', function (event) {\n var notesLength = $('#ContactUsForm .notescontent').val().length;\n if (notesLength > maxLength) {\n // Converting \\r\\n into a whitespace for validation safety.\n $('#ContactUsForm .notescontent').val($('#ContactUsForm .notescontent').val().replace(/\\r?\\n/g, ' '));\n // Updating...\n notesLength = $('#ContactUsForm .notescontent').val().length;\n }\n\n updateNotesLengthCounter(notesLength, maxLength);\n if (!isNotesLengthValid(notesLength, maxLength)) {\n $(this).val($(this).val().substr(0, 500));\n notesLength = $('#ContactUsForm .notescontent').val().length;\n updateNotesLengthCounter(notesLength, maxLength);\n }\n });\n\n //Validation form submit contact us\n $('#ContactUsForm .input-text, .input-textarea, .email-custom').on('change', function (event) {\n var flagValidate = false;\n if (!$('#ContactUsForm #dwfrm_contactus_firstname').length == 0 && $('#ContactUsForm #dwfrm_contactus_firstname').val())\n if (!$('#ContactUsForm #dwfrm_contactus_lastname').length == 0 && $('#ContactUsForm #dwfrm_contactus_lastname').val())\n if (!$('#ContactUsForm #dwfrm_contactus_email').hasClass('error') && !$('#ContactUsForm #dwfrm_contactus_email').length == 0 && $('#ContactUsForm #dwfrm_contactus_email').val())\n if (!$('#ContactUsForm #dwfrm_contactus_comment').length == 0 && $('#ContactUsForm #dwfrm_contactus_comment').val())\n flagValidate = true;\n\n var notesLength = $('#RegistrationForm .notescontent').val().length;\n if (!isNotesLengthValid(notesLength, maxLength)) {\n $(this).val($(this).val().substr(0, 500));\n flagValidate = false;\n }\n\n if (flagValidate) {\n if (!$('#scrivi_submit').hasClass('dark')) {\n $('#scrivi_submit').addClass(\"dark\");\n $('#scrivi_submit > .arrow-shape').addClass(\"white\");\n }\n } else {\n if ($('#scrivi_submit').hasClass('dark')) {\n $('#scrivi_submit').removeClass('dark');\n $('#scrivi_submit > .arrow-shape').removeClass(\"white\");\n }\n }\n });\n }\n });\n\n });\n\n $('body').on('click', '.faq', function (event) {\n var $faq = $(this);\n event.preventDefault();\n dialog.open({\n validator: validator,\n url: $(this).closest('.accordion-content').data('faq-popup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render',\n success: function (container) {\n var currentClass = $faq.data('number');\n container.find('.faq-dialog-link').removeClass('active');\n container.find('.faq-dialog-link.' + currentClass).addClass('active');\n container.find('.faq-dialog-accordion').removeClass('open');\n container.find('.faq-dialog-accordion.' + currentClass).addClass('open');\n container.find('.faq-dialog-link').click(function (event) {\n event.preventDefault();\n container.find('.faq-dialog-link').removeClass('active');\n $(this).addClass('active');\n var currentClass = $(this).data('number');\n container.find('.faq-dialog-accordion').removeClass('open');\n container.find('.faq-dialog-accordion.' + currentClass).addClass('open');\n });\n }\n },\n target: '#login-dialog'\n });\n });\n\n $('body').on('submit', '#ContactUsForm', function (event) {\n event.preventDefault();\n\n if ($(this).valid()) {\n $(this).find('[type=\"submit\"]').attr('disabled', 'disabled');\n $(this).addClass('in-loading').append('');\n\n var url = $(this).attr('action');\n var data = {};\n data = $(this).serializeArray();\n data.push({\n name: $(this).find('button[type=\"submit\"]').attr('name'),\n value: 'x'\n });\n data.push({\n name: 'scope',\n value: 'popup'\n });\n\n dialog.open({\n url: url,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog',\n data: data\n });\n\n }\n });\n\n // LOGIN BOTTOM CART\n $('body').on('click', '.tooltip-login-container.add-to-wishlist', function (e) {\n e.preventDefault();\n /*\n dialog.open({\n validator: validator,\n url: $(this).closest('.item-user-actions').find('#login-cart').attr('data-loginpopup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog'\n });\n */\n var redirectUrl = $(this).find('.login-wishlist').attr('data-href');\n location.href = redirectUrl;\n });\n\n $('body').on('click', '#login-cart', function (e) {\n if (typeof $(this).attr('data-loginpopup-url') != 'undefined') {\n e.preventDefault();\n dialog.open({\n validator: validator,\n url: $(this).attr('data-loginpopup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog'\n });\n }\n });\n\n $('body').on('click', '#password-reset', function (e) {\n e.preventDefault();\n dialog.open({\n validator: validator,\n url: $(e.target).attr('href'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render password-retrieve'\n },\n target: '#login-dialog'\n });\n });\n\n $('body').on('submit', '#EmailOnlyLandingForm', function (event) {\n event.preventDefault();\n validator.init();\n\n var url = $(this).attr('action');\n var data = {};\n data = $(this).serializeArray();\n data.push({\n name: $(this).find('button[type=\"submit\"]').attr('name'),\n value: 'x'\n });\n\n var $formContainer = $(this).closest('.reset-password-form');\n var $formConfirmation = $formContainer.siblings('.reset-password-confirm');\n\n data.push({\n name: 'responseType',\n value: 'json'\n });\n data.push({\n name: 'format',\n value: 'ajax'\n });\n\n $formContainer.find('.notfounderror').hide();\n\n url = util.ajaxUrl(url);\n\n $.ajax({\n url: url,\n data: data,\n type: \"POST\",\n async: true,\n success: function (response) {\n try {\n var responseJson = $.parseJSON(response.replace(/\\\\/g, \"\"));\n if (responseJson.success) {\n $formContainer.hide();\n $formConfirmation.show();\n } else {\n $formContainer.find('.notfounderror').show();\n }\n } catch (e) {\n $formContainer.find('.notfounderror').show();\n }\n\n }\n });\n });\n\n $('body').on('submit', '#PasswordResetForm', function (event) {\n event.preventDefault();\n validator.init();\n // var $requestPasswordForm = $('[name$=\"_requestpassword\"]');\n // if (!$requestPasswordForm.valid()) {\n // return;\n // }\n\n var url = $(this).attr('action');\n var data = {};\n data = $(this).serializeArray();\n data.push({\n name: $(this).find('button[type=\"submit\"]').attr('name'),\n value: 'x'\n });\n\n if ($(this).hasClass('reset-password-form-page')) {\n // Case: reset password page\n var $formContainer = $(this).closest('.reset-password-form');\n var $formConfirmation = $formContainer.siblings('.reset-password-confirm');\n\n data.push({\n name: 'responseType',\n value: 'json'\n });\n data.push({\n name: 'format',\n value: 'ajax'\n });\n\n // Reset error messages\n $formContainer.find('.notfounderror').hide();\n\n // Load content in the same page\n url = util.ajaxUrl(url);\n\n $.ajax({\n url: url,\n data: data,\n type: \"POST\",\n async: true,\n success: function (response) {\n try {\n var responseJson = $.parseJSON(response.replace(/\\\\/g, \"\"));\n if (responseJson.success) {\n $formContainer.hide();\n $formConfirmation.show();\n } else {\n $formContainer.find('.notfounderror').show();\n }\n } catch (e) {\n $formContainer.find('.notfounderror').show();\n }\n\n }\n });\n } else {\n // Case: reset password popup\n data.push({\n name: 'scope',\n value: 'popup'\n });\n\n dialog.open({\n validator: validator,\n url: url,\n type: 'POST',\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render password-retrieve'\n },\n target: '#login-dialog',\n data: data\n });\n }\n\n });\n\n $('body').on('submit', '#LoginForm', function (event) {\n event.preventDefault();\n\n var url = $(this).attr('action');\n var data = {};\n data = $(this).serializeArray();\n data.push({\n name: $(this).find('button[type=\"submit\"]').attr('name'),\n value: 'x'\n });\n\n if ($(this).hasClass('sidebar-validation')) {\n // sidebar validation\n data.push({\n name: 'scope',\n value: 'sidebar'\n });\n $.post(url, data, function (data) {\n try {\n var res = JSON.parse(data.replace(/\\\\/g, \"\"));\n if (res.redirect && res.url) {\n $('body').trigger('login:success', ['sidebar']);\n window.location.href = res.url;\n }\n } catch (e) {\n console.log(e);\n $('#generic-sidebar-content').html(data);\n validator.init();\n }\n });\n } else {\n // popup validation\n data.push({\n name: 'scope',\n value: 'popup'\n });\n\n dialog.open({\n validator: validator,\n url: url,\n type: 'POST',\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog',\n data: data\n });\n }\n\n });\n\n $('body').on('click', '.ui-dialog-titlebar-close', function (event) {\n event.preventDefault();\n dialog.destroy();\n });\n\n $('body').on('click', '.scrivibenefeetpopup', function () {\n event.preventDefault();\n var benefeetDialog = $('#benefeet-dialog');\n var benefeetOverlay = $('#benefeet-overlay');\n benefeetDialog.removeClass('open login-registration small').children('.ui-dialog-content').children().remove();\n benefeetOverlay.removeClass('open');\n dialog.open({\n validator: validator,\n url: $(this).attr('data-contactus-popup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog'\n });\n validator.init();\n });\n\n /* \t$('body').on('click', '.privacyPolicyNewsPopup', function(event){\n \t\tevent.preventDefault();\n \t var benefeetDialog = $('#benefeet-dialog');\n \t var benefeetOverlay = $('#benefeet-overlay');\n benefeetDialog.removeClass('open login-registration small').children('.ui-dialog-content').children().remove();\n benefeetOverlay.removeClass('open');\n dialog.open({\n \tvalidator: validator,\n url: $(this).attr('data-privacy-popup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render'\n },\n target: '#login-dialog'\n });\n }); */\n\n // SCROLL TO NEWSLETTER POLICY\n $('body').on('click', '#NewsletterFooterForm .privacyPolicyNewsPopup, #NewsletterFooterFormMob .privacyPolicyNewsPopup, .newsletter-register-section .privacyPolicyNewsPopup, #NewsletterSubscriptionForm .privacyPolicyNewsPopup, #NewsletterAdvForm .privacyPolicyNewsPopup', function (event) {\n $(document).ajaxComplete(function () {\n $('#login-dialog').animate({\n scrollTop: $(\"#newsletterp\").offset().top - ($(document).scrollTop()) - 150\n }, 1000);\n })\n });\n\n //POPUP return details account\n $('body').on('click', '.returnEmailPopup', function (event) {\n event.preventDefault();\n var $form = $(this).closest('.fakeForm');\n $form.find('.error').html('');\n var link = $('#returnEmailLink');\n link.attr('href', '');\n var url = $form.data('action');\n var $returnCaseNumber = $form.find('.returnCaseNumber');\n var $csrfToken = $form.find('.csrfTokenReturn');\n var data = $csrfToken.attr('name') + '=' + $csrfToken.attr('value') + '&' + $returnCaseNumber.attr('name') + '=' + $returnCaseNumber.attr('value');\n $.ajax({\n url: url,\n data: data,\n async: false,\n success: function (response) {\n try {\n var responseJson = JSON.parse(response.replace(/\\\\/g, \"\"));\n if (responseJson.newTab) {\n var newWindow = window.open(\"about:blank\", \"newPage\");\n newWindow.location.href = responseJson.url;\n } else {\n $form.find('.error').html(responseJson.error);\n }\n } catch (e) {}\n\n }\n })\n });\n\n /* SIDEBAR POPUP UTILS */\n /*\n * Open sidebar popup with content asset link (dynamic content) or DOM element id (static content)\n * Content asset link example: data-popup-sidebar=\"$httpsUrl('Page-Show', 'cid', 'content-asset-id')$\"\n * DOM element id example: data-popup-sidebar=\"sidebar-dialog\"\n */\n $('body').on('click', '[data-popup-sidebar]', function (event) {\n var url = $(this).attr('data-popup-sidebar');\n if (url == 'advance-information-modal' && !window.matchMedia('(max-width: 767px)').matches) {\n return;\n }\n event.preventDefault();\n var contentToShow = $(this).attr('data-popup-content') || '';\n if (url.indexOf('.html') !== -1) {\n // Open dialog with dynamic content\n dialog.open({\n url: url,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render sidebar',\n position: {\n my: 'right top',\n at: 'right bottom',\n of: window,\n collision: 'flipfit'\n },\n success: function (container) {\n container.parents('.ui-dialog').addClass('sidebar-open');\n $('html').addClass('no-scroll');\n container.on('dialogclose', function (event) {\n if (container.parents('.ui-dialog').hasClass('sidebar-open')) {\n container.parents('.ui-dialog').removeClass('sidebar-open');\n window.setTimeout(function () {\n container.dialog('close');\n }, 500);\n }\n });\n }\n },\n target: '#sidebar-content-dialog'\n });\n } else {\n // Show sidebar-popup static content\n if (url == 'sidebar-dialog') {\n $('#sidebar-dialog').addClass('sidebar-open');\n $('#sidebar-overlay').addClass('open');\n $('#sidebar-dialog').find('#sidebar-dialog-header').addClass('dialog-header-open');\n $('html').addClass('no-scroll');\n util.togglePageScroll(true);\n if (contentToShow != '') {\n var contentElem = $('#' + contentToShow);\n contentElem.addClass('show');\n }\n }\n }\n });\n $('#sidebar-dialog').on('click', '.ui-dialog-titlebar-close', function (event) {\n event.preventDefault();\n $('#sidebar-dialog').removeClass('sidebar-open');\n $('#sidebar-overlay').removeClass('open');\n $('#sidebar-dialog').find('#sidebar-dialog-header').removeClass('dialog-header-open');\n $('#sidebar-dialog').find('#sidebar-dialog-header .border-fullWidth').removeClass('d-none');\n util.togglePageScroll(false);\n setTimeout(function () {\n $('html').removeClass('no-scroll');\n $('#sidebar-dialog').find('.sidebar-dialog-content').removeClass('show');\n }, 300);\n });\n\n $('body').on('click', '.pdp-benefeet-points__right .discover-more', function (e) {\n e.preventDefault();\n $('#sidebar-dialog').addClass('sidebar-open');\n $('#sidebar-overlay').addClass('open');\n $('#sidebar-dialog').find('#sidebar-dialog-header').addClass('dialog-header-open');\n $('html').addClass('no-scroll');\n $('#sidebar-dialog').find('#sidebar-dialog-header .border-fullWidth').addClass('d-none');\n $('#sidebar-dialog-header button').addClass('popup-opened'); //gtm event 142\n var contentElem = $('#welcome-offer-popup');\n contentElem.addClass('show');\n });\n\n $('body').on('click', '.my-account-navigation .link-last-pdp', function (e) {\n e.preventDefault();\n var urlPDP = $('.my-account-navigation .link-pdp').text();\n window.location.href = urlPDP;\n });\n\n $('#sidebar-overlay').on('click', function (event) {\n event.preventDefault();\n $('#sidebar-dialog').removeClass('sidebar-open');\n $('#sidebar-overlay').removeClass('open');\n $('#sidebar-dialog').find('#sidebar-dialog-header').removeClass('dialog-header-open');\n util.togglePageScroll(false);\n setTimeout(function () {\n $('html').removeClass('no-scroll');\n $('#sidebar-dialog').find('.sidebar-dialog-content').removeClass('show');\n }, 300);\n });\n\n // Generic sidebar\n $('body').on('click', '[data-trigger-sidebar]', function () {\n var type = $(this).attr('data-trigger-sidebar');\n var content = $(this).attr('data-content');\n\n genericSidebar.open(content, type, false, function () {\n validator.init();\n });\n });\n\n // main menu toggle\n $('.menu-toggle, .tablet-overlay').on('click', function () {\n $('#wrapper').toggleClass('menu-active');\n $('.tablet-overlay').fadeToggle();\n // handle background scroll on mobile\n var isMenuOpen = $('#wrapper').hasClass('menu-active');\n if (window.matchMedia('(max-width: 767px)').matches) {\n util.togglePageScroll(isMenuOpen);\n }\n });\n\n $('.tablet-overlay').on('click', function () {\n $('#wrapper').removeClass('menu-active');\n $('.refinements-attributes-wrapper').removeClass('open');\n $('.tablet-overlay').fadeOut();\n });\n\n $('.menu-category li .menu-item-toggle').on('click', function (e) {\n e.preventDefault();\n var $parentLi = $(e.target).closest('li');\n $parentLi.siblings('li').removeClass('active').find('.menu-item-toggle').removeClass('fa-chevron-up active').addClass('fa-chevron-right');\n $parentLi.toggleClass('active');\n $(e.target).toggleClass('fa-chevron-right fa-chevron-up active');\n });\n\n // main menu - check empty sections to add custom styles\n if ($('.menu-category-main').prev('.menu-category').find('li').length == 0) {\n $('.menu-category-main').addClass('no-divisor-left');\n }\n if ($('.menu-category-main').next('.menu-category').find('li').length == 0) {\n $('.menu-category-main').addClass('no-divisor-right');\n }\n\n // MENU NAV MOBILE\n if (window.matchMedia('(max-width: 1279px)').matches) {\n $('.has-sub-menu').click(function (e) {\n e.preventDefault();\n var $level2 = $(this).siblings('.level-2');\n var $container = $(this).parents('.menu-category-wrapper');\n\n $level2.addClass('level-opened');\n $level2.css('top', $container.scrollTop() + 'px');\n $container.css('overflow', 'hidden');\n\n //Highlight category mobile\n highlightCategoryMobile();\n });\n\n $('.has-sub-menu-secondLevelAndBeyond').click(function (e) {\n e.preventDefault();\n var $level2 = $(this).parents('.level-2');\n var $level3 = $(this).parents('.has-sub-level-wrapper').siblings('.level-3');\n\n $level2.css('overflow', 'hidden');\n $level3.css('top', $level2.scrollTop() + 'px');\n $level3.addClass('level-opened');\n $('.highlight-subcategories .level-3').addClass('d-none');\n });\n\n $('.js-menu-back').on('click', function () {\n var isLevel3 = $(this).parents('.level-3').length;\n\n if (isLevel3) {\n $(this).parents('.level-2').removeAttr('style');\n $(this).parents('.level-2').css('top', $('.menu-category-wrapper').scrollTop() + 'px');\n $('.level-3').removeClass('level-opened');\n $('.highlight-subcategories .level-3').removeClass('d-none');\n } else {\n $(this).parents('.menu-category-wrapper').removeAttr('style');\n $('.level-2').removeClass('level-opened');\n }\n\n });\n }\n\n\n /*\n $('.user-account').on('click', function (e) {\n e.preventDefault();\n $(this).parent('.user-info').toggleClass('active');\n }); */\n\n //show \"callable\" footer link for mobile\n if (util.isMobile()) {\n //console.log(util.isMobile);\n $('footer').find('[data-mobile]').each(function (index, el) {\n $(this).removeAttr('data-mobile');\n var targetID = $(this).attr('data-target-hide');\n\n $('#' + targetID).hide();\n });\n }\n\n $(window).on('scroll', function () {\n $('.scroll-top-button:not(.scroll-top-products)').each(function () {\n if ($(this).attr('data-target-view')) {\n var elem = $(this).attr('data-target-view');\n var targetInView = util.isInViewport(elem);\n\n if (targetInView) {\n $(this).addClass('in-view');\n } else {\n $(this).removeClass('in-view');\n }\n }\n });\n });\n\n $(document).on('click', '.scroll-top-button', function (event) {\n event.preventDefault();\n $('html, body').animate({\n scrollTop: 0\n }, 550, 'easeInOutQuint');\n });\n\n // User logged snackbar - hide after 5s\n if ($('.content-snackbar').length) {\n window.setTimeout(function () {\n $('.content-snackbar').hide();\n }, 5000);\n }\n\n // Cookie popup events\n $('body').on('click', '#CybotCookiebotDialogBodyLevelDetailsButton', function (event) {\n $('#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowallSelection').addClass('show');\n $('#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll').addClass('pull-right');\n\n // Cookie popup - change elements position\n var cookieOptionsTop = $('#CybotCookiebotDialogBodyLevelButtonsSelectPane > .CybotCookiebotDialogBodyLevelButtonWrapper');\n var cookieOptionsTable = $('#CybotCookiebotDialogDetailBodyContentCookieContainerTypes > a');\n if (cookieOptionsTop.length && cookieOptionsTable.length) {\n var i = 0;\n $(cookieOptionsTop).each(function () {\n if (i > 0) {\n // Only first option checked by default\n $(this).find('input').attr('checked', false);\n }\n var option = $(this).html();\n $(option).prependTo($(cookieOptionsTable[i]));\n $(this).remove();\n i++;\n });\n }\n });\n\n\n $('body').on('click', '#gestisci_cookie', function (event) {\n setTimeout(function () {\n $('#CybotCookiebotDialogDetail').show();\n }, 300);\n });\n\n}\n\n/**\n * @private\n * @function\n * @description Adds class ('js') to html for css targeting and loads js specific styles.\n */\nfunction initializeDom() {\n // add class to html for css targeting\n $('html').addClass('js');\n if (SitePreferences.LISTING_INFINITE_SCROLL) {\n $('html').addClass('infinite-scroll');\n }\n // load js specific styles\n util.limitCharacters();\n}\n\nfunction errorPopup() {\n var errorMessage = $('.errorMessage');\n if (errorMessage.length > 0) {\n dialog.open({\n html: errorMessage.data('error-message'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration',\n }\n });\n }\n}\n\n/**\n * @private\n * @function\n * @description Initialize responsive images - change src value depending on screen size\n *\n * Usage:\n * \"\"\n */\nfunction initResponsiveImages() {\n $('.img-responsive').each(function () {\n var srcMobile = $(this).attr('src');\n var srcTablet = typeof $(this).attr('data-src-md') != 'undefined' ? $(this).attr('data-src-md') : '';\n var srcDesktop = typeof $(this).attr('data-src-lg') != 'undefined' ? $(this).attr('data-src-lg') : '';\n var srcMobileAttr = typeof $(this).attr('data-src-lg') != 'undefined' ? $(this).attr('data-src-sm') : '';\n\n if (srcTablet != '' || srcDesktop != '') {\n if ($(window).width() > 767 && $(window).width() <= 1279) {\n $(this).addClass('loading');\n // Load tablet image\n if (srcTablet != '') {\n $(this).attr('src', srcTablet);\n } else {\n $(this).attr('src', srcDesktop); // fallback\n }\n } else if ($(window).width() > 1279) {\n $(this).addClass('loading');\n // Load desktop image\n if (srcDesktop != '') {\n $(this).attr('src', srcDesktop);\n } else {\n $(this).attr('src', srcTablet); // fallback\n }\n } else if ($(window).width() <= 768) {\n $(this).addClass('loading');\n // Load mobile image\n if (srcMobileAttr != '') {\n $(this).attr('src', srcMobileAttr);\n } else {\n $(this).attr('src', srcTablet); // fallback\n }\n }\n $(this).on('load', function () {\n $(this).removeClass('loading');\n });\n }\n });\n}\n\n/**\n * Check if is Internet Explorer\n * MSIE = IE 10 or older\n * Trident/ = IE 11\n */\nfunction isIE() {\n var ua = window.navigator.userAgent;\n var msie = ua.indexOf('MSIE ');\n var trident = ua.indexOf('Trident/');\n\n return (msie > 0 || trident > 0);\n}\n\n//AMS-104 - Slider Highlights category\nfunction highlightCategoryMobile() {\n if (window.matchMedia('(max-width: 1279px)').matches) {\n var $secondLevelCategoryOpened = $('.level-2.level-opened');\n\n if (!$secondLevelCategoryOpened.find('.carousel-container').hasClass('carousel-new')) {\n\n //Create carousel container element\n $secondLevelCategoryOpened.find(\".level-3 .highlight-category:first\").after(\"\");\n\n var elementLength = $secondLevelCategoryOpened.find(\".highlight-subcategories .level-3 li\").length;\n var lastItems = $secondLevelCategoryOpened.find('.level-3 .highlight-category').slice(-(elementLength - 1));\n\n if (elementLength == 1) {\n $secondLevelCategoryOpened.find(\".level-3 .highlight-category .thirdCat-layout\").addClass('only-element'); //se ho un solo elemento rimuovi border\n } else if (elementLength > 1) { //append carousel solo se ho almeno 2 elementi\n $secondLevelCategoryOpened.find('.level-3-container .carousel-container').html(lastItems);\n }\n }\n\n if ($('.carousel-container').length > 0) {\n\n $(function () {\n var container = $(\".carousel-new\");\n\n var isDragging = false;\n var lastPosition = {\n x: 0,\n y: 0\n };\n\n container.on(\"mousedown touchstart\", function (event) {\n isDragging = true;\n lastPosition = getTouchPosition(event);\n });\n\n container.on(\"mousemove touchmove\", function (event) {\n if (isDragging) {\n var currentPosition = getTouchPosition(event);\n var deltaX = lastPosition.x - currentPosition.x;\n container.scrollLeft(container.scrollLeft() + deltaX);\n lastPosition = currentPosition;\n }\n });\n\n container.on(\"mouseup touchend\", function () {\n isDragging = false;\n });\n\n container.on(\"mouseleave touchcancel\", function () {\n isDragging = false;\n });\n\n function getTouchPosition(event) {\n if (event.type.startsWith(\"touch\")) {\n var touch = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];\n return {\n x: touch.clientX,\n y: touch.clientY\n };\n } else {\n return {\n x: event.clientX,\n y: event.clientY\n };\n }\n }\n });\n\n\n $(document).ready(function () {\n $(\".carousel-container\").niceScroll({\n horizrailenabled: true,\n autohidemode: false,\n cursorcolor: \"#d3d3d3\",\n cursoropacitymax: 0.5,\n cursorborderradius: \"4px\",\n cursorwidth: \"5px\"\n });\n\n });\n }\n }\n}\n\nvar pages = {\n account: require('./pages/account'),\n cart: require('./pages/cart'),\n checkout: require('./pages/checkout'),\n compare: require('./pages/compare'),\n customerService: require('./pages/customerservice'),\n product: require('./pages/product'),\n registry: require('./pages/registry'),\n search: require('./pages/search'),\n storefront: require('./pages/storefront'),\n wishlist: require('./pages/wishlist'),\n orderdetailsearch: require('./pages/orderdetailsearch'),\n orderdetail: require('./pages/orderdetail'),\n storelocator: require('./pages/storelocator'),\n storelocatorDetails: require('./custom/storelocatorDetails'),\n technology: require('./pages/technology'),\n benefeet: require('./pages/benefeet'),\n adyen3Ds2page: require('./pages/adyen3Ds2page'),\n error: require('./pages/error'),\n esw: require('./pages/esw')\n};\n\nvar app = {\n init: function () {\n if (document.cookie.length === 0) {\n $('
').addClass('browser-compatibility-alert').append($('

').addClass('browser-error').html(Resources.COOKIES_DISABLED)).appendTo('#browser-check');\n }\n initializeDom();\n initializeEvents();\n initResponsiveImages();\n\n // init specific global components\n countries.init();\n // tooltip.init();\n minicart.init();\n validator.init();\n rating.init();\n searchplaceholder.init();\n genericSidebar.init();\n impressions.init();\n login.init();\n\n recaptcha.init();\n\n csrf.init();\n\n // init content global components\n contentUtils.init();\n gtmUtils.init();\n\n widgetChat.initializeWidgetChat();\n\n // execute page specific initializations\n $.extend(page, window.pageContext);\n var ns = page.ns;\n if (ns && pages[ns] && pages[ns].init) {\n pages[ns].init();\n }\n\n // Check TLS status if indicated by site preference\n if (SitePreferences.CHECK_TLS === true) {\n tls.getUserAgent();\n }\n\n errorPopup();\n\n // FIX MENU ON SCROLL\n $(window).on('scroll', function () {\n var y_scroll_pos = window.pageYOffset;\n\n if (!window.matchMedia('(max-width: 1279px)').matches) {\n var scroll_pos_test = $('.header-banner').outerHeight() + 1; // altezza header banner\n } else {\n var scroll_pos_test = 0; // in mobile non ci sono elementi al di sopra dell'header\n }\n\n if (y_scroll_pos > scroll_pos_test) {\n $('body').addClass('fixed-header');\n /*$('#cookie-header').hide();*/\n // $('#cookie-header').addClass('fixed-cookie');\n\n } else {\n $('body').removeClass('fixed-header');\n //$('#cookie-header').removeClass('fixed-cookie');\n }\n });\n\n\n // Show/Hide logo header section on scroll\n $(document).ready(function () {\n\n var previousScroll = 0;\n\n $(window).scroll(function () {\n\n if (!window.matchMedia('(max-width: 1279px)').matches) {\n\n var currentScroll = $(this).scrollTop();\n\n /*\n If the current scroll position is greater than 200 (the top minus header) AND the current scroll position is less\n than the document height minus the window height (the bottom) run the navigation if/else statement.\n */\n if (currentScroll > 200 && currentScroll < $(document).height() - $(window).height()) {\n if (currentScroll == previousScroll) {\n return;\n }\n // If the current scroll is greater than the previous scroll (i.e we're scrolling down the page), hide the nav.\n if (currentScroll > previousScroll) {\n //window.setTimeout(hideNav, 300);\n hideNav();\n } else {\n // Else we are scrolling up (i.e the previous scroll is greater than the current scroll), so show the nav.\n //window.setTimeout(showNav, 300);\n showNav();\n }\n // Set the previous scroll value equal to the current scroll.\n previousScroll = currentScroll;\n }\n\n }\n\n });\n\n // prevent too many stickysidebar update\n var currentNavState = 'show';\n\n function hideNav() {\n if (currentNavState != 'hide') {\n currentNavState = 'hide';\n $(\".js-hide-on-scroll\").hide(0, function () {\n if (!isIE()) {\n if (window.refinementsStickySidebar || window.categoriesStickySidebar) {\n window.refinementsStickySidebar.updateSticky();\n window.categoriesStickySidebar.updateSticky();\n }\n }\n });\n }\n }\n\n function showNav() {\n if (currentNavState != 'show') {\n currentNavState = 'show';\n $(\".js-hide-on-scroll\").show(0, function () {\n if (!isIE()) {\n if (window.refinementsStickySidebar || window.categoriesStickySidebar) {\n window.refinementsStickySidebar.updateSticky();\n window.categoriesStickySidebar.updateSticky();\n }\n }\n });\n }\n }\n\n // this will prevent bugs on back to PLP from PDP\n $(window).trigger('scroll');\n\n // ADA compliance integration\n var countryName = $(\".country-name.data-name\").text();\n\n /* if ($('#wrapper').length > 0 && countryName == 'United States of America') {\n ! function () {\n var b = function () {\n window.__AudioEyeSiteHash = \"c0e030ee750b33b6a442658f03f12c56\";\n var a = document.createElement(\"script\");\n a.src = \"https://wsmcdn.audioeye.com/aem.js\";\n a.type = \"text/javascript\";\n a.setAttribute(\"async\", \"\");\n document.getElementsByTagName(\"body\")[0].appendChild(a)\n };\n \"complete\" !== document.readyState ? window.addEventListener ? window.addEventListener(\"load\", b) : window.attachEvent && window.attachEvent(\"onload\", b) : b()\n }();\n } */\n });\n\n\n if (!$('.pt_checkout').length && !$('.pt-benefeet-wrapper').length) {\n\n // SMOOTH SCROLL FOR HASH IN URL\n if (window.location.hash && $(window.location.hash).length > 0) {\n // smooth scroll to the anchor id\n\n var test = $(window.location.hash).attr('id');\n test.scrollIntoView(true);\n\n // setTimeout( function() {\n // var offset = $(window.location.hash).offset().top;\n // var outerHeight = $('.header-container').outerHeight(true);\n // $('html, body').animate({\n // scrollTop: (offeset - outerHeight) + 'px'\n // }, 1000, 'linear');\n // }, 600);\n }\n }\n\n $(document).on('click touchstart', '.toggle-pwd', function () {\n var id_by_class = $(this.parentNode.innerHTML).find('.password-custom').attr('id');\n $(this).find('.i-eye').toggleClass(\"fa-eye-slash\");\n var input = id_by_class;\n if ($('#' + input).attr(\"type\") === \"password\") {\n $('#' + input).attr(\"type\", \"text\");\n } else {\n $('#' + input).attr(\"type\", \"password\");\n }\n });\n\n\n if ($('.user-nav-header-benefeet').length) {\n $('.user-panel').css(\"top\", \"20px\");\n }\n\n }\n};\n\n// general extension functions\n(function () {\n String.format = function () {\n var s = arguments[0];\n var i, len = arguments.length - 1;\n for (i = 0; i < len; i++) {\n var reg = new RegExp('\\\\{' + i + '\\\\}', 'gm');\n s = s.replace(reg, arguments[i + 1]);\n }\n return s;\n };\n})();\n\n// initialize app\n$(document).ready(function () {\n app.init();\n});\n\n},{\"../../../../plugin_recaptcha/cartridge/client/default/js/recaptcha/recaptcha\":128,\"../../../../thron_sg_changes/cartridge/js/pages/product/index\":129,\"./captcha\":7,\"./contentUtils\":9,\"./cookieprivacy\":10,\"./countries\":11,\"./csrf\":12,\"./custom/storelocatorDetails\":18,\"./dialog\":20,\"./generic-sidebar\":22,\"./gtmUtils\":24,\"./impressions\":25,\"./jquery-ext\":26,\"./login\":27,\"./minicart\":28,\"./page\":29,\"./pages/account\":30,\"./pages/adyen3Ds2page\":31,\"./pages/benefeet\":32,\"./pages/cart\":33,\"./pages/checkout\":34,\"./pages/compare\":35,\"./pages/customerservice\":36,\"./pages/error\":38,\"./pages/esw\":39,\"./pages/orderdetail\":40,\"./pages/orderdetailsearch\":41,\"./pages/product\":45,\"./pages/product/addToCart\":42,\"./pages/product/variant\":55,\"./pages/registry\":56,\"./pages/search\":58,\"./pages/storefront\":59,\"./pages/storelocator\":60,\"./pages/technology\":61,\"./pages/wishlist\":63,\"./rating\":68,\"./searchplaceholder\":70,\"./searchsuggest\":71,\"./tls\":77,\"./tooltip\":78,\"./util\":79,\"./validator\":80,\"./widget-chat\":82}],6:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog'),\n page = require('./page'),\n util = require('./util');\n\nvar selectedList = [];\nvar maxItems = 1;\nvar bliUUID = '';\n\n/**\n * @private\n * @function\n * description Gets a list of bonus products related to a promoted product\n */\nfunction getBonusProducts() {\n var bonusproducts = [];\n\n var i, len;\n for (i = 0, len = selectedList.length; i < len; i++) {\n var p = {\n pid: selectedList[i].pid,\n qty: selectedList[i].qty,\n options: {}\n };\n var a, alen, bp = selectedList[i];\n if (bp.options) {\n for (a = 0, alen = bp.options.length; a < alen; a++) {\n var opt = bp.options[a];\n p.options = {optionName:opt.name, optionValue:opt.value};\n }\n }\n bonusproducts.push({product:p});\n }\n return {bonusproducts: bonusproducts};\n}\n\nvar selectedItemTemplate = function (data) {\n var attributes = '';\n for (var attrID in data.attributes) {\n var attr = data.attributes[attrID];\n attributes += '

  • \\n';\n attributes += '' + attr.displayName + ': ';\n attributes += '' + attr.displayValue + '\\n';\n attributes += '
  • ';\n }\n attributes += '
  • \\n';\n attributes += 'Qty: ';\n attributes += '' + data.qty + '';\n return [\n '
  • ',\n '',\n '
    ' + data.name + '
    ',\n '
      ',\n attributes,\n '
        ',\n '
      • '\n ].join('\\n');\n};\n\n// hide swatches that are not selected or not part of a Product Variation Group\nvar hideSwatches = function () {\n $('.bonus-product-item:not([data-producttype=\"master\"]) .swatches li').not('.selected').not('.variation-group-value').hide();\n // prevent unselecting the selected variant\n $('.bonus-product-item .swatches .selected').on('click', function () {\n return false;\n });\n};\n\n/**\n * @private\n * @function\n * @description Updates the summary page with the selected bonus product\n */\nfunction updateSummary() {\n var $bonusProductList = $('#bonus-product-list');\n if (!selectedList.length) {\n $bonusProductList.find('li.selected-bonus-item').remove();\n } else {\n var ulList = $bonusProductList.find('ul.selected-bonus-items').first();\n var i, len;\n for (i = 0, len = selectedList.length; i < len; i++) {\n var item = selectedList[i];\n var li = selectedItemTemplate(item);\n $(li).appendTo(ulList);\n }\n }\n\n // get remaining item count\n var remain = maxItems - selectedList.length;\n $bonusProductList.find('.bonus-items-available').text(remain);\n if (remain <= 0) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n } else {\n $bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n }\n}\n\nfunction initializeGrid () {\n var $bonusProduct = $('#bonus-product-dialog'),\n $bonusProductList = $('#bonus-product-list'),\n bliData = $bonusProductList.data('line-item-detail');\n maxItems = bliData.maxItems;\n bliUUID = bliData.uuid;\n\n if (bliData.itemCount >= maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n }\n\n var cartItems = $bonusProductList.find('.selected-bonus-item');\n cartItems.each(function () {\n var ci = $(this);\n var product = {\n uuid: ci.data('uuid'),\n pid: ci.data('pid'),\n qty: ci.find('.item-qty').text(),\n name: ci.find('.item-name').html(),\n attributes: {}\n };\n var attributes = ci.find('ul.item-attributes li');\n attributes.each(function () {\n var li = $(this);\n product.attributes[li.data('attributeId')] = {\n displayName:li.children('.display-name').html(),\n displayValue:li.children('.display-value').html()\n };\n });\n selectedList.push(product);\n });\n\n $bonusProductList.on('click', '.bonus-product-item a[href].swatchanchor', function (e) {\n e.preventDefault();\n var url = this.href,\n $this = $(this);\n url = util.appendParamsToUrl(url, {\n 'source': 'bonus',\n 'format': 'ajax'\n });\n $.ajax({\n url: url,\n success: function (response) {\n $this.closest('.bonus-product-item').empty().html(response);\n hideSwatches();\n }\n });\n })\n .on('change', '.input-text', function () {\n $bonusProductList.find('.select-bonus-item').removeAttr('disabled');\n $(this).closest('.bonus-product-form').find('.quantity-error').text('');\n })\n .on('click', '.select-bonus-item', function (e) {\n e.preventDefault();\n if (selectedList.length >= maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n $bonusProductList.find('.bonus-items-available').text('0');\n return;\n }\n\n var form = $(this).closest('.bonus-product-form'),\n detail = $(this).closest('.product-detail'),\n uuid = form.find('input[name=\"productUUID\"]').val(),\n qtyVal = form.find('input[name=\"Quantity\"]').val(),\n qty = (isNaN(qtyVal)) ? 1 : (+qtyVal);\n\n if (qty > maxItems) {\n $bonusProductList.find('.select-bonus-item').attr('disabled', 'disabled');\n form.find('.quantity-error').text(Resources.BONUS_PRODUCT_TOOMANY);\n return;\n }\n\n var product = {\n uuid: uuid,\n pid: form.find('input[name=\"pid\"]').val(),\n qty: qty,\n name: detail.find('.product-name').text(),\n attributes: detail.find('.product-variations').data('attributes'),\n options: []\n };\n\n var optionSelects = form.find('.product-option');\n\n optionSelects.each(function () {\n product.options.push({\n name: this.name,\n value: $(this).val(),\n display: $(this).children(':selected').first().html()\n });\n });\n selectedList.push(product);\n updateSummary();\n })\n .on('click', '.remove-link', function (e) {\n e.preventDefault();\n var container = $(this).closest('.selected-bonus-item');\n if (!container.data('uuid')) { return; }\n\n var uuid = container.data('uuid');\n var i, len = selectedList.length;\n for (i = 0; i < len; i++) {\n if (selectedList[i].uuid === uuid) {\n selectedList.splice(i, 1);\n break;\n }\n }\n updateSummary();\n })\n .on('click', '.add-to-cart-bonus', function (e) {\n e.preventDefault();\n var url = util.appendParamsToUrl(Urls.addBonusProduct, {bonusDiscountLineItemUUID: bliUUID});\n var bonusProducts = getBonusProducts();\n if (bonusProducts.bonusproducts[0].product.qty > maxItems) {\n bonusProducts.bonusproducts[0].product.qty = maxItems;\n }\n // make the server call\n $.ajax({\n type: 'POST',\n dataType: 'json',\n cache: false,\n contentType: 'application/json',\n url: url,\n data: JSON.stringify(bonusProducts)\n })\n .done(function () {\n // success\n page.refresh();\n })\n .fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n } else {\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n }\n })\n .always(function () {\n $bonusProduct.dialog('close');\n });\n })\n .on('click', '#more-bonus-products', function (e) {\n e.preventDefault();\n var uuid = $('#bonus-product-list').data().lineItemDetail.uuid;\n\n //get the next page of choice of bonus products\n var lineItemDetail = JSON.parse($('#bonus-product-list').attr('data-line-item-detail'));\n lineItemDetail.pageStart = lineItemDetail.pageStart + lineItemDetail.pageSize;\n $('#bonus-product-list').attr('data-line-item-detail', JSON.stringify(lineItemDetail));\n\n var url = util.appendParamsToUrl(Urls.getBonusProducts, {\n bonusDiscountLineItemUUID: uuid,\n format: 'ajax',\n lazyLoad: 'true',\n pageStart: lineItemDetail.pageStart,\n pageSize: $('#bonus-product-list').data().lineItemDetail.pageSize,\n bonusProductsTotal: $('#bonus-product-list').data().lineItemDetail.bpTotal\n });\n\n $.ajax({\n type: 'GET',\n cache: false,\n contentType: 'application/json',\n url: url\n })\n .done(function (data) {\n //add the new page to DOM and remove 'More' link if it is the last page of results\n $('#more-bonus-products').before(data);\n if ((lineItemDetail.pageStart + lineItemDetail.pageSize) >= $('#bonus-product-list').data().lineItemDetail.bpTotal) {\n $('#more-bonus-products').remove();\n }\n })\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n } else {\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n }\n });\n });\n}\n\nvar bonusProductsView = {\n /**\n * @function\n * @description Open the list of bonus products selection dialog\n */\n show: function (url) {\n var $bonusProduct = $('#bonus-product-dialog');\n // create the dialog\n dialog.open({\n target: $bonusProduct,\n url: url,\n options: {\n width: 795,\n title: Resources.BONUS_PRODUCTS\n },\n callback: function () {\n initializeGrid();\n hideSwatches();\n }\n });\n },\n /**\n * @function\n * @description Open bonus product promo prompt dialog\n */\n loadBonusOption: function () {\n var self = this,\n bonusDiscountContainer = document.querySelector('.bonus-discount-container');\n if (!bonusDiscountContainer) { return; }\n\n // get the html from minicart, then trash it\n var bonusDiscountContainerHtml = bonusDiscountContainer.outerHTML;\n bonusDiscountContainer.parentNode.removeChild(bonusDiscountContainer);\n\n dialog.open({\n html: bonusDiscountContainerHtml,\n options: {\n width: 400,\n title: Resources.BONUS_PRODUCT,\n buttons: [{\n text: Resources.SELECT_BONUS_PRODUCTS,\n click: function () {\n var uuid = $('.bonus-product-promo').data('lineitemid'),\n url = util.appendParamsToUrl(Urls.getBonusProducts, {\n bonusDiscountLineItemUUID: uuid,\n source: 'bonus',\n format: 'ajax',\n lazyLoad: 'false',\n pageStart: 0,\n pageSize: 10,\n bonusProductsTotal: -1\n });\n $(this).dialog('close');\n self.show(url);\n }\n }, {\n text: Resources.NO_THANKS,\n click: function () {\n $(this).dialog('close');\n }\n }]\n },\n callback: function () {\n // show hide promo details\n $('.show-promo-details').on('click', function () {\n $('.promo-details').toggleClass('visible');\n });\n }\n });\n }\n};\n\nmodule.exports = bonusProductsView;\n\n},{\"./dialog\":20,\"./page\":29,\"./util\":79}],7:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog');\nvar util = require('./util');\nvar SessionAttributes = window.SessionAttributes;\n\n/**\n * @function captcha Used to display/control the scrim containing the simulated captcha code\n **/\nmodule.exports = function () {\n /**\n * if the session.privacy.ratelimited element is present then show the notification\n * NOTE: You will probably want to replace this with a call to an actual CAPTCHA system to replace the simple one here\n */\n if (SessionAttributes.SHOW_CAPTCHA) {\n dialog.open({\n html: '

        ' + Resources.ATTENTION + '

        ' + Resources.TOO_MANY_LOGIN_ATTEMPTS + '

        ',\n options: {\n closeOnEscape: false,\n dialogClass: 'no-close',\n buttons: [{\n text: Resources.CONFIRM,\n class: 'button large rounded dark',\n click: function () {\n var url = util.appendParamsToUrl(Urls.rateLimiterReset, {format: 'ajax'});\n $.ajax({\n url: url\n });\n $(this).dialog('close');\n }\n }]\n }\n });\n }\n};\n\n},{\"./dialog\":20,\"./util\":79}],8:[function(require,module,exports){\n'use strict';\n\nvar page = require('./page'),\n util = require('./util'),\n TPromise = require('promise');\n\nvar _currentCategory = '',\n MAX_ACTIVE = 6;\n\n/**\n * @private\n * @function\n * @description Verifies the number of elements in the compare container and updates it with sequential classes for ui targeting\n */\nfunction refreshContainer() {\n var $compareContainer = $('.compare-items');\n var $compareItems = $compareContainer.find('.compare-item');\n var numActive = $compareItems.filter('.active').length;\n\n if (numActive < 2) {\n $('#compare-items-button').attr('disabled', 'disabled');\n } else {\n $('#compare-items-button').removeAttr('disabled');\n }\n\n $compareContainer.toggle(numActive > 0);\n}\n/**\n * @private\n * @function\n * @description Adds an item to the compare container and refreshes it\n */\nfunction addToList(data) {\n // get the first compare-item not currently active\n var $item = $('.compare-items .compare-item').not('.active').first(),\n $productTile = $('#' + data.uuid);\n\n if ($item.length === 0) {\n if ($productTile.length > 0) {\n $productTile.find('.compare-check')[0].checked = false;\n }\n window.alert(Resources.COMPARE_ADD_FAIL);\n return;\n }\n\n // if already added somehow, return\n if ($('[data-uuid=\"' + data.uuid + '\"]').length > 0) {\n return;\n }\n // set as active item\n $item.addClass('active')\n .attr('data-uuid', data.uuid)\n .attr('data-itemid', data.itemid)\n .data('uuid', data.uuid)\n .data('itemid', data.itemid)\n .append($(data.img).clone().addClass('compare-item-image'));\n}\n/**\n * @private\n * @function\n * description Removes an item from the compare container and refreshes it\n */\nfunction removeFromList($item) {\n if ($item.length === 0) { return; }\n // remove class, data and id from item\n $item.removeClass('active')\n .removeAttr('data-uuid')\n .removeAttr('data-itemid')\n .data('uuid', '')\n .data('itemid', '')\n // remove the image\n .find('.compare-item-image').remove();\n}\n\nfunction addProductAjax(args) {\n var promise = new TPromise(function (resolve, reject) {\n $.ajax({\n url: Urls.compareAdd,\n data: {\n pid: args.itemid,\n category: _currentCategory\n },\n dataType: 'json'\n }).done(function (response) {\n if (!response || !response.success) {\n reject(new Error(Resources.COMPARE_ADD_FAIL));\n } else {\n resolve(response);\n }\n }).fail(function (jqxhr, status, err) {\n reject(new Error(err));\n });\n });\n return promise;\n}\n\nfunction removeProductAjax(args) {\n var promise = new TPromise(function (resolve, reject) {\n $.ajax({\n url: Urls.compareRemove,\n data: {\n pid: args.itemid,\n category: _currentCategory\n },\n dataType: 'json'\n }).done(function (response) {\n if (!response || !response.success) {\n reject(new Error(Resources.COMPARE_REMOVE_FAIL));\n } else {\n resolve(response);\n }\n }).fail(function (jqxhr, status, err) {\n reject(new Error(err));\n });\n });\n return promise;\n}\n\nfunction shiftImages() {\n return new TPromise(function (resolve) {\n var $items = $('.compare-items .compare-item');\n $items.each(function (i, item) {\n var $item = $(item);\n // last item\n if (i === $items.length - 1) {\n return removeFromList($item);\n }\n var $next = $items.eq(i + 1);\n if ($next.hasClass('active')) {\n // remove its own image\n $next.find('.compare-item-image').detach().appendTo($item);\n $item.addClass('active')\n .attr('data-uuid', $next.data('uuid'))\n .attr('data-itemid', $next.data('itemid'))\n .data('uuid', $next.data('uuid'))\n .data('itemid', $next.data('itemid'));\n }\n });\n resolve();\n });\n}\n\n/**\n * @function\n * @description Adds product to the compare table\n */\nfunction addProduct(args) {\n var promise;\n var $items = $('.compare-items .compare-item');\n var $cb = $(args.cb);\n var numActive = $items.filter('.active').length;\n if (numActive === MAX_ACTIVE) {\n if (!window.confirm(Resources.COMPARE_CONFIRMATION)) {\n $cb[0].checked = false;\n return;\n }\n\n // remove product using id\n var $firstItem = $items.first();\n promise = removeItem($firstItem).then(function () {\n return shiftImages();\n });\n } else {\n promise = TPromise.resolve(0);\n }\n return promise.then(function () {\n return addProductAjax(args).then(function () {\n addToList(args);\n if ($cb && $cb.length > 0) { $cb[0].checked = true; }\n refreshContainer();\n });\n }).then(null, function () {\n if ($cb && $cb.length > 0) { $cb[0].checked = false; }\n });\n}\n\n/**\n * @function\n * @description Removes product from the compare table\n * @param {object} args - the arguments object should have the following properties: itemid, uuid and cb (checkbox)\n */\nfunction removeProduct(args) {\n var $cb = args.cb ? $(args.cb) : null;\n return removeProductAjax(args).then(function () {\n var $item = $('[data-uuid=\"' + args.uuid + '\"]');\n removeFromList($item);\n if ($cb && $cb.length > 0) { $cb[0].checked = false; }\n refreshContainer();\n }, function () {\n if ($cb && $cb.length > 0) { $cb[0].checked = true; }\n });\n}\n\nfunction removeItem($item) {\n var uuid = $item.data('uuid'),\n $productTile = $('#' + uuid);\n return removeProduct({\n itemid: $item.data('itemid'),\n uuid: uuid,\n cb: ($productTile.length === 0) ? null : $productTile.find('.compare-check')\n });\n}\n\n/**\n * @private\n * @function\n * @description Initializes the DOM-Object of the compare container\n */\nfunction initializeDom() {\n var $compareContainer = $('.compare-items');\n _currentCategory = $compareContainer.data('category') || '';\n var $active = $compareContainer.find('.compare-item').filter('.active');\n $active.each(function () {\n var $productTile = $('#' + $(this).data('uuid'));\n if ($productTile.length === 0) {return;}\n $productTile.find('.compare-check')[0].checked = true;\n });\n // set container state\n refreshContainer();\n}\n\n/**\n * @private\n * @function\n * @description Initializes the events on the compare container\n */\nfunction initializeEvents() {\n // add event to buttons to remove products\n $('.compare-item').on('click', '.compare-item-remove', function () {\n removeItem($(this).closest('.compare-item'));\n });\n\n // Button to go to compare page\n $('#compare-items-button').on('click', function () {\n page.redirect(util.appendParamToURL(Urls.compareShow, 'category', _currentCategory));\n });\n\n // Button to clear all compared items\n // rely on refreshContainer to take care of hiding the container\n $('#clear-compared-items').on('click', function () {\n $('.compare-items .active').each(function () {\n removeItem($(this));\n });\n });\n}\n\nexports.init = function () {\n initializeDom();\n initializeEvents();\n};\n\nexports.addProduct = addProduct;\nexports.removeProduct = removeProduct;\n\n},{\"./page\":29,\"./util\":79,\"promise\":112}],9:[function(require,module,exports){\n'use strict';\n\nvar productTile = require('./product-tile');\nvar slickButtonsHeight = require('./slickButtonsHeight');\nvar preloader = require('./preloader');\n\nexports.init = function () {\n initEditorialBannerPosition(); // required for GTM events\n setContentSliders();\n loadContentVimeo();\n loadContentVideos();\n setContentDynamicSize();\n initProductCardEvents();\n};\n\nfunction loadContentVimeo() {\n\n if ($(\".video-player\").length > 0) {\n $.getScript(\"https://player.vimeo.com/api/player.js\");\n $(\".video-player\").on(\"click\", function () {\n\n var player = new Vimeo.Player($(this).find(\".video-geox\"));\n\n var allVideo = new Vimeo.Player($(\".video-geox\"));\n\n //all video pause\n allVideo.pause();\n player.pause();\n $('.i-video_play').css({\n opacity: 1\n }); //show controls\n $('.video-gradient').css({\n opacity: 1\n });\n\n if ($(this).hasClass(\"playing\")) {\n $(this).find('.i-video_play').css({\n opacity: 1\n });\n $(this).find('.video-gradient').css({\n opacity: 1\n });\n player.pause();\n allVideo.pause();\n $(\".video-player\").removeClass(\"playing\");\n\n } else {\n\n $(this).find(\".video-geox\").addClass(\"playing\");\n $(\".video-player\").removeClass(\"playing\");\n $(this).addClass(\"playing\");\n $(this).find('.i-video_play').css({\n opacity: 0\n });\n $(this).find('.video-gradient').css({\n opacity: 0\n });\n player.play();\n }\n });\n }\n};\n\n\nfunction setContentSliders() {\n\n /* Slider mobile 3 columns */\n if ($(\".slider-mobile-3col\").length > 0) {\n if ($(window).width() < 768) {\n $(\".slider-mobile-3col\").slick({\n infinite: true,\n dots: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: false,\n nextArrow: false\n });\n }\n }\n /* Slider mobile 2 columns */\n if ($(\".slider-mobile-2col\").length > 0) {\n if ($(window).width() < 768) {\n $(\".slider-mobile-2col\").slick({\n infinite: true,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2,\n prevArrow: false,\n nextArrow: false\n });\n }\n }\n\n /* Hero slider */\n if ($('.hero-slider').length > 0) {\n\n // Add dots animation on init\n $('.hero-slider .slider').on('init', function (event, slick) {\n if ($('.hero-slider .slick-dots li').length > 1) {\n // unselect first slick dot\n $('.hero-slider .slick-dots li').first().removeClass('slick-active');\n $('.hero-slider .slick-dots li').first().addClass('transition-end');\n // activate animation style\n $(this).find('.slick-dots').addClass('dots-animation');\n }\n\n var $currentSlideFirst = $(\".hero-slider .slider\").find('.slide:not(.slick-cloned)').eq(0);\n\n var $ctaCurrentFirst = $currentSlideFirst.find('.cta-new');\n var buttonLimitFirst = 130;\n var maxWidthFirst = 130;\n\n $ctaCurrentFirst.each(function (index, element) {\n $(element).css('width', '');\n var currentWidthFirst = $(element).outerWidth();\n maxWidthFirst = Math.max(maxWidthFirst, currentWidthFirst);\n });\n\n var unitFirstCss = maxWidthFirst + 'px';\n $ctaCurrentFirst.each(function (index, button) {\n $(button).css('width', unitFirstCss);\n\n if (window.matchMedia('(max-width: 768px)').matches) {\n if (maxWidthFirst > buttonLimitFirst) {\n $('.div').css({\n \"flex-wrap\": \"wrap\"\n });\n }\n }\n });\n });\n\n $('.hero-slider .slider').not('.slick-initialized').slick({\n slidesToShow: 1,\n slidesToScroll: 1,\n arrows: true,\n dots: true,\n infinite: true,\n autoplay: true,\n autoplaySpeed: 5000,\n cssEase: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',\n pauseOnHover: false,\n pauseOnFocus: false,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1279,\n settings: {\n arrows: false\n }\n }]\n });\n $('.hero-slider .slider').on('beforeChange', function (event, slick, currentSlide, nextSlide) {\n var $dots = $(this).find('.slick-dots li');\n if ($dots.length > 1) {\n $dots[currentSlide].addClass('transition-end');\n $dots[nextSlide].removeClass('transition-end');\n }\n\n var $nextSlide = $(\".hero-slider .slider\").find('.slide:not(.slick-cloned)').eq(nextSlide);\n var $ctaNextSlide = $nextSlide.find('.cta-new');\n\n var buttonLimit = 130;\n var maxWidthButton = buttonLimit;\n\n $ctaNextSlide.each(function () {\n var currentWidth = $(this).outerWidth()\n maxWidthButton = Math.max(maxWidthButton, currentWidth);\n });\n\n var unitCss = maxWidthButton + 'px';\n $ctaNextSlide.each(function () {\n $(this).css('width', unitCss);\n\n if (window.matchMedia('(max-width: 768px)').matches) {\n if (maxWidthButton > buttonLimit) {\n $('.div').css({\n \"flex-wrap\": \"wrap\"\n });\n }\n }\n });\n });\n\n // Reset first slide after init\n window.setTimeout(function () {\n $('.hero-slider .slider').slick('slickPlay');\n if ($('.hero-slider .slick-dots li').length > 1) {\n // re-activate first slick dot\n $('.hero-slider .slick-dots li').first().removeClass('transition-end');\n $('.hero-slider .slick-dots li').first().addClass('slick-active');\n }\n }, 500);\n }\n\n /* Slider tablet 4 columns - template cat-banner-slot-5 */\n if ($(\".slider-tablet-4col\").length > 0) {\n if ($(window).width() < 1280) {\n $(\".slider-tablet-4col\").slick({\n infinite: true,\n dots: false,\n slidesToShow: 4,\n slidesToScroll: 4,\n prevArrow: false,\n nextArrow: false,\n responsive: [{\n breakpoint: 768,\n settings: {\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2,\n }\n }]\n });\n };\n }\n\n /* Slider tablet 2 and a half columns - template benefeet - content asset: benefeet-tab1-step-restyle */\n if ($(\".slider-tablet-2colandhalf\").length > 0) {\n if ($(window).width() < 1280) {\n $(\".slider-tablet-2colandhalf\").slick({\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2,\n responsive: [{\n breakpoint: 768,\n settings: {\n dots: true,\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }]\n });\n };\n }\n\n\n /* Slider mobile single column - editorial tiles */\n if ($('.editorial-tiles .slider-mobile').length > 0) {\n if ($(window).width() < 768) {\n $('.editorial-tiles .slider-mobile').slick({\n infinite: false,\n dots: true,\n arrows: false,\n slidesToShow: 1,\n slidesToScroll: 1\n });\n\n var item_length_tiles = $('.editorial-tiles .slider-mobile').find('.slick-slide').length;\n var arrListCard_tiles = $('.editorial-tiles .slider-mobile').find('.slick-slide');\n var lastSlickCard_tiles = arrListCard_tiles[Object.keys(arrListCard_tiles)[item_length_tiles - 1]];\n var firstSlickCard_tiles = arrListCard_tiles[Object.keys(arrListCard_tiles)[0]];\n\n\n $('.editorial-tiles .slider-mobile').on('beforeChange', function (e, s, currentSlideIndex, nextSlide) {\n if (item_length_tiles == nextSlide + 1) {\n lastSlickCard_tiles.addClass('last-card');\n $(lastSlickCard_tiles).parents('.slick-list').css('padding', '0 0 0 10vw');\n firstSlickCard_tiles.removeClass('first-card');\n } else if (nextSlide == 0) {\n firstSlickCard_tiles.addClass('first-card');\n $(firstSlickCard_tiles).parents('.slick-list').css('padding', '0 10vw 0 0');\n lastSlickCard_tiles.removeClass('last-card');\n }\n });\n }\n }\n\n /* Slider mobile single column, slider desktop/tablet 2 columns - editorial tiles carousel */\n if ($('.editorial-tiles-carousel .slider').length > 0) {\n $('.editorial-tiles-carousel .slider').slick({\n infinite: true,\n dots: true,\n arrows: false,\n slidesToShow: 2,\n slidesToScroll: 2,\n responsive: [{\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }]\n });\n }\n\n /* Slider mobile 1 and a half columns, slider desktop/tablet 3 columns - editorial product cards carousel */\n if ($('.editorial-product-cards-carousel .slider').length > 0) {\n $('.editorial-product-cards-carousel .slider').slick({\n infinite: true,\n dots: true,\n arrows: false,\n slidesToShow: 3,\n slidesToScroll: 3,\n responsive: [{\n breakpoint: 768,\n settings: {\n infinite: false,\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }]\n });\n\n\n var item_length = $('.editorial-product-cards-carousel .slider').find('.slick-slide').length - 1;\n $('.editorial-product-cards-carousel .slider').on('afterChange', function (e, s, currentSlideIndex) {\n var lastSlickCard = $('.editorial-product-cards-carousel .slider').find('.slick-slide').closest('.slick-list');\n var containerSlickList = $(lastSlickCard).closest('.container');\n\n if (item_length == currentSlideIndex) {\n lastSlickCard.removeClass('first-card');\n lastSlickCard.addClass('last-card');\n containerSlickList.removeClass('first-container-card');\n containerSlickList.addClass('last-container-card');\n } else if (currentSlideIndex == 0) {\n var firstSlickCard = $('.editorial-product-cards-carousel .slider').find('.slick-slide')[0].closest('.slick-list');\n firstSlickCard.removeClass('last-card');\n firstSlickCard.addClass('first-card');\n var containerSlickList = $(firstSlickCard).closest('.container');\n containerSlickList.removeClass('last-container-card');\n containerSlickList.addClass('first-container-card');\n }\n });\n }\n\n /* Slider mobile 2 columns, slider desktop/tablet 2 columns and a half - editorial look carousel */\n if ($('.editorial-look-carousel .slider').length > 0) {\n // Set slick buttons height on init slider\n var carouselLook = '.editorial-look-carousel .slider';\n $('.editorial-look-carousel .slider').not('.slick-initialized').on('init', function (event, slick) {\n var pre = new preloader();\n var imagesToLoad = [$('.editorial-look-carousel .slider img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselLook, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n $('.editorial-look-carousel .slider').slick({\n infinite: false,\n dots: true,\n arrows: true,\n slidesToShow: 2,\n slidesToScroll: 2,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 768,\n settings: {\n arrows: false\n }\n }]\n });\n\n var item_length_look = $('.editorial-look-carousel .slider').find('.slick-slide').length;\n var arrListCard_look = $('.editorial-look-carousel .slider').find('.slick-slide');\n var lastSlickCard_look = arrListCard_look[Object.keys(arrListCard_look)[item_length_look - 1]];\n var firstSlickCard_look = arrListCard_look[Object.keys(arrListCard_look)[0]];\n\n $('.editorial-look-carousel .slider').on('beforeChange', function (e, s, currentSlideIndex, nextSlide) {\n if (item_length_look == nextSlide + 2) {\n lastSlickCard_look.addClass('last-card');\n $(lastSlickCard_look).parents('.slick-list').css('padding', '0 0 0 10vw');\n firstSlickCard_look.removeClass('first-card');\n } else if (nextSlide == 0) {\n firstSlickCard_look.addClass('first-card');\n $(firstSlickCard_look).parents('.slick-list').css('padding', '0 10vw 0 0');\n lastSlickCard_look.removeClass('last-card');\n }\n });\n }\n}\n\n\n\nfunction loadContentVideos() {\n\n /**\n * Get videos and load custom or default thumbnail\n **/\n var getVideos = function () {\n $('.editorial-header-single-slot, .editorial-storytelling-single, .editorial-storytelling-video').find('.video-container').each(function () {\n // Load videos if visible on current device\n if ($(this).is(':visible')) {\n var videoType, videoElem;\n if ($(this).find('.video-player-youtube').length) {\n videoType = 'youtube';\n videoElem = $(this).find('.video-player-youtube');\n } else if ($(this).find('.video-player-vimeo').length) {\n videoType = 'vimeo';\n videoElem = $(this).find('.video-player-vimeo');\n }\n var videoId = $(videoElem).attr('data-id');\n var videoThumbnail = $(videoElem).attr('data-thumbnail');\n var videoThumbnailHtml = '';\n\n if (typeof videoThumbnail != 'undefined' && videoThumbnail != '') {\n videoThumbnailHtml = createCustomThumbnail(videoThumbnail, videoId);\n } else {\n videoThumbnailHtml = createThumbnail(videoId, videoType);\n }\n\n $(videoElem).append(videoThumbnailHtml);\n createIframe(videoElem, videoId, videoType);\n }\n });\n }\n\n /**\n * Create custom thumbnail from data-attribute provided url\n * @param {string} url\n * @param {string} id The Youtube or Vimeo video id\n * @return {string} The HTML containing the tag\n */\n var createCustomThumbnail = function (url, id) {\n return (\n '\"Video
        '\n );\n }\n\n /**\n * Get Youtube default max resolution thumbnail\n * @param {string} id The Youtube or Vimeo video id\n * @param {string} videoType \"youtube\" or \"vimeo\"\n * @return {string} The HTML containing the tag\n */\n var createThumbnail = function (id, videoType) {\n if (videoType == 'youtube') {\n return (\n '\"Video
        '\n );\n } else if (videoType == 'vimeo') {\n return (\n '
        '\n );\n }\n }\n\n /**\n * Create and load iframe in Youtube or Vimeo container\n **/\n function createIframe(elem, id, videoType) {\n var iframe = $('');\n if (videoType == 'youtube') {\n $(iframe).attr(\n \"src\",\n \"//www.youtube.com/embed/\" +\n id +\n \"?autoplay=0&modestbranding=1&border=0&enablejsapi=1&showinfo=0&rel=0\"\n );\n $(iframe).attr(\"frameborder\", \"0\");\n $(iframe).addClass('youtube-iframe');\n $(iframe).attr('id', 'iframe-' + id);\n $(elem).append(iframe);\n } else if (videoType == 'vimeo') {\n $(iframe).attr(\n \"src\",\n \"//player.vimeo.com/video/\" +\n id +\n \"?title=0&byline=0\"\n );\n $(iframe).attr(\"frameborder\", \"0\");\n $(iframe).attr(\"allow\", \"autoplay; fullscreen; picture-in-picture\");\n $(iframe).addClass('vimeo-iframe');\n $(iframe).attr('id', 'iframe-' + id);\n $(elem).append(iframe);\n }\n }\n\n /**\n * Init video player GTM events\n **/\n var initVideoPlayerEvents = function (elem, eventAction) {\n if (eventAction == 'play') {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '118',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'video',\n 'eventAction': 'play',\n 'eventLabel': $(elem).attr('data-seo-name').replace(/ /g, \"_\")\n });\n } else if (eventAction == 'pause') {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '119',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'video',\n 'eventAction': 'pause',\n 'eventLabel': $(elem).attr('data-seo-name').replace(/ /g, \"_\")\n });\n } else if (eventAction == 'full_view') {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '120',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'video',\n 'eventAction': 'full_view',\n 'eventLabel': $(elem).attr('data-seo-name').replace(/ /g, \"_\")\n });\n }\n }\n\n /**\n * Init video play/pause functions once API is loaded\n **/\n var initVideoPlayer = function () {\n // --- Youtube video player functions --- //\n if ($('.editorial-header-single-slot, .editorial-storytelling-single, .editorial-storytelling-video').find('.video-container').find('.video-player-youtube').length > 0) {\n // 1. This code loads the IFrame Player API code asynchronously.\n var tag = document.createElement('script');\n tag.src = \"https://www.youtube.com/iframe_api\";\n var firstScriptTag = document.getElementsByTagName('script')[0];\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n }\n\n // Set videoPlayer global variable\n window.yt_player = [];\n\n // 2. This function enables you to use the API on your page\n window.onYouTubeIframeAPIReady = function () {\n $('.youtube-iframe').each(function (index, value) {\n window.yt_player[index] = new YT.Player(value.id, {\n events: {\n 'onReady': onPlayerReady(index, value),\n 'onStateChange': onPlayerStateChange\n }\n });\n });\n }\n\n // 3. The API will call this function when the video player is ready.\n function onPlayerReady(index, value) {\n var videoPlayerId = value.id;\n var videoPlayButton = $(value).siblings('.i-video_play');\n $(videoPlayButton).attr('data-index', index);\n\n $(videoPlayButton).on('click', function () {\n var videoContainer = $(this).parents('.video-player-youtube');\n var index = parseInt($(this).attr('data-index'));\n if ($(videoContainer).hasClass('playing')) {\n (window.yt_player[index]).pauseVideo();\n $(videoContainer).removeClass('playing');\n } else {\n if (window.navigator.userAgent.toLowerCase().indexOf(\"chrome\") > -1) {\n (window.yt_player[index]).mute();\n }\n (window.yt_player[index]).playVideo();\n $(videoContainer).addClass('playing');\n }\n });\n }\n\n // 4. The API calls this function when the player's state changes.\n function onPlayerStateChange(event) {\n //console.log('onPlayerStateChange - event = ', event)\n var videoPlayerId = event.target.h.id;\n var videoContainer = $('#' + videoPlayerId).parents('.video-player-youtube');\n if (event.data == YT.PlayerState.PLAYING) {\n // Trigger GTM event - play\n initVideoPlayerEvents(videoContainer, 'play');\n } else if (event.data == YT.PlayerState.PAUSED) {\n $(videoContainer).removeClass('playing');\n // Trigger GTM event - pause\n initVideoPlayerEvents(videoContainer, 'pause');\n } else if (event.data == YT.PlayerState.ENDED) {\n $(videoContainer).removeClass('playing');\n // Trigger GTM event - full view\n initVideoPlayerEvents(videoContainer, 'full_view');\n }\n }\n\n // --- Vimeo video player functions --- //\n if ($('.editorial-header-single-slot, .editorial-storytelling-single, .editorial-storytelling-video').find('.video-container').find('.video-player-vimeo').length > 0) {\n // 1. This code loads the IFrame Player API\n $.getScript(\"https://player.vimeo.com/api/player.js\");\n\n // 2. Trigger Vimeo video player events\n var videoPlayButton = $('.video-player-vimeo').find('.i-video_play');\n $(videoPlayButton).on('click', function () {\n var videoContainer = $(this).parents('.video-player-vimeo');\n var videoPlayer = new Vimeo.Player($(videoContainer).find('.vimeo-iframe'));\n if ($(videoContainer).hasClass('playing')) {\n videoPlayer.pause();\n $(videoContainer).removeClass('playing');\n } else {\n videoPlayer.play();\n $(videoContainer).addClass('playing');\n }\n\n videoPlayer.on('play', function (data) {\n if (!$(videoContainer).addClass('playing')) {\n $(videoContainer).addClass('playing');\n }\n // Trigger GTM event - play\n initVideoPlayerEvents(videoContainer, 'play');\n });\n videoPlayer.on('pause', function (data) {\n if ($(videoContainer).addClass('playing')) {\n $(videoContainer).removeClass('playing');\n }\n // Trigger GTM event - pause\n initVideoPlayerEvents(videoContainer, 'pause');\n });\n videoPlayer.on('ended', function (data) {\n if ($(videoContainer).addClass('playing')) {\n $(videoContainer).removeClass('playing');\n }\n // Trigger GTM event - full view\n initVideoPlayerEvents(videoContainer, 'full_view');\n });\n });\n }\n }\n\n /* Load editorial content videos */\n if ($('.editorial-header-single-slot, .editorial-storytelling-single, .editorial-storytelling-video').find('.video-container').length > 0) {\n getVideos();\n initVideoPlayer();\n }\n\n if ($('.editorial-header-single-slot, .editorial-launch-full-background, .editorial-launch-landscape, .editorial-storytelling-video-review').find('.video-container').length > 0) {\n $.getScript(\"https://player.vimeo.com/api/player.js\");\n\n var dataId = $('#specialVideo').attr('data-id');\n var dataAutoplay = $('#specialVideo').attr('data-autoplay');\n var dataControls = $('#specialVideo').attr('data-controls');\n\n\n var options = {\n url: \"https://player.vimeo.com/video/\",\n id: dataId,\n autoplay: dataAutoplay,\n autopause: false,\n loop: false,\n muted: true,\n controls: dataControls\n };\n\n\n var videoPlayer = new Vimeo.Player('specialVideo', options);\n\n var eventID = '128';\n var eventCategory = 'video';\n var title = '';\n var position = '';\n if ($('.editorial-storytelling-video-review').find('.video-container').length > 0) {\n eventID = '26';\n\n eventCategory = 'home_slider';\n title = $('#specialVideo').attr('data-seo-name').toLowerCase().replace(/ /g, \"_\");\n position = $('#specialVideo').parents('.slide').data('position');\n }\n\n videoPlayer.on('play', function (data) {\n var eventActionString = 'play';\n\n if (title != '' && dataAutoplay) {\n if (data.percent > 0) {\n eventActionString = title + '_video_play';\n } else {\n eventActionString = title + '_video_autoplay';\n }\n\n } else if (title != '' && !dataAutoplay) {\n eventActionString = title + '_video_play';\n } else if (title === '' && dataAutoplay) {\n\n if (data.percent > 0) {\n eventActionString = 'play';\n } else {\n eventActionString = 'autoplay';\n }\n }\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': eventID,\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': eventCategory,\n 'eventAction': eventActionString,\n 'eventLabel': position != '' ? position : $('#specialVideo').attr('data-seo-name').toLowerCase().replace(/ /g, \"_\")\n });\n });\n\n videoPlayer.on('pause', function (data) {\n //Check on percentage of completion. If equal to 1 pause event it must not be tracked.\n if (data.percent < 1) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': eventID,\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': eventCategory,\n 'eventAction': title != '' ? title + '_video_pause' : 'pause',\n 'eventLabel': position != '' ? position : $('#specialVideo').attr('data-seo-name').toLowerCase().replace(/ /g, \"_\")\n });\n }\n });\n\n\n videoPlayer.on('ended', function () {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': eventID,\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': eventCategory,\n 'eventAction': title != '' ? title + '_video_full_view' : 'full_view',\n 'eventLabel': position != '' ? position : $('#specialVideo').attr('data-seo-name').toLowerCase().replace(/ /g, \"_\")\n });\n });\n }\n}\n\nfunction setContentDynamicSize() {\n /* Editorial header single slot - set background size based on content height */\n if ($('.editorial-header-single-slot').length > 0) {\n $('.editorial-header-single-slot').each(function () {\n var elem = $(this);\n $(this).find('.media-wrapper .img-responsive').on('load', function () {\n var bottomContentHeight = $(elem).find('.media-wrapper').height();\n var paddingBottom = parseInt($(elem).css('padding-bottom'));\n var bgSpacingBottom = paddingBottom + bottomContentHeight / 2;\n });\n });\n }\n\n /* Editorial header double - set background size based on content height */\n if ($('.editorial-header-double').length > 0) {\n $('.editorial-header-double').each(function () {\n var elem = $(this);\n $(this).find('.card-wrapper').first().find('.img-responsive').on('load', function () {\n var topContentHeight = $(elem).find('.text-wrapper').height();\n var bottomContentHeight = $(elem).find('.card-wrapper').first().height();\n var paddingTop = parseInt($(elem).css('padding-top'));\n if (window.matchMedia('(max-width: 1024px)').matches) {\n var bgHeight = topContentHeight + (bottomContentHeight / 3.5) + paddingTop;\n } else {\n var bgHeight = topContentHeight + (bottomContentHeight / 2) + paddingTop;\n }\n });\n\n if (window.matchMedia('(min-width: 768px)').matches) {\n if ($(this).find('.logo-wrapper').length > 0 && $(this).find('.default-title').length <= 0) {\n $(this).find('.logo-wrapper').css(\"margin-top\", \"25px\");\n } else if ($(this).find('.default-title').length > 0 && $(this).find('.logo-wrapper').length <= 0) {\n $(this).find('.default-title').css(\"margin-top\", \"50px\");\n }\n } else if (window.matchMedia('(max-width: 768px)').matches) {\n if ($(this).find('.logo-wrapper').length > 0 && $(this).find('.default-title').length <= 0) {\n $(this).find('.logo-wrapper').css(\"margin-bottom\", \"36px\");\n } else if ($(this).find('.default-title').length > 0 && $(this).find('.logo-wrapper').length <= 0) {\n $(this).find('.default-title').css(\"margin-bottom\", \"45px\");\n }\n }\n });\n }\n\n /* Editorial product cards carousel - equalize product cards height */\n if ($('.editorial-product-cards-carousel').length > 0 || $('.editorial-tiles').length > 0) {\n $('.editorial-product-cards-carousel, .editorial-tiles').each(function () {\n var elem = $(this);\n var cardMaxHeight = 0;\n $(elem).find('.product-card-container').last().find('.img-responsive').on('load', function () {\n $(elem).find('.product-card-container').each(function () {\n if ($(this).height() > cardMaxHeight) {\n cardMaxHeight = $(this).height();\n }\n });\n $(elem).find('.product-card-container').height(cardMaxHeight);\n $(elem).find('.slider').slick('resize');\n });\n });\n }\n\n /* Editorial launch full background - equalize cta width */\n if ($('.editorial-launch-full-background').length > 0) {\n $('.editorial-launch-full-background').each(function () {\n var $ctaContainer = $(this).find(\".content-element .content-cta\");\n var quantityCta = $ctaContainer.find('.button').length;\n\n if (quantityCta >= 2) {\n var $ctaCurrent = $ctaContainer.find('.button');\n var maxWidth = 276;\n\n $ctaCurrent.each(function (index, element) {\n $(element).css('width', '');\n var currentWidth = $(element).outerWidth();\n maxWidth = Math.max(maxWidth, currentWidth);\n });\n\n var unitFirst = maxWidth + 'px';\n var buttonLimit = 276 + 'px';\n\n $ctaCurrent.each(function (index, button) {\n $(button).css('width', unitFirst);\n\n if (unitFirst > buttonLimit) {\n $(button).css({\n \"max-width\": \"276px\"\n });\n }\n\n /*if (window.matchMedia('(max-width: 768px)').matches) {\n $('.div').css({\n \"flex-wrap\": \"wrap\"\n });\n }*/\n });\n }\n });\n }\n\n\n}\n\nfunction initEditorialBannerPosition() {\n /* Editorial landing pages - get CTA position for GTM events (banner position inside landing page) */\n var position = 1;\n // count landing page banner with CTA or image with link\n var editorialElements = $('#main').children('div[class^=editorial-]');\n $(editorialElements).each(function () {\n if ($(this).find('.button').length || $(this).find('a').length) {\n // banner with multiple columns content - set position attribute to each column\n // --- TODO add other editorial banner classes here (for new editorial modules) --- //\n if ($(this).hasClass('editorial-launch-portrait') || $(this).hasClass('editorial-header-double') || $(this).hasClass('editorial-tiles') || $(this).hasClass('editorial-tiles-carousel')) {\n var column = $(this).find('.col').not('.slick-cloned');\n $(column).each(function (index, elem) {\n if ($(this).find('.button, a').length) {\n $(this).find('.button, a').attr('data-position', position);\n position++;\n }\n });\n } else {\n // banner with single column or fullwidth content\n if ($(this).find('.button, a').length) {\n $(this).find('.button, a').attr('data-position', position);\n position++;\n }\n }\n }\n });\n}\n\nfunction initProductCardEvents() {\n\n /* Editorial look 2 products - update custom product card images */\n if ($('.editorial-look .product-tiles-look').length > 0) {\n $('.editorial-look .product-tiles-look').each(function () {\n var productCardImage = null;\n if ($(this).attr('data-product-image') != '') {\n productCardImage = $(this).attr('data-product-image'); // img tag\n }\n if (productCardImage != null) {\n $(this).find('.image-wrapper').append(productCardImage);\n $(this).find('.product-image').addClass('product-image-custom');\n }\n });\n }\n\n /* Init product card events (productTile + productImpression) */\n if ($('.editorial-product-cards .product-card-container').length > 0 || $('.editorial-product-cards-carousel .product-card-container').length > 0 || $('.editorial-look .product-tile-container').length > 0 || $('.editorial-look-carousel .product-tile-container').length > 0) {\n productTile.init('.editorial-product-cards .product-card-container', false);\n productTile.init('.editorial-product-cards-carousel .product-card-container', false);\n productTile.init('.editorial-look .product-tile-container', false);\n productTile.init('.editorial-look-carousel .product-tile-container', false);\n // init productImpression for all product cards\n $(document).trigger('impressions:init');\n }\n\n\n if ($('.editorial-new-listing-product-cards').length > 0) {\n if (window.matchMedia('(max-width: 768px)').matches) {\n var mobileBackground = 'url(' + $('.editorial-new-listing-product-cards').attr('data-src-sm') + ')';\n $('.editorial-new-listing-product-cards').css('background-image', mobileBackground);\n } else {\n var desktopBackground = 'url(' + $('.editorial-new-listing-product-cards').attr('data-src-lg') + ')';\n $('.editorial-new-listing-product-cards').css('background-image', desktopBackground);\n }\n }\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n},{\"./preloader\":64,\"./product-tile\":65,\"./slickButtonsHeight\":73}],10:[function(require,module,exports){\n'use strict';\n\nfunction enableCookies() {\n //if (document.cookie.indexOf('dw=1') < 0) {\n document.cookie = 'dw=1; path=/; secure; samesite=None';\n //}\n\n //if (document.cookie.indexOf('dw_cookies_accepted') < 0) {\n document.cookie = 'dw_cookies_accepted=1; path=/; secure; samesite=None';\n //}\n}\n\nmodule.exports = function () {\n\n enableCookies();\n \n};\n\n},{}],11:[function(require,module,exports){\n'use strict';\n\n/**\n * @description Generate a pop-up for \"Change country\" notification\n */\n// For Effects use: show: { effect: \"fade\", duration: 300 }, hide: 'drop',\nvar changeCountry = function() {\n\t$('#change-country-alert-close-button').on('click', function() {\n $('#change-country-alert').hide();\n });\n};\n\nexports.init = function init () {\n $('.country-selector .current-country').on('click', function () {\n $('.country-selector .selector').toggleClass('active');\n $(this).toggleClass('selector-active');\n });\n // set currency first before reload\n $('.country-selector .selector .locale').on('click', function (e) {\n e.preventDefault();\n var url = this.href;\n var currency = this.getAttribute('data-currency');\n $.ajax({\n dataType: 'json',\n url: Urls.setSessionCurrency,\n data: {\n format: 'ajax',\n currencyMnemonic: currency\n }\n })\n .done(function (response) {\n if (!response.success) {\n throw new Error('Unable to set currency');\n }\n window.location.href = url;\n });\n });\n \n changeCountry();\n};\n\n},{}],12:[function(require,module,exports){\n'use strict';\n\n\nfunction init (){\n\t$(\"body\").find(\"form.geox-form\").each(function(){\n\t\tgetAndInsertCSRFToken($(this).prop(\"id\"));\n\t});\n};\n\nfunction getAndInsertCSRFToken(formid){\n $(document).ready(function(){\n $.ajax(\n { \n url: Urls.csrfnew, \n context: document.body,\n dataType: 'json',\n success: function(data, status){\n insertCSRFForm(data, formid);\n },\n error: function(xhr, status, error){\n console.log('error during csrf call ' + error);\n }\n }\n );\n }); \n}\n\nfunction insertCSRFForm(csrfjson, formid){\n var csrf_name = csrfjson.csrf_token_name;\n var csrf_value = csrfjson.csrf_token_value;\n var form = document.getElementById(formid);\n var children = form.children;\n \n var csrfElement = children.namedItem(csrf_name);\n if(csrfElement){\n \tcsrfElement.value = csrf_value;\n } else{\n \tcsrfElement = document.createElement(\"input\");\n \tcsrfElement.type = \"hidden\";\n \tcsrfElement.name = csrf_name;\n \tcsrfElement.value = csrf_value;\n \n form.insertBefore(csrfElement, children[children.length-1]); \n }\n}\n\n\nexports.init = init;\n},{}],13:[function(require,module,exports){\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['exports'], factory);\n } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {\n // CommonJS\n factory(exports);\n } else {\n // Browser globals\n factory(root.IBAN = {});\n }\n}(this, function(exports){\n\n // Array.prototype.map polyfill\n // code from https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map\n if (!Array.prototype.map){\n Array.prototype.map = function(fun /*, thisArg */){\n \"use strict\";\n\n if (this === void 0 || this === null)\n throw new TypeError();\n\n var t = Object(this);\n var len = t.length >>> 0;\n if (typeof fun !== \"function\")\n throw new TypeError();\n\n var res = new Array(len);\n var thisArg = arguments.length >= 2 ? arguments[1] : void 0;\n for (var i = 0; i < len; i++)\n {\n // NOTE: Absolute correctness would demand Object.defineProperty\n // be used. But this method is fairly new, and failure is\n // possible only if Object.prototype or Array.prototype\n // has a property |i| (very unlikely), so use a less-correct\n // but more portable alternative.\n if (i in t)\n res[i] = fun.call(thisArg, t[i], i, t);\n }\n\n return res;\n };\n }\n\n var A = 'A'.charCodeAt(0),\n Z = 'Z'.charCodeAt(0);\n\n /**\n * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to\n * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616.\n *\n * @param {string} iban the IBAN\n * @returns {string} the prepared IBAN\n */\n function iso13616Prepare(iban) {\n iban = iban.toUpperCase();\n iban = iban.substr(4) + iban.substr(0,4);\n\n return iban.split('').map(function(n){\n var code = n.charCodeAt(0);\n if (code >= A && code <= Z){\n // A = 10, B = 11, ... Z = 35\n return code - A + 10;\n } else {\n return n;\n }\n }).join('');\n }\n\n /**\n * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064.\n *\n * @param iban\n * @returns {number}\n */\n function iso7064Mod97_10(iban) {\n var remainder = iban,\n block;\n\n while (remainder.length > 2){\n block = remainder.slice(0, 9);\n remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);\n }\n\n return parseInt(remainder, 10) % 97;\n }\n\n /**\n * Parse the BBAN structure used to configure each IBAN Specification and returns a matching regular expression.\n * A structure is composed of blocks of 3 characters (one letter and 2 digits). Each block represents\n * a logical group in the typical representation of the BBAN. For each group, the letter indicates which characters\n * are allowed in this group and the following 2-digits number tells the length of the group.\n *\n * @param {string} structure the structure to parse\n * @returns {RegExp}\n */\n function parseStructure(structure){\n // split in blocks of 3 chars\n var regex = structure.match(/(.{3})/g).map(function(block){\n\n // parse each structure block (1-char + 2-digits)\n var format,\n pattern = block.slice(0, 1),\n repeats = parseInt(block.slice(1), 10);\n\n switch (pattern){\n case \"A\": format = \"0-9A-Za-z\"; break;\n case \"B\": format = \"0-9A-Z\"; break;\n case \"C\": format = \"A-Za-z\"; break;\n case \"F\": format = \"0-9\"; break;\n case \"L\": format = \"a-z\"; break;\n case \"U\": format = \"A-Z\"; break;\n case \"W\": format = \"0-9a-z\"; break;\n }\n\n return '([' + format + ']{' + repeats + '})';\n });\n\n return new RegExp('^' + regex.join('') + '$');\n }\n\n /**\n *\n * @param iban\n * @returns {string}\n */\n function electronicFormat(iban){\n return iban.replace(NON_ALPHANUM, '').toUpperCase();\n }\n\n\n /**\n * Create a new Specification for a valid IBAN number.\n *\n * @param countryCode the code of the country\n * @param length the length of the IBAN\n * @param structure the structure of the underlying BBAN (for validation and formatting)\n * @param example an example valid IBAN\n * @constructor\n */\n function Specification(countryCode, length, structure, example){\n\n this.countryCode = countryCode;\n this.length = length;\n this.structure = structure;\n this.example = example;\n }\n\n /**\n * Lazy-loaded regex (parse the structure and construct the regular expression the first time we need it for validation)\n */\n Specification.prototype._regex = function(){\n return this._cachedRegex || (this._cachedRegex = parseStructure(this.structure))\n };\n\n /**\n * Check if the passed iban is valid according to this specification.\n *\n * @param {String} iban the iban to validate\n * @returns {boolean} true if valid, false otherwise\n */\n Specification.prototype.isValid = function(iban, countryCode){\n return this.length == iban.length\n && this.countryCode === iban.slice(0,2)\n && this.countryCode === countryCode\n && this._regex().test(iban.slice(4))\n && iso7064Mod97_10(iso13616Prepare(iban)) == 1;\n };\n\n /**\n * Convert the passed IBAN to a country-specific BBAN.\n *\n * @param iban the IBAN to convert\n * @param separator the separator to use between BBAN blocks\n * @returns {string} the BBAN\n */\n Specification.prototype.toBBAN = function(iban, separator) {\n return this._regex().exec(iban.slice(4)).slice(1).join(separator);\n };\n\n /**\n * Convert the passed BBAN to an IBAN for this country specification.\n * Please note that \"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account\".\n * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits\n *\n * @param bban the BBAN to convert to IBAN\n * @returns {string} the IBAN\n */\n Specification.prototype.fromBBAN = function(bban) {\n if (!this.isValidBBAN(bban)){\n throw new Error('Invalid BBAN');\n }\n\n var remainder = iso7064Mod97_10(iso13616Prepare(this.countryCode + '00' + bban)),\n checkDigit = ('0' + (98 - remainder)).slice(-2);\n\n return this.countryCode + checkDigit + bban;\n };\n\n /**\n * Check of the passed BBAN is valid.\n * This function only checks the format of the BBAN (length and matching the letetr/number specs) but does not\n * verify the check digit.\n *\n * @param bban the BBAN to validate\n * @returns {boolean} true if the passed bban is a valid BBAN according to this specification, false otherwise\n */\n Specification.prototype.isValidBBAN = function(bban) {\n return this.length - 4 == bban.length\n && this._regex().test(bban);\n };\n\n var countries = {};\n\n function addSpecification(IBAN){\n countries[IBAN.countryCode] = IBAN;\n }\n\n// addSpecification(new Specification(\"AD\", 24, \"F04F04A12\", \"AD1200012030200359100100\"));\n// addSpecification(new Specification(\"AE\", 23, \"F03F16\", \"AE070331234567890123456\"));\n// addSpecification(new Specification(\"AL\", 28, \"F08A16\", \"AL47212110090000000235698741\"));\n// addSpecification(new Specification(\"AT\", 20, \"F05F11\", \"AT611904300234573201\"));\n// addSpecification(new Specification(\"AZ\", 28, \"U04A20\", \"AZ21NABZ00000000137010001944\"));\n// addSpecification(new Specification(\"BA\", 20, \"F03F03F08F02\", \"BA391290079401028494\"));\n// addSpecification(new Specification(\"BE\", 16, \"F03F07F02\", \"BE68539007547034\"));\n// addSpecification(new Specification(\"BG\", 22, \"U04F04F02A08\", \"BG80BNBG96611020345678\"));\n// addSpecification(new Specification(\"BH\", 22, \"U04A14\", \"BH67BMAG00001299123456\"));\n// addSpecification(new Specification(\"BR\", 29, \"F08F05F10U01A01\", \"BR9700360305000010009795493P1\"));\n// addSpecification(new Specification(\"BY\", 28, \"A04F04A16\", \"BY13NBRB3600900000002Z00AB00\"));\n// addSpecification(new Specification(\"CH\", 21, \"F05A12\", \"CH9300762011623852957\"));\n// addSpecification(new Specification(\"CR\", 22, \"F04F14\", \"CR72012300000171549015\"));\n// addSpecification(new Specification(\"CY\", 28, \"F03F05A16\", \"CY17002001280000001200527600\"));\n// addSpecification(new Specification(\"CZ\", 24, \"F04F06F10\", \"CZ6508000000192000145399\"));\n addSpecification(new Specification(\"DE\", 22, \"F08F10\", \"DE89370400440532013000\"));\n// addSpecification(new Specification(\"DK\", 18, \"F04F09F01\", \"DK5000400440116243\"));\n// addSpecification(new Specification(\"DO\", 28, \"U04F20\", \"DO28BAGR00000001212453611324\"));\n// addSpecification(new Specification(\"EE\", 20, \"F02F02F11F01\", \"EE382200221020145685\"));\n addSpecification(new Specification(\"ES\", 24, \"F04F04F01F01F10\", \"ES9121000418450200051332\"));\n// addSpecification(new Specification(\"FI\", 18, \"F06F07F01\", \"FI2112345600000785\"));\n// addSpecification(new Specification(\"FO\", 18, \"F04F09F01\", \"FO6264600001631634\"));\n addSpecification(new Specification(\"FR\", 27, \"F05F05A11F02\", \"FR1420041010050500013M02606\"));\n addSpecification(new Specification(\"GB\", 22, \"U04F06F08\", \"GB29NWBK60161331926819\"));\n// addSpecification(new Specification(\"GE\", 22, \"U02F16\", \"GE29NB0000000101904917\"));\n// addSpecification(new Specification(\"GI\", 23, \"U04A15\", \"GI75NWBK000000007099453\"));\n// addSpecification(new Specification(\"GL\", 18, \"F04F09F01\", \"GL8964710001000206\"));\n addSpecification(new Specification(\"GR\", 27, \"F03F04A16\", \"GR1601101250000000012300695\"));\n// addSpecification(new Specification(\"GT\", 28, \"A04A20\", \"GT82TRAJ01020000001210029690\"));\n// addSpecification(new Specification(\"HR\", 21, \"F07F10\", \"HR1210010051863000160\"));\n// addSpecification(new Specification(\"HU\", 28, \"F03F04F01F15F01\", \"HU42117730161111101800000000\"));\n// addSpecification(new Specification(\"IE\", 22, \"U04F06F08\", \"IE29AIBK93115212345678\"));\n// addSpecification(new Specification(\"IL\", 23, \"F03F03F13\", \"IL620108000000099999999\"));\n// addSpecification(new Specification(\"IS\", 26, \"F04F02F06F10\", \"IS140159260076545510730339\"));\n addSpecification(new Specification(\"IT\", 27, \"U01F05F05A12\", \"IT60X0542811101000000123456\"));\n// addSpecification(new Specification(\"IQ\", 23, \"U04F03A12\", \"IQ98NBIQ850123456789012\"));\n// addSpecification(new Specification(\"JO\", 30, \"A04F22\", \"JO15AAAA1234567890123456789012\"));\n// addSpecification(new Specification(\"KW\", 30, \"U04A22\", \"KW81CBKU0000000000001234560101\"));\n// addSpecification(new Specification(\"KZ\", 20, \"F03A13\", \"KZ86125KZT5004100100\"));\n// addSpecification(new Specification(\"LB\", 28, \"F04A20\", \"LB62099900000001001901229114\"));\n// addSpecification(new Specification(\"LC\", 32, \"U04F24\", \"LC07HEMM000100010012001200013015\"));\n// addSpecification(new Specification(\"LI\", 21, \"F05A12\", \"LI21088100002324013AA\"));\n// addSpecification(new Specification(\"LT\", 20, \"F05F11\", \"LT121000011101001000\"));\n// addSpecification(new Specification(\"LU\", 20, \"F03A13\", \"LU280019400644750000\"));\n// addSpecification(new Specification(\"LV\", 21, \"U04A13\", \"LV80BANK0000435195001\"));\n addSpecification(new Specification(\"MC\", 27, \"F05F05A11F02\", \"MC5811222000010123456789030\"));\n// addSpecification(new Specification(\"MD\", 24, \"U02A18\", \"MD24AG000225100013104168\"));\n// addSpecification(new Specification(\"ME\", 22, \"F03F13F02\", \"ME25505000012345678951\"));\n// addSpecification(new Specification(\"MK\", 19, \"F03A10F02\", \"MK07250120000058984\"));\n// addSpecification(new Specification(\"MR\", 27, \"F05F05F11F02\", \"MR1300020001010000123456753\"));\n// addSpecification(new Specification(\"MT\", 31, \"U04F05A18\", \"MT84MALT011000012345MTLCAST001S\"));\n// addSpecification(new Specification(\"MU\", 30, \"U04F02F02F12F03U03\", \"MU17BOMM0101101030300200000MUR\"));\n// addSpecification(new Specification(\"NL\", 18, \"U04F10\", \"NL91ABNA0417164300\"));\n// addSpecification(new Specification(\"NO\", 15, \"F04F06F01\", \"NO9386011117947\"));\n// addSpecification(new Specification(\"PK\", 24, \"U04A16\", \"PK36SCBL0000001123456702\"));\n addSpecification(new Specification(\"PL\", 28, \"F08F16\", \"PL61109010140000071219812874\"));\n// addSpecification(new Specification(\"PS\", 29, \"U04A21\", \"PS92PALS000000000400123456702\"));\n addSpecification(new Specification(\"PT\", 25, \"F04F04F11F02\", \"PT50000201231234567890154\"));\n// addSpecification(new Specification(\"QA\", 29, \"U04A21\", \"QA30AAAA123456789012345678901\"));\n// addSpecification(new Specification(\"RO\", 24, \"U04A16\", \"RO49AAAA1B31007593840000\"));\n// addSpecification(new Specification(\"RS\", 22, \"F03F13F02\", \"RS35260005601001611379\"));\n// addSpecification(new Specification(\"SA\", 24, \"F02A18\", \"SA0380000000608010167519\"));\n// addSpecification(new Specification(\"SC\", 31, \"U04F04F16U03\", \"SC18SSCB11010000000000001497USD\"));\n addSpecification(new Specification(\"SE\", 24, \"F03F16F01\", \"SE4550000000058398257466\"));\n addSpecification(new Specification(\"SI\", 19, \"F05F08F02\", \"SI56263300012039086\"));\n addSpecification(new Specification(\"SK\", 24, \"F04F06F10\", \"SK3112000000198742637541\"));\n// addSpecification(new Specification(\"SM\", 27, \"U01F05F05A12\", \"SM86U0322509800000000270100\"));\n// addSpecification(new Specification(\"ST\", 25, \"F08F11F02\", \"ST68000100010051845310112\"));\n// addSpecification(new Specification(\"SV\", 28, \"U04F20\", \"SV62CENR00000000000000700025\"));\n// addSpecification(new Specification(\"TL\", 23, \"F03F14F02\", \"TL380080012345678910157\"));\n// addSpecification(new Specification(\"TN\", 24, \"F02F03F13F02\", \"TN5910006035183598478831\"));\n// addSpecification(new Specification(\"TR\", 26, \"F05F01A16\", \"TR330006100519786457841326\"));\n// addSpecification(new Specification(\"UA\", 29, \"F25\", \"UA511234567890123456789012345\"));\n// addSpecification(new Specification(\"VG\", 24, \"U04F16\", \"VG96VPVG0000012345678901\"));\n// addSpecification(new Specification(\"XK\", 20, \"F04F10F02\", \"XK051212012345678906\"));\n\n\n // The following countries are not included in the official IBAN registry but use the IBAN specification\n\n // Angola\n// addSpecification(new Specification(\"AO\", 25, \"F21\", \"AO69123456789012345678901\"));\n // Burkina\n// addSpecification(new Specification(\"BF\", 27, \"F23\", \"BF2312345678901234567890123\"));\n // Burundi\n// addSpecification(new Specification(\"BI\", 16, \"F12\", \"BI41123456789012\"));\n // Benin\n// addSpecification(new Specification(\"BJ\", 28, \"F24\", \"BJ39123456789012345678901234\"));\n // Ivory\n// addSpecification(new Specification(\"CI\", 28, \"U01F23\", \"CI17A12345678901234567890123\"));\n // Cameron\n// addSpecification(new Specification(\"CM\", 27, \"F23\", \"CM9012345678901234567890123\"));\n // Cape Verde\n// addSpecification(new Specification(\"CV\", 25, \"F21\", \"CV30123456789012345678901\"));\n // Algeria\n// addSpecification(new Specification(\"DZ\", 24, \"F20\", \"DZ8612345678901234567890\"));\n // Iran\n// addSpecification(new Specification(\"IR\", 26, \"F22\", \"IR861234568790123456789012\"));\n // Madagascar\n// addSpecification(new Specification(\"MG\", 27, \"F23\", \"MG1812345678901234567890123\"));\n // Mali\n// addSpecification(new Specification(\"ML\", 28, \"U01F23\", \"ML15A12345678901234567890123\"));\n // Mozambique\n// addSpecification(new Specification(\"MZ\", 25, \"F21\", \"MZ25123456789012345678901\"));\n // Senegal\n// addSpecification(new Specification(\"SN\", 28, \"U01F23\", \"SN52A12345678901234567890123\"));\n\n var NON_ALPHANUM = /[^a-zA-Z0-9]/g,\n EVERY_FOUR_CHARS =/(.{4})(?!$)/g;\n\n /**\n * Utility function to check if a variable is a String.\n *\n * @param v\n * @returns {boolean} true if the passed variable is a String, false otherwise.\n */\n function isString(v){\n return (typeof v == 'string' || v instanceof String);\n }\n\n /**\n * Check if an IBAN is valid.\n *\n * @param {String} iban the IBAN to validate.\n * @returns {boolean} true if the passed IBAN is valid, false otherwise\n */\n exports.isValid = function(iban, countryCode){\n if (!isString(iban) || !isString(countryCode)){\n return false;\n }\n \n iban = electronicFormat(iban);\n var countryStructure = countries[iban.slice(0,2)];\n return !!countryStructure && countryStructure.isValid(iban, countryCode);\n };\n\n /**\n * Convert an IBAN to a BBAN.\n *\n * @param iban\n * @param {String} [separator] the separator to use between the blocks of the BBAN, defaults to ' '\n * @returns {string|*}\n */\n exports.toBBAN = function(iban, separator){\n if (typeof separator == 'undefined'){\n separator = ' ';\n }\n iban = electronicFormat(iban);\n var countryStructure = countries[iban.slice(0,2)];\n if (!countryStructure) {\n throw new Error('No country with code ' + iban.slice(0,2));\n }\n return countryStructure.toBBAN(iban, separator);\n };\n\n /**\n * Convert the passed BBAN to an IBAN for this country specification.\n * Please note that \"generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account\".\n * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits\n *\n * @param countryCode the country of the BBAN\n * @param bban the BBAN to convert to IBAN\n * @returns {string} the IBAN\n */\n exports.fromBBAN = function(countryCode, bban){\n var countryStructure = countries[countryCode];\n if (!countryStructure) {\n throw new Error('No country with code ' + countryCode);\n }\n return countryStructure.fromBBAN(electronicFormat(bban));\n };\n\n /**\n * Check the validity of the passed BBAN.\n *\n * @param countryCode the country of the BBAN\n * @param bban the BBAN to check the validity of\n */\n exports.isValidBBAN = function(countryCode, bban){\n if (!isString(bban)){\n return false;\n }\n var countryStructure = countries[countryCode];\n return countryStructure && countryStructure.isValidBBAN(electronicFormat(bban));\n };\n\n /**\n *\n * @param iban\n * @param separator\n * @returns {string}\n */\n exports.printFormat = function(iban, separator){\n if (typeof separator == 'undefined'){\n separator = ' ';\n }\n return electronicFormat(iban).replace(EVERY_FOUR_CHARS, \"$1\" + separator);\n };\n\n exports.electronicFormat = electronicFormat;\n /**\n * An object containing all the known IBAN specifications.\n */\n exports.countries = countries;\n\n}));\n},{}],14:[function(require,module,exports){\n'use strict';\n\n\nvar wrapperSelector = '.minipop';\nvar triggerSelector = '.minipop__trigger';\nvar closerSelector = '.minipop__closer';\nvar renderSelector = '.minipop__render';\nvar openClass = 'minipop__render--open';\nvar $content;\nvar dialog = require('../dialog');\nvar validator = require('../validator');\n\n\n\nvar init = function (isInitFromTile) {\n $(triggerSelector).unbind(\"click\");\n $(triggerSelector).on('click', triggerHandler);\n\n $(closerSelector).unbind(\"click\");\n $(closerSelector).on('click', closerHandler);\n\n $(renderSelector).unbind(\"mouseleave\");\n $(renderSelector).on('mouseleave', closerHandler);\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nfunction triggerHandler(e) {\n e.preventDefault();\n $content = $(this).closest(wrapperSelector).find(renderSelector);\n var tooltip = window.Resources.POPUP_LOGIN_TOOLTIP;\n $content.find('.minipop__description').text(tooltip);\n $content.toggleClass(openClass);\n $(this).find(\".login-wishlist\").unbind(\"click\");\n $(this).find(\".login-wishlist\").on('click', miniPopLoginClickHandler);\n\n if ($content.hasClass('minipop__render--open')) {\n //set item on carousel products after add to wishlist\n sessionStorage.setItem('registrationType', 'related_products');\n sessionStorage.setItem('loginFrom', 'related_products');\n\n var sku = $(this).siblings('.pid').data('vgsku');\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '131',\n 'ss_event_if': getTimestampAlphanumericString(),\n 'eventCategory': 'product',\n 'eventAction': 'click_wishlist',\n 'eventLabel': 'product_listing',\n 'sku': sku\n });\n }\n\n return false;\n}\n\n\nfunction closerHandler(e) {\n\n if ($content !== undefined) {\n var closeEvent = false;\n\n if (dataLayer.filter(function (e) {\n return e.eventID === '132';\n }).length > 0) {\n\n closeEvent = true;\n }\n $content.removeClass(openClass);\n if (!closeEvent) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '132',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'popup',\n 'eventAction': 'close_popup',\n 'eventLabel': 'product_listing'\n });\n }\n\n }\n\n return false;\n}\n\nvar miniPopLoginClickHandler = function (e) {\n e.preventDefault();\n\n if (typeof $(this).attr('data-loginpopup-url') != 'undefined') {\n // Case: open login popup\n dialog.open({\n validator: validator,\n url: $(this).attr('data-loginpopup-url'),\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render login-registration'\n },\n target: '#login-dialog'\n });\n } else if (typeof $(this).attr('data-href') != 'undefined') {\n // Case: redirect to login page\n var redirectUrl = $(this).attr('data-href');\n location.href = redirectUrl;\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '132',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'popup',\n 'eventAction': 'sign_in',\n 'eventLabel': 'product_listing'\n });\n }\n};\nexports.init = init;\n\n},{\"../dialog\":20,\"../validator\":80}],15:[function(require,module,exports){\n/**\n *\n */\n'use strict';\n\nvar util = require('../util'),\n ajax = require('../ajax'),\n TPromise = require('promise'),\n mapController = require('./storelocator.mapcontroller');\nvar Regions = require('../../../italianRegions');\n\nexports.storePageController = {\n\n mapController: mapController,\n page: null,\n countryField: null,\n cityField: null,\n maxdistance: null,\n clickButton: null,\n geolocationButton: null,\n filterButton: null,\n storeSearchFilters: null,\n customInit: null,\n cleanErrors: null,\n showErrors: null,\n isGeolocation: false,\n\n init: function () {\n var self = this;\n\n if (this.customInit) {\n var customInitValue = this.customInit();\n }\n\n self.clickButton.on('click', function (e) {\n // Check for city field fulfillment\n if (self.cityField.val()) {\n\n self.isGeolocation = false;\n self.cleanErrors && self.cleanErrors();\n $('#storelocator-loader').fadeIn(200);\n\n return TPromise.resolve(self.getStores());\n } else {\n self.showErrors && self.showErrors();\n }\n\n if (self.cityField.val() == '') {\n // Disable initial getStores() function if store results already loaded by back-end\n if ($('#stores-results-list').find('.stores-results-list-content').length && $('.stores-results-list-content').find('#js-stores-results').length) {\n // update results number\n $('.js-results-number').html($('#js-stores-results').attr('data-stores-length'));\n // add classe initialized to update style\n if (!$('.stores-results-list').hasClass('initialized')) {\n $('.stores-results-list').addClass('initialized');\n }\n // update results on map\n self.stores = JSON.parse($('#js-stores-results').attr('data-locations'));\n self.authenticated = $('#js-stores-results').attr('data-authenticated') == 'true' ? true : false;\n showResultsOnMap(self);\n // init lastStorelocatorResult for filter functions\n window.lastStorelocatorResult = {};\n window.lastStorelocatorResult.authenticated = self.authenticated;\n window.lastStorelocatorResult.page = self.page;\n window.lastStorelocatorResult.searchType = 'storesByParams';\n window.lastStorelocatorResult.stores = self.stores;\n window.lastStorelocatorResult.storesNotFoundMessage = '';\n } else {\n if (PC && PC != '') {\n self.cityField.val(PC);\n self.countryField.val(C);\n self.getStores();\n } else {\n if (PN && PN != '') {\n var obj = [];\n obj.countrycode = 'IT';\n obj.province = PN;\n var findurl = util.appendParamsToUrl(Urls.storesFindAjax, {\n countryCode: obj.countrycode,\n state: obj.province,\n page: self.page\n });\n var options = {\n url: findurl,\n callback: handleResponse.bind(self),\n };\n\n ajax.getJson(options);\n } else {\n if (C && C != '') {\n self.countryField.val(C);\n } else {\n $('#dwfrm_storelocator_cityPostalCode').val(storesSearchQuery);\n }\n self.getStores();\n }\n }\n if (ID && ID != '') {\n saveFavoriteStore(ID, true);\n }\n }\n }\n });\n\n if (self.geolocationButton) {\n self.geolocationButton.on('click', function () {\n if (navigator.geolocation) {\n self.isStoreLocatorGeolocation = false;\n if (self.page === 'storelocator') {\n self.isStoreLocatorGeolocation = true;\n }\n\n self.isGeolocation = true;\n self.cityField.val(Resources.STORELOCATOR_YOUR_POSITION);\n $('#storelocator-loader').fadeIn(200);\n navigator.geolocation.getCurrentPosition(self.getStoresGeolocation.bind(self), function (err) {\n alert(Resources.STORELOCATOR_GEO_DISABLED);\n $('#storelocator-loader').fadeOut(200);\n });\n } else {\n alert(Resources.STORELOCATOR_GEO_DISABLED);\n $('#storelocator-loader').fadeOut(200);\n }\n });\n }\n\n if (self.filterButton) {\n self.filterButton.on('click', function () {\n try {\n var res = JSON.parse(JSON.stringify(window.lastStorelocatorResult));\n } catch (e) {\n console.error('Global variable \"lastStorelocatorResult\" doesn\\'t exist yet');\n return;\n }\n\n var activeFilters = [];\n $('.filter-option.active').each(function () {\n var value = $(this).attr('data-value');\n activeFilters.push(value);\n });\n\n if (activeFilters.length) {\n var stores = res.stores;\n var filteredStores = [];\n stores.forEach(function (item) {\n var allFiltersMatch = false;\n for (var i = 0; i < activeFilters.length; i++) {\n if (item[activeFilters[i]] == true) {\n allFiltersMatch = true;\n } else {\n allFiltersMatch = false;\n break;\n }\n }\n if (allFiltersMatch) {\n filteredStores.push(item);\n }\n });\n\n res.stores = filteredStores;\n }\n\n handleResponse.bind(self)(res, true);\n });\n }\n\n self.countryField.change(function (e) {\n self.isGeolocation = false;\n self.cityField.val('');\n return TPromise.resolve(self.getStores());\n });\n\n self.cityField.keypress(function (e) {\n var key = e.which;\n if (key == 13) // the enter key code\n {\n self.clickButton.click();\n e.preventDefault();\n // return false;\n }\n });\n\n var provinceAjaxCalls = function (countryCode, provinceCode) {\n var findurl = util.appendParamsToUrl(Urls.storesFindAjax, {\n countryCode: countryCode,\n state: provinceCode,\n page: self.page\n });\n var optionsStoresFind = {\n url: findurl,\n callback: handleResponse.bind(self)\n };\n\n var verticalSpace = window.matchMedia('(max-width: 767px)').matches ? 80 : 200;\n\n $('html, body').animate({\n scrollTop: $('.storelocator-result-container').offset().top - verticalSpace\n }, 1000);\n\n ajax.getJson(optionsStoresFind);\n };\n\n $('body').on('click', '.storeprovince', function () {\n var currentCountryCode = $(this).data('countrycode');\n var clickedProvince = $(this).data('province');\n provinceAjaxCalls(currentCountryCode, clickedProvince);\n });\n\n window.updateMap = updateMap.bind(self);\n window.updateMapReserve = updateMapReserve.bind(self);\n window.saveFavoriteStore = saveFavoriteStore;\n window.selectPickupStore = selectPickupStore;\n window.selectReturnInStore = selectReturnInStore;\n\n //Get the parameters sended from Store-Details.\n if (self.page === 'storelocator') {\n var qs = (function (a) {\n if (a == \"\") return {};\n var b = {};\n for (var i = 0; i < a.length; ++i) {\n var p = a[i].split('=', 2);\n if (p.length == 1)\n b[p[0]] = \"\";\n else\n b[p[0]] = decodeURIComponent(p[1].replace(/\\+/g, \" \"));\n }\n return b;\n })(window.location.search.substr(1).split('&'));\n var PN = qs['PN'];\n var PC = qs['PC'];\n var C = qs['C'];\n var ID = qs['StoreID'];\n\n var storesSearchQuery = qs['stores-search-query'];\n\n //console.log('PARAMS: '+PN);\n //console.log('PARAMS: '+PC);\n //console.log('PARAMS: '+C);\n\n // Disable initial getStores() function if store results already loaded by back-end\n if ($('#stores-results-list').find('.stores-results-list-content').length && $('.stores-results-list-content').find('#js-stores-results').length) {\n // update results number\n $('.js-results-number').html($('#js-stores-results').attr('data-stores-length'));\n // add classe initialized to update style\n if (!$('.stores-results-list').hasClass('initialized')) {\n $('.stores-results-list').addClass('initialized');\n }\n // update results on map\n self.stores = JSON.parse($('#js-stores-results').attr('data-locations'));\n self.authenticated = $('#js-stores-results').attr('data-authenticated') == 'true' ? true : false;\n showResultsOnMap(self);\n // init lastStorelocatorResult for filter functions\n window.lastStorelocatorResult = {};\n window.lastStorelocatorResult.authenticated = self.authenticated;\n window.lastStorelocatorResult.page = self.page;\n window.lastStorelocatorResult.searchType = 'storesByParams';\n window.lastStorelocatorResult.stores = self.stores;\n window.lastStorelocatorResult.storesNotFoundMessage = '';\n } else {\n if (PC && PC != '') {\n self.cityField.val(PC);\n self.countryField.val(C);\n self.getStores();\n } else {\n if (PN && PN != '') {\n var obj = [];\n obj.countrycode = 'IT';\n obj.province = PN;\n var findurl = util.appendParamsToUrl(Urls.storesFindAjax, {\n countryCode: obj.countrycode,\n state: obj.province,\n page: self.page\n });\n var options = {\n url: findurl,\n callback: handleResponse.bind(self),\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n } else {\n if (C && C != '') {\n self.countryField.val(C);\n } else {\n $('#dwfrm_storelocator_cityPostalCode').val(storesSearchQuery);\n }\n self.getStores();\n }\n }\n if (ID && ID != '') {\n saveFavoriteStore(ID, true);\n }\n }\n\n } else if (self.page === 'checkout' || self.page === 'orderdetail' || self.page === 'reserveinstore') {\n var customerStoresParams = {\n page: self.page\n };\n if (self.storeSearchFilters && self.storeSearchFilters.length != 0) {\n for (var i = 0; i < self.storeSearchFilters.length; i++) {\n customerStoresParams[self.storeSearchFilters[i]] = true;\n }\n }\n if (self.page === 'reserveinstore') {\n customerStoresParams.pid = $('#pid').val();\n }\n var options = {\n url: util.appendParamsToUrl(Urls.storesFindByCustomerAjax, customerStoresParams),\n callback: handleResponse.bind(self),\n page: self.page\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n\n }\n\n },\n\n getStoresInterceptor: function () {\n return false;\n },\n\n getStoresGeolocation: function (position) {\n var self = this;\n var lat = position.coords.latitude;\n var lng = position.coords.longitude;\n\n /* Attention:2 cases:\n * 1st - geolocation in the environment in Storelocator. The actual position of the user starting from his coordinates (longitude and latitude) must be considered. Google asynchronous geocoding services.\n * 2nd - geolocation at the cash desk. The order closing room must be considered. */\n if (self.isStoreLocatorGeolocation) {\n var geoCodingCountryValue = geoCodingCountry(lat, lng).then(function (result) {\n var countryLocationGeolocation = {};\n for (var i = 0; i < result.length; i++) {\n var r = result[i];\n\n if (!countryLocationGeolocation.countryCode && r.types[0] === 'country') {\n countryLocationGeolocation.country = r.address_components[0].long_name;\n countryLocationGeolocation.countryCode = r.address_components[0].short_name;\n }\n }\n\n //Show result information in map\n showStoresInMap(self, lat, lng, countryLocationGeolocation.countryCode);\n\n }, function errorCasePromise() {\n console.log(\"Error promise - Geocoding - result: \" + result);\n });\n\n } else {\n //Show result information in map - Checkout case - I show the search results starting from the place of the order.\n showStoresInMap(self, lat, lng, self.countryField.val())\n }\n\n },\n\n getStores: function () {\n var self = this;\n if (self.getStoresInterceptor) {\n var intercept = self.getStoresInterceptor();\n\n /* Case: stop search and show provinces */\n /*\n\t\t\t\tif(intercept) {\n\t\t\t\t\treturn;\n }\n */\n }\n var lat, lng;\n\n if (self.cityField.val()) {\n var geocoder = self.mapController.BasicMapController.data.geocoder;\n geocoder.geocode({\n 'address': self.cityField.val(),\n 'componentRestrictions': {\n 'country': self.countryField.val()\n }\n }, function (results, status) {\n if (status == 'OK') {\n lat = results[0].geometry.location.lat();\n lng = results[0].geometry.location.lng();\n\n var storesParams = {\n lat: lat,\n lng: lng,\n page: self.page,\n country: self.countryField.val(),\n maxdistance: self.maxdistance.val()\n };\n //storesParams[self.page]=true; questo parametro viene usato a backend? Sembra di no, quindi si può rimuovere.\n if (self.storeSearchFilters && self.storeSearchFilters.length != 0) {\n for (var i = 0; i < self.storeSearchFilters.length; i++) {\n storesParams[self.storeSearchFilters[i]] = true;\n }\n }\n if (self.page === 'reserveinstore') {\n storesParams.pid = $('#pid').val();\n }\n // if benefeet page add filter\n if ($('.pt-benefeet-wrapper').length) {\n storesParams.benefeetstores = true;\n }\n var options = {\n url: util.appendParamsToUrl(Urls.storesFindByCoordinatesAjax, storesParams),\n callback: handleResponse.bind(self)\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n } else {\n handleResponse.bind(self)({\n storesNotFoundMessage: Resources.STORES_NOT_FOUND,\n page: self.page\n });\n }\n });\n } else {\n //console.log('other way');\n var storesParams = {\n countryCode: self.countryField.val(),\n page: self.page,\n };\n // if benefeer page add filter\n if ($('.pt-benefeet-wrapper').length) {\n storesParams.benefeetstores = true;\n }\n if (self.storeSearchFilters && self.storeSearchFilters.length != 0) {\n for (var i = 0; i < self.storeSearchFilters.length; i++) {\n storesParams[self.storeSearchFilters[i]] = true;\n }\n }\n var options = {\n url: util.appendParamsToUrl(Urls.storesFindAjax, storesParams),\n callback: handleResponse.bind(self),\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n }\n }\n}\n\nfunction handleResponse(res, isFilter) {\n var self = this;\n if (!isFilter) {\n window.lastStorelocatorResult = res;\n }\n updateResultsList.bind(self)(res);\n if (res.stores && res.page === 'storelocator') {\n updateButton.bind(self)(res.stores);\n }\n self.mapController.BasicMapController.api.update(res.stores, res.authenticated, res.page, window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n}\nvar updateButton = function (stores) {\n for (var i = 0; i < stores.length; ++i) {\n if (stores[i].bookingURL && stores[i].bookingLocation && typeof SimplybookWidget === 'function') {\n var widget = new SimplybookWidget({\n \"widget_type\": \"button\",\n \"url\": \"https:\\/\\/\" + stores[i].bookingURL,\n \"theme\": \"adacompliant\",\n \"theme_settings\": {\n \"timeline_show_end_time\": \"0\",\n \"timeline_modern_display\": \"as_slots\",\n \"display_item_mode\": \"block\",\n \"hide_img_mode\": \"1\",\n \"show_sidebar\": \"1\"\n },\n \"timeline\": \"modern\",\n \"datepicker\": \"top_calendar\",\n \"is_rtl\": false,\n \"app_config\": {\n \"predefined\": {\n \"location\": stores[i].bookingLocation\n }\n },\n \"button_title\": \"Prenota ora\",\n \"button_background_color\": \"red\",\n \"button_text_color\": \"#FFFFFF\",\n \"button_position\": \"right\",\n \"button_position_offset\": \"55%\",\n \"button_custom_id\": \"tilelist\" + stores[i].storeId\n });\n }\n\n\n }\n}\nvar selectPickupStore = function (storeId) {\n $('#store-pickup-' + storeId + '').attr(\"checked\", true);\n}\n\nvar selectReturnInStore = function (storeId) {\n $('#store-return-' + storeId + '').attr(\"checked\", true);\n}\n\nvar saveFavoriteStore = function (storeId, auth) {\n //console.log('SAVE FAVORITE STORE');\n var options = {\n url: util.appendParamsToUrl(Urls.storesSaveFavAjax, {\n StoreID: storeId,\n authenticated: auth\n }),\n callback: function (res) {\n //console.log('Save Favorite Store Response: ' + JSON.stringify(res));\n if (res.status == 'OK') {\n if (res.redirectURL) {\n window.location.replace(res.redirectURL);\n return;\n }\n var storesList = res.oldFavStore;\n\n $('#favstore-' + res.storeId).attr('class', 'icon i-star');\n $('#favstore-window-' + res.storeId).length && $('#favstore-window-' + res.storeId).attr('class', 'icon i-star');\n if (storesList.indexOf(res.storeId) != -1) {\n $('#favstore-' + res.storeId).attr('class', 'icon i-star active');\n $('#favstore-window-' + res.storeId).length && $('#favstore-window-' + res.storeId).attr('class', 'icon i-star active');\n }\n } else {\n alert(res.errorMsg || 'Errore durante il salvataggio dello store come preferito :(');\n }\n }\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n};\n\nvar updateMapReserve = function (storeID) {\n var self = this;\n try {\n var res = JSON.parse(JSON.stringify(window.lastStorelocatorResult));\n } catch (e) {\n console.error('Global variable \"lastStorelocatorResult\" doesn\\'t exist yet');\n return;\n }\n\n var stores = res.stores;\n var filteredStores = stores.filter(function (item) {\n return item.storeId == storeID;\n });\n\n res.stores = filteredStores;\n self.mapController.BasicMapController.api.update(res.stores, res.authenticated, res.page, window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n};\n\nvar updateMap = function (storeId, lat, long, page, userIsAuthenticated, bookingLocation, bookingURL) {\n var self = this;\n var store = {\n storeId: storeId,\n lat: lat,\n long: long\n };\n window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE && self.mapController.BasicMapController.api.updateMapCenter(store, page, userIsAuthenticated, false);\n setTimeout(function () {\n var buttontile = $(\"#tilemap\" + storeId)[0];\n if (buttontile && bookingURL && bookingLocation) {\n var widget = new SimplybookWidget({\n \"widget_type\": \"button\",\n \"url\": \"https:\\/\\/\" + bookingURL,\n \"theme\": \"adacompliant\",\n \"theme_settings\": {\n \"timeline_show_end_time\": \"0\",\n \"timeline_modern_display\": \"as_slots\",\n \"display_item_mode\": \"block\",\n \"hide_img_mode\": \"1\",\n \"show_sidebar\": \"1\"\n },\n \"timeline\": \"modern\",\n \"datepicker\": \"top_calendar\",\n \"is_rtl\": false,\n \"app_config\": {\n \"predefined\": {\n \"location\": bookingLocation\n }\n },\n \"button_title\": \"Prenota ora\",\n \"button_background_color\": \"red\",\n \"button_text_color\": \"#FFFFFF\",\n \"button_position\": \"right\",\n \"button_position_offset\": \"55%\",\n \"button_custom_id\": \"tilemap\" + storeId\n });\n }\n }, 500);\n};\n\nvar showResultsOnMap = function (res) {\n res.mapController.BasicMapController.api.update(res.stores, res.authenticated, res.page, window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n}\n\nvar updateResultsList = function (res) {\n var self = this;\n var stores = res.stores;\n var labelcall = Resources.STORELOCATOR_CALL;\n var labelCTA = Resources.STORELOCATOR_CTA;\n var labeltel = Resources.STORELOCATOR_TEL;\n var labeldet = Resources.STORELOCATOR_DET;\n var labeldir = Resources.STORELOCATOR_DIR;\n var labelfav = Resources.STORELOCATOR_FAV;\n var labeltitle = Resources.STORELOCATOR_CITY_TITLE;\n var tooltip = Resources.STORELOCATOR_TOOLTIP_FAVORITE;\n var login = Resources.GLOBAL_LOGIN;\n var labelhours = Resources.STORELOCATOR_HOURS;\n var labelthis = Resources.STORELOCATOR_THIS;\n var labelreserve = Resources.STORELOCATOR_THISRESERVEINSTORE;\n var labelreturn = Resources.RETURN_HERE;\n var labelOtherStores = Resources.SEE_MORE;\n var labelFavoriteStores = Resources.FAVORITE_STORES;\n var labelthisStoreDetail = Resources.STORELOCATOR__THIS_STORE_DETAIL;\n\n if ($('#stores-results-list').find('.stores-results-list-content').length) {\n $('#stores-results-list').find('.stores-results-list-content').html('');\n } else {\n $('#stores-results-list').html('');\n }\n // remove static elements after new search\n if ($('.stores-results-list').hasClass('initialized') && $('#stores-results-list').find('.store-province-title').length) {\n $('#stores-results-list').find('.store-province-title').remove();\n }\n\n $('#storelocator-loader').fadeOut(200).delay(1000);\n\n var newHTML = [];\n var id = 'storelocator-result-';\n var getDirectionsUrl = '';\n var isBenefeetPage = $('.pt-benefeet-wrapper').length;\n\n\n //Find name of province that correspond to the statecode of the store\n var allRegions = Object.keys(Regions);\n var currentRegion = '';\n var provinces = '';\n var provinceName = '';\n if (stores && stores.length > 0) {\n for (var x = 0; x < allRegions.length; ++x) {\n currentRegion = allRegions[x];\n provinces = Regions[currentRegion];\n for (var y = 0; y < provinces.length; ++y) {\n if (provinces[y].code == stores[0].stateCode) {\n provinceName = provinces[y].name;\n break;\n }\n }\n }\n\n if (res.page === 'reserveinstore') {\n var firstFavouriteFounded = false;\n var firstNotFavouriteFounded = false;\n }\n\n for (var i = 0; i < stores.length; ++i) {\n //console.log(JSON.stringify(stores[i]));\n for (var k in stores[i]) {\n if (stores[i][k] == null) {\n stores[i][k] = '';\n //console.log('k = ' + k);\n //console.log('store[k] = ' + store[k]);\n }\n }\n stores[i].provinceName = provinceName;\n stores[i].PC = self.cityField.val();\n\n var pageDetailsUrl = Urls.storeDetails + '?StoreID=' + stores[i].storeId;\n if (self.cityField.val()) {\n pageDetailsUrl += '&PC=' + self.cityField.val();\n }\n\n getDirectionsUrl = 'http://maps.google.com/maps?daddr=(' + stores[i].lat + ',' + stores[i].long + ')';\n var bookingURL = stores[i].bookingURL ? \"'\" + stores[i].bookingURL + \"'\" : null;\n var bookingLocation = stores[i].bookingLocation ? stores[i].bookingLocation : null;\n\n var storeNameSeo = stores[i].name + '_' + stores[i].address.replace(/,/g, '');\n storeNameSeo = storeNameSeo.toLowerCase().trim().replace(/ /g, '_');\n\n if (res.page === 'storelocator') {\n // add \"0\" to number under 10 --> 01,02,...\n var formattedNumber = ('0' + (i + 1)).slice(-2)\n\n newHTML.push('
        ');\n //newHTML.push('
        ');\n //newHTML.push('');\n\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push(formattedNumber);\n newHTML.push('');\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + ', ' + stores[i].city + (stores[i].stateCode ? ' (' + stores[i].stateCode + '), ' : ' ') + stores[i].postalCode + '

        ');\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n if (window.matchMedia('(max-width: 767px)').matches) {\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + ', ' + stores[i].city + (stores[i].stateCode ? ' (' + stores[i].stateCode + '), ' : ' ') + stores[i].postalCode + '

        ');\n newHTML.push('
        ');\n }\n\n if (stores[i].phone) {\n newHTML.push('
        ' + labeltel + '
        ');\n newHTML.push('

        ' + stores[i].phone + '

        ');\n }\n\n if (stores[i].storeHours) {\n newHTML.push('
        ' + labelhours + '
        ' + stores[i].storeHours + '
        ');\n }\n\n newHTML.push('
        ');\n if (stores[i].omniReserveInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKRESERVE + '
        ');\n }\n if (stores[i].omniReturnInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_RETURNINSTORE + '
        ');\n }\n if (stores[i].omniPayAndCollect) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKCOLLECT + '
        ');\n }\n if (stores[i].storeBenefeet) {\n newHTML.push('
        ' + Resources.STORELOCATOR_BENEFEETSERVICE + '
        ');\n }\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n if (window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE) {\n if (stores[i].bookingURL && stores[i].bookingLocation && !isBenefeetPage) {\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('' + labelCTA + '');\n newHTML.push('
        ');\n }\n\n newHTML.push('');\n newHTML.push('');\n newHTML.push('');\n newHTML.push('' + labeldir + '');\n newHTML.push('');\n\n newHTML.push('');\n newHTML.push('' + labeldet + '');\n newHTML.push('');\n }\n newHTML.push('
        ');\n\n if (stores[i].phone) {\n newHTML.push('');\n newHTML.push(labelcall);\n newHTML.push('');\n }\n\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n\n // update results number\n $('.js-results-number').html(stores.length);\n\n // add classe initialized to update style\n if (!$('.stores-results-list').hasClass('initialized')) {\n $('.stores-results-list').addClass('initialized');\n }\n\n } else if (res.page === 'checkout') {\n $('#pick-up-in-store .billing-address').removeClass('hide');\n $('.pickup-instore-results').removeClass('hide');\n $('#storelocator-noresults').removeClass('visible');\n $('#button-step-1').removeClass('disabled');\n\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + '
        ' + stores[i].city + ', ' + stores[i].stateCode + ' ' + stores[i].postalCode + '

        ');\n\n var preselect = false;\n if (res.searchType == 'favoriteStores') {\n if (i == 0) {\n preselect = true;\n }\n }\n\n if (stores[i].phone && stores[i].storeHours) {\n newHTML.push('
        ');\n newHTML.push('
        ');\n if (window.matchMedia('(max-width: 767px)').matches) {\n newHTML.push('
        ');\n }\n newHTML.push('
        '); //INIZIO ACCORDION\n newHTML.push('
        '); //INIZIO STORE CONTENT\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + ', ' + stores[i].city + (stores[i].stateCode ? ' (' + stores[i].stateCode + '), ' : ' ') + stores[i].postalCode + '

        ');\n newHTML.push('
        ');\n }\n\n\n newHTML.push('
        ' + labeltel + '
        ');\n newHTML.push('

        ' + stores[i].phone + '

        ');\n newHTML.push('
        ' + labelhours + '
        ');\n newHTML.push(stores[i].storeHours);\n newHTML.push('
        ');\n\n\n newHTML.push('
        '); // INIZIO RESULT MOBILE\n newHTML.push('
        '); // BUTTON ROW\n if (window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE) {\n if (stores[i].bookingURL && stores[i].bookingLocation) {\n //CALENDAR BUTTON\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n }\n\n //MAP BUTTON\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('');\n newHTML.push('');\n newHTML.push('');\n newHTML.push('
        ');\n }\n\n //PHONE BUTTON\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n newHTML.push('
        '); // END BUTTON ROW\n\n //RITIRA ORDINE QUA\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push(labelthisStoreDetail);\n newHTML.push('');\n newHTML.push('
        ');\n\n //INIZIO TOOLTIP FAVOURITE STORE\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n //FINE TOOLTIP FAVOURITE STORE\n newHTML.push('
        '); // FINE RESULT MOBILE\n newHTML.push('
        '); //FINE STORE CONTENT\n newHTML.push('
        '); //FINE ACCORDION\n newHTML.push('
        ');\n newHTML.push('
        ');\n }\n\n var storeString = JSON.stringify(stores[i]).replace(/'/g, \"*\");\n storeString = storeString.replace(/\"/g, \"'\");\n newHTML.push('');\n newHTML.push('');\n newHTML.push('
        ');\n newHTML.push(labelthis);\n newHTML.push('
        ');\n newHTML.push('
        ');\n\n\n newHTML.push('
        ');\n\n\n\n if (stores[i].phone) {\n newHTML.push('');\n newHTML.push('
        ');\n newHTML.push(labelcall); //contentString.push(labeldet);\n newHTML.push('
        ');\n newHTML.push('
        ');\n }\n\n } else if (res.page === 'orderdetail') {\n\n labelthis = Resources.STORELOCATOR_THISODERDERDETAILS;\n\n $('#stores-found-block').removeClass('hide');\n $('#storelocator-wrapper').removeClass('hide');\n $('#storelocator-noresults').addClass('hide').slideUp(200);\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + ' ' + stores[i].city + ', ' + stores[i].stateCode + ' ' + stores[i].postalCode + '

        ');\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n if (stores[i].phone) {\n newHTML.push('');\n newHTML.push('

        ' + stores[i].phone + '

        ');\n }\n\n if (stores[i].storeHours) {\n newHTML.push('
        ' + stores[i].storeHours + '
        ');\n }\n\n newHTML.push('
        ');\n if (stores[i].omniReserveInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKRESERVE + '
        ');\n }\n if (stores[i].omniReturnInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_RETURNINSTORE + '
        ');\n }\n if (stores[i].omniPayAndCollect) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKCOLLECT + '
        ');\n }\n if (stores[i].storeBenefeet) {\n newHTML.push('
        ' + Resources.STORELOCATOR_BENEFEETSERVICE + '
        ');\n }\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push('
        ');\n newHTML.push('');\n if (stores[i].phone) {\n newHTML.push('');\n }\n newHTML.push('
        ');\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n\n } else if (res.page === 'reserveinstore') {\n var reserveInStoreBlocked = $('#reserve-product').data('reserveinstoreprod');\n\n labelthis = Resources.STORELOCATOR_THISRESERVEINSTORE;\n\n $('#stores-found-block').removeClass('hide');\n $('#storelocator-wrapper').removeClass('hide');\n $('#storelocator-noresults').addClass('hide').slideUp(200);\n\n if (!firstFavouriteFounded && stores[i].favorite) {\n newHTML.push('

        ' + labelFavoriteStores + '

        ');\n firstFavouriteFounded = true;\n } else if (firstFavouriteFounded && !firstNotFavouriteFounded && !stores[i].favorite) {\n newHTML.push('

        ' + labelOtherStores + '

        ');\n firstNotFavouriteFounded = true;\n }\n\n // newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('

        GEOX ' + stores[i].name + '

        ');\n newHTML.push('

        ' + stores[i].address + ' ' + stores[i].city + ', ' + stores[i].stateCode + ' ' + stores[i].postalCode + '

        ');\n newHTML.push('
        ');\n newHTML.push('');\n newHTML.push(stores[i].availabilityLabel);\n newHTML.push('');\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n if (stores[i].phone) {\n newHTML.push('');\n newHTML.push('

        ' + stores[i].phone + '

        ');\n }\n\n if (stores[i].storeHours) {\n newHTML.push('
        ' + stores[i].storeHours + '
        ');\n }\n\n newHTML.push('
        ');\n if (stores[i].omniReserveInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKRESERVE + '
        ');\n }\n if (stores[i].omniReturnInStore) {\n newHTML.push('
        ' + Resources.STORELOCATOR_RETURNINSTORE + '
        ');\n }\n if (stores[i].omniPayAndCollect) {\n newHTML.push('
        ' + Resources.STORELOCATOR_CLICKCOLLECT + '
        ');\n }\n if (stores[i].storeBenefeet) {\n newHTML.push('
        ' + Resources.STORELOCATOR_BENEFEETSERVICE + '
        ');\n }\n newHTML.push('
        ');\n\n if (!reserveInStoreBlocked) {\n newHTML.push('
        ');\n newHTML.push('');\n if (stores[i].phone) {\n newHTML.push('');\n }\n newHTML.push('
        ');\n }\n\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push('
        ');\n }\n newHTML.push('
        ');\n newHTML.push('
        ');\n newHTML.push(newHTML);\n }\n } else {\n\n if (res.page === 'checkout') {\n $('#pick-up-in-store .billing-address').addClass('hide');\n if (self.cityField.val()) {\n $('.pickup-instore-results').addClass('hide');\n $('#storelocator-noresults').addClass('visible');\n }\n } else if (res.page === 'orderdetail') {\n $('#stores-found-block').addClass('hide');\n if (self.cityField.val()) {\n $('#storelocator-noresults').removeClass('hide').slideDown(200);\n }\n } else if (res.page === 'reserveinstore') {\n $('.storelocator-wrapper').addClass('hide');\n if (self.cityField.val() || self.isGeolocation) {\n $('#storelocator-noresults').removeClass('hide').slideDown(200);\n }\n $(\".reserve-in-store-confirm\").length > 0 && $(\".reserve-in-store-confirm\").addClass(\"disabled\");\n } else {\n newHTML.push('

        ');\n newHTML.push(res.storesNotFoundMessage);\n newHTML.push('

        ');\n // update results number\n if (res.page === 'storelocator') {\n $('.js-results-number').html('0');\n // add classe initialized to update style\n if (!$('.stores-results-list').hasClass('initialized')) {\n $('.stores-results-list').addClass('initialized');\n }\n }\n }\n }\n\n /* AMS-42 - Attention: in the case of reserve in store in PDP if the input is empty and the user presses \"ENTER\" the list of stores must not be shown to FE.\n * Due to the construction of the code structure, the check cannot be carried out earlier. */\n if ($('#stores-results-list').find('.stores-results-list-content').length) {\n if (res.page === 'reserveinstore') {\n if ((self.cityField.val() || self.isGeolocation)) {\n $('#stores-results-list').find('.stores-results-list-content').html(newHTML.join(\"\"));\n }\n } else {\n $('#stores-results-list').find('.stores-results-list-content').html(newHTML.join(\"\"));\n }\n } else {\n if (res.page === 'reserveinstore') {\n if ((self.cityField.val() || self.isGeolocation)) {\n $('#stores-results-list').html(newHTML.join(\"\"));\n }\n } else {\n $('#stores-results-list').html(newHTML.join(\"\"));\n }\n }\n\n};\n\n/* Triangulation function for recalculating country information starting from longitude and latitude.\n * Attention asynchronous function.Need to manage response with Promise. ß*/\nvar geoCodingCountry = function (latitude, longitude) {\n\n return new Promise(function (resolve, reject) {\n var geocoder = new google.maps.Geocoder();\n\n geocoder.geocode({\n location: {\n lat: latitude,\n lng: longitude\n }\n }, function (results, status) {\n\n if (status == \"OK\") {\n if (results[0]) {\n resolve(results);\n } else {\n reject(\"The promise is rejected\");\n }\n }\n });\n });\n\n}\n\n/*Show the results of the geolocation */\nvar showStoresInMap = function (self, lat, lng, countryCode) {\n var storesParams = {\n lat: lat,\n lng: lng,\n page: self.page,\n country: countryCode,\n maxdistance: self.maxdistance.val()\n };\n\n if (self.storeSearchFilters && self.storeSearchFilters.length != 0) {\n for (var i = 0; i < self.storeSearchFilters.length; i++) {\n storesParams[self.storeSearchFilters[i]] = true;\n }\n }\n\n if (self.page === 'reserveinstore') {\n storesParams.pid = $('#pid').val();\n }\n\n // if benefeet page add filter\n if ($('.pt-benefeet-wrapper').length) {\n storesParams.benefeetstores = true;\n }\n\n var options = {\n url: util.appendParamsToUrl(Urls.storesFindByCoordinatesAjax, storesParams),\n callback: handleResponse.bind(self)\n };\n\n ajax.getJson(options);\n\n $('#dwfrm_storelocator_country').val(countryCode);\n}\n\n},{\"../../../italianRegions\":1,\"../ajax\":4,\"../util\":79,\"./storelocator.mapcontroller\":16,\"promise\":112}],16:[function(require,module,exports){\n/**\n * @description This module implements the general controller for the StoreLocator map view\n *\n * @author Extended ERP Salesforce-Dev\n * @author Alessio Villardita\n */\n\n\n'use strict';\n\nvar mapStyle = require('./storelocator.mapstyle');\n\n/**\n * @description This is the controller managing the Storelocator map operations\n */\nvar basicMapController = {};\n/**\n * Self reference for convenience\n */\nvar vm = basicMapController;\n\n//global var for keep trace of the last opened infowindow marker\nvar lastMarkerClick;\n\n// PUBLIC ATTRIBUTES\n/**\n * VIEW DATA\n *\n * This attribute holds the data that the controller need to display on the view\n */\nvm.data = {\n /**\n * MAP OBJECT, this object is used by google maps to save the map object\n */\n map: {},\n /**\n * MARKERS OBJECTS, this array is used to store all the markers\n */\n markers: [],\n /**\n * SELECTED MARKER: useful for omnichannel features.\n */\n selectedMarker: null,\n /**\n * POSITION object, this object hols the position of the browser, obtained from the IP and\n * geolocation utilities.\n *\n * WARNING: In chrome, only the hpps connection will grant you access to the geolocation data.\n */\n clientPosition: {},\n /**\n * STORES list as coming from backend\n * */\n storeList: [],\n /**\n * GEOCODER to retrieve coordinates from addresses\n * */\n geocoder: null,\n\n zoomLevel: 0,\n\n saveBound: null,\n defaultLocation: {}\n};\n\n// ***************************** METHODS *****************************\n/**\n * This method is in charge on preparing the data for the view on the creation of the controller\n */\nvar onInit = function (isGoogleMapsActive) {\n // --info\n //console.log('Start: BasicMapController - onInit');\n if (isGoogleMapsActive) {\n // Build the map\n buildMap();\n\n // Build the map\n buildGeocoder();\n\n\n }\n\n // --info\n //console.log('End: BasicMapController - onInit');\n};\n\nvar buildGeocoder = function () {\n vm.data.geocoder = new google.maps.Geocoder();\n}\n\nvar buildMap = function () {\n // --info\n //console.log('Start: buildMap');\n var italia = {\n lat: 43.265571,\n lng: 11.159818\n };\n vm.data.defaultLocation = {\n lat: italia.lat,\n long: italia.lng\n };\n\n var langForLabel = $('input[name=lang]').val() ? $('input[name=lang]').val().split('_')[0] : 'en';\n\n var styledMapType = new google.maps.StyledMapType(mapStyle.Style, {\n name: mapStyle.Name[langForLabel]\n });\n\n // 1. Create the map options\n var mapOptions = {\n zoom: 5,\n center: italia,\n fullscreenControl: false,\n mapTypeControlOptions: {\n mapTypeIds: ['styled_map']\n },\n //mapTypeId: google.maps.MapTypeId.TERRAIN\n };\n\n // 2. Instantiate the map and assign it to the dom object #map\n vm.data.map = new google.maps.Map(document.getElementById('storelocator-map'), mapOptions);\n\n //Associate the styled map with the MapTypeId and set it to display.\n vm.data.map.mapTypes.set('styled_map', styledMapType);\n vm.data.map.setMapTypeId('styled_map');\n};\n\n// Sets the map on all markers in the array.\nfunction setMapOnAll(map) {\n for (var i = 0; i < vm.data.markers.length; i++) {\n vm.data.markers[i].setMap(map);\n }\n}\n\n// Removes the markers from the map, but keeps them in the array.\nfunction clearMarkers() {\n setMapOnAll(null);\n if (lastMarkerClick) {\n lastMarkerClick['infowindow'].close();\n }\n}\n\n// Shows any markers currently in the array.\nfunction showMarkers() {\n setMapOnAll(vm.data.map);\n}\n\n// Deletes all markers in the array by removing references to them.\nfunction deleteMarkers() {\n clearMarkers();\n vm.data.markers = [];\n}\n\nvar markerDetails = function (marker, infoWindow) {\n\n var getDirectionsUrl = '';\n var getDirectionsButton = '';\n\n // IF the user geolocation is available\n if (vm.data.clientPosition.coords) {\n\n // 1. Generate the address frive to url\n getDirectionsUrl = 'http://maps.google.com/maps?saddr=(' + vm.clientPosition.coords.latitude + ',' + vm.clientPosition.coords.longitude + ')&daddr=(' + marker.position.lat() + ',' + marker.position.lng() + ')';\n\n // 2. Create the get directions button , using the google maps API\n getDirectionsButton = '

        Get directions

        ';\n\n // --debug\n // console.log('Directions url is: ', getDirectionsUrl);\n }\n\n // 3. Create the general layout of the marker details\n infoWindow.setContent('

        ' + marker.title + '

        ' + '

        ' + 'email: ' + marker.email + '



        ' + getDirectionsButton);\n\n\n // 4. Open the marker details in the map\n infoWindow.open(vm.data.map, marker);\n};\n\n/**\n *\n */\nvar buildMarker = function (info, userIsAuthenticated, page) {\n var ctaController = true;\n // 1. Create the marker object\n var marker = createMarker(vm.data.map, info, ctaController, page);\n\n var contentString = buildInfoWindow(marker, info, userIsAuthenticated, page);\n\n marker['infowindow'] = new google.maps.InfoWindow({\n content: contentString.join(\"\")\n });\n\n // --debug\n //console.log('The marker: [' + info.name + '] has been created');\n //console.log('The marker value: ', marker);\n\n // 4. Add the marker to the general markers array\n vm.data.markers.push(marker);\n\n};\n\nvar updateMap = function (userIsAuthenticated, page, isGoogleMapsActive) {\n\n // --info\n //console.log('Start: updateMap');\n\n // 1. Clean the marker list\n deleteMarkers();\n\n // 2. Create the markers from the new store list\n if (vm.data.storeList != null) {\n // -- Get the lenght of the shop list\n var storeListSize = vm.data.storeList.length;\n //console.log('***Length:'+storeListSize);\n // ITERATE over all markers\n for (var i = 0; i < storeListSize; i++) {\n if (typeof vm.data.storeList[i].searchResultsPosition == 'undefined') {\n vm.data.storeList[i].searchResultsPosition = (i + 1).toString();\n }\n // 3. Invoke the marker creation function\n isGoogleMapsActive && buildMarker(vm.data.storeList[i], userIsAuthenticated, page);\n }\n\n\n // Map Auto-Scaling\n isGoogleMapsActive && adaptMapBounds(page);\n\n isGoogleMapsActive && initInfoWindowEvents();\n\n /*vm.data.zoomLevel = vm.data.map.getZoom();\n console.log('Set ZoomLevel: '+vm.data.zoomLevel);*/\n }\n};\n\n\nvar adaptMapBounds = function (page) {\n //var bounds = new google.maps.LatLngBounds();\n vm.data.saveBound = new google.maps.LatLngBounds();\n for (var i = 0; i < vm.data.markers.length; i++) {\n //bounds.extend(vm.data.markers[i].getPosition());\n vm.data.saveBound.extend(vm.data.markers[i].getPosition());\n }\n\n vm.data.map.fitBounds(vm.data.saveBound);\n\n var maxZoomThreshold = 9;\n\n var radius = $('#maxdistance').val();\n if (radius < 30) {\n maxZoomThreshold = 12;\n } else if (radius < 50) {\n maxZoomThreshold = 11;\n } else {\n // Reduce maxZoomThreshold on tablet\n if (page == \"storelocator\" && window.matchMedia('(min-width: 768px)').matches && window.matchMedia('(max-width: 1279px)').matches) {\n maxZoomThreshold = 7;\n }\n }\n\n if (vm.data.map.getZoom() > 13) {\n vm.data.map.setZoom(13);\n } else if (vm.data.map.getZoom() < maxZoomThreshold && page != \"storelocator\") {\n vm.data.map.setZoom(maxZoomThreshold);\n }\n};\n\nvar adaptZoomLevel = function () {\n //console.log('adaptZoomLevel');\n if (vm.data.saveBound != null) {\n vm.data.map.fitBounds(vm.data.saveBound);\n }\n};\n\n/**\n * Callback function to retrieve the new state of the view\n */\nvar updateState = function (storesList, userIsAuthenticated, page, isGoogleMapsActive) {\n\n // --debug\n // console.log('Update: BasicMapController');\n //console.log('STORES LIST ');\n //console.log(JSON.stringify(storesList));\n // 1. Read new stores list\n vm.data.storeList = storesList;\n // 2. Update the map list\n updateMap(userIsAuthenticated, page, isGoogleMapsActive);\n\n // 3. Reset the previously selected store\n vm.data.selectedMarker = null;\n};\n\nvar updateMapDetail = function (storesList) {\n //console.log('STORES LIST ');\n //console.log(JSON.stringify(storesList));\n\n // 1. Read new stores list\n vm.data.storeList = storesList;\n // 2. Update the map list\n var infowindow = new google.maps.InfoWindow;\n\n // 1. Clean the marker list\n deleteMarkers();\n\n // 2. Create the markers from the new store list\n if (vm.data.storeList != null) {\n // -- Get the lenght of the shop list\n var storeListSize = vm.data.storeList.length;\n //console.log('***Length:'+storeListSize);\n\n buildMarkerDetail(vm.data.storeList[0], ' ');\n\n // Map Auto-Scaling\n vm.data.map.setZoom(16);\n }\n\n};\nvar buildMarkerDetail = function (info) {\n var markerOptions = {\n map: vm.data.map,\n position: new google.maps.LatLng(info.lat, info.long),\n title: info.name,\n email: info.email,\n id: info.storeId,\n icon: Urls.mapMarkerDetail\n };\n\n if (!!info.searchResultsPosition) {\n markerOptions.label = {\n text: info.searchResultsPosition,\n color: 'white'\n };\n } else {\n markerOptions.label = {\n text: '1',\n color: 'white'\n };\n }\n // 1. Create the marker object\n var marker = new google.maps.Marker(markerOptions);\n\n // 4. Add the marker to the general markers array\n vm.data.markers.push(marker);\n};\n\n\nvar getBrowserGeolocation = function () {\n\n // --info\n //console.log('Start: getBrowserGeolocation');\n\n if (navigator.geolocation) {\n\n navigator.geolocation.getCurrentPosition(showPosition);\n\n } else {\n\n // --info\n console.log('This browser doesnt support geolocation');\n }\n};\n\nvar showPosition = function (position) {\n vm.data.clientPosition = position;\n // --debug\n // console.log('Geolocation is:', position);\n};\n\nvar updateMapCenter = function (store, page, userIsAuthenticated, ctaController) {\n if (!store) {\n vm.data.map.panTo(new google.maps.LatLng(vm.data.defaultLocation.lat, vm.data.defaultLocation.long));\n } else {\n vm.data.map.panTo(new google.maps.LatLng(store.lat, store.long));\n }\n\n var filteredMarkers = [];\n if (vm.data.markers) {\n filteredMarkers = vm.data.markers.filter(function (m) {\n return m.id == store.storeId\n });\n }\n\n var selectedStore = [];\n if (vm.data.storeList) {\n selectedStore = vm.data.storeList.filter(function (s) {\n return s.storeId == store.storeId\n });\n }\n\n if (filteredMarkers.length == 1 && selectedStore.length == 1) {\n if (vm.data.selectedMarker) {\n var previouslySelectedStore = vm.data.storeList.filter(function (s) {\n return s.storeId == vm.data.selectedMarker.id\n })[0];\n\n // Reset del marker: si rimuove e si ricrea con il nuovo contentuto la InfoWindow.\n vm.data.selectedMarker.setMap(null);\n var refreshedPreviouslySelectedStoreMarker = createMarker(vm.data.map, previouslySelectedStore, ctaController);\n var refreshedContentString = buildInfoWindow(refreshedPreviouslySelectedStoreMarker, previouslySelectedStore, userIsAuthenticated, page, \"\");\n refreshedPreviouslySelectedStoreMarker['infowindow'] = new google.maps.InfoWindow({\n content: refreshedContentString.join(\"\")\n });\n }\n\n // Reset del marker: si rimuove e si ricrea con il nuovo contentuto la InfoWindow.\n var currentlySelectedMarker = filteredMarkers[0];\n currentlySelectedMarker.setMap(null);\n var refreshedSelectedStoreMarker = createMarker(vm.data.map, selectedStore[0], ctaController);\n var contentString = buildInfoWindow(refreshedSelectedStoreMarker, selectedStore[0], userIsAuthenticated, page, \"SELECTED\");\n refreshedSelectedStoreMarker['infowindow'] = new google.maps.InfoWindow({\n content: contentString.join(\"\")\n });\n refreshedSelectedStoreMarker.setLabel({\n text: selectedStore[0].searchResultsPosition,\n color: 'white'\n });\n refreshedSelectedStoreMarker.setIcon(Urls.mapSelectedMarker);\n vm.data.selectedMarker = refreshedSelectedStoreMarker;\n\n // opening info window\n /* if(lastMarkerClick != null && lastMarkerClick.id != vm.data.selectedMarker.id){\n \t\tlastMarkerClick['infowindow'].close();\n \t}\n \tvm.data.selectedMarker['infowindow'].open(vm.data.map, vm.data.selectedMarker); */\n\n lastMarkerClick = vm.data.selectedMarker;\n\n }\n};\n\n/**\n * API METHODS\n *\n * This attribute contains the functions to be used by the VF\n */\n\nvm.api = {\n init: onInit,\n update: updateState,\n updateMapCenter: updateMapCenter,\n updateMapDetail: updateMapDetail,\n adaptMapBounds: adaptMapBounds,\n adaptZoomLevel: adaptZoomLevel,\n};\n\nfunction initInfoWindowEvents() {\n //PICKUP IN STORE SELECT STORE FROM MAP\n $('body').on('click', '#storelocator-map .select-store, #storelocator-map a.radio', function () {\n var selectedStoreID = $(this).data('store');\n //console.log(selectedStoreID);\n $(this).closest('.gm-style-iw').addClass('active');\n\n if (lastMarkerClick != null) {\n lastMarkerClick['infowindow'].close();\n lastMarkerClick = null;\n }\n\n $('#store-pickup-' + selectedStoreID).parent('.radio').click();\n\n });\n};\n\nfunction buildInfoWindow(marker, info, userIsAuthenticated, page, markerLabelValue) {\n var markerLabel = markerLabelValue;\n var labelcall = Resources.STORELOCATOR_CALL;\n var labelCTA = Resources.STORELOCATOR_CTA;\n var labeltel = Resources.STORELOCATOR_TEL;\n var labeldet = Resources.STORELOCATOR_DET;\n var labeldir = Resources.STORELOCATOR_DIR;\n var labelfav = Resources.STORELOCATOR_FAV;\n var getDirectionsUrl = 'http://maps.google.com/maps?daddr=(' + marker.position.lat() + ',' + marker.position.lng() + ')';\n var pageDetailsUrl = Urls.storeDetails + '?StoreID=' + info.storeId;\n if (info.PC != undefined) {\n pageDetailsUrl += '&PC=' + info.PC;\n }\n\n\n\n\n // 2. Set the marker general content\n var contentString = [];\n if (page === 'storelocator') {\n markerLabel = info.searchResultsPosition;\n if (info.bookingURL && info.bookingLocation) {\n contentString.push('
        ' + labelCTA + '

        ');\n }\n contentString.push('
        ');\n contentString.push('');\n contentString.push(markerLabel);\n contentString.push('');\n var storename = info.name || '';\n contentString.push('
        ' + storename + '
        ');\n contentString.push('

        ' + info.address + '
        ' + info.city + ' ' + info.postalCode + ', ' + info.stateCode + '

        ');\n if (info.phone) {\n contentString.push('
        ' + labeltel + '
        ');\n contentString.push('

        ' + info.phone + '

        ');\n }\n contentString.push('
        ');\n\n return contentString;\n};\n\nfunction buildInfoWindowCheckout(info, markerLabel, page) {\n var reserveInStoreBlocked = $('#reserve-product').data('reserveinstoreprod');\n var labeltel = Resources.STORELOCATOR_TEL;\n var labelthis = Resources.STORELOCATOR_THIS;\n if (page === 'orderdetail') {\n labelthis = Resources.STORELOCATOR_THISODERDERDETAILS;\n } else if (page === 'reserveinstore') {\n labelthis = Resources.STORELOCATOR_THISRESERVEINSTORE;\n }\n var labelcall = Resources.STORELOCATOR_CALL;\n var labelhours = Resources.STORELOCATOR_HOURS;\n\n var contentString = [];\n\n var iconClass = \"\";\n var radioClass = \"\";\n var htmlSelectThisStore = \"\";\n if (markerLabel == \"SELECTED\") {\n iconClass = \" active\";\n radioClass = \" selected\";\n markerLabel = \"\";\n } else {\n markerLabel = info.searchResultsPosition;\n htmlSelectThisStore = '';\n }\n contentString.push('
        ');\n contentString.push('
        ');\n contentString.push(markerLabel);\n contentString.push('
        ');\n contentString.push('');\n contentString.push('
        ');\n contentString.push('
        ');\n contentString.push('
        ' + info.name + '
        ');\n contentString.push('

        ' + info.address + '
        ' + info.city + ' ' + info.postalCode + ', ' + info.stateCode + '

        ');\n if (info.phone) {\n contentString.push('
        ' + labeltel + '
        ');\n contentString.push('

        ' + info.phone + '

        ');\n }\n\n if (info.storeHours) {\n contentString.push('
        ' + labelhours + '
        ' + info.storeHours + '
        ');\n }\n contentString.push('
        ');\n if (!reserveInStoreBlocked) {\n contentString.push(htmlSelectThisStore);\n }\n contentString.push('');\n\n return contentString;\n};\n\n// Creates the marker object\nfunction createMarker(map, info, ctaController, page) {\n\n var imageUrl = Urls.mapMarker;\n var labelColor = '#406CCB';\n\n if (page === 'reserveinstore') {\n imageUrl = Urls.mapMarkerDetail;\n labelColor = 'white';\n }\n\n var newMarker = new google.maps.Marker({\n map: map,\n position: new google.maps.LatLng(info.lat, info.long),\n title: info.name,\n email: info.email,\n label: {\n text: info.searchResultsPosition,\n color: labelColor\n },\n id: info.storeId,\n icon: imageUrl,\n bookingLocation: info.bookingLocation,\n bookingURL: info.bookingURL\n });\n //console.log(info);\n attachClickListenerToMarker(newMarker, ctaController);\n\n return newMarker;\n};\n\nfunction scrollToStore(markerID) {\n if ($('.stores-results-list').length == 0) {\n return;\n }\n // wait for the dropdown to open\n setTimeout(function () {\n $('.stores-results-list').scrollTop(0);\n var scrollValue = $('[data-store-id=' + markerID + ']').offset().top - $('.stores-results-list').offset().top - $('.stores-results-list').scrollTop();\n $('.stores-results-list').scrollTop(scrollValue);\n }, 300);\n}\n\nfunction attachClickListenerToMarker(marker, ctaController) {\n // 3. Add a onclick listener to the marker in order to open the details window\n marker.addListener('click', function () {\n /* if(lastMarkerClick != null && lastMarkerClick.id != marker.id){\n \t\tlastMarkerClick['infowindow'].close();\n \t}\n marker['infowindow'].open(vm.data.map, marker); */\n if ($('.reserve-storelocator').length && $('.reserve-storelocator').parents('.return-sidebar-stage').length) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '107',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'return',\n 'eventAction': 'metodo',\n 'eventLabel': 'map_' + $('.payandcollect-result.open').attr('data-store-name')\n });\n } else if ($('.reserve-storelocator').length) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '50',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel_select_shop',\n 'eventAction': $('.payandcollect-result.open').attr('data-store-name'),\n 'eventLabel': 'map',\n 'sku': $('#pid').val(),\n 'dimension39': $('.payandcollect-result.open').attr('data-availability'),\n 'dimension40': $('.product-addtocart-information').attr('data-category')\n });\n } else if ($('#storelocator-map').length) {\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '41',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'store_locator',\n 'eventAction': 'geox_' + marker.title.toLowerCase(),\n 'eventLabel': 'placeholder_map'\n });\n }\n\n var eventID = $('.pt-benefeet-wrapper').length ? '97' : '41';\n\n $('[data-store-id=' + marker.id + '] .store-header').trigger('click', [eventID]);\n\n if (!window.matchMedia('(max-width: 767px)').matches && $('[data-store-id=' + marker.id + ']').length) {\n scrollToStore(marker.id);\n }\n\n lastMarkerClick = marker;\n });\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n\nexports.BasicMapController = basicMapController;\n\n},{\"./storelocator.mapstyle\":17}],17:[function(require,module,exports){\nexports.Name = {\n 'it': 'Negozi Geox',\n 'en': 'Geox Stores',\n 'fr': 'Magasins Geox',\n 'es': 'Tiendas Geox',\n 'pt': 'Lojas Geox ',\n 'de': 'Geox-Geschäfte'\n}\n\nexports.Style = [\n {\n \"featureType\": \"administrative\",\n \"elementType\": \"labels.text.fill\",\n \"stylers\": [\n {\n \"visibility\": \"on\"\n },\n {\n \"color\": \"#232427\"\n }\n ]\n },\n {\n \"featureType\": \"administrative\",\n \"elementType\": \"labels.text.stroke\",\n \"stylers\": [\n {\n \"visibility\": \"off\"\n }\n ]\n },\n {\n \"featureType\": \"road\",\n \"elementType\": \"geometry\",\n \"stylers\": [\n {\n \"visibility\": \"on\"\n },\n {\n \"color\": \"#b0b4bd\"\n }\n ]\n },\n {\n \"featureType\": \"road\",\n \"elementType\": \"labels\",\n \"stylers\": [\n {\n \"visibility\": \"off\"\n }\n ]\n },\n {\n \"featureType\": \"road.highway\",\n \"elementType\": \"geometry\",\n \"stylers\": [\n {\n \"visibility\": \"on\"\n },\n {\n \"color\": \"#797a81\"\n }\n ]\n },\n {\n \"featureType\": \"water\",\n \"elementType\": \"all\",\n \"stylers\": [\n {\n \"visibility\": \"on\"\n },\n {\n \"color\": \"#5e616f\"\n }\n ]\n },\n {\n \"featureType\": \"landscape.man_made\",\n \"elementType\": \"all\",\n \"stylers\": [\n {\n \"visibility\": \"simplified\"\n },\n {\n \"color\": \"#a5a8b1\"\n }\n ]\n },\n {\n \"featureType\": \"landscape.natural\",\n \"elementType\": \"all\",\n \"stylers\": [\n {\n \"visibility\": \"simplified\"\n },\n {\n \"color\": \"#9c9fa8\"\n }\n ]\n },\n {\n \"featureType\": \"landscape\",\n \"elementType\": \"labels\",\n \"stylers\": [\n {\n \"visibility\": \"off\"\n }\n ]\n },\n {\n \"featureType\": \"poi\",\n \"elementType\": \"all\",\n \"stylers\": [\n {\n \"visibility\": \"off\"\n },\n {\n \"saturation\": -100\n }\n ]\n },\n {\n \"featureType\": \"transit\",\n \"elementType\": \"all\",\n \"stylers\": [\n {\n \"visibility\": \"off\"\n },\n {\n \"saturation\": -100\n }\n ]\n }\n];\n},{}],18:[function(require,module,exports){\n'use strict';\n\nvar util = require('../util'),\n ajax = require('../ajax'),\n TPromise = require('promise'),\n tooltip = require('../tooltip'),\n mapController = require('./storelocator.mapcontroller');\n//storelocatorController= require('./storelocator');\nvar Regions = require('../../../italianRegions');\n\nexports.init = function () {\n //console.log('*INIT*'+window.Auth);\n //console.log('*INIT*'+window.Storename);\n //console.log('*INIT*'+window.Storeemail);\n //console.log('*INIT*'+window.StorestoreId);\n //console.log('*INIT*'+window.Storelat);\n //console.log('*INIT*'+window.Storelong);\n //console.log('*INIT*'+window.Store);\n\n var store = [{\n storeId: window.StorestoreId,\n name: window.Storename,\n email: window.Storeemail,\n lat: window.Storelat,\n long: window.Storelong\n }];\n\n //console.log('*INIT*'+JSON.stringify(store));\n\n //console.log('AAA' + window.Urls.googleMap);\n $.when(\n window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE && $.getScript(window.Urls.googleMap),\n $.Deferred(function (deferred) {\n $(deferred.resolve);\n })\n ).done(function () {\n\n tooltip.init();\n\n // remove \"orario standard\" from hours html content\n $('.js-remove-first-paragraph').find(\"p:first\").css('display', 'none');\n\n // move map to bottom page on mobile\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('.store-locator-details-map').appendTo('.mobile-map-container');\n\n $(document).on('click', '.js-hours-dropdown', function () {\n var $parent = $(this).parents('.hours-list');\n var $content = $parent.find('.hours-list-content');\n\n if ($parent.hasClass('open')) {\n $parent.removeClass('open');\n $content.slideUp(200);\n } else {\n $('.hours-list.open .hours-list-content').slideUp(200);\n $('.hours-list.open').removeClass('open');\n\n $parent.addClass('open');\n $content.slideDown(200);\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '77',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'store_locator',\n 'eventAction': $('[data-store-name]').attr('data-store-name'),\n 'eventLabel': $(this).text().toLowerCase().replace(/ /g, \"_\")\n });\n }\n });\n }\n\n mapController.BasicMapController.api.init(window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE && updateMapCenter(window.Storelat, window.Storelong);\n window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE && updateMapMarker(store, window.Auth);\n window.saveFavoriteStore = saveFavoriteStore;\n\n });\n};\n\nvar saveFavoriteStore = function (storeId, auth) {\n //console.log('SAVE FAVORITE STORE');\n var options = {\n url: util.appendParamsToUrl(Urls.storesSaveFavAjax, {\n StoreID: storeId,\n authenticated: auth,\n details: true\n }),\n callback: handleSaveFavStoreResponse,\n };\n //console.log(options.url);\n\n ajax.getJson(options);\n};\n\nvar handleSaveFavStoreResponse = function (res) {\n\n //console.log('Save Favorite Store Response: ' + JSON.stringify(res));\n if (res.status == 'OK') {\n if (res.redirectURL) {\n // Go To Login-Show with previous url in original param.\n window.location.replace(res.redirectURL);\n return;\n }\n var storesList = res.oldFavStore;\n\n $('#icon').attr('class', 'i-star');\n if (storesList.indexOf(res.storeId) != -1) {\n $('#icon').attr('class', 'i-star active');\n }\n } else {\n alert('Errore durante il salvataggio dello store come preferito :(');\n }\n\n};\n\nvar handleResponse = function (res) {\n if ($('#stores-results-list').find('.stores-results-list-content').length) {\n $('#stores-results-list').find('.stores-results-list-content').html('');\n } else {\n $('#stores-results-list').html('');\n }\n updateResultsList(res);\n mapController.BasicMapController.api.update(res.stores, res.authenticated);\n};\n\nvar updateMapCenter = function (lat, long) {\n var store = {\n lat: lat,\n long: long\n };\n //console.log('*************'+store);\n mapController.BasicMapController.api.updateMapCenter(store);\n};\n\nvar updateMapMarker = function (store, auth) {\n //console.log('*************'+store);\n mapController.BasicMapController.api.updateMapDetail(store, auth);\n //updateState(store,auth);\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n},{\"../../../italianRegions\":1,\"../ajax\":4,\"../tooltip\":78,\"../util\":79,\"./storelocator.mapcontroller\":16,\"promise\":112}],19:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('../dialog');\nvar miniPop = require('./minipop');\n\nvar WishlistComponent = function (isProductTile, isPDP, pdpSizeValidator) {\n this.context = {\n isUserLoggedIn: false,\n favs: [],\n isProductTile: false,\n isPDP: false\n };\n\n this.initContext(isProductTile, isPDP);\n this.handleContext(pdpSizeValidator);\n};\n\nWishlistComponent.prototype.initContext = function (isProductTile, isPDP) {\n this.context.isUserLoggedIn = $('#customer-favorites').length > 0 && $('#customer-favorites').data('isuserloggedin');\n this.context.favs = $('#customer-favorites').data('favorites').favorites;\n this.context.isProductTile = isProductTile;\n this.context.isPDP = isPDP;\n this.context.isAccountWL = $('#carousel-wishlist').length > 0;\n};\n\nWishlistComponent.prototype.handleContext = function (pdpSizeValidator) {\n if (this.context.isUserLoggedIn) {\n if (this.context.isProductTile) {\n this.initWishlistTile();\n }\n\n if (this.context.isPDP) {\n if ($(\".product-not-in-wishlist\").length > 0) {\n $(\".product-not-in-wishlist\").unbind(\"click\");\n $(\".product-not-in-wishlist\").on(\"click\", pdpSizeValidator);\n } else {\n $(\".product-in-wishlist\").unbind(\"click\");\n $(\".product-in-wishlist\").on(\"click\", pdpSizeValidator);\n }\n }\n } else {\n miniPop.init(this.context.isProductTile);\n }\n};\n\nWishlistComponent.prototype.initWishlistTile = function () {\n\n var _this = this;\n\n _this.context.favs && !_this.context.isAccountWL && $('.product-tile-container').each(function (e) {\n\n var $thumb = $(this).find('.product-tile');\n var id = $thumb.data('vgid');\n var present = _this.context.favs.indexOf(id);\n\n var $full = $($thumb).find('#imgFull');\n var $empty = $($thumb).find('#imgEmpty');\n\n $full.hide();\n $empty.show();\n\n $full.attr('id', 'imgFull' + id);\n $empty.attr('id', 'imgEmpty' + id);\n\n if (present != -1) {\n\n $full.toggle();\n $empty.toggle();\n $(this).on('click', '#imgFull' + id, function (e) {\n e.preventDefault();\n e.stopPropagation();\n openDialogWishlist(id, $full, $empty);\n });\n\n } else {\n $(this).on('click', '#imgEmpty' + id, function (e) {\n e.preventDefault();\n e.stopPropagation();\n openDialogWishlist(id, $full, $empty);\n });\n }\n\n });\n\n _this.context.favs && _this.context.isAccountWL && $('.product-tile-container').each(function (e) {\n\n var $thumb = $(this).find('.product-tile');\n var id = $thumb.data('vgid');\n var $removeBtn = $thumb.find('.delete-item');\n\n $(this).on('click', '#imgFull' + id, function (e) {\n e.preventDefault();\n e.stopPropagation();\n $removeBtn.trigger('click');\n });\n\n });\n};\n\nfunction openDialogWishlist(id, $full, $empty) {\n dialog.open({\n url: Urls.wishlistPopup,\n data: [{\n name: \"vgid\",\n value: id\n }],\n options: {\n draggable: false,\n resizable: false,\n show: {\n effect: \"fade\",\n duration: 200\n },\n dialogClass: 'dialog-render wishlist_popup',\n success: function (container) {\n initWishlistDialogUI(id, $full, $empty);\n }\n },\n target: '#login-dialog'\n });\n};\n\nfunction initWishlistDialogUI(id, $full, $empty) {\n $(\".add-size-to-wishlist\").on(\"click\", {\n ID: id,\n fullIcon: $full,\n emptyIcon: $empty\n }, addToWishlistHandler);\n $(\".add-size-to-wishlist-selected\").on(\"click\", {\n ID: id,\n fullIcon: $full,\n emptyIcon: $empty\n }, removeFromWishlistHandler);\n};\n\nfunction addToWishlistHandler(e) {\n var id = e.data.ID;\n var $full = e.data.fullIcon;\n var $empty = e.data.emptyIcon;\n var $this = $(this);\n var url = $(this).data('wishlink');\n $.ajax({\n url: url,\n method: 'GET',\n async: true\n })\n .done(function (response) {\n if (response.success) {\n if ($(\".add-size-to-wishlist-selected\").length == 0) {\n $full.show();\n $empty.hide();\n $('#icon-header-wishlist').addClass(\"full\");\n $('#imgFull' + id).unbind(\"click\");\n $(\"body\").on('click', '#imgFull' + id, function (e) {\n e.preventDefault();\n e.stopPropagation();\n openDialogWishlist(id, $full, $empty);\n });\n }\n\n $this.removeClass(\"add-size-to-wishlist\");\n $this.addClass(\"add-size-to-wishlist-selected\");\n $this.closest(\"li\").addClass(\"selected\");\n $this.unbind(\"click\");\n $this.on(\"click\", {\n ID: id,\n fullIcon: $full,\n emptyIcon: $empty\n }, removeFromWishlistHandler);\n $(\"#wishlist-feedback-message\").html(response.msg)\n setTimeout(function () {\n $(\"#wishlist-feedback-message\").fadeIn(300);\n }, 500);\n setTimeout(function () {\n $(\"#wishlist-feedback-message\").fadeOut(200);\n }, 2500);\n }\n })\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n }\n });\n};\n\nfunction removeFromWishlistHandler(e) {\n var id = e.data.ID;\n var $full = e.data.fullIcon;\n var $empty = e.data.emptyIcon;\n\n var $this = $(this);\n var url = $(this).data('wishlink-remove');\n $.ajax({\n url: url,\n method: 'GET',\n async: true\n })\n .done(function (response) {\n if (response.success) {\n $this.removeClass(\"add-size-to-wishlist-selected\");\n $this.addClass(\"add-size-to-wishlist\");\n $this.closest(\"li\").removeClass(\"selected\");\n $this.unbind(\"click\");\n $this.on(\"click\", {\n ID: id,\n fullIcon: $full,\n emptyIcon: $empty\n }, addToWishlistHandler);\n $(\"#wishlist-feedback-message\").html(response.msg)\n setTimeout(function () {\n $(\"#wishlist-feedback-message\").fadeIn(300);\n }, 500);\n setTimeout(function () {\n $(\"#wishlist-feedback-message\").fadeOut(200);\n }, 2500);\n\n if ($(\".add-size-to-wishlist-selected\").length == 0) {\n $full.hide();\n $empty.show();\n $('#imgEmpty' + id).unbind(\"click\");\n $(\"body\").on('click', '#imgEmpty' + id, function (e) {\n e.preventDefault();\n e.stopPropagation();\n openDialogWishlist(id, $full, $empty);\n });\n }\n }\n })\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n }\n });\n};\n\nmodule.exports = WishlistComponent;\n\n},{\"../dialog\":20,\"./minipop\":14}],20:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('./ajax'),\n util = require('./util'),\n _ = require('lodash'),\n imagesLoaded = require('imagesloaded');\n\nvar dialog = {\n /**\n * @function\n * @description Appends a dialog to a given container (target)\n * @param {Object} params params.target can be an id selector or an jquery object\n */\n create: function (params) {\n var $target, id;\n\n if (_.isString(params.target)) {\n if (params.target.charAt(0) === '#') {\n $target = $(params.target);\n } else {\n $target = $('#' + params.target);\n }\n } else if (params.target instanceof jQuery) {\n $target = params.target;\n } else {\n $target = $('#dialog-container');\n }\n\n // if no element found, create one\n if ($target.length === 0) {\n if ($target.selector && $target.selector.charAt(0) === '#') {\n id = $target.selector.substr(1);\n $target = $('
        ').attr('id', id).addClass('dialog-content').appendTo('body');\n }\n }\n\n // create the dialog\n this.$container = $target;\n this.$loader = $('#checkout-loader');\n this.$container.dialog(_.merge({}, this.settings, params.options || {}));\n\n var scrollsToTop = params.options.scrollsToTop || false;\n\n if (window.matchMedia('(max-width: 1023px)').matches && scrollsToTop) {\n $(\"html, body\").animate({\n scrollTop: 0\n }, \"200\");\n return false;\n }\n },\n /**\n * @function\n * @description Opens a dialog using the given url (params.url) or html (params.html)\n * @param {Object} params\n * @param {Object} params.url should contain the url\n * @param {String} params.html contains the html of the dialog content\n */\n open: function (params) {\n if (this.$container && this.$container.hasClass(\"ui-dialog-content\") && this.$container.dialog('isOpen')) {\n this.destroy();\n }\n this.create(params);\n this.replace(params);\n },\n /**\n * @description populate the dialog with html content, then open it, then \"success\" function if present\n **/\n openWithContent: function (params) {\n var content, position, callback;\n\n if (!this.$container) {\n return;\n }\n content = params.content || params.html;\n if (!content) {\n return;\n }\n this.$container.empty().html(content);\n if (!this.$container.dialog('isOpen')) {\n this.$container.dialog('open');\n }\n\n if (params.options) {\n position = params.options.position;\n }\n if (!position) {\n position = this.settings.position;\n }\n imagesLoaded(this.$container).on('done', function () {\n this.$container.dialog('option', 'position', position);\n }.bind(this));\n\n callback = (typeof params.callback === 'function') ? params.callback : function () {};\n callback();\n this.success(params);\n this.validatorInit(params);\n },\n /**\n * @description Replace the content of current dialog\n * @param {object} params\n * @param {string} params.url - If the url property is provided, an ajax call is performed to get the content to replace\n * @param {string} params.html - If no url property is provided, use html provided to replace\n */\n replace: function (params) {\n if (!this.$container) {\n return;\n }\n if (params.url) {\n params.url = util.appendParamToURL(params.url, 'format', 'ajax');\n this.$loader.removeClass('hide');\n ajax.load({\n url: params.url,\n data: params.data,\n type: params.type,\n async: params.async,\n callback: function (response) {\n this.$loader.addClass('hide');\n params.content = response;\n try {\n JSON.parse(params.content);\n this.successJson(params);\n } catch (e) {\n this.openWithContent(params);\n }\n }.bind(this)\n });\n } else if (params.html) {\n this.openWithContent(params);\n }\n },\n /**\n * @function\n * @description Closes the dialog\n */\n close: function () {\n if (!this.$container) {\n return;\n }\n this.$container.dialog('close');\n },\n /**\n * @function\n * @description Closes the dialog and restores page\n */\n destroy: function () {\n if (!this.$container) {\n return;\n }\n this.$container.empty();\n this.$container.dialog('destroy');\n },\n /**\n * @function\n * @description removes data\n */\n remove: function () {\n if (!this.$container) {\n return;\n }\n this.$container.remove();\n },\n exists: function () {\n return this.$container && (this.$container.length > 0);\n },\n isActive: function () {\n return this.exists() && (this.$container.children.length > 0);\n },\n isDialogOpen: function () {\n return this.exists() && this.$container.hasClass(\"ui-dialog-content\") && this.$container.dialog('isOpen');\n },\n getContainer: function () {\n return this.$container;\n },\n success: function (params) {\n if (params.options && params.options.success) {\n params.options.success(this.$container);\n }\n },\n successJson: function (params) {\n if (params.options && params.options.successJson) {\n params.options.successJson(JSON.parse(params.content));\n }\n },\n validatorInit: function (params) {\n if (params && params.validator) {\n params.validator.init();\n }\n },\n\n settings: {\n autoOpen: false,\n height: 'auto',\n modal: true,\n overlay: {\n opacity: 0.5,\n background: 'black'\n },\n resizable: false,\n title: '',\n width: '800',\n close: function () {\n $(this).dialog('close');\n },\n position: {\n my: 'center',\n at: 'center',\n of: window,\n collision: 'flipfit'\n }\n }\n};\n\nmodule.exports = dialog;\n\n},{\"./ajax\":4,\"./util\":79,\"imagesloaded\":109,\"lodash\":110}],21:[function(require,module,exports){\n'use strict';\n\n/**\n * Utilities for event handling at frontend level.\n */\n\nvar eventUtils = {\n\n checkClickEventAttached: function (selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').click;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').click.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n }\n\n};\n\nmodule.exports = eventUtils;\n\n},{}],22:[function(require,module,exports){\n'use strict';\nvar util = util = require('./util');\n\nvar genericSidebar = {\n\n init: function () {\n var sidebar = $('#generic-sidebar-content').length;\n if (sidebar) {\n this.initPreventPageScroll();\n this.initClose();\n }\n\n // Get scrollbar width and update dynamic styles\n function getScrollbarWidth() {\n return window.innerWidth - document.documentElement.clientWidth;\n }\n var scrollbarWidth = getScrollbarWidth();\n document.documentElement.style.setProperty('--scrollbarWidth', scrollbarWidth + 'px');\n\n },\n\n /**\n * @function\n * @description open the sidebar with the given content\n * @param {String} content url or #ID of the content\n * @param {String} type dynamic if it's an URL, static if the content is already inside the page\n * @param {Boolean} mobileFull style of the mobile version\n * @param {Function} callback function to trigger at the end\n */\n open: function (content, type, mobileFull, callback) {\n var self = this;\n $('#generic-sidebar-content').html('');\n\n // Ajax content\n if (type == 'dynamic') {\n //$('#checkout-loader').removeClass('hide');\n $.get(content, function (data) {\n $('#generic-sidebar-content').html(data);\n\n if ($('#find-out-more').attr('clicked') == 'true') {\n $('.js-close-generic-sidebar').addClass('opened-popup');\n }\n\n //$('#checkout-loader').addClass('hide');\n $('#generic-sidebar').addClass('open');\n $('#generic-sidebar-overlay').fadeIn();\n\n if (mobileFull) {\n $('#generic-sidebar').addClass('full-height');\n } else {\n $('#generic-sidebar').removeClass('full-height');\n }\n\n // block scroll\n if (window.matchMedia('(min-width: 1280px)').matches) {\n $('html').addClass('no-scroll');\n } else {\n if (mobileFull) {\n util.togglePageScroll(true);\n } else {\n document.body.addEventListener('touchmove', self.preventPageScrollOnTouch, {\n passive: false\n });\n }\n }\n\n if (callback) {\n callback();\n }\n });\n }\n\n // Static content\n if (type == 'static') {\n // save parent element to restore it on close\n window.parentSidebarContent = $(content).parent();\n\n // dynamically load content for landing page\n if ($(content).hasClass('landing')) {\n var title = $('.hero-listing-stripe').find('.default-tag').html();\n var descr = $('.hero-listing-stripe').find('.default-text').html();\n if (title != '' && $(content).find('.title').html() == '') {\n $(content).find('.title').html(title);\n }\n if (descr != '' && $(content).find('.description').html() == '') {\n $(content).find('.description').html(descr);\n }\n }\n\n $(content).appendTo('#generic-sidebar-content');\n $(content).removeAttr('hidden');\n $('#generic-sidebar').addClass('open');\n $('#generic-sidebar-overlay').fadeIn();\n\n if (mobileFull) {\n $('#generic-sidebar').addClass('full-height');\n } else {\n $('#generic-sidebar').removeClass('full-height');\n }\n\n // block scroll\n if (window.matchMedia('(min-width: 1280px)').matches) {\n $('html').addClass('no-scroll');\n } else {\n if (mobileFull) {\n util.togglePageScroll(true);\n } else {\n document.body.addEventListener('touchmove', self.preventPageScrollOnTouch, {\n passive: false\n });\n }\n }\n\n if (callback) {\n callback();\n }\n }\n\n },\n\n /**\n * @function\n * @description Prevent page scroll when sidebar is open\n */\n initPreventPageScroll: function () {\n var el = document.getElementById('generic-sidebar-content');\n el.addEventListener('touchstart', function () {\n var top = el.scrollTop,\n totalScroll = el.scrollHeight,\n currentScroll = top + el.offsetHeight\n\n // this prevents the scroll from \"passing through\" to the body.\n if (top === 0) {\n el.scrollTop = 1\n } else if (currentScroll === totalScroll) {\n el.scrollTop = top - 1\n }\n });\n\n el.addEventListener('touchmove', function (evt) {\n //if the content is actually scrollable the scrolling can occur\n if (el.offsetHeight < el.scrollHeight)\n evt._isScroller = true\n });\n },\n\n /**\n * @function\n * @description Init close sidebar click event\n */\n initClose: function () {\n var self = this;\n\n $('body').on('click', '.js-close-generic-sidebar', function () {\n\n if ($('.opened-popup').length) {\n $(\"#find-out-more\").attr(\"clicked\", false);\n }\n\n var isMobileFull = $('#generic-sidebar').hasClass('full-height');\n $('#generic-sidebar').removeClass('open');\n $('#generic-sidebar-overlay').fadeOut();\n $('#generic-sidebar').removeAttr('style');\n\n self.pushNotifyMeCloseGTM();\n\n // if static content --> bring it back to previous position\n if (window.parentSidebarContent) {\n var $content = $('#generic-sidebar-content').children();\n $content.attr('hidden', true)\n window.parentSidebarContent.append($content);\n window.parentSidebarContent = null;\n }\n\n // enable scroll\n if (window.matchMedia('(min-width: 1280px)').matches || $('html').hasClass('no-scroll')) {\n $('html').removeClass('no-scroll');\n } else {\n if (isMobileFull) {\n util.togglePageScroll(false);\n } else {\n document.body.removeEventListener('touchmove', self.preventPageScrollOnTouch, {\n passive: false\n })\n }\n }\n\n $('#generic-sidebar-content').html('');\n });\n },\n\n /**\n * @function\n * @description push GTM notify me data\n */\n pushNotifyMeCloseGTM: function () {\n var isNotifyMeFormVisible = $('#generic-sidebar-content #notify-me-modal').length && $('#render-rows').is(\":visible\");\n\n if (isNotifyMeFormVisible) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '56',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'product_notify_me_close',\n 'eventAction': $('.side-container').find('h1').attr('data-seo-label').replace(/ /g, '_').toLowerCase(),\n 'eventLabel': $(\".pdp-selcart__size-selected\").html().trim(),\n 'sku': $('#pid').val()\n });\n }\n },\n\n /**\n * @function\n * @description prevent scroll if the target is not the sidebar\n */\n preventPageScrollOnTouch: function (evt) {\n if (!evt._isScroller) {\n evt.preventDefault();\n }\n }\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nmodule.exports = genericSidebar;\n\n},{\"./util\":79}],23:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('./ajax'),\n minicart = require('./minicart'),\n util = require('./util');\n\nvar setAddToCartHandler = function (e) {\n e.preventDefault();\n var form = $(this).closest('form');\n\n var options = {\n url: util.ajaxUrl(form.attr('action')),\n method: 'POST',\n cache: false,\n data: form.serialize()\n };\n $.ajax(options).done(function (response) {\n if (response.success) {\n ajax.load({\n url: Urls.minicartGC,\n data: {lineItemId: response.result.lineItemId},\n callback: function (response) {\n minicart.show(response);\n form.find('input,textarea').val('');\n }\n });\n } else {\n form.find('span.error').hide();\n for (var id in response.errors.FormErrors) {\n var $errorEl = $('#' + id).addClass('error').removeClass('valid').next('.error');\n if (!$errorEl || $errorEl.length === 0) {\n $errorEl = $('');\n $('#' + id).after($errorEl);\n }\n $errorEl.text(response.errors.FormErrors[id].replace(/\\\\'/g, '\\'')).show();\n }\n }\n }).fail(function (xhr, textStatus) {\n // failed\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n } else {\n window.alert(Resources.SERVER_CONNECTION_ERROR);\n }\n });\n};\n\nexports.init = function () {\n $('#AddToBasketButton').on('click', setAddToCartHandler);\n};\n\n},{\"./ajax\":4,\"./minicart\":28,\"./util\":79}],24:[function(require,module,exports){\n'use strict';\n\nexports.init = function () {\n\n if ($('[data-gtmpromobanner]').length > 0) {\n initPromoEvents();\n } else {\n window.initPromoEvents = initPromoEvents;\n }\n\n if ($('[data-gtmevent]').length > 0) {\n initGtmEvents();\n } else {\n window.initGtmEvents = initGtmEvents;\n }\n\n if ($('[data-returncase-number]').length > 0) {\n initReturnConfirmationEvents();\n } else {\n window.initReturnConfirmationEvents = initReturnConfirmationEvents;\n }\n};\n\n/* padStart polyfill for IE */\n// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart\nif (!String.prototype.padStart) {\n String.prototype.padStart = function padStart(targetLength, padString) {\n targetLength = targetLength >> 0; //truncate if number or convert non-number to 0;\n padString = String((typeof padString !== 'undefined' ? padString : ' '));\n if (this.length > targetLength) {\n return String(this);\n } else {\n targetLength = targetLength - this.length;\n if (targetLength > padString.length) {\n padString += Array.apply(null, Array(targetLength)).map(function () {\n return padString;\n }).join(\"\");\n }\n return padString.slice(0, targetLength) + String(this);\n }\n };\n}\n\nfunction leftFillNum(num, targetLength) {\n return num.toString().padStart(targetLength, 0);\n}\n\nfunction getPromoCta(elem) {\n var promoCta = '';\n if ($(elem).find('img').length) {\n promoCta = 'image';\n } else {\n if (typeof $(elem).attr('data-seo-label') !== 'undefined' && $(elem).attr('data-seo-label') != '') {\n promoCta = $(elem).attr('data-seo-label').trim().toLowerCase().replace(/ /g, \"_\");\n }\n }\n return promoCta;\n}\n\nfunction initPromoEvents() {\n\n var promoIndex = 0;\n var pushPromoView = false;\n\n // init dataLayer for promoView container - not triggered for data-gtmpromobanner=\"listing_editorial_card\"\n var datalayerElement = {};\n datalayerElement.event = 'promoView';\n datalayerElement.ss_event_id = getTimestampAlphanumericString();\n datalayerElement.ecommerce = {};\n datalayerElement.ecommerce.promoView = {};\n datalayerElement.ecommerce.promoView.promotions = [];\n\n $('[data-gtmpromobanner]').each(function () {\n promoIndex++;\n var promoName = ''\n if ($(this).find('.default-product-title').attr('data-seo-label')) {\n promoName = $(this).find('.default-product-title').attr('data-seo-label').trim().toLowerCase().replace(/ /g, \"_\");\n }\n if ($(this).find('.default-tag-small').length) {\n var categoryName = '';\n if ($(this).find('.default-tag-small').attr('data-seo-label')) {\n categoryName = $(this).find('.default-tag-small').attr('data-seo-label').trim().toLowerCase().replace(/ /g, \"_\");\n }\n promoName = categoryName + '_' + promoName;\n }\n\n if ($(this).hasClass('editorial-card')) {\n if ($(this).find('.editorial-card-title').attr('data-seo-label')) {\n promoName = $(this).find('.editorial-card-title').attr('data-seo-label').trim().toLowerCase().replace(/ /g, \"_\");\n }\n if ($(this).find('.editorial-card-text').length && $(this).find('.editorial-card-text').attr('data-seo-label')) {\n var promoText = $(this).find('.editorial-card-title').attr('data-seo-label').trim().toLowerCase().replace(/ /g, \"_\");\n promoName = promoName + '_' + promoText;\n }\n }\n\n var promoCreative = $(this).data('gtmpromobanner');\n var promoPosition = '';\n if ($(this).parents('.plp-top-banner-wrapper').length) {\n promoPosition = 'top_banner';\n } else if ($(this).parents('.plp-breaker-top').length) {\n promoPosition = 'breaker';\n } else if ($(this).parents('.plp-breaker-middle').length) {\n promoPosition = 'plp_breaker_middle';\n } else if ($(this).parents('.bottom-breakers-wrapper').length) {\n promoPosition = 'bottom_banner';\n } else if ($(this).data('gtmpromoposition')) {\n promoPosition = $(this).data('gtmpromoposition');\n }\n\n // set different events based on promoCreative\n if (promoCreative != 'listing_editorial_card') {\n pushPromoView = true;\n var promoID = leftFillNum(promoIndex, 4); // format: 0001\n var datalayerPromo = {};\n datalayerPromo.id = promoID;\n datalayerPromo.name = promoName;\n datalayerPromo.creative = promoCreative;\n datalayerPromo.position = promoPosition;\n\n // push single promo object into promoView container\n datalayerElement.ecommerce.promoView.promotions.push(datalayerPromo);\n }\n\n // add promoClick event\n $(this).find('a').click(function (event) {\n var promoCta = getPromoCta($(this));\n\n var dataLayerClick = {};\n dataLayerClick.ss_event_id = getTimestampAlphanumericString();\n\n if (promoCreative == 'listing_editorial_card') {\n // new GAevent\n dataLayerClick.event = 'GAevent';\n dataLayerClick.eventID = '137';\n dataLayerClick.eventCategory = 'breaker';\n dataLayerClick.eventAction = promoCreative;\n dataLayerClick.eventLabel = promoName;\n dataLayerClick.dimension62 = promoCta;\n dataLayerClick.dimension63 = promoPosition;\n dataLayerClick.event_name = 'breaker';\n dataLayerClick.label = promoCta;\n dataLayerClick.type = promoName;\n dataLayerClick.method = promoCreative;\n dataLayerClick.position = promoPosition;\n } else {\n // promoClick event\n dataLayerClick.event = 'promoClick';\n dataLayerClick.ecommerce = {};\n dataLayerClick.ecommerce.promoClick = {};\n dataLayerClick.ecommerce.promoClick.promotions = [];\n dataLayerClick.ecommerce.promoClick.promotions.push(datalayerPromo);\n }\n\n // push promoClick event into dataLayer\n dataLayer.push(dataLayerClick);\n });\n });\n\n // push promoView container into dataLayer\n if (pushPromoView) {\n dataLayer.push(datalayerElement);\n }\n}\n\n\nfunction initGtmEvents() {\n\n var datalayerElement = {};\n\n $('[data-gtmevent]').each(function () {\n\n if ($(this).data('gtmevent') == 'login') {\n // prevent multiple events pushed\n var loginEventPushed = false;\n if (dataLayer.filter(function (e) {\n return e.eventID === '20';\n }).length > 0) {\n loginEventPushed = true;\n }\n\n if (!loginEventPushed) {\n // successful login from login page, cart or checkout\n var pageType = dataLayer[0].pageType;\n if (pageType === 'checkout' || pageType === 'profile' ||\n pageType === 'product') {\n var eventLabel = sessionStorage.getItem('loginFrom') ? sessionStorage.getItem('loginFrom') : '';\n datalayerElement.event = 'GAevent';\n datalayerElement.eventID = '20';\n datalayerElement.ss_event_id = getTimestampAlphanumericString();\n datalayerElement.eventCategory = 'login';\n datalayerElement.eventAction = 'access';\n datalayerElement.eventLabel = eventLabel;\n // clear login from data\n sessionStorage.removeItem('loginFrom');\n }\n }\n }\n\n if ($(this).data('gtmevent') == 'registration') {\n // prevent multiple events pushed\n var registrationEventPushed = false;\n\n // event id 19 - registration step 2\n if (dataLayer.filter(function (e) {\n return e.eventID === '19';\n }).length > 0) {\n registrationEventPushed = true;\n }\n if (!registrationEventPushed) {\n // successful registration\n var emailHashed = sessionStorage.getItem('registrationEmail') ? sessionStorage.getItem('registrationEmail') : '';\n var eventLabel = sessionStorage.getItem('registrationType') ? sessionStorage.getItem('registrationType') : '';\n datalayerElement.event = 'GAevent';\n datalayerElement.eventID = '19';\n datalayerElement.ss_event_id = getTimestampAlphanumericString();\n datalayerElement.eventCategory = 'registration';\n datalayerElement.eventAction = 'step2';\n datalayerElement.eventLabel = eventLabel;\n datalayerElement.emailHashed = emailHashed;\n // clear registration type data\n sessionStorage.removeItem('registrationType');\n sessionStorage.removeItem('registrationEmail');\n }\n\n }\n });\n\n dataLayer.push(datalayerElement);\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nif (dataLayer[0].pageType == 'checkout') {\n $('.grid-footer-middle .content-payment').addClass('d-none');\n}\n\nfunction initReturnConfirmationEvents() {\n var skus = [];\n var categories = [];\n var products = [];\n var $returnedProducts = $('[data-item-id]');\n var returnID = $('[data-returncase-number]').attr('data-returncase-number') ? $('[data-returncase-number]').attr('data-returncase-number').split('-')[0] : '';\n\n $returnedProducts.each(function () {\n var sku = $(this).attr('data-item-id');\n var returnedQty = parseInt($(this).find(\"[data-returned-qty]\").attr('data-returned-qty'));\n\n skus.push(sku);\n categories.push($(this).find(\".category\").attr('data-category').trim().replace(/ /g, '_').toLowerCase());\n products.push({\n 'id': sku,\n 'quantity': returnedQty\n });\n });\n\n // Data for return event\n var returnObj = {\n 'event': 'refund',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'ecommerce': {\n 'currencyCode': $('[data-currency]').attr('data-currency'),\n 'refund': {\n 'actionField': {\n 'id': returnID\n }\n }\n }\n };\n\n // Add additional products data if partial return\n if (sessionStorage.getItem('isFullReturn') != 'true') {\n returnObj.ecommerce.refund.products = products;\n }\n\n // clear session storage value\n sessionStorage.removeItem('isFullReturn');\n\n // Push confirmation page event\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '109',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'return',\n 'eventAction': 'thank_you_page',\n 'eventLabel': returnID,\n 'sku': skus.join(),\n 'dimension40': categories.join()\n });\n // Push return event\n dataLayer.push(returnObj);\n}\n\n},{}],25:[function(require,module,exports){\n'use strict';\n\nvar impressions = {\n\n init: function () {\n var self = this;\n\n // impressions:init --> event to trigger impressions push\n $(document).on('impressions:init', function() {\n self.pushImpressionSliders();\n });\n\n // push impressions on slide change\n $(document).on('afterChange', '[data-impression-slider]', function() {\n self.pushImpressionSliders();\n })\n\n },\n\n pushImpressionSliders: function () {\n\n var $impressionSliders = $('[data-impression-slider]');\n\n $impressionSliders.each(function () {\n\n try {\n // get basic productImpression object without products\n var impressionObj = $(this).attr('data-impression-slider');\n impressionObj = JSON.parse(impressionObj);\n\n // get all the active slides not already pushed inside product impression (data-impression-triggered=\"false\")\n // or get all the non-slider elements with attributes data-impression-default-trigger=\"true\" and data-impression-triggered=\"false\"\n var $activeSlides = $(this).find('.slick-active.slick-slide[data-impression-triggered=\"false\"], [data-impression-default-trigger=\"true\"][data-impression-triggered=\"false\"]');\n\n if ($activeSlides.length) {\n var productList = [];\n\n $activeSlides.each(function () {\n\n // get product data and add them to productList\n var productData = $(this).attr('data-slide-impression');\n productData = JSON.parse(productData);\n productList.push(productData);\n\n // prevent multiple product impression's push\n $(this).attr('data-impression-triggered', true);\n });\n\n // push dataLayer\n impressionObj.ecommerce.impressions = productList;\n dataLayer.push(impressionObj);\n }\n\n } catch (e) {\n console.error('Impression slider error: ' + e);\n }\n });\n\n }\n\n};\n\nmodule.exports = impressions;\n\n},{}],26:[function(require,module,exports){\n'use strict';\n// jQuery extensions\n\nmodule.exports = function () {\n // params\n // toggleClass - required\n // triggerSelector - optional. the selector for the element that triggers the event handler. defaults to the child elements of the list.\n // eventName - optional. defaults to 'click'\n $.fn.toggledList = function (options) {\n if (!options.toggleClass) { return this; }\n var list = this;\n return list.on(options.eventName || 'click', options.triggerSelector || list.children(), function (e) {\n e.preventDefault();\n var classTarget = options.triggerSelector ? $(this).parent() : $(this);\n classTarget.toggleClass(options.toggleClass);\n // execute callback if exists\n if (options.callback) {options.callback();}\n });\n };\n\n $.fn.syncHeight = function () {\n var arr = $.makeArray(this);\n arr.sort(function (a, b) {\n return $(a).height() - $(b).height();\n });\n return this.height($(arr[arr.length - 1]).height());\n };\n};\n\n},{}],27:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog'),\n page = require('./page'),\n validator = require('./validator');\n\nvar _ = require('lodash');\n\n/**\n * Opening popup with parametric error message\n * @param {String} errorMsg - error message\n * @param {boolean} errorUserExists - true if the customer exists\n */\nvar openPopupError = function (errorMsg, errorUserExists) {\n var benefeetDialog = $('#benefeet-dialog');\n var msg = errorMsg;\n var errorUserExists = errorUserExists;\n\n if (msg && msg != '') {\n\n benefeetDialog.removeClass('login-registration').children('.ui-dialog-content').children().remove();\n var benefeetOverlay = $('#benefeet-overlay');\n benefeetOverlay.addClass('open');\n\n benefeetDialog.addClass(\"login-registration\");\n benefeetDialog.removeClass(\"benefeet-registration\");\n benefeetDialog.addClass('open').find('.ui-dialog-content').html(msg);\n\n // prevent multiple dialog ajax requests\n benefeetDialog.attr('data-opened', true);\n\n if (errorUserExists) {\n $('.content-email').find('.error-message').hide();\n $('.content-email').find('.email').append('
        ' + msg + '
        ');\n }\n }\n};\n\n/**\n * Retrieve product options\n *\n * @param {Object[]} events - Array of event objects\n * @param {string} selector - Event selector\n * @return {boolean} - Already attached flag\n */\nfunction checkEventAlreadyAttached(events, selector) {\n var finded = false;\n\n if (events) {\n // search selector inside each event object\n for (var i = 0; i < events.length && !finded; i++) {\n if (events[i].selector === selector) {\n finded = true;\n }\n }\n }\n\n return finded;\n}\n\nfunction checkSubmitEventAttached(selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').submit;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').submit.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n}\n\nfunction checkClickEventAttached(selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').click;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').click.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nvar login = {\n /**\n * @private\n * @function\n * @description init events for the loginPage\n */\n init: function () {\n $('.content-registration-form-step2').hide();\n $('.content-assets-step2').hide();\n\n\n var inputVal = $('.field-wrapper input').val(); // get the value of the input field\n\n if (inputVal == \"\") {\n // $('.content-login').addClass('disabled');\n // $('.content-registration-form-step1').addClass('disabled');\n // $('form').find('div:first-child[class*=\"content-\"]').addClass('disabled');\n }\n\n //if ($('.content-registration-form-step1').hasClass('disabled')) {\n $('.content-icon-back-register').hide();\n //}\n\n //o-auth binding for which icon is clicked\n $('.oAuthIcon').bind('click', function () {\n $('#OAuthProvider').val(this.id);\n });\n\n\n //toggle the value of the rememberme checkbox\n $('#dwfrm_login_rememberme').bind('change', function () {\n if ($('#dwfrm_login_rememberme').attr('checked')) {\n $('#rememberme').val('true');\n } else {\n $('#rememberme').val('false');\n }\n });\n\n var $formElem = $('.field-wrapper input').closest('form');\n var $requiredInputs = $formElem.find('input.required');\n var $formContainer;\n var validator;\n var validators = new Map();\n var selector;\n\n var hasEmptyRequired = function () {\n // nomore hidden sections in register page, visible input fields filtering removed\n var requiredValues = $requiredInputs.map(function () {\n if ($(this).attr('type') === 'checkbox' && $(this).prop('checked') == false) {\n return '';\n } else {\n return $(this).val();\n }\n });\n return _(requiredValues).contains('');\n };\n\n var validateEl = function () {\n var currentFormID = this.form.id;\n\n $formContainer = $('#' + currentFormID).find('div:first-child[class*=\"content-\"]');\n $requiredInputs = $('#' + currentFormID).find('input.required, select.required');\n validator = validators.get(currentFormID);\n\n var hasFilledInvalid = false;\n /* When validateEl is called on a filled input validate every other filled input (except for checkboxes,\n which must be explicitly filtered out because they are considered filled by default) */\n $requiredInputs.filter(\"input:filled:not(input[type='checkbox'])\").each(function () {\n if (!validator.element(this)) {\n hasFilledInvalid = false;\n }\n });\n\n /* Verified mobilephone validation added -> if we are inside MyData page, during validation we also check for the number to be verified*/\n var mobilePhone = $('input[name*=\"profile_customer_mobilephone\"]').length != 0 ? $('input[name*=\"profile_customer_mobilephone\"]')[0].value : '';\n var isVerifiedNumber = false;\n if (mobilePhone) {\n isVerifiedNumber = sessionStorage.getItem('verifiedNumber') == mobilePhone ? true : false;\n if (!hasEmptyRequired() && !hasFilledInvalid && isVerifiedNumber) {\n $formContainer.removeClass('disabled');\n } else {\n validator.element(this);\n }\n } else {\n if (!hasEmptyRequired() && !hasFilledInvalid) {\n $formContainer.removeClass('disabled');\n }\n }\n };\n\n // Set a validator for every form inside the current page\n var length = $formElem.length;\n for (var i = 0; i < length; i++) {\n var currentForm = $formElem[i];\n $requiredInputs = $('#' + currentForm.id).find('input.required, select.required');\n $formContainer = $('#' + currentForm.id).find('div:first-child[class*=\"content-\"]');\n\n validator = $('#' + currentForm.id).validate({\n focusInvalid: false\n });\n\n validators.set(currentForm.id, validator);\n\n $requiredInputs.on('change focusout', validateEl);\n $requiredInputs.filter('input').on('keyup', _.debounce(validateEl, 200));\n };\n\n $('.field-wrapper input').on('change keyup mouseup', function () {\n if ($(\".email_main_confirm\").val() == $(\".email_second_confirm\").val()) {\n $(\"#dwfrm_profile_customer_emailconfirm-error\").hide();\n } else {\n $(\"#dwfrm_profile_customer_emailconfirm-error\").show();\n }\n\n //Check for removal of error message for email already used, in case ofupdating the input field\n if ($('.content-email .email').find('.error-user-exist').length > 0) {\n $('.content-email .email').find('.error-user-exist').remove();\n }\n });\n\n // Enable spinner and change styles on form submit (Login page)\n var eventName = 'spinner_event';\n selector = '#dwfrm_login';\n\n if (!checkSubmitEventAttached(selector, eventName)) {\n $(document).on('submit', selector, {\n eventName: 'spinner_event'\n }, function () {\n if ($(\".email-custom\").hasClass(\"valid\") && $(\".password-custom\").hasClass(\"valid\")) {\n $(\".email-custom\").css({\n \"background-color\": \"#f2f2f2\"\n });\n $(\".password-custom\").css({\n \"background-color\": \"#f2f2f2\"\n });\n $(\".login-rememberme\").css({\n \"opacity\": \"0.3\"\n });\n $(\"#password-reset\").css({\n \"opacity\": \"0.3\"\n });\n $(\".create-account \").css({\n \"box-shadow\": \"none\"\n });\n $(\".button \").css({\n \"background-color\": \"#f2f2f2\",\n \"color\": \"#cccccc\"\n });\n $(\".text-accedi\").hide();\n $(\".spinner\").css(\"display\", \"block\");\n }\n });\n }\n\n // Enable spinner and change styles on form submit (Registration - EditProfile)\n eventName = 'spinner_event';\n selector = '#RegistrationForm, #ChangePassowrdForm, #NewPasswordForm';\n\n if (!checkSubmitEventAttached(selector, eventName)) {\n $(document).on('submit', selector, {\n eventName: 'spinner_event'\n }, function () {\n var currentValidator = validators.get(this.id);\n if (currentValidator.form()) {\n $('.button').not($('#' + this.id).find('button[type=\"submit\"]')).css({\n \"background-color\": \"#f2f2f2\",\n \"background-image\": \"none\",\n \"color\": \"#cccccc\"\n });\n $('#' + this.id).find('span[class*=\"text\"]').hide();\n $('#' + this.id).find(\".spinner\").css(\"display\", \"block\");\n }\n });\n }\n\n $(\".content-icon-back-register\").click(function () {\n $('.content-registration-form-step2').hide();\n $('.content-registration-form-step1').removeClass('disabled');\n $('.content-assets-step2').hide();\n $('.content-icon-back-register').hide();\n $('.contenitore-form').remove();\n $('.content-registration-form-step1').show();\n $('.content-assets-step1').show();\n\n // Scroll top - all device\n $(window).scrollTop(0);\n });\n\n\n /**\n * For the country with second step.\n * Ajax to check if user has already registered an account with the same email.\n */\n var eventsButton = $._data($(document)[0], 'events').click;\n var selectorButton = '.continua';\n var eventAlreadyAttached = checkEventAlreadyAttached(eventsButton, selectorButton);\n if (!eventAlreadyAttached) {\n $(document).on('click', '.continua', function () {\n var urlButton = $('.continua').data('checkuser-url');\n\n // Check empty fields to enable step 2\n if (!hasEmptyRequired()) {\n $.ajax({\n url: urlButton,\n type: 'post',\n dataType: 'json',\n data: {\n userEmail: $('.email_main_confirm').val(),\n confirmUserEmail: $('.email_second_confirm').val()\n },\n success: function (data) {\n if (!data.errorExistingCustomer) {\n $('.content-elements').addClass('active');\n $('.content-registration-form-step1').removeClass('disabled');\n $('.content-registration-form-step2').show();\n $('.content-assets-step2').show();\n $('.content-icon-back-register').show();\n $('.content-registration-form-step1').hide();\n $('.content-assets-step1').hide();\n\n // Scroll top - all device\n $(window).scrollTop(0);\n\n $(':radio').each(function () {\n $(this).removeAttr('checked');\n $('input[type=\"radio\"]').prop('checked', false);\n });\n $('.initBenefeetFormValidation').addClass('disabled');\n\n if (!$(this).data('eventTriggered')) {\n var email = $('.email_main_confirm').val();\n var emailMD5 = $.md5(email);\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '19',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'registration',\n 'eventAction': 'step2',\n 'emailHashed': emailMD5\n });\n }\n\n // prevent multiple event trigger\n //$(this).data('eventTriggered', true);\n } else {\n openPopupError(data.errorMsg, data.errorExistingCustomer);\n }\n },\n error: function (err) {\n console.log(\"Errrore!!!!\");\n }\n });\n }\n\n });\n }\n },\n\n initBenefeetFormValidation: function () {\n\n if (typeof _ == 'undefined') {\n var _ = require('lodash');\n }\n\n var $formElem = $('.field-wrapper input').closest('form');\n if ($formElem.find('#benefeet-dialog').length) {\n $formElem.find('#benefeet-dialog');\n }\n var $requiredInputs = $formElem.find('input.required');\n var $formContainer = $('.content-new-benefeet, .content-old-benefeet');\n var validator;\n\n var hasEmptyRequired = function () {\n // filter out only the visible fields\n var requiredValues = $requiredInputs.filter(':visible').map(function () {\n if ($(this).attr('type') === 'checkbox' && $(this).prop('checked') == false) {\n return '';\n } else {\n return $(this).val();\n }\n });\n return _(requiredValues).contains('');\n };\n\n var validateEl = function () {\n if ($(this).val() === '') {\n $formContainer.addClass('disabled');\n } else {\n // enable continue button on last required field that is valid\n // only validate single field\n if (validator.element(this) && !hasEmptyRequired()) {\n $formContainer.removeClass('disabled');\n } else {\n $formContainer.addClass('disabled');\n }\n }\n };\n\n // Case: multiple input field - validate on change/keyup\n validator = $formElem.validate();\n $requiredInputs.on('change', validateEl);\n $requiredInputs.filter('input').on('keyup', _.debounce(validateEl, 200));\n\n // Disable form on init if has empty fields\n if (hasEmptyRequired()) {\n $formContainer.addClass('disabled');\n }\n\n }\n}\n\nmodule.exports = login;\n\n},{\"./dialog\":20,\"./page\":29,\"./validator\":80,\"lodash\":110}],28:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util'),\n bonusProductsView = require('./bonus-products-view');\n\nvar timer = {\n id: null,\n clear: function () {\n if (this.id) {\n window.clearTimeout(this.id);\n delete this.id;\n }\n },\n start: function (duration, callback) {\n this.id = setTimeout(callback, duration);\n }\n};\n\nvar minicart = {\n init: function () {\n\n this.$el = $('#mini-cart');\n this.$content = this.$el.find('.mini-cart-content');\n\n $('.mini-cart-product').eq(0).find('.mini-cart-toggle').addClass('fa-caret-down');\n $('.mini-cart-product').not(':first').addClass('collapsed')\n .find('.mini-cart-toggle').addClass('fa-caret-right');\n\n $('.mini-cart-toggle').on('click', function () {\n $(this).toggleClass('fa-caret-down fa-caret-right');\n $(this).closest('.mini-cart-product').toggleClass('collapsed');\n });\n\n // events\n this.$el.find('.mini-cart-total').on('mouseenter', function () {\n if (this.$content.not(':visible')) {\n this.slide();\n }\n }.bind(this));\n\n this.$content.on('mouseenter', function () {\n timer.clear();\n //$('html').addClass('no-scroll');\n }).on('mouseleave', function () {\n timer.clear();\n timer.start(30, this.close.bind(this));\n //$('html').removeClass('no-scroll');\n this.$content.removeClass('open');\n }.bind(this));\n\n // reduce products container max-height if there are promo banners\n var promoBanners = $('.mini-cart-content .cart-promo-banner').length;\n if (promoBanners) {\n $('.mini-cart-products').addClass('lower-height');\n }\n\n },\n /**\n * @function\n * @description Shows the given content in the mini cart\n * @param {String} A HTML string with the content which will be shown\n */\n show: function (html) {\n this.$el.html(html);\n util.scrollBrowser(0);\n this.init();\n this.addToCart();\n bonusProductsView.loadBonusOption();\n },\n addToCart: function () {\n timer.clear();\n // show the item\n this.$content.addClass('open');\n // after a time out automatically close it\n timer.start(5000, this.close.bind(this));\n },\n\n /**\n * @function\n * @description Slides down and show the contents of the mini cart\n */\n slide: function () {\n timer.clear();\n // show the item\n this.$content.addClass('open');\n // after a time out automatically close it\n timer.start(3000, this.close.bind(this));\n },\n /**\n * @function\n * @description Closes the mini cart with given delay\n * @param {Number} delay The delay in milliseconds\n */\n close: function (delay) {\n timer.clear();\n this.$content.removeClass('open');\n }\n};\n\nmodule.exports = minicart;\n\nminicart.js\n/*closes the mini cart if the user tab is open*/ \n$(\".log-in\").hover (function() {\n $(\".mini-cart-content\").removeClass('open');\n});\n\n\n},{\"./bonus-products-view\":6,\"./util\":79}],29:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util');\n\nvar page = {\n title: '',\n type: '',\n params: util.getQueryStringParams(window.location.search.substr(1)),\n redirect: function (newURL) {\n setTimeout(function () {\n window.location.href = newURL;\n }, 0);\n },\n refresh: function () {\n setTimeout(function () {\n window.location.assign(window.location.href);\n }, 500);\n },\n getCurrentUrl: function() {\n \treturn window.location.href;\n },\n getCurrentUrlWithParameter: function(name, value) {\n \tvar newUrl = new URL(window.location.href);\n \tif(newUrl.searchParams.getAll(name).length >0) {\n \t\tnewUrl.searchParams.delete(name);\n\t\t};\n\t\tnewUrl.searchParams.append(name, value);\n\t\treturn newUrl.toString();\n }\n};\n\nmodule.exports = page;\n\n},{\"./util\":79}],30:[function(require,module,exports){\n'use strict';\n\nvar giftcert = require('../giftcert'),\n tooltip = require('../tooltip'),\n util = require('../util'),\n eventUtils = require('../eventHandlingUtils'),\n dialog = require('../dialog'),\n page = require('../page'),\n login = require('../login'),\n editAccount = require('./editaccount'),\n validator = require('../validator'),\n ajax = require('../ajax'),\n wishlist = require(\"./wishlist\"),\n productTile = require('../product-tile');\n\nvar popupHasBeenRead = false;\nvar benefeetHasBeenRead = false;\n\n/**\n * @function\n * @description Initializes the events on the address form (apply, cancel, delete)\n * @param {Element} form The form which will be initialized\n */\nfunction initializeAddressForm() {\n var $form = $('#edit-address-form');\n\n $form.find('input[name=\"format\"]').remove();\n tooltip.init();\n //$(\"\").attr({type:\"hidden\", name:\"format\", value:\"ajax\"}).appendTo(form);\n\n $form.on('click', '.apply-button', function (e) {\n e.preventDefault();\n if (!$form.valid()) {\n var errors = $form.find('.error');\n if (errors.length > 0) {\n var offset = errors[0].offset();\n $('#dialog-container').animate({\n scrollTop: offset.top - 50\n }, 500);\n }\n return false;\n }\n var url = util.appendParamToURL($form.attr('action'), 'format', 'ajax');\n var applyName = $form.find('.apply-button').attr('name');\n var options = {\n url: url,\n data: $form.serialize() + '&' + applyName + '=x' + '&addressid=' + $(this).closest('form').find('[name$=\"_addressid\"]').val(),\n type: 'POST'\n };\n $.ajax(options).done(function (data) {\n if (typeof (data) !== 'string') {\n if (data.success) {\n dialog.close();\n page.redirect(page.getCurrentUrlWithParameter('invalid', 'false'));\n } else if (data.error) {\n page.redirect(Urls.csrffailed);\n } else {\n $('#dialog-container').animate({\n scrollTop: 0\n }, 500);\n $form.find('.form-error').html(data.message);\n $form.find('.form-error').show();\n return false;\n }\n } else {\n $('#dialog-container').html(data);\n account.init();\n tooltip.init();\n }\n });\n })\n .on('click', '#edit-address-form .cancel-button,#edit-address-form .close-button', function (e) {\n e.preventDefault();\n dialog.close();\n })\n .on('click', '#edit-address-form .delete-button', function (e) {\n e.preventDefault();\n if (window.confirm(String.format(Resources.CONFIRM_DELETE, Resources.TITLE_ADDRESS))) {\n var url = util.appendParamsToUrl(Urls.deleteAddress, {\n AddressID: $form.find('#addressid').val(),\n format: 'ajax'\n });\n $.ajax({\n url: url,\n method: 'POST',\n dataType: 'json'\n }).done(function (data) {\n if (data.status.toLowerCase() === 'ok') {\n dialog.close();\n page.refresh();\n } else if (data.message.length > 0) {\n window.alert(data.message);\n return false;\n } else {\n dialog.close();\n page.refresh();\n }\n });\n }\n });\n\n validator.init();\n}\n/**\n * @private\n * @function\n * @description Toggles the list of Orders\n */\n\nfunction toggleFullOrder() {\n $('.order-items')\n .find('li.hidden:first')\n .prev('li')\n // .append('View All')\n .children('.toggle')\n .click(function () {\n $(this).parent().siblings('li.hidden').show();\n $(this).remove();\n });\n}\n/**\n * @private\n * @function\n * @description Binds the events on the address form (edit, create, delete)\n */\nfunction initAddressEvents() {\n var addresses = $('#addresses');\n\n if (addresses.length === 0) {\n return;\n }\n\n addresses.on('click', '.address-edit, .address-create', function (e) {\n e.preventDefault();\n var url = $(this).attr('data-href');\n dialog.open({\n url: url,\n validator: validator,\n options: {\n open: initializeAddressForm,\n appendTo: addresses,\n draggable: false,\n dialogClass: 'dialog-render address-create-edit',\n success: function (container) {\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').addClass('fixed-page');\n }\n\n container.parent().find('.ui-dialog-titlebar-close').on('click', function () {\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').removeClass('fixed-page');\n }\n });\n\n container.find('select').has('.select-option.empty:selected').each(function (index, element) {\n $(element).css('color', '#b2b2b2');\n });\n }\n }\n });\n }).on('click', '.delete', function (e) {\n e.preventDefault();\n if (window.confirm(String.format(Resources.CONFIRM_DELETE, Resources.TITLE_ADDRESS))) {\n $.ajax({\n url: util.appendParamToURL($(this).attr('href'), 'format', 'ajax'),\n dataType: 'json'\n }).done(function (data) {\n if (data.status.toLowerCase() === 'ok') {\n page.redirect(Urls.addressesList);\n } else if (data.message.length > 0) {\n window.alert(data.message);\n } else {\n page.refresh();\n }\n });\n }\n });\n}\n/**\n * @private\n * @function\n * @description Binds the events of the payment methods list (delete card)\n */\nfunction initPaymentEvents() {\n $('.add-card').on('click', function (e) {\n e.preventDefault();\n dialog.open({\n url: $(e.target).attr('href'),\n options: {\n open: initializePaymentForm\n }\n });\n });\n\n var paymentList = $('.payment-list');\n if (paymentList.length === 0) {\n return;\n }\n\n util.setDeleteConfirmation(paymentList, String.format(Resources.CONFIRM_DELETE, Resources.TITLE_CREDITCARD));\n\n $('form[name=\"payment-remove\"]').on('submit', function (e) {\n e.preventDefault();\n // override form submission in order to prevent refresh issues\n var button = $(this).find('.delete');\n $('').attr({\n type: 'hidden',\n name: button.attr('name'),\n value: button.attr('value') || 'delete card'\n }).appendTo($(this));\n var data = $(this).serialize();\n $.ajax({\n type: 'POST',\n url: $(this).attr('action'),\n data: data\n })\n .done(function () {\n page.redirect(Urls.paymentsList);\n });\n });\n}\n\nfunction initializePaymentForm() {\n $('#CreditCardForm').on('click', '.cancel-button', function (e) {\n e.preventDefault();\n dialog.close();\n });\n}\n\n/**\n * @private\n * @function\n * @description Autocomplete the field for Pop-up newbenefeet\n */\n\nfunction autofillBenefeetNew(form, container) {\n var $form = $(form);\n var $container = $(container);\n\n var firstname = $form.find('[name$=\"_firstname\"]').val();\n var lastname = $form.find('[name$=\"_lastname\"]').val();\n var phone = $form.find('[name$=\"_phone\"]').val();\n var email = $form.find('[name$=\"_email\"]').val();\n var birthdayday = $form.find('[name$=\"_birthdayday\"]').val();\n var birthdaymonth = $form.find('[name$=\"_birthdaymonth\"]').val();\n var birthdayyear = $form.find('[name$=\"_birthdayyear\"]').val();\n\n $container.find('[name$=\"_firstname\"]').val(firstname);\n $container.find('[name$=\"_lastname\"]').val(lastname);\n $container.find('[name$=\"_phone\"]').val(phone);\n $container.find('[name$=\"_email\"]').val(email);\n $container.find('[name$=\"_birthdayday\"]').val(birthdayday).trigger('change');\n $container.find('[name$=\"_birthdaymonth\"]').val(birthdaymonth).trigger('change');\n $container.find('[name$=\"_birthdayyear\"]').val(birthdayyear).trigger('change');\n}\n\n/**\n * @private\n * @function\n * @description Validate form for Benefeet steps\n */\n\n\n\nfunction validateRegistry() {\n var benefeetValue = '';\n var benefeeturl = '';\n var switchCase = false;\n var registrationForm = $('#RegistrationForm');\n var benefeetDialog = $('#benefeet-dialog');\n var benefeetOverlay = $('#benefeet-overlay');\n var formLoader = $('#form-loader');\n\n var setDialog = function (url, autofillvalue) {\n $.ajax({\n url: url,\n beforeSend: function () {\n //benefeetOverlay.addClass('open').append('');\n if (formLoader.length) {\n formLoader.fadeIn(200);\n }\n },\n success: function (data) {\n\n if (data.isError) {\n benefeetDialog.addClass(\"login-registration\");\n benefeetDialog.removeClass(\"benefeet-registration\");\n benefeetDialog.addClass('open').children('.ui-dialog-content').html(data.template);\n } else {\n benefeetDialog.addClass(\"benefeet-registration\");\n benefeetDialog.removeClass(\"login-registration\");\n $(\".reg-benefeet-container\").find(\".contenitore-form\").append(benefeetDialog);\n benefeetDialog.addClass('open').children('.content-text').empty();\n benefeetDialog.addClass('open').children('.content-text').append(data);\n }\n\n benefeetDialog.find('select').has('.select-option.empty:selected').each(function (index, element) {\n $(element).css('color', '#b2b2b2');\n });\n\n if (formLoader.length) {\n formLoader.fadeOut(200);\n }\n benefeetOverlay.find('.dots-loader').remove();\n registrationForm.validate();\n\n if (autofillvalue === 'newbenefeet') {\n autofillBenefeetNew(registrationForm, 'fieldset[data-target=\"' + benefeetValue + '\"]');\n handleClickBenefeetPolicy();\n }\n\n login.initBenefeetFormValidation();\n }\n });\n };\n\n if ($('.reg-benefeet-form-block input[type=\"radio\"]').length) {\n switchCase = true;\n }\n\n if ($('.reg-benefeet-form-block input[type=\"radio\"]:checked').length) {\n benefeetValue = $('.reg-benefeet-form-block input[type=\"radio\"]:checked').attr('value').toLowerCase();\n }\n\n $('.reg-benefeet-form-block input[type=\"radio\"]').on('change', function (event) {\n benefeetValue = $(this).attr('value').toLowerCase();\n });\n\n\n $('.reg-benefeet-container button[name$=profile_actions_confirm]').on('click', function (event) {\n var $form = $(this).closest('form');\n if ($('form').find('input.error').length == 0) {\n if (switchCase) {\n if (registrationForm.valid() && benefeetValue === 'nobenefeet') {\n $(this).submit();\n } else if (registrationForm.valid() && benefeetValue === 'oldbenefeet') {\n $.ajax({\n url: benefeetDialog.attr('data-verifybenefeet-url'),\n async: false,\n data: {\n email: registrationForm.find('[name$=\"_email\"]').val()\n },\n type: 'GET',\n beforeSend: function () {\n benefeetOverlay.addClass('open').append('');\n },\n success: function (response) {\n benefeetOverlay.find('.dots-loader').remove();\n var jsonResult = null;\n try {\n jsonResult = $.parseJSON(response.replace(/\\\\/g, \"\"));\n } catch (err) {\n //casistica errore utente bloccato\n jsonResult = null\n }\n\n if (jsonResult == null) {\n //casistica errore utente bloccato\n } else if (!jsonResult.exists) {\n event.preventDefault();\n benefeeturl = benefeetDialog.attr('data-oldbenefeet-url');\n benefeetDialog.addClass('benefeet-registration');\n setDialog(benefeeturl);\n }\n }\n });\n } else if (registrationForm.valid() && benefeetValue === 'newbenefeet') {\n event.preventDefault();\n benefeeturl = benefeetDialog.attr('data-newbenefeet-url') + \"?email=\" + registrationForm.find('[name$=\"_email\"]').val();\n benefeetDialog.addClass('benefeet-registration');\n setDialog(benefeeturl, benefeetValue);\n }\n }\n }\n });\n\n\n $(\".input-radio\").on(\"change\", function (event) {\n var $form = $(this).closest('form');\n var formLoader = $('#form-loader');\n $('.input-radio').closest('div').removeClass(\"selected\");\n //$('.input-radio').closest('div').addClass(\"not-selected\");\n $('html').removeClass('no-scroll');\n if (switchCase) {\n if (benefeetValue === 'nobenefeet') {\n $(this).closest('div').addClass(\"selected\");\n //$(this).closest('div').removeClass(\"not-selected\");\n $('.contenitore-form').remove();\n $('.crea-account-hidden').removeClass('disabled').show();\n //$(this).submit();\n } else if (benefeetValue === 'oldbenefeet') {\n $(this).closest('div').addClass(\"selected\");\n //$(this).closest('div').removeClass(\"not-selected\");\n $(this).closest(\"div\").addClass(\"selected-old-benefeet\");\n\n if ($('.radio-wrap').hasClass('selected-old-benefeet')) {\n $(\".contenitore-form\").remove();\n $('.selected-old-benefeet').append('
        ');\n }\n\n $('.crea-account-hidden').hide();\n $('.input-radio').closest(\"div\").removeClass(\"selected-new-benefeet\");\n\n // ajax call to check whether a benefeet customer with the given email actually exists (Account-VerifyBenefeetCustomer)\n $.ajax({\n url: benefeetDialog.attr('data-verifybenefeet-url'),\n async: false,\n data: {\n email: registrationForm.find('[name$=\"_email\"]').val()\n },\n type: 'GET',\n beforeSend: function () {\n //benefeetOverlay.addClass('open').append('');\n if (formLoader.length) {\n formLoader.fadeIn(200);\n }\n },\n success: function (response) {\n benefeetOverlay.find('.dots-loader').remove();\n // la variabile jsonResult è una rappresentazione dell'ipotetico customer associato alla email\n // e ritornato dalla chiamata ajax\n var jsonResult = null;\n try {\n jsonResult = $.parseJSON(response.replace(/\\\\/g, \"\"));\n } catch (err) {\n //casistica errore utente bloccato\n jsonResult = null\n }\n\n if (jsonResult == null) {\n //casistica errore utente bloccato\n } else if (!jsonResult.exists) {\n //casistica utente benefeet inesistente (rendering benefeet popup) [Account-OldBenefeetPopup]\n event.preventDefault();\n benefeeturl = benefeetDialog.attr('data-oldbenefeet-url');\n benefeetDialog.addClass('benefeet-registration');\n setDialog(benefeeturl);\n } else {\n //casistica utente benefeet esistente (submit immediato del form di registrazione)\n $('.reg-benefeet-container button[name$=profile_actions_confirm]').click();\n }\n }\n });\n } else if (benefeetValue === 'newbenefeet') {\n $(this).closest('div').addClass(\"selected\");\n //$(this).closest('div').removeClass(\"not-selected\");\n $(this).closest(\"div\").addClass(\"selected-new-benefeet\");\n\n if ($('.radio-wrap').hasClass('selected-new-benefeet')) {\n $(\".contenitore-form\").remove();\n $('.selected-new-benefeet').append('
        ');\n }\n\n $('.crea-account-hidden').hide();\n $('.input-radio').closest(\"div\").removeClass(\"selected-old-benefeet\");\n\n event.preventDefault();\n benefeeturl = benefeetDialog.attr('data-newbenefeet-url') + \"?email=\" + registrationForm.find('[name$=\"_email\"]').val();\n benefeetDialog.addClass('benefeet-registration');\n setDialog(benefeeturl, benefeetValue);\n }\n }\n });\n\n\n $('#benefeet-dialog .ui-dialog-titlebar-close').on('click', function (event) {\n event.preventDefault();\n $('html').removeClass('no-scroll');\n benefeetDialog.removeClass('open benefeet-registration small').children('.ui-dialog-content').children().remove();\n benefeetOverlay.removeClass('open');\n });\n}\n\n\nvar deleteFavoriteStore = function (storeId) {\n var options = {\n url: util.appendParamsToUrl(Urls.storesSaveFavAjax, {\n StoreID: storeId,\n authenticated: true\n }),\n callback: handleStoreResponse,\n };\n\n ajax.getJson(options);\n};\n\nvar handleStoreResponse = function (res) {\n if (res.status == 'OK') {\n location.reload();\n }\n};\n\nvar handleDeleteStore = function () {\n $('.store-card').on('click', '.delete', function () {\n deleteFavoriteStore($(this).attr('data-store-id'));\n });\n};\n\nvar handleDetailStore = function () {\n $('.store-card').on('click', '.content-detail', function () {\n $(this).toggleClass(\"visible\");\n });\n};\n\nvar initErrorDialog = function () {\n var benefeetDialog = $('#benefeet-dialog');\n var msg = $(benefeetDialog).data('errormsg');\n var errorUserExists = $(benefeetDialog).data('erroruserexists');\n\n if (msg && msg != '') {\n\n benefeetDialog.removeClass('login-registration').children('.ui-dialog-content').children().remove();\n var benefeetOverlay = $('#benefeet-overlay');\n benefeetOverlay.addClass('open');\n\n benefeetDialog.addClass(\"login-registration\");\n benefeetDialog.removeClass(\"benefeet-registration\");\n benefeetDialog.addClass('open').find('.ui-dialog-content').html(msg);\n\n // prevent multiple dialog ajax requests\n benefeetDialog.attr('data-opened', true);\n\n if (errorUserExists) {\n $('.content-email').find('.error-message').hide();\n $('.content-email').find('.email').append('
        ' + msg + '
        ');\n }\n }\n};\n\nvar initPoliciesDialogs = function () {\n $('body').on('click', '#newsPrivacy, .privacy-popup', function (event) {\n event.preventDefault();\n openPopup(Urls.policiesPopup, handleClickMyGeoxPolicy);\n popupHasBeenRead = false;\n });\n\n $(\"body\").on(\"click\", \"input[id*='profile_customer_privacyPolicy']\", function (e) {\n if (popupHasBeenRead) {\n //openPopup(Urls.policiesPopup, handleClickMyGeoxPolicy);\n popupHasBeenRead = true;\n $(this).prop(\"checked\", false);\n }\n });\n\n $('body').on('click', '#registrationPrivacy, .privacy-popup-registration', function (event) {\n event.preventDefault();\n openPopup(Urls.policiesPopup, handleClickMyGeoxPolicy);\n popupHasBeenRead = false;\n });\n\n $(\"body\").on(\"click\", \"input[id*='profile_customer_benefeetConsent']\", function () {\n if (benefeetHasBeenRead) {\n benefeetHasBeenRead = true;\n $(this).prop(\"checked\", false);\n }\n });\n\n $('body').on('click', '#registrationBenefeetRegulation, .benefeet-regulation-popup-registration', function (event) {\n event.preventDefault();\n window.open(Urls.benefeetPolicy, '_blank');\n benefeetHasBeenRead = false;\n });\n\n $('body').on('click', '#registrationBirthdayRules', function (event) {\n event.preventDefault();\n window.open(Urls.birthdayPolicy, '_blank');\n });\n};\n\nvar openPopup = function (url, callback) {\n dialog.open({\n url: url,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render',\n success: function (container) {\n callback && callback();\n }\n },\n target: '#login-dialog'\n });\n};\n\nvar openPopupCURBenefeet = function (url, callback) {\n dialog.open({\n url: url,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render dialog-cur-benefeet-render',\n success: function (container) {\n callback && callback();\n }\n },\n target: '#cur-benefeet-dialog'\n });\n};\n\nvar handleClickBenefeetPolicy = function () {\n $(\"#benefeet-privacy\").on(\"click\", function () {\n window.open(Urls.benefeetPolicy, '_blank');\n });\n};\n\nfunction initBenefeetAlertMyAccount() {\n if ($(\"#benefeet-alert-myaccount\").length) {\n openPopup(Urls.benefeetAlertMyAccount);\n }\n};\n\nfunction initCURNoBenefeetAlertMyAccount() {\n var onCloseCallback = function () {\n $('.cur-nobenefeet-alert-myaccount').parents('.ui-dialog').find('.ui-dialog-titlebar-close').on('click', function () {\n $.ajax({\n url: Urls.curNoBenefeetAlertSeen,\n method: \"GET\"\n });\n });\n };\n\n if ($(\"#cur-nobenefeet-alert-myaccount\").length) {\n openPopupCURBenefeet(Urls.curNoBenefeetAlertMyAccount, onCloseCallback);\n }\n};\n\nfunction initBenefeetPolicyClickHandler() {\n if ($(\"#benefeet-privacy\").length) {\n handleClickBenefeetPolicy();\n }\n};\n\nvar handleClickMyGeoxPolicy = function () {\n $(\"#mygeox-privacy-policy\").on(\"click\", function () {\n window.open(Urls.mygeoxPolicy, '_blank');\n });\n};\n\n/**\n * @private\n * @function\n * @description Init mobile navigation on my account dashboard page\n */\nfunction initMobileNavigation() {\n if (window.matchMedia('(max-width: 767px)').matches && $('#main').hasClass('my-account-main-dashboard')) {\n if ($('#secondary').length) {\n var accountNavBottom = $('#secondary').clone().attr('id', 'secondary-bottom').appendTo('.my-account-main-dashboard > .row');\n // Hide menu items already shown as account-dashboard-card\n if ($('.account-dashboard-content').find('.card-benefeet').length) {\n $('#secondary-bottom').find('#Account-Benefeet').parent('li').addClass('hide');\n }\n if ($('.account-dashboard-content').find('.card-orders').length) {\n $('#secondary-bottom').find('#Order-History').parent('li').addClass('hide');\n }\n if ($('.account-dashboard-content').find('.card-wishlist').length) {\n $('#secondary-bottom').find('#Wishlist-Show').parent('li').addClass('hide');\n }\n if ($('.account-dashboard-content').find('.card-addresses').length) {\n $('#secondary-bottom').find('#Address-List').parent('li').addClass('hide');\n }\n }\n }\n}\n\n/**\n * @private\n * @function\n * @description Limit the number of vouchers inside the carousel\n */\nfunction limitVouchersCarouselSize(number) {\n var $vouchers = $('#carousel-voucher .cart-voucher-container');\n\n if ($vouchers.length > number) {\n var $vouchersToRemove = $vouchers.slice(number);\n $vouchersToRemove.remove();\n }\n}\n\n/**\n * @private\n * @function\n * @description Init benefeet points progress bar on my account benefeet page\n */\nfunction initBenefeetProgressBar() {\n if ($('.benefeet-point-progressbar').length) {\n var customerPoints = $('.benefeet-point-progressbar').data('points');\n var pointsStep1 = parseInt($('.progressbar-step[data-step=1]').find('.points').text());\n var pointsStep2 = parseInt($('.progressbar-step[data-step=2]').find('.points').text());\n var pointsStep3 = parseInt($('.progressbar-step[data-step=3]').find('.points').text());\n var pointsStep4 = parseInt($('.progressbar-step[data-step=4]').find('.points').text());\n var fillPercentage = 0;\n\n if (customerPoints > 0 && customerPoints <= pointsStep1) {\n $('.progressbar-step[data-step=1]').addClass('current');\n fillPercentage = parseInt((customerPoints * 100) / pointsStep1);\n $('.progressbar-step[data-step=1]').find('.fill').css('width', fillPercentage + '%');\n } else if (customerPoints > pointsStep1 && customerPoints <= pointsStep2) {\n $('.progressbar-step[data-step=1]').addClass('active');\n $('.progressbar-step[data-step=2]').addClass('current');\n fillPercentage = parseInt((customerPoints * 100) / pointsStep2);\n $('.progressbar-step[data-step=2]').find('.fill').css('width', fillPercentage + '%');\n } else if (customerPoints > pointsStep2 && customerPoints <= pointsStep3) {\n $('.progressbar-step[data-step=1], .progressbar-step[data-step=2]').addClass('active');\n $('.progressbar-step[data-step=3]').addClass('current');\n fillPercentage = parseInt((customerPoints * 100) / pointsStep3);\n $('.progressbar-step[data-step=3]').find('.fill').css('width', fillPercentage + '%');\n } else if (customerPoints > pointsStep3 && customerPoints <= pointsStep4) {\n $('.progressbar-step[data-step=1], .progressbar-step[data-step=2], .progressbar-step[data-step=3]').addClass('active');\n $('.progressbar-step[data-step=4]').addClass('current');\n fillPercentage = parseInt((customerPoints * 100) / pointsStep4);\n $('.progressbar-step[data-step=4]').find('.fill').css('width', fillPercentage + '%');\n }\n\n // Scroll to current step on mobile (progressbar with horizontal scroll)\n if (window.matchMedia('(max-width: 767px)').matches) {\n if ($('.progressbar-step.current').length) {\n var currentStepLeft = $('.progressbar-step.current').offset().left;\n var containerPadding = parseInt($('.benefeet-point-progressbar-container').css('padding-left'));\n $('.benefeet-point-progressbar-container').scrollLeft(currentStepLeft - containerPadding);\n }\n }\n\n }\n}\n\n/**\n * @private\n * @function\n * @description Init order list page events\n */\nfunction initOrderListEvents() {\n if ($('.list-orders').length) {\n $('.list-orders .list-item-render').each(function () {\n var orderBtn = $(this).find('.button.order-details');\n $(this).on('click', '.order-detail-link', function (e) {\n $(orderBtn).trigger('click');\n });\n });\n\n // Set pagination session storage\n var url = location.href;\n var orderListPaging = '';\n if (url.indexOf('?start') !== -1) {\n orderListPaging = url.split('?')[1];\n sessionStorage.setItem('orderListStart', orderListPaging);\n } else {\n sessionStorage.removeItem('orderListStart');\n }\n }\n\n // Update back link from order detail to order list\n if ($('.orders-main').length) {\n if ($('.orders-main').find('.btn-back-orders').length) {\n var backUrl = $('.orders-main').find('.btn-back-orders').attr('href');\n if (sessionStorage.getItem('orderListStart')) {\n backUrl = backUrl + '?' + sessionStorage.getItem('orderListStart');\n $('.orders-main').find('.btn-back-orders').attr('href', backUrl);\n }\n }\n }\n}\n\n/**\n * @private\n * @function\n * @description Init product tile events on my account dashboard page\n */\nfunction initProductTileEvents() {\n productTile.init('#carousel-wishlist .product-tile-container', false);\n}\n\n/**\n * @private\n * @function\n * @description Init wishlist carousel on my account dashboard page\n */\nfunction initWishlistCarousel() {\n $('#carousel-wishlist').slick({\n infinite: false,\n dots: true,\n arrows: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 2,\n slidesToScroll: 1\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }\n ]\n });\n}\n\n/**\n * @private\n * @function\n * @description Init order widget on my account dashboard page (active step + order link)\n */\nfunction initOrderWidget() {\n $('#carousel-orders .card-element').each(function () {\n var orderStep = parseInt($(this).find('[data-order-step]').attr('data-order-step'));\n if (orderStep > 0) {\n for (var i = 1; i <= orderStep; i++) {\n $(this).find('.order-steps-wrapper [data-step=\"' + i + '\"]').addClass('active-step');\n }\n }\n var orderBtn = $(this).find('.button.order-details');\n $(this).on('click', '.order-detail-link', function (e) {\n $(orderBtn).trigger('click');\n });\n });\n}\n\n/**\n * @private\n * @function\n * @description Init orders carousel on my account dashboard page\n */\nfunction initOrderCarousel() {\n $('#carousel-orders form').slick({\n infinite: false,\n dots: true,\n arrows: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 2,\n slidesToScroll: 1\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }\n ]\n });\n}\n\n/**\n * @private\n * @function\n * @description Init voucher carousel on my account dashboard page\n */\nfunction initDashboardVoucherCarousel() {\n $('#carousel-voucher').slick({\n infinite: true,\n dots: true,\n arrows: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n centerPadding: '20px',\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 3,\n slidesToScroll: 3,\n centerMode: false,\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n }\n }\n ]\n });\n}\n\nfunction initBenefeetPlusStatusChart() {\n if ($('#step-points-donut-chart').length > 0) {\n var benefeetPoints = new Number($('#step-points-donut-chart').data(\"benefeet-points\"));\n var currentStep = \"\";\n var previousThreshold = 0;\n var currentThreshold = 150;\n\n if ($('#benefeet-steps-carousel').length > 0) {\n currentStep = $('#benefeet-steps-carousel').data(\"step\");\n } else if ($('#benefeet-plus-carousel').length > 0) {\n currentStep = $('#benefeet-plus-carousel').data(\"step\");\n }\n\n var $step1Item = $('#benefeet-steps-carousel').find('.step-1-item');\n var $step2Item = $('#benefeet-steps-carousel').find('.step-2-item');\n var $step3Item = $('#benefeet-steps-carousel').find('.step-3-item');\n var $step4Item = $('#benefeet-steps-carousel').find('.step-4-item');\n\n switch (currentStep) {\n case \"STEP 1\":\n currentThreshold = 150;\n previousThreshold = 0;\n $step1Item.addClass('active-step');\n $step2Item.addClass('reachable-step');\n $step3Item.addClass('reachable-step');\n $step4Item.addClass('reachable-step');\n break;\n case \"STEP 2\":\n currentThreshold = 250;\n previousThreshold = 150;\n $step1Item.addClass('former-step');\n $step2Item.addClass('active-step');\n $step3Item.addClass('reachable-step');\n $step4Item.addClass('reachable-step');\n break;\n case \"STEP 3\":\n currentThreshold = 500;\n previousThreshold = 250;\n $step1Item.addClass('former-step');\n $step2Item.addClass('former-step');\n $step3Item.addClass('active-step');\n $step4Item.addClass('reachable-step');\n break;\n case \"STEP 4\":\n currentThreshold = 1000;\n previousThreshold = 500;\n $step1Item.addClass('former-step');\n $step2Item.addClass('former-step');\n $step3Item.addClass('former-step');\n $step4Item.addClass('active-step');\n break;\n default:\n currentThreshold = 150;\n previousThreshold = 0;\n $step1Item.addClass('active-step');\n $step2Item.addClass('reachable-step');\n $step3Item.addClass('reachable-step');\n $step4Item.addClass('reachable-step');\n break;\n }\n\n if ($('#hexagon-path').length > 0) {\n // progressbar.js\n var svgPath = document.getElementById('hexagon-path');\n var hexagonDonutChart = new ProgressBar.Path(svgPath, {\n duration: 300\n });\n\n var pointsRemap = (benefeetPoints - previousThreshold) / (currentThreshold - previousThreshold);\n\n hexagonDonutChart.animate(pointsRemap, function () {\n console.log(\"animazione conclusa\");\n $('#status-chart-overlay').fadeOut(300, \"linear\");\n });\n }\n }\n}\n\n/**\n * @private\n * @function\n * @description Init benefeet plus status carousel on my account dashboard page\n */\nfunction initBenefeetPlusDashboardCarousel() {\n $('#benefeet-plus-carousel').slick({\n infinite: false,\n dots: true,\n arrows: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n centerPadding: '20px',\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: false,\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n }\n }\n ]\n });\n}\n\n/**\n * @private\n * @function\n * @description Init benefeet plus status carousel on my account benefeet page\n */\nfunction initBenefeetPlusStepsCarousel() {\n $('#benefeet-steps-carousel').slick({\n infinite: false,\n dots: false,\n arrows: false,\n slidesToShow: 4,\n slidesToScroll: 4,\n centerMode: true,\n centerPadding: '20px',\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n dots: true,\n arrows: true\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n dots: true,\n arrows: true\n }\n }\n ]\n });\n}\n\n/**\n * @private\n * @function\n * @description Init benefeet tab carousels (vouchers + missions) on my account benefeet page\n */\nfunction initBenefeetTabCarousel() {\n\n //Functions that initialize the tab carousels (identified by html element id).\n function initTabCarousel($tabCarouselID) {\n var selector = '.tab-carousel' + '#' + $tabCarouselID;\n if ($(selector).find('.slick-list').length == 0) {\n $(selector).slick({\n infinite: false,\n dots: true,\n arrows: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n centerPadding: '20px',\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n dots: true,\n arrows: true\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n dots: true,\n arrows: true\n }\n }\n ]\n });\n }\n }\n\n function unsetTabCarousel($tabCarouselID) {\n var selector = '.tab-carousel' + '#' + $tabCarouselID;\n if ($(selector).find('.slick-list').length) {\n $(selector).slick('unslick');\n }\n }\n\n /**\n * Voucher balance decimal management\n */\n function updatePriceStyle() {\n var $priceElement = $('.tab-carousel-item.is-voucher-item').find('.voucher-value');\n\n $priceElement.each(function () {\n var price = $(this).html();\n $(this).html(price.replace(/(\\D*)(\\d*\\.)(\\d*)/, '$2$3'));\n })\n }\n\n //Actual carousels + tab buttons initialization\n\n // ---- Voucher Carousels ----\n\n initTabCarousel('available-vouchers-tab');\n $('#benefeet-voucher-overlay').fadeOut(300, \"linear\");\n\n // ---- Mission Carousels ----\n\n $('#completed-missions-tab').hide();\n $('#completed-missions-button').addClass('disabled');\n\n initTabCarousel('available-missions-tab');\n $('#benefeet-mission-overlay').fadeOut(300, \"linear\");\n\n // ---- Voucher WO - init overlay not carousel or tab ----\n $('#benefeet-voucher-wo-overlay').fadeOut(300, \"linear\");\n\n\n var logosToLoad = $('.benefeet-mission').find('.mission-partner-logo');\n\n for (var i = 0; i < logosToLoad.length; i++) {\n var imgLink = $(logosToLoad[i]).data(\"logo-url\");\n $(logosToLoad[i]).find('img').attr(\"src\", imgLink);\n }\n\n $('#completed-missions-button').on('click', function () {\n $('#available-missions-tab').hide().removeClass('active-tab');\n $('#completed-missions-tab').show().addClass('active-tab');\n $('#completed-missions-button').removeClass('disabled');\n $('#available-missions-button').addClass('disabled');\n initTabCarousel('completed-missions-tab');\n unsetTabCarousel('available-missions-tab');\n });\n\n $('#available-missions-button').on('click', function () {\n $('#available-missions-tab').show().addClass('active-tab');\n $('#completed-missions-tab').hide().removeClass('active-tab');\n $('#completed-missions-button').addClass('disabled');\n $('#available-missions-button').removeClass('disabled');\n initTabCarousel('available-missions-tab');\n unsetTabCarousel('completed-missions-tab');\n });\n\n updatePriceStyle();\n}\n\n/**\n * @private\n * @function\n * @description Init voucher carousel on my account benefeet page\n */\nfunction initBenefeetVoucherCarousel() {\n // Add custom class on init\n $('#carousel-voucher').on('init', function (event, slick) {\n if ($(this).find('.slick-arrow').length == 0) {\n $(this).addClass('no-arrows');\n }\n });\n $('#carousel-voucher').slick({\n infinite: true,\n dots: true,\n arrows: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n centerMode: false,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n slidesToShow: 3,\n slidesToScroll: 3,\n centerMode: false,\n }\n },\n {\n breakpoint: 768,\n settings: {\n slidesToShow: 1,\n slidesToScroll: 1,\n centerMode: true,\n centerPadding: '20px'\n }\n }\n ]\n });\n}\n\n/**\n * @private\n * @function\n * @description Init ProductClick event inside wishlist page\n */\nfunction initWishlistProductClick() {\n $('.wishlist-item-render .name a').on('click', function () {\n var $row = $(this).parents('.row-render');\n var position = $row.attr('data-pos');\n var $gtmvalue = $row.siblings('#gtmvalue' + position);\n\n if ($gtmvalue.length > 0) {\n var gtm = $gtmvalue.data('gtmvalue');\n dataLayer.push(gtm);\n }\n });\n}\n\nfunction cleanLogoutSessionStorage() {\n $('body').on('click', '.my-account-navigation li > a#btnLogoutSession, #btnLogoutSessionHeader', function () {\n if (sessionStorage.getItem('verifiedNumber')) {\n sessionStorage.removeItem('verifiedNumber');\n }\n });\n}\n\n/**\n * @private\n * @function\n * @description Binds the events of the order, address and payment pages\n */\nfunction initializeEvents() {\n //console.log('@Call account.js -> init');\n toggleFullOrder();\n initAddressEvents();\n initPaymentEvents();\n validateRegistry();\n handleDeleteStore();\n handleDetailStore();\n login.init();\n editAccount.init();\n initErrorDialog();\n initPoliciesDialogs();\n initBenefeetAlertMyAccount();\n initCURNoBenefeetAlertMyAccount();\n initBenefeetPolicyClickHandler();\n initMobileNavigation();\n initBenefeetProgressBar();\n initOrderListEvents();\n initWishlistProductClick();\n cleanLogoutSessionStorage();\n\n if ($(\"#carousel-wishlist .product-tile\").length > 0) {\n initProductTileEvents();\n initWishlistCarousel();\n }\n if ($(\"#carousel-orders .card-element\").length > 0) {\n initOrderWidget();\n initOrderCarousel();\n }\n if ($(\"#carousel-voucher .cart-voucher\").length > 0) {\n var isBenefeetPage = $('.benefeet-voucher-slider').length;\n if (isBenefeetPage) {\n limitVouchersCarouselSize(12);\n initBenefeetVoucherCarousel();\n } else {\n limitVouchersCarouselSize(5);\n initDashboardVoucherCarousel();\n }\n }\n\n //TODO Sistemare e raggruppare inizializzazione pagina Benefeet\n initBenefeetPlusDashboardCarousel();\n initBenefeetPlusStepsCarousel();\n initBenefeetPlusStatusChart();\n initBenefeetTabCarousel();\n}\n\nvar account = {\n init: function () {\n initializeEvents();\n giftcert.init();\n wishlist.init();\n },\n initCartLogin: function () {\n login.init();\n }\n};\n\nmodule.exports = account;\n\n},{\"../ajax\":4,\"../dialog\":20,\"../eventHandlingUtils\":21,\"../giftcert\":23,\"../login\":27,\"../page\":29,\"../product-tile\":65,\"../tooltip\":78,\"../util\":79,\"../validator\":80,\"./editaccount\":37,\"./wishlist\":63}],31:[function(require,module,exports){\n'use strict';\n\nexports.init = function () {\n $(\".content-elements\").addClass('confirm-step');\n $(\".content-text-progress\").addClass('confirm-step');\n\n $('.js-checkout-products-accordion').on('click', function () {\n $(this).parent().toggleClass('open');\n if (!window.matchMedia('(max-width: 767px)').matches) {\n $(this).siblings('.accordion-content').slideToggle(200, function () {\n $('body').trigger('checkoutSidebar:update');\n });\n } else {\n if (!$(this).parent().hasClass('open')) {\n $('#checkout-accordion-overlay').remove();\n } else {\n $(this).parent().append('
        ');\n }\n }\n });\n // $(\"iframe\").load(function() {\n // // var frameContents;\n // // frameContents = $(\"#threeDSIframe\").contents(); \n // // console.log(\"dentro\");\n // // frameContents.find(\".challenge-simulation\").css('background-color', 'red');\n // $('#threeDSIframe').load(function() {\n // console.log(\"dentro\");\n // $(\"#threeDSIframe\").contents().find(\"head\").append(\"\"); \n // });\n // });\n // // $(document).ready(function() {\n // // console.log(\"fuori\");\n // // $('iframe#threeDSIframe').ready(function() {\n // // console.log(\"dentro\");\n // // var frame = $('iframe#threeDSIframe').contentDocument;\n // // console.log($('.challenge-simulation', frame));\n\n // // console.log(!$('.pt_checkout-adyen').length);\n // // $('.challenge-simulation', frame).css('padding', '50px !important');\n // // console.log( $('.challenge-simulation', frame).css('padding', '50px !important'));\n // // });\n // // });\n \n // // window.onload = function() {\n // // var test = document.getElementById('threeDSIframe');\n // // console.log(test);\n // // // var doc = test.contentDocument;\n // // // doc.body.innerHTML = doc.body.innerHTML + '';\n // // };\n};\n},{}],32:[function(require,module,exports){\n'use strict';\nvar storelocator = require('./storelocator');\n\nexports.init = function () {\n storelocator.init();\n\n // trigger map resize\n $('[data-target=\"#tab4\"]').on('click', function () {\n setTimeout(function() {\n $('.js-apply-filters-storelocator').trigger('click');\n }, 300);\n });\n\n // Show storelocator tab on mobile\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('#tab4').addClass('is-active');\n }\n\n // Toggle benefeet tabs\n $('.benefeet-tabs-ca .tabs a').on('click', function () {\n var target = $(this).attr('data-target');\n\n if(!$(this).closest('li').hasClass('is-active')){\n $('.benefeet-tabs-ca .tabs li').removeClass('is-active');\n $(this).closest('li').addClass('is-active');\n $('.tab-content').removeClass('is-active');\n $(target).addClass('is-active');\n }\n });\n\n // Show storelocator tab with custom link on the same page\n $('.benefeet-tabs-ca .trigger-geox-store').on('click', function (event) {\n event.preventDefault();\n if (window.matchMedia('(max-width: 767px)').matches) {\n var posScrollTo = $('#tab4').offset().top;\n $('html, body').animate({\n scrollTop: posScrollTo - 50\n }, 1000);\n } else {\n $('.benefeet-tabs-ca').find('[data-target=\"#tab4\"]').trigger('click');\n }\n });\n\n $(document).ready(function () {\n // Show benefeet tab with URL params (hash or querystring params)\n var showTab = '';\n if (window.location.hash && $(window.location.hash).length > 0) {\n showTab = window.location.hash;\n } else if ($('.benefeet-tabs-ca').attr('data-view-tab') != '') {\n // querystring params rendered by data attributes\n showTab = '#' + $('.benefeet-tabs-ca').attr('data-view-tab');\n }\n if (showTab != '' && $(showTab).length) {\n if (window.matchMedia('(max-width: 767px)').matches) {\n var posScrollTo = $(showTab).offset().top;\n $('html, body').animate({\n scrollTop: posScrollTo - 50\n }, 1000);\n } else {\n setTimeout(function() {\n $('.benefeet-tabs-ca').find('[data-target=\"'+ showTab +'\"]').trigger('click');\n }, 500);\n }\n }\n });\n};\n\n},{\"./storelocator\":60}],33:[function(require,module,exports){\n'use strict';\n\nvar account = require('./account'),\n ajax = require('../ajax'),\n util = require('../util'),\n bonusProductsView = require('../bonus-products-view'),\n recommendations = require('./product/recommendations'),\n productTile = require('../product-tile'),\n addToCart = require('../pages/product/addToCart'),\n cartStoreInventory = require('../storeinventory/cart');\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n/**\n * @private\n * @function\n * @description Binds events to the cart page (edit item's details, bonus item's actions, coupon code entry)\n */\nfunction initializeEvents() {\n $('#cart-table').on('click', '.bonus-item-actions a, .item-details .bonusproducts a', function (e) {\n e.preventDefault();\n bonusProductsView.show(this.href);\n });\n\n // override enter key for coupon code entry\n $('form input[name$=\"_couponCode\"]').on('keydown', function (e) {\n if (e.which === 13 && $(this).val().length === 0) {\n return false;\n }\n });\n\n //to prevent multiple submissions of the form when removing a product from the cart\n var removeItemEvent = false;\n $('button[name$=\"deleteProduct\"]').on('click', function (e) {\n if (removeItemEvent) {\n e.preventDefault();\n } else {\n removeItemEvent = true;\n }\n });\n\n // remove item timer trigger - set timeout before remove and enable restore item action\n var removeItemTimeout;\n $('.remove-from-cart-timer-trigger').on('click', function (e) {\n // disable action if remove item timer is already set on other cart items\n if ($('.show-remove-item-layer').length) {\n return;\n }\n $(this).parents('.cart-row-inner').addClass('show-remove-item-layer');\n $(this).parents('.cart-row-inner').find('.remove-item-timeline').animate({\n width: '100%'\n }, 7000, 'linear');\n var removeItemButton = $(this).parents('.cart-row-inner').find('button[name$=\"deleteProduct\"]')[0];\n removeItemTimeout = window.setTimeout(function () {\n $(removeItemButton).trigger('click');\n }, 7000);\n });\n\n // restore item trigger - cancel timeout and prevent remove from cart action\n $('.restore-item-link').on('click', function (e) {\n // stop timer\n $(this).parents('.cart-row-inner').find('.remove-item-timeline').stop();\n window.clearTimeout(removeItemTimeout);\n // restore cart item view\n $(this).parents('.cart-row-inner').removeClass('show-remove-item-layer');\n $('.remove-item-timeline').removeAttr('style');\n // trigger gtm event\n var dataContainer = $(this).parents('.cart-row-inner').find('.product-removefromcart-all-information');\n var itemId = '' + dataContainer.data('id');\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '86',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'product',\n 'eventAction': 'restore_to_cart',\n 'sku': itemId\n });\n });\n\n // remove item and redirect to PDP (remove item and try in store)\n $('.remove-item-layer').on('click', '.reserve-in-store-button-container > a', function (e) {\n e.preventDefault();\n // stop timer\n $(this).parents('.cart-row-inner').find('.remove-item-timeline').stop();\n window.clearTimeout(removeItemTimeout);\n // trigger gtm event\n var dataContainer = $(this).parents('.cart-row-inner').find('.product-removefromcart-all-information');\n var itemId = '' + dataContainer.data('id');\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '86',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'product',\n 'eventAction': 'try_in_store',\n 'sku': itemId\n });\n // set redirect url and submit remove item form\n var redirectUrl = $(this).attr('href');\n $('#cart-items-form').find('[name=\"redirectUrl\"]').val(redirectUrl);\n var removeItemButton = $(this).parents('.cart-row-inner').find('button[name$=\"deleteProduct\"]')[0];\n $(removeItemButton).trigger('click');\n });\n\n\n // show apply coupon button\n var couponButtonTimeout;\n\n $('form input[name$=\"_couponCode\"]').on('keydown blur paste', function (e) {\n var $this = $(this);\n // setTimeout to get value also on paste\n couponButtonTimeout = setTimeout(function () {\n var value = $this.val();\n if (value.length > 0) {\n $('.cart-couponcode-button').fadeIn();\n } else {\n $('.cart-couponcode-button').fadeOut();\n }\n }, 100);\n\n //scroll in alto al tap nel coupon\n var order = document.querySelector('.order-total');\n\n var scrollElementIntoView = (element, behavior) => {\n var scrollTop = window.pageYOffset;\n // Furthermore, if you have for example a header outside the iframe\n // you need to factor in its dimensions when calculating the position to scroll to\n var headerOutsideIframe = window.parent.document.getElementsByClassName('top-banner')[0].clientHeight;\n\n var finalOffset = element.getBoundingClientRect().top + scrollTop + headerOutsideIframe;\n\n window.parent.scroll({\n top: finalOffset,\n behavior: behavior || 'auto'\n })\n }\n\n scrollElementIntoView(order, 'auto');\n\n });\n\n\n // clear coupon button timeout on click outside (on help accordion)\n $('body').on('click', '.cart-help-accordion .accordion-title', function (e) {\n e.preventDefault();\n if (couponButtonTimeout) {\n clearTimeout(couponButtonTimeout);\n }\n });\n\n // cart attributes dropdowns select logic\n $(document).on('click', '.js-cart-select-option', function () {\n $(this).parents('.cart-select').find('.js-cart-select-option').removeClass('selected');\n $(this).addClass('selected');\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n var href = $(this).attr('data-value');\n updateEditCartContent(href);\n }\n });\n\n // Function to be called with a specific execution context for dropdowns toggle\n function toggleDropdownsOnClick() {\n // prevent select opening for bonus products\n if ($(this).parents('.cart-dropdowns-disabled').length) return;\n\n var $parent = $(this).parents('.cart-select');\n\n if ($parent.hasClass('open')) {\n $parent.removeClass('open');\n $parent.find('.cart-select-content').slideUp();\n } else {\n $('.cart-select').removeClass('open');\n $('.cart-select-content').slideUp();\n $parent.addClass('open');\n $parent.find('.cart-select-content').slideDown();\n }\n }\n\n // Open/close dropdowns on click\n\n $('.js-cart-select-trigger').on('click', function () {\n toggleDropdownsOnClick.call(this);\n });\n\n // Handle +/- qty mobile buttons\n $(document).on('click', '.js-cart-qty-btn', function (e) {\n e.preventDefault();\n\n var maxQty = $(this).parents('.cart-qty-mobile-wrapper').attr('data-max-qty-value');\n maxQty = parseInt(maxQty);\n var currentQty = $(this).parents('.cart-qty-mobile-wrapper').find('#Quantity').val();\n currentQty = parseInt(currentQty);\n var updatedQty = $(this).hasClass('plus') ? currentQty + 1 : currentQty - 1;\n\n if (updatedQty < 1 || updatedQty > maxQty) return;\n\n $(this).parents('.cart-qty-mobile-wrapper').find('#Quantity').val(updatedQty);\n $(this).parents('.cart-qty-mobile-wrapper').find('.cart-qty-mobile-value').html('0' + updatedQty);\n\n if (updatedQty <= 1) {\n $('.js-cart-qty-btn.minus').addClass('disabled');\n } else {\n $('.js-cart-qty-btn.minus').removeClass('disabled');\n }\n\n if (updatedQty >= maxQty) {\n $('.js-cart-qty-btn.plus').addClass('disabled');\n } else {\n $('.js-cart-qty-btn.plus').removeClass('disabled');\n }\n });\n\n // On quantity change\n $('.js-submit-qty').on('click', function () {\n var value = $(this).parents('.cart-row').find('.js-cart-select-option.selected').attr('data-value');\n var $input = $(this).closest('.item-quantity').children('input');\n var $dropdownButton = $(this).parents('.cart-select').find('.js-cart-select-trigger');\n var $spinner = $(this).find('.spinner');\n var $buttonText = $(this).find('.btn-text');\n\n var delayedClose = setTimeout(function () {\n $dropdownButton.click();\n }, 1500);\n\n $buttonText.hide();\n $spinner.show();\n\n $input.val(value);\n $('#cart-items-form').submit();\n });\n\n $(document).on('click', '.cart-edit-mobile-btn', function () {\n $(this).parents('.cart-row').find('.cart-dropdowns-wrapper').addClass('open');\n $('#cart-table').append('
        ');\n blockPageScrollOnEdit();\n });\n\n $(document).on('click', '.js-close-cart-edit-mobile', function () {\n $('.cart-dropdowns-wrapper.open').removeClass('open');\n $('.cart-edit-mobile-overlay').remove();\n document.body.removeEventListener('touchmove', preventPageScrollOnTouch, {\n passive: false\n });\n $('.cart-dropdowns-wrapper.open').removeAttr('id');\n });\n\n // On size/color change\n $(document).on('click', '.js-submit-attribute', function () {\n var href = $(this).parents('.pdp-main').find('.js-cart-select-option.selected').attr('data-value');\n var $dropdownButton = $(this).parents('.cart-select').find('.js-cart-select-trigger');\n var $spinner = $(this).find('.spinner');\n var $buttonText = $(this).find('.btn-text');\n\n $buttonText.hide();\n $spinner.show();\n updateEditCartContent(href);\n });\n\n // Spinner on mobile submit changes\n mobileSpinnerOnAddToCart();\n\n // generate mobile attributes recap (color/size/qty)\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('.cart-row').each(function () {\n var color = $(this).find('.color-cart-select .js-cart-select-option.selected .text-label').text();\n color = color ? '
        ' + '' + Resources.COLOR + ': ' + color + '' : '';\n var size = $(this).find('.size-cart-select .js-cart-select-option.selected .checkbox-label').text();\n size = size ? '' + Resources.SIZE + ': ' + size + '' : '';\n // Hide size for bonus products\n if ($(this).find('.cart-dropdowns-disabled').length) {\n size = '';\n }\n var qty = parseInt($(this).find('#Quantity').val());\n qty = qty ? '' + Resources.QTY + ': ' + qty + '' : '';\n $(this).find('.cart-product-info-mobile').append(qty + size + color);\n });\n }\n\n // move coupon block under cart table on tablet/mobile\n if (window.matchMedia('(max-width: 1279px)').matches) {\n $($('.cart-coupon-code')).insertAfter('#cart-table');\n }\n\n if (window.matchMedia('(max-width: 1279px)').matches) {\n $(\".cart-coupon-code\").detach().appendTo('#cart-sticky-sidebar .coupon-code-box-mobile');\n\n if ($.trim($(\".cart-coupon-code .error\").html()) != '') {\n window.scrollTo(0, $(\"#cart-sticky-sidebar\").offset().top);\n }\n }\n\n // move shipping banner before totals on mobile\n if (window.matchMedia('(max-width: 767px)').matches) {\n var shippingBanner = $('.cart-main .cart-promo-banner.banner-darkblue');\n $(shippingBanner).insertAfter('.cart-main');\n shippingBanner.addClass('banner-moved');\n }\n\n // move coupon product discount on order summary product discount\n if ($('.cart-order-totals').find('.total-product-discount').length && $('.cart-order-totals').find('.product-discount').length) {\n var productDiscountRow = $('.cart-order-totals').find('.product-discount');\n var couponProductRow = $('.cart-order-totals').find('.total-product-discount');\n $(couponProductRow).insertAfter(productDiscountRow).addClass('total-coupon-moved');\n }\n\n // move coupon shipping discount on order summary shipping discount\n if ($('.cart-order-totals').find('.total-shipping-discount').length && $('.cart-order-totals').find('.order-shipping-discount').length) {\n var shippingDiscountRow = $('.cart-order-totals').find('.order-shipping-discount');\n var couponShippingRow = $('.cart-order-totals').find('.total-shipping-discount');\n $(couponShippingRow).insertAfter(shippingDiscountRow).addClass('total-coupon-moved');\n }\n\n // init voucher slider\n if ($('#cart-voucher-slider').length) {\n $('#cart-voucher-slider').slick({\n infinite: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 768,\n settings: {\n arrows: true,\n dots: true,\n slidesToShow: 1,\n slidesToScroll: 1\n }\n }]\n });\n }\n\n $(document).on('click', '.js-cart-voucher', function () {\n $(\".js-cart-voucher\").not(this).css('pointer-events', 'none');\n setTimeout(function () {\n $(\".js-cart-voucher\").not(this).css('pointer-events', 'all');\n }, 15000);\n\n });\n\n updateDropdownsActiveValue();\n updatePriceStyle();\n addToCart();\n}\n\nfunction mobileSpinnerOnAddToCart() {\n $('.product-add-to-cart').find('button#add-to-cart').on('click', function () {\n var $spinner = $(this).find('.spinner');\n var $buttonText = $(this).find('.btn-text');\n\n $buttonText.hide();\n $spinner.show();\n });\n}\n\n/**\n * @private\n * @function\n * @description Prevent page scroll on edit sidebar touch\n */\nfunction blockPageScrollOnEdit() {\n $('.cart-dropdowns-wrapper.open').attr('id', 'cart-active-edit');\n var el = document.getElementById('cart-active-edit');\n el.addEventListener('touchstart', function () {\n var top = el.scrollTop,\n totalScroll = el.scrollHeight,\n currentScroll = top + el.offsetHeight\n\n // this prevents the scroll from \"passing through\" to the body.\n if (top === 0) {\n el.scrollTop = 1\n } else if (currentScroll === totalScroll) {\n el.scrollTop = top - 1\n }\n });\n\n el.addEventListener('touchmove', function (evt) {\n //if the content is actually scrollable the scrolling can occur\n if (el.offsetHeight < el.scrollHeight)\n evt._isScroller = true\n });\n\n document.body.addEventListener('touchmove', preventPageScrollOnTouch, {\n passive: false\n });\n}\n\n/**\n * @private\n * @function\n * @description Prevent page scroll if the target is not the sidebar\n */\nfunction preventPageScrollOnTouch(evt) {\n if (!evt._isScroller) {\n evt.preventDefault();\n }\n}\n\n/**\n * @private\n * @function\n * @description Update edit cart form before product update\n */\nfunction updateEditCartContent(href) {\n var $parent = $('[data-value=\"' + href + '\"]').parents('.cart-row');\n var $pdpForm = $parent.find('.pdpForm');\n\n // if it's a color change, add current size value to query string\n if (href.indexOf('_size') == -1) {\n var queryString = href.split('?')[1];\n var result = JSON.parse('{\"' + queryString.replace(/&/g, '\",\"').replace(/=/g, '\":\"') + '\"}', function (key, value) {\n return key === \"\" ? value : decodeURIComponent(value)\n });\n var pid = result.pid;\n var key = 'dwvar_' + pid + '_size';\n var sizeValue = $parent.find('.size-cart-select .selected').attr('data-value-id');\n href = href + '&' + key + '=' + sizeValue;\n }\n\n // get quantity\n var qty = $pdpForm.find('input[name=\"Quantity\"]').first().val();\n var params = {\n Quantity: isNaN(qty) ? '1' : qty,\n format: 'ajax',\n productlistid: $pdpForm.find('input[name=\"productlistid\"]').first().val()\n };\n\n // get target for content load\n var target = $pdpForm.closest('.cart-row').find('.item-edit-cover');\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('#checkout-loader').removeClass('hide');\n }\n\n ajax.load({\n url: util.appendParamsToUrl(href, params),\n target: target,\n callback: function (data) {\n if (!window.matchMedia('(max-width: 767px)').matches) {\n // update dropdown values\n updateDropdownsActiveValue();\n // trigger add to cart\n $parent.find('.item-editbutton').trigger('click', [true]);\n } else {\n $('#checkout-loader').addClass('hide');\n }\n mobileSpinnerOnAddToCart();\n }\n });\n\n};\n\n\n/**\n * @private\n * @function\n * @description Update dropdowns active value\n */\nfunction updateDropdownsActiveValue() {\n var $dropdowns = $('.js-load-value');\n\n if ($dropdowns.length) {\n $dropdowns.each(function () {\n var value = $(this).find('.cart-select-filter.selected .checkbox-label').html();\n $(this).find('.cart-select-label').html(value).removeClass('hidden');\n });\n }\n}\n\n/**\n * Voucher balance decimal management\n */\nfunction updatePriceStyle() {\n var $priceElement = $('.cart-voucher').find('.cart-voucher-price');\n\n $priceElement.each(function () {\n var price = $(this).html();\n $(this).html(price.replace(/(\\D*)(\\d*\\.)(\\d*)/, '$2$3'));\n })\n}\n\n\n/**\n * @private\n * @function\n * @description Initialize additional functionality related with PayPal integration\n */\nfunction initPaypalFunctionality() {\n var dialog = require('../dialog');\n var util = require('../util');\n var $expressButton = $('.js_paypal_start_ba_checkout');\n\n $expressButton.on('click', function () {\n if ($expressButton.data('is-address-exist') === true) {\n return true;\n }\n dialog.open({\n url: $expressButton.data('edit-address-url'),\n options: {\n title: $expressButton.data('edit-address-title'),\n open: initEditDefaultShippingAddressForm\n }\n });\n return false;\n });\n\n function initEditDefaultShippingAddressForm() {\n var $form = $('#paypalEditDefaultShippingAddress');\n $form.on('click', '.apply-button', function () {\n if (!$form.valid()) {\n return false;\n }\n var applyName = $form.find('.apply-button').attr('name');\n var options = {\n url: $form.attr('action'),\n data: $form.serialize() + '&' + applyName + '=x',\n type: 'POST'\n };\n $.ajax(options).done(function (data) {\n if (typeof (data) !== 'string') {\n if (data.success) {\n dialog.close();\n window.location = $expressButton.attr('href');\n } else {\n window.alert(data.message);\n return false;\n }\n } else {\n $('#dialog-container').html(data);\n initEditDefaultShippingAddressForm();\n }\n });\n return false;\n });\n $form.on('click', '.cancel-button, .close-button', function () {\n dialog.close();\n return false;\n });\n $('#paypalSelectSavedAddress').change(function () {\n var data = $(this).val();\n try {\n data = JSON.parse(data);\n\n for (name in data) {\n var val = data[name];\n if (typeof val === 'string') {\n val = val.replace(/\\^/g, \"'\");\n }\n $('#dwfrm_profile_address_' + name).val(val);\n }\n } catch (e) {\n $form.find('input:text').val('');\n $form.find('select').val('');\n }\n });\n // For SiteGenesis v100- the code bellow no need\n $('select[id$=\"_country\"]', $form).on('change', function () {\n util.updateStateOptions($form);\n });\n }\n}\n\nexports.init = function () {\n initializeEvents();\n initPaypalFunctionality();\n\n if (SitePreferences.STORE_PICKUP) {\n cartStoreInventory.init();\n }\n account.initCartLogin();\n\n if ($(\"#carousel-recommendations-cart .product-tile\").length > 0) {\n initCartRecommendations();\n } else {\n window.initCartRecommendations = initCartRecommendations;\n }\n};\n\nvar initCartRecommendations = function () {\n recommendations();\n productTile.init('#carousel-recommendations-cart .product-tile-container', false);\n productTile.init('.best-products-box .product-tile-container', false);\n};\n\n},{\"../ajax\":4,\"../bonus-products-view\":6,\"../dialog\":20,\"../pages/product/addToCart\":42,\"../product-tile\":65,\"../storeinventory/cart\":74,\"../util\":79,\"./account\":30,\"./product/recommendations\":50}],34:[function(require,module,exports){\n'use strict';\n\n//window.jQuery = window.$ = require('jquery');\n\n/**\n * @function Initializes the page events depending on the checkout stage (shipping/billing)\n */\nexports.init = function () {\n\n var processInclude = require('../../../mfra/util');\n\n $(document).ready(function () {\n processInclude(require('../../../mfra/checkout/checkout'));\n });\n require('../../../mfra/components/spinner');\n\n\n};\n\n},{\"../../../mfra/checkout/checkout\":85,\"../../../mfra/components/spinner\":92,\"../../../mfra/util\":93}],35:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n ajax = require('../ajax'),\n page = require('../page'),\n productTile = require('../product-tile'),\n quickview = require('../quickview');\n\n/**\n * @private\n * @function\n * @description Binds the click events to the remove-link and quick-view button\n */\nfunction initializeEvents() {\n $('#compare-table').on('click', '.remove-link', function (e) {\n e.preventDefault();\n ajax.getJson({\n url: this.href,\n callback: function () {\n page.refresh();\n }\n });\n })\n .on('click', '.open-quick-view', function (e) {\n e.preventDefault();\n var url = $(this).closest('.product').find('.thumb-link').attr('href');\n quickview.show({\n url: url,\n source: 'quickview'\n });\n });\n\n $('#compare-category-list').on('change', function () {\n $(this).closest('form').submit();\n });\n}\n\nexports.init = function () {\n productTile.init();\n initializeEvents();\n addProductToCart();\n};\n\n},{\"../ajax\":4,\"../page\":29,\"../product-tile\":65,\"../quickview\":67,\"./product/addToCart\":42}],36:[function(require,module,exports){\n'use strict';\n\nvar util = require('../util'),\n sizeGuide = require('../size-guide');\n\n/**\n * @private\n * @function handleClickMyGeoxShowNormativaPrivacy\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleClickMyGeoxShowNormativaPrivacy = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#mygeox-normativaprivacy-popup\", Urls.mygeoxNormativaPrivacyPopup);\n util.openModalOnClick(\".mygeox-normativaprivacy-popup\", Urls.mygeoxNormativaPrivacyPopup);\n};\n\n/**\n * @private\n * @function handleClickMyGeoxShowGeoxGroup\n * @description Binds the click event on the element \"#mygeox-geoxgroup-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleClickMyGeoxShowGeoxGroup = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#mygeox-geoxgroup-popup\", Urls.mygeoxNormativaPrivacyPopup);\n util.openModalOnClick(\".mygeox-geoxgroup-popup\", Urls.mygeoxNormativaPrivacyPopup);\n};\n\n/**\n * @private\n * @function handleClickMyGeoxShowNormativaPrivacy\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleClickpayandcollectStoreList = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#omni-stores-clickandcollect\", Urls.payandcollectStoreList);\n util.openModalOnClick(\".omni-stores-clickandcollect\", Urls.payandcollectStoreList);\n};\n\n/**\n * @private\n * @function handleClickMyGeoxShowNormativaPrivacy\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleClickreserveinstoreStoreList = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#omni-stores-clickandreserve\", Urls.reserveinstoreStoreList);\n util.openModalOnClick(\".omni-stores-clickandreserve\", Urls.reserveinstoreStoreList);\n};\n\n/**\n * @private\n * @function handleClickMyGeoxShowNormativaPrivacy\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleClickreturninstoreStoreList = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#omni-stores-returninstore\", Urls.returninstoreStoreList);\n util.openModalOnClick(\".omni-stores-returninstore\", Urls.returninstoreStoreList);\n};\n\n/**\n * @private\n * @function handlehandleConsensoBenefeet\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleConsensoBenefeet = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#privacy-consensobenefeet-overlay\", Urls.consensoBenefeet);\n util.openModalOnClick(\".privacy-consensobenefeet-overlay\", Urls.consensoBenefeet);\n};\n\n/**\n * @private\n * @function handleTrasferimentoDatiBenefeet\n * @description Binds the click event on the element \"#mygeox-normativaprivacy-popup\" rendered in the \"Privacy\" section\n * of the Customer Service pages to a function that renders a dialog with its specific content.\n */\nvar handleTrasferimentoDatiBenefeet = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n util.openModalOnClick(\"#privacy-trasferimentodatibenefeet-overlay\", Urls.trasferimentoDatiBenefeet);\n util.openModalOnClick(\".privacy-trasferimentodatibenefeet-overlay\", Urls.trasferimentoDatiBenefeet);\n};\n\n\n/**\n * @private\n * @function handleClickSendContactUs\n * @description Binds the click event on the element \"#sendBtn\" rendered in the \"Contact Us\" section\n * of the Customer Service pages to a function that renders a loader and disables the button.\n */\nvar handleClickSendContactUs = function () {\n // This module is loaded for each customer service page, thus the element\n // presence must be checked\n if ($('#sendBtn').length) {\n $('#sendBtn').on(\"click\", function () {\n if ($(\"#RegistrationForm\").valid()) {\n $('#sendBtn').addClass('disabled');\n $('#checkout-loader').removeClass('hide');\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '93',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'contact_us',\n 'eventAction': $('.myquestion option:selected').attr('value'),\n 'eventLabel': 'contact_form'\n });\n }\n });\n }\n};\n\nvar handleClickPhoneCallContactUs = function () {\n if ($('#contactUsPhone-accordion a.contactus-button').length > 0) {\n $('#contactUsPhone-accordion a.contactus-button').on('click', function () {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '93',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'contact_us',\n 'eventAction': 'click',\n 'eventLabel': 'phone_number'\n });\n })\n }\n}\n\nvar accordionPrivacy = function () {\n\n var accordionOptions = {\n slideSpeed: 500,\n allowAllClosed: true,\n multiExpand: true\n };\n\n var elem = new Foundation.Accordion($('.accordion'), accordionOptions);\n\n if ($(\"[href='\" + window.location.hash + \"']\").length) {\n $('.accordion').foundation('down', $(window.location.hash + \"-accordion\"));\n }\n};\n\nvar initPoliciesDialogs = function () {\n $('body').on('click', '#newsPrivacy', function (event) {\n event.preventDefault();\n window.open(Urls.newsletterPolicy, '_blank');\n });\n\n};\n\n\nvar anchorCookieListener = function () {\n\n $('a.policyToCookie').on('click', function () {\n\n if ($(\"#cookiePolicyBookmark-accordion\").attr('aria-hidden') == 'true') {\n\n $('a#cookiePolicyBookmark').click();\n }\n });\n}\n\n\nvar anchorPolicyListener = function () {\n\n $('a.cookieToPolicy').on('click', function () {\n\n if ($(\"#policy-accordion\").attr('aria-hidden') == 'true') {\n\n $('a#policy').click();\n }\n });\n}\n\n//ContactUs-page - Accordion function on ContactUs page\nvar contactUsAccordion = function () {\n var accordionOptions = {\n slideSpeed: 500,\n allowAllClosed: true,\n multiExpand: true\n };\n\n var elem = new Foundation.Accordion($('.accordion'), accordionOptions);\n\n if ($(\"[href='\" + window.location.hash + \"']\").length) {\n $('.accordion').foundation('down', $(window.location.hash + \"-accordion\"));\n }\n}\n\n//ContactUs-page - GTM event on accordion ContactUs Page\nvar contactUsAccordionEvent = function () {\n if ($('.accordion-contactus').length > 0) {\n $('.accordion').on('click', '.accordion-item-contactus .accordion-title-contactus', function () {\n var eventType = 'close_section';\n if ($(this).parent().hasClass('is-active')) {\n eventType = 'open_section';\n }\n\n var topicAccordion = $(this).parent().find('.accordion-content-contactus').data('seo-label').toLowerCase().replace(/ /g, \"_\");\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '129',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'contact_us_page',\n 'eventAction': eventType,\n 'eventLabel': topicAccordion\n });\n });\n\n }\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n\nvar customerservice = {\n init: function () {\n handleClickMyGeoxShowNormativaPrivacy();\n handleClickMyGeoxShowGeoxGroup();\n handleClickSendContactUs();\n handleClickPhoneCallContactUs();\n\n handleClickpayandcollectStoreList();\n handleClickreserveinstoreStoreList();\n handleClickreturninstoreStoreList();\n handleConsensoBenefeet();\n handleTrasferimentoDatiBenefeet();\n $('#accordion-policy').length && accordionPrivacy();\n initPoliciesDialogs();\n anchorPolicyListener();\n anchorCookieListener();\n sizeGuide.init();\n contactUsAccordion();\n contactUsAccordionEvent();\n }\n};\n\nmodule.exports = customerservice;\n\n},{\"../size-guide\":72,\"../util\":79}],37:[function(require,module,exports){\n'use strict';\nvar _ = require('lodash');\nvar dialog = require('../../dw/dialog'),\n dwValidator = require('../../dw/validator');\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nvar editAccount = {\n\n init: function () {\n var $formElem = $('.field-wrapper input').closest('form');\n var $requiredInputs = $formElem.find('input.required, select.required');\n var $formContainer = $formElem.find('.content-edit-profile-form');\n var $submitOverlay = $('#overlay-on-editprofile-submit');\n var countryCode;\n\n $formContainer.addClass('disabled'); // Disabled by default because password field will always be empty on page load\n $submitOverlay.hide();\n\n var verifySelector = '#verifyNumberButton';\n\n // First ajax call to determine whether the current mobile phone is verified or not\n\n if ($('input[id*=\"profile_customer_mobilephone\"]').length > 0) {\n var $button = $(verifySelector);\n $button.hide();\n\n if ($('#verificationPhoneAreaRecaptchaV2').length > 0) {\n $('#verificationPhoneAreaRecaptchaV2').hide();\n }\n\n $.ajax({\n url: $(verifySelector).data('mobile-check-url'),\n method: \"GET\",\n success: function (data) {\n var numberToVerify = $('input[id*=\"profile_customer_mobilephone\"]')[0].value;\n if (data.isCurrentlyVerified) {\n $('.phone-field-column1').addClass('verified');\n $('.mobile-phone-input').find('.verified-icon').css('color', '#3156bc');\n $('.mobile-phone-input').find('.verified-icon').fadeIn(300, function () {\n $(this).animate({\n color: '#d8d8d8'\n }, 500);\n });\n $('.mobile-phone-input').find('input.phone').blur();\n sessionStorage.setItem('verifiedNumber', numberToVerify); // Save the number as verified at session level\n\n //Recaptcha invalid session\n if (window.grecaptcha) {\n window.grecaptcha.reset();\n }\n } else {\n $('.phone-field-column1').removeClass('verified');\n $('.mobile-phone-input').find('.verified-icon').hide();\n var validator = $(verifySelector).closest('form').data('validator');\n if (numberToVerify != \"\" && validator.element($('input[id*=\"profile_customer_mobilephone\"]'))) {\n $button.show();\n }\n }\n }\n });\n }\n\n var hasEmptyRequired = function () {\n // filter out only the visible fields\n var requiredValues = $requiredInputs.map(function () {\n if ($(this).attr('type') === 'checkbox' && $(this).prop('checked') == false) {\n return '';\n } else {\n return $(this).val();\n }\n });\n return _(requiredValues).contains('');\n };\n\n // validation function for mobilephone/children/address boxes (My Data page - EditProfile)\n var validateFormBox = function () {\n var currentFormID = this.form.id || '#RegistrationForm';\n $formContainer = $('#' + currentFormID).find('div:first-child[class*=\"content-\"]');\n $requiredInputs = $('#' + currentFormID).find('input.required, select.required');\n var validator = $('#' + currentFormID).data('validator');\n\n if ($(this).val() === '' && $(this).hasClass('required')) {\n $formContainer.addClass('disabled');\n $(this).removeClass('valid');\n } else {\n var hasFilledInvalid = false;\n $requiredInputs.filter(\"input:filled:not(input[type='checkbox'])\").each(function () {\n if (!validator.element(this)) {\n hasFilledInvalid = true;\n }\n });\n\n var mobilePhone = $('input[name*=\"profile_customer_mobilephone\"]').length != 0 ? $('input[name*=\"profile_customer_mobilephone\"]')[0].value : '';\n var isVerifiedNumber = false;\n if (mobilePhone) {\n isVerifiedNumber = sessionStorage.getItem('verifiedNumber') == mobilePhone ? true : false;\n if (!hasEmptyRequired() && !hasFilledInvalid && isVerifiedNumber) {\n $formContainer.removeClass('disabled');\n } else {\n validator.element(this)\n $formContainer.addClass('disabled');\n }\n } else {\n if (!hasEmptyRequired() && !hasFilledInvalid) {\n $formContainer.removeClass('disabled');\n } else {\n validator.element(this)\n $formContainer.addClass('disabled');\n }\n }\n }\n\n };\n\n // function utilities to check for already attached events based on selectors and custom event name\n function checkSubmitEventAttached(selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').submit;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').submit.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n }\n\n function checkClickEventAttached(selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').click;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').click.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n }\n\n function checkChangeEventAttached(selector, eventName) {\n var found = false;\n var events = $._data($(document).get(0), 'events').change;\n\n if (events) {\n var eventsNumber = $._data($(document).get(0), 'events').change.length;\n for (var i = 0; i < eventsNumber && !found; i++) {\n if (events[i].selector == selector && events[i].data && events[i].data.eventName && events[i].data.eventName == eventName) {\n found = true;\n }\n }\n }\n\n return found;\n }\n\n function setCustomerBirthdayStyle() {\n var customerBdayMonthField = $('.edit-form-default-section').find('.birthday-field').find('.birthdate-cell-2').find('select');\n var customerBdayYearField = $('.edit-form-default-section').find('.birthday-field').find('.birthdate-cell-last').find('select');\n\n if (!customerBdayYearField.val()) {\n customerBdayMonthField.parent('.field-wrapper').addClass('uk-de-birthday-style');\n customerBdayYearField.removeClass('required');\n customerBdayYearField.hide();\n }\n }\n\n // Function to initialize the collapsible sections of the profile form (My Data page - EditProfile)\n function initCollapsibleSections() {\n var collapseHeaders = $('form').find('.collapse-header');\n var collapsibleNumber = collapseHeaders.length;\n\n $('form').find('.collapsible').hide({\n complete: function () {\n var dataContainer = $(this).find('div[class$=\"data-container\"]');\n\n var boxInputs = dataContainer.find('input, select');\n\n var switchSelector = (countryCode == 'GB' || countryCode == 'DE') ? '[name$=\"birthdayyear\"], [name$=\"profile_address_address2\"], #set_default_address_checked, .disabled' : '[name$=\"profile_address_address2\"], #set_default_address_checked, .disabled';\n\n if ($(boxInputs[0]).val() == \"\") {\n if (!$(boxInputs[0]).hasClass(\"required\")) {\n boxInputs.prop('disabled', 'true');\n }\n } else {\n boxInputs.not(switchSelector).addClass(\"required\");\n boxInputs.not('.disabled').removeAttr('disabled');\n dataContainer.find('.son-birthday-selection').find('.grid-x:first').addClass('disabled');\n }\n }\n });\n\n for (var i = 0; i < collapsibleNumber; i++) {\n var currentHeader = collapseHeaders[i];\n var currentToggleIcon = $('#' + currentHeader.id).find('.collapse-toggle-icon-bg');\n var toggleIconSelector = '#' + currentToggleIcon[0].id;\n if (!checkClickEventAttached(toggleIconSelector, 'collapse-on-click')) {\n $(document).on('click', toggleIconSelector, {\n eventName: 'collapse-on-click'\n }, function () {\n $(this).parents('.collapse-header').next('.collapsible').toggle({\n duration: 'fast',\n start: function () {\n if ($(this).prop('id') == 'childrenCollapsible') {\n var sonSections = $(this).find('.son-data-container');\n var sonSectionsNumber = sonSections.length;\n\n for (var i = 0; i < sonSectionsNumber; i++) {\n var boxInputs = $(sonSections[i]).find('input, select');\n if (!$(boxInputs[0]).hasClass('required')) {\n if (boxInputs.attr('disabled')) {\n boxInputs.not('.disabled').removeAttr('disabled');\n } else {\n boxInputs.prop('disabled', 'true');\n }\n } else {\n if (boxInputs.filter('.disabled').attr('disabled')) {\n boxInputs.filter('.disabled').removeAttr('disabled');\n } else {\n boxInputs.filter('.disabled').prop('disabled', 'true');\n }\n }\n }\n } else {\n var boxInputs = $(this).find('input, select');\n if (!$(boxInputs[0]).hasClass('required')) {\n if (boxInputs.attr('disabled')) {\n boxInputs.removeAttr('disabled');\n } else {\n boxInputs.prop('disabled', 'true');\n }\n }\n }\n }\n }).toggleClass('open', function () {\n // EC-2461 Richiesta nuovi eventi e review tracciamento Registrazione\n var dataLayerObj = {};\n var action = '';\n var section = '';\n\n if ($(this).is(\"#addressCollapsible\") && $('#addressCollapsible').hasClass('open')) {\n action = 'click_button';\n section = 'insert_a_new_address';\n\n dataLayerObj.eventLabel = action + '-' + section;\n } else if ($(this).is(\"#childrenCollapsible\") && $('#childrenCollapsible').hasClass('open')) {\n action = 'click_button';\n section = 'add_your_children';\n\n dataLayerObj.eventLabel = action + '-' + section;\n }\n\n if (Object.keys(dataLayerObj).length != 0) {\n dataLayerObj.event = 'GAevent';\n dataLayerObj.eventID = '121';\n dataLayerObj.ss_event_id = getTimestampAlphanumericString();\n dataLayerObj.eventCategory = 'my_account';\n dataLayerObj.eventAction = 'personal_data';\n\n dataLayer.push(dataLayerObj);\n }\n });\n\n return false;\n }).parents('.collapse-header').next('.collapsible').hide('fast', function () {\n var boxInputs = $(this).find('input, select');\n if (!$(boxInputs[0]).hasClass('required')) {\n boxInputs.prop('disabled', 'true');\n }\n });\n }\n }\n\n //Initialize toggle icon animation for collapsible sections\n for (var i = 0; i < collapsibleNumber; i++) {\n var currentHeader = collapseHeaders[i];\n var currentToggleIcon = $('#' + currentHeader.id).find('.collapse-toggle-icon-bg');\n var toggleIconSelector = '#' + currentToggleIcon[0].id;\n if (!checkClickEventAttached(toggleIconSelector, 'animate-toggle-icon')) {\n $(document).on('click', toggleIconSelector, {\n eventName: 'animate-toggle-icon'\n }, function () {\n var currentIcon = $(this);\n if (currentIcon.hasClass('closed')) {\n currentIcon.removeClass('closed');\n currentIcon.find('.collapse-toggle-after').animate({\n marginLeft: \"39px\"\n }, 400, function () {});\n currentIcon.animate({\n backgroundColor: \"#3156bc\"\n }, 400);\n } else {\n currentIcon.addClass('closed');\n currentIcon.find('.collapse-toggle-after').animate({\n marginLeft: \"3px\"\n }, 400, function () {});\n currentIcon.animate({\n backgroundColor: \"#cacaca\"\n }, 400);\n }\n return false;\n });\n }\n }\n }\n\n /* Set Default Address checkbox initialization */\n var setDefaultCheckboxContainer = $('.set-default-address-button');\n var setDefaultCheckboxLabel = setDefaultCheckboxContainer.find('label');\n var labelMessage = setDefaultCheckboxContainer.parent('.form-row').data('label');\n\n setDefaultCheckboxContainer.find('input').prop('id', 'set_default_address_checked');\n setDefaultCheckboxContainer.find('input').prop('name', 'set_default_address_checked');\n setDefaultCheckboxContainer.find('input').prop('value', 'true');\n setDefaultCheckboxLabel.prop('for', 'set_default_address_checked');\n\n setDefaultCheckboxLabel.find('span').html(labelMessage);\n setDefaultCheckboxContainer.find('input').hide();\n\n /* Check if address input fields are filled in in order to enable the Set Default Address checkbox */\n function enableSetDefaultAddress() {\n var mobilephoneInput = $('input[name*=\"profile_customer_mobilephone\"]');\n\n var isFilledIn = true;\n\n\n if (!mobilephoneInput.val()) {\n $('.set-default-address-button').hide();\n $('.set-default-address-button').addClass('disabled');\n $('.set-default-address-button').find('input').prop('disabled', 'true');\n $('.set-default-address-button').find('input').removeAttr('checked');\n } else {\n $('.set-default-address-button').removeClass('disabled');\n $('.set-default-address-button').find('input').removeAttr('disabled');\n $('.set-default-address-button').show();\n }\n }\n\n enableSetDefaultAddress();\n\n /* Precheck set default address chekcbox based on prechecked class, set via isml template */\n var setDefaultAddressContainer = $('#addressCollapsible').find('.set-default-address-button');\n if (setDefaultAddressContainer.hasClass('prechecked')) {\n setDefaultAddressContainer.find('#set_default_address_checked').prop('checked', 'true');\n setDefaultAddressContainer.removeClass('prechecked');\n }\n\n /* Attach the event handler for the 'required' attribute switch, for the children/address/new-password boxes' inputs (My Data page - EditProfile) */\n function attachRequiredSwitch(selector) {\n if (selector != \"\" && !checkChangeEventAttached(selector, 'required-switch-event')) {\n $(document).on('change', selector, {\n eventName: 'required-switch-event'\n\n /*\n This function decides whether a whole form box has required inputs or not.\n (if at least one input is filled then the whole box becomes required and must be validated on submit)\n */\n }, function () {\n /* The input fields that will switch between required and not required must be inside a container that has a class ending with 'data-container' */\n var currentBox = $(this).parents('div[class$=\"data-container\"]');\n var currentBoxInputs = currentBox.find('input, select');\n var hasInputFilled = false;\n\n for (var i = 0; i < currentBoxInputs.length && !hasInputFilled; i++) {\n if (currentBoxInputs[i].value != \"\" && !currentBoxInputs[i].id.includes('profile_address_country') && currentBoxInputs[i].id != 'set_default_address_checked') {\n hasInputFilled = true;\n }\n }\n\n // address2 input (flat/floor/staircase) and set_default_address checkbox have been excluded from the switch as they are not mandatory fields\n // when in GB or DE locales, children's birthday year input field is excluded from the switch (not mandatory in these countries)\n\n var switchSelector = (countryCode == 'GB' || countryCode == 'DE') ? '[name$=\"birthdayyear\"], [name$=\"profile_address_address2\"], #set_default_address_checked, .disabled' : '[name$=\"profile_address_address2\"], #set_default_address_checked, .disabled'\n\n if (hasInputFilled) {\n currentBoxInputs.not(switchSelector).addClass('required');\n currentBoxInputs.not(switchSelector).prop('aria-required', 'true');\n currentBoxInputs.not(switchSelector).closest('.form-row').addClass('required');\n currentBoxInputs.not(switchSelector).closest('.form-row').prop('aria-required', 'true');\n } else {\n currentBoxInputs.not(switchSelector).removeClass('required');\n currentBoxInputs.removeClass('error');\n currentBoxInputs.not(switchSelector).removeAttr('aria-required');\n currentBoxInputs.prop('aria-invalid', 'false');\n /*\n currentBox.find('span[id*=\"error\"], span[class*=\"error\"]').hide();\n */\n currentBoxInputs.not(switchSelector).closest('.form-row').removeClass('required');\n currentBoxInputs.not(switchSelector).closest('.form-row').removeAttr('aria-required');\n }\n\n if ($(currentBox[0]).parents('.collapsible').prop('id') == 'addressCollapsible') {\n enableSetDefaultAddress();\n }\n\n currentBoxInputs.blur();\n });\n }\n }\n\n /* Attach the event handler for the display of the error label, for the birthday section inside the children boxes (My Data page - EditProfile) */\n function attachErrorLabel(selector) {\n if (selector != \"\" && !checkChangeEventAttached(selector, 'birthday-error-label-event')) {\n $(document).on('change focusin focusout', selector, {\n eventName: 'birthday-error-label-event'\n }, function () {\n var currentBox = $(this).parents('.son-data-container');\n var birthdayBox = currentBox.find('.son-birthday-selection');\n var currentBoxInputs = birthdayBox.find('select');\n var hasSelectInvalid = false;\n\n for (var i = 0; i < currentBoxInputs.length && !hasSelectInvalid; i++) {\n if ($('#' + currentBoxInputs[i].id).hasClass('error')) {\n hasSelectInvalid = true;\n }\n }\n\n if (hasSelectInvalid) {\n currentBox.find('.son-birthday-error').show();\n } else {\n currentBox.find('.son-birthday-error').hide();\n }\n });\n }\n }\n\n /* Handling new-password section inputs' required attribute (My Data page - EditProfile) */\n var newPassInputFields = $('#new-password-section').find('input');\n newPassInputFields.removeClass('required');\n\n var newPassInputSelector = '';\n for (var i = 0; i < newPassInputFields.length; i++) {\n if (newPassInputSelector == '') {\n newPassInputSelector = '#' + newPassInputFields[i].id;\n } else {\n newPassInputSelector += ', #' + newPassInputFields[i].id;\n }\n }\n attachRequiredSwitch(newPassInputSelector);\n\n /* Handling address section inputs' required attribute (My Data page - EditProfile) */\n var addressInputFields = $('#addressCollapsible').find('input, select');\n addressInputFields.removeClass('required');\n\n var addressInputSelector = '';\n for (var i = 0; i < addressInputFields.length; i++) {\n if (addressInputSelector == '') {\n addressInputSelector = '#' + addressInputFields[i].id;\n } else {\n addressInputSelector += ', #' + addressInputFields[i].id;\n }\n }\n attachRequiredSwitch(addressInputSelector);\n\n /* Forced change event on address section, in order to properly set required attributes based on precompilation */\n $('#addressCollapsible').find('input[name*=\"address_address1\"]').trigger('change');\n\n /* Function that creates a new child box based on the presence of other child boxes */\n function createNewChildBox(firstname, gender, birthdayday, birthdaymonth, birthdayyear) {\n var containerWrapper = $('.edit-form-children-section').find('.son-data-container-wrapper');\n var childContainers = containerWrapper.find('.son-data-container');\n var childNumber = childContainers.length;\n if (childNumber < 4) {\n var newChildContainer = $('#' + childContainers[0].id).clone();\n var newHtmlElements = newChildContainer.find('input,select,label,span');\n var newInputFields = newChildContainer.find('input, select');\n var newBirthdayFields = newChildContainer.find('.son-birthday-selection').find('select');\n\n newHtmlElements.each(function (i, currentHtmlElement) {\n var attributes = currentHtmlElement.attributes;\n var attrNumber = attributes.length;\n var attrNames = [];\n var newAttrMap = {};\n\n for (var i = 0; i < attrNumber; i++) {\n var attrName = attributes[i].name;\n var oldAttrValues = attributes[i].value.split(/\\s+/);\n var valuesNumber = oldAttrValues.length;\n var newAttrValues = '';\n\n for (var j = 0; j < valuesNumber; j++) {\n if (oldAttrValues[j].includes('son1')) {\n var newSubstring = 'son' + (childNumber + 1);\n var newAttr = oldAttrValues[j].replace(/son1/, newSubstring);\n if (newAttrValues == '') {\n newAttrValues = newAttr;\n } else {\n newAttrValues += ' ' + newAttr;\n }\n } else {\n if (newAttrValues == '') {\n newAttrValues = oldAttrValues[j];\n } else {\n newAttrValues += ' ' + oldAttrValues[j];\n }\n }\n }\n\n attrNames[i] = attrName;\n newAttrMap[attrName] = newAttrValues;\n }\n\n for (var i = 0; i < attrNumber; i++) {\n var name = attrNames[i];\n var value = newAttrMap[name];\n\n $(this).removeAttr(name);\n $(this).prop(name, value);\n }\n $(this).removeClass('error');\n $(this).removeClass('required');\n $(this).removeClass('valid');\n $(this).closest('.form-row').removeClass('required');\n\n });\n\n newInputFields.on('change focusout', validateFormBox);\n newInputFields.filter('input').on('keyup', _.debounce(validateFormBox, 200));\n\n var newFieldsSelector = '';\n for (var i = 0; i < newInputFields.length; i++) {\n if (newFieldsSelector == '') {\n newFieldsSelector = '#' + newInputFields[i].id;\n } else {\n newFieldsSelector += ', #' + newInputFields[i].id;\n }\n }\n attachRequiredSwitch(newFieldsSelector);\n\n newFieldsSelector = '';\n for (var i = 0; i < newBirthdayFields.length; i++) {\n if (newFieldsSelector == '') {\n newFieldsSelector = '#' + newBirthdayFields[i].id;\n } else {\n newFieldsSelector += ', #' + newBirthdayFields[i].id;\n }\n }\n attachErrorLabel(newFieldsSelector);\n\n newChildContainer.appendTo(containerWrapper);\n var newErrorContainer = newChildContainer.find('.son-birthday-error')\n newErrorContainer.hide();\n newErrorContainer.attr('id', 'son-birthday-error' + ($(document).find('.son-birthday-error').length));\n\n $(newInputFields[0]).val(firstname);\n $(newInputFields[1]).val(gender);\n $(newInputFields[2]).val(birthdayday);\n $(newInputFields[3]).val(birthdaymonth);\n $(newInputFields[4]).val(birthdayyear);\n if (birthdayday && birthdaymonth && birthdayyear) {\n $(newInputFields[2]).addClass('disabled required');\n $(newInputFields[3]).addClass('disabled required');\n $(newInputFields[4]).addClass('disabled');\n if (birthdayyear == \"1900\") {\n $(newInputFields[3]).parent('.field-wrapper').addClass('uk-de-birthday-style');\n $(newInputFields[4]).hide();\n } else {\n $(newInputFields[3]).parent('.field-wrapper').removeClass('uk-de-birthday-style');\n $(newInputFields[4]).addClass('required');\n $(newInputFields[4]).show();\n }\n } else {\n newChildContainer.find('.son-birthday-selection').find('.grid-x:first').removeClass('disabled');\n $(newInputFields[2]).removeClass('disabled');\n $(newInputFields[3]).removeClass('disabled');\n $(newInputFields[4]).removeClass('disabled');\n $(newInputFields[4]).show();\n }\n }\n }\n\n /* Generates precompiled children boxes */\n var childrenUrl = $('.edit-form-children-section').find('.son-data-container-wrapper').data(\"url\");\n\n if (childrenUrl) {\n $.ajax({\n url: childrenUrl,\n method: \"GET\",\n success: function (data) {\n //setting locale from ajax call - this is done here because children's birthday fields need special handling based on country\n countryCode = data.countryCode;\n //as soon as we get informations about the current locale set customer's birthday field's style.\n setCustomerBirthdayStyle();\n\n if (data.childrenFromDw.length > 0) {\n var childrenNumber = data.childrenFromDw.length;\n\n var firstChildDw = data.childrenFromDw.shift();\n var firstname1 = firstChildDw.firstname;\n var gender1 = '' + firstChildDw.gender;\n\n var birthdate1 = new Date(firstChildDw.birthday);\n var day1 = '' + birthdate1.getDate();\n var month1 = '' + (birthdate1.getMonth() + 1);\n var year1 = '' + birthdate1.getFullYear();\n\n var firstSonBox = $('.son-data-container-wrapper').children('div:first-child');\n var firstSonInputs = firstSonBox.find('input, select');\n\n $(firstSonInputs[0]).val(firstname1);\n $(firstSonInputs[1]).val(gender1);\n $(firstSonInputs[2]).val(day1).addClass('disabled required');\n $(firstSonInputs[3]).val(month1).addClass('disabled required');\n $(firstSonInputs[4]).val(year1).addClass('disabled');\n if (year1 == \"1900\") {\n $(firstSonInputs[3]).parent('.field-wrapper').addClass('uk-de-birthday-style');\n $(firstSonInputs[4]).hide();\n } else {\n $(firstSonInputs[3]).parent('.field-wrapper').removeClass('uk-de-birthday-style');\n $(firstSonInputs[4]).addClass('required');\n $(firstSonInputs[4]).show();\n }\n\n for (var i = 1; i < childrenNumber; i++) {\n var currentChildFromDw = data.childrenFromDw.shift();\n var firstname = currentChildFromDw.firstname;\n var gender = '' + currentChildFromDw.gender;\n\n var birthdate = new Date(currentChildFromDw.birthday);\n var day = '' + birthdate.getDate();\n var month = '' + (birthdate.getMonth() + 1);\n var year = '' + birthdate.getFullYear();\n\n createNewChildBox(firstname, gender, day, month, year);\n }\n };\n /* Actual Initialization of collapsible sections */\n initCollapsibleSections();\n }\n });\n }\n\n /* Adds a new container in the children section (add son button)(My Data page - EditProfile) */\n var addSonSelector = '.add-son-button';\n\n if (!checkClickEventAttached(addSonSelector, 'add-son-event')) {\n $(document).on('click', addSonSelector, {\n eventName: 'add-son-event'\n }, function () {\n var containerWrapper = $('.edit-form-children-section').find('.son-data-container-wrapper');\n var childContainers = containerWrapper.find('.son-data-container');\n var childNumber = childContainers.length;\n\n createNewChildBox('', '', '', '', '');\n\n if (childNumber >= 3) {\n $(this).hide();\n }\n });\n }\n\n /* Set the logic for the dynamic validation of children boxes (My Data page - EditProfile) */\n var son1Box = $('.son-data-container-wrapper').children('div:first-child');\n var son1InputFields = son1Box.find('input, select');\n var son1BirthdayFields = son1Box.find('.son-birthday-selection').find('select');\n\n son1InputFields.on('change focusout', validateFormBox);\n son1InputFields.filter('input').on('keyup', _.debounce(validateFormBox, 200));\n\n var sonInputSelector = '';\n\n for (var i = 0; i < son1InputFields.length; i++) {\n if (sonInputSelector == '') {\n sonInputSelector = '#' + son1InputFields[i].id;\n } else {\n sonInputSelector += ', #' + son1InputFields[i].id;\n }\n }\n attachRequiredSwitch(sonInputSelector);\n\n /* Handle the display of the error label for the birthday section inside children boxes (My Data page - EditProfile) */\n son1Box.find('.son-birthday-error').hide();\n\n var sonBirthdayFieldsSelector = '';\n\n sonBirthdayFieldsSelector = '';\n for (var i = 0; i < son1BirthdayFields.length; i++) {\n if (sonBirthdayFieldsSelector == '') {\n sonBirthdayFieldsSelector = '#' + son1BirthdayFields[i].id;\n } else {\n sonBirthdayFieldsSelector += ', #' + son1BirthdayFields[i].id;\n }\n }\n attachErrorLabel(sonBirthdayFieldsSelector);\n\n /* Initialize verify button and verify button display event */\n var mobilephoneSelector = 'input[name*=\"profile_customer_mobilephone\"]';\n if (!checkChangeEventAttached(mobilephoneSelector, 'verify_button_show')) {\n $(document).on('keyup', mobilephoneSelector, {\n eventName: 'verify_button_show'\n }, function () {\n var inputValue = $(this)[0].value;\n var validator = $(this).closest('form').data('validator');\n\n $(this).on('change focusout', validateFormBox);\n $(this).on('keyup', _.debounce(validateFormBox, 200));\n\n enableSetDefaultAddress();\n\n var $icon = $('.mobile-phone-input').find('.verified-icon');\n $('.phone-field-column1').removeClass('verified');\n $icon.hide();\n\n if (window.grecaptcha) {\n window.grecaptcha.reset();\n }\n\n if (inputValue != \"\" && validator.element(this) && sessionStorage.getItem('verifiedNumber') != inputValue) { //checks if the number is valid and if it is not already verified (saved in sessionStorage)\n $formElem.find('#verifyNumberButton').show();\n $formElem.find('#verifyNumberButton').find('span[class*=\"text\"]').show();\n $formElem.find('#verifyNumberButton').find(\".spinner\").hide();\n\n if ($('.g-recaptcha-wrapper-editprofilearea').length > 0) {\n $('.g-recaptcha-wrapper-editprofilearea').show();\n $('#verificationPhoneAreaRecaptchaV2').show();\n }\n } else {\n $formElem.find('#verifyNumberButton').hide();\n\n if ($('.g-recaptcha-wrapper-editprofilearea').length > 0) {\n $('.g-recaptcha-wrapper-editprofilearea').hide();\n $('#verificationPhoneAreaRecaptchaV2').hide();\n }\n }\n\n\n if (sessionStorage.getItem('verifiedNumber') == inputValue) {\n $('.phone-field-column1').addClass('verified');\n\n $icon.css('color', '#3156bc');\n\n $icon.stop().fadeIn(\n 300,\n function () {\n $icon.stop().animate({\n color: '#d8d8d8'\n }, 500);\n }\n );\n } else {\n $('.phone-field-column1').removeClass('verified');\n $icon.hide();\n }\n });\n }\n\n /* Enable spinner and change styles on verify mobilephone button click */\n if (!checkClickEventAttached(verifySelector, 'spinner_event')) {\n $(document).on('click', verifySelector, {\n eventName: 'spinner_event'\n }, function () {\n var validator = $(this).closest('form').data('validator');\n if (validator.element(this)) {\n $(this).find('span[class*=\"text\"]').hide();\n $(this).find(\".spinner\").css(\"display\", \"block\");\n }\n });\n }\n\n /* Custom style adjustments to prefix selection */\n var viewportHeight = $(window).height();\n\n $('.prefix-input .prefix-custom-select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false,\n maxHeight: viewportHeight / 2,\n preventWindowScroll: false,\n onOpen: function () {\n var inputContainer = $('.phone-field-column1')[0];\n var inputContainerWidth = inputContainer.scrollWidth;\n var selectId = 'prefix-custom-select';\n var $selectricOptionsWrapper = $('.selectric-' + selectId + ' .selectric-items');\n $selectricOptionsWrapper.css({\n \"width\": inputContainerWidth + 'px',\n \"-ms-touch-action\": \"none\",\n \"touch-action\": \"none\"\n });\n }\n });\n\n /* --- Setting the logic for the mobile number validation --- */\n\n /* This function disables the verifyMobileCodeButton based on the code input fields that are filled in */\n function toggleVerifyMobileCodeButton() {\n var verificationCode1 = $('input[name*=\"verificationcode1\"]')[0].value;\n var verificationCode2 = $('input[name*=\"verificationcode2\"]')[0].value;\n var verificationCode3 = $('input[name*=\"verificationcode3\"]')[0].value;\n var verificationCode4 = $('input[name*=\"verificationcode4\"]')[0].value;\n var verificationCode5 = $('input[name*=\"verificationcode5\"]')[0].value;\n var verificationCode6 = $('input[name*=\"verificationcode6\"]')[0].value;\n\n if (verificationCode1 && verificationCode2 && verificationCode3 && verificationCode4 && verificationCode5 && verificationCode6) {\n $('#verifyMobileCodeButton').prop(\"disabled\", false);\n $('#verifyMobileCodeButton').removeClass('disabled');\n } else {\n $('#verifyMobileCodeButton').prop(\"disabled\", true);\n $('#verifyMobileCodeButton').addClass('disabled');\n }\n }\n\n /* Handling of the mobile number verification flow */\n if (!checkClickEventAttached(verifySelector, 'init_verify_number')) {\n $(document).on('click', verifySelector, {\n eventName: 'init_verify_number'\n }, function () {\n var $button = $(this);\n var numberToVerify = $('input[id*=\"profile_customer_mobilephone\"]')[0].value;\n var currentPrefix = $('.prefix-input .selectric-hide-select option:selected')[0].value;\n var userEmail = $(verifySelector).data('email-user');\n\n $.ajax({ //Ajax for the rendering of the verification code insertion popup\n url: $(verifySelector).data('mobile-verify-url'),\n method: \"GET\",\n data: {\n 'numberToVerify': numberToVerify,\n 'currentPrefix': currentPrefix,\n 'userEmail': userEmail\n },\n success: function (data) {\n if (data.error != undefined && data.error == true) { //Error case\n $button.find('span[class*=\"text\"]').show();\n $button.find(\".spinner\").hide();\n $('input[id*=\"profile_customer_mobilephone\"]').addClass('error');\n $('input[id*=\"profile_customer_mobilephone\"]').siblings().text(data.message).show();\n } else {\n $button.find('span[class*=\"text\"]').show();\n $button.find(\".spinner\").hide();\n dialog.open({ // Open the popup\n validator: dwValidator,\n html: data,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'phone-verify-popup-container',\n success: function (container) { // Popup initialization (template and events handling)\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').addClass('fixed-page');\n }\n\n //COUNTDOWN (VERIFICATION CODE VALIDITY TIME SPAN) CTRL+F -> Verification code time validity\n\n /* var delayInMilliseconds = 32000; //This is the actual validity time span\n var codeTimeSpan = new Date().getTime() + delayInMilliseconds;\n\n var countdown;\n // Function that handles the update of the countdown and, once expired, makes an ajax call to invalidate the verification code\n function timer() {\n var now = new Date().getTime();\n\n var timeRemaining = codeTimeSpan - now;\n\n var minutes = (\"0\" + (Math.floor((timeRemaining % (1000 * 60 * 60)) / (1000 * 60)))).slice(-2);\n var seconds = (\"0\" + (Math.floor((timeRemaining % (1000 * 60)) / 1000))).slice(-2);\n\n var counting = minutes + \":\" + seconds;\n\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html(counting);\n\n if (timeRemaining < 0) {\n clearInterval(countdown);\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html('');\n $.ajax({ // Stop countdown and invalidate code\n url: $('#verifyCodeCountdown').data('action'),\n method: \"GET\",\n success: function (data) {\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html(data.message);\n }\n });\n }\n } */\n\n // Verification code time validity\n /* countdown = setInterval(timer, 1000); */\n\n // First disable verify mobile code button\n $('#verifyMobileCodeButton').prop(\"disabled\", true);\n $('#verifyMobileCodeButton').addClass('disabled');\n\n // Handling of all the events linked to code input fields\n $(\"#PhoneVerifyForm\").find('input[name*=\"verificationcode\"]').each(function () {\n // MOVE FOCUS FORWARD\n // On 'input' event, if the currently focused input is not empty and the value is a number,\n // move the focus forward. Then, check whether the verifyMobileCodeButton can be enabled or\n // has to stay disabled.\n $(this).on(\"input\", {\n eventName: 'move_focus_event'\n },\n function () {\n var currentElementID = $(this).attr('id');\n\n if (currentElementID.includes('verificationcode6')) {\n $(this).blur();\n } else {\n if ($(this).val() != '' && Number.isInteger(parseInt($(this).val()))) {\n $(this).nextAll('input:first').trigger('focus');\n }\n }\n\n toggleVerifyMobileCodeButton();\n\n $(\"#PhoneVerifyForm\").find('input[name*=\"verificationcode\"]').removeClass(\"error\");\n }\n );\n\n // MOVE FOCUS BACKWARDS (BACKSPACE PRESS)\n // On 'keydown' event check if the pressed key is Backspace: if it is move the focus backwards.\n // Then, check whether the verifyMobileCodeButton can be enabled or has to stay disabled.\n $(this).on(\"keydown\", function (e) {\n var keycode = e.code || e.keyCode;\n var currentElementID = $(this).attr('id');\n\n //Backspace\n if (keycode == 8) {\n if (currentElementID.includes('verificationcode1')) {\n $(this).trigger('focus');\n } else {\n if ($(this).val() == '') {\n $(this).prevAll('input:first').trigger('focus');\n }\n }\n }\n\n toggleVerifyMobileCodeButton();\n\n $(\"#PhoneVerifyForm\").find('input[name*=\"verificationcode\"]').removeClass(\"error\");\n });\n\n // On 'focusin' event clear the input field and disable verify mobile code button\n $(this).on(\"focusin\", function () {\n $(this).val('');\n\n $('#verifyMobileCodeButton').prop(\"disabled\", true);\n $('#verifyMobileCodeButton').addClass('disabled');\n });\n\n $(this).on(\"focusout blur\", function () {\n $(\"#PhoneVerifyForm\").find('input[name*=\"verificationcode\"]').removeClass(\"error\");\n });\n\n // COPY-PASTE HANDLING\n // Handle the copy-paste of the verification code.\n // Check whether the verifyMobileCodeButton can be enabled or has to stay disabled.\n $(this).on(\"paste\", function (e) {\n e.preventDefault();\n var data = e.originalEvent.clipboardData.getData(\"text\");\n\n if (data.length <= 6) {\n for (var i = 0; i < data.length; i++) {\n var currentNumber = data.charAt(i);\n var index = parseInt(i) + 1;\n var inputSelector = 'input[name*=\"verificationcode' + index + '\"]';\n var inputInOrder = $(inputSelector);\n inputInOrder.val(currentNumber);\n }\n }\n\n toggleVerifyMobileCodeButton();\n\n $(this).blur();\n });\n });\n\n container.parent().find('.ui-dialog-titlebar-close').on('click', function () {\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').removeClass('fixed-page');\n }\n // Verification code time validity\n /* clearInterval(countdown);\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html(''); */\n });\n\n // Send new code button\n $('#sendNewCodeButton').on(\"click\", function () {\n var numberToVerify = $('input[id*=\"profile_customer_mobilephone\"]')[0].value;\n var currentPrefix = $('.prefix-input .selectric-hide-select option:selected')[0].value;\n\n var $button = $(this);\n $button.find('span[class*=\"text\"]').hide();\n $button.find(\".spinner\").css(\"display\", \"block\");\n\n // Verification code time validity\n /* clearInterval(countdown);\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html(''); */\n\n $.ajax({ // Stop countdown and invalidate code before generating a new one\n url: $('#sendNewCodeButton').data('action'),\n method: \"GET\",\n data: {\n 'numberToVerify': numberToVerify,\n 'currentPrefix': currentPrefix\n },\n success: function (data) {\n if (!data.error) {\n $button.find('span[class*=\"text\"]').show();\n $button.find(\".spinner\").hide();\n\n // Verification code time validity\n\n /* codeTimeSpan = new Date().getTime() + delayInMilliseconds;\n countdown = setInterval(timer, 1000); */\n } else {\n dialog.destroy();\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').removeClass('fixed-page');\n }\n }\n }\n });\n\n });\n\n // Verification code \"submit\" (The mobile number verification is handled at session level)\n $('#verifyMobileCodeButton').on('click', function () {\n var verificationCode1 = $('input[name*=\"verificationcode1\"]')[0].value;\n var verificationCode2 = $('input[name*=\"verificationcode2\"]')[0].value;\n var verificationCode3 = $('input[name*=\"verificationcode3\"]')[0].value;\n var verificationCode4 = $('input[name*=\"verificationcode4\"]')[0].value;\n var verificationCode5 = $('input[name*=\"verificationcode5\"]')[0].value;\n var verificationCode6 = $('input[name*=\"verificationcode6\"]')[0].value;\n\n if (verificationCode1 && verificationCode2 && verificationCode3 && verificationCode4 && verificationCode5 && verificationCode6) {\n $.ajax({ // Ajax call for the code validation\n url: $('#verifyMobileCodeButton').data('action'),\n method: \"GET\",\n data: {\n 'numberToVerify': numberToVerify,\n 'verificationCode1': verificationCode1,\n 'verificationCode2': verificationCode2,\n 'verificationCode3': verificationCode3,\n 'verificationCode4': verificationCode4,\n 'verificationCode5': verificationCode5,\n 'verificationCode6': verificationCode6\n },\n success: function (data) {\n\n // Verification code time validity\n /* clearInterval(countdown);\n $('#PhoneVerifyForm').find('#verifyCodeCountdown').html(''); */\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('body').removeClass('fixed-page');\n }\n dialog.destroy();\n if (data.numberIsVerified) {\n sessionStorage.setItem('verifiedNumber', numberToVerify); // Save the number as verified at session level\n $button.hide();\n $('.phone-field-column1').addClass('verified');\n $('.mobile-phone-input').find('.verified-icon').css('color', '#3156bc');\n $('.mobile-phone-input').find('.verified-icon').fadeIn(300, function () {\n $(this).animate({\n color: '#d8d8d8'\n }, 500);\n });\n $('.mobile-phone-input').find('input.phone').blur();\n } else {\n dialog.open({\n html: data.template,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'code-error-dialog'\n },\n target: '#code-error-container'\n });\n }\n }\n });\n }\n $(this).find('span[class*=\"text\"]').hide();\n $(this).find(\".spinner\").css(\"display\", \"block\");\n });\n }\n },\n target: '#phone-verify-sidebar'\n });\n }\n return false;\n },\n error: function () {\n $button.find('span[class*=\"text\"]').show();\n $button.find(\".spinner\").hide();\n }\n });\n });\n }\n\n // Remove disabled attribute from children birthday fields on submit button click (in order to trigger their submission too)\n var submitSelector = '#submitEditProfileButton'\n if (!checkClickEventAttached(submitSelector, 'remove_disabled_on_submit')) {\n $(document).on('click', submitSelector, {\n eventName: 'remove_disabled_on_submit'\n }, function (e) {\n if (!$formContainer.hasClass('disabled')) {\n var disabledBirthdayFields = $('#childrenCollapsible').find('.son-birthday-selection').find('select');\n disabledBirthdayFields.removeAttr('disabled');\n $submitOverlay.show();\n }\n });\n }\n\n /*\n * Event used to not allow the form to be submitted when the \"Enter\" button is clicked\n */\n $('body').on(\"keypress\", 'form#RegistrationForm', function (e) {\n var code = e.code === 'Enter' || e.key === 'Enter';\n if (code) {\n e.preventDefault();\n return false;\n }\n });\n\n $('body').on('click', 'form#RegistrationForm button[type=submit]', function (e) {\n var isValid = true;\n var firstError = '';\n for (var i = 0; i < 4; i++) {\n var daySelect = $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayday');\n var monthSelect = $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdaymonth');\n var yearSelect = $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayyear');\n\n var childDay = parseInt(daySelect.val());\n var childMonth = parseInt(monthSelect.val());\n var childYear = parseInt(yearSelect.val());\n\n var todayDate = new Date();\n var today = {\n day: todayDate.getDate(),\n month: todayDate.getMonth() + 1,\n year: todayDate.getFullYear()\n };\n var age = today.year - childYear;\n var ageMonth = today.month - childMonth;\n if (ageMonth < 0 || (ageMonth === 0 && today.day < childDay)) {\n age--;\n }\n\n if ((age < 0 || age > 14) && !daySelect.hasClass('disabled')) {\n isValid = false;\n $('#son-birthday-error' + (i + 1)).css({\n display: 'block'\n });\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayday').addClass('error')\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdaymonth').addClass('error')\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayyear').addClass('error')\n\n if (firstError != '') {\n firstError = '#son-birthday-error' + (i + 1)\n };\n } else {\n $('#son-birthday-error' + (i + 1)).css({\n display: 'none'\n });\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayday').removeClass('error')\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdaymonth').removeClass('error')\n $('#dwfrm_profile_customer_benefeet_son' + (i + 1) + '_birthdayyear').removeClass('error')\n }\n }\n if (!isValid) {\n e.preventDefault();\n\n return false;\n }\n })\n }\n}\nmodule.exports = editAccount;\n\n},{\"../../dw/dialog\":20,\"../../dw/validator\":80,\"lodash\":110}],38:[function(require,module,exports){\n'use strict';\n\nvar slickButtonsHeight = require('../slickButtonsHeight');\nvar preloader = require('../preloader');\nvar rollcomponent = require('./roll-component');\nvar WishlistComponent = require(\"../custom/wishlistComponent\");\nvar recommendations = require('./product/recommendations'),\n genericSidebar = require('../generic-sidebar'),\n productTile = require('../product-tile');\nexports.init = function () {\n setCarouselObserver();\n initializeEvents();\n\n //setTechSlider();\n // slider/video common functions moved to contentUtils.js\n\n // start Old functions - remove after reskinning\n // setSlotSliders();\n // setHighlightComposition();\n // setHeroCarousels();\n // setOldSliders();\n // rollcomponent.init();\n // loadVimeo();\n // end Old functions - remove after reskinning\n\n if ($(\"#carousel-recommendations .product-tile\").length > 0 || $(\".best-products-box .product-tile\").length > 0) {\n initProductCarouselEvents();\n window.initProductCarouselEvents = initProductCarouselEvents;\n } else {\n\n window.initProductCarouselEvents = initProductCarouselEvents;\n }\n\n\n\n};\n\nfunction initializeEvents() {\n var $main = $('#main');\n\n $main.on('click', '.bannerhero__information .advance-information-button', function (e) {\n e.preventDefault();\n var url = $(this).attr('data-popup-sidebar');\n\n if (url == 'advance-information-modal') {\n genericSidebar.open('.sidebar-dialog-category-information', 'static', false);\n }\n });\n}\n\n\nfunction setCarouselObserver() {\n var targetNode = document.getElementById('product-cluster-carousel-slot-container');\n console.log(\"file storefront\");\n var callback;\n if (targetNode) {\n callback = function (mutationsList, observer) {\n for (var mutationIndex in mutationsList) {\n var mutation = mutationsList[mutationIndex];\n console.log(mutation);\n\n if (mutation.type === 'childList') {\n initProductCarouselEvents();\n break;\n }\n }\n observer.disconnect();\n };\n // Creazione di un'istanza di monitoraggio collegata alla funzione di callback\n var observer = new MutationObserver(callback);\n var config = {\n childList: true,\n subtree: true\n };\n // Inizio del monitoraggio del nodo target riguardo le mutazioni configurate\n observer.observe(targetNode, config);\n }\n}\nvar initProductCarouselEvents = function () {\n recommendations();\n productTile.init('#carousel-recommendations .product-tile-container', false);\n productTile.init('.best-products-box .product-tile-container', false);\n new WishlistComponent(true, false);\n};\n\n},{\"../custom/wishlistComponent\":19,\"../generic-sidebar\":22,\"../preloader\":64,\"../product-tile\":65,\"../slickButtonsHeight\":73,\"./product/recommendations\":50,\"./roll-component\":57}],39:[function(require,module,exports){\n(function(l) {\n function d() {\n var a = !1,\n b;\n this.settings = {\n appendHelpButton: !0,\n displayHelpButton: !0,\n isExternalPage: !0,\n devMode: !1,\n targetElement: document.body,\n elementForOnlineDisplay: void 0,\n elementForOfflineDisplay: void 0,\n defaultMinimizedText: \"\",\n disabledMinimizedText: \"\",\n defaultAssistiveText: \"\",\n loadingText: \"Loading\",\n showIcon: void 0,\n enabledFeatures: [],\n entryFeature: \"FieldService\",\n storageDomain: document.domain,\n language: void 0,\n linkAction: {\n feature: void 0,\n name: void 0,\n valid: !1\n },\n linkActionParameters: {},\n useCustomAuthentication: !1,\n allowGuestUsers: !1,\n requireSLDS: !1,\n hasBottomTabBar: !1\n };\n this.auth = {};\n this.validLinkActions = {};\n this.alwaysWarnOnBeforeUnload = !1;\n Object.defineProperty(this.auth, \"oauthToken\", {\n get: function() {\n return b\n },\n set: function(c) {\n this.validateHeaderValue(c) ? (b = c) ? (this.setSessionData(\"ESW_OAUTH_TOKEN\", c), this.checkAuthentication()) : this.deleteSessionData(\"ESW_OAUTH_TOKEN\") : this.error('\"' + c + '\" is not a valid OAuth token.')\n }.bind(this)\n });\n this.featureScripts = {};\n this.storedEventHandlers = {};\n this.messageHandlers = {};\n this.storageKeys = [\"ESW_BODY_SCROLL_POSITION\", \"ESW_IS_MINIMIZED\", \"ESW_MINIMIZED_TEXT\", \"ESW_OAUTH_TOKEN\"];\n this.defaultSettings = {};\n this.snippetSettingsFile = {};\n this.eswFrame = void 0;\n this.availableFeatures = [\"script\", \"session\"];\n this.outboundMessagesAwaitingIframeLoad = [];\n this.pendingMessages = {};\n this.iframeScriptsToLoad = [];\n this.isAuthenticationRequired = this.isIframeReady = this.hasSessionDataLoaded = this.componentInitInProgress = this.domInitInProgress = !1;\n this.loginPendingSerializedData = void 0;\n this.componentLoaded = !1;\n Object.defineProperty(this,\n \"isButtonDisabled\", {\n get: function() {\n return a\n },\n set: function(c) {\n a = c;\n this.onButtonStatusChange()\n }.bind(this),\n configurable: !0\n });\n this.setupMessageListener();\n this.getLinkActionData()\n }\n var m = [\".salesforce.com\", \".force.com\", \".sfdc.net\"];\n d.prototype.getLightningOutParamsObj = function() {\n var a = {};\n embedded_svc.config && embedded_svc.config.additionalSettings && embedded_svc.config.additionalSettings.labelsLanguage ? a = {\n guestUserLang: embedded_svc.config.additionalSettings.labelsLanguage\n } : embedded_svc.settings.language &&\n \"\" !== embedded_svc.settings.language.trim() && (a = {\n guestUserLang: embedded_svc.settings.language\n });\n a.eswConfigDeveloperName = embedded_svc.settings.eswConfigDevName;\n return a\n };\n d.prototype.adjustCommunityStorageDomain = function() {\n this.isCommunityDomain(this.settings.storageDomain) && this.settings.storageDomain === document.domain && (this.settings.storageDomain = this.settings.storageDomain + \"/\" + window.location.pathname.split(\"/\")[1])\n };\n d.prototype.loadLightningOutScripts = function(a) {\n if (\"function\" !== typeof Promise) this.loadScriptFromDirectory(\"common\",\n \"promisepolyfill\",\n function() {\n return this.loadLightningOutScripts(a)\n }.bind(this), !0);\n else return new Promise(function(b, c) {\n try {\n var e = a && a.baseCoreURL ? a.baseCoreURL : embedded_svc.settings.baseCoreURL;\n if (window.$Lightning) b(\"Lightning Out is already loaded on this page.\");\n else if (embedded_svc.utils.isCommunityOrSite()) b(\"Communities context does not require Lightning Out to use Embedded Service.\");\n else if (e) {\n var f = document.createElement(\"script\");\n f.type = \"text/javascript\";\n f.src = e + \"/lightning/lightning.out.js\";\n f.onload = function() {\n b(\"Lightning Out scripts loaded.\")\n };\n document.getElementsByTagName(\"head\")[0].appendChild(f)\n }\n } catch (h) {\n c(h)\n }\n })\n };\n d.prototype.instantiateLightningOutApplication = function(a) {\n if (\"function\" !== typeof Promise) this.loadScriptFromDirectory(\"common\", \"promisepolyfill\", function() {\n return this.instantiateLightningOutApplication(a)\n }.bind(this), !0);\n else return new Promise(function(b, c) {\n try {\n var e = a && a.communityEndpointURL ? a.communityEndpointURL : embedded_svc.settings.communityEndpointURL;\n var f = a &&\n a.oauthToken ? a.oauthToken : embedded_svc.settings.oauthToken;\n var h = a && a.paramsObj ? a.paramsObj : embedded_svc.getLightningOutParamsObj() || void 0;\n embedded_svc.utils.isCommunityOrSite() ? b(\"Communities context already has an Aura context.\") : window.$Lightning && $Lightning.use(\"embeddedService:sidebarApp\", function() {\n b(\"Lightning Out application request complete.\")\n }, e, f, h)\n } catch (g) {\n c(g)\n }\n })\n };\n d.prototype.createEmbeddedServiceComponent = function(a) {\n if (\"function\" !== typeof Promise) this.loadScriptFromDirectory(\"common\",\n \"promisepolyfill\",\n function() {\n return this.createEmbeddedServiceComponent(a)\n }.bind(this), !0);\n else return new Promise(function(b, c) {\n var e = a && a.chatAPISettings ? embedded_svc.validateStartChatAttributes(a.chatAPISettings) : {};\n try {\n var f = a && a.attributes ? a.attributes : {\n configurationData: embedded_svc.settings,\n chatAPISettings: e\n };\n var h = a && a.locator ? a.locator : embedded_svc.settings.targetElement;\n embedded_svc.preparePageForSidebar();\n window.$Lightning && !document.querySelector(\".embeddedServiceSidebar\") ? $Lightning.ready($Lightning.createComponent.bind(this,\n \"embeddedService:sidebar\", f, h,\n function(g, k, n) {\n \"SUCCESS\" === k ? embedded_svc.utils.addEventHandler(\"afterInitialization\", function() {\n b(\"Embedded Service component created.\")\n }) : c(n)\n })) : embedded_svc.utils.isCommunityOrSite() ? window.dispatchEvent(new CustomEvent(\"embeddedServiceCreateSidebar\", {\n detail: {\n componentAttributes: f,\n resolve: b,\n reject: c\n }\n })) : \"undefined\" === typeof window.$Lightning ? b(\"Lightning Out should be loaded on this page before creating the Embedded Service component.\") : b(\"Embedded Service component already exists.\")\n } catch (g) {\n c(g)\n }\n })\n };\n d.prototype.bootstrapEmbeddedService = function(a) {\n if (\"function\" !== typeof Promise) this.loadScriptFromDirectory(\"common\", \"promisepolyfill\", function() {\n return embedded_svc.bootstrapEmbeddedService(a)\n }, !0);\n else return new Promise(function(b, c) {\n try {\n embedded_svc.loadLightningOutScripts(a).then(function() {\n embedded_svc.instantiateLightningOutApplication(a).then(function() {\n embedded_svc.createEmbeddedServiceComponent(a).then(function() {\n window.requestAnimationFrame(function() {\n embedded_svc.hideHelpButton();\n b(\"Embedded Service application and component bootstrapped.\")\n })\n })\n })\n })\n } catch (e) {\n c(e)\n }\n })\n };\n d.prototype.validateStartChatAttributes = function(a) {\n var b = (a = a ? a : {}) && a.prepopulatedPrechatFields ? a.prepopulatedPrechatFields : {},\n c = a && a.extraPrechatInfo ? a.extraPrechatInfo : [],\n e = a && a.extraPrechatFormDetails ? a.extraPrechatFormDetails : [],\n f = a && a.fallbackRouting ? a.fallbackRouting : [],\n h = a && a.directToButtonRouting ? a.directToButtonRouting : void 0,\n g = {\n buttonId: a && a.buttonId ? a.buttonId : void 0,\n userId: a && a.userId ? a.userId : void 0,\n fallback: a && \"boolean\" === typeof a.fallback ? a.fallback : void 0\n };\n if (\"object\" === typeof b) a.prepopulatedPrechatFields =\n b;\n else throw Error(\"Validation failed for prepopulatedPrechatFields, received: \" + b);\n if (Array.isArray(e)) a.extraPrechatFormDetails = e;\n else throw Error(\"Validation failed for extraPrechatFormDetails, received: \" + e);\n if (Array.isArray(c)) a.extraPrechatInfo = c;\n else throw Error(\"Validation failed for extraPrechatInfo, received: \" + c);\n if (Array.isArray(f)) a.fallbackRouting = f;\n else throw Error(\"Validation failed for fallbackRouting, received: \" + f);\n \"function\" === typeof h ? a.directToButtonRouting = h : embedded_svc.log(\"Did not receive an actionable parameter for directToButtonRouting, received: \" +\n h);\n if (\"object\" === typeof g)\n if (a.directToAgentRouting = g, g.buttonId)\n if (\"string\" === typeof g.buttonId && g.buttonId.trim().length) a.directToAgentRouting.buttonId = g.buttonId.trim(), a.directToAgentRouting.fallback = g.fallback, g.userId && (\"string\" === typeof g.userId && g.userId.trim().length ? a.directToAgentRouting.userId = g.userId.trim() : embedded_svc.log(\"Did not receive an actionable parameter for directToAgentRouting's userId, received: \" + g.userId));\n else throw Error(\"Validation failed for directToAgentRouting's buttonId, received: \" +\n g.buttonId);\n else embedded_svc.log(\"Did not receive an actionable parameter for directToAgentRouting's buttonId, received: \" + g.buttonId);\n else throw Error(\"Validation failed for directToAgentRouting, received: \" + g);\n return a\n };\n d.prototype.isInternetExplorer = function() {\n return \"ActiveXObject\" in window\n };\n d.prototype.outputToConsole = function(a, b, c) {\n if ((c || this.settings.devMode) && console && console[a]) console[a](\"[Snap-ins] \" + (Array.isArray(b) ? b.join(\", \") : b))\n };\n d.prototype.log = function() {\n this.outputToConsole(\"log\",\n [].slice.apply(arguments))\n };\n d.prototype.error = function(a, b) {\n a ? this.outputToConsole(\"error\", a, b) : this.outputToConsole(\"error\", \"esw responed with an unspecified error.\", b);\n embedded_svc.utils.fireEvent(\"error\")\n };\n d.prototype.warning = function(a, b) {\n a ? this.outputToConsole(\"warn\", \"Warning: \" + a, b) : this.outputToConsole(\"warn\", \"esw sent an anonymous warning.\", b)\n };\n d.prototype.deprecated = function(a) {\n this.warning(a + \" is deprecated in version \" + Number(\"5.0\").toFixed(1) + \" and will be removed in version \" + (Number(\"5.0\") +\n 1).toFixed(1))\n };\n d.prototype.getCookie = function(a) {\n var b = document.cookie;\n if (b) {\n var c = b.indexOf(a + \"=\");\n if (-1 !== c) return c += (a + \"=\").length, a = b.indexOf(\";\", c), -1 === a && (a = b.length), b.substring(c, a)\n }\n };\n d.prototype.setCookie = function(a, b, c) {\n a = a + \"=\" + b + \";\";\n c && (c = new Date, c.setFullYear(c.getFullYear() + 10), a += \"expires=\" + c.toUTCString() + \";\");\n document.cookie = a + \"path=/;\"\n };\n d.prototype.mergeSettings = function(a) {\n Object.keys(a).forEach(function(b) {\n void 0 === this.settings[b] && (this.settings[b] = a[b])\n }.bind(this))\n };\n d.prototype.loadFeatureScript =\n function(a, b) {\n var c = decodeURI(a).toLowerCase(); - 1 === a.indexOf(\"..\") ? this.loadScriptFromDirectory(\"client\", c + \".esw\", function() {\n this.featureScripts[a](this);\n this.availableFeatures.push(c);\n embedded_svc.utils.fireEvent(\"featureLoaded\", void 0, a);\n b && b();\n this.processPendingMessages(c)\n }.bind(this)) : this.error('\"' + a + '\" is not a valid feature name.')\n };\n d.prototype.fireEvent = function(a, b) {\n var c = [].slice.apply(arguments).slice(2);\n if (window.embedded_svc && embedded_svc.utils) return embedded_svc.utils.fireEvent(a,\n b, c);\n this.error(\"fireEvent should not be called before calling init!\");\n return !0\n };\n d.prototype.isValidEntityId = function(a) {\n return \"string\" === typeof a && (18 === a.length || 15 === a.length)\n };\n d.prototype.getKeyPrefix = function(a) {\n if (this.isValidEntityId(a)) return a.substr(0, 3)\n };\n d.prototype.isOrganizationId = function(a) {\n return \"00D\" === this.getKeyPrefix(a)\n };\n d.prototype.getESWFrame = function() {\n var a = document.getElementById(\"esw_storage_iframe\");\n !this.eswFrame && a && (this.eswFrame = a.contentWindow);\n return this.eswFrame\n };\n d.prototype.isFrameStorageEnabled = function() {\n this.deprecated(\"isFrameStorageEnabled\");\n return !0\n };\n d.prototype.processPendingMessages = function(a) {\n this.pendingMessages[a] && (this.pendingMessages[a].forEach(function(b) {\n this.handleMessage(b.payload)\n }.bind(this)), this.pendingMessages[a] = void 0)\n };\n d.prototype.loadCSS = function() {\n var a = document.createElement(\"link\");\n a.href = (this.settings.gslbBaseURL ? this.settings.gslbBaseURL : this.settings.baseCoreURL) + \"/embeddedservice/\" + this.settings.releaseVersion + \"/esw\" + (this.settings.devMode ?\n \"\" : \".min\") + \".css\";\n a.type = \"text/css\";\n a.rel = \"stylesheet\";\n document.getElementsByTagName(\"head\")[0].appendChild(a)\n };\n d.prototype.appendHelpButton = function(a) {\n var b = document.createElement(\"div\"),\n c = \"\";\n b.className = \"embeddedServiceHelpButton\";\n this.isLanguageRtl(this.settings.language) && this.isDesktop() && (c = 'dir=\"rtl\"');\n b.innerHTML = '
        ';\n a || (b.style.display = \"none\");\n this.settings.hasBottomTabBar && b.classList.add(\"embeddedServiceBottomTabBar\");\n this.settings.targetElement.appendChild(b);\n this.setHelpButtonText(this.settings.defaultMinimizedText);\n \"ontouchstart\" in document.documentElement && [].slice.apply(document.querySelectorAll(\".embeddedServiceHelpButton .uiButton\")).forEach(function(e) {\n e.classList.add(\"no-hover\")\n });\n this.onButtonStatusChange()\n };\n d.prototype.appendIFrame = function() {\n var a = document.createElement(\"iframe\"),\n b = {};\n a.id = \"esw_storage_iframe\";\n a.src = this.settings.iframeURL;\n a.style.display = \"none\";\n a.title = \"Live Chat Metadata\";\n a.onload = function() {\n var c = this.getESWFrame();\n this.isIframeReady = !0;\n this.outboundMessagesAwaitingIframeLoad.forEach(function(e) {\n c.postMessage(e, this.settings.iframeURL)\n }.bind(this));\n this.outboundMessagesAwaitingIframeLoad = [];\n this.iframeScriptsToLoad.forEach(function(e) {\n this.loadStorageScript(e)\n }.bind(this));\n b.deploymentId =\n this.settings.deploymentId;\n b.isSamePageNavigation = this.isSamePageNavigation();\n b.isRefresh = 1 === window.performance.navigation.type;\n this.postMessage(\"session.updateStorage\", b);\n this.iframeScriptsToLoad = []\n }.bind(this);\n this.settings.targetElement.appendChild(a);\n window.addEventListener(\"beforeunload\", function(c) {\n this.isInternetExplorer() && (a.src = \"about:blank\");\n if (this.warnOnBeforeUnload && this.componentLoaded)\n if (embedded_svc.utils.fireEvent(\"snapinsCloseSessionWarning\"), this.settings.closeSessionWarning &&\n \"function\" === typeof this.settings.closeSessionWarning) this.settings.closeSessionWarning();\n else return (c || window.event).returnValue = \"You might lose the active chat session if you close this tab. Are you sure?\"\n }.bind(this), !1)\n };\n d.prototype.preparePageForSidebar = function() {\n document.getElementById(\"snapins_invite\") && embedded_svc.inviteAPI && embedded_svc.inviteAPI.inviteButton.setOnlineState(!1);\n embedded_svc.utils.fireEvent(\"beforeCreate\");\n Object.keys(this.settings).forEach(function(a) {}.bind(this));\n this.mergeSettings(this.defaultSettings)\n };\n d.prototype.createLightningComponent = function(a) {\n this.preparePageForSidebar();\n this.createEmbeddedServiceComponent({\n attributes: {\n configurationData: this.settings,\n serializedSessionData: a\n },\n locator: this.settings.targetElement\n }).then(function() {\n this.hideHelpButton();\n this.componentInitInProgress = !1;\n this.componentLoaded = !0;\n embedded_svc && embedded_svc.liveAgentAPI && embedded_svc.liveAgentAPI.ping();\n embedded_svc.utils.fireEvent(\"ready\")\n }.bind(this))\n };\n d.prototype.loadLightningApp = function(a) {\n var b;\n if (this.settings.isExternalPage &&\n \"string\" !== typeof this.settings.communityEndpointURL) throw Error(\"communityEndpointURL String property not set\");\n if (b = document.getElementsByClassName(\"helpButton\")[0]) {\n var c = b.getBoundingClientRect().width;\n 0 < c && (b.style.width = c + \"px\")\n }\n this.setHelpButtonText(this.settings.loadingText, !1);\n this.instantiateLightningOutApplication({\n communityEndpointURL: this.settings.communityEndpointURL,\n oauthToken: this.auth.oauthToken\n }).then(this.createLightningComponent.bind(this, a))\n };\n d.prototype.initLightningOut = function(a) {\n this.hasSessionDataLoaded &&\n (\"function\" !== typeof Promise ? this.loadScriptFromDirectory(\"common\", \"promisepolyfill\", function() {\n this.initLightningOut(a)\n }.bind(this), !0) : this.loadLightningOutScripts().then(this.loadLightningApp.bind(this, a)))\n };\n d.prototype.setHelpButtonText = function(a, b) {\n var c = void 0 === this.settings.showIcon ? !0 : this.settings.showIcon;\n b = void 0 === b ? c : b;\n c = document.getElementById(\"helpButtonSpan\");\n if (c) {\n var e = c.querySelector(\".message\");\n e.innerHTML = a;\n if (a = c.parentElement.querySelector(\".embeddedServiceIcon\")) a.style.display =\n b ? \"inline-block\" : \"none\"\n }\n };\n d.prototype.prepareDOM = function() {\n this.domInitInProgress || (this.domInitInProgress = !0, this.appendIFrame())\n };\n d.prototype.addSessionHandlers = function() {\n this.addMessageHandler(\"session.onLoad\", function() {\n this.postMessage(\"session.get\", this.storageKeys)\n }.bind(this));\n this.addMessageHandler(\"session.sessionData\", function(a) {\n this.alwaysWarnOnBeforeUnload = !a;\n this.resumeInitWithSessionData(a || {})\n }.bind(this));\n this.addMessageHandler(\"session.deletedSessionData\", function(a) {\n -1 < a.indexOf(\"CHASITOR_SERIALIZED_KEY\") &&\n (this.loginPendingSerializedData = void 0)\n }.bind(this));\n this.addMessageHandler(\"session.updatePrimary\", function(a) {\n a && (a.isPrimary ? sessionStorage.setItem(this.settings.storageDomain + \"MASTER_DEPLOYMENT_ID\", this.settings.deploymentId) : sessionStorage.removeItem(this.settings.storageDomain + \"MASTER_DEPLOYMENT_ID\"), this.warnOnBeforeUnload = this.alwaysWarnOnBeforeUnload || 1 < a.activeChatSessions && a.isPrimary, embedded_svc && embedded_svc.liveAgentAPI && (embedded_svc.liveAgentAPI.browserSessionInfo = a))\n }.bind(this))\n };\n d.prototype.addMetaTag = function(a, b) {\n var c = document.createElement(\"meta\");\n c.name = a;\n c.content = b;\n document.head.appendChild(c)\n };\n d.prototype.init = function(a, b, c, e, f, h) {\n this.settings.baseCoreURL = a;\n this.settings.communityEndpointURL = b;\n this.settings.gslbBaseURL = c ? c : a;\n this.settings.orgId = e;\n this.settings.releaseVersion = \"5.0\";\n this.settings.eswConfigDevName = f;\n this.mergeSettings(h || {});\n this.adjustCommunityStorageDomain();\n if (\"string\" !== typeof this.settings.baseCoreURL) throw Error(\"Base core URL value must be a string.\");\n if (!this.isOrganizationId(this.settings.orgId)) throw Error(\"Invalid OrganizationId Parameter Value: \" + this.settings.orgId);\n embedded_svc.utils ? this.finishInit() : this.loadScriptFromDirectory(\"utils\", \"common\", this.finishInit.bind(this))\n };\n d.prototype.finishInit = function() {\n this.storedEventHandlers && (Object.getOwnPropertyNames(this.storedEventHandlers).forEach(function(a) {\n this.storedEventHandlers[a].forEach(function(b) {\n embedded_svc.utils.addEventHandler(a, b)\n })\n }.bind(this)), this.storedEventHandlers = {});\n if (!embedded_svc.utils.fireEvent(\"validateInit\", function(a) {\n return -1 !== a.indexOf(!1)\n }, this.settings)) {\n this.checkForNativeFunctionOverrides();\n this.settings.appendHelpButton && this.loadCSS();\n if (!this.settings.targetElement) throw Error(\"No targetElement specified\");\n this.settings.iframeURL = this.settings.gslbBaseURL + \"/embeddedservice/\" + this.settings.releaseVersion + (this.settings.devMode ? \"/eswDev.html\" : \"/esw.html\") + \"?parent=\" + document.location.href;\n this.addSessionHandlers();\n this.loadFeatures(this.onFeatureScriptsLoaded.bind(this));\n this.settings.hasBottomTabBar = this.isUseriOS15plusSafari ? this.isUseriOS15plusSafari() : !1;\n embedded_svc.utils.fireEvent(\"afterInit\", void 0, this.settings)\n }\n };\n d.prototype.onFeatureScriptsLoaded = function() {\n \"complete\" === document.readyState ? setTimeout(this.prepareDOM.bind(this), 1) : document.addEventListener ? (document.addEventListener(\"DOMContentLoaded\", this.prepareDOM.bind(this), !1), window.addEventListener(\"load\", this.prepareDOM.bind(this), !1)) : window.attachEvent ? window.attachEvent(\"onload\", this.prepareDOM.bind(this)) :\n this.log(\"No available event model. Exiting.\")\n };\n d.prototype.checkForNativeFunctionOverrides = function() {\n [{\n name: \"document\",\n object: document,\n functions: \"addEventListener createAttribute createComment createDocumentFragment createElementNS createTextNode createRange getElementById getElementsByTagName getElementsByClassName querySelector querySelectorAll removeEventListener\".split(\" \")\n }, {\n name: \"window\",\n object: window,\n functions: \"addEventListener clearTimeout dispatchEvent open removeEventListener requestAnimationFrame setInterval setTimeout\".split(\" \")\n }].forEach(function(a) {\n a.functions.forEach(function(b) {\n b in\n a.object && !this.isNativeFunction(a.object, b) && this.warning(\"Embedded Service Chat may not function correctly with this native JS function modified: \" + a.name + \".\" + b, !0)\n }.bind(this))\n }.bind(this))\n };\n d.prototype.isNativeFunction = function(a, b) {\n return Function.prototype.toString.call(a[b]).match(/\\[native code\\]/)\n };\n d.prototype.isUseriOS15plusSafari = function() {\n var a = !!navigator.userAgent.match(/iP(hone|ad|od)/i),\n b = navigator.userAgent.match(/(?!=OS)(([0-9]){2})/i);\n b = b && 0 < b.length ? Number(b[0]) : -1;\n var c = !!navigator.userAgent.match(/WebKit/i) &&\n !navigator.userAgent.match(/CriOS/i);\n return a && c && 15 <= b\n };\n d.prototype.onHelpButtonClick = function() {\n if (!this.componentInitInProgress && !document.getElementsByClassName(\"embeddedServiceSidebar\").length) {\n this.componentInitInProgress = !0;\n try {\n embedded_svc.utils.isCommunityOrSite() && 0 < Object.keys(embedded_svc.liveAgentAPI.inviteButton).length ? window.dispatchEvent(new CustomEvent(\"onStartChatFromInvitation\"), {\n detail: {\n bubbles: !0,\n composed: !1\n }\n }) : (this.checkAuthentication(), embedded_svc.utils.fireEvent(\"onHelpButtonClick\"))\n } catch (a) {\n throw this.componentInitInProgress = !1, a;\n }\n }\n };\n d.prototype.resumeInitWithSessionData = function(a) {\n var b = embedded_svc.utils.fireEvent(\"sessionDataRetrieved\", function(f) {\n return -1 !== f.indexOf(!0)\n }, a),\n c = !1,\n e = !1;\n this.settings.linkAction.valid ? c = !0 : b ? (this.log(\"Existing session found. Continuing with data: \" + a), e = c = !0, embedded_svc.menu && embedded_svc.menu.hideTopContainer()) : this.componentInitInProgress && (c = !0);\n this.hasSessionDataLoaded = !0;\n a.ESW_OAUTH_TOKEN && (this.auth.oauthToken = a.ESW_OAUTH_TOKEN);\n this.loginPendingSerializedData = e ? a : void 0;\n c && (this.componentInitInProgress = !0, this.checkAuthentication());\n this.settings.appendHelpButton && this.appendHelpButton(this.settings.displayHelpButton && !b)\n };\n d.prototype.checkAuthentication = function() {\n this.isAuthenticationRequired && !this.settings.allowGuestUsers ? this.auth.oauthToken ? (this.loginButtonPressed || this.componentInitInProgress) && this.initLightningOut(this.loginPendingSerializedData) : embedded_svc.utils.fireEvent(\"requireauth\") : (this.loginButtonPressed || this.componentInitInProgress) && this.initLightningOut(this.loginPendingSerializedData)\n };\n d.prototype.postMessage = function(a, b) {\n a = {\n domain: this.settings.storageDomain,\n data: b,\n method: a\n };\n (b = this.getESWFrame()) ? b.postMessage(a, this.settings.iframeURL): this.outboundMessagesAwaitingIframeLoad.push(a)\n };\n d.prototype.setSessionData = function(a, b) {\n if (\"object\" === typeof a) var c = a;\n else c = {}, c[a] = b;\n this.postMessage(\"session.set\", c)\n };\n d.prototype.deleteSessionData = function(a) {\n a = Array.isArray(a) ? a : [a];\n this.postMessage(\"session.delete\", a)\n };\n d.prototype.defineFeature = function(a, b) {\n this.featureScripts[a] = b\n };\n d.prototype.registerStorageKeys = function(a) {\n \"string\" === typeof a ? this.storageKeys.push(a) : a.forEach(function(b) {\n this.storageKeys.push(b)\n }.bind(this))\n };\n d.prototype.addMessageHandler = function(a, b) {\n this.messageHandlers[a] || (this.messageHandlers[a] = []);\n this.messageHandlers[a].push(b)\n };\n var p = \"liveagent.chatCanceledOnDifferentTab liveagent.fileTransfer.resetFileSelector liveagent.fileTransfer.uploadFile session.deletedSessionData session.onLoad session.sessionData session.updateMaster\".split(\" \");\n d.prototype.clearMessageHandlers =\n function() {\n Object.keys(this.messageHandlers).filter(function(a) {\n return -1 === p.indexOf(a)\n }).forEach(function(a) {\n this.messageHandlers[a] = []\n }.bind(this))\n };\n d.prototype.loadStorageScript = function(a) {\n this.isIframeReady ? this.postMessage(\"script.load\", a) : this.iframeScriptsToLoad.push(a)\n };\n d.prototype.loadScriptFromDirectory = function(a, b, c, e) {\n b = b.toLowerCase();\n var f = document.createElement(\"script\"),\n h = this.settings.gslbBaseURL,\n g = b.replace(\".\", \"-\") + \"-script\";\n f.id = g;\n f.type = \"text/javascript\";\n f.src = [h, \"embeddedservice\",\n e ? void 0 : this.settings.releaseVersion, a, b + (this.settings.devMode ? \"\" : \".min\") + \".js\"\n ].filter(function(k) {\n return !!k\n }).join(\"/\");\n c && (f.onload = c);\n document.body.appendChild(f)\n };\n d.prototype.loadFeatures = function(a) {\n this.settings.enabledFeatures.forEach(function(b) {\n \"base\" !== b && -1 === this.availableFeatures.indexOf(b.toLowerCase()) && this.loadFeatureScript(b, a)\n }.bind(this))\n };\n d.prototype.addEventHandler = function(a, b) {\n window.embedded_svc && embedded_svc.utils ? embedded_svc.utils.addEventHandler(a, b) : (this.storedEventHandlers[a] ||\n (this.storedEventHandlers[a] = []), this.storedEventHandlers[a].push(b))\n };\n d.prototype.setupMessageListener = function() {\n window.addEventListener(\"message\", function(a) {\n var b = a.data,\n c = a.origin.split(\":\")[1].replace(\"//\", \"\");\n b && b.method && embedded_svc.isMessageFromSalesforceDomain(c) && (\"session.onLoad\" === b.method && -1 === this.settings.iframeURL.indexOf(c) && (c = this.settings.iframeURL.split(\"/\")[2], a = a.origin.split(\"/\")[2], this.settings.iframeURL = this.settings.iframeURL.replace(c, a)), a = b.method.split(\".\")[0].toLowerCase(),\n -1 === this.availableFeatures.indexOf(a) ? (this.pendingMessages[a] || (this.pendingMessages[a] = []), this.pendingMessages[a].push({\n direction: \"incoming\",\n payload: b\n })) : this.handleMessage(b))\n }.bind(this), !1)\n };\n d.prototype.handleMessage = function(a) {\n var b = this.messageHandlers[a.method];\n b ? b.forEach(function(c) {\n c(a.data)\n }) : this.log(\"Unregistered method \" + a.method + \" received.\")\n };\n d.prototype.isMessageFromSalesforceDomain = function(a) {\n if (embedded_svc.utils.isCommunityOrSite() && a === document.domain) return !0;\n var b = function(c,\n e) {\n return -1 !== c.indexOf(e, c.length - e.length)\n };\n return m.some(function(c) {\n return b(a, c)\n })\n };\n d.prototype.isCommunityDomain = function(a) {\n return \".force.com\" === a.substr(-10)\n };\n d.prototype.isSamePageNavigation = function() {\n var a = document.domain;\n if (this.isCommunityDomain(document.domain)) {\n var b = a + \"/\" + window.location.pathname.split(\"/\")[1];\n b === this.settings.storageDomain && (a = b)\n }\n return a.substr(-this.settings.storageDomain.length) === this.settings.storageDomain\n };\n d.prototype.addDefaultSetting = function(a, b) {\n this.defaultSettings[a] =\n b\n };\n d.prototype.onButtonStatusChange = function() {\n var a = document.querySelector(\".embeddedServiceHelpButton button\"),\n b;\n if (embedded_svc.menu) embedded_svc.menu.onAgentAvailabilityChange();\n a && (b = a.querySelector(\".message\")) && (this.isButtonDisabled ? (a.onclick = function() {}, a.classList.remove(\"helpButtonEnabled\"), a.classList.add(\"helpButtonDisabled\"), b.innerHTML = this.settings.disabledMinimizedText) : (a.onclick = this.onHelpButtonClick.bind(this), a.classList.remove(\"helpButtonDisabled\"), a.classList.add(\"helpButtonEnabled\"),\n b.innerHTML = this.settings.defaultMinimizedText))\n };\n d.prototype.hideHelpButton = function() {\n var a = document.querySelector(\".embeddedServiceHelpButton\");\n a && (a.style.display = \"none\")\n };\n d.prototype.showHelpButton = function() {\n var a = document.querySelector(\".embeddedServiceHelpButton\");\n a && (a.style.display = \"\")\n };\n d.prototype.setDefaultButtonText = function(a, b, c, e) {\n this.settings.entryFeature === a && (this.settings.defaultMinimizedText = this.settings.defaultMinimizedText || b, this.settings.disabledMinimizedText = this.settings.disabledMinimizedText ||\n c, this.settings.defaultAssistiveText = this.settings.defaultAssistiveText || e || \"\")\n };\n d.prototype.setDefaultShowIcon = function(a, b) {\n this.settings.entryFeature === a && void 0 === this.settings.showIcon && (this.settings.showIcon = b)\n };\n d.prototype.registerLinkAction = function(a, b) {\n var c = this.settings.linkAction;\n this.validLinkActions[a] || (this.validLinkActions[a] = []); - 1 === this.validLinkActions[a].indexOf(b) && this.validLinkActions[a].push(b);\n c.feature && c.name && c.feature.toLowerCase() === a.toLowerCase() && c.name.toLowerCase() ===\n b.toLowerCase() && (c.valid = !0, c.feature = a, this.settings.entryFeature = a)\n };\n d.prototype.setLinkAction = function(a, b, c) {\n var e = Object.keys(this.validLinkActions).filter(function(f) {\n return f.toLowerCase() === a.toLowerCase()\n })[0];\n e ? (this.settings.linkAction.feature = e, this.settings.linkAction.name = this.validLinkActions[e].filter(function(f) {\n return f.toLowerCase() === b.toLowerCase()\n })[0], this.settings.linkAction.valid = void 0 !== this.settings.linkAction.name, this.settings.linkActionParameters = c) : this.settings.linkAction.valid = !1\n };\n d.prototype.getLinkActionData = function() {\n window.location.search.replace(/([a-zA-Z0-9._]+)=([^&\\s]+)/g, function(a, b, c) {\n a = b.toLowerCase();\n 0 === a.indexOf(\"snapins.\") && (a = a.replace(\"snapins.\", \"\"), \"action\" === a ? (c = c.split(\".\"), 2 === c.length && (this.settings.linkAction.feature = c[0], this.settings.linkAction.name = c[1])) : this.settings.linkActionParameters[a.toLowerCase()] = c)\n }.bind(this))\n };\n d.prototype.requireAuthentication = function() {\n var a = document.createElement(\"script\"),\n b = document.createElement(\"style\"),\n c = document.querySelector(this.settings.loginTargetQuerySelector);\n this.isAuthenticationRequired = !0;\n if (\"https:\" !== window.location.protocol && !this.settings.devMode) throw this.settings.displayHelpButton = !1, Error(\"Snap-in authentication requires HTTPS.\");\n if (!this.settings.useCustomAuthentication) {\n if (!this.settings.loginClientId || !this.settings.loginRedirectURL || !this.settings.loginTargetQuerySelector) throw Error(\"Authentication in Snap-ins requires these valid settings params: loginClientId, loginRedirectURL, loginTargetQuerySelector.\");\n if (c) this.loginButtonPressed = !1, c.addEventListener(\"click\", function() {\n this.loginButtonPressed = !0\n }.bind(this));\n else throw Error(\"loginTargetQuerySelector is not a valid DOM element.\");\n this.addMetaTag(\"salesforce-community\", this.settings.communityEndpointURL);\n this.addMetaTag(\"salesforce-client-id\", this.settings.loginClientId);\n this.addMetaTag(\"salesforce-redirect-uri\", this.settings.loginRedirectURL);\n this.addMetaTag(\"salesforce-mode\", \"popup\");\n this.addMetaTag(\"salesforce-target\", this.settings.loginTargetQuerySelector);\n this.addMetaTag(\"salesforce-login-handler\", \"__snapinsLoginCallback\");\n this.addMetaTag(\"salesforce-logout-handler\", \"__snapinsLogoutCallback\");\n embedded_svc.utils.addEventHandler(\"requireauth\", function() {\n var e = setInterval(function() {\n window.SFIDWidget && (clearInterval(e), window.SFIDWidget.openid_response ? window.__snapinsLoginCallback() : window.SFIDWidget.login())\n }, 100)\n });\n embedded_svc.utils.addEventHandler(\"autherror\", function(e) {\n if (window.SFIDWidget) {\n this.loginButtonPressed = !0;\n window.SFIDWidget.logout();\n var f = setInterval(function() {\n window.SFIDWidget.config && (clearInterval(f), embedded_svc.utils.fireEvent(\"requireauth\"))\n }.bind(this, f), 100)\n }\n }.bind(this));\n window.__snapinsLoginCallback = function() {\n var e = document.querySelector(this.settings.loginTargetQuerySelector),\n f = document.createElement(\"button\");\n if (this.loginButtonPressed || this.componentInitInProgress) e.innerHTML = \"\";\n f.className = \"authenticationStart\";\n f.innerHTML = this.settings.authenticationStartLabel;\n f.addEventListener(\"click\", this.onHelpButtonClick.bind(this));\n e.appendChild(f);\n this.auth.oauthToken = window.SFIDWidget.openid_response.access_token\n }.bind(this);\n window.__snapinsLogoutCallback = function() {\n this.auth.oauthToken = void 0;\n window.SFIDWidget.init()\n }.bind(this);\n document.head.appendChild(b);\n b.sheet.insertRule(\".sfid-logout { display: none; }\", 0);\n a.type = \"text/javascript\";\n a.src = this.settings.communityEndpointURL + \"/servlet/servlet.loginwidgetcontroller?type=javascript_widget\" + (embedded_svc.settings.devMode ? \"&min=false\" : \"\");\n document.head.appendChild(a)\n }\n };\n d.prototype.requireSLDS =\n function() {\n this.settings.requireSLDS = !0;\n if (this.settings.targetElement === document.body) {\n var a = document.createElement(\"div\");\n a.id = \"esw-snapin-target\";\n document.body.appendChild(a);\n this.settings.targetElement = a\n }\n this.settings.targetElement.classList.add(\"slds-scope\");\n a = document.createElement(\"link\");\n a.href = (this.settings.gslbBaseURL ? this.settings.gslbBaseURL : this.settings.baseCoreURL) + \"/embeddedservice/\" + this.settings.releaseVersion + \"/esw-slds\" + (this.settings.devMode ? \"\" : \".min\") + \".css\";\n a.type = \"text/css\";\n a.rel = \"stylesheet\";\n document.getElementsByTagName(\"head\")[0].appendChild(a)\n };\n d.prototype.validateHeaderValue = function(a) {\n return /^[0-9a-zA-Z!#$%&'*+-.^_`|~\" ]*$/g.test(a)\n };\n d.prototype.isLanguageRtl = function(a) {\n if (a && \"\" !== a.trim()) switch (a.substring(0, 2)) {\n case \"ar\":\n case \"fa\":\n case \"he\":\n case \"iw\":\n case \"ji\":\n case \"ur\":\n case \"yi\":\n return !0;\n default:\n return !1\n }\n };\n d.prototype.isDesktop = function() {\n return -1 === navigator.userAgent.indexOf(\"Mobi\")\n };\n window.embedded_svc = new d;\n Object.getOwnPropertyNames(l).forEach(function(a) {\n var b =\n l[a];\n \"object\" === b ? (window.embedded_svc[a] = {}, Object.keys(b).forEach(function(c) {\n window.embedded_svc[a][c] = b[c]\n })) : window.embedded_svc[a] = b\n })\n})(window.embedded_svc || {});\n},{}],40:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('../dialog'),\n login = require('../login'),\n validator = require('../validator'),\n iban = require('../custom/iban/iban'),\n genericSidebar = require('../generic-sidebar'),\n returnSidebar = require('../return-sidebar'),\n storelocatorController = require('../custom/storelocator'),\n mapController = require('../custom/storelocator.mapcontroller');;\n\nfunction initMap() {\n $.when(\n $.getScript(window.Urls.googleMap),\n $.Deferred(function (deferred) {\n $(deferred.resolve);\n })\n ).done(function () {\n //\n mapController.BasicMapController.api.init(window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n\n var storePageController = {\n page: 'orderdetail',\n countryField: $('#dwfrm_storelocator_country'),\n cityField: $('#dwfrm_storelocator_cityPostalCode'),\n maxdistance: $('#maxdistance'),\n clickButton: $('#store-locator-submit'),\n geolocationButton: $('.js-reserve-geolocation'),\n storeSearchFilters: ['omniReturnInStore'],\n mapController: mapController,\n customInit: function () {\n\n this.geolocationButton.on('click', function (e) {\n $('#storelocator-wrapper').prepend($('#storelocator-map'));\n $('.js-reserve-geolocation').addClass('active');\n });\n\n this.clickButton.on('click', function (e) {\n $('#storelocator-wrapper').prepend($('#storelocator-map'));\n $('.js-reserve-geolocation').removeClass('active');\n // Trigger datalayer\n $('body').trigger('return-instore:search');\n });\n\n //Show map and Adapt bounds when click Map view mobile\n $('.tab-button-map').on('click touchstart', function (e) {\n $('.tab-button').removeClass('active');\n $('.tab-button-map').addClass('active');\n $('#storelocator-map').slideDown('200');\n $('#storelocator-list').slideUp('200');\n });\n $('.tab-button-map').on('touchend', function (e) {\n if ($('#storelocator-map').is(':visible')) {\n this.mapController.BasicMapController.api.adaptZoomLevel();\n }\n });\n\n var enableStoreSearch = function () {\n if ($(this).val()) {\n $('#store-locator-submit').removeClass(\"disabled\");\n $('#dwfrm_storelocator_cityPostalCode').removeClass(\"error\");\n $('#dwfrm_storelocator_cityPostalCode').next(\"span.error\").empty();\n } else {\n $('#store-locator-submit').addClass(\"disabled\");\n $('#dwfrm_storelocator_cityPostalCode').addClass(\"error\");\n $('#dwfrm_storelocator_cityPostalCode').next(\"span.error\").html(Resources.VALIDATE_REQUIRED);\n }\n };\n\n // Listeners di eventi per validazione input\n $('#dwfrm_storelocator_cityPostalCode').change(enableStoreSearch);\n $('#dwfrm_storelocator_cityPostalCode').keyup(enableStoreSearch);\n $('#dwfrm_storelocator_cityPostalCode').blur(enableStoreSearch);\n },\n cleanErrors: function () {\n this.cityField.removeClass(\"error\");\n this.cityField.next(\"span.error\").empty();\n $('#stores-list-errorReturn').removeClass('visible');\n },\n showErrors: function () {\n this.cityField.addClass(\"error\");\n this.cityField.next(\"span.error\").html(Resources.VALIDATE_REQUIRED);\n }\n };\n $.extend(storelocatorController.storePageController, storePageController);\n storelocatorController.storePageController.init();\n\n $('.store-details-link').on('click', function (e) {\n e.preventDefault();\n dialog.open({\n url: $(e.target).attr('href')\n });\n });\n\n $('.return-type-block input[type=radio]').on('change', function () {\n switch ($(this).val()) {\n case Constants.RETURN_COURIER:\n $('.return-storelocator, .storelocator-content-tab').removeClass('active').addClass('hide');\n $('#return-address').removeClass('hide');\n break;\n case Constants.RETURN_STORE:\n $('.return-storelocator, .storelocator-content-tab').removeClass('hide').addClass('active');\n $('#return-address').addClass('hide');\n break;\n }\n });\n\n if ($('#returnStore').prop(\"checked\")) {\n $('.return-storelocator, .storelocator-content-tab').removeClass('hide').addClass('active');\n $('#return-address').addClass('hide');\n } else {\n $('.return-storelocator, .storelocator-content-tab').removeClass('active').addClass('hide');\n $('#return-address').removeClass('hide');\n }\n });\n}\n\n/**\n * @private\n * @function\n * @description Validate form for Benefeet steps\n */\n\nvar handleSubmitReturnRequest = function () {\n $('body').on('click', '#submitReturnRequest', function (event) {\n var $form = $(this).closest('form');\n if (!$form.valid()) {\n event.preventDefault();\n } else {\n // Trigger datalayer\n $('body').trigger('return-stage-completed:confirmation');\n }\n\n // Generate returned products object\n var productsJson = {\n 'products': []\n };\n $('.return-sidebar .retunedProducts').each(function () {\n var $this = $(this);\n var pid = $this.find(\"[id$='_id']\").val();\n var reason = $this.find(\"[id$='_reason']\").val();\n var quantity = $this.find(\"[id$='_quantity']\").val();\n productsJson['products'].push({\n 'id': pid,\n 'reason': reason,\n 'quantity': quantity\n });\n });\n $('[name$=\"_returnProducts\"]').val(JSON.stringify(productsJson));\n $('[name$=\"_orderId\"]').val($('input#orderId').val());\n\n if (window.SessionAttributes.IS_RETURN_IN_STORE_ACTIVE) {\n var $radio = $('#dwfrm_storelocator_cityPostalCode').closest(\"form\").find('input[name=storePickupSelection]:checked');\n if ($('#returnStore').prop(\"checked\")) {\n if ($radio.length == 0) {\n $('#stores-found-block').hasClass('hide') && $('#stores-found-block').removeClass('hide');\n $('#stores-list-errorReturn').addClass('visible');\n\n var posScrollTo = $('#stores-list-errorReturn').offset();\n // SCROLL TO ERROR MESSAGE INSTEAD OF ERROR INPUT\n $('html, body').animate({\n scrollTop: posScrollTo.top - 100\n }, 1000);\n\n event.preventDefault();\n } else {\n $('#stores-list-errorReturn').removeClass('visible');\n }\n }\n }\n });\n\n $('#ReturnCase .iban').keyup(function (event) {\n $(this).val(iban.printFormat($(this).val()));\n });\n};\n\nfunction initReturnNoteEvents() {\n var maxLength = 500;\n var notesLength = ($('#ReturnCase .notescontent').length > 0 && $('#ReturnCase .notescontent').val().length) || 0;\n updateNotesLengthCounter(notesLength, maxLength);\n\n $('#ReturnCase .input-textarea').on('keyup', function (event) {\n var notesLength = $('#ReturnCase .notescontent').val().length;\n if (notesLength > maxLength) {\n // Converting \\r\\n into a whitespace for validation safety.\n $('#ReturnCase .notescontent').val($('#ReturnCase .notescontent').val().replace(/\\r?\\n/g, ' '));\n // Updating...\n notesLength = $('#ReturnCase .notescontent').val().length;\n }\n\n updateNotesLengthCounter(notesLength, maxLength);\n if (!isNotesLengthValid(notesLength, maxLength)) {\n $(this).val($(this).val().substr(0, 500));\n notesLength = $('#ReturnCase .notescontent').val().length;\n updateNotesLengthCounter(notesLength, maxLength);\n }\n });\n};\n\nfunction isNotesLengthValid(actualLength, maxLength) {\n return 0 <= actualLength && actualLength <= maxLength;\n};\n\nfunction updateNotesLengthCounter(actualLength, maxLength) {\n $('.textcount').html(actualLength + \"/\" + maxLength);\n};\n\nfunction initUI() {\n\n // store KM select init\n $('.reserve-storelocator .custom-select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false,\n onInit: function () {\n var $parent = $(this).closest('.form-group');\n $parent.addClass('active');\n }\n });\n\n // store KM select on open\n $('.reserve-storelocator .custom-select').on('selectric-before-open', function () {\n if ($(window).width() > 1024) {\n var selectId = $(this).attr('id');\n var $selectricWrapper = $('.selectric-' + selectId);\n var $selectricOptionsWrapper = $('.selectric-' + selectId + ' .selectric-items');\n var selectricOptionHeight = $selectricOptionsWrapper.find('li:eq(0)').outerHeight();\n var selectedIndex = $(this).find('option[selected]').index();\n var gap = selectricOptionHeight * selectedIndex;\n $selectricOptionsWrapper.css({\n marginTop: -(gap + $selectricWrapper.outerHeight())\n });\n }\n });\n\n // textarea counter\n var maxLength = 500;\n $('.return-textarea label').append('0 / ' + maxLength + '');\n $('textarea').attr('maxlength', maxLength);\n $('textarea').on('keyup', function () {\n var characterCount = $(this).val().length;\n $('#textarea-counter').text(characterCount);\n });\n\n // fix checkbox error message bug\n $('#dwfrm_orderdetail_returnPolicy').on('change', function () {\n $('#dwfrm_orderdetail_returnPolicy-error').remove();\n });\n}\n\nfunction initSidebarEvents() {\n\n // return sidebar trigger\n $('.js-open-returns-sidebar').on('click', function () {\n var url = $(this).attr('data-url');\n var orderID = $('[data-order-id]').attr('data-order-id');\n var $products = $(this).closest(\".line-items\").find(\".js-product-to-return\");\n var querystring = '';\n var enableInitMap = $(this).attr('data-initmap') == 'true' ? true : false;\n\n // generate media query (products + order ID)\n $products.each(function () {\n if ($(this).is(':checked')) {\n var value = $(this).val();\n querystring = querystring ? (querystring + ',' + value) : ('?products=' + value);\n }\n });\n querystring = querystring ? (querystring + '&orderID=' + orderID) : ('?orderID=' + orderID);\n\n genericSidebar.open(url + querystring, 'dynamic', true, function () {\n if (enableInitMap) {\n initMap();\n }\n initUI();\n $('.return-sidebar').returnSidebar();\n // this prevent IOS hide back button bug\n $('.generic-sidebar-content').css('overflow-y', 'visible');\n });\n });\n\n // Enable/Disable return button\n $('.js-product-to-return').on('change', function () {\n var indexSelected = $(this).index();\n if ($(this).prev().length) {\n while ($(this).prev().attr(\"class\").includes(\"js-product-to-return\")) {\n indexSelected--;\n }\n }\n var isChecked = $('.js-product-to-return').is(\":checked\");\n var btnReturnOpenSidebar = $(this).closest('.line-items').find(\".js-open-returns-sidebar\").eq(0);\n if (isChecked) {\n btnReturnOpenSidebar.prop('disabled', false);\n } else {\n btnReturnOpenSidebar.prop('disabled', true);\n }\n });\n\n // clear geolocation input value on focus in\n $(document).on('focusin', '.citystorelocator input', function () {\n if ($('.js-reserve-geolocation').hasClass('active')) {\n $(this).val('');\n }\n });\n\n // init store dropdown\n $(document).on('click', '.js-store-result-trigger', function () {\n var storeID = $(this).attr('data-store-id');\n var $this = $(this).parents('.payandcollect-result');\n var $mapContainer = $this.find('.store-map');\n // if current dropdown is selected\n if ($this.hasClass('open')) {\n $this.removeClass('open');\n $this.find('.store-result-content').slideUp(200);\n } else {\n // close active dropdowns\n $('.payandcollect-result.open').find('.store-result-content').slideUp(200);\n $('.payandcollect-result').removeClass('open');\n // open clicked dropdown\n $this.addClass('open');\n $this.find('.store-result-content').slideDown(200);\n // move and update map\n $mapContainer.append($('#storelocator-map'));\n updateMapReserve(storeID);\n // trigger datalayer\n $('body').trigger('return-instore:dropdown');\n }\n });\n\n // Init order steps\n $('[data-order-step]').each(function (index) {\n var orderStep = parseInt($(this).attr('data-order-step'));\n if (orderStep > 0) {\n for (var i = 1; i <= orderStep; i++) {\n $('.order-steps-wrapper:not(.return-steps) [data-step=\"' + i + '\"]').eq(index).addClass('active-step');\n }\n }\n });\n\n // Init refound dropdowns\n $('.refound-dropdown-inited .return-dropdown-trigger').on('click', function () {\n $(this).parent().toggleClass('open');\n });\n}\n\n\n/**\n * @private\n * @function\n * @description Go back to the correct order history page\n */\nfunction initBackToHistory() {\n $('.revert, .accountmain-back').on('click', function (e) {\n e.preventDefault();\n window.history.back();\n });\n}\n\n\n/**\n * @private\n * @function\n * @description Binds the events of the order, address and payment pages\n */\nfunction initializeEvents() {\n login.init();\n returnSidebar.init();\n handleSubmitReturnRequest();\n validator.init();\n initReturnNoteEvents();\n initSidebarEvents();\n initBackToHistory();\n}\n\nvar orderdetail = {\n init: function () {\n initializeEvents();\n },\n initCartLogin: function () {\n login.init();\n }\n};\n\nmodule.exports = orderdetail;\n\n},{\"../custom/iban/iban\":13,\"../custom/storelocator\":15,\"../custom/storelocator.mapcontroller\":16,\"../dialog\":20,\"../generic-sidebar\":22,\"../login\":27,\"../return-sidebar\":69,\"../validator\":80}],41:[function(require,module,exports){\n'use strict';\n\nvar validator = require('../validator');\nvar\tvalidatorTask1 = require('../validatorTask1');\n\nexports.init = function () {\n\n\tvalidator.init();\n\tvalidatorTask1.init();\n\n};\n\n},{\"../validator\":80,\"../validatorTask1\":81}],42:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('../../dialog'),\n minicart = require('../../minicart'),\n page = require('../../page'),\n util = require('../../util'),\n Promise = require('promise'),\n _ = require('lodash');\n\n/**\n * @description Make the AJAX request to add an item to cart\n * @param {Element} form The form element that contains the item quantity and ID data\n * @returns {Promise}\n */\nvar addItemToCart = function (form) {\n var isEditCartPage = $('#cart-table').length;\n var $form = $(form),\n $qty = $form.find('input[name=\"Quantity\"]');\n if ($qty.length === 0 || isNaN($qty.val()) || parseInt($qty.val(), 10) === 0) {\n $qty.val('1');\n }\n\n var data = $form.serialize();\n if (isEditCartPage) {\n var data = $form.find(\"select, textarea, input\").serialize();\n }\n\n\tvar dataContainer = $(form).find('.product-addtocart-information');\n\tif(dataContainer && dataContainer.length > 0) {\n\t\tvar ordering = dataContainer.data('actionfield-list');\n\t\tif(ordering) {\n\t\t\tdata += '&ordering=' + ordering;\n\t\t}\n\t}\n \n return Promise.resolve($.ajax({\n type: 'POST',\n url: util.ajaxUrl(Urls.addProduct),\n data: data\n })).then(function (response) {\n // handle error in the response\n if (response.error) {\n throw new Error(response.error);\n } else {\n return response;\n }\n });\n};\n/**\n * @description Handler to handle the add to cart event\n */\nvar addToCart = function (e) {\n e.preventDefault();\n var isEditCartPage = $('#cart-table').length;\n\n if ( $('.pdp-selcart').length > 0) {\n // if we are not in wishlist...\n if($(\".wishlist-item-render\").length === 0){\n // we are in pdp\n if($('.pdp-swatches-size__option.selected').length===0) {\n return;\n }\n }\n } else {\n // we are in other pages\n if(!isEditCartPage && $('#size-select')[0].selectedIndex === 0){\n return;\n }\n }\n var $form = $(this).closest('form');\n if (isEditCartPage) {\n $form = $(this).parents('.pdpForm');\n }\n\n addItemToCart($form).then(function (response) {\n var $uuid = $form.find('input[name=\"uuid\"]');\n if ($uuid.length > 0 && $uuid.val().length > 0) {\n page.refresh();\n } else {\n // do not close quickview if adding individual item that is part of product set\n // @TODO should notify the user some other way that the add action has completed successfully\n if (!$(this).hasClass('sub-product-item') && $('.pdp-selcart').length === 0) {\n dialog.close(); \n }\n minicart.show(response);\n showPDPSnackbar();\n }\n \n feelAddToCart();\n }.bind(this));\n};\n\nfunction showPDPSnackbar(){\n $('.product-details-contanier')\n .append('

        ' + Resources.PRODUCT_ADDEDTOCART + '

        ');\n\n window.setTimeout(function () {\n $('.product-details-contanier .content-snackbar').remove();\n }, 5000);\n};\n\nfunction feelAddToCart(){\n\t// check browser support\n\tif( 'vibrate' in window.navigator){\n\t\tvar pattern = [400, 100, 150, 100, 55, 100, 20, 10];\n\t\twindow.navigator.vibrate(pattern);\n\t}\n};\n\n/**\n * @description Handler to handle the add all items to cart event\n */\nvar addAllToCart = function (e) {\n e.preventDefault();\n var $productForms = $('#product-set-list').find('form').toArray();\n Promise.all(_.map($productForms, addItemToCart))\n .then(function (responses) {\n dialog.close();\n // show the final response only, which would include all the other items\n minicart.show(responses[responses.length - 1]);\n });\n};\n\n/**\n * @function\n * @description Binds the click event to a given target for the add-to-cart handling\n */\nmodule.exports = function () {\n $('body').on('click', '.pdp-selcart .add-to-cart', addToCart);\n $('body').on('click', '#add-all-to-cart', addAllToCart);\n $('body').on('click', '#add-to-cart.item-editbutton', addToCart);\n};\n\n},{\"../../dialog\":20,\"../../minicart\":28,\"../../page\":29,\"../../util\":79,\"lodash\":110,\"promise\":112}],43:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n util = require('../../util');\n\nvar updateContainer = function (data) {\n var $availabilityMsg = $('#pdpMain .availability .availability-msg');\n var message; // this should be lexically scoped, when `let` is supported (ES6)\n if (!data) {\n $availabilityMsg.html(Resources.ITEM_STATUS_NOTAVAILABLE);\n return;\n }\n $availabilityMsg.empty();\n // Look through levels ... if msg is not empty, then create span el\n if (data.levels.IN_STOCK > 0) {\n if (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n // Just in stock\n message = Resources.IN_STOCK;\n } else {\n // In stock with conditions ...\n message = data.inStockMsg;\n }\n $availabilityMsg.append('

        ' + message + '

        ');\n }\n if (data.levels.PREORDER > 0) {\n if (data.levels.IN_STOCK === 0 && data.levels.BACKORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n message = Resources.PREORDER;\n } else {\n message = data.preOrderMsg;\n }\n $availabilityMsg.append('

        ' + message + '

        ');\n }\n if (data.levels.BACKORDER > 0) {\n if (data.levels.IN_STOCK === 0 && data.levels.PREORDER === 0 && data.levels.NOT_AVAILABLE === 0) {\n message = Resources.BACKORDER;\n } else {\n message = data.backOrderMsg;\n }\n $availabilityMsg.append('

        ' + message + '

        ');\n }\n if (data.inStockDate !== '') {\n $availabilityMsg.append('

        ' + String.format(Resources.IN_STOCK_DATE, data.inStockDate) + '

        ');\n }\n if (data.levels.NOT_AVAILABLE > 0) {\n if (data.levels.PREORDER === 0 && data.levels.BACKORDER === 0 && data.levels.IN_STOCK === 0) {\n message = Resources.NOT_AVAILABLE;\n } else {\n message = Resources.REMAIN_NOT_AVAILABLE;\n }\n $availabilityMsg.append('

        ' + message + '

        ');\n }\n};\n\nvar getAvailability = function () {\n ajax.getJson({\n url: util.appendParamsToUrl(Urls.getAvailability, {\n pid: $('#pid').val(),\n Quantity: $(this).val()\n }),\n callback: updateContainer\n });\n};\n\nmodule.exports = function () {\n $('#pdpMain').on('change', '.pdpForm input[name=\"Quantity\"]', getAvailability);\n};\n\n},{\"../../ajax\":4,\"../../util\":79}],44:[function(require,module,exports){\n'use strict';\nvar dialog = require('../../dialog');\nvar util = require('../../util');\nvar qs = require('qs');\nvar url = require('url');\nvar _ = require('lodash');\n\nvar zoomMediaQuery = matchMedia('(min-width: 960px)');\n\n/**\n * @description Enables the zoom viewer on the product detail page\n * @param zmq {Media Query List}\n */\n\nfunction loadZoom(zmq) {\n var $imgZoom = $('#pdpMain .main-image'),\n hiresUrl;\n\n if (!zmq) {\n zmq = zoomMediaQuery;\n }\n\n if ($imgZoom.length === 0 || dialog.isActive() || util.isMobile() || !zoomMediaQuery.matches) {\n $imgZoom.trigger('zoom.destroy');\n\n return;\n }\n\n hiresUrl = $imgZoom.attr('href');\n\n if (hiresUrl && hiresUrl !== 'null' && hiresUrl.indexOf('noimagelarge') === -1 && zoomMediaQuery.matches) {\n $imgZoom.zoom({\n url: hiresUrl\n });\n }\n}\n\nzoomMediaQuery.addListener(loadZoom);\n\n/**\n * @description Sets the main image attributes and the href for the surrounding tag\n * @param {Object} atts Object with url, alt, title\n */\n\nfunction setMainImage(atts) {\n if (!dialog.isActive() && !util.isMobile()) {\n $('#pdpMain .main-image').attr('href', atts.hires);\n }\n\n updatePinButton(atts.url);\n loadZoom();\n}\n\nfunction updatePinButton(imageUrl) {\n var pinButton = document.querySelector('.share-icon[data-share=pinterest]');\n\n if (!pinButton) {\n return;\n }\n\n var newUrl = imageUrl;\n\n if (!imageUrl) {\n newUrl = document.querySelector('#pdpMain .primary-image').getAttribute('src');\n }\n\n var href = url.parse(pinButton.href);\n var query = qs.parse(href.query);\n\n query.media = url.resolve(window.location.href, newUrl);\n query.url = window.location.href;\n\n var newHref = url.format(_.extend({}, href, {\n query: query,\n search: qs.stringify(query)\n }));\n\n pinButton.href = newHref;\n}\n\n/**\n * @description Replaces the images in the image container, for eg. when a different color was clicked.\n */\nfunction replaceImages() {\n var $newImages = $('#update-images'),\n $imageContainer = $('#pdpMain .product-image-container');\n\n if ($newImages.length === 0) {\n return;\n }\n\n $imageContainer.html($newImages.html());\n $newImages.remove();\n loadZoom();\n}\n\n/* @module image\n * @description this module handles the primary image viewer on PDP\n **/\n\n/**\n * @description by default, this function sets up zoom and event handler for thumbnail click\n **/\nmodule.exports = function() {\n // if (dialog.isActive() || util.isMobile()) {\n // $('#pdpMain .main-image').removeAttr('href');\n // }\n\n //updatePinButton();\n //loadZoom();\n\n // $('#pdpMain').on('click', '.productthumbnail', function() {\n // setMainImage($(this).data('lgimg'));\n // });\n};\nmodule.exports.loadZoom = loadZoom;\nmodule.exports.setMainImage = setMainImage;\nmodule.exports.replaceImages = replaceImages;\n\n},{\"../../dialog\":20,\"../../util\":79,\"lodash\":110,\"qs\":121,\"url\":126}],45:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('../../dialog'),\n productStoreInventory = require('../../storeinventory/product'),\n tooltip = require('../../tooltip'),\n util = require('../../util'),\n addToCart = require('./addToCart'),\n availability = require('./availability'),\n image = require('./image'),\n productNav = require('./productNav'),\n productSet = require('./productSet'),\n reserveInStore = require('./reserveInStore'),\n variant = require('./variant');\n\n/**\n * @description Initialize product detail page with reviews, recommendation and product navigation.\n */\nfunction initializeDom() {\n productNav();\n tooltip.init();\n}\n\n/**\n * @description Initialize event handlers on product detail page\n */\nfunction initializeEvents() {\n var $pdpMain = $('#pdpMain');\n\n addToCart();\n availability();\n variant();\n image();\n productSet();\n reserveInStore.initEvents();\n if (SitePreferences.STORE_PICKUP) {\n productStoreInventory.init();\n }\n\n // Add to Wishlist and Add to Gift Registry links behaviors\n $pdpMain.on('click', '[data-action=\"wishlist\"], [data-action=\"gift-registry\"]', function () {\n var data = util.getQueryStringParams($('.pdpForm').serialize());\n if (data.cartAction) {\n delete data.cartAction;\n }\n var url = util.appendParamsToUrl(this.href, data);\n this.setAttribute('href', url);\n });\n\n // product options\n $pdpMain.on('change', '.product-options select', function () {\n var salesPrice = $pdpMain.find('.product-add-to-cart .price-sales');\n var selectedItem = $(this).children().filter(':selected').first();\n salesPrice.text(selectedItem.data('combined'));\n });\n\n // prevent default behavior of thumbnail link and add this Button\n $pdpMain.on('click', '.thumbnail-link, .unselectable a', function (e) {\n e.preventDefault();\n });\n\n $('.size-chart-link a').on('click', function (e) {\n e.preventDefault();\n dialog.open({\n url: $(e.target).attr('href')\n });\n });\n}\n\nvar product = {\n initializeEvents: initializeEvents,\n init: function () {\n initializeDom();\n initializeEvents();\n }\n};\n\nmodule.exports = product;\n\n},{\"../../dialog\":20,\"../../storeinventory/product\":76,\"../../tooltip\":78,\"../../util\":79,\"./addToCart\":42,\"./availability\":43,\"./image\":44,\"./productNav\":48,\"./productSet\":49,\"./reserveInStore\":51,\"./variant\":55}],46:[function(require,module,exports){\n'use strict';\n/**\n * @description Generate a pop-up for \"Back in stock\" notification\n */\nvar ajax = require('../../ajax'),\n validator = require('../../validator'),\n genericSidebar = require('../../generic-sidebar'),\n TPromise = require('promise'),\n util = require('../../util');\n\n/* function openNotifyMeDialog(e){\n e.preventDefault();\n\n var $form = $('#notify-me-form');\n var customerEmail = $('.render-rows').attr('data-autocomplete-mail');\n\n var isSizeSelected = checkSelectedSize(e);\n if (isSizeSelected) {\n\n $('#notify-me-modal').dialog({\n dialogClass: 'dialog-notify-me-render dialog-render small',\n draggable: false,\n resizable: false,\n modal: true,\n position: {\n my: 'center',\n at: 'center',\n of: window\n },\n open: function(event) {\n validator.init();\n $form.find('input[name$=\"backinstock_email\"]').val(customerEmail);\n\n $('#sub-notify-me').on('click', function(event) {\n event.preventDefault();\n return TPromise.resolve(sendNotifyMeSubscription($form));\n });\n\n $('#notify-me-button').on('click', function(event) {\n event.preventDefault();\n return $('#notify-me-modal').dialog('close');\n });\n },\n close: function(event) {\n $('.dialog-notify-me-render').remove();\n $form.find('#render-rows').removeAttr('hidden');\n $form.find('.msg-render').attr('hidden', 'hidden');\n $form.find('#notify-me-button').addClass('d-none');\n $form.find('input').removeClass('error');\n $form.find('.input-text').val('');\n $form.find('span.error').remove();\n }\n });\n }\n}; */\n\nfunction checkSelectedSize(e) {\n var isSizeSelected = false;\n if ($(\".pdp-selcart__column__content.pdp-selcart__panel--size > ul > li.pdp-swatches-size__option.selected div\").data(\"href\")) {\n $(e.target).removeClass('error');\n isSizeSelected = true;\n } else {\n $(e.target).addClass('error');\n $(e.target).html($(e.target).data('sizecheck'));\n $('[data-selcartpanel=\"pdp-selcart__panel--size\"]').trigger('click');\n $('.size-select-error').fadeIn();\n }\n\n return isSizeSelected;\n};\n\nvar init = function () {\n $(document).on('keydown', function (event) {\n if (event.keyCode == 13) {\n $('#notify-me-form').on('submit', function (e) {\n e.preventDefault();\n });\n }\n });\n\n $('#sub-notify-me').on('click', function (event) {\n event.preventDefault();\n var $form = $('#notify-me-form');\n return TPromise.resolve(sendNotifyMeSubscription($form));\n });\n\n $('#notify-me').on('click', function (e) {\n if (checkSelectedSize(e)) {\n genericSidebar.open('#notify-me-modal', 'static', false, function () {\n validator.init();\n\n // autocomplete email\n var $form = $('#notify-me-form');\n var customerEmail = $('.render-rows').attr('data-autocomplete-mail');\n $form.find('input[name$=\"backinstock_email\"]').val(customerEmail);\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '54',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'product_notify_me_step_1',\n 'eventAction': $('.side-container').find('h1').attr('data-seo-label').replace(/ /g, '_').toLowerCase(),\n 'eventLabel': $(\".pdp-selcart__size-selected\").html().trim(),\n 'sku': $('#pid').val()\n });\n });\n }\n });\n\n};\n\nvar sendNotifyMeSubscription = function ($form) {\n if ($form.valid()) {\n var options = {\n url: util.appendParamsToUrl($form.attr('action'), {\n pid: $('#pid').val(),\n email: $form.find('input[name$=\"backinstock_email\"]').val(),\n }),\n callback: handleResponse,\n };\n ajax.getJson(options);\n }\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\n// Handles only success responses (see ajax.js definition).\nvar handleResponse = function (response) {\n //console.log(JSON.stringify(response));\n var $form = $('#notify-me-form');\n if (response.success) {\n $form.find('#render-rows').attr('hidden', 'hidden');\n $form.find('.notify-me-success').removeAttr('hidden');\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '55',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'product_notify_me_step_2',\n 'eventAction': $('.side-container').find('h1').attr('data-seo-label').replace(/ /g, '_').toLowerCase(),\n 'eventLabel': $(\".pdp-selcart__size-selected\").html().trim(),\n 'sku': $('#pid').val()\n });\n\n } else {\n if (response.exists) {\n $form.find('#render-rows').attr('hidden', 'hidden');\n $form.find('.notify-me-exists').removeAttr('hidden');\n } else {\n //response.success = false\n $form.find('#render-rows').attr('hidden', 'hidden');\n $form.find('.notify-me-error').removeAttr('hidden');\n }\n }\n $form.find('#notify-me-button').removeClass('d-none');\n};\n\nmodule.exports = {\n init: init\n};\n\n},{\"../../ajax\":4,\"../../generic-sidebar\":22,\"../../util\":79,\"../../validator\":80,\"promise\":112}],47:[function(require,module,exports){\n'use strict';\n\n\n/* static vars: */\nvar debugColor = 'color: purple; font-weight: bold;';\nvar columnsPadding = 20;\nvar paletteMarginLeft = 20 ;\nvar excessPalettesClassName = 'pdp-attribute--hidden';\nvar openerUiClassName = 'pdp-swatches-color__opener';\nvar colorWrapper = '.pdp-selcart__column';\nvar colorsStripSel = '.pdp-selcart__column--color .pdp-selcart__column__content';\nvar colorsLabelSel = '.pdp-selcart__column--color .pdp-selcart__column__label';\n\n\n/* calculated in setSizes: */\nvar barW, \n columnsWidth, \n palettesMarginLeftWidth,\n allPalettesWidth,\n singlePaletteWidth, \n avaiableW, \n neededW, \n openerUiWidth, \n totalColors;\n\n\nvar init = function(){\n\n var $clonedLabel = $(colorsLabelSel).clone().addClass('cloned-label');\n $clonedLabel.prependTo( $(colorsStripSel) );\n\n resetSizes();\n\n setLoading(true);\n\n setSizes(function(){\n if( /* !isSpaceEnough() */ false ) { // TODO: modify it\n\n // 1. calculate how many palettes can stay in avaiableW\n var howManyPalettes = parseInt( (avaiableW - openerUiWidth) / (singlePaletteWidth + paletteMarginLeft) );\n /*\n console.log('%c > Palettes Control: color palettes are over avaiable size', debugColor);\n console.log('%c > singlePaletteWidth: ' + (singlePaletteWidth + paletteMarginLeft), debugColor);\n console.log('%c > howManyPalettes: ' + howManyPalettes , debugColor);\n */\n \n // 2. separate visible and hidden\n var firstExcess = parseInt(howManyPalettes)+1;\n var $excessPalettes = $('ul.pdp-swatches-color li:nth-child(N+'+firstExcess+')');\n $excessPalettes.addClass(excessPalettesClassName);\n $('ul.pdp-swatches-color').append($excessPalettes);\n\n // 3. create expansion trigger\n var openerUiActiveUi = '+'+(totalColors-howManyPalettes)+'';\n var openerUiInactiveUi = '';\n var $openerUi = $('
      • ').addClass(openerUiClassName).html( openerUiActiveUi+openerUiInactiveUi );\n $('ul.pdp-swatches-color').append($openerUi );\n\n\n \n // 4. create interaction\n $openerUi.on('click', function(){\n $excessPalettes.toggleClass(excessPalettesClassName);\n $(this).toggleClass(openerUiClassName+'--active');\n // manage panel size:\n $(colorsStripSel).toggleClass('active');\n })\n\n // 5. remove loader\n setLoading(false);\n\n } else {\n /* console.log('%c > color palettes fit in avaiable size', debugColor); */\n setLoading(false);\n }\n });\n} \n\nvar setLoading = function(state){\n var $colorWrapper = $('.pdp-selcart__column--color');\n var activeClass = 'pdp-selcart__column--loading';\n if (state) {\n $colorWrapper.addClass(activeClass);\n } else {\n $colorWrapper.removeClass(activeClass);\n }\n}\n\nfunction resetSizes(){\n barW = 0;\n columnsWidth = 0;\n palettesMarginLeftWidth = 0; \n allPalettesWidth = 0; \n singlePaletteWidth = 0;\n avaiableW = 0;\n neededW = 0;\n openerUiWidth = 0;\n totalColors = 0;\n}\n\nfunction setSizes(callback){\n barW = $('.pdp-selcart').outerWidth();\n totalColors = $('.pdp-swatches-color li').size();\n palettesMarginLeftWidth = paletteMarginLeft * (totalColors - 1);\n $('.pdp-selcart__column:not(.pdp-selcart__column--color):visible').each(function(i){\n columnsWidth += $(this).outerWidth();\n });\n $('.pdp-swatches-color li').each(function(i){\n singlePaletteWidth = $(this).outerWidth();\n allPalettesWidth += $(this).outerWidth();\n }); \n openerUiWidth = singlePaletteWidth + paletteMarginLeft;\n avaiableW = barW - columnsWidth - 2*columnsPadding;\n neededW = allPalettesWidth + palettesMarginLeftWidth;\n /*\n console.log('%c > Palettes Control: setSizes', debugColor);\n console.log('%c > barW: ' + barW, debugColor);\n console.log('%c > palettesMarginLeftWidth: ' + palettesMarginLeftWidth, debugColor);\n console.log('%c > columnsWidth: ' + columnsWidth, debugColor);\n console.log('%c > openerUiWidth: ' + openerUiWidth, debugColor);\n console.log('%c > avaiableW: ' + avaiableW, debugColor);\n console.log('%c > neededW: ' + neededW, debugColor);\n */\n\n callback();\n}\n\n\n\nfunction isSpaceEnough(){\n return (avaiableW > neededW);\n}\n\n\nvar destroy = function(){\n $('.'+excessPalettesClassName).removeClass(excessPalettesClassName);\n $('.'+openerUiClassName).remove();\n}\n\nexports.init = init;\nexports.setLoading = setLoading;\n\n},{}],48:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n util = require('../../util');\n\n/**\n * @description loads product's navigation\n **/\nmodule.exports = function () {\n var $pidInput = $('.pdpForm input[name=\"pid\"]').last(),\n $navContainer = $('#product-nav-container');\n // if no hash exists, or no pid exists, or nav container does not exist, return\n if (window.location.hash.length <= 1 || $pidInput.length === 0 || $navContainer.length === 0) {\n return;\n }\n\n var pid = $pidInput.val(),\n hash = window.location.hash.substr(1),\n url = util.appendParamToURL(Urls.productNav + '?' + hash, 'pid', pid);\n\n ajax.load({\n url: url,\n target: $navContainer\n });\n};\n\n},{\"../../ajax\":4,\"../../util\":79}],49:[function(require,module,exports){\n'use strict';\n\nvar ajax = require('../../ajax'),\n tooltip = require('../../tooltip'),\n util = require('../../util');\n\nmodule.exports = function () {\n var $addToCart = $('#add-to-cart'),\n $addAllToCart = $('#add-all-to-cart'),\n $productSetList = $('#product-set-list');\n\n var updateAddToCartButtons = function () {\n if ($productSetList.find('.add-to-cart[disabled]').length > 0) {\n $addAllToCart.attr('disabled', 'disabled');\n // product set does not have an add-to-cart button, but product bundle does\n $addToCart.attr('disabled', 'disabled');\n } else {\n $addAllToCart.removeAttr('disabled');\n $addToCart.removeAttr('disabled');\n }\n };\n\n if ($productSetList.length > 0) {\n updateAddToCartButtons();\n }\n // click on swatch for product set\n $productSetList.on('click', '.product-set-item .swatchanchor', function (e) {\n e.preventDefault();\n if ($(this).parents('li').hasClass('unselectable')) { return; }\n var url = Urls.getSetItem + this.search;\n var $container = $(this).closest('.product-set-item');\n var qty = $container.find('form input[name=\"Quantity\"]').first().val();\n\n ajax.load({\n url: util.appendParamToURL(url, 'Quantity', isNaN(qty) ? '1' : qty),\n target: $container,\n callback: function () {\n updateAddToCartButtons();\n tooltip.init();\n }\n });\n });\n};\n\n},{\"../../ajax\":4,\"../../tooltip\":78,\"../../util\":79}],50:[function(require,module,exports){\n'use strict';\n\n\nvar preloader = require('../../preloader');\nvar slickButtonsHeight = require('../../slickButtonsHeight');\n\n/**\n * @description Creates product recommendation carousel using jQuery slick plugin\n **/\n\n\n\n\nmodule.exports = function () {\n // Default carousel recommendations\n var carouselSel = '#carousel-recommendations:not(.carousel-recommendations-cart) > ul';\n var $carousel = $(carouselSel).not('.slick-initialized');\n $carousel.on('init', function (event, slick) {\n var pre = new preloader();\n var imagesToLoad = [$('#carousel-recommendations img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselSel, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n $carousel.slick({\n infinite: true,\n dots: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 3,\n slidesToScroll: 3\n }\n },\n {\n breakpoint: 768,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2\n }\n }\n ]\n });\n\n // PDP carousel recommendations\n var carouselSelPDP = '#carousel-recommendations-pdp > ul';\n var $carouselPDP = $(carouselSelPDP).not('.slick-initialized');\n $carouselPDP.on('init', function (event, slick) {\n var pre = new preloader();\n var imagesToLoad = [$('#carousel-recommendations img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselSel, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n $carouselPDP.slick({\n infinite: false,\n dots: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n infinite: false,\n arrows: false,\n dots: true,\n slidesToShow: 3,\n slidesToScroll: 3\n }\n },\n {\n breakpoint: 768,\n settings: {\n infinite: false,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2\n }\n }\n ]\n });\n\n // cart carousel recommendations\n var carouselCart = '#carousel-recommendations-cart > ul';\n var $carouselCart = $(carouselCart).not('.slick-initialized');\n $carouselCart.on('init', function () {\n var pre = new preloader();\n var imagesToLoad = [$('#carousel-recommendations-cart img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselCart, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n $carouselCart.slick({\n infinite: true,\n dots: true,\n slidesToShow: 5,\n slidesToScroll: 5,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 3,\n slidesToScroll: 3\n }\n },\n {\n breakpoint: 768,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2\n }\n }\n ]\n });\n\n\n // Default carousel recommendations\n var carouselSel = '#carousel-recommendations:not(.carousel-recommendations-cart) > ul';\n var $carousel = $(carouselSel).not('.slick-initialized');\n $carousel.on('init', function (event, slick) {\n var pre = new preloader();\n var imagesToLoad = [$('#carousel-recommendations img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselSel, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n\n // Editorial carousel product\n var carouselSel = '#carousel-editorial:not(.carousel-recommendations-cart) > ul';\n var $carouselEditorial = $(carouselSel).not('.slick-initialized');\n $carouselEditorial.on('init', function (event, slick) {\n var pre = new preloader();\n var imagesToLoad = [$('#carousel-editorial img').eq(0).attr('src')];\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init(carouselSel, '.product-tile');\n },\n array: imagesToLoad\n });\n });\n\n $carouselEditorial.slick({\n infinite: true,\n dots: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n prevArrow: '',\n nextArrow: '',\n responsive: [{\n breakpoint: 1280,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 3,\n slidesToScroll: 3\n }\n },\n {\n breakpoint: 768,\n settings: {\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2\n }\n }\n ]\n\n });\n};\n\n},{\"../../preloader\":64,\"../../slickButtonsHeight\":73}],51:[function(require,module,exports){\n'use strict';\n\nvar dialogReserveInStore = require('../../dialog'),\n validator = require('../../validator'),\n genericSidebar = require('../../generic-sidebar'),\n storelocatorController = require('../../custom/storelocator'),\n mapController = require('../../custom/storelocator.mapcontroller'),\n defer = $.Deferred();\n\n/*,\n _ = require('lodash');\nvar dialogReserveInStore = _.assign({}, dialog);*/\n\nvar init = function (e) {\n e.preventDefault();\n\n var isSizeSelected = checkSelectedSize(e);\n if (isSizeSelected) {\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '46',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel-booking',\n 'eventAction': 'book_in_store',\n 'eventLabel': $('.side-container').find('h1').text().trim().replace(' ', '_'),\n 'sku': $('#pid').val(),\n 'size': $(\".pdp-selcart__size-selected\").html().trim(),\n 'dimension40': $('.product-addtocart-information').attr('data-category')\n });\n\n var content = $(e.currentTarget).attr('data-reserveinstore-dialog-url');\n\n genericSidebar.open(content, 'dynamic', true, function () {\n initUI();\n validator.init();\n });\n\n } else {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '45',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel-booking',\n 'eventAction': 'book_in_store',\n 'eventLabel': 'select_size'\n });\n }\n\n\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nvar checkSelectedSize = function (e) {\n var isSizeSelected = false;\n if ($(\".pdp-selcart__column__content.pdp-selcart__panel--size > ul > li.pdp-swatches-size__option.selected div\").data(\"href\")) {\n $(e.target).removeClass('error');\n isSizeSelected = true;\n } else {\n $(e.target).addClass('error');\n $(e.target).html($(e.target).data('sizecheck'));\n $('[data-selcartpanel=\"pdp-selcart__panel--size\"]').trigger('click');\n $('.size-select-error').fadeIn();\n }\n\n return isSizeSelected;\n};\n\nvar closeOmnichannelLogin = function () {\n $('.login-reserve-wrapper').hide();\n $('.reserve-storelocator').fadeIn();\n $('.generic-sidebar-backbtn').remove();\n $('.generic-sidebar-header').removeClass('back-active');\n}\n\nvar loginForReserve = function (event) {\n event.preventDefault();\n\n $('#storelocator-loader').fadeIn(200);\n\n var $form = $(\"#LoginFormFromRIS\");\n if (!$form.valid()) {\n defer.reject();\n $('#storelocator-loader').fadeOut(200);\n return defer;\n }\n\n var loginUrl = $form.attr('action');\n var data = {};\n data = $form.serializeArray();\n data.push({\n name: $(this).attr('name'),\n value: 'x'\n });\n data.push({\n name: 'scope',\n value: 'popup'\n });\n data.push({\n name: \"goon\",\n value: \"stay\"\n });\n data.push({\n name: \"format\",\n value: \"ajax\"\n });\n\n $('#storelocator-loader').fadeIn(200);\n\n $.ajax({\n url: loginUrl,\n method: 'POST',\n data: data,\n async: true\n })\n .done(function (response) {\n if (response.error) {\n $('#reserveinstore-login-errormsg').html(response.errorMsg);\n } else {\n $('#reserve-login').remove();\n $(\"#reserve-confirm\").html(response.contents);\n $(\"#reserve-confirm\").removeClass('nomargin');\n //activateEmailField();\n $(\"#reserve-confirm\").data(\"uli\", 1)\n // open confirmation step\n $('.payandcollect-result.open .js-reserve-trigger').trigger('click');\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '48',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel-login',\n 'eventAction': 'login',\n 'eventLabel': 'access'\n });\n }\n })\n // failed\n .fail(function (xhr, textStatus) {\n if (textStatus === 'parsererror') {\n window.alert(Resources.BAD_RESPONSE);\n }\n if (options.callback) {\n options.callback(null);\n }\n })\n .always(function () {\n $('#storelocator-loader').fadeOut(200).delay(1000);\n });\n};\n\nvar initMap = function () {\n if (typeof google === 'object' && typeof google.maps === 'object') {\n initMapElements();\n return;\n }\n\n $.when(\n $.getScript(window.Urls.googleMap),\n $.Deferred(function (deferred) {\n $(deferred.resolve);\n })\n ).done(initMapElements);\n};\n\nfunction initMapElements() {\n //\n //\n mapController.BasicMapController.api.init(window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n\n var storePageController = {\n page: 'reserveinstore',\n countryField: $('#dwfrm_storelocator_country'),\n cityField: $('#dwfrm_storelocator_cityPostalCode'),\n maxdistance: $('#maxdistance'),\n clickButton: $('#store-locator-submit'),\n geolocationButton: $('.js-reserve-geolocation'),\n mapController: mapController,\n storeSearchFilters: ['omniReserveInStore'],\n customInit: function () {\n\n this.geolocationButton.on('click', function (e) {\n $('#storelocator-wrapper').prepend($('#storelocator-map'));\n $('.js-reserve-geolocation').addClass('active');\n });\n\n this.clickButton.on('click', function (e) {\n $('#storelocator-wrapper').prepend($('#storelocator-map'));\n $('.js-reserve-geolocation').removeClass('active');\n });\n\n /* if ($('.tab-button-list').hasClass('active')){\n $('.tab-button-map').removeClass('active');\n $('#storelocator-map').slideUp('200');\n } */\n\n /* $('.tab-button-list').on('click touchstart',function (e) {\n $('.tab-button-map').removeClass('active');\n $(this).addClass('active');\n $('#storelocator-map').slideUp('200');\n $('#stores-results-list').slideDown('200');\n\n dataLayer.push({\n 'event':'GAevent',\n 'eventID':'50',\n 'eventCategory':'omnichannel_select_shop',\n 'eventAction':'select_store',\n 'eventLabel':'list'\n });\n }); */\n\n //Show map and Adapt bounds when click Map view mobile\n $('.tab-button-map').on('click touchstart', function (e) {\n $('.tab-button-list').removeClass('active');\n $('.tab-button-map').addClass('active');\n $('#storelocator-map').slideDown('200');\n $('#stores-results-list').slideUp('200');\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '50',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel_select_shop',\n 'eventAction': 'select_store',\n 'eventLabel': 'map'\n });\n });\n\n $('.tab-button-map').on('touchend', function (e) {\n if ($('#storelocator-map').is(':visible')) {\n this.mapController.BasicMapController.api.adaptZoomLevel();\n }\n });\n\n var enableStoreSearch = function () {\n if ($(this).val()) {\n $('#store-locator-submit').removeClass(\"disabled\");\n } else {\n $('#store-locator-submit').addClass(\"disabled\");\n }\n };\n\n $('#store-locator-submit').click(function (event) {\n\n var citypostalcode = $(\".reserve-in-store-search-block\").find(\"#dwfrm_storelocator_cityPostalCode\").val();\n // var distance = $(\".reserve-in-store-search-block\").find('.selectric .label').html();\n\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '49',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel_search_store',\n 'eventAction': citypostalcode,\n 'eventLabel': $('#pid').val(),\n 'dimension40': $('.product-addtocart-information').attr('data-category')\n });\n });\n\n // Listeners di eventi per validazione input\n $('#dwfrm_storelocator_cityPostalCode').change(enableStoreSearch);\n $('#dwfrm_storelocator_cityPostalCode').keyup(enableStoreSearch);\n $('#dwfrm_storelocator_cityPostalCode').blur(enableStoreSearch);\n },\n cleanErrors: function () {\n this.cityField.removeClass(\"required-error\");\n this.cityField.closest(\".form-group\").removeClass(\"inerror\");\n this.cityField.closest(\".form-control-feedback\").addClass(\"hide\");\n $('#stores-list-errorReserve').addClass('hide');\n $('#stores-list-errorReserve').removeClass('visible');\n },\n showErrors: function () {\n this.cityField.closest(\".form-group\").addClass(\"inerror\");\n this.cityField.closest(\".form-control-feedback\").removeClass(\"hide\");\n }\n };\n $.extend(storelocatorController.storePageController, storePageController);\n storelocatorController.storePageController.init();\n\n};\n\nvar selectrifyMaxDistance = function () {\n $('.reserve-storelocator .custom-select').on('selectric-before-open', function () {\n if ($(window).width() > 1024) {\n var selectId = $(this).attr('id');\n var $selectricWrapper = $('.selectric-' + selectId);\n var $selectricOptionsWrapper = $('.selectric-' + selectId + ' .selectric-items');\n var selectricOptionHeight = $selectricOptionsWrapper.find('li:eq(0)').outerHeight();\n var selectedIndex = $(this).find('option[selected]').index();\n var gap = selectricOptionHeight * selectedIndex;\n $selectricOptionsWrapper.css({\n marginTop: -(gap + $selectricWrapper.outerHeight())\n });\n }\n });\n\n $('.reserve-storelocator .custom-select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false,\n onInit: function () {\n var $parent = $(this).closest('.form-group');\n $parent.addClass('active');\n }\n });\n};\n\n// var activateEmailField = function(){\n// var $parent = $(\"#reserveinstore_email\").closest('.form-group');\n// $parent.addClass('active');\n// };\n\nvar initUI = function () {\n initMap();\n selectrifyMaxDistance();\n $('#submitButtonLoginFormFromRIS').on('click', loginForReserve);\n $('#popup-iscrizione').click(function (event) {\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '47',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel-login',\n 'eventAction': 'registration',\n 'eventLabel': 'step1'\n });\n });\n //$(\"#reserveinstore_email\").length > 0 && activateEmailField();\n $(\".ui-dialog-titlebar-close\").unbind(\"click\");\n $(\".ui-dialog-titlebar-close\").on(\"click\", function () {\n if ($(\"#reserve-confirm\").data(\"uli\") != 0) {\n window.location.reload();\n }\n });\n};\n\nvar scrollToOpenShop = function () {\n var scrollValue = $('.payandcollect-result.open').offset().top - $('.generic-sidebar-content').offset().top - $('.generic-sidebar-content').scrollTop();\n $('.generic-sidebar-content').scrollTop(scrollValue);\n}\n\nvar showConfirmationStep = function (response) {\n $('.reserve-storelocator').hide();\n $('.generic-sidebar-content').append(response);\n $('#reserve-confirmation-map').append($('#storelocator-map'));\n $('.generic-sidebar-header').prepend('');\n $('.generic-sidebar-header').addClass('back-active');\n\n $('.generic-sidebar-backbtn, .js-close-generic-sidebar').on('click', function () {\n if ($('.payandcollect-result.open').length) {\n $('.payandcollect-result.open').find('.store-map').append($('#storelocator-map'));\n }\n $('.reserve-confirmation').remove();\n $('.generic-sidebar-backbtn').remove();\n $('.generic-sidebar-header').removeClass('back-active');\n $('.reserve-storelocator').fadeIn(200);\n });\n}\n\nvar attachReserveConfirmationSubmitEvent = function () {\n $('.js-submit-reserve-confirmation').on('click', function () {\n var action = $(this).attr('data-action');\n var pid = $(this).attr('data-pid');\n var storeReserveSelection = $(this).attr('data-store-code');\n\n $.ajax({\n url: action,\n data: {\n 'pid': pid,\n 'storeReserveSelection': storeReserveSelection\n },\n type: 'POST',\n beforeSend: function () {\n $('#storelocator-loader').fadeIn(200);\n },\n success: function (response) {\n $('.reserve-confirmation').remove();\n $('.generic-sidebar-backbtn').remove();\n $('.generic-sidebar-header').removeClass('back-active');\n $('.generic-sidebar-content').append(response);\n\n var eventCategory = $('.reserve-result-message-title.title-error').length ? 'omnichannel_thank_you_error' : 'omnichannel_thank_you';\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '53',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': eventCategory,\n 'eventAction': $('.payandcollect-result.open').attr('data-store-name'),\n 'eventLabel': $('.side-container').find('h1').text().trim().replace(' ', '_'),\n 'sku': $('#pid').val(),\n 'dimension40': $('.product-addtocart-information').attr('data-category')\n });\n },\n complete: function () {\n $('#storelocator-loader').fadeOut(200);\n }\n });\n });\n}\n\nmodule.exports = {\n init: init,\n initEvents: function () {\n\n // reserve store dropdown\n $(document).on('click', '.js-store-result-trigger', function () {\n var storeID = $(this).attr('data-store-id');\n var $this = $(this).parents('.payandcollect-result');\n var $mapContainer = $this.find('.store-map');\n // if current dropdown is selected\n if ($this.hasClass('open')) {\n $this.removeClass('open');\n $this.find('.store-result-content').slideUp(200);\n } else {\n // close active dropdowns\n $('.payandcollect-result.open').find('.store-result-content').slideUp(200);\n $('.payandcollect-result').removeClass('open');\n // open clicked dropdown\n $this.addClass('open');\n $this.find('.store-result-content').slideDown(200);\n // move and update map\n $mapContainer.append($('#storelocator-map'));\n updateMapReserve(storeID);\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '50',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'omnichannel_select_shop',\n 'eventAction': $(this).parents('.payandcollect-result').attr('data-store-name'),\n 'eventLabel': 'select',\n 'sku': $('#pid').val(),\n 'dimension39': $(this).parents('.payandcollect-result').attr('data-availability'),\n 'dimension40': $('.product-addtocart-information').attr('data-category')\n });\n }\n });\n\n // reserve dropdown button click\n $(document).on('click', '.js-reserve-trigger', function () {\n var isUserLogged = $('.reserve-in-store-confirm').length;\n if (!isUserLogged) {\n $('.reserve-storelocator').hide();\n $('.login-reserve-wrapper').fadeIn();\n // Scroll top on mobile\n if (window.matchMedia('(max-width: 767px)').matches) {\n $(window).scrollTop(0);\n }\n $('.generic-sidebar-header').prepend('');\n $('.generic-sidebar-header').addClass('back-active');\n\n $('.generic-sidebar-backbtn, .js-close-generic-sidebar').on('click', function () {\n closeOmnichannelLogin();\n });\n\n } else {\n var storeReserveSelection = $(this).attr('data-store-selection')\n var pid = $('#pid').val();\n\n $.ajax({\n url: $('#ReserveInStoreVerifyForm').attr('action'),\n data: {\n 'storeReserveSelection': storeReserveSelection,\n 'pid': pid,\n },\n type: 'POST',\n beforeSend: function () {\n $('#storelocator-loader').fadeIn(200);\n },\n success: function (response) {\n closeOmnichannelLogin();\n showConfirmationStep(response);\n attachReserveConfirmationSubmitEvent();\n },\n complete: function () {\n $('#storelocator-loader').fadeOut(200);\n }\n });\n }\n });\n\n $(document).on('click', '.generic-sidebar-backbtn', function () {\n scrollToOpenShop();\n });\n\n // clear geolocation input value on focus in\n $(document).on('focusin', '.citystorelocator input', function () {\n if ($('.js-reserve-geolocation').hasClass('active')) {\n $(this).val('');\n }\n });\n\n }\n};\n\n},{\"../../custom/storelocator\":15,\"../../custom/storelocator.mapcontroller\":16,\"../../dialog\":20,\"../../generic-sidebar\":22,\"../../validator\":80}],52:[function(require,module,exports){\n'use strict';\nvar specTab = require('./specTab');\nvar palettesPanel = require('./palettesPanel');\n\n\nfunction panelsInit(){\n var $pdpMain = $('#pdpMain');\n $pdpMain.on('click', '[data-selcartpanel]', function(e){\n var $selcart = $('.pdp-selcart');\n var $selcartPanels = $('.pdp-selcart__column__panel');\n var panelSelector = $(this).data('selcartpanel');\n var $panel = $('.'+panelSelector);\n var triggerPosition = $(this).closest('.pdp-selcart__column').offset().left - $selcart.offset().left ;\n\n $selcartPanels.removeClass('open');\n // toggle selected panel\n if( $(this).hasClass('open') ) {\n $(this).removeClass('open');\n $panel.removeClass('open');\n } else {\n $(this).addClass('open');\n $panel.addClass('open');\n if($(window).outerWidth() > 767) {\n var cssObj = {};\n if($selcart.hasClass('pdp-selcart--sticked')){\n cssObj = {\n left: triggerPosition,\n top: 'auto',\n bottom: $selcart.outerHeight() - 2\n }\n } else {\n cssObj = {\n left: triggerPosition,\n top: $selcart.outerHeight() - 2,\n bottom: 'auto'\n }\n }\n $panel.css(cssObj);\n }\n }\n\n\n });\n}\n\nfunction stickSelectorLarge(){\n\n // posizioni e dimensioni al load:\n var onLoadPosition = $('.pdp-selcart').offset().top + $('.pdp-selcart').outerHeight();\n var onLoadWidth = $('.pdp-selcart').outerWidth();\n\n var debugColor = 'color: green; font-weight: bold;';\n /*\n console.log('%c > onLoadPosition '+onLoadPosition, debugColor);\n console.log('%c > onLoadWidth '+onLoadWidth, debugColor);\n console.log('%c > onLoadHeight '+onLoadHeight, debugColor);\n */\n\n $(window).on('scroll', function(){\n var elPos = onLoadPosition - $(window).scrollTop() ;\n var winH = $(window).outerHeight();\n var avaiableCanvas = winH - $('.footer-sticky').outerHeight();\n /*\n console.log('%c > elPos '+elPos, debugColor);\n console.log('%c > avaiableCanvas '+avaiableCanvas, debugColor);\n */\n if ( elPos >= avaiableCanvas ) {\n $('.pdp-selcart').css({\n position:'fixed',\n bottom: $('.footer-sticky').outerHeight(),\n width: onLoadWidth\n }).addClass('pdp-selcart--sticked');\n } else {\n $('.pdp-selcart').css({\n position:'absolute',\n bottom: -40\n }).removeClass('pdp-selcart--sticked');;\n }\n });\n}\n\n\nfunction stickSelectorSmartphone(){\n $(window).scroll();\n // posizioni e dimensioni al load:\n var onLoadPosition = $('.pdp-selcart').outerHeight();\n\n var menuHeight = $('.header-container').outerHeight();\n\n $(window).on('scroll', function(){\n var scrolled = $(window).scrollTop();\n if( scrolled > onLoadPosition - menuHeight ) {\n $('#pdp-smartphone-cta').addClass('active');\n } else {\n $('#pdp-smartphone-cta').removeClass('active');\n }\n });\n}\n\nfunction smartphoneSizeSelect(){\n var $select = $('.pdp-selcart__size-selected');\n var smartphoneLabel = $('.pdp-selcart__size-selected').data('smartphonelabel');\n var label = $('.pdp-selcart__size-selected').data('label');\n if($select.length > 0 && $select.html().trim() == label) {\n $select.html(smartphoneLabel);\n }\n}\n\nfunction addToCartScroller(){\n $('#pdpMain').on('click', '#add-to-cart-trigger', function(){\n // prevent multiple clicks\n if ($(this).data('click-init')) return;\n $(this).data('click-init', true);\n\n var scrollGap = $('.pdp-selcart').offset().top - $('.header-container').outerHeight(true);\n $('#add-to-cart').trigger('click');\n $('html,body').animate({\n scrollTop: scrollGap\n }, 500, function() {\n // reactivate trigger\n $(this).data('click-init', false);\n });\n });\n}\n\nfunction trigShareAndWishlist(){\n var shareContentSelector = '.pdp-selcart__column--share .pdp-selcart__column__content';\n var sharePanelSelector = '.pdp-selcart__panel--share';\n $('#pdpMain').on('click', '#wishlist-mobile-trigger', function(){\n\n if($('.pdp-selcart__column--wishlist .minipop__trigger').length > 0){\n\n $('.pdp-selcart__column--wishlist .minipop__trigger').click();\n\n\n } else if($('.pdp-selcart__column--wishlist .product-not-in-wishlist').length > 0){\n\n $('.pdp-selcart__column--wishlist .product-not-in-wishlist').click();\n\n\n } else if($('.pdp-selcart__column--wishlist .product-in-wishlist,.wishlist-listing').length > 0){\n\n $('.pdp-selcart__column--wishlist .product-in-wishlist,.wishlist-listing').click();\n }\n\n });\n $('#pdpMain').on('click', '#share-mobile-trigger', function(){\n $(shareContentSelector +' img').trigger('click');\n if ($('.pdp-selcart__column--share__closer').length === 0) {\n var $closer = $('
        ').addClass('pdp-selcart__column--share__closer');\n $(sharePanelSelector).append($closer);\n $closer.on('click', function(){\n $(shareContentSelector +' img').trigger('click');\n });\n }\n });\n\n}\n\nfunction smartphoneFixing(){\n smartphoneSizeSelect();\n addToCartScroller();\n trigShareAndWishlist();\n}\n\nexports.getLabelSizeUpdated = function() {\n if($(window).outerWidth() < 768 ) {\n smartphoneFixing();\n }\n};\n\nexports.init = function(){\n if($(window).outerWidth() < 768 ) {\n smartphoneFixing();\n }\n // andrebbe integrato un loader effettivo della galleria\n // per sapere quando la galleria ha preso la sua altezza finale\n // per evitare questo inelegante timeout:\n\n /* -------- Eliminazione per restyling PDP e rimozione sticky banner -------- */\n setTimeout(function(){\n if($(window).outerWidth() < 768 ) {\n stickSelectorSmartphone();\n }\n /* -------- Eliminazione per restyling PDP e rimozione sticky banner -------- */\n /*else {\n stickSelectorLarge();\n $(window).scroll();\n }*/\n }, 1000);\n panelsInit();\n specTab.init();\n};\n\n},{\"./palettesPanel\":47,\"./specTab\":53}],53:[function(require,module,exports){\n'use strict';\n\nvar tabsCont = 'tabs-cont';\nvar cardsCont = 'cards-cont';\nvar tabs = null;\nvar cards = null;\nvar cardId= 1;\nvar activeTabClass = 'active-tab';\nvar activeCard = 'get-in';\n\n/**\n * The init would initialize the handler of tabs if there are a tabs container;\n\n */\nvar init = function(){\n \n console.log('Tab handled initialized');\n var tempTabs = getTabs(tabsCont);\n var tempCont = getCards(cardsCont);\n\n if(tempTabs){\n console.log('tabs ottenute');\n tabs = tempTabs;\n cards = tempCont;\n handleTabs(tabs);\n }else{\n console.log('No inside-spec component detected');\n }\n}\n\n/**\n * \n * @param {string} tabsContainer the tabs container\n */\nfunction getTabs(tabsContainer){\n var tabsEl = document.getElementById(tabsContainer);\n if(tabsEl===null){\n return false;\n }\n var arrTabs = Array.prototype.slice.call(tabsEl.children); \n return arrTabs;\n}\n\n/**\n * \n * @param {string} cardsContainer the cards container\n */\nfunction getCards(cardsContainer){\n var contents = document.getElementById(cardsContainer);\n if(contents===null){\n return false;\n }\n var arrContents = Array.prototype.slice.call(contents.children);\n return arrContents;\n}\n/**\n * This function would be called on init function to handle cards with a listener on every tab\n * @param {array} elements the DOM elements to iterate to handle the cards\n */\nfunction handleTabs(elements){\n var arrElements = Array.prototype.slice.call(elements);\n for(var i =0; i< arrElements.length;i++){\n handleCards(arrElements[i]);\n }\n // ES6\n // for(var el of arrElements){\n // handleCards(el);\n // }\n }\n /**\n * This function let's any tab to handle the respective card with the same dataset(data-id) \n * @param {object} el the tab element\n */\nfunction handleCards(el){\n var element = el;\n element.addEventListener('click', function(e){\n e.preventDefault();\n resetClass(tabs,activeTabClass);\n cardId = Number(element.dataset.id);\n // console.log(this.cardId);\n element.classList.add(activeTabClass);\n showCard(cardId);\n },true);\n}\n/**\n * \n * @param {*} els elements to be manipulated\n * @param {string} delClass the name of class to be deleted from elements\n */\nfunction resetClass(els,delClass){\n\n for(var i = 0;i -1) {\n imgUrl = imgUrl.replace('700x700', '0x0');\n }\n $currentSlide.html('
        ');\n\n if (!window.matchMedia('(max-width: 1279px)').matches) {\n initDesktopZoom();\n } else {\n initMobileZoom();\n }\n });\n\n $('.product-images-zoom-carousel .zoom').zoom({\n url: $(this).attr('data-url'),\n on: 'mouseover',\n callback: function () {\n console.log('zoom active')\n }\n });\n\n initInfoServicesModals();\n //pdpProductInfoServicesInit(); //Restyling PDP - removing slick slider for information services\n // initPDPRecommendations();\n\n // Update pdp-tags view (hide tag NEW if product has a discount tag)\n if ($('#pdpMain').find('#product-main-container .product-content-reload-wrapper').length) {\n var pdpMainContent = $('#pdpMain').find('#product-main-container .product-content-reload-wrapper');\n if ($(pdpMainContent).find('.pdp-tags .product-attribute.new').length && $(pdpMainContent).find('.pdp_price__percentage').length) {\n $(pdpMainContent).find('.pdp-tags .product-attribute.new').hide();\n } else {\n $(pdpMainContent).find('.pdp-tags .product-attribute.new').show();\n }\n }\n\n /*\n * 3D image in PDP - Mobile version\n */\n if (window.matchMedia('(max-width: 767px)').matches) {\n if ($('.product-images-3d .image-3d-wrapper').length > 0 && !$('.product-images-3d .image-3d-wrapper').is(':empty')) {\n var $image3DIframe = $('.product-images-3d .image-3d-wrapper').detach();\n\n if ($('#product-images-3d-mobile').length > 0) {\n $('#product-images-3d-mobile').find('.product-images-3d-mobile-container').append($image3DIframe);\n }\n }\n }\n};\n\nvar zoomEvent = function (option) {\n var optionValue = parseInt($(option).parents('.slick-slide').attr('data-slick-index')) + 1;\n dataLayer.push(datalayerEvent('GAevent', '13', getTimestampAlphanumericString(), 'product', 'image', \"zoom_\" + optionValue, $('#pid').val()));\n}\n\nvar initDesktopZoom = function () {\n $('.product-images-zoom-carousel .zoom-inner').trigger('zoom.destroy');\n\n $('.product-images-zoom-carousel .zoom-inner').zoom({\n url: $(this).parent().attr('data-url'),\n on: 'click',\n magnify: 1.2,\n onZoomIn: function () {\n $('#product-images-zoom').addClass('is-zooming');\n // Product images zoom click desktop event\n var $this = $(this);\n zoomEvent($this);\n\n },\n onZoomOut: function () {\n $('#product-images-zoom').removeClass('is-zooming');\n }\n });\n}\n\nvar initMobileZoom = function () {\n\n var imageContainers = document.querySelectorAll('.zoom-inner');\n\n imageContainers.forEach(function (imageContainer, index) {\n\n // exit if this image is not lazy loaded\n var displayImage = imageContainer.getElementsByClassName('zoom-image')[0];\n if (!displayImage) return;\n\n var minScale = 1;\n var maxScale = 4;\n var imageWidth;\n var imageHeight;\n var containerWidth;\n var containerHeight;\n var displayImageX = 0;\n var displayImageY = 0;\n var displayImageScale = 1;\n var displayDefaultWidth;\n var displayDefaultHeight;\n var rangeX = 0;\n var rangeMaxX = 0;\n var rangeMinX = 0;\n var rangeY = 0;\n var rangeMaxY = 0;\n var rangeMinY = 0;\n var displayImageRangeY = 0;\n var displayImageCurrentX = 0;\n var displayImageCurrentY = 0;\n var displayImageCurrentScale = 1;\n\n // reset zoom\n displayImageScale = 1;\n displayImageX = 0;\n displayImageY = 0;\n displayImageCurrentScale = 1;\n displayImageCurrentX = 0;\n displayImageCurrentY = 0;\n updateDisplayImage(0, 0, 1);\n\n function resizeContainer() {\n containerWidth = imageContainer.offsetWidth;\n containerHeight = imageContainer.offsetHeight;\n if (displayDefaultWidth !== undefined && displayDefaultHeight !== undefined) {\n displayDefaultWidth = displayImage.offsetWidth;\n displayDefaultHeight = displayImage.offsetHeight;\n updateRange();\n displayImageCurrentX = clamp(displayImageX, rangeMinX, rangeMaxX);\n displayImageCurrentY = clamp(displayImageY, rangeMinY, rangeMaxY);\n updateDisplayImage(\n displayImageCurrentX,\n displayImageCurrentY,\n displayImageCurrentScale);\n }\n }\n\n resizeContainer();\n\n function clamp(value, min, max) {\n return Math.min(Math.max(min, value), max);\n }\n\n function clampScale(newScale) {\n return clamp(newScale, minScale, maxScale);\n }\n\n window.addEventListener('resize', resizeContainer, true);\n\n imageWidth = displayImage.width;\n imageHeight = displayImage.height;\n displayDefaultWidth = displayImage.offsetWidth;\n // important: displayDefaultHeight is equal to width because with lazy loading the height could be 0 in this moment\n displayDefaultHeight = displayImage.offsetWidth;\n rangeX = Math.max(0, displayDefaultWidth - containerWidth);\n rangeY = Math.max(0, displayDefaultHeight - containerHeight);\n\n function updateDisplayImage(x, y, scale) {\n var transform = 'translateX(' + x + 'px) translateY(' + y + 'px) translateZ(0px) scale(' + scale + ',' + scale + ')';\n displayImage.style.transform = transform;\n displayImage.style.WebkitTransform = transform;\n displayImage.style.msTransform = transform;\n }\n\n function updateRange() {\n rangeX = Math.max(0, Math.round(displayDefaultWidth * displayImageCurrentScale) - containerWidth);\n rangeY = Math.max(0, Math.round(displayDefaultHeight * displayImageCurrentScale) - containerHeight);\n\n rangeMaxX = Math.round(rangeX / 2);\n rangeMinX = 0 - rangeMaxX;\n\n rangeMaxY = Math.round(rangeY / 2);\n rangeMinY = 0 - rangeMaxY;\n }\n\n var hammertime = new Hammer(imageContainer);\n hammertime.set({\n touchAction: 'auto'\n });\n hammertime.get('pinch').set({\n enable: true\n });\n hammertime.get('pan').set({\n direction: Hammer.DIRECTION_ALL\n });\n\n hammertime.on('pan', function (ev) {\n displayImageCurrentX = clamp(displayImageX + ev.deltaX, rangeMinX, rangeMaxX);\n displayImageCurrentY = clamp(displayImageY + ev.deltaY, rangeMinY, rangeMaxY);\n updateDisplayImage(displayImageCurrentX, displayImageCurrentY, displayImageScale);\n });\n\n hammertime.on('pinch pinchmove', function (ev) {\n displayImageCurrentScale = clampScale(ev.scale * displayImageScale);\n updateRange();\n displayImageCurrentX = clamp(displayImageX + ev.deltaX, rangeMinX, rangeMaxX);\n displayImageCurrentY = clamp(displayImageY + ev.deltaY, rangeMinY, rangeMaxY);\n updateDisplayImage(displayImageCurrentX, displayImageCurrentY, displayImageCurrentScale);\n });\n\n hammertime.on('panend pancancel pinchend pinchcancel', function () {\n displayImageScale = displayImageCurrentScale;\n displayImageX = displayImageCurrentX;\n displayImageY = displayImageCurrentY;\n });\n\n // Push zoom GTM\n hammertime.on('pinchend', function () {\n var optionValue = parseInt($('.product-images-zoom-carousel .slick-current').attr('data-slick-index')) + 1;\n dataLayer.push(datalayerEvent('GAevent', '13', getTimestampAlphanumericString(), 'product', 'image', \"zoom_\" + optionValue, $('#pid').val()));\n });\n\n });\n\n $(window).trigger('resize');\n}\n\nvar initInfoServicesModals = function () {\n $('body').on('click', '#find-out-more', function (e) {\n e.preventDefault();\n genericSidebar.open(Urls.infoServiceShipping, 'dynamic', true);\n });\n\n $('body').on('click', '#shippinglayer', function (e) {\n e.preventDefault();\n genericSidebar.open(Urls.infoServiceShipping, 'dynamic', true);\n });\n\n $('body').on('click', '#refundlayer', function (e) {\n e.preventDefault();\n genericSidebar.open(Urls.infoServiceRefund, 'dynamic', true);\n });\n\n $('body').on('click', '#reservelayer', function (e) {\n e.preventDefault();\n genericSidebar.open(Urls.infoServiceReserve, 'dynamic', true);\n });\n\n $('body').on('click', '#paymentlayer', function (e) {\n e.preventDefault();\n genericSidebar.open(Urls.infoServicePayment, 'dynamic', true);\n });\n}\n\nvar pdpProductInfoServicesInit = function () {\n // product info services - slider\n if ($(window).width() < 1024) {\n $('.product-info-service-inner-wrapper').slick({\n arrows: false,\n dots: true,\n slidesToShow: 1\n });\n $(\".product-info-services\").css(\"visibility\", \"visible\");\n }\n}\n\n// Hook to init events after recommendations load from Einstein.\nvar initPDPRecommendations = function () {\n recommendations();\n productTile.init('#carousel-recommendations .product-tile-container', false);\n productTile.init('.best-products-box .product-tile-container', false);\n};\n\nwindow.initPDPRecommendations = initPDPRecommendations;\n\n\nvar vendorPDPInit = function () {\n\n /* ------------------------------ Init accordion ----------------------------- */\n var elem = new Foundation.Accordion($('.accordion'));\n\n /* ------- restyling size selector ------- */\n $('.pdp-swatches-size__option div').on('click', function (e) {\n var sizeOption = $(this);\n\n e.preventDefault();\n\n if (sizeOption.data(\"href\")) {\n var isEditCart = false;\n updateContent(sizeOption.data(\"href\"), isEditCart);\n\n } else {\n $('.size-select-error').fadeIn();\n }\n\n\n //dataLayer\n var gtm = $('.pdp-swatches-size').data('gtmvalue').toLowerCase().replace(\" \", \"_\");\n var gtmOptionValue = sizeOption.attr('data-value').toLowerCase().replace(/ /g, \"_\");\n var pid = $('#pid').val();\n dataLayer.push(datalayerEvent('GAevent', '11', getTimestampAlphanumericString(), 'product', gtm, gtmOptionValue, pid, null, 'product_page'));\n\n })\n /* ------- /restyling size selector ------- */\n\n /* ------- restyling color selector ------- */\n $('.pdp-swatches-size').length > 0 && $('.swatchanchor ').on('click', function (e) {\n var $pdpForm = $('.pdpForm');\n e.preventDefault();\n\n var colorOption = $(this);\n\n // if (sizeOption.data(\"href\")) {\n // var isEditCart = false;\n // updateContent(sizeOption.data(\"href\"), isEditCart);\n // } else {\n // $('.size-select-error').fadeIn();\n // }\n\n //dataLayer\n //var gtm = $('.pdp-swatches-size').data('gtmvalue').toLowerCase().replace(\" \", \"_\") ;\n var gtm = colorOption.context.dataset.gtmvalue.toLowerCase().replace(\" \", \"_\");\n //var gtmOptionValue = colorOption.html().trim().toLowerCase().replace(/ /g,\"_\") ;\n var gtmOptionValue = $(this).attr('data-seo-name').trim().toLowerCase().replace(/ /g, \"_\");\n var pid = $('#pid').val();\n dataLayer.push(datalayerEvent('GAevent', '11', getTimestampAlphanumericString(), 'product', gtm, gtmOptionValue, pid, null, 'product_page'));\n })\n\n /* ------- /restyling color selector ------- */\n\n\n /* ------- old size selector ------- */\n $('#size-select, #color-select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false,\n\n onChange: function (element) {\n var sizeOption = $(element).find(\":selected\");\n\n if ($(element).parents('li').hasClass('unselectable')) {\n return;\n }\n\n if (sizeOption.data(\"href\")) {\n var isEditCart;\n if ($('#source').val() == 'cart')\n isEditCart = true;\n else\n isEditCart = false;\n updateContent(sizeOption.data(\"href\"), isEditCart);\n } else {\n // add-to-cart sempre attivo\n //$('.product-add-to-cart #add-to-cart').attr('disabled', 'disabled');\n $('.size-select-error').fadeIn();\n }\n //dataLayer push specifico\n dataLayer.push(datalayerEvent('GAevent', '11', getTimestampAlphanumericString(), 'product', $(element).data(\"gtmvalue\").toLowerCase().replace(\" \", \"_\"), sizeOption.html().trim().toLowerCase().replace(/ /g, \"_\"), $('#pid').val()));\n\n },\n\n onInit: function () {\n //console.log('OnInit -> ' + JSON.stringify($(this)));\n }\n });\n\n\n $('.size-guide-button').on('click', function () {\n $(this).data('clicked', true);\n var productMoreSizesTable = \"#\" + $(\"#currentGenderSIzeTable\")[0].value;\n $(productMoreSizesTable).click();\n dataLayer.push(datalayerEvent('GAevent', '12', getTimestampAlphanumericString(), 'product', 'product_detail', 'size_guide', $('#pid').val()));\n if (!window.matchMedia('(max-width: 767px)').matches) {\n $('.generic-sidebar').css('width', '640px');\n }\n genericSidebar.open('#size-guide-modal', 'static', true, function () {\n sizeGuide.initTableScrollBar();\n });\n });\n\n\n //DNA mobile click\n $('.dna-tech__inner h2').click(function () {\n //console.log('WoRkS');\n $('.dna-tech__inner .icon-toggle').toggleClass('open');\n $('.dna-tech__inner .tech-mobile').slideToggle(500);\n });\n if ($(window).width() >= 768) {\n $('a.noIconForDesk').click(function () {\n return false;\n });\n $('a.noIconForDesk').off('click');\n $(\"a.noIconForDesk\").unbind(\"click\");\n }\n\n\n};\n\nvar checkSelectedSize = function (e) {\n var isSizeSelected = false;\n if ($(\".pdp-selcart__column__content.pdp-selcart__panel--size > ul > li.pdp-swatches-size__option.selected div\").data(\"href\")) {\n $(e.target).removeClass('error');\n isSizeSelected = true;\n } else {\n $(e.target).addClass('error');\n $(e.target).html($(e.target).data('sizecheck'));\n $('[data-selcartpanel=\"pdp-selcart__panel--size\"]').trigger('click');\n $('.size-select-error').fadeIn();\n // mobile --> scroll to size selector\n if (window.matchMedia('(max-width: 767px)').matches) {\n $('html, body').animate({\n scrollTop: $(\".pdp-selcart__column--color\").offset().top\n }, 1000);\n }\n }\n\n return isSizeSelected;\n};\n\n/**\n * @description update product content with new variant from href, load new content to #product-content panel\n * @param {String} href - url of the new product variant\n **/\n\nvar updateContent = function (href, isEditProductInCart) {\n var comesFromPlp = $('.pdp-slider-attributes .slick-active:first a');\n if (comesFromPlp.length) {\n href = href + '&colorslickposition=' + comesFromPlp.data('tabindex');\n }\n var $pdpForm = $('.pdpForm');\n var qty = $pdpForm.find('input[name=\"Quantity\"]').first().val();\n var params = {\n Quantity: isNaN(qty) ? '1' : qty,\n format: 'ajax',\n productlistid: $pdpForm.find('input[name=\"productlistid\"]').first().val()\n };\n\n var target;\n if (!$pdpForm.length) {\n target = $(\"#pdpMain\").find('#product-main-container .product-content-reload-wrapper');\n } else if (!isEditProductInCart && $pdpForm.length && $pdpForm.length > 0) {\n target = $pdpForm.closest('#product-main-container .product-content-reload-wrapper');\n } else {\n target = $pdpForm.closest('.cart-row').find('.item-edit-cover');\n }\n\n progress.show($('#pdpMain'));\n\n ajax.load({\n url: util.appendParamsToUrl(href, params),\n target: target,\n callback: function (data) {\n if (SitePreferences.STORE_PICKUP) {\n productStoreInventory.init();\n }\n\n vendorPDPInit();\n sizeGuideInit();\n\n ($(window).outerWidth() > 767) ? palettesPanel.init(): palettesPanel.setLoading(false);\n\n pdpSlickInit();\n notifyMe.init();\n\n $('#reserve-in-store-button').unbind(\"click\");\n $('#reserve-in-store-button').on('click', reserveInStore.init);\n $('#reserve-in-store-button-mobile').unbind(\"click\");\n $('#reserve-in-store-button-mobile').on('click', reserveInStore.init);\n\n loadTemplateTaglie();\n\n $(window).trigger('resize');\n $(window).scroll();\n initWishlistActions();\n\n if (typeof stickySidebarPDP !== 'undefined') {\n stickySidebarPDP.init();\n }\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n handleTapMobile();\n moveProductBaseInformation()\n }\n\n productSelectorCart.getLabelSizeUpdated();\n updateKlarnaOnSiteService();\n\n //TrueFit Reload\n try {\n tfcapi('calculate');\n console.warn('TrueFit widget has been reloaded.');\n } catch (e) {\n console.error('ERROR: TrueFit Api is not available.');\n }\n }\n });\n\n};\n\nvar updateKlarnaOnSiteService = function () {\n window.KlarnaOnsiteService = window.KlarnaOnsiteService || [];\n window.KlarnaOnsiteService.push({\n eventName: 'refresh-placements'\n });\n}\n\nvar initWishlistActions = function () {\n new WishlistComponent(false, true, wishlistActionHandler);\n};\n\nvar wishlistActionHandler = function (e) {\n e.preventDefault();\n if (checkSelectedSize(e)) {\n\n // push GTM\n var pid = $('#pid').val();\n dataLayer.push(datalayerEvent('GAevent', '15', getTimestampAlphanumericString(), 'product', 'add_to_wishlist', 'product_detail', pid));\n\n window.location.href = $(this).data(\"href\");\n }\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nvar loadTemplateTaglie = function () {\n\n // The international site does not show the product sizes,\n // thus the next check.\n if ($('#size-guide-modal').length > 0) {\n var Url = $('#size-guide-modal').data('taglieurl');\n\n ajax.load({\n url: Url,\n target: $('#size-guide-modal'),\n async: true,\n type: 'GET',\n callback: function (response) {\n $('#size-guide-modal').html(response);\n sizeGuide.init();\n }.bind(this)\n });\n }\n};\n\nvar handleTapMobile = function () {\n var productSlides = document.querySelectorAll('.js-thumb-zoom');\n\n productSlides.forEach(function (productSlide) {\n var mc = new Hammer.Manager(productSlide);\n\n mc.add(new Hammer.Tap({\n event: 'doubletap',\n taps: 2\n }));\n mc.add(new Hammer.Tap({\n event: 'singletap'\n }));\n\n // we only want to trigger a tap, when we don't have detected a doubletap\n /* mc.get('doubletap').recognizeWith('singletap');\n mc.get('singletap').requireFailure('doubletap'); */\n\n mc.on(\"singletap doubletap\", function (ev) {\n var index = $('.js-thumb-zoom.slick-current').attr('data-index');\n openZoomSlider(index);\n });\n\n /* mc.on(\"doubletap\", function(ev) {\n $('.pdp-wishlist-icon').trigger('click');\n }); */\n });\n};\n\nvar openZoomSlider = function (index) {\n util.togglePageScroll(true);\n var slideIndex = parseInt(index) - 1;\n $('.product-images-zoom-carousel').slick('slickGoTo', slideIndex);\n $('#product-images-zoom').addClass('open');\n};\n\n/**\n * 3D layer opening\n */\nvar open3DPopupImage = function () {\n $('#product-images-3d-mobile').addClass('open');\n};\n\nvar moveProductBaseInformation = function () {\n $('.product-content-properties').insertBefore('.pdp-cover-central-flow .product-images');\n}\n\nvar moveTechnologyInformation = function () {\n var $technologyBanner = $('.pdp-technology-wrapper');\n if ($technologyBanner.length) {\n var $parent = $technologyBanner.parents('.thumb');\n $technologyBanner.appendTo('.js-pdp-technology-mobile');\n $('.pdp-technology-mobile').show();\n $parent.remove();\n }\n}\n\n/*\n * Removing size guide.\n * Integration for ticket EC-2970\n */\nvar sizeGuideInit = function () {\n if ($('#currentGenderSIzeTable').length == 0) {\n var $sizeGuideButton = $('.size-guide');\n\n if ($sizeGuideButton.length > 0) {\n $sizeGuideButton.hide();\n }\n }\n}\n\nmodule.exports = function () {\n var $pdpMain = $('#pdpMain');\n var $footerOffTop = $('footer').offset().top;\n var $headerContainerHeight = $('.header-container').height();\n\n\n $('body').on('click', '.trigger-help', function () {\n util.scrollBrowser($footerOffTop - $headerContainerHeight);\n });\n\n $pdpMain.on('click', '.ui-icon-closethick', function () {\n util.togglePageScroll(false);\n $('#product-images-zoom').removeClass('open');\n });\n\n if (!window.matchMedia('(max-width: 767px)').matches) {\n $pdpMain.on('click', '.product-images-carousel .js-thumb-zoom', function () {\n var index = $(this).attr('data-index');\n openZoomSlider(index);\n });\n } else {\n handleTapMobile();\n }\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n $pdpMain.on('click', '.product-images-3d .icon-3d-wrapper', function () {\n open3DPopupImage();\n });\n\n $pdpMain.on('click', '.ui-icon-closethick-3d-image', function () {\n util.togglePageScroll(false);\n $('#product-images-3d-mobile').removeClass('open');\n });\n }\n\n $pdpMain.on('click', '.swatchanchor', function (e) {\n e.preventDefault();\n if ($(this).parents('li').hasClass('unselectable') || $(this).parent().hasClass('selected')) {\n return;\n }\n updateContent(this.dataset.usedLink);\n });\n\n $('body').on('click', '#add-to-cart', checkSelectedSize);\n\n vendorPDPInit();\n\n sizeGuideInit();\n\n productSelectorCart.init();\n ($(window).outerWidth() > 767) ? palettesPanel.init(): palettesPanel.setLoading(false);\n\n if ($(window).outerWidth() < 767) {\n moveProductBaseInformation();\n }\n\n // prevent page resize IOS\n document.addEventListener(\"touchstart\", function (event) {\n if (event.touches.length > 1) {\n event.preventDefault();\n event.stopPropagation();\n }\n }, {\n passive: false\n });\n\n pdpSlickInit();\n notifyMe.init();\n $('#reserve-in-store-button').unbind(\"click\");\n $('#reserve-in-store-button').on('click', reserveInStore.init);\n $('#reserve-in-store-button-mobile').unbind(\"click\");\n $('#reserve-in-store-button-mobile').on('click', reserveInStore.init);\n initWishlistActions();\n loadTemplateTaglie();\n};\n\n},{\"../../ajax\":4,\"../../custom/wishlistComponent\":19,\"../../generic-sidebar\":22,\"../../product-tile\":65,\"../../progress\":66,\"../../size-guide\":72,\"../../storeinventory/product\":76,\"../../util\":79,\"./notifyMe\":46,\"./palettesPanel\":47,\"./recommendations\":50,\"./reserveInStore\":51,\"./selectorCart\":52}],56:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n ajax = require('../ajax'),\n login = require('../login'),\n quickview = require('../quickview'),\n util = require('../util');\n\n/**\n * @function\n * @description Loads address details to a given address and fills the address form\n * @param {String} addressID The ID of the address to which data will be loaded\n */\nfunction populateForm(addressID, $form) {\n // load address details\n var url = Urls.giftRegAdd + addressID;\n ajax.getJson({\n url: url,\n callback: function (data) {\n if (!data || !data.address) {\n window.alert(Resources.REG_ADDR_ERROR);\n return false;\n }\n // fill the form\n $form.find('[name$=\"_addressid\"]').val(data.address.ID);\n $form.find('[name$=\"_firstname\"]').val(data.address.firstName);\n $form.find('[name$=\"_lastname\"]').val(data.address.lastName);\n $form.find('[name$=\"_address1\"]').val(data.address.address1);\n $form.find('[name$=\"_address2\"]').val(data.address.address2);\n $form.find('[name$=\"_city\"]').val(data.address.city);\n $form.find('[name$=\"_country\"]').val(data.address.countryCode).trigger('change');\n $form.find('[name$=\"_postal\"]').val(data.address.postalCode);\n $form.find('[name$=\"_state\"]').val(data.address.stateCode);\n $form.find('[name$=\"_phone\"]').val(data.address.phone);\n // $form.parent('form').validate().form();\n }\n });\n}\n\n/**\n * @private\n * @function\n * @description Initializes events for the gift registration\n */\nfunction initializeEvents() {\n var $eventAddressForm = $('form[name$=\"_giftregistry\"]'),\n $beforeAddress = $eventAddressForm.find('fieldset[name=\"address-before\"]'),\n $afterAddress = $eventAddressForm.find('fieldset[name=\"address-after\"]');\n\n $('.usepreevent').on('click', function () {\n // filter out storefront toolkit\n $(':input', $beforeAddress).not('[id^=\"ext\"]').not('select[name$=\"_addressBeforeList\"]').each(function () {\n var fieldName = $(this).attr('name'),\n $afterField = $afterAddress.find('[name=\"' + fieldName.replace('Before', 'After') + '\"]');\n $afterField.val($(this).val()).trigger('change');\n });\n });\n $eventAddressForm.on('change', 'select[name$=\"_addressBeforeList\"]', function () {\n var addressID = $(this).val();\n if (addressID.length === 0) { return; }\n populateForm(addressID, $beforeAddress);\n })\n .on('change', 'select[name$=\"_addressAfterList\"]', function () {\n var addressID = $(this).val();\n if (addressID.length === 0) { return; }\n populateForm(addressID, $afterAddress);\n });\n\n $('.item-list').on('click', '.item-edit-details a', function (e) {\n e.preventDefault();\n var productListID = $('input[name=productListID]').val();\n quickview.show({\n url: e.target.href,\n source: 'giftregistry',\n productlistid: productListID\n });\n });\n}\n\nexports.init = function () {\n initializeEvents();\n addProductToCart();\n login.init();\n util.setDeleteConfirmation('.item-list', String.format(Resources.CONFIRM_DELETE, Resources.TITLE_GIFTREGISTRY));\n};\n\n},{\"../ajax\":4,\"../login\":27,\"../quickview\":67,\"../util\":79,\"./product/addToCart\":42}],57:[function(require,module,exports){\n'use strict';\n\nvar touchMethods = require('./touchEvents');\n\nvar dataSlideNumber = 0 ;\nvar numberOfSlides = 3;\nvar scrollAmount ;\nvar overflower = $(\".component-roll__container__inner_overflower\");\nvar contentVideo = $(\".component-roll__container__inner-video\");\nvar contentColumn1 = $(\".component-roll__container__inner_small_column_one\");\nvar contentMedium1 = $(\".component-roll__container__inner_medium1\");\nvar contentMedium2 = $(\".component-roll__container__inner_medium2\");\nvar contentColumn2 = $(\".component-roll__container__inner_small_column_two\");\nvar container = $(\".component-roll__container\");\n\nvar rightButton = $(\".roll_all_container .component-roll__buttons-after\");\nvar leftButton = $(\".roll_all_container .component-roll__buttons-before\");\nvar buttonsWrapper = $(\".component-roll__buttons_wrapper\");\n\n\nfunction initializeEvents() {\n\tconsole.log('@Call roll-component.js -> init');\n initComponent();\n}\n\nfunction scrollTo( amount ) {\n overflower.animate( { scrollLeft: amount }, 600 , 'easeOutExpo' );\n}\n\nfunction scrollRight(){\n if(dataSlideNumber < (numberOfSlides-1)){\n dataSlideNumber++;\n scrollTo(scrollAmount * dataSlideNumber );\n }\n}\nfunction scrollLeft(){\n if(dataSlideNumber > 0){\n dataSlideNumber--;\n scrollTo(scrollAmount * dataSlideNumber );\n \n }\n}\n\nvar initComponent = function () {\n var totalInnerWidth = contentVideo.outerWidth(true) + contentColumn1.outerWidth(true) + contentMedium1.outerWidth(true) + contentMedium2.outerWidth(true) + contentColumn2.outerWidth(true);\n var overflowerWidth = overflower.outerWidth();\n var scrollCenterAmount = ( totalInnerWidth - overflowerWidth ) / 2 ;\n\n scrollAmount = totalInnerWidth / numberOfSlides ;\n\n initializeButtons();\n}\n\nfunction initializeButtons() {\n \n checkLeftRightVisibility();\n\n rightButton.on(\"click\",function(){\n scrollRight();\n checkLeftRightVisibility();\n });\n leftButton.on(\"click\",function(){\n scrollLeft();\n checkLeftRightVisibility();\n });\n\n // if($(window).width() > 767 && $(buttonsWrapper).length > 0 ){\n\n // try {\n // touchMethods.swipedetect( buttonsWrapper , function (swipedir) { \n // if(swipedir === 'right'){\n // scrollLeft();\n // }else if(swipedir === 'left'){\n // scrollRight();\n // }\n // });\n // } catch (error) {\n // console.warn(\"Roll component not loaded correctly.\");\n // }\n // }else {\n \n // }\n\n}\n\nfunction checkLeftRightVisibility() {\n // LOGIC FOR SHOW/HIDE NEXT/PREV hover buttons\n if(dataSlideNumber == 0){\n leftButton.addClass(\"opacity-less\");\n rightButton.removeClass(\"opacity-less\");\n }else if(dataSlideNumber == (numberOfSlides-1) ) {\n rightButton.addClass(\"opacity-less\");\n leftButton.removeClass(\"opacity-less\");\n }else{\n rightButton.removeClass(\"opacity-less\");\n leftButton.removeClass(\"opacity-less\");\n }\n}\n\nvar rollcomponent = {\n init: function () {\n initializeEvents();\n },\n otherFunction: function () {\n \n }\n};\n\nmodule.exports = rollcomponent;\n\n},{\"./touchEvents\":62}],58:[function(require,module,exports){\n'use strict';\n\nvar compareWidget = require('../compare-widget'),\n productTile = require('../product-tile'),\n progress = require('../progress'),\n util = require('../util'),\n genericSidebar = require('../generic-sidebar'),\n recommendations = require('./product/recommendations'),\n unrecommendations = require('./product/unrecommendations');\n\nfunction infiniteScroll() {\n var loadingPlaceHolder = $('.infinite-scroll-placeholder[data-loading-state=\"unloaded\"]');\n var gridUrl = loadingPlaceHolder.attr('data-grid-url');\n\n if (loadingPlaceHolder.length === 1 && util.elementInViewport(loadingPlaceHolder.get(0), 250)) {\n loadingPlaceHolder.attr('data-loading-state', 'loading');\n loadingPlaceHolder.addClass('infinite-scroll-loading');\n\n var fillEndlessScrollChunk = function (html) {\n loadingPlaceHolder.removeClass('infinite-scroll-loading');\n loadingPlaceHolder.attr('data-loading-state', 'loaded');\n $('div.search-result-content').append(html);\n };\n\n $.ajax({\n type: 'GET',\n dataType: 'html',\n url: gridUrl,\n success: function (response) {\n try {\n sessionStorage['scroll-cache_' + gridUrl] = response;\n } catch (e) {\n\n }\n\n fillEndlessScrollChunk(response);\n productTile.init('.tiles-container .product-tile-container', true);\n initSwatchesSlider();\n }\n });\n }\n}\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nfunction clickToInfiniteScroll() {\n var loadingPlaceHolderSelector = '.click-to-scroll[data-loading-state=\"unloaded\"]';\n\n $(document).on('click', loadingPlaceHolderSelector, function (e) {\n var loadingPlaceHolder = $(loadingPlaceHolderSelector);\n var gridUrl = loadingPlaceHolder.attr('data-grid-url');\n\n loadingPlaceHolder.attr('data-loading-state', 'loading');\n loadingPlaceHolder.addClass('infinite-scroll-loading');\n loadingPlaceHolder.find(\".click-to-scroll__content\").hide();\n loadingPlaceHolder.find(\".bottom-breakers-wrapper\").hide();\n\n var fillEndlessScrollChunk = function (html) {\n loadingPlaceHolder.removeClass('infinite-scroll-loading');\n loadingPlaceHolder.attr('data-loading-state', 'loaded');\n $('div.search-result-content').append(html);\n\n var focusElement = $('.click-to-scroll:last').attr('data-focuselement');\n\n try {\n AudioEye.focusElement('[data-pos=\"' + focusElement + '\"]');\n } catch (e) {\n console.log('audioeye not present');\n }\n\n //Change setting robots configuration - EC-2336\n $('meta[name=robots]').attr('content', 'noindex,​ ​follow');\n };\n\n $.ajax({\n type: 'GET',\n dataType: 'html',\n url: gridUrl,\n success: function (response) {\n try {\n sessionStorage['scroll-cache_' + gridUrl] = response;\n } catch (e) {\n\n }\n $(e.target).remove();\n fillEndlessScrollChunk(response);\n productTile.init('.tiles-container .product-tile-container', true);\n initSwatchesSlider();\n }\n });\n\n });\n}\n\n\n\n/**\n * @public\n * @function sortByChange() @plp.js\n * @description refresh the functionality of custom select for \"sort-by\" filter.\n */\n\nfunction refreshSortBySelect() {\n $('.custom-select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false\n });\n\n $('.sort-by select').selectric({\n disableOnMobile: false,\n nativeOnMobile: false,\n onOpen: function () {\n $('.sort-by .trigger-label').addClass('open');\n },\n onClose: function () {\n $('.sort-by .trigger-label').removeClass('open');\n }\n });\n}\n\n/**\n * @public\n * @function inViewButton() @plp.js\n * @description refresh the functionality of \"scrollToTop\" button.\n */\n\nfunction inViewButton() {\n //in caso di risultati ricerca vuoto il seguente selector è vuoto e il codice non deve essere eseguito\n if ($('.search-result-content').length > 0) {\n var resultContentOffestTop = $('.search-result-content').offset().top;\n var topBannerHeight = $('.top-banner').height();\n\n $(window).on('scroll', function () {\n var scroller = $(this).scrollTop();\n var footerInView = util.isInViewport('footer');\n\n if (scroller >= (resultContentOffestTop - topBannerHeight) /*&& !footerInView*/ ) {\n $('.scroll-top-products').addClass('in-view');\n //} else if (scroller >= (resultContentOffestTop - topBannerHeight) /*&& !footerInView*/) {\n //$('.scroll-top-button').removeClass('in-view');\n } else {\n $('.scroll-top-products').removeClass('in-view');\n }\n });\n }\n}\n\nfunction initSwatchesSlider() {\n $('.grid-tile').each(function () {\n $(this).find('.swatch-list-slider').not('.slick-initialized').slick({\n slidesToShow: 3\n });\n });\n}\n\nfunction scrollToTop() {\n if (util.isMobile()) {\n util.scrollBrowser(0);\n }\n}\n\nfunction scrollToListing() {\n if ($(window).width() < 1280) {\n var headerH = $('.header-container').outerHeight();\n var mainPosition = $('#main').offset().top;\n $('html, body').animate({\n scrollTop: mainPosition - headerH\n }, 650, 'easeInOutQuint');\n }\n}\n\n/**\n * @public\n * @function\n * @description init the price slider filter\n */\nfunction initPriceSlider() {\n // get filter values\n var val1 = parseInt($('.price1').val());\n var val2 = parseInt($('.price2').val());\n var min = parseInt($('.price-range-filter').attr('data-from'));\n var max = parseInt($('.price-range-filter').attr('data-to'));\n\n // init slider\n $(\".slider-range\").slider({\n range: true,\n min: min,\n max: max,\n step: 1,\n values: [val1, val2],\n slide: function (e, ui) {\n var price1 = Math.floor(ui.values[0]);\n $('.price1').val(price1);\n var price2 = Math.floor(ui.values[1]);\n $('.price2').val(price2);\n }\n });\n\n // update slider on inputs change\n $('.price1, .price2').on('input', function () {\n var val1 = parseInt($('.price1').val());\n var val2 = parseInt($('.price2').val());\n if (val2 >= val1) {\n $(\".slider-range\").slider(\"values\", [val1, val2]);\n }\n });\n\n // track slider changes on mobile\n $('.slider-range').on('slidechange', function (event, ui) {\n $(this).addClass('refinement-active');\n $(this).parents('.attr-refinement-content').find('.js-apply-filters').prop('disabled', false);\n $('.js-apply-filters-mobile').prop('disabled', false);\n });\n}\n\n\n/**\n * @public\n * @function\n * @description Update small active refinements tags\n */\nfunction updateMobileActiveRefinementsTags() {\n $('.attr-refinement').each(function () {\n var $activeFilters = $(this).find('.refinement-active');\n var $filtersContainer = $(this).find('.trigger-filters:not(.price)');\n\n $filtersContainer.html('');\n $activeFilters.each(function () {\n var name = $(this).find('.refinement-value').text();\n var id = $(this).attr('data-value');\n $filtersContainer.append('' + name + '');\n });\n });\n}\n\n\n/**\n * @public\n * @function\n * @description Order category refinements by sections (product, technology, etc.)\n */\nfunction initRefinementsOrderCategories() {\n\n $('.js-order-categories').each(function () {\n var $this = $(this);\n var technologyCategories = $this.find('.technology-refinement');\n\n // get category labels\n var productLabel = $('.category-refinement').attr('data-product-label');\n var technologyLabel = $('.category-refinement').attr('data-technology-label');\n\n // if there are technology refinements, order them\n if (technologyCategories.length) {\n $('
      • ' + productLabel + '
      • ').prependTo($this);\n $('
      • ' + technologyLabel + '
      • ').appendTo($this);\n technologyCategories.appendTo($this);\n }\n });\n\n}\n\n\n/**\n * @public\n * @function\n * @description Activate apply buttons related to this checkbox\n */\nfunction activateApplyButtons($checkbox, extraFilter) {\n // activate desktop button - Specific management for extra filter\n if (extraFilter && extraFilter == 'extra') {\n $checkbox.parents('.attr-refinement-content').find('.js-apply-extra-filters').prop('disabled', false);\n } else {\n $checkbox.parents('.attr-refinement-content').find('.js-apply-filters').prop('disabled', false);\n }\n\n // activate mobile button\n $('.js-apply-filters-mobile').prop('disabled', false);\n}\n\n\n/**\n * @public\n * @function\n * @description Update refinement checkbox status\n */\nfunction updateRefinementCheckbox($checkbox) {\n var isSortBy = $checkbox.parents('.sort-by').length;\n\n // if it's sort by, disable old active value and clear mobile tags\n if (isSortBy) {\n $checkbox.parents('.sort-by').find('.refinement-checkbox').removeClass('refinement-active');\n $checkbox.parents('.sort-by').find('.trigger-filters').html('');\n }\n\n $checkbox.toggleClass('refinement-active');\n\n var $filterContainer = $checkbox.parents('.attr-refinement-content');\n var refinementType = $filterContainer.attr('data-refinement-type');\n\n //In the case of an extra filter and if it is not in mobile, the new URL is built.\n if (refinementType == 'extra' && !window.matchMedia('(max-width: 767px)').matches) {\n var oldURL = $checkbox.data('refinement-reset-link');\n var updateURL = createAttributeRefinementExtraURL($checkbox, oldURL);\n\n $('.js-apply-extra-filters').data('filtering-url', updateURL);;\n }\n\n activateApplyButtons($checkbox, refinementType);\n}\n\n\n/**\n * @public\n * @function\n * @description Update refinement mobile tag\n */\nfunction updateRefinementMobileTag($checkbox) {\n var id = $checkbox.attr('data-value');\n var isRefinementActive = $checkbox.hasClass('refinement-active');\n\n if (isRefinementActive) {\n // add filter tag\n var name = $checkbox.find('.refinement-value').text();\n $checkbox.parents('.refinement').find('.trigger-filters').append('' + name + '');\n } else {\n // remove filter tag\n $('[data-refinement-id=\"' + id + '\"]').remove();\n }\n}\n\n\n/**\n * @public\n * @function\n * @description Create sort option URL\n */\nfunction createSortOptionURL($filter) {\n var $activeFilter = $filter.parents('.attr-refinement-content').find('.refinement-active');\n var url = $activeFilter.attr('data-value');\n\n return url;\n}\n\n\n/**\n * @public\n * @function\n * @description Create attribute refinement URL\n */\nfunction createAttributeRefinementURL($filter, type) {\n var $filterContainer = $filter.parents('.attr-refinement-content');\n var filterDivision = $filterContainer.attr('data-division') ? '&division=' + encodeURIComponent($filterContainer.attr('data-division')) : '';\n var $activeFilters = $filterContainer.find('.refinement-active');\n var oldURL = $filterContainer.find('.js-reset-filters').attr('data-reset-link');\n var separator = oldURL.indexOf('?') !== -1 ? '&' : '?';\n\n if (type == 'price') {\n // generate price refinement URL\n var min = getPriceMinValue();\n var max = getPriceMaxValue();\n var url = oldURL + separator + 'pmin=' + encodeURIComponent(min) + '&' + 'pmax=' + encodeURIComponent(max);\n } else {\n /* Get all active values and generate query string. - Retrieval of filter list in the Extra item to be grouped. */\n var paramURL = type;\n if (type == 'extra') {\n paramURL = $activeFilters.data('refinement-type-extra');\n }\n var queryString = '';\n $activeFilters.each(function (index) {\n queryString += index != 0 ? '|' : '';\n queryString += $(this).attr('data-value');\n });\n var index = getURLIndex(oldURL, 1);\n var url = oldURL + separator + 'prefn' + index + '=' + paramURL + '&' + 'prefv' + index + '=' + encodeURIComponent(queryString) + filterDivision;\n }\n\n return url;\n}\n\n/**\n * @public\n * @function\n * @description Create attribute refinement URL for EXTRA refinements\n */\nfunction createAttributeRefinementExtraURL($filter, oldURL) {\n var $filterContainer = $filter.parents('.attr-refinement-content');\n var filterDivision = $filterContainer.attr('data-division') ? '&division=' + encodeURIComponent($filterContainer.attr('data-division')) : '';\n var $activeFilters = $filterContainer.find('.refinement-active');\n\n var oldURL = oldURL;\n\n /* Get all active values and generate query string. - Retrieval of filter list in the Extra item to be grouped. */\n var url = '';\n var queryString = '';\n var paramURL = '';\n var oldURLExtra = oldURL;\n\n $activeFilters.each(function (index) {\n paramURL = $(this).data('refinement-type-extra');\n queryString = $(this).attr('data-value');\n\n var separator = oldURLExtra.indexOf('?') !== -1 ? '&' : '?';\n\n var index = getURLIndex(oldURLExtra, 1);\n oldURLExtra = oldURLExtra + separator + 'prefn' + index + '=' + paramURL + '&' + 'prefv' + index + '=' + encodeURIComponent(queryString) + filterDivision;\n });\n\n url = oldURLExtra;\n return url;\n}\n\n\n/**\n * @public\n * @function\n * @description Get price filter's min value. If invalid get general min value.\n */\nfunction getPriceMinValue() {\n var value = 0;\n var currentValue = parseInt($('.price1').val());\n var min = parseInt($('.price-range-filter').attr('data-from'));\n var decimalSeparator = $('.price-range-filter').attr('data-separator');\n var currentMax = parseInt($('.price2').val());\n\n if (currentValue && currentValue >= min && currentValue <= currentMax) {\n value = currentValue;\n } else {\n value = min;\n }\n\n return value + decimalSeparator + '00';\n}\n\n\n/**\n * @public\n * @function\n * @description Get price filter's max value. If invalid get general max value.\n */\nfunction getPriceMaxValue() {\n var value = 0;\n var currentValue = parseInt($('.price2').val());\n var currentMin = parseInt($('.price1').val());\n var decimalSeparator = $('.price-range-filter').attr('data-separator');\n var max = parseInt($('.price-range-filter').attr('data-to'));\n\n if (currentValue && currentValue <= max && currentValue >= currentMin) {\n value = currentValue;\n } else {\n value = max;\n }\n\n return value + decimalSeparator + '00';\n}\n\n\n/**\n * @public\n * @function\n * @description Get the first not already used filter index\n */\nfunction getURLIndex(url, index) {\n // index > 10 to prevent infinite loop\n if (url.indexOf('prefn' + index) == -1 || index > 10) {\n return index;\n } else {\n return getURLIndex(url, index + 1);\n }\n}\n\n\n/**\n * @private\n * @function\n * @description replaces breadcrumbs, lefthand nav and product listing with ajax and puts a loading indicator over the product listing\n */\nfunction updateProductListing(url, prevstate) {\n if (!url || url.indexOf(\"checkout\") >= 0 || url.indexOf(\"privacy\") >= 0) {\n return;\n }\n\n progress.show($('.search-result-content'));\n\n $('#main').load(util.appendParamToURL(url, 'format', 'ajax'), function () {\n /* url = url.replace('&division=apparel', '');\n url = url.replace('&division=footwear', '');\n url = url.replace(/&?prefn[1-9]=division/i, '');\n url = url.replace(/&?prefv[1-9]=APPAREL/i, '');\n url = url.replace(/&?prefv[1-9]=FOOTWEAR/i, ''); */\n util.appendParamToURL(url, 'format', 'ajax');\n compareWidget.init();\n productTile.init('.tiles-container .product-tile-container', true);\n progress.hide();\n //refreshSortBySelect();\n selectricClass.selectricCustomSelect();\n moveCategoryRefinementsOnMobile();\n moveEditorialCardsOnMobile();\n inViewButton();\n initSwatchesSlider();\n stickySidebarHelper.init();\n initPriceSlider();\n initRefinementsOrderCategories();\n updateMobileActiveRefinementsTags();\n updateGridPreference();\n\n // track current URL to restore it on close refinements\n window.currentURL = url;\n\n if (($('.cat-focus-banner').length == 0) && ($('.category-hero-banner').length == 0)) {\n $('.category-list-results-top').removeClass('hide');\n }\n });\n}\n\n\n/**\n * @public\n * @function\n * @description Update mobile grid preference\n */\nfunction updateGridPreference() {\n var gridPreference = localStorage.getItem('gridPreference');\n $('[data-grid-size]').removeClass('active-grid');\n\n if (gridPreference == 'small') {\n $('[data-grid-size=\"small\"]').addClass('active-grid');\n $('.search-result-content').addClass('small-grid');\n } else {\n $('[data-grid-size=\"large\"]').addClass('active-grid');\n $('.search-result-content').removeClass('small-grid');\n }\n}\n\n\n/**\n * @public\n * @function\n * @description Create mobile refinements URL\n */\nfunction createMobileRefinementURL() {\n var $filters = $('.attr-refinement-content');\n var url = $('.reset-btn.js-reset-filters').attr('data-reset-link');\n var filterIndex = 1;\n var isPriceFilterApplied = $('.trigger-filters.price').find('span').length;\n\n // check if the price filter is applied and force the refinement-active class\n if (isPriceFilterApplied) {\n $('.slider-range').addClass('refinement-active');\n }\n\n $filters.each(function () {\n var $filter = $(this);\n var $activeFilters = $filter.find('.refinement-active');\n\n if ($activeFilters.length) {\n var type = $filter.attr('data-refinement-type');\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n\n if (type == 'price') {\n // generate price refinement URL\n var min = getPriceMinValue();\n var max = getPriceMaxValue();\n url += separator + 'pmin=' + encodeURIComponent(min) + '&' + 'pmax=' + encodeURIComponent(max);\n } else if (type == 'sort') {\n // generate sort by filter\n url += separator + 'srule=' + encodeURIComponent($activeFilters.attr('data-id'));\n } else {\n /* Get all active values and generate query string.\n * Two cases: estra refinement, normal filter\n * Retrieval of filter list in the Extra item to be grouped. */\n if (type == 'extra') {\n var queryString = '';\n $activeFilters.each(function (index) {\n var paramURL = $(this).data('refinement-type-extra');\n queryString = $(this).attr('data-value');\n\n separator = url.indexOf('?') !== -1 ? '&' : '?';\n\n url += separator + 'prefn' + filterIndex + '=' + paramURL + '&' + 'prefv' + filterIndex + '=' + encodeURIComponent(queryString);\n filterIndex++;\n });\n } else {\n var paramUrl = type;\n var queryString = '';\n $activeFilters.each(function (index) {\n queryString += index != 0 ? '|' : '';\n queryString += $(this).attr('data-value');\n });\n url += separator + 'prefn' + filterIndex + '=' + paramUrl + '&' + 'prefv' + filterIndex + '=' + encodeURIComponent(queryString);\n filterIndex++;\n }\n }\n }\n\n });\n\n return url;\n}\n\n\n/**\n * @public\n * @function\n * @description Update refinements block\n */\nfunction updateRefinements() {\n var url = window.currentURL ? window.currentURL : window.location.href;\n $('.filter-btn.js-toggle-refinements').css('pointer-events', 'none');\n\n $('#refinements-wrapper').load(util.appendParamToURL(url, 'format', 'ajax') + ' #refinements-wrapper', function () {\n $('.filter-btn.js-toggle-refinements').removeAttr('style');\n moveCategoryRefinementsOnMobile();\n moveEditorialCardsOnMobile();\n initPriceSlider();\n updateMobileActiveRefinementsTags();\n updateGridPreference();\n });\n}\n\n\n/**\n * @public\n * @function\n * @description Move category filters inside rafinements sidebar on tablet and mobile\n */\nfunction moveCategoryRefinementsOnMobile() {\n if (window.matchMedia('(max-width: 1279px)').matches) {\n var areFiltersAlreadyMoved = $('.cat-refinement-content-mobile .category-refinement').length;\n // move category filters\n if (!areFiltersAlreadyMoved) {\n var $categoryRefinements = $('.category-refinement').clone();\n $categoryRefinements.appendTo('.cat-refinement-content-mobile');\n }\n // if there's some category dropdown open --> close it\n $('.category-refinement').find('.expandable').removeClass('active triggered');\n }\n}\n\n/**\n * @public\n * @function\n * @description Move editorial cards on mobile to fix PLP grid view\n */\nfunction moveEditorialCardsOnMobile() {\n if (window.matchMedia('(max-width: 767px)').matches) {\n if ($('.editorial-card').length > 1) {\n var secondEditorialCard = $('.editorial-card')[1];\n\n if ($(secondEditorialCard) && $(secondEditorialCard).index() % 2 != 0) {\n $(secondEditorialCard).insertBefore($(secondEditorialCard).prev('.grid-tile'));\n }\n\n }\n }\n}\n\n\n\n/**\n * @private\n * @function\n * @description Initializes events for the following elements:
        \n *

        refinement blocks

        \n *

        updating grid: refinements, pagination, breadcrumb

        \n *

        item click

        \n *

        sorting changes

        \n */\n\nfunction initializeEvents() {\n var $main = $('#main');\n\n $main.on('load', function () {\n var backToClickedTile = location.search.split(\"&pos=\")[1] || location.search.split(\"?pos=\")[1];\n if (backToClickedTile) {\n var posScrollTo = $main.find(\"[data-pos='\" + backToClickedTile + \"']\");\n // Scroll till the last clicked tile vertically.\n $('html, body').animate({\n scrollTop: posScrollTo.top - 100\n }, 500);\n }\n productTile.init('.tiles-container .product-tile-container', true);\n });\n\n $main.on('click', '.refinement .trigger', function () {\n // close other filters\n if (!$(this).hasClass('expanded')) {\n $('.refinement .trigger').removeClass('expanded');\n $('.refinement .trigger').siblings('.attr-refinement-content, .cat-refinement-content-mobile').slideUp();\n }\n $(this).toggleClass('expanded').siblings('.attr-refinement-content, .cat-refinement-content-mobile').stop().slideToggle(550, 'easeInOutQuint');\n });\n\n $main.on('click', '.pagination a, .breadcrumb-refinement-value a, .sort-by-list a', function (e) {\n if ($(this).parents('.category-refinement').length > 0 || $(this).parents('.folder-refinement').length > 0 || $(this).parent().hasClass('unselectable')) {\n return;\n }\n e.preventDefault();\n updateProductListing(this.href);\n productTile.init('.tiles-container .product-tile-container', true);\n });\n\n $main.on('click', '.refinement a', function (e) {\n if ($(this).parents('.category-refinement').length > 0 || $(this).parents('.folder-refinement').length > 0 || $(this).parent().hasClass('unselectable')) {\n return;\n }\n e.preventDefault();\n updateRefinementCheckbox($(this));\n updateRefinementMobileTag($(this));\n });\n\n // Sort by desktop\n if (!window.matchMedia('(max-width: 1279px)').matches) {\n $main.on('click', '.sort-link', function () {\n var url = createSortOptionURL($(this));\n updateProductListing(url);\n productTile.init('.tiles-container .product-tile-container', true);\n });\n }\n\n $main.on('click', '.js-apply-filters', function () {\n // disable button to prevent multiple clicks\n $('.filter-button').prop('disabled', true);\n\n // generate URL\n var filterType = $(this).parents('.attr-refinement-content').attr('data-refinement-type');\n var url = createAttributeRefinementURL($(this), filterType);\n\n updateProductListing(url);\n productTile.init('.tiles-container .product-tile-container', true);\n });\n\n $main.on('click', '.js-apply-extra-filters', function () {\n //Refinement Extra - Specific event triggered on click of the apply button\n // disable button to prevent multiple clicks\n $('.filter-button').prop('disabled', true);\n\n // generate URL\n var urlSet = $(this).data('filtering-url');\n\n updateProductListing(urlSet);\n productTile.init('.tiles-container .product-tile-container', true);\n\n });\n\n $main.on('click', '.js-apply-filters-mobile', function () {\n var url = createMobileRefinementURL();\n\n // disable button to prevent multiple clicks\n $(this).prop('disabled', true);\n\n scrollToListing();\n updateProductListing(url);\n $('.close-refinements.js-toggle-refinements').trigger('click', [true]); // close filters sidebar\n });\n\n $main.on('click', '.js-reset-filters', function () {\n // disable button to prevent multiple clicks\n $('.filter-button').prop('disabled', true);\n\n var url = $(this).attr('data-reset-link');\n updateProductListing(url);\n productTile.init('.tiles-container .product-tile-container', true);\n if (window.matchMedia('(max-width: 1279px)').matches) {\n $('.close-refinements.js-toggle-refinements').trigger('click', [false]); // close filters sidebar\n }\n });\n\n $main.on('click', '.js-toggle-refinements', function (e, applyFilters) {\n $('.refinements-attributes-wrapper').toggleClass('open');\n $('.tablet-overlay').fadeToggle();\n\n // block page scroll if sidebar is open\n var areRefinementsOpen = $('.refinements-attributes-wrapper').hasClass('open');\n if (window.matchMedia('(max-width: 767px)').matches) {\n util.togglePageScroll(areRefinementsOpen);\n }\n\n // reset not applied filters\n var isCloseRefinements = $(this).hasClass('close-refinements');\n var refinementsAreChanged = !$('.js-apply-filters-mobile').prop('disabled');\n if (isCloseRefinements && !applyFilters && refinementsAreChanged) {\n updateRefinements();\n }\n });\n\n $('.tablet-overlay').on('click', function () {\n var refinementsAreChanged = !$('.js-apply-filters-mobile').prop('disabled');\n if (refinementsAreChanged) {\n updateRefinements();\n }\n });\n\n $main.on('click', '.js-trigger-grid', function () {\n var gridSize = $(this).attr('data-grid-size');\n localStorage.setItem('gridPreference', gridSize);\n updateGridPreference();\n });\n\n $main.on('click', '.product-tile a:not(\"#quickviewbutton\")', function () {\n var a = $(this);\n var wl = window.location;\n var qsParams = (wl.search.length > 1) ? util.getQueryStringParams(wl.search.substr(1)) : {};\n var hashParams = (wl.hash.length > 1) ? util.getQueryStringParams(wl.hash.substr(1)) : {};\n var params = $.extend(hashParams, qsParams);\n\n if (!params.start) {\n params.start = 0;\n }\n\n var tile = a.closest('.product-tile');\n var idx = tile.data('idx') ? +tile.data('idx') : 0;\n params.start = (+params.start) + (idx + 1);\n a[0].hash = $.param(params);\n });\n\n $main.on('change', '.sort-by select', function (e) {\n e.preventDefault();\n var selectedOption = $(this).find(\":selected\");\n dataLayer.push(datalayerEvent('GAevent', '10', getTimestampAlphanumericString(), 'product_listing', 'sort_by', selectedOption.html().trim().toLowerCase().replace(/ /g, \"_\")));\n updateProductListing($(this).find('option:selected').val());\n productTile.init('.tiles-container .product-tile-container', true);\n });\n\n $(\".icon-filter-specialhighlights\").remove();\n\n\n if (document.querySelector(\"#category-level-1 > li:nth-child(2) > a > span\") != null && document.querySelector(\"#category-level-1 > li:nth-child(2) > a > span\").innerHTML.trim() == 'Special Highlights') {\n\n document.querySelector(\"#category-level-1 > li:nth-child(2) > a\").addClass(\"hide\");\n\n }\n\n $main.on('click', '.bannerhero__information .advance-information-button', function (e) {\n e.preventDefault();\n var url = $(this).attr('data-popup-sidebar');\n\n if (url == 'advance-information-modal') {\n genericSidebar.open('.sidebar-dialog-category-information', 'static', false);\n }\n });\n\n $main.on('click', '.hero-listing-stripe .advance-information-button', function (e) {\n e.preventDefault();\n var url = $(this).attr('data-popup-sidebar');\n\n if (url == 'advance-information-modal') {\n genericSidebar.open('.sidebar-dialog-category-information', 'static', false);\n }\n });\n\n $main.on('click', '#advance-information-modal .ui-dialog-titlebar-close', function (event) {\n event.preventDefault();\n $('#advance-information-modal').removeClass('sidebar-open');\n $('#advance-information-modal-overlay').removeClass('open');\n $('#advance-information-modal').find('#sidebar-dialog-header').removeClass('dialog-header-open');\n setTimeout(function () {\n $('html').removeClass('no-scroll');\n $('#sidebar-dialog').find('.sidebar-dialog-content').removeClass('show');\n }, 300);\n });\n\n $main.on('click', '#advance-information-modal-overlay', function (event) {\n event.preventDefault();\n $('#advance-information-modal').removeClass('sidebar-open');\n $('#advance-information-modal-overlay').removeClass('open');\n $('#advance-information-modal').find('#sidebar-dialog-header').removeClass('dialog-header-open');\n setTimeout(function () {\n $('html').removeClass('no-scroll');\n $('#sidebar-dialog').find('.sidebar-dialog-content').removeClass('show');\n }, 300);\n });\n\n moveCategoryRefinementsOnMobile();\n moveEditorialCardsOnMobile();\n updateGridPreference();\n updateMobileActiveRefinementsTags();\n initRefinementsOrderCategories();\n initPriceSlider();\n initSwatchesSlider();\n inViewButton();\n}\n\n/**\n * @public\n * @function\n * @description Product carousel observer (for no results page)\n */\nfunction setCarouselObserver() {\n var targetNode = document.getElementById('product-cluster-carousel-slot-container');\n console.log(\"setCarouselObserver -- file search\");\n if (targetNode) {\n var callback = function (mutationsList, observer) {\n for (var mutationIndex in mutationsList) {\n var mutation = mutationsList[mutationIndex];\n if (mutation.type === 'childList') {\n initProductCarouselEvents();\n break;\n }\n }\n observer.disconnect();\n };\n // Creazione di un'istanza di monitoraggio collegata alla funzione di callback\n var observer = new MutationObserver(callback);\n var config = {\n childList: true,\n subtree: true\n };\n // Inizio del monitoraggio del nodo target riguardo le mutazioni configurate\n observer.observe(targetNode, config);\n }\n};\n\n/**\n * @public\n * @function\n * @description Init product carousel events (for no results page)\n */\nvar initProductCarouselEvents = function () {\n recommendations();\n productTile.init('#carousel-recommendations .product-tile-container', false);\n productTile.init(\"#carousel-editorial .product-tile-container\", false);\n productTile.init('.best-products-box .product-tile-container', false);\n};\n\nvar unsetProductCarouselEvents = function () {\n unrecommendations();\n}\n\nexports.init = function () {\n compareWidget.init();\n\n if (SitePreferences.LISTING_INFINITE_SCROLL) {\n // $(window).on('scroll', infiniteScroll);\n clickToInfiniteScroll();\n }\n\n productTile.init('.tiles-container .product-tile-container', true);\n productTile.init('.brk-edit-tiles-container .product-tile-container', true);\n initializeEvents();\n\n setCarouselObserver();\n\n //Function initialization on window object\n window.unsetProductCarouselEvents = unsetProductCarouselEvents;\n window.initProductCarouselEvents = initProductCarouselEvents;\n\n if ($(\"#carousel-recommendations .product-tile\").length > 0 || $(\"#carousel-editorial .product-tile\").length > 0 || $(\".best-products-box .product-tile\").length > 0) {\n initProductCarouselEvents();\n }\n};\n\n},{\"../compare-widget\":8,\"../generic-sidebar\":22,\"../product-tile\":65,\"../progress\":66,\"../util\":79,\"./product/recommendations\":50,\"./product/unrecommendations\":54}],59:[function(require,module,exports){\n'use strict';\n\nvar slickButtonsHeight = require('../slickButtonsHeight');\nvar preloader = require('../preloader');\nvar rollcomponent = require('./roll-component');\nvar WishlistComponent = require(\"../custom/wishlistComponent\");\nvar recommendations = require('./product/recommendations'),\n unrecommendations = require('./product/unrecommendations'),\n productTile = require('../product-tile');\n\nexports.init = function () {\n setCarouselObserver();\n setTechSlider();\n // slider/video common functions moved to contentUtils.js\n\n // start Old functions - remove after reskinning\n setSlotSliders();\n setHighlightComposition();\n setHeroCarousels();\n setOldSliders();\n rollcomponent.init();\n loadVimeo();\n // end Old functions - remove after reskinning\n\n //Function initialization on window object\n window.initProductCarouselEvents = initProductCarouselEvents;\n window.unsetProductCarouselEvents = unsetProductCarouselEvents;\n\n if ($(\"#carousel-recommendations .product-tile\").length > 0 || $(\"#carousel-editorial .product-tile\").length > 0 || $(\".best-products-box .product-tile\").length > 0) {\n initProductCarouselEvents();\n }\n};\n\nfunction loadVimeo() {\n // --------------------------------------- //\n // VIDEO --- old js\n if ($('.home-top-cover__video iframe').length) {\n $.when(\n $.getScript(\"https://player.vimeo.com/api/player.js\"),\n $.Deferred(function (deferred) {\n $(deferred.resolve);\n })\n )\n .done(function () {\n var player = new Vimeo.Player($('.home-top-cover__video iframe'));\n var ctaContainer = $(\".home-top-cover__container .home-top-cover__cta-overlay\");\n player.on('play', function () {\n ctaContainer.fadeOut();\n });\n player.on('pause', function () {\n ctaContainer.fadeIn();\n });\n });\n }\n};\n\nfunction setCarouselObserver() {\n var targetNode = document.getElementById('product-cluster-carousel-slot-container');\n console.log(\"setCarouselObserver -- file storefront\");\n if (targetNode) {\n var callback = function (mutationsList, observer) {\n for (var mutationIndex in mutationsList) {\n var mutation = mutationsList[mutationIndex];\n if (mutation.type === 'childList') {\n initProductCarouselEvents();\n break;\n }\n }\n observer.disconnect();\n };\n // Creazione di un'istanza di monitoraggio collegata alla funzione di callback\n var observer = new MutationObserver(callback);\n var config = {\n childList: true,\n subtree: true\n };\n // Inizio del monitoraggio del nodo target riguardo le mutazioni configurate\n observer.observe(targetNode, config);\n }\n}\n\nfunction setTechSlider() {\n\n /* Technologies highlight slider */\n if ($('.techselection-highlights').length > 0) {\n var $techContainer = $('.techselection-highlights'),\n $swipeTabsContainer = $techContainer.find('.swipe-tabs'),\n $swipeTabs = $techContainer.find('.swipe-tab'),\n $swipeTabsContentContainer = $techContainer.find('.swipe-content'),\n $swipeTabsContentRow = $techContainer.find('.swipe-content-row'),\n currentIndex = 0,\n activeTabClassName = 'active';\n\n $swipeTabsContainer.on('init', function (event, slick) {\n // update swipe tabs after initialize slick with infinite mode\n if (slick.options.infinite) {\n $swipeTabs = $techContainer.find('.swipe-tab');\n }\n // init active tab\n currentIndex = slick.getCurrent();\n $swipeTabs.removeClass(activeTabClassName);\n $techContainer.find('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName);\n });\n\n // Tabs content - toggle background image on init\n $swipeTabsContentContainer.on('init', function (event, slick) {\n currentIndex = slick.getCurrent();\n toggleBackgroundImage(currentIndex);\n });\n\n // Tabs content - toggle background image on change slide\n $swipeTabsContentContainer.on('beforeChange', function (event, slick, currentSlide, nextSlide) {\n toggleBackgroundImage(nextSlide);\n });\n\n // Tabs content - toggle background image on change slide\n var toggleBackgroundImage = function (index) {\n var $slideElem = $swipeTabsContentContainer.find('.slick-slide[data-slick-index=' + index + ']');\n\n var bgMobile = typeof $slideElem[0].dataset.bgSm != 'undefined' ? $slideElem[0].dataset.bgSm : '';\n var bgTablet = typeof $slideElem[0].dataset.bgMd != 'undefined' ? $slideElem[0].dataset.bgMd : '';\n var bgDesktop = typeof $slideElem[0].dataset.bgLg != 'undefined' ? $slideElem[0].dataset.bgLg : '';\n\n if (bgMobile != '' || bgTablet != '' || bgDesktop != '') {\n if ($(window).width() <= 767 && bgMobile != '') {\n $swipeTabsContentRow.css('background-image', 'url(' + bgMobile + ')');\n } else if ($(window).width() > 767 && $(window).width() <= 1279 && bgTablet != '') {\n $swipeTabsContentRow.css('background-image', 'url(' + bgTablet + ')');\n } else if ($(window).width() > 1279 && bgDesktop != '') {\n $swipeTabsContentRow.css('background-image', 'url(' + bgDesktop + ')');\n }\n } else {\n // reset default background image\n $swipeTabsContentRow.removeAttr('style');\n }\n }\n\n $swipeTabsContainer.slick({\n slidesToShow: 4,\n slidesToScroll: 1,\n arrows: false,\n infinite: false,\n swipeToSlide: true,\n touchThreshold: 10,\n variableWidth: true,\n responsive: [{\n breakpoint: 992,\n settings: {\n slidesToShow: 2,\n infinite: true,\n centerMode: true,\n centerPadding: '50px'\n }\n }]\n });\n\n $swipeTabsContentContainer.slick({\n asNavFor: $swipeTabsContainer,\n slidesToShow: 1,\n slidesToScroll: 1,\n arrows: false,\n infinite: false,\n swipeToSlide: true,\n draggable: false,\n touchThreshold: 10,\n responsive: [{\n breakpoint: 992,\n settings: {\n infinite: true\n }\n }]\n });\n\n // Tabs click handler\n $swipeTabs.on('click', function (event) {\n currentIndex = $(this).data('slick-index');\n $techContainer.find('.swipe-tab').removeClass(activeTabClassName);\n $swipeTabsContainer.slick('slickGoTo', currentIndex);\n $swipeTabsContentContainer.slick('slickGoTo', currentIndex);\n $swipeTabsContentContainer.on('afterChange', function (event, slick, currentSlide, nextSlide) {\n currentIndex = currentSlide;\n $techContainer.find('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName);\n });\n });\n\n // Tabs swipe handler\n $swipeTabsContentContainer.on('swipe', function (event, slick, direction) {\n currentIndex = $(this).slick('slickCurrentSlide');\n $swipeTabs.removeClass(activeTabClassName);\n $techContainer.find('.swipe-tab[data-slick-index=' + currentIndex + ']').addClass(activeTabClassName);\n });\n }\n}\n\nfunction setSlotSliders() {\n\n // --------------------------------------- //\n // SLOT SLIDER --- old js\n if ($(window).width() > 767) {\n\n $(\".slot-slider-2img\").slick({\n infinite: true,\n centerMode: true,\n centerPadding: '130px',\n slidesToShow: 2,\n slidesToScroll: 2,\n prevArrow: '',\n nextArrow: ''\n });\n\n } else {\n $(\".slot-slider-2img\").slick({\n infinite: true,\n centerMode: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: ''\n });\n }\n\n if ($(window).width() > 959) {\n $(\".slot-slider-3img\").slick({\n infinite: true,\n centerMode: true,\n centerPadding: '130px',\n slidesToShow: 3,\n slidesToScroll: 3,\n prevArrow: '',\n nextArrow: ''\n });\n\n $(\"#homepage-block-9-slider\").slick({\n infinite: true,\n centerMode: true,\n centerPadding: '130px',\n slidesToShow: 3,\n slidesToScroll: 3,\n prevArrow: '',\n nextArrow: ''\n });\n\n $(\"#homepage-block-11-slider\").slick({\n infinite: true,\n centerMode: true,\n centerPadding: '130px',\n slidesToShow: 3,\n slidesToScroll: 3,\n prevArrow: '',\n nextArrow: ''\n });\n } else {\n $(\".slot-slider-3img\").slick({\n infinite: true,\n centerMode: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: ''\n });\n }\n // end SLOT SLIDER --- old js\n // --------------------------------------- //\n}\n\n\nfunction setHighlightComposition() {\n\n // --------------------------------------- //\n // HIGHLIGHT COMPOSITION --- old js\n if ($(window).width() > 767) {\n $(\"#chc .main-image\").slick({\n infinite: true,\n dots: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n asNavFor: '#chc .content, #chc .context-image, #chc .product-image, #chc .button-container',\n prevArrow: '',\n nextArrow: '',\n speed: 800\n });\n $(\"#chc .content\").slick({\n infinite: true,\n arrows: false,\n swipe: false,\n touchMove: false,\n fade: true,\n slidesToShow: 1,\n slidesToScroll: 1\n });\n $(\"#chc .context-image\").slick({\n infinite: true,\n arrows: false,\n swipe: false,\n touchMove: false,\n fade: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n speed: 800\n });\n $(\"#chc .product-image\").slick({\n infinite: true,\n arrows: false,\n swipe: false,\n touchMove: false,\n fade: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n speed: 200\n });\n $(\"#chc .button-container\").slick({\n infinite: true,\n arrows: false,\n swipe: false,\n touchMove: false,\n fade: true,\n slidesToShow: 1,\n slidesToScroll: 1\n });\n }\n // end HIGHLIGHT COMPOSITION --- old js\n // --------------------------------------- //\n}\n\nfunction setHeroCarousels() {\n\n // --------------------------------------- //\n // MAIN SLIDER HOMEPAGE --- old js\n $(\"#hp-slider-1, #hp-slider-3\").slick({\n infinite: true,\n dots: true,\n autoplay: true,\n autoplaySpeed: 5000,\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: ''\n });\n\n $(\"#hp-slider-2 .images\").slick({\n infinite: true,\n dots: true,\n autoplay: false,\n autoplaySpeed: 5000,\n asNavFor: '#hp-slider-2 .messages',\n slidesToShow: 1,\n slidesToScroll: 1,\n prevArrow: '',\n nextArrow: ''\n });\n\n if ($(window).width() > 767) {\n $(\"#hp-slider-2 .messages\").slick({\n slidesToShow: 1,\n slidesToScroll: 1,\n arrows: false,\n fade: true,\n asNavFor: '#hp-slider-2 .images'\n });\n } else {\n $(\"#hp-slider-2 .messages\").slick({\n slidesToShow: 1,\n slidesToScroll: 1,\n arrows: false,\n fade: false,\n asNavFor: '#hp-slider-2 .images'\n });\n }\n\n // FIX PER IL LOADING\n $(\"#hp-slider-1 .hp-slide, #hp-slider-2 .hp-slide, #hp-slider-3 .hp-slide\").addClass('loaded');\n\n // end MAIN SLIDER HOMEPAGE --- old js\n // --------------------------------------- //\n}\n\n// The following function is not necessary since the recommendations module is doing the same work.\nfunction setClusterCarousel() {\n // PRODUCT CLUSTER CAROUSEL\n if ($(window).width() > 1279) {\n $(\"#carousel-recommendations, #carousel-editorial\").slick({\n infinite: true,\n dots: true,\n slidesToShow: 4,\n slidesToScroll: 4,\n prevArrow: '',\n nextArrow: ''\n });\n } else {\n if ($(window).width() > 767) {\n $(\"#carousel-recommendations, #carousel-editorial\").slick({\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 3,\n slidesToScroll: 3\n });\n } else {\n $(\"#carousel-recommendations, #carousel-editorial\").slick({\n infinite: true,\n arrows: false,\n dots: true,\n slidesToShow: 2,\n slidesToScroll: 2\n });\n }\n }\n\n\n var pre = new preloader();\n\n var imagesToLoad = [$(\"#carousel-recommendations img, #carousel-editorial img\").eq(0).attr('src')];\n\n pre.init({\n callback: function (results) {\n slickButtonsHeight.init('#carousel-recommendations, #carousel-editorial', '.product-tile');\n },\n array: imagesToLoad\n });\n\n}\n\nfunction setOldSliders() {\n\n // --------------------------------------- //\n // SLIDER HOMEPAGE --- old js\n $('#homepage-slider')\n // responsive slides\n .on('jcarousel:create jcarousel:reload', function () {\n var element = $(this),\n width = element.innerWidth();\n element.jcarousel('items').css('width', width + 'px');\n })\n .jcarousel({\n wrap: 'circular'\n })\n .jcarouselAutoscroll({\n interval: 5000\n });\n $('#homepage-slider .jcarousel-control')\n .on('jcarouselpagination:active', 'a', function () {\n $(this).addClass('active');\n })\n .on('jcarouselpagination:inactive', 'a', function () {\n $(this).removeClass('active');\n })\n .jcarouselPagination({\n item: function (page) {\n return '
        ' + page + '';\n }\n });\n\n $('#vertical-carousel')\n .jcarousel({\n vertical: true\n })\n .jcarouselAutoscroll({\n interval: 5000\n });\n $('#vertical-carousel .jcarousel-prev')\n .on('jcarouselcontrol:active', function () {\n $(this).removeClass('inactive');\n })\n .on('jcarouselcontrol:inactive', function () {\n $(this).addClass('inactive');\n })\n .jcarouselControl({\n target: '-=1'\n });\n\n $('#vertical-carousel .jcarousel-next')\n .on('jcarouselcontrol:active', function () {\n $(this).removeClass('inactive');\n })\n .on('jcarouselcontrol:inactive', function () {\n $(this).addClass('inactive');\n })\n .jcarouselControl({\n target: '+=1'\n });\n // end SLIDER HOMEPAGE --- old js\n // --------------------------------------- //\n}\n\n// PCC slider tiles + swatch colors animation\nvar initProductCarouselEvents = function () {\n recommendations();\n productTile.init('#carousel-recommendations .product-tile-container, #carousel-editorial .product-tile-container', false);\n productTile.init('.best-products-box .product-tile-container', false);\n new WishlistComponent(true, false);\n};\n\nvar unsetProductCarouselEvents = function () {\n unrecommendations();\n}\n\n},{\"../custom/wishlistComponent\":19,\"../preloader\":64,\"../product-tile\":65,\"../slickButtonsHeight\":73,\"./product/recommendations\":50,\"./product/unrecommendations\":54,\"./roll-component\":57}],60:[function(require,module,exports){\n'use strict';\nvar dialog = require('../dialog'),\n storelocatorController = require('../custom/storelocator'),\n genericSidebar = require('../generic-sidebar'),\n util = require('../util'),\n tooltip = require('../tooltip'),\n mapController = require('../custom/storelocator.mapcontroller');\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nexports.init = function () {\n $.when(\n window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE && $.getScript(window.Urls.googleMap),\n $.Deferred(function (deferred) {\n $(deferred.resolve);\n })\n ).done(function () {\n //\n //\n mapController.BasicMapController.api.init(window.SessionAttributes.IS_GOOGLE_MAPS_ACTIVE);\n\n var storePageController = {\n page: 'storelocator',\n countryField: $('#dwfrm_storelocator_country'),\n cityField: $('#dwfrm_storelocator_cityPostalCode'),\n clickButton: $('#store-locator-submit'),\n geolocationButton: $('.js-reserve-geolocation'),\n filterButton: $('.js-apply-filters-storelocator'),\n maxdistance: $('#maxdistance'),\n mapController: mapController,\n getStoresInterceptor: function () {\n if ($('#dwfrm_storelocator_country').val() == 'IT' && ($('#dwfrm_storelocator_cityPostalCode').length == 0 || $('#dwfrm_storelocator_cityPostalCode').val().length == 0)) {\n\n if ($('#stores-results-regions').children().length) {\n // Case: content already filled in on page load\n $('#stores-results-regions').find(\"a\").click(function (e) {\n e.preventDefault();\n });\n } else {\n // Get content\n $.ajax({\n url: Urls.regionsProvinces,\n success: function (response) {\n $('#stores-results-regions').empty().html(response);\n $('#stores-results-regions').find(\"a\").click(function (e) {\n e.preventDefault();\n });\n // reset map a livello Italia\n // Safe call.\n /*\n mapController.BasicMapController.api.update(null,false);\n mapController.BasicMapController.api.updateMapCenter();\n */\n }\n });\n }\n return true;\n } else {\n $('#stores-results-regions').empty();\n }\n return false;\n },\n customInit: function () {\n\n //Show map and Adapt bounds when click Map view mobile\n $('.tab-button-map').on('click touchstart', function (e) {\n $('.tab-button').removeClass('active');\n $('.tab-button-map').addClass('active');\n $('#storelocator-map').slideDown('200');\n $('#storelocator-map-title').show();\n //For italy slide up list if is a store result list (not a province list)\n if (self.countryField.val() == \"IT\") {\n if ($('#stores-results-list').find('.storelocator-result').length > 0) {\n $('#stores-results-list').slideUp('200');\n }\n } else {\n $('#stores-results-list').slideUp('200');\n }\n });\n $('.tab-button-map').on('touchend', function (e) {\n if ($('#storelocator-map').is(':visible')) {\n self.mapController.BasicMapController.api.adaptZoomLevel();\n }\n });\n\n // on geolocation click --> icon style active\n this.geolocationButton.on('click', function (e) {\n $('.js-reserve-geolocation').addClass('active');\n });\n\n // on search click\n this.clickButton.on('click', function (e) {\n // remove geolocation icon active style\n $('.js-reserve-geolocation').removeClass('active');\n // reset all filters\n $('.filter-option').removeClass('active');\n $('.filter-button').prop('disabled', true);\n });\n\n // on apply filters --> activate reset button\n this.filterButton.on('click', function () {\n $('.js-reset-filters-storelocator').prop('disabled', false);\n // close accordion\n var $parent = $(this).parents('.storelocator-filter');\n var $content = $parent.find('.filter-content');\n if ($parent.hasClass('open')) {\n $parent.removeClass('open');\n $content.slideUp(200);\n }\n });\n }\n };\n $.extend(storelocatorController.storePageController, storePageController);\n storelocatorController.storePageController.init();\n\n tooltip.init();\n\n $('.store-details-link').on('click', function (e) {\n e.preventDefault();\n dialog.open({\n url: $(e.target).attr('href')\n });\n });\n\n // filters dropdown\n $('.filter-label').on('click', function () {\n var $parent = $(this).parents('.storelocator-filter');\n var $content = $parent.find('.filter-content');\n\n if ($parent.hasClass('open')) {\n $parent.removeClass('open');\n $content.slideUp(200);\n } else {\n $parent.addClass('open');\n $content.slideDown(200);\n }\n });\n\n // on filter checkbox click\n $('.filter-option').on('click', function () {\n $(this).toggleClass('active');\n // activate apply filters button\n if ($('.filter-option.active').length) {\n $('.js-apply-filters-storelocator').attr('disabled', false);\n }\n });\n\n // on reset click\n $(document).on('click', '.js-reset-filters-storelocator', function () {\n // remove filters and trigger search\n $('.filter-option').removeClass('active');\n $('.js-apply-filters-storelocator').trigger('click', [true]);\n // disable apply/reset buttons\n $('.js-reset-filters-storelocator').prop('disabled', true);\n $('.js-apply-filters-storelocator').prop('disabled', true);\n });\n\n // toggle mobile filters sidebar\n $(document).on('click', '.js-toggle-refinements', function () {\n $('.storelocator-filters-wrapper').toggleClass('open');\n\n // block page scroll if sidebar is open\n var areRefinementsOpen = $('.storelocator-filters-wrapper').hasClass('open');\n if (window.matchMedia('(max-width: 767px)').matches) {\n util.togglePageScroll(areRefinementsOpen);\n }\n });\n\n // clear geolocation input value on focus in\n $(document).on('focusin', '.cityorzip input', function () {\n if ($('.js-reserve-geolocation').hasClass('active')) {\n $(this).val('');\n }\n });\n\n\n if (window.matchMedia('(max-width: 767px)').matches) {\n\n $(document).on('click', '.storeprovince-region', function () {\n var $this = $(this).parents('.storeprovince-result');\n // if current dropdown is selected\n if ($this.hasClass('open')) {\n $this.removeClass('open');\n $this.find('.storeprovince-provinces').slideUp(200);\n } else {\n // close active dropdowns\n $('.storeprovince-result.open').find('.storeprovince-provinces').slideUp(200);\n $('.storeprovince-result').removeClass('open');\n // open clicked dropdown\n $this.addClass('open');\n $this.find('.storeprovince-provinces').slideDown(200);\n }\n });\n\n // description modal mobile\n $(document).on('click', '.storelocator-result', function (e, eventID) {\n // disable link href\n e.preventDefault();\n var id = $(this).attr('data-store-id');\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': eventID ? eventID : ($('.pt_storelocator').length ? '76' : '97'),\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': $('.pt_storelocator').length ? 'store_locator' : 'benefeet',\n 'eventAction': $('.pt_storelocator').length ? $(this).attr('data-store-name') : 'participating_stores',\n 'eventLabel': eventID ? 'placeholder_map_' + $(this).attr('data-store-name') : ($('.pt_storelocator').length ? 'discover_more' : 'click-' + $(this).attr('data-store-name'))\n });\n\n genericSidebar.open('#store-content-' + id, 'static', false);\n });\n\n // switch map/list mobile\n $(document).on('click', '.js-trigger-grid', function () {\n var gridType = $(this).attr('data-grid');\n $('[data-grid]').removeClass('active-grid');\n\n if (gridType == 'map') {\n $('[data-grid=\"map\"]').addClass('active-grid');\n $('.stores-results-list').fadeOut();\n // re-calculate map zoom on switch\n $('#storelocator-map').fadeIn(200, function () {\n setTimeout(function () {\n $('.js-apply-filters-storelocator').trigger('click');\n }, 300);\n });\n } else {\n $('[data-grid=\"list\"]').addClass('active-grid');\n $('#storelocator-map').fadeOut();\n $('.stores-results-list').fadeIn();\n }\n });\n\n } else {\n // result store dropdown\n $(document).on('click', '.storelocator-result .store-header', function (e, eventID) {\n // disable link href\n e.preventDefault();\n var $this = $(this).parents('.storelocator-result');\n\n // if current dropdown is selected\n if ($this.hasClass('store-selected')) {\n $this.removeClass('store-selected');\n $this.find('.store-info-content').slideUp(200);\n } else {\n // close active dropdowns\n $('.storelocator-result.store-selected').find('.store-info-content').slideUp(200);\n $('.storelocator-result').removeClass('store-selected');\n // open clicked dropdown\n $this.addClass('store-selected');\n $this.find('.store-info-content').slideDown(200);\n\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': eventID ? eventID : ($('.pt_storelocator').length ? '76' : '97'),\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': $('.pt_storelocator').length ? 'store_locator' : 'benefeet',\n 'eventAction': $('.pt_storelocator').length ? $(this).parents('.storelocator-result').attr('data-store-name') : 'participating_stores',\n 'eventLabel': eventID ? 'placeholder_map_' + $(this).parents('.storelocator-result').attr('data-store-name') : ($('.pt_storelocator').length ? 'discover_more' : 'click-' + $(this).parents('.storelocator-result').attr('data-store-name'))\n });\n }\n });\n }\n\n });\n};\n\n},{\"../custom/storelocator\":15,\"../custom/storelocator.mapcontroller\":16,\"../dialog\":20,\"../generic-sidebar\":22,\"../tooltip\":78,\"../util\":79}],61:[function(require,module,exports){\n'use strict';\n\nvar productTile = require('../product-tile');\nvar recommendations = require('./product/recommendations');\nvar WishlistComponent = require(\"../custom/wishlistComponent\");\n\n /**\n * @private\n * @function\n * @description Initializes events for the following elements:
        \n *

        refinement blocks

        \n *

        updating grid: refinements, pagination, breadcrumb

        \n *

        item click

        \n *

        sorting changes

        \n */\n\nfunction initializeEvents(){\n var newHeight = $('.product-tile-container').height();\n $('#banner-image').height(newHeight);\n\n $(\".landing-menu .menu-ul li a\").click(function() {\n $('html, body').animate({\n scrollTop: $($(this).attr('data-target')).offset().top - 150\n }, 650, 'easeInOutQuint');\n\n return false;\n });\n\n recommendations();\n\n $(window).scroll(function() {\n if ($(document).scrollTop() > 27) {\n $(\".technology-landing-page .landing-menu\").addClass(\"affixmenu\");\n } else {\n $(\".technology-landing-page .landing-menu\").removeClass(\"affixmenu\");\n }\n });\n\n var imgheightfirst = $('#first .banner-left').height();\n\n if ($(window).width() > 960) {\n $('#first .banner-right .text-blue-bg').css('minHeight', imgheightfirst);\n }\n\n \n}\n\nexports.init = function () {\n productTile.init('#carousel-recommendations .product-tile-container', false);\n new WishlistComponent(true, false);\n initializeEvents();\n};\n\n},{\"../custom/wishlistComponent\":19,\"../product-tile\":65,\"./product/recommendations\":50}],62:[function(require,module,exports){\n// credit: http://www.javascriptkit.com/javatutors/touchevents2.shtml\nfunction swipedetect(el, callback){\n \n var touchsurface = el.get(0),\n swipedir,\n startX,\n startY,\n distX,\n distY,\n threshold = 150, //required min distance traveled to be considered swipe\n restraint = 100, // maximum distance allowed at the same time in perpendicular direction\n allowedTime = 300, // maximum time allowed to travel that distance\n elapsedTime,\n startTime,\n handleswipe = callback || function(swipedir){}\n \n touchsurface.addEventListener('touchstart', function(e){\n var touchobj = e.changedTouches[0]\n swipedir = 'none'\n dist = 0\n startX = touchobj.pageX\n startY = touchobj.pageY\n startTime = new Date().getTime() // record time when finger first makes contact with surface\n e.preventDefault()\n }, false)\n \n touchsurface.addEventListener('touchmove', function(e){\n e.preventDefault() // prevent scrolling when inside DIV\n }, false)\n \n touchsurface.addEventListener('touchend', function(e){\n var touchobj = e.changedTouches[0]\n distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface\n distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface\n elapsedTime = new Date().getTime() - startTime // get time elapsed\n if (elapsedTime <= allowedTime){ // first condition for awipe met\n if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint){ // 2nd condition for horizontal swipe met\n swipedir = (distX < 0)? 'left' : 'right' // if dist traveled is negative, it indicates left swipe\n }\n else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint){ // 2nd condition for vertical swipe met\n swipedir = (distY < 0)? 'up' : 'down' // if dist traveled is negative, it indicates up swipe\n }\n }\n handleswipe(swipedir)\n e.preventDefault()\n }, false)\n}\n\nvar objects = { \n swipedetect : swipedetect \n} ;\n\nmodule.exports = objects;\n},{}],63:[function(require,module,exports){\n'use strict';\n\nvar addProductToCart = require('./product/addToCart'),\n page = require('../page'),\n login = require('../login'),\n lodash = require('lodash'),\n eventUtils = require('../eventHandlingUtils'),\n util = require('../util');\n\nexports.init = function () {\n addProductToCart();\n $('#editAddress').on('change', function () {\n page.redirect(util.appendParamToURL(Urls.wishlistAddress, 'AddressID', $(this).val()));\n });\n\n // Initialization of the wishlist sharing popup\n $('#wishlist-popup-background-overlay').hide();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').hide();\n $('#ShareWishlist').addClass('disabled').attr('disabled', 'true');\n\n // Show wishlist sharing popup button\n if (!eventUtils.checkClickEventAttached('#share-wishlist-mail-button', 'open-wishlist-share-popup')) {\n $(document).on('click', '#share-wishlist-mail-button', {\n eventName: 'open-wishlist-share-popup'\n }, function () {\n $('#wishlist-popup-background-overlay').show().css('display', 'flex');\n });\n }\n\n // Close wishlist sharing popup button\n if (!eventUtils.checkClickEventAttached('#popup-close, #ShareWishlistClose', 'close-wishlist-share-popup')) {\n $(document).on('click', '#popup-close, #ShareWishlistClose', {\n eventName: 'close-wishlist-share-popup'\n },\n function () {\n $('#ShareWishlist').find('input').removeClass('error').val(\"\");\n $('#ShareWishlist').addClass('disabled').attr('disabled', true);\n $('#ShareWishlist').find('span[id*=\"error\"]').hide();\n\n $('#wishlist-popup-background-overlay').find('.main-container').show();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').find('.share-success, .share-error').hide();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').hide();\n $('#wishlist-popup-background-overlay').hide();\n\n $('#ShareWishlistButton').find('span[class*=\"text\"]').show();\n $('#ShareWishlistButton').find(\".spinner\").hide();\n });\n }\n\n //Enable|Disable wishlist sharing form based on input fields\n $('#ShareWishlist').find('input[name*=\"email\"]').on('keyup focusout change', lodash.debounce(function () {\n if ($(this).val() != \"\" && $(this).hasClass('valid')) {\n $('#ShareWishlist').removeClass('disabled').removeAttr('disabled');\n } else {\n $('#ShareWishlist').addClass('disabled').attr('disabled', 'true');\n }\n }, 100));\n\n //Prevent submit on enter for wishlist sharing form\n $('#ShareWishlist').on('keyup keypress', function (event) {\n var keyCode = event.keyCode || event.which;\n if (keyCode === 13) {\n event.preventDefault();\n return false;\n }\n });\n\n //Ajax call on wishlist share submit-button click\n if (!eventUtils.checkClickEventAttached('#ShareWishlistButton', 'send_wishlist')) {\n $(document).on('click', '#ShareWishlistButton', {\n eventName: 'send_wishlist'\n }, function () {\n if ($('#ShareWishlist').find('input').val() != \"\" && $('#ShareWishlist').find('input').hasClass('valid')) {\n var forminput = $('#ShareWishlist').serialize();\n forminput += (forminput !== '') ? '&' : '';\n forminput += $(this).attr('name') + '=' + $(this).html();\n $.ajax({\n method: \"POST\",\n url: $('#ShareWishlistButton').data('action'),\n data: forminput,\n success: function (data) {\n if (data.isValid) {\n $('#wishlist-popup-background-overlay').find('.main-container').hide();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').show();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').find('.share-success').show();\n } else {\n $('#wishlist-popup-background-overlay').find('.main-container').hide();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').show();\n $('#wishlist-popup-background-overlay').find('.confirmation-container').find('.share-error').show();\n }\n }\n });\n }\n });\n }\n\n //Enable spinner on wishlist share submit\n if (!eventUtils.checkClickEventAttached('#ShareWishlistButton', 'spinner_event')) {\n $(document).on('click', '#ShareWishlistButton', {\n eventName: 'spinner_event'\n }, function () {\n if ($('#ShareWishlist').find('input').val() != \"\" && $('#ShareWishlist').find('input').hasClass('valid')) {\n $(this).find('span[class*=\"text\"]').hide();\n $(this).find(\".spinner\").css(\"display\", \"block\");\n }\n });\n }\n\n //add js logic to remove the , from the qty feild to pass regex expression on client side\n $('.option-quantity-desired input').on('focusout', function () {\n $(this).val($(this).val().replace(',', ''));\n });\n\n login.init();\n\n};\n\n},{\"../eventHandlingUtils\":21,\"../login\":27,\"../page\":29,\"../util\":79,\"./product/addToCart\":42,\"lodash\":110}],64:[function(require,module,exports){\n'use strict';\n\n/* -------------------------------------------------------------- */\n/* ----------------------- wip preloader module ---------------- */\n/* -------------------------------------------------------------- */\n/*\n// HOW TO USE IT:\n\nvar preloader = require('../preloader');\n\nvar pre = new preloader(); \nvar imagesToLoad = //un selettore js ad esempio document.querySelectorAll('img')\npre.init({\n callback: function(results){\n console.dir(results);\n // istanziate quel che vi pare\n },\n array: imagesToLoad\n});\n*/\n\n\nvar preloader = function() {\n var loader;\n var urls = [];\n var urlNotFound = [];\n var loaded = [];\n\n var obj = {};\n\n this.init = function(options){\n\n if (options === undefined) {\n options = {};\n }\n\n obj.class = options.class === undefined ? 'loading' : options.class;\n obj.callback = options.callback === undefined ? this.defaultCallback : options.callback;\n obj.array = options.array;\n\n document.body.addClass(obj.class);\n this.createTempWrapper();\n\n if(Object.prototype.toString.call(obj.array)=== '[object Array]') {\n urls = obj.array;\n } else {\n urls = this.getImgs();\n }\n _createTempImg();\n };\n\n this.defaultCallback = function(results){\n console.dir(results);\n };\n\n\n this.getImgs = function(){\n var imgsNL = document.querySelectorAll(\"img\");\n return _nodeListToSrcArray(imgsNL);\n };\n\n this.createTempWrapper = function(){\n loader = document.createElement('div');\n loader.addClass('preloader-temp');\n document.querySelector('body').appendChild(loader);\n };\n\n function _nodeListToSrcArray(nodeList){\n var arr = [];\n for(var i = nodeList.length; i--; arr.unshift(nodeList[i].src));\n return arr;\n }\n\n function _createTempImg() {\n if(urls.length === 0){\n // console.log('no images to load in this page');\n _checkComplete();\n } else {\n for (var i = 0; i < urls.length; i++) {\n var tempImg = new Image();\n /*\n FIX AV: the following instruction is forbidden in strict mode (ES5). @Diego please check for correctness.\n tempImg.style = 'display:none';\n */\n tempImg.style.display = 'none';\n tempImg.onload = function () {\n loaded.push(this.src);\n _checkComplete();\n };\n\n tempImg.onerror = function () {\n urlNotFound.push(this.src);\n _checkComplete();\n };\n\n tempImg.src = urls[i];\n loader.appendChild(tempImg);\n }\n }\n }\n\n\n function _checkComplete() {\n if ((loaded.length + urlNotFound.length) === urls.length) {\n var results = {\n 'loaded' : loaded,\n '404' : urlNotFound\n };\n obj.callback(results);\n loaded = [];\n loader.remove();\n document.body.removeClass(obj.class);\n } \n }\n\n\n return this;\n\n};\n\n\nmodule.exports = preloader;\n\n\n\n\n/* -------------------------------------------------------------- */\n/* -------------------------- pure js extensions ---------------- */\n/* -------------------------------------------------------------- */\n\nElement.prototype.addClass = function(classString) {\n if (this.classList){\n this.classList.add(classString);\n } else {\n this.className += ' ' + classString;\n }\n};\n\nElement.prototype.removeClass = function(classString) {\n if (this.classList) {\n this.classList.remove(classString);\n } else {\n this.className = this.className.replace(new RegExp('(^|\\\\b)' + classString.split(' ').join('|') + '(\\\\b|$)', 'gi'), ' ');\n }\n};\n\n/**\n * Use the pollyfill from MDN to fix ie11 error -\n * > http://stackoverflow.com/questions/35085503/error-with-getelementbyidid-remove-in-ie11\n */\n\nif (!('remove' in Element.prototype)) {\n\tElement.prototype.remove = function() {\n\t\tif (this.parentNode) {\n\t\t\tthis.parentNode.removeChild(this);\n\t\t}\n\t};\n}\n\n\n\n},{}],65:[function(require,module,exports){\n'use strict';\n\n// var imagesLoaded = require('imagesloaded');\nvar WishlistComponent = require(\"./custom/wishlistComponent\");\n\n/**\n * @private\n * @function\n * @description Initializes events on the product-tile for the following elements:\n * - swatches\n * - thumbnails\n */\n\nfunction initializeEvents(tileSelector, isPLP) {\n\n // tileSelector = .product-tile-container\n $(tileSelector).not('[data-click-init]').on('click', function (e) {\n if (isPLP) {\n var stateObj = {\n state: \"plpTileClick\"\n };\n\n var url = window.currentURL ? window.currentURL : location.href;\n var wildcard = \"?\";\n\n if (url.indexOf(\"&pos\") !== -1) {\n url = url.split(\"&pos\")[0];\n wildcard = \"&\";\n } else if (url.indexOf(\"?pos\") !== -1) {\n url = url.split(\"?pos\")[0];\n wildcard = \"?\";\n } else if (url.indexOf(\"?\") !== -1) {\n wildcard = \"&\";\n }\n\n url += wildcard + 'pos=' + $(this).data('pos');\n history.pushState(\n stateObj,\n document.title,\n url\n );\n }\n\n var position = $(this).data('pos');\n var $gtmvalue = $(this).siblings('#gtmvalue' + position);\n if ($gtmvalue.length > 0) {\n var gtm = $gtmvalue.data('gtmvalue');\n dataLayer.push(gtm);\n }\n\n // Link to PDP\n var productUrl = $(this).data('href');\n location.href = productUrl;\n\n });\n\n // prevent multiple event attachments\n if (!$(tileSelector).attr('data-click-init')) {\n $(tileSelector).attr('data-click-init', true);\n\n initCarouselTileEvents();\n new WishlistComponent(true, false);\n }\n};\n\nvar switchTileImage = function ($thumb, newThumbData) {\n if (newThumbData) {\n var currentAttrs = {\n src: newThumbData.src,\n alt: newThumbData.alt,\n title: newThumbData.title\n };\n $thumb.attr(currentAttrs);\n }\n};\n\n// PLP tiles + swatch colors animation + xled and technology tiles\nfunction initCarouselTileEvents() {\n\n // Switch tile image on mouseover/mouseout\n $('body').on('mouseover', \".product-tile-container .product-tile .product-image .overlay\", function (ev) {\n var productImage = $(this).parent(\".product-image\");\n // Disable switch tile image for product images custom (case: editorial look-2-product.isml)\n var switchTileImageEnabled = true;\n if (productImage.hasClass('product-image-custom')) {\n switchTileImageEnabled = false;\n }\n if (switchTileImageEnabled) {\n var $thumb = productImage.find('img').eq(0);\n var productTile = $(this).parents('.product-tile-container');\n switchTileImage($thumb, productTile.find('.swatch-colors .hexcolor.selected').data('thumb1'));\n }\n });\n $('body').on('mouseout', \".product-tile-container .product-tile .product-image .overlay\", function (ev) {\n var productImage = $(this).parent(\".product-image\");\n // Disable switch tile image for product images custom (case: editorial look-2-product.isml)\n var switchTileImageEnabled = true;\n if (productImage.hasClass('product-image-custom')) {\n switchTileImageEnabled = false;\n }\n if (switchTileImageEnabled) {\n var $thumb = productImage.find('img').eq(0);\n var productTile = $(this).parents('.product-tile-container');\n switchTileImage($thumb, productTile.find('.swatch-colors .hexcolor.selected').data('thumb'));\n }\n });\n\n // Swatch color animation - switch tile image on swatch color mouseover/mouseout\n $('body').on('mouseover', '.swatch-colors .hexcolor', function (a) {\n a.preventDefault();\n\n $(this).closest('.swatch-colors').find('.hexcolor.high').removeClass('high');\n $(this).addClass('high');\n\n var $tile = $(this).closest('.product-tile-container');\n var $thumb = $tile.find('.product-tile .product-image img').eq(0);\n var data = $(this).data('thumb1');\n switchTileImage($thumb, data);\n });\n $('body').on('mouseout', '.swatch-colors .hexcolor', function (b) {\n b.preventDefault();\n\n $(this).closest('.swatch-colors').find('.hexcolor.high').removeClass('high');\n var $prev = $(this).closest('.swatch-colors').find('.hexcolor.selected');\n $prev.addClass('high');\n\n var $tile = $(this).closest('.product-tile-container');\n\n var $thumb = $tile.find('.product-tile .product-image img').eq(0);\n var data = $prev.data('thumb');\n switchTileImage($thumb, data);\n });\n\n /*\n // Toggle product-details-price view on product tile mouseover/mouseout\n $('body').on('mouseover', '.product-tile-container .product-tile .product-image' , function(ev){\n var theParent = $(ev.target).closest('.product-tile-container');\n theParent.find('.product-details-price_small, .product-details-price').css('opacity', 0 );\n });\n $('body').on('mouseout', '.product-tile-container .product-tile .product-image' , function(ev){\n var theParent = $(ev.target).closest(\".product-tile-container\");\n theParent.find('.product-details-price_small, .product-details-price').css('opacity', 1 );\n });\n */\n\n $('body').on('click', '.swatch-colors .hexcolor', function (c) {\n c.preventDefault();\n\n var $tile = $(this).closest('.product-tile-container');\n $tile.attr('data-href', $(this).data('href'));\n\n var $thumb = $tile.find('.product-tile .product-image img').eq(0);\n var data = $(this).data('thumb1');\n switchTileImage($thumb, data);\n\n location.href = $(this).data('href');\n });\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nfunction initHashLinks() {\n $('.product-hash-link').click(function (event) {\n var href = $(this).data('href');\n if (href) {\n event.preventDefault();\n window.location.href = href;\n }\n });\n};\n\nexports.init = function (tileSelector, isPLP) {\n var $tiles = $(tileSelector);\n\n if ($tiles.length === 0) {\n return;\n }\n\n initializeEvents(tileSelector, isPLP);\n};\n\n},{\"./custom/wishlistComponent\":19}],66:[function(require,module,exports){\n'use strict';\n\nvar $loader;\n\n/**\n * @function\n * @description Shows an AJAX-loader on top of a given container\n * @param {Element} container The Element on top of which the AJAX-Loader will be shown\n */\nvar show = function (container) {\n var target = (!container || $(container).length === 0) ? $('body') : $(container);\n $loader = $loader || $('.loader');\n\n if ($loader.length === 0) {\n $loader = $('
        ').addClass('loader')\n .append($('
        ').addClass('loader-indicator'), $('
        ').addClass('loader-bg'));\n }\n return $loader.appendTo(target).show();\n};\n/**\n * @function\n * @description Hides an AJAX-loader\n */\nvar hide = function () {\n if ($loader) {\n $loader.hide();\n }\n};\n\nexports.show = show;\nexports.hide = hide;\n\n},{}],67:[function(require,module,exports){\n'use strict';\n\nvar dialog = require('./dialog'),\n product = require('./pages/product'),\n util = require('./util'),\n _ = require('lodash');\n\n\nvar makeUrl = function (url, source, productListID) {\n if (source) {\n url = util.appendParamToURL(url, 'source', source);\n }\n if (productListID) {\n url = util.appendParamToURL(url, 'productlistid', productListID);\n }\n return url;\n};\n\nvar removeParam = function (url) {\n if (url.indexOf('?') !== -1) {\n return url.substring(0, url.indexOf('?'));\n } else {\n return url;\n }\n};\n\nvar quickview = {\n init: function () {\n if (!this.exists()) {\n this.$container = $('
        ').attr('id', 'QuickViewDialog').appendTo(document.body);\n }\n this.productLinks = $('#search-result-items .thumb-link').map(function (index, thumbLink) {\n return $(thumbLink).attr('href');\n });\n },\n\n setup: function (qvUrl) {\n var $btnNext = $('.quickview-next'),\n $btnPrev = $('.quickview-prev');\n\n product.initializeEvents();\n\n this.productLinkIndex = _(this.productLinks).findIndex(function (url) {\n return removeParam(url) === removeParam(qvUrl);\n });\n\n // hide the buttons on the compare page or when there are no other products\n if (this.productLinks.length <= 1 || $('.compareremovecell').length > 0) {\n $btnNext.hide();\n $btnPrev.hide();\n return;\n }\n\n if (this.productLinkIndex === this.productLinks.length - 1) {\n $btnNext.attr('disabled', 'disabled');\n }\n if (this.productLinkIndex === 0) {\n $btnPrev.attr('disabled', 'disabled');\n }\n\n $btnNext.on('click', function (e) {\n e.preventDefault();\n this.navigateQuickview(1);\n }.bind(this));\n $btnPrev.on('click', function (e) {\n e.preventDefault();\n this.navigateQuickview(-1);\n }.bind(this));\n },\n\n /**\n * @param {Number} step - How many products away from current product to navigate to. Negative number means navigate backward\n */\n navigateQuickview: function (step) {\n // default step to 0\n this.productLinkIndex += (step ? step : 0);\n var url = makeUrl(this.productLinks[this.productLinkIndex], 'quickview');\n dialog.replace({\n url: url,\n callback: this.setup.bind(this, url)\n });\n },\n\n /**\n * @description show quick view dialog\n * @param {Object} options\n * @param {String} options.url - url of the product details\n * @param {String} options.source - source of the dialog to be appended to URL\n * @param {String} options.productlistid - to be appended to URL\n * @param {Function} options.callback - callback once the dialog is opened\n */\n show: function (options) {\n var url;\n if (!this.exists()) {\n this.init();\n }\n url = makeUrl(options.url, options.source, options.productlistid);\n\n dialog.open({\n target: this.$container,\n url: url,\n options: {\n width: 920,\n title: Resources.QUICK_VIEW_POPUP,\n open: function () {\n this.setup(url);\n if (typeof options.callback === 'function') { options.callback(); }\n }.bind(this)\n }\n });\n },\n exists: function () {\n return this.$container && (this.$container.length > 0);\n }\n};\n\nmodule.exports = quickview;\n\n},{\"./dialog\":20,\"./pages/product\":45,\"./util\":79,\"lodash\":110}],68:[function(require,module,exports){\n'use strict';\n\n/**\n * copied from https://github.com/darkskyapp/string-hash\n */\nfunction hashFn(str) {\n var hash = 5381,\n i = str.length;\n\n while (i) {\n hash = (hash * 33) ^ str.charCodeAt(--i);\n }\n /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed\n * integers. Since we want the results to be always positive, convert the\n * signed int to an unsigned by doing an unsigned bitshift. */\n return hash >>> 0;\n}\n\n/**\n * Create rating based on hash ranging from 2-5\n * @param pid\n */\nfunction getRating(pid) {\n return hashFn(pid.toString()) % 30 / 10 + 2;\n}\n\nmodule.exports = {\n init: function () {\n $('.product-review').each(function (index, review) {\n var pid = $(review).data('pid');\n if (!pid) {\n return;\n }\n // rating range from 2 - 5\n var rating = getRating(pid);\n var baseRating = Math.floor(rating);\n var starsCount = 0;\n for (var i = 0; i < baseRating; i++) {\n $('.rating', review).append('');\n starsCount++;\n }\n // give half star for anything in between\n if (rating > baseRating) {\n $('.rating', review).append('');\n starsCount++;\n }\n if (starsCount < 5) {\n for (var j = 0; j < 5 - starsCount; j++) {\n $('.rating', review).append('');\n }\n }\n });\n }\n};\n\n},{}],69:[function(require,module,exports){\n'use strict';\n\nvar returnSidebar = {\n\n init: function () {\n $.fn.returnSidebar = function () {\n\n // all checkout Stages\n var checkoutStages = [\n 'reasonAndQty',\n 'iban',\n 'method',\n 'returnInStore',\n 'payAndCollectAddress',\n 'confirmation'\n ];\n \n\n var selectedQty = 1;\n $('[id$=\"_quantity\"]').on('change', function(){\n selectedQty = this.value;\n });\n \n\n var orderCOD = $('.iban-stage').length;\n var orderPayAndCollect = $('.pay-and-collect-address-stage').length;\n\n /*\n * Remove unused stages\n */\n function removeUnusedStages() {\n var index = 0;\n\n if (!orderCOD) {\n index = checkoutStages.indexOf('iban');\n checkoutStages.splice(index, 1);\n }\n\n if (!orderPayAndCollect) {\n index = checkoutStages.indexOf('payAndCollectAddress');\n checkoutStages.splice(index, 1);\n }\n }\n\n /*\n * Get next stage number\n */\n function getNextStage(stageName) {\n var nextStageNumber = 0;\n\n if (stageName == 'method') {\n var selectedMethod = $('input[name=\"dwfrm_orderdetail_returnType\"]:checked').val();\n\n if (selectedMethod == 'returnCourier' && !orderPayAndCollect) {\n nextStageNumber = checkoutStages.indexOf('confirmation');\n } else if (selectedMethod == 'returnCourier' && orderPayAndCollect) {\n nextStageNumber = checkoutStages.indexOf('payAndCollectAddress');\n } else {\n nextStageNumber = checkoutStages.indexOf('returnInStore');\n }\n\n } else if (stageName == 'returnInStore') {\n nextStageNumber = checkoutStages.indexOf('confirmation');\n } else {\n var stageNumber = checkoutStages.indexOf(stageName);\n nextStageNumber = stageNumber + 1;\n }\n\n return nextStageNumber;\n }\n\n /*\n * Update confirmation products HTML\n */\n function updateConfirmationProducts() {\n var $products = $('.reason-and-qty-stage .line-items').html();\n $('.return-confirmation-products').html($products);\n\n $('.return-confirmation-products .line-item').each(function () {\n var color = $(this).find('[data-attribute=\"color\"] .value').text();\n var size = $(this).find('[data-attribute=\"size\"] .value').text();\n var qty = selectedQty;\n var id = $(this).find('[id$=\"_reason\"]').attr('id');\n var reason = $('.reason-and-qty-stage #' + id + ' option:selected').text();\n\n var html = \t'
        ' +\n '' + color + ' / ' + size + ' / ' + Resources.QTY + ' ' + qty + '' +\n '' + Resources.RETURN_REASON + ': ' + reason + '' +\n '
        '\n\n $(this).find('.attribute, .item-data.mob-only, .retunedProducts').remove();\n $(this).find('.line-item-details').append(html);\n });\n }\n\n /*\n * Update confirmation step HTML\n */\n function updateConfirmationStep() {\n var selectedMethod = $('input[name=\"dwfrm_orderdetail_returnType\"]:checked').attr('id');\n\n if (selectedMethod == 'returnStore') {\n $('.return-confirmation-address, .return-confirmation-address-info').addClass('hide');\n $('.return-confirmation-ups, .return-confirmation-ups-info').addClass('hide');\n $('.reserve-confirmation-store-wrapper').removeClass('hide');\n\n var $store = $('input[name=\"storePickupSelection\"]:checked').parents('.payandcollect-result');\n var storeName = $store.find('.store-name').text();\n var storeAddress = $store.find('.store-address').text();\n var storeHours = $store.find('.store-hours').html();\n $('.reserve-confirmation-store-name').html(storeName);\n $('.reserve-confirmation-store-address').html(storeAddress);\n $('.reserve-hours-accordion .accordion-content').html(storeHours);\n $('#reserve-confirmation-map').append($('#storelocator-map'));\n }\n\n if (selectedMethod == 'returnCourier') {\n $('.reserve-confirmation-store-wrapper').addClass('hide');\n $('.return-confirmation-ups, .return-confirmation-ups-info').addClass('hide');\n $('.return-confirmation-address, .return-confirmation-address-info').removeClass('hide');\n\n if (orderPayAndCollect) {\n var name = $('#dwfrm_returnaddress_returnfromaddress_firstName').val() + ' ' + $('#dwfrm_returnaddress_returnfromaddress_lastName').val();\n var address1 = $('#dwfrm_returnaddress_returnfromaddress_address1').val();\n var address2 = $('#dwfrm_returnaddress_returnfromaddress_address2').val();\n var city = $('#dwfrm_returnaddress_returnfromaddress_postalCode').val() + ' ' +\n $('#dwfrm_returnaddress_returnfromaddress_city').val() + ' (' +\n $('#dwfrm_returnaddress_returnfromaddress_states_stateCode').val() + ') - ' +\n $('#dwfrm_returnaddress_returnfromaddress_countryCode option:selected').text();\n\n $('.return-confirmation-address-name').html(name ? name : '');\n $('.return-confirmation-address-address1').html(address1 ? address1 : '');\n $('.return-confirmation-address-address2').html(address2 ? address2 : '');\n $('.return-confirmation-address-city').html(city ? city : '');\n }\n }\n\n if (selectedMethod == 'returnUPS') {\n $('.reserve-confirmation-store-wrapper').addClass('hide');\n $('.return-confirmation-address, .return-confirmation-address-info').addClass('hide');\n $('.return-confirmation-ups, .return-confirmation-ups-info').removeClass('hide');\n }\n\n updateConfirmationProducts();\n }\n\n /*\n * Go to next stage\n */\n function nextStage() {\n var stageName = $('.return-sidebar').attr('data-current-stage');\n var nextStageNumber = getNextStage(stageName);\n\n // Trigger stage completed event\n $('body').trigger('return-stage-completed:' + stageName);\n\n // set isFullReturn session value (datalayer)\n if (stageName == 'reasonAndQty') {\n setSessionFullReturn();\n }\n\n // create confirmation step\n if (checkoutStages[nextStageNumber] == 'confirmation') {\n updateConfirmationStep();\n }\n\n $('.return-sidebar').attr('data-current-stage', checkoutStages[nextStageNumber]);\n }\n\n /*\n * Get previous stage\n */\n function getPreviousStage(stageName) {\n var prevStageNumber = 0;\n var selectedMethod = $('input[name=\"dwfrm_orderdetail_returnType\"]:checked').val();\n\n // get the previous stage logic\n if (stageName == 'payAndCollectAddress') {\n prevStageNumber = checkoutStages.indexOf('method');\n } else if (stageName == 'confirmation' && selectedMethod == 'returnCourier' && !orderPayAndCollect) {\n prevStageNumber = checkoutStages.indexOf('method');\n } else if (stageName == 'confirmation' && selectedMethod != 'returnCourier') {\n // bring the map back from confirmation to returnCourier step\n if ($('.payandcollect-result.open').length) {\n $('.payandcollect-result.open').find('.store-map').append($('#storelocator-map'));\n }\n prevStageNumber = checkoutStages.indexOf('returnInStore');\n } else {\n var stageNumber = checkoutStages.indexOf(stageName);\n prevStageNumber = stageNumber - 1;\n }\n\n return prevStageNumber;\n }\n\n /*\n * Go to previous stage\n */\n function previousStage() {\n var stageName = $('.return-sidebar').attr('data-current-stage');\n var prevStageNumber = getPreviousStage(stageName);\n\n $('.return-sidebar').attr('data-current-stage', checkoutStages[prevStageNumber]);\n }\n\n /*\n * Validate current stage form\n */\n function validateStage(name) {\n var valid = true;\n\n if (name == 'reasonAndQty') {\n valid = $('[id$=\"_reason\"]').valid();\n }\n if (name == 'iban') {\n valid = $('#dwfrm_orderdetail_iban').valid();\n }\n if (name == 'payAndCollectAddress') {\n valid = $('.shipping-address-block input, .shipping-address-block select').valid()\n }\n\n return valid;\n }\n\n /*\n * Set full return value inside session storage\n */\n function setSessionFullReturn() {\n var fullReturn = true;\n var orderProductsNumber = $('.order-shipment-table-restyle').find('.line-item-restyle').length;\n var productsToReturnNumber = $('.reason-and-qty-stage').find('.line-item').length;\n var orderWithoutReturns = !$('.order-shipment-table-restyle').find('[data-attribute=\"qty-return\"]').length;\n\n // check if no previous returns and if all products are returned\n if (orderWithoutReturns && (productsToReturnNumber == orderProductsNumber)) {\n var $returnQtySelects = $('.return-qty-select').find(\"[id$='_quantity']\");\n\n // check if all quatities are returned\n $returnQtySelects.each(function () {\n var selectValue = $(this).val();\n var selectMaxValue = $(this).attr('data-max-value');\n if (selectValue != selectMaxValue) {\n fullReturn = false;\n }\n });\n } else {\n fullReturn = false;\n }\n\n sessionStorage.setItem('isFullReturn', fullReturn);\n }\n\n /*\n * Sidebar generic events\n */\n $('.return-next-step').on('click', function () {\n var stageName = $('.return-sidebar').attr('data-current-stage');\n var valid = validateStage(stageName);\n\n if (valid) nextStage();\n });\n\n $('.return-previous-step').on('click', function () {\n previousStage();\n });\n\n $(document).on('click', '.js-return-store-trigger', function () {\n $(this).parents('.store-result-content').find('input[name=\"storePickupSelection\"]').prop('checked', true);\n // trigger datalayer\n $('body').trigger('return-instore:choice');\n nextStage();\n });\n\n removeUnusedStages();\n };\n }\n};\n\nmodule.exports = returnSidebar;\n\n},{}],70:[function(require,module,exports){\n'use strict';\n\n/**\n * @private\n * @function\n * @description Binds event to the place holder (.blur)\n */\nfunction initializeEvents() {\n $('#q').focus(function () {\n var input = $(this);\n if (input.val() === input.attr('placeholder')) {\n input.val('');\n }\n })\n .blur(function () {\n var input = $(this);\n if (input.val() === '' || input.val() === input.attr('placeholder')) {\n input.val(input.attr('placeholder'));\n }\n })\n .blur();\n}\n\nexports.init = initializeEvents;\n\n},{}],71:[function(require,module,exports){\n'use strict';\n\nvar util = require('./util');\n\nvar currentQuery = null,\n lastQuery = null,\n runningQuery = null,\n listTotal = -1,\n listCurrent = -1,\n delay = 30,\n $container,\n $resultsContainer;\n/**\n * @function\n * @description Handles keyboard's arrow keys\n * @param keyCode Code of an arrow key to be handled\n */\nfunction handleArrowKeys(keyCode) {\n switch (keyCode) {\n case 38:\n // keyUp\n listCurrent = (listCurrent <= 0) ? (listTotal - 1) : (listCurrent - 1);\n break;\n case 40:\n // keyDown\n listCurrent = (listCurrent >= listTotal - 1) ? 0 : listCurrent + 1;\n break;\n default:\n // reset\n listCurrent = -1;\n return false;\n }\n\n $resultsContainer.children().removeClass('selected').eq(listCurrent).addClass('selected');\n $('input[name=\"q\"]').val($resultsContainer.find('.selected .suggestionterm').first().text());\n return true;\n}\n\nvar searchsuggest = {\n /**\n * @function\n * @description Configures parameters and required object instances\n */\n init: function (container, defaultValue) {\n var $searchContainer = $(container).find('.suggestions-slot-container');\n var $searchForm = $(container).find('form[name=\"simpleSearch\"]');\n var $searchField = $(container).find('input[name=\"q\"]');\n $container = $(container);\n\n // disable browser auto complete\n $searchField.attr('autocomplete', 'off');\n\n // on focus listener (clear default value)\n $searchField.focus(function () {\n if (!$resultsContainer) {\n // create results container if needed\n $resultsContainer = $('
        ').attr('id', 'search-suggestions').empty().appendTo($searchContainer);\n }\n if ($searchField.val() === defaultValue) {\n $searchField.val('');\n }\n });\n\n $(document).on('click', function (e) {\n if ($container.find($(e.target)).length <= 0 || $(e.target).hasClass('clear-input')) {\n setTimeout(this.clearResults, 200);\n }\n }.bind(this));\n // on key up listener\n $searchField.keyup(function (e) {\n\n // get keyCode (window.event is for IE)\n var keyCode = e.keyCode || window.event.keyCode;\n\n // check and treat up and down arrows\n if (handleArrowKeys(keyCode)) {\n return;\n }\n // check for an ENTER or ESC\n /* if (keyCode === 13 || keyCode === 27) {\n this.clearResults();\n return;\n } */\n\n currentQuery = $searchField.val().trim();\n\n // no query currently running, init an update\n if (!runningQuery) {\n runningQuery = currentQuery;\n setTimeout(this.suggest.bind(this), delay);\n }\n }.bind(this));\n },\n\n /**\n * @function\n * @description trigger suggest action\n */\n suggest: function () {\n // check whether query to execute (runningQuery) is still up to date and had not changed in the meanwhile\n // (we had a little delay)\n if (runningQuery !== currentQuery) {\n // update running query to the most recent search phrase\n runningQuery = currentQuery;\n }\n\n // if it's empty clear the results box and return\n if (runningQuery.length === 0) {\n this.clearResults();\n runningQuery = null;\n return;\n }\n\n // if the current search phrase is the same as for the last suggestion call, just return\n if (lastQuery === runningQuery) {\n runningQuery = null;\n return;\n }\n\n // build the request url\n var reqUrl = util.appendParamToURL(Urls.searchsuggest, 'q', runningQuery);\n\n // start loading\n $('#search-loader').css('display', 'flex');\n $container.addClass('loading');\n\n // hide popular links and default content on loading\n $('.popular-links-slot-container').hide();\n $('.useful-links').not('.phrase-suggestions').hide();\n $('.best-products-box').hide();\n $('.no-results-text').hide();\n\n // execute server call\n $.get(reqUrl, function (data) {\n var suggestionHTML = data,\n ansLength = suggestionHTML.trim().length;\n\n // if there are results populate the results div\n if (ansLength === 0) {\n this.clearResults();\n } else {\n // update the results div\n $('.popular-links-slot-container').hide();\n $('.useful-links').not('.phrase-suggestions').hide();\n $('.best-products-box').hide();\n $('.no-results-text').hide();\n $resultsContainer.html(suggestionHTML).fadeIn(200);\n }\n\n // record the query that has been executed\n lastQuery = runningQuery;\n // reset currently running query\n runningQuery = null;\n\n // check for another required update (if current search phrase is different from just executed call)\n if (currentQuery !== lastQuery) {\n // ... and execute immediately if search has changed while this server call was in transit\n runningQuery = currentQuery;\n setTimeout(this.suggest.bind(this), delay);\n } else {\n // show no results message if search is complete and has no results\n if (ansLength === 0) {\n setTimeout(function () {\n $container.addClass('no-results');\n $('.popular-links-slot-container').addClass('no-results');\n $('.no-results-text').show();\n }, 200);\n } else {\n $container.removeClass('no-results');\n $('.popular-links-slot-container').removeClass('no-results');\n }\n }\n\n // end loading\n $('#search-loader').removeAttr('style');\n $container.removeClass('loading');\n\n //this.hideLeftPanel();\n }.bind(this));\n },\n /**\n * @function\n * @description\n */\n clearResults: function () {\n if (!$resultsContainer) {\n return;\n }\n $resultsContainer.fadeOut(200, function () {\n $resultsContainer.empty();\n\n // show popular links and default content\n $container.removeClass('no-results');\n $('.popular-links-slot-container').show().removeClass('no-results');\n $('.useful-links').show();\n $('.best-products-box').show();\n $('.no-results-text').hide();\n });\n },\n /**\n * @function\n * @description\n */\n hideLeftPanel: function () {\n //hide left panel if there is only a matching suggested custom phrase\n if ($('.search-suggestion-left-panel-hit').length === 1 && $('.search-phrase-suggestion a').text().replace(/(^[\\s]+|[\\s]+$)/g, '').toUpperCase() === $('.search-suggestion-left-panel-hit a').text().toUpperCase()) {\n $('.search-suggestion-left-panel').css('display', 'none');\n $('.search-suggestion-wrapper-full').addClass('search-suggestion-wrapper');\n $('.search-suggestion-wrapper').removeClass('search-suggestion-wrapper-full');\n }\n }\n};\n\nmodule.exports = searchsuggest;\n\n},{\"./util\":79}],72:[function(require,module,exports){\n'use strict';\n\nvar util = util = require('./util');\n\nvar sizeGuide = {\n init: function () {\n if ($('.service-table').length) {\n this.initTabs();\n this.initDropdown();\n this.openCategoryOnPDP();\n this.initTableAnimation();\n this.initExpandTable();\n this.initTableScrollBar();\n }\n },\n\n /**\n * @function\n * @description Init table scroll bar\n */\n initTableScrollBar: function () {\n if (window.matchMedia('(max-width: 1024px)').matches) {\n var $activeTab = $('.service-tabs-content.active-content');\n var $sizeTables = $activeTab.find('.service-table.size-table');\n\n $sizeTables.each(function () {\n var isVisible = !$(this).is(':hidden');\n var isNotInizialized = $(this).attr('data-scroll-initialized') != 'true';\n\n if (isVisible && isNotInizialized) {\n var isTableOverflow = ($(this).find('table').width() - $(this).width()) > 0;\n if (isTableOverflow) {\n // append scrollbar html\n $('
        ').insertAfter($(this));\n // prevent multiple init\n $(this).attr('data-scroll-initialized', 'true');\n // animate bar\n $(this).on('scroll', function () {\n var scrollPercentage = 100 * $(this).scrollLeft() / ($(this).find('table').width() - $(this).width());\n // handle IOS bouncing\n scrollPercentage = scrollPercentage < 0 ? 0 : (scrollPercentage > 100 ? 100 : scrollPercentage);\n $(this).next('.size-table-progress-wrapper').find('.size-table-progress-pin').css('left', scrollPercentage.toFixed(2) + '%');\n });\n }\n }\n });\n }\n },\n\n /**\n * @function\n * @description Init expand table popup\n */\n initExpandTable: function () {\n\n if (window.matchMedia('(max-width: 1024px)').matches) {\n // append expand button\n $('').insertAfter($('.service-table.size-table'));\n\n $('.expand-size-table').on('click', function () {\n\n // add popup html\n var table = $(this).prev('.service-table.size-table').length ? $(this).prev('.service-table.size-table') : $(this).prev().prev('.service-table.size-table');\n var html = '
        ' +\n '' +\n '
        ' + table.html() + '
        ' +\n '
        ' +\n '
        ' +\n '

        ' + Resources.SIZEGUIDE_ROTATE + '

        ' +\n '
        ';\n $('body').append(html);\n\n // block scroll\n util.togglePageScroll(true);\n\n // if portrait mode show \"change orientation\" overlay\n if (window.innerHeight > window.innerWidth) {\n $('.change-orientation').show();\n }\n\n // hide \"change orientation\" overlay on orientation change\n window.onorientationchange = function () {\n $('.change-orientation').hide();\n };\n\n // init close popup button\n $('.close-size-table').on('click', function () {\n // trigger data layer\n dataLayer.push({\n 'event': 'GAevent',\n 'eventID': '102',\n 'ss_event_id': getTimestampAlphanumericString(),\n 'eventCategory': 'size_guide',\n 'eventAction': 'pdp_riduci_tabella',\n 'eventLabel': $(this).parents('[data-size-tab]').attr('data-size-tab')\n });\n // remove pop-up\n $('.size-table-popup').remove();\n util.togglePageScroll(false);\n });\n });\n\n }\n },\n\n /**\n * @function\n * @description Init service tabs click event\n */\n initTabs: function () {\n var self = this;\n\n $('.service-tabs-item').on('click', function () {\n // if already active, do nothing\n if ($(this).hasClass('active-tab')) return;\n\n var index = $(this).index();\n var $parent = $(this).parents('.service-tabs');\n\n // Activate Tab\n $parent.find('.service-tabs-item').removeClass('active-tab');\n $(this).addClass('active-tab');\n\n // Activate Content\n $parent.find('.service-tabs-content').removeClass('active-content');\n $parent.find('.service-tabs-content-wrapper').children().eq(index).addClass('active-content');\n\n self.initTableScrollBar();\n });\n },\n\n /**\n * @function\n * @description Init service dropdowns\n */\n initDropdown: function () {\n var self = this;\n\n $('.service-dropdown-trigger').on('click', function () {\n var $dropdown = $(this).parents('.service-dropdown');\n $dropdown.toggleClass('open');\n\n self.initTableScrollBar();\n });\n\n // Size guide page mobile - show first service dropdown on each tab open by default\n if (window.matchMedia('(max-width: 1024px)').matches && $('.pt_product-details').length == 0) {\n $('.service-tabs-content').each(function () {\n $(this).find('.service-dropdown:first-child > .service-dropdown-trigger').trigger('click');\n });\n }\n },\n\n /**\n * @function\n * @description On PDP page load, open shoes or apparel section\n */\n openCategoryOnPDP: function () {\n var variationGroupID = $('[data-variationgroup-id]').attr('data-variationgroup-id');\n\n if (variationGroupID) {\n // Check if it's an apparel item\n var isApparel = false;\n if (variationGroupID.charAt(0) == 'W' || variationGroupID.charAt(0) == 'M' || variationGroupID.charAt(0) == 'K') {\n isApparel = true;\n }\n // Activate dropdown\n if (isApparel) {\n $('[data-size-tab=\"apparel\"]').addClass('open');\n } else {\n $('[data-size-tab=\"shoes\"]').addClass('open');\n }\n }\n },\n\n /**\n * @function\n * @description Init row and columns highlight on hover\n */\n initTableAnimation: function () {\n $(document).on({\n mouseenter: function () {\n\n // Highlight item on hover\n $(this).css({\n 'background-color': '#3156BC',\n 'color': 'white'\n });\n\n // Highlight row\n var indexCol = $(this).index();\n if (indexCol > 0) {\n for (var i = 0; i < indexCol; i++) {\n $(this).parent().children().eq(i).css({\n 'background-color': '#d6ddf2',\n 'color': '#3156BC'\n });\n }\n }\n\n // Highlight Column\n var indexRow = $(this).parent().index();\n if (indexRow > 0) {\n for (var i = 0; i < indexRow; i++) {\n $(this).parents('tbody').children().eq(i).children().eq(indexCol).css({\n 'background-color': '#d6ddf2',\n 'color': '#3156BC'\n });\n }\n }\n },\n\n mouseleave: function () {\n // remove all styles\n $('.service-table.size-table td, .service-table.size-table th').removeAttr('style');\n }\n\n }, \".service-table.size-table td, .service-table.size-table th\");\n }\n};\n\nfunction getTimestampAlphanumericString() {\n var timestamp = Date.now();\n var alphanumericString = Math.random().toString(36).slice(2);\n var timeNumericString = timestamp + '.' + alphanumericString;\n return timeNumericString;\n}\n\nmodule.exports = sizeGuide;\n\n},{\"./util\":79}],73:[function(require,module,exports){\n'use strict';\n\n/* slick buttons with same height of the image (not entire gallery)*/\n\nvar slickCarouselSelector, tileSelector, slidesTrack;\n\nvar init = function(carouselSel, tileSel){\n slickCarouselSelector = carouselSel;\n tileSelector = tileSel;\n slidesTrack = slickCarouselSelector+' .slick-track';\n //debug('slickCarouselSelector: '+slickCarouselSelector)\n //debug('carouselSel: '+carouselSel)\n calculate();\n resizeHandler();\n}\n\nfunction calculate(){\n var maxSlideHeight = $(slidesTrack).outerHeight();\n //debug('maxSlideHeight: '+maxSlideHeight)\n var imageHeight = $(slidesTrack+' '+tileSelector).outerHeight();\n //debug('imageHeight: '+imageHeight)\n var imageProportion = parseFloat( ( imageHeight * 100) / maxSlideHeight ) ; \n var buttonSelectors = slickCarouselSelector+' .slider-next, '+slickCarouselSelector+' .slider-prev';\n $(buttonSelectors).css({\n height: imageProportion+'%'\n }); \n} \n\nfunction resizeHandler(){\n window.onresize = function(event) {\n calculate();\n };\n}\n\nfunction debug(msg){\n console.log('%c '+msg, 'color: green');\n}\n\n\nexports.init = init;\n\n\n},{}],74:[function(require,module,exports){\n'use strict';\n\nvar inventory = require('./');\n\nvar cartInventory = {\n setSelectedStore: function (storeId) {\n var $selectedStore = $('.store-tile.' + storeId),\n $lineItem = $('.cart-row[data-uuid=\"' + this.uuid + '\"]'),\n storeAddress = $selectedStore.find('.store-address').html(),\n storeStatus = $selectedStore.find('.store-status').data('status'),\n storeStatusText = $selectedStore.find('.store-status').text();\n this.selectedStore = storeId;\n\n $lineItem.find('.instore-delivery .selected-store-address')\n .data('storeId', storeId)\n .attr('data-store-id', storeId)\n .html(storeAddress);\n $lineItem.find('.instore-delivery .selected-store-availability')\n .data('status', storeStatus)\n .attr('data-status', storeStatus)\n .text(storeStatusText);\n $lineItem.find('.instore-delivery .delivery-option').removeAttr('disabled').trigger('click');\n },\n cartSelectStore: function (selectedStore) {\n var self = this;\n inventory.getStoresInventory(this.uuid).then(function (stores) {\n inventory.selectStoreDialog({\n stores: stores,\n selectedStoreId: selectedStore,\n selectedStoreText: Resources.SELECTED_STORE,\n continueCallback: function () {},\n selectStoreCallback: self.setSelectedStore.bind(self)\n });\n }).done();\n },\n setDeliveryOption: function (value, storeId) {\n // set loading state\n $('.item-delivery-options')\n .addClass('loading')\n .children().hide();\n\n var data = {\n plid: this.uuid,\n storepickup: (value === 'store' ? true : false)\n };\n if (value === 'store') {\n data.storepickup = true;\n data.storeid = storeId;\n } else {\n data.storepickup = false;\n }\n $.ajax({\n url: Urls.setStorePickup,\n data: data,\n success: function () {\n // remove loading state\n $('.item-delivery-options')\n .removeClass('loading')\n .children().show();\n }\n });\n },\n init: function () {\n var self = this;\n $('.item-delivery-options .set-preferred-store').on('click', function (e) {\n e.preventDefault();\n self.uuid = $(this).data('uuid');\n var selectedStore = $(this).closest('.instore-delivery').find('.selected-store-address').data('storeId');\n if (!User.zip) {\n inventory.zipPrompt(function () {\n self.cartSelectStore(selectedStore);\n });\n } else {\n self.cartSelectStore(selectedStore);\n }\n });\n $('.item-delivery-options .delivery-option').on('click', function () {\n // reset the uuid\n var selectedStore = $(this).closest('.instore-delivery').find('.selected-store-address').data('storeId');\n self.uuid = $(this).closest('.cart-row').data('uuid');\n self.setDeliveryOption($(this).val(), selectedStore);\n });\n }\n};\n\nmodule.exports = cartInventory;\n\n},{\"./\":75}],75:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash'),\n dialog = require('../dialog'),\n TPromise = require('promise'),\n util = require('../util');\n\nvar newLine = '\\n';\nvar storeTemplate = function (store, selectedStoreId, selectedStoreText) {\n return [\n '
      • ',\n '

        ',\n ' ' + store.address1 + '
        ',\n ' ' + store.city + ', ' + store.stateCode + ' ' + store.postalCode,\n '

        ',\n '

        ' + store.status + '

        ',\n ' ',\n '
      • '\n ].join(newLine);\n};\n\nvar storeListTemplate = function (stores, selectedStoreId, selectedStoreText) {\n if (stores && stores.length) {\n return [\n '
        ',\n '
          ',\n _.map(stores, function (store) {\n return storeTemplate(store, selectedStoreId, selectedStoreText);\n }).join(newLine),\n '
        ',\n '
        ',\n '
        ',\n '
        '\n ].join(newLine);\n } else {\n return '
        ' + Resources.INVALID_ZIP + '
        ';\n }\n};\n\nvar zipPromptTemplate = function () {\n return [\n '
        ',\n ' ',\n '
        '\n ].join(newLine);\n};\n\n/**\n * @description test whether zipcode is valid for either US or Canada\n * @return {Boolean} true if the zipcode is valid for either country, false if it's invalid for both\n **/\nvar validateZipCode = function (zipCode) {\n var regexes = {\n canada: /^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d$/i,\n usa: /^\\d{5}(-\\d{4})?$/\n },\n valid = false;\n if (!zipCode) { return; }\n _.each(regexes, function (re) {\n var regexp = new RegExp(re);\n valid = regexp.test(zipCode);\n });\n return valid;\n};\n\nvar storeinventory = {\n zipPrompt: function (callback) {\n var self = this;\n dialog.open({\n html: zipPromptTemplate(),\n options: {\n title: Resources.STORE_NEAR_YOU,\n width: 500,\n buttons: [{\n text: Resources.SEARCH,\n click: function () {\n var zipCode = $('#user-zip').val();\n if (validateZipCode(zipCode)) {\n self.setUserZip(zipCode);\n if (callback) {\n callback(zipCode);\n }\n }\n }\n }],\n open: function () {\n $('#user-zip').on('keypress', function (e) {\n if (e.which === 13) {\n // trigger the search button\n $('.ui-dialog-buttonset .ui-button').trigger('click');\n }\n });\n }\n }\n });\n },\n getStoresInventory: function (pid) {\n return TPromise.resolve($.ajax({\n url: util.appendParamsToUrl(Urls.storesInventory, {\n pid: pid,\n zipCode: User.zip\n }),\n dataType: 'json'\n }));\n },\n /**\n * @description open the dialog to select store\n * @param {Array} options.stores\n * @param {String} options.selectedStoreId\n * @param {String} options.selectedStoreText\n * @param {Function} options.continueCallback\n * @param {Function} options.selectStoreCallback\n **/\n selectStoreDialog: function (options) {\n var self = this,\n stores = options.stores,\n selectedStoreId = options.selectedStoreId,\n selectedStoreText = options.selectedStoreText,\n storeList = storeListTemplate(stores, selectedStoreId, selectedStoreText);\n dialog.open({\n html: storeList,\n options: {\n title: Resources.SELECT_STORE + ' - ' + User.zip,\n buttons: [{\n text: Resources.CHANGE_LOCATION,\n click: function () {\n self.setUserZip(null);\n // trigger the event to start the process all over again\n $('.set-preferred-store').trigger('click');\n }.bind(this)\n }, {\n text: Resources.CONTINUE,\n click: function () {\n if (options.continueCallback) {\n options.continueCallback(stores);\n }\n dialog.close();\n }\n }],\n open: function () {\n $('.select-store-button').on('click', function (e) {\n e.preventDefault();\n var storeId = $(this).data('storeId');\n // if the store is already selected, don't select again\n if (storeId === selectedStoreId) { return; }\n $('.store-list .store-tile.selected').removeClass('selected')\n .find('.select-store-button').text(Resources.SELECT_STORE);\n $(this).text(selectedStoreText)\n .closest('.store-tile').addClass('selected');\n if (options.selectStoreCallback) {\n options.selectStoreCallback(storeId);\n }\n });\n }\n }\n });\n },\n setUserZip: function (zip) {\n User.zip = zip;\n $.ajax({\n type: 'POST',\n url: Urls.setZipCode,\n data: {\n zipCode: zip\n }\n });\n },\n shippingLoad: function () {\n var $checkoutForm = $('.address');\n $checkoutForm.off('click');\n $checkoutForm.on('click', 'input[name$=\"_shippingAddress_isGift\"]', function () {\n $(this).parent().siblings('.gift-message-text').toggleClass('hidden', $('input[name$=\"_shippingAddress_isGift\"]:checked').val());\n });\n }\n};\n\nmodule.exports = storeinventory;\n\n},{\"../dialog\":20,\"../util\":79,\"lodash\":110,\"promise\":112}],76:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash'),\n inventory = require('./');\n\nvar newLine = '\\n';\nvar pdpStoreTemplate = function (store) {\n return [\n '
      • ',\n '
        ' + store.address1 + ', ' + store.city + ' ' + store.stateCode +\n ' ' + store.postalCode + '
        ',\n '
        ' + store.status + '
        ',\n '
      • '\n ].join(newLine);\n};\nvar pdpStoresListingTemplate = function (stores) {\n if (stores && stores.length) {\n return [\n '
        ',\n (stores.length > 1 ? ' ' + Resources.SEE_MORE + '' : ''),\n '
          ',\n _.map(stores, pdpStoreTemplate).join(newLine),\n '
        ',\n '
        '\n ].join(newLine);\n }\n};\n\nvar storesListing = function (stores) {\n // list all stores on PDP page\n if ($('.store-list-pdp-container').length) {\n $('.store-list-pdp-container').remove();\n }\n $('.availability-results').append(pdpStoresListingTemplate(stores));\n};\n\nvar productInventory = {\n setPreferredStore: function (storeId) {\n User.storeId = storeId;\n $.ajax({\n url: Urls.setPreferredStore,\n type: 'POST',\n data: {storeId: storeId}\n });\n },\n productSelectStore: function () {\n var self = this;\n inventory.getStoresInventory(this.pid).then(function (stores) {\n inventory.selectStoreDialog({\n stores: stores,\n selectedStoreId: User.storeId,\n selectedStoreText: Resources.PREFERRED_STORE,\n continueCallback: storesListing,\n selectStoreCallback: self.setPreferredStore\n });\n }).done();\n },\n init: function () {\n var $availabilityContainer = $('.availability-results'),\n self = this;\n this.pid = $('input[name=\"pid\"]').val();\n\n $('#product-content .set-preferred-store').on('click', function (e) {\n e.preventDefault();\n if (!User.zip) {\n inventory.zipPrompt(function () {\n self.productSelectStore();\n });\n } else {\n self.productSelectStore();\n }\n });\n\n if ($availabilityContainer.length) {\n if (User.storeId) {\n inventory.getStoresInventory(this.pid).then(storesListing);\n }\n\n // See more or less stores in the listing\n $availabilityContainer.on('click', '.stores-toggle', function (e) {\n e.preventDefault();\n $('.store-list-pdp .store-list-item').toggleClass('visible');\n if ($(this).hasClass('collapsed')) {\n $(this).text(Resources.SEE_LESS);\n } else {\n $(this).text(Resources.SEE_MORE);\n }\n $(this).toggleClass('collapsed');\n });\n }\n }\n};\n\nmodule.exports = productInventory;\n\n},{\"./\":75,\"lodash\":110}],77:[function(require,module,exports){\n'use strict';\n\n/**\n * Checks the TLS and displays a warning if appropriate\n * @function getUserAgent Checks the TLS and displays a warning if appropriate\n **/\nfunction getUserAgent() {\n // Use an external service to check the TLS of the browser\n // NOTE: this implementation uses https://www.howsmyssl.com\n // you may also wish to consider the API available at https://www.ssllabs.com/projects/ssllabs-apis/index.html\n var url = 'https://www.howsmyssl.com/a/check';\n var cookieName = 'dw_TLSWarning';\n var cookieValue = getCookie(cookieName);\n\n // Test to see if this browser has already been flagged by looking at its cookies\n if (!cookieValue) {\n getTLS(url, function (message) {\n if (message.length > 0) {\n showWarning(message[0]);\n\n // the browser is bad - set the cookie to true (for 15 minutes)\n setCookie(cookieName, 'true', 15);\n } else {\n // else the browser is good, set the cookie to false (for 30 days) so we don't check again\n setCookie(cookieName, 'false', 60 * 24 * 30);\n }\n });\n } else if (cookieValue === 'true') {\n // if we already know that this is an invalid browser, show the warning\n showWarning(Resources.TLS_WARNING);\n }\n}\n\n/**\n * Calls out to the TLS service and calls the callback with a message (if necessary)\n * @function getTLS\n *\n * @param {string} url - URL of external TLS-checking API\n * @param {function} callback - function to call with response\n **/\nfunction getTLS(url, callback) {\n var message = [];\n\n // First, see if the browser is among the suspect browsers to see if a TLS check is necessary\n var userAgent = navigator.userAgent;\n\n /** This list derived from https://www.ssllabs.com/ssltest/clients.html **/\n var badBrowsers = ['MSIE 6.0','MSIE 7.0','MSIE 8.0','MSIE 9.0','MSIE 10.0',\n 'Android 2.3.7', 'Android 4.0.4', 'Android 4.1.1', 'Android 4.2.2', 'Android 4.3',\n 'Safari 5.1.9 / OS X 10.6.8', 'Safari 6.0.4 / OS X 10.8.4 '];\n function checkTLSLevel(data) {\n // If we can determine the TLS level, check to see if it's less than 1.2\n if (parseFloat(data.tls_version.split(' ')[1]) < 1.1) {\n message.push(Resources.TLS_WARNING);\n callback(message);\n\n //If you want to track statistics on bad TLS hits, include this call\n $.ajax({url: Urls.TLSBadTLS});\n }\n }\n\n function reportBadBrowser () {\n // If the TLS level cannot be determined just report that this browser is suspect\n message.push(Resources.TLS_WARNING);\n callback(message);\n\n //If you want to track statistics on deprecated browsers, include this call\n $.ajax({url: Urls.TLSBadBrowser});\n }\n\n for (var i = 0; i < badBrowsers.length; i++) {\n if (userAgent.match(badBrowsers[i])) {\n // It's a suspect browser, let's see what it's TLS level is\n $.ajax({\n url: url\n }).done(checkTLSLevel).fail(reportBadBrowser);\n break;\n }\n }\n\n /** For testing purposes, uncomment this block\n message.push(Resources.TLS_WARNING);\n **/\n callback(message);\n}\n\n/**\n * @function showWarning turns on the browser-compatibility-alert and sets the message\n *\n * @param {string} message - the message that will be shown upon detection of a bad browser\n **/\nfunction showWarning(message) {\n $('
        ').addClass('browser-compatibility-alert').append($('

        ').addClass('browser-error').html(message)).appendTo('#browser-check');\n}\n\n/**\n * @function getCookie\n *\n * @param {string} key - The cookie name\n * @returns {string} value - the value of the cookie if found, null otherwise\n **/\nfunction getCookie(key) {\n var cookies = document.cookie.split(';');\n for (var i = 0; i < cookies.length; i++) {\n var tokens = cookies[i].split('=');\n var cookieKey = tokens[0].trim();\n if (cookieKey === key) {\n return tokens[1];\n }\n }\n return '';\n}\n\n/**\n * @function setCookie\n *\n * @param {string} key - The cookie name\n * @param {string} value - The cookie value\n * @param {integer} minutes - The number of minutes to expire the cookie\n **/\nfunction setCookie (key, value, minutes) {\n var date = new Date();\n date.setTime(date + (minutes * 60 * 1000));\n\n document.cookie = key + '=' + value + '; expires=' + date.toGMTString() + '; path=/';\n}\n\n/**\n * Export the getUserAgent function\n */\n\nexports.getUserAgent = getUserAgent;\n\n},{}],78:[function(require,module,exports){\n'use strict';\n\n/**\n * @function\n * @description Initializes the tooltip-content and layout\n */\nexports.init = function () {\n $(document).tooltip({\n items: '.tooltip',\n track: true,\n content: function () {\n return $(this).find('.tooltip-content').html();\n }\n });\n\n $('.share-link').on('click', function (e) {\n e.preventDefault();\n var target = $(this).data('target');\n if (!target) {\n return;\n }\n $(target).toggleClass('active');\n });\n};\n\n},{}],79:[function(require,module,exports){\n'use strict';\n\nvar _ = require('lodash');\n\nvar util = {\n /**\n * @function\n * @description appends the parameter with the given name and value to the given url and returns the changed url\n * @param {String} url the url to which the parameter will be added\n * @param {String} name the name of the parameter\n * @param {String} value the value of the parameter\n */\n appendParamToURL: function (url, name, value) {\n // quit if the param already exists\n if (url.indexOf(name + '=') !== -1) {\n return url;\n }\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n return url + separator + name + '=' + encodeURIComponent(value);\n },\n\n /**\n * @function\n * @description remove the parameter and its value from the given url and returns the changed url\n * @param {String} url the url from which the parameter will be removed\n * @param {String} name the name of parameter that will be removed from url\n */\n removeParamFromURL: function (url, name) {\n if (url.indexOf('?') === -1 || url.indexOf(name + '=') === -1) {\n return url;\n }\n var hash;\n var params;\n var domain = url.split('?')[0];\n var paramUrl = url.split('?')[1];\n var newParams = [];\n // if there is a hash at the end, store the hash\n if (paramUrl.indexOf('#') > -1) {\n hash = paramUrl.split('#')[1] || '';\n paramUrl = paramUrl.split('#')[0];\n }\n params = paramUrl.split('&');\n for (var i = 0; i < params.length; i++) {\n // put back param to newParams array if it is not the one to be removed\n if (params[i].split('=')[0] !== name) {\n newParams.push(params[i]);\n }\n }\n return domain + '?' + newParams.join('&') + (hash ? '#' + hash : '');\n },\n\n /**\n * @function\n * @description appends the parameters to the given url and returns the changed url\n * @param {String} url the url to which the parameters will be added\n * @param {Object} params\n */\n appendParamsToUrl: function (url, params) {\n var _url = url;\n _.each(params, function (value, name) {\n _url = this.appendParamToURL(_url, name, value);\n }.bind(this));\n return _url;\n },\n /**\n * @function\n * @description extract the query string from URL\n * @param {String} url the url to extra query string from\n **/\n getQueryString: function (url) {\n var qs;\n if (!_.isString(url)) { return; }\n var a = document.createElement('a');\n a.href = url;\n if (a.search) {\n qs = a.search.substr(1); // remove the leading ?\n }\n return qs;\n },\n /**\n * @function\n * @description\n * @param {String}\n * @param {String}\n */\n elementInViewport: function (el, offsetToTop) {\n var top = el.offsetTop,\n left = el.offsetLeft,\n width = el.offsetWidth,\n height = el.offsetHeight;\n\n while (el.offsetParent) {\n el = el.offsetParent;\n top += el.offsetTop;\n left += el.offsetLeft;\n }\n\n if (typeof(offsetToTop) !== 'undefined') {\n top -= offsetToTop;\n }\n\n if (window.pageXOffset !== null) {\n return (\n top < (window.pageYOffset + window.innerHeight) &&\n left < (window.pageXOffset + window.innerWidth) &&\n (top + height) > window.pageYOffset &&\n (left + width) > window.pageXOffset\n );\n }\n\n if (document.compatMode === 'CSS1Compat') {\n return (\n top < (window.document.documentElement.scrollTop + window.document.documentElement.clientHeight) &&\n left < (window.document.documentElement.scrollLeft + window.document.documentElement.clientWidth) &&\n (top + height) > window.document.documentElement.scrollTop &&\n (left + width) > window.document.documentElement.scrollLeft\n );\n }\n },\n /**\n * @function\n * @description\n * @param {String}\n * @param {String}\n */\n isInViewport: /*$.fn.isInViewport =*/ function(elem) {\n var elementTop = $(elem).offset().top;\n var elementBottom = elementTop + $(elem).outerHeight();\n\n var viewportTop = $(window).scrollTop();\n var viewportBottom = viewportTop + $(window).height();\n\n return elementBottom > viewportTop && elementTop < viewportBottom;\n },\n /**\n * @function\n * @description Appends the parameter 'format=ajax' to a given path\n * @param {String} path the relative path\n */\n ajaxUrl: function (path) {\n return this.appendParamToURL(path, 'format', 'ajax');\n },\n\n /**\n * @function\n * @description\n * @param {String} url\n */\n toAbsoluteUrl: function (url) {\n if (url.indexOf('http') !== 0 && url.charAt(0) !== '/') {\n url = '/' + url;\n }\n return url;\n },\n /**\n * @function\n * @description Loads css dynamically from given urls\n * @param {Array} urls Array of urls from which css will be dynamically loaded.\n */\n loadDynamicCss: function (urls) {\n var i, len = urls.length;\n for (i = 0; i < len; i++) {\n this.loadedCssFiles.push(this.loadCssFile(urls[i]));\n }\n },\n\n /**\n * @function\n * @description Loads css file dynamically from given url\n * @param {String} url The url from which css file will be dynamically loaded.\n */\n loadCssFile: function (url) {\n return $('').appendTo($('head')).attr({\n type: 'text/css',\n rel: 'stylesheet'\n }).attr('href', url); // for i.e. <9, href must be added after link has been appended to head\n },\n // array to keep track of the dynamically loaded CSS files\n loadedCssFiles: [],\n\n /**\n * @function\n * @description Removes all css files which were dynamically loaded\n */\n clearDynamicCss: function () {\n var i = this.loadedCssFiles.length;\n while (0 > i--) {\n $(this.loadedCssFiles[i]).remove();\n }\n this.loadedCssFiles = [];\n },\n /**\n * @function\n * @description Extracts all parameters from a given query string into an object\n * @param {String} qs The query string from which the parameters will be extracted\n */\n getQueryStringParams: function (qs) {\n if (!qs || qs.length === 0) { return {}; }\n var params = {},\n unescapedQS = decodeURIComponent(qs);\n // Use the String::replace method to iterate over each\n // name-value pair in the string.\n unescapedQS.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'),\n function ($0, $1, $2, $3) {\n params[$1] = $3;\n }\n );\n return params;\n },\n\n fillAddressFields: function (address, $form) {\n for (var field in address) {\n if (field === 'ID' || field === 'UUID' || field === 'key') {\n continue;\n }\n // if the key in address object ends with 'Code', remove that suffix\n // keys that ends with 'Code' are postalCode, stateCode and countryCode\n $form.find('[name$=\"' + field.replace('Code', '') + '\"]').val(address[field]);\n // update the state fields\n if (field === 'countryCode') {\n $form.find('[name$=\"country\"]').trigger('change');\n // retrigger state selection after country has changed\n // this results in duplication of the state code, but is a necessary evil\n // for now because sometimes countryCode comes after stateCode\n $form.find('[name$=\"state\"]').val(address.stateCode);\n }\n }\n },\n /**\n * @function\n * @description Updates the number of the remaining character\n * based on the character limit in a text area\n */\n limitCharacters: function () {\n $('form').find('textarea[data-character-limit]').each(function () {\n var characterLimit = $(this).data('character-limit');\n var charCountHtml = String.format(Resources.CHAR_LIMIT_MSG,\n '' + characterLimit + '',\n '' + characterLimit + '');\n var charCountContainer = $(this).next('div.char-count');\n if (charCountContainer.length === 0) {\n charCountContainer = $('

        ').insertAfter($(this));\n }\n charCountContainer.html(charCountHtml);\n // trigger the keydown event so that any existing character data is calculated\n $(this).change();\n });\n },\n /**\n * @function\n * @description Binds the onclick-event to a delete button on a given container,\n * which opens a confirmation box with a given message\n * @param {String} container The name of element to which the function will be bind\n * @param {String} message The message the will be shown upon a click\n */\n setDeleteConfirmation: function (container, message) {\n $(container).on('click', '.delete', function () {\n return window.confirm(message);\n });\n },\n /**\n * @function\n * @description Scrolls a browser window to a given x point\n * @param {String} The x coordinate\n */\n scrollBrowser: function (xLocation) {\n $('html, body').animate({scrollTop: xLocation}, 650, 'easeInOutQuint');\n },\n\n isMobile: function () {\n var mobileAgentHash = ['mobile', 'tablet', 'phone', 'ipad', 'ipod', 'android', 'blackberry', 'windows ce', 'opera mini', 'palm'];\n var idx = 0;\n var isMobile = false;\n var userAgent = (navigator.userAgent).toLowerCase();\n\n while (mobileAgentHash[idx] && !isMobile) {\n isMobile = (userAgent.indexOf(mobileAgentHash[idx]) >= 0);\n idx++;\n }\n return isMobile;\n },\n\n openModalOnClick: function (selector, resourceUrl){\n var dialog = require('../dw/dialog');\n if($(selector).length){\n $(selector).on(\"click\", function(e){\n e.preventDefault();\n dialog.open({\n url: resourceUrl ,\n options: {\n draggable: false,\n resizable: false,\n dialogClass: 'dialog-render',\n success: function(container){\n }\n },\n target: '#login-dialog'\n });\n });\n }\n },\n\n togglePageScroll: function (blockScroll) {\n var $body = document.querySelector('body');\n // global variable to save current scroll position\n window.scrollPosition = window.scrollPosition ? window.scrollPosition : 0;\n\n if (blockScroll) {\n // save page scroll and block page scrolling\n window.scrollPosition = window.pageYOffset;\n setTimeout(function () {\n $body.style.overflow = 'hidden';\n $body.style.position = 'fixed';\n $body.style.width = '100%';\n }, 300);\n } else {\n // enable page scroll and scroll to saved position\n $body.style.removeProperty('overflow');\n $body.style.removeProperty('position');\n $body.style.removeProperty('top');\n $body.style.removeProperty('width');\n window.scrollTo(0, window.scrollPosition);\n }\n }\n\n};\n\nmodule.exports = util;\n\n},{\"../dw/dialog\":20,\"lodash\":110}],80:[function(require,module,exports){\n'use strict';\n\nvar validatorUtils = require('../custom/pinValidations');\nvar iban = require('./custom/iban/iban');\nvar dialog = require('./dialog');\n\nvar additionalValidationFunctions = {\n ssn: {\n bg: validatorUtils.validateBulgarianEGN,\n ch: validatorUtils.CheckCH,\n hr: validatorUtils.validateCroatianOIB,\n it: validatorUtils.ControllaCF,\n ro: validatorUtils.validateRomanianCNP\n }\n\n}\n\nvar regex = {\n phone: /^[+]?(?!0+$)[\\d \\-]{8,15}$/,\n postal: {\n it: /^\\d{5}$/,\n gb: /^[a-zA-Z][a-zA-Z0-9]{1,3} \\d[a-zA-Z]{2}$/,\n de: /^\\d{5}$/,\n fr: /^\\d{5}$/,\n es: /^\\d{5}$/,\n at: /^\\d{4}$/,\n nl: /^\\d{4} [a-zA-Z]{2}$/,\n be: /^\\d{4}$/,\n ch: /^\\d{4}$/,\n pl: /^\\d{2}-\\d{3}$/,\n cz: /^\\d{3} \\d{2}$/,\n sk: /^\\d{3} \\d{2}$/,\n hu: /^\\d{4}$/,\n lv: /^[a-zA-Z]{2}-\\d{4}$/,\n hr: /^\\d{5}$/,\n dk: /^\\d{4}$/,\n si: /^([A-Z]{2} )?\\d{4}$/,\n se: /^\\d{3} \\d{2}$/,\n ee: /^\\d{5}$/,\n bg: /^\\d{4}$/,\n lt: /^[a-zA-Z]{2}-\\d{5}$/,\n lu: /^\\d{4}$/,\n fi: /^\\d{5}$/,\n no: /^\\d{4}$/,\n ro: /^\\d{6}$/,\n gr: /^\\d{3} \\d{2}$/,\n pt: /^\\d{4}(-\\d{3})?$/,\n mc: /^\\d{5}$/,\n ie: /^[a-zA-Z0-9]{3} [a-zA-Z0-9]{4}$/,\n ca: /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\\s?[0-9][A-Z][0-9]$/,\n us: /^[0-9]{5}(?:-[0-9]{4})?$/\n },\n ssn: {\n at: /^\\d{9}$/,\n be: /^\\d{11}$/,\n bg: /^\\d{10}$/,\n ch: /^\\d{13}$/,\n de: /^\\d{11}$/,\n dk: /^\\d{10}$/,\n ee: /^\\d{11}$/,\n es: /^\\d{8}[a-zA-Z]{1}|[a-zA-Z]{1}\\d{7}[A-Za-z]{1}$/,\n fi: /^[FIfi]{2}\\d{8}$/,\n fr: /^\\d{13}$/,\n gb: /^\\d{10}|[A-Za-z]{9}$/,\n gr: /^\\d{9}$/,\n hr: /^\\d{11}$/,\n hu: /^\\d{10}$/,\n ie: /^\\d{7}[A-za-z]{1,2}$/,\n it: /^[0-9A-Z]{16}$/,\n lt: /^\\d{11}$/,\n lu: /^\\d{13}$/,\n lv: /^\\d{11}$/,\n mc: /^\\d{13}$/,\n nl: /^\\d{9}$/,\n pl: /^\\d{11}$/,\n pt: /^\\d{9}$/,\n ro: /^\\d{13}$/,\n se: /^\\d{10}$/,\n si: /^\\d{8}$/,\n sk: /^\\d{8}$/\n },\n notCC: /^(?!(([0-9 -]){13,19})).*$/,\n customemail: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9]{0,61}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9]{1,61}){1,61}\\.(?:\\.?[a-zA-Z0-9]{0,61}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9]{1,61})){1,61}$/,\n multipleEmail: /^[a-zA-Z0-9_\\-\\.]+@([a-zA-Z0-9_\\-]+\\.)+[a-zA-Z][a-zA-Z]+(\\s*[,;]\\s*([a-zA-Z0-9_\\-\\.]+@([a-zA-Z0-9_\\-]+\\.)+[a-zA-Z][a-zA-Z]+))*$/,\n stringlos: /^(?=.{0,35}$)([a-zA-Z\\u0080-\\u024F]+(?:. |-| |'))*([a-zA-Z\\u0080-\\u024F]+(?:.))*$/,\n city: /^(?=.{0,35}$)([a-zA-Z\\u0080-\\u024F]+(?:. |-| |'))*([a-zA-Z0-9\\u0080-\\u024F])*$/,\n numeric: /^[0-9]+$/,\n orderNo: {\n all: /^GX/,\n us: /^(HBB-U)([0-9]{6})$/\n },\n password: /^(?=.*[a-z])(?=.*\\d)[A-Za-z\\d$@\\-_.:,;!%*#?&]{6,}$/\n};\n\n\nvar settings = {\n errorClass: 'error',\n errorElement: 'span',\n errorPlacement: function (error, element) {\n if (element.attr('type') == 'checkbox' || element.attr('type') == 'radio') {\n error.insertAfter(element.next('label'));\n } else {\n error.insertAfter(element);\n }\n },\n focusInvalid: false,\n focusCleanup: true,\n invalidHandler: function (event, validator) {\n if (validator.errorList.length != 0) {\n var offset = $(validator.errorList[0].element).offset();\n var selector;\n if (dialog.isDialogOpen()) {\n selector = dialog.getContainer();\n } else {\n selector = $('html, body');\n }\n selector.animate({\n scrollTop: offset.top - 100\n }, 500);\n }\n },\n // onkeyup: function (element) {\n // if (!this.checkable(element) && $(element).hasClass('onkeyupvalidation')) {\n // this.element(element);\n // }\n // },\n // onfocusout: function (element) {\n // if (!this.checkable(element)) {\n // this.element(element);\n // }\n // }\n};\n\n/**\n * @function\n * @description Validates a given phone number against the countries phone regex\n * @param {String} value The phone number which will be validated\n * @param {String} el The input field\n */\n\nvar validatePhone = function (value, element) {\n // Saving the original value to restore it after validation.\n // Validation is performed on a sanitized input, an input cleaned from spaces.\n var originalValue = $(element).val();\n sanitizeFields(element);\n value = $(element).val();\n\n var validationResult = this.optional(element) || regex.phone.test($.trim(value));\n\n $(element).val(originalValue);\n return validationResult;\n};\n\n/**\n * @function\n * @description Validates a zip code against the countries postal regex\n * @param {String} value The zip code which will be validated\n * @param {String} el The input field\n */\n\nvar validateZipcode = function (value, el) {\n var country = $(el).closest('form').find('.countryCode');\n if (country.length === 0 || country.val().length === 0 || !regex.postal[country.val().toLowerCase()]) {\n return true;\n }\n\n var rgx = regex.postal[country.val().toLowerCase()];\n var isOptional = this.optional(el);\n var isValid = rgx.test($.trim(value));\n\n return (isOptional ? (!value || 0 === value.length) : isValid) || isValid;\n};\n\n/**\n * @function\n * @description Validates a SSN based on current country\n * @param {String} value The ssn field which will be validated\n * @param {String} el The input field\n */\n\nvar validateSsn = function (value, el) {\n var country = $(el).closest('form').find('.countryCode').val();\n country = country.toLowerCase();\n //console.log(country);\n if (country.length === 0) {\n return true;\n }\n\n var isValid;\n\n isValid = regex.ssn[country].test($.trim(value));\n //console.log(isValid);\n if (isValid) {\n var applyFunction = additionalValidationFunctions.ssn[country];\n if (applyFunction) {\n isValid = applyFunction(value);\n }\n }\n\n return isValid;\n};\n\n/**\n * @function\n * @description Validates that a credit card owner is not a Credit card number\n * @param {String} value The owner field which will be validated\n * @param {String} el The input field\n */\n\nvar validateOwner = function (value) {\n var isValid = regex.notCC.test($.trim(value));\n return isValid;\n};\n\n/**\n * @function\n * @description Validates email with domain\n * @param {String} value The email field which will be validated\n * @param {String} el The input field\n */\n\nvar validateEmail = function (value, element) {\n element.value = element.value.toLowerCase();\n value = element.value;\n return this.optional(element) || regex.customemail.test($.trim(value));\n};\n\n/**\n * @function\n * @description Validates multiple emails with domain\n * @param {String} value The email field which will be validated\n * @param {String} el The input field\n */\n\nvar validateMultipleEmail = function (value, element) {\n element.value = element.value.toLowerCase();\n value = element.value;\n return this.optional(element) || regex.multipleEmail.test($.trim(value));\n};\n\n/**\n * @function\n * @description Validates stringlos\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateStringlos = function (value, element) {\n return this.optional(element) || regex.stringlos.test($.trim(value));\n};\n\n/**\n * @function\n * @description Validates city\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateCity = function (value, element) {\n return this.optional(element) || regex.city.test($.trim(value));\n};\n\n/**\n * @function\n * @description Validates numeric\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateNumeric = function (value, element) {\n return this.optional(element) || regex.numeric.test($.trim(value));\n};\n\n/**\n * @function\n * @description Validates order numbers\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateOrderNumber = function (value, element) {\n var country = $(element).closest('body').find('.countryCode').text();\n if (country == 'US' || country == 'CA') {\n var valid = this.optional(element) || regex.orderNo['us'].test($.trim(value)) || regex.orderNo['all'].test($.trim(value)) || regex.numeric.test($.trim(value));\n } else {\n var valid = this.optional(element) || regex.orderNo['all'].test($.trim(value)) || regex.numeric.test($.trim(value));\n }\n return valid;\n};\n\n/**\n * @function\n * @description Validates iban\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateIban = function (value, element) {\n var country = $('.orderdetails .order-shipment-address .summarybox .mini-address-location .country');\n if (country.length === 0 || country.data('countrycode').length === 0) {\n return true;\n }\n return this.optional(element) || iban.isValid(value, country.data('countrycode'));\n};\n\n/**\n * @function\n * @description Validates email confirmation field.\n * Confirmation field must have class 'email_second_confirm', main field must have class 'email_main_confirm',\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validateEmailConfirmation = function (value, element) {\n var mainvalue = $(element).closest('form').find('.email_main_confirm');\n if (mainvalue.length === 0 || mainvalue.val().length === 0) {\n return false;\n }\n if (mainvalue.val() == value) {\n return true;\n } else {\n return false;\n }\n\n};\n\n/**\n * @function\n * @description Validates password confirmation field.\n * Confirmation field must have class 'password_second_confirm', main field must have class 'password_main_confirm',\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validatePasswordConfirmation = function (value, element) {\n $(\"div\").find(\".confirm-new-pass\").children().children().children().not(':first-child').remove();\n var mainvalue = $(element).closest('form').find('.password_main_confirm');\n // The following \"if\" statement works only if the password_main_confirm field is required, which sometimes is not\n /* if (mainvalue.length === 0 || mainvalue.val().length === 0) {\n return false;\n } */\n if (mainvalue.val() == value) {\n return true;\n } else {\n return false;\n }\n};\n\n\n/**\n * @function\n * @description Validates password\n * @param {String} value The value of the field which will be validated\n * @param {String} el The input field\n */\n\nvar validatePassword = function (value, element) {\n $(\"div\").find(\".new-pass\").children().children().children().not(':first-child').remove();\n return this.optional(element) || regex.password.test($.trim(value));\n};\n\n/**\n * Add phone validation method to jQuery validation plugin.\n * Text fields must have 'phone' css class to be validated as phone\n */\n$.validator.addMethod('phone', validatePhone, Resources.INVALID_PHONE);\n\n/**\n * Add zip code validation method to jQuery validation plugin.\n * Text fields must have 'zipCode' css class to be validated as zip code\n */\n$.validator.addMethod('zipcode', validateZipcode, Constants.ZIPCODE_FORMAT_MSG);\n\n/**\n * Add ssn validation method to jQuery validation plugin.\n * Text fields must have 'zipCode' css class to be validated as zip code\n */\n$.validator.addMethod('ssn', validateSsn, Constants.SSN_FORMAT_MSG);\n\n/**\n * Add CCOwner validation method to jQuery validation plugin.\n * Text fields must have 'owner' css class to be validated as not a credit card\n */\n$.validator.addMethod('owner', validateOwner, Resources.INVALID_OWNER);\n\n/**\n * Add gift cert amount validation method to jQuery validation plugin.\n * Text fields must have 'gift-cert-amont' css class to be validated\n */\n$.validator.addMethod('gift-cert-amount', function (value, el) {\n var isOptional = this.optional(el);\n var isValid = (!isNaN(value)) && (parseFloat(value) >= 5) && (parseFloat(value) <= 5000);\n return isOptional || isValid;\n}, Resources.GIFT_CERT_AMOUNT_INVALID);\n\n/**\n * Add positive number validation method to jQuery validation plugin.\n * Text fields must have 'positivenumber' css class to be validated as positivenumber\n */\n$.validator.addMethod('positivenumber', function (value) {\n if ($.trim(value).length === 0) {\n return true;\n }\n return (!isNaN(value) && Number(value) >= 0);\n}, '');\n\n/**\n * Add custom email validation method to jQuery validation plugin.\n * Text fields must have 'email-custom' css class to be validated as email-regex\n */\n$.validator.addMethod('email-custom', validateEmail, Resources.VALIDATE_EMAIL);\n\n/**\n * Adds multiple email validation method to jQuery validation plugin.\n * Text fields must have 'multiple-email' css class to be validated as multiple-email-regex\n */\n$.validator.addMethod('multiple-email', validateMultipleEmail, Resources.VALIDATE_MULTIPLE_EMAIL);\n\n/**\n * Add stringlos validation method to jQuery validation plugin.\n * Text fields must have 'stringlos' css class to be validated\n */\n$.validator.addMethod('stringlos', validateStringlos, '');\n\n/**\n * Add city validation method to jQuery validation plugin.\n * Text fields must have 'stringlos' css class to be validated\n */\n$.validator.addMethod('city', validateCity, '');\n\n/**\n * Add numeric validation method to jQuery validation plugin.\n * Text fields must have 'numeric' css class to be validated\n */\n$.validator.addMethod('numeric', validateNumeric, '');\n\n/**\n * Add order number validation method to jQuery validation plugin.\n * Text fields must have 'numeric' css class to be validated\n */\n$.validator.addMethod('order-no', validateOrderNumber, Resources.VALIDATE_ORDER_NUMBER);\n\n/**\n * Add iban validation method to jQuery validation plugin.\n * Text fields must have 'iban' css class to be validated\n */\n$.validator.addMethod('iban', validateIban, Constants.IBAN_FORMAT_MSG);\n\n/**\n * Add \"confirmation field validations\" method to jQuery validation plugin.\n * Confirmation field must have class 'second_confirm', main field must have class 'main_confirm',\n * Both field must be children of a div with class 'confirm-validation'\n */\n$.validator.addMethod('email_second_confirm', validateEmailConfirmation, Resources.VALIDATE_CONFIRM_EMAIL);\n\n/**\n * Add \"confirmation field validations\" method to jQuery validation plugin.\n * Confirmation field must have class 'second_confirm', main field must have class 'main_confirm',\n * Both field must be children of a div with class 'confirm-validation'\n */\n$.validator.addMethod('password_second_confirm', validatePasswordConfirmation, Resources.VALIDATE_CONFIRM_PASSWORD);\n\n/**\n * Add password validation method to jQuery validation plugin.\n * Text fields must have 'password_validation' css class to be validated\n * NOTE: to be added only on\n */\n$.validator.addMethod('password_validation', validatePassword, Resources.VALIDATE_PASSWORD);\n\n/*\n * Cleans a field from undesired characters.\n * Current implementation removes only the spaces.\n */\n\nfunction sanitizeFields(input) {\n var regex = /[\\s\\-]+/g;\n\n var cleanValue = $(input).val().replace(regex, '');\n $(input).val(cleanValue);\n};\n\n$.extend($.validator.messages, {\n required: Resources.VALIDATE_REQUIRED,\n remote: Resources.VALIDATE_REMOTE,\n email: Resources.VALIDATE_EMAIL,\n url: Resources.VALIDATE_URL,\n date: Resources.VALIDATE_DATE,\n dateISO: Resources.VALIDATE_DATEISO,\n number: Resources.VALIDATE_NUMBER,\n digits: Resources.VALIDATE_DIGITS,\n creditcard: Resources.VALIDATE_CREDITCARD,\n equalTo: Resources.VALIDATE_EQUALTO,\n ssn: Constants.SSN_FORMAT_MSG,\n maxlength: $.validator.format(Resources.VALIDATE_MAXLENGTH),\n minlength: $.validator.format(Resources.VALIDATE_MINLENGTH),\n rangelength: $.validator.format(Resources.VALIDATE_RANGELENGTH),\n range: $.validator.format(Resources.VALIDATE_RANGE),\n max: $.validator.format(Resources.VALIDATE_MAX),\n min: $.validator.format(Resources.VALIDATE_MIN),\n confirmemail: Resources.VALIDATE_CONFIRM_EMAIL,\n password: Resources.VALIDATE_PASSWORD,\n confirmpassword: Resources.VALIDATE_CONFIRM_PASSWORD\n});\n\nvar validator = {\n regex: regex,\n settings: settings,\n init: function () {\n var self = this;\n $('form:not(.suppress)').each(function () {\n $(this).validate(self.settings);\n });\n },\n initForm: function (f) {\n $(f).validate(this.settings);\n }\n};\n\nmodule.exports = validator;\n\n},{\"../custom/pinValidations\":2,\"./custom/iban/iban\":13,\"./dialog\":20}],81:[function(require,module,exports){\n\n\t'use strict';\n\t// Caricamento Modulo ADYEN: tramite gulp in custom.min.js.\n\t\n\texports.init = function () {\n\n\t\tvalidateOrderDetailTrack();\n\n\t\t$('#dwfrm_orderdetailtrack input').keyup(function(){\n\t\t\tvalidateOrderDetailTrack();\n\t\t});\t\n\t};\n\n//VALIDATE FORM TASK 1\nfunction validateOrderDetailTrack(){\n\t\n\tif ( ($('#dwfrm_orderdetailtrack_orderNumber').val()) && ($('#dwfrm_orderdetailtrack input.error').length < 1) ) {\n\t\t$('#dwfrm_orderdetailtrack button').removeAttr('disabled');\n\t} else {\n\t\t$('#dwfrm_orderdetailtrack button').attr('disabled','disabled');\n\t}\t\n};\n},{}],82:[function(require,module,exports){\n/**\n * Chat Widget - Initialization\n */\n\n'use strict';\n\nexports.initializeWidgetChat = function initializeWidgetChat() {\n //Setting mapping language\n var languageChatMapping = 'English';\n\n if (settingChat && settingChat.languageCode != '') {\n switch (settingChat.languageCode) {\n case 'it':\n languageChatMapping = 'Italian';\n break;\n case 'fr':\n languageChatMapping = 'French';\n break;\n case 'de':\n languageChatMapping = 'German';\n break;\n case 'en':\n languageChatMapping = 'English';\n break;\n default:\n languageChatMapping = 'English';\n break;\n }\n }\n\n var checkAvail = true;\n\n var initESW = function (gslbBaseURL) {\n var show = false;\n\n window.setInterval(function () {\n if (checkAvail == true) {\n checkAvail = checkAvailabilityChat();\n }\n }, 500);\n\n // heitor comment\n\n embedded_svc.addEventHandler(\"onChatRequestSuccess\", function (data) {\n console.log(\"onChatRequestSuccess event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChatEstablished\", function (data) {\n console.log(\"onChatEstablished event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChasitorMessage\", function (data) {\n console.log(\"onChasitorMessage event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onAgentMessage\", function (data) {\n console.log(\"onAgentMessage event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChatConferenceInitiated\", function (data) {\n console.log(\"onChatConferenceInitiated event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onAgentJoinedConference\", function (data) {\n console.log(\"onAgentJoinedConference event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onAgentLeftConference\", function (data) {\n console.log(\"onAgentLeftConference event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChatConferenceEnded\", function (data) {\n console.log(\"onChatConferenceEnded event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChatTransferSuccessful\", function (data) {\n console.log(\"onChatTransferSuccessful event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onChatEndedByChasitor\", function (data) {\n console.log(\"onChatEndedByChasitor event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n console.log('JSON.stringify(end chat buttommm ) ----> ' + JSON.stringify(document.getElementsByClassName(\"endChatButton closeChatButton uiButton--default uiButton embeddedServiceSidebarButton\")[0]));\n\n });\n\n embedded_svc.addEventHandler(\"onChatEndedByAgent\", function (data) {\n console.log(\"onChatEndedByAgent event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onQueueUpdate\", function (data) {\n console.log(\"onQueueUpdate event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey + \"and queuePosition was \" + data.queuePosition);\n });\n\n embedded_svc.addEventHandler(\"onIdleTimeoutOccurred\", function (data) {\n console.log(\"onIdleTimeoutOccurred event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onConnectionError\", function (data) {\n console.log(\"onConnectionError event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onClickSubmitButton\", function (data) {\n console.log(\"onClickSubmitButton event was fired. liveAgentSessionKey was \" + data.liveAgentSessionKey);\n });\n\n embedded_svc.addEventHandler(\"onInviteAccepted\", function () {\n console.log(\"onInviteAccepted event was fired.\");\n });\n\n embedded_svc.addEventHandler(\"onInviteRejected\", function () {\n console.log(\"onInviteRejected event was fired.\");\n });\n\n embedded_svc.addEventHandler(\"onInvitationResourceLoaded\", function () {\n console.log(\"onInvitationResourceLoaded event was fired.\");\n });\n\n embedded_svc.addEventHandler(\"onSettingsCallCompleted\", function (data) {\n var chatStatus = data.isAgentAvailable ? \"online\" : \"offline\";\n console.log(\"onSettingsCallCompleted event was fired. Agent availability status is \" + chatStatus);\n });\n\n embedded_svc.addEventHandler(\"onAvailability\", function (data) {\n var chatStatus = data.isAgentAvailable ? \"online\" : \"offline\";\n console.log(\"onAvailability event was fired. Agent availability status is \" + chatStatus);\n });\n\n // end\n embedded_svc.addEventHandler(\"afterMinimize\", function (data) {\n let myElement = document.getElementsByClassName(\"sidebarMinimized\");\n console.log('heitor sidebarMinimized html 0 ----> ' + JSON.stringify(myElement[0]));\n myElement[0].style.opacity = \"0\";\n let myElement1 = document.getElementsByClassName(\"embeddedServiceHelpButton\");\n console.log('heitor embeddedServiceHelpButton html 0 ----> ' + JSON.stringify(myElement1[0]));\n myElement1[0].style.display = \"block\";\n\n let myElement2 = document.getElementsByClassName(\"embeddedServiceIcon\");\n console.log('heitor embeddedServiceIcon html 0 ----> ' + JSON.stringify(myElement2[0]));\n myElement2[0].style.display = \"block\";\n console.log(\"afterMinimize event was fired.\");\n });\n embedded_svc.addEventHandler(\"afterMaximize\", function (data) {\n let myElement = document.getElementsByClassName(\"sidebarMaximized\");\n console.log('heitor sidebarMaximized html 0 ----> ' + JSON.stringify(myElement[0]));\n myElement[0].style.opacity = \"100%\";\n console.log(\"afterMaximize event was fired.\");\n });\n embedded_svc.addEventHandler(\"afterMaximize\", function (data) {\n if (!show) {\n show = true;\n console.log(\"afterMaximize event was fired.\");\n var li3 = document.createElement(\"div\");\n li3.style.color = \"#3156bc\";\n li3.style.backgroundColor = \"white\";\n li3.style.padding = \"10px 0\";\n li3.style.fontSize = \"16px\";\n li3.style.fontWeight = '600';\n li3.style.marginTop = \"8px\";\n li3.style.textAlign = 'left';\n li3.style.marginLeft = \"16px\";\n li3.style.letterSpacing = \"0.7px\";\n\n li3.appendChild(document.createTextNode(settingChat.chatMainText));\n var sidebar = document.querySelector(\"div.formContent.embeddedServiceSidebarForm\");\n\n sidebar.insertBefore(li3, sidebar.childNodes[0]);\n console.log('heitor sidebar -----> ' + JSON.stringify(sidebar));\n\n\n var li4 = document.createElement(\"div\");\n li4.style.color = \"grey\";\n li4.style.backgroundColor = \"white\";\n li4.style.fontSize = \"12px\";\n li4.style.fontWeight = '300';\n li4.style.font = \"ProximaNova, sans-serif\";\n li4.style.textAlign = 'left';\n li4.style.marginLeft = \"16px\";\n\n li4.appendChild(document.createTextNode(settingChat.chatRequiredFieldsText));\n var sidebar = document.querySelector(\"div.formContent.embeddedServiceSidebarForm\");\n sidebar.insertBefore(li4, sidebar.childNodes[3]);\n\n\n var li2 = document.createElement(\"div\");\n li2.style.color = \"grey\";\n li2.style.backgroundColor = \"white\";\n li2.style.textAlign = 'left';\n li2.style.fontWeight = '300';\n li4.style.padding = \"5px 0 \";\n li2.style.fontSize = \"12px\";\n li2.style.font = \"ProximaNova, sans-serif\";\n li2.style.marginLeft = settingChat.li2MarginLeft;\n var a = document.createElement('a');\n //li2.style.whiteSpace='pre';\n var linkText = document.createTextNode(settingChat.chatLinkText);\n var linkText1 = document.createTextNode(settingChat.chatLinkText1);\n\n a.appendChild(linkText);\n a.title = \"Read the privacy policy\";\n a.href = \"https://www.geox.com/\" + settingChat.languageCode + \"-\" + settingChat.countryCode + \"/privacy\";\n document.body.appendChild(a);\n li2.appendChild(linkText1);\n li2.appendChild(a);\n sidebar.insertBefore(li2, sidebar.childNodes[4]);\n\n const uilabell = document.getElementsByClassName(\"uiLabel-left form-element__label uiLabel\");\n\n document.getElementsByClassName(\"uiLabel-left form-element__label uiLabel\")[0].innerText = getTranslationFormField(settingChat.languageCode, 'FirstName');\n document.getElementsByClassName(\"uiLabel-left form-element__label uiLabel\")[1].innerText = getTranslationFormField(settingChat.languageCode, 'LastName');\n document.getElementsByClassName(\"uiLabel-left form-element__label uiLabel\")[2].innerText = getTranslationFormField(settingChat.languageCode, 'Subject');\n document.getElementsByClassName(\"uiLabel-left form-element__label uiLabel\")[3].innerText = \"E-MAIL *\";\n console.log('json submitButton ---> ' + JSON.stringify(document.getElementsByClassName(\"label bBody\")[0].innerText));\n document.getElementsByClassName(\"label bBody\")[0].innerText = getTranslationButtonString(settingChat.languageCode);\n\n //console.log('JSON.stringify(myElement) ----> ' + JSON.stringify(document.getElementsByClassName(\"form-element__help\")[3].innerText)));\n\n //document.getElementsByClassName(\"form-element__help\")[0].innerText = 'Please enter a valid first name value.';\n //console.log('JSON.stringify(uiInputDefaultError ) ----> ' + JSON.stringify(embedded_svc.settings));\n\n //document.getElementsByClassName(\"form-element__help\")[0].innerText = \"Please enter a valid first name value.\";\n //document.getElementsByClassName(\"form-element__help\")[1].innerText = \"Please enter a valid last name value.\";\n //document.getElementsByClassName(\"form-element__help\")[2].innerText = \"Please enter a valid subject value.\";\n //document.getElementsByClassName(\"form-element__help\")[3].innerText = \"Please enter a valid email value.\";\n\n }\n });\n\n embedded_svc.addEventHandler(\"afterDestroy\", function(data) {\n show = false;\n let myElement2 = document.getElementsByClassName(\"embeddedServiceIcon\");\n myElement2[0].style.display = \"block\";\n console.log(\"afterDestroy event was fired.\");\n });\n\n embedded_svc.addEventHandler(\"onClickSubmitButton\", function (data) {\n console.log('onClickSubmitButton --> JSON.stringify(myElement) ----> ' + JSON.stringify(document.getElementsByClassName(\"uiInputDefaultError form-element__help\")[0]));\n\n });\n\n embedded_svc.addEventHandler(\"onHelpButtonClick\", function (data) {\n console.log(\"onHelpButtonClick event was fired.\");\n\n\n });\n\n embedded_svc.settings.displayHelpButton = true; //Or false\n embedded_svc.settings.language = settingChat.languageCode != '' ? settingChat.languageCode : 'en-US'; //For example, enter 'en' or 'en-US'\n embedded_svc.settings.defaultMinimizedText = 'Live Chat'; //(Defaults to Chat with an Expert)\n embedded_svc.settings.disabledMinimizedText = 'Live Chat'; //(Defaults to Agent Offline)\n embedded_svc.settings.loadingText = 'Live Chat'; //(Defaults to Loading)\n\n\n\n //embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)\n\n // Settings for Chat\n //embedded_svc.settings.directToButtonRouting = function(prechatFormData) {\n // Dynamically changes the button ID based on what the visitor enters in the pre-chat form.\n // Returns a valid button ID.\n //};\n //embedded_svc.settings.prepopulatedPrechatFields = {}; //Sets the auto-population of pre-chat form fields\n //embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId\n //embedded_svc.settings.offlineSupportMinimizedText = ''; //(Defaults to Contact Us)\n\n embedded_svc.settings.offlineSupportMinimizedText = 'Live Chat'; //(Defaults to Contact Us)\n embedded_svc.settings.enabledFeatures = ['LiveAgent'];\n embedded_svc.settings.entryFeature = 'LiveAgent';\n\n embedded_svc.settings.extraPrechatInfo = [{\n \"entityFieldMaps\": [{\n \"doCreate\": true,\n \"doFind\": true,\n \"fieldName\": \"LastName\",\n \"isExactMatch\": true,\n \"label\": getTranslationFormField(settingChat.languageCode, 'LastName')\n }, {\n \"doCreate\": true,\n \"doFind\": true,\n \"fieldName\": \"FirstName\",\n \"isExactMatch\": true,\n \"label\": getTranslationFormField(settingChat.languageCode, 'FirstName')\n }, {\n \"doCreate\": true,\n \"doFind\": true,\n \"fieldName\": \"Email\",\n \"isExactMatch\": true,\n \"label\": \"Email\"\n }, {\n \"doCreate\": true,\n \"doFind\": true,\n \"fieldName\": \"Subject__c\",\n \"isExactMatch\": true,\n \"label\": getTranslationFormField(settingChat.languageCode, 'Subject__c')\n }],\n \"entityName\": \"Contact\",\n \"showOnCreate\": true\n }];\n embedded_svc.settings.extraPrechatFormDetails = [{\n \"label\": \"Country\",\n \"value\": settingChat.countryCode != '' ? settingChat.countryCode : 'CA',\n \"transcriptFields\": [\"Country__c\"],\n \"displayToAgent\": true\n }, {\n \"label\": \"Region\",\n \"value\": settingChat.regionCodeMapping != '' ? settingChat.regionCodeMapping : 'AMERICAS',\n \"transcriptFields\": [\"Region__c\"],\n \"displayToAgent\": true\n }, {\n \"label\": \"Language\",\n \"value\": languageChatMapping,\n \"transcriptFields\": [\"Language__c\"],\n \"displayToAgent\": true\n }];\n\n embedded_svc.init(\n 'https://tfour.my.salesforce.com',\n 'https://tfour.force.com',\n gslbBaseURL,\n '00D2p000000P6Rt',\n settingChat.buttonChatName, {\n baseLiveAgentContentURL: 'https://c.la3-c2-cdg.salesforceliveagent.com/content',\n deploymentId: '5722p000000HCUY',\n buttonId: settingChat.buttonChatCodeID,\n baseLiveAgentURL: 'https://d.la3-c2-cdg.salesforceliveagent.com/chat',\n eswLiveAgentDevName: settingChat.buttonChatName,\n isOfflineSupportEnabled: false\n }\n );\n };\n\n if ($('#wrapper').length > 0 && settingChat && settingChat.enableWidgetChat && settingChat.enableWidgetChat == 'true') {\n if (!window.embedded_svc) {\n var s = document.createElement('script');\n s.setAttribute('src', 'https://tfour.my.salesforce.com/embeddedservice/5.0/esw.min.js');\n s.onload = function () {\n initESW(null);\n };\n\n document.body.appendChild(s);\n } else {\n initESW('https://service.force.com');\n }\n }\n};\n\nfunction checkAvailabilityChat() {\n var elementEnabled = document.getElementsByClassName('uiButton helpButtonEnabled');\n var elementDisabled = document.getElementsByClassName('uiButton helpButtonDisabled');\n console.log('checkAvailabilityChat - element Enabled -----> AGENTTTT ------> ' + elementEnabled.length);\n console.log('checkAvailabilityChat - element Disabled -----> AGENTTTT ------> ' + elementDisabled.length);\n if (elementEnabled && elementDisabled) {\n if (elementEnabled.length == 0 && elementDisabled.length == 0) {\n // recall checkAvailabilityChat function after interval\n return true;\n } else {\n if (elementEnabled.length > 0) {\n document.getElementsByClassName('embeddedServiceHelpButton').item(0).style.display = \"block\";\n // stop calling checkAvailabilityChat function\n return false;\n }\n if (elementDisabled.length > 0) {\n document.getElementsByClassName('embeddedServiceHelpButton').item(0).style.display = \"none\";\n // recall checkAvailabilityChat function after interval\n return true;\n }\n\n // stop calling checkAvailabilityChat function\n //return false;\n }\n } else {\n // recall checkAvailabilityChat function after interval\n return true;\n }\n\n}\n\n/*\n * Translation form string function\n */\nfunction getTranslationFormField (language, fieldString) {\n var languageStrgTranslation = '';\n\n if (fieldString && language) {\n var languageObjTranslation = {};\n\n switch (fieldString) {\n case 'FirstName':\n languageObjTranslation = {\n 'en': 'First Name *',\n 'fr': 'Prénom *',\n 'de': 'Vorname *'\n };\n break;\n case 'LastName':\n languageObjTranslation = {\n 'en': 'Last Name *',\n 'fr': 'Nom *',\n 'de': 'Nachname *'\n };\n break;\n case 'Subject__c':\n case 'Subject':\n languageObjTranslation = {\n 'en': 'Subject *',\n 'fr': 'Sujet *',\n 'de': 'Betreff *'\n };\n break;\n default:\n languageObjTranslation = {};\n break;\n }\n\n languageStrgTranslation = languageObjTranslation[language].toUpperCase();\n }\n\n return languageStrgTranslation;\n}\n\n/**\n * Translation button string function\n */\nfunction getTranslationButtonString (language) {\n var buttonTranslationButtonString = {\n 'it': 'Inizia a chattare',\n 'en': 'Start chatting',\n 'de': 'Chatten starten',\n 'fr': 'Commence à chatter'\n };\n\n return buttonTranslationButtonString[language].toUpperCase();\n}\n},{}],83:[function(require,module,exports){\n'use strict';\n\n/**\n * Populate the Billing Address Summary View\n * @param {string} parentSelector - the top level DOM selector for a unique address summary\n * @param {Object} address - the address data\n */\nfunction populateAddressSummary(parentSelector, address) {\n if (address) {\n $.each(address, function (attr) {\n var val = address[attr];\n $('.' + attr, parentSelector).text(val || '');\n });\n }\n}\n\n/**\n * returns a formed ');\n }\n var safeShipping = shipping || {};\n var shippingAddress = safeShipping.shippingAddress || {};\n\n if (isBilling && isNew && !order.billing.matchingAddressId) {\n shippingAddress = order.billing.billingAddress.address || {};\n isNew = false;\n isSelected = true;\n safeShipping.UUID = 'manual-entry';\n }\n\n var uuid = safeShipping.UUID ? safeShipping.UUID : 'new';\n var optionEl = $('