1(self["webpackChunkolipop_direct_to_consumer"] = self["webpackChunkolipop_direct_to_consumer"] || []).push([["app"],{ 2
3/***/ "./src/olipop/components/Accordion/oli-accordion.ts": 4/*!**********************************************************!*\ 5 !*** ./src/olipop/components/Accordion/oli-accordion.ts ***! 6 \**********************************************************/ 7/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 8 9"use strict"; 10 11 12Object.defineProperty(exports, "__esModule", ({ 13 value: true 14})); 15exports.accordion = void 0; 16var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 17exports.accordion = (0, picoapp_1.component)(function (node) { 18 var summary = node.querySelector("[data-summary]"); 19 var details = node.querySelector("[data-details]"); 20 var state = { 21 open: node.dataset.open === "true" 22 }; 23 var toggleDetails = function toggleDetails() { 24 state.open = !state.open; 25 if (state.open) { 26 details.style.maxHeight = details.scrollHeight + "px"; 27 } else { 28 details.style.maxHeight = "0px"; 29 } 30 }; 31 summary.addEventListener("click", toggleDetails); 32}); 33 34/***/ }), 35
36/***/ "./src/olipop/components/Barba/Views/constants.ts": 37/*!********************************************************!*\ 38 !*** ./src/olipop/components/Barba/Views/constants.ts ***! 39 \********************************************************/ 40/***/ ((__unused_webpack_module, exports) => { 41 42"use strict"; 43 44 45Object.defineProperty(exports, "__esModule", ({ 46 value: true 47})); 48exports.TRANSITION_PRODUCT_VIEW_AFTER_ENTER = exports.TRANSITION_PRODUCT_VIEW_AFTER = exports.TRANSITION_PRODUCT_VIEW_ENTER = exports.TRANSITION_PRODUCT_VIEW_LEAVE = exports.TRANSITION_PRODUCT_VIEW_BEFORE = void 0; 49exports.TRANSITION_PRODUCT_VIEW_BEFORE = "product-view-before"; 50exports.TRANSITION_PRODUCT_VIEW_LEAVE = "product-view-leave"; 51exports.TRANSITION_PRODUCT_VIEW_ENTER = "product-view-enter"; 52exports.TRANSITION_PRODUCT_VIEW_AFTER = "product-view-after"; 53exports.TRANSITION_PRODUCT_VIEW_AFTER_ENTER = "product-view-after-enter"; 54 55/***/ }), 56
57/***/ "./src/olipop/components/Barba/Views/product.ts": 58/*!******************************************************!*\ 59 !*** ./src/olipop/components/Barba/Views/product.ts ***! 60 \******************************************************/ 61/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 62 63"use strict"; 64 65 66var __importDefault = this && this.__importDefault || function (mod) { 67 return mod && mod.__esModule ? mod : { 68 "default": mod 69 }; 70}; 71Object.defineProperty(exports, "__esModule", ({ 72 value: true 73})); 74exports.useProductView = void 0; 75var animations_1 = __webpack_require__(/*! ../../../../scripts/animations */ "./src/scripts/animations/index.js"); 76var flavorSliderUtils_1 = __webpack_require__(/*! ../../../../scripts/pdp/flavorSliderUtils */ "./src/scripts/pdp/flavorSliderUtils.js"); 77var core_1 = __importDefault(__webpack_require__(/*! @barba/core */ "./node_modules/@barba/core/dist/barba.umd.js")); 78var prefetch_1 = __importDefault(__webpack_require__(/*! @barba/prefetch */ "./node_modules/@barba/prefetch/dist/barba-prefetch.umd.js")); 79var constants_1 = __webpack_require__(/*! ./constants */ "./src/olipop/components/Barba/Views/constants.ts"); 80var product_form_1 = __webpack_require__(/*! ../../Product/ProductForm/product-form */ "./src/olipop/components/Product/ProductForm/product-form.ts"); 81/** Barba must only be initialized once: productForm mounts inside the Barba container, so every PDP swap remounts it and would otherwise call init() again (duplicate popstate listeners + broken history stack). */ 82var productBarbaInitialized = false; 83var useProductView = function useProductView() { 84 if (document.documentElement.dataset.prefetching === "false") { 85 return; 86 } 87 if (productBarbaInitialized) { 88 return; 89 } 90 productBarbaInitialized = true; 91 core_1["default"].use(prefetch_1["default"]); 92 core_1["default"].init({ 93 prevent: function prevent(_ref) { 94 var el = _ref.el; 95 return !el || el.hasAttribute("data-transition-type") === false; 96 }, 97 views: [{ 98 namespace: "product" 99 }], 100 transitions: [{ 101 name: "wave-under", 102 from: { 103 namespace: ["product"], 104 custom: function custom(_ref2) { 105 var trigger = _ref2.trigger; 106 if (trigger === "back" || trigger === "forward" || trigger === "popstate") { 107 // History navigation must match so Barba swaps HTML; wave is skipped when trigger is not a flavor link (see waveUnder.js). 108 return true; 109 } 110 if ((0, product_form_1.isBarbaLink)(trigger)) { 111 return trigger.hasAttribute("data-transition-type") && trigger.dataset.transitionType === "wave-under"; 112 } 113 return false; 114 } 115 }, 116 sync: true, 117 before: function before(data) { 118 window.dispatchEvent(new CustomEvent(constants_1.TRANSITION_PRODUCT_VIEW_BEFORE, { 119 detail: data 120 })); 121 }, 122 enter: function enter(data) { 123 (0, animations_1.fadeIn)(data.next.container); 124 }, 125 leave: function leave(data) { 126 window.dispatchEvent(new CustomEvent(constants_1.TRANSITION_PRODUCT_VIEW_LEAVE, { 127 detail: data 128 })); 129 }, 130 after: function after(data) { 131 window.dispatchEvent(new CustomEvent(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, { 132 detail: data 133 })); 134 window.dispatchEvent(new CustomEvent("shopify:section:load", { 135 detail: data 136 })); 137 document.dispatchEvent(new Event("recharge:reload")); 138 if (window.Rebuy && window.Rebuy.SmartCart) { 139 window.Rebuy.SmartCart.bindEvents(); 140 } 141 (0, flavorSliderUtils_1.updateFlavorSlider)(); 142 // Rebuy cart reinitializing after barba transition 143 setTimeout(function () { 144 try { 145 if (window.Rebuy) { 146 var cartUpsell = document.querySelector('#rebuy-cart .rebuy-upsell'); 147 if (cartUpsell) cartUpsell.innerHTML = ''; 148 window.Rebuy.reinit(); 149 } 150 } catch (err) { 151 console.error("[Rebuy] Failed to reinitialize:", err); 152 } 153 }, 0); 154 }, 155 afterEnter: function afterEnter(data) { 156 if (window.innerWidth < 1024) { 157 window.scrollTo({ 158 top: 0, 159 behavior: 'smooth' 160 }); 161 } 162 document.body.classList.add("is-retailer-variant"); 163 document.body.classList.remove("sticky-cta-bottom"); 164 window.dispatchEvent(new CustomEvent(constants_1.TRANSITION_PRODUCT_VIEW_AFTER_ENTER, { 165 detail: data 166 })); 167 } 168 }] 169 }); 170}; 171exports.useProductView = useProductView; 172 173/***/ }), 174
175/***/ "./src/olipop/components/Barba/transition-overlay.ts": 176/*!***********************************************************!*\ 177 !*** ./src/olipop/components/Barba/transition-overlay.ts ***! 178 \***********************************************************/ 179/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 180 181"use strict"; 182 183 184Object.defineProperty(exports, "__esModule", ({ 185 value: true 186})); 187exports.transitionOverlay = void 0; 188var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 189var constants_1 = __webpack_require__(/*! ./Views/constants */ "./src/olipop/components/Barba/Views/constants.ts"); 190var animations_1 = __webpack_require__(/*! ../../../scripts/animations */ "./src/scripts/animations/index.js"); 191exports.transitionOverlay = (0, picoapp_1.component)(function (node) { 192 var transitionWaveElement = node.children[0]; 193 var transitionBefore = function transitionBefore(_ref) { 194 var detail = _ref.detail; 195 (0, animations_1.waveUnderBefore)(detail, node, transitionWaveElement); 196 }; 197 var transitionLeave = function transitionLeave(_ref2) { 198 var detail = _ref2.detail; 199 (0, animations_1.waveUnderLeave)(detail, node, transitionWaveElement); 200 }; 201 var transitionAfter = function transitionAfter(_ref3) { 202 var detail = _ref3.detail; 203 setFlavorColors(detail); 204 }; 205 var setFlavorColors = function setFlavorColors(_ref4) { 206 var trigger = _ref4.trigger, 207 next = _ref4.next; 208 if (trigger === "back" || trigger === "forward" || trigger === "popstate") { 209 (0, animations_1.syncFlavorColorsFromContainer)(next.container, { 210 overlayEl: node, 211 waveEl: transitionWaveElement 212 }); 213 } 214 }; 215 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_BEFORE, transitionBefore); 216 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_LEAVE, transitionLeave); 217 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, transitionAfter); 218 return function () { 219 window.removeEventListener(constants_1.TRANSITION_PRODUCT_VIEW_BEFORE, transitionBefore); 220 window.removeEventListener(constants_1.TRANSITION_PRODUCT_VIEW_LEAVE, transitionLeave); 221 window.removeEventListener(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, transitionAfter); 222 }; 223}); 224 225/***/ }), 226
vendor: 4,892 bytes, lines 227-237
227/***/ "./src/olipop/components/Buttons/oli-button-action.ts": 228/*!************************************************************!*\ 229 !*** ./src/olipop/components/Buttons/oli-button-action.ts ***! 230 \************************************************************/ 231/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 232 233"use strict"; 234 235 236function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 237function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,924 bytes, lines 237-289
237 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 238var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 239 function adopt(value) { 240 return value instanceof P ? value : new P(function (resolve) { 241 resolve(value); 242 }); 243 } 244 return new (P || (P = Promise))(function (resolve, reject) { 245 function fulfilled(value) { 246 try { 247 step(generator.next(value)); 248 } catch (e) { 249 reject(e); 250 } 251 } 252 function rejected(value) { 253 try { 254 step(generator["throw"](value)); 255 } catch (e) { 256 reject(e); 257 } 258 } 259 function step(result) { 260 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 261 } 262 step((generator = generator.apply(thisArg, _arguments || [])).next()); 263 }); 264}; 265Object.defineProperty(exports, "__esModule", ({ 266 value: true 267})); 268exports.addVariant = exports.buttonAction = void 0; 269var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 270var cart_1 = __webpack_require__(/*! ../../utilities/cart */ "./src/olipop/utilities/cart.ts"); 271var oli_button_effect_1 = __webpack_require__(/*! ./oli-button-effect */ "./src/olipop/components/Buttons/oli-button-effect.ts"); 272var pdp_1 = __webpack_require__(/*! ../../../scripts/pdp */ "./src/scripts/pdp/index.js"); 273var store_locator_modal_1 = __webpack_require__(/*! ../StoreLocator/store-locator-modal */ "./src/olipop/components/StoreLocator/store-locator-modal.ts"); 274var BUTTON_ACTIONS; 275(function (BUTTON_ACTIONS) { 276 BUTTON_ACTIONS["ADD_VARIANT"] = "add-variant"; 277 BUTTON_ACTIONS["STORE_LOCATOR"] = "store-locator"; 278 BUTTON_ACTIONS["BACK_IN_STOCK"] = "back-in-stock"; 279})(BUTTON_ACTIONS || (BUTTON_ACTIONS = {})); 280exports.buttonAction = (0, picoapp_1.component)(function (node) { 281 function handleButtonAction(e) { 282 e.preventDefault(); 283 e.stopImmediatePropagation(); 284 var action = node.dataset.action; 285 if (!action) return; 286 switch (action) { 287 case BUTTON_ACTIONS.ADD_VARIANT: 288 (0, exports.addVariant)(node); 289 break;
290 case BUTTON_ACTIONS.STORE_LOCATOR: 291 storeLocator(node); 292 break; 293 case BUTTON_ACTIONS.BACK_IN_STOCK: 294 backInStock(node); 295 break; 296 default: 297 break; 298 } 299 } 300 node.addEventListener("click", handleButtonAction); 301 return function () { 302 node.removeEventListener("click", handleButtonAction); 303 }; 304}); 305var addVariant = function addVariant(node) { 306 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 307 var _a, variantIdElement, variantId, amount, res; 308 return _regeneratorRuntime().wrap(function _callee$(_context) { 309 while (1) switch (_context.prev = _context.next) { 310 case 0: 311 variantIdElement = node.closest("[data-variant-id]"); 312 variantId = variantIdElement === null || variantIdElement === void 0 ? void 0 : variantIdElement.dataset.variantId; 313 amount = (_a = Number(variantIdElement === null || variantIdElement === void 0 ? void 0 : variantIdElement.dataset.quantity)) !== null && _a !== void 0 ? _a : 1; 314 if (variantId) { 315 _context.next = 5; 316 break; 317 } 318 return _context.abrupt("return"); 319 case 5: 320 _context.prev = 5; 321 _context.next = 8; 322 return (0, cart_1.ajaxCartAdd)([{ 323 id: variantId, 324 quantity: amount 325 }]); 326 case 8: 327 res = _context.sent; 328 (0, oli_button_effect_1.handleButtonEffect)(node); 329 return _context.abrupt("return", res); 330 case 13: 331 _context.prev = 13; 332 _context.t0 = _context["catch"](5); 333 console.error(_context.t0); 334 case 16: 335 case "end": 336 return _context.stop(); 337 } 338 }, _callee, null, [[5, 13]]); 339 })); 340}; 341exports.addVariant = addVariant; 342var storeLocator = function storeLocator(node) { 343 var upcCodeElement = node.closest("[data-product-locator-upc]"); 344 var upcCode = upcCodeElement === null || upcCodeElement === void 0 ? void 0 : upcCodeElement.dataset.productLocatorUpc; 345 if (!upcCode) return; 346 (0, store_locator_modal_1.openStoreLocatorModal)(upcCode); 347}; 348var backInStock = function backInStock(node) { 349 var productDataElement = node.closest("[data-variant-id]"); 350 var variantId = productDataElement === null || productDataElement === void 0 ? void 0 : productDataElement.dataset.variantId; 351 var productTitle = productDataElement === null || productDataElement === void 0 ? void 0 : productDataElement.dataset.productTitle; 352 var productId = productDataElement === null || productDataElement === void 0 ? void 0 : productDataElement.dataset.productId; 353 if (!variantId || !productTitle || !productId) return; 354 var backInStockModal = new pdp_1.BackInStockNotice(); 355 backInStockModal.variant.id = variantId; 356 backInStockModal.variant.title = productTitle; 357 backInStockModal.variant.productId = productId; 358 backInStockModal._mount(); 359}; 360 361/***/ }), 362
363/***/ "./src/olipop/components/Buttons/oli-button-effect.ts": 364/*!************************************************************!*\ 365 !*** ./src/olipop/components/Buttons/oli-button-effect.ts ***! 366 \************************************************************/ 367/***/ ((__unused_webpack_module, exports) => { 368 369"use strict"; 370 371 372Object.defineProperty(exports, "__esModule", ({ 373 value: true 374})); 375exports.handleButtonEffect = void 0; 376var BUTTON_EFFECTS; 377(function (BUTTON_EFFECTS) { 378 BUTTON_EFFECTS["RELOAD_PAGE"] = "reload-page"; 379 BUTTON_EFFECTS["CHECKOUT_REDIRECT"] = "checkout-redirect"; 380})(BUTTON_EFFECTS || (BUTTON_EFFECTS = {})); 381var HELPERS = { 382 isRebuyEnabled: function isRebuyEnabled() { 383 var status = window.Rebuy.SmartCart.status; 384 return status !== "disabled"; 385 } 386}; 387var handleButtonEffect = function handleButtonEffect(node) { 388 var effect = node.dataset.effect; 389 if (!effect) return; 390 switch (effect) { 391 case BUTTON_EFFECTS.RELOAD_PAGE: 392 reloadPage(); 393 break; 394 case BUTTON_EFFECTS.CHECKOUT_REDIRECT: 395 checkoutRedirect(); 396 break; 397 default: 398 break; 399 } 400}; 401exports.handleButtonEffect = handleButtonEffect; 402var reloadPage = function reloadPage() { 403 if (HELPERS.isRebuyEnabled()) return; 404 try { 405 location.reload(); 406 } catch (e) { 407 console.error(e); 408 } 409}; 410var isMobile = function isMobile() { 411 return /iPhone|iPad|iPod|Android|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent); 412}; 413var checkoutRedirect = function checkoutRedirect() { 414 if (HELPERS.isRebuyEnabled()) { 415 var cartFlyout = document.querySelector('#rebuy-cart .rebuy-cart__flyout'); 416 if (cartFlyout) { 417 cartFlyout.style.display = 'none'; 418 } 419 } 420 setTimeout(function () { 421 window.location.href = '/checkout'; 422 }, isMobile() ? 1000 : 2000); 423}; 424 425/***/ }), 426
427/***/ "./src/olipop/components/Checkbox/oli-select-checkbox.ts": 428/*!***************************************************************!*\ 429 !*** ./src/olipop/components/Checkbox/oli-select-checkbox.ts ***! 430 \***************************************************************/ 431/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 432 433"use strict"; 434 435 436Object.defineProperty(exports, "__esModule", ({ 437 value: true 438})); 439exports.enterKeypressEvent = void 0; 440var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 441exports.enterKeypressEvent = (0, picoapp_1.component)(function (node) { 442 function toggleCheckbox(e) { 443 if (e.code === "Enter") { 444 var checkboxInput = node.querySelector('input[name="address[default]"]'); 445 checkboxInput.checked ? checkboxInput.checked = false : checkboxInput.checked = true; 446 e.preventDefault(); 447 } 448 } 449 node.addEventListener("keypress", toggleCheckbox); 450 return function () { 451 node.removeEventListener("keypress", toggleCheckbox); 452 }; 453}); 454 455/***/ }), 456
457/***/ "./src/olipop/components/CustomProductForm/oli-custom-product-form.ts": 458/*!****************************************************************************!*\ 459 !*** ./src/olipop/components/CustomProductForm/oli-custom-product-form.ts ***! 460 \****************************************************************************/ 461/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 462 463"use strict"; 464 465 466Object.defineProperty(exports, "__esModule", ({ 467 value: true 468})); 469exports.customProductForm = void 0; 470var animations_1 = __webpack_require__(/*! ../../../scripts/animations */ "./src/scripts/animations/index.js"); 471var utils_1 = __webpack_require__(/*! ../../../scripts/utils */ "./src/scripts/utils/index.js"); 472var global_1 = __webpack_require__(/*! ../../../scripts/global */ "./src/scripts/global/index.js"); 473var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 474var state = { 475 container: null, 476 form: null, 477 priceDisplay: null, 478 qty_selector: null, 479 combo_box: null, 480 atc_button: null, 481 all_swatches: null, 482 dynamic_elems: null, 483 accordion_group_container: null, 484 reviews_container: null 485}; 486/** 487 * Initializes the subscription form by setting up various elements and components. 488 */ 489var _initForm = function _initForm() { 490 state.container = document.getElementById("subscription-barba-container"); 491 state.form = document.querySelector("product-form"); 492 state.priceDisplay = document.getElementById("price-display-box"); 493 if (!state.container || !state.form) return; 494 try { 495 state.qty_selector = new global_1.QtySelector(state.form); 496 state.combo_box = new global_1.ComboBox(state.form, state.priceDisplay); 497 state.atc_button = new global_1.AddToCart(state.form, state.qty_selector, state.combo_box); 498 } catch (e) { 499 console.error(e); 500 } 501 state.all_swatches = state.form.querySelectorAll(".product-swatch"); 502 state.dynamic_elems = document.querySelectorAll("[data-update]"); 503 state.accordion_group_container = document.getElementById("accordion-group-container"); 504 state.reviews_container = document.getElementById("reviews_container"); 505 state.all_swatches.forEach(function (swatchEl) { 506 swatchEl.addEventListener("click", updateProductElements); 507 }); 508 var initialSwatch = state.all_swatches[0]; 509 (0, animations_1.updateColors)(initialSwatch); 510 (0, animations_1.fadeIn)(state.container); 511}; 512/** 513 * Event handler that updates various elements on the page based on the clicked swatch. 514 * @param {Event} e - The event object triggered by the click event. 515 */ 516var updateProductElements = function updateProductElements(e) { 517 var newSwatchEl = e.currentTarget; 518 var newProductHandle = newSwatchEl.dataset.handle; 519 (0, animations_1.updateColors)(newSwatchEl); 520 (0, utils_1.toggleDisplay)(newProductHandle, state.accordion_group_container, "product-accordion"); 521 (0, utils_1.updateDynamicElems)(newSwatchEl, state.dynamic_elems, state.form); 522}; 523exports.customProductForm = (0, picoapp_1.component)(function () { 524 _initForm(); 525 (0, utils_1.initSection)("slider-container", global_1.Slider); 526 (0, utils_1.initSection)("accordion-group", global_1.Accordion); 527}); 528 529/***/ }), 530
531/***/ "./src/olipop/components/Date/oli-date-countdown.ts": 532/*!**********************************************************!*\ 533 !*** ./src/olipop/components/Date/oli-date-countdown.ts ***! 534 \**********************************************************/ 535/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 536 537"use strict"; 538 539 540var __importDefault = this && this.__importDefault || function (mod) { 541 return mod && mod.__esModule ? mod : { 542 "default": mod 543 }; 544}; 545Object.defineProperty(exports, "__esModule", ({ 546 value: true 547})); 548exports.dateCountdown = void 0; 549var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 550var dayjs_1 = __importDefault(__webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js")); 551var utc_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/utc */ "./node_modules/dayjs/plugin/utc.js")); 552var duration_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/duration */ "./node_modules/dayjs/plugin/duration.js")); 553var timezone_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/timezone */ "./node_modules/dayjs/plugin/timezone.js")); 554var customParseFormat_1 = __importDefault(__webpack_require__(/*! dayjs/plugin/customParseFormat */ "./node_modules/dayjs/plugin/customParseFormat.js")); 555dayjs_1["default"].extend(utc_1["default"]); 556dayjs_1["default"].extend(duration_1["default"]); 557dayjs_1["default"].extend(timezone_1["default"]); 558dayjs_1["default"].extend(customParseFormat_1["default"]); 559var DEFAULT_TIMEZONE = "America/Los_Angeles"; 560dayjs_1["default"].tz.setDefault(DEFAULT_TIMEZONE); 561exports.dateCountdown = (0, picoapp_1.component)(function (node) { 562 var endDateData = node.dataset.endDate; 563 var endDate = dayjs_1["default"].tz(endDateData); 564 var currentUTCDate = dayjs_1["default"].tz(); 565 var timeDifference = endDate.diff(currentUTCDate); 566 var initialDuration = dayjs_1["default"].duration(timeDifference); 567 var daysEl = node.querySelector("[data-days]"); 568 var hoursEl = node.querySelector("[data-hours]"); 569 var minutesEl = node.querySelector("[data-minutes]"); 570 var secondsEl = node.querySelector("[data-seconds]"); 571 if (!initialDuration.days()) daysEl.style.display = "none"; 572 if (!initialDuration.hours()) hoursEl.style.display = "none"; 573 if (!initialDuration.minutes()) minutesEl.style.display = "none"; 574 if (!initialDuration.seconds()) secondsEl.style.display = "none"; 575 var updateCounters = function updateCounters(duration) { 576 var days = duration.days(); 577 var hours = duration.hours(); 578 var minutes = duration.minutes(); 579 var seconds = duration.seconds(); 580 var ms = duration.asMilliseconds(); 581 var daysText = "".concat(days, "d"); 582 var hoursText = "".concat(hours, "h"); 583 var minutesText = "".concat(minutes, "m"); 584 var secondsText = "".concat(seconds, "s"); 585 if (ms && ms > 0 && daysEl.textContent !== daysText) { 586 daysEl.innerHTML = daysText; 587 } 588 if (ms && ms > 0 && hoursEl.textContent !== hoursText) { 589 hoursEl.innerHTML = hoursText; 590 } 591 if (ms && ms > 0 && minutesEl.textContent !== minutesText) { 592 minutesEl.innerHTML = minutesText; 593 } 594 if (ms && ms > 0 && secondsEl.textContent !== secondsText) { 595 secondsEl.innerHTML = secondsText; 596 } 597 }; 598 var ms = initialDuration.asMilliseconds(); 599 if (!ms || ms <= 0) { 600 node.innerHTML = ""; 601 return; 602 } 603 updateCounters(initialDuration); 604 var countdownInterval = setInterval(function () { 605 if (!timeDifference) { 606 clearInterval(countdownInterval); 607 return; 608 } 609 timeDifference -= 1000; 610 var newDuration = dayjs_1["default"].duration(timeDifference); 611 updateCounters(newDuration); 612 }, 1000); 613 return function () { 614 clearInterval(countdownInterval); 615 }; 616}); 617 618/***/ }), 619
vendor: 5,020 bytes, lines 620-630
620/***/ "./src/olipop/components/Dialog/SwitchToSubscription/switch-to-subscription-dialog.ts": 621/*!********************************************************************************************!*\ 622 !*** ./src/olipop/components/Dialog/SwitchToSubscription/switch-to-subscription-dialog.ts ***! 623 \********************************************************************************************/ 624/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 625 626"use strict"; 627 628 629function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 630function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 630
630 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
vendor: 4,239 bytes, lines 630-641
630h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 631function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 632function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 633function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 634var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 635 function adopt(value) { 636 return value instanceof P ? value : new P(function (resolve) { 637 resolve(value); 638 }); 639 } 640 return new (P || (P = Promise))(function (resolve, reject) { 641 function fulfilled(value) {
642 try { 643 step(generator.next(value)); 644 } catch (e) { 645 reject(e); 646 } 647 } 648 function rejected(value) { 649 try { 650 step(generator["throw"](value)); 651 } catch (e) { 652 reject(e); 653 } 654 } 655 function step(result) { 656 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 657 } 658 step((generator = generator.apply(thisArg, _arguments || [])).next()); 659 }); 660}; 661Object.defineProperty(exports, "__esModule", ({ 662 value: true 663})); 664exports.switchToSubscriptionDialog = void 0; 665var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 666var cart_1 = __webpack_require__(/*! ../../../utilities/cart */ "./src/olipop/utilities/cart.ts"); 667var REBUY_SWITCH_TO_SUBSCRIPTION_DIALOG = "rebuy:switch-to-subscription-dialog"; 668exports.switchToSubscriptionDialog = (0, picoapp_1.component)(function (node, context) { 669 var dialogId = node.dataset.dialogId; 670 var getDialog = function getDialog() { 671 return context.getState().dialogs[dialogId]; 672 }; 673 var sellingPlanId = node.dataset.sellingPlanId; 674 var dialog = getDialog(); 675 var subscribeToRebuyEvents = function subscribeToRebuyEvents(_dialog) { 676 if (!_dialog) return; 677 _dialog.on("hide", function (event) { 678 // Hide the smart cart along only if the dialog is hidden by native dialog events - click overlay, click close button, etc. 679 window.igEvents = window.igEvents || []; 680 window.igEvents.push({ 681 event: "Subscription Close", 682 properties: { 683 id: node.dataset.dialogId 684 } 685 }); 686 if (window.Rebuy.SmartCart.visible && event.detail) { 687 window.Rebuy.SmartCart.hide(); 688 } 689 }); 690 _dialog.on("show", function () { 691 window.igEvents = window.igEvents || []; 692 window.igEvents.push({ 693 event: "Subscription Modal - Open", 694 properties: { 695 product: node.dataset.dialogId 696 } 697 }); 698 }); 699 }; 700 if (dialog) { 701 subscribeToRebuyEvents(dialog); 702 } else { 703 context.on("*", function () { 704 var dialog = getDialog(); 705 if (dialog) { 706 subscribeToRebuyEvents(dialog); 707 } 708 }); 709 } 710 var shouldDialogRender = function shouldDialogRender(e) { 711 var _a, _b; 712 if (window.disableSwitchToSubscriptionDialog === true) return false; 713 if (!window.location.pathname.includes("/products")) return false; 714 var firstItemAdded = e.detail.item.items ? e.detail.item.items[0] : e.detail.item; 715 var variantId = node.dataset.variantId; 716 if (!firstItemAdded || !firstItemAdded.id) return false; 717 if (parseInt(variantId) !== parseInt(firstItemAdded.id)) return false; 718 if (e.detail.item.selling_plan_allocation) return false; 719 if (localStorage.getItem(REBUY_SWITCH_TO_SUBSCRIPTION_DIALOG)) { 720 return false; 721 } 722 var cart = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.cart) === null || _b === void 0 ? void 0 : _b.cart; 723 var subscriptionVariant = cart.items.find(function (_item) { 724 return _item.variant_id === e.detail.item.variant_id && _item.selling_plan_allocation; 725 }); 726 if (subscriptionVariant) return false; 727 return true; 728 }; 729 var renderDialogContent = function renderDialogContent(e) { 730 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 731 var dialog, firstItemAdded, updateProductButton, closeButton; 732 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 733 while (1) switch (_context2.prev = _context2.next) { 734 case 0: 735 if (shouldDialogRender(e)) { 736 _context2.next = 2; 737 break; 738 } 739 return _context2.abrupt("return"); 740 case 2: 741 dialog = getDialog(); 742 firstItemAdded = e.detail.item.items ? e.detail.item.items[0] : e.detail.item; 743 if (!(!firstItemAdded || !firstItemAdded.id)) { 744 _context2.next = 6; 745 break; 746 } 747 return _context2.abrupt("return"); 748 case 6: 749 if (dialog) { 750 dialog.show(); 751 localStorage.setItem(REBUY_SWITCH_TO_SUBSCRIPTION_DIALOG, "true"); 752 } 753 // Handle Button Events 754 updateProductButton = node.querySelector("#switch-to-subscription-dialog-button"); 755 updateProductButton.addEventListener("click", function () { 756 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 757 return _regeneratorRuntime().wrap(function _callee$(_context) { 758 while (1) switch (_context.prev = _context.next) { 759 case 0: 760 _context.next = 2; 761 return (0, cart_1.ajaxCartUpdate)(_defineProperty({}, firstItemAdded.key, firstItemAdded.quantity > 1 ? firstItemAdded.quantity - 1 : 0)); 762 case 2: 763 _context.next = 4; 764 return (0, cart_1.ajaxCartAdd)([{ 765 id: firstItemAdded.variant_id, 766 quantity: 1, 767 selling_plan: sellingPlanId, 768 properties: firstItemAdded.properties 769 }]); 770 case 4: 771 window.igEvents = window.igEvents || []; 772 window.igEvents.push({ 773 event: "Subscription Modal - Accept", 774 properties: { 775 product: node.dataset.dialogId 776 } 777 }); 778 dialog.hide(); 779 case 7: 780 case "end": 781 return _context.stop(); 782 } 783 }, _callee); 784 })); 785 }); 786 closeButton = node.querySelector("#switch-to-subscription-dialog-close"); 787 closeButton.addEventListener("click", function () { 788 dialog.hide(); 789 window.igEvents = window.igEvents || []; 790 window.igEvents.push({ 791 event: "Subscription Modal - Decline", 792 properties: { 793 product: node.dataset.dialogId 794 } 795 }); 796 }); 797 case 11: 798 case "end": 799 return _context2.stop(); 800 } 801 }, _callee2); 802 })); 803 }; 804 document.addEventListener("rebuy:cart.add", renderDialogContent); 805 return function () { 806 document.removeEventListener("rebuy:cart.add", renderDialogContent); 807 }; 808}); 809 810/***/ }), 811
812/***/ "./src/olipop/components/Dialog/oli-dialog.ts": 813/*!****************************************************!*\ 814 !*** ./src/olipop/components/Dialog/oli-dialog.ts ***! 815 \****************************************************/ 816/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 817 818"use strict"; 819 820 821function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 822function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 823function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 824function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 825var __importDefault = this && this.__importDefault || function (mod) { 826 return mod && mod.__esModule ? mod : { 827 "default": mod 828 }; 829}; 830Object.defineProperty(exports, "__esModule", ({ 831 value: true 832})); 833exports.dialog = void 0; 834var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 835var a11y_dialog_1 = __importDefault(__webpack_require__(/*! a11y-dialog */ "./node_modules/a11y-dialog/dist/a11y-dialog.esm.js")); 836exports.dialog = (0, picoapp_1.component)(function (node, context) { 837 if (node.dataset.portal) { 838 var portal = document.getElementById(node.dataset.portal); 839 if (!portal) { 840 console.error("Portal ".concat(node.dataset.portal, " could not be found to instantiate dialog in."), node); 841 return; 842 } 843 var existingDialog = portal.querySelector("#".concat(node.id)); 844 if (!existingDialog) { 845 portal.appendChild(node); 846 } else { 847 node.remove(); 848 return; 849 } 850 } 851 var dialog = new a11y_dialog_1["default"](node); 852 var state = context.getState(); 853 context.hydrate(Object.assign(Object.assign({}, state), { 854 dialogs: Object.assign(Object.assign({}, state.dialogs), _defineProperty({}, node.id, dialog)) 855 })); 856 dialog.on("show", function () { 857 document.documentElement.style.overflow = "hidden"; 858 window.igEvents = window.igEvents || []; 859 window.igEvents.push({ 860 event: "dialog:show", 861 properties: { 862 dialogId: node.id 863 } 864 }); 865 }); 866 dialog.on("hide", function () { 867 document.documentElement.style.overflow = ""; 868 window.igEvents = window.igEvents || []; 869 window.igEvents.push({ 870 event: "dialog:hide", 871 properties: { 872 dialogId: node.id 873 } 874 }); 875 }); 876 return function () { 877 if (dialog) { 878 dialog.destroy(); 879 } 880 }; 881}); 882 883/***/ }), 884
885/***/ "./src/olipop/components/Navbar/cart-toggle.ts": 886/*!*****************************************************!*\ 887 !*** ./src/olipop/components/Navbar/cart-toggle.ts ***! 888 \*****************************************************/ 889/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 890 891"use strict"; 892 893 894Object.defineProperty(exports, "__esModule", ({ 895 value: true 896})); 897exports.cartToggle = void 0; 898var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 899exports.cartToggle = (0, picoapp_1.component)(function (node) { 900 var valueNode = node.querySelector(".cart-item-count-badge__value"); 901 var updateCartItems = function updateCartItems(event) { 902 var _a, _b, _c; 903 var cartItemCount = (_c = (_b = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.cart) === null || _b === void 0 ? void 0 : _b.cart) === null || _c === void 0 ? void 0 : _c.item_count; 904 if (isNaN(cartItemCount)) return false; 905 var text = String(cartItemCount); 906 if (valueNode) { 907 valueNode.textContent = text; 908 } else { 909 node.textContent = text; 910 } 911 if (cartItemCount === 0) { 912 node.style.display = "none"; 913 } else { 914 node.style.display = "flex"; 915 } 916 }; 917 document.addEventListener("rebuy:cart.change", updateCartItems); 918 return function () { 919 document.removeEventListener("rebuy:cart.change", updateCartItems); 920 }; 921}); 922 923/***/ }), 924
925/***/ "./src/olipop/components/Navbar/oli-dropdown-menu.ts": 926/*!***********************************************************!*\ 927 !*** ./src/olipop/components/Navbar/oli-dropdown-menu.ts ***! 928 \***********************************************************/ 929/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 930 931"use strict"; 932 933 934function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 935function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 936function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 937Object.defineProperty(exports, "__esModule", ({ 938 value: true 939})); 940exports.megaMenu = void 0; 941var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 942function getVisibleFocusables(container) { 943 var selector = "a[href], button:not([disabled]), input:not([type=hidden]):enabled, select:enabled, textarea:enabled, [tabindex]:not([tabindex^='-'])"; 944 return Array.from(container.querySelectorAll(selector)).filter(function (el) { 945 return el.offsetParent !== null; 946 }); 947} 948/** After Tab on last focusable in a submenu: next main link, or first focusable after the main nav in header order. */ 949function focusNextTopLevelOrOut(header, navUl, currentTrigger) { 950 var topFocusables = Array.from(navUl.querySelectorAll(":scope > li > a, :scope > li > button")); 951 var idx = topFocusables.indexOf(currentTrigger); 952 if (idx >= 0 && idx < topFocusables.length - 1) { 953 topFocusables[idx + 1].focus(); 954 return; 955 } 956 var ordered = getVisibleFocusables(header); 957 var lastMain = topFocusables[topFocusables.length - 1]; 958 var i = ordered.indexOf(lastMain); 959 if (i >= 0 && i < ordered.length - 1) { 960 ordered[i + 1].focus(); 961 } 962} 963var SCROLL_LOCK_CLASS = "stop-scroll"; 964function lockPageScroll() { 965 document.documentElement.classList.add(SCROLL_LOCK_CLASS); 966} 967function unlockPageScroll() { 968 document.documentElement.classList.remove(SCROLL_LOCK_CLASS); 969} 970function getChildListHandleFromPanel(el) { 971 var prefix = "site-nav-dropdown__menu--"; 972 var _iterator = _createForOfIteratorHelper(el.classList), 973 _step; 974 try { 975 for (_iterator.s(); !(_step = _iterator.n()).done;) { 976 var c = _step.value; 977 if (!c.startsWith(prefix)) continue; 978 var rest = c.slice(prefix.length); 979 if (rest && rest !== "active") { 980 return rest; 981 } 982 } 983 } catch (err) { 984 _iterator.e(err); 985 } finally { 986 _iterator.f(); 987 } 988 return null; 989} 990var carouselInitialized = new WeakSet(); 991function initNavCarousels(scope) { 992 scope.querySelectorAll("[data-nav-carousel]").forEach(function (carousel) { 993 var track = carousel.querySelector("[data-carousel-track]"); 994 var toolbar = carousel.querySelector(".site-nav-dropdown__carousel-toolbar"); 995 var prev = carousel.querySelector(".site-nav-dropdown__carousel-btn--prev"); 996 var next = carousel.querySelector(".site-nav-dropdown__carousel-btn--next"); 997 if (!track || !prev || !next) { 998 return; 999 } 1000 var scrollStep = function scrollStep() { 1001 return Math.max(200, Math.floor(track.clientWidth * 0.85)); 1002 }; 1003 /** Hide arrow toolbar when all slides fit; subpixels often report 1â4px âoverflowâ with no real scroll. */ 1004 var OVERFLOW_EPS_PX = 12; 1005 var updateCarousel = function updateCarousel() { 1006 var scrollLeft = track.scrollLeft, 1007 scrollWidth = track.scrollWidth, 1008 clientWidth = track.clientWidth; 1009 if (clientWidth < 1) { 1010 return; 1011 } 1012 var overflowPx = scrollWidth - clientWidth; 1013 var needsPagination = overflowPx > OVERFLOW_EPS_PX; 1014 if (toolbar) { 1015 toolbar.classList.toggle("site-nav-dropdown__carousel-toolbar--no-scroll", !needsPagination); 1016 toolbar.setAttribute("aria-hidden", needsPagination ? "false" : "true"); 1017 } 1018 if (!needsPagination) { 1019 prev.disabled = true; 1020 next.disabled = true; 1021 return; 1022 } 1023 prev.disabled = scrollLeft <= 2; 1024 next.disabled = scrollLeft + clientWidth >= scrollWidth - 2; 1025 }; 1026 var scheduleCarouselMeasure = function scheduleCarouselMeasure() { 1027 updateCarousel(); 1028 requestAnimationFrame(function () { 1029 updateCarousel(); 1030 requestAnimationFrame(updateCarousel); 1031 });
1032 [50, 150, 400, 800].forEach(function (ms) { 1033 window.setTimeout(updateCarousel, ms); 1034 }); 1035 }; 1036 if (!carouselInitialized.has(carousel)) { 1037 carouselInitialized.add(carousel); 1038 prev.addEventListener("click", function () { 1039 track.scrollBy({ 1040 left: -scrollStep(), 1041 behavior: "smooth" 1042 }); 1043 }); 1044 next.addEventListener("click", function () { 1045 track.scrollBy({ 1046 left: scrollStep(), 1047 behavior: "smooth" 1048 }); 1049 }); 1050 track.addEventListener("scroll", updateCarousel, { 1051 passive: true 1052 }); 1053 var ro = new ResizeObserver(updateCarousel); 1054 ro.observe(track); 1055 var productRow = track.querySelector(".site-nav-dropdown__product-row"); 1056 if (productRow) { 1057 ro.observe(productRow); 1058 } 1059 track.querySelectorAll("img").forEach(function (img) { 1060 var bump = function bump() { 1061 updateCarousel(); 1062 }; 1063 if (img.complete) { 1064 bump(); 1065 } else { 1066 img.addEventListener("load", bump, { 1067 once: true 1068 }); 1069 } 1070 }); 1071 track.addEventListener("keydown", function (e) { 1072 if (e.key === "ArrowLeft") { 1073 e.preventDefault(); 1074 track.scrollBy({ 1075 left: -scrollStep(), 1076 behavior: "smooth" 1077 }); 1078 } else if (e.key === "ArrowRight") { 1079 e.preventDefault(); 1080 track.scrollBy({ 1081 left: scrollStep(), 1082 behavior: "smooth" 1083 }); 1084 } 1085 }); 1086 } 1087 scheduleCarouselMeasure(); 1088 }); 1089} 1090function queryPanelByHandle(scope, handle) { 1091 if (!handle) { 1092 return null; 1093 } 1094 return scope.querySelector("#".concat(CSS.escape(handle))); 1095} 1096function activateInnerPanel(clicked, innerParents, scope) { 1097 innerParents.forEach(function (button) { 1098 var handle = button.getAttribute("data-handle"); 1099 var menu = queryPanelByHandle(scope, handle); 1100 var nested = button.firstElementChild; 1101 if (button === clicked) { 1102 nested === null || nested === void 0 ? void 0 : nested.setAttribute("aria-expanded", "true"); 1103 button.classList.add("site-nav-dropdown__child-link--active"); 1104 menu === null || menu === void 0 ? void 0 : menu.classList.add("site-nav-dropdown__child-menu--active"); 1105 } else { 1106 nested === null || nested === void 0 ? void 0 : nested.setAttribute("aria-expanded", "false"); 1107 button.classList.remove("site-nav-dropdown__child-link--active"); 1108 menu === null || menu === void 0 ? void 0 : menu.classList.remove("site-nav-dropdown__child-menu--active"); 1109 } 1110 }); 1111} 1112exports.megaMenu = (0, picoapp_1.component)(function (node) { 1113 var overlay = document.querySelector(".overlay"); 1114 var lastActiveTrigger = null; 1115 var openDropdown = function openDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node) { 1116 var fromKeyboard = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; 1117 var trigger = dropdownLink.firstElementChild; 1118 lockPageScroll(); 1119 trigger.setAttribute("aria-expanded", "true"); 1120 node.classList.add("is-dropdown-open"); 1121 node.classList.add("dropdown-active"); 1122 overlay === null || overlay === void 0 ? void 0 : overlay.classList.add("is-active"); 1123 node.querySelectorAll(".site-nav--has-dropdown.site-nav--dropdown-open").forEach(function (el) { 1124 el.classList.remove("site-nav--dropdown-open"); 1125 }); 1126 dropdownLink.classList.add("site-nav--dropdown-open"); 1127 dropdownContainer.querySelectorAll(".site-nav-dropdown__menu--active").forEach(function (el) { 1128 return el.classList.remove("site-nav-dropdown__menu--active"); 1129 }); 1130 navDropdown.classList.add("site-nav-dropdown__menu--active"); 1131 var innerParents = navDropdown.querySelectorAll(".site-nav-dropdown__link-parent"); 1132 if (innerParents.length) { 1133 activateInnerPanel(innerParents[0], innerParents, navDropdown); 1134 } 1135 dropdownContainer.classList.remove("tw-hidden"); 1136 setTimeout(function () { 1137 dropdownContainer.classList.add("tw-opacity-100"); 1138 initNavCarousels(navDropdown); 1139 var closeButton = navDropdown.querySelector(".site-nav-dropdown-close"); 1140 var firstFocusable = navDropdown.querySelector("a, button, input, [tabindex]:not
1140([tabindex='-1'])"); 1141 var isKeyboardNavigation = fromKeyboard || trigger === document.activeElement; 1142 if (isKeyboardNavigation && firstFocusable) { 1143 lastActiveTrigger = trigger; 1144 firstFocusable.focus(); 1145 } 1146 if (closeButton) { 1147 closeButton.onclick = function () { 1148 closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node); 1149 }; 1150 } 1151 }, 0); 1152 }; 1153 var closeDropdown = function closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node, options) { 1154 var _a; 1155 var skipTriggerRefocus = (_a = options === null || options === void 0 ? void 0 : options.skipTriggerRefocus) !== null && _a !== void 0 ? _a : false; 1156 var trigger = dropdownLink.firstElementChild; 1157 trigger.setAttribute("aria-expanded", "false"); 1158 dropdownLink.classList.remove("site-nav--dropdown-open"); 1159 node.classList.remove("is-dropdown-open"); 1160 node.classList.remove("dropdown-active"); 1161 overlay === null || overlay === void 0 ? void 0 : overlay.classList.remove("is-active"); 1162 unlockPageScroll(); 1163 navDropdown.classList.remove("site-nav-dropdown__menu--active"); 1164 dropdownContainer.classList.remove("tw-opacity-100"); 1165 setTimeout(function () { 1166 dropdownContainer.classList.add("tw-hidden"); 1167 }, 0); 1168 removeTrapFocus(); 1169 if (!skipTriggerRefocus && lastActiveTrigger) { 1170 lastActiveTrigger.focus(); 1171 lastActiveTrigger = null; 1172 } else if (skipTriggerRefocus) { 1173 lastActiveTrigger = null; 1174 } 1175 }; 1176 var handleInnerDropdownKeypress = function handleInnerDropdownKeypress(e, innerDropdownButtons, navDropdown) { 1177 var code = e.code; 1178 if (code !== "Tab") e.preventDefault(); 1179 if (code === "Space" || code === "Enter") { 1180 var current = e.currentTarget; 1181 activateInnerPanel(current, innerDropdownButtons, navDropdown); 1182 initNavCarousels(navDropdown); 1183 } 1184 }; 1185 var handleKeypress = function handleKeypress(dropdownLink, e, navDropdown, overlay, dropdownContainer, node) { 1186 var code = e.code; 1187 if (code === "Tab") { 1188 if (!e.shiftKey) { 1189 var isThisMenuActive = (overlay === null || overlay === void 0 ? void 0 : overlay.classList.contains("is-active")) && navDropdown.classList.contains("site-nav-dropdown__menu--active"); 1190 if (isThisMenuActive) { 1191 e.preventDefault(); 1192 var trigger = dropdownLink.firstElementChild; 1193 var firstFocusable = navDropdown.querySelector("a, button, input, [tabindex]:not([tabindex='-1'])"); 1194 if (firstFocusable) { 1195 lastActiveTrigger = trigger; 1196 firstFocusable.focus(); 1197 } 1198 } 1199 } 1200 return; 1201 } 1202 if (code !== "Tab") e.preventDefault(); 1203 var forceClose = code === "Escape"; 1204 if (code === "Space" || code === "Enter" || forceClose) { 1205 (overlay === null || overlay === void 0 ? void 0 : overlay.classList.contains("is-active")) || forceClose ? closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node) : openDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node); 1206 } 1207 }; 1208 var initNav = function initNav(node, overlay) { 1209 var MEGAMENU_MIN_WIDTH = 1024; 1210 var closeActiveMegaMenu = function closeActiveMegaMenu(options) { 1211 if (!node.classList.contains("dropdown-active")) { 1212 return; 1213 } 1214 var dropdownContainer = node.querySelector(".site-nav-dropdown"); 1215 if (!dropdownContainer) { 1216 return; 1217 } 1218 var activePanel = dropdownContainer.querySelector(".site-nav-dropdown__menu.site-nav-dropdown__menu--active"); 1219 if (!activePanel) { 1220 return; 1221 } 1222 var handle = getChildListHandleFromPanel(activePanel); 1223 if (!handle) { 1224 return; 1225 } 1226 var dropdownLink = node.querySelector("[data-child-list-handle=\"".concat(handle, "\"]")); 1227 if (!dropdownLink) { 1228 return; 1229 } 1230 closeDropdown(dropdownLink, activePanel, overlay, dropdownContainer, node, options); 1231 }; 1232 var handleViewportResize = function handleViewportResize() { 1233 if (window.innerWidth < MEGAMENU_MIN_WIDTH) { 1234 closeActiveMegaMenu({ 1235 skipTriggerRefocus: true 1236 }); 1237 } 1238 };
1239 overlay === null || overlay === void 0 ? void 0 : overlay.addEventListener("click", function () { 1240 return closeActiveMegaMenu(); 1241 }); 1242 window.addEventListener("resize", handleViewportResize); 1243 node.querySelectorAll(".site-nav > .site-nav--has-dropdown").forEach(function (dropdownLink, idx) { 1244 var dropdownContainer = node.querySelector(".site-nav-dropdown"); 1245 var linkName = dropdownLink.getAttribute("data-child-list-handle"); 1246 var navDropdown = node.querySelector(".site-nav-dropdown__menu--".concat(linkName)); 1247 var trigger = dropdownLink.firstElementChild; 1248 var handleTriggerClick = function handleTriggerClick(e) { 1249 e.preventDefault(); 1250 e.stopPropagation(); 1251 var isThisOpen = navDropdown.classList.contains("site-nav-dropdown__menu--active") && Boolean(overlay === null || overlay === void 0 ? void 0 : overlay.classList.contains("is-active")); 1252 if (isThisOpen) { 1253 closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node); 1254 } else { 1255 openDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node); 1256 } 1257 }; 1258 trigger.addEventListener("click", handleTriggerClick); 1259 trigger.addEventListener("keydown", function (e) { 1260 return handleKeypress(dropdownLink, e, navDropdown, overlay, dropdownContainer, node); 1261 }); 1262 var handleSubmenuTabKeydown = function handleSubmenuTabKeydown(e) { 1263 if (e.key !== "Tab") return; 1264 if (!navDropdown.classList.contains("site-nav-dropdown__menu--active")) { 1265 return; 1266 } 1267 if (!(overlay === null || overlay === void 0 ? void 0 : overlay.classList.contains("is-active"))) return; 1268 var focusables = getVisibleFocusables(navDropdown); 1269 if (!focusables.length) return; 1270 var active = document.activeElement; 1271 if (!active) return; 1272 var activeIndex = focusables.indexOf(active); 1273 if (activeIndex === -1) return; 1274 var trigger = dropdownLink.firstElementChild; 1275 if (e.shiftKey && activeIndex === 0) { 1276 e.preventDefault(); 1277 lastActiveTrigger = null; 1278 closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node, { 1279 skipTriggerRefocus: true 1280 }); 1281 trigger.focus(); 1282 return; 1283 } 1284 if (!e.shiftKey && activeIndex === focusables.length - 1) { 1285 e.preventDefault(); 1286 lastActiveTrigger = null; 1287 closeDropdown(dropdownLink, navDropdown, overlay, dropdownContainer, node, { 1288 skipTriggerRefocus: true 1289 }); 1290 var navUl = node.querySelector("#SiteNav"); 1291 if (navUl) { 1292 focusNextTopLevelOrOut(node, navUl, trigger); 1293 } 1294 } 1295 }; 1296 navDropdown.addEventListener("keydown", handleSubmenuTabKeydown); 1297 var innerDropdownButtons = navDropdown.querySelectorAll(".site-nav-dropdown__link-parent"); 1298 if (innerDropdownButtons.length) { 1299 innerDropdownButtons.forEach(function (button, idx) { 1300 if (idx === 0) { 1301 button.classList.add("site-nav-dropdown__child-link--active"); 1302 var firstHandle = button.getAttribute("data-handle"); 1303 var firstMenu = queryPanelByHandle(navDropdown, firstHandle); 1304 firstMenu === null || firstMenu === void 0 ? void 0 : firstMenu.classList.add("site-nav-dropdown__child-menu--active"); 1305 } 1306 var onInnerClick = function onInnerClick(e) { 1307 e.preventDefault(); 1308 e.stopPropagation(); 1309 activateInnerPanel(button, innerDropdownButtons, navDropdown); 1310 initNavCarousels(navDropdown); 1311 }; 1312 var onInnerKeydown = function onInnerKeydown(e) { 1313 return handleInnerDropdownKeypress(e, innerDropdownButtons, navDropdown); 1314 }; 1315 button.addEventListener("click", onInnerClick); 1316 button.addEventListener("keydown", onInnerKeydown); 1317 }); 1318 } 1319 return function () { 1320 trigger.removeEventListener("click", handleTriggerClick); 1321 }; 1322 }); 1323 }; 1324 initNav(node, overlay); 1325}); 1326 1327/***/ }), 1328
1329/***/ "./src/olipop/components/Product/ProductForm/product-form.ts": 1330/*!*******************************************************************!*\ 1331 !*** ./src/olipop/components/Product/ProductForm/product-form.ts ***! 1332 \*******************************************************************/ 1333/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1334 1335"use strict"; 1336 1337 1338Object.defineProperty(exports, "__esModule", ({ 1339 value: true 1340})); 1341exports.productForm = exports.isBarbaLink = void 0; 1342var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 1343var product_1 = __webpack_require__(/*! ../../Barba/Views/product */ "./src/olipop/components/Barba/Views/product.ts"); 1344var constants_1 = __webpack_require__(/*! ../../Barba/Views/constants */ "./src/olipop/components/Barba/Views/constants.ts"); 1345var pdp_1 = __webpack_require__(/*! ../../../../scripts/pdp */ "./src/scripts/pdp/index.js"); 1346var product_gallery_1 = __webpack_require__(/*! ../ProductGallery/product-gallery */ "./src/olipop/components/Product/ProductGallery/product-gallery.ts"); 1347var accordion_1 = __webpack_require__(/*! ../../../../scripts/global/accordion */ "./src/scripts/global/accordion.js"); 1348var oli_tabs_1 = __webpack_require__(/*! ../../Tab/oli-tabs */ "./src/olipop/components/Tab/oli-tabs.ts"); 1349var isBarbaLink = function isBarbaLink(trigger) { 1350 return trigger !== undefined; 1351}; 1352exports.isBarbaLink = isBarbaLink; 1353exports.productForm = (0, picoapp_1.component)(function (node) { 1354 (0, product_1.useProductView)(); 1355 var syncSellingPlanState = function syncSellingPlanState() { 1356 var subscriptionRoot = document.querySelector('[id^="rtx_widget_injection_parent_"][data-product-id]'); 1357 var productId = subscriptionRoot === null || subscriptionRoot === void 0 ? void 0 : subscriptionRoot.dataset.productId; 1358 if (!productId || typeof window.setSellingPlan !== "function") { 1359 return; 1360 } 1361 window.setSellingPlan(productId, true); 1362 requestAnimationFrame(function () { 1363 window.setSellingPlan(productId, true); 1364 requestAnimationFrame(function () { 1365 window.setSellingPlan(productId, true); 1366 }); 1367 }); 1368 window.setTimeout(function () { 1369 window.setSellingPlan(productId, true); 1370 }, 120); 1371 }; 1372 var productGalleryContainer = document.querySelector(".keen-slider-container"); 1373 var accordions = document.querySelectorAll("accordion-group"); 1374 if (productGalleryContainer) { 1375 var productGallery = new product_gallery_1.ProductGallery(productGalleryContainer); 1376 productGallery._init(); 1377 } 1378 accordions.forEach(function (accordion) { 1379 return new accordion_1.Accordion(accordion); 1380 }); 1381 var quantityInput = node.querySelector("[data-quantity-input]"); 1382 var incrementButton = node.querySelector("[data-quantity-add]"); 1383 var decrementButton = node.querySelector("[data-quantity-remove]"); 1384 var quantityIncrement = function quantityIncrement(e) { 1385 e.preventDefault(); 1386 var productTitle = quantityInput.getAttribute('data-product-title'); 1387 quantityInput.value = "".concat(parseInt(quantityInput.value) + 1); 1388 quantityInput.ariaLabel = "".concat(productTitle, " quantity ").concat(quantityInput.value); 1389 }; 1390 var quantityDecrement = function quantityDecrement(e) { 1391 e.preventDefault(); 1392 if (parseInt(quantityInput.value) > 1) { 1393 quantityInput.value = "".concat(parseInt(quantityInput.value) - 1); 1394 } else { 1395 quantityInput.value = "1"; 1396 } 1397 }; 1398 incrementButton === null || incrementButton === void 0 ? void 0 : incrementButton.addEventListener("click", quantityIncrement); 1399 decrementButton === null || decrementButton === void 0 ? void 0 : decrementButton.addEventListener("click", quantityDecrement); 1400 // Legacy JS Component - ComboBox 1401 var comboBox = new pdp_1.ComboBox(); 1402 comboBox._init(); 1403 syncSellingPlanState(); 1404 var submitGAEvents = function submitGAEvents(trigger) { 1405 if (window.gtag) { 1406 var productTitle = trigger.dataset.title; 1407 window.gtag("event", "Flavor Selection", { 1408 event_detail: productTitle 1409 }); 1410 } 1411 }; 1412 window.addEventListener(oli_tabs_1.TAB_SELECTED, function (_ref) { 1413 var detail = _ref.detail; 1414 if (window.gtag) { 1415 window.gtag("event", "Product Group Selection", { 1416 event_detail: detail.tab.dataset.collectionTitle || detail.tab.textContent.trim() 1417 }); 1418 } 1419 }); 1420 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, function (_ref2) { 1421 var detail = _ref2.detail; 1422 if ((0, exports.isBarbaLink)(detail.trigger)) { 1423 detail.trigger.focus(); 1424 submitGAEvents(detail.trigger); 1425 } 1426 syncSellingPlanState(); 1427 }); 1428}); 1429 1430/***/ }), 1431
1432/***/ "./src/olipop/components/Product/ProductForm/sticky-add-to-cart.ts": 1433/*!*************************************************************************!*\ 1434 !*** ./src/olipop/components/Product/ProductForm/sticky-add-to-cart.ts ***! 1435 \*************************************************************************/ 1436/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 1437 1438"use strict"; 1439 1440 1441function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 1442function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 1443function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 1444function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 1445function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } 1446function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 1447Object.defineProperty(exports, "__esModule", ({ 1448 value: true 1449})); 1450exports.stickyAddToCart = void 0; 1451var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 1452var constants_1 = __webpack_require__(/*! ../../Barba/Views/constants */ "./src/olipop/components/Barba/Views/constants.ts"); 1453var oli_subscription_box_1 = __webpack_require__(/*! ../../StayAI/oli-subscription-box */ "./src/olipop/components/StayAI/oli-subscription-box.ts"); 1454var general_1 = __webpack_require__(/*! ../../../utilities/general */ "./src/olipop/utilities/general.ts"); 1455var STICKY_ADD_TO_CART_UPDATE = "oli:sticky-add-to-cart:update"; 1456/** PDP flavor links carry the same price data-* as the sticky root; copy on Barba so JS stays self-contained. */ 1457var copyStickyPriceDataset = function copyStickyPriceDataset(from, to) { 1458 var keys = ["originalOneTimePrice", "oneTimePrice", "originalSellingPlanPrice", "sellingPlanPrice"]; 1459 keys.forEach(function (key) { 1460 var val = from.dataset[key]; 1461 if (val !== undefined) { 1462 to.dataset[key] = val; 1463 } 1464 }); 1465}; 1466var GAEvent = function GAEvent(productTitle) { 1467 return function () { 1468 if (window.gtag) { 1469 window.gtag("event", "Sticky Add to Cart", { 1470 event_detail: productTitle 1471 }); 1472 } 1473 }; 1474}; 1475var REBUY_SMARTCART_SHOW = "rebuy:smartcart.show"; 1476var REBUY_SMARTCART_HIDE = "rebuy:smartcart.hide"; 1477var REBUY_CART_OPEN_ATTR = "data-rebuy-smartcart-open"; 1478exports.stickyAddToCart = (0, picoapp_1.component)(function (node) { 1479 var gaEvent; 1480 var observer; 1481 var optionSelectionHandler; 1482 var stickyActivationFrame; 1483 var getProductForm = function getProductForm() { 1484 return document.querySelector("#oli-product-form"); 1485 }; 1486 var getStickySubmitButton = function getStickySubmitButton() { 1487 return node.querySelector("button[type='submit']") || node.querySelector("button"); 1488 }; 1489 var updateStickyPricing = function updateStickyPricing(detail) { 1490 var productPriceEl = node.querySelector("[data-price]"); 1491 var compareAtPriceEl = node.querySelector("[data-compare-at-price]"); 1492 var deliveryText = node.querySelector("[data-delivery-text]"); 1493 if (!productPriceEl || !compareAtPriceEl || !deliveryText) { 1494 return; 1495 } 1496 var originalOneTimePrice = Number(node.dataset.originalOneTimePrice || 0); 1497 var oneTimePrice = Number(node.dataset.oneTimePrice || 0); 1498 var originalSellingPlanPrice = Number(node.dataset.originalSellingPlanPrice || 0); 1499 var sellingPlanPrice = Number(node.dataset.sellingPlanPrice || 0); 1500 if (!detail || detail.subscriptionPlanId === "" && !detail.frequencyText) { 1501 deliveryText.innerHTML = "One Time"; 1502 productPriceEl.innerHTML = (0, general_1.formatMoney)(oneTimePrice); 1503 if (originalOneTimePrice > oneTimePrice) { 1504 compareAtPriceEl.innerHTML = (0, general_1.formatMoney)(originalOneTimePrice); 1505 compareAtPriceEl.classList.remove("tw-hidden"); 1506 } else { 1507 compareAtPriceEl.classList.add("tw-hidden"); 1508 } 1509 return; 1510 } 1511 deliveryText.innerHTML = (detail.frequencyText || "").toLowerCase(); 1512 productPriceEl.innerHTML = (0, general_1.formatMoney)(sellingPlanPrice); 1513 if (originalSellingPlanPrice > sellingPlanPrice) { 1514 compareAtPriceEl.innerHTML = (0, general_1.formatMoney)(originalSellingPlanPrice); 1515 compareAtPriceEl.classList.remove("tw-hidden"); 1516 } else { 1517 compareAtPriceEl.classList.add("tw-hidden"); 1518 } 1519 }; 1520 var bindOptionSelection = function bindOptionSelection() { 1521 if (optionSelectionHandler) { 1522 window.removeEventListener(oli_subscription_box_1.OPTION_SELECTION, optionSelectionHandler); 1523 } 1524 optionSelectionHandler = function optionSelectionHandler(event) { 1525 updateStickyPricing(event.detail); 1526 }; 1527 window.addEventListener(oli_subscription_box_1.OPTION_SELECTION, optionSelectionHandler); 1528 }; 1529 var replaceStickyMarkup = function replaceStickyMarkup(markup) { 1530 var stickyDocument = new DOMParser().parseFromString(markup, "text/html"); 1531 var sourceStickyNode = stickyDocument.querySelector("[data-sticky-add-to-cart]"); 1532 if (!sourceStickyNode) return; 1533 node.className = sourceStickyNode.className; 1534 node.innerHTML = sourceStickyNode.innerHTML; 1535 var sourceStickyStyle = sourceStickyNode.getAttribute("style"); 1536 if (sourceStickyStyle) { 1537 node.setAttribute("style", sourceStickyStyle); 1538 } else { 1539 node.removeAttribute("style"); 1540 } 1541 Object.entries(sourceStickyNode.dataset).forEach(function (_ref) { 1542 var _ref2 = _slicedToArray(_ref, 2), 1543 key = _ref2[0], 1544 value = _ref2[1]; 1545 node.dataset[key] = value; 1546 }); 1547 createSticky(); 1548 }; 1549 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, function (_ref3) { 1550 var detail = _ref3.detail; 1551 var _a, _b; 1552 var trigger = detail === null || detail === void 0 ? void 0 : detail.trigger; 1553 if (trigger) { 1554 copyStickyPriceDataset(trigger, node); 1555 } 1556 var newProductTitle = (_a = trigger === null || trigger === void 0 ? void 0 : trigger.dataset) === null || _a === void 0 ? void 0 : _a.title; 1557 var productAvailability = (_b = trigger === null || trigger === void 0 ? void 0 : trigger.dataset) === null || _b === void 0 ? void 0 : _b.productAvailable; 1558 if (observer) { 1559 observer.disconnect(); 1560 } 1561 createSticky(newProductTitle, productAvailability); 1562 }); 1563 var createSticky = function createSticky(productTitle, productAvailability) { 1564 var stickyAddToCartButton = getStickySubmitButton();
1565 var productForm = getProductForm(); 1566 var submitButton = productForm === null || productForm === void 0 ? void 0 : productForm.querySelector("button[type='submit']"); 1567 var productTitleEl = node.querySelector("[data-product-title]"); 1568 var productAvailableText = node.querySelector("[data-product-available-text]"); 1569 var productOOSText = node.querySelector("[data-oos-text]"); 1570 var stickyOOSButton = node.querySelector("[data-oos-cta]"); 1571 var stickyAvailability = productAvailability !== null && productAvailability !== void 0 ? productAvailability : node.dataset.productAvailable; 1572 var anchorOOSElement = productForm === null || productForm === void 0 ? void 0 : productForm.querySelector("button[data-action='back-in-stock']"); 1573 if (!stickyAddToCartButton || !productAvailableText || !productOOSText || !stickyOOSButton) { 1574 return; 1575 } 1576 // Handle OOS State 1577 if (stickyAvailability === "false") { 1578 toggleStickyButton(false); 1579 } else { 1580 toggleStickyButton(true); 1581 } 1582 function toggleStickyButton(show) { 1583 if (show) { 1584 stickyAddToCartButton.classList.remove("tw-hidden"); 1585 productAvailableText.classList.remove("tw-hidden"); 1586 productOOSText.classList.add("tw-hidden"); 1587 stickyOOSButton.classList.add("tw-hidden"); 1588 productOOSText.classList.remove("tw-block"); 1589 stickyOOSButton.classList.remove("tw-block"); 1590 } else { 1591 stickyAddToCartButton.classList.add("tw-hidden"); 1592 productAvailableText.classList.add("tw-hidden"); 1593 productOOSText.classList.remove("tw-hidden"); 1594 stickyOOSButton.classList.remove("tw-hidden"); 1595 productOOSText.classList.add("tw-block"); 1596 stickyOOSButton.classList.add("tw-block"); 1597 } 1598 } 1599 if (productTitle && productTitleEl) { 1600 productTitleEl.innerHTML = productTitle; 1601 } 1602 var observedAnchor = stickyAvailability === "false" ? anchorOOSElement : submitButton; 1603 if (!productForm || !observedAnchor) return; 1604 if (observer) { 1605 observer.disconnect(); 1606 } 1607 function showSticky(position) { 1608 if (node.hasAttribute("data-active")) { 1609 return; 1610 } 1611 if (stickyActivationFrame) { 1612 window.cancelAnimationFrame(stickyActivationFrame); 1613 } 1614 node.setAttribute("data-sticky-preparing", "true"); 1615 node.removeAttribute("data-active"); 1616 stickyRenderEffects(position); 1617 // Commit the hidden top/bottom position before enabling the slide-in transition. 1618 node.getBoundingClientRect(); 1619 stickyActivationFrame = window.requestAnimationFrame(function () { 1620 node.removeAttribute("data-sticky-preparing"); 1621 // Recalculate with transitions re-enabled, then start the slide. 1622 node.getBoundingClientRect(); 1623 stickyActivationFrame = window.requestAnimationFrame(function () { 1624 node.setAttribute("data-active", "true"); 1625 stickyActivationFrame = undefined; 1626 }); 1627 }); 1628 } 1629 function hideSticky() { 1630 if (stickyActivationFrame) { 1631 window.cancelAnimationFrame(stickyActivationFrame); 1632 stickyActivationFrame = undefined; 1633 } 1634 node.removeAttribute("data-sticky-preparing"); 1635 node.removeAttribute("data-active"); 1636 stickyRenderEffects(); 1637 } 1638 function handleIntersection(entries) { 1639 entries.forEach(function (entry) { 1640 var _a; 1641 if (window.innerWidth <= 768) { 1642 if (!entry.isIntersecting) { 1643 showSticky("bottom"); 1644 } else { 1645 hideSticky(); 1646 } 1647 } else { 1648 if (!entry.rootBounds) return; 1649 var scrollPosition = document.documentElement.scrollTop || document.body.scrollTop; 1650 var anchorTop = entry.boundingClientRect.top; 1651 var headerHeight = ((_a = document.querySelector("#shopify-section-header")) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0; 1652 if (entry.isIntersecting) { 1653 hideSticky(); 1654 } else if (!entry.isIntersecting && scrollPosition < anchorTop) { 1655 node.style.bottom = "0px"; 1656 node.style.top = "unset"; 1657 showSticky("bottom"); 1658 } else if (!entry.isIntersecting && scrollPosition > anchorTop) { 1659 node.style.top = headerHeight.toString() + 'px'; 1660 node.style.bottom = "unset"; 1661 showSticky("top"); 1662 } 1663 } 1664 }); 1665 } 1666 observer = new IntersectionObserver(handleIntersection); 1667 observer.observe(observedAnchor); 1668 updateStickyPricing(); 1669 bindOptionSelection(); 1670 handleGAEvent((productTitleEl === null || productTitleEl === void 0 ? void 0 : productTitleEl.innerHTML) || ""); 1671 }; 1672 createSticky(); 1673 var onRebuySmartCartShow = function onRebuySmartCartShow() { 1674 node.setAttribute(REBUY_CART_OPEN_ATTR, ""); 1675 document.body.classList.remove("sticky-cta-top", "sticky-cta-bottom"); 1676 }; 1677 var onRebuySmartCartHide = function onRebuySmartCartHide() { 1678 node.removeAttribute(REBUY_CART_OPEN_ATTR); 1679 }; 1680 document.addEventListener(REBUY_SMARTCART_SHOW, onRebuySmartCartShow); 1681 document.addEventListener(REBUY_SMARTCART_HIDE, onRebuySmartCartHide); 1682 window.addEventListener(STICKY_ADD_TO_CART_UPDATE, function (event) { 1683 replaceStickyMarkup(event.detail.markup); 1684 }); 1685 function stickyRenderEffects(position) { 1686 var productForm = document.querySelector("#product-form-content"); 1687 if (position) { 1688 node.dataset.stickyPosition = position; 1689 } 1690 setTimeout(function () { 1691 document.body.classList.remove("sticky-cta-top", "sticky-cta-bottom"); 1692 if (position && productForm && !productForm.classList.contains("hide")) { 1693 document.body.classList.add("sticky-cta-".concat(position)); 1694 } 1695 }, 100); 1696 } 1697 function handleGAEvent(productTitle) { 1698 var stickyAddToCartButton = getStickySubmitButton(); 1699 if (!stickyAddToCartButton) return; 1700 if (gaEvent) { 1701 stickyAddToCartButton.removeEventListener("click", gaEvent); 1702 } 1703 gaEvent = GAEvent(productTitle); 1704 stickyAddToCartButton.addEventListener("click", gaEvent); 1705 } 1706 return function () { 1707 if (stickyActivationFrame) { 1708 window.cancelAnimationFrame(stickyActivationFrame); 1709 } 1710 node.removeAttribute("data-sticky-preparing"); 1711 document.removeEventListener(REBUY_SMARTCART_SHOW, onRebuySmartCartShow); 1712 document.removeEventListener(REBUY_SMARTCART_HIDE, onRebuySmartCartHide); 1713 node.removeAttribute(REBUY_CART_OPEN_ATTR); 1714 }; 1715}); 1716 1717/***/ }), 1718
1719/***/ "./src/olipop/components/Product/ProductGallery/product-gallery.ts": 1720/*!*************************************************************************!*\ 1721 !*** ./src/olipop/components/Product/ProductGallery/product-gallery.ts ***! 1722 \*************************************************************************/ 1723/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 1724 1725"use strict"; 1726 1727 1728function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 1729function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 1730function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 1731function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 1732function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 1733function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 1734function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 1735function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1736function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 1737function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 1738function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 1739function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 1740var __importDefault = this && this.__importDefault || function (mod) { 1741 return mod && mod.__esModule ? mod : { 1742 "default": mod 1743 }; 1744}; 1745Object.defineProperty(exports, "__esModule", ({ 1746 value: true 1747})); 1748exports.ProductGallery = void 0; 1749__webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 1750var keen_slider_1 = __importDefault(__webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js")); 1751__webpack_require__(/*! imagesloaded */ "./node_modules/imagesloaded/imagesloaded.js"); 1752var keen_slider_navigation_plugin_1 = __webpack_require__(/*! ../../../../scripts/sections/keen-slider-navigation-plugin */ "./src/scripts/sections/keen-slider-navigation-plugin.js"); 1753var MAX_VISIBLE_SLIDES = 5; 1754var DESKTOP_OVERFLOW_CLASS = "lg:tw-hidden"; 1755var ProductGallery = /*#__PURE__*/function () { 1756 function ProductGallery(wrapper) { 1757 var _this = this; 1758 _classCallCheck(this, ProductGallery); 1759 /** 1760 Builds a new instance of the KeenSlider and assigns it to the slider property of the ProductGallery instance. 1761 */ 1762 this._build = function () { 1763 var _a; 1764 if (!_this.container || !((_a = _this.slides) === null || _a === void 0 ? void 0 : _a.length)) { 1765 return; 1766 } 1767 _this.slider = new keen_slider_1["default"](_this.container, { 1768 selector: function selector() { 1769 return _this.slides; 1770 }, 1771 breakpoints: { 1772 "(min-width: 1024px)": { 1773 slides: { 1774 perView: 0, 1775 spacing: 0 1776 } 1777 } 1778 }, 1779 slides: { 1780 perView: 1, 1781 spacing: 0 1782 } 1783 }, [(0, keen_slider_navigation_plugin_1.KeenSliderNavigation)({
1784 arrows: false, 1785 dots: _this.wrapper.querySelector("[data-dots]"), 1786 wrapper: _this.wrapper.querySelector(".keen-slider__navigation-wrapper") 1787 })]); 1788 }; 1789 /** 1790 Loads videos and reveals them after images are loaded. 1791 */ 1792 this._loadVideos = function () { 1793 var videos = _this.container.querySelectorAll(".product-gallery__video"); 1794 // reveal videos after images are loaded 1795 videos.forEach(function (el) { 1796 el.style.opacity = "1"; 1797 }); 1798 }; 1799 /** Keeps zoom/lightbox URLs in sync after variant-radios fetches fresh section HTML (`?variant=`). */ 1800 this.refreshFsSourcesFromDom = function () { 1801 _this.fsSources = _this.parseFsSources(); 1802 }; 1803 this._init = function () { 1804 if (!_this.container) { 1805 return; 1806 } 1807 _this.fsSources = _this.parseFsSources(); 1808 _this.wrapper.removeEventListener("oli:product-gallery-fs-sources-updated", _this.refreshFsSourcesFromDom); 1809 _this.wrapper.addEventListener("oli:product-gallery-fs-sources-updated", _this.refreshFsSourcesFromDom); 1810 var allSlides = _toConsumableArray(_this.container.querySelectorAll("product-gallery-slide")); 1811 _this.slides = _this.applySlideOverflow(allSlides); 1812 _this.bindLightbox(allSlides); 1813 _this._loadVideos(); 1814 if (_this.slides.length) { 1815 _this._build(); 1816 } 1817 }; 1818 this.slider = null; 1819 this.activeIdx = 0; 1820 this.wrapper = wrapper; 1821 this.container = wrapper.querySelector(".keen-slider") || wrapper.querySelector("product-gallery"); 1822 this.fsSources = []; 1823 this.slides = null; 1824 } 1825 _createClass(ProductGallery, [{ 1826 key: "parseFsSources", 1827 value: function parseFsSources() { 1828 var _a, _b; 1829 var scriptEl = (_a = this.container) === null || _a === void 0 ? void 0 : _a.querySelector("[data-product-gallery-fs-sources]"); 1830 if (!((_b = scriptEl === null || scriptEl === void 0 ? void 0 : scriptEl.textContent) === null || _b === void 0 ? void 0 : _b.trim())) { 1831 return []; 1832 } 1833 try { 1834 var parsed = JSON.parse(scriptEl.textContent); 1835 return Array.isArray(parsed) ? parsed : []; 1836 } catch (_c) { 1837 return []; 1838 } 1839 } 1840 }, { 1841 key: "shouldIgnoreLightboxClick", 1842 value: function shouldIgnoreLightboxClick(target) { 1843 var el = target; 1844 if (!(el === null || el === void 0 ? void 0 : el.closest)) { 1845 return false; 1846 } 1847 if (el.closest('a[href]:not([href="#"])')) { 1848 return true; 1849 } 1850 if (el.closest("button")) { 1851 return true; 1852 } 1853 if (el.closest("video")) { 1854 return true; 1855 } 1856 return false; 1857 } 1858 }, { 1859 key: "openFsLightbox", 1860 value: function openFsLightbox(startIndex) { 1861 var sources = this.fsSources; 1862 if (!sources.length) { 1863 return; 1864 } 1865 var applyAndOpen = function applyAndOpen() { 1866 var Fs = window.FsLightbox; 1867 if (!Fs) { 1868 return false; 1869 } 1870 var fs = new Fs(); 1871 fs.props.sources = sources.map(function (s) { 1872 return s.url; 1873 }); 1874 fs.props.disableThumbs = false; 1875 fs.props.showThumbsOnMount = true; 1876 fs.props.disableBackgroundClose = true; 1877 fs.props.thumbs = sources.map(function (s) { 1878 var _a; 1879 return (_a = s.thumb) !== null && _a !== void 0 ? _a : ""; 1880 }); 1881 fs.props.onOpen = function (inst) { 1882 ProductGallery.scheduleFsLightboxThumbSelectedSync(inst); 1883 }; 1884 fs.props.onShow = function (inst) { 1885 ProductGallery.scheduleFsLightboxThumbSelectedSync(inst); 1886 }; 1887 fs.props.onSlideChange = function (inst) { 1888 ProductGallery.syncFsLightboxThumbWrapperSelected(inst); 1889 }; 1890 sources.forEach(function (s, i) { 1891 if (s.type === "video") { 1892 fs.props.types[i] = "video"; 1893 } else if (s.type === "youtube") { 1894 fs.props.types[i] = "youtube"; 1895 } 1896 }); 1897 var i = Math.max(0, Math.min(startIndex, sources.length - 1)); 1898 fs.open(i); 1899 return true; 1900 };
1901 if (applyAndOpen()) { 1902 return; 1903 } 1904 var attempts = 0; 1905 var maxAttempts = 100; 1906 var tick = function tick() { 1907 if (applyAndOpen()) { 1908 return; 1909 } 1910 if (++attempts < maxAttempts) { 1911 window.requestAnimationFrame(tick); 1912 } 1913 }; 1914 window.requestAnimationFrame(tick); 1915 var onLoad = function onLoad() { 1916 applyAndOpen(); 1917 }; 1918 window.addEventListener("load", onLoad, { 1919 once: true 1920 }); 1921 } 1922 }, { 1923 key: "bindLightbox", 1924 value: function bindLightbox(slideNodes) { 1925 var _this2 = this; 1926 if (!this.fsSources.length) { 1927 return; 1928 } 1929 slideNodes.forEach(function (slide) { 1930 slide.addEventListener("click", function (e) { 1931 if (_this2.shouldIgnoreLightboxClick(e.target)) { 1932 return; 1933 } 1934 var raw = slide.getAttribute("data-fs-source-index"); 1935 var idx = raw !== null && raw !== "" ? parseInt(raw, 10) : 0; 1936 _this2.openFsLightbox(Number.isFinite(idx) ? idx : 0); 1937 }); 1938 }); 1939 var viewAll = this.wrapper.querySelector("[data-product-gallery-view-all]"); 1940 viewAll === null || viewAll === void 0 ? void 0 : viewAll.addEventListener("click", function () { 1941 return _this2.openFsLightbox(0); 1942 }); 1943 } 1944 }, { 1945 key: "applySlideOverflow", 1946 value: function applySlideOverflow(allSlides) { 1947 var viewAll = this.wrapper.querySelector("[data-product-gallery-view-all]"); 1948 allSlides.forEach(function (slide) { 1949 slide.hidden = false; 1950 slide.removeAttribute("aria-hidden"); 1951 slide.classList.remove(DESKTOP_OVERFLOW_CLASS); 1952 }); 1953 if (allSlides.length <= MAX_VISIBLE_SLIDES) { 1954 viewAll === null || viewAll === void 0 ? void 0 : viewAll.setAttribute("hidden", ""); 1955 return allSlides; 1956 } 1957 allSlides.forEach(function (slide, index) { 1958 if (index >= MAX_VISIBLE_SLIDES) { 1959 slide.classList.add(DESKTOP_OVERFLOW_CLASS); 1960 } 1961 }); 1962 viewAll === null || viewAll === void 0 ? void 0 : viewAll.removeAttribute("hidden"); 1963 return allSlides; 1964 } 1965 }], [{ 1966 key: "syncFsLightboxThumbWrapperSelected", 1967 value: function syncFsLightboxThumbWrapperSelected(instance) { 1968 var _a, _b, _c, _d, _e; 1969 var idx = (_b = (_a = instance.stageIndexes) === null || _a === void 0 ? void 0 : _a.current) !== null && _b !== void 0 ? _b : 0; 1970 var container = (_c = instance.elements) === null || _c === void 0 ? void 0 : _c.container; 1971 var fromProps = (_e = (_d = instance.elements) === null || _d === void 0 ? void 0 : _d.thumbsWrappers) === null || _e === void 0 ? void 0 : _e.filter(function (w) { 1972 return Boolean(w); 1973 }); 1974 var wrappers = []; 1975 if (container) { 1976 var fromDom = _toConsumableArray(container.querySelectorAll(".fslightbox-thumb-wrapper")); 1977 if (fromDom.length > 0) { 1978 wrappers = fromDom; 1979 } 1980 } 1981 if (!wrappers.length && (fromProps === null || fromProps === void 0 ? void 0 : fromProps.length)) { 1982 wrappers = fromProps; 1983 } 1984 wrappers.forEach(function (w, i) { 1985 w.classList.toggle("selected", i === idx); 1986 }); 1987 } 1988 }, { 1989 key: "scheduleFsLightboxThumbSelectedSync", 1990 value: function scheduleFsLightboxThumbSelectedSync(instance) { 1991 ProductGallery.syncFsLightboxThumbWrapperSelected(instance); 1992 window.requestAnimationFrame(function () { 1993 ProductGallery.syncFsLightboxThumbWrapperSelected(instance); 1994 window.setTimeout(function () { 1995 return ProductGallery.syncFsLightboxThumbWrapperSelected(instance); 1996 }, 50); 1997 window.setTimeout(function () { 1998 return ProductGallery.syncFsLightboxThumbWrapperSelected(instance); 1999 }, 200); 2000 window.setTimeout(function () { 2001 return ProductGallery.syncFsLightboxThumbWrapperSelected(instance); 2002 }, 500); 2003 }); 2004 } 2005 }]); 2006 return ProductGallery; 2007}(); 2008exports.ProductGallery = ProductGallery; 2009 2010/***/ }), 2011
2012/***/ "./src/olipop/components/PromoBanner/oli-promotion-banner.ts": 2013/*!*******************************************************************!*\ 2014 !*** ./src/olipop/components/PromoBanner/oli-promotion-banner.ts ***! 2015 \*******************************************************************/ 2016/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 2017 2018"use strict"; 2019 2020 2021function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 2022function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 2023function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 2024function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 2025function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 2026function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 2027var __importDefault = this && this.__importDefault || function (mod) { 2028 return mod && mod.__esModule ? mod : { 2029 "default": mod 2030 }; 2031}; 2032Object.defineProperty(exports, "__esModule", ({ 2033 value: true 2034})); 2035exports.promotionBanner = void 0; 2036var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2037var js_cookie_1 = __importDefault(__webpack_require__(/*! js-cookie */ "./node_modules/js-cookie/dist/js.cookie.js")); 2038var PROMOTION_COOKIE_NAME = "promotion_cookie"; 2039var CLOSED_PROMOTION_BANNERS_COOKIE_NAME = "closed_promotion_banners"; 2040var toggleBanner = function toggleBanner(bannerElement) { 2041 bannerElement.classList.toggle("tw-hidden"); 2042}; 2043function setPersistentDiscountCookie(_ref) { 2044 var discount = _ref.discount, 2045 url = _ref.url; 2046 var cookieDetails = { 2047 discount: discount, 2048 url: url 2049 }; 2050 js_cookie_1["default"].set(PROMOTION_COOKIE_NAME, JSON.stringify(cookieDetails), { 2051 expires: 7 2052 }); 2053} 2054/** 2055 * Retrieve all store discounts. Discounts in Shopify are normally a Checkout entity so querying discounts is not something that's provided. 2056 * To retrieve store discounts we're using a combination of methods: 2057 * 1. Using cart and line item discount applications in liquid 2058 * 2. Using a shopify made cookie "discount_code" - this is often tied with shopify discount permalinks 2059 * 3. Reading url_parameter "discount" - this is leveraged by Rebuy to apply a checkout discount 2060 * 4. Reading Rebuy SmartCart & Cart discounts 2061 */ 2062var getAllStoreDiscounts = function getAllStoreDiscounts(node) { 2063 var _a, _b, _c, _d, _e; 2064 var storeDiscounts = node.dataset.storeDiscounts ? JSON.parse(node.dataset.storeDiscounts) : []; 2065 var discountCodeCookie = js_cookie_1["default"].get("discount_code"); 2066 var rebuySmartCartDiscountCode = (_c = (_b = (_a = window.Rebuy) === null || _a === void 0 ? void 0 : _a.SmartCart) === null || _b === void 0 ? void 0 : _b.discount) === null || _c === void 0 ? void 0 : _c.code; 2067 var rebuyCartDiscountCode = (_e = (_d = window.Rebuy) === null || _d === void 0 ? void 0 : _d.Cart) === null || _e === void 0 ? void 0 : _e.discount; 2068 if (discountCodeCookie && !storeDiscounts.find(function (discountCode) { 2069 return discountCode.toLowerCase() === discountCodeCookie.toLowerCase(); 2070 })) { 2071 storeDiscounts.push(discountCodeCookie); 2072 } 2073 var currentURL = new URL(window.location.href); 2074 var currentURLSearchParams = new URLSearchParams(currentURL.search); 2075 var rebuyDiscount = currentURLSearchParams.get("discount"); 2076 if (rebuyDiscount && !storeDiscounts.find(function (discountCode) { 2077 return discountCode.toLowerCase() === rebuyDiscount.toLowerCase(); 2078 })) { 2079 storeDiscounts.push(rebuyDiscount); 2080 } 2081 if (rebuySmartCartDiscountCode && !storeDiscounts.find(function (discountCode) { 2082 return discountCode.toLowerCase() === rebuySmartCartDiscountCode.toLowerCase(); 2083 })) { 2084 storeDiscounts.push(rebuySmartCartDiscountCode); 2085 } 2086 // For Cart template 2087 if (rebuyCartDiscountCode && !storeDiscounts.find(function (discountCode) { 2088 return discountCode.toLowerCase() === rebuyCartDiscountCode.toLowerCase(); 2089 })) { 2090 storeDiscounts.push(rebuyCartDiscountCode); 2091 } 2092 return storeDiscounts; 2093}; 2094var getPromotionCookie = function getPromotionCookie() { 2095 var promotionCookie = js_cookie_1["default"].get(PROMOTION_COOKIE_NAME); 2096 return promotionCookie ? JSON.parse(promotionCookie) : {}; 2097}; 2098/** Shopify promotion_url may be absolute, protocol-relative, or shop-relative. */ 2099var normalizePromotionUrl = function normalizePromotionUrl(url) { 2100 try { 2101 var value = url === null || url === void 0 ? void 0 : url.trim(); 2102 if (!value) return ""; 2103 var base = window.location.origin || window.location.href; 2104 if (/^https?:\/\//i.test(value) || value.startsWith("//")) { 2105 return new URL(value, base).toString(); 2106 } 2107 var path = value.startsWith("/") ? value : "/".concat(value); 2108 return new URL(path, base).toString(); 2109 } catch (_a) { 2110 return ""; 2111 } 2112}; 2113exports.promotionBanner = (0, picoapp_1.component)(function (node) { 2114 var initPromotionBanner = function initPromotionBanner() { 2115 var closeIcon = node.querySelectorAll("[data-icon-close]"); 2116 var promotionBanners = node.querySelectorAll("[data-promotion-banner]"); 2117 var currentURL = new URL(window.location.href); 2118 var storeDiscounts = getAllStoreDiscounts(node); 2119 // Clean any cookies if discounts were removed 2120 if (getPromotionCookie() && getPromotionCookie().discount && !storeDiscounts.find(function (discountCode) { 2121 return discountCode.toLowerCase() === getPromotionCookie().discount.toLowerCase(); 2122 })) { 2123 js_cookie_1["default"].remove(PROMOTION_COOKIE_NAME); 2124 } 2125 var closedPromotionBanners = js_cookie_1["default"].get(CLOSED_PROMOTION_BANNERS_COOKIE_NAME); 2126 var closedPromotions = closedPromotionBanners ? JSON.parse(closedPromotionBanners) : []; 2127 var _loop = function _loop() { 2128 var bannerElement = promotionBanners[i]; 2129 var promotionDiscount = bannerElement.dataset.promotionDiscount; 2130 var promotionURL = normalizePromotionUrl(bannerElement.dataset.promotionUrl); 2131 // Check if banner is in closed promotions (blacklist) 2132 if (closedPromotions.find(function (closedPromotion) { 2133 if (closedPromotion.url === promotionURL && closedPromotion.discount === promotionDiscount) { 2134 return true; 2135 } 2136 return false;
2137 })) { 2138 return "continue"; 2139 } 2140 if (promotionDiscount && promotionURL) { 2141 if (currentURL.toString() === promotionURL && storeDiscounts.find(function (discountCode) { 2142 return discountCode.toLowerCase() === bannerElement.dataset.promotionDiscount.toLowerCase(); 2143 })) { 2144 setPersistentDiscountCookie({ 2145 discount: promotionDiscount, 2146 url: promotionURL 2147 }); 2148 } 2149 } else if (currentURL.toString() === promotionURL) { 2150 // Set cookie based on url 2151 setPersistentDiscountCookie({ 2152 discount: promotionDiscount, 2153 url: promotionURL 2154 }); 2155 } else if ( 2156 // Set cookie based on discount 2157 storeDiscounts.find(function (discountCode) { 2158 return discountCode.toLowerCase() === bannerElement.dataset.promotionDiscount.toLowerCase(); 2159 })) { 2160 setPersistentDiscountCookie({ 2161 discount: promotionDiscount, 2162 url: promotionURL 2163 }); 2164 } 2165 }; 2166 for (var i = 0; i < promotionBanners.length; i++) { 2167 var _ret = _loop(); 2168 if (_ret === "continue") continue; 2169 } 2170 // Toggle display of active banner based on current cookie 2171 var activeBanner = _toConsumableArray(promotionBanners).find(function (bannerElement) { 2172 var promotionCookie = getPromotionCookie(); 2173 var promotionURL = normalizePromotionUrl(bannerElement.dataset.promotionUrl); 2174 var promotionDiscount = bannerElement.dataset.promotionDiscount; 2175 return promotionURL === promotionCookie.url && promotionDiscount === promotionCookie.discount; 2176 }); 2177 if (activeBanner) toggleBanner(activeBanner); 2178 // Closing banner and creating blacklist of promotions 2179 if (closeIcon) { 2180 closeIcon.forEach(function (closeElement) { 2181 closeElement.addEventListener("click", function () { 2182 var bannerElement = closeElement.closest("[data-promotion-banner]"); 2183 var promotionCookie = getPromotionCookie(); 2184 js_cookie_1["default"].remove(PROMOTION_COOKIE_NAME); 2185 toggleBanner(bannerElement); 2186 var bannedPromotions = js_cookie_1["default"].get(CLOSED_PROMOTION_BANNERS_COOKIE_NAME); 2187 var bannedPromotionDetails = bannedPromotions ? JSON.parse(bannedPromotions) : []; 2188 bannedPromotionDetails.push(promotionCookie); 2189 js_cookie_1["default"].set(CLOSED_PROMOTION_BANNERS_COOKIE_NAME, JSON.stringify(bannedPromotionDetails), { 2190 expires: 7 2191 }); 2192 }); 2193 }); 2194 } 2195 }; 2196 if (window.location.pathname === "/cart") { 2197 document.addEventListener("rebuy:cart.ready", function () { 2198 initPromotionBanner(); 2199 }); 2200 } else { 2201 document.addEventListener("rebuy:smartcart.ready", function () { 2202 initPromotionBanner(); 2203 }); 2204 } 2205}); 2206 2207/***/ }), 2208
2209/***/ "./src/olipop/components/Select/oli-select.ts": 2210/*!****************************************************!*\ 2211 !*** ./src/olipop/components/Select/oli-select.ts ***! 2212 \****************************************************/ 2213/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2214 2215"use strict"; 2216 2217 2218function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 2219function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 2220function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 2221function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 2222function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 2223function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 2224Object.defineProperty(exports, "__esModule", ({ 2225 value: true 2226})); 2227exports.select = void 0; 2228var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2229exports.select = (0, picoapp_1.component)(function (node) { 2230 var button = node.querySelector("button"); 2231 var fieldsetElement = node.querySelector("[data-fieldset]"); 2232 var options = node.querySelectorAll(".select-options li"); 2233 var sectionId = node.dataset.id; 2234 var hiddenField = node.querySelector("#" + sectionId + "-hidden-field"); 2235 var selectedValue = node.querySelector("#" + sectionId + "-selected-value"); 2236 var isExpanded = false; 2237 node.addEventListener("click", handleButtonClick); 2238 node.addEventListener("keydown", handleButtonKeypresses); 2239 document.addEventListener("click", handleBodyClick); 2240 options.forEach(function (option) { 2241 option.addEventListener("click", function (e) { 2242 e.stopPropagation(); 2243 var target = e.target.closest("li"); 2244 selectOption(target); 2245 collapseOptions(); 2246 }); 2247 }); 2248 function handleBodyClick(e) { 2249 if (!node.contains(e.target) && isExpanded) { 2250 collapseOptions(); 2251 } 2252 } 2253 function handleButtonClick() { 2254 if (isExpanded) { 2255 collapseOptions(); 2256 } else { 2257 expandOptions(); 2258 } 2259 } 2260 function collapseOptions() { 2261 button.setAttribute("aria-expanded", "false"); 2262 button.classList.remove("tw-hidden"); 2263 fieldsetElement.classList.add("tw-hidden"); 2264 isExpanded = false; 2265 button.focus(); 2266 } 2267 function expandOptions() { 2268 button.setAttribute("aria-expanded", "true"); 2269 fieldsetElement.classList.remove("tw-hidden"); 2270 isExpanded = true; 2271 } 2272 function selectOption(option) { 2273 unselectAllOptions(); 2274 option.setAttribute("aria-selected", true); 2275 button.setAttribute("aria-activedescendant", option.getAttribute("id")); 2276 hiddenField.value = option.textContent; 2277 selectedValue.innerHTML = option.textContent; 2278 } 2279 function unselectAllOptions() { 2280 options.forEach(function (option) { 2281 option.removeAttribute("aria-selected"); 2282 }); 2283 } 2284 function handleButtonKeypresses(e) { 2285 switch (e.key) { 2286 case "ArrowUp": 2287 e.preventDefault(); 2288 if (isExpanded) { 2289 selectPreviousOption(); 2290 } else { 2291 expandOptions(); 2292 } 2293 break; 2294 case "ArrowDown": 2295 e.preventDefault(); 2296 if (isExpanded) { 2297 selectNextOption(); 2298 } else { 2299 expandOptions(); 2300 selectFirstOption(); 2301 } 2302 break; 2303 case "Home": 2304 if (isExpanded) { 2305 selectFirstOption(); 2306 } 2307 break; 2308 case "End": 2309 if (isExpanded) { 2310 selectLastOption(); 2311 } 2312 break; 2313 case "Tab": 2314 collapseOptions(); 2315 break; 2316 case "Escape": 2317 case "Enter": 2318 if (isExpanded) { 2319 e.preventDefault(); 2320 collapseOptions(); 2321 } 2322 break; 2323 } 2324 } 2325 function selectFirstOption() { 2326 var firstOption = options[0]; 2327 selectOption(firstOption); 2328 } 2329 function selectLastOption() { 2330 var lastOption = options[options.length - 1]; 2331 selectOption(lastOption); 2332 } 2333 function selectNextOption() { 2334 var currentOption = document.getElementById(button.getAttribute("aria-activedescendant")); 2335 if (currentOption !== undefined) { 2336 var currentOptionIndex = _toConsumableArray(options).indexOf(currentOption); 2337 if (currentOptionIndex + 1 < options.length) { 2338 var nextOption = options[currentOptionIndex + 1]; 2339 selectOption(nextOption); 2340 } 2341 } 2342 } 2343 function selectPreviousOption() { 2344 var currentOption = document.getElementById(button.getAttribute("aria-activedescendant")); 2345 if (currentOption) { 2346 var currentOptionIndex = _toConsumableArray(options).indexOf(currentOption); 2347 if (currentOptionIndex - 1 >= 0) { 2348 var previousOption = options[currentOptionIndex - 1]; 2349 selectOption(previousOption); 2350 } 2351 } 2352 } 2353 return function () { 2354 node.removeEventListener("click", handleButtonClick); 2355 document.removeEventListener("click", handleBodyClick); 2356 }; 2357}); 2358 2359/***/ }), 2360
2361/***/ "./src/olipop/components/StayAI/oli-stayai-login.ts": 2362/*!**********************************************************!*\ 2363 !*** ./src/olipop/components/StayAI/oli-stayai-login.ts ***! 2364 \**********************************************************/ 2365/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2366 2367"use strict"; 2368 2369 2370Object.defineProperty(exports, "__esModule", ({ 2371 value: true 2372})); 2373exports.stayAILogin = void 0; 2374var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2375exports.stayAILogin = (0, picoapp_1.component)(function (node) { 2376 var _a; 2377 var appName = "retextion"; 2378 var customerId = ((_a = node === null || node === void 0 ? void 0 : node.dataset) === null || _a === void 0 ? void 0 : _a.customerId) || window.__st.cid; 2379 var loginRetextionCustomerPortal = function loginRetextionCustomerPortal(e) { 2380 e.preventDefault(); 2381 if (customerId) { 2382 // Construct an HTTP request 2383 var xhr = new XMLHttpRequest(); 2384 xhr.open("POST", "/apps/" + appName + "/login", true); 2385 xhr.setRequestHeader("Accept", "application/json; charset=utf-8"); 2386 xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); 2387 // Send the collected data as JSON 2388 var data = { 2389 customerId: customerId 2390 }; 2391 xhr.send(JSON.stringify(data)); 2392 xhr.addEventListener("loadend", function () { 2393 if (xhr.status === 200) { 2394 var _data = JSON.parse(xhr.responseText); 2395 if (_data.token) { 2396 var oneHour = 60 * 60 * 1000; 2397 localStorage.setItem("customer-portal-token", _data.token); 2398 localStorage.setItem("customer-portal-token-expiration", "".concat(new Date().getTime() + oneHour)); 2399 window.location.replace("/apps/" + appName + "/#/shop/subscriptions"); 2400 } 2401 } 2402 }); 2403 } else { 2404 window.location.replace("/apps/" + appName + "/#/login"); 2405 } 2406 }; 2407 var triggerElement = node.querySelector("a[href='/apps/retextion/login']"); 2408 if (triggerElement) { 2409 triggerElement.addEventListener("click", loginRetextionCustomerPortal); 2410 } 2411 return function () { 2412 if (triggerElement) { 2413 triggerElement.removeEventListener("click", loginRetextionCustomerPortal); 2414 } 2415 }; 2416}); 2417 2418/***/ }), 2419
2420/***/ "./src/olipop/components/StayAI/oli-subscription-box.ts": 2421/*!**************************************************************!*\ 2422 !*** ./src/olipop/components/StayAI/oli-subscription-box.ts ***! 2423 \**************************************************************/ 2424/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2425 2426"use strict"; 2427 2428 2429Object.defineProperty(exports, "__esModule", ({ 2430 value: true 2431})); 2432exports.subscriptionBox = exports.OPTION_SELECTION = void 0; 2433var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2434exports.OPTION_SELECTION = "option-selection"; 2435exports.subscriptionBox = (0, picoapp_1.component)(function (node) { 2436 var productId = node.dataset.productId; 2437 if (!productId) return; 2438 var sellingPlanInput = node.querySelector("[name='selling_plan']"); 2439 node.querySelectorAll("input[name=\"selling_plan_select\"]").forEach(function (frequencySelect) { 2440 frequencySelect.addEventListener("change", function (e) { 2441 var selected = node.querySelector("input[name=\"selling_plan_select\"]:checked"); 2442 var plansSelect = node.querySelectorAll(".rtx_option_plans"); 2443 if (selected.value === "onetime") { 2444 plansSelect.forEach(function (plans) { 2445 plans.style.display = "none"; 2446 }); 2447 sellingPlanInput.value = ""; 2448 } else { 2449 plansSelect.forEach(function (plans) { 2450 plans.style.display = "block"; 2451 }); 2452 var sellingPlanOption = node.querySelector("#rtx_option_plans_dropdown"); 2453 var sellingPlanId = sellingPlanOption === null || sellingPlanOption === void 0 ? void 0 : sellingPlanOption.value; 2454 sellingPlanInput.value = sellingPlanId; 2455 } 2456 var changeEvent = new Event("change"); 2457 sellingPlanInput.dispatchEvent(changeEvent); 2458 submitGAEvent(selected.value); 2459 }); 2460 }); 2461 sellingPlanInput.addEventListener("change", function (e) { 2462 var subscriptionPlanId = e.target.value; 2463 var optionElement = node.querySelector("option[value='".concat(subscriptionPlanId, "']")); 2464 var frequencyText = optionElement === null || optionElement === void 0 ? void 0 : optionElement.innerHTML; 2465 window.dispatchEvent(new CustomEvent(exports.OPTION_SELECTION, { 2466 detail: { 2467 subscriptionPlanId: subscriptionPlanId, 2468 frequencyText: frequencyText 2469 } 2470 })); 2471 }); 2472 var submitGAEvent = function submitGAEvent(value) { 2473 if (window.gtag) { 2474 window.gtag("event", "Subscription Selection", { 2475 event_detail: value === "onetime" ? "One Time" : "Subscribe & Save" 2476 }); 2477 } 2478 }; 2479}); 2480 2481/***/ }), 2482
2483/***/ "./src/olipop/components/StoreLocator/oli-store-locator-button.ts": 2484/*!************************************************************************!*\ 2485 !*** ./src/olipop/components/StoreLocator/oli-store-locator-button.ts ***! 2486 \************************************************************************/ 2487/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2488 2489"use strict"; 2490 2491 2492Object.defineProperty(exports, "__esModule", ({ 2493 value: true 2494})); 2495exports.storeLocatorButton = void 0; 2496var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2497var store_locator_modal_1 = __webpack_require__(/*! ./store-locator-modal */ "./src/olipop/components/StoreLocator/store-locator-modal.ts"); 2498exports.storeLocatorButton = (0, picoapp_1.component)(function (node) { 2499 var upcCode = node.dataset.productLocatorUpc; 2500 if (!upcCode) return; 2501 var button = node.querySelector("button"); 2502 if (!button) return; 2503 var handleClick = function handleClick(event) { 2504 event.preventDefault(); 2505 (0, store_locator_modal_1.openStoreLocatorModal)(upcCode); 2506 }; 2507 button.addEventListener("click", handleClick); 2508 return function () { 2509 button.removeEventListener("click", handleClick); 2510 }; 2511}); 2512 2513/***/ }), 2514
vendor: 6,202 bytes, lines 2515-2530
2515/***/ "./src/olipop/components/StoreLocator/store-locator-modal.ts": 2516/*!*******************************************************************!*\ 2517 !*** ./src/olipop/components/StoreLocator/store-locator-modal.ts ***! 2518 \*******************************************************************/ 2519/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 2520 2521"use strict"; 2522 2523 2524function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 2525function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 2526function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 2527function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 2528function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 2529function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 2530function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 2530
2530 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
2530h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 2531var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 2532 function adopt(value) { 2533 return value instanceof P ? value : new P(function (resolve) { 2534 resolve(value); 2535 }); 2536 } 2537 return new (P || (P = Promise))(function (resolve, reject) { 2538 function fulfilled(value) { 2539 try { 2540 step(generator.next(value)); 2541 } catch (e) { 2542 reject(e); 2543 } 2544 } 2545 function rejected(value) { 2546 try { 2547 step(generator["throw"](value)); 2548 } catch (e) { 2549 reject(e); 2550 } 2551 } 2552 function step(result) { 2553 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 2554 } 2555 step((generator = generator.apply(thisArg, _arguments || [])).next()); 2556 }); 2557}; 2558Object.defineProperty(exports, "__esModule", ({ 2559 value: true 2560})); 2561exports.storeLocatorTrigger = exports.storeLocatorModal = exports.openStoreLocatorModal = void 0; 2562var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2563var DIALOG_ID = "find-in-store-dialog"; 2564var WIDGET_MOUNT_ID = "store-locator-modal-widget"; 2565var SMARTCOMMERCE_SCRIPTS = ["https://s3.us-west-2.amazonaws.com/static.smartcommerce.co/assets/client/65LKCR/js/smartcart_olipop_us_prod.js", "https://ss.click2cart.com/assets/js/smartcart_min.js"]; 2566var WIDGET_READY_SELECTOR = ".sc-pl-product-locator__container"; 2567var RENDER_POLL_INTERVAL_MS = 100; 2568var RENDER_POLL_TIMEOUT_MS = 15000; 2569var modalController = null; 2570var pendingUpc = null; 2571function loadScript(src) { 2572 if (document.querySelector("script[src=\"".concat(src, "\"]"))) { 2573 return Promise.resolve(); 2574 } 2575 return new Promise(function (resolve, reject) { 2576 var script = document.createElement("script"); 2577 script.src = src; 2578 script.type = "text/javascript"; 2579 script.onload = function () { 2580 return resolve(); 2581 }; 2582 script.onerror = function () { 2583 return reject(new Error("Failed to load ".concat(src))); 2584 }; 2585 document.body.appendChild(script); 2586 }); 2587} 2588function ensureSmartCommerceScripts() { 2589 return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 2590 var _i, _SMARTCOMMERCE_SCRIPT, src; 2591 return _regeneratorRuntime().wrap(function _callee$(_context) { 2592 while (1) switch (_context.prev = _context.next) { 2593 case 0: 2594 _i = 0, _SMARTCOMMERCE_SCRIPT = SMARTCOMMERCE_SCRIPTS; 2595 case 1: 2596 if (!(_i < _SMARTCOMMERCE_SCRIPT.length)) { 2597 _context.next = 8; 2598 break; 2599 } 2600 src = _SMARTCOMMERCE_SCRIPT[_i]; 2601 _context.next = 5; 2602 return loadScript(src); 2603 case 5: 2604 _i++; 2605 _context.next = 1; 2606 break; 2607 case 8: 2608 _context.next = 10; 2609 return waitForProductLocatorUtilities(); 2610 case 10: 2611 case "end": 2612 return _context.stop(); 2613 } 2614 }, _callee); 2615 })); 2616} 2617function waitForProductLocatorUtilities() { 2618 if (window.SCProductLocatorUtilities) { 2619 return Promise.resolve(); 2620 } 2621 return new Promise(function (resolve, reject) { 2622 var startedAt = Date.now(); 2623 var intervalId = window.setInterval(function () { 2624 if (window.SCProductLocatorUtilities) { 2625 window.clearInterval(intervalId); 2626 resolve(); 2627 return; 2628 } 2629 if (Date.now() - startedAt >= RENDER_POLL_TIMEOUT_MS) { 2630 window.clearInterval(intervalId); 2631 reject(new Error("SmartCommerce product locator utilities failed to load")); 2632 } 2633 }, RENDER_POLL_INTERVAL_MS); 2634 }); 2635} 2636function waitForWidgetMount(mount) { 2637 var timeoutMs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RENDER_POLL_TIMEOUT_MS; 2638 if (mount.querySelector(WIDGET_READY_SELECTOR)) { 2639 return Promise.resolve(); 2640 } 2641 return new Promise(function (resolve, reject) { 2642 var startedAt = Date.now(); 2643 var intervalId = window.setInterval(function () { 2644 if (mount.querySelector(WIDGET_READY_SELECTOR)) { 2645 window.clearInterval(intervalId); 2646 resolve(); 2647 return; 2648 } 2649 if (Date.now() - startedAt >= timeoutMs) { 2650 window.clearInterval(intervalId); 2651 reject(new Error("SmartCommerce widget failed to render")); 2652 } 2653 }, RENDER_POLL_INTERVAL_MS); 2654 }); 2655} 2656function applyUpcToWidget(upc) { 2657 var mount = document.getElementById(WIDGET_MOUNT_ID); 2658 if (!mount) { 2659 throw new Error("Store locator widget mount not found"); 2660 } 2661 mount.setAttribute("data-sc-upc", upc); 2662 mount.dataset.scUpc = upc; 2663 return mount; 2664} 2665var StoreLocatorModalController = /*#__PURE__*/function () { 2666 function StoreLocatorModalController(_node, context) { 2667 _classCallCheck(this, StoreLocatorModalController); 2668 this._node = _node; 2669 this.context = context; 2670 this.opening = false;
2671 } 2672 _createClass(StoreLocatorModalController, [{ 2673 key: "getDialog", 2674 value: function getDialog() { 2675 return this.context.getState().dialogs[DIALOG_ID]; 2676 } 2677 }, { 2678 key: "waitForDialog", 2679 value: function waitForDialog() { 2680 var _this = this; 2681 var existingDialog = this.getDialog(); 2682 if (existingDialog) { 2683 return Promise.resolve(existingDialog); 2684 } 2685 return new Promise(function (resolve, reject) { 2686 var startedAt = Date.now(); 2687 var intervalId = window.setInterval(function () { 2688 var dialog = _this.getDialog(); 2689 if (dialog) { 2690 window.clearInterval(intervalId); 2691 resolve(dialog); 2692 return; 2693 } 2694 if (Date.now() - startedAt >= RENDER_POLL_TIMEOUT_MS) { 2695 window.clearInterval(intervalId); 2696 reject(new Error("Store locator dialog \"".concat(DIALOG_ID, "\" is not registered"))); 2697 } 2698 }, RENDER_POLL_INTERVAL_MS); 2699 }); 2700 } 2701 }, { 2702 key: "open", 2703 value: function open(upc) { 2704 var _a; 2705 return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 2706 var dialog, mount, needsRender; 2707 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 2708 while (1) switch (_context2.prev = _context2.next) { 2709 case 0: 2710 if (!(!upc || this.opening)) { 2711 _context2.next = 2; 2712 break; 2713 } 2714 return _context2.abrupt("return"); 2715 case 2: 2716 this.opening = true; 2717 _context2.prev = 3; 2718 _context2.next = 6; 2719 return this.waitForDialog(); 2720 case 6: 2721 dialog = _context2.sent; 2722 mount = applyUpcToWidget(upc); 2723 needsRender = !mount.querySelector(WIDGET_READY_SELECTOR) || mount.dataset.lastUpc !== upc; 2724 dialog.show(); 2725 if (!needsRender) { 2726 _context2.next = 18; 2727 break; 2728 } 2729 mount.innerHTML = ""; 2730 _context2.next = 14; 2731 return ensureSmartCommerceScripts(); 2732 case 14: 2733 (_a = window.SCProductLocatorUtilities) === null || _a === void 0 ? void 0 : _a.renderAllProductLocators(true); 2734 _context2.next = 17; 2735 return waitForWidgetMount(mount); 2736 case 17: 2737 mount.dataset.lastUpc = upc; 2738 case 18: 2739 pendingUpc = null; 2740 _context2.next = 24; 2741 break; 2742 case 21: 2743 _context2.prev = 21; 2744 _context2.t0 = _context2["catch"](3); 2745 console.error(_context2.t0); 2746 case 24: 2747 _context2.prev = 24; 2748 this.opening = false; 2749 return _context2.finish(24); 2750 case 27: 2751 case "end": 2752 return _context2.stop(); 2753 } 2754 }, _callee2, this, [[3, 21, 24, 27]]); 2755 })); 2756 } 2757 }]); 2758 return StoreLocatorModalController; 2759}(); 2760function openStoreLocatorModal(upc) { 2761 if (!upc) return; 2762 pendingUpc = upc; 2763 if (modalController) { 2764 void modalController.open(upc); 2765 } 2766} 2767exports.openStoreLocatorModal = openStoreLocatorModal; 2768exports.storeLocatorModal = (0, picoapp_1.component)(function (node, context) { 2769 modalController = new StoreLocatorModalController(node, context); 2770 void ensureSmartCommerceScripts()["catch"](function () { 2771 // Preload on idle; first click will retry if this fails. 2772 }); 2773 if (pendingUpc) { 2774 var upc = pendingUpc; 2775 void modalController.open(upc); 2776 } 2777 return function () { 2778 if (modalController) { 2779 modalController = null; 2780 } 2781 }; 2782}); 2783exports.storeLocatorTrigger = (0, picoapp_1.component)(function (node) { 2784 var handleClick = function handleClick(event) { 2785 event.preventDefault(); 2786 var upc = node.dataset.productLocatorUpc; 2787 if (!upc) return; 2788 openStoreLocatorModal(upc); 2789 }; 2790 node.addEventListener("click", handleClick); 2791 return function () { 2792 node.removeEventListener("click", handleClick); 2793 }; 2794}); 2795 2796/***/ }), 2797
2798/***/ "./src/olipop/components/Tab/oli-tabs.ts": 2799/*!***********************************************!*\ 2800 !*** ./src/olipop/components/Tab/oli-tabs.ts ***! 2801 \***********************************************/ 2802/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2803 2804"use strict"; 2805 2806 2807function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 2808function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 2809function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 2810function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 2811function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 2812function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 2813Object.defineProperty(exports, "__esModule", ({ 2814 value: true 2815})); 2816exports.tabs = exports.TAB_SELECTED = void 0; 2817var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2818var TAB_BUTTON_SELECTOR = "button[role='tab']"; 2819exports.TAB_SELECTED = "tab-selected"; 2820exports.tabs = (0, picoapp_1.component)(function (node) { 2821 var tablist = node.querySelector("[role='tablist']"); 2822 var buttonTabs = node.querySelectorAll(TAB_BUTTON_SELECTOR); 2823 var tabPanels = node.querySelectorAll("[role='tabpanel']"); 2824 var enableHistory = node.dataset.enableHistory === "true"; 2825 tablist.addEventListener("keydown", function (e) { 2826 switch (e.key) { 2827 case "ArrowLeft": 2828 selectPreviousTab(); 2829 break; 2830 case "ArrowRight": 2831 selectNextTab(); 2832 break; 2833 } 2834 }); 2835 buttonTabs.forEach(function (tab) { 2836 tab.addEventListener("click", function (e) { 2837 var nextTabIndex = _toConsumableArray(buttonTabs).indexOf(e.target); 2838 selectTab(nextTabIndex); 2839 }); 2840 }); 2841 function selectPreviousTab() { 2842 var activeTab = node.querySelector("".concat(TAB_BUTTON_SELECTOR, "[aria-selected=\"true\"]")); 2843 if (!activeTab) return; 2844 var activeTabIndex = _toConsumableArray(buttonTabs).indexOf(activeTab); 2845 if (activeTabIndex > 0) { 2846 selectTab(activeTabIndex - 1); 2847 } else { 2848 selectTab(buttonTabs.length - 1); 2849 } 2850 } 2851 function selectNextTab() { 2852 var activeTab = node.querySelector("".concat(TAB_BUTTON_SELECTOR, "[aria-selected=\"true\"]")); 2853 if (!activeTab) return; 2854 var activeTabIndex = _toConsumableArray(buttonTabs).indexOf(activeTab); 2855 if (activeTabIndex < buttonTabs.length - 1) { 2856 selectTab(activeTabIndex + 1); 2857 } else { 2858 selectTab(0); 2859 } 2860 } 2861 function selectTab(index) { 2862 var skipPush = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 2863 buttonTabs.forEach(function (tab) { 2864 tab.setAttribute("aria-selected", "false"); 2865 tab.setAttribute("tabindex", "-1"); 2866 }); 2867 var selectedTab = buttonTabs[index]; 2868 selectedTab.setAttribute("aria-selected", "true"); 2869 selectedTab.setAttribute("tabindex", "0"); 2870 selectedTab.focus(); 2871 var pathname = selectedTab.dataset.pathname; 2872 if (pathname && !skipPush && enableHistory) { 2873 window.history.pushState({}, "", pathname); 2874 } 2875 tabPanels.forEach(function (tabPanel) { 2876 tabPanel.classList.add("tw-hidden"); 2877 }); 2878 var nextTabPanel = node.querySelector("#" + selectedTab.getAttribute("aria-controls")); 2879 nextTabPanel.classList.remove("tw-hidden"); 2880 window.dispatchEvent(new CustomEvent(exports.TAB_SELECTED, { 2881 detail: { 2882 tab: selectedTab 2883 } 2884 })); 2885 } 2886 var handleTabHistory = function handleTabHistory() { 2887 var previousTabIndex = _toConsumableArray(buttonTabs).findIndex(function (buttonElement) { 2888 var pathname = window.location.pathname + window.location.hash; 2889 return buttonElement.dataset.pathname === pathname; 2890 }); 2891 if (previousTabIndex > -1) { 2892 selectTab(previousTabIndex, true); 2893 } 2894 }; 2895 if (enableHistory) { 2896 window.addEventListener("popstate", handleTabHistory); 2897 } 2898 return function () { 2899 if (enableHistory) { 2900 window.removeEventListener("popstate", handleTabHistory); 2901 } 2902 }; 2903}); 2904 2905/***/ }), 2906
2907/***/ "./src/olipop/components/Zest/zest-button.ts": 2908/*!***************************************************!*\ 2909 !*** ./src/olipop/components/Zest/zest-button.ts ***! 2910 \***************************************************/ 2911/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2912 2913"use strict"; 2914 2915 2916Object.defineProperty(exports, "__esModule", ({ 2917 value: true 2918})); 2919exports.zestButton = void 0; 2920var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 2921exports.zestButton = (0, picoapp_1.component)(function (node) { 2922 var trigger = node.querySelector("[data-zest-trigger] button"); 2923 if (!trigger) return; 2924 var triggerZestModal = function triggerZestModal() { 2925 var zestElement = node.querySelector("zest-button button"); 2926 if (zestElement) { 2927 zestElement.click(); 2928 } 2929 }; 2930 trigger.addEventListener("click", triggerZestModal); 2931 return function () { 2932 if (trigger) { 2933 trigger.removeEventListener("click", triggerZestModal); 2934 } 2935 }; 2936}); 2937 2938/***/ }), 2939
2940/***/ "./src/olipop/components/index.ts": 2941/*!****************************************!*\ 2942 !*** ./src/olipop/components/index.ts ***! 2943 \****************************************/ 2944/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 2945 2946"use strict"; 2947 2948 2949Object.defineProperty(exports, "__esModule", ({ 2950 value: true 2951})); 2952exports.switchToSubscriptionDialog = exports.dialog = exports.dateCountdown = exports.promotionBanner = exports.stickyAddToCart = exports.subscriptionBox = exports.ProductGallery = exports.customProductForm = exports.accordion = exports.transitionOverlay = exports.openStoreLocatorModal = exports.storeLocatorTrigger = exports.storeLocatorModal = exports.storeLocatorButton = exports.stayAILogin = exports.zestButton = exports.select = exports.tabs = exports.productForm = exports.buttonAction = exports.enterKeypressEvent = exports.megaMenu = exports.cartToggle = void 0; 2953var cart_toggle_1 = __webpack_require__(/*! ./Navbar/cart-toggle */ "./src/olipop/components/Navbar/cart-toggle.ts"); 2954Object.defineProperty(exports, "cartToggle", ({ 2955 enumerable: true, 2956 get: function get() { 2957 return cart_toggle_1.cartToggle; 2958 } 2959})); 2960var oli_dropdown_menu_1 = __webpack_require__(/*! ./Navbar/oli-dropdown-menu */ "./src/olipop/components/Navbar/oli-dropdown-menu.ts"); 2961Object.defineProperty(exports, "megaMenu", ({ 2962 enumerable: true, 2963 get: function get() { 2964 return oli_dropdown_menu_1.megaMenu; 2965 } 2966})); 2967var oli_select_checkbox_1 = __webpack_require__(/*! ./Checkbox/oli-select-checkbox */ "./src/olipop/components/Checkbox/oli-select-checkbox.ts"); 2968Object.defineProperty(exports, "enterKeypressEvent", ({ 2969 enumerable: true, 2970 get: function get() { 2971 return oli_select_checkbox_1.enterKeypressEvent; 2972 } 2973})); 2974var oli_button_action_1 = __webpack_require__(/*! ./Buttons/oli-button-action */ "./src/olipop/components/Buttons/oli-button-action.ts"); 2975Object.defineProperty(exports, "buttonAction", ({ 2976 enumerable: true, 2977 get: function get() { 2978 return oli_button_action_1.buttonAction; 2979 } 2980})); 2981var product_form_1 = __webpack_require__(/*! ./Product/ProductForm/product-form */ "./src/olipop/components/Product/ProductForm/product-form.ts"); 2982Object.defineProperty(exports, "productForm", ({ 2983 enumerable: true, 2984 get: function get() { 2985 return product_form_1.productForm; 2986 } 2987})); 2988var oli_tabs_1 = __webpack_require__(/*! ./Tab/oli-tabs */ "./src/olipop/components/Tab/oli-tabs.ts"); 2989Object.defineProperty(exports, "tabs", ({ 2990 enumerable: true, 2991 get: function get() { 2992 return oli_tabs_1.tabs; 2993 } 2994})); 2995var oli_select_1 = __webpack_require__(/*! ./Select/oli-select */ "./src/olipop/components/Select/oli-select.ts"); 2996Object.defineProperty(exports, "select", ({ 2997 enumerable: true, 2998 get: function get() { 2999 return oli_select_1.select; 3000 } 3001})); 3002var zest_button_1 = __webpack_require__(/*! ./Zest/zest-button */ "./src/olipop/components/Zest/zest-button.ts"); 3003Object.defineProperty(exports, "zestButton", ({ 3004 enumerable: true, 3005 get: function get() { 3006 return zest_button_1.zestButton; 3007 } 3008})); 3009var oli_stayai_login_1 = __webpack_require__(/*! ./StayAI/oli-stayai-login */ "./src/olipop/components/StayAI/oli-stayai-login.ts"); 3010Object.defineProperty(exports, "stayAILogin", ({ 3011 enumerable: true, 3012 get: function get() { 3013 return oli_stayai_login_1.stayAILogin; 3014 } 3015})); 3016var oli_store_locator_button_1 = __webpack_require__(/*! ./StoreLocator/oli-store-locator-button */ "./src/olipop/components/StoreLocator/oli-store-locator-button.ts"); 3017Object.defineProperty(exports, "storeLocatorButton", ({ 3018 enumerable: true, 3019 get: function get() { 3020 return oli_store_locator_button_1.storeLocatorButton; 3021 } 3022})); 3023var store_locator_modal_1 = __webpack_require__(/*! ./StoreLocator/store-locator-modal */ "./src/olipop/components/StoreLocator/store-locator-modal.ts"); 3024Object.defineProperty(exports, "storeLocatorModal", ({ 3025 enumerable: true, 3026 get: function get() { 3027 return store_locator_modal_1.storeLocatorModal; 3028 } 3029})); 3030Object.defineProperty(exports, "storeLocatorTrigger", ({ 3031 enumerable: true, 3032 get: function get() { 3033 return store_locator_modal_1.storeLocatorTrigger; 3034 } 3035})); 3036Object.defineProperty(exports, "openStoreLocatorModal", ({ 3037 enumerable: true, 3038 get: function get() { 3039 return store_locator_modal_1.openStoreLocatorModal; 3040 } 3041})); 3042var transition_overlay_1 = __webpack_require__(/*! ./Barba/transition-overlay */ "./src/olipop/components/Barba/transition-overlay.ts"); 3043Object.defineProperty(exports, "transitionOverlay", ({ 3044 enumerable: true, 3045 get: function get() { 3046 return transition_overlay_1.transitionOverlay; 3047 } 3048})); 3049var oli_accordion_1 = __webpack_require__(/*! ./Accordion/oli-accordion */ "./src/olipop/components/Accordion/oli-accordion.ts"); 3050Object.defineProperty(exports, "accordion", ({ 3051 enumerable: true, 3052 get: function get() { 3053 return oli_accordion_1.accordion; 3054 } 3055})); 3056var oli_custom_product_form_1 = __webpack_require__(/*! ./CustomProductForm/oli-custom-product-form */ "./src/olipop/components/CustomProductForm/oli-custom-product-form.ts"); 3057Object.defineProperty(exports, "customProductForm", ({ 3058 enumerable: true, 3059 get: function get() { 3060 return oli_custom_product_form_1.customProductForm; 3061 } 3062})); 3063var product_gallery_1 = __webpack_require__(/*! ./Product/ProductGallery/product-gallery */ "./src/olipop/components/Product/ProductGallery/product-gallery.ts"); 3064Object.defineProperty(exports, "ProductGallery", ({ 3065 enumerable: true, 3066 get: function get() { 3067 return product_gallery_1.ProductGallery; 3068 } 3069})); 3070var oli_subscription_box_1 = __webpack_require__(/*! ./StayAI/oli-subscription-box */ "./src/olipop/components/StayAI/oli-subscription-box.ts"); 3071Object.defineProperty(exports, "subscriptionBox", ({ 3072 enumerable: true, 3073 get: function get() { 3074 return oli_subscription_box_1.subscriptionBox; 3075 } 3076})); 3077var sticky_add_to_cart_1 = __webpack_require__(/*! ./Product/ProductForm/sticky-add-to-cart */ "./src/olipop/components/Product/ProductForm/sticky-add-to-cart.ts"); 3078Object.defineProperty(exports, "stickyAddToCart", ({ 3079 enumerable: true, 3080 get: function get() { 3081 return sticky_add_to_cart_1.stickyAddToCart; 3082 } 3083})); 3084var oli_promotion_banner_1 = __webpack_require__(/*! ./PromoBanner/oli-promotion-banner */ "./src/olipop/components/PromoBanner/oli-promotion-banner.ts"); 3085Object.defineProperty(exports, "promotionBanner", ({ 3086 enumerable: true, 3087 get: function get() { 3088 return oli_promotion_banner_1.promotionBanner; 3089 } 3090})); 3091var oli_date_countdown_1 = __webpack_require__(/*! ./Date/oli-date-countdown */ "./src/olipop/components/Date/oli-date-countdown.ts");
3092Object.defineProperty(exports, "dateCountdown", ({ 3093 enumerable: true, 3094 get: function get() { 3095 return oli_date_countdown_1.dateCountdown; 3096 } 3097})); 3098var oli_dialog_1 = __webpack_require__(/*! ./Dialog/oli-dialog */ "./src/olipop/components/Dialog/oli-dialog.ts"); 3099Object.defineProperty(exports, "dialog", ({ 3100 enumerable: true, 3101 get: function get() { 3102 return oli_dialog_1.dialog; 3103 } 3104})); 3105var switch_to_subscription_dialog_1 = __webpack_require__(/*! ./Dialog/SwitchToSubscription/switch-to-subscription-dialog */ "./src/olipop/components/Dialog/SwitchToSubscription/switch-to-subscription-dialog.ts"); 3106Object.defineProperty(exports, "switchToSubscriptionDialog", ({ 3107 enumerable: true, 3108 get: function get() { 3109 return switch_to_subscription_dialog_1.switchToSubscriptionDialog; 3110 } 3111})); 3112 3113/***/ }), 3114
3115/***/ "./src/olipop/index.ts": 3116/*!*****************************!*\ 3117 !*** ./src/olipop/index.ts ***! 3118 \*****************************/ 3119/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 3120 3121"use strict"; 3122 3123 3124var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { 3125 if (k2 === undefined) k2 = k; 3126 var desc = Object.getOwnPropertyDescriptor(m, k); 3127 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 3128 desc = { 3129 enumerable: true, 3130 get: function get() { 3131 return m[k]; 3132 } 3133 }; 3134 } 3135 Object.defineProperty(o, k2, desc); 3136} : function (o, m, k, k2) { 3137 if (k2 === undefined) k2 = k; 3138 o[k2] = m[k]; 3139}); 3140var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { 3141 Object.defineProperty(o, "default", { 3142 enumerable: true, 3143 value: v 3144 }); 3145} : function (o, v) { 3146 o["default"] = v; 3147}); 3148var __importStar = this && this.__importStar || function (mod) { 3149 if (mod && mod.__esModule) return mod; 3150 var result = {}; 3151 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 3152 __setModuleDefault(result, mod); 3153 return result; 3154}; 3155Object.defineProperty(exports, "__esModule", ({ 3156 value: true 3157})); 3158var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3159var components = __importStar(__webpack_require__(/*! ./components */ "./src/olipop/components/index.ts")); 3160var pageComponents = __importStar(__webpack_require__(/*! ./pages */ "./src/olipop/pages/index.ts")); 3161var global_1 = __webpack_require__(/*! ../scripts/global */ "./src/scripts/global/index.js"); 3162var utils_1 = __webpack_require__(/*! ../scripts/utils */ "./src/scripts/utils/index.js"); 3163var pdp_sticky_layout_1 = __webpack_require__(/*! ./pages/pdp-sticky-layout */ "./src/olipop/pages/pdp-sticky-layout.ts"); 3164var initialState = { 3165 products: {}, 3166 dialogs: {} 3167}; 3168var app = (0, picoapp_1.picoapp)(Object.assign(Object.assign({}, components), pageComponents), initialState); 3169/** 3170 * Keen can fail internally (try/catch in library) without throwing; created() never runs and 3171 * slides stay at Liquid opacity:0. If no instance was attached after init, show content anyway. 3172 */ 3173function ensureAnnouncementCarouselSlidesVisible() { 3174 document.querySelectorAll("slider-container.announcements-bar").forEach(function (node) { 3175 var el = node; 3176 if (el.dataset.disabled === "true" || el.dataset.singleSlide === "true") { 3177 return; 3178 } 3179 if (el._keenSliderInstance) { 3180 return; 3181 } 3182 el.querySelectorAll(".keen-slider__slide").forEach(function (slide) { 3183 slide.style.opacity = "1"; 3184 }); 3185 }); 3186} 3187function bootApp() { 3188 /* Keen sliders must init before picoapp mounts â promotionBanner (and others) prune/update slides; 3189 * double-mount or DOM changes before created() leave slides at opacity:0 from Liquid. */ 3190 (0, utils_1.initSection)("slider-container", global_1.Slider); 3191 (0, pdp_sticky_layout_1.initPdpStickyLayout)(); 3192 /* Mount after paint so Keen layout can settle; then recover any failed inits. */ 3193 requestAnimationFrame(function () { 3194 app.mount(); 3195 requestAnimationFrame(function () { 3196 ensureAnnouncementCarouselSlidesVisible(); 3197 }); 3198 }); 3199} 3200/* Scripts in head may run after DOMContentLoaded if load order changes; still bootstrap. */ 3201if (document.readyState === "loading") { 3202 window.addEventListener("DOMContentLoaded", bootApp); 3203} else { 3204 bootApp(); 3205} 3206window.addEventListener("shopify:section:load", function (event) { 3207 var root = event.target; 3208 if (root === null || root === void 0 ? void 0 : root.querySelectorAll) { 3209 root.querySelectorAll("slider-container").forEach(function (el) { 3210 var container = el; 3211 if (!container._keenSliderInstance) { 3212 try { 3213 new global_1.Slider(container); 3214 } catch (err) { 3215 console.error("[shopify:section:load] Slider init failed:", container, err); 3216 } 3217 } 3218 }); 3219 } 3220 (0, pdp_sticky_layout_1.initPdpStickyLayout)(); 3221 app.mount(); 3222 requestAnimationFrame(function () { 3223 requestAnimationFrame(ensureAnnouncementCarouselSlidesVisible); 3224 }); 3225}); 3226window.addEventListener("picoapp:mount", function () { 3227 (0, pdp_sticky_layout_1.initPdpStickyLayout)(); 3228 app.mount(); 3229}); 3230exports["default"] = app; 3231 3232/***/ }), 3233
3234/***/ "./src/olipop/pages/camila/oli-camila-gallery.ts": 3235/*!*******************************************************!*\ 3236 !*** ./src/olipop/pages/camila/oli-camila-gallery.ts ***! 3237 \*******************************************************/ 3238/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 3239 3240"use strict"; 3241 3242 3243var __importDefault = this && this.__importDefault || function (mod) { 3244 return mod && mod.__esModule ? mod : { 3245 "default": mod 3246 }; 3247}; 3248Object.defineProperty(exports, "__esModule", ({ 3249 value: true 3250})); 3251exports.camilaGalleryVideo = exports.camilaGallery = void 0; 3252var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3253var keen_slider_1 = __importDefault(__webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js")); 3254var global_1 = __webpack_require__(/*! ../../../scripts/global */ "./src/scripts/global/index.js"); 3255exports.camilaGallery = (0, picoapp_1.component)(function (node) { 3256 var slider = new keen_slider_1["default"](node, { 3257 breakpoints: { 3258 "(min-width: 750px)": { 3259 disabled: true 3260 } 3261 }, 3262 slides: { 3263 perView: 1.2, 3264 spacing: 20, 3265 origin: "center" 3266 } 3267 }); 3268}); 3269exports.camilaGalleryVideo = (0, picoapp_1.component)(function (node) { 3270 new global_1.VideoPlayer(node); 3271}); 3272 3273/***/ }), 3274
vendor: 6,655 bytes, lines 3275-3292
3275/***/ "./src/olipop/pages/camila/oli-camila-product-form.ts": 3276/*!************************************************************!*\ 3277 !*** ./src/olipop/pages/camila/oli-camila-product-form.ts ***! 3278 \************************************************************/ 3279/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 3280 3281"use strict"; 3282 3283 3284function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 3285function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 3286function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 3287function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } 3288function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 3289function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 3290function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 3291function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 3292function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,395 bytes, lines 3292-3306
3292 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 3293function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 3294function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 3295function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 3296function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 3297function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 3298function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 3299var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 3300 function adopt(value) { 3301 return value instanceof P ? value : new P(function (resolve) { 3302 resolve(value); 3303 }); 3304 } 3305 return new (P || (P = Promise))(function (resolve, reject) { 3306 function fulfilled(value) {
3307 try { 3308 step(generator.next(value)); 3309 } catch (e) { 3310 reject(e); 3311 } 3312 } 3313 function rejected(value) { 3314 try { 3315 step(generator["throw"](value)); 3316 } catch (e) { 3317 reject(e); 3318 } 3319 } 3320 function step(result) { 3321 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 3322 } 3323 step((generator = generator.apply(thisArg, _arguments || [])).next()); 3324 }); 3325}; 3326Object.defineProperty(exports, "__esModule", ({ 3327 value: true 3328})); 3329exports.camilaProductForm = void 0; 3330var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3331var global_1 = __webpack_require__(/*! ../../../scripts/global */ "./src/scripts/global/index.js"); 3332var utils_1 = __webpack_require__(/*! ../../../scripts/utils */ "./src/scripts/utils/index.js"); 3333var product_1 = __webpack_require__(/*! ../../utilities/product */ "./src/olipop/utilities/product.ts"); 3334var general_1 = __webpack_require__(/*! ../../utilities/general */ "./src/olipop/utilities/general.ts"); 3335var cart_1 = __webpack_require__(/*! ../../utilities/cart */ "./src/olipop/utilities/cart.ts"); 3336var SECTIONS_CACHE = new Map(); 3337exports.camilaProductForm = (0, picoapp_1.component)(function (node, context) { 3338 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() { 3339 var form, priceElement, compareAtPriceElement, price, updateImage, updatePrice, updateIngredients, handleFormChange, submitForm; 3340 return _regeneratorRuntime().wrap(function _callee4$(_context4) { 3341 while (1) switch (_context4.prev = _context4.next) { 3342 case 0: 3343 form = node.querySelector("form"); 3344 priceElement = node.querySelector("[data-price]"); 3345 compareAtPriceElement = node.querySelector("[data-compare-at-price]"); 3346 price = (0, general_1.formatMoney)(priceElement.dataset.price); 3347 updateImage = function updateImage(_ref) { 3348 var target = _ref.target, 3349 product = _ref.product; 3350 if (!product) return; 3351 var pictureElement = node.querySelector("[data-for=\"".concat(target.name, "\"]")); 3352 var sourceElements = _toConsumableArray(pictureElement.querySelectorAll("source")); 3353 sourceElements.forEach(function (sourceElement) { 3354 var _a; 3355 var srcset = sourceElement.getAttribute("srcset"); 3356 var srcsetURL = (0, general_1.getFullyQualifiedUrl)(srcset); 3357 var widthParam = (_a = srcsetURL.searchParams.get("width")) !== null && _a !== void 0 ? _a : ""; 3358 var newProductURL = (0, general_1.getFullyQualifiedUrl)(product.featuredImage.url); 3359 newProductURL.searchParams.set("width", widthParam); 3360 sourceElement.setAttribute("srcset", newProductURL.href); 3361 }); 3362 }; 3363 updatePrice = function updatePrice(_ref2) { 3364 var product = _ref2.product, 3365 sellingPlanId = _ref2.sellingPlanId; 3366 if (!product) return; 3367 if (sellingPlanId) { 3368 var sellingPlans = (0, product_1.getProductSellingPlans)({ 3369 product: product, 3370 group: "12 Cans" 3371 }); 3372 var selectedSellingPlan = sellingPlans.nodes.find(function (sellingPlan) { 3373 return sellingPlan.id === sellingPlanId; 3374 }); 3375 var adjustmentPercentage = selectedSellingPlan.priceAdjustments[0].adju
3375stmentValue.adjustmentPercentage; 3376 var originalPrice = parseInt(priceElement.dataset.price); 3377 var flatDiscount = originalPrice * (adjustmentPercentage / 100); 3378 price = "".concat((0, general_1.formatMoney)(originalPrice - flatDiscount)); 3379 priceElement.innerHTML = price; 3380 compareAtPriceElement.innerHTML = (0, general_1.formatMoney)(priceElement.dataset.price); 3381 compareAtPriceElement.classList.add("tw-mr-2"); 3382 } else { 3383 price = (0, general_1.formatMoney)(priceElement.dataset.price); 3384 priceElement.innerHTML = price; 3385 compareAtPriceElement.innerHTML = ""; 3386 compareAtPriceElement.classList.remove("tw-mr-2"); 3387 } 3388 }; 3389 updateIngredients = function updateIngredients(_ref3) { 3390 var target = _ref3.target, 3391 product = _ref3.product; 3392 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 3393 var sectionDOM, index, ingredientsContainer, sectionId, sectionUrl, result, section, sectionMarkup; 3394 return _regeneratorRuntime().wrap(function _callee$(_context) { 3395 while (1) switch (_context.prev = _context.next) { 3396 case 0: 3397 index = target.dataset.index || 1; 3398 ingredientsContainer = document.querySelector("[data-ingredients-list=\"".concat(index, "\"]")); 3399 if (!SECTIONS_CACHE.has(product.id)) { 3400 _context.next = 6; 3401 break; 3402 } 3403 sectionDOM = SECTIONS_CACHE.get(product.id); 3404 _context.next = 23; 3405 break; 3406 case 6: 3407 _context.prev = 6; 3408 sectionId = "six-pack-ingredients"; 3409 sectionUrl = (0, general_1.getShopifySectionRenderUrl)(sectionId, product.handle); 3410 _context.next = 11; 3411 return fetch(sectionUrl); 3412 case 11: 3413 result = _context.sent; 3414 _context.next = 14; 3415 return result.json(); 3416 case 14: 3417 section = _context.sent; 3418 sectionMarkup = section[sectionId]; 3419 sectionDOM = (0, general_1.parseSectionDom)(sectionMarkup, sectionId); 3420 SECTIONS_CACHE.set(product.id, sectionDOM); 3421 _context.next = 23; 3422 break; 3423 case 20: 3424 _context.prev = 20; 3425 _context.t0 = _context["catch"](6); 3426 console.error(_context.t0); 3427 case 23: 3428 ingredientsContainer.innerHTML = sectionDOM.innerHTML; 3429 (0, utils_1.initSection)("accordion-group", global_1.Accordion); 3430 case 25: 3431 case "end": 3432 return _context.stop(); 3433 } 3434 }, _callee, null, [[6, 20]]); 3435 })); 3436 }; 3437 handleFormChange = function handleFormChange(_ref4) { 3438 var target = _ref4.target; 3439 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 3440 var productGID, product, state, bundleProduct, _productGID, _product; 3441 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 3442 while (1) switch (_context2.prev = _context2.next) { 3443 case 0: 3444 if (!target.name.includes("product")) { 3445 _context2.next = 11; 3446 break; 3447 } 3448 productGID = (0, product_1.getProductID)(parseInt(target.dataset.productId)); 3449 _context2.next = 4; 3450 return (0, product_1.fetchProduct)(productGID); 3451 case 4: 3452 product = _context2.sent; 3453 if (product) { 3454 _context2.next = 7; 3455 break; 3456 } 3457 return _context2.abrupt("return"); 3458 case 7: 3459 state = context.getState(); 3460 context.hydrate(Object.assign(Object.assign({}, state), { 3461 products: Object.assign(Object.assign({}, state.products), _defineProperty({}, product.id, product)) 3462 })); 3463 updateImage({ 3464 target: target, 3465 product: product 3466 }); 3467 updateIngredients({ 3468 target: target, 3469 product: product 3470 }); 3471 case 11: 3472 if (!(target.name === "selling_plan")) { 3473 _context2.next = 18; 3474 break; 3475 } 3476 bundleProduct = form.querySelector('[name="product_bundle"]'); 3477 _productGID = (0, product_1.getProductID)(parseInt(bundleProduct.dataset.productId)); 3478 _context2.next = 16; 3479 return (0, product_1.fetchProduct)(_productGID); 3480 case 16: 3481 _product = _context2.sent; 3482 updatePrice({ 3483 product: _product, 3484 sellingPlanId: (0, product_1.getSellingPlanID)(target.value) 3485 }); 3486 case 18: 3487 case "end": 3488 return _context2.stop(); 3489 } 3490 }, _callee2); 3491 })); 3492 }; 3493 submitForm = function submitForm(e) { 3494 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { 3495 var formData, sellingPlan, productVariants, flavorLabels, currentDate, uniqueBundleId, cartItems; 3496 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 3497 while (1) switch (_context3.prev = _context3.next) { 3498 case 0: 3499 e.preventDefault(); 3500 formData = new FormData(form); 3501 sellingPlan = formData.get("selling_plan"); 3502 productVariants = Array.from(formData.entries()).slice(0, 3); 3503 flavorLabels = [node.querySelector("[data-current-label='product_main']"), node.querySelector("[data-current-label='product_secondary']")]; 3504 currentDate = Date.now(); 3505 uniqueBundleId = (0, general_1.generateUUID)(); 3506 cartItems = productVariants.map(function (_ref5) { 3507 var _ref6 = _slicedToArray(_ref5, 2), 3508 name = _ref6[0], 3509 value = _ref6[1]; 3510 var properties = { 3511 _bundle_id: uniqueBundleId, 3512 _created_at: currentDate 3513 }; 3514 if (name === "product_bundle") { 3515 properties._bundle_parent = true; 3516 properties._bundle_price = price; 3517 properties.Flavors = [].concat(flavorLabels).map(function (flavorLabel) { 3518 return flavorLabel.textContent; 3519 }).join(", ").trim(); 3520 properties._frequency = node.querySelector("[data-current-label='selling_plan']").textContent; 3521 } else { 3522 properties._bundle_parent = false;
3523 properties._hidden_child = "true"; 3524 } 3525 return { 3526 id: value, 3527 properties: properties, 3528 quantity: 1, 3529 selling_plan: sellingPlan 3530 }; 3531 }); 3532 _context3.prev = 8; 3533 _context3.next = 11; 3534 return (0, cart_1.ajaxCartAdd)(cartItems); 3535 case 11: 3536 _context3.next = 16; 3537 break; 3538 case 13: 3539 _context3.prev = 13; 3540 _context3.t0 = _context3["catch"](8); 3541 console.error(_context3.t0); 3542 case 16: 3543 case "end": 3544 return _context3.stop(); 3545 } 3546 }, _callee3, null, [[8, 13]]); 3547 })); 3548 }; 3549 form.addEventListener("change", handleFormChange); 3550 form.addEventListener("submit", submitForm); 3551 return _context4.abrupt("return", function () { 3552 form.removeEventListener("change", handleFormChange); 3553 }); 3554 case 12: 3555 case "end": 3556 return _context4.stop(); 3557 } 3558 }, _callee4); 3559 })); 3560}); 3561 3562/***/ }), 3563
3564/***/ "./src/olipop/pages/camila/oli-camila-select.ts": 3565/*!******************************************************!*\ 3566 !*** ./src/olipop/pages/camila/oli-camila-select.ts ***! 3567 \******************************************************/ 3568/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3569 3570"use strict"; 3571 3572 3573Object.defineProperty(exports, "__esModule", ({ 3574 value: true 3575})); 3576exports.camilaSelect = void 0; 3577var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3578var general_1 = __webpack_require__(/*! ../../utilities/general */ "./src/olipop/utilities/general.ts"); 3579exports.camilaSelect = (0, picoapp_1.component)(function (node) { 3580 var button = node.querySelector("[data-button]"); 3581 var options = node.querySelectorAll("input[type='radio']"); 3582 var thumbnailBackground = node.querySelector("[data-thumbnail-background]"); 3583 var currentLabel = node.querySelector("[data-current-label]"); 3584 var closeButton = node.querySelector("[data-close]"); 3585 var disableAccessibilityOptions = node.dataset.disableAccessibility === "true"; 3586 var thumbnailImage = node.querySelector("[data-thumbnail]"); 3587 var toggleSelect = function toggleSelect() { 3588 if (button.getAttribute("aria-expanded") === "true") { 3589 button.removeAttribute("aria-expanded"); 3590 } else { 3591 if (node.dataset.selectType === "product") { 3592 var productSelects = document.querySelectorAll("[data-select-type='product']"); 3593 productSelects.forEach(function (productSelect) { 3594 if (productSelect !== node) { 3595 var _button = productSelect.querySelector("[data-button]"); 3596 _button.removeAttribute("aria-expanded"); 3597 } 3598 }); 3599 } 3600 button.setAttribute("aria-expanded", "true"); 3601 } 3602 }; 3603 var updateThumbnail = function updateThumbnail(optionElement) { 3604 if (!thumbnailImage) { 3605 return; 3606 } 3607 var newImageUrl = (0, general_1.getFullyQualifiedUrl)(optionElement.dataset.imageSrc); 3608 thumbnailImage.setAttribute("src", newImageUrl.href); 3609 thumbnailBackground.style.backgroundColor = optionElement.dataset.backgroundColor || ""; 3610 }; 3611 var handleOptionChange = function handleOptionChange(_ref) { 3612 var currentTarget = _ref.currentTarget; 3613 selectProduct(currentTarget); 3614 button.focus(); 3615 }; 3616 var selectProduct = function selectProduct(option) { 3617 currentLabel.dataset.value = option.value; 3618 currentLabel.innerHTML = option.dataset.label; 3619 updateThumbnail(option); 3620 if (!disableAccessibilityOptions) { 3621 toggleSelect(); 3622 } 3623 }; 3624 var handleOutsideClick = function handleOutsideClick(_ref2) { 3625 var target = _ref2.target; 3626 if (!node.contains(target) && button.getAttribute("aria-expanded") === "true") { 3627 toggleSelect(); 3628 } 3629 }; 3630 var clickSameOption = function clickSameOption(_ref3) { 3631 var target = _ref3.target; 3632 if (target.value === currentLabel.dataset.value) { 3633 toggleSelect(); 3634 } 3635 }; 3636 var enableAccessibility = function enableAccessibility() { 3637 document.addEventListener("click", handleOutsideClick); 3638 options.forEach(function (optionElement) { 3639 optionElement.addEventListener("click", clickSameOption); 3640 }); 3641 }; 3642 options.forEach(function (optionElement) { 3643 optionElement.addEventListener("change", handleOptionChange); 3644 }); 3645 button.addEventListener("click", toggleSelect); 3646 if (!disableAccessibilityOptions) { 3647 enableAccessibility(); 3648 } 3649 if (closeButton) { 3650 closeButton.addEventListener("click", toggleSelect); 3651 } 3652 return function () { 3653 button.removeEventListener("click", toggleSelect); 3654 options.forEach(function (optionElement) { 3655 optionElement.removeEventListener("click", handleOptionChange); 3656 }); 3657 if (!disableAccessibilityOptions) { 3658 document.removeEventListener("click", handleOutsideClick); 3659 options.forEach(function (optionElement) { 3660 optionElement.removeEventListener("click", clickSameOption); 3661 }); 3662 } 3663 }; 3664}); 3665 3666/***/ }), 3667
3668/***/ "./src/olipop/pages/cart/oli-cart-subscription-selector.ts": 3669/*!*****************************************************************!*\ 3670 !*** ./src/olipop/pages/cart/oli-cart-subscription-selector.ts ***! 3671 \*****************************************************************/ 3672/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3673 3674"use strict"; 3675 3676 3677Object.defineProperty(exports, "__esModule", ({ 3678 value: true 3679})); 3680exports.cartSubscriptionSelector = void 0; 3681var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3682exports.cartSubscriptionSelector = (0, picoapp_1.component)(function (node) { 3683 var oneTimePurchaseBtn = node.querySelector(".rebuy-button"); 3684 var sellingPlanBtn = node.querySelector(".rebuy-select"); 3685 var subscriptionInfo = node.querySelector("[data-subscription-info]"); 3686 var regularPriceEl = node.querySelector("[data-cart-item-regular-price]"); 3687 var compareAtPriceEl = node.querySelector("[data-cart-item-compare-at-price]"); 3688 var cartTotal = document.querySelector("[data-cart-subtotal]"); 3689 if (oneTimePurchaseBtn) { 3690 oneTimePurchaseBtn.addEventListener("click", function () { 3691 var defaultDeliveryFrequency = sellingPlanBtn.options[2].value; 3692 sellingPlanBtn.value = defaultDeliveryFrequency; 3693 subscriptionInfo.innerHTML = sellingPlanBtn.options[2].innerHTML; 3694 subscriptionInfo.classList.remove("hide"); 3695 var changeEvent = new Event("change"); 3696 sellingPlanBtn.dispatchEvent(changeEvent); 3697 }); 3698 } 3699 if (sellingPlanBtn) { 3700 sellingPlanBtn.addEventListener("change", function (e) { 3701 try { 3702 var lineItem = window.Rebuy.Cart.items().find(function (lineItem) { 3703 return lineItem.key === node.dataset.cartItemKey; 3704 }); 3705 var lineItemIndex = window.Rebuy.Cart.items().findIndex(function (lineItem) { 3706 return lineItem.key === node.dataset.cartItemKey; 3707 }); 3708 if (!lineItem) return; 3709 window.Rebuy.Cart.changeItem({ 3710 id: node.dataset.cartItemKey, 3711 quantity: lineItem.quantity, 3712 selling_plan: e.target.value 3713 }, { 3714 success: function success(cart) { 3715 var matchedLineItem = cart.items[lineItemIndex]; 3716 var newKey = matchedLineItem.key; 3717 node.setAttribute("data-cart-item-key", newKey); 3718 var updatedCartTotal = "$" + cart.items_subtotal_price / 100; 3719 var updatedCartCurrency = cart.currency; 3720 cartTotal.innerHTML = updatedCartTotal + " " + updatedCartCurrency; 3721 var sellingPlan = matchedLineItem === null || matchedLineItem === void 0 ? void 0 : matchedLineItem.selling_plan_allocation; 3722 if (sellingPlan) { 3723 regularPriceEl.innerHTML = "$" + sellingPlan.price / 100; 3724 compareAtPriceEl.innerHTML = "$" + sellingPlan.compare_at_price / 100; 3725 subscriptionInfo.innerHTML = sellingPlan.selling_plan.name; 3726 sellingPlanBtn.style.display = "block"; 3727 oneTimePurchaseBtn.style.display = "none"; 3728 } else { 3729 regularPriceEl.innerHTML = "$" + matchedLineItem.final_price / 100; 3730 subscriptionInfo.classList.remove("hide"); 3731 subscriptionInfo.innerHTML = ""; 3732 compareAtPriceEl.innerHTML = ""; 3733 oneTimePurchaseBtn.style.display = "block"; 3734 sellingPlanBtn.style.display = "none"; 3735 } 3736 } 3737 }); 3738 } catch (error) { 3739 console.error(error); 3740 } 3741 }); 3742 } 3743}); 3744 3745/***/ }), 3746
3747/***/ "./src/olipop/pages/contact/oli-contact-form.ts": 3748/*!******************************************************!*\ 3749 !*** ./src/olipop/pages/contact/oli-contact-form.ts ***! 3750 \******************************************************/ 3751/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3752 3753"use strict"; 3754 3755 3756Object.defineProperty(exports, "__esModule", ({ 3757 value: true 3758})); 3759exports.contactForm = void 0; 3760var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3761exports.contactForm = (0, picoapp_1.component)(function (node) { 3762 function handleSubmit(event) { 3763 event.preventDefault(); 3764 var data = new FormData(event.target); 3765 fetch("https://formspree.io/f/mleyekaw", { 3766 method: "post", 3767 body: data, 3768 headers: { 3769 Accept: "application/json" 3770 } 3771 }).then(function (response) { 3772 if (response.ok) { 3773 var formWrapper = document.querySelector(".js-contact-form-wrapper"); 3774 var formHeader = document.querySelector(".js-contact-form-header"); 3775 var successMessage = document.querySelector(".js-contact-form-success"); 3776 formWrapper.classList.add("tw-hidden"); 3777 formHeader.classList.add("tw-hidden"); 3778 successMessage.classList.remove("tw-hidden"); 3779 event.target.reset(); 3780 } else { 3781 var formErrorWrapper = document.querySelector(".js-form-error"); 3782 var formError = document.querySelector(".js-form-error > p"); 3783 formErrorWrapper.classList.remove("tw-hidden"); 3784 formError.innerHTML = "There was an error submitting your form. Please try again."; 3785 } 3786 })["catch"](function () { 3787 var formErrorWrapper = document.querySelector(".js-form-error"); 3788 var formError = document.querySelector(".js-form-error"); 3789 formErrorWrapper.classList.remove("tw-hidden"); 3790 formError.innerHTML = "There was an error submitting your form. Please try again."; 3791 }); 3792 } 3793 node.addEventListener("submit", handleSubmit); 3794 return function () { 3795 node.removeEventListener("submit", handleSubmit); 3796 }; 3797}); 3798 3799/***/ }), 3800
vendor: 4,864 bytes, lines 3801-3811
3801/***/ "./src/olipop/pages/contact/oli-malomo-form.ts": 3802/*!*****************************************************!*\ 3803 !*** ./src/olipop/pages/contact/oli-malomo-form.ts ***! 3804 \*****************************************************/ 3805/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 3806 3807"use strict"; 3808 3809 3810function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 3811function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 3811
3811 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
vendor: 6,116 bytes, lines 3811-3826
3811h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 3812function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 3813function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 3814function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } 3815function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 3816function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 3817function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 3818function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 3819var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 3820 function adopt(value) { 3821 return value instanceof P ? value : new P(function (resolve) { 3822 resolve(value); 3823 }); 3824 } 3825 return new (P || (P = Promise))(function (resolve, reject) { 3826 function fulfilled(value) {
3827 try { 3828 step(generator.next(value)); 3829 } catch (e) { 3830 reject(e); 3831 } 3832 } 3833 function rejected(value) { 3834 try { 3835 step(generator["throw"](value)); 3836 } catch (e) { 3837 reject(e); 3838 } 3839 } 3840 function step(result) { 3841 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 3842 } 3843 step((generator = generator.apply(thisArg, _arguments || [])).next()); 3844 }); 3845}; 3846Object.defineProperty(exports, "__esModule", ({ 3847 value: true 3848})); 3849exports.malomoForm = void 0; 3850var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3851var fetchMalomoTrackingURL_1 = __webpack_require__(/*! ../../utilities/fetchMalomoTrackingURL */ "./src/olipop/utilities/fetchMalomoTrackingURL.ts"); 3852exports.malomoForm = (0, picoapp_1.component)(function (node) { 3853 function handleSubmit(event) { 3854 return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 3855 var formData, baseUrl, form, formErrorWrapper, formError, _iterator, _step, _step$value, name, value, data; 3856 return _regeneratorRuntime().wrap(function _callee$(_context) { 3857 while (1) switch (_context.prev = _context.next) { 3858 case 0: 3859 event.preventDefault(); 3860 formData = new FormData(event.target); 3861 baseUrl = new URL("https://api.gomalomo.com/orders"); 3862 form = event.target; 3863 formErrorWrapper = form === null || form === void 0 ? void 0 : form.querySelector(".js-form-error"); 3864 formError = formErrorWrapper === null || formErrorWrapper === void 0 ? void 0 : formErrorWrapper.querySelector(".js-form-error > p"); 3865 _iterator = _createForOfIteratorHelper(formData.entries()); 3866 _context.prev = 7; 3867 _iterator.s(); 3868 case 9: 3869 if ((_step = _iterator.n()).done) { 3870 _context.next = 18; 3871 break; 3872 } 3873 _step$value = _slicedToArray(_step.value, 2), name = _step$value[0], value = _step$value[1]; 3874 if (value) { 3875 _context.next = 15; 3876 break; 3877 } 3878 formErrorWrapper === null || formErrorWrapper === void 0 ? void 0 : formErrorWrapper.classList.remove("tw-hidden"); 3879 formError.innerHTML = "Please fill in the fields"; 3880 return _context.abrupt("return"); 3881 case 15: 3882 if (typeof value === "string") { 3883 if (name === "number" && value.includes("#") || name === "tracking_code" && value.includes("#")) { 3884 baseUrl.searchParams.append(name, value.replace("#", "")); 3885 } else { 3886 baseUrl.searchParams.append(name, value); 3887 } 3888 } 3889 case 16: 3890 _context.next = 9; 3891 break; 3892 case 18: 3893 _context.next = 23; 3894 break; 3895 case 20: 3896 _context.prev = 20; 3897 _context.t0 = _context["catch"](7); 3898 _iterator.e(_context.t0); 3899 case 23: 3900 _context.prev = 23; 3901 _iterator.f(); 3902 return _context.finish(23); 3903 case 26: 3904 _context.prev = 26; 3905 _context.next = 29; 3906 return (0, fetchMalomoTrackingURL_1.malomoTracking)(baseUrl); 3907 case 29: 3908 data = _context.sent; 3909 if (data.url) { 3910 window.location.href = data.url; 3911 } else { 3912 formErrorWrapper === null || formErrorWrapper === void 0 ? void 0 : formErrorWrapper.classList.remove("tw-hidden"); 3913 formError.innerHTML = "There was an error in the form. Please try submitting again"; 3914 } 3915 _context.next = 36; 3916 break; 3917 case 33: 3918 _context.prev = 33; 3919 _context.t1 = _context["catch"](26); 3920 console.error(_context.t1); 3921 case 36: 3922 case "end": 3923 return _context.stop(); 3924 } 3925 }, _callee, null, [[7, 20, 23, 26], [26, 33]]); 3926 })); 3927 } 3928 var forms = node.querySelectorAll("form");
3929 forms.forEach(function (form) { 3930 return form.addEventListener("submit", handleSubmit); 3931 }); 3932}); 3933 3934/***/ }), 3935
3936/***/ "./src/olipop/pages/contact/oli-section-anchoring.ts": 3937/*!***********************************************************!*\ 3938 !*** ./src/olipop/pages/contact/oli-section-anchoring.ts ***! 3939 \***********************************************************/ 3940/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 3941 3942"use strict"; 3943 3944 3945Object.defineProperty(exports, "__esModule", ({ 3946 value: true 3947})); 3948exports.sectionAnchoring = void 0; 3949var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 3950var general_1 = __webpack_require__(/*! ../../utilities/general */ "./src/olipop/utilities/general.ts"); 3951exports.sectionAnchoring = (0, picoapp_1.component)(function (node) { 3952 var anchorSectionName = node.dataset.anchorSection; 3953 var anchorIndex = node.dataset.anchorIndex; 3954 if (!anchorIndex || !anchorSectionName) return; 3955 var sectionElement = document.querySelectorAll(".shopify-section" + ".section-".concat(anchorSectionName)); 3956 var setScrollMargin = function setScrollMargin() { 3957 sectionElement[parseInt(anchorIndex)].style.scrollMarginTop = "".concat((0, general_1.getHeaderHeights)(), "px"); 3958 document.documentElement.style.scrollBehavior = "smooth"; 3959 }; 3960 if (sectionElement) { 3961 var anchorSectionElement = sectionElement[parseInt(anchorIndex)]; 3962 node.href = "#" + anchorSectionElement.id; 3963 node.addEventListener("click", setScrollMargin); 3964 } 3965 return function () { 3966 if (sectionElement) { 3967 node.removeEventListener("click", setScrollMargin); 3968 } 3969 }; 3970}); 3971 3972/***/ }), 3973
vendor: 6,077 bytes, lines 3974-3990
3974/***/ "./src/olipop/pages/customers/customer-addresses.ts": 3975/*!**********************************************************!*\ 3976 !*** ./src/olipop/pages/customers/customer-addresses.ts ***! 3977 \**********************************************************/ 3978/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 3979 3980"use strict"; 3981 3982 3983function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 3984function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 3985function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 3986function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 3987function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 3988function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 3989function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 3990function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 3990
3990 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
3990h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 3991var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 3992 function adopt(value) { 3993 return value instanceof P ? value : new P(function (resolve) { 3994 resolve(value); 3995 }); 3996 } 3997 return new (P || (P = Promise))(function (resolve, reject) { 3998 function fulfilled(value) { 3999 try { 4000 step(generator.next(value)); 4001 } catch (e) { 4002 reject(e); 4003 } 4004 } 4005 function rejected(value) { 4006 try { 4007 step(generator["throw"](value)); 4008 } catch (e) { 4009 reject(e); 4010 } 4011 } 4012 function step(result) { 4013 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4014 } 4015 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4016 }); 4017}; 4018Object.defineProperty(exports, "__esModule", ({ 4019 value: true 4020})); 4021exports.customerAddresses = void 0; 4022var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 4023var COUNTRY_INPUT_SELECTOR = "[name='address[country]']"; 4024var PROVINCE_INPUT_SELECTOR = "[name='address[province]']"; 4025exports.customerAddresses = (0, picoapp_1.component)(function (node) { 4026 var provinceMap = new Map(); 4027 var addAddressToggleButtons = node.querySelectorAll("[data-add-address-toggle] button"); 4028 var editAddressToggleButtons = node.querySelectorAll("[data-edit-address-toggle] button"); 4029 var newAddressForm = node.querySelector("#address_form_new"); 4030 var newAddressContainer = node.querySelector("[data-new-address]"); 4031 var addresses = node.querySelector("[data-addresses]"); 4032 var paginationContainer = node.querySelector("[data-pagination]"); 4033 var toggleAddAddressForm = function toggleAddAddressForm() { 4034 newAddressContainer.classList.toggle("tw-hidden"); 4035 addresses.classList.toggle("tw-hidden"); 4036 paginationContainer.classList.toggle("tw-hidden"); 4037 if (!newAddressContainer.classList.contains("tw-hidden")) { 4038 addProvinces(newAddressForm); 4039 } 4040 }; 4041 var toggleEditAddressForm = function toggleEditAddressForm(e) { 4042 var _a; 4043 var addressId = (_a = e.target.closest("[data-edit-address-toggle]")) === null || _a === void 0 ? void 0 : _a.dataset.editAddressToggle; 4044 var addressContainer = node.querySelector("[data-address-id=\"".concat(addressId, "\"]")); 4045 addressContainer.classList.toggle("tw-hidden"); 4046 addresses.classList.toggle("tw-hidden"); 4047 paginationContainer.classList.toggle("tw-hidden"); 4048 if (!addressContainer.classList.contains("tw-hidden")) { 4049 var form = addressContainer.querySelector("form"); 4050 addProvinces(form); 4051 } 4052 }; 4053 var addProvinces = function addProvinces(form) { 4054 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4055 var countrySelect, provinceSelect, provinceContainer, zipContainer, selectedCountry, provinces, provincesData, currentOption; 4056 return _regeneratorRuntime().wrap(function _callee$(_context) { 4057 while (1) switch (_context.prev = _context.next) { 4058 case 0: 4059 countrySelect = form.querySelector(COUNTRY_INPUT_SELECTOR); 4060 provinceSelect = form.querySelector(PROVINCE_INPUT_SELECTOR); 4061 provinceContainer = form.querySelector("[data-province-container]"); 4062 zipContainer = form.querySelector("[data-zip-container]"); 4063 selectedCountry = countrySelect.options[countrySelect.selectedIndex]; 4064 provinces = provinceMap.get(selectedCountry.value); 4065 if (provinces) { 4066 _context.next = 14; 4067 break; 4068 } 4069 provincesData = selectedCountry.dataset.provinces; 4070 if (provincesData) { 4071 _context.next = 10; 4072 break; 4073 } 4074 return _context.abrupt("return"); 4075 case 10: 4076 _context.next = 12; 4077 return JSON.parse(provincesData); 4078 case 12: 4079 provinces = _context.sent; 4080 provinceMap.set(countrySelect.value, provinces); 4081 case 14: 4082 if (!provinces || !provinces.length) { 4083 // Selected Country has no province 4084 provinceContainer.classList.add("tw-hidden"); 4085 zipContainer.classList.replace("tw-col-span-1", "tw-col-span-2"); 4086 } else { 4087 // Add provinces from currently selected country 4088 provinceContainer.classList.remove("tw-hidden"); 4089 // Empty province select options 4090 provinceSelect.innerHTML = ""; 4091 zipContainer.classList.replace("tw-col-span-2", "tw-col-span-1"); 4092 currentOption = provinceSelect.dataset["default"];
4093 provinces.forEach(function (subProvinces) { 4094 var province = subProvinces[subProvinces.length - 1]; 4095 var provinceOption = document.createElement("option"); 4096 provinceOption.value = province; 4097 provinceOption.innerHTML = province; 4098 if (currentOption === province) provinceOption.selected = true; 4099 provinceSelect.appendChild(provinceOption); 4100 }); 4101 } 4102 case 15: 4103 case "end": 4104 return _context.stop(); 4105 } 4106 }, _callee); 4107 })); 4108 }; 4109 var changeProvinces = function changeProvinces(e) { 4110 var countrySelector = e.currentTarget; 4111 addProvinces(countrySelector.form); 4112 }; 4113 _toConsumableArray(addAddressToggleButtons).forEach(function (button) { 4114 button.addEventListener("click", toggleAddAddressForm); 4115 }); 4116 _toConsumableArray(editAddressToggleButtons).forEach(function (button) { 4117 button.addEventListener("click", toggleEditAddressForm); 4118 }); 4119 node.querySelectorAll(COUNTRY_INPUT_SELECTOR).forEach(function (select) { 4120 select.addEventListener("change", changeProvinces); 4121 var selectedCountry = select.dataset["default"]; 4122 if (selectedCountry) { 4123 for (var i = 0, count = select.options.length; i < count; i++) { 4124 var option = select.options[i]; 4125 if (selectedCountry === option.value || selectedCountry === option.innerHTML) { 4126 select.selectedIndex = i; 4127 } 4128 } 4129 } 4130 }); 4131 return function () { 4132 _toConsumableArray(addAddressToggleButtons).forEach(function (button) { 4133 button.removeEventListener("click", toggleAddAddressForm); 4134 }); 4135 _toConsumableArray(editAddressToggleButtons).forEach(function (button) { 4136 button.removeEventListener("click", toggleEditAddressForm); 4137 }); 4138 node.querySelectorAll(COUNTRY_INPUT_SELECTOR).forEach(function (select) { 4139 select.removeEventListener("change", changeProvinces); 4140 }); 4141 }; 4142}); 4143 4144/***/ }), 4145
vendor: 4,872 bytes, lines 4146-4156
4146/***/ "./src/olipop/pages/customers/oli-malomo-link.ts": 4147/*!*******************************************************!*\ 4148 !*** ./src/olipop/pages/customers/oli-malomo-link.ts ***! 4149 \*******************************************************/ 4150/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 4151 4152"use strict"; 4153 4154 4155function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4156function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,189 bytes, lines 4156-4192
4156 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4157var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4158 function adopt(value) { 4159 return value instanceof P ? value : new P(function (resolve) { 4160 resolve(value); 4161 }); 4162 } 4163 return new (P || (P = Promise))(function (resolve, reject) { 4164 function fulfilled(value) { 4165 try { 4166 step(generator.next(value)); 4167 } catch (e) { 4168 reject(e); 4169 } 4170 } 4171 function rejected(value) { 4172 try { 4173 step(generator["throw"](value)); 4174 } catch (e) { 4175 reject(e); 4176 } 4177 } 4178 function step(result) { 4179 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4180 } 4181 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4182 }); 4183}; 4184Object.defineProperty(exports, "__esModule", ({ 4185 value: true 4186})); 4187exports.malomoLink = void 0; 4188var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 4189var fetchMalomoTrackingURL_1 = __webpack_require__(/*! ../../utilities/fetchMalomoTrackingURL */ "./src/olipop/utilities/fetchMalomoTrackingURL.ts"); 4190exports.malomoLink = (0, picoapp_1.component)(function (node) { 4191 function handleClick(e) { 4192 return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4193 var orderNumber, customerEmail, baseUrl, data; 4194 return _regeneratorRuntime().wrap(function _callee$(_context) { 4195 while (1) switch (_context.prev = _context.next) { 4196 case 0: 4197 e.preventDefault(); 4198 orderNumber = node.dataset.orderNumber; 4199 customerEmail = node.dataset.customerEmail; 4200 baseUrl = new URL("https://api.gomalomo.com/orders"); 4201 baseUrl.searchParams.append("number", orderNumber); 4202 baseUrl.searchParams.append("customer_email", customerEmail); 4203 _context.prev = 6; 4204 _context.next = 9; 4205 return (0, fetchMalomoTrackingURL_1.malomoTracking)(baseUrl); 4206 case 9: 4207 data = _context.sent; 4208 if (data.url) { 4209 window.open(data.url, "_blank"); 4210 } 4211 _context.next = 16; 4212 break; 4213 case 13: 4214 _context.prev = 13; 4215 _context.t0 = _context["catch"](6); 4216 console.error(_context.t0); 4217 case 16: 4218 case "end": 4219 return _context.stop(); 4220 } 4221 }, _callee, null, [[6, 13]]); 4222 })); 4223 } 4224 var trackingAnchorButton = node.querySelector("a"); 4225 trackingAnchorButton.addEventListener("click", handleClick); 4226}); 4227 4228/***/ }), 4229
4230/***/ "./src/olipop/pages/index.ts": 4231/*!***********************************!*\ 4232 !*** ./src/olipop/pages/index.ts ***! 4233 \***********************************/ 4234/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 4235 4236"use strict"; 4237 4238 4239Object.defineProperty(exports, "__esModule", ({ 4240 value: true 4241})); 4242exports.malomoLink = exports.malomoForm = exports.jobsBoard = exports.customerAddresses = exports.contactForm = exports.sectionAnchoring = exports.cartSubscriptionSelector = exports.camilaGalleryVideo = exports.camilaGallery = exports.camilaProductForm = exports.camilaSelect = void 0; 4243var oli_camila_select_1 = __webpack_require__(/*! ./camila/oli-camila-select */ "./src/olipop/pages/camila/oli-camila-select.ts"); 4244Object.defineProperty(exports, "camilaSelect", ({ 4245 enumerable: true, 4246 get: function get() { 4247 return oli_camila_select_1.camilaSelect; 4248 } 4249})); 4250var oli_camila_product_form_1 = __webpack_require__(/*! ./camila/oli-camila-product-form */ "./src/olipop/pages/camila/oli-camila-product-form.ts"); 4251Object.defineProperty(exports, "camilaProductForm", ({ 4252 enumerable: true, 4253 get: function get() { 4254 return oli_camila_product_form_1.camilaProductForm; 4255 } 4256})); 4257var oli_camila_gallery_1 = __webpack_require__(/*! ./camila/oli-camila-gallery */ "./src/olipop/pages/camila/oli-camila-gallery.ts"); 4258Object.defineProperty(exports, "camilaGallery", ({ 4259 enumerable: true, 4260 get: function get() { 4261 return oli_camila_gallery_1.camilaGallery; 4262 } 4263})); 4264Object.defineProperty(exports, "camilaGalleryVideo", ({ 4265 enumerable: true, 4266 get: function get() { 4267 return oli_camila_gallery_1.camilaGalleryVideo; 4268 } 4269})); 4270var oli_cart_subscription_selector_1 = __webpack_require__(/*! ./cart/oli-cart-subscription-selector */ "./src/olipop/pages/cart/oli-cart-subscription-selector.ts"); 4271Object.defineProperty(exports, "cartSubscriptionSelector", ({ 4272 enumerable: true, 4273 get: function get() { 4274 return oli_cart_subscription_selector_1.cartSubscriptionSelector; 4275 } 4276})); 4277var oli_section_anchoring_1 = __webpack_require__(/*! ./contact/oli-section-anchoring */ "./src/olipop/pages/contact/oli-section-anchoring.ts"); 4278Object.defineProperty(exports, "sectionAnchoring", ({ 4279 enumerable: true, 4280 get: function get() { 4281 return oli_section_anchoring_1.sectionAnchoring; 4282 } 4283})); 4284var oli_contact_form_1 = __webpack_require__(/*! ./contact/oli-contact-form */ "./src/olipop/pages/contact/oli-contact-form.ts"); 4285Object.defineProperty(exports, "contactForm", ({ 4286 enumerable: true, 4287 get: function get() { 4288 return oli_contact_form_1.contactForm; 4289 } 4290})); 4291var customer_addresses_1 = __webpack_require__(/*! ./customers/customer-addresses */ "./src/olipop/pages/customers/customer-addresses.ts"); 4292Object.defineProperty(exports, "customerAddresses", ({ 4293 enumerable: true, 4294 get: function get() { 4295 return customer_addresses_1.customerAddresses; 4296 } 4297})); 4298var jobs_board_1 = __webpack_require__(/*! ./jobs/jobs-board */ "./src/olipop/pages/jobs/jobs-board.ts"); 4299Object.defineProperty(exports, "jobsBoard", ({ 4300 enumerable: true, 4301 get: function get() { 4302 return jobs_board_1.jobsBoard; 4303 } 4304})); 4305var oli_malomo_form_1 = __webpack_require__(/*! ./contact/oli-malomo-form */ "./src/olipop/pages/contact/oli-malomo-form.ts"); 4306Object.defineProperty(exports, "malomoForm", ({ 4307 enumerable: true, 4308 get: function get() { 4309 return oli_malomo_form_1.malomoForm; 4310 } 4311})); 4312var oli_malomo_link_1 = __webpack_require__(/*! ./customers/oli-malomo-link */ "./src/olipop/pages/customers/oli-malomo-link.ts"); 4313Object.defineProperty(exports, "malomoLink", ({ 4314 enumerable: true, 4315 get: function get() { 4316 return oli_malomo_link_1.malomoLink; 4317 } 4318})); 4319 4320/***/ }), 4321
vendor: 4,832 bytes, lines 4322-4332
4322/***/ "./src/olipop/pages/jobs/jobs-board.ts": 4323/*!*********************************************!*\ 4324 !*** ./src/olipop/pages/jobs/jobs-board.ts ***! 4325 \*********************************************/ 4326/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 4327 4328"use strict"; 4329 4330 4331function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4332function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 10,758 bytes, lines 4332-4395
4332 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4333var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4334 function adopt(value) { 4335 return value instanceof P ? value : new P(function (resolve) { 4336 resolve(value); 4337 }); 4338 } 4339 return new (P || (P = Promise))(function (resolve, reject) { 4340 function fulfilled(value) { 4341 try { 4342 step(generator.next(value)); 4343 } catch (e) { 4344 reject(e); 4345 } 4346 } 4347 function rejected(value) { 4348 try { 4349 step(generator["throw"](value)); 4350 } catch (e) { 4351 reject(e); 4352 } 4353 } 4354 function step(result) { 4355 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4356 } 4357 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4358 }); 4359}; 4360Object.defineProperty(exports, "__esModule", ({ 4361 value: true 4362})); 4363exports.jobsBoard = void 0; 4364var picoapp_1 = __webpack_require__(/*! picoapp */ "./node_modules/picoapp/dist/picoapp.es.js"); 4365var greenhouse_1 = __webpack_require__(/*! ../../utilities/greenhouse */ "./src/olipop/utilities/greenhouse.ts"); 4366exports.jobsBoard = (0, picoapp_1.component)(function (node) { 4367 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4368 var BOARD_TOKEN, _yield, jobs, categorizedJobs, jobCategories, jobsHTMLText; 4369 return _regeneratorRuntime().wrap(function _callee$(_context) { 4370 while (1) switch (_context.prev = _context.next) { 4371 case 0: 4372 BOARD_TOKEN = node.dataset.boardToken; 4373 _context.next = 3; 4374 return (0, greenhouse_1.fetchJobs)(BOARD_TOKEN); 4375 case 3: 4376 _yield = _context.sent; 4377 jobs = _yield.jobs; 4378 categorizedJobs = (0, greenhouse_1.partitionJobs)(jobs); 4379 jobCategories = Object.keys(categorizedJobs).sort(); 4380 jobsHTMLText = jobCategories.reduce(function (htmlText, category) { 4381 return "\n ".concat(htmlText, "\n <div class=\"tw-mb-10\">\n <h4 class='tw-text-black md:tw-text-3xl tw-text-2xl tw-mb-6 tw-font-bold'>").concat(category, "</h4>\n <ul aria-label='jobs for ").concat(category, "'>\n ").concat(categorizedJobs[category].reduce(function (_htmlText, job) { 4382 return "\n ".concat(_htmlText, "\n <li class='md:tw-mb-5 tw-mb-4'>\n <a class=\"tw-text-hunter-green tw-font-bold md:tw-text-2xl tw-text-xl\" href=\"").concat(job.absolute_url, "\">").concat(job.title, "</a>\n <p class=\"tw-text-gray-500 md:tw-text-xl tw-text-lg\">").concat(job.location.name, "</p>\n </li>\n "); 4383 }, ""), "\n </ul>\n </div>\n "); 4384 }, ""); 4385 node.innerHTML = jobsHTMLText; 4386 case 9: 4387 case "end": 4388 return _context.stop(); 4389 } 4390 }, _callee); 4391 })); 4392}); 4393 4394/***/ }), 4395
4396/***/ "./src/olipop/pages/pdp-sticky-layout.ts": 4397/*!***********************************************!*\ 4398 !*** ./src/olipop/pages/pdp-sticky-layout.ts ***! 4399 \***********************************************/ 4400/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 4401 4402"use strict"; 4403 4404 4405Object.defineProperty(exports, "__esModule", ({ 4406 value: true 4407})); 4408exports.initPdpStickyLayout = void 0; 4409var constants_1 = __webpack_require__(/*! ../components/Barba/Views/constants */ "./src/olipop/components/Barba/Views/constants.ts"); 4410var LG_MIN = 1024; 4411function isPdpContext() { 4412 return document.body.classList.contains("template-product") || document.querySelector("[data-barba-namespace='product']") != null; 4413} 4414function syncBuyboxStickyTopCssVar() { 4415 var _a, _b; 4416 if (!isPdpContext()) { 4417 document.documentElement.style.removeProperty("--pdp-buybox-sticky-top"); 4418 return; 4419 } 4420 if (window.innerWidth < LG_MIN) { 4421 document.documentElement.style.removeProperty("--pdp-buybox-sticky-top"); 4422 return; 4423 } 4424 var header = document.querySelector("#shopify-section-header") || document.querySelector("header");
4425 var ann = document.querySelector(".section-announcement-bar"); 4426 var offset = ((_a = header === null || header === void 0 ? void 0 : header.offsetHeight) !== null && _a !== void 0 ? _a : 64) + ((_b = ann === null || ann === void 0 ? void 0 : ann.offsetHeight) !== null && _b !== void 0 ? _b : 0); 4427 document.documentElement.style.setProperty("--pdp-buybox-sticky-top", "".concat(offset, "px")); 4428} 4429var listenersWired = false; 4430function ensurePdpStickyListeners() { 4431 if (listenersWired) return; 4432 listenersWired = true; 4433 window.addEventListener("resize", syncBuyboxStickyTopCssVar); 4434 window.addEventListener(constants_1.TRANSITION_PRODUCT_VIEW_AFTER, syncBuyboxStickyTopCssVar); 4435} 4436/** Safe to call on every mount: syncs CSS var and wires resize/transition once. */ 4437function initPdpStickyLayout() { 4438 ensurePdpStickyListeners(); 4439 syncBuyboxStickyTopCssVar(); 4440} 4441exports.initPdpStickyLayout = initPdpStickyLayout; 4442 4443/***/ }), 4444
vendor: 4,783 bytes, lines 4445-4455
4445/***/ "./src/olipop/utilities/cart.ts": 4446/*!**************************************!*\ 4447 !*** ./src/olipop/utilities/cart.ts ***! 4448 \**************************************/ 4449/***/ (function(__unused_webpack_module, exports) { 4450 4451"use strict"; 4452 4453 4454function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4455function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 4,708 bytes, line 4455
4455 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEac
4455h(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4456var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4457 function adopt(value) { 4458 return value instanceof P ? value : new P(function (resolve) { 4459 resolve(value); 4460 }); 4461 } 4462 return new (P || (P = Promise))(function (resolve, reject) { 4463 function fulfilled(value) { 4464 try { 4465 step(generator.next(value)); 4466 } catch (e) { 4467 reject(e); 4468 } 4469 } 4470 function rejected(value) { 4471 try { 4472 step(generator["throw"](value)); 4473 } catch (e) { 4474 reject(e); 4475 } 4476 } 4477 function step(result) { 4478 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4479 } 4480 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4481 }); 4482}; 4483Object.defineProperty(exports, "__esModule", ({ 4484 value: true 4485})); 4486exports.ajaxCartUpdate = exports.ajaxCartChange = exports.ajaxCartAdd = void 0; 4487var ajaxCartAdd = function ajaxCartAdd(cartItems) { 4488 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4489 var response; 4490 return _regeneratorRuntime().wrap(function _callee$(_context) { 4491 while (1) switch (_context.prev = _context.next) { 4492 case 0: 4493 _context.prev = 0; 4494 _context.next = 3; 4495 return fetch("/cart/add.js", { 4496 method: "POST", 4497 headers: { 4498 "Content-Type": "application/json" 4499 }, 4500 body: JSON.stringify({ 4501 items: cartItems 4502 }) 4503 }); 4504 case 3: 4505 response = _context.sent; 4506 return _context.abrupt("return", response.json()); 4507 case 7: 4508 _context.prev = 7; 4509 _context.t0 = _context["catch"](0); 4510 console.error(_context.t0); 4511 case 10: 4512 case "end": 4513 return _context.stop(); 4514 } 4515 }, _callee, null, [[0, 7]]); 4516 })); 4517}; 4518exports.ajaxCartAdd = ajaxCartAdd; 4519var ajaxCartChange = function ajaxCartChange(item) { 4520 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 4521 var response; 4522 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 4523 while (1) switch (_context2.prev = _context2.next) { 4524 case 0: 4525 _context2.prev = 0; 4526 _context2.next = 3; 4527 return fetch("/cart/change.js", { 4528 method: "POST", 4529 headers: { 4530 "Content-Type": "application/json" 4531 }, 4532 body: JSON.stringify(item) 4533 }); 4534 case 3: 4535 response = _context2.sent; 4536 return _context2.abrupt("return", response.json()); 4537 case 7: 4538 _context2.prev = 7; 4539 _context2.t0 = _context2["catch"](0); 4540 console.error(_context2.t0); 4541 case 10: 4542 case "end": 4543 return _context2.stop(); 4544 } 4545 }, _callee2, null, [[0, 7]]); 4546 })); 4547}; 4548exports.ajaxCartChange = ajaxCartChange; 4549var ajaxCartUpdate = function ajaxCartUpdate(updates) { 4550 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { 4551 var response; 4552 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 4553 while (1) switch (_context3.prev = _context3.next) { 4554 case 0: 4555 _context3.prev = 0; 4556 _context3.next = 3; 4557 return fetch("/cart/update.js", { 4558 method: "POST", 4559 headers: { 4560 "Content-Type": "application/json" 4561 }, 4562 body: JSON.stringify({ 4563 updates: updates 4564 }) 4565 }); 4566 case 3: 4567 response = _context3.sent; 4568 return _context3.abrupt("return", response.json()); 4569 case 7: 4570 _context3.prev = 7; 4571 _context3.t0 = _context3["catch"](0); 4572 console.error(_context3.t0); 4573 case 10: 4574 case "end": 4575 return _context3.stop(); 4576 } 4577 }, _callee3, null, [[0, 7]]); 4578 })); 4579}; 4580exports.ajaxCartUpdate = ajaxCartUpdate; 4581 4582/***/ }), 4583
4584/***/ "./src/olipop/utilities/constants.ts": 4585/*!*******************************************!*\ 4586 !*** ./src/olipop/utilities/constants.ts ***! 4587 \*******************************************/ 4588/***/ ((__unused_webpack_module, exports) => { 4589 4590"use strict"; 4591 4592 4593Object.defineProperty(exports, "__esModule", ({ 4594 value: true 4595})); 4596exports.STOREFRONT_ACCESS_TOKEN = exports.STOREFRONT_API_URL = void 0; 4597exports.STOREFRONT_API_URL = "/api/2024-07/graphql.json"; 4598exports.STOREFRONT_ACCESS_TOKEN = "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"; 4599 4600/***/ }), 4601
vendor: 4,855 bytes, lines 4602-4612
4602/***/ "./src/olipop/utilities/fetchMalomoTrackingURL.ts": 4603/*!********************************************************!*\ 4604 !*** ./src/olipop/utilities/fetchMalomoTrackingURL.ts ***! 4605 \********************************************************/ 4606/***/ (function(__unused_webpack_module, exports) { 4607 4608"use strict"; 4609 4610 4611function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4612function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,920 bytes, lines 4612-4681
4612 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4613var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4614 function adopt(value) { 4615 return value instanceof P ? value : new P(function (resolve) { 4616 resolve(value); 4617 }); 4618 } 4619 return new (P || (P = Promise))(function (resolve, reject) { 4620 function fulfilled(value) { 4621 try { 4622 step(generator.next(value)); 4623 } catch (e) { 4624 reject(e); 4625 } 4626 } 4627 function rejected(value) { 4628 try { 4629 step(generator["throw"](value)); 4630 } catch (e) { 4631 reject(e); 4632 } 4633 } 4634 function step(result) { 4635 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4636 } 4637 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4638 }); 4639}; 4640Object.defineProperty(exports, "__esModule", ({ 4641 value: true 4642})); 4643exports.malomoTracking = void 0; 4644var malomoTracking = function malomoTracking(url) { 4645 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4646 var bearerToken, headers, response, data; 4647 return _regeneratorRuntime().wrap(function _callee$(_context) { 4648 while (1) switch (_context.prev = _context.next) { 4649 case 0: 4650 bearerToken = "Bearer " + ""; 4651 headers = { 4652 Authorization: bearerToken, 4653 Accept: "application/vnd.malomo+json; version=2" 4654 }; 4655 _context.prev = 2; 4656 _context.next = 5; 4657 return fetch(url, { 4658 headers: headers 4659 }); 4660 case 5: 4661 response = _context.sent; 4662 _context.next = 8; 4663 return response.json(); 4664 case 8: 4665 data = _context.sent; 4666 return _context.abrupt("return", data); 4667 case 12: 4668 _context.prev = 12; 4669 _context.t0 = _context["catch"](2); 4670 console.error(_context.t0); 4671 case 15: 4672 case "end": 4673 return _context.stop(); 4674 } 4675 }, _callee, null, [[2, 12]]); 4676 })); 4677}; 4678exports.malomoTracking = malomoTracking; 4679 4680/***/ }), 4681
4682/***/ "./src/olipop/utilities/general.ts": 4683/*!*****************************************!*\ 4684 !*** ./src/olipop/utilities/general.ts ***! 4685 \*****************************************/ 4686/***/ ((__unused_webpack_module, exports) => { 4687 4688"use strict"; 4689 4690 4691Object.defineProperty(exports, "__esModule", ({ 4692 value: true 4693})); 4694exports.getHeaderHeights = exports.parseSectionDom = exports.getShopifySectionRenderUrl = exports.formatMoney = exports.getFullyQualifiedUrl = exports.formatFullyQualifiedUrl = exports.generateUUID = void 0; 4695/** 4696 * @returns v4 UUID (https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID) 4697 */ 4698var generateUUID = function generateUUID() { 4699 var _a; 4700 var uuid = (_a = self === null || self === void 0 ? void 0 : self.crypto) === null || _a === void 0 ? void 0 : _a.randomUUID(); 4701 return uuid !== null && uuid !== void 0 ? uuid : "".concat(new Date().valueOf()); 4702}; 4703exports.generateUUID = generateUUID; 4704var formatFullyQualifiedUrl = function formatFullyQualifiedUrl(url) { 4705 if (url.startsWith(location.protocol)) { 4706 return url; 4707 } 4708 return "".concat(location.protocol).concat(url); 4709}; 4710exports.formatFullyQualifiedUrl = formatFullyQualifiedUrl; 4711var getFullyQualifiedUrl = function getFullyQualifiedUrl(url) { 4712 if (!url) return null; 4713 return new URL((0, exports.formatFullyQualifiedUrl)(url)); 4714}; 4715exports.getFullyQualifiedUrl = getFullyQualifiedUrl; 4716// eslint-disable-next-line no-template-curly-in-string 4717function formatMoney(cents) { 4718 var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "${{amount}}"; 4719 if (typeof cents === "string") { 4720 cents = cents.replace(".", ""); 4721 } 4722 var value = ""; 4723 var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/; 4724 function formatWithDelimiters(number, precision, thousands, decimal) { 4725 var p = precision; 4726 precision = precision || 2; 4727 thousands = thousands || ","; 4728 decimal = decimal || "."; 4729 if (isNaN(number) || number === null) { 4730 return 0; 4731 } 4732 number = (number / 100.0).toFixed(precision); 4733 var parts = number.split("."); 4734 var dollarsAmount = parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + thousands); 4735 var centsAmount = parts[1] ? decimal + parts[1] : ""; 4736 if (p === 0) { 4737 return dollarsAmount; 4738 } else { 4739 return dollarsAmount + centsAmount; 4740 } 4741 } 4742 switch (format.match(placeholderRegex)[1]) { 4743 case "amount": 4744 value = formatWithDelimiters(cents, 2); 4745 break; 4746 case "amount_no_decimals": 4747 value = formatWithDelimiters(cents, 0); 4748 break; 4749 case "amount_with_space_separator": 4750 value = formatWithDelimiters(cents, 2, " ", "."); 4751 break; 4752 case "amount_no_decimals_with_comma_separator": 4753 value = formatWithDelimiters(cents, 0, ",", "."); 4754 break; 4755 case "amount_no_decimals_with_space_separator": 4756 value = formatWithDelimiters(cents, 0, " "); 4757 break; 4758 case "amount_no_trailing_zeroes": 4759 value = formatWithDelimiters(cents, 2).replace(".00", ""); 4760 break; 4761 } 4762 return format.replace(placeholderRegex, value); 4763} 4764exports.formatMoney = formatMoney; 4765var getShopifySectionRenderUrl = function getShopifySectionRenderUrl(sectionId, productHandle) { 4766 var path = productHandle ? "/products/".concat(productHandle) : window.location.pathname; 4767 var url = new URL("".concat(window.location.origin).concat(path)); 4768 url.searchParams.append("sections", sectionId); 4769 return url; 4770}; 4771exports.getShopifySectionRenderUrl = getShopifySectionRenderUrl; 4772var parseSectionDom = function parseSectionDom(sectionString, sectionId) { 4773 var parser = new DOMParser(); 4774 var _parser$parseFromStri = parser.parseFromString(sectionString, "text/html"), 4775 body = _parser$parseFromStri.body; 4776 var sectionHTML = body.querySelector("#shopify-section-".concat(sectionId)); 4777 return sectionHTML; 4778}; 4779exports.parseSectionDom = parseSectionDom; 4780var getHeaderHeights = function getHeaderHeights() { 4781 var navBar = document.querySelector(".site-header"); 4782 var navBarHeight = navBar ? navBar.clientHeight : 0; 4783 var stickyBar = document.querySelector(".section-announcement-bar"); 4784 var stickyBarHeight = stickyBar ? stickyBar.clientHeight : 0; 4785 var heightsTotal = navBarHeight + stickyBarHeight; 4786 return heightsTotal; 4787}; 4788exports.getHeaderHeights = getHeaderHeights; 4789 4790/***/ }), 4791
vendor: 6,000 bytes, lines 4792-4808
4792/***/ "./src/olipop/utilities/greenhouse.ts": 4793/*!********************************************!*\ 4794 !*** ./src/olipop/utilities/greenhouse.ts ***! 4795 \********************************************/ 4796/***/ (function(__unused_webpack_module, exports) { 4797 4798"use strict"; 4799 4800 4801function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4802function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 4803function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 4804function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 4805function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 4806function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 4807function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 4808function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,146 bytes, lines 4808-4847
4808 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4809var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4810 function adopt(value) { 4811 return value instanceof P ? value : new P(function (resolve) { 4812 resolve(value); 4813 }); 4814 } 4815 return new (P || (P = Promise))(function (resolve, reject) { 4816 function fulfilled(value) { 4817 try { 4818 step(generator.next(value)); 4819 } catch (e) { 4820 reject(e); 4821 } 4822 } 4823 function rejected(value) { 4824 try { 4825 step(generator["throw"](value)); 4826 } catch (e) { 4827 reject(e); 4828 } 4829 } 4830 function step(result) { 4831 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4832 } 4833 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4834 }); 4835}; 4836Object.defineProperty(exports, "__esModule", ({ 4837 value: true 4838})); 4839exports.partitionJobs = exports.fetchJobs = void 0; 4840var fetchJobs = function fetchJobs(BOARD_TOKEN) { 4841 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4842 var data, jobsList; 4843 return _regeneratorRuntime().wrap(function _callee$(_context) { 4844 while (1) switch (_context.prev = _context.next) { 4845 case 0: 4846 _context.prev = 0; 4847 _context.next = 3;
4848 return fetch("https://boards-api.greenhouse.io/v1/boards/".concat(BOARD_TOKEN, "/jobs?content=true")); 4849 case 3: 4850 data = _context.sent; 4851 _context.next = 6; 4852 return data.json(); 4853 case 6: 4854 jobsList = _context.sent; 4855 return _context.abrupt("return", jobsList); 4856 case 10: 4857 _context.prev = 10; 4858 _context.t0 = _context["catch"](0); 4859 console.error(_context.t0); 4860 case 13: 4861 case "end": 4862 return _context.stop(); 4863 } 4864 }, _callee, null, [[0, 10]]); 4865 })); 4866}; 4867exports.fetchJobs = fetchJobs; 4868var partitionJobs = function partitionJobs(jobs) { 4869 var categorizedJobs = jobs.reduce(function (jobsMap, job) { 4870 var departments = job.departments; 4871 departments.forEach(function (department) { 4872 jobsMap[department.name] = [].concat(_toConsumableArray(jobsMap[department.name] || []), [job]); 4873 }); 4874 return jobsMap; 4875 }, {}); 4876 return categorizedJobs; 4877}; 4878exports.partitionJobs = partitionJobs; 4879 4880/***/ }), 4881
vendor: 4,816 bytes, lines 4882-4892
4882/***/ "./src/olipop/utilities/product.ts": 4883/*!*****************************************!*\ 4884 !*** ./src/olipop/utilities/product.ts ***! 4885 \*****************************************/ 4886/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 4887 4888"use strict"; 4889 4890 4891function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4892function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,014 bytes, lines 4892-4928
4892 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 4893var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { 4894 function adopt(value) { 4895 return value instanceof P ? value : new P(function (resolve) { 4896 resolve(value); 4897 }); 4898 } 4899 return new (P || (P = Promise))(function (resolve, reject) { 4900 function fulfilled(value) { 4901 try { 4902 step(generator.next(value)); 4903 } catch (e) { 4904 reject(e); 4905 } 4906 } 4907 function rejected(value) { 4908 try { 4909 step(generator["throw"](value)); 4910 } catch (e) { 4911 reject(e); 4912 } 4913 } 4914 function step(result) { 4915 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 4916 } 4917 step((generator = generator.apply(thisArg, _arguments || [])).next()); 4918 }); 4919}; 4920var __importDefault = this && this.__importDefault || function (mod) { 4921 return mod && mod.__esModule ? mod : { 4922 "default": mod 4923 }; 4924}; 4925Object.defineProperty(exports, "__esModule", ({ 4926 value: true 4927})); 4928exports.getProductSellingPlanAllocation = exports.getProductSellingPlans = exports.fetchProduct = exports.getSellingPlanID = exports.getProductVariantID = exp
4928orts.getProductID = void 0; 4929var product_graphql_1 = __importDefault(__webpack_require__(/*! ../graphql/product.graphql */ "./src/olipop/graphql/product.graphql")); 4930var __1 = __importDefault(__webpack_require__(/*! ../ */ "./src/olipop/index.ts")); 4931var constants_1 = __webpack_require__(/*! ./constants */ "./src/olipop/utilities/constants.ts"); 4932/** 4933 * Get scalar ID https://shopify.dev/docs/api/storefront/2023-01/scalars/ID from product ID integer 4934 * Example Value: "gid://shopify/Product/10079785100" 4935 */ 4936var getProductID = function getProductID(id) { 4937 if (!id) return null; 4938 return "gid://shopify/Product/".concat(id); 4939}; 4940exports.getProductID = getProductID; 4941var getProductVariantID = function getProductVariantID(id) { 4942 if (!id) return null; 4943 return "gid://shopify/ProductVariant/".concat(id); 4944}; 4945exports.getProductVariantID = getProductVariantID; 4946var getSellingPlanID = function getSellingPlanID(id) { 4947 if (!id) return null; 4948 return "gid://shopify/SellingPlan/".concat(id); 4949}; 4950exports.getSellingPlanID = getSellingPlanID; 4951var fetchProduct = function fetchProduct(id) { 4952 return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 4953 var appState, response, responseJSON; 4954 return _regeneratorRuntime().wrap(function _callee$(_context) { 4955 while (1) switch (_context.prev = _context.next) { 4956 case 0: 4957 appState = __1["default"].getState(); 4958 if (!appState.products[id]) { 4959 _context.next = 3; 4960 break; 4961 } 4962 return _context.abrupt("return", appState.products[id]); 4963 case 3: 4964 _context.prev = 3; 4965 _context.next = 6; 4966 return fetch(constants_1.STOREFRONT_API_URL, { 4967 method: "POST", 4968 headers: { 4969 "Content-Type": "application/json", 4970 "X-Shopify-Storefront-Access-Token": constants_1.STOREFRONT_ACCESS_TOKEN 4971 }, 4972 body: JSON.stringify({ 4973 query: product_graphql_1["default"], 4974 variables: { 4975 id: id 4976 } 4977 }) 4978 }); 4979 case 6: 4980 response = _context.sent; 4981 _context.next = 9; 4982 return response.json(); 4983 case 9: 4984 responseJSON = _context.sent; 4985 return _context.abrupt("return", responseJSON.data.product); 4986 case 13: 4987 _context.prev = 13; 4988 _context.t0 = _context["catch"](3); 4989 console.error(_context.t0); 4990 case 16: 4991 case "end": 4992 return _context.stop(); 4993 } 4994 }, _callee, null, [[3, 13]]); 4995 })); 4996}; 4997exports.fetchProduct = fetchProduct; 4998/** 4999 * 5000 * @param {Product} product - Product query 5001 * @param {string} group - SellingPlanGroup name 5002 * @returns SellingPlans 5003 */ 5004var getProductSellingPlans = function getProductSellingPlans(_ref) { 5005 var product = _ref.product, 5006 group = _ref.group; 5007 var sellingPlanGroup = product.sellingPlanGroups.nodes.find(function (_ref2) { 5008 var name = _ref2.name; 5009 return name === group; 5010 }); 5011 return sellingPlanGroup.sellingPlans; 5012}; 5013exports.getProductSellingPlans = getProductSellingPlans; 5014var getProductSellingPlanAllocation = function getProductSellingPlanAllocation(product, sellingPlanId) { 5015 var _a, _b, _c, _d; 5016 return (_d = (_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.variants) === null || _a === void 0 ? void 0 : _a.nodes[0]) === null || _b === void 0 ? void 0 : _b.sellingPlanAllocations) === null || _c === void 0 ? void 0 : _c.nodes) === null || _d === void 0 ? void 0 : _d.find(function (sellingPlanAllocation) { 5017 var _a; 5018 return ((_a = sellingPlanAllocation.sellingPlan) === null || _a === void 0 ? void 0 : _a.id) === sellingPlanId; 5019 }); 5020}; 5021exports.getProductSellingPlanAllocation = getProductSellingPlanAllocation; 5022 5023/***/ }), 5024
5025/***/ "./src/scripts/animations/fadeIn.js": 5026/*!******************************************!*\ 5027 !*** ./src/scripts/animations/fadeIn.js ***! 5028 \******************************************/ 5029/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5030 5031"use strict"; 5032__webpack_require__.r(__webpack_exports__); 5033/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5034/* harmony export */ "fadeIn": () => (/* binding */ fadeIn) 5035/* harmony export */ }); 5036/* harmony import */ var imagesloaded__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! imagesloaded */ "./node_modules/imagesloaded/imagesloaded.js"); 5037/* harmony import */ var imagesloaded__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(imagesloaded__WEBPACK_IMPORTED_MODULE_0__); 5038 5039 5040/** 5041 * Checks if images have fully loaded and fades them in. 5042 * 5043 * @param container Parent element containing images which will be faded in 5044 */ 5045var fadeIn = function fadeIn(container) { 5046 var imgLoad = imagesloaded__WEBPACK_IMPORTED_MODULE_0___default()(container); 5047 imgLoad.on("progress", function (instance, image) { 5048 var result = image.isLoaded ? "loaded" : "broken"; 5049 if (image.isLoaded) { 5050 image.img.style.opacity = "1"; 5051 } 5052 }); 5053}; 5054 5055/***/ }), 5056
5057/***/ "./src/scripts/animations/index.js": 5058/*!*****************************************!*\ 5059 !*** ./src/scripts/animations/index.js ***! 5060 \*****************************************/ 5061/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5062 5063"use strict"; 5064__webpack_require__.r(__webpack_exports__); 5065/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5066/* harmony export */ "fadeIn": () => (/* reexport safe */ _fadeIn__WEBPACK_IMPORTED_MODULE_2__.fadeIn), 5067/* harmony export */ "findFlavorColorSource": () => (/* reexport safe */ _updateColors__WEBPACK_IMPORTED_MODULE_3__.findFlavorColorSource), 5068/* harmony export */ "syncFlavorColorsFromContainer": () => (/* reexport safe */ _updateColors__WEBPACK_IMPORTED_MODULE_3__.syncFlavorColorsFromContainer), 5069/* harmony export */ "updateColors": () => (/* reexport safe */ _updateColors__WEBPACK_IMPORTED_MODULE_3__.updateColors), 5070/* harmony export */ "waveUnderBefore": () => (/* reexport safe */ _waveUnder_js__WEBPACK_IMPORTED_MODULE_1__.waveUnderBefore), 5071/* harmony export */ "waveUnderLeave": () => (/* reexport safe */ _waveUnder_js__WEBPACK_IMPORTED_MODULE_1__.waveUnderLeave) 5072/* harmony export */ }); 5073/* harmony import */ var _links_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./links.js */ "./src/scripts/animations/links.js"); 5074/* harmony import */ var _links_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_links_js__WEBPACK_IMPORTED_MODULE_0__); 5075/* harmony import */ var _waveUnder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./waveUnder.js */ "./src/scripts/animations/waveUnder.js"); 5076/* harmony import */ var _fadeIn__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fadeIn */ "./src/scripts/animations/fadeIn.js"); 5077/* harmony import */ var _updateColors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./updateColors */ "./src/scripts/animations/updateColors.js"); 5078 5079 5080 5081 5082 5083/***/ }), 5084
5085/***/ "./src/scripts/animations/links.js": 5086/*!*****************************************!*\ 5087 !*** ./src/scripts/animations/links.js ***! 5088 \*****************************************/ 5089/***/ (() => { 5090 5091document.addEventListener("click", function (e) { 5092 var anchor = e.target.closest('a[href^="#"]'); 5093 if (!anchor) return; 5094 5095 // Collection hybrid CLP jump bar uses scroll-margin + section JS; global handler 5096 // below preventDefault()s and uses a fixed 150px offset which breaks anchoring. 5097 if (anchor.closest(".clp-jump-links") || anchor.hasAttribute("data-clp-jump-anchor")) { 5098 e.preventDefault(); 5099 return; 5100 } 5101 e.preventDefault(); 5102 var targetId = anchor.getAttribute("href").trim(); 5103 if (targetId === "#") return; 5104 var id = targetId.slice(1); 5105 if (!id) return; 5106 var targetElement = document.getElementById(id); 5107 if (!targetElement) return; 5108 var offset = targetElement.getBoundingClientRect().top + window.scrollY - 150; 5109 window.scrollTo({ 5110 top: offset, 5111 behavior: "smooth" 5112 }); 5113}); 5114 5115/***/ }), 5116
5117/***/ "./src/scripts/animations/updateColors.js": 5118/*!************************************************!*\ 5119 !*** ./src/scripts/animations/updateColors.js ***! 5120 \************************************************/ 5121/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5122 5123"use strict"; 5124__webpack_require__.r(__webpack_exports__); 5125/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5126/* harmony export */ "findFlavorColorSource": () => (/* binding */ findFlavorColorSource), 5127/* harmony export */ "syncFlavorColorsFromContainer": () => (/* binding */ syncFlavorColorsFromContainer), 5128/* harmony export */ "updateColors": () => (/* binding */ updateColors) 5129/* harmony export */ }); 5130/** 5131 * Updates the global CSS variables that define the flavor colors 5132 * based on the provided trigger element's dataset attributes. 5133 * 5134 * @param {HTMLElement} trigger - The trigger element that contains the 5135 * color data in its dataset attributes. It should have the following 5136 * properties: 'data-color-light', 'data-color-medium', 'data-color-dark'. 5137 */ 5138var updateColors = function updateColors(trigger) { 5139 var _trigger$dataset; 5140 if (!(trigger !== null && trigger !== void 0 && (_trigger$dataset = trigger.dataset) !== null && _trigger$dataset !== void 0 && _trigger$dataset.colorLight)) { 5141 return; 5142 } 5143 document.documentElement.style.setProperty("--flavor-color-100", "".concat(trigger.dataset.colorLight)); 5144 document.documentElement.style.setProperty("--flavor-color-200", "".concat(trigger.dataset.colorMedium)); 5145 document.documentElement.style.setProperty("--flavor-color-300", "".concat(trigger.dataset.colorDark)); 5146 document.documentElement.style.setProperty("--flavor-color-selector", "".concat(trigger.dataset.colorSelector)); 5147}; 5148 5149/** 5150 * Finds an element in the PDP markup that carries flavor theme data-color-* attrs. 5151 * @param {ParentNode} [root=document] 5152 * @returns {HTMLElement | null} 5153 */ 5154var findFlavorColorSource = function findFlavorColorSource() { 5155 var _root$querySelector, _root$querySelector2, _root$querySelector3, _root$querySelector4; 5156 var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 5157 return ((_root$querySelector = root.querySelector) === null || _root$querySelector === void 0 ? void 0 : _root$querySelector.call(root, "details.product-flavor-dropdown[data-color-light]")) || ((_root$querySelector2 = root.querySelector) === null || _root$querySelector2 === void 0 ? void 0 : _root$querySelector2.call(root, ".product-swatch--active[data-color-light]")) || ((_root$querySelector3 = root.querySelector) === null || _root$querySelector3 === void 0 ? void 0 : _root$querySelector3.call(root, ".product-swatch--active")) || ((_root$querySelector4 = root.querySelector) === null || _root$querySelector4 === void 0 ? void 0 : _root$querySelector4.call(root, 'a[aria-current="page"][data-color-light]')) || null; 5158}; 5159 5160/** 5161 * Syncs body/overlay flavor CSS variables from swapped Barba container markup. 5162 * @param {ParentNode} container 5163 * @param {{ overlayEl?: HTMLElement, waveEl?: HTMLElement }} [options] 5164 * @returns {boolean} whether colors were applied 5165 */ 5166var syncFlavorColorsFromContainer = function syncFlavorColorsFromContainer(container) { 5167 var _source$dataset; 5168 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 5169 var source = findFlavorColorSource(container); 5170 if (!(source !== null && source !== void 0 && (_source$dataset = source.dataset) !== null && _source$dataset !== void 0 && _source$dataset.colorLight)) { 5171 return false; 5172 } 5173 updateColors(source); 5174 var overlayEl = options.overlayEl, 5175 waveEl = options.waveEl; 5176 if (overlayEl) { 5177 overlayEl.style.background = source.dataset.colorLight; 5178 } 5179 if (waveEl) { 5180 waveEl.setAttribute("fill", "".concat(source.dataset.colorLight)); 5181 } 5182 return true; 5183}; 5184 5185/***/ }), 5186
5187/***/ "./src/scripts/animations/waveUnder.js": 5188/*!*********************************************!*\ 5189 !*** ./src/scripts/animations/waveUnder.js ***! 5190 \*********************************************/ 5191/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5192 5193"use strict"; 5194__webpack_require__.r(__webpack_exports__); 5195/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5196/* harmony export */ "waveUnderBefore": () => (/* binding */ waveUnderBefore), 5197/* harmony export */ "waveUnderLeave": () => (/* binding */ waveUnderLeave) 5198/* harmony export */ }); 5199/* harmony import */ var gsap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! gsap */ "./node_modules/gsap/index.js"); 5200function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 5201 5202 5203/** Wave reads swatch colors from a flavor `<a>`; browser history uses a string trigger. */ 5204function isFlavorLinkTrigger(trigger) { 5205 return trigger && _typeof(trigger) === "object" && "dataset" in trigger && trigger.dataset && typeof trigger.dataset.colorLight === "string"; 5206} 5207 5208/** 5209 * Updates color of the wave to new product color 5210 * and repositions them offscreen on the lefthand side. 5211 * 5212 * @param data {object} object containing data from selected product swatch 5213 * @param overlayEl {element} overlay element behind 5214 * @param waveEl {element} wave element moving across page 5215 */ 5216var waveUnderBefore = function waveUnderBefore(data, overlayEl, waveEl) { 5217 gsap__WEBPACK_IMPORTED_MODULE_0__["default"].defaults({ 5218 overwrite: true 5219 }); 5220 var trigger = data.trigger; 5221 if (!isFlavorLinkTrigger(trigger)) { 5222 return; 5223 } 5224 overlayEl.style.background = trigger.dataset.colorLight; 5225 waveEl.style.display = "block"; 5226 waveEl.setAttribute("fill", "".concat(trigger.dataset.colorLight)); 5227 gsap__WEBPACK_IMPORTED_MODULE_0__["default"].set(overlayEl, { 5228 x: "-100%" 5229 }); 5230}; 5231 5232/** 5233 * 5234 * Moves wave from left to right side of screen. Once the wave is fully across 5235 * update the css variables from the selected swatch 5236 * 5237 * @param data {object} object containing data from selected product swatch 5238 * @param overlayEl {element} overlay element behind 5239 */ 5240var waveUnderLeave = function waveUnderLeave(data, overlayEl) { 5241 gsap__WEBPACK_IMPORTED_MODULE_0__["default"].defaults({ 5242 overwrite: true 5243 }); 5244 var trigger = data.trigger; 5245 if (!isFlavorLinkTrigger(trigger)) { 5246 return Promise.resolve(); 5247 } 5248 5249 // speed up wave animation on smaller screen resolutions 5250 var duration = window.innerWidth >= 1024 ? 1 : 0.85; 5251 var delay = window.innerWidth >= 1024 ? ".50" : ".25"; 5252 return gsap__WEBPACK_IMPORTED_MODULE_0__["default"].timeline().to(overlayEl, { 5253 duration: 0, 5254 background: "".concat(trigger.dataset.overlay) 5255 }).to(overlayEl, { 5256 duration: duration, 5257 x: "100%", 5258 onComplete: function onComplete() { 5259 document.documentElement.style.setProperty("--flavor-color-100", "".concat(trigger.dataset.colorLight)); 5260 } 5261 }, "<").call(function () { 5262 document.documentElement.style.setProperty("--flavor-color-200", "".concat(trigger.dataset.colorMedium)); 5263 document.documentElement.style.setProperty("--flavor-color-300", "".concat(trigger.dataset.colorDark)); 5264 }, null, delay); 5265}; 5266 5267/***/ }), 5268
vendor: 4,466 bytes, lines 5269-5314
5269/***/ "./src/scripts/global/accordion.js": 5270/*!*****************************************!*\ 5271 !*** ./src/scripts/global/accordion.js ***! 5272 \*****************************************/ 5273/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5274 5275"use strict"; 5276__webpack_require__.r(__webpack_exports__); 5277/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5278/* harmony export */ "Accordion": () => (/* binding */ Accordion) 5279/* harmony export */ }); 5280function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 5281function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 5282function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 5283function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 5284function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 5285function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 5286function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 5287function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5288function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 5289function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 5290function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 5291function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 5292function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 5293var Accordion = /*#__PURE__*/function () { 5294 /** 5295 * Represents a dropdown accordion 5296 * 5297 * Uses Custom Element <accordion-group> 5298 * 5299 * @constructor 5300 * @param {HTMLElement} container parent custom element 5301 * @property {HTMLElement} featuredImage - sticky image being displayed (optional) 5302 * @property {HTMLElement} activePanel - panel which is currently open 5303 * @property {HTMLElement} activeIcon - icon for active panel 5304 */ 5305 function Accordion(container) { 5306 var _this = this; 5307 _classCallCheck(this, Accordion); 5308 /** 5309 Update the featured image for a given element. 5310 @param {string|boolean} newImage - The URL of the new image to be set as featured image. If set to false, the default image will be displayed. 5311 @returns {void} 5312 */ 5313 _defineProperty(this, "_updateFeaturedImage", function () { 5314 var newImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5315 if (_this.featuredImage) { 5316 if (newImage) { 5317 _this.featuredImage.style.opacity = "0"; 5318 _this.featuredImage.src = newImage; 5319 $(_this.featuredImage).imagesLoaded(function () { 5320 _this.featuredImage.style.opacity = "1"; 5321 }); 5322 } else { 5323 _this.featuredImage.style.opacity = "0"; 5324 setTimeout(function () { 5325 // if all panels close display default image set as data attribute on image element 5326 _this.featuredImage.src = _this.featuredImage.dataset.defaultSrc; 5327 _this.featuredImage.style.opacity = "1"; 5328 }, 300); 5329 } 5330 } 5331 }); 5332 /** 5333 Updates the featured image and opens the panel by rotating the active icon and setting the active panel's height to the height of its children. 5334 @param {string|boolean} newImage - Whether a new image is being added or not. Defaults to false. 5335 */ 5336 _defineProperty(this, "_openPanel", function (newImage) { 5337 _this._updateFeaturedImage(newImage); 5338 _this.activeIcon.style.transform = "rotate(180deg)"; 5339 // this.activePanel.style.height = `${this.activePanel.children[0].offsetHeight}px`; 5340 // this.activePanel.style.opacity = '1'; 5341 // this.activePanel.style.blockSize = 'auto'; 5342 _this.activePanel.style.display = 'block'; 5343 _this.activePanel.setAttribute("aria-expanded", "true"); 5344 var wrapper = _this.activePanel.closest('.accordion-item'); 5345 if (wrapper) { 5346 wrapper.setAttribute('aria-expanded', 'true'); 5347 } 5348 }); 5349 /** 5350 Closes the active panel by rotating the active icon back to its original position and setting the active panel's height to 0. 5351 */ 5352 _defineProperty(this, "_closePanel", function () { 5353 if (!_this.activePanel) { 5354 return; 5355 } 5356 _this.activeIcon.style.transform = "rotate(0deg)"; 5357 // this.activePanel.style.height = `0px`; 5358 // this.activePanel.style.opacity = '0'; 5359 // this.activePanel.style.blockSize = '0'; 5360 _this.activePanel.style.display = 'none'; 5361 _this.activePanel.setAttribute("aria-expanded", "false"); 5362 var wrapper = _this.activePanel.closest('.accordion-item'); 5363 if (wrapper) { 5364 wrapper.setAttribute('aria-expanded', 'false'); 5365 } 5366 }); 5367 /** 5368 Toggles the active panel between open and closed states by checking the current height of the active panel and calling either _openPanel or _resetPanels. 5369 */ 5370 _defineProperty(this, "_togglePanel", function () { 5371 _this.activePanel.style.height = _this.activePanel.style.height === "0px" || _this.activePanel.style.display === 'none' ? _this._openPanel() : _this._resetPanels(); 5372 }); 5373 /** 5374 Resets the panels by updating the featured image to its default value, closing the active panel, and setting the active panel to false. 5375 */ 5376 _defineProperty(this, "_resetPanels", function () { 5377 _this._updateFeaturedImage(); 5378 _this._closePanel(); 5379 _this.activePanel = false; 5380 }); 5381 /** 5382 Handles the click event on a panel by checking whether the selected panel is the active panel, and then calling _togglePanel or _closePanel and _openPanel as necessary. 5383 @param {Event} e - The click event object. 5384 */ 5385 _defineProperty(this, "_handleClick", function (e) { 5386 var selectedPanel = e.currentTarget; 5387 var targetId = selectedPanel.dataset.panel; 5388 var newImage = selectedPanel.dataset.image; 5389 console.log(targetId, "targetId"); 5390 if (_this.activePanel && targetId === _this.activePanel.id) { 5391 _this._togglePanel(); 5392 return; 5393 } 5394 _this._closePanel(); 5395 _this._updateActivePanel(targetId, selectedPanel); 5396 _this._openPanel(newImage); 5397 }); 5398 /** 5399 Updates the active panel and active icon based on the selected panel's ID and active icon element. 5400 @param {string} targetId - The ID of the panel to make active. 5401 @param {HTMLElement} selectedPanel - The panel element that was clicked. 5402 */ 5403 _defineProperty(this, "_updateActivePanel", function (targetId, selectedPanel) { 5404 _this.activePanel = document.getElementById(targetId); 5405 _this.activeIcon = selectedPanel.querySelector("svg"); 5406 }); 5407 this.container = container; 5408 this.featuredImage = this.container ? this.container.querySelector("[data-default-src]") : null; 5409 this.activePanel = null; 5410 this.activeIcon = null; 5411 this._init(); 5412 } 5413 5414 /** 5415 Checks if any panels exist inside container element and adds a click element to each panel button 5416 @memberof Accordion 5417 @returns {void} 5418 @throws {Error} If the container is not found or if there are no panels found in the container 5419 */ 5420 _createClass(Accordion, [{ 5421 key: "_buildPanels", 5422 value: function _buildPanels() { 5423 var _this2 = this; 5424 var allPanels = this.container.querySelectorAll("button"); 5425 if (!allPanels || !allPanels.length) { 5426 return; 5427 } 5428 var initiallyOpenPanel = _toConsumableArray(allPanels).find(function (panel) { 5429 return panel.getAttribute("data-open") === "true"; 5430 }); 5431 if (initiallyOpenPanel) { 5432 var targetId = initiallyOpenPanel.dataset.panel; 5433 this.activePanel = document.getElementById(targetId); 5434 this.activeIcon = initiallyOpenPanel.querySelector("svg");
5435 this._openPanel(); 5436 } 5437 allPanels.forEach(function (panel) { 5438 panel.addEventListener("click", _this2._handleClick); 5439 }); 5440 } 5441 }, { 5442 key: "_init", 5443 value: 5444 /** 5445 * Initialize the accordion component by checking if the container element exists and building its panels. 5446 * @throws {Error} If the container element is not found. 5447 * @returns {void} 5448 */ 5449 function _init() { 5450 if (!this.container) { 5451 throw new Error("Accordion container not found"); 5452 } 5453 this._buildPanels(); 5454 } 5455 }]); 5456 return Accordion; 5457}(); 5458 5459/***/ }), 5460
vendor: 5,024 bytes, lines 5461-5473
5461/***/ "./src/scripts/global/addToCart.js": 5462/*!*****************************************!*\ 5463 !*** ./src/scripts/global/addToCart.js ***! 5464 \*****************************************/ 5465/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5466 5467"use strict"; 5468__webpack_require__.r(__webpack_exports__); 5469/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5470/* harmony export */ "AddToCart": () => (/* binding */ AddToCart) 5471/* harmony export */ }); 5472function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 5473function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,627 bytes, lines 5473-5480
5473 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 5474function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 5475function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 5476function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 5477function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 5478function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5479function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 5480function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string");
5480 return _typeof(key) === "symbol" ? key : String(key); } 5481function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 5482/** 5483 * Create a new instance of the AddToCart component. 5484 * 5485 * @param {HTMLElement|false} [form=false] - The HTML form element containing the product information. 5486 * @param {HTMLElement|false} [qtySelector=false] - The HTML element used to select the quantity of the product to add to the cart. 5487 * @param {HTMLElement|false} [comboBox=false] - The HTML select element containing the product variant options. 5488 */ 5489 5490var AddToCart = /*#__PURE__*/_createClass(function AddToCart() { 5491 var _this = this; 5492 var form = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 5493 var _qtySelector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 5494 var _comboBox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 5495 _classCallCheck(this, AddToCart); 5496 /** 5497 * Handles the click event when the "Add to Cart" button is clicked. 5498 * @returns {Promise<void>} - A Promise that resolves when the product is successfully added to the cart. 5499 */ 5500 _defineProperty(this, "_handleClick", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 5501 var productData, cartData, addRequest; 5502 return _regeneratorRuntime().wrap(function _callee$(_context) { 5503 while (1) switch (_context.prev = _context.next) { 5504 case 0: 5505 if (!_this.loading) { 5506 _context.next = 2; 5507 break; 5508 } 5509 return _context.abrupt("return"); 5510 case 2: 5511 // Set loading state and change button text 5512 _this.loading = true; 5513 _this.buttonEl.innerText = "Adding..."; 5514 5515 // Get product data 5516 productData = _this._getProductData(_this.formEl, _this.qtySelector, _this.comboBox); 5517 if (productData) { 5518 _context.next = 7; 5519 break; 5520 } 5521 throw new Error("Product Data not found"); 5522 case 7: 5523 cartData = { 5524 id: productData.id, 5525 quantity: productData.quantity 5526 }; 5527 if (productData.selling_plan) { 5528 cartData["selling_plan"] = productData.selling_plan; 5529 } 5530 5531 // send product to data server 5532 _context.next = 11; 5533 return fetch("/cart/add.js", { 5534 method: "POST", 5535 headers: { 5536 "Content-Type": "application/json" 5537 }, 5538 body: JSON.stringify(cartData) 5539 }).then(function (response) { 5540 if (response.ok) { 5541 return response.json(); 5542 } 5543 throw new Error("Something went wrong"); 5544 }).then(function () { 5545 // Success: Product added to cart 5546 _this.loading = false; 5547 _this.buttonEl.innerText = "Add To Cart"; 5548 gtag("event", "conversion", { 5549 send_to: "AW-11061188277/VBndCO-QnJYYELWtsZop" 5550 }); 5551 console.log("gtag event sent successfully"); 5552 })["catch"](function (error) { 5553 console.log("ERROR", error); 5554 }); 5555 case 11: 5556 addRequest = _context.sent; 5557 case 12: 5558 case "end": 5559 return _context.stop(); 5560 } 5561 }, _callee); 5562 }))); 5563 /** 5564 * Gets the product data from the form, quantity selector, and combo box. 5565 * @param {HTMLElement} formEl - The form element containing the product information. 5566 * @param {HTMLElement} qtySelector - The element used to select the quantity of the product to add to the cart. 5567 * @param {HTMLElement} comboBox - The select element containing the product variant options. 5568 * @returns {Object|null} - An object containing the product data, or null if the data is not found. 5569 */ 5570 _defineProperty(this, "_getProductData", function (formEl, qtySelector, comboBox) { 5571 var product = { 5572 id: formEl.dataset.productVariant || false, 5573 qty: qtySelector ? qtySelector._getTotal() : 1, 5574 selling_plan_id: comboBox ? comboBox._getSellingPlan() : false 5575 }; 5576 5577 // Validate product data 5578 if (!product.id) { 5579 throw new Error("Product variant ID not found"); 5580 } 5581 return { 5582 id: product.id, 5583 quantity: product.qty, 5584 selling_plan: product.selling_plan_id 5585 }; 5586 }); 5587 /** 5588 * Initialize the AddToCart component by setting the button element, adding click and keydown event listeners, and calling the handleClick function when events occur. 5589 * @throws {Error} If the atc-button custom element is not found within the form element. 5590 * @returns {void} 5591 */ 5592 _defineProperty(this, "_init", function () { 5593 _this.buttonEl = _this.formEl.querySelector("atc-button"); 5594 if (!_this.buttonEl) { 5595 throw new Error("atc-button custom element not found"); 5596 } 5597 _this.buttonEl.addEventListener("click", function (e) { 5598 return _this._handleClick(e); 5599 }); 5600 _this.buttonEl.addEventListener("keydown", function (e) { 5601 if (e.key == "Enter") { 5602 _this._handleClick(e); 5603 } 5604 }); 5605 }); 5606 this.formEl = form; 5607 this.qtySelector = _qtySelector;
5608 this.comboBox = _comboBox; 5609 this.buttonEl = false; 5610 this.loading = false; 5611 this._init(); 5612}); 5613 5614/***/ }), 5615
5616/***/ "./src/scripts/global/comboBox.js": 5617/*!****************************************!*\ 5618 !*** ./src/scripts/global/comboBox.js ***! 5619 \****************************************/ 5620/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5621 5622"use strict"; 5623__webpack_require__.r(__webpack_exports__); 5624/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5625/* harmony export */ "ComboBox": () => (/* binding */ ComboBox) 5626/* harmony export */ }); 5627function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 5628function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 5629function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 5630function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5631function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 5632function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 5633function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 5634/* ---- 5635 5636 This JS is taken from this article - https://www.24a11y.com/2019/select-your-poison-part-2/ 5637 It is also modified to be used as a way to decorate select dropdowns and make them 5638 accessible using keyboards. 5639 5640 How to use it: 5641 Add js-combobox class to the <select> element you would like to replace with the combobox. 5642 Hide your <select> element as well as corresponding <label> element with display: none;. 5643 5644 On load, this libary will create a new <label> element and a combobox element which consists 5645 of an input element and a listbox. 5646 5647 The new <label> element will have select label's aria-label. 5648 The new combobox element will have select options' values and text. 5649 5650 On option select, this libary will also set your hidden <select> element's val so it 5651 can be used further. 5652 5653---- */ 5654 5655var ComboBox = /*#__PURE__*/_createClass(function ComboBox(_form, priceDisplay) { 5656 var _this = this; 5657 _classCallCheck(this, ComboBox); 5658 // return an array of exact option name matches from a comma-separated string 5659 _defineProperty(this, "_findMatches", function (options, search) { 5660 var names = search.split(","); 5661 return names.map(function (name) { 5662 var match = options.filter(function (option) { 5663 return name.trim().toLowerCase() === option.toLowerCase(); 5664 }); 5665 return match.length > 0 ? match[0] : null; 5666 }).filter(function (option) { 5667 return option !== null; 5668 }); 5669 }); 5670 // return combobox action from key press 5671 _defineProperty(this, "_getActionFromKey", function (key, menuOpen) { 5672 // handle opening when closed 5673 if (!menuOpen && key === _this.keys.Down) { 5674 return _this.menuActions.Open; 5675 } 5676 5677 // handle keys when open 5678 if (key === _this.keys.Down) { 5679 return _this.menuActions.Next; 5680 } else if (key === _this.keys.Up) { 5681 return _this.menuActions.Previous; 5682 } else if (key === _this.keys.Home) { 5683 return _this.menuActions.First; 5684 } else if (key === _this.keys.End) { 5685 return _this.menuActions.Last; 5686 } else if (key === _this.keys.Escape) { 5687 return _this.menuActions.Close; 5688 } else if (key === _this.keys.Enter) { 5689 return _this.menuActions.CloseSelect; 5690 } else if (key === _this.keys.Backspace || key === _this.keys.Clear || key.length === 1) { 5691 return _this.menuActions.Type; 5692 } 5693 }); 5694 // get updated option index 5695 _defineProperty(this, "_getUpdatedIndex", function (current, max, action) { 5696 switch (action) { 5697 case _this.menuActions.First: 5698 return 0; 5699 case _this.menuActions.Last: 5700 return max; 5701 case _this.menuActions.Previous: 5702 return Math.max(0, current - 1); 5703 case _this.menuActions.Next: 5704 return Math.min(max, current + 1); 5705 default: 5706 return current; 5707 } 5708 }); 5709 // filter an array of options against an input string 5710 // returns an array of options that begin with the filter string, case-independent 5711 _defineProperty(this, "_filterOptions", function () { 5712 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 5713 var filter = arguments.length > 1 ? arguments[1] : undefined; 5714 var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 5715 return options.filter(function (option) { 5716 var matches = option.toLowerCase().indexOf(filter.toLowerCase()) === 0; 5717 return matches && exclude.indexOf(option) < 0; 5718 }); 5719 }); 5720 _defineProperty(this, "_init", function () { 5721 if (!_this.formEl) { 5722 console.log("Combobox Missing Form"); 5723 return; 5724 } 5725 _this.wrapperEl = _this.formEl.querySelector("combo-box"); 5726 _this.inputEl = _this.wrapperEl.querySelector("input[name=rtx_option_plans_dropdown]"); 5727 _this.listboxEl = _this.wrapperEl.querySelector("list-box"); 5728 _this.optionId = _this.listboxEl.dataset.identifier; 5729 _this.options = Array.from(_this.listboxEl.children); 5730 /* 5731 On some pages (example: Subscription Page) there are hidden form inputs that change their values to match 5732 a combox selection in a different section ( lemmings ). If this is a combo-box that changes these other inputs on the 5733 page it will have a data-attribute of lemmings set to true. 5734 */ 5735 if (_this.wrapperEl.dataset.lemmings) { 5736 _this.allLemmings = document.querySelectorAll("[data-combobox-lemming]"); 5737 } 5738 if (_this.options.length === 0) { 5739 console.log("Combox Error: No Options Found"); 5740 return; 5741 } 5742 _this.options.forEach(function (el, index) { 5743 el.addEventListener("click", function () { 5744 return _this._onOptionClick(index); 5745 }); 5746 }); 5747 _this.inputEl.addEventListener("blur", _this._onInputBlur); 5748 _this.inputEl.addEventListener("click", function () { 5749 return _this._updateMenuState(true); 5750 }); 5751 _this.inputEl.addEventListener("keydown", function (e) { 5752 return _this._onInputKeyDown(e); 5753 }); 5754 _this._onOptionClick(_this.activeIndex); 5755 5756 // Add event listener for clicks outside the combo box 5757 document.addEventListener("click", _this._onDocumentClick); 5758 }); 5759 _defineProperty(this, "_onInputKeyDown", function (event) { 5760 var key = event.key; 5761 var max = this.options.length - 1; 5762 var action = this._getActionFromKey(key, this.open); 5763 switch (action) { 5764 case this.menuActions.Next: 5765 case this.menuActions.Last: 5766 case this.menuActions.First: 5767 case this.menuActions.Previous: 5768 event.preventDefault();
5769 return this._onOptionChange(this._getUpdatedIndex(this.activeIndex, max, action)); 5770 case this.menuActions.CloseSelect: 5771 event.preventDefault(); 5772 this._selectOption(this.activeIndex); 5773 return this._updateMenuState(false); 5774 case this.menuActions.Close: 5775 event.preventDefault(); 5776 return this._updateMenuState(false); 5777 case this.menuActions.Open: 5778 return this._updateMenuState(true); 5779 } 5780 }); 5781 _defineProperty(this, "_onInputBlur", function () { 5782 if (this.ignoreBlur) { 5783 this.ignoreBlur = false; 5784 return; 5785 } 5786 if (this.open) { 5787 this._updateMenuState(false, false); 5788 } 5789 }); 5790 _defineProperty(this, "_onOptionChange", function (index) { 5791 var _this2 = this; 5792 this.activeIndex = index; 5793 this.inputEl.setAttribute("aria-activedescendant", "".concat(this.optionId, "__").concat(index)); 5794 this.inputEl.dataset.index = index; 5795 this.inputEl.dataset.sellingPlanId = this.options[index].dataset.sellingPlanId; 5796 this.inputEl.value = this.options[index].innerText; 5797 this.options.forEach(function (el) { 5798 el.classList.remove("option-current"); 5799 }); 5800 this.options[index].classList.add("option-current"); 5801 if (this.priceDisplay) { 5802 if (this.activeIndex > 0) { 5803 this.priceDisplay.querySelector(".one-time-price-box").classList.add("tw-hidden"); 5804 this.priceDisplay.querySelector(".subscription-price-box").classList.remove("tw-hidden"); 5805 } else { 5806 this.priceDisplay.querySelector(".subscription-price-box").classList.add("tw-hidden"); 5807 this.priceDisplay.querySelector(".one-time-price-box").classList.remove("tw-hidden"); 5808 } 5809 } 5810 5811 /* If combobox changes other selling plan inputs on page, update their values */ 5812 if (this.allLemmings) { 5813 this.allLemmings.forEach(function (el) { 5814 if (el.dataset.comboboxLemming === "value") { 5815 el.value = _this2.options[index].dataset.sellingPlanId; 5816 } 5817 if (el.dataset.comboboxLemming === "label") { 5818 el.innerText = _this2.options[index].innerText; 5819 } 5820 }); 5821 } 5822 }); 5823 _defineProperty(this, "_onOptionClick", function (index) { 5824 this._onOptionChange(index); 5825 this._selectOption(index); 5826 this._updateMenuState(false); 5827 }); 5828 _defineProperty(this, "_onOptionMouseDown", function () { 5829 this.ignoreBlur = true; 5830 }); 5831 _defineProperty(this, "_selectOption", function (index) { 5832 var selected = this.options[index]; 5833 this.inputEl.value = selected.innerText; 5834 this.activeIndex = index; 5835 }); 5836 _defineProperty(this, "_updateMenuState", function (open) { 5837 var callFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 5838 this.open = open; 5839 this.wrapperEl.setAttribute("aria-expanded", "".concat(open)); 5840 open ? this.wrapperEl.classList.add("open") : this.wrapperEl.classList.remove("open"); 5841 }); 5842 _defineProperty(this, "_onDocumentClick", function (event) { 5843 if (_this.open && !_this.wrapperEl.contains(event.target)) { 5844 _this._updateMenuState(false); 5845 } 5846 }); 5847 _defineProperty(this, "_getIndex", function () { 5848 return _this.activeIndex; 5849 }); 5850 _defineProperty(this, "_getSellingPlan", function () { 5851 return _this.inputEl.dataset.sellingPlanId; 5852 }); 5853 _defineProperty(this, "_refresh", function (form) { 5854 _this.formEl = form; 5855 _this._init(); 5856 }); 5857 this.keys = { 5858 Backspace: "Backspace", 5859 Clear: "Clear", 5860 Down: "ArrowDown", 5861 End: "End", 5862 Enter: "Enter", 5863 Escape: "Escape", 5864 Home: "Home", 5865 Left: "ArrowLeft", 5866 PageDown: "PageDown", 5867 PageUp: "PageUp", 5868 Right: "ArrowRight", 5869 Space: " ", 5870 Tab: "Tab", 5871 Up: "ArrowUp" 5872 }; 5873 this.menuActions = { 5874 Close: 0, 5875 CloseSelect: 1, 5876 First: 2, 5877 Last: 3, 5878 Next: 4, 5879 Open: 5, 5880 Previous: 6, 5881 Select: 7, 5882 Space: 8, 5883 Type: 9 5884 }; 5885 this.formEl = _form; 5886 this.priceDisplay = priceDisplay; 5887 this.wrapperEl = false; 5888 this.comboEl = false; 5889 this.inputEl = false; 5890 this.listboxEl = false; 5891 this.optionId = false; 5892 this.sellingPlanInput = false; 5893 this.el = false;
5894 this.inputEl = false; 5895 this.selectEl = false; 5896 this.idBase = false; 5897 this.options = false; 5898 this.optionValues = false; 5899 this.activeIndex = 1; 5900 this.open = false; 5901 this.allLemmings = false; 5902 this._init(); 5903}); 5904 5905/***/ }), 5906
5907/***/ "./src/scripts/global/dropdown.js": 5908/*!****************************************!*\ 5909 !*** ./src/scripts/global/dropdown.js ***! 5910 \****************************************/ 5911/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5912 5913"use strict"; 5914__webpack_require__.r(__webpack_exports__); 5915/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5916/* harmony export */ "Dropdown": () => (/* binding */ Dropdown) 5917/* harmony export */ }); 5918function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 5919function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 5920function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 5921function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5922function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 5923function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 5924function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 5925/** 5926 Initializes a dropdown component 5927 @param {HTMLElement} el - The HTML element on which to initialize the dropdown. 5928*/ 5929 5930var Dropdown = /*#__PURE__*/_createClass(function Dropdown(el) { 5931 var _this = this; 5932 _classCallCheck(this, Dropdown); 5933 _defineProperty(this, "_init", function () { 5934 // Add an event listener to the trigger element to toggle the dropdown 5935 _this.trigger.addEventListener("click", function () { 5936 _this.toggle(); 5937 }); 5938 _this.trigger.addEventListener("keypress", function (e) { 5939 if (e.code === "Enter") _this.toggle(); 5940 }); 5941 5942 // Add a resize event listener to recalculate container and open heights 5943 window.addEventListener("resize", function () { 5944 _this.openHeight = _this.containerHeight + _this.dropdown.offsetHeight; 5945 }); 5946 return function () { 5947 _this.container.removeEventListener("click", _this.container._init); 5948 _this.container.removeEventListener("keypress", _this.container._init); 5949 _this.container.removeEventListener("resize", _this.container._init); 5950 }; 5951 }); 5952 this.container = el; 5953 this.containerHeight = el.offsetHeight; 5954 this.trigger = el.querySelector("drop-down-trigger"); 5955 this.dropdown = el.querySelector("drop-down"); 5956 this.iconOpen = this.trigger.querySelector("icon-open"); 5957 this.iconClosed = this.trigger.querySelector("icon-closed"); 5958 this.openHeight = this.containerHeight + this.dropdown.offsetHeight; 5959 this.isOpen = false; 5960 this.toggle = function () { 5961 _this.iconClosed.style.visibility = _this.isOpen ? "visible" : "hidden"; 5962 _this.iconOpen.style.visibility = _this.isOpen ? "hidden" : "visible"; 5963 _this.trigger.ariaExpanded = _this.isOpen ? "false" : "true"; 5964 _this.trigger.ariaLabel = _this.isOpen ? "Open" : "Close"; 5965 _this.container.style.height = _this.isOpen ? "".concat(_this.trigger.offsetHeight, "px") : "".concat(_this.openHeight, "px"); 5966 _this.isOpen = !_this.isOpen; 5967 }; 5968 this._init(); 5969}); 5970 5971/***/ }), 5972
5973/***/ "./src/scripts/global/index.js": 5974/*!*************************************!*\ 5975 !*** ./src/scripts/global/index.js ***! 5976 \*************************************/ 5977/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 5978 5979"use strict"; 5980__webpack_require__.r(__webpack_exports__); 5981/* harmony export */ __webpack_require__.d(__webpack_exports__, { 5982/* harmony export */ "Accordion": () => (/* reexport safe */ _accordion__WEBPACK_IMPORTED_MODULE_3__.Accordion), 5983/* harmony export */ "AddToCart": () => (/* reexport safe */ _addToCart__WEBPACK_IMPORTED_MODULE_4__.AddToCart), 5984/* harmony export */ "ComboBox": () => (/* reexport safe */ _comboBox__WEBPACK_IMPORTED_MODULE_5__.ComboBox), 5985/* harmony export */ "Dropdown": () => (/* reexport safe */ _dropdown__WEBPACK_IMPORTED_MODULE_9__.Dropdown), 5986/* harmony export */ "KlaviyoForm": () => (/* reexport safe */ _klaviyoForm__WEBPACK_IMPORTED_MODULE_13__.KlaviyoForm), 5987/* harmony export */ "Newsletter": () => (/* reexport safe */ _newsletter__WEBPACK_IMPORTED_MODULE_10__.Newsletter), 5988/* harmony export */ "QtySelector": () => (/* reexport safe */ _qtySelector__WEBPACK_IMPORTED_MODULE_6__.QtySelector), 5989/* harmony export */ "Slider": () => (/* reexport safe */ _slider__WEBPACK_IMPORTED_MODULE_7__.Slider), 5990/* harmony export */ "Tooltip": () => (/* reexport safe */ _tooltip__WEBPACK_IMPORTED_MODULE_12__.Tooltip), 5991/* harmony export */ "TopBar": () => (/* reexport safe */ _topBar__WEBPACK_IMPORTED_MODULE_8__.TopBar), 5992/* harmony export */ "VideoPlayer": () => (/* reexport safe */ _videoPlayer__WEBPACK_IMPORTED_MODULE_11__.VideoPlayer), 5993/* harmony export */ "collapseAnnouncementSliderIfSingleSlide": () => (/* reexport safe */ _slider__WEBPACK_IMPORTED_MODULE_7__.collapseAnnouncementSliderIfSingleSlide) 5994/* harmony export */ }); 5995/* harmony import */ var _simple_tabs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./simple-tabs */ "./src/scripts/global/simple-tabs.js"); 5996/* harmony import */ var _modal_dialog__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modal-dialog */ "./src/scripts/global/modal-dialog.js"); 5997/* harmony import */ var _refresh_link__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./refresh-link */ "./src/scripts/global/refresh-link.js"); 5998/* harmony import */ var _accordion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./accordion */ "./src/scripts/global/accordion.js"); 5999/* harmony import */ var _addToCart__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addToCart */ "./src/scripts/global/addToCart.js"); 6000/* harmony import */ var _comboBox__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./comboBox */ "./src/scripts/global/comboBox.js"); 6001/* harmony import */ var _qtySelector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./qtySelector */ "./src/scripts/global/qtySelector.js"); 6002/* harmony import */ var _slider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./slider */ "./src/scripts/global/slider.js"); 6003/* harmony import */ var _topBar__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./topBar */ "./src/scripts/global/topBar.js"); 6004/* harmony import */ var _dropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./dropdown */ "./src/scripts/global/dropdown.js"); 6005/* harmony import */ var _newsletter__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./newsletter */ "./src/scripts/global/newsletter.js"); 6006/* harmony import */ var _videoPlayer__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./videoPlayer */ "./src/scripts/global/videoPlayer.js"); 6007/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./tooltip */ "./src/scripts/global/tooltip.js"); 6008/* harmony import */ var _klaviyoForm__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./klaviyoForm */ "./src/scripts/global/klaviyoForm.js"); 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024/***/ }), 6025
6026/***/ "./src/scripts/global/klaviyoForm.js": 6027/*!*******************************************!*\ 6028 !*** ./src/scripts/global/klaviyoForm.js ***! 6029 \*******************************************/ 6030/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6031 6032"use strict"; 6033__webpack_require__.r(__webpack_exports__); 6034/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6035/* harmony export */ "KlaviyoForm": () => (/* binding */ KlaviyoForm) 6036/* harmony export */ }); 6037function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6038function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6039function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6040function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6041function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6042function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6043/** 6044 * Represents a dropdown accordion 6045 * 6046 * Uses Custom Element <klaviyo-form> 6047 * 6048 * @constructor 6049 * @param {HTMLElement} container parent custom element 6050 */ 6051 6052var KlaviyoForm = /*#__PURE__*/function () { 6053 function KlaviyoForm(container) { 6054 _classCallCheck(this, KlaviyoForm); 6055 this.container = container; 6056 this.form = this.container.querySelector("form"); 6057 this.klaviyoListId = this.container.getAttribute("data-klaviyo-list-id"); 6058 this.email = this.container.querySelector('input[type="email"]'); 6059 this.phone = this.container.querySelector('input[type="tel"]'); 6060 this.companyId = "PbvgDc"; 6061 if (this.phone) { 6062 this.phone.addEventListener('input', this.onPhoneInput); 6063 this.phone.addEventListener("keydown", function (e) { 6064 if ((e.key === "Backspace" || e.key === "Delete") && this.value === "+1") { 6065 this.value = ""; 6066 } 6067 }); 6068 this.phone.addEventListener("focus", function () { 6069 if (!this.value.startsWith("+1")) { 6070 this.value = "+1" + this.value.replace(/^\+?[0-9]*/, ""); 6071 } 6072 }); 6073 this.phone.addEventListener("blur", function () { 6074 if (this.value === "+1") { 6075 this.value = ""; 6076 } 6077 }); 6078 } 6079 if (this.klaviyoListId) { 6080 this.form.addEventListener("submit", this.sendForm.bind(this)); 6081 } else { 6082 return console.error("Klaviyo form id not found."); 6083 } 6084 } 6085 _createClass(KlaviyoForm, [{ 6086 key: "formData", 6087 value: function formData() { 6088 var _this$container$query, _this$email, _this$phone; 6089 return { 6090 method: "POST", 6091 headers: { 6092 revision: "2024-02-15", 6093 "content-type": "application/json" 6094 }, 6095 body: JSON.stringify({ 6096 data: { 6097 type: "subscription", 6098 attributes: { 6099 custom_source: ((_this$container$query = this.container.querySelector('[name="contact[tags]"]')) === null || _this$container$query === void 0 ? void 0 : _this$container$query.value) || "Signup form", 6100 profile: { 6101 data: { 6102 type: "profile", 6103 attributes: { 6104 email: ((_this$email = this.email) === null || _this$email === void 0 ? void 0 : _this$email.value) || null, 6105 phone_number: ((_this$phone = this.phone) === null || _this$phone === void 0 ? void 0 : _this$phone.value) || null 6106 } 6107 } 6108 } 6109 }, 6110 relationships: { 6111 list: { 6112 data: { 6113 type: "list", 6114 id: this.klaviyoListId 6115 } 6116 } 6117 } 6118 } 6119 }) 6120 }; 6121 } 6122 }, { 6123 key: "showMessage", 6124 value: function showMessage(type) { 6125 var _this$email2, 6126 _this$phone2, 6127 _this$container$query2, 6128 _this2 = this; 6129 (_this$email2 = this.email) === null || _this$email2 === void 0 ? void 0 : _this$email2.classList.add(type); 6130 (_this$phone2 = this.phone) === null || _this$phone2 === void 0 ? void 0 : _this$phone2.classList.add(type); 6131 this.container.querySelectorAll(".klaviyo-form__message").forEach(function (message) { 6132 return message.classList.add("hide"); 6133 }); 6134 (_this$container$query2 = this.container.querySelector(".klaviyo-form__" + type)) === null || _this$container$query2 === void 0 ? void 0 : _this$container$query2.classList.remove("hide"); 6135 if (type === "success" && this.email) { 6136 var _this$container$query3; 6137 (_this$container$query3 = this.container.querySelector(".klaviyo-form__wrapper")) === null || _this$container$query3 === void 0 ? void 0 : _this$container$query3.classList.add("hide"); 6138 } 6139 setTimeout(function () { 6140 var _this2$email, _this2$phone, _this2$container$quer, _this2$container$quer2; 6141 (_this2$email = _this2.email) === null || _this2$email === void 0 ? void 0 : _this2$email.classList.remove(type); 6142 (_this2$phone = _this2.phone) === null || _this2$phone === void 0 ? void 0 : _this2$phone.classList.add(type); 6143 (_this2$container$quer = _this2.container.querySelector(".klaviyo-form__" + type)) === null || _this2$container$quer === void 0 ? void 0 : _this2$container$quer.classList.add("hide"); 6144 (_this2$container$quer2 = _this2.container.querySelector(".klaviyo-form__wrapper")) === null || _this2$container$quer2 === void 0 ? void 0 : _this2$container$quer2.classList.remove("hide"); 6145 }, 7000); 6146 } 6147 }, { 6148 key: "sendForm", 6149 value: function sendForm(event) { 6150 event.preventDefault(); 6151 var _this = this; 6152 if (this.emailValidation() && this.phoneValidation()) { 6153 fetch("https://a.klaviyo.com/client/subscriptions/?company_id=".concat(this.companyId), this.formData()).then(function (response) { 6154 if (response.status === 202) { 6155 var redirect = _this.container.getAttribute('data-success-redirect'); 6156 if (redirect) { 6157 window.location.href = redirect; 6158 } else { 6159 _this.showMessage("success"); 6160 } 6161 } else { 6162 _this.showMessage("error"); 6163 } 6164 })["catch"](function (err) { 6165 console.error(err); 6166 _this.showMessage("error"); 6167 }); 6168 } else { 6169 var errorType = "error-email"; 6170 if (!this.phoneValidation() && this.emailValidation()) errorType = "error-phone"; 6171 console.log(errorType); 6172 this.showMessage(errorType); 6173 } 6174 } 6175 }, { 6176 key: "emailValidation", 6177 value: function emailValidation() { 6178 if (this.email) { 6179 var emailValue = this.email.value; 6180 var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 6181 var result = re.test(emailValue); 6182 return result && result !== ""; 6183 } else { 6184 return true; 6185 } 6186 } 6187 }, { 6188 key: "phoneValidation", 6189 value: function phoneValidation() { 6190 if (this.phone) { 6191 var phoneValue = this.phone.value; 6192 var re = /^\+[1-9]\d{1,14}$/; 6193 var result = re.test(phoneValue); 6194 return result && result !== ""; 6195 } else { 6196 return true; 6197 } 6198 } 6199 }, { 6200 key: "onPhoneInput", 6201 value: function onPhoneInput() { 6202 var phoneInput = this.value; 6203 phoneInput = phoneInput.replace(/[^0-9+]/g, ""); 6204 if (!phoneInput.startsWith("+1")) { 6205 phoneInput = "+1" + phoneInput.replace(/^\+?[0-9]*/, ""); 6206 } 6207 this.value = phoneInput; 6208 } 6209 }]); 6210 return KlaviyoForm; 6211}(); 6212 6213/***/ }), 6214
vendor: 4,062 bytes, lines 6215-6237
6215/***/ "./src/scripts/global/modal-dialog.js": 6216/*!********************************************!*\ 6217 !*** ./src/scripts/global/modal-dialog.js ***! 6218 \********************************************/ 6219/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6220 6221"use strict"; 6222__webpack_require__.r(__webpack_exports__); 6223/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6224/* harmony export */ "ModalDialog": () => (/* binding */ ModalDialog), 6225/* harmony export */ "ModalOpener": () => (/* binding */ ModalOpener) 6226/* harmony export */ }); 6227function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6228function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6229function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6230function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6231function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6232function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6233function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 6234function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 6235function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 6236function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 6237function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); }
6237 Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 6238function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 6239function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 6240function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 6241function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 6242function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 6243var ModalDialog = /*#__PURE__*/function (_HTMLElement) { 6244 _inherits(ModalDialog, _HTMLElement); 6245 var _super = _createSuper(ModalDialog); 6246 function ModalDialog() { 6247 var _this; 6248 _classCallCheck(this, ModalDialog); 6249 _this = _super.call(this); 6250 _this.popup = _this.querySelector('[data-popup]'); 6251 _this.overlay = document.querySelector('.page-overlay'); 6252 _this.closeBtn = _this.querySelectorAll('[data-close-popup]'); 6253 _this.autoOpen = _this.hasAttribute('data-auto-open'); 6254 _this.checkParams(); 6255 console.log(_this.autoOpen); 6256 console.log(Shopify.designMode); 6257 if (_this.autoOpen && !Shopify.designMode) { 6258 setTimeout(function () { 6259 _this.show(); 6260 }, 1000); 6261 } 6262 _this.closeBtn.forEach(function (btn) { 6263 return btn.addEventListener('click', _this.hide.bind(_assertThisInitialized(_this))); 6264 }); 6265 _this.addEventListener('keyup', function (event) { 6266 var _event$code; 6267 if (((_event$code = event.code) === null || _event$code === void 0 ? void 0 : _event$code.toUpperCase()) === 'ESCAPE') _this.hide(); 6268 }); 6269 _this.addEventListener('click', function (event) { 6270 if (event.target.nodeName === 'MODAL-DIALOG') _this.hide(); 6271 }); 6272 if (_this.overlay) { 6273 _this.overlay.addEventListener('click', function (e) { 6274 var isClickInside = _this.contains(e.target); 6275 if (!isClickInside) _this.hide(); 6276 }); 6277 } 6278 document.addEventListener('click', function (e) { 6279 var link = e.target.closest('a'); 6280 if (!link) return; 6281 var href = link.href; 6282 var url = new URL(href); 6283 var popupId = url.searchParams.get('popup_open'); 6284 if (!popupId) return; 6285 var currentUrlBase = window.location.origin + window.location.pathname + window.location.hash; 6286 var linkUrlBase = url.origin + url.pathname + url.hash; 6287 if (currentUrlBase === linkUrlBase && popupId === _this.id) { 6288 e.preventDefault(); 6289 _this.show(); 6290 } 6291 }); 6292 return _this; 6293 } 6294 _createClass(ModalDialog, [{ 6295 key: "checkParams", 6296 value: function checkParams() { 6297 var _this2 = this; 6298 var params = new URLSearchParams(window.location.search); 6299 var popupId = params.get('popup_open'); 6300 if (popupId && popupId === this.id) { 6301 setTimeout(function () { 6302 _this2.show(); 6303 }, 1000); 6304 params["delete"]('popup_open'); 6305 var newUrl = window.location.pathname + (params.toString() ? '?' + params.toString() : '') + window.location.hash; 6306 window.history.replaceState({}, '', newUrl); 6307 } 6308 } 6309 }, { 6310 key: "show", 6311 value: function show(opener) { 6312 this.openedBy = opener; 6313 if (this.overlay) this.overlay.setAttribute('aria-hidden', 'false'); 6314 this.popup.setAttribute('aria-hidden', 'false'); 6315 if (this.openedBy) this.openedBy.setAttribute('aria-expanded', 'true'); 6316 document.documentElement.classList.add('tw-overflow-hidden'); 6317 if (this.popup.querySelector('.cart-view-event')) { 6318 this.popup.querySelector('.cart-view-event').classList.remove('hide'); 6319 } 6320 var pdpContainer = document.querySelector("[data-barba='container']"); 6321 if (pdpContainer) pdpContainer.style.zIndex = '50'; 6322 } 6323 }, { 6324 key: "hide", 6325 value: function hide() { 6326 this.popup.setAttribute('aria-hidden', 'true'); 6327 document.documentElement.classList.remove('tw-overflow-hidden'); 6328 if (this.openedBy) this.openedBy.setAttribute('aria-expanded', 'false'); 6329 if (this.overlay) this.overlay.setAttribute('aria-hidden', 'true'); 6330 var pdpContainer = document.querySelector("[data-barba='container']"); 6331 if (pdpContainer) setTimeout(function () { 6332 pdpContainer.style.zIndex = ''; 6333 }, 300); 6334 } 6335 }]); 6336 return ModalDialog; 6337}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); 6338var ModalOpener = /*#__PURE__*/function (_HTMLElement2) { 6339 _inherits(ModalOpener, _HTMLElement2); 6340 var _super2 = _createSuper(ModalOpener); 6341 function ModalOpener() { 6342 var _this3; 6343 _classCallCheck(this, ModalOpener); 6344 _this3 = _super2.call(this); 6345 var button = _this3.querySelector('[aria-controls]'); 6346 if (!button) return _possibleConstructorReturn(_this3); 6347 var modalElement = document.querySelector(button.getAttribute('aria-controls')); 6348 if (!modalElement) return _possibleConstructorReturn(_this3); 6349 var modal = modalElement.querySelector('[data-popup]'); 6350 button.addEventListener('click', function (e) { 6351 e.preventDefault(); 6352 if (modal.getAttribute('aria-hidden') === 'false') { 6353 modalElement.hide(); 6354 } else { 6355 modalElement.show(button); 6356 } 6357 }); 6358 return _this3; 6359 } 6360 return _createClass(ModalOpener); 6361}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); 6362document.addEventListener('DOMContentLoaded', function () { 6363 if (!customElements.get('modal-dialog')) { 6364 customElements.define('modal-dialog', ModalDialog); 6365 } 6366 if (!customElements.get('modal-opener')) { 6367 customElements.define('modal-opener', ModalOpener); 6368 } 6369}); 6370 6371/***/ }), 6372
6373/***/ "./src/scripts/global/newsletter.js": 6374/*!******************************************!*\ 6375 !*** ./src/scripts/global/newsletter.js ***! 6376 \******************************************/ 6377/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6378 6379"use strict"; 6380__webpack_require__.r(__webpack_exports__); 6381/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6382/* harmony export */ "Newsletter": () => (/* binding */ Newsletter) 6383/* harmony export */ }); 6384function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6385function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6386function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6387function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6388function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6389function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6390var Newsletter = /*#__PURE__*/function () { 6391 function Newsletter(section) { 6392 _classCallCheck(this, Newsletter); 6393 this.section = section; 6394 this.listId = section.dataset.listId; 6395 this.source = section.dataset.source; 6396 this.form = section.querySelector('form'); 6397 this.klaviyoListId = section.dataset.listId; 6398 this.email = section.querySelector('input[type="email"]'); 6399 this.companyId = 'PbvgDc'; 6400 if (this.klaviyoListId) { 6401 this.form.addEventListener('submit', this.sendForm.bind(this)); 6402 } else { 6403 return console.error('Klaviyo form id not found.'); 6404 } 6405 } 6406 _createClass(Newsletter, [{ 6407 key: "formData", 6408 value: function formData() { 6409 return { 6410 method: 'POST', 6411 headers: { 6412 revision: '2024-02-15', 6413 'content-type': 'application/json' 6414 }, 6415 body: JSON.stringify({ 6416 data: { 6417 type: 'subscription', 6418 attributes: { 6419 custom_source: this.source, 6420 profile: { 6421 data: { 6422 type: 'profile', 6423 attributes: { 6424 email: this.email ? this.email.value : '' 6425 } 6426 } 6427 } 6428 }, 6429 relationships: { 6430 list: { 6431 data: { 6432 type: 'list', 6433 id: this.klaviyoListId 6434 } 6435 } 6436 } 6437 } 6438 }) 6439 }; 6440 } 6441 }, { 6442 key: "showMessage", 6443 value: function showMessage(type) { 6444 var _this$section$querySe, 6445 _this2 = this; 6446 (_this$section$querySe = this.section.querySelectorAll('.form-message')) === null || _this$section$querySe === void 0 ? void 0 : _this$section$querySe.forEach(function (item) { 6447 return item.classList.add('hide'); 6448 }); 6449 this.section.querySelector('.form-message__' + type).classList.remove('hide'); 6450 setTimeout(function () { 6451 _this2.section.querySelector('.form-message__' + type).classList.add('hide'); 6452 }, 10000); 6453 } 6454 }, { 6455 key: "sendForm", 6456 value: function sendForm(event) { 6457 event.preventDefault(); 6458 var _this = this; 6459 var input = this.section.querySelector('input[name="email"]'); 6460 console.log(this.emailValidation()); 6461 if (this.emailValidation()) { 6462 fetch("https://a.klaviyo.com/client/subscriptions/?company_id=".concat(this.companyId), this.formData()).then(function (response) { 6463 if (response.status === 202) { 6464 input.value = ''; 6465 _this.showMessage("success"); 6466 } else { 6467 _this.showMessage("error"); 6468 } 6469 })["catch"](function (err) { 6470 console.error(err); 6471 _this.showMessage("error"); 6472 }); 6473 } else { 6474 this.showMessage("error-email"); 6475 } 6476 } 6477 }, { 6478 key: "emailValidation", 6479 value: function emailValidation() { 6480 if (this.email) { 6481 var emailValue = this.email.value; 6482 var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 6483 var result = re.test(emailValue); 6484 return result && result !== ''; 6485 } else { 6486 return true; 6487 } 6488 } 6489 }]); 6490 return Newsletter; 6491}(); 6492 6493/***/ }), 6494
6495/***/ "./src/scripts/global/qtySelector.js": 6496/*!*******************************************!*\ 6497 !*** ./src/scripts/global/qtySelector.js ***! 6498 \*******************************************/ 6499/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6500 6501"use strict"; 6502__webpack_require__.r(__webpack_exports__); 6503/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6504/* harmony export */ "QtySelector": () => (/* binding */ QtySelector) 6505/* harmony export */ }); 6506function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6507function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6508function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6509function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6510function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 6511function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6512function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6513/** 6514 6515QtySelector class provides functionality to select a quantity by adding or subtracting from an input field. 6516 6517@class 6518@param {HTMLFormElement} form - The form element containing the quantity selector inputs. 6519@property {HTMLFormElement} form - The form element containing the quantity selector inputs. 6520@property {number} total - The current quantity selected. 6521@property {HTMLInputElement} value_display - The input field displaying the selected quantity. 6522@property {Object} controls - The controls for adding and subtracting from the selected quantity. 6523@property {HTMLButtonElement} controls.add - The button element for adding to the selected quantity. 6524@property {HTMLButtonElement} controls.subtract - The button element for subtracting from the selected quantity. 6525 6526*/ 6527 6528var QtySelector = /*#__PURE__*/_createClass( 6529/** 6530 * Creates a new `QtySelector` instance. 6531 * 6532 * @param {HTMLElement} form - The HTML form element that contains the quantity selector. 6533 */ 6534function QtySelector(_form) { 6535 var _this = this; 6536 _classCallCheck(this, QtySelector); 6537 /** 6538 * Increases the current quantity value by 1, up to a maximum of 99. 6539 * 6540 */ 6541 _defineProperty(this, "_increase", function () { 6542 if (_this.total < 99) { 6543 _this.total += 1; 6544 _this.value_display.value = _this.total; 6545 _this.value_display.setAttribute("aria-valuenow", _this.total); 6546 } 6547 }); 6548 /** 6549 * Decreases the current quantity value by 1, down to a minimum of 1. 6550 * 6551 */ 6552 _defineProperty(this, "_decrease", function () { 6553 if (_this.total > 1) { 6554 _this.total -= 1; 6555 _this.value_display.value = _this.total; 6556 _this.value_display.setAttribute("aria-valuenow", _this.total); 6557 } 6558 }); 6559 /** 6560 * Returns the current quantity value. 6561 * 6562 * @returns {number} - The current quantity value. 6563 */ 6564 _defineProperty(this, "_getTotal", function () { 6565 return _this.total; 6566 }); 6567 /** 6568 * Refreshes the `QtySelector` instance with a new HTML form element that contains the quantity selector. 6569 * 6570 * @param {HTMLElement} form - The new HTML form element that contains the quantity selector. 6571 */ 6572 _defineProperty(this, "_refresh", function (form) { 6573 _this.form = form; 6574 _this.value_display = form.querySelector(".quantity__input"), _this.controls = { 6575 add: form.querySelector("qty-add"), 6576 subtract: form.querySelector("qty-subtract") 6577 }; 6578 if (_this.value_display && _this.controls.add && _this.controls.subtract) { 6579 _this.value_display.value = _this.total;
6580 _this._addControls(); 6581 } else { 6582 throw new Error("Quantity Selector Elements Missing"); 6583 } 6584 }); 6585 /** 6586 * Adds event listeners to the quantity selector controls. 6587 */ 6588 _defineProperty(this, "_addControls", function () { 6589 _this.controls.add.addEventListener("click", _this._increase); 6590 _this.controls.add.addEventListener("keydown", function (e) { 6591 if (e.key == "Enter") { 6592 _this._increase(); 6593 } 6594 }); 6595 _this.controls.subtract.addEventListener("click", _this._decrease); 6596 _this.controls.subtract.addEventListener("keydown", function (e) { 6597 if (e.key == "Enter") { 6598 _this._decrease(); 6599 } 6600 }); 6601 }); 6602 /** 6603 * Initializes the `QtySelector` instance by adding event listeners to the quantity selector controls. 6604 */ 6605 _defineProperty(this, "_init", function () { 6606 _this._addControls(); 6607 }); 6608 this.form = _form, this.total = 1, this.value_display = _form.querySelector(".quantity__input"), this.controls = { 6609 add: _form.querySelector("qty-add"), 6610 subtract: _form.querySelector("qty-subtract") 6611 }; 6612 if (this.value_display && this.controls.add && this.controls.subtract) { 6613 this._init(); 6614 } else { 6615 throw new Error("Quantity Selector Elements Missing"); 6616 } 6617}); 6618 6619/***/ }), 6620
vendor: 5,270 bytes, lines 6621-6646
6621/***/ "./src/scripts/global/refresh-link.js": 6622/*!********************************************!*\ 6623 !*** ./src/scripts/global/refresh-link.js ***! 6624 \********************************************/ 6625/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6626 6627"use strict"; 6628__webpack_require__.r(__webpack_exports__); 6629/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6630/* harmony export */ "RefreshLink": () => (/* binding */ RefreshLink) 6631/* harmony export */ }); 6632function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6633function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6634function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6635function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6636function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6637function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6638function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 6639function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 6640function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 6641function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 6642function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 6643function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 6644function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 6645function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 6646function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6647function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 6648var RefreshLink = /*#__PURE__*/function (_HTMLElement) { 6649 _inherits(RefreshLink, _HTMLElement); 6650 var _super = _createSuper(RefreshLink); 6651 function RefreshLink() { 6652 var _this; 6653 _classCallCheck(this, RefreshLink); 6654 _this = _super.call(this); 6655 _this.refreshLink = _this.querySelector('a'); 6656 if (!_this.refreshLink) return _possibleConstructorReturn(_this); 6657 _this.initClick(); 6658 return _this; 6659 } 6660 _createClass(RefreshLink, [{ 6661 key: "initClick", 6662 value: function initClick() { 6663 this.refreshLink.addEventListener('click', function (e) { 6664 e.preventDefault(); 6665 e.stopPropagation(); 6666 e.stopImmediatePropagation(); 6667 var element = e.target.closest('a[href]'); 6668 var targetUrl = element === null || element === void 0 ? void 0 : element.getAttribute('href'); 6669 if (!targetUrl) return; 6670 if (window.location.href === targetUrl || window.location.pathname === targetUrl || !targetUrl) { 6671 window.location.reload(); 6672 return; 6673 } 6674 window.location.href = targetUrl; 6675 }); 6676 } 6677 }]); 6678 return RefreshLink; 6679}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); 6680document.addEventListener('DOMContentLoaded', function () { 6681 if (!customElements.get('refresh-link')) { 6682 customElements.define('refresh-link', RefreshLink); 6683 } 6684}); 6685 6686/***/ }), 6687
vendor: 5,264 bytes, lines 6688-6713
6688/***/ "./src/scripts/global/simple-tabs.js": 6689/*!*******************************************!*\ 6690 !*** ./src/scripts/global/simple-tabs.js ***! 6691 \*******************************************/ 6692/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6693 6694"use strict"; 6695__webpack_require__.r(__webpack_exports__); 6696/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6697/* harmony export */ "SimpleTabs": () => (/* binding */ SimpleTabs) 6698/* harmony export */ }); 6699function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6700function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6701function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6702function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6703function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6704function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6705function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 6706function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 6707function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 6708function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 6709function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 6710function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 6711function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 6712function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 6713function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6714function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 6715var SimpleTabs = /*#__PURE__*/function (_HTMLElement) { 6716 _inherits(SimpleTabs, _HTMLElement); 6717 var _super = _createSuper(SimpleTabs); 6718 function SimpleTabs() { 6719 _classCallCheck(this, SimpleTabs); 6720 return _super.apply(this, arguments); 6721 } 6722 _createClass(SimpleTabs, [{ 6723 key: "connectedCallback", 6724 value: function connectedCallback() { 6725 var buttons = this.querySelectorAll('.js-simple-tabs-button'); 6726 var contents = this.querySelectorAll('.js-simple-tabs-content'); 6727 buttons === null || buttons === void 0 ? void 0 : buttons.forEach(function (btn, index) { 6728 btn === null || btn === void 0 ? void 0 : btn.addEventListener('click', function () { 6729 buttons.forEach(function (b) { 6730 return b.setAttribute('aria-expanded', 'false'); 6731 }); 6732 contents === null || contents === void 0 ? void 0 : contents.forEach(function (p) { 6733 return p === null || p === void 0 ? void 0 : p.setAttribute('aria-hidden', 'true'); 6734 }); 6735 btn.setAttribute('aria-expanded', 'true'); 6736 contents[index].setAttribute('aria-hidden', 'false'); 6737 }); 6738 }); 6739 } 6740 }]); 6741 return SimpleTabs; 6742}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); 6743document.addEventListener('DOMContentLoaded', function () { 6744 if (!customElements.get('simple-tabs')) { 6745 customElements.define('simple-tabs', SimpleTabs); 6746 } 6747}); 6748 6749/***/ }), 6750
vendor: 5,126 bytes, lines 6751-6801
6751/***/ "./src/scripts/global/slider.js": 6752/*!**************************************!*\ 6753 !*** ./src/scripts/global/slider.js ***! 6754 \**************************************/ 6755/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6756 6757"use strict"; 6758__webpack_require__.r(__webpack_exports__); 6759/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6760/* harmony export */ "Slider": () => (/* binding */ Slider), 6761/* harmony export */ "collapseAnnouncementSliderIfSingleSlide": () => (/* binding */ collapseAnnouncementSliderIfSingleSlide), 6762/* harmony export */ "equalizeKeenAnnouncementSlides": () => (/* binding */ equalizeKeenAnnouncementSlides) 6763/* harmony export */ }); 6764/* harmony import */ var keen_slider_keen_slider_min_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 6765/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 6766function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 6767function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 6768function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 6769function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 6770function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 6771function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 6772function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 6773function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 6774function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 6775function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 6776function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 6777function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 6778function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 6779/* 6780 6781 Global Slider Component 6782 ------------------------ 6783 6784 A class representing a global slider component that uses the Keen Slider library. It allows customization through data-attributes set on the slider container. The slider is responsive and can have different number of slides displayed depending on the screen size. It also supports navigation and controls. 6785 6786 Note** data-attributes should be set on slider container to control the following options: 6787 6788 maxWidth <data-max-width> slider breaks after this screen width ( default none ) 6789 minWidth <data-min-width> slider breaks before this screen width ( default 0 ) 6790 perView desktop <data-per-view-desktop> how many slides will display on desktop ( default 1 ) 6791 perView mobile <data-per-view-mobile> how many slides will display on mobile/tablet ( default 1 ) 6792 hasLoop <data-slider-loop> does slider loopp (default false) 6793 6794 6795*/ 6796 6797 6798 6799 6800/** Safe value for [data-key="..."] selectors (Shopify section ids can include -- and "). */ 6801function escapeDataKeyAttr(key) {
6802 if (key == null || key === "") { 6803 return ""; 6804 } 6805 return String(key).replace(/\\/g, "\\\\").replace(/"/g, '\\"'); 6806} 6807 6808/** 6809 * Prefer controls/nav inside the same section tree as the slider to avoid selector edge cases. 6810 */ 6811function querySliderPart(container, tagName, key) { 6812 var _ref, _container$parentElem, _container$parentElem2, _container$closest; 6813 var k = escapeDataKeyAttr(key); 6814 if (!k) { 6815 return null; 6816 } 6817 var sel = "".concat(tagName, "[data-key=\"").concat(k, "\"]"); 6818 return (_ref = (_container$parentElem = (_container$parentElem2 = container.parentElement) === null || _container$parentElem2 === void 0 ? void 0 : _container$parentElem2.querySelector(sel)) !== null && _container$parentElem !== void 0 ? _container$parentElem : (_container$closest = container.closest(".shopify-section")) === null || _container$closest === void 0 ? void 0 : _container$closest.querySelector(sel)) !== null && _ref !== void 0 ? _ref : document.querySelector(sel); 6819} 6820 6821/** 6822 * Match announcement slides to a stable bar height. 6823 * - Injected promo mirror slides are measured against "simple" slides only (not full clone height). 6824 * - Slides with a countdown ([data-end-date]) are excluded from the shared max so one tall timer 6825 * row does not force every slide to ~150px+; those slides keep their natural height. 6826 * - Keenâs `.keen-slider__slide { min-height: 100% }` makes every slide as tall as the tallest 6827 * slide, so offsetHeight is wrong until we override min-height for measurement. 6828 * - The flex row also uses default `align-items: stretch`, so every slideâs offsetHeight matches 6829 * the tallest slide (e.g. countdown row) unless we measure with `align-self: flex-start`. 6830 * @param {HTMLElement | null | undefined} container - keen-slider root 6831 */ 6832function equalizeKeenAnnouncementSlides(container) { 6833 if (!container || !container.hasAttribute("data-equal-slide-height")) { 6834 return; 6835 } 6836 try { 6837 equalizeKeenAnnouncementSlidesInner(container); 6838 } catch (err) { 6839 console.error("[equalizeKeenAnnouncementSlides]", err); 6840 } 6841} 6842function equalizeKeenAnnouncementSlidesInner(container) { 6843 var allSlides = container.querySelectorAll(".keen-slider__slide"); 6844 if (!allSlides.length) { 6845 return; 6846 } 6847 var isMirrorSlide = function isMirrorSlide(el) {
6848 return el.hasAttribute("data-injected-promotion-slide") || el.classList.contains("announcement-bar__promo-mirror"); 6849 }; 6850 var hasCountdown = function hasCountdown(el) { 6851 return el.querySelector("[data-end-date]"); 6852 }; 6853 allSlides.forEach(function (el) { 6854 el.style.minHeight = ""; 6855 }); 6856 allSlides.forEach(function (el) { 6857 el.style.setProperty("min-height", "0", "important"); 6858 }); 6859 6860 /** @type {Map<Element, string>} */ 6861 var prevAlignSelf = new Map(); 6862 allSlides.forEach(function (el) { 6863 prevAlignSelf.set(el, el.style.alignSelf); 6864 el.style.setProperty("align-self", "flex-start", "important"); 6865 }); 6866 var heights = new Map(); 6867 allSlides.forEach(function (el) { 6868 heights.set(el, el.offsetHeight); 6869 }); 6870 allSlides.forEach(function (el) { 6871 var prev = prevAlignSelf.get(el); 6872 if (prev) { 6873 el.style.alignSelf = prev; 6874 } else { 6875 el.style.removeProperty("align-self"); 6876 } 6877 }); 6878 allSlides.forEach(function (el) { 6879 el.style.removeProperty("min-height"); 6880 }); 6881 var basisSlides = _toConsumableArray(allSlides).filter(function (el) { 6882 return !isMirrorSlide(el) && !hasCountdown(el); 6883 }); 6884 var basisForMax = basisSlides.length ? basisSlides : _toConsumableArray(allSlides).filter(function (el) { 6885 return !isMirrorSlide(el); 6886 }); 6887 var max = 0; 6888 basisForMax.forEach(function (el) { 6889 max = Math.max(max, heights.get(el) || 0); 6890 }); 6891 if (max <= 0) { 6892 return; 6893 } 6894 allSlides.forEach(function (el) { 6895 if (isMirrorSlide(el)) { 6896 el.style.minHeight = "".concat(max, "px"); 6897 } else if (hasCountdown(el)) { 6898 var h = heights.get(el) || max; 6899 el.style.minHeight = "".concat(Math.max(max, h), "px"); 6900 } else { 6901 el.style.minHeight = "".concat(max, "px"); 6902 } 6903 }); 6904} 6905var Slider = /*#__PURE__*/function () { 6906 /* 6907 Creates an instance of Slider. 6908 @constructor 6909 @param {HTMLElement} container - The HTML element that contains the slider. 6910 */ 6911 function Slider(container) { 6912 var _this = this; 6913 _classCallCheck(this, Slider); 6914 /** 6915 * When data-equal-slide-height is set, set each slide min-height to the tallest 6916 * slide so the bar does not jump between messages. 6917 */ 6918 _defineProperty(this, "_equalizeSlideHeights", function () { 6919 if (!_this.slider.instance) { 6920 return; 6921 } 6922 equalizeKeenAnnouncementSlides(_this.slider.container); 6923 }); 6924 /** 6925 Builds the slider instance using the KeenSlider library. 6926 */ 6927 _defineProperty(this, "_build", function () { 6928 /* Runtime collapse (single slide after prune) sets data-disabled â do not rebuild Keen. */ 6929 if (_this.slider.container.dataset.disabled === "true") { 6930 return; 6931 } 6932 // check if the slider is disabled and remove the attribute if it exists 6933 if (_this.slider.container.hasAttribute("data-keen-slider-disabled")) { 6934 _this.slider.container.removeAttribute("data-keen-slider-disabled"); 6935 } 6936 6937 // check if navigation is enabled and get the nav links and fill color 6938 if (_this.nav.container != null) { 6939 _this.nav.links = _this.nav.container.querySelectorAll("nav-dot"); 6940 _this.nav.fill = _this.nav.container.dataset.fill; 6941 } 6942 6943 // check if controls are enabled and get the previous and next buttons 6944 if (_this.controls.container != null) { 6945 _this.controls.prev = _this.controls.container.querySelector("control-prev"); 6946 _this.controls.next = _this.controls.container.querySelector("control-next"); 6947 } 6948 6949 // check if the slider has a loop attribute (loop can fail internal init in edge cases) 6950 var hasLoopAttr = _this.slider.container.hasAttribute("data-slider-loop"); 6951 var slideCount = _this._slideElements().length; 6952 var hasLoop = hasLoopAttr && slideCount >= 2; 6953 6954 // check autoplay 6955 var hasAutoplay = _this.slider.container.hasAttribute("data-autoplay"); 6956 var plugins = []; 6957 if (hasAutoplay) { 6958 var autoplaySpeed = Number(_this.slider.container.getAttribute("data-autoplay")) * 1000; 6959 plugins = [function (slider) { 6960 var timeout; 6961 var mouseOver = false;
6962 function clearNextTimeout() { 6963 clearTimeout(timeout); 6964 } 6965 function nextTimeout() { 6966 clearTimeout(timeout); 6967 if (mouseOver) return; 6968 timeout = setTimeout(function () { 6969 slider.next(); 6970 }, autoplaySpeed); 6971 } 6972 slider.on("created", function () { 6973 slider.container.addEventListener("mouseover", function () { 6974 mouseOver = true; 6975 clearNextTimeout(); 6976 }); 6977 slider.container.addEventListener("mouseout", function () { 6978 mouseOver = false; 6979 nextTimeout(); 6980 }); 6981 nextTimeout(); 6982 }); 6983 slider.on("dragStarted", clearNextTimeout); 6984 slider.on("animationEnded", nextTimeout); 6985 slider.on("updated", nextTimeout); 6986 }]; 6987 } 6988 _this.slider.renderMode = _this.slider.container.hasAttribute("data-mode") ? _this.slider.container.dataset.mode : "precision"; 6989 try { 6990 // String selector re-queries the container on update(); a static NodeList goes stale 6991 // when slides are removed (e.g. hidden integrated promotion blocks), leaving empty track slots. 6992 _this.slider.instance = new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](_this.slider.container, { 6993 selector: function selector(root) { 6994 return Array.from(root.querySelectorAll(".keen-slider__slide")); 6995 }, 6996 slides: { 6997 spacing: 20, 6998 // space between slides 6999 perView: _this.slider.perView.mobile ? _this.slider.perView.mobile : 1 // number of slides to show on mobile 7000 }, 7001 7002 breakpoints: { 7003 "(min-width: 768px)": { 7004 slides: { 7005 perView: _this.slider.perView.tablet ? _this.slider.perView.tablet : 1, 7006 spacing: 20 7007 } 7008 }, 7009 "(min-width: 1024px)": { 7010 slides: { 7011 perView: _this.slider.perView.desktop ? _this.slider.perView.desktop : 1, 7012 spacing: 20 7013 } 7014 } 7015 }, 7016 loop: hasLoop, 7017 renderMode: _this.slider.renderMode, 7018 created: function created(keen) { 7019 _this.slider.container._keenSliderInstance = keen; 7020 _this.slider.slides = _this._slideElements(); 7021 7022 // Use live slide list (prune/mirror can change DOM before/after hooks). 7023 _this.slider.slides.forEach(function (el) { 7024 el.style.opacity = "1"; 7025 }); 7026 try { 7027 _this._buildNav(); 7028 if (_this.controls.container) { 7029 _this._buildControls(); 7030 } 7031 } catch (setupErr) { 7032 console.error("[Slider] Navigation/controls setup failed:", setupErr); 7033 } 7034 requestAnimationFrame(function () { 7035 _this._equalizeSlideHeights(); 7036 }); 7037 }, 7038 updated: function updated() { 7039 _this.slider.slides = _this._slideElements(); 7040 /* Liquid ships slides with opacity:0; created() fixes once. After prune/mirror, 7041 * promotionBanner calls update() â without this, slides stay invisible. Custom 7042 * renderMode still gets correct values from detailsChanged below. */ 7043 _this.slider.slides.forEach(function (el) { 7044 el.style.opacity = "1"; 7045 }); 7046 requestAnimationFrame(function () { 7047 _this._equalizeSlideHeights(); 7048 }); 7049 }, 7050 slideChanged: function slideChanged(data) { 7051 // update the slider based on the current slide index 7052 _this._updateSlider(data.track.details.rel); 7053 }, 7054 detailsChanged: function detailsChanged(s) { 7055 if (_this.slider.renderMode === "custom") { 7056 s.slides.forEach(function (element, idx) { 7057 element.style.opacity = s.track.details.slides[idx].portion; 7058 }); 7059 } 7060 }, 7061 destroyed: function destroyed() { 7062 delete _this.slider.container._keenSliderInstance; 7063 _this.slider.instance = false;
7064 if (_this.slider.container.hasAttribute("data-equal-slide-height")) { 7065 window.removeEventListener("resize", _this._boundEqualizeHeights); 7066 } 7067 // set the disabled attribute to the slider container and reset the slides 7068 _this.slider.container.setAttribute("data-keen-slider-disabled", null); 7069 _this._resetSlides(); 7070 } 7071 }, plugins); 7072 } catch (err) { 7073 console.error("[Slider] KeenSlider failed to initialize:", err); 7074 _this.slider.instance = false; 7075 _this.slider.container.querySelectorAll(".keen-slider__slide").forEach(function (el) { 7076 el.style.opacity = "1"; 7077 }); 7078 } 7079 7080 /* Keen wraps init in try/catch and returns undefined on failure without rethrowing, 7081 * so created() never runs and slides stay at Liquid opacity:0. Recover explicitly. */ 7082 if (!_this.slider.container._keenSliderInstance) { 7083 console.error("[Slider] KeenSlider did not finish initializing; see keen-slider logs above. Showing slides without carousel."); 7084 _this.slider.instance = false; 7085 _this.slider.container.querySelectorAll(".keen-slider__slide").forEach(function (el) { 7086 el.style.opacity = "1"; 7087 }); 7088 } 7089 }); 7090 /** 7091 Updates the slider by changing the currently displayed slide and updating the navigation dots, if present. 7092 @param {number} newIdx - The index of the slide to display. 7093 @returns {void} 7094 */ 7095 _defineProperty(this, "_updateSlider", function (newIdx) { 7096 // this.slider.slides[this.index].setAttribute("aria-hidden", true); 7097 // this.slider.slides[newIdx].setAttribute("aria-hidden", false); 7098 7099 if (_this.slider.renderMode === "custom") { 7100 var slides = _this._slideElements(); 7101 slides[_this.index].style.zIndex = "1"; 7102 slides[newIdx].style.zIndex = "5"; 7103 } 7104 if (_this.nav.container != null) { 7105 _this.nav.links[_this.index].style.background = "transparent"; 7106 _this.nav.links[_this.index].setAttribute("aria-current", false); 7107 _this.nav.links[newIdx].style.background = "".concat(_this.nav.fill); 7108 _this.nav.links[newIdx].setAttribute("aria-current", true); 7109 } 7110 _this.index = newIdx; 7111 }); 7112 /** 7113 Handles the click event on navigation dots or controls to move the slider to the corresponding slide. 7114 @param {Object} e - The event object representing the click event. 7115 */ 7116 _defineProperty(this, "_handleClick", function (e) { 7117 var index = e.currentTarget.dataset.key; 7118 _this.slider.instance.moveToIdx(parseInt(index)); 7119 }); 7120 /** 7121 Handles the previous slide event 7122 */ 7123 _defineProperty(this, "_handlePrev", function () { 7124 _this.slider.instance.prev(); 7125 }); 7126 /** 7127 Handles the next slide event 7128 */ 7129 _defineProperty(this, "_handleNext", function () { 7130 _this.slider.instance.next(); 7131 }); 7132 /** 7133 Handles the keydown event 7134 @param {Event} e - the event object 7135 */ 7136 _defineProperty(this, "_handleKeyDown", function (e) { 7137 var action = e.target.dataset.action; 7138 if (e.key === "Enter" && action === "prev") { 7139 return _this._handlePrev(); 7140 } 7141 if (e.key === "Enter" && action === "next") { 7142 return _this._handleNext(); 7143 } 7144 if (e.key === "ArrowLeft" && e.target.localName === "control-next") { 7145 return _this.controls.prev.focus(); 7146 } 7147 if (e.key === "ArrowRight" && e.target.localName === "control-prev") { 7148 return _this.controls.next.focus(); 7149 } 7150 }); 7151 /** 7152 Builds navigation dots and adds event listener for click on each dot 7153 */ 7154 _defineProperty(this, "_buildNav", function () { 7155 if (_this.nav.container == null) { 7156 return; 7157 } 7158 _this.nav.links[_this.index].style.background = "".concat(_this.nav.fill); 7159 _this.nav.links.forEach(function (el) { 7160 el.addEventListener("click", _this._handleClick); 7161 }); 7162 }); 7163 /** 7164 Sets up the slider controls by adding event listeners to the previous and next buttons. 7165 If the controls container is not present, returns from the function without performing any action. 7166 */ 7167 _defineProperty(this, "_buildControls", function () { 7168 if (_this.controls.container == null) { 7169 return; 7170 } 7171 _this.controls.prev.addEventListener("click", _this._handlePrev); 7172 _this.controls.prev.addEventListener("keydown", _this._handleKeyDown); 7173 _this.controls.next.addEventListener("click", _this._handleNext); 7174 _this.controls.next.addEventListener("keydown", _this._handleKeyDown); 7175 }); 7176 /** 7177 Resets the slides by removing any transform applied to them and resetting aria-hidden attribute to false. 7178 */ 7179 _defineProperty(this, "_resetSlides", function () {
7180 _this._slideElements().forEach(function (el) { 7181 el.style.transform = "0"; 7182 el.removeAttribute("aria-hidden"); 7183 el.setAttribute("aria-hidden", false); 7184 }); 7185 }); 7186 /** 7187 Checks the window size against the defined minimum and maximum widths for the slider. 7188 If the window size meets the criteria, the slider is built. 7189 If not, the slider is not built. 7190 */ 7191 _defineProperty(this, "_checkSize", function () { 7192 if (_this.slider.container.dataset.disabled === "true") { 7193 return; 7194 } 7195 var minWidth = _this.slider.minWidth; 7196 var maxWidth = _this.slider.maxWidth; 7197 var windowWidth = window.innerWidth; 7198 if (!minWidth && !maxWidth) { 7199 _this._build(); 7200 return; 7201 } 7202 7203 // If there is a minimum width and the window is wider than the minimum, rebuild the slider 7204 if (minWidth && windowWidth > minWidth) { 7205 _this._build(); 7206 return; 7207 } 7208 7209 // If there is a maximum width and the window is narrower than the maximum, rebuild the slider 7210 if (maxWidth && windowWidth < maxWidth) { 7211 _this._build(); 7212 } 7213 }); 7214 /** 7215 Initializes the slider based on the provided configuration in the slider object. 7216 Checks the screen size and builds the slider accordingly. 7217 Listens for window resize events and destroys the slider instance if necessary. 7218 */ 7219 _defineProperty(this, "_init", function () { 7220 if (_this.slider.container.dataset.disabled === "true" || _this._slideElements().length === 0) { 7221 return; 7222 } 7223 7224 // Set number of slides to show on mobile and desktop devices if specified in slider container attributes 7225 if (_this.slider.container.hasAttribute("data-per-view-mobile")) { 7226 _this.slider.perView.mobile = parseInt(_this.slider.container.dataset.perViewMobile); 7227 } 7228 if (_this.slider.container.hasAttribute("data-per-view-tablet")) { 7229 _this.slider.perView.tablet = parseInt(_this.slider.container.dataset.perViewTablet); 7230 } 7231 if (_this.slider.container.hasAttribute("data-per-view-desktop")) { 7232 _this.slider.perView.desktop = parseInt(_this.slider.container.dataset.perViewDesktop); 7233 } 7234 7235 // Set maximum and minimum screen width for the slider if specified in slider container attributes 7236 if (_this.slider.container.hasAttribute("data-max-screen-width")) { 7237 _this.slider.maxWidth = parseInt(_this.slider.container.dataset.maxScreenWidth); 7238 } 7239 if (_this.slider.container.hasAttribute("data-min-screen-width")) { 7240 _this.slider.minWidth = parseInt(_this.slider.container.dataset.minScreenWidth); 7241 } 7242 7243 // Call the _checkSize function to set the number of slides to show based on current screen width 7244 _this._checkSize(); 7245 if (_this.slider.container.hasAttribute("data-equal-slide-height")) { 7246 window.addEventListener("resize", _this._boundEqualizeHeights); 7247 } 7248 window.addEventListener("resize", function () { 7249 // If slider instance doesn't exist, call _checkSize function and return 7250 if (_this.slider.instance === false) { 7251 _this._checkSize(); 7252 return; 7253 } 7254 7255 // If window width is less than minimum width, destroy the slider instance 7256 if (_this.slider.minWidth !== false && window.innerWidth < _this.slider.minWidth) { 7257 _this.slider.instance.destroy(); 7258 } 7259 7260 // If window width is greater than maximum width, destroy the slider instance 7261 if (_this.slider.maxWidth !== false && window.innerWidth > _this.slider.maxWidth) { 7262 _this.slider.instance.destroy(); 7263 } 7264 }); 7265 }); 7266 this.breakpoint = 1024; 7267 this.key = container.dataset.key; 7268 7269 /** 7270 An object containing information about the slider. 7271 @property {HTMLElement} container - The HTML element that contains the slider. 7272 @property {NodeListOf<HTMLElement>} slides - The HTML elements representing the slides. 7273 @property {KeenSlider} instance - The instance of the KeenSlider library used to create the slider. 7274 @property {number} maxWidth - The screen width at which the slider stops rendering (default none). 7275 @property {number} minWidth - The screen width at which the slider starts rendering (default 0). 7276 @property {object} perView - An object that contains the number of slides to display depending on the screen size. 7277 @property {number} perView.desktop - The number of slides to display on desktop (default 1). 7278 @property {number} perView.mobile - The number of slides to display on mobile/tablet (default 1). 7279 */ 7280 this.slider = { 7281 container: container, 7282 slides: container.querySelectorAll(".keen-slider__slide"), 7283 instance: false, 7284 maxWidth: false, 7285 minWidth: false, 7286 renderMode: false, 7287 autoRotate: false, 7288 perView: { 7289 desktop: false, 7290 tablet: false, 7291 mobile: false 7292 } 7293 }; 7294 7295 /**
7296 An object containing information about the slider navigation. 7297 @property {HTMLElement} container - The HTML element that contains the slider navigation. 7298 @property {NodeListOf<HTMLElement>} links - The HTML elements representing the navigation dots. 7299 @property {string} fill - The background color of the navigation dot when active. 7300 @private 7301 */ 7302 this.nav = { 7303 container: querySliderPart(container, "slider-nav", this.key), 7304 links: false, 7305 fill: false 7306 }; 7307 7308 /** 7309 An object containing information about the slider controls. 7310 @property {HTMLElement} container - The HTML element that contains the slider controls. 7311 @property {HTMLElement} prev - The HTML element representing the previous control. 7312 @property {HTMLElement} next - The HTML element representing the next control. 7313 */ 7314 this.controls = { 7315 container: querySliderPart(container, "slider-controls", this.key), 7316 prev: false, 7317 next: false 7318 }; 7319 7320 /** 7321 The current slide index. 7322 @type {number} 7323 */ 7324 this.index = 0; 7325 this._boundEqualizeHeights = this._equalizeSlideHeights.bind(this); 7326 this._init(); 7327 } 7328 7329 /** Current slide elements (re-query after DOM changes e.g. pruned promo slides). */ 7330 _createClass(Slider, [{ 7331 key: "_slideElements", 7332 value: function _slideElements() { 7333 return this.slider.container.querySelectorAll(".keen-slider__slide"); 7334 } 7335 }]); 7336 return Slider; 7337}(); 7338 7339/** 7340 * When Liquid rendered a carousel (2+ blocks) but prune/mirror leaves exactly one slide, 7341 * destroy Keen and present a static bar (matches single-block Liquid output). 7342 */ 7343function collapseAnnouncementSliderIfSingleSlide(container) { 7344 var _bar$querySelector; 7345 if (!container || !container.classList.contains("announcements-bar")) { 7346 return; 7347 } 7348 var slides = container.querySelectorAll(".keen-slider__slide"); 7349 if (slides.length !== 1) { 7350 return; 7351 } 7352 var slide = slides[0]; 7353 var keen = container._keenSliderInstance; 7354 if (keen && typeof keen.destroy === "function") { 7355 try { 7356 keen.destroy(); 7357 } catch (err) { 7358 console.error("[collapseAnnouncementSliderIfSingleSlide] destroy failed:", err); 7359 } 7360 } 7361 if (container._keenSliderInstance) { 7362 delete container._keenSliderInstance; 7363 } 7364 container.setAttribute("data-disabled", "true"); 7365 container.setAttribute("data-single-slide", "true"); 7366 container.classList.remove("keen-slider"); 7367 container.removeAttribute("data-slider-loop"); 7368 container.removeAttribute("data-autoplay"); 7369 container.removeAttribute("data-equal-slide-height"); 7370 slide.classList.remove("keen-slider__slide"); 7371 slide.classList.add("announcement-bar__single"); 7372 slide.style.opacity = "1"; 7373 slide.style.transform = ""; 7374 slide.style.minWidth = ""; 7375 slide.style.maxWidth = ""; 7376 slide.style.removeProperty("min-height"); 7377 var bar = container.closest("announcement-bar"); 7378 bar === null || bar === void 0 ? void 0 : (_bar$querySelector = bar.querySelector("slider-controls")) === null || _bar$querySelector === void 0 ? void 0 : _bar$querySelector.classList.add("tw-hidden"); 7379} 7380 7381/***/ }), 7382
7383/***/ "./src/scripts/global/tooltip.js": 7384/*!***************************************!*\ 7385 !*** ./src/scripts/global/tooltip.js ***! 7386 \***************************************/ 7387/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 7388 7389"use strict"; 7390__webpack_require__.r(__webpack_exports__); 7391/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7392/* harmony export */ "Tooltip": () => (/* binding */ Tooltip) 7393/* harmony export */ }); 7394function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 7395function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7396function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 7397function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 7398function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 7399function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 7400function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 7401var Tooltip = /*#__PURE__*/function () { 7402 /** 7403 * Represents a tooltip component 7404 * 7405 * Uses Custom Element <tooltip-info> 7406 * 7407 * @constructor 7408 * @param {HTMLElement} container - parent custom element 7409 * @property {HTMLElement} tooltipContent - the content that appears as the tooltip 7410 * @property {boolean} isVisible - whether the tooltip is currently visible 7411 */ 7412 function Tooltip(container) { 7413 var _this = this; 7414 _classCallCheck(this, Tooltip); 7415 /** 7416 * Shows the tooltip by updating the aria-hidden attribute and setting the isVisible flag to true. 7417 * 7418 * @memberof Tooltip 7419 * @returns {void} 7420 */ 7421 _defineProperty(this, "_showTooltip", function () { 7422 if (_this.isVisible) return; 7423 _this.tooltipContent.setAttribute("aria-hidden", "false"); 7424 _this.isVisible = true; 7425 }); 7426 /** 7427 * Hides the tooltip by updating the aria-hidden attribute and setting the isVisible flag to false. 7428 * 7429 * @memberof Tooltip 7430 * @returns {void} 7431 */ 7432 _defineProperty(this, "_hideTooltip", function () { 7433 if (!_this.isVisible) return; 7434 _this.tooltipContent.setAttribute("aria-hidden", "true"); 7435 _this.isVisible = false; 7436 }); 7437 /** 7438 * Toggles the visibility of the tooltip when the icon is clicked. 7439 * 7440 * @memberof Tooltip 7441 * @returns {void} 7442 */ 7443 _defineProperty(this, "_toggleTooltip", function () { 7444 _this.isVisible ? _this._hideTooltip() : _this._showTooltip(); 7445 }); 7446 /** 7447 * Handles clicks outside the tooltip, closing it if clicked outside of the tooltip or the tooltip icon. 7448 * 7449 * @param {Event} e - The click event object. 7450 * @memberof Tooltip 7451 * @returns {void} 7452 */ 7453 _defineProperty(this, "_handleOutsideClick", function (e) { 7454 var icon = _this.container.querySelector(".tooltip-info__icon"); 7455 if (_this.isVisible && !_this.container.contains(e.target) && e.target !== icon) { 7456 _this._hideTooltip(); 7457 } 7458 }); 7459 this.container = container; 7460 this.tooltipContent = this.container.querySelector(".tooltip-info__content"); 7461 this.isVisible = false;
7462 this._init(); 7463 } 7464 7465 /** 7466 * Initialize the tooltip component by adding event listeners for hover, click, or touch interactions. 7467 * 7468 * @memberof Tooltip 7469 * @returns {void} 7470 */ 7471 _createClass(Tooltip, [{ 7472 key: "_init", 7473 value: function _init() { 7474 if (!this.container || !this.tooltipContent) { 7475 throw new Error("Tooltip container or content not found"); 7476 } 7477 var isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 0; 7478 this.container.addEventListener("click", this._toggleTooltip); 7479 if (!isTouchDevice) { 7480 this.container.addEventListener("mouseenter", this._showTooltip); 7481 this.container.addEventListener("mouseleave", this._hideTooltip); 7482 } 7483 this.container.addEventListener("focus", this._showTooltip); 7484 this.container.addEventListener("blur", this._hideTooltip); 7485 document.addEventListener("click", this._handleOutsideClick); 7486 } 7487 }]); 7488 return Tooltip; 7489}(); 7490 7491/***/ }), 7492
7493/***/ "./src/scripts/global/topBar.js": 7494/*!**************************************!*\ 7495 !*** ./src/scripts/global/topBar.js ***! 7496 \**************************************/ 7497/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 7498 7499"use strict"; 7500__webpack_require__.r(__webpack_exports__); 7501/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7502/* harmony export */ "TopBar": () => (/* binding */ TopBar) 7503/* harmony export */ }); 7504function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 7505function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7506function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 7507function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 7508function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 7509function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 7510/** 7511 Represents a top bar component. 7512 @class 7513 7514 @param {Element} container - The container element for the top bar. 7515 7516 @property {Element} header - The header element. 7517 @property {Element} container - The container element for the top bar. 7518 @property {Element} topBarEl - The top bar element. 7519 @property {Element} scrollTarget - The target element for scrolling. 7520 @property {boolean} enable - A boolean that indicates whether the top bar is enabled. 7521*/ 7522 7523var TopBar = /*#__PURE__*/function () { 7524 function TopBar(container) { 7525 _classCallCheck(this, TopBar); 7526 this.header = document.getElementById("shopify-section-header"); 7527 this.container = container; 7528 this.topBarEl = document.querySelector("product-top-bar"); 7529 this.scrollTarget = document.getElementById("productFormContainer"); 7530 this.enable = window.innerWidth < 1024; 7531 this._init(); 7532 } 7533 7534 /** 7535 Hides the top bar element. 7536 */ 7537 _createClass(TopBar, [{ 7538 key: "_hide", 7539 value: function _hide() { 7540 this.topBarEl.style.height = "0"; 7541 this.topBarEl.style.visibility = "hidden"; 7542 this.topBarEl.style.top = "-40px"; 7543 } 7544 7545 /** 7546 Refreshes the top bar element based on the specified trigger element. 7547 @param {Element} trigger - The trigger element. 7548 */ 7549 }, { 7550 key: "_refresh", 7551 value: function _refresh(trigger) { 7552 this.topBarEl = document.querySelector("product-top-bar"); 7553 this.scrollTarget = document.getElementById("productFormContainer"); 7554 var topImage = this.topBarEl.querySelector("#top-bar-image"); 7555 var topTitle = this.topBarEl.querySelector("#top-bar-title"); 7556 var topVariant = this.topBarEl.querySelector("#top-bar-id"); 7557 topImage.src = "".concat(trigger.dataset.image); 7558 topTitle.innerText = "".concat(trigger.dataset.title); 7559 topVariant.value = "".concat(trigger.dataset.variant); 7560 } 7561 7562 /** 7563 Handles the scrolling of the page. 7564 */ 7565 }, { 7566 key: "_handleScroll", 7567 value: function _handleScroll() { 7568 var _this = this; 7569 if (!this.enable) { 7570 return; 7571 } 7572 if (window.scrollY > this.scrollTarget.offsetHeight + this.scrollTarget.offsetTop) { 7573 this.topBarEl.style.visibility = "visible"; 7574 this.topBarEl.style.height = "auto"; 7575 this.topBarEl.style.top = "".concat(this.header.clientHeight, "px"); 7576 } else { 7577 this.topBarEl.style.top = "-40px"; 7578 setTimeout(function () { 7579 _this.topBarEl.style.height = "0px"; 7580 _this.topBarEl.style.visibility = "hidden"; 7581 }, 35); 7582 } 7583 } 7584 7585 /** 7586 Initializes the top bar element and its event listeners. 7587 */ 7588 }, { 7589 key: "_init", 7590 value: function _init() { 7591 var _this2 = this; 7592 document.addEventListener("scroll", function () { 7593 return _this2._handleScroll(); 7594 }); 7595 var resizeAction = function resizeAction() { 7596 _this2.enable = window.innerWidth < 1024; 7597 _this2.header = document.querySelector("header"); 7598 if (!_this2.enable) { 7599 _this2._hide(); 7600 } 7601 }; 7602 window.addEventListener("resize", function () { 7603 var doit = setTimeout(resizeAction, 400); 7604 clearTimeout(doit); 7605 }); 7606 } 7607 }]); 7608 return TopBar; 7609}(); 7610 7611/***/ }), 7612
7613/***/ "./src/scripts/global/videoPlayer.js": 7614/*!*******************************************!*\ 7615 !*** ./src/scripts/global/videoPlayer.js ***! 7616 \*******************************************/ 7617/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 7618 7619"use strict"; 7620__webpack_require__.r(__webpack_exports__); 7621/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7622/* harmony export */ "VideoPlayer": () => (/* binding */ VideoPlayer) 7623/* harmony export */ }); 7624function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 7625function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 7626function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 7627function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7628function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 7629function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 7630function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 7631/** 7632 * Represents a video player with controls. Video begins playing when the user scrolls to the video and pauses when the video is outside of the viewport. 7633 * @param {HTMLElement} container - The container element for the video player. 7634 * @property {HTMLElement} controls.container - The container element for the video controls. 7635 * @property {HTMLElement} controls.icons.play - The play icon element. 7636 * @property {HTMLElement} controls.icons.pause - The pause icon element. 7637 * @property {HTMLElement} video - The video element. 7638 * @property {boolean} isPlaying - A boolean that indicates whether the video is playing. 7639 * @property {boolean} playedOnce - A boolean that indicates whether the video has played once. 7640 */ 7641 7642var VideoPlayer = /*#__PURE__*/_createClass(function VideoPlayer(container) { 7643 var _this = this; 7644 _classCallCheck(this, VideoPlayer); 7645 _defineProperty(this, "_triggerControl", function (e) { 7646 _this.controls.icons.play.style.display = _this.isPlaying ? "block" : "none"; 7647 _this.controls.icons.pause.style.display = _this.isPlaying ? "none" : "block"; 7648 var ariaLabel = _this.isPlaying ? "play video" : "pause video"; 7649 _this.controls.container.setAttribute("aria-label", ariaLabel); 7650 if (_this.isPlaying) { 7651 _this.video.pause(); 7652 } else { 7653 _this.video.play(); 7654 } 7655 _this.isPlaying = !_this.isPlaying; 7656 }); 7657 _defineProperty(this, "_setObserver", function () { 7658 var ob = new IntersectionObserver(_this._obCallback); 7659 ob.observe(_this.controls.container); 7660 }); 7661 _defineProperty(this, "_obCallback", function (payload) { 7662 if (payload[0].isIntersecting && !_this.isPlaying) { 7663 // if video has already played once do not autoplay it again. 7664 if (!_this.playedOnce) { 7665 _this._triggerControl(); 7666 } 7667 } 7668 }); 7669 _defineProperty(this, "_handleVideoEnd", function () { 7670 _this.playedOnce = true; 7671 _this._triggerControl(); 7672 }); 7673 _defineProperty(this, "_init", function () { 7674 if (!_this.video) { 7675 console.warn("VideoPlayer: No video element found."); 7676 return; 7677 } 7678 _this.video.addEventListener("ended", _this._handleVideoEnd, false); 7679 if (_this.controls.container) { 7680 if (!_this.controls.icons.play || !_this.controls.icons.pause) { 7681 console.warn("VideoPlayer: Video controls elements missing."); 7682 return; 7683 } 7684 _this.controls.container.addEventListener("click", _this._triggerControl, false); 7685 _this.controls.container.addEventListener("keydown", function (e) { 7686 if (e.key == "Enter") { 7687 _this._triggerControl(); 7688 } 7689 }); 7690 } 7691 if (_this.container.dataset.autoplay) { 7692 _this._setObserver(); 7693 } 7694 }); 7695 this.container = container; 7696 this.controls = { 7697 container: container.querySelector("video-controls"), 7698 icons: { 7699 play: container.querySelector(".play-icon"), 7700 pause: container.querySelector(".pause-icon") 7701 } 7702 }; 7703 this.video = container.querySelector("video"); 7704 this.isPlaying = false;
7705 this.playedOnce = false; 7706 this._init(); 7707}); 7708 7709/***/ }), 7710
vendor: 5,442 bytes, lines 7711-7725
7711/***/ "./src/scripts/page.ingredients/flavorsSlider.js": 7712/*!*******************************************************!*\ 7713 !*** ./src/scripts/page.ingredients/flavorsSlider.js ***! 7714 \*******************************************************/ 7715/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 7716 7717"use strict"; 7718__webpack_require__.r(__webpack_exports__); 7719/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7720/* harmony export */ "flavorsSlider": () => (/* binding */ flavorsSlider) 7721/* harmony export */ }); 7722/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 7723/* harmony import */ var keen_slider_keen_slider_min_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 7724function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 7725function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,627 bytes, lines 7725-7732
7725 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 7726function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 7727function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 7728function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 7729function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 7730function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 7731function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 7732function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string");
7732 return _typeof(key) === "symbol" ? key : String(key); } 7733function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 7734 7735 7736 7737/* global gsap */ 7738/* global Draggable */ 7739 7740/** 7741 Class for managing the Keen Slider and animation data for the Flavor Slider. 7742 --- does not use keen slider or another third-party slider library 7743 --- uses gsap animation library to simulate effect of a slider 7744 7745 Currently on Ingredients Page Only 7746*/ 7747var flavorsSlider = /*#__PURE__*/_createClass(function flavorsSlider() { 7748 var _this = this; 7749 _classCallCheck(this, flavorsSlider); 7750 /** 7751 Sets the median position of an array of objects, and stores it in the "animPositions" property of the calling object. 7752 @param {Array} arr - An array of objects with numeric keys to determine the median position. 7753 @returns {Number} The index of the median object in the array. 7754 */ 7755 _defineProperty(this, "_setMedianPosition", function (arr) { 7756 // Calculate the middle index of the array 7757 var mid = Math.floor(arr.length / 2); 7758 // Calculate the median position based on whether the array length is odd or even 7759 var slide = arr.length % 2 !== 0 ? arr[mid] : (arr[mid - 1] + arr[mid]) / 2; 7760 7761 // Store the index of the median position in the "animPositions" property of the calling object 7762 _this.animPositions.medianIndex = slide.key; 7763 return _this.animPositions.medianIndex; 7764 }); 7765 /** 7766 Sets the animation positions for the elements on and off screen, 7767 and initializes the animation data for each on-screen element. 7768 */ 7769 _defineProperty(this, "_setAnimPositions", function () { 7770 // Set the off-screen positions for the left and right elements 7771 _this.animPositions.offScreen.left = document.querySelector('[ data-flavor-anim-offscreen="left"]').offsetLeft; 7772 _this.animPositions.offScreen.right = document.querySelector('[ data-flavor-anim-offscreen="right"]').offsetLeft; 7773 7774 // Initialize the animation data for each on-screen element 7775 _this.animPositions.onScreenAll.forEach(function (can, index) { 7776 _this.animData.push({ 7777 key: index, 7778 x: can.offsetLeft, 7779 posX: can.offsetLeft, 7780 width: can.offsetWidth, 7781 scale: can.dataset.scale, 7782 opacity: can.dataset.opacity 7783 }); 7784 }); 7785 7786 // Calculate the median position of the on-screen elements 7787 _this._setMedianPosition(_this.animData); 7788 7789 // Set the slides using the animation data 7790 _this._setSlides(); 7791 }); 7792 /** 7793 Sets the positions, scale, and opacity of each slide element based on its animation data. 7794 If the animation data for a slide does not exist, it is placed offscreen to the right. 7795 If a slide is in the center position, its data is updated and displayed. 7796 */ 7797 _defineProperty(this, "_setSlides", function () { 7798 // component does not show same flavor twice or clone cans 7799 if (_this.sliderEls.allSlides.length < _this.animPositions.onScreenAll.length) { 7800 console.error("less than minimum number of slides"); 7801 return; 7802 } 7803 7804 // Position each slide based on its animation data 7805 _this.sliderEls.allSlides.forEach(function (slide) { 7806 var animPosition = _this.animData[slide.dataset.pos]; 7807 var isCenterSlide = parseInt(slide.dataset.pos) === _this.animPositions.medianIndex; 7808 if (animPosition === undefined) { 7809 // if animation position does not exist place slide offscreen to the right 7810 gsap.set(slide, { 7811 left: _this.animPositions.offScreen.right 7812 }); 7813 } else { 7814 // place slide on position marker 7815 var posX = isCenterSlide ? "".concat(animPosition.x, "px") : "".concat(animPosition.x + (animPosition.width / 2 - slide.offsetWidth / 2), "px"); 7816 _this.animData[slide.dataset.pos].x = posX; 7817 slide.style.left = posX; 7818 slide.style.transform = "scale(".concat(animPosition.scale, ")"); 7819 slide.style.opacity = animPosition.opacity; 7820 } 7821 7822 // if slide is in the middle of the row display it's data 7823 if (isCenterSlide) { 7824 slide.removeAttribute("aria-hidden"); 7825 _this._updateData(slide); 7826 } 7827 }); 7828 7829 // update section colors 7830 gsap.set(_this.section, { 7831 background: _this.state.colors.background 7832 }); 7833 gsap.set(_this.blobEls.blobs.desktop, { 7834 fill: _this.state.colors.blob 7835 }); 7836 _this._displayData();
7837 _this._addControls(); 7838 }); 7839 /** 7840 Creates a Draggable instance and attaches it to the wrapper element. 7841 Detects horizontal drag direction and triggers animation of the slide elements in the appropriate direction. 7842 */ 7843 _defineProperty(this, "_setDraggable", function () { 7844 var startX, startY; 7845 var proxy = document.createElement("div"); 7846 var that = _this; 7847 _this.sliderEls.draggableInstance = Draggable.create(proxy, { 7848 trigger: _this.wrapper, 7849 type: "x", 7850 edgeResistance: 0.65, 7851 onPress: function onPress() { 7852 // record the starting values so we can compare them later... 7853 startX = this.x; 7854 startY = this.y; 7855 }, 7856 onRelease: function onRelease() { 7857 var xChange = this.x - startX; 7858 var yChange = this.y - startY; 7859 var ratio = Math.abs(xChange / yChange); 7860 var direction = []; 7861 if (ratio > 0.25) { 7862 // you can adjust the ratio thresholds to make things more or less sensitive to diagonal movement. 7863 direction.push(xChange < 0 ? "left" : "right"); 7864 } 7865 if (direction[0] === "left") { 7866 that._animateSlides("prev"); 7867 return; 7868 } 7869 if (direction[0] === "right") { 7870 that._animateSlides("next"); 7871 } 7872 } 7873 }); 7874 }); 7875 /** 7876 Shifts a slide to the left or right of the screen based on its position. 7877 @param {HTMLElement} el - The slide to be shifted. 7878 @param {number} currentKey - The current position of the slide. 7879 @param {number} nextKey - The position to which the slide should be shifted. 7880 @returns {Object|boolean}
7880 Returns an object containing the left, opacity, and scale values for the slide if the slide is shifted on the screen. Returns false if the slide is not shifted on the screen. 7881 */ 7882 _defineProperty(this, "_shiftPrev", function (el, currentKey, nextKey) { 7883 // if slide is offscreen left set it offscren right 7884 if (currentKey === -1) { 7885 var excessSlides = _this.sliderEls.allSlides.length - _this.animPositions.onScreenAll.length; 7886 gsap.set(el, { 7887 left: _this.animPositions.offScreen.right 7888 }); 7889 el.dataset.pos = _this.sliderEls.allSlides.length - excessSlides; 7890 return false; 7891 } 7892 7893 // if next slide position is greater than number of position markers send offscreen right 7894 if (nextKey >= _this.animPositions.onScreenAll.length) { 7895 el.dataset.pos = nextKey; 7896 return { 7897 left: _this.animPositions.offScreen.right, 7898 scale: 1, 7899 opacity: 0.25 7900 }; 7901 } 7902 7903 // if slide is first move offscreen left 7904 if (nextKey >= 0) { 7905 var _this$animData$nextKe = _this.animData[nextKey], 7906 x = _this$animData$nextKe.x, 7907 opacity = _this$animData$nextKe.opacity, 7908 scale = _this$animData$nextKe.scale; 7909 el.dataset.pos = nextKey; 7910 return { 7911 left: x, 7912 opacity: opacity, 7913 scale: scale 7914 }; 7915 } 7916 el.dataset.pos = nextKey; 7917 return { 7918 left: _this.animPositions.offScreen.left, 7919 scale: 1, 7920 opacity: 0.25 7921 }; 7922 }); 7923 /** 7924 Shifts a slide to the left or right of the screen based on its position. 7925 @param {HTMLElement} el - The slide to be shifted. 7926 @param {number} currentKey - The current position of the slide. 7927 @param {number} nextKey - The position to which the slide should be shifted. 7928 @returns {Object}
7928 Returns an object containing the left, opacity, and scale values for the slide after it has been shifted. 7929 */ 7930 _defineProperty(this, "_shiftNext", function (el, currentKey, nextKey) { 7931 if (_this.animData[nextKey] !== undefined) { 7932 var _this$animData$nextKe2 = _this.animData[nextKey], 7933 x = _this$animData$nextKe2.x, 7934 opacity = _this$animData$nextKe2.opacity, 7935 scale = _this$animData$nextKe2.scale; 7936 var animSettings = { 7937 left: x, 7938 opacity: opacity, 7939 scale: scale 7940 }; 7941 } 7942 if (nextKey >= _this.animPositions.onScreenAll.length) { 7943 animSettings = { 7944 left: _this.animPositions.offScreen.right, 7945 scale: 1, 7946 opacity: 0.25 7947 }; 7948 } 7949 if (currentKey === _this.sliderEls.allSlides.length - 1) { 7950 var _this$animData$ = _this.animData[0], 7951 _x = _this$animData$.x, 7952 _opacity = _this$animData$.opacity, 7953 _scale = _this$animData$.scale; 7954 gsap.set(el, { 7955 left: _this.animPositions.offScreen.left 7956 }); 7957 nextKey = 0; 7958 animSettings = { 7959 left: _x, 7960 scale: _scale, 7961 opacity: _opacity 7962 }; 7963 } 7964 el.dataset.pos = nextKey; 7965 return animSettings; 7966 }); 7967 /** 7968 Aanimates the sliding of the carousel when the user clicks on the 'next' or 'previous' button. 7969 @param {Event} e - The click event on the 'next' or 'previous' button. 7970 */ 7971 _defineProperty(this, "_animateSlides", function (e) { 7972 // Determine the type of button that was clicked 7973 var controlType = e.currentTarget === undefined ? e : e.currentTarget.dataset.control; 7974 var animSettings = false; 7975 7976 // If the window is smaller than the specified breakpoint, shift the slide without any animation 7977 if (window.innerWidth < _this.breakpoint) { 7978 controlType === "next" ? _this.sliderEls.slider.next() : _this.sliderEls.slider.prev(); 7979 return; 7980 } 7981 7982 // Define the function to expand and shift the slide 7983 var shiftExpand = function shiftExpand() { 7984 var tl = gsap.timeline(); 7985 tl.to(_this.contentEls.container, { 7986 duration: 0.25, 7987 opacity: 0, 7988 onComplete: _this._displayData 7989 }); 7990 tl.to(_this.blobEls.container, { 7991 duration: 0.25, 7992 transformOrigin: "center center", 7993 scale: 10 7994 }, "<"); 7995 tl.to(_this.blobEls.blobs.desktop, { 7996 duration: 0.1, 7997 fill: function fill() { 7998 return _this.state.colors.blob; 7999 } 8000 }); 8001 tl.to(_this.section, { 8002 duration: 0, 8003 background: function background() { 8004 return _this.state.colors.background; 8005 } 8006 }); 8007 return tl; 8008 }; 8009 8010 // Define the function to shrink the slide back to its original size 8011 var shiftShrink = function shiftShrink() { 8012 var tl = gsap.timeline(); 8013 tl.to(_this.contentEls.container, { 8014 duration: 0.1, 8015 opacity: 1 8016 }); 8017 tl.to(_this.blobEls.container, { 8018 duration: 0.1, 8019 transformOrigin: "center center", 8020 scale: 1 8021 }); 8022 return tl; 8023 }; 8024 8025 // Create a timeline for the master animation and add the expand and shrink functions to it 8026 var master = gsap.timeline({ 8027 paused: true, 8028 autoRemoveChildren: true, 8029 onStart: function onStart() {} 8030 }); 8031 master.add(shiftExpand(_this.state)); 8032 master.add(shiftShrink); 8033 8034 // Loop through each slide in the carousel 8035 _this.sliderEls.allSlides.forEach(function (el, i) { 8036 // Get the current and next position of the slide 8037 var currentKey = parseInt(el.dataset.pos); 8038 var nextKey = controlType === "next" ? currentKey + 1 : currentKey - 1; 8039 // Check if the slide is the active slide 8040 var isActiveSlide = nextKey === _this.animPositions.medianIndex; 8041 // Get the animation settings for the slide 8042 animSettings = controlType === "next" ? _this._shiftNext(el, currentKey, nextKey) : _this._shiftPrev(el, currentKey, nextKey); 8043 8044 // If the slide is the active slide, update the data 8045 if (isActiveSlide) { 8046 el.removeAttribute("aria-hidden"); 8047 _this._updateData(el); 8048 } else { 8049 el.setAttribute("aria-hidden", true); 8050 } 8051 // If the slide is the active slide, restart the master animation 8052 if (isActiveSlide) { 8053 master.restart(); 8054 } 8055 // If there are animation settings for the slide, animate the slide 8056 if (animSettings) { 8057 gsap.to(el, animSettings); 8058 } 8059 }); 8060 }); 8061 /** 8062 Updates the state object with data from the active slide 8063 @param {Element} el - The active slide element to retrieve data from 8064 @returns {Object}
8064 The updated state object containing the title, text, slide element, index, button label and URL, and background and blob colors 8065 */ 8066 _defineProperty(this, "_updateData", function (el) { 8067 _this.state = { 8068 title: el.dataset.title, 8069 text: el.dataset.text, 8070 slide: el, 8071 index: el.dataset.index, 8072 btn: { 8073 label: el.dataset.label, 8074 url: el.dataset.url 8075 }, 8076 colors: { 8077 background: el.dataset.bg, 8078 blob: el.dataset.blob 8079 } 8080 }; 8081 return _this.state; 8082 }); 8083 /** 8084 Updates the content elements with data from the current state object 8085 */ 8086 _defineProperty(this, "_displayData", function () { 8087 for (var i = 0; i < _this.contentEls.container.length; i++) { 8088 _this.contentEls.title[i].innerHTML = _this.state.title; 8089 _this.contentEls.text[i].innerHTML = _this.state.text; 8090 _this.contentEls.button[i].innerHTML = _this.state.btn.label; 8091 _this.contentEls.button[i].setAttribute("href", _this.state.btn.url); 8092 } 8093 8094 // hidden doubled slides 8095 _this.sliderEls.allSlides.forEach(function (el) { 8096 var currentPos = el.getAttribute("data-pos"); 8097 var doubleItems = document.querySelectorAll("[data-flavor-slide][data-pos=\"".concat(currentPos, "\"]")); 8098 el.classList.remove("opacity-0-imp"); 8099 if (doubleItems.length === 2) { 8100 doubleItems[0].classList.add("opacity-0-imp"); 8101 } else if (doubleItems.length === 3) { 8102 doubleItems[0].classList.add("opacity-0-imp"); 8103 doubleItems[1].classList.add("opacity-0-imp"); 8104 } 8105 }); 8106 }); 8107 /** 8108 Attaches event listeners to control elements for previous and next slide animations. 8109 Also disables the loading state after controls have been added. 8110 */ 8111 _defineProperty(this, "_addControls", function () { 8112 // Attach event listener to previous button click and enter keypress 8113 _this.controlEls.prev.addEventListener("click", _this._animateSlides); 8114 _this.controlEls.prev.addEventListener("keypress", function (e) { 8115 if (e.key === "Enter") { 8116 _this._animateSlides(e); 8117 } 8118 }); 8119 8120 // Attach event listener to next button click and enter keypress 8121 _this.controlEls.next.addEventListener("click", _this._animateSlides); 8122 _this.controlEls.next.addEventListener("keypress", function (e) { 8123 if (e.key === "Enter") { 8124 _this._animateSlides(e); 8125 } 8126 }); 8127 8128 // Disable loading state after controls have been added 8129 _this._disableLoadingState(); 8130 }); 8131 /** 8132 Updates the background color of the section element and the fill color of the mobile and desktop blobs. 8133 Colors are retrieved from the current state of the object. 8134 */ 8135 _defineProperty(this, "_updateColors", function () { 8136 _this.section.style.background = _this.state.colors.background; 8137 _this.blobEls.blobs.mobile.style.fill = _this.state.colors.blob; 8138 _this.blobEls.blobs.desktop.style.fill = _this.state.colors.blob; 8139 }); 8140 /** 8141 Builds a KeenSlider and attaches event listeners for slide changes and animations. 8142 Updates data, display, and colors on slide change or animation start/end. 8143 */ 8144 _defineProperty(this, "_buildSlider", function () { 8145 _this.sliderEls.slider = new keen_slider__WEBPACK_IMPORTED_MODULE_0__["default"]("#track", { 8146 mode: "snap", 8147 loop: true, 8148 initial: 2, 8149 drag: true, 8150 selector: _this.sliderEls.allSlides, 8151 slides: { 8152 origin: "center", 8153 perView: 2, 8154 spacing: 35 8155 }, 8156 created: function created(slider) { 8157 _this._updateData(_this.sliderEls.allSlides[2]); 8158 _this.state.slide.style.opacity = 1; 8159 _this._displayData(); 8160 _this._updateColors(); 8161 _this._addControls(); 8162 }, 8163 animationStarted: function animationStarted() { 8164 // Scale the blob container and change slide opacity during animation start 8165 _this.blobEls.container.style.transform = "scale(6)"; 8166 _this.state.slide.style.opacity = 0.25; 8167 _this.state.slide.setAttribute("aria-hidden", "true"); 8168 }, 8169 animationEnded: function animationEnded() { 8170 // Scale the blob container and change slide opacity during animation end 8171 // if window is tablet sized return svg to 1.5 scale instead of 1 (we are using mobile path for tablet). 8172 var size = window.innerWidth >= 768 && window.innerWidth < 1024 ? "1.5" : "1"; 8173 _this.blobEls.container.style.transform = "scale(".concat(size, ")"); 8174 _this.state.slide.style.opacity = 1; 8175 _this.state.slide.removeAttribute("aria-hidden"); 8176 }, 8177 slideChanged: function slideChanged(slider) { 8178 // Update data, display, and colors on slide change 8179 var newSlide = _this.sliderEls.allSlides[slider.track.details.rel]; 8180 _this._updateData(newSlide); 8181 _this._displayData(); 8182 _this._updateColors(); 8183 } 8184 }); 8185 }); 8186 /** 8187 Resets all slides by removing their inline styles and setting opacity to 0.25. 8188 The animData array is also cleared. 8189 @returns {Promise<Element[]>} - A Promise that resolves to an array of all slides after they have been reset. 8190 */ 8191 _defineProperty(this, "_resetSlides", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 8192 return _regeneratorRuntime().wrap(function _callee$(_context) { 8193 while (1) switch (_context.prev = _context.next) { 8194 case 0: 8195 _this.animData = [];
8196 _this.sliderEls.allSlides.forEach(function (slide) { 8197 slide.removeAttribute("style", "transform"); 8198 slide.removeAttribute("style", "left"); 8199 slide.style.opacity = 0.25; 8200 }); 8201 return _context.abrupt("return", _this.sliderEls.allSlides); 8202 case 3: 8203 case "end": 8204 return _context.stop(); 8205 } 8206 }, _callee); 8207 }))); 8208 _defineProperty(this, "_enableLoadingState", function () { 8209 _this.wrapper.style.opacity = 0; 8210 _this.sliderEls.spinner.style.display = "block"; 8211 }); 8212 _defineProperty(this, "_disableLoadingState", function () { 8213 setTimeout(function () { 8214 _this.wrapper.style.opacity = 1; 8215 _this.controlEls.container.style.opacity = 1; 8216 _this.sliderEls.spinner.style.display = "none"; 8217 _this.loading = false; 8218 }, 100); 8219 }); 8220 /** 8221 Sets up event listener for window resize and handles slide resetting and rebuilding the slider based on the window size. 8222 */ 8223 _defineProperty(this, "_setResize", function () { 8224 var resizeId; 8225 window.addEventListener("resize", function () { 8226 _this._enableLoadingState(); 8227 clearTimeout(resizeId); 8228 resizeId = setTimeout(resizedEnded, 500); 8229 }); 8230 var resizedEnded = /*#__PURE__*/function () { 8231 var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 8232 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 8233 while (1) switch (_context2.prev = _context2.next) { 8234 case 0: 8235 if (!(window.innerWidth < _this.breakpoint && _this.sliderEls.slider === null && _this.loading === false)) { 8236 _context2.next = 5; 8237 break; 8238 } 8239 _this.loading = true; 8240 // const slides = await this._resetSlides(); 8241 _this.sliderEls.draggableInstance[0].disable(); 8242 _this._buildSlider(); 8243 return _context2.abrupt("return"); 8244 case 5: 8245 if (!(window.innerWidth > _this.breakpoint && _this.loading === false)) { 8246 _context2.next = 11; 8247 break; 8248 } 8249 _this.loading = true; 8250 // const slides = await this._resetSlides(); 8251 8252 // If there is an existing slider instance, enable draggableInstance, else create a new draggable instance 8253 if (_this.sliderEls.draggableInstance) { 8254 _this.sliderEls.draggableInstance[0].enable(); 8255 } else { 8256 _this._setDraggable(); 8257 } 8258 8259 // If there is an existing slider instance, destroy it 8260 if (_this.sliderEls.slider) { 8261 _this.sliderEls.slider.destroy(); 8262 _this.sliderEls.slider = null; 8263 } 8264 _this._setAnimPositions(); 8265 return _context2.abrupt("return"); 8266 case 11: 8267 if (!(window.innerWidth < _this.breakpoint && _this.sliderEls.slider != null)) { 8268 _context2.next = 13; 8269 break; 8270 } 8271 return _context2.abrupt("return", _this._disableLoadingState()); 8272 case 13: 8273 case "end": 8274 return _context2.stop(); 8275 } 8276 }, _callee2); 8277 })); 8278 return function resizedEnded() { 8279 return _ref2.apply(this, arguments); 8280 }; 8281 }(); 8282 }); 8283 _defineProperty(this, "_init", function () { 8284 gsap.defaults({ 8285 overwrite: true 8286 }); 8287 gsap.registerPlugin(Draggable); 8288 if (window.innerWidth < _this.breakpoint) { 8289 _this._buildSlider(); 8290 } else { 8291 _this._setDraggable(); 8292 _this._setAnimPositions(); 8293 } 8294 function isMobile() { 8295 return /iPhone|iPad|iPod|Android|webOS|BlackBerry|Windows Phone/i.test(navigator.userAgent); 8296 } 8297 if (!isMobile()) { 8298 _this._setResize(); 8299 } 8300 }); 8301 this.breakpoint = 1200; 8302 this.loading = true; 8303 this.wrapper = document.getElementById("flavor-slider-wrapper"); 8304 this.section = document.getElementById("flavor-slider-section"); 8305 this.sliderEls = { 8306 draggableInstance: false, 8307 spinner: document.getElementById("flavor-spinner"), 8308 track: document.getElementById("track"), 8309 allSlides: document.querySelectorAll("[data-flavor-slide]"), 8310 slider: null 8311 }; 8312 this.controlEls = {
8313 container: document.getElementById("flavor-slider-controls"), 8314 next: document.getElementById("flavor-control-next"), 8315 prev: document.getElementById("flavor-control-prev") 8316 }; 8317 this.contentEls = { 8318 container: document.querySelectorAll("#flavor-content"), 8319 title: document.querySelectorAll("#flavor-title"), 8320 text: document.querySelectorAll("#flavor-text"), 8321 button: document.querySelectorAll("#flavor-button") 8322 }; 8323 this.blobEls = { 8324 container: document.getElementById("flavor-blob-container"), 8325 blobs: { 8326 mobile: document.getElementById("flavor-blob-m"), 8327 desktop: document.getElementById("flavor-blob-d") 8328 } 8329 }; 8330 this.animData = []; 8331 this.animPositions = { 8332 medianIndex: null, 8333 onScreenAll: document.querySelectorAll("[data-flavor-anim-position]"), 8334 offScreen: { 8335 left: null, 8336 right: null 8337 } 8338 }; 8339 this.state = { 8340 colors: { 8341 background: null, 8342 blob: null 8343 }, 8344 btn: { 8345 lable: null, 8346 url: null 8347 }, 8348 title: null, 8349 text: null, 8350 slide: null, 8351 index: null 8352 }; 8353 this._init(); 8354}); 8355 8356/***/ }), 8357
8358/***/ "./src/scripts/pdp/backInStock.js": 8359/*!****************************************!*\ 8360 !*** ./src/scripts/pdp/backInStock.js ***! 8361 \****************************************/ 8362/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8363 8364"use strict"; 8365__webpack_require__.r(__webpack_exports__); 8366/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8367/* harmony export */ "BackInStockNotice": () => (/* binding */ BackInStockNotice) 8368/* harmony export */ }); 8369function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 8370function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8371function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 8372function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8373function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 8374function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 8375function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 8376/** 8377A class for managing back in stock notifications 8378 8379Note -- uses Back In Stock Shopify App 8380 8381*/ 8382 8383var BackInStockNotice = /*#__PURE__*/function () { 8384 function BackInStockNotice() { 8385 var _this = this; 8386 _classCallCheck(this, BackInStockNotice); 8387 _defineProperty(this, "_handleClick", function () { 8388 _this._mount(); 8389 }); 8390 /** 8391 Handles form submission event by creating BIS notification for given variant ID and email input. 8392 @param {Event} e - Form submission event object. 8393 */ 8394 _defineProperty(this, "_handleSubmit", function (e) { 8395 e.preventDefault(); 8396 _this._enableLoadingState(true); 8397 var formData = new FormData(e.target); 8398 var formProps = Object.fromEntries(formData); 8399 var email = formProps.emailInput; 8400 var emailList = formProps.hasOwnProperty("emailList"); 8401 var variantId = _this.variant.id; 8402 var productId = _this.variant.productId; 8403 BIS.create(email, variantId, productId, { 8404 accepts_marketing: emailList 8405 }).then(function (data) { 8406 setTimeout(function () { 8407 formResponse.innerHTML = data.status == "OK" ? data.message : data.errors.base; 8408 formResponse.style.color = data.status == "OK" ? "inherit" : "red"; 8409 _this._enableLoadingState(false); 8410 }, 500); 8411 }); 8412 }); 8413 this.allVariantsIds = []; 8414 this.variant = { 8415 id: false, 8416 title: false, 8417 productId: false 8418 }; 8419 this.modal = document.querySelector("[data-bis-modal]"); 8420 this.overlay = this.modal.querySelector("[modal-overlay]"); 8421 this.container = this.modal.querySelector("[modal-inner]"); 8422 this.closeIcon = this.modal.querySelector("[modal-close]"); 8423 this.variantName = document.getElementById("bis_variant"); 8424 this.formResponse = document.getElementById("formResponse"); 8425 this.form = document.getElementById("bis_form"); 8426 this.submitLabel = document.getElementById("modal-btn-label"); 8427 this.submitSpinner = document.getElementById("modal-btn-spinner"); 8428 this.overlay.addEventListener("click", function () { 8429 _this._close(); 8430 }); 8431 this.closeIcon.addEventListener("click", function () { 8432 _this._close(); 8433 }); 8434 } 8435 8436 /** 8437 Sets the active variant ID, title, and product ID for BIS notification and adds a click event listener to the button element with the given variant ID if it has not been added yet. 8438 @param {number} variantId - The ID of the variant. 8439 @param {string} variantTitle - The title of the variant. 8440 @param {number} productId - The ID of the product. 8441 */ 8442 _createClass(BackInStockNotice, [{ 8443 key: "_createBtn", 8444 value: function _createBtn(variantId, variantTitle, productId) { 8445 //set active variable for BIS notification 8446 this.variant.id = variantId; 8447 this.variant.title = variantTitle; 8448 this.variant.productId = productId; 8449 8450 //add eventListernere to button if one has not been added yet 8451 if (!this.allVariantsIds.includes(variantId)) { 8452 var triggerBtn = document.querySelector("[data-bis-id=\"".concat(variantId, "\"]")); 8453 triggerBtn.addEventListener("click", this._handleClick); 8454 this.allVariantsIds.push(variantId); 8455 } 8456 } 8457 }, { 8458 key: "_enableLoadingState", 8459 value: 8460 /** 8461 Enables/disables the loading state of the BackInStockNotice form. 8462 @param {boolean} status - Whether to enable the loading state or not. 8463 */ 8464 function _enableLoadingState(status) { 8465 if (status) { 8466 $("#submitBtn").attr("disabled", true); 8467 $(this.submitLabel).hide(); 8468 $(this.submitSpinner).show(); 8469 } else { 8470 $("#submitBtn").attr("disabled", false); 8471 $(this.submitLabel).show(); 8472 $(this.submitSpinner).hide(); 8473 } 8474 } 8475 }, { 8476 key: "_mount", 8477 value: function _mount() { 8478 this.variantName.innerHTML = "".concat(this.variant.title); 8479 this.form.addEventListener("submit", this._handleSubmit); 8480 this._display(); 8481 } 8482 8483 /** 8484 Displays a modal and locks the screen 8485 */ 8486 }, { 8487 key: "_display", 8488 value: function _display() { 8489 var _this2 = this; 8490 //lock screen 8491 document.body.style.height = "100vh"; 8492 document.body.style.overflow = "hidden"; 8493 $("body").bind("touchmove", function (e) { 8494 e.preventDefault(); 8495 }); 8496 8497 //display modal 8498 $(this.modal).addClass("active"); 8499 this.overlay.style.opacity = ".20"; 8500 setTimeout(function () { 8501 _this2.container.style.opacity = "1"; 8502 _this2.container.style.top = "0px"; 8503 }, 100); 8504 } 8505 8506 /** 8507 Closes the modal and resets form and values 8508 */ 8509 }, { 8510 key: "_close", 8511 value: function _close() { 8512 //unlock screen 8513 document.body.style.height = "auto"; 8514 document.body.style.overflow = "auto"; 8515 $("body").bind("touchmove", function (e) { 8516 e.preventDefault(); 8517 }); 8518 8519 //reset form + values 8520 this.form.reset(); 8521 this.formResponse.innerHTML = ""; 8522 8523 //close modal 8524 $(this.modal).removeClass("active"); 8525 this.overlay.style.opacity = "0"; 8526 this.container.style.opacity = "0"; 8527 this.container.style.top = "16px"; 8528 } 8529 }]); 8530 return BackInStockNotice; 8531}(); 8532 8533/***/ }), 8534
8535/***/ "./src/scripts/pdp/campaignFamilySlider.js": 8536/*!*************************************************!*\ 8537 !*** ./src/scripts/pdp/campaignFamilySlider.js ***! 8538 \*************************************************/ 8539/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8540 8541"use strict"; 8542__webpack_require__.r(__webpack_exports__); 8543/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8544/* harmony export */ "CampaignFamilySlider": () => (/* binding */ CampaignFamilySlider) 8545/* harmony export */ }); 8546/* harmony import */ var keen_slider_keen_slider_min_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 8547/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 8548function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 8549function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 8550function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8551function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8552function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 8553function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 8554function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 8555 8556 8557 8558/** 8559 8560Create a Campaign Family Slider found in the influencer view of the PDP. 8561 --- content of family slider set in pdp customizer 8562 --- only displays on campaign view ( snippets/campaign-widget ) 8563 --- content displays on bottom half of page, is shared for every influencer 8564 --- uses <campaign-family-slider> and <campaign-family-nav> custom elements 8565 8566 todo: rework global slider to work with campaign family slider design 8567 8568 @property {Object} slider - Slider object. 8569 @property {HTMLElement} slider.container - Slider container element. 8570 @property {Object} slider.instance - KeenSlider instance of the slider. 8571 @property {HTMLElement[]} slider.slides - Array of slider slide elements. 8572 @property {Object} nav - Navigation object. 8573 @property {HTMLElement} nav.container - Navigation container element. 8574 @property {HTMLElement[]} nav.links - Array of navigation links. 8575 @property {number} index - Current index of the displayed slide. 8576*/ 8577 8578var CampaignFamilySlider = /*#__PURE__*/_createClass(function CampaignFamilySlider() { 8579 var _this = this; 8580 _classCallCheck(this, CampaignFamilySlider); 8581 // build slider 8582 _defineProperty(this, "_build", function () { 8583 _this.slider.instance = new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](_this.slider.container, { 8584 selector: _this.slides, 8585 loop: true, 8586 defaultAnimation: { 8587 duration: 3000 8588 }, 8589 created: function created(el) { 8590 el.moveToIdx(_this.index, true, { 8591 duration: 0 8592 });
8593 _this._addControls(); 8594 }, 8595 slideChanged: function slideChanged(data) { 8596 _this.slides[_this.index].setAttribute("aria-hidden", true); 8597 _this.slides[data.track.details.rel].setAttribute("aria-hidden", false); 8598 _this._updatNav(data.track.details.rel); 8599 }, 8600 detailsChanged: function detailsChanged(s) { 8601 s.slides.forEach(function (element, idx) { 8602 element.style.opacity = s.track.details.slides[idx].portion; 8603 }); 8604 }, 8605 renderMode: "custom" 8606 }); 8607 }); 8608 /** 8609 Update the navigation links to indicate the current slide. 8610 @param {number} idx - The index of the current slide. 8611 */ 8612 _defineProperty(this, "_updatNav", function (idx) { 8613 var oldLink = _this.nav.links[_this.index]; 8614 var newLink = _this.nav.links[idx]; 8615 oldLink.style.fontWeight = "normal"; 8616 oldLink.setAttribute("aria-current", false); 8617 newLink.style.fontWeight = "bold"; 8618 newLink.setAttribute("aria-current", true); 8619 _this.index = idx; 8620 }); 8621 /** 8622 Handle the click event on the navigation links. 8623 @param {Event} e - The click event. 8624 */ 8625 _defineProperty(this, "_handleClick", function (e) { 8626 _this.slider.instance.moveToIdx(parseInt(e.currentTarget.dataset.key), true, { 8627 duration: 0 8628 }); 8629 }); 8630 /** 8631 Add event listeners to the navigation links. 8632 */ 8633 _defineProperty(this, "_addControls", function () { 8634 _this.nav.links = _this.nav.container.querySelectorAll("button"); 8635 _this.nav.links.forEach(function (el) { 8636 el.addEventListener("click", _this._handleClick); 8637 }); 8638 }); 8639 /** 8640 Update the slider and navigation elements. 8641 */ 8642 _defineProperty(this, "_update", function () { 8643 _this.slider.container = document.querySelector("campaign-family-slider"); 8644 _this.nav.container = document.querySelector("campaign-family-nav"); 8645 _this.slides = _this.slider.container.childNodes; 8646 }); 8647 /** 8648 Set up the event listener to reload the slider. 8649 */ 8650 _defineProperty(this, "_setReload", function () { 8651 window.addEventListener("recharge:reload", function () { 8652 _this.slider.instance.update(); 8653 _this._update(); 8654 _this._build(); 8655 }); 8656 }); 8657 // initialize slider if container and slides exsist 8658 _defineProperty(this, "_init", function () { 8659 _this.slides = _this.slider.container ? _this.slider.container.childNodes : false; 8660 if (_this.slides) { 8661 _this._build(); 8662 _this._setReload(); 8663 } 8664 }); 8665 this.slider = { 8666 container: document.querySelector("campaign-family-slider"), 8667 instance: false, 8668 slides: false 8669 }; 8670 this.nav = { 8671 container: document.querySelector("campaign-family-nav"), 8672 links: false 8673 }; 8674 this.index = 0; 8675}); 8676 8677/***/ }), 8678
8679/***/ "./src/scripts/pdp/campaignHelloBar.js": 8680/*!*********************************************!*\ 8681 !*** ./src/scripts/pdp/campaignHelloBar.js ***! 8682 \*********************************************/ 8683/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8684 8685"use strict"; 8686__webpack_require__.r(__webpack_exports__); 8687/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8688/* harmony export */ "CampaignHelloBar": () => (/* binding */ CampaignHelloBar) 8689/* harmony export */ }); 8690function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 8691function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 8692function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8693function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8694function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 8695function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 8696function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 8697/** 8698 Creates bar below header for campaign views. Contains an avatar image and discount message. 8699 Content is set through 'snippets/campaign-widget.liquid' 8700 8701 --- Uses custom element <campaign-hello-bar> 8702*/ 8703var CampaignHelloBar = /*#__PURE__*/_createClass(function CampaignHelloBar() { 8704 var _this = this; 8705 _classCallCheck(this, CampaignHelloBar); 8706 _defineProperty(this, "_handleClose", function () { 8707 _this.section.style.display = "none"; 8708 }); 8709 _defineProperty(this, "_reset", function () { 8710 _this.section = document.querySelector("campaign-hello-bar"); 8711 if (_this.section != null) { 8712 _this.closeIcon = _this.section.querySelector("campaign-hello-bar-close"); 8713 _this.closeIcon.addEventListener("click", _this._handleClose); 8714 _this.active = false; 8715 } 8716 }); 8717 _defineProperty(this, "\xDF", void 0); 8718 _defineProperty(this, "_setReload", function () { 8719 window.addEventListener("recharge:reload", function () { 8720 _this.section = document.querySelector("campaign-hello-bar"); 8721 if (_this.active) { 8722 _this.closeIcon = _this.section.querySelector("campaign-hello-bar-close"); 8723 _this.closeIcon.addEventListener("click", _this._handleClose); 8724 } 8725 }); 8726 }); 8727 _defineProperty(this, "_init", function () { 8728 if (_this.section != null) { 8729 _this.active = true; 8730 _this.closeIcon = _this.section.querySelector("campaign-hello-bar-close"); 8731 _this.closeIcon.addEventListener("click", _this._handleClose); 8732 _this._setReload(); 8733 } 8734 }); 8735 this.section = document.querySelector("campaign-hello-bar"); 8736 this.closeIcon = false; 8737 this.active = false; 8738}); 8739 8740/***/ }), 8741
vendor: 4,323 bytes, lines 8742-8796
8742/***/ "./src/scripts/pdp/campaignQuoteSlider.js": 8743/*!************************************************!*\ 8744 !*** ./src/scripts/pdp/campaignQuoteSlider.js ***! 8745 \************************************************/ 8746/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8747 8748"use strict"; 8749__webpack_require__.r(__webpack_exports__); 8750/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8751/* harmony export */ "CampaignQuoteSlider": () => (/* binding */ CampaignQuoteSlider) 8752/* harmony export */ }); 8753/* harmony import */ var keen_slider_keen_slider_min_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 8754/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 8755function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 8756function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 8757function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8758function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8759function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 8760function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 8761function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 8762 8763 8764 8765/** 8766 Constructs a Quote Slider for Campaign Views. 8767 --- displays on campaign view only 8768 --- content is set in customizer and is shared for all campaigns 8769 --- uses <campaign-quote-slider> and <campaign-quote-nav> custom elements 8770 8771 todo: update slider.js to fit campaign quote slider 8772 8773 @property {HTMLElement} slider.container - The container of the slider. 8774 @property {NodeList} slider.slides - The slides of the slider. 8775 @property {Object} slider.instance - The KeenSlider instance of the slider. 8776 @property {HTMLElement} nav.container - The container of the navigation. 8777 @property {NodeList} nav.links - The navigation dots of the slider. 8778 @property {HTMLElement} nav.prev - The previous control of the navigation. 8779 @property {HTMLElement} nav.next - The next control of the navigation. 8780 @property {string} nav.fill - The fill color of the active dot. 8781 @property {number} index - Index of the current slider 8782*/ 8783 8784var CampaignQuoteSlider = /*#__PURE__*/_createClass(function CampaignQuoteSlider() { 8785 var _this = this; 8786 _classCallCheck(this, CampaignQuoteSlider); 8787 /** 8788 Builds the KeenSlider instance and initializes navigation elements. 8789 */ 8790 _defineProperty(this, "_build", function () { 8791 if (_this.slider.container.hasAttribute("data-keen-slider-disabled")) { 8792 _this.slider.container.removeAttribute("data-keen-slider-disabled"); 8793 } 8794 _this.nav.links = _this.nav.container.querySelectorAll("nav-dot"); 8795 _this.nav.prev = _this.nav.container.querySelector("control-prev"); 8796 _this.nav.next = _this.nav.container.querySelector("control-next");
8797 _this.nav.fill = _this.nav.container.dataset.fill; 8798 _this.slider.instance = new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](_this.slider.container, { 8799 selector: _this.slider.slides, 8800 slides: { 8801 perView: 1, 8802 spacing: 20 8803 }, 8804 loop: true, 8805 created: function created(data) { 8806 _this.slider.slides[data.track.details.rel].setAttribute("aria-hidden", false); 8807 _this._buildNav(); 8808 }, 8809 slideChanged: function slideChanged(data) { 8810 _this._updateSlider(data.track.details.rel); 8811 }, 8812 destroyed: function destroyed(data) { 8813 _this.slider.container.setAttribute("data-keen-slider-disabled", null); 8814 _this._resetSlides(); 8815 } 8816 }); 8817 }); 8818 /** 8819 Updates the slider instance with new slide index. 8820 @param {number} newIdx - The new index of the slide to update the slider with. 8821 */ 8822 _defineProperty(this, "_updateSlider", function (newIdx) { 8823 _this.slider.slides[_this.index].setAttribute("aria-hidden", true); 8824 _this.slider.slides[newIdx].setAttribute("aria-hidden", false); 8825 _this.nav.links[_this.index].style.background = "transparent"; 8826 _this.nav.links[_this.index].setAttribute("aria-current", false); 8827 _this.nav.links[newIdx].style.background = "".concat(_this.nav.fill); 8828 _this.nav.links[newIdx].setAttribute("aria-current", true); 8829 _this.index = newIdx; 8830 }); 8831 /** 8832 Handles the click event on the navigation dots and moves the slider instance to the selected slide index. 8833 @param {Object} e - The event object. 8834 */ 8835 _defineProperty(this, "_handleClick", function (e) { 8836 var index = e.currentTarget.dataset.key; 8837 _this.slider.instance.moveToIdx(parseInt(index)); 8838 }); 8839 // shift slider to previous slider 8840 _defineProperty(this, "_handlePrev", function () { 8841 _this.slider.instance.prev(); 8842 }); 8843 // shift slider to next slide 8844 _defineProperty(this, "_handleNext", function () { 8845 _this.slider.instance.next(); 8846 }); 8847 _defineProperty(this, "_buildNav", function () { 8848 _this.nav.links[_this.index].style.background = "".concat(_this.nav.fill); 8849 _this.nav.links.forEach(function (el) { 8850 el.addEventListener("click", _this._handleClick); 8851 }); 8852 _this.nav.prev.addEventListener("click", _this._handlePrev); 8853 _this.nav.next.addEventListener("click", _this._handleNext); 8854 }); 8855 _defineProperty(this, "_resetSlides", function () { 8856 _this.slider.slides.forEach(function (el) { 8857 el.style.transform = "0"; 8858 el.removeAttribute("aria-hidden"); 8859 el.setAttribute("aria-hidden", false); 8860 }); 8861 }); 8862 _defineProperty(this, "_setReload", function () { 8863 window.addEventListener("recharge:reload", function () { 8864 if (_this.slider.instance) { 8865 _this.slider.instance.destroy(); 8866 } 8867 _this.slider.container = document.querySelector("campaign-quote-slider"); 8868 _this.nav.container = document.querySelector("campaign-quote-nav"); 8869 _this.slider.slides = _this.slider.container.childNodes; 8870 if (window.innerWidth < 1024 && _this.slider.slides) { 8871 _this._build(); 8872 } 8873 }); 8874 }); 8875 _defineProperty(this, "_init", function () { 8876 _this.slider.slides = _this.slider.container != null ? _this.slider.container.childNodes : false; 8877 if (_this.slider.slides == false || _this.slider.slides.length <= 1) { 8878 return; 8879 } 8880 if (window.innerWidth < 1024) { 8881 _this._build(); 8882 } 8883 _this._setReload(); 8884 window.addEventListener("resize", function () { 8885 if (window.innerWidth < 1024 && _this.slider.instance == false) { 8886 _this._build(); 8887 } 8888 if (window.innerWidth >= 1024 && _this.slider.instance) { 8889 _this.slider.instance.destroy(); 8890 } 8891 }); 8892 }); 8893 this.breakpoint = 1024, this.slider = { 8894 container: document.querySelector("campaign-quote-slider"), 8895 slides: false, 8896 instance: false 8897 }; 8898 this.nav = { 8899 container: document.querySelector("campaign-quote-nav"), 8900 links: false, 8901 prev: false, 8902 next: false, 8903 fill: false 8904 }; 8905 this.index = 0; 8906}); 8907 8908/***/ }), 8909
8910/***/ "./src/scripts/pdp/comboBox.js": 8911/*!*************************************!*\ 8912 !*** ./src/scripts/pdp/comboBox.js ***! 8913 \*************************************/ 8914/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8915 8916"use strict"; 8917__webpack_require__.r(__webpack_exports__); 8918/* harmony export */ __webpack_require__.d(__webpack_exports__, { 8919/* harmony export */ "ComboBox": () => (/* binding */ ComboBox) 8920/* harmony export */ }); 8921function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 8922function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 8923function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 8924function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 8925function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 8926function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 8927function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 8928function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 8929function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8930function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8931function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 8932function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 8933function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 8934/*---- 8935 8936 todo: integrate combobox on pdp with global combobox script 8937 8938 8939 This JS is taken from this article - https://www.24a11y.com/2019/select-your-poison-part-2/ 8940 It is also modified to be used as a way to decorate select dropdowns and make them 8941 accessible using keyboards. 8942 8943 How to use it: 8944 Add js-combobox class to the <select> element you would like to replace with the combobox. 8945 Hide your <select> element as well as corresponding <label> element with display: none;. 8946 8947 On load, this libary will create a new <label> element and a combobox element which consists 8948 of an input element and a listbox. 8949 8950 The new <label> element will have select label's aria-label. 8951 The new combobox element will have select options' values and text. 8952 8953 On option select, this libary will also set your hidden <select> element's val so it 8954 can be used further. 8955 8956----*/ 8957var ComboBox = /*#__PURE__*/_createClass(function ComboBox() { 8958 var _this = this; 8959 _classCallCheck(this, ComboBox); 8960 // return an array of exact option name matches from a comma-separated string 8961 _defineProperty(this, "_findMatches", function (options, search) { 8962 var names = search.split(","); 8963 return names.map(function (name) { 8964 var match = options.filter(function (option) { 8965 return name.trim().toLowerCase() === option.toLowerCase(); 8966 }); 8967 return match.length > 0 ? match[0] : null; 8968 }).filter(function (option) { 8969 return option !== null; 8970 }); 8971 }); 8972 // return combobox action from key press 8973 _defineProperty(this, "_getActionFromKey", function (key, menuOpen) { 8974 // handle opening when closed 8975 if (!menuOpen && key === _this.keys.Down) { 8976 return _this.menuActions.Open; 8977 } 8978 8979 // handle keys when open 8980 if (key === _this.keys.Down) { 8981 return _this.menuActions.Next; 8982 } else if (key === _this.keys.Up) { 8983 return _this.menuActions.Previous; 8984 } else if (key === _this.keys.Home) { 8985 return _this.menuActions.First; 8986 } else if (key === _this.keys.End) { 8987 return _this.menuActions.Last; 8988 } else if (key === _this.keys.Escape) { 8989 return _this.menuActions.Close; 8990 } else if (key === _this.keys.Enter) { 8991 return _this.menuActions.CloseSelect; 8992 } else if (key === _this.keys.Backspace || key === _this.keys.Clear || key.length === 1) { 8993 return _this.menuActions.Type; 8994 } 8995 }); 8996 // get index of option that matches a string 8997 _defineProperty(this, "_getIndexByLetter", function (options, filter) { 8998 var firstMatch = _this._filterOptions(options, filter)[0]; 8999 return firstMatch ? options.indexOf(firstMatch) : -1; 9000 }); 9001 // get updated option index 9002 _defineProperty(this, "_getUpdatedIndex", function (current, max, action) { 9003 switch (action) { 9004 case _this.menuActions.First: 9005 return 0; 9006 case _this.menuActions.Last: 9007 return max; 9008 case _this.menuActions.Previous: 9009 return Math.max(0, current - 1); 9010 case _this.menuActions.Next: 9011 return Math.min(max, current + 1); 9012 default: 9013 return current; 9014 } 9015 }); 9016 // check if an element is currently scrollable 9017 _defineProperty(this, "_isScrollable", function (element) { 9018 return element && element.clientHeight < element.scrollHeight; 9019 });
9020 // ensure given child element is within the parent's visible scroll area 9021 _defineProperty(this, "_maintainScrollVisibility", function (activeElement, scrollParent) { 9022 var offsetHeight = activeElement.offsetHeight, 9023 offsetTop = activeElement.offsetTop; 9024 var parentOffsetHeight = scrollParent.offsetHeight, 9025 scrollTop = scrollParent.scrollTop; 9026 var isAbove = offsetTop < scrollTop; 9027 var isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; 9028 if (isAbove) { 9029 scrollParent.scrollTo(0, offsetTop); 9030 } else if (isBelow) { 9031 scrollParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); 9032 } 9033 }); 9034 // filter an array of options against an input string 9035 // returns an array of options that begin with the filter string, case-independent 9036 _defineProperty(this, "_filterOptions", function () { 9037 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 9038 var filter = arguments.length > 1 ? arguments[1] : undefined; 9039 var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; 9040 return options.filter(function (option) { 9041 var matches = option.toLowerCase().indexOf(filter.toLowerCase()) === 0; 9042 return matches && exclude.indexOf(option) < 0; 9043 }); 9044 }); 9045 _defineProperty(this, "_init", function () { 9046 var container = $(".js-combobox"); 9047 var $this = $(container); 9048 var labelEl = $(container).parents("label[for=\"rtx_option_plans_dropdown\"]"); 9049 9050 // Insert combobox after select element's label 9051 labelEl.after('<label for="combo' + _this.index + '" aria-label="' + labelEl.attr("aria-label") + '" class="combo-label"></label>' + '<div class="combo js-aria11">' + '<div role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-owns="listbox' + _this.index + '" class="input-wrapper">' + '<input aria-activedescendant="" aria-autocomplete="none" aria-label="Subscription frequency" id="combo' + _this.index + '" class="combo-input" role="combobox" readonly type="text">' + '<div class="combo-menu" role="listbox" id="listbox' + _this.index + '"></div>' + "</div>" + "</div>"); 9052 var selectOptions = $this.find("option"); 9053 _this.optionValues = $.map(selectOptions, function (e) { 9054 return $(e).val(); 9055 }); 9056 _this.options = $.map(selectOptions, function (e) { 9057 return e.label; 9058 }); 9059 var selectedValue = "".concat($this.val() || ""); 9060 var selectedIndex = _this.optionValues.indexOf(selectedValue); 9061 _this.activeIndex = selectedIndex >= 0 ? selectedIndex : 0; 9062 var el = labelEl.siblings(".js-aria11")[0]; 9063 9064 // // init combo 9065 _this.el = el; 9066 if (_this.el && _this.options.length) { 9067 _this.selectEl = $this; 9068 _this.comboEl = el.querySelector("[role=combobox]"); 9069 _this.inputEl = el.querySelector("input"); 9070 _this.listboxEl = el.querySelector("[role=listbox]"); 9071 _this.idBase = _this.inputEl.id; 9072 _this._buildCombo(); 9073 9074 // Add event listener for clicks outside the combo box 9075 document.addEventListener("click", _this._onDocumentClick); 9076 } else { 9077 console.log("No Subscription Option for Product."); 9078 } 9079 }); 9080 _defineProperty(this, "_buildCombo", function () { 9081 _this.inputEl.addEventListener("input", _this._onInput); 9082 _this.inputEl.addEventListener("blur", _this._onInputBlur); 9083 _this.inputEl.addEventListener("click", function () { 9084 return _this._updateMenuState(true); 9085 }); 9086 _this.inputEl.addEventListener("keydown", _this._onInputKeyDown); 9087 _this.options.map(function (option, index) { 9088 var optionEl = document.createElement("div"); 9089 optionEl.setAttribute("role", "option"); 9090 optionEl.id = "".concat(_this.idBase, "-").concat(index); 9091 optionEl.className = index === 0 ? "combo-option option-current" : "combo-option"; 9092 optionEl.setAttribute("aria-selected", "false"); 9093 optionEl.innerText = option; 9094 optionEl.addEventListener("click", function () { 9095 _this._onOptionClick(index); 9096 }); 9097 optionEl.addEventListener("mousedown", _this._onOptionMouseDown()); 9098 _this.listboxEl.appendChild(optionEl); 9099 }); 9100 _this._selectOption(_this.activeIndex, false); 9101 }); 9102 _defineProperty(this, "_onInput", function () { 9103 var curValue = _this.inputEl.value; 9104 var matches = _this._filterOptions(_this.options, curValue); 9105 9106 // set activeIndex to first matching option 9107 // (or leave it alone, if the active option is already in the matching set) 9108 var filterCurrentOption = matches.filter(function (option) { 9109 return option === _this.options[_this.activeIndex]; 9110 }); 9111 if (matches.length > 0 && !filterCurrentOption.length) { 9112 _this._onOptionChange(_this.options.indexOf(matches[0])); 9113 } 9114 var menuState = _this.options.length > 0; 9115 if (_this.open !== menuState) { 9116 _this._updateMenuState(menuState, false); 9117 } 9118 }); 9119 _defineProperty(this, "_onInputKeyDown", function (event) { 9120 var key = event.key; 9121 var max = _this.options.length - 1; 9122 var action = _this._getActionFromKey(key, _this.open); 9123 switch (action) { 9124 case _this.menuActions.Next: 9125 case _this.menuActions.Last: 9126 case _this.menuActions.First: 9127 case _this.menuActions.Previous: 9128 event.preventDefault();
9129 return _this._onOptionChange(_this._getUpdatedIndex(_this.activeIndex, max, action)); 9130 case _this.menuActions.CloseSelect: 9131 event.preventDefault(); 9132 _this._selectOption(_this.activeIndex); 9133 return _this._updateMenuState(false); 9134 case _this.menuActions.Close: 9135 event.preventDefault(); 9136 return _this._updateMenuState(false); 9137 case _this.menuActions.Open: 9138 return _this._updateMenuState(true); 9139 } 9140 }); 9141 _defineProperty(this, "_onInputBlur", function () { 9142 if (this.ignoreBlur) { 9143 this.ignoreBlur = false; 9144 return; 9145 } 9146 if (this.open) { 9147 this._updateMenuState(false, false); 9148 } 9149 }); 9150 _defineProperty(this, "_onOptionChange", function (index) { 9151 this.activeIndex = index; 9152 this.inputEl.setAttribute("aria-activedescendant", "".concat(this.idBase, "-").concat(index)); 9153 9154 // update active style 9155 var options = this.el.querySelectorAll("[role=option]"); 9156 _toConsumableArray(options).forEach(function (optionEl) { 9157 optionEl.classList.remove("option-current"); 9158 }); 9159 options[index].classList.add("option-current"); 9160 if (this.open && this._isScrollable(this.listboxEl)) { 9161 this._maintainScrollVisibility(options[index], this.listboxEl); 9162 } 9163 }); 9164 _defineProperty(this, "_onOptionClick", function (index) { 9165 this._onOptionChange(index); 9166 this._selectOption(index); 9167 this._updateMenuState(false); 9168 }); 9169 _defineProperty(this, "_onOptionMouseDown", function () { 9170 this.ignoreBlur = true; 9171 }); 9172 _defineProperty(this, "_selectOption", function (index) { 9173 var shouldSync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 9174 var selected = this.options[index]; 9175 this.inputEl.value = selected; 9176 this.inputEl.setAttribute("aria-label", "Subscription frequency, selected ".concat(selected)); 9177 this.activeIndex = index; 9178 9179 // update aria-selected 9180 var options = this.el.querySelectorAll("[role=option]"); 9181 _toConsumableArray(options).forEach(function (optionEl) { 9182 optionEl.setAttribute("aria-selected", "false"); 9183 }); 9184 options[index].setAttribute("aria-selected", "true"); 9185 if (!shouldSync) { 9186 return; 9187 } 9188 9189 // Update hidden select element's value 9190 this.selectEl.val(this.optionValues[index]); 9191 setSellingPlan(this.selectEl.data("product_id")); 9192 var dropdown = document.querySelector(".combo-input"); 9193 var retexBuyBox = document.querySelector(".rtx_container"); 9194 var currentProductId = retexBuyBox.id; 9195 dropdown.addEventListener("click", function (e) { 9196 var noClickBtn = document.getElementById("product_onetime_".concat(currentProductId)); 9197 noClickBtn.checked = false; 9198 var yesClickBtn = document.getElementById("product_subsave_".concat(currentProductId, "_1")); 9199 yesClickBtn.checked = true; 9200 }); 9201 }); 9202 _defineProperty(this, "_updateMenuState", function (open) { 9203 var callFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 9204 this.open = open; 9205 this.comboEl.setAttribute("aria-expanded", "".concat(open)); 9206 open ? this.el.classList.add("open") : this.el.classList.remove("open"); 9207 }); 9208 _defineProperty(this, "_onDocumentClick", function (event) { 9209 if (_this.open && !_this.el.contains(event.target)) { 9210 _this._updateMenuState(false); 9211 } 9212 }); 9213 this.keys = { 9214 Backspace: "Backspace", 9215 Clear: "Clear", 9216 Down: "ArrowDown", 9217 End: "End", 9218 Enter: "Enter", 9219 Escape: "Escape", 9220 Home: "Home", 9221 Left: "ArrowLeft", 9222 PageDown: "PageDown", 9223 PageUp: "PageUp", 9224 Right: "ArrowRight", 9225 Space: " ", 9226 Tab: "Tab", 9227 Up: "ArrowUp" 9228 }; 9229 this.menuActions = { 9230 Close: 0, 9231 CloseSelect: 1, 9232 First: 2, 9233 Last: 3, 9234 Next: 4, 9235 Open: 5, 9236 Previous: 6, 9237 Select: 7, 9238 Space: 8, 9239 Type: 9 9240 }; 9241 this.el = false; 9242 this.selectEl = false;
9243 this.comboEl = false; 9244 this.inputEl = false; 9245 this.listboxEl = false; 9246 this.idBase = false; 9247 this.options = false; 9248 this.optionValues = false; 9249 this.activeIndex = 0; 9250 this.open = false; 9251}); 9252 9253/***/ }), 9254
9255/***/ "./src/scripts/pdp/flavorSliderUtils.js": 9256/*!**********************************************!*\ 9257 !*** ./src/scripts/pdp/flavorSliderUtils.js ***! 9258 \**********************************************/ 9259/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9260 9261"use strict"; 9262__webpack_require__.r(__webpack_exports__); 9263/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9264/* harmony export */ "animateFlavorDropdownClose": () => (/* binding */ animateFlavorDropdownClose), 9265/* harmony export */ "updateFlavorSlider": () => (/* binding */ updateFlavorSlider) 9266/* harmony export */ }); 9267/* harmony import */ var _barba_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @barba/core */ "./node_modules/@barba/core/dist/barba.umd.js"); 9268/* harmony import */ var _barba_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_barba_core__WEBPACK_IMPORTED_MODULE_0__); 9269 9270var flavorDropdownListenersBound = false; 9271var FLAVOR_DROPDOWN_CLOSE_MS = 500; 9272var FLAVOR_DROPDOWN_CLOSED_HEIGHT = 48; 9273function getFlavorDropdownCollapse(details) { 9274 return details.querySelector(".product-flavor-dropdown__collapse"); 9275} 9276function getFlavorDropdownCollapseInner(details) { 9277 return details.querySelector(".product-flavor-dropdown__collapse-inner"); 9278} 9279function getFlavorDropdownScroll(details) { 9280 return details.querySelector("[data-flavor-scroll]"); 9281} 9282function resetFlavorDropdownScrollToTop(details) { 9283 var scroll = getFlavorDropdownScroll(details); 9284 if (scroll) {
9285 scroll.scrollTop = 0; 9286 } 9287} 9288function getFlavorDropdownScrollbar(details) { 9289 return { 9290 bar: details.querySelector("[data-flavor-scrollbar]"), 9291 topFill: details.querySelector("[data-flavor-scrollbar-top]"), 9292 thumb: details.querySelector("[data-flavor-scrollbar-thumb]"), 9293 bottomFill: details.querySelector("[data-flavor-scrollbar-bottom]") 9294 }; 9295} 9296function prefersReducedMotion() { 9297 return typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; 9298} 9299function getFlavorDropdownTargetHeight(details) { 9300 var collapseInner = getFlavorDropdownCollapseInner(details); 9301 return (collapseInner === null || collapseInner === void 0 ? void 0 : collapseInner.offsetHeight) || (collapseInner === null || collapseInner === void 0 ? void 0 : collapseInner.scrollHeight) || 240; 9302} 9303function syncFlavorDropdownScrollbar(details) { 9304 var scroll = getFlavorDropdownScroll(details); 9305 var _getFlavorDropdownScr = getFlavorDropdownScrollbar(details), 9306 bar = _getFlavorDropdownScr.bar, 9307 topFill = _getFlavorDropdownScr.topFill, 9308 thumb = _getFlavorDropdownScr.thumb, 9309 bottomFill = _getFlavorDropdownScr.bottomFill; 9310 if (!scroll || !bar || !topFill || !thumb || !bottomFill) { 9311 return; 9312 } 9313 var maxScroll = scroll.scrollHeight - scroll.clientHeight; 9314 if (maxScroll <= 0) { 9315 bar.dataset.visible = "false"; 9316 topFill.style.height = "0px"; 9317 thumb.style.height = "0px"; 9318 bottomFill.style.height = "0px"; 9319 return; 9320 } 9321 var barHeight = bar.offsetHeight || 160; 9322 var gap = 4; 9323 var thumbHeight = Math.min(barHeight, 62); 9324 var maxThumbTop = Math.max(0, barHeight - thumbHeight); 9325 var progress = maxScroll > 0 ? scroll.scrollTop / maxScroll : 0; 9326 var thumbTop = Math.round(maxThumbTop * progress); 9327 var topHeight = Math.max(0, thumbTop - gap); 9328 var bottomTop = Math.min(barHeight, thumbTop + thumbHeight + gap); 9329 var bottomHeight = Math.max(0, barHeight - bottomTop); 9330 bar.dataset.visible = "true"; 9331 topFill.style.height = "".concat(topHeight, "px"); 9332 topFill.style.display = topHeight > 0 ? "block" : "none"; 9333 thumb.style.top = "".concat(thumbTop, "px"); 9334 thumb.style.height = "".concat(thumbHeight, "px"); 9335 bottomFill.style.top = "".concat(bottomTop, "px"); 9336 bottomFill.style.height = "".concat(bottomHeight, "px"); 9337 bottomFill.style.display = bottomHeight > 0 ? "block" : "none"; 9338} 9339function bindFlavorDropdownScrollbar(details) { 9340 var scroll = getFlavorDropdownScroll(details); 9341 if (!scroll || scroll.dataset.flavorScrollbarBound === "true") { 9342 return; 9343 } 9344 scroll.dataset.flavorScrollbarBound = "true"; 9345 scroll.addEventListener("scroll", function () { 9346 syncFlavorDropdownScrollbar(details); 9347 }, { 9348 passive: true 9349 }); 9350 if (typeof ResizeObserver === "function") { 9351 var resizeObserver = new ResizeObserver(function () { 9352 syncFlavorDropdownScrollbar(details); 9353 }); 9354 resizeObserver.observe(scroll); 9355 } 9356} 9357 9358/** 9359 * After <details> opens, animate height 0px â target height. 9360 */ 9361function scheduleFlavorDropdownOpenAnimation(details) { 9362 var collapse = getFlavorDropdownCollapse(details); 9363 if (!collapse || !details.open) { 9364 return; 9365 } 9366 bindFlavorDropdownScrollbar(details); 9367 syncFlavorDropdownScrollbar(details); 9368 var targetHeight = getFlavorDropdownTargetHeight(details); 9369 if (prefersReducedMotion()) { 9370 collapse.style.height = "".concat(targetHeight, "px"); 9371 requestAnimationFrame(function () { 9372 return syncFlavorDropdownScrollbar(details); 9373 }); 9374 return; 9375 } 9376 var run = function run() { 9377 if (!details.open) { 9378 return; 9379 } 9380 collapse.style.transition = "none"; 9381 collapse.style.height = "".concat(FLAVOR_DROPDOWN_CLOSED_HEIGHT, "px"); 9382 void collapse.getBoundingClientRect(); 9383 collapse.style.removeProperty("transition"); 9384 requestAnimationFrame(function () { 9385 requestAnimationFrame(function () { 9386 if (!details.open) { 9387 collapse.style.removeProperty("height"); 9388 collapse.style.removeProperty("transition"); 9389 return; 9390 } 9391 collapse.style.height = "".concat(targetHeight, "px"); 9392 syncFlavorDropdownScrollbar(details); 9393 }); 9394 }); 9395 }; 9396 run(); 9397}
9398function animateFlavorDropdownOpen(details) { 9399 var collapse = getFlavorDropdownCollapse(details); 9400 if (!details || !collapse || details.open) { 9401 return; 9402 } 9403 document.querySelectorAll("details.product-flavor-dropdown").forEach(function (d) { 9404 if (d !== details) { 9405 animateFlavorDropdownClose(d, { 9406 instant: true 9407 }); 9408 } 9409 }); 9410 collapse.style.transition = "none"; 9411 collapse.style.height = "".concat(FLAVOR_DROPDOWN_CLOSED_HEIGHT, "px"); 9412 details.dataset.flavorOpenHandled = "true"; 9413 details.setAttribute("open", ""); 9414 resetFlavorDropdownScrollToTop(details); 9415 bindFlavorDropdownScrollbar(details); 9416 scheduleFlavorDropdownOpenAnimation(details); 9417} 9418 9419/** 9420 * Close flavor <details> after animating the collapse height. 9421 * @param {HTMLDetailsElement} details 9422 * @param {{ instant?: boolean, onAfterClose?: () => void }} options 9423 */ 9424function animateFlavorDropdownClose(details) { 9425 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 9426 var _options$instant = options.instant, 9427 instant = _options$instant === void 0 ? false : _options$instant, 9428 onAfterClose = options.onAfterClose; 9429 var collapse = getFlavorDropdownCollapse(details); 9430 if (!details || !collapse) { 9431 details === null || details === void 0 ? void 0 : details.removeAttribute("open"); 9432 onAfterClose === null || onAfterClose === void 0 ? void 0 : onAfterClose(); 9433 return; 9434 } 9435 if (!details.open) { 9436 collapse.style.height = ""; 9437 delete collapse.dataset.flavorClosing; 9438 onAfterClose === null || onAfterClose === void 0 ? void 0 : onAfterClose(); 9439 return; 9440 } 9441 if (instant) { 9442 collapse.style.height = ""; 9443 delete collapse.dataset.flavorClosing; 9444 details.removeAttribute("open"); 9445 onAfterClose === null || onAfterClose === void 0 ? void 0 : onAfterClose(); 9446 return; 9447 } 9448 if (prefersReducedMotion()) { 9449 collapse.style.height = ""; 9450 delete collapse.dataset.flavorClosing; 9451 details.removeAttribute("open"); 9452 onAfterClose === null || onAfterClose === void 0 ? void 0 : onAfterClose(); 9453 return; 9454 } 9455 if (collapse.dataset.flavorClosing === "true") { 9456 return; 9457 } 9458 collapse.dataset.flavorClosing = "true"; 9459 collapse.style.height = "".concat(getFlavorDropdownTargetHeight(details), "px"); 9460 void collapse.getBoundingClientRect(); 9461 collapse.style.height = "".concat(FLAVOR_DROPDOWN_CLOSED_HEIGHT, "px"); 9462 var finish = function finish() { 9463 delete collapse.dataset.flavorClosing; 9464 collapse.style.height = ""; 9465 details.removeAttribute("open"); 9466 onAfterClose === null || onAfterClose === void 0 ? void 0 : onAfterClose(); 9467 }; 9468 var onEnd = function onEnd(ev) { 9469 if (ev.target !== collapse) { 9470 return; 9471 } 9472 if (ev.propertyName !== "height") { 9473 return; 9474 } 9475 collapse.removeEventListener("transitionend", onEnd); 9476 finish(); 9477 }; 9478 collapse.addEventListener("transitionend", onEnd); 9479 window.setTimeout(function () { 9480 if (collapse.dataset.flavorClosing === "true") { 9481 collapse.removeEventListener("transitionend", onEnd); 9482 finish(); 9483 } 9484 }, FLAVOR_DROPDOWN_CLOSE_MS); 9485} 9486function navigateFromFlavorDropdownRow(anchor) { 9487 var href = anchor.href; 9488 if (document.documentElement.dataset.prefetching === "false") { 9489 window.location.assign(href); 9490 return; 9491 } 9492 try { 9493 _barba_core__WEBPACK_IMPORTED_MODULE_0___default().go(href, anchor); 9494 } catch (_unused) { 9495 window.location.assign(href); 9496 } 9497} 9498function initFlavorDropdown() { 9499 if (flavorDropdownListenersBound) { 9500 return; 9501 } 9502 flavorDropdownListenersBound = true; 9503 document.addEventListener("click", function (e) { 9504 if (e.button !== 0) { 9505 return; 9506 } 9507 var rowAnchor = e.target.closest("a.product-flavor-dropdown__row"); 9508 if (rowAnchor) { 9509 var details = rowAnchor.closest("details.product-flavor-dropdown"); 9510 if (details !== null && details !== void 0 && details.open) { 9511 if (e.defaultPrevented) { 9512 return; 9513 } 9514 if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) { 9515 return; 9516 } 9517 if (rowAnchor.target === "_blank") { 9518 return; 9519 } 9520 var download = rowAnchor.getAttribute("download"); 9521 if (download !== null && download !== "") { 9522 return; 9523 } 9524 var hrefAttr = rowAnchor.getAttribute("href"); 9525 if (!hrefAttr || hrefAttr === "#" || hrefAttr.startsWith("#")) { 9526 return; 9527 } 9528 e.preventDefault(); 9529 e.stopImmediatePropagation(); 9530 animateFlavorDropdownClose(details, { 9531 onAfterClose: function onAfterClose() { 9532 return navigateFromFlavorDropdownRow(rowAnchor); 9533 } 9534 }); 9535 return; 9536 } 9537 } 9538 var summary = e.target.closest("details.product-flavor-dropdown > summary.product-flavor-dropdown__trigger"); 9539 if (summary) { 9540 var _details = summary.closest("details.product-flavor-dropdown"); 9541 if (_details !== null && _details !== void 0 && _details.open) { 9542 e.preventDefault(); 9543 e.stopImmediatePropagation(); 9544 animateFlavorDropdownClose(_details); 9545 } else if (_details) { 9546 e.preventDefault(); 9547 e.stopImmediatePropagation(); 9548 animateFlavorDropdownOpen(_details); 9549 } 9550 return; 9551 } 9552 var insideFlavor = e.target.closest("details.product-flavor-dropdown"); 9553 if (!insideFlavor) { 9554 document.querySelectorAll("details.product-flavor-dropdown[open]").forEach(function (d) { 9555 animateFlavorDropdownClose(d); 9556 }); 9557 } 9558 }, true); 9559 document.body.addEventListener("click", function (e) { 9560 var btn = e.target.closest("[data-flavor-dropdown-close]"); 9561 if (!btn) { 9562 return; 9563 } 9564 var details = btn.closest("details.product-flavor-dropdown"); 9565 if (details) { 9566 animateFlavorDropdownClose(details); 9567 } 9568 }); 9569 document.addEventListener("toggle", function (e) { 9570 var _details$classList; 9571 var details = e.target; 9572 if (!(details !== null && details !== void 0 && (_details$classList = details.classList) !== null && _details$classList !== void 0 && _details$classList.contains("product-flavor-dropdown"))) { 9573 return; 9574 } 9575 if (details.open) { 9576 if (details.dataset.flavorOpenHandled === "true") { 9577 delete details.dataset.flavorOpenHandled; 9578 return; 9579 } 9580 document.querySelectorAll("details.product-flavor-dropdown").forEach(function (d) { 9581 if (d !== details) { 9582 animateFlavorDropdownClose(d, { 9583 instant: true 9584 }); 9585 } 9586 });
9587 resetFlavorDropdownScrollToTop(details); 9588 bindFlavorDropdownScrollbar(details); 9589 scheduleFlavorDropdownOpenAnimation(details); 9590 } else { 9591 var collapse = getFlavorDropdownCollapse(details); 9592 var _getFlavorDropdownScr2 = getFlavorDropdownScrollbar(details), 9593 bar = _getFlavorDropdownScr2.bar; 9594 if (collapse) { 9595 collapse.style.height = ""; 9596 delete collapse.dataset.flavorClosing; 9597 } 9598 if (bar) { 9599 bar.dataset.visible = "false"; 9600 } 9601 } 9602 }, true); 9603} 9604function updateFlavorSlider() { 9605 initFlavorDropdown(); 9606 document.querySelectorAll("details.product-flavor-dropdown").forEach(function (el) { 9607 bindFlavorDropdownScrollbar(el); 9608 animateFlavorDropdownClose(el, { 9609 instant: true 9610 }); 9611 }); 9612 var swiperEl = document.querySelector("swiper-container.product-flavor-slider"); 9613 if (swiperEl && swiperEl.swiper) { 9614 swiperEl.swiper.update(); 9615 swiperEl.swiper.navigation.update(); 9616 var slides = swiperEl.querySelectorAll("swiper-slide"); 9617 var targetIndex = -1; 9618 slides.forEach(function (slide, idx) { 9619 if (slide.querySelector('a[aria-current="page"]')) { 9620 targetIndex = idx; 9621 } 9622 }); 9623 if (targetIndex > 3) { 9624 swiperEl.swiper.slideTo(targetIndex, 0); 9625 } 9626 if (swiperEl.swiper.params.freeMode && [3, 7, 11].includes(targetIndex) && window.innerWidth < 768) { 9627 var currentTranslate = swiperEl.swiper.getTranslate(); 9628 swiperEl.swiper.setTranslate(currentTranslate - 60); 9629 swiperEl.swiper.updateProgress(); 9630 swiperEl.swiper.updateActiveIndex(); 9631 swiperEl.swiper.updateSlidesClasses(); 9632 } 9633 } 9634} 9635 9636/***/ }), 9637
9638/***/ "./src/scripts/pdp/index.js": 9639/*!**********************************!*\ 9640 !*** ./src/scripts/pdp/index.js ***! 9641 \**********************************/ 9642/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9643 9644"use strict"; 9645__webpack_require__.r(__webpack_exports__); 9646/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9647/* harmony export */ "BackInStockNotice": () => (/* reexport safe */ _backInStock_js__WEBPACK_IMPORTED_MODULE_2__.BackInStockNotice), 9648/* harmony export */ "CampaignFamilySlider": () => (/* reexport safe */ _campaignFamilySlider_js__WEBPACK_IMPORTED_MODULE_7__.CampaignFamilySlider), 9649/* harmony export */ "CampaignHelloBar": () => (/* reexport safe */ _campaignHelloBar_js__WEBPACK_IMPORTED_MODULE_6__.CampaignHelloBar), 9650/* harmony export */ "CampaignQuoteSlider": () => (/* reexport safe */ _campaignQuoteSlider_js__WEBPACK_IMPORTED_MODULE_8__.CampaignQuoteSlider), 9651/* harmony export */ "ComboBox": () => (/* reexport safe */ _comboBox_js__WEBPACK_IMPORTED_MODULE_9__.ComboBox), 9652/* harmony export */ "OhiWidget": () => (/* reexport safe */ _ohiWidget_js__WEBPACK_IMPORTED_MODULE_3__.OhiWidget), 9653/* harmony export */ "ProductGallery": () => (/* reexport safe */ _productGallery_js__WEBPACK_IMPORTED_MODULE_4__.ProductGallery), 9654/* harmony export */ "QuantitySelector": () => (/* reexport safe */ _quantitySelector_js__WEBPACK_IMPORTED_MODULE_5__.QuantitySelector) 9655/* harmony export */ }); 9656/* harmony import */ var _variant_radios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./variant-radios */ "./src/scripts/pdp/variant-radios.js"); 9657/* harmony import */ var _flavorSliderUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./flavorSliderUtils.js */ "./src/scripts/pdp/flavorSliderUtils.js"); 9658/* harmony import */ var _backInStock_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./backInStock.js */ "./src/scripts/pdp/backInStock.js"); 9659/* harmony import */ var _ohiWidget_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ohiWidget.js */ "./src/scripts/pdp/ohiWidget.js"); 9660/* harmony import */ var _productGallery_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./productGallery.js */ "./src/scripts/pdp/productGallery.js"); 9661/* harmony import */ var _quantitySelector_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./quantitySelector.js */ "./src/scripts/pdp/quantitySelector.js"); 9662/* harmony import */ var _campaignHelloBar_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./campaignHelloBar.js */ "./src/scripts/pdp/campaignHelloBar.js"); 9663/* harmony import */ var _campaignFamilySlider_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./campaignFamilySlider.js */ "./src/scripts/pdp/campaignFamilySlider.js"); 9664/* harmony import */ var _campaignQuoteSlider_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./campaignQuoteSlider.js */ "./src/scripts/pdp/campaignQuoteSlider.js"); 9665/* harmony import */ var _comboBox_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./comboBox.js */ "./src/scripts/pdp/comboBox.js"); 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676document.addEventListener('DOMContentLoaded', function () { 9677 (0,_flavorSliderUtils_js__WEBPACK_IMPORTED_MODULE_1__.updateFlavorSlider)(); 9678}); 9679 9680/***/ }), 9681
vendor: 5,012 bytes, lines 9682-9694
9682/***/ "./src/scripts/pdp/ohiWidget.js": 9683/*!**************************************!*\ 9684 !*** ./src/scripts/pdp/ohiWidget.js ***! 9685 \**************************************/ 9686/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9687 9688"use strict"; 9689__webpack_require__.r(__webpack_exports__); 9690/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9691/* harmony export */ "OhiWidget": () => (/* binding */ OhiWidget) 9692/* harmony export */ }); 9693function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 9694function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,627 bytes, lines 9694-9701
9694 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 9695function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 9696function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 9697function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9698function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 9699function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 9700function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 9701function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string");
9701 return _typeof(key) === "symbol" ? key : String(key); } 9702function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 9703/* 9704 ** Note: This Widget will not work when viewing the PDP through a shopify preview link ( due to the different url ). 9705 9706 *** OhiWidget has been discontinued ( shipping issues ) but may be re-installed in the future, keeping this here for now *** 9707 9708*/ 9709 9710var OhiWidget = /*#__PURE__*/function () { 9711 function OhiWidget(product) { 9712 var _this = this; 9713 _classCallCheck(this, OhiWidget); 9714 _defineProperty(this, "_handleToggle", function () { 9715 var _this$state = _this.state, 9716 toggleBtn = _this$state.toggleBtn, 9717 input = _this$state.input, 9718 inputContainer = _this$state.inputContainer, 9719 hasError = _this$state.hasError; 9720 _this.state.isOpen = !_this.state.isOpen; 9721 toggleBtn.innerHTML = _this.state.isOpen ? "Cancel" : "Edit Location"; 9722 toggleBtn.ariaExpanded = _this.state.isOpen ? "true" : "false"; 9723 inputContainer.style.height = _this.state.isOpen ? "64px" : "0px"; 9724 inputContainer.style.opacity = _this.state.isOpen ? "1" : "0"; 9725 if (_this.state.isOpen == false) { 9726 input.value == ""; 9727 } else { 9728 input.focus(); 9729 } 9730 if (hasError) { 9731 _this._clearError(); 9732 } 9733 }); 9734 _defineProperty(this, "_handleSubmit", function () { 9735 var _this$state2 = _this.state, 9736 input = _this$state2.input, 9737 hasError = _this$state2.hasError, 9738 handle = _this$state2.handle; 9739 var inputValue = input.value; 9740 var isValidZipCode = inputValue.match(/^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z] \d[A-Z]\d$/); 9741 if (isValidZipCode) { 9742 _this._fetchApi(inputValue); 9743 if (hasError) { 9744 _this._clearError(); 9745 } 9746 } else { 9747 _this.state.hasError = true; 9748 input.classList.add("input--error"); 9749 b; 9750 $("#ohi-error-".concat(handle)).html("* Please Enter Valid Zip Code"); 9751 } 9752 }); 9753 this.state = { 9754 isOpen: false, 9755 isDisabled: false, 9756 zipCode: false, 9757 hasError: false, 9758 title: product.title, 9759 handle: product.handle, 9760 sku: product.sku, 9761 widget: document.getElementById("ohi-pdp-container"), 9762 spinner: document.getElementById("ohi-spinner"), 9763 msgContainer: document.getElementById("ohi-message"), 9764 toggleBtn: document.getElementById("ohi-toggle"), 9765 inputContainer: document.getElementById("ohi-inputContainer"), 9766 input: document.getElementById("ohi-input"), 9767 submitBtn: document.getElementById("ohi-submit"), 9768 messages: {
9769 next_day_availability_message: "Get it tomorrow with next day delivery to [zip], [city].", 9770 not_available_delivery_message: "Same day delivery is unavailable in [zip], [city]. Try entering another zip code or enjoy free shipping on orders over $50!", 9771 rush_availability_message: "Get it today with 2 hour delivery to [zip], [city].", 9772 same_day_availability_message: "Same day delivery available in [zip].", 9773 two_day_availability_message: "Two day delivery available in [zip].", 9774 error_out_message: "Same day delivery is unavailable in your area. Try entering another zip code or enjoy free shipping on orders over $50!", 9775 online_only_message: "Exclusively available online. Enjoy free shipping on orders over $50!" 9776 } 9777 }; 9778 } 9779 _createClass(OhiWidget, [{ 9780 key: "_clearError", 9781 value: function _clearError() { 9782 var _this$state3 = this.state, 9783 input = _this$state3.input, 9784 handle = _this$state3.handle; 9785 this.state.hasError = false; 9786 input.classList.remove("input--error"); 9787 $("#ohi-error-".concat(handle)).html(""); 9788 } 9789 }, { 9790 key: "_createMessage", 9791 value: function _createMessage(data) { 9792 var template = data.bestAvailability.template; 9793 var _data$placeholders = data.placeholders, 9794 city = _data$placeholders.city, 9795 zip = _data$placeholders.zip; 9796 this.state.zipCode = zip; 9797 var ohi_msg = this.state.messages["".concat(template)].replace("[zip]", zip).replace("[productname]", this.state.title).replace(/[\])}[{(]/g, ""); 9798 9799 // if the city is undefined remove that area of string and previous comma. 9800 ohi_msg = city == undefined ? ohi_msg.replace(", city", "") : ohi_msg.replace("city", city); 9801 this._renderMessage(ohi_msg); 9802 } 9803 }, { 9804 key: "_displaySpinner", 9805 value: function _displaySpinner(status) { 9806 this.state.msgContainer.style.opacity = status ? "0" : "1"; 9807 this.state.spinner.style.opacity = status ? "1" : "0"; 9808 } 9809 }, { 9810 key: "_refreshOhiApi", 9811 value: function _refreshOhiApi() { 9812 return window.OHIWIDGET.render(); 9813 } 9814 }, { 9815 key: "_fetchApi", 9816 value: function () { 9817 var _fetchApi2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(inputValue) { 9818 var sku, result; 9819 return _regeneratorRuntime().wrap(function _callee$(_context) { 9820 while (1) switch (_context.prev = _context.next) { 9821 case 0: 9822 sku = this.state.sku; 9823 this._displaySpinner(true); 9824 window.OHIWIDGET.setParams({ 9825 zip: inputValue, 9826 sku: sku, 9827 productname: this.state.title, 9828 is_testing: true 9829 }); 9830 _context.next = 5; 9831 return this._refreshOhiApi(); 9832 case 5: 9833 result = _context.sent; 9834 if (!(window.OHIWIDGET.config == undefined)) { 9835 _context.next = 9; 9836 break; 9837 } 9838 this._disableControls(); 9839 return _context.abrupt("return"); 9840 case 9: 9841 this._createMessage(window.OHIWIDGET); 9842 case 10: 9843 case "end": 9844 return _context.stop(); 9845 } 9846 }, _callee, this); 9847 })); 9848 function _fetchApi(_x) { 9849 return _fetchApi2.apply(this, arguments); 9850 } 9851 return _fetchApi; 9852 }() 9853 }, { 9854 key: "_getBestAvailability", 9855 value: function _getBestAvailability() { 9856 var order_of_times = ["rush", "same_day", "next_day", "two_day"]; 9857 var best_available = false; 9858 for (var i = 0; i < order_of_times.length; i++) { 9859 var type = order_of_times[i]; 9860 if (window.OHIWIDGET.config.availability["".concat(type)] == true) { 9861 best_available = "".concat(type, "_availability_message"); 9862 break; 9863 } 9864 } 9865 return best_available; 9866 } 9867 }, { 9868 key: "_renderMessage", 9869 value: function _renderMessage(msg) { 9870 var _this2 = this; 9871 this._fadeIn(); 9872 setTimeout(function () { 9873 _this2.state.toggleBtn.style.opacity = "1"; 9874 _this2._displaySpinner(false); 9875 _this2.state.msgContainer.innerHTML = msg; 9876 }, 500); 9877 } 9878 }, { 9879 key: "_buildControls", 9880 value: function _buildControls() { 9881 var _this3 = this; 9882 this.state.toggleBtn.addEventListener("click", this._handleToggle, true); 9883 this.state.submitBtn.addEventListener("click", this._handleSubmit, true); 9884 this.state.input.addEventListener("keyup", function (event) { 9885 if (event.key === "Enter") { 9886 _this3._handleSubmit(); 9887 } 9888 }); 9889 } 9890 }, { 9891 key: "_disableControls", 9892 value: function _disableControls() { 9893 this._renderMessage(this.state.messages.online_only_message); 9894 this.state.isDisabled = true; 9895 this.state.inputContainer.style.display = "none"; 9896 this.state.inputContainer.setAttribute("aria-hidden", true); 9897 this.state.toggleBtn.style.display = "none"; 9898 this.state.inputContainer.setAttribute("aria-hidden", true); 9899 this._displaySpinner(false); 9900 this.state.toggleBtn.previousElementSibling.style.maxWidth = "100%"; 9901 } 9902 }, { 9903 key: "_fadeIn", 9904 value: function _fadeIn() { 9905 this.state.widget.style.height = "auto"; 9906 this.state.widget.style.opacity = "1"; 9907 } 9908 }, { 9909 key: "_build", 9910 value: function _build() { 9911 var _this4 = this; 9912 var ticks = 0; 9913 if (this.state.inputContainer == null) { 9914 return false;
9915 } 9916 var refreshInterval = setInterval(function () { 9917 if (window.OHIWIDGET != undefined && window.OHIWIDGET.hasOwnProperty("placeholders")) { 9918 clearInterval(refreshInterval); 9919 if (window.OHIWIDGET.config == undefined) { 9920 _this4._disableControls(); 9921 } else { 9922 _this4._buildControls(_this4.state.handle); 9923 _this4._createMessage(window.OHIWIDGET); 9924 } 9925 } else { 9926 ticks++; 9927 } 9928 if (ticks == 8) { 9929 clearInterval(refreshInterval); 9930 _this4._buildControls(); 9931 _this4._renderMessage(_this4.state.messages.error_out_message); 9932 console.error("Ohi API Unresponsive."); 9933 } 9934 }, 800); 9935 } 9936 }, { 9937 key: "_init", 9938 value: function _init(data) { 9939 var _this5 = this; 9940 if (this.state.inputContainer == null) { 9941 return; 9942 } 9943 setTimeout(function () { 9944 _this5._displaySpinner(true); 9945 _this5._buildControls(); 9946 if (data.config == undefined) { 9947 _this5._disableControls(); 9948 return; 9949 } 9950 _this5._createMessage(data); 9951 }, 500); 9952 } 9953 }]); 9954 return OhiWidget; 9955}(); 9956 9957/***/ }), 9958
vendor: 5,709 bytes, lines 9959-9975
9959/***/ "./src/scripts/pdp/productGallery.js": 9960/*!*******************************************!*\ 9961 !*** ./src/scripts/pdp/productGallery.js ***! 9962 \*******************************************/ 9963/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 9964 9965"use strict"; 9966__webpack_require__.r(__webpack_exports__); 9967/* harmony export */ __webpack_require__.d(__webpack_exports__, { 9968/* harmony export */ "ProductGallery": () => (/* binding */ ProductGallery) 9969/* harmony export */ }); 9970/* harmony import */ var keen_slider_keen_slider_min_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider/keen-slider.min.css */ "./node_modules/keen-slider/keen-slider.min.css"); 9971/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 9972/* harmony import */ var imagesloaded__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! imagesloaded */ "./node_modules/imagesloaded/imagesloaded.js"); 9973/* harmony import */ var imagesloaded__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(imagesloaded__WEBPACK_IMPORTED_MODULE_2__); 9974function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 9975function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context);
vendor: 9,627 bytes, lines 9975-9982
9975 if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } 9976function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } 9977function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } 9978function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 9979function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 9980function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 9981function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 9982function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string");
9982 return _typeof(key) === "symbol" ? key : String(key); } 9983function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 9984 9985 9986 9987 9988/** 9989 Represents a product image gallery. 9990 @property {boolean} slider - The slider instance of KeenSlider. 9991 @property {number} breakpoint - The breakpoint where the slider will be created. 9992 @property {number} activeIdx - The index of the active slide. 9993 @property {HTMLElement} container - The container element that holds the slides. 9994 @property {NodeListOf<HTMLElement>} slides - The slides of the gallery. 9995*/ 9996var ProductGallery = /*#__PURE__*/_createClass(function ProductGallery() { 9997 var _this = this; 9998 _classCallCheck(this, ProductGallery); 9999 /** 10000 Builds a new instance of the KeenSlider and assigns it to the slider property of the ProductGallery instance. 10001 */ 10002 _defineProperty(this, "_build", function () { 10003 _this.slider = new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](_this.container, { 10004 selector: _this.slides, 10005 mode: "free-snap", 10006 slides: { 10007 perView: "auto", 10008 spacing: 0 10009 }, 10010 destroyed: function () { 10011 var _destroyed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { 10012 var slides; 10013 return _regeneratorRuntime().wrap(function _callee$(_context) { 10014 while (1) switch (_context.prev = _context.next) { 10015 case 0: 10016 _this.slider = false;
10017 _context.next = 3; 10018 return _this._resetAllSlides(); 10019 case 3: 10020 slides = _context.sent; 10021 return _context.abrupt("return", slides); 10022 case 5: 10023 case "end": 10024 return _context.stop(); 10025 } 10026 }, _callee); 10027 })); 10028 function destroyed() { 10029 return _destroyed.apply(this, arguments); 10030 } 10031 return destroyed; 10032 }(), 10033 slideChanged: function slideChanged(slider) { 10034 _this._updateSlider(slider); 10035 } 10036 }); 10037 }); 10038 /** 10039 Loads videos and reveals them after images are loaded. 10040 */ 10041 _defineProperty(this, "_loadVideos", function () { 10042 var videos = _this.container.querySelectorAll(".product-gallery__video"); 10043 10044 // reveal videos after images are loaded 10045 videos.forEach(function (el) { 10046 el.style.opacity = 1; 10047 }); 10048 }); 10049 /** 10050 Updates the slider by changing the aria-hidden attribute of the old and new slides 10051 and updating the activeIdx with the new index of the slide. 10052 @param {object} slider - The KeenSlider instance. 10053 */ 10054 _defineProperty(this, "_updateSlider", function (slider) { 10055 var oldIdx = _this.activeIdx; 10056 var newIdx = slider.track.details.rel; 10057 _this.slides[oldIdx].setAttribute("aria-hidden", true); 10058 _this.slides[newIdx].setAttribute("aria-hidden", false); 10059 _this.activeIdx = slider.track.details.rel; 10060 }); 10061 /** 10062 * Resets all the slides by setting 'aria-hidden' to false 10063 @param {HTMLElement} el - The element to be reset. Default is 'this.slides' 10064 @returns {NodeListOf<HTMLElement>} - Returns a node list of all the slides 10065 */ 10066 _defineProperty(this, "_resetAllSlides", function (el) { 10067 _this.slides.forEach(function (slide) { 10068 slide.setAttribute("aria-hidden", false); 10069 }); 10070 return _this.slides; 10071 }); 10072 /** 10073 Sets the 'aria-hidden' and 'aria-label' attributes on all slides, and calls the '_build' function 10074 */ 10075 _defineProperty(this, "_setAttributes", function () { 10076 _this.slides.forEach(function (slide, index) { 10077 var isHidden = index !== _this.activeIdx; 10078 slide.setAttribute("aria-hidden", isHidden); 10079 slide.setAttribute("aria-label", "slide ".concat(index + 1, " of ").concat(_this.slides.length - 1)); 10080 }); 10081 _this._build(); 10082 }); 10083 /** 10084 Creates a new KeenSlider instance and sets the attributes using the '_setAttributes' function 10085 */ 10086 _defineProperty(this, "_createSlider", function () { 10087 $(_this.container).imagesLoaded(function () { 10088 _this._setAttributes(); 10089 }); 10090 }); 10091 /** 10092 Sets up the event listener for window resizing and handles slider creation and destruction based on breakpoint. 10093 */ 10094 _defineProperty(this, "_setResize", function () { 10095 var resizeId; 10096 var windowWidth = window.innerWidth; 10097 window.addEventListener("resize", function () { 10098 clearTimeout(resizeId); 10099 resizeId = setTimeout(resizedEnded, 500); 10100 }); 10101 10102 /** 10103 Called when the window has finished resizing. 10104 Destroys or creates slider based on window width. 10105 */ 10106 var resizedEnded = /*#__PURE__*/function () { 10107 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { 10108 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 10109 while (1) switch (_context2.prev = _context2.next) { 10110 case 0: 10111 if (!(window.innerWidth < _this.breakpoint && window.innerWidth !== windowWidth)) { 10112 _context2.next = 6; 10113 break; 10114 } 10115 windowWidth = window.innerWidth; 10116 if (!_this.slider) { 10117 _context2.next = 5; 10118 break; 10119 } 10120 _context2.next = 5; 10121 return _this.slider.destroy(); 10122 case 5: 10123 return _context2.abrupt("return"); 10124 case 6: 10125 if (!(window.innerWidth > _this.breakpoint && _this.slider)) { 10126 _context2.next = 9; 10127 break; 10128 } 10129 _this.slider.destroy(); 10130 return _context2.abrupt("return"); 10131 case 9: 10132 if (window.innerWidth < _this.breakpoint && !_this.slider) { 10133 _this._createSlider(); 10134 } 10135 case 10: 10136 case "end": 10137 return _context2.stop(); 10138 } 10139 }, _callee2); 10140 })); 10141 return function resizedEnded() { 10142 return _ref.apply(this, arguments); 10143 }; 10144 }(); 10145 }); 10146 /** 10147 Initializes the product gallery by loading videos, creating a slider if necessary based on screen size and number of slides, and setting up resize event listener 10148 */ 10149 _defineProperty(this, "_init", function () { 10150 _this._loadVideos(); 10151 if (window.innerWidth < _this.breakpoint && _this.slides.length > 1) { 10152 _this._createSlider(); 10153 } 10154 _this._setResize(); 10155 }); 10156 this.slider = false;
10157 this.breakpoint = 1024; 10158 this.activeIdx = 0; 10159 this.container = document.querySelector("product-gallery"); 10160 this.slides = document.querySelectorAll("product-gallery-slide"); 10161}); 10162 10163/***/ }), 10164
10165/***/ "./src/scripts/pdp/quantitySelector.js": 10166/*!*********************************************!*\ 10167 !*** ./src/scripts/pdp/quantitySelector.js ***! 10168 \*********************************************/ 10169/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10170 10171"use strict"; 10172__webpack_require__.r(__webpack_exports__); 10173/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10174/* harmony export */ "QuantitySelector": () => (/* binding */ QuantitySelector) 10175/* harmony export */ }); 10176function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 10177function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 10178function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 10179function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10180function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } 10181function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 10182function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 10183var QuantitySelector = /*#__PURE__*/_createClass(function QuantitySelector() { 10184 var _this = this; 10185 _classCallCheck(this, QuantitySelector); 10186 _defineProperty(this, "_increase", function () { 10187 if (_this.total < 99) { 10188 _this.total = _this.total + 1; 10189 _this.value_display.value = _this.total; 10190 } 10191 }); 10192 _defineProperty(this, "_decrease", function () { 10193 if (_this.total > 1) { 10194 _this.total = _this.total - 1; 10195 _this.value_display.value = _this.total; 10196 _this.value_display.setAttribute("aria-valuenow", _this.total); 10197 } 10198 }); 10199 _defineProperty(this, "_init", function () { 10200 if (_this.value_display !== undefined) { 10201 _this.controls.add.addEventListener("click", _this._increase); 10202 _this.controls.subtract.addEventListener("click", _this._decrease); 10203 } 10204 }); 10205 this.total = 1; 10206 this.value_display = document.getElementById("quantity-selector-value"); 10207 this.controls = { 10208 add: document.getElementById("quantity-selector-add"), 10209 subtract: document.getElementById("quantity-selector-subtract") 10210 }; 10211}); 10212 10213/***/ }), 10214
vendor: 4,124 bytes, lines 10215-10237
10215/***/ "./src/scripts/pdp/variant-radios.js": 10216/*!*******************************************!*\ 10217 !*** ./src/scripts/pdp/variant-radios.js ***! 10218 \*******************************************/ 10219/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10220 10221"use strict"; 10222__webpack_require__.r(__webpack_exports__); 10223/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10224/* harmony export */ "VariantRadios": () => (/* binding */ VariantRadios) 10225/* harmony export */ }); 10226/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 10227function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 10228function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10229function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 10230function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 10231function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 10232function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 10233function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 10234function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 10235function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 10236function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 10237function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); }
10237 Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 10238function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 10239function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 10240function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 10241function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 10242function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 10243 10244var VariantRadios = /*#__PURE__*/function (_HTMLElement) { 10245 _inherits(VariantRadios, _HTMLElement); 10246 var _super = _createSuper(VariantRadios); 10247 function VariantRadios() { 10248 var _this; 10249 _classCallCheck(this, VariantRadios); 10250 _this = _super.call(this); 10251 _this.addEventListener('change', _this.onVariantChange); 10252 _this._onPopState = _this.onPopState.bind(_assertThisInitialized(_this)); 10253 _this.productForm = document.getElementById('oli-product-form'); 10254 return _this; 10255 } 10256 _createClass(VariantRadios, [{ 10257 key: "connectedCallback", 10258 value: function connectedCallback() { 10259 window.addEventListener('popstate', this._onPopState); 10260 } 10261 }, { 10262 key: "disconnectedCallback", 10263 value: function disconnectedCallback() { 10264 window.removeEventListener('popstate', this._onPopState); 10265 } 10266 10267 /** 10268 * When the URL changes via browser back/forward (same product path, different ?variant=), 10269 * Barba intentionally skips a full page swap; re-fetch partial PDP markup from the URL. 10270 */ 10271 }, { 10272 key: "onPopState", 10273 value: function onPopState() { 10274 if (this.dataset.updateUrl === 'false') { 10275 return; 10276 } 10277 try { 10278 var loc = new URL(window.location.href); 10279 var productPath = new URL(this.dataset.url, window.location.href).pathname; 10280 if (loc.pathname !== productPath) { 10281 return; 10282 } 10283 var variantParam = loc.searchParams.get('variant'); 10284 if (!variantParam) { 10285 return; 10286 } 10287 var variantId = Number.parseInt(variantParam, 10); 10288 var variant = this.getVariantData().find(function (v) { 10289 return v.id === variantId; 10290 }); 10291 if (!variant) { 10292 return; 10293 } 10294 var fieldsets = Array.from(this.querySelectorAll('fieldset')); 10295 variant.options.forEach(function (value, index) { 10296 var fieldset = fieldsets[index]; 10297 if (!fieldset) { 10298 return; 10299 } 10300 var radios = Array.from(fieldset.querySelectorAll('input[type="radio"]')); 10301 var match = radios.find(function (inp) { 10302 return inp.value === value && !inp.disabled; 10303 }) || radios.find(function (inp) { 10304 return inp.value === value; 10305 }); 10306 if (match && !match.checked) { 10307 match.checked = true; 10308 } 10309 }); 10310 this.currentVariant = variant; 10311 this.updateOptions(); 10312 this.updatePackLegendValue(); 10313 this.renderProductInfo(); 10314 } catch (_unused) { 10315 /* ignore */ 10316 } 10317 } 10318 }, { 10319 key: "onVariantChange", 10320 value: function onVariantChange() { 10321 this.updateOptions(); 10322 this.updateMasterId(); 10323 this.updatePackLegendValue(); 10324 if (!this.currentVariant) { 10325 this.setUnavailable(); 10326 } else { 10327 this.updateURL(); 10328 this.renderProductInfo(); 10329 } 10330 } 10331 10332 /** 10333 * Keeps the inline "Pack: â¦" label in sync with the selected size option. 10334 */ 10335 }, { 10336 key: "updatePackLegendValue", 10337 value: function updatePackLegendValue() { 10338 var fieldset = this.querySelector('.product-form__fieldset--size') || this.querySelector('.product-form__fieldset--pack-option'); 10339 var checkedInput = fieldset === null || fieldset === void 0 ? void 0 : fieldset.querySelector('input[type="radio"]:checked'); 10340 if (!checkedInput) return; 10341 var legendValue = fieldset.querySelector('[data-pack-legend-value]'); 10342 if (legendValue) { 10343 legendValue.textContent = checkedInput.value; 10344 } 10345 var varietyPackLegend = document.querySelector('[data-variety-pack-legend-value]');
10346 if (varietyPackLegend) { 10347 var prefix = checkedInput.value.trim().split(/\s+/)[0] || checkedInput.value.trim(); 10348 varietyPackLegend.textContent = prefix ? "".concat(prefix, " pack") : checkedInput.value; 10349 } 10350 } 10351 }, { 10352 key: "updateOptions", 10353 value: function updateOptions() { 10354 var fieldsets = Array.from(this.querySelectorAll('fieldset')); 10355 this.options = fieldsets.map(function (fieldset) { 10356 return Array.from(fieldset.querySelectorAll('input')).find(function (radio) { 10357 return radio.checked; 10358 }).value; 10359 }); 10360 } 10361 }, { 10362 key: "updateMasterId", 10363 value: function updateMasterId() { 10364 var _this2 = this; 10365 this.currentVariant = this.getVariantData().find(function (variant) { 10366 return !variant.options.map(function (option, index) { 10367 return _this2.options[index] === option; 10368 }).includes(false); 10369 }); 10370 } 10371 }, { 10372 key: "updateURL", 10373 value: function updateURL() { 10374 if (!this.currentVariant || this.dataset.updateUrl === 'false') return; 10375 window.history.replaceState({}, '', "".concat(this.dataset.url, "?variant=").concat(this.currentVariant.id)); 10376 } 10377 }, { 10378 key: "renderProductInfo", 10379 value: function renderProductInfo() { 10380 var _this3 = this; 10381 fetch("".concat(this.dataset.url, "?variant=").concat(this.currentVariant.id)).then(function (response) { 10382 return response.text(); 10383 }).then(function (responseText) { 10384 var _document$querySelect, _html$querySelector; 10385 var html = new DOMParser().parseFromString(responseText, 'text/html'); 10386 var changeSelectors = ["#product-form-retailers-check", "#product-featured-image-oli-product-gallery", "#product-ingredients-section", "#product-size-description", "#product-selling-plan-selector", "[data-submit-button-text]", "#product-form-retailers", "#product-form-beam-widget"]; 10387 changeSelectors.forEach(function (selector) { 10388 var destination = document.querySelector(selector); 10389 var source = html.querySelector(selector); 10390 if (destination && source) { 10391 if (selector === '#product-selling-plan-selector') { 10392 destination.outerHTML = source.outerHTML; 10393 } else { 10394 destination.innerHTML = source.innerHTML; 10395 } 10396 } 10397 }); 10398 var fsSourcesDest = document.querySelector('[data-product-gallery-fs-sources]'); 10399 var fsSourcesSrc = html.querySelector('[data-product-gallery-fs-sources]'); 10400 if (fsSourcesDest && fsSourcesSrc) { 10401 fsSourcesDest.textContent = fsSourcesSrc.textContent; 10402 } 10403 (_document$querySelect = document.querySelector('.keen-slider-container')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.dispatchEvent(new CustomEvent('oli:product-gallery-fs-sources-updated')); 10404 _this3.reinitializeSellingPlan(); 10405 var accordions = document.querySelectorAll('accordion-group'); 10406 if (accordions.length) { 10407 accordions.forEach(function (accordion) { 10408 // eslint-disable-next-line no-new 10409 new _global__WEBPACK_IMPORTED_MODULE_0__.Accordion(accordion); 10410 }); 10411 } 10412 10413 // check if it retailer variant 10414 var retailerVariantInput = document.querySelector('#product-form-retailers-input'); 10415 if (retailerVariantInput) { 10416 var _document$querySelect2, _document$querySelect3; 10417 (_document$querySelect2 = document.querySelector('#product-form-content')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.classList.add('hide'); 10418 (_document$querySelect3 = document.querySelector('[data-sticky-add-to-cart]')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.classList.add('hide'); 10419 document.body.classList.add('is-retailer-variant'); 10420 } else { 10421 var _document$querySelect4, _document$querySelect5; 10422 (_document$querySelect4 = document.querySelector('#product-form-content:not(.hide-dtc)')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.classList.remove('hide'); 10423 (_document$querySelect5 = document.querySelector('[data-sticky-add-to-cart]')) === null || _document$querySelect5 === void 0 ? void 0 : _document$querySelect5.classList.remove('hide'); 10424 document.body.classList.remove('is-retailer-variant'); 10425 } 10426 var stickyMarkup = (_html$querySelector = html.querySelector('[data-sticky-add-to-cart]')) === null || _html$querySelector === void 0 ? void 0 : _html$querySelector.outerHTML; 10427 if (stickyMarkup) { 10428 window.dispatchEvent(new CustomEvent('oli:sticky-add-to-cart:update', { 10429 detail: { 10430 markup: stickyMarkup 10431 } 10432 })); 10433 } 10434 }); 10435 } 10436 }, { 10437 key: "reinitializeSellingPlan", 10438 value: function reinitializeSellingPlan() { 10439 var subscriptionRoot = document.querySelector('[id^="rtx_widget_injection_parent_"][data-product-id]'); 10440 if (!subscriptionRoot) return; 10441 if (window.setSellingPlan && subscriptionRoot.dataset.productId) { 10442 var productId = subscriptionRoot.dataset.productId; 10443 window.setSellingPlan(productId, true); 10444 requestAnimationFrame(function () { 10445 window.setSellingPlan(productId, true); 10446 requestAnimationFrame(function () { 10447 window.setSellingPlan(productId, true); 10448 }); 10449 }); 10450 window.setTimeout(function () { 10451 window.setSellingPlan(productId, true); 10452 }, 120); 10453 } 10454 } 10455 }, { 10456 key: "setUnavailable", 10457 value: function setUnavailable() { 10458 var addButton = this.productForm.querySelector('[name="add"]'); 10459 var addButtonText = this.productForm.querySelector('[name="add"] > span'); 10460 if (!addButton) return; 10461 addButton.setAttribute('disabled', 'disabled'); 10462 addButtonText.textContent = theme.strings.unavailable; 10463 } 10464 }, { 10465 key: "getVariantData", 10466 value: function getVariantData() { 10467 this.variantData = this.variantData || JSON.parse(this.querySelector('[type="application/json"]').textContent); 10468 return this.variantData; 10469 } 10470 }]); 10471 return VariantRadios; 10472}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); 10473document.addEventListener('DOMContentLoaded', function () { 10474 if (!customElements.get('variant-radios')) { 10475 customElements.define('variant-radios', VariantRadios); 10476 } 10477}); 10478 10479/***/ }), 10480
10481/***/ "./src/scripts/sections/featured-blog.js": 10482/*!***********************************************!*\ 10483 !*** ./src/scripts/sections/featured-blog.js ***! 10484 \***********************************************/ 10485/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10486 10487"use strict"; 10488__webpack_require__.r(__webpack_exports__); 10489/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10490/* harmony export */ "buildFeaturedBlogSection": () => (/* binding */ buildFeaturedBlogSection) 10491/* harmony export */ }); 10492/* harmony import */ var _keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keen-slider-navigation-plugin */ "./src/scripts/sections/keen-slider-navigation-plugin.js"); 10493/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 10494/* eslint-disable no-new */ 10495 10496 10497 10498// todo: legacy code - rewrite to use global slider 10499 10500var buildFeaturedBlogSection = function buildFeaturedBlogSection() { 10501 document.querySelectorAll("[js-featured-blog-slider]").forEach(function (sliderWrapper) { 10502 var keenSliderEl = sliderWrapper.querySelector(".keen-slider"); 10503 var dots = sliderWrapper.querySelector("[data-dots]"); 10504 if (!keenSliderEl) return; 10505 new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](keenSliderEl, { 10506 breakpoints: { 10507 "(min-width: 750px)": { 10508 slides: { 10509 perView: 2, 10510 spacing: 15 10511 } 10512 } 10513 }, 10514 slides: { 10515 origin: "center", 10516 perView: 1, 10517 spacing: 15 10518 } 10519 }, [(0,_keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__.KeenSliderNavigation)({ 10520 arrows: false, 10521 dots: dots, 10522 wrapper: sliderWrapper.querySelector(".keen-slider__navigation-wrapper") 10523 })]); 10524 }); 10525}; 10526 10527/***/ }), 10528
10529/***/ "./src/scripts/sections/flavours-slider.js": 10530/*!*************************************************!*\ 10531 !*** ./src/scripts/sections/flavours-slider.js ***! 10532 \*************************************************/ 10533/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10534 10535"use strict"; 10536__webpack_require__.r(__webpack_exports__); 10537/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10538/* harmony export */ "buildFlavorsSlider": () => (/* binding */ buildFlavorsSlider) 10539/* harmony export */ }); 10540/* harmony import */ var _keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keen-slider-navigation-plugin */ "./src/scripts/sections/keen-slider-navigation-plugin.js"); 10541/* harmony import */ var _keen_slider_keyboard_navigation_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keen-slider-keyboard-navigation-plugin */ "./src/scripts/sections/keen-slider-keyboard-navigation-plugin.js"); 10542/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 10543function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 10544/* eslint-disable no-new */ 10545 10546 10547 10548// todo: legacy code - rewrite to use global slider 10549 10550var TOGGLE_OVERFLOW_CLASS = "toggle-flavours-slider--static"; 10551 10552/** Collections toggle sliders only: turns off drag/loop when slides fit without horizontal overflow. */ 10553function toggleFlavoursOverflowPlugin(slider) { 10554 function measureOverflow() { 10555 if (!slider.container.offsetParent) { 10556 return null; 10557 } 10558 var slides = slider.slides; 10559 if (!slides.length) { 10560 return false; 10561 } 10562 var so = slider.options.slides; 10563 var spacing = _typeof(so) === "object" && so !== null && typeof so.spacing === "number" ? so.spacing : 0; 10564 var totalWidth = slides.reduce(function (sum, el, i) { 10565 return sum + el.getBoundingClientRect().width + (i < slides.length - 1 ? spacing : 0); 10566 }, 0); 10567 return totalWidth > slider.size + 0.5; 10568 } 10569 function syncFlavoursOverflow() { 10570 var overflow = measureOverflow(); 10571 if (overflow === null) { 10572 return; 10573 } 10574 slider.container.classList.toggle(TOGGLE_OVERFLOW_CLASS, !overflow); 10575 var patch = overflow ? { 10576 drag: true, 10577 loop: true, 10578 rubberband: true 10579 } : { 10580 drag: false, 10581 loop: false, 10582 rubberband: false 10583 }; 10584 if (slider.options.drag === patch.drag && slider.options.loop === patch.loop && slider.options.rubberband === patch.rubberband) { 10585 return; 10586 } 10587 slider.update(patch); 10588 } 10589 slider.on("created", syncFlavoursOverflow); 10590 slider.on("updated", syncFlavoursOverflow); 10591 slider.on("optionsChanged", syncFlavoursOverflow); 10592 slider.syncFlavoursOverflow = syncFlavoursOverflow; 10593} 10594var buildFlavorsSlider = function buildFlavorsSlider() { 10595 var newOptions = { 10596 mode: "free-snap", 10597 loop: true, 10598 slides: { 10599 origin: "center", 10600 perView: "auto", 10601 spacing: 12 10602 }, 10603 breakpoints: { 10604 "(min-width: 768px)": { 10605 mode: "free-snap", 10606 loop: true, 10607 slides: { 10608 origin: "center", 10609 perView: "auto", 10610 spacing: 20 10611 } 10612 } 10613 } 10614 }; 10615 var defaultOptions = { 10616 mode: "free-snap", 10617 loop: true, 10618 slides: { 10619 origin: "center", 10620 perView: "auto", 10621 spacing: 50 10622 } 10623 }; 10624 document.querySelectorAll("[js-flavours-slider]").forEach(function (sliderEl) { 10625 var newSlider = sliderEl.getAttribute("data-collection"); 10626 var plugins = [(0,_keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__.KeenSliderNavigation)({ 10627 arrows: true, 10628 dots: false 10629 }), _keen_slider_keyboard_navigation_plugin__WEBPACK_IMPORTED_MODULE_1__.KeenSliderKeyboardNavigation]; 10630 if (sliderEl.classList.contains("toggle-flavours-slider")) { 10631 plugins.push(toggleFlavoursOverflowPlugin); 10632 } 10633 var instance = new keen_slider__WEBPACK_IMPORTED_MODULE_2__["default"](sliderEl, newSlider ? newOptions : defaultOptions, plugins); 10634 sliderEl._keenFlavoursSlider = instance; 10635 }); 10636}; 10637 10638/***/ }), 10639
10640/***/ "./src/scripts/sections/full-width-image-text.js": 10641/*!*******************************************************!*\ 10642 !*** ./src/scripts/sections/full-width-image-text.js ***! 10643 \*******************************************************/ 10644/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10645 10646"use strict"; 10647__webpack_require__.r(__webpack_exports__); 10648/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10649/* harmony export */ "buildFullWidthImageText": () => (/* binding */ buildFullWidthImageText) 10650/* harmony export */ }); 10651/** 10652 Builds a full width image text section that includes an SVG badge. 10653*/ 10654 10655var buildFullWidthImageText = function buildFullWidthImageText() { 10656 var elements = document.querySelectorAll("[js-full-width-image-text]"); 10657 elements.forEach(function (element) { 10658 var svgBadge = element.querySelector(".svg_badge"); 10659 if (!svgBadge || svgBadge.length == 0) { 10660 return; 10661 } 10662 var animated = false; 10663 window.addEventListener("scroll", function () { 10664 var top_of_element = element.getBoundingClientRect().top + window.pageYOffset; 10665 var top_of_screen = window.pageYOffset; 10666 if (!animated && top_of_screen + window.innerHeight / 3 > top_of_element) { 10667 animated = true; 10668 svgBadge.classList.add("animate__bounceIn"); 10669 } 10670 }); 10671 }); 10672}; 10673 10674/***/ }), 10675
10676/***/ "./src/scripts/sections/index.js": 10677/*!***************************************!*\ 10678 !*** ./src/scripts/sections/index.js ***! 10679 \***************************************/ 10680/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10681 10682"use strict"; 10683__webpack_require__.r(__webpack_exports__); 10684/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10685/* harmony export */ "buildFeaturedBlogSection": () => (/* reexport safe */ _featured_blog__WEBPACK_IMPORTED_MODULE_0__.buildFeaturedBlogSection), 10686/* harmony export */ "buildFlavorsSlider": () => (/* reexport safe */ _flavours_slider__WEBPACK_IMPORTED_MODULE_2__.buildFlavorsSlider), 10687/* harmony export */ "buildFullWidthImageText": () => (/* reexport safe */ _full_width_image_text__WEBPACK_IMPORTED_MODULE_3__.buildFullWidthImageText), 10688/* harmony export */ "buildOtherSodaComparison": () => (/* reexport safe */ _other_sodas_comparison__WEBPACK_IMPORTED_MODULE_4__.buildOtherSodaComparison), 10689/* harmony export */ "buildOurStory": () => (/* reexport safe */ _our_story__WEBPACK_IMPORTED_MODULE_5__.buildOurStory), 10690/* harmony export */ "buildPlyrVideo": () => (/* reexport safe */ _plyr_video_init__WEBPACK_IMPORTED_MODULE_6__.buildPlyrVideo), 10691/* harmony export */ "buildPublicationSlider": () => (/* reexport safe */ _publication_slider__WEBPACK_IMPORTED_MODULE_7__.buildPublicationSlider), 10692/* harmony export */ "buildRebuyRecommendations": () => (/* reexport safe */ _rebuy_recommendations__WEBPACK_IMPORTED_MODULE_10__.buildRebuyRecommendations), 10693/* harmony export */ "buildSlider": () => (/* reexport safe */ _slider__WEBPACK_IMPORTED_MODULE_8__.buildSlider), 10694/* harmony export */ "initSliceAnimation": () => (/* reexport safe */ _init_slice_animation__WEBPACK_IMPORTED_MODULE_9__.initSliceAnimation), 10695/* harmony export */ "rebuyUpsellSmartCartSlider": () => (/* reexport safe */ _rebuy_upsell_slider__WEBPACK_IMPORTED_MODULE_1__.rebuyUpsellSmartCartSlider) 10696/* harmony export */ }); 10697/* harmony import */ var _featured_blog__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./featured-blog */ "./src/scripts/sections/featured-blog.js"); 10698/* harmony import */ var _rebuy_upsell_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rebuy-upsell-slider */ "./src/scripts/sections/rebuy-upsell-slider.js"); 10699/* harmony import */ var _flavours_slider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./flavours-slider */ "./src/scripts/sections/flavours-slider.js"); 10700/* harmony import */ var _full_width_image_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./full-width-image-text */ "./src/scripts/sections/full-width-image-text.js"); 10701/* harmony import */ var _other_sodas_comparison__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./other-sodas-comparison */ "./src/scripts/sections/other-sodas-comparison.js"); 10702/* harmony import */ var _our_story__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./our-story */ "./src/scripts/sections/our-story.js"); 10703/* harmony import */ var _plyr_video_init__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./plyr-video-init */ "./src/scripts/sections/plyr-video-init.js"); 10704/* harmony import */ var _publication_slider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./publication-slider */ "./src/scripts/sections/publication-slider.js"); 10705/* harmony import */ var _slider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./slider */ "./src/scripts/sections/slider.js"); 10706/* harmony import */ var _init_slice_animation__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./init-slice-animation */ "./src/scripts/sections/init-slice-animation.js"); 10707/* harmony import */ var _rebuy_recommendations__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./rebuy-recommendations */ "./src/scripts/sections/rebuy-recommendations.js"); 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720/***/ }), 10721
vendor: 4,043 bytes, lines 10722-10743
10722/***/ "./src/scripts/sections/init-slice-animation.js": 10723/*!******************************************************!*\ 10724 !*** ./src/scripts/sections/init-slice-animation.js ***! 10725 \******************************************************/ 10726/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10727 10728"use strict"; 10729__webpack_require__.r(__webpack_exports__); 10730/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10731/* harmony export */ "initSliceAnimation": () => (/* binding */ initSliceAnimation) 10732/* harmony export */ }); 10733function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 10734function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10735function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 10736function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 10737function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 10738function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 10739function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 10740function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 10741function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 10742function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 10743function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); }
10743 Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 10744function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 10745function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 10746function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 10747function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 10748function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 10749var initSliceAnimation = function initSliceAnimation() { 10750 if (!customElements.get('slice-animation')) { 10751 customElements.define('slice-animation', /*#__PURE__*/function (_HTMLElement) { 10752 _inherits(SliceAnimation, _HTMLElement); 10753 var _super = _createSuper(SliceAnimation); 10754 function SliceAnimation() { 10755 var _this; 10756 _classCallCheck(this, SliceAnimation); 10757 _this = _super.call(this); 10758 _this.onScroll = _this.onScroll.bind(_assertThisInitialized(_this)); // Bind `this` to the onScroll function 10759 return _this; 10760 } 10761 _createClass(SliceAnimation, [{ 10762 key: "connectedCallback", 10763 value: function connectedCallback() { 10764 this.checkVisibility(); // Initial check on load 10765 } 10766 }, { 10767 key: "isElementPartiallyInViewport", 10768 value: function isElementPartiallyInViewport(element) { 10769 var rect = element.getBoundingClientRect(); 10770 return rect.top < (window.innerHeight || document.documentElement.clientHeight) && rect.bottom > 0 && rect.left < (window.innerWidth || document.documentElement.clientWidth) && rect.right > 0; 10771 } 10772 }, { 10773 key: "checkVisibility", 10774 value: function checkVisibility() { 10775 if (this.isElementPartiallyInViewport(this)) { 10776 this.style.animationPlayState = 'running'; 10777 // this.querySelector('.animation-element').style.animationPlayState = 'running' 10778 10779 window.removeEventListener('scroll', this.onScroll); 10780 } else { 10781 window.addEventListener('scroll', this.onScroll); 10782 } 10783 } 10784 }, { 10785 key: "onScroll", 10786 value: function onScroll() { 10787 this.checkVisibility(); // Check visibility on each scroll 10788 } 10789 }]); 10790 return SliceAnimation; 10791 }( /*#__PURE__*/_wrapNativeSuper(HTMLElement))); 10792 } 10793}; 10794 10795/***/ }), 10796
10797/***/ "./src/scripts/sections/keen-slider-keyboard-navigation-plugin.js": 10798/*!************************************************************************!*\ 10799 !*** ./src/scripts/sections/keen-slider-keyboard-navigation-plugin.js ***! 10800 \************************************************************************/ 10801/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10802 10803"use strict"; 10804__webpack_require__.r(__webpack_exports__); 10805/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10806/* harmony export */ "KeenSliderKeyboardNavigation": () => (/* binding */ KeenSliderKeyboardNavigation) 10807/* harmony export */ }); 10808function getFocusableElements(container) { 10809 if (!container) return []; 10810 return Array.from(container.querySelectorAll("a[href], button:not([disabled]), input:not([type=hidden]):enabled, select:enabled, textarea:enabled, [tabindex]:not([tabindex^='-'])")).filter(function (el) { 10811 return el.offsetParent !== null; 10812 }); 10813} 10814function getSlides(slider) { 10815 if (Array.isArray(slider.slides) && slider.slides.length) { 10816 return slider.slides; 10817 } 10818 return Array.from(slider.container.querySelectorAll(":scope > .keen-slider__slide")); 10819} 10820function isToggleFlavoursStatic(slider) { 10821 return slider.container.classList.contains("toggle-flavours-slider") && slider.container.classList.contains("toggle-flavours-slider--static"); 10822} 10823 10824/** 10825 * Keyboard support for keen-slider carousels used as product/flavour rows. 10826 * - Tab / Shift+Tab can leave the carousel after the last / before the first focusable. 10827 * - Optional data-collection behavior: advance to next slide only from "add to cart" on multi-card sliders. 10828 */ 10829function KeenSliderKeyboardNavigation(slider) { 10830 /** Timestamp of pointerdown inside this slider; used to skip focus-snapping when a click activates a link/button. */ 10831 var pointerDownAtMs = 0; 10832 var POINTER_FOCUS_ALIGN_MAX_MS = 500; 10833 function onContainerPointerDown() { 10834 pointerDownAtMs = performance.now(); 10835 } 10836 function onSlideKeydown(e) { 10837 var _active$dataset; 10838 if (e.key !== "Tab") return; 10839 var slides = getSlides(slider); 10840 if (!slides.length) return; 10841 var rel = slider.track.details.rel; 10842 var currentSlide = slides[rel]; 10843 if (!currentSlide) return; 10844 var focusables = getFocusableElements(currentSlide); 10845 var active = document.activeElement; 10846 var fi = focusables.indexOf(active); 10847 if (fi === -1) return; 10848 var shiftKey = e.shiftKey; 10849 var newSlider = slider.container.getAttribute("data-collection"); 10850 var lastButtonInsideCard = ((_active$dataset = active.dataset) === null || _active$dataset === void 0 ? void 0 : _active$dataset.action) === "add-variant"; 10851 10852 // Forward: leave carousel after last focusable on last slide (no loop) 10853 if (!shiftKey && rel === slides.length - 1 && fi === focusables.length - 1) { 10854 return; 10855 } 10856 10857 // Backward: leave carousel before first focusable on first slide 10858 if (shiftKey && rel === 0 && fi === 0) { 10859 return; 10860 } 10861 10862 // Shift+Tab: move to previous slide when focus is on first focusable (slide > 0) 10863 if (shiftKey && rel > 0 && fi === 0) { 10864 if (isToggleFlavoursStatic(slider)) return; 10865 if (newSlider && !active.hasAttribute("href")) return; 10866 e.preventDefault(); 10867 slider.prev(); 10868 requestAnimationFrame(function () { 10869 var _prevFocusables; 10870 var idx = slider.track.details.rel; 10871 var prevFocusables = getFocusableElements(slides[idx]); 10872 (_prevFocusables = prevFocusables[prevFocusables.length - 1]) === null || _prevFocusables === void 0 ? void 0 : _prevFocusables.focus(); 10873 }); 10874 return; 10875 } 10876 10877 // Tab: move to next slide when focus is on last focusable (not on last slide) 10878 if (!shiftKey && rel < slides.length - 1 && fi === focusables.length - 1) { 10879 if (isToggleFlavoursStatic(slider)) return; 10880 if (newSlider && !lastButtonInsideCard) return; 10881 e.preventDefault(); 10882 slider.next(); 10883 requestAnimationFrame(function () { 10884 var _nextFocusables$; 10885 var idx = slider.track.details.rel; 10886 var nextFocusables = getFocusableElements(slides[idx]); 10887 (_nextFocusables$ = nextFocusables[0]) === null || _nextFocusables$ === void 0 ? void 0 : _nextFocusables$.focus(); 10888 }); 10889 } 10890 } 10891 10892 /** 10893 * When focus moves to a slide via keyboard (Tab), align the track so that slide is 10894 * centered. DOM tab order can move focus to a neighboring slide without updating the 10895 * slider relative index â moveToIdx fixes that. 10896 *
10897 * Pointer-driven focus (click/tap on a product link) skips moveToIdx so navigation 10898 * happens without sliding the carousel. 10899 */ 10900 function onFocusIn(e) { 10901 var target = e.target; 10902 if (!target || !slider.container.contains(target)) return; 10903 var slide = target.closest(".keen-slider__slide"); 10904 if (!slide || !slider.container.contains(slide)) return; 10905 var slidesNow = getSlides(slider); 10906 var idx = slidesNow.indexOf(slide); 10907 if (idx === -1) return; 10908 if (idx === slider.track.details.rel) return; 10909 if (isToggleFlavoursStatic(slider)) return; 10910 var pointerRecent = pointerDownAtMs > 0 && performance.now() - pointerDownAtMs < POINTER_FOCUS_ALIGN_MAX_MS; 10911 if (pointerRecent) { 10912 pointerDownAtMs = 0; 10913 return; 10914 } 10915 slider.moveToIdx(idx, false, { 10916 duration: 320 10917 }); 10918 } 10919 slider.on("created", function () { 10920 var slides = getSlides(slider); 10921 slides.forEach(function (slide) { 10922 slide.addEventListener("keydown", onSlideKeydown); 10923 }); 10924 slider.container.addEventListener("pointerdown", onContainerPointerDown, true); 10925 slider.container.addEventListener("focusin", onFocusIn); 10926 }); 10927} 10928 10929/***/ }), 10930
10931/***/ "./src/scripts/sections/keen-slider-navigation-plugin.js": 10932/*!***************************************************************!*\ 10933 !*** ./src/scripts/sections/keen-slider-navigation-plugin.js ***! 10934 \***************************************************************/ 10935/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 10936 10937"use strict"; 10938__webpack_require__.r(__webpack_exports__); 10939/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10940/* harmony export */ "KeenSliderNavigation": () => (/* binding */ KeenSliderNavigation) 10941/* harmony export */ }); 10942var KeenSliderNavigation = function KeenSliderNavigation() { 10943 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 10944 return function (slider) { 10945 var wrapper = options.wrapper; 10946 var dots, arrowLeft, arrowRight; 10947 var dragged = false; 10948 function markup(remove) { 10949 wrapperMarkup(remove); 10950 dotMarkup(remove); 10951 arrowMarkup(remove); 10952 } 10953 function removeElement(element) { 10954 element && element.parentNode && element.parentNode.removeChild(element); 10955 } 10956 function createDiv(className) { 10957 var div = document.createElement("div"); 10958 var classNames = className.split(" "); 10959 classNames.forEach(function (name) { 10960 return div.classList.add(name); 10961 }); 10962 return div; 10963 } 10964 function arrowMarkup(remove) { 10965 if (remove) { 10966 var stored = slider._keenNavArrows; 10967 if (stored) { 10968 removeElement(stored.left); 10969 removeElement(stored.right); 10970 delete slider._keenNavArrows; 10971 } else { 10972 removeElement(arrowLeft); 10973 removeElement(arrowRight); 10974 } 10975 arrowLeft = undefined; 10976 arrowRight = undefined; 10977 return; 10978 } 10979 if (!options.arrows) { 10980 return; 10981 } 10982 var root = slider.container; 10983 arrowLeft = root.querySelector(":scope > [data-arrow-left]") || root.querySelector("[data-arrow-left]"); 10984 arrowRight = root.querySelector(":scope > [data-arrow-right]") || root.querySelector("[data-arrow-right]"); 10985 if (!arrowRight || !arrowLeft) { 10986 return; 10987 } 10988 slider._keenNavArrows = { 10989 left: arrowLeft, 10990 right: arrowRight 10991 }; 10992 var onPrev = function onPrev(e) { 10993 e.preventDefault(); 10994 e.stopPropagation(); 10995 slider.prev(); 10996 }; 10997 var onNext = function onNext(e) { 10998 e.preventDefault(); 10999 e.stopPropagation(); 11000 slider.next(); 11001 }; 11002 arrowLeft.addEventListener("click", onPrev); 11003 arrowRight.addEventListener("click", onNext); 11004 } 11005 function wrapperMarkup(remove) { 11006 if (remove) { 11007 var parent = wrapper.parentNode; 11008 while (wrapper.firstChild) parent.insertBefore(wrapper.firstChild, wrapper); 11009 removeElement(wrapper); 11010 return; 11011 } 11012 if (!options.wrapper) { 11013 wrapper = createDiv("keen-slider__navigation-wrapper keen-slider__slide-active-".concat(slider.track.details.rel)); 11014 slider.container.parentNode.appendChild(wrapper); 11015 wrapper.appendChild(slider.container); 11016 } 11017 } 11018 function dotMarkup(remove) { 11019 var _slider$options, _slider$options2, _slider$track, _slider$track$details, _slider$track2, _slider$track2$detail; 11020 if (remove) { 11021 removeElement(dots); 11022 return; 11023 } 11024 if (!options.dots) { 11025 return; 11026 } 11027 var slidesPerView = 1; 11028 if ((_slider$options = slider.options) !== null && _slider$options !== void 0 && _slider$options.slides && (_slider$options2 = slider.options) !== null && _slider$options2 !== void 0 && _slider$options2.slides.perView) { 11029 var _slider$options3; 11030 slidesPerView = (_slider$options3 = slider.options) === null || _slider$options3 === void 0 ? void 0 : _slider$options3.slides.perView; 11031 } 11032 if (((_slider$track = slider.track) === null || _slider$track === void 0 ? void 0 : (_slider$track$details = _slider$track.details) === null || _slider$track$details === void 0 ? void 0 : _slider$track$details.slides.length) <= slidesPerView) { 11033 return; 11034 } 11035 if (!options.dots) return; 11036 var initialButton = options.dots.querySelector("[data-dot-button]"); 11037 options.dots.innerHTML = ""; 11038 (_slider$track2 = slider.track) === null || _slider$track2 === void 0 ? void 0 : (_slider$track2$detail = _slider$track2.details) === null || _slider$track2$detail === void 0 ? void 0 : _slider$track2$detail.slides.forEac
11038h(function (_e, idx) { 11039 var newDot = initialButton === null || initialButton === void 0 ? void 0 : initialButton.cloneNode(true); 11040 var newDotInner = newDot.querySelector('[data-dot]'); 11041 newDot.onclick = function () { 11042 slider.moveToIdx(idx); 11043 }; 11044 // newDot.ariaLabel = `Navigate to slide ${idx + 1}`; 11045 if (newDotInner) newDotInner.ariaLabel = "Navigate to slide ".concat(idx + 1); 11046 options.dots.appendChild(newDot); 11047 }); 11048 options.dots.setAttribute("data-active", "true"); 11049 } 11050 function updateClasses() { 11051 var _slider$track3, _slider$track3$detail, _nav$left, _nav$right; 11052 var slide = (_slider$track3 = slider.track) === null || _slider$track3 === void 0 ? void 0 : (_slider$track3$detail = _slider$track3.details) === null || _slider$track3$detail === void 0 ? void 0 : _slider$track3$detail.rel; 11053 if (isNaN(slide)) return; 11054 var nav = slider._keenNavArrows; 11055 var leftBtn = (_nav$left = nav === null || nav === void 0 ? void 0 : nav.left) !== null && _nav$left !== void 0 ? _nav$left : arrowLeft; 11056 var rightBtn = (_nav$right = nav === null || nav === void 0 ? void 0 : nav.right) !== null && _nav$right !== void 0 ? _nav$right : arrowRight; 11057 if (leftBtn && rightBtn) { 11058 slide === 0 ? leftBtn.classList.add("arrow--disabled") : leftBtn.classList.remove("arrow--disabled"); 11059 slide === slider.track.details.slides.length - 1 ? rightBtn.classList.add("arrow--disabled") : rightBtn.classList.remove("arrow--disabled"); 11060 } 11061 if (options !== null && options !== void 0 && options.arrows) { 11062 var activeCan = slider === null || slider === void 0 ? void 0 : slider.slides[slide]; 11063 slider === null || slider === void 0 ? void 0 : slider.slides.forEach(function (slide) { 11064 slide.ariaCurrent = activeCan === slide; 11065 }); 11066 } 11067 if (options.dots) { 11068 Array.from(options.dots.children).forEach(function (dot, idx) { 11069 var dotEl = dot.querySelector("[data-dot]"); 11070 if (idx === slide) { 11071 dot.classList.add("dot--active"); 11072 // dotEl.ariaSelected = true; 11073 slider.slides[idx].ariaHidden = false; 11074 } else { 11075 dot.classList.remove("dot--active"); 11076 // dotEl.ariaSelected = false; 11077 slider.slides[idx].ariaHidden = true; 11078 } 11079 }); 11080 } 11081 if (wrapper) { 11082 wrapper.className = wrapper.className.replace(/\b(keen-slider__slide-active-[^\s]+)\b/, "keen-slider__slide-active-".concat(slide)); 11083 } 11084 } 11085 slider.on("created", function () { 11086 markup(); 11087 updateClasses(); 11088 }); 11089 slider.on("optionsChanged", function () { 11090 if (!options.arrows) { 11091 markup(true); 11092 markup(); 11093 } 11094 updateClasses(); 11095 }); 11096 slider.on("dragStarted", function () { 11097 dragged = true; 11098 }); 11099 slider.on("dragEnded", function () { 11100 setTimeout(function () { 11101 var active = document.activeElement; 11102 if (active && slider.slides.includes(active)) { 11103 active.blur(); 11104 } 11105 dragged = false; 11106 }, 700); 11107 }); 11108 slider.on("slideChanged", function () { 11109 updateClasses(); 11110 var activeSlide = slider.slides[slider.track.details.rel]; 11111 activeSlide.setAttribute("tabindex", "-1"); 11112 if (dragged) { 11113 if (document.activeElement === activeSlide) { 11114 activeSlide.blur(); 11115 } 11116 return; 11117 } 11118 activeSlide.focus(); 11119 }); 11120 slider.on("destroyed", function () { 11121 markup(true); 11122 }); 11123 }; 11124}; 11125 11126/***/ }), 11127
11128/***/ "./src/scripts/sections/other-sodas-comparison.js": 11129/*!********************************************************!*\ 11130 !*** ./src/scripts/sections/other-sodas-comparison.js ***! 11131 \********************************************************/ 11132/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11133 11134"use strict"; 11135__webpack_require__.r(__webpack_exports__); 11136/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11137/* harmony export */ "buildOtherSodaComparison": () => (/* binding */ buildOtherSodaComparison) 11138/* harmony export */ }); 11139function _readOnlyError(name) { throw new TypeError("\"" + name + "\" is read-only"); } 11140/** 11141 Selects all elements with the attribute js-other-sodas-comparison. 11142 For each element, it initializes a toggle button that changes the displayed content of a comparison table 11143 between two different products: olipop and soda. 11144*/ 11145 11146var buildOtherSodaComparison = function buildOtherSodaComparison() { 11147 var elements = document.querySelectorAll("[js-other-sodas-comparison]"); 11148 elements.forEach(function (element) { 11149 var displayedProduct = "olipop"; 11150 var toggleBtn = element.querySelector(".other-sodas-comparison--toggle"); 11151 var toggleSpan = element.querySelector(".other-sodas-toggle--button"); 11152 function displayProduct(product) { 11153 var details = element.querySelectorAll('[class^="other-sodas-comparison__details"]'); 11154 details.forEach(function (detail) { 11155 detail.classList.remove("animate__fadeIn"); 11156 }); 11157 element.querySelector(".other-sodas-comparison__details-".concat(product)).classList.toggle("animate__fadeIn"); 11158 if (product === "olipop") { 11159 toggleSpan.style.right = "auto"; 11160 toggleBtn.setAttribute("aria-checked", "true"); 11161 } else { 11162 toggleSpan.style.right = "0"; 11163 toggleBtn.setAttribute("aria-checked", "false"); 11164 } 11165 } 11166 displayProduct(displayedProduct); 11167 toggleBtn.addEventListener("click", function (event) { 11168 var newProduct = ""; 11169 if (displayedProduct === "olipop") { 11170 newProduct = "soda"; 11171 } else { 11172 newProduct = "olipop"; 11173 } 11174 displayProduct(newProduct); 11175 newProduct, _readOnlyError("displayedProduct"); 11176 }); 11177 }); 11178}; 11179 11180/***/ }), 11181
11182/***/ "./src/scripts/sections/our-story.js": 11183/*!*******************************************!*\ 11184 !*** ./src/scripts/sections/our-story.js ***! 11185 \*******************************************/ 11186/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11187 11188"use strict"; 11189__webpack_require__.r(__webpack_exports__); 11190/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11191/* harmony export */ "buildOurStory": () => (/* binding */ buildOurStory) 11192/* harmony export */ }); 11193/* harmony import */ var tingle_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tingle.js */ "./node_modules/tingle.js/dist/tingle.min.js"); 11194/* harmony import */ var tingle_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tingle_js__WEBPACK_IMPORTED_MODULE_0__); 11195/* harmony import */ var tingle_js_dist_tingle_min_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tingle.js/dist/tingle.min.css */ "./node_modules/tingle.js/dist/tingle.min.css"); 11196/** 11197 Builds the functionality to display a modal with the bio information of a scientist when a certain element is clicked. 11198*/ 11199 11200 11201 11202var buildOurStory = function buildOurStory() { 11203 var elements = document.querySelectorAll("[js-our-story-view-bio]"); 11204 elements.forEach(function (element) { 11205 var name = element.dataset.name; 11206 var university = element.dataset.university; 11207 var bio = element.dataset.bio; 11208 element.addEventListener("click", function () { 11209 var modal = new (tingle_js__WEBPACK_IMPORTED_MODULE_0___default().modal)({ 11210 footer: false, 11211 stickyFooter: false, 11212 closeMethods: ["overlay", "button", "escape"], 11213 cssClass: ["our-story__scientists-modal"] 11214 }); 11215 modal.setContent("\n <div>\n <h2 class=\"settings-text-bold-lg\">".concat(name, "</h2>\n <h3 class=\"settings-text-base-md tw-font-light tw-uppercase tw-mb-10\">").concat(university, "</h3>\n </div>\n <p>").concat(bio, "</p>\n ")); 11216 modal.open(); 11217 var isKeyboardNavigation = element === document.activeElement; 11218 var firstFocusable = modal.modal.querySelector('button'); 11219 if (isKeyboardNavigation && firstFocusable) { 11220 setTimeout(function () { 11221 firstFocusable.focus(); 11222 }, 500); 11223 firstFocusable.addEventListener("click", function () { 11224 element === null || element === void 0 ? void 0 : element.focus(); 11225 }); 11226 } 11227 }); 11228 }); 11229}; 11230 11231/***/ }), 11232
11233/***/ "./src/scripts/sections/plyr-video-init.js": 11234/*!*************************************************!*\ 11235 !*** ./src/scripts/sections/plyr-video-init.js ***! 11236 \*************************************************/ 11237/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11238 11239"use strict"; 11240__webpack_require__.r(__webpack_exports__); 11241/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11242/* harmony export */ "buildPlyrVideo": () => (/* binding */ buildPlyrVideo) 11243/* harmony export */ }); 11244/** 11245 * Initializes Plyr video players on all elements with the `[js-plyr-video-init]` attribute. 11246 * 11247 */ 11248var buildPlyrVideo = function buildPlyrVideo() { 11249 var elements = document.querySelectorAll("[js-plyr-video-init]"); 11250 elements.forEach(function (element) { 11251 var player = new Plyr(element, { 11252 controls: ["play-large", "play", "progress", "current-time", "mute", "volume", "captions", "settings", "pip", "airplay", "fullscreen"] 11253 }); 11254 setTimeout(function () { 11255 var backImg = document.querySelector(".video-sec .video-block").dataset.imageSrc; 11256 document.querySelector(".video-block .plyr__poster").style.backgroundImage = "url(" + backImg + ")"; 11257 }, 2000); 11258 }); 11259}; 11260 11261/***/ }), 11262
11263/***/ "./src/scripts/sections/publication-slider.js": 11264/*!****************************************************!*\ 11265 !*** ./src/scripts/sections/publication-slider.js ***! 11266 \****************************************************/ 11267/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11268 11269"use strict"; 11270__webpack_require__.r(__webpack_exports__); 11271/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11272/* harmony export */ "buildPublicationSlider": () => (/* binding */ buildPublicationSlider) 11273/* harmony export */ }); 11274/* harmony import */ var _keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keen-slider-navigation-plugin */ "./src/scripts/sections/keen-slider-navigation-plugin.js"); 11275/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 11276/* eslint-disable no-new */ 11277 11278 11279 11280/** 11281 * Initializes a publication slider on all elements with the `[js-publication-slider]` attribute. 11282 * 11283 */ 11284var buildPublicationSlider = function buildPublicationSlider() { 11285 document.querySelectorAll("[js-publication-slider]").forEach(function (slider) { 11286 new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](slider, {}, [(0,_keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__.KeenSliderNavigation)({ 11287 arrows: false, 11288 dots: slider.querySelector("[data-dots]") 11289 })]); 11290 }); 11291}; 11292 11293/***/ }), 11294
vendor: 4,305 bytes, lines 11295-11318
11295/***/ "./src/scripts/sections/rebuy-recommendations.js": 11296/*!*******************************************************!*\ 11297 !*** ./src/scripts/sections/rebuy-recommendations.js ***! 11298 \*******************************************************/ 11299/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11300 11301"use strict"; 11302__webpack_require__.r(__webpack_exports__); 11303/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11304/* harmony export */ "buildRebuyRecommendations": () => (/* binding */ buildRebuyRecommendations) 11305/* harmony export */ }); 11306/* harmony import */ var _olipop_components_Buttons_oli_button_action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../olipop/components/Buttons/oli-button-action */ "./src/olipop/components/Buttons/oli-button-action.ts"); 11307/* harmony import */ var _olipop_components_Buttons_oli_button_action__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_olipop_components_Buttons_oli_button_action__WEBPACK_IMPORTED_MODULE_0__); 11308function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 11309function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11310function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } 11311function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 11312function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } 11313function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } 11314function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } 11315function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 11316function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } 11317function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 11318function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); }
11318 if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } 11319function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } 11320function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 11321function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } 11322function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 11323function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 11324 11325var buildRebuyRecommendations = function buildRebuyRecommendations() { 11326 if (!customElements.get('rebuy-recommendations')) { 11327 customElements.define('rebuy-recommendations', /*#__PURE__*/function (_HTMLElement) { 11328 _inherits(rebuyRecommendations, _HTMLElement); 11329 var _super = _createSuper(rebuyRecommendations); 11330 function rebuyRecommendations() { 11331 var _this; 11332 _classCallCheck(this, rebuyRecommendations); 11333 _this = _super.call(this); 11334 _this.widgetId = _this.dataset.widgetId; 11335 _this.rootUrl = _this.dataset.rootUrl; 11336 _this.productGrid = _this.querySelector('.js-rebuy-product-grid'); 11337 /** One delegated listener for injected cards â avoid duplicate handlers if products re-fetch. */ 11338 _this._delegatedCartClickBound = false; 11339 if (!_this.widgetId) return _possibleConstructorReturn(_this); 11340 document.addEventListener('rebuy.loaded', _this.initWidget.bind(_assertThisInitialized(_this))); 11341 _this.initWidget(); 11342 return _this; 11343 } 11344 _createClass(rebuyRecommendations, [{ 11345 key: "initWidget", 11346 value: function initWidget() { 11347 var _window$Rebuy$widgets, 11348 _this2 = this; 11349 var widget = (_window$Rebuy$widgets = window.Rebuy.widgets) === null || _window$Rebuy$widgets === void 0 ? void 0 : _window$Rebuy$widgets.find(function (w) { 11350 return w.id === _this2.widgetId; 11351 }); 11352 if (!widget) return; 11353 var checkProducts = setInterval(function () { 11354 if (widget.data.products) { 11355 _this2.widgetProducts = widget.data.products; 11356 clearInterval(checkProducts); 11357 _this2.getProductCards(); 11358 } 11359 }, 200); 11360 } 11361 }, { 11362 key: "getProductCards", 11363 value: function getProductCards() { 11364 var _this3 = this; 11365 var fetchPromises = this.widgetProducts.map(function (product) { 11366 return fetch("".concat(_this3.rootUrl, "products/").concat(product.handle, "?view=product-card")); 11367 }); 11368 Promise.all(fetchPromises).then(function (responses) { 11369 responses.forEach(function (response) { 11370 if (!response.ok) { 11371 throw new Error("HTTP error! Status: ".concat(response.status)); 11372 } 11373 }); 11374 return Promise.all(responses.map(function (response) { 11375 return response.text(); 11376 })); 11377 }).then(function (data) { 11378 _this3.renderProducts(data); 11379 _this3.initATCButtons(); 11380 })["catch"](function (error) { 11381 console.error(error); 11382 }); 11383 } 11384 }, { 11385 key: "renderProducts", 11386 value: function renderProducts(data) { 11387 var _this4 = this; 11388 if (!data.length) { 11389 this.closest('.shopify-section').classList.add('hidden'); 11390 return; 11391 } 11392 data.forEach(function (item) { 11393 var parsedCard = new DOMParser().parseFromString(item, 'text/html').querySelector('.product-card'); 11394 if (!parsedCard) return; 11395 _this4.productGrid.insertAdjacentElement("beforeend", parsedCard); 11396 }); 11397 if (typeof window.initProductCardHoverWaves === 'function') { 11398 window.initProductCardHoverWaves(this.productGrid); 11399 } 11400 } 11401 }, { 11402 key: "initATCButtons", 11403 value: function initATCButtons() { 11404 var _this5 = this; 11405 if (this._delegatedCartClickBound) return; 11406 this._delegatedCartClickBound = true; 11407 this.addEventListener('click', function (e) { 11408 var btn = e.target.closest('button[data-add-to-cart][data-product-card-cta]') || e.target.closest('[data-action="add-variant"]'); 11409 if (!btn || !_this5.contains(btn)) return; 11410 e.preventDefault(); 11411 e.stopPropagation(); 11412 (0,_olipop_components_Buttons_oli_button_action__WEBPACK_IMPORTED_MODULE_0__.addVariant)(btn); 11413 }, true); 11414 } 11415 }]); 11416 return rebuyRecommendations; 11417 }( /*#__PURE__*/_wrapNativeSuper(HTMLElement))); 11418 } 11419}; 11420 11421/***/ }), 11422
11423/***/ "./src/scripts/sections/rebuy-upsell-slider.js": 11424/*!*****************************************************!*\ 11425 !*** ./src/scripts/sections/rebuy-upsell-slider.js ***! 11426 \*****************************************************/ 11427/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11428 11429"use strict"; 11430__webpack_require__.r(__webpack_exports__); 11431/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11432/* harmony export */ "rebuyUpsellSmartCartSlider": () => (/* binding */ rebuyUpsellSmartCartSlider) 11433/* harmony export */ }); 11434/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 11435/* eslint-disable no-new */ 11436 11437 11438/** 11439 * Shape expected by window.__oliRebuyGetLinePriceParts (see rebuy-cart-script.liquid). 11440 */ 11441function upsellProductAsLineItem(product, variant) { 11442 return { 11443 product: product, 11444 variant: variant, 11445 price: variant.price, 11446 compare_at_price: variant.compare_at_price, 11447 selling_plan_allocation: null 11448 }; 11449} 11450 11451/** 11452 * Uses the same pricing helpers as Smart Cart line items (rebuy-cart-template.liquid) 11453 * so upsell prices match cart items with global discounts on or off. 11454 */ 11455function renderUpsellProductPrice(product, container, widget) { 11456 var _product$variants, _window$Rebuy, _window$Rebuy$util, _window$Rebuy2, _window$Rebuy2$Cart; 11457 var variant = product.selected_variant || ((_product$variants = product.variants) === null || _product$variants === void 0 ? void 0 : _product$variants[0]); 11458 if (!variant || !(widget !== null && widget !== void 0 && widget.variantPrice)) return; 11459 var formatMoney = typeof widget.formatMoney === "function" && widget.formatMoney.bind(widget) || ((_window$Rebuy = window.Rebuy) === null || _window$Rebuy === void 0 ? void 0 : (_window$Rebuy$util = _window$Rebuy.util) === null || _window$Rebuy$util === void 0 ? void 0 : _window$Rebuy$util.formatMoney) || ((_window$Rebuy2 = window.Rebuy) === null || _window$Rebuy2 === void 0 ? void 0 : (_window$Rebuy2$Cart = _window$Rebuy2.Cart) === null || _window$Rebuy2$Cart === void 0 ? void 0 : _window$Rebuy2$Cart.formatMoney); 11460 if (!formatMoney) return; 11461 container.classList.add("product-price", "rebuy-product-price", "tw-text-3", "tw-font-semibold", "tw-leading-3", "tw-flex", "tw-gap-x-1.5"); 11462 var item = upsellProductAsLineItem(product, variant); 11463 var rebuyVariantPrice = function rebuyVariantPrice() { 11464 return widget.variantPrice(product, variant); 11465 }; 11466 var rebuyVariantCompareAt = function rebuyVariantCompareAt() { 11467 return widget.variantCompareAtPrice(product, variant); 11468 }; 11469 var rebuyVariantOnSale = function rebuyVariantOnSale() { 11470 return typeof widget.variantOnSale === "function" && widget.variantOnSale(product, variant); 11471 }; 11472 var hasDiscount = typeof window.oliRebuyLineHasDiscount === "function" ? window.oliRebuyLineHasDiscount(item, rebuyVariantOnSale) : rebuyVariantOnSale(); 11473 var saleHtml = typeof window.oliRebuyLineSalePrice === "function" ? window.oliRebuyLineSalePrice(item, formatMoney, rebuyVariantPrice) : formatMoney(rebuyVariantPrice()); 11474 if (hasDiscount) { 11475 var salePrice = document.createElement("span"); 11476 salePrice.classList.add("rebuy-money", "sale"); 11477 salePrice.innerHTML = saleHtml; 11478 container.appendChild(salePrice); 11479 var compareAtPrice = document.createElement("span"); 11480 compareAtPrice.classList.add("rebuy-money", "compare-at", "tw-font-normal"); 11481 compareAtPrice.innerHTML = typeof window.oliRebuyLineComparePrice === "function" ? window.oliRebuyLineComparePrice(item, formatMoney, rebuyVariantCompareAt) : formatMoney(rebuyVariantCompareAt()); 11482 container.appendChild(compareAtPrice); 11483 } else { 11484 var price = document.createElement("span"); 11485 price.classList.add("rebuy-money"); 11486 price.innerHTML = saleHtml; 11487 container.appendChild(price); 11488 } 11489} 11490var rebuyUpsellSmartCartSlider = function rebuyUpsellSmartCartSlider() { 11491 document.addEventListener("rebuy.ready", function (event) { 11492 var _window$Rebuy3, _window$Rebuy3$SmartC, _window$Rebuy3$SmartC2, _event$detail$widget; 11493 var RebuySmartCartCrossSells = (_window$Rebuy3 = window.Rebuy) === null || _window$Rebuy3 === void 0 ? void 0 : (_window$Rebuy3$SmartC = _window$Rebuy3.SmartCart) === null || _window$Rebuy3$SmartC === void 0 ? void 0 : (_window$Rebuy3$SmartC2 = _window$Rebuy3$SmartC.settings) === null || _window$Rebuy3$SmartC2 === void 0 ? void 0 : _window$Rebuy3$SmartC2.cross_sells; 11494 if (!RebuySmartCartCrossSells) return; 11495 if ((_event$detail$widget = event.detail.widget) !== null && _event$detail$widget !== void 0 && _event$detail$widget.id && RebuySmartCartCrossSells.includes(event.detail.widget.id)) { 11496 var productChangeEvent = function productChangeEvent() { 11497 document.addEventListener("rebuy.productsChange", function (event) { 11498 renderProducts(event.detail.products); 11499 }); 11500 }; 11501 var widget = event.detail.widget; 11502 var rebuyContainerEl = document.querySelector(".rebuy-upsell"); 11503 // Container styling
11504 rebuyContainerEl.classList.add("tw-py-4", "tw-pl-5", "tw-w-full", "rebuy-upsell-item-container", "tw-border-solid"); 11505 rebuyContainerEl.setAttribute("role", "region"); 11506 rebuyContainerEl.setAttribute("aria-label", "Product recommendations"); 11507 11508 // Arrow Container 11509 var titleContainerEl = document.createElement("div"); 11510 titleContainerEl.classList.add("tw-flex", "tw-justify-between", "tw-items-center", "tw-pb-3", "tw-pr-5"); 11511 rebuyContainerEl.appendChild(titleContainerEl); 11512 11513 // Widget Title 11514 var widgetTitle = event.detail.widget.data.config.language.title; 11515 var newWidgetTitle = document.createElement("div"); 11516 var widgetTitleContent = document.createTextNode(widgetTitle); 11517 newWidgetTitle.appendChild(widgetTitleContent); 11518 newWidgetTitle.classList.add("tw-text-[16px]", "md:tw-text-[20px]", "tw-font-extrabold", "tw-leading-[14px]", "tw-pr-2", "tw-flex-1"); 11519 titleContainerEl.appendChild(newWidgetTitle); 11520 11521 // Arrow Container 11522 var arrowContainerEl = document.createElement("div"); 11523 arrowContainerEl.classList.add("tw-flex", "tw-items-center"); 11524 titleContainerEl.appendChild(arrowContainerEl); 11525 11526 // Arrow Right SVG 11527 var arrowRightEl = document.createElement("button"); 11528 arrowRightEl.classList.add("tw-flex", "tw-bg-transparent", "tw-w-[24px]", "tw-h-[24px]", "tw-p-0", "tw-border-none"); 11529 arrowRightEl.id = "arrow-right"; 11530 arrowRightEl.ariaLabel = "Slider previous button"; 11531 arrowRightEl.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n <g>\n <path d=\"M21.0001 11.9999C21.0001 12.1988 20.9211 12.3896 20.7804 12.5303C20.6398 12.6709 20.449 12.7499 20.2501 12.7499H5.56041L11.0307 18.2193C11.1004 18.289 11.1557 18.3717 11.1934 18.4628C11.2311 18.5538 11.2505 18.6514 11.2505 18.7499C11.2505 18.8485 11.2311 18.9461 11.1934 19.0371C11.1557 19.1281 11.1004 19.2109 11.0307 19.2806C10.961 19.3502 10.8783 19.4055 10.7873 19.4432C10.6962 19.4809 10.5986 19.5003 10.5001 19.5003C10.4016 19.5003 10.304 19.4809 10.2129 19.4432C10.1219 19.4055 10.0392
1153119.3502 9.96948 19.2806L3.21948 12.5306C3.14974 12.4609 3.09443 12.3782 3.05668 12.2871C3.01894 12.1961 2.99951 12.0985 2.99951 11.9999C2.99951 11.9014 3.01894 11.8038 3.05668 11.7127C3.09443 11.6217 3.14974 11.539 3.21948 11.4693L9.96948 4.7193C10.1102 4.57857 10.3011 4.49951 10.5001 4.49951C10.6991 4.49951 10.89 4.57857 11.0307 4.7193C11.1715 4.86003 11.2505 5.05091 11.2505 5.24993C11.2505 5.44895 11.1715 5.63982 11.0307 5.78055L5.56041 11.2499H20.2501C20.449 11.2499 20.6398 11.3289 20.7804 11.4696C20.9211 11.6103 21.0001 11.801 21.0001 11.9999Z\" fill=\"#034638\"/>\n </g>\n</svg>\n "; 11532 arrowContainerEl.appendChild(arrowRightEl); 11533 var arrowRight = rebuyContainerEl.querySelector("#arrow-right"); 11534 11535 // Arrow Left SVG 11536 var arrowLeftEl = document.createElement("button"); 11537 arrowLeftEl.classList.add("tw-flex", "tw-bg-transparent", "tw-w-[24px]", "tw-h-[24px]", "tw-p-0", "tw-border-none", "tw-ml-2"); 11538 arrowLeftEl.id = "arrow-left"; 11539 arrowLeftEl.ariaLabel = "Slider next button"; 11540 arrowLeftEl.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\">\n <path d=\"M20.7806 12.5306L14.0306 19.2806C13.8899 19.4213 13.699 19.5003 13.5 19.5003C13.301 19.5003 13.1101 19.4213 12.9694 19.2806C12.8286 19.1398 12.7496 18.949 12.7496 18.7499C12.7496 18.5509 12.8286 18.36 12.9694 18.2193L18.4397 12.7499H3.75C3.55109 12.7499 3.36032 12.6709 3.21967 12.5303C3.07902 12.3896 3 12.1988 3 11.9999C3 11.801 3.07902 11.6103 3.21967 11.4696C3.36032 11.3289 3.55109 11.2499 3.75 11.2499H18.4397L12.9694 5.78055C12.8286 5.63982 12.7496 5.44895 12.7496 5.24993C12.7496 5.05091 12.8286 4.86003 12.9694 4.7193C13.1101 4.57857 13.301 4.49951 13.5 4.49951C13.699 4.49951 13.8899 4.57857 14.0306 4.7193L20.7806 11.4693C20.8504 11.539 20.9057 11.6217 20.9434 11.7127C20.9812 11.8038 21.0006 11.9014 21.0006 11.9999C21.0006 12.0985 20.9812 12.1961 20.9434 12.2871C20.9057 12.3782 20.8504 12.4609 20.7806 12.5306Z\" fill=\"#034638\"/>\n</svg>"; 11541 arrowContainerEl.appendChild(arrowLeftEl); 11542 var arrowLeft = rebuyContainerEl.querySelector("#arrow-left"); 11543 11544 // Products Wrapper 11545 var productsWrapper = document.createElement("div"); 11546 productsWrapper.classList.add("keen-slider"); 11547 rebuyContainerEl.appendChild(productsWrapper); 11548 var renderProducts = function renderProducts(productsArray) { 11549 // Clear previous products 11550 productsWrapper.innerHTML = ""; 11551 productsArray.forEach(function (product) { 11552 // Product Container 11553 var productContainer = document.createElement("div"); 11554 productContainer.classList.add("tw-rounded-[10px]", "tw-border", "tw-border-solid", "tw-border-hunter-green/25", "tw-bg-white", "tw-flex", "tw-items-center", "keen-slider__slide"); 11555 productsWrapper.appendChild(productContainer); 11556 11557 // Product Image 11558 var productImageEl = document.createElement("img"); 11559 productImageEl.src = product.image.src; 11560 productImageEl.alt = product.title; 11561 productImageEl.classList.add("product-image", "tw-w-[26px]", "tw-h-12", "tw-mr-2", "tw-object-contain"); 11562 productContainer.appendChild(productImageEl); 11563 11564 // Product Title & price wrapper 11565 var productInfoWrapperEl = document.createElement("div"); 11566 productInfoWrapperEl.classList.add("product-info-wrapper", "tw-flex", "tw-flex-col", "tw-justify-center", "tw-flex-1"); 11567 productContainer.appendChild(productInfoWrapperEl); 11568 11569 // Product Title 11570 var newProductsEl = document.createElement("div"); 11571 var productTitle = document.createTextNode(product.title); 11572 newProductsEl.appendChild(productTitle); 11573 newProductsEl.classList.add("product-title", "tw-text-3", "tw-font-semibold", "tw-leading-3", "tw-pb-2"); 11574 productInfoWrapperEl.appendChild(newProductsEl); 11575 // Product Price (same logic as cart line items via oliRebuyLine*) 11576 var productPriceContainer = document.createElement("div"); 11577 renderUpsellProductPrice(product, productPriceContainer, widget); 11578 productInfoWrapperEl.appendChild(productPriceContainer); 11579 11580 // Product Add button 11581 var addButtonEl = document.createElement("button"); 11582 var addButtonLanguage = document.createTextNode(event.detail.widget.data.config.language.add_to_cart); 11583 addButtonEl.ariaLabel = "Add ".concat(product.title); 11584 addButtonEl.appendChild(addButtonLanguage); 11585 addButtonEl.classList.add("tw-text-white", "tw-bg-hunter-green", "tw-rounded-[100px]", "tw-py-2", "tw-px-3", "tw-font-semibold", "tw-border-none", "tw-font-body", "tw-text-3", "tw-leading-3"); 11586 addButtonEl.innerHTML = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path d=\"M17.5 10C17.5 10.1658 17.4342 10.3247 17.3169 10.4419C17.1997 10.5592 17.0408 10.625 16.875 10.625H10.625V16.875C10.625 17.0408 10.5592 17.1997 10.4419 17.3169C10.3247 17.4342 10.1658 17.5 10 17.5C9.83424 17.5 9.67527 17.4342 9.55806 17.3169C9.44085 17.1997 9.375 17.0408 9.375 16.875V10.625H3.125C2.95924 10.625 2.80027 10.5592 2.68306 10.4419C2.56585 10.3247 2.5 10.1658 2.5 10C2.5 9.83424 2.56585 9.67527 2.68306 9.55806C2.80027 9.44085 2.95924 9.375 3.125 9.375H9.375V3.125C9.375 2.95924 9.44085 2.80027 9.55806 2.68306C9.67527 2.56585 9.83424 2.5 10 2.5C10.1658 2.5 10.3247 2.56585 10.4419 2.68306C10.5592 2.80027 10.625 2.95924 10.625 3.125V9.375H16.875C17.0408 9.375 17.1997 9.44085 17.3169 9.55806C17.4342 9.67527 17.5 9.83424 17.5 10Z\" fill=\"#034638\"/>\n </svg>"; 11587 addButtonEl.onclick = function () { 11588 // Set the loading spinner as the button content 11589 addButtonEl.innerHTML = "<svg class=\"tw-animate-spin tw-h-5 tw-w-5 tw-text-black\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">
11589\n <circle class=\"tw-opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" stroke-width=\"4\"></circle>\n <path class=\"tw-opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\"></path>\n </svg>"; 11590 widget.addToCart(product); 11591 productChangeEvent(); 11592 }; 11593 productContainer.appendChild(addButtonEl); 11594 }); 11595 11596 // Re-initiate Keen Slider 11597 new keen_slider__WEBPACK_IMPORTED_MODULE_0__["default"](productsWrapper, { 11598 loop: true, 11599 breakpoints: { 11600 "(min-width: 750px)": { 11601 slides: { 11602 perView: 1.5, 11603 spacing: 8 11604 } 11605 } 11606 }, 11607 slides: { 11608 perView: 1.2, 11609 spacing: 8 11610 }, 11611 created: function created(slide) { 11612 arrowRight.addEventListener("click", function () { 11613 slide.prev(); 11614 }); 11615 arrowLeft.addEventListener("click", function () { 11616 slide.next(); 11617 }); 11618 } 11619 }); 11620 }; 11621 renderProducts(event.detail.widget.data.products); 11622 productChangeEvent(); 11623 } 11624 }); 11625}; 11626 11627/***/ }), 11628
11629/***/ "./src/scripts/sections/slider.js": 11630/*!****************************************!*\ 11631 !*** ./src/scripts/sections/slider.js ***! 11632 \****************************************/ 11633/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11634 11635"use strict"; 11636__webpack_require__.r(__webpack_exports__); 11637/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11638/* harmony export */ "buildSlider": () => (/* binding */ buildSlider) 11639/* harmony export */ }); 11640/* harmony import */ var _keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keen-slider-navigation-plugin */ "./src/scripts/sections/keen-slider-navigation-plugin.js"); 11641/* harmony import */ var keen_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! keen-slider */ "./node_modules/keen-slider/keen-slider.es.js"); 11642/* eslint-disable no-new */ 11643 11644 11645 11646/** 11647 * Initializes a KeenSlider on all elements with the `[js-slider]` attribute. 11648 * 11649 */ 11650var buildSlider = function buildSlider() { 11651 document.addEventListener("DOMContentLoaded", function () { 11652 document.querySelectorAll("[js-slider]").forEach(function (slider) { 11653 new keen_slider__WEBPACK_IMPORTED_MODULE_1__["default"](slider, {}, [(0,_keen_slider_navigation_plugin__WEBPACK_IMPORTED_MODULE_0__.KeenSliderNavigation)({ 11654 arrows: false, 11655 dots: false 11656 })]); 11657 }); 11658 }); 11659}; 11660 11661/***/ }), 11662
11663/***/ "./src/scripts/templates/blog.js": 11664/*!***************************************!*\ 11665 !*** ./src/scripts/templates/blog.js ***! 11666 \***************************************/ 11667/***/ (() => { 11668 11669var $selectedCategory; 11670var $body; 11671var $filterButton; 11672 11673// Close mobile filter and navigate to selected category 11674var _closeMobileFilterAndNavigate = function _closeMobileFilterAndNavigate() { 11675 if ($selectedCategory && $selectedCategory.length > 0) { 11676 window.location.href = $selectedCategory.attr("href"); 11677 } else { 11678 $(".js-blog-mobile-filter").hide(); 11679 $(".js-blog-mobile-filter-open").show(); 11680 } 11681 $body.css("overflow", "visible"); 11682}; 11683 11684// Show/hide mobile filter button depending on window position 11685var _showHideFilterButton = function _showHideFilterButton() { 11686 var footerTop = $("footer").offset().top; 11687 var footerBottom = $("footer").offset().top + $("footer").outerHeight(); 11688 var windowBottom = $(window).scrollTop() + ($(window).innerHeight() - $(window).innerHeight() / 3); 11689 var windowTop = $(window).scrollTop(); 11690 if (windowBottom > footerTop && windowTop < footerBottom) { 11691 $filterButton.css("opacity", "0"); 11692 $filterButton.css("visibility", "hidden"); 11693 } else { 11694 $filterButton.css("visibility", "visible"); 11695 $filterButton.css("opacity", "1"); 11696 } 11697}; 11698 11699// Show/hide menu separator depending on window position 11700var _showHideMenuSeparator = function _showHideMenuSeparator() { 11701 var menuTop = $(".js-blog-categories").offset().top; 11702 var headerBottom = $("header").offset().top + $("header").outerHeight(); 11703 if (menuTop === headerBottom) { 11704 $(".js-blog-categories").addClass("tw-border-t-2"); 11705 } else { 11706 $(".js-blog-categories").removeClass("tw-border-t-2"); 11707 } 11708}; 11709 11710// set filter elements and init event listeners 11711var _initBlogFilter = function _initBlogFilter() { 11712 $selectedCategory = $(".js-blog-category-link.is-selected"); 11713 $body = $("body"); 11714 $filterButton = $(".js-blog-mobile-filter-open button"); 11715 11716 // Event listener for mobile filter close button 11717 $(".js-blog-mobile-filter-close").click(function (event) { 11718 _closeMobileFilterAndNavigate(); 11719 }); 11720 11721 // Event listener for mobile filter open button 11722 $(".js-blog-mobile-filter-open").click(function () { 11723 if ($filterButton.css("visibility") === "visible") { 11724 $(".js-blog-mobile-filter").show(); 11725 $(".js-blog-mobile-filter-open").hide(); 11726 if ($selectedCategory.length > 0) { 11727 $selectedCategory.closest("details").attr("open", ""); 11728 } 11729 $body.css("overflow", "hidden"); 11730 } 11731 }); 11732 11733 // Event listener for mouseenter on category details 11734 $(".js-detail summary, .js-detail ul").mouseenter(function (event) { 11735 if ($(window).width() > 1024) { 11736 var $currentDetail = $(event.target).closest("details"); 11737 $currentDetail.attr("open", ""); 11738 $(".js-blog-categories .js-detail").not($currentDetail).removeAttr("open"); 11739 } 11740 }); 11741 11742 // Event listener for mouseleave on category details 11743 $(".js-detail ul, .js-detail summary").mouseleave(function (event) { 11744 if ($(window).width() > 1024) { 11745 var $currentDetail = $(event.target).closest("details"); 11746 $currentDetail.removeAttr("open"); 11747 $(".js-blog-categories .js-detail").not($currentDetail).removeAttr("open"); 11748 } 11749 }); 11750 11751 // Event listener for click on mobile filter category link 11752 $(".js-blog-mobile-filter .js-blog-category-link").click(function (event) { 11753 event.preventDefault(); 11754 if ($selectedCategory && $selectedCategory.length > 0 && $(event.target).attr("href") === $selectedCategory.attr("href")) { 11755 $selectedCategory.removeClass("is-selected"); 11756 $selectedCategory = null; 11757 } else { 11758 $selectedCategory = $(event.target); 11759 $(".js-blog-category-link").removeClass("is-selected"); 11760 $selectedCategory.addClass("is-selected"); 11761 _closeMobileFilterAndNavigate(); 11762 } 11763 }); 11764 var forceSubMenuToggle = function forceSubMenuToggle(e) { 11765 if (e.code === "Escape" || e.type === "click") { 11766 $(".js-blog-categories .js-detail").removeAttr("open"); 11767 } 11768 }; 11769 11770 // Event listener for window click 11771 window.addEventListener("click", forceSubMenuToggle); 11772 // Event listener for window "Escape" keypress 11773 window.addEventListener("keydown", forceSubMenuToggle); 11774 11775 // Event listener for click on category details 11776 $(".js-detail").click(function (event) { 11777 event.stopPropagation(); 11778 }); 11779 11780 // Event listener for window scroll 11781 $(window).scroll(function () { 11782 _showHideFilterButton(); 11783 _showHideMenuSeparator(); 11784 }); 11785}; 11786var _initSeeMoreBtn = function _initSeeMoreBtn() { 11787 $(".js-load-more").on("click", function () { 11788 var pageSize = parseInt($("[data-page-size]").val()); 11789 var totalPages = parseInt($("[data-total-pages]").val()); 11790 var nextPage = parseInt($("[data-current-page]").val()) + 1; 11791 var nextUrl = $("[data-next-url]").val().replace(/page=[0-9]+/, "page=" + nextPage); 11792 $("[data-current-page]").val(nextPage); 11793 $.ajax({ 11794 url: nextUrl, 11795 type: "GET", 11796 dataType: "html", 11797 success: function success(responseHTML) { 11798 $(".blog-digest-articles-list").append($(responseHTML).find(".blog-digest-articles-list").html()); 11799 var blogArticles = $(".blog-digest-articles-list").find(".blog-article-list-item"); 11800 // Focus on the first newly addedd article 11801 $(blogArticles[blogArticles.length - pageSize]).focus(); 11802 if (nextPage >= totalPages) { 11803 $(".js-load-more").addClass("tw-hidden"); 11804 } 11805 } 11806 }); 11807 }); 11808}; 11809document.addEventListener("DOMContentLoaded", function (event) { 11810 var template = document.body.dataset.template; 11811 if (template === "blog") _initBlogFilter(); 11812 if (template === "blog" || template === "search") _initSeeMoreBtn(); 11813}); 11814 11815/***/ }), 11816
11817/***/ "./src/scripts/templates/bundle-builder.js": 11818/*!*************************************************!*\ 11819 !*** ./src/scripts/templates/bundle-builder.js ***! 11820 \*************************************************/ 11821/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11822 11823"use strict"; 11824__webpack_require__.r(__webpack_exports__); 11825/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 11826/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 11827 11828 11829 11830/* 11831 These are scripts for sections on the bundle builder landing page. 11832 Scripting for the actual bundle builder app can be found inside the seperate bundle-builder folder 11833*/ 11834 11835document.addEventListener("DOMContentLoaded", function (event) { 11836 if (document.body.dataset.suffix == "bundle-builder") { 11837 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("accordion-group", _global__WEBPACK_IMPORTED_MODULE_0__.Accordion); 11838 } 11839}); 11840 11841/***/ }), 11842
11843/***/ "./src/scripts/templates/collection.js": 11844/*!*********************************************!*\ 11845 !*** ./src/scripts/templates/collection.js ***! 11846 \*********************************************/ 11847/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11848 11849"use strict"; 11850__webpack_require__.r(__webpack_exports__); 11851/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 11852/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 11853 11854 11855document.addEventListener("DOMContentLoaded", function (event) { 11856 if (document.body.dataset.template == "collection") { 11857 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("drop-down-container", _global__WEBPACK_IMPORTED_MODULE_0__.Dropdown); 11858 } 11859}); 11860 11861/***/ }), 11862
11863/***/ "./src/scripts/templates/global.js": 11864/*!*****************************************!*\ 11865 !*** ./src/scripts/templates/global.js ***! 11866 \*****************************************/ 11867/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11868 11869"use strict"; 11870__webpack_require__.r(__webpack_exports__); 11871/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 11872/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 11873/* harmony import */ var _thebeyondgroup_brand__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @thebeyondgroup/brand */ "./node_modules/@thebeyondgroup/brand/src/index.js"); 11874 11875 11876 11877// logBeyondBrand(); 11878document.addEventListener("DOMContentLoaded", function () { 11879 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("newsletter-form", _global__WEBPACK_IMPORTED_MODULE_0__.Newsletter); 11880 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("video-container", _global__WEBPACK_IMPORTED_MODULE_0__.VideoPlayer); 11881 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("tooltip-info", _global__WEBPACK_IMPORTED_MODULE_0__.Tooltip); 11882 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("klaviyo-form", _global__WEBPACK_IMPORTED_MODULE_0__.KlaviyoForm); 11883 if (document.querySelector("announcement-bar")) { 11884 document.body.classList.add("has-announcement", "has_announcement"); 11885 } 11886}); 11887 11888/***/ }), 11889
11890/***/ "./src/scripts/templates/index.js": 11891/*!****************************************!*\ 11892 !*** ./src/scripts/templates/index.js ***! 11893 \****************************************/ 11894/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11895 11896"use strict"; 11897__webpack_require__.r(__webpack_exports__); 11898/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 11899/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 11900/* harmony import */ var _sections__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../sections */ "./src/scripts/sections/index.js"); 11901 11902 11903 11904document.addEventListener("DOMContentLoaded", function (_event) { 11905 if (document.body.dataset.template === "index") { 11906 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildFullWidthImageText)(); 11907 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildOtherSodaComparison)(); 11908 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildOurStory)(); 11909 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildPublicationSlider)(); 11910 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildSlider)(); 11911 } 11912 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildFeaturedBlogSection)(); 11913 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.rebuyUpsellSmartCartSlider)(); 11914 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildFlavorsSlider)(); 11915 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("accordion-group", _global__WEBPACK_IMPORTED_MODULE_0__.Accordion); 11916 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.initSliceAnimation)(); 11917 (0,_sections__WEBPACK_IMPORTED_MODULE_2__.buildRebuyRecommendations)(); 11918}); 11919 11920/***/ }), 11921
11922/***/ "./src/scripts/templates/page.bundle-builder.js": 11923/*!******************************************************!*\ 11924 !*** ./src/scripts/templates/page.bundle-builder.js ***! 11925 \******************************************************/ 11926/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 11927 11928"use strict"; 11929__webpack_require__.r(__webpack_exports__); 11930/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 11931/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 11932 11933 11934document.addEventListener("DOMContentLoaded", function (event) { 11935 if (document.body.dataset.suffix == "bundle-builder") { 11936 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("accordion-group", _global__WEBPACK_IMPORTED_MODULE_0__.Accordion); 11937 } 11938}); 11939 11940/***/ }), 11941
11942/***/ "./src/scripts/templates/page.dietitian.js": 11943/*!*************************************************!*\ 11944 !*** ./src/scripts/templates/page.dietitian.js ***! 11945 \*************************************************/ 11946/***/ (() => { 11947 11948// todo: make tab/panel a global element 11949 11950function initDietTabs() { 11951 var tabs = document.querySelectorAll('[role="tab"]'); 11952 var tabList = document.querySelector('[role="tablist"]'); 11953 11954 // Add a click event handler to each tab 11955 tabs.forEach(function (tab) { 11956 tab.addEventListener("click", changeTabs); 11957 }); 11958 11959 // Enable arrow navigation between tabs in the tab list 11960 var tabFocus = 0; 11961 tabList.addEventListener("keydown", function (e) { 11962 // Move right 11963 if (e.key === "ArrowRight" || e.key === "ArrowLeft") { 11964 tabs[tabFocus].setAttribute("tabindex", -1); 11965 if (e.key === "ArrowRight") { 11966 tabFocus++; 11967 // If we're at the end, go to the start 11968 if (tabFocus >= tabs.length) { 11969 tabFocus = 0; 11970 } 11971 // Move left 11972 } else if (e.key === "ArrowLeft") { 11973 tabFocus--; 11974 // If we're at the start, move to the end 11975 if (tabFocus < 0) { 11976 tabFocus = tabs.length - 1; 11977 } 11978 } 11979 tabs[tabFocus].setAttribute("tabindex", 0); 11980 tabs[tabFocus].focus(); 11981 } 11982 }); 11983} 11984function changeTabs(e) { 11985 var target = e.target; 11986 var parent = target.parentNode; 11987 var grandparent = parent.parentNode; 11988 11989 // Remove all current selected tabs 11990 parent.querySelectorAll('[aria-selected="true"]').forEach(function (t) { 11991 t.setAttribute("aria-selected", false); 11992 t.classList.remove("active"); 11993 }); 11994 11995 // Set this tab as selected 11996 target.setAttribute("aria-selected", true); 11997 target.classList.add("active"); 11998 11999 // Hide all tab panels 12000 grandparent.querySelectorAll('[role="tabpanel"]').forEach(function (p) { 12001 return p.setAttribute("hidden", true); 12002 }); 12003 12004 // Show the selected panel 12005 grandparent.parentNode.querySelector("#".concat(target.getAttribute("aria-controls"))).removeAttribute("hidden"); 12006} 12007document.addEventListener("DOMContentLoaded", function (event) { 12008 if (document.body.dataset.template == "page" && document.body.dataset.suffix == "dietitian") { 12009 initDietTabs(); 12010 } 12011}); 12012 12013/***/ }), 12014
12015/***/ "./src/scripts/templates/page.digestive-health.js": 12016/*!********************************************************!*\ 12017 !*** ./src/scripts/templates/page.digestive-health.js ***! 12018 \********************************************************/ 12019/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12020 12021"use strict"; 12022__webpack_require__.r(__webpack_exports__); 12023/* harmony import */ var _sections__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sections */ "./src/scripts/sections/index.js"); 12024 12025document.addEventListener("DOMContentLoaded", function (event) { 12026 if (document.body.dataset.template === "digestive-health") { 12027 (0,_sections__WEBPACK_IMPORTED_MODULE_0__.buildPlyrVideo)(); 12028 } 12029}); 12030 12031/***/ }), 12032
12033/***/ "./src/scripts/templates/page.faq.js": 12034/*!*******************************************!*\ 12035 !*** ./src/scripts/templates/page.faq.js ***! 12036 \*******************************************/ 12037/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12038 12039"use strict"; 12040__webpack_require__.r(__webpack_exports__); 12041/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 12042/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 12043 12044 12045document.addEventListener("DOMContentLoaded", function () { 12046 if (document.body.dataset.suffix == "faq-new") { 12047 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("accordion-group", _global__WEBPACK_IMPORTED_MODULE_0__.Accordion); 12048 } 12049}, false); 12050 12051/***/ }), 12052
12053/***/ "./src/scripts/templates/page.ingredients.js": 12054/*!***************************************************!*\ 12055 !*** ./src/scripts/templates/page.ingredients.js ***! 12056 \***************************************************/ 12057/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12058 12059"use strict"; 12060__webpack_require__.r(__webpack_exports__); 12061/* harmony import */ var _page_ingredients_flavorsSlider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../page.ingredients/flavorsSlider */ "./src/scripts/page.ingredients/flavorsSlider.js"); 12062/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 12063/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 12064 12065 12066 12067document.addEventListener("DOMContentLoaded", function () { 12068 if (document.body.dataset.template === "page") { 12069 (0,_utils__WEBPACK_IMPORTED_MODULE_2__.initSection)("flavor-slider", _page_ingredients_flavorsSlider__WEBPACK_IMPORTED_MODULE_0__.flavorsSlider); 12070 (0,_utils__WEBPACK_IMPORTED_MODULE_2__.initSection)("ingredients-accordion", _global__WEBPACK_IMPORTED_MODULE_1__.Accordion); 12071 } 12072}); 12073 12074/***/ }), 12075
12076/***/ "./src/scripts/templates/page.our-story.js": 12077/*!*************************************************!*\ 12078 !*** ./src/scripts/templates/page.our-story.js ***! 12079 \*************************************************/ 12080/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12081 12082"use strict"; 12083__webpack_require__.r(__webpack_exports__); 12084/* harmony import */ var _sections__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../sections */ "./src/scripts/sections/index.js"); 12085 12086document.addEventListener("DOMContentLoaded", function (event) { 12087 if (document.body.dataset.template == "page" && document.body.dataset.suffix == "story") { 12088 (0,_sections__WEBPACK_IMPORTED_MODULE_0__.buildOurStory)(); 12089 } 12090}); 12091 12092/***/ }), 12093
12094/***/ "./src/scripts/templates/page.subscription.js": 12095/*!****************************************************!*\ 12096 !*** ./src/scripts/templates/page.subscription.js ***! 12097 \****************************************************/ 12098/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12099 12100"use strict"; 12101__webpack_require__.r(__webpack_exports__); 12102/* harmony import */ var _animations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../animations */ "./src/scripts/animations/index.js"); 12103/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "./src/scripts/utils/index.js"); 12104/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../global */ "./src/scripts/global/index.js"); 12105 12106 12107 12108 12109/** 12110 * 12111 Contains the implementation of the subscription form. 12112 It initializes and updates various elements and components on the page based on user interaction 12113 by searching for elements with specific data attributes ( [data-update] ) and replacing their content with the new value. 12114 12115 @module subscriptionForm 12116 * 12117 * 12118 @property {Element} container - The subscription barba container element 12119 @property {Element} form - The product form element 12120 @property {QtySelector} qty_selector - The quantity selector component instance 12121 @property {ComboBox} combo_box - The combo box component instance 12122 @property {AddToCart} atc_button - The add to cart button component instance 12123 @property {TopBar} top_bar - The top bar component instance 12124 @property {NodeList} all_swatches - A list of all swatch elements in the form 12125 @property {NodeList} dynamic_elems - A list of all dynamic elements to update when a swatch is clicked 12126 @property {Element} accordion_group_container - The container element for all accordion groups 12127 @property {Element} reviews_container - The container element for product reviews 12128*/ 12129 12130var state = { 12131 container: false, 12132 form: false, 12133 qty_selector: false, 12134 combo_box: false, 12135 atc_button: false, 12136 top_bar: false, 12137 all_swatches: false, 12138 dynamic_elems: false, 12139 accordion_group_container: false, 12140 reviews_container: false 12141}; 12142 12143/** 12144 Initializes the subscription form by setting up various elements and components. 12145*/ 12146var _initForm = function _initForm() { 12147 state.container = document.getElementById("subscription-barba-container"); 12148 state.form = document.querySelector("product-form"); 12149 if (!state.container || !state.form) return; 12150 try { 12151 state.qty_selector = new _global__WEBPACK_IMPORTED_MODULE_2__.QtySelector(state.form); 12152 state.combo_box = new _global__WEBPACK_IMPORTED_MODULE_2__.ComboBox(state.form); 12153 state.atc_button = new _global__WEBPACK_IMPORTED_MODULE_2__.AddToCart(state.form, state.qty_selector, state.combo_box); 12154 state.top_bar = new _global__WEBPACK_IMPORTED_MODULE_2__.TopBar(); 12155 } catch (e) { 12156 console.error(e); 12157 } 12158 state.all_swatches = state.form.querySelectorAll(".product-swatch"); 12159 state.dynamic_elems = document.querySelectorAll("[data-update]"); 12160 state.accordion_group_container = document.getElementById("accordion-group-container"); 12161 state.reviews_container = document.getElementById("reviews_container"); 12162 state.all_swatches.forEach(function (swatchEl) { 12163 swatchEl.addEventListener("click", _handleUpdate); 12164 }); 12165 (0,_animations__WEBPACK_IMPORTED_MODULE_0__.fadeIn)(state.container); 12166}; 12167 12168/** 12169 Event handler that updates various elements on the page based on the clicked swatch. 12170 @param {Event} e - The event object triggered by the click event. 12171*/ 12172var _handleUpdate = function _handleUpdate(e) { 12173 var newSwatchEl = e.currentTarget; 12174 var newProductHandle = newSwatchEl.dataset.handle; 12175 (0,_animations__WEBPACK_IMPORTED_MODULE_0__.updateColors)(newSwatchEl); 12176 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.toggleDisplay)(newProductHandle, state.accordion_group_container, "product-accordion"); 12177 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.toggleDisplay)(newProductHandle, state.reviews_container, "subscription-reviews"); 12178 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.updateDynamicElems)(newSwatchEl, state.dynamic_elems, state.form); 12179}; 12180document.addEventListener("DOMContentLoaded", function (event) { 12181 if (document.body.dataset.suffix == "subscription") { 12182 _initForm(); 12183 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.initSection)("accordion-group", _global__WEBPACK_IMPORTED_MODULE_2__.Accordion); 12184 } 12185}); 12186 12187/***/ }), 12188
12189/***/ "./src/scripts/utils/index.js": 12190/*!************************************!*\ 12191 !*** ./src/scripts/utils/index.js ***! 12192 \************************************/ 12193/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12194 12195"use strict"; 12196__webpack_require__.r(__webpack_exports__); 12197/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12198/* harmony export */ "initSection": () => (/* reexport safe */ _initSection__WEBPACK_IMPORTED_MODULE_0__.initSection), 12199/* harmony export */ "toggleDisplay": () => (/* reexport safe */ _toggleDisplay__WEBPACK_IMPORTED_MODULE_1__.toggleDisplay), 12200/* harmony export */ "updateDynamicElems": () => (/* reexport safe */ _updateDynamicElems__WEBPACK_IMPORTED_MODULE_2__.updateDynamicElems) 12201/* harmony export */ }); 12202/* harmony import */ var _initSection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./initSection */ "./src/scripts/utils/initSection.js"); 12203/* harmony import */ var _toggleDisplay__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toggleDisplay */ "./src/scripts/utils/toggleDisplay.js"); 12204/* harmony import */ var _updateDynamicElems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./updateDynamicElems */ "./src/scripts/utils/updateDynamicElems.js"); 12205 12206 12207 12208 12209/***/ }), 12210
vendor: 3,175 bytes, lines 12211-12261
12211/***/ "./src/scripts/utils/initSection.js": 12212/*!******************************************!*\ 12213 !*** ./src/scripts/utils/initSection.js ***! 12214 \******************************************/ 12215/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12216 12217"use strict"; 12218__webpack_require__.r(__webpack_exports__); 12219/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12220/* harmony export */ "initSection": () => (/* binding */ initSection) 12221/* harmony export */ }); 12222function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 12223function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 12224function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } 12225/** 12226 * Initializes a set of section elements as instances of a given constructor function. 12227 * 12228 * @param {string} element - The CSS selector for the section elements to initialize. 12229 * @param {function} constructorFn - The constructor function to use for initialization. 12230 */ 12231 12232var initSection = function initSection(element, constructorFn) { 12233 if (!element || !constructorFn) { 12234 console.warn("Missing arguments for initSection."); 12235 return; 12236 } 12237 var sectionElements = document.querySelectorAll(element); 12238 if (!sectionElements) { 12239 console.warn("No section elements found for ".concat(element)); 12240 return; 12241 } 12242 var _iterator = _createForOfIteratorHelper(sectionElements), 12243 _step; 12244 try { 12245 for (_iterator.s(); !(_step = _iterator.n()).done;) { 12246 var sectionElement = _step.value; 12247 try { 12248 new constructorFn(sectionElement); 12249 } catch (err) { 12250 console.error("[initSection] Failed to initialize ".concat(element, ":"), sectionElement, err); 12251 } 12252 } 12253 } catch (err) { 12254 _iterator.e(err); 12255 } finally { 12256 _iterator.f(); 12257 } 12258}; 12259 12260/***/ }), 12261
12262/***/ "./src/scripts/utils/toggleDisplay.js": 12263/*!********************************************!*\ 12264 !*** ./src/scripts/utils/toggleDisplay.js ***! 12265 \********************************************/ 12266/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12267 12268"use strict"; 12269__webpack_require__.r(__webpack_exports__); 12270/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12271/* harmony export */ "toggleDisplay": () => (/* binding */ toggleDisplay) 12272/* harmony export */ }); 12273/** 12274 12275 Toggles the display of two elements in a given container. The two elements must have the same id, but different handles. 12276 The handle parameter is used to find the element to display, and the container's handle attribute is used to find the element to hide. 12277 The handle attribute is then updated to the new handle parameter. 12278 12279 @param {String} handle - The new product handle. 12280 @param {HTMLElement} container - The container element holding the two elements to toggle. 12281 @param {string} id - The identifier used to find the two elements to toggle. 12282 @returns {void} 12283*/ 12284 12285var toggleDisplay = function toggleDisplay(newHandle, container, id) { 12286 if (!newHandle || !container || !id) { 12287 console.warn("Missing arguments for toggleDisplay"); 12288 } 12289 var oldElem = container.querySelector("#".concat(id, "__").concat(container.dataset.handle)); 12290 var newElem = container.querySelector("#".concat(id, "__").concat(newHandle)); 12291 if (!oldElem || !newElem) { 12292 console.warn("No elements found for ".concat(id, "__").concat(newHandle)); 12293 return; 12294 } 12295 container.dataset.handle = newHandle; 12296 oldElem.style.display = "none"; 12297 newElem.style.display = "block"; 12298}; 12299 12300/***/ }), 12301
12302/***/ "./src/scripts/utils/updateDynamicElems.js": 12303/*!*************************************************!*\ 12304 !*** ./src/scripts/utils/updateDynamicElems.js ***! 12305 \*************************************************/ 12306/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12307 12308"use strict"; 12309__webpack_require__.r(__webpack_exports__); 12310/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12311/* harmony export */ "updateDynamicElems": () => (/* binding */ updateDynamicElems) 12312/* harmony export */ }); 12313/** 12314 Updates dynamic elements based on a trigger element's dataset. 12315 @param {HTMLElement} trigger - The element that triggered the update. 12316 @param {Array<HTMLElement>} allDynamicElems - An array of all dynamic elements to be updated. 12317 @returns {void} 12318*/ 12319 12320var updateDynamicElems = function updateDynamicElems(trigger, allDynamicElems) { 12321 var formEl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 12322 if (!trigger || !allDynamicElems) { 12323 console.warn("Missing arguments for updateDynamicElems."); 12324 return; 12325 } 12326 var dataset = trigger.dataset; 12327 allDynamicElems.forEach(function (dynamicEl) { 12328 // eslint-disable-next-line no-prototype-builtins 12329 if (dataset.hasOwnProperty(dynamicEl.dataset.update)) { 12330 var newProperty = dynamicEl.dataset.update; 12331 switch (newProperty) { 12332 case "image": 12333 dynamicEl.src = dataset[newProperty]; 12334 dynamicEl.alt = dataset.title; 12335 break; 12336 case "variant": 12337 if (formEl) { 12338 formEl.dataset.productVariant = dataset[newProperty]; 12339 } 12340 dynamicEl.value = dataset[newProperty]; 12341 break; 12342 case "handle": 12343 dynamicEl.dataset.handle = dataset[newProperty]; 12344 break; 12345 default: 12346 if (!dynamicEl.children || !dynamicEl.children.length) { 12347 dynamicEl.innerText = dataset[newProperty]; 12348 } else { 12349 dynamicEl.children[dynamicEl.children.length - 1].innerText = dataset[newProperty]; 12350 } 12351 } 12352 } 12353 }); 12354}; 12355 12356/***/ }), 12357 12358/***/ "data:image/svg+xml,%3Csvg width=%2719%27 height=%2719%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M15.514.535l-6.42 6.42L2.677.536a1.517 1.517 0 00-2.14 0 1.517 1.517 0 000 2.14l6.42 6.419-6.42 6.419a1.517 1.517 0 000 2.14 1.517 1.517 0 002.14 0l6.419-6.42 6.419 6.42a1.517 1.517 0 002.14 0 1.517 1.517 0 000-2.14l-6.42-6.42 6.42-6.418a1.517 1.517 0 000-2.14 1.516 1.516 0 00-2.14 0z%27 fill=%27%23FFF%27 fill-rule=%27nonzero%27/%3E%3C/svg%3E": 12359/*!*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ 12360 !*** data:image/svg+xml,%3Csvg width=%2719%27 height=%2719%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M15.514.535l-6.42 6.42L2.677.536a1.517 1.517 0 00-2.14 0 1.517 1.517 0 000 2.14l6.42 6.419-6.42 6.419a1.517 1.517 0 000 2.14 1.517 1.517 0 002.14 0l6.419-6.42 6.419 6.42a1.517 1.517 0 002.14 0 1.517 1.517 0 000-2.14l-6.42-6.42 6.42-6.418a1.517 1.517 0 000-2.14 1.516 1.516 0 00-2.14 0z%27 fill=%27%23FFF%27 fill-rule=%27nonzero%27/%3E%3C/svg%3E ***! 12361 \*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ 12362/***/ ((module) => { 12363 12364"use strict"; 12365module.exports = "data:image/svg+xml,%3Csvg width=%2719%27 height=%2719%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath d=%27M15.514.535l-6.42
123656.42L2.677.536a1.517 1.517 0 00-2.14 0 1.517 1.517 0 000 2.14l6.42 6.419-6.42 6.419a1.517 1.517 0 000 2.14 1.517 1.517 0 002.14 0l6.419-6.42 6.419 6.42a1.517 1.517 0 002.14 0 1.517 1.517 0 000-2.14l-6.42-6.42 6.42-6.418a1.517 1.517 0 000-2.14 1.516 1.516 0 00-2.14 0z%27 fill=%27%23FFF%27 fill-rule=%27nonzero%27/%3E%3C/svg%3E"; 12366 12367/***/ }), 12368
12369/***/ "./src/olipop/graphql/product.graphql": 12370/*!********************************************!*\ 12371 !*** ./src/olipop/graphql/product.graphql ***! 12372 \********************************************/ 12373/***/ ((module) => { 12374 12375"use strict"; 12376module.exports = "query Product($id: ID!) {\n product(id: $id) {\n id\n handle\n title\n variants(first: 1) {\n nodes {\n id\n sellingPlanAllocations(first: 3) {\n nodes {\n sellingPlan {\n id\n }\n priceAdjustments {\n price {\n amount\n }\n compareAtPrice {\n amount\n }\n }\n }\n }\n }\n }\n color: metafield(namespace: \"color_theme\", key: \"dark\") {\n value\n }\n metafield(namespace: \"switch_to_subscription\", key: \"featured_image\") {\n reference {\n ... on MediaImage {\n image {\n url\n }\n }\n }\n }\n featuredImage {\n altText\n url\n width\n height\n }\n priceRange {\n minVariantPrice {\n amount\n }\n }\n sellingPlanGroups(first: 10) {\n nodes {\n name\n sellingPlans(first: 10) {\n nodes {\n priceAdjustments {\n adjustmentValue {\n ... on SellingPlanFixedAmountPriceAdjustment {\n adjustmentAmount {\n amount\n }\n }\n ... on SellingPlanFixedPriceAdjustment {\n price {\n amount\n }\n }\n ... on SellingPlanPercentagePriceAdjustment {\n adjustmentPercentage\n }\n }\n }\n name\n id\n options {\n name\n value\n }\n }\n }\n }\n }\n }\n}\n"; 12377 12378/***/ })
12378 12379 12380}, 12381/******/ __webpack_require__ => { // webpackRuntimeModules 12382/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) 12383/******/ __webpack_require__.O(0, ["vendor"], () => (__webpack_exec__("./src/olipop/index.ts"), __webpack_exec__("./src/scripts/templates/blog.js"), __webpack_exec__("./src/scripts/templates/bundle-builder.js"), __webpack_exec__("./src/scripts/templates/collection.js"), __webpack_exec__("./src/scripts/templates/global.js"), __webpack_exec__("./src/scripts/templates/index.js"), __webpack_exec__("./src/scripts/templates/page.bundle-builder.js"), __webpack_exec__("./src/scripts/templates/page.dietitian.js"), __webpack_exec__("./src/scripts/templates/page.digestive-health.js"), __webpack_exec__("./src/scripts/templates/page.faq.js"), __webpack_exec__("./src/scripts/templates/page.ingredients.js"), __webpack_exec__("./src/scripts/templates/page.our-story.js"), __webpack_exec__("./src/scripts/templates/page.subscription.js"))); 12384/******/ var __webpack_exports__ = __webpack_require__.O(); 12385/******/ } 12386]); 12387//# sourceMappingURL=app.min.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.