@best-bundles/bundle-ui 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/BundleProvider.d.ts.map +1 -1
- package/dist/index.js +291 -288
- package/dist/index.js.map +1 -1
- package/dist/liquid/bundle-ui.iife.js +10 -10
- package/dist/liquid/bundle-ui.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode('._button_18rtl_1{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-family:var(--bb-font-family, inherit);border:1px solid var(--bb-button-border, rgba(0, 0, 0, .12));background:var(--bb-button-bg, #111827);color:var(--bb-button-text, #ffffff);font:inherit;line-height:1;padding:10px 14px;border-radius:var(--bb-button-radius, 10px);cursor:pointer;transition:transform .12s ease,background .12s ease,border-color .12s ease,opacity .12s ease}._button_18rtl_1:hover{background:var(--bb-button-bg-hover, #0b1220)}._button_18rtl_1:active{transform:translateY(1px)}._button_18rtl_1:disabled{opacity:.6;cursor:not-allowed}._button_18rtl_1:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._backdrop_vl21a_1{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--bb-backdrop-z-index, 9999);display:flex;justify-content:flex-end;background:var(--bb-backdrop-bg, rgba(0, 0, 0, .5));-webkit-backdrop-filter:blur(var(--bb-backdrop-blur, 2px));backdrop-filter:blur(var(--bb-backdrop-blur, 2px));padding:var(--bb-backdrop-padding, 12px);opacity:0;transition:opacity var(--bb-drawer-transition-duration, .22s) ease}._celebrationOverlay_vl21a_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_vl21a_23{font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.03em;font-size:18px;line-height:1;padding:12px 16px;border-radius:999px;color:#0b1b44;background:linear-gradient(180deg,#fff,#bae6fd);border:2px solid rgba(37,99,235,.28);box-shadow:0 18px 55px #0006,0 10px 28px #2563eb33,inset 0 1px #ffffffbf;transform-origin:50% 60%;will-change:transform,opacity,filter;animation:_bbCelebrationPop_vl21a_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_vl21a_1{0%{opacity:0;transform:translateY(10px) scale(.6);filter:blur(1px) saturate(1.1)}12%{opacity:1;transform:translateY(0) scale(1.12);filter:blur(0px) saturate(1.1)}22%{opacity:1;transform:translateY(0) scale(1)}80%{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(-10px) scale(.98)}}._backdropOpen_vl21a_74{opacity:1}._backdropClosed_vl21a_78{opacity:0}._panel_vl21a_82{width:440px;max-width:100%;height:100%;background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);border-radius:var(--bb-panel-radius, 16px);box-shadow:0 20px 60px #00000059;display:grid;grid-template-rows:auto 1fr auto;overflow:hidden;outline:none;position:relative;top:unset;right:unset;bottom:unset;left:unset}._panelOpen_vl21a_102{animation:_bbSlideInFromRight_vl21a_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_vl21a_106{animation:_bbSlideOutToRight_vl21a_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_vl21a_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_vl21a_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_vl21a_1{transition:none}._celebrationChip_vl21a_23,._panelOpen_vl21a_102,._panelClosed_vl21a_106{animation:none}}._header_vl21a_145{display:grid;grid-template-columns:36px 1fr 36px;align-items:center;column-gap:12px;padding:var(--bb-header-padding, 16px 16px 12px 16px);border-bottom:1px solid var(--bb-border-color, rgba(17, 24, 39, .08))}._headerCenter_vl21a_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_vl21a_162{font-size:24px;margin:0;line-height:1.2;font-family:var(--bb-font-family-title, "Bebas Neue", "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.02em;color:var(--bb-title-color, var(--bb-text-color, #111827))}._searchIconButton_vl21a_171{width:36px;height:36px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}._searchIconButton_vl21a_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_vl21a_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_vl21a_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_vl21a_197{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transform:translateY(-2px);transition:opacity .18s ease,transform .22s ease}._headerSearchOpen_vl21a_209 ._headerTitleWrap_vl21a_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_vl21a_209 ._headerSearchWrap_vl21a_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_vl21a_221{width:min(320px,100%);height:36px;display:flex;align-items:center;gap:8px;background:var(--bb-surface-bg, #ffffff);border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));border-radius:10px;padding:0 8px}._searchInput_vl21a_233{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_vl21a_233::-webkit-search-cancel-button,._searchInput_vl21a_233::-webkit-search-decoration,._searchInput_vl21a_233::-webkit-search-results-button,._searchInput_vl21a_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_vl21a_254{border:none;background:transparent;color:var(--bb-text-color, #111827);font:inherit;font-size:13px;font-weight:700;cursor:pointer;padding:6px;border-radius:10px;line-height:1}._searchClearButton_vl21a_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_vl21a_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_vl21a_276{border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);width:36px;height:36px;border-radius:10px;cursor:pointer;flex:0 0 auto}._closeButton_vl21a_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_vl21a_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_vl21a_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_vl21a_193,._headerSearchWrap_vl21a_197{transition:none}}._body_vl21a_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_vl21a_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_vl21a_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_vl21a_324{margin-top:4px}._variantList_vl21a_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_vl21a_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_vl21a_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_vl21a_351{height:100%;align-self:stretch;border-radius:12px;border:none;background:var(--bb-cta-bg, #91aae5);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:800;padding:0 16px;cursor:pointer;white-space:nowrap}._addToBundleButton_vl21a_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_vl21a_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_vl21a_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_vl21a_379{width:60px;height:60px;border-radius:12px;overflow:hidden;border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));flex:0 0 auto}._variantThumbImg_vl21a_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_vl21a_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_vl21a_406{min-width:0}._variantName_vl21a_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_vl21a_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_vl21a_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_vl21a_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_vl21a_427{font-size:13px;font-weight:800}._qtyControls_vl21a_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_vl21a_451{width:34px;height:34px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);cursor:pointer;line-height:1;font-size:16px}._qtyButton_vl21a_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_vl21a_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_vl21a_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_vl21a_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_vl21a_483{padding:var(--bb-footer-padding, 12px 16px 16px 16px);border-top:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);position:relative}._poweredBy_vl21a_490{font-size:10px;color:var(rgba(17, 24, 39, .6));text-align:center;margin-top:10px}._poweredBy_vl21a_490 a{color:inherit;text-decoration:none}._boxSummaryWindow_vl21a_502{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_vl21a_502::-webkit-scrollbar{display:none}._boxSummaryRow_vl21a_519{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_vl21a_527{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_vl21a_535{width:100%;aspect-ratio:1 / 1;border-radius:12px;position:relative;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;box-sizing:border-box}._boxItemClickable_vl21a_547{cursor:pointer}._boxItemClickable_vl21a_547:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_vl21a_556{font-size:11px;line-height:1.15;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._boxItemPlaceholder_vl21a_567{border:1px dashed var(--bb-border-strong-color, rgba(17, 24, 39, .18));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));color:var(--bb-muted-color, rgba(17, 24, 39, .6))}._boxItemFilled_vl21a_573{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_vl21a_579{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:linear-gradient(180deg,#2563eb1a,#2563eb08);color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_vl21a_587{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_vl21a_595{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_vl21a_602{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_vl21a_609{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .04));color:var(--bb-text-color, #111827);font-weight:800}._ctaButtonGroup_vl21a_620{display:flex;gap:8px;width:100%;transition:gap .3s cubic-bezier(.4,0,.2,1)}._ctaButtonGroupAnimating_vl21a_627{gap:0}._cta_vl21a_620{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer}._ctaSecondary_vl21a_643{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer}._ctaDualLeft_vl21a_655{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),background .3s cubic-bezier(.4,0,.2,1),color .3s cubic-bezier(.4,0,.2,1),border-right-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualLeftAnimating_vl21a_673{border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0;background:var(--bb-cta-bg, #2563eb);opacity:.6;color:var(--bb-cta-text, #ffffff)}._ctaDualLeftAnimating_vl21a_673>span{opacity:0}._ctaDualRight_vl21a_686{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),border-left-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualRightAnimating_vl21a_702{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;opacity:.6}._ctaDualRightAnimating_vl21a_702>span{opacity:0}._ctaTotals_vl21a_713{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_vl21a_721{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;background:linear-gradient(180deg,#2563eb24,#2563eb0f);border:1px solid rgba(37,99,235,.3);color:#1d4ed8f2;white-space:nowrap}._ctaTotalsWrap_vl21a_735{overflow:hidden;max-height:0;opacity:0;transform:translateY(4px);margin-bottom:0;transition:max-height .22s ease,opacity .16s ease,transform .22s ease,margin-bottom .22s ease}._ctaTotalsWrapVisible_vl21a_748{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_vl21a_755{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_vl21a_762{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_vl21a_735{transition:none}}._cta_vl21a_620:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_vl21a_620:disabled{opacity:.6;cursor:not-allowed}._cta_vl21a_620:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaSecondary_vl21a_643:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaSecondary_vl21a_643:disabled{opacity:.6;cursor:not-allowed}._ctaSecondary_vl21a_643:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualLeft_vl21a_655:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaDualLeft_vl21a_655:disabled{opacity:.6;cursor:not-allowed}._ctaDualLeft_vl21a_655:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualRight_vl21a_686:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._ctaDualRight_vl21a_686:disabled{opacity:.6;cursor:not-allowed}._ctaDualRight_vl21a_686:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_vl21a_831{margin-top:8px;font-size:12px;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center}@media(max-width:767px){._backdrop_vl21a_1{padding:0;justify-content:stretch}._panel_vl21a_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import { jsx as h, jsxs as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsx as h, jsxs as O, Fragment as fe } from "react/jsx-runtime";
|
|
3
|
+
import Dt, { useState as k, useRef as U, useEffect as z, useCallback as ut, useMemo as M, createContext as me, useContext as pe, forwardRef as ce, createElement as jt } from "react";
|
|
4
|
+
const At = {
|
|
5
5
|
bundleId: "_bundle_id",
|
|
6
6
|
bundleConfig: "_bundle_config",
|
|
7
7
|
bundleSource: "_bundle_source",
|
|
@@ -17,12 +17,12 @@ async function be(i) {
|
|
|
17
17
|
})).json().catch(() => null);
|
|
18
18
|
return !a || typeof a != "object" ? { ok: !1, error: "Invalid response." } : a;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
20
|
+
const re = "bb_anonymous_user_id";
|
|
21
|
+
function Rt() {
|
|
22
22
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
23
23
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
24
24
|
try {
|
|
25
|
-
const i = localStorage.getItem(
|
|
25
|
+
const i = localStorage.getItem(re);
|
|
26
26
|
if (i && typeof i == "string" && i.length > 0)
|
|
27
27
|
return i;
|
|
28
28
|
let t;
|
|
@@ -35,12 +35,12 @@ function At() {
|
|
|
35
35
|
} catch {
|
|
36
36
|
t = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
37
37
|
}
|
|
38
|
-
return localStorage.setItem(
|
|
38
|
+
return localStorage.setItem(re, t), t;
|
|
39
39
|
} catch {
|
|
40
40
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
async function
|
|
43
|
+
async function Ft(i, t, e) {
|
|
44
44
|
if (!(typeof window > "u"))
|
|
45
45
|
try {
|
|
46
46
|
const a = new URL(i, window.location.origin);
|
|
@@ -62,7 +62,7 @@ async function Rt(i, t, e) {
|
|
|
62
62
|
console.warn("[Bundle Analytics] Failed to track event:", a);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const le = me(null);
|
|
66
66
|
function ve() {
|
|
67
67
|
try {
|
|
68
68
|
const i = globalThis.crypto;
|
|
@@ -71,7 +71,7 @@ function ve() {
|
|
|
71
71
|
}
|
|
72
72
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function ae(i) {
|
|
75
75
|
return Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0;
|
|
76
76
|
}
|
|
77
77
|
function rr(i) {
|
|
@@ -84,79 +84,79 @@ function rr(i) {
|
|
|
84
84
|
configFetcher: l,
|
|
85
85
|
analyticsEndpoint: c,
|
|
86
86
|
children: m
|
|
87
|
-
} = i, w = c ?? `${t}/api/public/bundle-analytics`, [A, R] =
|
|
87
|
+
} = i, w = c ?? `${t}/api/public/bundle-analytics`, [A, R] = k(!1), [x, Z] = k(!n), [E, K] = k(!1), [L, P] = k(null), [F, V] = k((n == null ? void 0 : n.currencyCode) ?? null), [g, ht] = k((n == null ? void 0 : n.config) ?? null), [st, yt] = k(
|
|
88
88
|
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
89
|
-
), [
|
|
89
|
+
), [ft, Nt] = k(
|
|
90
90
|
() => ({ selections: {}, order: [] })
|
|
91
|
-
),
|
|
91
|
+
), Tt = U(null);
|
|
92
92
|
z(() => {
|
|
93
93
|
var D;
|
|
94
94
|
if (n) return;
|
|
95
|
-
(D =
|
|
95
|
+
(D = Tt.current) == null || D.abort();
|
|
96
96
|
const f = new AbortController();
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
return
|
|
97
|
+
Tt.current = f;
|
|
98
|
+
const I = l ?? be;
|
|
99
|
+
return Z(!0), P(null), I({ apiBaseUrl: t, shop: e, signal: f.signal }).then((y) => {
|
|
100
100
|
if (!y.ok) {
|
|
101
|
-
P(y.error || "Failed to load bundle config."),
|
|
101
|
+
P(y.error || "Failed to load bundle config."), ht(null), yt([]), V(null);
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
V(y.currencyCode ?? null),
|
|
104
|
+
V(y.currencyCode ?? null), ht(y.config), yt(y.eligibleVariants ?? []);
|
|
105
105
|
}).catch((y) => {
|
|
106
|
-
const
|
|
107
|
-
P(
|
|
108
|
-
}).finally(() =>
|
|
106
|
+
const nt = y instanceof Error ? y.message : "Failed to load bundle config.";
|
|
107
|
+
P(nt), ht(null), yt([]), V(null);
|
|
108
|
+
}).finally(() => Z(!1)), () => f.abort();
|
|
109
109
|
}, [t, e, n, l]);
|
|
110
|
-
const
|
|
110
|
+
const Mt = ut(() => {
|
|
111
111
|
if (R(!0), w)
|
|
112
112
|
try {
|
|
113
|
-
const f =
|
|
114
|
-
|
|
113
|
+
const f = Rt();
|
|
114
|
+
Ft(w, e, {
|
|
115
115
|
eventType: "DRAWER_OPENED",
|
|
116
116
|
shop: e,
|
|
117
117
|
anonymousUserId: f,
|
|
118
118
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
119
|
-
}).catch((
|
|
120
|
-
console.warn("[Bundle Analytics] Failed to track drawer opened:",
|
|
119
|
+
}).catch((I) => {
|
|
120
|
+
console.warn("[Bundle Analytics] Failed to track drawer opened:", I);
|
|
121
121
|
});
|
|
122
122
|
} catch (f) {
|
|
123
123
|
console.warn("[Bundle Analytics] Error in open() callback:", f);
|
|
124
124
|
}
|
|
125
|
-
}, [w, e]),
|
|
125
|
+
}, [w, e]), mt = ut(() => R(!1), []), Pt = ut(() => {
|
|
126
126
|
R((f) => {
|
|
127
127
|
if (!f && w)
|
|
128
128
|
try {
|
|
129
|
-
const
|
|
130
|
-
|
|
129
|
+
const I = Rt();
|
|
130
|
+
Ft(w, e, {
|
|
131
131
|
eventType: "DRAWER_OPENED",
|
|
132
132
|
shop: e,
|
|
133
|
-
anonymousUserId:
|
|
133
|
+
anonymousUserId: I,
|
|
134
134
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
135
135
|
}).catch((D) => {
|
|
136
136
|
console.warn("[Bundle Analytics] Failed to track drawer opened:", D);
|
|
137
137
|
});
|
|
138
|
-
} catch (
|
|
139
|
-
console.warn("[Bundle Analytics] Error in toggle() callback:",
|
|
138
|
+
} catch (I) {
|
|
139
|
+
console.warn("[Bundle Analytics] Error in toggle() callback:", I);
|
|
140
140
|
}
|
|
141
141
|
return !f;
|
|
142
142
|
});
|
|
143
|
-
}, [w, e]),
|
|
144
|
-
const f = Number((g == null ? void 0 : g.maxBundleSize) ?? NaN),
|
|
145
|
-
return Math.max(2, Math.min(100,
|
|
146
|
-
}, [g == null ? void 0 : g.maxBundleSize]),
|
|
147
|
-
if (!
|
|
143
|
+
}, [w, e]), kt = M(() => {
|
|
144
|
+
const f = Number((g == null ? void 0 : g.maxBundleSize) ?? NaN), I = Number.isFinite(f) ? Math.floor(f) : 100;
|
|
145
|
+
return Math.max(2, Math.min(100, I));
|
|
146
|
+
}, [g == null ? void 0 : g.maxBundleSize]), pt = M(() => new Set(st.map((f) => f.id)), [st]), J = ut((f, I) => {
|
|
147
|
+
if (!pt.has(f))
|
|
148
148
|
return;
|
|
149
|
-
const D =
|
|
150
|
-
|
|
151
|
-
const
|
|
149
|
+
const D = ae(I);
|
|
150
|
+
Nt((y) => {
|
|
151
|
+
const nt = y.selections[f] ?? 0, q = D - nt, G = Object.values(y.selections).reduce(($, Y) => $ + (Y || 0), 0), B = q > 0 ? Math.min(q, Math.max(0, kt - G)) : q, rt = nt + B;
|
|
152
152
|
let Q;
|
|
153
|
-
if (
|
|
153
|
+
if (rt <= 0) {
|
|
154
154
|
const { [f]: $, ...Y } = y.selections;
|
|
155
155
|
Q = Y;
|
|
156
|
-
} else
|
|
157
|
-
let
|
|
156
|
+
} else nt === rt ? Q = y.selections : Q = { ...y.selections, [f]: rt };
|
|
157
|
+
let at = y.order;
|
|
158
158
|
if (B > 0)
|
|
159
|
-
|
|
159
|
+
at = [...y.order, ...Array.from({ length: B }, () => f)];
|
|
160
160
|
else if (B < 0) {
|
|
161
161
|
let $ = -B;
|
|
162
162
|
const Y = [];
|
|
@@ -168,13 +168,13 @@ function rr(i) {
|
|
|
168
168
|
}
|
|
169
169
|
Y.push(S);
|
|
170
170
|
}
|
|
171
|
-
Y.reverse(),
|
|
171
|
+
Y.reverse(), at = Y;
|
|
172
172
|
}
|
|
173
|
-
if (Q === y.selections &&
|
|
173
|
+
if (Q === y.selections && at === y.order) return y;
|
|
174
174
|
if (w)
|
|
175
175
|
try {
|
|
176
|
-
const $ =
|
|
177
|
-
|
|
176
|
+
const $ = Rt();
|
|
177
|
+
Ft(w, e, {
|
|
178
178
|
eventType: "VARIANT_SELECTION_CHANGED",
|
|
179
179
|
shop: e,
|
|
180
180
|
anonymousUserId: $,
|
|
@@ -184,153 +184,156 @@ function rr(i) {
|
|
|
184
184
|
});
|
|
185
185
|
} catch {
|
|
186
186
|
}
|
|
187
|
-
return { selections: Q, order:
|
|
187
|
+
return { selections: Q, order: at };
|
|
188
188
|
});
|
|
189
|
-
}, [
|
|
190
|
-
const f = (g == null ? void 0 : g.rules) ?? [],
|
|
191
|
-
return Number.isFinite(
|
|
192
|
-
}, [g]),
|
|
193
|
-
var S;
|
|
194
|
-
if (!
|
|
195
|
-
const
|
|
189
|
+
}, [kt, pt, w, e]), bt = ut(() => Nt({ selections: {}, order: [] }), []), H = ft.selections, Ct = ft.order, ct = M(() => Object.values(H).reduce((f, I) => f + (I || 0), 0), [H]), tt = M(() => {
|
|
190
|
+
const f = (g == null ? void 0 : g.rules) ?? [], I = f.length ? Math.min(...f.map((D) => D.minBundleSize)) : 2;
|
|
191
|
+
return Number.isFinite(I) && I > 0 ? I : 2;
|
|
192
|
+
}, [g]), wt = M(() => !(x || E || L || !(g != null && g.isActive) || ct < tt), [ct, g == null ? void 0 : g.isActive, L, x, tt, E]), lt = ut(async (f) => {
|
|
193
|
+
var S, gt;
|
|
194
|
+
if (!wt || !g) return;
|
|
195
|
+
const I = ve(), D = (g.title ?? "").trim().slice(0, 255), y = Object.entries(H).map(([v, vt]) => ({ merchandiseId: v, quantity: ae(vt) })).filter((v) => v.quantity > 0).filter((v) => pt.has(v.merchandiseId)).map((v) => ({
|
|
196
196
|
merchandiseId: v.merchandiseId,
|
|
197
197
|
quantity: v.quantity,
|
|
198
198
|
attributes: [
|
|
199
|
-
{ key:
|
|
200
|
-
{ key:
|
|
201
|
-
{ key:
|
|
202
|
-
...D ? [{ key:
|
|
199
|
+
{ key: At.bundleId, value: I },
|
|
200
|
+
{ key: At.bundleConfig, value: r },
|
|
201
|
+
{ key: At.bundleSource, value: "bundle_builder" },
|
|
202
|
+
...D ? [{ key: At.bundleTitle, value: D }] : []
|
|
203
203
|
]
|
|
204
204
|
}));
|
|
205
205
|
if (!y.length) return;
|
|
206
|
-
const
|
|
206
|
+
const nt = new Map(st.map((v) => [v.id, v]));
|
|
207
207
|
let q = 0;
|
|
208
|
-
for (const [v,
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const
|
|
212
|
-
Number.isFinite(
|
|
208
|
+
for (const [v, vt] of Object.entries(H)) {
|
|
209
|
+
const xt = vt ?? 0;
|
|
210
|
+
if (xt <= 0) continue;
|
|
211
|
+
const it = nt.get(v), Ot = Number(it == null ? void 0 : it.price);
|
|
212
|
+
Number.isFinite(Ot) && (q += Ot * xt);
|
|
213
213
|
}
|
|
214
214
|
q = Math.round(q * 100) / 100;
|
|
215
|
-
const G = [...g.rules ?? []].sort((v,
|
|
215
|
+
const G = [...g.rules ?? []].sort((v, vt) => v.minBundleSize - vt.minBundleSize);
|
|
216
216
|
let B = null;
|
|
217
217
|
for (const v of G)
|
|
218
218
|
ct >= v.minBundleSize && (B = v);
|
|
219
|
-
const
|
|
219
|
+
const rt = B ? (() => {
|
|
220
220
|
const v = Number.parseFloat(B.discountPercent);
|
|
221
221
|
return Number.isFinite(v) && v > 0 ? v : null;
|
|
222
|
-
})() : null, Q =
|
|
223
|
-
|
|
222
|
+
})() : null, Q = rt ? Math.round(q * (1 - rt / 100) * 100) / 100 : q, at = q - Q, $ = y.map((v) => v.merchandiseId), Y = (B == null ? void 0 : B.handle) ?? "", T = ((S = B == null ? void 0 : B.label) == null ? void 0 : S.trim()) || "";
|
|
223
|
+
K(!0);
|
|
224
224
|
try {
|
|
225
225
|
if (await a.linesAdd(y), w)
|
|
226
226
|
try {
|
|
227
|
-
const v =
|
|
228
|
-
|
|
227
|
+
const v = Rt();
|
|
228
|
+
Ft(w, e, {
|
|
229
229
|
eventType: "BUNDLE_ADDED_TO_BASKET",
|
|
230
230
|
shop: e,
|
|
231
231
|
anonymousUserId: v,
|
|
232
|
-
bundleId:
|
|
232
|
+
bundleId: I,
|
|
233
233
|
productVariantIds: $,
|
|
234
234
|
grossPrice: q,
|
|
235
235
|
discountedPrice: Q,
|
|
236
236
|
currency: F ?? void 0,
|
|
237
237
|
discountThresholdIdentifier: Y,
|
|
238
238
|
discountLabel: T,
|
|
239
|
-
discountPercentage:
|
|
240
|
-
discountedAmount:
|
|
239
|
+
discountPercentage: rt,
|
|
240
|
+
discountedAmount: at,
|
|
241
241
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
242
242
|
});
|
|
243
243
|
} catch {
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
bt(), f != null && f.skipClose || mt(), (gt = f == null ? void 0 : f.onComplete) == null || gt.call(f);
|
|
246
246
|
} finally {
|
|
247
|
-
|
|
247
|
+
K(!1);
|
|
248
248
|
}
|
|
249
249
|
}, [
|
|
250
|
-
|
|
250
|
+
wt,
|
|
251
251
|
a,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
bt,
|
|
253
|
+
mt,
|
|
254
254
|
g,
|
|
255
255
|
r,
|
|
256
256
|
F,
|
|
257
|
-
|
|
258
|
-
|
|
257
|
+
H,
|
|
258
|
+
pt,
|
|
259
259
|
st,
|
|
260
260
|
ct,
|
|
261
261
|
w,
|
|
262
262
|
e
|
|
263
|
-
]), It =
|
|
264
|
-
await lt(() => {
|
|
263
|
+
]), It = ut(async () => {
|
|
264
|
+
await lt({ onComplete: () => {
|
|
265
265
|
var f;
|
|
266
266
|
(f = a.openCartUI) == null || f.call(a);
|
|
267
|
+
} });
|
|
268
|
+
}, [lt, a]), et = ut(async () => {
|
|
269
|
+
await lt({
|
|
270
|
+
skipClose: !0,
|
|
271
|
+
onComplete: () => {
|
|
272
|
+
var f;
|
|
273
|
+
(f = a.navigateToCheckout) == null || f.call(a);
|
|
274
|
+
}
|
|
267
275
|
});
|
|
268
|
-
}, [lt, a]),
|
|
269
|
-
await lt(() => {
|
|
270
|
-
var f;
|
|
271
|
-
(f = a.navigateToCheckout) == null || f.call(a);
|
|
272
|
-
});
|
|
273
|
-
}, [lt, a]), Dt = M(
|
|
276
|
+
}, [lt, a]), qt = M(
|
|
274
277
|
() => ({
|
|
275
278
|
isOpen: A,
|
|
276
|
-
open:
|
|
277
|
-
close:
|
|
278
|
-
toggle:
|
|
279
|
+
open: Mt,
|
|
280
|
+
close: mt,
|
|
281
|
+
toggle: Pt,
|
|
279
282
|
loading: x,
|
|
280
283
|
submitting: E,
|
|
281
284
|
error: L,
|
|
282
285
|
currencyCode: F,
|
|
283
286
|
config: g,
|
|
284
287
|
eligibleVariants: st,
|
|
285
|
-
selections:
|
|
286
|
-
selectionOrder:
|
|
287
|
-
setQuantity:
|
|
288
|
-
clearSelections:
|
|
288
|
+
selections: H,
|
|
289
|
+
selectionOrder: Ct,
|
|
290
|
+
setQuantity: J,
|
|
291
|
+
clearSelections: bt,
|
|
289
292
|
bundleSize: ct,
|
|
290
|
-
minRequired:
|
|
291
|
-
canSubmit:
|
|
293
|
+
minRequired: tt,
|
|
294
|
+
canSubmit: wt,
|
|
292
295
|
submit: It,
|
|
293
|
-
submitAndCheckout:
|
|
296
|
+
submitAndCheckout: et
|
|
294
297
|
}),
|
|
295
298
|
[
|
|
296
299
|
A,
|
|
297
|
-
Tt,
|
|
298
|
-
pt,
|
|
299
300
|
Mt,
|
|
301
|
+
mt,
|
|
302
|
+
Pt,
|
|
300
303
|
x,
|
|
301
304
|
E,
|
|
302
305
|
L,
|
|
303
306
|
F,
|
|
304
307
|
g,
|
|
305
308
|
st,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
H,
|
|
310
|
+
Ct,
|
|
311
|
+
J,
|
|
312
|
+
bt,
|
|
310
313
|
ct,
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
tt,
|
|
315
|
+
wt,
|
|
313
316
|
It,
|
|
314
|
-
|
|
317
|
+
et
|
|
315
318
|
]
|
|
316
319
|
);
|
|
317
|
-
return /* @__PURE__ */ h(
|
|
320
|
+
return /* @__PURE__ */ h(le.Provider, { value: qt, children: m });
|
|
318
321
|
}
|
|
319
|
-
function
|
|
320
|
-
const i = pe(
|
|
322
|
+
function Gt() {
|
|
323
|
+
const i = pe(le);
|
|
321
324
|
if (!i)
|
|
322
325
|
throw new Error("useBundleBuilder must be used within <BundleProvider />");
|
|
323
326
|
return i;
|
|
324
327
|
}
|
|
325
328
|
function ar() {
|
|
326
|
-
const { isOpen: i, open: t, close: e, toggle: a } =
|
|
329
|
+
const { isOpen: i, open: t, close: e, toggle: a } = Gt();
|
|
327
330
|
return { isOpen: i, open: t, close: e, toggle: a };
|
|
328
331
|
}
|
|
329
332
|
const _e = "_button_18rtl_1", ye = {
|
|
330
333
|
button: _e
|
|
331
334
|
};
|
|
332
335
|
function ir(i) {
|
|
333
|
-
const { toggle: t } =
|
|
336
|
+
const { toggle: t } = Gt();
|
|
334
337
|
return /* @__PURE__ */ h(
|
|
335
338
|
"button",
|
|
336
339
|
{
|
|
@@ -341,10 +344,10 @@ function ir(i) {
|
|
|
341
344
|
}
|
|
342
345
|
);
|
|
343
346
|
}
|
|
344
|
-
var
|
|
347
|
+
var zt, ie;
|
|
345
348
|
function we() {
|
|
346
|
-
if (
|
|
347
|
-
|
|
349
|
+
if (ie) return zt;
|
|
350
|
+
ie = 1;
|
|
348
351
|
var i = {
|
|
349
352
|
linear: function(t, e, a, r) {
|
|
350
353
|
var n = a - e;
|
|
@@ -471,7 +474,7 @@ function we() {
|
|
|
471
474
|
return t < r / 2 ? (l = i.easeInBounce(t * 2, 0, n, r), l * 0.5 + e) : (l = i.easeOutBounce(t * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + e);
|
|
472
475
|
}
|
|
473
476
|
};
|
|
474
|
-
return
|
|
477
|
+
return zt = i, zt;
|
|
475
478
|
}
|
|
476
479
|
var ge = we();
|
|
477
480
|
function xe(i) {
|
|
@@ -480,41 +483,41 @@ function xe(i) {
|
|
|
480
483
|
function W(i, t) {
|
|
481
484
|
return i + Math.random() * (t - i);
|
|
482
485
|
}
|
|
483
|
-
function
|
|
486
|
+
function Ce(i, t) {
|
|
484
487
|
return Math.floor(i + Math.random() * (t - i + 1));
|
|
485
488
|
}
|
|
486
|
-
var
|
|
489
|
+
var St;
|
|
487
490
|
(function(i) {
|
|
488
491
|
i[i.Circle = 0] = "Circle", i[i.Square = 1] = "Square", i[i.Strip = 2] = "Strip";
|
|
489
|
-
})(
|
|
490
|
-
var
|
|
492
|
+
})(St || (St = {}));
|
|
493
|
+
var dt;
|
|
491
494
|
(function(i) {
|
|
492
495
|
i[i.Positive = 1] = "Positive", i[i.Negative = -1] = "Negative";
|
|
493
|
-
})(
|
|
494
|
-
const
|
|
496
|
+
})(dt || (dt = {}));
|
|
497
|
+
const Ie = 1e3 / 60;
|
|
495
498
|
class Be {
|
|
496
499
|
constructor(t, e, a, r) {
|
|
497
500
|
this.getOptions = e;
|
|
498
501
|
const { colors: n, initialVelocityX: l, initialVelocityY: c } = this.getOptions();
|
|
499
|
-
this.context = t, this.x = a, this.y = r, this.w = W(5, 20), this.h = W(5, 20), this.radius = W(5, 10), this.vx = typeof l == "number" ? W(-l, l) : W(l.min, l.max), this.vy = typeof c == "number" ? W(-c, 0) : W(c.min, c.max), this.shape =
|
|
502
|
+
this.context = t, this.x = a, this.y = r, this.w = W(5, 20), this.h = W(5, 20), this.radius = W(5, 10), this.vx = typeof l == "number" ? W(-l, l) : W(l.min, l.max), this.vy = typeof c == "number" ? W(-c, 0) : W(c.min, c.max), this.shape = Ce(0, 2), this.angle = xe(W(0, 360)), this.angularSpin = W(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = W(0, 1), this.rotationDirection = W(0, 1) ? dt.Positive : dt.Negative;
|
|
500
503
|
}
|
|
501
504
|
update(t) {
|
|
502
|
-
const { gravity: e, wind: a, friction: r, opacity: n, drawShape: l } = this.getOptions(), c = t /
|
|
503
|
-
this.x += this.vx * c, this.y += this.vy * c, this.vy += e * c, this.vx += a * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection ===
|
|
505
|
+
const { gravity: e, wind: a, friction: r, opacity: n, drawShape: l } = this.getOptions(), c = t / Ie;
|
|
506
|
+
this.x += this.vx * c, this.y += this.vy * c, this.vy += e * c, this.vx += a * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection === dt.Positive ? this.rotationDirection = dt.Negative : this.rotateY <= -1 && this.rotationDirection === dt.Negative && (this.rotationDirection = dt.Positive);
|
|
504
507
|
const m = 0.1 * this.rotationDirection * c;
|
|
505
508
|
if (this.rotateY += m, this.angle += this.angularSpin, this.context.save(), this.context.translate(this.x, this.y), this.context.rotate(this.angle), this.context.scale(1, this.rotateY), this.context.rotate(this.angle), this.context.beginPath(), this.context.fillStyle = this.color, this.context.strokeStyle = this.color, this.context.globalAlpha = n, this.context.lineCap = "round", this.context.lineWidth = 2, l && typeof l == "function")
|
|
506
509
|
l.call(this, this.context);
|
|
507
510
|
else
|
|
508
511
|
switch (this.shape) {
|
|
509
|
-
case
|
|
512
|
+
case St.Circle: {
|
|
510
513
|
this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
|
|
511
514
|
break;
|
|
512
515
|
}
|
|
513
|
-
case
|
|
516
|
+
case St.Square: {
|
|
514
517
|
this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
|
|
515
518
|
break;
|
|
516
519
|
}
|
|
517
|
-
case
|
|
520
|
+
case St.Strip: {
|
|
518
521
|
this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
|
|
519
522
|
break;
|
|
520
523
|
}
|
|
@@ -530,23 +533,23 @@ class Se {
|
|
|
530
533
|
const r = W(this.x, this.w + this.x), n = W(this.y, this.h + this.y);
|
|
531
534
|
return new Be(this.context, this.getOptions, r, n);
|
|
532
535
|
}, this.animate = (r) => {
|
|
533
|
-
const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: w, recycle: A, numberOfPieces: R, debug: x, tweenFunction:
|
|
536
|
+
const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: w, recycle: A, numberOfPieces: R, debug: x, tweenFunction: Z, tweenDuration: E } = this.getOptions();
|
|
534
537
|
if (!w)
|
|
535
538
|
return !1;
|
|
536
|
-
const
|
|
539
|
+
const K = this.particles.length, L = A ? K : c;
|
|
537
540
|
if (L < R) {
|
|
538
541
|
m !== R && (this.tweenProgress = 0, this.tweenFrom = L, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(E, Math.max(0, this.tweenProgress + r));
|
|
539
|
-
const P =
|
|
542
|
+
const P = Z(this.tweenProgress, this.tweenFrom, R, E), F = Math.round(P - L);
|
|
540
543
|
for (let V = 0; V < F; V++)
|
|
541
544
|
this.particles.push(this.getParticle());
|
|
542
545
|
this.particlesGenerated += F;
|
|
543
546
|
}
|
|
544
|
-
x && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${
|
|
547
|
+
x && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${K}`, n.width - 10, n.height - 20));
|
|
545
548
|
for (let P = this.particles.length - 1; P >= 0; P--) {
|
|
546
549
|
const F = this.particles[P];
|
|
547
550
|
F.update(r), (F.y > n.height || F.y < -100 || F.x > n.width + 100 || F.x < -100) && (A && L <= R ? this.particles[P] = this.getParticle() : this.removeParticleAt(P));
|
|
548
551
|
}
|
|
549
|
-
return
|
|
552
|
+
return K > 0 || L < R;
|
|
550
553
|
}, this.canvas = t;
|
|
551
554
|
const a = this.canvas.getContext("2d");
|
|
552
555
|
if (!a)
|
|
@@ -554,7 +557,7 @@ class Se {
|
|
|
554
557
|
this.context = a, this.getOptions = e;
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
|
-
const
|
|
560
|
+
const Qt = {
|
|
558
561
|
width: typeof window < "u" ? window.innerWidth : 300,
|
|
559
562
|
height: typeof window < "u" ? window.innerHeight : 200,
|
|
560
563
|
numberOfPieces: 200,
|
|
@@ -602,7 +605,7 @@ class Ne {
|
|
|
602
605
|
};
|
|
603
606
|
this._options = {
|
|
604
607
|
...n,
|
|
605
|
-
...
|
|
608
|
+
...Qt,
|
|
606
609
|
...r
|
|
607
610
|
}, Object.assign(this, r.confettiSource);
|
|
608
611
|
}, this.update = (r = 0) => {
|
|
@@ -631,26 +634,26 @@ class Ne {
|
|
|
631
634
|
this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && a === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
|
|
632
635
|
}
|
|
633
636
|
}
|
|
634
|
-
const Te =
|
|
635
|
-
class
|
|
637
|
+
const Te = Dt.createRef();
|
|
638
|
+
class Yt extends Dt.Component {
|
|
636
639
|
constructor(t) {
|
|
637
|
-
super(t), this.canvas =
|
|
640
|
+
super(t), this.canvas = Dt.createRef(), this.canvas = t.canvasRef || Te;
|
|
638
641
|
}
|
|
639
642
|
componentDidMount() {
|
|
640
643
|
if (this.canvas.current) {
|
|
641
|
-
const t =
|
|
644
|
+
const t = Wt(this.props)[0];
|
|
642
645
|
this.confetti = new Ne(this.canvas.current, t);
|
|
643
646
|
}
|
|
644
647
|
}
|
|
645
648
|
componentDidUpdate() {
|
|
646
|
-
const t =
|
|
649
|
+
const t = Wt(this.props)[0];
|
|
647
650
|
this.confetti && (this.confetti.options = t);
|
|
648
651
|
}
|
|
649
652
|
componentWillUnmount() {
|
|
650
653
|
this.confetti && this.confetti.stop(), this.confetti = void 0;
|
|
651
654
|
}
|
|
652
655
|
render() {
|
|
653
|
-
const [t, e] =
|
|
656
|
+
const [t, e] = Wt(this.props), a = {
|
|
654
657
|
zIndex: 2,
|
|
655
658
|
position: "absolute",
|
|
656
659
|
pointerEvents: "none",
|
|
@@ -663,13 +666,13 @@ class Qt extends Ft.Component {
|
|
|
663
666
|
return h("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: a });
|
|
664
667
|
}
|
|
665
668
|
}
|
|
666
|
-
|
|
667
|
-
...
|
|
669
|
+
Yt.defaultProps = {
|
|
670
|
+
...Qt
|
|
668
671
|
};
|
|
669
|
-
|
|
670
|
-
function
|
|
672
|
+
Yt.displayName = "ReactConfetti";
|
|
673
|
+
function Wt(i) {
|
|
671
674
|
const t = {}, e = {}, a = {}, r = [
|
|
672
|
-
...Object.keys(
|
|
675
|
+
...Object.keys(Qt),
|
|
673
676
|
"confettiSource",
|
|
674
677
|
"drawShape",
|
|
675
678
|
"onConfettiComplete",
|
|
@@ -681,20 +684,20 @@ function zt(i) {
|
|
|
681
684
|
}
|
|
682
685
|
return [t, a, e];
|
|
683
686
|
}
|
|
684
|
-
const Me =
|
|
687
|
+
const Me = Dt.forwardRef((i, t) => h(Yt, { canvasRef: t, ...i }));
|
|
685
688
|
/**
|
|
686
689
|
* @license lucide-react v0.515.0 - ISC
|
|
687
690
|
*
|
|
688
691
|
* This source code is licensed under the ISC license.
|
|
689
692
|
* See the LICENSE file in the root directory of this source tree.
|
|
690
693
|
*/
|
|
691
|
-
const Pe = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
694
|
+
const Pe = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ke = (i) => i.replace(
|
|
692
695
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
693
696
|
(t, e, a) => a ? a.toUpperCase() : e.toLowerCase()
|
|
694
|
-
),
|
|
695
|
-
const t =
|
|
697
|
+
), oe = (i) => {
|
|
698
|
+
const t = ke(i);
|
|
696
699
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
697
|
-
},
|
|
700
|
+
}, ue = (...i) => i.filter((t, e, a) => !!t && t.trim() !== "" && a.indexOf(t) === e).join(" ").trim(), Oe = (i) => {
|
|
698
701
|
for (const t in i)
|
|
699
702
|
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
700
703
|
return !0;
|
|
@@ -722,7 +725,7 @@ var Ae = {
|
|
|
722
725
|
* This source code is licensed under the ISC license.
|
|
723
726
|
* See the LICENSE file in the root directory of this source tree.
|
|
724
727
|
*/
|
|
725
|
-
const Re =
|
|
728
|
+
const Re = ce(
|
|
726
729
|
({
|
|
727
730
|
color: i = "currentColor",
|
|
728
731
|
size: t = 24,
|
|
@@ -732,7 +735,7 @@ const Re = se(
|
|
|
732
735
|
children: n,
|
|
733
736
|
iconNode: l,
|
|
734
737
|
...c
|
|
735
|
-
}, m) =>
|
|
738
|
+
}, m) => jt(
|
|
736
739
|
"svg",
|
|
737
740
|
{
|
|
738
741
|
ref: m,
|
|
@@ -741,12 +744,12 @@ const Re = se(
|
|
|
741
744
|
height: t,
|
|
742
745
|
stroke: i,
|
|
743
746
|
strokeWidth: a ? Number(e) * 24 / Number(t) : e,
|
|
744
|
-
className:
|
|
745
|
-
...!n && !
|
|
747
|
+
className: ue("lucide", r),
|
|
748
|
+
...!n && !Oe(c) && { "aria-hidden": "true" },
|
|
746
749
|
...c
|
|
747
750
|
},
|
|
748
751
|
[
|
|
749
|
-
...l.map(([w, A]) =>
|
|
752
|
+
...l.map(([w, A]) => jt(w, A)),
|
|
750
753
|
...Array.isArray(n) ? n : [n]
|
|
751
754
|
]
|
|
752
755
|
)
|
|
@@ -758,19 +761,19 @@ const Re = se(
|
|
|
758
761
|
* See the LICENSE file in the root directory of this source tree.
|
|
759
762
|
*/
|
|
760
763
|
const Fe = (i, t) => {
|
|
761
|
-
const e =
|
|
762
|
-
({ className: a, ...r }, n) =>
|
|
764
|
+
const e = ce(
|
|
765
|
+
({ className: a, ...r }, n) => jt(Re, {
|
|
763
766
|
ref: n,
|
|
764
767
|
iconNode: t,
|
|
765
|
-
className:
|
|
766
|
-
`lucide-${Pe(
|
|
768
|
+
className: ue(
|
|
769
|
+
`lucide-${Pe(oe(i))}`,
|
|
767
770
|
`lucide-${i}`,
|
|
768
771
|
a
|
|
769
772
|
),
|
|
770
773
|
...r
|
|
771
774
|
})
|
|
772
775
|
);
|
|
773
|
-
return e.displayName =
|
|
776
|
+
return e.displayName = oe(i), e;
|
|
774
777
|
};
|
|
775
778
|
/**
|
|
776
779
|
* @license lucide-react v0.515.0 - ISC
|
|
@@ -781,7 +784,7 @@ const Fe = (i, t) => {
|
|
|
781
784
|
const De = [
|
|
782
785
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
783
786
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
784
|
-
], qe = Fe("search", De), Ee = "_backdrop_vl21a_1", Le = "_celebrationOverlay_vl21a_14", $e = "_celebrationChip_vl21a_23", Ue = "_backdropOpen_vl21a_74", ze = "_backdropClosed_vl21a_78", We = "_panel_vl21a_82", Ve = "_panelOpen_vl21a_102", je = "_panelClosed_vl21a_106", Ge = "_header_vl21a_145", Qe = "_headerCenter_vl21a_154", Ye = "_title_vl21a_162", Ke = "_searchIconButton_vl21a_171", He = "_headerTitleWrap_vl21a_193", Xe = "_headerSearchWrap_vl21a_197", Ze = "_headerSearchOpen_vl21a_209", Je = "_searchBar_vl21a_221", tn = "_searchInput_vl21a_233", en = "_searchClearButton_vl21a_254", nn = "_closeButton_vl21a_276", rn = "_body_vl21a_309", an = "_muted_vl21a_314", on = "_error_vl21a_319", sn = "_variants_vl21a_324", cn = "_variantList_vl21a_328", ln = "_variantRow_vl21a_336", un = "_variantLeft_vl21a_344", dn = "_addToBundleButton_vl21a_351", hn = "_variantThumb_vl21a_379", fn = "_variantThumbImg_vl21a_389", mn = "_variantThumbFallback_vl21a_396", pn = "_variantInfo_vl21a_406", bn = "_variantName_vl21a_410", vn = "_variantMeta_vl21a_419", _n = "_variantPriceRow_vl21a_427", yn = "_variantCompareAt_vl21a_434", wn = "_variantPrice_vl21a_427", gn = "_qtyControls_vl21a_445", xn = "_qtyButton_vl21a_451",
|
|
787
|
+
], qe = Fe("search", De), Ee = "_backdrop_vl21a_1", Le = "_celebrationOverlay_vl21a_14", $e = "_celebrationChip_vl21a_23", Ue = "_backdropOpen_vl21a_74", ze = "_backdropClosed_vl21a_78", We = "_panel_vl21a_82", Ve = "_panelOpen_vl21a_102", je = "_panelClosed_vl21a_106", Ge = "_header_vl21a_145", Qe = "_headerCenter_vl21a_154", Ye = "_title_vl21a_162", Ke = "_searchIconButton_vl21a_171", He = "_headerTitleWrap_vl21a_193", Xe = "_headerSearchWrap_vl21a_197", Ze = "_headerSearchOpen_vl21a_209", Je = "_searchBar_vl21a_221", tn = "_searchInput_vl21a_233", en = "_searchClearButton_vl21a_254", nn = "_closeButton_vl21a_276", rn = "_body_vl21a_309", an = "_muted_vl21a_314", on = "_error_vl21a_319", sn = "_variants_vl21a_324", cn = "_variantList_vl21a_328", ln = "_variantRow_vl21a_336", un = "_variantLeft_vl21a_344", dn = "_addToBundleButton_vl21a_351", hn = "_variantThumb_vl21a_379", fn = "_variantThumbImg_vl21a_389", mn = "_variantThumbFallback_vl21a_396", pn = "_variantInfo_vl21a_406", bn = "_variantName_vl21a_410", vn = "_variantMeta_vl21a_419", _n = "_variantPriceRow_vl21a_427", yn = "_variantCompareAt_vl21a_434", wn = "_variantPrice_vl21a_427", gn = "_qtyControls_vl21a_445", xn = "_qtyButton_vl21a_451", Cn = "_qtyValue_vl21a_476", In = "_footer_vl21a_483", Bn = "_poweredBy_vl21a_490", Sn = "_boxSummaryWindow_vl21a_502", Nn = "_boxSummaryRow_vl21a_519", Tn = "_boxSlot_vl21a_527", Mn = "_boxItem_vl21a_535", Pn = "_boxItemClickable_vl21a_547", kn = "_boxThresholdLabel_vl21a_556", On = "_boxItemPlaceholder_vl21a_567", An = "_boxItemFilled_vl21a_573", Rn = "_boxItemThreshold_vl21a_579", Fn = "_boxItemDiscountText_vl21a_587", Dn = "_boxItemPlus_vl21a_595", qn = "_boxItemImage_vl21a_602", En = "_boxItemFallback_vl21a_609", Ln = "_ctaButtonGroup_vl21a_620", $n = "_ctaButtonGroupAnimating_vl21a_627", Un = "_cta_vl21a_620", zn = "_ctaDualLeft_vl21a_655", Wn = "_ctaDualLeftAnimating_vl21a_673", Vn = "_ctaDualRight_vl21a_686", jn = "_ctaDualRightAnimating_vl21a_702", Gn = "_ctaTotals_vl21a_713", Qn = "_ctaDiscountBadge_vl21a_721", Yn = "_ctaTotalsWrap_vl21a_735", Kn = "_ctaTotalsWrapVisible_vl21a_748", Hn = "_ctaTotalsStrike_vl21a_755", Xn = "_ctaTotalsPrice_vl21a_762", u = {
|
|
785
788
|
backdrop: Ee,
|
|
786
789
|
celebrationOverlay: Le,
|
|
787
790
|
celebrationChip: $e,
|
|
@@ -820,16 +823,16 @@ const De = [
|
|
|
820
823
|
variantPrice: wn,
|
|
821
824
|
qtyControls: gn,
|
|
822
825
|
qtyButton: xn,
|
|
823
|
-
qtyValue:
|
|
824
|
-
footer:
|
|
826
|
+
qtyValue: Cn,
|
|
827
|
+
footer: In,
|
|
825
828
|
poweredBy: Bn,
|
|
826
829
|
boxSummaryWindow: Sn,
|
|
827
830
|
boxSummaryRow: Nn,
|
|
828
831
|
boxSlot: Tn,
|
|
829
832
|
boxItem: Mn,
|
|
830
833
|
boxItemClickable: Pn,
|
|
831
|
-
boxThresholdLabel:
|
|
832
|
-
boxItemPlaceholder:
|
|
834
|
+
boxThresholdLabel: kn,
|
|
835
|
+
boxItemPlaceholder: On,
|
|
833
836
|
boxItemFilled: An,
|
|
834
837
|
boxItemThreshold: Rn,
|
|
835
838
|
boxItemDiscountText: Fn,
|
|
@@ -851,7 +854,7 @@ const De = [
|
|
|
851
854
|
ctaTotalsPrice: Xn
|
|
852
855
|
};
|
|
853
856
|
function or(i) {
|
|
854
|
-
var
|
|
857
|
+
var ne;
|
|
855
858
|
const {
|
|
856
859
|
isOpen: t,
|
|
857
860
|
close: e,
|
|
@@ -865,17 +868,17 @@ function or(i) {
|
|
|
865
868
|
selectionOrder: A,
|
|
866
869
|
setQuantity: R,
|
|
867
870
|
bundleSize: x,
|
|
868
|
-
minRequired:
|
|
871
|
+
minRequired: Z,
|
|
869
872
|
canSubmit: E,
|
|
870
|
-
submit:
|
|
873
|
+
submit: K,
|
|
871
874
|
submitAndCheckout: L
|
|
872
|
-
} =
|
|
875
|
+
} = Gt(), [P, F] = k(!1), [V, g] = k(""), ht = U(null), st = U(null), yt = U(null), [ft, Nt] = k(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Tt, Mt] = k(0), [mt, Pt] = k(null), [kt, pt] = k(!1), J = U(null), bt = U(x), H = 7e3, [Ct, ct] = k(0), [tt, wt] = k(null), [lt, It] = k(!1), et = U(null), qt = 2800, f = (o) => {
|
|
873
876
|
const s = Number.parseFloat(o);
|
|
874
877
|
return Number.isFinite(s) ? String(Math.round(s)) : o;
|
|
875
|
-
},
|
|
878
|
+
}, I = (o) => {
|
|
876
879
|
const s = (o ?? []).filter((d) => {
|
|
877
|
-
var
|
|
878
|
-
const b = (
|
|
880
|
+
var C, _;
|
|
881
|
+
const b = (C = d == null ? void 0 : d.name) == null ? void 0 : C.trim(), p = (_ = d == null ? void 0 : d.value) == null ? void 0 : _.trim();
|
|
879
882
|
return !(!b || !p || b.toLowerCase() === "title");
|
|
880
883
|
});
|
|
881
884
|
return s.length ? s.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
|
|
@@ -883,9 +886,9 @@ function or(i) {
|
|
|
883
886
|
var s;
|
|
884
887
|
return ((s = o.product) == null ? void 0 : s.title) ?? o.displayName ?? o.title;
|
|
885
888
|
}, y = (o) => {
|
|
886
|
-
const s = D(o), d =
|
|
889
|
+
const s = D(o), d = I(o.selectedOptions);
|
|
887
890
|
return [s, d].filter(Boolean).join(" — ");
|
|
888
|
-
}, [
|
|
891
|
+
}, [nt, q] = k(t), G = U(null), B = (o) => {
|
|
889
892
|
const s = Number(o);
|
|
890
893
|
if (!Number.isFinite(s)) return o;
|
|
891
894
|
if (l)
|
|
@@ -894,10 +897,10 @@ function or(i) {
|
|
|
894
897
|
} catch {
|
|
895
898
|
}
|
|
896
899
|
return `$${s.toFixed(2)}`;
|
|
897
|
-
},
|
|
900
|
+
}, rt = ((ne = c == null ? void 0 : c.title) == null ? void 0 : ne.trim()) || "Build your bundle", Q = M(() => {
|
|
898
901
|
const o = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(o) ? Math.floor(o) : 100;
|
|
899
902
|
return Math.max(2, Math.min(100, s));
|
|
900
|
-
}, [c == null ? void 0 : c.maxBundleSize]),
|
|
903
|
+
}, [c == null ? void 0 : c.maxBundleSize]), at = x >= Q, $ = M(() => [...m].sort((o, s) => o.displayName.localeCompare(s.displayName)), [m]), Y = M(() => {
|
|
901
904
|
const o = V.trim().toLowerCase();
|
|
902
905
|
if (!o) return $;
|
|
903
906
|
const s = o.split(/\s+/).filter(Boolean), d = (b) => {
|
|
@@ -906,39 +909,39 @@ function or(i) {
|
|
|
906
909
|
p.push(b.displayName), (_ = b.product) != null && _.title && p.push(b.product.title);
|
|
907
910
|
for (const N of b.selectedOptions ?? [])
|
|
908
911
|
p.push(N.name), p.push(N.value);
|
|
909
|
-
const
|
|
910
|
-
return s.every((N) =>
|
|
912
|
+
const C = p.join(" ").toLowerCase();
|
|
913
|
+
return s.every((N) => C.includes(N));
|
|
911
914
|
};
|
|
912
915
|
return $.filter(d);
|
|
913
|
-
}, [V, $]), T = M(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), S = M(() => Math.max(0,
|
|
916
|
+
}, [V, $]), T = M(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), S = M(() => Math.max(0, Z - x), [x, Z]), gt = M(() => {
|
|
914
917
|
let o = null;
|
|
915
918
|
for (const s of T)
|
|
916
919
|
x >= s.minBundleSize && (o = s);
|
|
917
920
|
return o;
|
|
918
|
-
}, [x, T]),
|
|
919
|
-
if (!
|
|
920
|
-
const o = Number.parseFloat(
|
|
921
|
+
}, [x, T]), v = M(() => {
|
|
922
|
+
if (!gt) return null;
|
|
923
|
+
const o = Number.parseFloat(gt.discountPercent);
|
|
921
924
|
return !Number.isFinite(o) || o <= 0 ? null : o;
|
|
922
|
-
}, [
|
|
925
|
+
}, [gt]), vt = M(() => {
|
|
923
926
|
const o = T[0];
|
|
924
927
|
if (!o) return null;
|
|
925
928
|
const s = Number.parseFloat(o.discountPercent);
|
|
926
929
|
return !Number.isFinite(s) || s <= 0 ? null : s;
|
|
927
|
-
}, [T]),
|
|
930
|
+
}, [T]), xt = v ?? vt, it = M(() => {
|
|
928
931
|
const o = new Map(m.map((d) => [d.id, d]));
|
|
929
932
|
let s = 0;
|
|
930
933
|
for (const [d, b] of Object.entries(w)) {
|
|
931
934
|
const p = b ?? 0;
|
|
932
935
|
if (p <= 0) continue;
|
|
933
|
-
const
|
|
936
|
+
const C = o.get(d), _ = Number(C == null ? void 0 : C.price);
|
|
934
937
|
Number.isFinite(_) && (s += _ * p);
|
|
935
938
|
}
|
|
936
939
|
return Math.round(s * 100) / 100;
|
|
937
|
-
}, [m, w]),
|
|
938
|
-
if (!
|
|
939
|
-
const o =
|
|
940
|
+
}, [m, w]), Ot = M(() => {
|
|
941
|
+
if (!v) return it;
|
|
942
|
+
const o = it * (1 - v / 100);
|
|
940
943
|
return Math.round(o * 100) / 100;
|
|
941
|
-
}, [
|
|
944
|
+
}, [v, it]), Kt = M(() => T.length ? Math.max(...T.map((o) => o.minBundleSize)) : 0, [T]), Et = M(() => {
|
|
942
945
|
const o = new Map(m.map((s) => [s.id, s]));
|
|
943
946
|
return A.map((s) => o.get(s)).filter((s) => !!s);
|
|
944
947
|
}, [m, A]), de = M(() => {
|
|
@@ -953,22 +956,22 @@ function or(i) {
|
|
|
953
956
|
});
|
|
954
957
|
}
|
|
955
958
|
return o;
|
|
956
|
-
}, [T]), he = M(() => Math.max(
|
|
959
|
+
}, [T]), he = M(() => Math.max(Kt || Z, Et.length), [Et.length, Kt, Z]), [Lt, Ht] = k(!0), Xt = U(S);
|
|
957
960
|
z(() => {
|
|
958
961
|
if (((c == null ? void 0 : c.ctaButtonMode) || "add_to_cart") === "add_to_cart_checkout") {
|
|
959
|
-
const s =
|
|
960
|
-
|
|
962
|
+
const s = Xt.current > 0;
|
|
963
|
+
Ht(!(s && S === 0));
|
|
961
964
|
}
|
|
962
|
-
|
|
965
|
+
Xt.current = S;
|
|
963
966
|
}, [S, c == null ? void 0 : c.ctaButtonMode]);
|
|
964
|
-
const
|
|
965
|
-
const s =
|
|
967
|
+
const $t = U(null), Zt = U(null), Jt = U(null), te = U(x), ee = (o) => {
|
|
968
|
+
const s = Zt.current;
|
|
966
969
|
if (!s) return;
|
|
967
970
|
const d = s.querySelector(`[data-variant-row="${o}"]`);
|
|
968
971
|
if (!d) return;
|
|
969
|
-
const b = s.getBoundingClientRect(), p = d.getBoundingClientRect(),
|
|
970
|
-
if (p.top >= b.top +
|
|
971
|
-
const N = Math.max(0, s.scrollHeight - s.clientHeight), j = p.top - b.top + p.height / 2,
|
|
972
|
+
const b = s.getBoundingClientRect(), p = d.getBoundingClientRect(), C = 8;
|
|
973
|
+
if (p.top >= b.top + C && p.bottom <= b.bottom - C) return;
|
|
974
|
+
const N = Math.max(0, s.scrollHeight - s.clientHeight), j = p.top - b.top + p.height / 2, X = s.scrollTop + j - s.clientHeight / 2, ot = Math.min(N, Math.max(0, X));
|
|
972
975
|
s.scrollTo({ top: ot, behavior: "smooth" });
|
|
973
976
|
};
|
|
974
977
|
return z(() => {
|
|
@@ -979,7 +982,7 @@ function or(i) {
|
|
|
979
982
|
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
980
983
|
}, [e, t]), z(() => {
|
|
981
984
|
if (typeof window > "u") return;
|
|
982
|
-
const o = () =>
|
|
985
|
+
const o = () => Nt({ width: window.innerWidth, height: window.innerHeight });
|
|
983
986
|
return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
984
987
|
}, []), z(() => {
|
|
985
988
|
if (G.current != null && (window.clearTimeout(G.current), G.current = null), t) {
|
|
@@ -992,59 +995,59 @@ function or(i) {
|
|
|
992
995
|
}, [t]), z(() => () => {
|
|
993
996
|
G.current != null && window.clearTimeout(G.current);
|
|
994
997
|
}, []), z(() => () => {
|
|
995
|
-
|
|
998
|
+
J.current != null && window.clearTimeout(J.current);
|
|
996
999
|
}, []), z(() => () => {
|
|
997
|
-
|
|
1000
|
+
et.current != null && window.clearTimeout(et.current);
|
|
998
1001
|
}, []), z(() => {
|
|
999
1002
|
if (!t || !P) return;
|
|
1000
1003
|
const o = requestAnimationFrame(() => {
|
|
1001
1004
|
var s;
|
|
1002
|
-
return (s =
|
|
1005
|
+
return (s = ht.current) == null ? void 0 : s.focus();
|
|
1003
1006
|
});
|
|
1004
1007
|
return () => cancelAnimationFrame(o);
|
|
1005
1008
|
}, [t, P]), z(() => {
|
|
1006
|
-
const o =
|
|
1007
|
-
if (
|
|
1008
|
-
const s =
|
|
1009
|
+
const o = te.current;
|
|
1010
|
+
if (te.current = x, x <= o) return;
|
|
1011
|
+
const s = Jt.current;
|
|
1009
1012
|
if (!s) return;
|
|
1010
1013
|
const d = T.some((_) => _.minBundleSize === x), b = T.find((_) => _.minBundleSize > x), p = b && d ? b.minBundleSize - 1 : b ? null : x - 1;
|
|
1011
1014
|
if (p == null || p < 0) return;
|
|
1012
|
-
const
|
|
1015
|
+
const C = requestAnimationFrame(() => {
|
|
1013
1016
|
const _ = s.querySelector(`[data-box-slot="${p}"]`);
|
|
1014
1017
|
if (!_) return;
|
|
1015
|
-
const N = s.getBoundingClientRect(),
|
|
1016
|
-
if (
|
|
1017
|
-
const ot = Math.max(0, s.scrollWidth - s.clientWidth),
|
|
1018
|
-
s.scrollTo({ left:
|
|
1018
|
+
const N = s.getBoundingClientRect(), X = _.getBoundingClientRect().right - N.right;
|
|
1019
|
+
if (X <= 1) return;
|
|
1020
|
+
const ot = Math.max(0, s.scrollWidth - s.clientWidth), _t = Math.min(ot, Math.max(0, s.scrollLeft + X));
|
|
1021
|
+
s.scrollTo({ left: _t, behavior: "smooth" });
|
|
1019
1022
|
});
|
|
1020
|
-
return () => cancelAnimationFrame(
|
|
1023
|
+
return () => cancelAnimationFrame(C);
|
|
1021
1024
|
}, [x, T]), z(() => {
|
|
1022
1025
|
if (!t) return;
|
|
1023
|
-
const o =
|
|
1024
|
-
if (
|
|
1026
|
+
const o = bt.current;
|
|
1027
|
+
if (bt.current = x, x <= o) return;
|
|
1025
1028
|
const s = T.find((d) => d.minBundleSize === x);
|
|
1026
|
-
s && (
|
|
1027
|
-
It(!1),
|
|
1028
|
-
},
|
|
1029
|
+
s && (wt(`You received a ${f(s.discountPercent)}% discount!`), ct((d) => d + 1), It(!0), et.current != null && window.clearTimeout(et.current), et.current = window.setTimeout(() => {
|
|
1030
|
+
It(!1), et.current = null;
|
|
1031
|
+
}, qt));
|
|
1029
1032
|
}, [x, t, T]), z(() => {
|
|
1030
|
-
if (!t || !lt || !
|
|
1033
|
+
if (!t || !lt || !tt) return;
|
|
1031
1034
|
const o = requestAnimationFrame(() => {
|
|
1032
1035
|
var N;
|
|
1033
|
-
const s =
|
|
1036
|
+
const s = yt.current, d = s == null ? void 0 : s.getBoundingClientRect(), b = (N = $t.current) == null ? void 0 : N.getBoundingClientRect(), p = d ? d.left + d.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, C = d ? d.top + d.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, _ = {
|
|
1034
1037
|
x: p - 2,
|
|
1035
|
-
y:
|
|
1038
|
+
y: C - 2,
|
|
1036
1039
|
w: 4,
|
|
1037
1040
|
h: 4
|
|
1038
1041
|
};
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
},
|
|
1042
|
+
Pt(_), Mt((j) => j + 1), pt(!0), J.current != null && window.clearTimeout(J.current), J.current = window.setTimeout(() => {
|
|
1043
|
+
pt(!1), J.current = null;
|
|
1044
|
+
}, H);
|
|
1042
1045
|
});
|
|
1043
1046
|
return () => cancelAnimationFrame(o);
|
|
1044
|
-
}, [
|
|
1047
|
+
}, [Ct, tt, H, lt, t]), z(() => {
|
|
1045
1048
|
var o;
|
|
1046
|
-
t && ((o =
|
|
1047
|
-
}, [t]),
|
|
1049
|
+
t && ((o = $t.current) == null || o.focus());
|
|
1050
|
+
}, [t]), nt ? /* @__PURE__ */ O(
|
|
1048
1051
|
"div",
|
|
1049
1052
|
{
|
|
1050
1053
|
role: "dialog",
|
|
@@ -1055,12 +1058,12 @@ function or(i) {
|
|
|
1055
1058
|
o.target === o.currentTarget && e();
|
|
1056
1059
|
},
|
|
1057
1060
|
children: [
|
|
1058
|
-
|
|
1061
|
+
kt && mt && ft.width > 0 && ft.height > 0 ? /* @__PURE__ */ h(
|
|
1059
1062
|
Me,
|
|
1060
1063
|
{
|
|
1061
|
-
width:
|
|
1062
|
-
height:
|
|
1063
|
-
confettiSource:
|
|
1064
|
+
width: ft.width,
|
|
1065
|
+
height: ft.height,
|
|
1066
|
+
confettiSource: mt,
|
|
1064
1067
|
colors: [
|
|
1065
1068
|
"#2563eb",
|
|
1066
1069
|
// blue-600
|
|
@@ -1083,11 +1086,11 @@ function or(i) {
|
|
|
1083
1086
|
initialVelocityX: { min: -6, max: 6 },
|
|
1084
1087
|
style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
|
|
1085
1088
|
},
|
|
1086
|
-
|
|
1089
|
+
Tt
|
|
1087
1090
|
) : null,
|
|
1088
|
-
/* @__PURE__ */
|
|
1089
|
-
lt &&
|
|
1090
|
-
/* @__PURE__ */
|
|
1091
|
+
/* @__PURE__ */ O("aside", { ref: $t, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
|
|
1092
|
+
lt && tt ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: yt, className: u.celebrationChip, children: tt }, Ct) }) : null,
|
|
1093
|
+
/* @__PURE__ */ O("header", { className: [u.header, P ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
|
|
1091
1094
|
/* @__PURE__ */ h(
|
|
1092
1095
|
"button",
|
|
1093
1096
|
{
|
|
@@ -1101,13 +1104,13 @@ function or(i) {
|
|
|
1101
1104
|
children: /* @__PURE__ */ h(qe, { size: 18, "aria-hidden": "true" })
|
|
1102
1105
|
}
|
|
1103
1106
|
),
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": P, children: /* @__PURE__ */ h("h2", { className: u.title, children:
|
|
1106
|
-
/* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !P, children: /* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ O("div", { className: u.headerCenter, children: [
|
|
1108
|
+
/* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": P, children: /* @__PURE__ */ h("h2", { className: u.title, children: rt }) }),
|
|
1109
|
+
/* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !P, children: /* @__PURE__ */ O("div", { className: u.searchBar, children: [
|
|
1107
1110
|
/* @__PURE__ */ h(
|
|
1108
1111
|
"input",
|
|
1109
1112
|
{
|
|
1110
|
-
ref:
|
|
1113
|
+
ref: ht,
|
|
1111
1114
|
className: u.searchInput,
|
|
1112
1115
|
type: "search",
|
|
1113
1116
|
value: V,
|
|
@@ -1128,7 +1131,7 @@ function or(i) {
|
|
|
1128
1131
|
},
|
|
1129
1132
|
onClick: () => {
|
|
1130
1133
|
var o;
|
|
1131
|
-
g(""), (o =
|
|
1134
|
+
g(""), (o = ht.current) == null || o.focus();
|
|
1132
1135
|
},
|
|
1133
1136
|
"aria-label": "Clear search",
|
|
1134
1137
|
children: "Clear"
|
|
@@ -1138,16 +1141,16 @@ function or(i) {
|
|
|
1138
1141
|
] }),
|
|
1139
1142
|
/* @__PURE__ */ h("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
|
|
1140
1143
|
] }),
|
|
1141
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ O("div", { className: u.body, ref: Zt, children: [
|
|
1142
1145
|
a ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
|
|
1143
1146
|
n ? /* @__PURE__ */ h("p", { className: u.error, children: n }) : null,
|
|
1144
1147
|
!a && c && !c.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
|
|
1145
1148
|
/* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children: Y.map((o) => {
|
|
1146
|
-
var
|
|
1147
|
-
const s = w[o.id] ?? 0, d = D(o), b =
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (
|
|
1149
|
+
var X, ot, _t, Bt;
|
|
1150
|
+
const s = w[o.id] ?? 0, d = D(o), b = I(o.selectedOptions), p = y(o), C = xt, _ = Number(o.price), N = C != null && Number.isFinite(C) && C > 0 && Number.isFinite(_), j = N ? Math.round(_ * (1 - C / 100) * 100) / 100 : null;
|
|
1151
|
+
return /* @__PURE__ */ O("li", { className: u.variantRow, "data-variant-row": o.id, children: [
|
|
1152
|
+
/* @__PURE__ */ O("div", { className: u.variantLeft, children: [
|
|
1153
|
+
/* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (X = o.image) != null && X.url ? /* @__PURE__ */ h(
|
|
1151
1154
|
"img",
|
|
1152
1155
|
{
|
|
1153
1156
|
className: u.variantThumbImg,
|
|
@@ -1155,11 +1158,11 @@ function or(i) {
|
|
|
1155
1158
|
alt: o.image.altText ?? p,
|
|
1156
1159
|
loading: "lazy"
|
|
1157
1160
|
}
|
|
1158
|
-
) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((
|
|
1159
|
-
/* @__PURE__ */
|
|
1161
|
+
) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((Bt = (_t = (ot = o.product) == null ? void 0 : ot.title) == null ? void 0 : _t.slice(0, 1)) == null ? void 0 : Bt.toUpperCase()) ?? "•" }) }),
|
|
1162
|
+
/* @__PURE__ */ O("div", { className: u.variantInfo, children: [
|
|
1160
1163
|
/* @__PURE__ */ h("div", { className: u.variantName, children: d }),
|
|
1161
1164
|
b ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: b }) : null,
|
|
1162
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ O("div", { className: u.variantPriceRow, children: [
|
|
1163
1166
|
N ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: B(Number.isFinite(_) ? _.toFixed(2) : o.price) }) : null,
|
|
1164
1167
|
/* @__PURE__ */ h("span", { className: u.variantPrice, children: B(
|
|
1165
1168
|
j != null ? j.toFixed(2) : Number.isFinite(_) ? _.toFixed(2) : o.price
|
|
@@ -1172,12 +1175,12 @@ function or(i) {
|
|
|
1172
1175
|
{
|
|
1173
1176
|
type: "button",
|
|
1174
1177
|
onClick: () => R(o.id, 1),
|
|
1175
|
-
disabled: r ||
|
|
1178
|
+
disabled: r || at,
|
|
1176
1179
|
className: u.addToBundleButton,
|
|
1177
1180
|
"aria-label": `Add ${p} to bundle`,
|
|
1178
1181
|
children: "Add"
|
|
1179
1182
|
}
|
|
1180
|
-
) : /* @__PURE__ */
|
|
1183
|
+
) : /* @__PURE__ */ O("div", { className: u.qtyControls, children: [
|
|
1181
1184
|
/* @__PURE__ */ h(
|
|
1182
1185
|
"button",
|
|
1183
1186
|
{
|
|
@@ -1195,7 +1198,7 @@ function or(i) {
|
|
|
1195
1198
|
{
|
|
1196
1199
|
type: "button",
|
|
1197
1200
|
onClick: () => R(o.id, s + 1),
|
|
1198
|
-
disabled: r ||
|
|
1201
|
+
disabled: r || at,
|
|
1199
1202
|
className: u.qtyButton,
|
|
1200
1203
|
"aria-label": `Increase ${p}`,
|
|
1201
1204
|
children: "+"
|
|
@@ -1205,29 +1208,29 @@ function or(i) {
|
|
|
1205
1208
|
] }, o.id);
|
|
1206
1209
|
}) }) })
|
|
1207
1210
|
] }),
|
|
1208
|
-
/* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref:
|
|
1210
|
-
var
|
|
1211
|
-
const d =
|
|
1212
|
-
return /* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ O("footer", { className: u.footer, ref: st, children: [
|
|
1212
|
+
/* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: Jt, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: he }).map((o, s) => {
|
|
1213
|
+
var X, ot, _t, Bt;
|
|
1214
|
+
const d = Et[s], b = de.get(s), p = !!d, C = !!b, _ = C && !p, N = b ? `${b.discountPercent}% off` : null, j = p ? d.displayName : `Slot ${s + 1}`;
|
|
1215
|
+
return /* @__PURE__ */ O("div", { "data-box-slot": s, className: u.boxSlot, children: [
|
|
1213
1216
|
/* @__PURE__ */ h(
|
|
1214
1217
|
"div",
|
|
1215
1218
|
{
|
|
1216
1219
|
className: [
|
|
1217
1220
|
u.boxItem,
|
|
1218
1221
|
p ? u.boxItemFilled : u.boxItemPlaceholder,
|
|
1219
|
-
|
|
1222
|
+
C ? u.boxItemThreshold : null,
|
|
1220
1223
|
p ? u.boxItemClickable : null
|
|
1221
1224
|
].filter(Boolean).join(" "),
|
|
1222
1225
|
role: p ? "button" : void 0,
|
|
1223
1226
|
tabIndex: p ? 0 : void 0,
|
|
1224
|
-
onClick: p ? () =>
|
|
1225
|
-
onKeyDown: p ? (
|
|
1226
|
-
(
|
|
1227
|
+
onClick: p ? () => ee(d.id) : void 0,
|
|
1228
|
+
onKeyDown: p ? (Ut) => {
|
|
1229
|
+
(Ut.key === "Enter" || Ut.key === " ") && (Ut.preventDefault(), ee(d.id));
|
|
1227
1230
|
} : void 0,
|
|
1228
1231
|
"aria-label": _ && N ? `${j}. Unlocks ${N}.` : j,
|
|
1229
1232
|
title: _ && N ? `${j} • Unlocks ${N}` : j,
|
|
1230
|
-
children: p ? (
|
|
1233
|
+
children: p ? (X = d.image) != null && X.url ? /* @__PURE__ */ h(
|
|
1231
1234
|
"img",
|
|
1232
1235
|
{
|
|
1233
1236
|
className: u.boxItemImage,
|
|
@@ -1235,10 +1238,10 @@ function or(i) {
|
|
|
1235
1238
|
alt: d.image.altText ?? d.displayName,
|
|
1236
1239
|
loading: "lazy"
|
|
1237
1240
|
}
|
|
1238
|
-
) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((
|
|
1241
|
+
) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Bt = (_t = (ot = d.product) == null ? void 0 : ot.title) == null ? void 0 : _t.slice(0, 1)) == null ? void 0 : Bt.toUpperCase()) ?? "•" }) : _ && N ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: N }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
|
|
1239
1242
|
}
|
|
1240
1243
|
),
|
|
1241
|
-
|
|
1244
|
+
C ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: b.label }) : null
|
|
1242
1245
|
] }, s);
|
|
1243
1246
|
}) }) }),
|
|
1244
1247
|
/* @__PURE__ */ h(
|
|
@@ -1246,29 +1249,29 @@ function or(i) {
|
|
|
1246
1249
|
{
|
|
1247
1250
|
className: [u.ctaTotalsWrap, S <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
|
|
1248
1251
|
"aria-hidden": S > 0,
|
|
1249
|
-
children: /* @__PURE__ */
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
+
children: /* @__PURE__ */ O("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
|
|
1253
|
+
xt ? /* @__PURE__ */ O("span", { className: u.ctaDiscountBadge, children: [
|
|
1254
|
+
xt,
|
|
1252
1255
|
"% Discount"
|
|
1253
1256
|
] }) : /* @__PURE__ */ h("span", {}),
|
|
1254
|
-
/* @__PURE__ */ h("span", { children:
|
|
1255
|
-
/* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: B(
|
|
1257
|
+
/* @__PURE__ */ h("span", { children: v ? /* @__PURE__ */ O(fe, { children: [
|
|
1258
|
+
/* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: B(it.toFixed(2)) }),
|
|
1256
1259
|
" ",
|
|
1257
|
-
/* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(
|
|
1258
|
-
] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(
|
|
1260
|
+
/* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(Ot.toFixed(2)) })
|
|
1261
|
+
] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: B(it.toFixed(2)) }) })
|
|
1259
1262
|
] })
|
|
1260
1263
|
}
|
|
1261
1264
|
),
|
|
1262
1265
|
(() => {
|
|
1263
1266
|
const o = (c == null ? void 0 : c.ctaButtonMode) || "add_to_cart";
|
|
1264
|
-
return o === "add_to_cart_checkout" ? S > 0 ? /* @__PURE__ */ h("button", { type: "button", onClick:
|
|
1267
|
+
return o === "add_to_cart_checkout" ? S > 0 ? /* @__PURE__ */ h("button", { type: "button", onClick: K, disabled: !E, className: u.cta, children: r ? "Adding…" : `Add ${S} more product${S === 1 ? "" : "s"}` }) : /* @__PURE__ */ O("div", { className: `${u.ctaButtonGroup} ${Lt ? u.ctaButtonGroupAnimating : ""}`, children: [
|
|
1265
1268
|
/* @__PURE__ */ h(
|
|
1266
1269
|
"button",
|
|
1267
1270
|
{
|
|
1268
1271
|
type: "button",
|
|
1269
|
-
onClick:
|
|
1272
|
+
onClick: K,
|
|
1270
1273
|
disabled: !E,
|
|
1271
|
-
className: `${u.ctaDualLeft} ${
|
|
1274
|
+
className: `${u.ctaDualLeft} ${Lt ? u.ctaDualLeftAnimating : ""}`,
|
|
1272
1275
|
children: /* @__PURE__ */ h("span", { children: r ? "Adding…" : "Add to Basket" })
|
|
1273
1276
|
}
|
|
1274
1277
|
),
|
|
@@ -1278,13 +1281,13 @@ function or(i) {
|
|
|
1278
1281
|
type: "button",
|
|
1279
1282
|
onClick: L,
|
|
1280
1283
|
disabled: !E,
|
|
1281
|
-
className: `${u.ctaDualRight} ${
|
|
1284
|
+
className: `${u.ctaDualRight} ${Lt ? u.ctaDualRightAnimating : ""}`,
|
|
1282
1285
|
children: /* @__PURE__ */ h("span", { children: r ? "Processing…" : "Checkout" })
|
|
1283
1286
|
}
|
|
1284
1287
|
)
|
|
1285
|
-
] }) : o === "checkout" ? /* @__PURE__ */ h("button", { type: "button", onClick: L, disabled: !E, className: u.cta, children: r ? "Processing…" : S > 0 ? `Add ${S} more product${S === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ h("button", { type: "button", onClick:
|
|
1288
|
+
] }) : o === "checkout" ? /* @__PURE__ */ h("button", { type: "button", onClick: L, disabled: !E, className: u.cta, children: r ? "Processing…" : S > 0 ? `Add ${S} more product${S === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ h("button", { type: "button", onClick: K, disabled: !E, className: u.cta, children: r ? "Adding…" : S > 0 ? `Add ${S} more product${S === 1 ? "" : "s"}` : "Add to Basket" });
|
|
1286
1289
|
})(),
|
|
1287
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ O("div", { className: u.poweredBy, children: [
|
|
1288
1291
|
"powered by ",
|
|
1289
1292
|
/* @__PURE__ */ h("a", { href: "https://apps.shopify.com/best-bundles", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
|
|
1290
1293
|
] })
|
|
@@ -1294,7 +1297,7 @@ function or(i) {
|
|
|
1294
1297
|
}
|
|
1295
1298
|
) : null;
|
|
1296
1299
|
}
|
|
1297
|
-
function
|
|
1300
|
+
function se(i) {
|
|
1298
1301
|
if (i != null && i.length)
|
|
1299
1302
|
return i.reduce((t, e) => (e != null && e.key && (t[e.key] = e.value ?? ""), t), {});
|
|
1300
1303
|
}
|
|
@@ -1330,7 +1333,7 @@ async function tr() {
|
|
|
1330
1333
|
} catch {
|
|
1331
1334
|
}
|
|
1332
1335
|
}
|
|
1333
|
-
async function
|
|
1336
|
+
async function Vt(i, t) {
|
|
1334
1337
|
const e = await fetch(i, {
|
|
1335
1338
|
method: "POST",
|
|
1336
1339
|
headers: {
|
|
@@ -1351,21 +1354,21 @@ function sr() {
|
|
|
1351
1354
|
const t = i.map((e) => ({
|
|
1352
1355
|
id: Zn(e.merchandiseId),
|
|
1353
1356
|
quantity: e.quantity,
|
|
1354
|
-
properties:
|
|
1357
|
+
properties: se(e.attributes)
|
|
1355
1358
|
}));
|
|
1356
|
-
await
|
|
1359
|
+
await Vt("/cart/add.js", { items: t });
|
|
1357
1360
|
},
|
|
1358
1361
|
async linesUpdate(i) {
|
|
1359
1362
|
for (const t of i)
|
|
1360
|
-
await
|
|
1363
|
+
await Vt("/cart/change.js", {
|
|
1361
1364
|
id: t.id,
|
|
1362
1365
|
quantity: t.quantity,
|
|
1363
|
-
properties:
|
|
1366
|
+
properties: se(t.attributes)
|
|
1364
1367
|
});
|
|
1365
1368
|
},
|
|
1366
1369
|
async linesRemove(i) {
|
|
1367
1370
|
for (const t of i)
|
|
1368
|
-
await
|
|
1371
|
+
await Vt("/cart/change.js", { id: t, quantity: 0 });
|
|
1369
1372
|
},
|
|
1370
1373
|
openCartUI() {
|
|
1371
1374
|
window.setTimeout(() => {
|
|
@@ -1380,10 +1383,10 @@ function sr() {
|
|
|
1380
1383
|
export {
|
|
1381
1384
|
or as BundleBuilderDrawer,
|
|
1382
1385
|
ir as BundleButton,
|
|
1383
|
-
|
|
1386
|
+
At as BundleLineAttributeKeys,
|
|
1384
1387
|
rr as BundleProvider,
|
|
1385
1388
|
sr as createLiquidCartAdapter,
|
|
1386
|
-
|
|
1389
|
+
Gt as useBundleBuilder,
|
|
1387
1390
|
ar as useBundleBuilderDrawer
|
|
1388
1391
|
};
|
|
1389
1392
|
//# sourceMappingURL=index.js.map
|