{"version":3,"sources":["webpack:///./src/client/default/js/components/toasterComponent.js","webpack:///./src/client/default/js/components/timeslotNotificationComponent.js","webpack:///./src/client/default/js/base/baseComponent.js","webpack:///./node_modules/js-cookie/src/js.cookie.js"],"names":["ToasterComponent","element","handleClose","$options","clickCloseEverywhere","document","addEventListener","e","isapp","appPostMessage","action","$el","contains","target","classList","add","CLASSES","hide","handleAnimationProgressBar","close","progressBar","this","querySelector","SELECTORS","console","log","$close","baseComponent","TimeslotNotificationComponent","timeslotNotification","parseInt","pageType","init","CUSTOM_MESSAGES","TIMESLOT","EXPIRY_NOTIFICATION","showNotification","closeBtn","Number","timeslotMinutes","timeslotSeconds","Cookies","get","$on","setExpiryCookie","pushToDatalayer","setTimeout","remove","expiryCookie","Date","getTime","set","expires","eventType","pageTemplate","window","dataLayer","push","event","promo_title","promo_template","promo_type","BaseComponent","_componentElement","setAttribute","_checkMessages","compOptions","options","dataset","Object","keys","filter","entry","includes","forEach","optionValue","cleanEntry","cleanOptionKey","JSON","parse","replace","convertType","deepFreeze","getAttribute","events","cb","elements","Bean","on","stopPropagation","one","off","fire","container","message","_loading","EMIT","LOADER_EVENTS","show","body","error","icon","option","optionReturn","key","str","charAt","toLocaleLowerCase","slice","BaseGiaComponent","factory","module","exports","OldCookies","api","noConflict","extend","i","result","arguments","length","attributes","decode","s","decodeURIComponent","converter","value","path","defaults","toUTCString","stringify","test","write","encodeURIComponent","String","escape","stringifiedAttributes","attributeName","split","cookie","json","jar","cookies","parts","join","name","read","getJSON","withConverter"],"mappings":";qqBAGqBA,E,gCAkBnB,WAAYC,GAAS,0BACnB,cAAMA,IACDC,cACD,EAAKC,SAASC,sBAChBC,SAASC,iBAAiB,SAAS,SAACC,GAC9B,EAAKJ,SAASK,MAChBC,YAAe,CAAEC,OAAQ,4BAEpB,EAAKC,IAAIC,SAASL,EAAEM,UAAWN,EAAEM,OAAOC,UAAUF,SAAS,sBAC9D,EAAKD,IAAIG,UAAUC,IAAI,EAAKC,QAAQC,S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gB,GAAeC,MAAM,KAAK,KAGrE,OAAQrI,SAASsI,OAASnC,EAAM,IAAMsB,EAAQU,GAG/C,SAAS9F,EAAK8D,EAAKoC,GAClB,GAAwB,oBAAbvI,SAAX,CAUA,IANA,IAAIwI,EAAM,GAGNC,EAAUzI,SAASsI,OAAStI,SAASsI,OAAOD,MAAM,MAAQ,GAC1DrB,EAAI,EAEDA,EAAIyB,EAAQtB,OAAQH,IAAK,CAC/B,IAAI0B,EAAQD,EAAQzB,GAAGqB,MAAM,KACzBC,EAASI,EAAMnC,MAAM,GAAGoC,KAAK,KAE5BJ,GAA6B,MAArBD,EAAOjC,OAAO,KAC1BiC,EAASA,EAAO/B,MAAM,GAAI,IAG3B,IACC,IAAIqC,EAAOvB,EAAOqB,EAAM,IAIxB,GAHAJ,GAAUd,EAAUqB,MAAQrB,GAAWc,EAAQM,IAC9CvB,EAAOiB,GAEJC,EACH,IACCD,EAAS7D,KAAKC,MAAM4D,GACnB,MAAOpI,IAKV,GAFAsI,EAAII,GAAQN,EAERnC,IAAQyC,EACX,MAEA,MAAO1I,KAGV,OAAOiG,EAAMqC,EAAIrC,GAAOqC,GAoBzB,OAjBA3B,EAAI/D,IAAMA,EACV+D,EAAIxE,IAAM,SAAU8D,GACnB,OAAO9D,EAAI8D,GAAK,IAEjBU,EAAIiC,QAAU,SAAU3C,GACvB,OAAO9D,EAAI8D,GAAK,IAEjBU,EAAInE,OAAS,SAAUyD,EAAKiB,GAC3BtE,EAAIqD,EAAK,GAAIY,EAAOK,EAAY,CAC/BrE,SAAU,MAIZ8D,EAAIc,SAAW,GAEfd,EAAIkC,cAAgBpH,EAEbkF,EAGDlF,EAAK","file":"js/component-timeslotNotificationComponent-js.chunks.js","sourcesContent":["import baseComponent from '../base/baseComponent';\nimport { appPostMessage } from '../utilities/postMessage';\n\nexport default class ToasterComponent extends baseComponent {\n get SELECTORS() {\n return {\n close: '.close-btn',\n progressBar: '.timeslot-progress-bar'\n };\n }\n\n get CLASSES() {\n return {\n hide: 'd-none'\n };\n }\n\n get $close() {\n return this.$el.querySelector(this.SELECTORS.close);\n }\n\n constructor(element) {\n super(element);\n this.handleClose();\n if (this.$options.clickCloseEverywhere) {\n document.addEventListener('click', (e) => {\n if (this.$options.isapp) {\n appPostMessage({ action: 'PRODUCT_NA_FLYERS_CLOSE' });\n } else {\n if (!this.$el.contains(e.target) || e.target.classList.contains('toaster-close-btn')) {\n this.$el.classList.add(this.CLASSES.hide);\n }\n }\n });\n }\n this.handleAnimationProgressBar();\n }\n\n handleAnimationProgressBar() {\n const progressBar = this.$el.querySelector(this.SELECTORS.progressBar);\n if (progressBar) {\n progressBar.addEventListener('animationend', (e) => {\n console.log('animazione finita!!');\n this.$el.classList.add(this.CLASSES.hide);\n });\n }\n }\n\n handleClose() {\n this.$close.addEventListener('click', (e) => {\n this.$el.classList.add(this.CLASSES.hide);\n });\n }\n}\n","import ToasterComponent from './toasterComponent';\nimport Cookies from 'js-cookie';\nimport { appPostMessage } from '../utilities/postMessage';\n\nexport default class TimeslotNotificationComponent extends ToasterComponent {\n get Messages() {\n return {\n [this.CUSTOM_MESSAGES.TIMESLOT.EXPIRY_NOTIFICATION]: this.showNotification\n };\n }\n get SELECTORS() {\n return {\n closeBtn: '.close-btn',\n progressBar: '.timeslot-progress-bar'\n };\n }\n get CLASSES() {\n return {\n hide: 'd-none'\n };\n }\n\n constructor(element) {\n super(element);\n this.timeslotNotification = parseInt(this.$options.timeslotNotification, 10);\n this.pageType = this.$options.pageType;\n this.isapp = this.$options.isapp;\n this.init();\n }\n\n init() {\n if (this.pageType !== 'checkout') {\n const time = Number(`${this.$options.timeslotMinutes}.${this.$options.timeslotSeconds}`);\n if (time <= this.timeslotNotification && !Cookies.get('timeslot-expiry-notification')) {\n this.showNotification();\n }\n }\n }\n\n handleClose() {\n const closeBtn = this.$el.querySelector(this.SELECTORS.closeBtn);\n if (closeBtn) {\n this.$on(\n 'click',\n () => {\n this.$el.classList.add(this.CLASSES.hide);\n this.setExpiryCookie();\n this.pushToDatalayer('promo_click', 'banner_consegna');\n },\n closeBtn\n );\n }\n }\n\n showNotification() {\n if (!Cookies.get('timeslot-expiry-notification') && this.pageType !== 'checkout') {\n if (this.isapp) {\n appPostMessage({ action: 'OPEN_EXPIRY_NOTIFICATION' });\n setTimeout(() => {\n this.setExpiryCookie();\n }, 10500);\n } else {\n this.$el.classList.remove(this.CLASSES.hide);\n this.pushToDatalayer('promo_impression', 'banner_consegna');\n }\n }\n }\n\n handleAnimationProgressBar() {\n const progressBar = this.$el.querySelector(this.SELECTORS.progressBar);\n if (progressBar) {\n progressBar.addEventListener('animationend', (e) => {\n this.$el.classList.add(this.CLASSES.hide);\n this.setExpiryCookie();\n });\n }\n }\n\n setExpiryCookie() {\n let expiryCookie = new Date(new Date().getTime() + this.timeslotNotification * 60 * 1000);\n Cookies.set('timeslot-expiry-notification', true, { expires: expiryCookie });\n }\n\n pushToDatalayer(eventType, pageTemplate) {\n if (!window.dataLayer) return;\n window.dataLayer.push({\n event: eventType,\n promo_title: 'Scadenza slot consegna',\n promo_template: pageTemplate,\n promo_type: 'popup'\n });\n }\n}\n","/* eslint-disable new-cap */\n/* eslint-disable valid-jsdoc */\n/* eslint-disable no-underscore-dangle */\n\nimport Bean from 'bean';\nimport deepFreeze from '../utilities/freeze';\nimport BaseGiaComponent from './baseGiaComponent';\n\nexport default class BaseComponent extends BaseGiaComponent {\n /**\n * @returns {HTMLElement}\n */\n get $el() {\n return /** @type {HTMLElement} */ (this._componentElement);\n }\n\n get $options() {\n const compOptions = {};\n const options = { ...this.$el.dataset };\n const optionsEntires = Object.keys(options).filter((entry) => entry.includes('option'));\n optionsEntires.forEach((entry) => {\n const cleanEntry = BaseComponent.cleanOptionKey(entry);\n let optionValue;\n if (options[entry].includes('{') && options[entry].includes('}')) {\n optionValue = JSON.parse(options[entry].replace(/'/g, '\"'));\n } else {\n optionValue = BaseComponent.convertType(options[entry]);\n }\n compOptions[cleanEntry] = optionValue;\n });\n return deepFreeze(compOptions);\n }\n\n get COMPONENT_NAME() {\n return this.$el.getAttribute('data-component');\n }\n\n /**\n *\n * constructor\n *\n * @param {Element} element\n */\n constructor(element) {\n super(element);\n this._componentElement = element;\n this._componentElement.setAttribute('data-component-init', 'true');\n this._checkMessages();\n }\n\n static convertType(option) {\n let optionReturn;\n switch (option) {\n case 'false':\n optionReturn = false;\n break;\n case 'true':\n optionReturn = true;\n break;\n case 'null':\n optionReturn = null;\n break;\n default:\n optionReturn = option;\n break;\n }\n\n return optionReturn;\n }\n\n static cleanOptionKey(key) {\n const str = key.replace('option', '');\n return `${str.charAt(0).toLocaleLowerCase()}${str.slice(1)}`;\n }\n\n /**\n *\n * $on\n *\n * @param {String} events\n * @param {Function} cb\n * @param {Element} [element = this.$el]\n * @param {Array|String|Element} [elements = null]\n */\n $on(events, cb, element = this.$el, elements = null) {\n if (!element || !events || !cb) return;\n if (!elements) {\n Bean.on(element, events, (e) => {\n if (e) e.stopPropagation();\n cb(e);\n });\n } else {\n Bean.on(element, events, elements, (e) => {\n if (e) e.stopPropagation();\n cb(e);\n });\n }\n }\n\n /**\n *\n * $one\n *\n * @param {String} events\n * @param {Function} cb\n * @param {Element} [element = this.$el]\n */\n $one(events, cb, element = this.$el) {\n Bean.one(element, events, cb);\n }\n\n /**\n *\n * $off\n *\n * @param {String} events\n * @param {Element} [element = this.$el]\n */\n $off(events, element = this.$el) {\n Bean.off(element, events);\n }\n\n /**\n *\n * $fire\n *\n * @param {String} events\n * @param {Element} [element = this.$el]\n */\n $fire(events, element = this.$el) {\n Bean.fire(element, events);\n }\n\n /**\n *\n * Activate loader\n *\n * @param {HTMLElement} [container]\n * @param {String} [message]\n */\n loading(container, message) {\n this._loading = true;\n this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.show, {\n container: container || document.body,\n message: message ?? null\n });\n }\n\n /**\n *\n * Deactivate loader\n *\n * @param {HTMLElement} [container]\n * @param {String} [message]\n * @param {Boolean} [error=false]\n * @param {String} [icon]\n */\n endLoading(container, message, error = false, icon) {\n this._loading = false;\n setTimeout(() => {\n if (!this._loading) {\n this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.hide, {\n container: container || document.body,\n message,\n error,\n icon\n });\n }\n }, 400);\n }\n}\n","/*!\n * JavaScript Cookie v2.2.1\n * https://github.com/js-cookie/js-cookie\n *\n * Copyright 2006, 2015 Klaus Hartl & Fagner Brack\n * Released under the MIT license\n */\n;(function (factory) {\n\tvar registeredInModuleLoader;\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t\tregisteredInModuleLoader = true;\n\t}\n\tif (!registeredInModuleLoader) {\n\t\tvar OldCookies = window.Cookies;\n\t\tvar api = window.Cookies = factory();\n\t\tapi.noConflict = function () {\n\t\t\twindow.Cookies = OldCookies;\n\t\t\treturn api;\n\t\t};\n\t}\n}(function () {\n\tfunction extend () {\n\t\tvar i = 0;\n\t\tvar result = {};\n\t\tfor (; i < arguments.length; i++) {\n\t\t\tvar attributes = arguments[ i ];\n\t\t\tfor (var key in attributes) {\n\t\t\t\tresult[key] = attributes[key];\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\tfunction decode (s) {\n\t\treturn s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);\n\t}\n\n\tfunction init (converter) {\n\t\tfunction api() {}\n\n\t\tfunction set (key, value, attributes) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tattributes = extend({\n\t\t\t\tpath: '/'\n\t\t\t}, api.defaults, attributes);\n\n\t\t\tif (typeof attributes.expires === 'number') {\n\t\t\t\tattributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);\n\t\t\t}\n\n\t\t\t// We're using \"expires\" because \"max-age\" is not supported by IE\n\t\t\tattributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';\n\n\t\t\ttry {\n\t\t\t\tvar result = JSON.stringify(value);\n\t\t\t\tif (/^[\\{\\[]/.test(result)) {\n\t\t\t\t\tvalue = result;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\n\t\t\tvalue = converter.write ?\n\t\t\t\tconverter.write(value, key) :\n\t\t\t\tencodeURIComponent(String(value))\n\t\t\t\t\t.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);\n\n\t\t\tkey = encodeURIComponent(String(key))\n\t\t\t\t.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)\n\t\t\t\t.replace(/[\\(\\)]/g, escape);\n\n\t\t\tvar stringifiedAttributes = '';\n\t\t\tfor (var attributeName in attributes) {\n\t\t\t\tif (!attributes[attributeName]) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tstringifiedAttributes += '; ' + attributeName;\n\t\t\t\tif (attributes[attributeName] === true) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Considers RFC 6265 section 5.2:\n\t\t\t\t// ...\n\t\t\t\t// 3. If the remaining unparsed-attributes contains a %x3B (\";\")\n\t\t\t\t// character:\n\t\t\t\t// Consume the characters of the unparsed-attributes up to,\n\t\t\t\t// not including, the first %x3B (\";\") character.\n\t\t\t\t// ...\n\t\t\t\tstringifiedAttributes += '=' + attributes[attributeName].split(';')[0];\n\t\t\t}\n\n\t\t\treturn (document.cookie = key + '=' + value + stringifiedAttributes);\n\t\t}\n\n\t\tfunction get (key, json) {\n\t\t\tif (typeof document === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar jar = {};\n\t\t\t// To prevent the for loop in the first place assign an empty array\n\t\t\t// in case there are no cookies at all.\n\t\t\tvar cookies = document.cookie ? document.cookie.split('; ') : [];\n\t\t\tvar i = 0;\n\n\t\t\tfor (; i < cookies.length; i++) {\n\t\t\t\tvar parts = cookies[i].split('=');\n\t\t\t\tvar cookie = parts.slice(1).join('=');\n\n\t\t\t\tif (!json && cookie.charAt(0) === '\"') {\n\t\t\t\t\tcookie = cookie.slice(1, -1);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tvar name = decode(parts[0]);\n\t\t\t\t\tcookie = (converter.read || converter)(cookie, name) ||\n\t\t\t\t\t\tdecode(cookie);\n\n\t\t\t\t\tif (json) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tcookie = JSON.parse(cookie);\n\t\t\t\t\t\t} catch (e) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tjar[name] = cookie;\n\n\t\t\t\t\tif (key === name) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {}\n\t\t\t}\n\n\t\t\treturn key ? jar[key] : jar;\n\t\t}\n\n\t\tapi.set = set;\n\t\tapi.get = function (key) {\n\t\t\treturn get(key, false /* read as raw */);\n\t\t};\n\t\tapi.getJSON = function (key) {\n\t\t\treturn get(key, true /* read as json */);\n\t\t};\n\t\tapi.remove = function (key, attributes) {\n\t\t\tset(key, '', extend(attributes, {\n\t\t\t\texpires: -1\n\t\t\t}));\n\t\t};\n\n\t\tapi.defaults = {};\n\n\t\tapi.withConverter = init;\n\n\t\treturn api;\n\t}\n\n\treturn init(function () {});\n}));\n"],"sourceRoot":""}