{"version":3,"file":"default/js/addnewslettermodal.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/org_arlo/cartridge/client/default/js/addnewslettermodal.js","webpack:///./cartridges/org_arlo/cartridge/client/default/js/components/Modal.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/org_arlo/cartridge/client/default/js/addnewslettermodal.js\");\n","/**\n * Arlo SFCC Static\n * New bundles page entry point.\n */\n\n\nimport Modal from './components/Modal';\n\n /**\n * Define the scroll event handler function\n */\nfunction scrollHandler() {\n var scrollPosition = window.scrollY;\n var scrollCoordinates = window.promoOverlayPosition;\n if (scrollPosition >= scrollCoordinates) {\n // Trigger the email signup pop-up here\n new Modal('promo-overlay-content'); // eslint-disable-line no-new\n // Remove the scroll event listener after the modal is triggered\n window.removeEventListener('scroll', scrollHandler);\n }\n}\n\n// Attach the scroll event listener\nwindow.addEventListener('scroll', scrollHandler);\n\n","/**\n * Component: Modal\n */\n\nexport default class Modal {\n constructor(id, config) {\n this.ns = 'modal';\n this.$self = jQuery('#' + id + '.' + this.ns);\n this.options = this.$self.data('options');\n this.$overlay = this.$self.find('.' + this.ns + '__overlay');\n this.$closeBtn = this.$self.find('.' + this.ns + '__close');\n\n this.closeElements = [];\n this.closeElements.push(this.$overlay); // Close the modal if overlay is clicked\n this.closeElements.push(this.$closeBtn);\n\n this.openModal = this.openModal.bind(this);\n this.closeModal = this.closeModal.bind(this);\n\n if (this.options) {\n // Bind click event to trigger modal selector\n this.$modalOpenElement = jQuery(this.options.triggerModalOpenSelector);\n // Set autoOpen if exists in options object\n this.autoOpen = this.options.autoOpen;\n this.autoOpenFlag = this.options.autoOpenFlag;\n }\n\n if (this.$self) {\n this.init(config);\n }\n }\n\n init(config) {\n this.setOpenHandlers();\n this.setCloseHandlers();\n this.setCloseButtonState(this.$closeBtn, config);\n this.setOptionalCallbacks(config);\n\n if (this.autoOpen && this.autoOpenFlag) {\n this.openOnInit();\n }\n\n $('body').on('click', '#headache-subscribe', function (e) {\n e.preventDefault();\n this.openModal();\n });\n }\n\n openOnInit() {\n // If localStorage key has NOT been set yet, open modal.\n if (!window.localStorage.getItem(this.autoOpenFlag)) {\n this.openModal();\n }\n }\n\n setOpenHandlers() {\n if (this.$modalOpenElement) {\n this.$modalOpenElement.on('click', () => {\n this.openModal();\n });\n }\n }\n\n openModal() {\n $('body').addClass('no-scroll');\n this.$self.addClass(this.ns + '--opened');\n\n if (this.openCallback) {\n this.openCallback();\n }\n }\n\n setCloseHandlers() {\n for (var i = 0; i < this.closeElements.length; i++) {\n var el = this.closeElements[i];\n if (el) {\n $(el).on('click', () => {\n this.closeModal();\n });\n }\n }\n\n $(document).on('keydown', (e) => {\n var key = e.key || e.keyCode;\n if (\n key === 'Escape'\n || key === 'Esc'\n || key === 27\n ) {\n this.closeModal();\n }\n });\n }\n\n closeModal() {\n $('body').removeClass('no-scroll');\n this.$self.removeClass(this.ns + '--opened');\n\n if (this.closeCallback) {\n this.closeCallback();\n }\n\n if (this.autoOpen && this.autoOpenFlag) {\n window.localStorage.setItem(this.autoOpenFlag, true);\n }\n }\n\n setCloseButtonState($closeBtn, config) {\n if (config) {\n this.showCloseButton = config.showCloseButton;\n\n if (this.showCloseButton === true) {\n $closeBtn.show();\n } else {\n $closeBtn.hide();\n }\n }\n }\n\n setOptionalCallbacks(config) {\n if (config) {\n var openCb = config.openCallback;\n var closeCb = config.closeCallback;\n if (typeof openCb === 'function') {\n this.openCallback = openCb;\n }\n\n if (typeof closeCb === 'function') {\n this.closeCallback = closeCb;\n }\n }\n }\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACvBA;AACA;AACA;AAFA;AAKA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAKA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;;;;;A","sourceRoot":""}