{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_basicfit/cartridge/client/default/js/countdownLocalized.js"],"names":["CountdownLocalized","countdown","$counter","$","$counterwrap","length","endDate","attr","countDownDate","Date","getTime","x","setInterval","now","distance","$daysElement","$daysLabelElement","days","Math","floor","hours","minutes","seconds","remove","text","clearInterval","addClass","handleCountdownLocalizedLinkClick","on","e","hrefUrl","currentTarget","data","isUrlToCheckout","hasClass","window","dataLayer","push","ecommerce","event","step","component_name","location","href","init","document","ready"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA,KAAM,CAAAA,kBAAkB,CAAG,CAAC,IAAM,CAC9B,KAAM,CAAAC,SAAS,CAAGA,CAAA,GAAM,CACpB,KAAM,CAAAC,QAAQ,CAAGC,CAAC,CAAC,UAAU,CAAC,CAC9B,KAAM,CAAAC,YAAY,CAAGD,CAAC,CAAC,cAAc,CAAC,CAEtC,GAAID,QAAQ,CAACG,MAAM,CAAE,CACjB;AACA,KAAM,CAAAC,OAAO,CAAGJ,QAAQ,CAACK,IAAI,CAAC,WAAW,CAAC,CAE1C;AACA,KAAM,CAAAC,aAAa,CAAG,GAAI,C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C,CACL,CAAC,EAAE,CAAC,CAEW,gEAAC,IAAM,CAClBxB,CAAC,CAAC0C,QAAQ,CAAC,CAACC,KAAK,CAAC9C,kBAAkB,CAAC4C,IAAI,CAAC,CAC9C,CAAC,EAAE,CAAC,E","file":"default/js/countdownLocalized.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/app_custom_basicfit/cartridge/client/default/js/countdownLocalized.js\");\n","const CountdownLocalized = (() => {\n const countdown = () => {\n const $counter = $('#counter');\n const $counterwrap = $('#counterwrap');\n\n if ($counter.length) {\n // Get the date from Page Designer\n const endDate = $counter.attr('data-date');\n\n // Set the date we're counting down to\n const countDownDate = new Date(endDate).getTime();\n\n // Update the count down every 1 second\n const x = setInterval(() => {\n // Get today's date and time\n const now = new Date().getTime();\n\n // Find the distance between now and the count down date\n const distance = countDownDate - now;\n\n // Get counter days HTML element\n const $daysElement = $('.js-counter-days-value');\n const $daysLabelElement = $('.js-counter-days-label');\n\n // Time calculations for days, hours, minutes and seconds\n const days = $daysElement.length ? Math.floor(distance / (1000 * 60 * 60 * 24)) : 0;\n const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));\n const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));\n const seconds = Math.floor((distance % (1000 * 60)) / 1000);\n\n if (days <= 0 && $daysElement.length && $daysLabelElement.length) {\n $daysElement.remove();\n $daysLabelElement.remove();\n }\n\n if ($daysElement.length && days) {\n $daysElement.text(days);\n }\n $('.js-counter-hours-value').text(hours);\n $('.js-counter-mins-value').text(minutes);\n $('.js-counter-secs-value').text(seconds);\n\n // If the count down is over, write some text\n if (distance < 0) {\n clearInterval(x);\n $counterwrap.addClass('d-none');\n }\n }, 10);\n }\n };\n\n /**\n * @description Function for handling black friday banner CTA click\n */\n function handleCountdownLocalizedLinkClick() {\n $('.js-countdownLocalized__link').on('click', function (e) {\n const hrefUrl = $(e.currentTarget).data('href-url');\n const isUrlToCheckout = $(e.currentTarget).hasClass('js-countdownLocalized__link-checkout');\n if (isUrlToCheckout) {\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n ecommerce: null\n });\n window.dataLayer.push({\n event: 'precheckout',\n step: '1',\n component_name: 'become a member',\n });\n }\n window.location.href = hrefUrl;\n });\n }\n\n return {\n init() {\n countdown();\n handleCountdownLocalizedLinkClick();\n },\n };\n})();\n\nexport default (() => {\n $(document).ready(CountdownLocalized.init);\n})();\n"],"sourceRoot":""}