{"version":3,"sources":["webpack:///./src/client/default/js/utilities/mapsUtils.js","webpack:///./src/client/default/js/components/storeSelectionComponent.js"],"names":["googleMapsApiKey","a","window","mapLoaded","scriptSrc","script","document","createElement","src","async","defer","head","appendChild","initMap","event","Event","createEvent","initEvent","body","dispatchEvent","StoreSelectionComponent","element","sidebar","querySelector","container","SELECTORS","storeServiceList","introbox","introBoxes","placeRecap","input","btnSubmit","currentPosition","isMobileApp","isApp","initGMaps","restoreLayerOnEmptyInput","timeslotEnabled","$options","isStorePage","observer","MutationObserver","mutations","contains","disconnect","observe","attributes","childList","characterData","subtree","this","CUSTOM_MESSAGES","STORE_SELECTION_SELECT_EVENTS","changed","save","SHIPPING_UPDATE_EVENTS","updated","updateSelection","handleAddToCart","handleReorder","close","resetLayer","TIMESLOT","INIT_COMPONENT","sendAddToCartPayload","paccontainer","findCurrentPositionBtn","pushApp","partners","querySelectorAll","length","forEach","el","addEventListener","e","preventDefault","appPostMessage","goToPartnerUrl","href","gmkey","googleMapInitScript","Bean","on","off","initAutocomplete","initGeoloc","targetNode","getElementById","oninput","setAttribute","value","mutationsList","target","setTimeout","classList","add","remove","autocomplete","google","maps","places","Autocomplete","setFields","setComponentRestrictions","country","setTypes","_addEventListener","type","listener","_listener","suggestionSelected","getElementsByClassName","keyCode","KeyboardEvent","key","code","apply","$on","focus","ev","which","action","blur","addListener","clear","place","getPlace","geometry","addressComponent","lat","location","long","lng","cap","getAddressPart","address_components","city","state","address","civic","administrativeAreaLevel3","isGeneric","getAddressGeneric","inputAutocomplete","geolocButton","iconPac","iconGeo","textNode","createTextNode","firstChild","insertBefore","stopPropagation","loading","clickFindCurrentPositionCB","endLoading","getClientLocation","geocoder","Geocoder","geocode","then","response","results","formatted_address","catch","console","error","position","undefined","promiseArray","push","Promise","resolve","reject","wait","clearTimeout","navigatorGeolocation","race","pos","info","isNaN","coords","latitude","longitude","clientLocation","inputValue","stateCode","doSearch","innerHTML","filter","val","join","streetNumber","get","url","params","data","services","capList","cityList","selectLabel","selectPlaceholder","warningCityCap","bannerOptions","errorMessage","isTherePickupInStore","find","service","shippingMethodId","servicesTemplate","servicesTemplateNoTimeslot","pushDeliveryPartnersToDataLayer","msg","partnerTargetForApp","part","typesToSearch","administrativeAreaLevel2","addressPart","types","indexOf","short_name","includes","shippingSelected","redirect","timeslotEnabledForApp","addToCartPayload","addToCart","reorder","hash","replace","res","promobundle","search","config","pid","dataset","addToCartPaylodFromAxios","request","quantityTotal","qtyInCart","EMIT","REORDER_EVENTS","CART_PAYLOAD","cartPayloadData","className","moveInfostrip","infoStrip","scrollTo","mainHeader","nextSibling","button","partner","dataLayer","service_name","delivery_type","TogglerComponent"],"mappings":"wWAAO,WAAmCA,GAAnC,iBAAAC,EAAA,sDACAC,OAAOC,YACNC,EADiB,sDAC0CJ,EAD1C,mDAEjBK,EAASC,SAASC,cAAc,WAC7BC,IAAMJ,EACbC,EAAOI,OAAQ,EACfJ,EAAOK,OAAQ,EACfJ,SAASK,KAAKC,YAAYP,IAG5BH,OAAOW,QAAU,WAEf,IAAIC,EADJZ,OAAOC,WAAY,EAEE,mBAAVY,MACTD,EAAQ,IAAIC,MAAM,eAElBD,EAAQR,SAASU,YAAY,UACvBC,UAAU,cAAc,GAAO,GAEvCX,SAASY,KAAKC,cAAcL,IAnBzB,4C,0lECScM,E,0CAyBnB,WAAYC,GAAS,MAcnB,GAdmB,aACnB,cAAMA,IACDC,QAAsChB,SAASiB,cAAc,0BAClE,EAAKC,UAAwClB,SAASiB,cAAc,EAAKE,UAAUC,kBACnF,EAAKC,SAAWrB,SAASiB,cAAc,EAAKE,UAAUG,YACtD,EAAKC,WAAavB,SAASiB,cAAc,EAAKE,UAAUI,YACxD,EAAKC,MAAyCxB,SAASiB,cAAc,+BACrE,EAAKQ,UAA6CzB,SAASiB,cAAc,iBACzE,EAAKS,gBAAkB,KACvB,EAAKC,YAAc3B,SAASiB,cAAc,EAAKE,UAAUS,OACzD,EAAKC,YACL,EAAKC,2BACL,EAAKC,gB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KAAKiO,UAAUf,QAAQ,sCAAuC,MAChG,O,6CAGL,WACM9N,SAASiB,cAAc,iCAAmCjB,SAASiB,cAAc,4BACrEjB,SAAS+D,iBAAiB,iBAChCE,SAAQ,SAACkL,GACfA,EAAOhL,iBAAiB,SAAS,WAC/B,IAAIiL,EAAUD,EAAON,UAAUf,QAAQ,eAAgB,IACvDlO,OAAOyP,UAAUlF,KAAK,CACpB3J,MAAO,iBACP8O,aAAc,mBACdC,cAAeH,c,GAvf0BI","file":"js/component-storeSelectionComponent-js.chunks.js","sourcesContent":["export async function googleMapInitScript(googleMapsApiKey) {\n if (!window.mapLoaded) {\n var scriptSrc = `https://maps.googleapis.com/maps/api/js?key=${googleMapsApiKey}&callback=initMap&libraries=places&language=it`;\n var script = document.createElement('script');\n script.src = scriptSrc;\n script.async = true;\n script.defer = true;\n document.head.appendChild(script);\n }\n\n window.initMap = function() {\n window.mapLoaded = true;\n var event;\n if (typeof Event === 'function') {\n event = new Event('map:loaded');\n } else {\n event = document.createEvent('Event');\n event.initEvent('map:loaded', false, true);\n }\n document.body.dispatchEvent(event);\n };\n}\n","import TogglerComponent from './togglerComponent';\nimport { get, request } from '../libs/Axios';\nimport servicesTemplate from 'MICROTEMPLATES/stores/storeServices.ejs';\nimport servicesTemplateNoTimeslot from 'MICROTEMPLATES/stores/storeServicesNoTimeslot.ejs';\nimport { navigatorGeolocation } from '../utilities/geolocationUtils';\nimport { appPostMessage } from '../utilities/postMessage';\nimport { googleMapInitScript } from '../utilities/mapsUtils';\nimport Bean from 'bean';\n\nexport default class StoreSelectionComponent extends TogglerComponent {\n get Messages() {\n return {\n [this.CUSTOM_MESSAGES.STORE_SELECTION_SELECT_EVENTS.changed]: this.save,\n [this.CUSTOM_MESSAGES.SHIPPING_UPDATE_EVENTS.updated]: this.updateSelection,\n [`error.NO_SHIPPING_METHOD_SELECTED`]: this.handleAddToCart,\n [`error.NO_SHIPPING_METHOD_SELECTED_REORDER`]: this.handleReorder,\n [this.CUSTOM_MESSAGES.STORE_SELECTION_SELECT_EVENTS.close]: this.resetLayer,\n [this.CUSTOM_MESSAGES.TIMESLOT.INIT_COMPONENT]: this.sendAddToCartPayload\n };\n }\n\n get SELECTORS() {\n return {\n ...super.SELECTORS,\n storeServiceList: '.services-list',\n introBoxes: '.informative-info',\n placeRecap: '#place-recap',\n paccontainer: '.pac-container',\n findCurrentPositionBtn: '.storeSelectio-sidebar .iamhere',\n pushApp: '.push-app-content-wrapper',\n isApp: '.mobile-layout'\n };\n }\n\n constructor(element) {\n super(element);\n this.sidebar = /** @type {HTMLElement} */ (document.querySelector('.storeSelectio-sidebar'));\n this.container = /** @type {HTMLElement} */ (document.querySelector(this.SELECTORS.storeServiceList));\n this.introbox = document.querySelector(this.SELECTORS.introBoxes);\n this.placeRecap = document.querySelector(this.SELECTORS.placeRecap);\n this.input = /** @type {HTMLInputElement} */ (document.querySelector('#sidebarAddressAutocomplete'));\n this.btnSubmit = /** @type {HTMLInputElement} */ (document.querySelector('.js-btn-store'));\n this.currentPosition = null;\n this.isMobileApp = document.querySelector(this.SELECTORS.isApp);\n this.initGMaps();\n this.restoreLayerOnEmptyInput();\n this.timeslotEnabled = this.$options.timeslotEnabled;\n let isStoreLocatorPage = this.$options.isStorePage;\n if (!isStoreLocatorPage) {\n var observer = new MutationObserver((mutations) => {\n if (document.contains(document.querySelector('.pac-container:not(.maps)'))) {\n document.querySelector('.storeSelectio-sidebar').appendChild(document.querySelector('.pac-container:not(.maps)'));\n observer.disconnect();\n }\n });\n\n observer.observe(document, { attributes: false, childList: true, characterData: false, subtree: true });\n }\n }\n partnerTargetForApp() {\n if (this.isMobileApp) {\n let partners = document.querySelectorAll('.partner-link');\n if (partners && partners.length > 0) {\n partners.forEach((el) => {\n el.addEventListener('click', (e) => {\n e.preventDefault();\n appPostMessage({ goToPartnerUrl: el.href });\n });\n });\n }\n }\n }\n initGMaps() {\n var googleMapsApiKey = this.$options.gmkey;\n if (googleMapsApiKey) {\n googleMapInitScript(googleMapsApiKey);\n\n if (!window.mapLoaded) {\n Bean.on(document.body, 'map:loaded', () => {\n Bean.off(document.body, 'map:loaded');\n this.initAutocomplete();\n this.initGeoloc();\n });\n }\n }\n }\n\n restoreLayerOnEmptyInput() {\n const targetNode = document.getElementById('sidebarAddressAutocomplete');\n targetNode.oninput = function(e) {\n targetNode.setAttribute('value', targetNode.value);\n };\n\n const config = { attributes: true, childList: true, subtree: true };\n\n const callback = function(mutationsList, observer) {\n for (let mutation of mutationsList) {\n if (mutation.target.value === '') {\n setTimeout(() => {\n document.querySelector('.services-list')?.classList.add('hidden');\n document.querySelector('.informative-info')?.classList.remove('hidden');\n document.querySelector('.storeSelectio-sidebar').classList.add('initial-state');\n }, 400);\n }\n }\n };\n\n const observer = new MutationObserver(callback);\n observer.observe(targetNode, config);\n }\n\n initAutocomplete() {\n var input = /** @type {HTMLInputElement} */ (document.querySelector('#sidebarAddressAutocomplete'));\n // eslint-disable-next-line no-undef\n var autocomplete = new google.maps.places.Autocomplete(input);\n autocomplete.setFields(['address_component', 'geometry']); // limit only to address_component and geometry\n autocomplete.setComponentRestrictions({\n country: ['it'] // limit only to Italian results\n });\n autocomplete.setTypes(['geocode']);\n\n const _addEventListener = input.addEventListener;\n\n const addEventListenerWrapper = (type, listener) => {\n if (type === 'keydown') {\n const _listener = listener;\n listener = (event) => {\n this.introbox.classList.add('hidden');\n document.querySelector('.storeSelectio-sidebar').classList.remove('initial-state');\n const suggestionSelected = document.getElementsByClassName('pac-item-selected').length;\n if (event.keyCode == 13 && !suggestionSelected) {\n const e = new KeyboardEvent('keydown', { key: 'ArrowDown', code: 'ArrowDown', keyCode: 40 });\n _listener.apply(this.input, [e]);\n }\n _listener.apply(this.input, [event]);\n };\n }\n _addEventListener.apply(this.input, [type, listener]);\n };\n\n this.input.addEventListener = addEventListenerWrapper;\n\n this.$on(\n 'click.btnSubmit',\n (e) => {\n input.focus();\n var ev = document.createEvent('Event');\n ev.initEvent('keydown');\n ev.which = ev.keyCode = 13;\n input.dispatchEvent(ev);\n if (this.isMobileApp) {\n appPostMessage({ action: 'OK_STORE_LAYER' });\n input.blur();\n }\n },\n this.btnSubmit\n );\n\n // eslint-disable-next-line no-undef\n google.maps.event.addListener(autocomplete, 'place_changed', () => {\n this.clear();\n var place = autocomplete.getPlace();\n\n if (!place.geometry) {\n // User enter a not available place or there is an error with api call\n // Show error\n\n return;\n }\n const addressComponent = {\n lat: place.geometry.location.lat(),\n long: place.geometry.location.lng(),\n cap: this.getAddressPart(place.address_components, 'cap'),\n city: this.getAddressPart(place.address_components, 'city'),\n state: this.getAddressPart(place.address_components, 'administrativeAreaLevel2'),\n address: this.getAddressPart(place.address_components, 'address'),\n civic: this.getAddressPart(place.address_components, 'civic'),\n administrativeAreaLevel3: this.getAddressPart(place.address_components, 'administrativeAreaLevel3'),\n isGeneric: this.getAddressGeneric(place.address_components) ? 1 : 0\n };\n\n this.save(addressComponent);\n });\n }\n\n initGeoloc() {\n let inputAutocomplete = document.querySelector('#sidebarAddressAutocomplete');\n this.$on(\n 'focus',\n () => {\n if (!document.querySelector(this.SELECTORS.findCurrentPositionBtn)) {\n let geolocButton = document.createElement('button');\n geolocButton.classList.add('pac-item', 'iamhere');\n let iconPac = document.createElement('span');\n iconPac.classList.add('pac-icon', 'pac-icon-marker');\n let iconGeo = document.createElement('span');\n iconGeo.classList.add('icon-geolocstore');\n geolocButton.appendChild(iconPac);\n geolocButton.appendChild(iconGeo);\n let textNode = document.createTextNode('Utilizza la mia posizione attuale');\n geolocButton.appendChild(textNode);\n let paccontainer = document.querySelector(this.SELECTORS.paccontainer);\n if (paccontainer && paccontainer.firstChild) {\n paccontainer.insertBefore(geolocButton, paccontainer.firstChild);\n } else if (paccontainer) {\n paccontainer.appendChild(geolocButton);\n }\n geolocButton.addEventListener('click', (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.loading(this.sidebar);\n this.clickFindCurrentPositionCB();\n this.endLoading(this.sidebar);\n });\n this.$on(\n 'blur',\n () => {\n paccontainer.classList.add('keep');\n setTimeout(() => {\n paccontainer.classList.remove('keep');\n }, 500);\n },\n inputAutocomplete\n );\n }\n },\n inputAutocomplete\n );\n }\n\n async clickFindCurrentPositionCB() {\n await this.getClientLocation();\n if (this.currentPosition && this.currentPosition.lat && this.currentPosition.lng) {\n // eslint-disable-next-line no-undef\n const geocoder = new google.maps.Geocoder();\n try {\n geocoder\n .geocode({ location: this.currentPosition })\n .then((response) => {\n if (response.results[0]) {\n var place = response.results[0];\n this.input.value = place.formatted_address;\n if (!place.geometry) {\n // User enter a not available place or there is an error with api call\n // Show error\n\n this.endLoading(this.sidebar);\n return;\n }\n const addressComponent = {\n lat: place.geometry.location.lat(),\n long: place.geometry.location.lng(),\n cap: this.getAddressPart(place.address_components, 'cap'),\n city: this.getAddressPart(place.address_components, 'city'),\n state: this.getAddressPart(place.address_components, 'administrativeAreaLevel2'),\n address: this.getAddressPart(place.address_components, 'address'),\n civic: this.getAddressPart(place.address_components, 'civic'),\n administrativeAreaLevel3: this.getAddressPart(place.address_components, 'administrativeAreaLevel3'),\n isGeneric: this.getAddressGeneric(place.address_components) ? 1 : 0\n };\n\n this.save(addressComponent);\n }\n this.endLoading(this.sidebar);\n })\n .catch((e) => {\n console.error('Geocoder failed due to: ' + e);\n this.endLoading(this.sidebar);\n });\n } catch (error) {\n this.endLoading(this.sidebar);\n }\n }\n }\n\n async getClientLocation() {\n let clientLocation;\n /**\n * @type {Position} position\n */\n\n var promiseArray = [];\n var position = undefined;\n promiseArray.push(\n new Promise((resolve, reject) => {\n const wait = setTimeout(() => {\n clearTimeout(wait);\n reject('Location has timed out');\n }, 10000);\n })\n );\n\n promiseArray.push(navigatorGeolocation());\n position = await Promise.race(promiseArray)\n .then((pos) => {\n return pos;\n })\n .catch((e) => console.info('navigator geolocation error: ', e));\n\n if (position && !isNaN(position.coords.latitude) && !isNaN(position.coords.longitude)) clientLocation = { lat: position.coords.latitude, lng: position.coords.longitude };\n /* else {\n let woosLocation = await geolocation(this.$options.wmkey).catch((e) => console.error('Woosmap error: ', e));\n if (woosLocation && woosLocation.success) clientLocation = { lat: woosLocation.latitude, lng: woosLocation.longitude };\n }\n if (this.currentPosition && this.currentPosition.lat === clientLocation.lat && this.currentPosition.lng === clientLocation.lng) return 'stop'; */\n this.currentPosition = /** @type {google.maps.LatLngLiteral} */ (clientLocation);\n }\n\n clear() {\n this.cap = null;\n this.address = null;\n this.civic = null;\n this.lat = null;\n this.long = null;\n this.city = null;\n }\n\n save({ cap, city, address, state, civic, lat, long, administrativeAreaLevel3, isGeneric }) {\n if (cap) {\n this.cap = cap;\n this.inputValue = this.input.value;\n this.input.value = this.inputValue + ' ,' + cap;\n }\n if (city) this.city = city;\n if (address) this.address = address;\n if (state) this.stateCode = state;\n if (civic) this.civic = civic;\n if (lat) this.lat = lat;\n if (long) this.long = long;\n if (administrativeAreaLevel3) {\n this.administrativeAreaLevel3 = administrativeAreaLevel3;\n }\n\n this.doSearch(this.cap, this.city, this.stateCode, this.lat, this.long, this.address, this.civic, this.administrativeAreaLevel3, isGeneric);\n this.placeRecap.innerHTML = [this.address, this.civic, this.city, this.cap]\n .filter(function(val) {\n return val;\n })\n .join(', ');\n }\n\n async doSearch(cap, city, state, lat, long, address, streetNumber, administrativeAreaLevel3, isGeneric) {\n this.loading(this.sidebar);\n const { data } = await get(this.$options.url, {\n params: { cap, city, state, lat, long, address, streetNumber, administrativeAreaLevel3, isGeneric, timeslotEnabled: this.timeslotEnabled }\n });\n this.endLoading(this.sidebar);\n const { services, capList, cityList, selectLabel, selectPlaceholder, warningCityCap, bannerOptions, errorMessage } = data;\n let isTherePickupInStore = false;\n let isApp = this.isMobileApp;\n if (services && services.length > 0) {\n isTherePickupInStore = services.find((service) => service.shippingMethodId == 'pickup_in_store');\n if (this.timeslotEnabled) {\n this.container.innerHTML = servicesTemplate({ services, bannerOptions, isTherePickupInStore, isApp });\n } else {\n this.container.innerHTML = servicesTemplateNoTimeslot({ services, bannerOptions, isTherePickupInStore, isApp });\n }\n this.pushDeliveryPartnersToDataLayer();\n } else if (capList && capList.length > 0) {\n if (this.timeslotEnabled) {\n this.container.innerHTML = servicesTemplate({ capList, selectLabel, selectPlaceholder, warningCityCap, bannerOptions, isTherePickupInStore, isApp });\n } else {\n this.container.innerHTML = servicesTemplateNoTimeslot({ capList, selectLabel, selectPlaceholder, warningCityCap, bannerOptions, isTherePickupInStore, isApp });\n }\n } else if (cityList && cityList.length > 0) {\n if (this.timeslotEnabled) {\n this.container.innerHTML = servicesTemplate({ cityList, selectLabel, selectPlaceholder, warningCityCap, bannerOptions, isTherePickupInStore, isApp });\n } else {\n this.container.innerHTML = servicesTemplateNoTimeslot({ cityList, selectLabel, selectPlaceholder, warningCityCap, bannerOptions, isTherePickupInStore, isApp });\n }\n } else {\n if (this.timeslotEnabled) {\n this.container.innerHTML = servicesTemplate({ msg: errorMessage, isTherePickupInStore, isApp });\n } else {\n this.container.innerHTML = servicesTemplateNoTimeslot({ msg: errorMessage, isTherePickupInStore, isApp });\n }\n }\n this.btnSubmit.setAttribute('disabled', true);\n this.container.classList.remove('hidden');\n this.partnerTargetForApp();\n }\n\n getAddressPart(address, part) {\n let addressParts = {\n cap: ['postal_code'],\n city: ['locality', 'administrative_area_level_3'],\n address: ['route'],\n civic: ['street_number'],\n administrativeAreaLevel2: ['administrative_area_level_2'],\n administrativeAreaLevel3: ['administrative_area_level_3']\n };\n\n let typesToSearch = addressParts[part] || [];\n let addressPart = address.find((addressComponent) => {\n let typesIntersection = addressComponent.types.filter((type) => {\n return typesToSearch.indexOf(type) !== -1;\n });\n return typesIntersection.length > 0;\n });\n\n return addressPart ? addressPart.short_name : null;\n }\n\n getAddressGeneric(address) {\n return address[0] && (address[0].types.includes('postal_code') || address[0].types.includes('locality'));\n }\n\n async updateSelection({ shippingSelected, redirect, timeslotEnabledForApp }) {\n if (this.addToCartPayload) {\n await this.addToCart();\n }\n // window.history.pushState({}, document.title, window.location.pathname);\n\n //window.location.reload();\n if (!this.reorder) {\n var url = '';\n\n if (window.location.hash.indexOf('size') > -1) {\n url = window.location.href.replace(window.location.hash, '');\n } else {\n url = window.location.href.replace('showDeliveryBar=true', '');\n }\n if (this.addToCartPayload && this.addToCartPayload.res && this.addToCartPayload.res.data && this.addToCartPayload.res.data.promobundle) {\n url = url + (window.location.search ? '&' : '?') + 'promobundle=' + this.addToCartPayload.res.config.data.pid;\n }\n if (this.isMobileApp && timeslotEnabledForApp) {\n let newParamsForRedirectBuildApp = 'appTimeslotEnabled=true';\n if (url.indexOf('appTimeslotEnabled=true') === -1) {\n if (url.indexOf('?') !== -1) {\n url = url + '&' + newParamsForRedirectBuildApp;\n } else {\n url = url + '?' + newParamsForRedirectBuildApp;\n }\n }\n }\n if (window.location.href.search('/cart') === -1) {\n window.location.href = url;\n }\n }\n if (redirect) {\n window.location.href = redirect;\n } else if (document.querySelector('.store-selection-bar') && document.querySelector('.js-store-selector-redirect')) {\n window.location.href = document.querySelector('.store-selection-bar').dataset.redirect;\n }\n this.remove();\n }\n\n async addToCart() {\n const addToCartPaylodFromAxios = this.addToCartPayload && this.addToCartPayload.res ? this.addToCartPayload.res.config : null;\n // /addToCartPaylodFromAxios.data.skipnotifications = true;\n if (addToCartPaylodFromAxios) {\n const { data } = await request(addToCartPaylodFromAxios);\n if (data && data.quantityTotal) {\n appPostMessage({ qtyInCart: data.quantityTotal });\n }\n if (this.reorder) {\n this.EMIT(this.CUSTOM_MESSAGES.REORDER_EVENTS.updated, data);\n }\n }\n }\n\n handleAddToCart(msg) {\n this.add();\n this.addToCartPayload = msg;\n }\n\n handleReorder(msg) {\n this.add();\n this.addToCartPayload = msg;\n this.reorder = true;\n }\n\n sendAddToCartPayload() {\n this.EMIT(this.CUSTOM_MESSAGES.TIMESLOT.CART_PAYLOAD, { cartPayloadData: this.addToCartPayload ? this.addToCartPayload : null, reorder: this.reorder });\n }\n\n resetLayer() {\n document.querySelector('body').classList.remove('js-store-selector-redirect');\n setTimeout(() => {\n this.introbox.classList.remove('hidden');\n document.querySelector('.storeSelectio-sidebar').classList.add('initial-state');\n this.container.classList.add('hidden');\n this.input.value = '';\n document.body.className = document.body.className.replace(/\\bopenStoresList.*?\\b/g, '');\n if (this.$options.moveInfostrip && document.querySelector(this.SELECTORS.infoStrip)) {\n window.scrollTo(0, 0);\n document.querySelector(this.SELECTORS.mainHeader).classList.remove('moveinfostrip');\n document.querySelector(this.SELECTORS.mainHeader).classList.add('noanimation');\n document\n .querySelector(this.SELECTORS.mainHeader)\n .insertBefore(\n document.querySelector(this.SELECTORS.infoStrip),\n document.querySelector(this.SELECTORS.pushApp)\n ? document.querySelector(this.SELECTORS.pushApp).nextSibling\n : document.querySelector(this.SELECTORS.mainHeader).firstChild\n );\n }\n document.body.className = document.body.className.replace(/\\bopenExtraLayer.*?\\b/g, '');\n document.body.className = document.body.className.replace(/\\bopenStoresList.*?\\b/g, '');\n document.body.className = document.body.className.replace(/\\bopenSingleStoreDeliveryList.*?\\b/g, '');\n }, 400);\n }\n\n pushDeliveryPartnersToDataLayer() {\n if (document.querySelector('.store-service-card.partners') && document.querySelector('.partner-link-container')) {\n let buttons = document.querySelectorAll('.partner-link');\n buttons.forEach((button) => {\n button.addEventListener('click', function() {\n let partner = button.className.replace('partner-link', '');\n window.dataLayer.push({\n event: 'select_service',\n service_name: 'partner_delivery',\n delivery_type: partner\n });\n });\n });\n }\n }\n}\n"],"sourceRoot":""}