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AE;IAC/BA,OAAO,CAAC,CAAC;EACb,CAAC,MAAM,IAAIN,OAAA,CAAOM,OAAO,MAAK,QAAQ,EAAE;IACpCC,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,OAAO,CAAC,UAAUC,GAAG,EAAE;MACxC,IAAI,OAAOJ,OAAO,CAACI,GAAG,CAAC,KAAK,UAAU,EAAE;QACpCJ,OAAO,CAACI,GAAG,CAAC,CAAC,CAAC;MAClB;IACJ,CAAC,CAAC;EACN;AACJ,CAAC;;;;;;UCZD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;;ACtBa;;AAEb,IAAIC,cAAc,GAAGvD,mBAAO,CAAC,kFAAQ,CAAC;AAEtCrB,CAAC,CAAC,YAAY;EACV4E,cAAc,CAACvD,mBAAO,CAAC,gHAAuB,CAAC,CAAC;AACpD,CAAC,CAAC,C","sources":["webpack://hello-fioul-sfcc/./cartridges/app_storefront_hf/cartridge/client/default/js/components/notifications.js","webpack://hello-fioul-sfcc/./cartridges/app_storefront_hf/cartridge/client/default/js/contactUs/contactUs.js","webpack://hello-fioul-sfcc/./cartridges/app_storefront_hf/cartridge/client/default/js/util.js","webpack://hello-fioul-sfcc/webpack/bootstrap","webpack://hello-fioul-sfcc/./cartridges/app_storefront_hf/cartridge/client/default/js/contactUs.js"],"sourcesContent":["'use strict';\n\nconst selectors = {\n NOTIFICATION: 'js-alert',\n SUCCESS: 'alert-success',\n INFO: 'alert-info',\n ERROR: 'alert-danger',\n WARNING: 'alert-warning'\n};\n\nconst cache = {\n $root: $('html'),\n $body: $('body'),\n $selector: $('.js-alert-wrapper')\n};\n\n/**\n * Creates notification message with an alert component.\n * @param {string} message - data message returned from the server's ajax call\n * @param {string} type - notification type which defines css class (default: '')\n * @param {Object} container - custom container to append notification (default: '.js-alert-wrapper')\n * @param {string} classCustom - css classname for custom styling (optional, default: '')\n * @param {function} callback - (optional)\n */\n\nmodule.exports = {\n create: function (message, type, container, classCustom, callback) {\n var notification = '';\n var notificationClass = selectors[type] || '';\n var selector = cache.$selector;\n if (container) {\n selector = container;\n }\n var classExtra = classCustom || '';\n\n switch (type) {\n case 'success':\n notificationClass = selectors.SUCCESS;\n break;\n case 'info':\n notificationClass = selectors.INFO;\n break;\n case 'error':\n notificationClass = selectors.ERROR;\n break;\n case 'warning':\n notificationClass = selectors.WARNING;\n break;\n default:\n notificationClass = '';\n }\n\n notification =\n '
' +\n message +\n '
';\n\n selector.find('.' + selectors.NOTIFICATION).remove();\n selector.append($(notification));\n\n $(cache.$root, cache.$body).animate({ scrollTop: 0 }, 500);\n\n if (callback) {\n callback();\n }\n }\n};\n","'use strict';\n\nconst notifications = require('../components/notifications');\n\nconst selectors = {\n alertContainer: '.js-alert-wrapper',\n submitButton: '.js-contact-us-submit',\n contactForm: '.js-contact-us',\n captchaError: '.js-recaptcha-error',\n reCaptchaField: '.js-gCaptchaToken-contactus'\n};\n\n/**\n * Make submit button reusable\n * @param {Object} button - button that was clicked for contact us sign-up\n */\nfunction enableSubmitButton(button) {\n setTimeout(function () {\n button.removeAttr('disabled');\n }, 3000);\n};\n\n/**\n * Submits contact us form\n * @param {obj} form Contac us form data\n */\nfunction submitContactUsForm(form) {\n var url = form.attr('action');\n var button = $(selectors.submitButton);\n button.attr('disabled', true);\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: form.serialize(),\n success: function (data) {\n if (data.success) {\n var email = form.find('input[type=email]').val();\n\n $(selectors.contactForm).trigger('reset');\n notifications.create(data.msg, 'success');\n\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n event: 'contact.form',\n form_type: email\n });\n\n } else {\n notifications.create(data.msg, 'error');\n }\n form.find(selectors.reCaptchaField).val('');\n enableSubmitButton(button);\n $.spinner().stop();\n\n },\n error: function (err) {\n notifications.create(err, 'error');\n form.find(selectors.reCaptchaField).val('');\n enableSubmitButton(button);\n $.spinner().stop();\n }\n });\n}\n\nmodule.exports = {\n subscribeContact: function () {\n $(selectors.contactForm).on('submit', function (e) {\n e.preventDefault();\n var form = $(this);\n $.spinner().start();\n // Verify if Google reCaptcha is enabled/loaded\n if (window.grecaptcha) {\n // Google reCaptcha Site key\n var gsiteKey = form.data('gsite-key');\n window.grecaptcha.ready(function () {\n window.grecaptcha\n .execute(gsiteKey, {action: form.data('action')})\n .then(function (token) {\n form.find(selectors.reCaptchaField).val(token);\n submitContactUsForm(form);\n });\n });\n } else {\n submitContactUsForm(form);\n }\n $.spinner().stop();\n });\n }\n};\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","'use strict';\n\nvar processInclude = require('./util');\n\n$(function () {\n processInclude(require('./contactUs/contactUs'));\n});\n"],"names":["selectors","NOTIFICATION","SUCCESS","INFO","ERROR","WARNING","cache","$root","$","$body","$selector","module","exports","create","message","type","container","classCustom","callback","notification","notificationClass","selector","classExtra","find","remove","append","animate","scrollTop","notifications","require","alertContainer","submitButton","contactForm","captchaError","reCaptchaField","enableSubmitButton","button","setTimeout","removeAttr","submitContactUsForm","form","url","attr","ajax","dataType","data","serialize","success","email","val","trigger","msg","window","dataLayer","push","event","form_type","spinner","stop","error","err","subscribeContact","on","e","preventDefault","start","grecaptcha","gsiteKey","ready","execute","action","then","token","_typeof","o","Symbol","iterator","constructor","prototype","include","Object","keys","forEach","key","processInclude"],"sourceRoot":""}