@best-bundles/bundle-ui 0.0.2 → 0.0.4
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/components/BundleBuilderDrawer.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/context/BundleProvider.d.ts.map +1 -1
- package/dist/index.js +924 -528
- package/dist/index.js.map +1 -1
- package/dist/stories/BundleUI.stories.d.ts.map +1 -1
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.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_1ctfr_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}._backdropOpen_1ctfr_14{opacity:1}._backdropClosed_1ctfr_18{opacity:0}._panel_1ctfr_22{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_1ctfr_42{animation:_bbSlideInFromRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_1ctfr_46{animation:_bbSlideOutToRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_1ctfr_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_1ctfr_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_1ctfr_1{transition:none}._panelOpen_1ctfr_42,._panelClosed_1ctfr_46{animation:none}}._header_1ctfr_81{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_1ctfr_90{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_1ctfr_98{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_1ctfr_107{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_1ctfr_107:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_1ctfr_107:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_1ctfr_129{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_1ctfr_133{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_1ctfr_145 ._headerTitleWrap_1ctfr_129{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_1ctfr_145 ._headerSearchWrap_1ctfr_133{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_1ctfr_157{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_1ctfr_169{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_1ctfr_169::-webkit-search-cancel-button,._searchInput_1ctfr_169::-webkit-search-decoration,._searchInput_1ctfr_169::-webkit-search-results-button,._searchInput_1ctfr_169::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_1ctfr_190{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_1ctfr_190:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_1ctfr_190:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_1ctfr_212{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_1ctfr_212:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_1ctfr_212:disabled{opacity:.6;cursor:not-allowed}._closeButton_1ctfr_212:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_1ctfr_129,._headerSearchWrap_1ctfr_133{transition:none}}._body_1ctfr_245{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_1ctfr_250{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_1ctfr_255{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_1ctfr_260{margin-top:4px}._variantList_1ctfr_264{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_1ctfr_272{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_1ctfr_280{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_1ctfr_287{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_1ctfr_287:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_1ctfr_287:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_1ctfr_287:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_1ctfr_315{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_1ctfr_325{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_1ctfr_332{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_1ctfr_342{min-width:0}._variantName_1ctfr_346{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_1ctfr_355{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_1ctfr_363{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_1ctfr_370{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_1ctfr_363{font-size:13px;font-weight:800}._qtyControls_1ctfr_381{display:inline-flex;align-items:center;gap:6px}._qtyButton_1ctfr_387{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_1ctfr_387:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_1ctfr_387:disabled{opacity:.6;cursor:not-allowed}._qtyButton_1ctfr_387:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_1ctfr_412{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_1ctfr_419{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}._boxSummaryWindow_1ctfr_426{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_1ctfr_426::-webkit-scrollbar{display:none}._boxSummaryRow_1ctfr_443{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_1ctfr_451{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_1ctfr_459{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_1ctfr_471{cursor:pointer}._boxItemClickable_1ctfr_471:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_1ctfr_480{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_1ctfr_491{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_1ctfr_497{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_1ctfr_503{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_1ctfr_511{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_1ctfr_519{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_1ctfr_526{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_1ctfr_533{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}._cta_1ctfr_544{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}._ctaTotals_1ctfr_556{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_1ctfr_564{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_1ctfr_578{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_1ctfr_591{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_1ctfr_598{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_1ctfr_605{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_1ctfr_578{transition:none}}._cta_1ctfr_544:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_1ctfr_544:disabled{opacity:.6;cursor:not-allowed}._cta_1ctfr_544:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_1ctfr_630{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_1ctfr_1{padding:0;justify-content:stretch}._panel_1ctfr_22{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
const
|
|
2
|
+
import { jsx as d, jsxs as P, Fragment as Qt } from "react/jsx-runtime";
|
|
3
|
+
import wt, { useState as O, useRef as V, useEffect as z, useCallback as st, useMemo as T, createContext as Yt, useContext as Gt, forwardRef as Et, createElement as Tt } from "react";
|
|
4
|
+
const gt = {
|
|
5
5
|
bundleId: "_bundle_id",
|
|
6
6
|
bundleConfig: "_bundle_config",
|
|
7
|
-
bundleSource: "_bundle_source"
|
|
7
|
+
bundleSource: "_bundle_source",
|
|
8
|
+
bundleTitle: "_bundle_title"
|
|
8
9
|
};
|
|
9
|
-
async function
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
const
|
|
10
|
+
async function Ht(o) {
|
|
11
|
+
const t = new URL("/api/public/bundle-config", o.apiBaseUrl);
|
|
12
|
+
t.searchParams.set("shop", o.shop);
|
|
13
|
+
const i = await (await fetch(t, {
|
|
13
14
|
method: "GET",
|
|
14
15
|
signal: o.signal,
|
|
15
16
|
headers: { "Content-Type": "application/json" }
|
|
16
17
|
})).json().catch(() => null);
|
|
17
|
-
return !
|
|
18
|
+
return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
20
|
+
const Vt = Yt(null);
|
|
21
|
+
function Kt() {
|
|
21
22
|
try {
|
|
22
23
|
const o = globalThis.crypto;
|
|
23
24
|
if (o != null && o.randomUUID) return o.randomUUID();
|
|
@@ -25,175 +26,517 @@ function ke() {
|
|
|
25
26
|
}
|
|
26
27
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function Dt(o) {
|
|
29
30
|
return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function Cn(o) {
|
|
32
33
|
const {
|
|
33
|
-
apiBaseUrl:
|
|
34
|
-
shop:
|
|
35
|
-
cartAdapter:
|
|
36
|
-
configHandle:
|
|
37
|
-
initialData:
|
|
38
|
-
configFetcher:
|
|
39
|
-
children:
|
|
40
|
-
} = o, [
|
|
41
|
-
(
|
|
42
|
-
), [
|
|
34
|
+
apiBaseUrl: t,
|
|
35
|
+
shop: e,
|
|
36
|
+
cartAdapter: i,
|
|
37
|
+
configHandle: r = "default",
|
|
38
|
+
initialData: n,
|
|
39
|
+
configFetcher: c,
|
|
40
|
+
children: l
|
|
41
|
+
} = o, [m, k] = O(!1), [N, R] = O(!n), [w, $] = O(!1), [j, U] = O(null), [S, F] = O((n == null ? void 0 : n.currencyCode) ?? null), [b, Q] = O((n == null ? void 0 : n.config) ?? null), [rt, it] = O(
|
|
42
|
+
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
43
|
+
), [K, ft] = O(
|
|
43
44
|
() => ({ selections: {}, order: [] })
|
|
44
|
-
),
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
if (
|
|
48
|
-
(
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
if (!
|
|
54
|
-
|
|
45
|
+
), mt = V(null);
|
|
46
|
+
z(() => {
|
|
47
|
+
var C;
|
|
48
|
+
if (n) return;
|
|
49
|
+
(C = mt.current) == null || C.abort();
|
|
50
|
+
const y = new AbortController();
|
|
51
|
+
mt.current = y;
|
|
52
|
+
const x = c ?? Ht;
|
|
53
|
+
return R(!0), U(null), x({ apiBaseUrl: t, shop: e, signal: y.signal }).then((g) => {
|
|
54
|
+
if (!g.ok) {
|
|
55
|
+
U(g.error || "Failed to load bundle config."), Q(null), it([]), F(null);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
}).catch((
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
}).finally(() =>
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
69
|
-
const { [
|
|
70
|
-
|
|
71
|
-
} else
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
else if (
|
|
76
|
-
let
|
|
77
|
-
const
|
|
78
|
-
for (let
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
|
|
58
|
+
F(g.currencyCode ?? null), Q(g.config), it(g.eligibleVariants ?? []);
|
|
59
|
+
}).catch((g) => {
|
|
60
|
+
const M = g instanceof Error ? g.message : "Failed to load bundle config.";
|
|
61
|
+
U(M), Q(null), it([]), F(null);
|
|
62
|
+
}).finally(() => R(!1)), () => y.abort();
|
|
63
|
+
}, [t, e, n, c]);
|
|
64
|
+
const pt = st(() => k(!0), []), X = st(() => k(!1), []), bt = st(() => k((y) => !y), []), _t = st((y, x) => {
|
|
65
|
+
const C = Dt(x);
|
|
66
|
+
ft((g) => {
|
|
67
|
+
const M = g.selections[y] ?? 0, G = C - M;
|
|
68
|
+
let I;
|
|
69
|
+
if (C <= 0) {
|
|
70
|
+
const { [y]: et, ...D } = g.selections;
|
|
71
|
+
I = D;
|
|
72
|
+
} else M === C ? I = g.selections : I = { ...g.selections, [y]: C };
|
|
73
|
+
let L = g.order;
|
|
74
|
+
if (G > 0)
|
|
75
|
+
L = [...g.order, ...Array.from({ length: G }, () => y)];
|
|
76
|
+
else if (G < 0) {
|
|
77
|
+
let et = -G;
|
|
78
|
+
const D = [];
|
|
79
|
+
for (let lt = g.order.length - 1; lt >= 0; lt--) {
|
|
80
|
+
const ot = g.order[lt];
|
|
81
|
+
if (ot === y && et > 0) {
|
|
82
|
+
et--;
|
|
82
83
|
continue;
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
+
D.push(ot);
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
+
D.reverse(), L = D;
|
|
87
88
|
}
|
|
88
|
-
return
|
|
89
|
+
return I === g.selections && L === g.order ? g : { selections: I, order: L };
|
|
89
90
|
});
|
|
90
|
-
}, []),
|
|
91
|
-
const
|
|
92
|
-
return Number.isFinite(
|
|
93
|
-
}, [
|
|
94
|
-
var
|
|
95
|
-
if (!
|
|
96
|
-
const
|
|
97
|
-
merchandiseId:
|
|
98
|
-
quantity:
|
|
91
|
+
}, []), Z = st(() => ft({ selections: {}, order: [] }), []), A = K.selections, ct = K.order, at = T(() => Object.values(A).reduce((y, x) => y + (x || 0), 0), [A]), J = T(() => {
|
|
92
|
+
const y = (b == null ? void 0 : b.rules) ?? [], x = y.length ? Math.min(...y.map((C) => C.minBundleSize)) : 2;
|
|
93
|
+
return Number.isFinite(x) && x > 0 ? x : 2;
|
|
94
|
+
}, [b]), tt = T(() => !(N || w || j || !(b != null && b.isActive) || at < J), [at, b == null ? void 0 : b.isActive, j, N, J, w]), vt = st(async () => {
|
|
95
|
+
var g;
|
|
96
|
+
if (!tt || !b) return;
|
|
97
|
+
const y = Kt(), x = (b.title ?? "").trim().slice(0, 255), C = Object.entries(A).map(([M, G]) => ({ merchandiseId: M, quantity: Dt(G) })).filter((M) => M.quantity > 0).map((M) => ({
|
|
98
|
+
merchandiseId: M.merchandiseId,
|
|
99
|
+
quantity: M.quantity,
|
|
99
100
|
attributes: [
|
|
100
|
-
{ key:
|
|
101
|
-
{ key:
|
|
102
|
-
{ key:
|
|
101
|
+
{ key: gt.bundleId, value: y },
|
|
102
|
+
{ key: gt.bundleConfig, value: r },
|
|
103
|
+
{ key: gt.bundleSource, value: "bundle_builder" },
|
|
104
|
+
...x ? [{ key: gt.bundleTitle, value: x }] : []
|
|
103
105
|
]
|
|
104
106
|
}));
|
|
105
107
|
if (C.length) {
|
|
106
|
-
|
|
108
|
+
$(!0);
|
|
107
109
|
try {
|
|
108
|
-
await
|
|
110
|
+
await i.linesAdd(C), Z(), X(), (g = i.openCartUI) == null || g.call(i);
|
|
109
111
|
} finally {
|
|
110
|
-
|
|
112
|
+
$(!1);
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
}, [
|
|
115
|
+
}, [tt, i, Z, X, b, r, A]), yt = T(
|
|
114
116
|
() => ({
|
|
115
|
-
isOpen:
|
|
116
|
-
open:
|
|
117
|
-
close:
|
|
118
|
-
toggle:
|
|
119
|
-
loading:
|
|
120
|
-
submitting:
|
|
121
|
-
error:
|
|
122
|
-
currencyCode:
|
|
123
|
-
config:
|
|
124
|
-
eligibleVariants:
|
|
125
|
-
selections:
|
|
126
|
-
selectionOrder:
|
|
127
|
-
setQuantity:
|
|
128
|
-
clearSelections:
|
|
129
|
-
bundleSize:
|
|
130
|
-
minRequired:
|
|
131
|
-
canSubmit:
|
|
132
|
-
submit:
|
|
117
|
+
isOpen: m,
|
|
118
|
+
open: pt,
|
|
119
|
+
close: X,
|
|
120
|
+
toggle: bt,
|
|
121
|
+
loading: N,
|
|
122
|
+
submitting: w,
|
|
123
|
+
error: j,
|
|
124
|
+
currencyCode: S,
|
|
125
|
+
config: b,
|
|
126
|
+
eligibleVariants: rt,
|
|
127
|
+
selections: A,
|
|
128
|
+
selectionOrder: ct,
|
|
129
|
+
setQuantity: _t,
|
|
130
|
+
clearSelections: Z,
|
|
131
|
+
bundleSize: at,
|
|
132
|
+
minRequired: J,
|
|
133
|
+
canSubmit: tt,
|
|
134
|
+
submit: vt
|
|
133
135
|
}),
|
|
134
136
|
[
|
|
137
|
+
m,
|
|
138
|
+
pt,
|
|
139
|
+
X,
|
|
140
|
+
bt,
|
|
141
|
+
N,
|
|
135
142
|
w,
|
|
136
|
-
|
|
137
|
-
|
|
143
|
+
j,
|
|
144
|
+
S,
|
|
145
|
+
b,
|
|
146
|
+
rt,
|
|
138
147
|
A,
|
|
139
|
-
|
|
140
|
-
|
|
148
|
+
ct,
|
|
149
|
+
_t,
|
|
150
|
+
Z,
|
|
151
|
+
at,
|
|
141
152
|
J,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
ee,
|
|
145
|
-
W,
|
|
146
|
-
v,
|
|
147
|
-
be,
|
|
148
|
-
$,
|
|
149
|
-
P,
|
|
150
|
-
V,
|
|
151
|
-
S,
|
|
152
|
-
fe
|
|
153
|
+
tt,
|
|
154
|
+
vt
|
|
153
155
|
]
|
|
154
156
|
);
|
|
155
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ d(Vt.Provider, { value: yt, children: l });
|
|
156
158
|
}
|
|
157
|
-
function
|
|
158
|
-
const o =
|
|
159
|
+
function Nt() {
|
|
160
|
+
const o = Gt(Vt);
|
|
159
161
|
if (!o)
|
|
160
162
|
throw new Error("useBundleBuilder must be used within <BundleProvider />");
|
|
161
163
|
return o;
|
|
162
164
|
}
|
|
163
|
-
function
|
|
164
|
-
const { isOpen: o, open:
|
|
165
|
-
return { isOpen: o, open:
|
|
165
|
+
function Bn() {
|
|
166
|
+
const { isOpen: o, open: t, close: e, toggle: i } = Nt();
|
|
167
|
+
return { isOpen: o, open: t, close: e, toggle: i };
|
|
166
168
|
}
|
|
167
|
-
const
|
|
168
|
-
button:
|
|
169
|
+
const Xt = "_button_18rtl_1", Zt = {
|
|
170
|
+
button: Xt
|
|
169
171
|
};
|
|
170
|
-
function
|
|
171
|
-
const { toggle:
|
|
172
|
-
return /* @__PURE__ */
|
|
172
|
+
function Tn(o) {
|
|
173
|
+
const { toggle: t } = Nt();
|
|
174
|
+
return /* @__PURE__ */ d(
|
|
173
175
|
"button",
|
|
174
176
|
{
|
|
175
177
|
type: "button",
|
|
176
|
-
onClick:
|
|
177
|
-
className: [
|
|
178
|
+
onClick: t,
|
|
179
|
+
className: [Zt.button, o.className].filter(Boolean).join(" "),
|
|
178
180
|
children: o.children ?? "Build a bundle"
|
|
179
181
|
}
|
|
180
182
|
);
|
|
181
183
|
}
|
|
184
|
+
var Ct, Lt;
|
|
185
|
+
function Jt() {
|
|
186
|
+
if (Lt) return Ct;
|
|
187
|
+
Lt = 1;
|
|
188
|
+
var o = {
|
|
189
|
+
linear: function(t, e, i, r) {
|
|
190
|
+
var n = i - e;
|
|
191
|
+
return n * t / r + e;
|
|
192
|
+
},
|
|
193
|
+
easeInQuad: function(t, e, i, r) {
|
|
194
|
+
var n = i - e;
|
|
195
|
+
return n * (t /= r) * t + e;
|
|
196
|
+
},
|
|
197
|
+
easeOutQuad: function(t, e, i, r) {
|
|
198
|
+
var n = i - e;
|
|
199
|
+
return -n * (t /= r) * (t - 2) + e;
|
|
200
|
+
},
|
|
201
|
+
easeInOutQuad: function(t, e, i, r) {
|
|
202
|
+
var n = i - e;
|
|
203
|
+
return (t /= r / 2) < 1 ? n / 2 * t * t + e : -n / 2 * (--t * (t - 2) - 1) + e;
|
|
204
|
+
},
|
|
205
|
+
easeInCubic: function(t, e, i, r) {
|
|
206
|
+
var n = i - e;
|
|
207
|
+
return n * (t /= r) * t * t + e;
|
|
208
|
+
},
|
|
209
|
+
easeOutCubic: function(t, e, i, r) {
|
|
210
|
+
var n = i - e;
|
|
211
|
+
return n * ((t = t / r - 1) * t * t + 1) + e;
|
|
212
|
+
},
|
|
213
|
+
easeInOutCubic: function(t, e, i, r) {
|
|
214
|
+
var n = i - e;
|
|
215
|
+
return (t /= r / 2) < 1 ? n / 2 * t * t * t + e : n / 2 * ((t -= 2) * t * t + 2) + e;
|
|
216
|
+
},
|
|
217
|
+
easeInQuart: function(t, e, i, r) {
|
|
218
|
+
var n = i - e;
|
|
219
|
+
return n * (t /= r) * t * t * t + e;
|
|
220
|
+
},
|
|
221
|
+
easeOutQuart: function(t, e, i, r) {
|
|
222
|
+
var n = i - e;
|
|
223
|
+
return -n * ((t = t / r - 1) * t * t * t - 1) + e;
|
|
224
|
+
},
|
|
225
|
+
easeInOutQuart: function(t, e, i, r) {
|
|
226
|
+
var n = i - e;
|
|
227
|
+
return (t /= r / 2) < 1 ? n / 2 * t * t * t * t + e : -n / 2 * ((t -= 2) * t * t * t - 2) + e;
|
|
228
|
+
},
|
|
229
|
+
easeInQuint: function(t, e, i, r) {
|
|
230
|
+
var n = i - e;
|
|
231
|
+
return n * (t /= r) * t * t * t * t + e;
|
|
232
|
+
},
|
|
233
|
+
easeOutQuint: function(t, e, i, r) {
|
|
234
|
+
var n = i - e;
|
|
235
|
+
return n * ((t = t / r - 1) * t * t * t * t + 1) + e;
|
|
236
|
+
},
|
|
237
|
+
easeInOutQuint: function(t, e, i, r) {
|
|
238
|
+
var n = i - e;
|
|
239
|
+
return (t /= r / 2) < 1 ? n / 2 * t * t * t * t * t + e : n / 2 * ((t -= 2) * t * t * t * t + 2) + e;
|
|
240
|
+
},
|
|
241
|
+
easeInSine: function(t, e, i, r) {
|
|
242
|
+
var n = i - e;
|
|
243
|
+
return -n * Math.cos(t / r * (Math.PI / 2)) + n + e;
|
|
244
|
+
},
|
|
245
|
+
easeOutSine: function(t, e, i, r) {
|
|
246
|
+
var n = i - e;
|
|
247
|
+
return n * Math.sin(t / r * (Math.PI / 2)) + e;
|
|
248
|
+
},
|
|
249
|
+
easeInOutSine: function(t, e, i, r) {
|
|
250
|
+
var n = i - e;
|
|
251
|
+
return -n / 2 * (Math.cos(Math.PI * t / r) - 1) + e;
|
|
252
|
+
},
|
|
253
|
+
easeInExpo: function(t, e, i, r) {
|
|
254
|
+
var n = i - e;
|
|
255
|
+
return t == 0 ? e : n * Math.pow(2, 10 * (t / r - 1)) + e;
|
|
256
|
+
},
|
|
257
|
+
easeOutExpo: function(t, e, i, r) {
|
|
258
|
+
var n = i - e;
|
|
259
|
+
return t == r ? e + n : n * (-Math.pow(2, -10 * t / r) + 1) + e;
|
|
260
|
+
},
|
|
261
|
+
easeInOutExpo: function(t, e, i, r) {
|
|
262
|
+
var n = i - e;
|
|
263
|
+
return t === 0 ? e : t === r ? e + n : (t /= r / 2) < 1 ? n / 2 * Math.pow(2, 10 * (t - 1)) + e : n / 2 * (-Math.pow(2, -10 * --t) + 2) + e;
|
|
264
|
+
},
|
|
265
|
+
easeInCirc: function(t, e, i, r) {
|
|
266
|
+
var n = i - e;
|
|
267
|
+
return -n * (Math.sqrt(1 - (t /= r) * t) - 1) + e;
|
|
268
|
+
},
|
|
269
|
+
easeOutCirc: function(t, e, i, r) {
|
|
270
|
+
var n = i - e;
|
|
271
|
+
return n * Math.sqrt(1 - (t = t / r - 1) * t) + e;
|
|
272
|
+
},
|
|
273
|
+
easeInOutCirc: function(t, e, i, r) {
|
|
274
|
+
var n = i - e;
|
|
275
|
+
return (t /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + e : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e;
|
|
276
|
+
},
|
|
277
|
+
easeInElastic: function(t, e, i, r) {
|
|
278
|
+
var n = i - e, c, l, m;
|
|
279
|
+
return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), -(c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e);
|
|
280
|
+
},
|
|
281
|
+
easeOutElastic: function(t, e, i, r) {
|
|
282
|
+
var n = i - e, c, l, m;
|
|
283
|
+
return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), c * Math.pow(2, -10 * t) * Math.sin((t * r - m) * (2 * Math.PI) / l) + n + e);
|
|
284
|
+
},
|
|
285
|
+
easeInOutElastic: function(t, e, i, r) {
|
|
286
|
+
var n = i - e, c, l, m;
|
|
287
|
+
return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r / 2) === 2 ? e + n : (l || (l = r * (0.3 * 1.5)), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), t < 1 ? -0.5 * (c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e : c * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l) * 0.5 + n + e);
|
|
288
|
+
},
|
|
289
|
+
easeInBack: function(t, e, i, r, n) {
|
|
290
|
+
var c = i - e;
|
|
291
|
+
return n === void 0 && (n = 1.70158), c * (t /= r) * t * ((n + 1) * t - n) + e;
|
|
292
|
+
},
|
|
293
|
+
easeOutBack: function(t, e, i, r, n) {
|
|
294
|
+
var c = i - e;
|
|
295
|
+
return n === void 0 && (n = 1.70158), c * ((t = t / r - 1) * t * ((n + 1) * t + n) + 1) + e;
|
|
296
|
+
},
|
|
297
|
+
easeInOutBack: function(t, e, i, r, n) {
|
|
298
|
+
var c = i - e;
|
|
299
|
+
return n === void 0 && (n = 1.70158), (t /= r / 2) < 1 ? c / 2 * (t * t * (((n *= 1.525) + 1) * t - n)) + e : c / 2 * ((t -= 2) * t * (((n *= 1.525) + 1) * t + n) + 2) + e;
|
|
300
|
+
},
|
|
301
|
+
easeInBounce: function(t, e, i, r) {
|
|
302
|
+
var n = i - e, c;
|
|
303
|
+
return c = o.easeOutBounce(r - t, 0, n, r), n - c + e;
|
|
304
|
+
},
|
|
305
|
+
easeOutBounce: function(t, e, i, r) {
|
|
306
|
+
var n = i - e;
|
|
307
|
+
return (t /= r) < 1 / 2.75 ? n * (7.5625 * t * t) + e : t < 2 / 2.75 ? n * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + e : t < 2.5 / 2.75 ? n * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + e : n * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + e;
|
|
308
|
+
},
|
|
309
|
+
easeInOutBounce: function(t, e, i, r) {
|
|
310
|
+
var n = i - e, c;
|
|
311
|
+
return t < r / 2 ? (c = o.easeInBounce(t * 2, 0, n, r), c * 0.5 + e) : (c = o.easeOutBounce(t * 2 - r, 0, n, r), c * 0.5 + n * 0.5 + e);
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
return Ct = o, Ct;
|
|
315
|
+
}
|
|
316
|
+
var te = Jt();
|
|
317
|
+
function ee(o) {
|
|
318
|
+
return o * Math.PI / 180;
|
|
319
|
+
}
|
|
320
|
+
function q(o, t) {
|
|
321
|
+
return o + Math.random() * (t - o);
|
|
322
|
+
}
|
|
323
|
+
function ne(o, t) {
|
|
324
|
+
return Math.floor(o + Math.random() * (t - o + 1));
|
|
325
|
+
}
|
|
326
|
+
var dt;
|
|
327
|
+
(function(o) {
|
|
328
|
+
o[o.Circle = 0] = "Circle", o[o.Square = 1] = "Square", o[o.Strip = 2] = "Strip";
|
|
329
|
+
})(dt || (dt = {}));
|
|
330
|
+
var H;
|
|
331
|
+
(function(o) {
|
|
332
|
+
o[o.Positive = 1] = "Positive", o[o.Negative = -1] = "Negative";
|
|
333
|
+
})(H || (H = {}));
|
|
334
|
+
const re = 1e3 / 60;
|
|
335
|
+
class ie {
|
|
336
|
+
constructor(t, e, i, r) {
|
|
337
|
+
this.getOptions = e;
|
|
338
|
+
const { colors: n, initialVelocityX: c, initialVelocityY: l } = this.getOptions();
|
|
339
|
+
this.context = t, this.x = i, this.y = r, this.w = q(5, 20), this.h = q(5, 20), this.radius = q(5, 10), this.vx = typeof c == "number" ? q(-c, c) : q(c.min, c.max), this.vy = typeof l == "number" ? q(-l, 0) : q(l.min, l.max), this.shape = ne(0, 2), this.angle = ee(q(0, 360)), this.angularSpin = q(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = q(0, 1), this.rotationDirection = q(0, 1) ? H.Positive : H.Negative;
|
|
340
|
+
}
|
|
341
|
+
update(t) {
|
|
342
|
+
const { gravity: e, wind: i, friction: r, opacity: n, drawShape: c } = this.getOptions(), l = t / re;
|
|
343
|
+
this.x += this.vx * l, this.y += this.vy * l, this.vy += e * l, this.vx += i * l, this.vx *= r ** l, this.vy *= r ** l, this.rotateY >= 1 && this.rotationDirection === H.Positive ? this.rotationDirection = H.Negative : this.rotateY <= -1 && this.rotationDirection === H.Negative && (this.rotationDirection = H.Positive);
|
|
344
|
+
const m = 0.1 * this.rotationDirection * l;
|
|
345
|
+
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, c && typeof c == "function")
|
|
346
|
+
c.call(this, this.context);
|
|
347
|
+
else
|
|
348
|
+
switch (this.shape) {
|
|
349
|
+
case dt.Circle: {
|
|
350
|
+
this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
case dt.Square: {
|
|
354
|
+
this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
case dt.Strip: {
|
|
358
|
+
this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
this.context.closePath(), this.context.restore();
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
class ae {
|
|
366
|
+
constructor(t, e) {
|
|
367
|
+
this.x = 0, this.y = 0, this.w = 0, this.h = 0, this.lastNumberOfPieces = 0, this.tweenProgress = 0, this.tweenFrom = 0, this.particles = [], this.particlesGenerated = 0, this.removeParticleAt = (r) => {
|
|
368
|
+
this.particles.splice(r, 1);
|
|
369
|
+
}, this.getParticle = () => {
|
|
370
|
+
const r = q(this.x, this.w + this.x), n = q(this.y, this.h + this.y);
|
|
371
|
+
return new ie(this.context, this.getOptions, r, n);
|
|
372
|
+
}, this.animate = (r) => {
|
|
373
|
+
const { canvas: n, context: c, particlesGenerated: l, lastNumberOfPieces: m } = this, { run: k, recycle: N, numberOfPieces: R, debug: w, tweenFunction: $, tweenDuration: j } = this.getOptions();
|
|
374
|
+
if (!k)
|
|
375
|
+
return !1;
|
|
376
|
+
const U = this.particles.length, S = N ? U : l;
|
|
377
|
+
if (S < R) {
|
|
378
|
+
m !== R && (this.tweenProgress = 0, this.tweenFrom = S, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(j, Math.max(0, this.tweenProgress + r));
|
|
379
|
+
const F = $(this.tweenProgress, this.tweenFrom, R, j), b = Math.round(F - S);
|
|
380
|
+
for (let Q = 0; Q < b; Q++)
|
|
381
|
+
this.particles.push(this.getParticle());
|
|
382
|
+
this.particlesGenerated += b;
|
|
383
|
+
}
|
|
384
|
+
w && (c.font = "12px sans-serif", c.fillStyle = "#333", c.textAlign = "right", c.fillText(`Particles: ${U}`, n.width - 10, n.height - 20));
|
|
385
|
+
for (let F = this.particles.length - 1; F >= 0; F--) {
|
|
386
|
+
const b = this.particles[F];
|
|
387
|
+
b.update(r), (b.y > n.height || b.y < -100 || b.x > n.width + 100 || b.x < -100) && (N && S <= R ? this.particles[F] = this.getParticle() : this.removeParticleAt(F));
|
|
388
|
+
}
|
|
389
|
+
return U > 0 || S < R;
|
|
390
|
+
}, this.canvas = t;
|
|
391
|
+
const i = this.canvas.getContext("2d");
|
|
392
|
+
if (!i)
|
|
393
|
+
throw new Error("Could not get canvas context");
|
|
394
|
+
this.context = i, this.getOptions = e;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
const St = {
|
|
398
|
+
width: typeof window < "u" ? window.innerWidth : 300,
|
|
399
|
+
height: typeof window < "u" ? window.innerHeight : 200,
|
|
400
|
+
numberOfPieces: 200,
|
|
401
|
+
friction: 0.99,
|
|
402
|
+
wind: 0,
|
|
403
|
+
gravity: 0.1,
|
|
404
|
+
initialVelocityX: 4,
|
|
405
|
+
initialVelocityY: 10,
|
|
406
|
+
colors: [
|
|
407
|
+
"#f44336",
|
|
408
|
+
"#e91e63",
|
|
409
|
+
"#9c27b0",
|
|
410
|
+
"#673ab7",
|
|
411
|
+
"#3f51b5",
|
|
412
|
+
"#2196f3",
|
|
413
|
+
"#03a9f4",
|
|
414
|
+
"#00bcd4",
|
|
415
|
+
"#009688",
|
|
416
|
+
"#4CAF50",
|
|
417
|
+
"#8BC34A",
|
|
418
|
+
"#CDDC39",
|
|
419
|
+
"#FFEB3B",
|
|
420
|
+
"#FFC107",
|
|
421
|
+
"#FF9800",
|
|
422
|
+
"#FF5722",
|
|
423
|
+
"#795548"
|
|
424
|
+
],
|
|
425
|
+
opacity: 1,
|
|
426
|
+
debug: !1,
|
|
427
|
+
tweenFunction: te.easeInOutQuad,
|
|
428
|
+
tweenDuration: 5e3,
|
|
429
|
+
recycle: !0,
|
|
430
|
+
run: !0
|
|
431
|
+
};
|
|
432
|
+
class oe {
|
|
433
|
+
constructor(t, e) {
|
|
434
|
+
this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
|
|
435
|
+
const n = {
|
|
436
|
+
confettiSource: {
|
|
437
|
+
x: 0,
|
|
438
|
+
y: 0,
|
|
439
|
+
w: this.canvas.width,
|
|
440
|
+
h: 0
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
this._options = {
|
|
444
|
+
...n,
|
|
445
|
+
...St,
|
|
446
|
+
...r
|
|
447
|
+
}, Object.assign(this, r.confettiSource);
|
|
448
|
+
}, this.update = (r = 0) => {
|
|
449
|
+
const { options: { run: n, onConfettiComplete: c, frameRate: l }, canvas: m, context: k } = this, N = Math.min(r - this.lastFrameTime, 50);
|
|
450
|
+
if (l && N < 1e3 / l) {
|
|
451
|
+
this.rafId = requestAnimationFrame(this.update);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
this.lastFrameTime = r - (l ? N % l : 0), n && (k.fillStyle = "white", k.clearRect(0, 0, m.width, m.height)), this.generator.animate(N) ? this.rafId = requestAnimationFrame(this.update) : (c && typeof c == "function" && this.generator.particlesGenerated > 0 && c.call(this, this), this._options.run = !1);
|
|
455
|
+
}, this.reset = () => {
|
|
456
|
+
this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
|
|
457
|
+
}, this.stop = () => {
|
|
458
|
+
this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
|
|
459
|
+
}, this.canvas = t;
|
|
460
|
+
const i = this.canvas.getContext("2d");
|
|
461
|
+
if (!i)
|
|
462
|
+
throw new Error("Could not get canvas context");
|
|
463
|
+
this.context = i, this.generator = new ae(this.canvas, () => this.options), this.options = e, this.update();
|
|
464
|
+
}
|
|
465
|
+
get options() {
|
|
466
|
+
return this._options;
|
|
467
|
+
}
|
|
468
|
+
set options(t) {
|
|
469
|
+
var r, n;
|
|
470
|
+
const e = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
|
|
471
|
+
this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && i === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
const se = wt.createRef();
|
|
475
|
+
class Pt extends wt.Component {
|
|
476
|
+
constructor(t) {
|
|
477
|
+
super(t), this.canvas = wt.createRef(), this.canvas = t.canvasRef || se;
|
|
478
|
+
}
|
|
479
|
+
componentDidMount() {
|
|
480
|
+
if (this.canvas.current) {
|
|
481
|
+
const t = Bt(this.props)[0];
|
|
482
|
+
this.confetti = new oe(this.canvas.current, t);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
componentDidUpdate() {
|
|
486
|
+
const t = Bt(this.props)[0];
|
|
487
|
+
this.confetti && (this.confetti.options = t);
|
|
488
|
+
}
|
|
489
|
+
componentWillUnmount() {
|
|
490
|
+
this.confetti && this.confetti.stop(), this.confetti = void 0;
|
|
491
|
+
}
|
|
492
|
+
render() {
|
|
493
|
+
const [t, e] = Bt(this.props), i = {
|
|
494
|
+
zIndex: 2,
|
|
495
|
+
position: "absolute",
|
|
496
|
+
pointerEvents: "none",
|
|
497
|
+
top: 0,
|
|
498
|
+
left: 0,
|
|
499
|
+
bottom: 0,
|
|
500
|
+
right: 0,
|
|
501
|
+
...e.style
|
|
502
|
+
};
|
|
503
|
+
return d("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: i });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
Pt.defaultProps = {
|
|
507
|
+
...St
|
|
508
|
+
};
|
|
509
|
+
Pt.displayName = "ReactConfetti";
|
|
510
|
+
function Bt(o) {
|
|
511
|
+
const t = {}, e = {}, i = {}, r = [
|
|
512
|
+
...Object.keys(St),
|
|
513
|
+
"confettiSource",
|
|
514
|
+
"drawShape",
|
|
515
|
+
"onConfettiComplete",
|
|
516
|
+
"frameRate"
|
|
517
|
+
], n = ["canvasRef"];
|
|
518
|
+
for (const c in o) {
|
|
519
|
+
const l = o[c];
|
|
520
|
+
r.includes(c) ? t[c] = l : n.includes(c) ? n[c] = l : i[c] = l;
|
|
521
|
+
}
|
|
522
|
+
return [t, i, e];
|
|
523
|
+
}
|
|
524
|
+
const ce = wt.forwardRef((o, t) => d(Pt, { canvasRef: t, ...o }));
|
|
182
525
|
/**
|
|
183
526
|
* @license lucide-react v0.515.0 - ISC
|
|
184
527
|
*
|
|
185
528
|
* This source code is licensed under the ISC license.
|
|
186
529
|
* See the LICENSE file in the root directory of this source tree.
|
|
187
530
|
*/
|
|
188
|
-
const
|
|
531
|
+
const le = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ue = (o) => o.replace(
|
|
189
532
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
190
|
-
(
|
|
191
|
-
),
|
|
192
|
-
const
|
|
193
|
-
return
|
|
194
|
-
},
|
|
195
|
-
for (const
|
|
196
|
-
if (
|
|
533
|
+
(t, e, i) => i ? i.toUpperCase() : e.toLowerCase()
|
|
534
|
+
), Wt = (o) => {
|
|
535
|
+
const t = ue(o);
|
|
536
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
537
|
+
}, zt = (...o) => o.filter((t, e, i) => !!t && t.trim() !== "" && i.indexOf(t) === e).join(" ").trim(), he = (o) => {
|
|
538
|
+
for (const t in o)
|
|
539
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
197
540
|
return !0;
|
|
198
541
|
};
|
|
199
542
|
/**
|
|
@@ -202,7 +545,7 @@ const Re = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Oe = (
|
|
|
202
545
|
* This source code is licensed under the ISC license.
|
|
203
546
|
* See the LICENSE file in the root directory of this source tree.
|
|
204
547
|
*/
|
|
205
|
-
var
|
|
548
|
+
var de = {
|
|
206
549
|
xmlns: "http://www.w3.org/2000/svg",
|
|
207
550
|
width: 24,
|
|
208
551
|
height: 24,
|
|
@@ -219,32 +562,32 @@ var Me = {
|
|
|
219
562
|
* This source code is licensed under the ISC license.
|
|
220
563
|
* See the LICENSE file in the root directory of this source tree.
|
|
221
564
|
*/
|
|
222
|
-
const
|
|
565
|
+
const fe = Et(
|
|
223
566
|
({
|
|
224
567
|
color: o = "currentColor",
|
|
225
|
-
size:
|
|
226
|
-
strokeWidth:
|
|
227
|
-
absoluteStrokeWidth:
|
|
228
|
-
className:
|
|
229
|
-
children:
|
|
230
|
-
iconNode:
|
|
231
|
-
...
|
|
232
|
-
},
|
|
568
|
+
size: t = 24,
|
|
569
|
+
strokeWidth: e = 2,
|
|
570
|
+
absoluteStrokeWidth: i,
|
|
571
|
+
className: r = "",
|
|
572
|
+
children: n,
|
|
573
|
+
iconNode: c,
|
|
574
|
+
...l
|
|
575
|
+
}, m) => Tt(
|
|
233
576
|
"svg",
|
|
234
577
|
{
|
|
235
|
-
ref:
|
|
236
|
-
...
|
|
237
|
-
width:
|
|
238
|
-
height:
|
|
578
|
+
ref: m,
|
|
579
|
+
...de,
|
|
580
|
+
width: t,
|
|
581
|
+
height: t,
|
|
239
582
|
stroke: o,
|
|
240
|
-
strokeWidth:
|
|
241
|
-
className:
|
|
242
|
-
...!
|
|
243
|
-
...
|
|
583
|
+
strokeWidth: i ? Number(e) * 24 / Number(t) : e,
|
|
584
|
+
className: zt("lucide", r),
|
|
585
|
+
...!n && !he(l) && { "aria-hidden": "true" },
|
|
586
|
+
...l
|
|
244
587
|
},
|
|
245
588
|
[
|
|
246
|
-
...
|
|
247
|
-
...Array.isArray(
|
|
589
|
+
...c.map(([k, N]) => Tt(k, N)),
|
|
590
|
+
...Array.isArray(n) ? n : [n]
|
|
248
591
|
]
|
|
249
592
|
)
|
|
250
593
|
);
|
|
@@ -254,20 +597,20 @@ const qe = Be(
|
|
|
254
597
|
* This source code is licensed under the ISC license.
|
|
255
598
|
* See the LICENSE file in the root directory of this source tree.
|
|
256
599
|
*/
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
({ className:
|
|
260
|
-
ref:
|
|
261
|
-
iconNode:
|
|
262
|
-
className:
|
|
263
|
-
`lucide-${
|
|
600
|
+
const me = (o, t) => {
|
|
601
|
+
const e = Et(
|
|
602
|
+
({ className: i, ...r }, n) => Tt(fe, {
|
|
603
|
+
ref: n,
|
|
604
|
+
iconNode: t,
|
|
605
|
+
className: zt(
|
|
606
|
+
`lucide-${le(Wt(o))}`,
|
|
264
607
|
`lucide-${o}`,
|
|
265
|
-
|
|
608
|
+
i
|
|
266
609
|
),
|
|
267
|
-
...
|
|
610
|
+
...r
|
|
268
611
|
})
|
|
269
612
|
);
|
|
270
|
-
return
|
|
613
|
+
return e.displayName = Wt(o), e;
|
|
271
614
|
};
|
|
272
615
|
/**
|
|
273
616
|
* @license lucide-react v0.515.0 - ISC
|
|
@@ -275,413 +618,466 @@ const Ae = (o, c) => {
|
|
|
275
618
|
* This source code is licensed under the ISC license.
|
|
276
619
|
* See the LICENSE file in the root directory of this source tree.
|
|
277
620
|
*/
|
|
278
|
-
const
|
|
621
|
+
const pe = [
|
|
279
622
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
280
623
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
281
|
-
],
|
|
282
|
-
backdrop:
|
|
283
|
-
backdropOpen:
|
|
284
|
-
backdropClosed:
|
|
285
|
-
panel:
|
|
286
|
-
panelOpen:
|
|
287
|
-
panelClosed:
|
|
288
|
-
header:
|
|
289
|
-
headerCenter:
|
|
290
|
-
title:
|
|
291
|
-
searchIconButton:
|
|
292
|
-
headerTitleWrap:
|
|
293
|
-
headerSearchWrap:
|
|
294
|
-
headerSearchOpen:
|
|
295
|
-
searchBar:
|
|
296
|
-
searchInput:
|
|
297
|
-
searchClearButton:
|
|
298
|
-
closeButton:
|
|
299
|
-
body:
|
|
300
|
-
muted:
|
|
301
|
-
error:
|
|
302
|
-
variants:
|
|
303
|
-
variantList:
|
|
304
|
-
variantRow:
|
|
305
|
-
variantLeft:
|
|
306
|
-
addToBundleButton:
|
|
307
|
-
variantThumb:
|
|
308
|
-
variantThumbImg:
|
|
309
|
-
variantThumbFallback:
|
|
310
|
-
variantInfo:
|
|
311
|
-
variantName:
|
|
312
|
-
variantMeta:
|
|
313
|
-
variantPriceRow:
|
|
314
|
-
variantCompareAt:
|
|
315
|
-
variantPrice:
|
|
316
|
-
qtyControls:
|
|
317
|
-
qtyButton:
|
|
318
|
-
qtyValue:
|
|
319
|
-
footer:
|
|
320
|
-
boxSummaryWindow:
|
|
321
|
-
boxSummaryRow:
|
|
322
|
-
boxSlot:
|
|
323
|
-
boxItem:
|
|
324
|
-
boxItemClickable:
|
|
325
|
-
boxThresholdLabel:
|
|
326
|
-
boxItemPlaceholder:
|
|
327
|
-
boxItemFilled:
|
|
328
|
-
boxItemThreshold:
|
|
329
|
-
boxItemDiscountText:
|
|
330
|
-
boxItemPlus:
|
|
331
|
-
boxItemImage:
|
|
332
|
-
boxItemFallback:
|
|
333
|
-
cta:
|
|
334
|
-
ctaTotals:
|
|
335
|
-
ctaDiscountBadge:
|
|
336
|
-
ctaTotalsWrap:
|
|
337
|
-
ctaTotalsWrapVisible:
|
|
338
|
-
ctaTotalsStrike:
|
|
339
|
-
ctaTotalsPrice:
|
|
624
|
+
], be = me("search", pe), _e = "_backdrop_1ctfr_1", ve = "_backdropOpen_1ctfr_14", ge = "_backdropClosed_1ctfr_18", we = "_panel_1ctfr_22", ye = "_panelOpen_1ctfr_42", xe = "_panelClosed_1ctfr_46", Ie = "_header_1ctfr_81", Ce = "_headerCenter_1ctfr_90", Be = "_title_1ctfr_98", Te = "_searchIconButton_1ctfr_107", Ne = "_headerTitleWrap_1ctfr_129", Se = "_headerSearchWrap_1ctfr_133", Pe = "_headerSearchOpen_1ctfr_145", Me = "_searchBar_1ctfr_157", Oe = "_searchInput_1ctfr_169", ke = "_searchClearButton_1ctfr_190", Fe = "_closeButton_1ctfr_212", Re = "_body_1ctfr_245", Ae = "_muted_1ctfr_250", qe = "_error_1ctfr_255", De = "_variants_1ctfr_260", Le = "_variantList_1ctfr_264", We = "_variantRow_1ctfr_272", Ee = "_variantLeft_1ctfr_280", Ve = "_addToBundleButton_1ctfr_287", ze = "_variantThumb_1ctfr_315", $e = "_variantThumbImg_1ctfr_325", je = "_variantThumbFallback_1ctfr_332", Ue = "_variantInfo_1ctfr_342", Qe = "_variantName_1ctfr_346", Ye = "_variantMeta_1ctfr_355", Ge = "_variantPriceRow_1ctfr_363", He = "_variantCompareAt_1ctfr_370", Ke = "_variantPrice_1ctfr_363", Xe = "_qtyControls_1ctfr_381", Ze = "_qtyButton_1ctfr_387", Je = "_qtyValue_1ctfr_412", tn = "_footer_1ctfr_419", en = "_boxSummaryWindow_1ctfr_426", nn = "_boxSummaryRow_1ctfr_443", rn = "_boxSlot_1ctfr_451", an = "_boxItem_1ctfr_459", on = "_boxItemClickable_1ctfr_471", sn = "_boxThresholdLabel_1ctfr_480", cn = "_boxItemPlaceholder_1ctfr_491", ln = "_boxItemFilled_1ctfr_497", un = "_boxItemThreshold_1ctfr_503", hn = "_boxItemDiscountText_1ctfr_511", dn = "_boxItemPlus_1ctfr_519", fn = "_boxItemImage_1ctfr_526", mn = "_boxItemFallback_1ctfr_533", pn = "_cta_1ctfr_544", bn = "_ctaTotals_1ctfr_556", _n = "_ctaDiscountBadge_1ctfr_564", vn = "_ctaTotalsWrap_1ctfr_578", gn = "_ctaTotalsWrapVisible_1ctfr_591", wn = "_ctaTotalsStrike_1ctfr_598", yn = "_ctaTotalsPrice_1ctfr_605", u = {
|
|
625
|
+
backdrop: _e,
|
|
626
|
+
backdropOpen: ve,
|
|
627
|
+
backdropClosed: ge,
|
|
628
|
+
panel: we,
|
|
629
|
+
panelOpen: ye,
|
|
630
|
+
panelClosed: xe,
|
|
631
|
+
header: Ie,
|
|
632
|
+
headerCenter: Ce,
|
|
633
|
+
title: Be,
|
|
634
|
+
searchIconButton: Te,
|
|
635
|
+
headerTitleWrap: Ne,
|
|
636
|
+
headerSearchWrap: Se,
|
|
637
|
+
headerSearchOpen: Pe,
|
|
638
|
+
searchBar: Me,
|
|
639
|
+
searchInput: Oe,
|
|
640
|
+
searchClearButton: ke,
|
|
641
|
+
closeButton: Fe,
|
|
642
|
+
body: Re,
|
|
643
|
+
muted: Ae,
|
|
644
|
+
error: qe,
|
|
645
|
+
variants: De,
|
|
646
|
+
variantList: Le,
|
|
647
|
+
variantRow: We,
|
|
648
|
+
variantLeft: Ee,
|
|
649
|
+
addToBundleButton: Ve,
|
|
650
|
+
variantThumb: ze,
|
|
651
|
+
variantThumbImg: $e,
|
|
652
|
+
variantThumbFallback: je,
|
|
653
|
+
variantInfo: Ue,
|
|
654
|
+
variantName: Qe,
|
|
655
|
+
variantMeta: Ye,
|
|
656
|
+
variantPriceRow: Ge,
|
|
657
|
+
variantCompareAt: He,
|
|
658
|
+
variantPrice: Ke,
|
|
659
|
+
qtyControls: Xe,
|
|
660
|
+
qtyButton: Ze,
|
|
661
|
+
qtyValue: Je,
|
|
662
|
+
footer: tn,
|
|
663
|
+
boxSummaryWindow: en,
|
|
664
|
+
boxSummaryRow: nn,
|
|
665
|
+
boxSlot: rn,
|
|
666
|
+
boxItem: an,
|
|
667
|
+
boxItemClickable: on,
|
|
668
|
+
boxThresholdLabel: sn,
|
|
669
|
+
boxItemPlaceholder: cn,
|
|
670
|
+
boxItemFilled: ln,
|
|
671
|
+
boxItemThreshold: un,
|
|
672
|
+
boxItemDiscountText: hn,
|
|
673
|
+
boxItemPlus: dn,
|
|
674
|
+
boxItemImage: fn,
|
|
675
|
+
boxItemFallback: mn,
|
|
676
|
+
cta: pn,
|
|
677
|
+
ctaTotals: bn,
|
|
678
|
+
ctaDiscountBadge: _n,
|
|
679
|
+
ctaTotalsWrap: vn,
|
|
680
|
+
ctaTotalsWrapVisible: gn,
|
|
681
|
+
ctaTotalsStrike: wn,
|
|
682
|
+
ctaTotalsPrice: yn
|
|
340
683
|
};
|
|
341
|
-
function
|
|
342
|
-
var
|
|
684
|
+
function Nn(o) {
|
|
685
|
+
var qt;
|
|
343
686
|
const {
|
|
344
|
-
isOpen:
|
|
345
|
-
close:
|
|
346
|
-
loading:
|
|
347
|
-
submitting:
|
|
348
|
-
error:
|
|
349
|
-
currencyCode:
|
|
350
|
-
config:
|
|
351
|
-
eligibleVariants:
|
|
352
|
-
selections:
|
|
353
|
-
selectionOrder:
|
|
354
|
-
setQuantity:
|
|
355
|
-
bundleSize:
|
|
356
|
-
minRequired:
|
|
357
|
-
canSubmit:
|
|
358
|
-
submit:
|
|
359
|
-
} =
|
|
360
|
-
const
|
|
361
|
-
var
|
|
362
|
-
const
|
|
363
|
-
return !(!
|
|
687
|
+
isOpen: t,
|
|
688
|
+
close: e,
|
|
689
|
+
loading: i,
|
|
690
|
+
submitting: r,
|
|
691
|
+
error: n,
|
|
692
|
+
currencyCode: c,
|
|
693
|
+
config: l,
|
|
694
|
+
eligibleVariants: m,
|
|
695
|
+
selections: k,
|
|
696
|
+
selectionOrder: N,
|
|
697
|
+
setQuantity: R,
|
|
698
|
+
bundleSize: w,
|
|
699
|
+
minRequired: $,
|
|
700
|
+
canSubmit: j,
|
|
701
|
+
submit: U
|
|
702
|
+
} = Nt(), [S, F] = O(!1), [b, Q] = O(""), rt = V(null), it = V(null), [K, ft] = O(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [mt, pt] = O(0), [X, bt] = O(null), [_t, Z] = O(!1), A = V(null), ct = V(w), at = 7e3, J = (a) => {
|
|
703
|
+
const s = (a ?? []).filter((h) => {
|
|
704
|
+
var v, _;
|
|
705
|
+
const p = (v = h == null ? void 0 : h.name) == null ? void 0 : v.trim(), f = (_ = h == null ? void 0 : h.value) == null ? void 0 : _.trim();
|
|
706
|
+
return !(!p || !f || p.toLowerCase() === "title");
|
|
364
707
|
});
|
|
365
|
-
return
|
|
366
|
-
},
|
|
367
|
-
var
|
|
368
|
-
return ((
|
|
369
|
-
},
|
|
370
|
-
const
|
|
371
|
-
return [
|
|
372
|
-
}, [
|
|
373
|
-
const
|
|
374
|
-
if (!Number.isFinite(
|
|
375
|
-
if (
|
|
708
|
+
return s.length ? s.map((h) => `${h.name}: ${h.value}`).join(" · ") : null;
|
|
709
|
+
}, tt = (a) => {
|
|
710
|
+
var s;
|
|
711
|
+
return ((s = a.product) == null ? void 0 : s.title) ?? a.displayName ?? a.title;
|
|
712
|
+
}, vt = (a) => {
|
|
713
|
+
const s = tt(a), h = J(a.selectedOptions);
|
|
714
|
+
return [s, h].filter(Boolean).join(" — ");
|
|
715
|
+
}, [yt, y] = O(t), x = V(null), C = (a) => {
|
|
716
|
+
const s = Number(a);
|
|
717
|
+
if (!Number.isFinite(s)) return a;
|
|
718
|
+
if (c)
|
|
376
719
|
try {
|
|
377
|
-
return new Intl.NumberFormat(void 0, { style: "currency", currency:
|
|
720
|
+
return new Intl.NumberFormat(void 0, { style: "currency", currency: c }).format(s);
|
|
378
721
|
} catch {
|
|
379
722
|
}
|
|
380
|
-
return `$${
|
|
381
|
-
},
|
|
382
|
-
const
|
|
383
|
-
if (!
|
|
384
|
-
const
|
|
385
|
-
var
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
for (const
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
return
|
|
723
|
+
return `$${s.toFixed(2)}`;
|
|
724
|
+
}, g = ((qt = l == null ? void 0 : l.title) == null ? void 0 : qt.trim()) || "Build your bundle", M = T(() => [...m].sort((a, s) => a.displayName.localeCompare(s.displayName)), [m]), G = T(() => {
|
|
725
|
+
const a = b.trim().toLowerCase();
|
|
726
|
+
if (!a) return M;
|
|
727
|
+
const s = a.split(/\s+/).filter(Boolean), h = (p) => {
|
|
728
|
+
var _;
|
|
729
|
+
const f = [];
|
|
730
|
+
f.push(p.displayName), (_ = p.product) != null && _.title && f.push(p.product.title);
|
|
731
|
+
for (const B of p.selectedOptions ?? [])
|
|
732
|
+
f.push(B.name), f.push(B.value);
|
|
733
|
+
const v = f.join(" ").toLowerCase();
|
|
734
|
+
return s.every((B) => v.includes(B));
|
|
392
735
|
};
|
|
393
|
-
return
|
|
394
|
-
}, [
|
|
395
|
-
let
|
|
396
|
-
for (const
|
|
397
|
-
|
|
398
|
-
return
|
|
399
|
-
}, [
|
|
400
|
-
if (!
|
|
401
|
-
const
|
|
402
|
-
return !Number.isFinite(
|
|
403
|
-
}, [
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
406
|
-
const
|
|
407
|
-
return !Number.isFinite(
|
|
408
|
-
}, [
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
for (const [
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
const
|
|
415
|
-
Number.isFinite(
|
|
736
|
+
return M.filter(h);
|
|
737
|
+
}, [b, M]), I = T(() => [...(l == null ? void 0 : l.rules) ?? []].sort((a, s) => a.minBundleSize - s.minBundleSize), [l == null ? void 0 : l.rules]), L = T(() => Math.max(0, $ - w), [w, $]), et = T(() => {
|
|
738
|
+
let a = null;
|
|
739
|
+
for (const s of I)
|
|
740
|
+
w >= s.minBundleSize && (a = s);
|
|
741
|
+
return a;
|
|
742
|
+
}, [w, I]), D = T(() => {
|
|
743
|
+
if (!et) return null;
|
|
744
|
+
const a = Number.parseFloat(et.discountPercent);
|
|
745
|
+
return !Number.isFinite(a) || a <= 0 ? null : a;
|
|
746
|
+
}, [et]), lt = T(() => {
|
|
747
|
+
const a = I[0];
|
|
748
|
+
if (!a) return null;
|
|
749
|
+
const s = Number.parseFloat(a.discountPercent);
|
|
750
|
+
return !Number.isFinite(s) || s <= 0 ? null : s;
|
|
751
|
+
}, [I]), ot = D ?? lt, ut = T(() => {
|
|
752
|
+
const a = new Map(m.map((h) => [h.id, h]));
|
|
753
|
+
let s = 0;
|
|
754
|
+
for (const [h, p] of Object.entries(k)) {
|
|
755
|
+
const f = p ?? 0;
|
|
756
|
+
if (f <= 0) continue;
|
|
757
|
+
const v = a.get(h), _ = Number(v == null ? void 0 : v.price);
|
|
758
|
+
Number.isFinite(_) && (s += _ * f);
|
|
416
759
|
}
|
|
417
|
-
return Math.round(
|
|
418
|
-
}, [
|
|
419
|
-
if (!
|
|
420
|
-
const
|
|
421
|
-
return Math.round(
|
|
422
|
-
}, [
|
|
423
|
-
const
|
|
424
|
-
return
|
|
425
|
-
}, [
|
|
426
|
-
var
|
|
427
|
-
const
|
|
428
|
-
for (const
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
discountPercent:
|
|
432
|
-
minBundleSize:
|
|
433
|
-
label: ((
|
|
760
|
+
return Math.round(s * 100) / 100;
|
|
761
|
+
}, [m, k]), $t = T(() => {
|
|
762
|
+
if (!D) return ut;
|
|
763
|
+
const a = ut * (1 - D / 100);
|
|
764
|
+
return Math.round(a * 100) / 100;
|
|
765
|
+
}, [D, ut]), Mt = T(() => I.length ? Math.max(...I.map((a) => a.minBundleSize)) : 0, [I]), xt = T(() => {
|
|
766
|
+
const a = new Map(m.map((s) => [s.id, s]));
|
|
767
|
+
return N.map((s) => a.get(s)).filter((s) => !!s);
|
|
768
|
+
}, [m, N]), jt = T(() => {
|
|
769
|
+
var s;
|
|
770
|
+
const a = /* @__PURE__ */ new Map();
|
|
771
|
+
for (const h of I) {
|
|
772
|
+
const p = Math.max(0, h.minBundleSize - 1);
|
|
773
|
+
a.set(p, {
|
|
774
|
+
discountPercent: h.discountPercent,
|
|
775
|
+
minBundleSize: h.minBundleSize,
|
|
776
|
+
label: ((s = h.label) == null ? void 0 : s.trim()) || `Buy ${h.minBundleSize}+`
|
|
434
777
|
});
|
|
435
778
|
}
|
|
436
|
-
return
|
|
437
|
-
}, [
|
|
438
|
-
const
|
|
439
|
-
if (!
|
|
440
|
-
const
|
|
441
|
-
if (!
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
const
|
|
445
|
-
|
|
779
|
+
return a;
|
|
780
|
+
}, [I]), Ut = T(() => Math.max(Mt || $, xt.length), [xt.length, Mt, $]), Ot = V(null), kt = V(null), Ft = V(null), Rt = V(w), At = (a) => {
|
|
781
|
+
const s = kt.current;
|
|
782
|
+
if (!s) return;
|
|
783
|
+
const h = s.querySelector(`[data-variant-row="${a}"]`);
|
|
784
|
+
if (!h) return;
|
|
785
|
+
const p = s.getBoundingClientRect(), f = h.getBoundingClientRect(), v = 8;
|
|
786
|
+
if (f.top >= p.top + v && f.bottom <= p.bottom - v) return;
|
|
787
|
+
const B = Math.max(0, s.scrollHeight - s.clientHeight), W = f.top - p.top + f.height / 2, E = s.scrollTop + W - s.clientHeight / 2, Y = Math.min(B, Math.max(0, E));
|
|
788
|
+
s.scrollTo({ top: Y, behavior: "smooth" });
|
|
446
789
|
};
|
|
447
|
-
return
|
|
448
|
-
if (!
|
|
449
|
-
const
|
|
450
|
-
|
|
790
|
+
return z(() => {
|
|
791
|
+
if (!t) return;
|
|
792
|
+
const a = (s) => {
|
|
793
|
+
s.key === "Escape" && e();
|
|
451
794
|
};
|
|
452
|
-
return window.addEventListener("keydown",
|
|
453
|
-
}, [
|
|
454
|
-
if (
|
|
455
|
-
|
|
795
|
+
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
796
|
+
}, [e, t]), z(() => {
|
|
797
|
+
if (typeof window > "u") return;
|
|
798
|
+
const a = () => ft({ width: window.innerWidth, height: window.innerHeight });
|
|
799
|
+
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
800
|
+
}, []), z(() => {
|
|
801
|
+
if (x.current != null && (window.clearTimeout(x.current), x.current = null), t) {
|
|
802
|
+
y(!0);
|
|
456
803
|
return;
|
|
457
804
|
}
|
|
458
|
-
|
|
459
|
-
|
|
805
|
+
x.current = window.setTimeout(() => {
|
|
806
|
+
y(!1), x.current = null;
|
|
460
807
|
}, 220);
|
|
461
|
-
}, [
|
|
462
|
-
|
|
463
|
-
}, []),
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
808
|
+
}, [t]), z(() => () => {
|
|
809
|
+
x.current != null && window.clearTimeout(x.current);
|
|
810
|
+
}, []), z(() => () => {
|
|
811
|
+
A.current != null && window.clearTimeout(A.current);
|
|
812
|
+
}, []), z(() => {
|
|
813
|
+
if (!t || !S) return;
|
|
814
|
+
const a = requestAnimationFrame(() => {
|
|
815
|
+
var s;
|
|
816
|
+
return (s = rt.current) == null ? void 0 : s.focus();
|
|
468
817
|
});
|
|
469
|
-
return () => cancelAnimationFrame(
|
|
470
|
-
}, [
|
|
471
|
-
const
|
|
472
|
-
if (
|
|
473
|
-
const
|
|
474
|
-
if (!
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
if (!
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
|
|
818
|
+
return () => cancelAnimationFrame(a);
|
|
819
|
+
}, [t, S]), z(() => {
|
|
820
|
+
const a = Rt.current;
|
|
821
|
+
if (Rt.current = w, w <= a) return;
|
|
822
|
+
const s = Ft.current;
|
|
823
|
+
if (!s) return;
|
|
824
|
+
const h = I.some((_) => _.minBundleSize === w), p = I.find((_) => _.minBundleSize > w), f = p && h ? p.minBundleSize - 1 : p ? null : w - 1;
|
|
825
|
+
if (f == null || f < 0) return;
|
|
826
|
+
const v = requestAnimationFrame(() => {
|
|
827
|
+
const _ = s.querySelector(`[data-box-slot="${f}"]`);
|
|
828
|
+
if (!_) return;
|
|
829
|
+
const B = s.getBoundingClientRect(), E = _.getBoundingClientRect().right - B.right;
|
|
830
|
+
if (E <= 1) return;
|
|
831
|
+
const Y = Math.max(0, s.scrollWidth - s.clientWidth), nt = Math.min(Y, Math.max(0, s.scrollLeft + E));
|
|
832
|
+
s.scrollTo({ left: nt, behavior: "smooth" });
|
|
484
833
|
});
|
|
485
|
-
return () => cancelAnimationFrame(
|
|
486
|
-
}, [
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
834
|
+
return () => cancelAnimationFrame(v);
|
|
835
|
+
}, [w, I]), z(() => {
|
|
836
|
+
if (!t) return;
|
|
837
|
+
const a = ct.current;
|
|
838
|
+
if (ct.current = w, w <= a || !I.some((v) => v.minBundleSize === w)) return;
|
|
839
|
+
const h = it.current;
|
|
840
|
+
if (!h) return;
|
|
841
|
+
const p = h.getBoundingClientRect(), f = {
|
|
842
|
+
x: p.left + p.width / 2 - 2,
|
|
843
|
+
y: p.top + 4,
|
|
844
|
+
w: 4,
|
|
845
|
+
h: 4
|
|
846
|
+
};
|
|
847
|
+
bt(f), pt((v) => v + 1), Z(!0), A.current != null && window.clearTimeout(A.current), A.current = window.setTimeout(() => {
|
|
848
|
+
Z(!1), A.current = null;
|
|
849
|
+
}, at);
|
|
850
|
+
}, [w, t, I]), z(() => {
|
|
851
|
+
var a;
|
|
852
|
+
t && ((a = Ot.current) == null || a.focus());
|
|
853
|
+
}, [t]), yt ? /* @__PURE__ */ P(
|
|
490
854
|
"div",
|
|
491
855
|
{
|
|
492
856
|
role: "dialog",
|
|
493
857
|
"aria-modal": "true",
|
|
494
858
|
"aria-label": "Bundle builder",
|
|
495
|
-
className: [
|
|
496
|
-
onMouseDown: (
|
|
497
|
-
|
|
859
|
+
className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
|
|
860
|
+
onMouseDown: (a) => {
|
|
861
|
+
a.target === a.currentTarget && e();
|
|
498
862
|
},
|
|
499
|
-
children:
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
"
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
] }),
|
|
551
|
-
/* @__PURE__ */ N("div", { className: n.body, ref: Q, children: [
|
|
552
|
-
m ? /* @__PURE__ */ r("p", { className: n.muted, children: "Loading…" }) : null,
|
|
553
|
-
h ? /* @__PURE__ */ r("p", { className: n.error, children: h }) : null,
|
|
554
|
-
!m && x && !x.isActive ? /* @__PURE__ */ r("p", { className: n.error, children: "Bundles are not active." }) : null,
|
|
555
|
-
/* @__PURE__ */ r("div", { className: n.variants, children: /* @__PURE__ */ r("ul", { className: n.variantList, children: W.map((e) => {
|
|
556
|
-
var O, q, H, de;
|
|
557
|
-
const t = L[e.id] ?? 0, a = se(e), i = te(e.selectedOptions), s = me(e), b = ie, u = Number(e.price), p = b != null && Number.isFinite(b) && b > 0 && Number.isFinite(u), R = p ? Math.round(u * (1 - b / 100) * 100) / 100 : null;
|
|
558
|
-
return /* @__PURE__ */ N("li", { className: n.variantRow, "data-variant-row": e.id, children: [
|
|
559
|
-
/* @__PURE__ */ N("div", { className: n.variantLeft, children: [
|
|
560
|
-
/* @__PURE__ */ r("div", { className: n.variantThumb, "aria-hidden": "true", children: (O = e.image) != null && O.url ? /* @__PURE__ */ r(
|
|
561
|
-
"img",
|
|
863
|
+
children: [
|
|
864
|
+
_t && X && K.width > 0 && K.height > 0 ? /* @__PURE__ */ d(
|
|
865
|
+
ce,
|
|
866
|
+
{
|
|
867
|
+
width: K.width,
|
|
868
|
+
height: K.height,
|
|
869
|
+
confettiSource: X,
|
|
870
|
+
colors: [
|
|
871
|
+
"#2563eb",
|
|
872
|
+
// blue-600
|
|
873
|
+
"#3b82f6",
|
|
874
|
+
// blue-500
|
|
875
|
+
"#60a5fa",
|
|
876
|
+
// blue-400
|
|
877
|
+
"#93c5fd",
|
|
878
|
+
// blue-300
|
|
879
|
+
"#bae6fd",
|
|
880
|
+
// blue-200
|
|
881
|
+
"#e0f2fe"
|
|
882
|
+
// blue-100
|
|
883
|
+
],
|
|
884
|
+
recycle: !1,
|
|
885
|
+
numberOfPieces: 70,
|
|
886
|
+
tweenDuration: 100,
|
|
887
|
+
gravity: 0.45,
|
|
888
|
+
initialVelocityY: { min: -10, max: -30 },
|
|
889
|
+
initialVelocityX: { min: -6, max: 6 },
|
|
890
|
+
style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483647 }
|
|
891
|
+
},
|
|
892
|
+
mt
|
|
893
|
+
) : null,
|
|
894
|
+
/* @__PURE__ */ P("aside", { ref: Ot, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
|
|
895
|
+
/* @__PURE__ */ P("header", { className: [u.header, S ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
|
|
896
|
+
/* @__PURE__ */ d(
|
|
897
|
+
"button",
|
|
898
|
+
{
|
|
899
|
+
type: "button",
|
|
900
|
+
className: u.searchIconButton,
|
|
901
|
+
"aria-label": S ? "Search (expanded)" : "Search",
|
|
902
|
+
"aria-expanded": S,
|
|
903
|
+
onClick: () => {
|
|
904
|
+
F(!0);
|
|
905
|
+
},
|
|
906
|
+
children: /* @__PURE__ */ d(be, { size: 18, "aria-hidden": "true" })
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ P("div", { className: u.headerCenter, children: [
|
|
910
|
+
/* @__PURE__ */ d("div", { className: u.headerTitleWrap, "aria-hidden": S, children: /* @__PURE__ */ d("h2", { className: u.title, children: g }) }),
|
|
911
|
+
/* @__PURE__ */ d("div", { className: u.headerSearchWrap, "aria-hidden": !S, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
|
|
912
|
+
/* @__PURE__ */ d(
|
|
913
|
+
"input",
|
|
562
914
|
{
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
/* @__PURE__ */ N("div", { className: n.variantPriceRow, children: [
|
|
573
|
-
p ? /* @__PURE__ */ r("span", { className: n.variantCompareAt, children: A(Number.isFinite(u) ? u.toFixed(2) : e.price) }) : null,
|
|
574
|
-
/* @__PURE__ */ r("span", { className: n.variantPrice, children: A(
|
|
575
|
-
R != null ? R.toFixed(2) : Number.isFinite(u) ? u.toFixed(2) : e.price
|
|
576
|
-
) })
|
|
577
|
-
] })
|
|
578
|
-
] })
|
|
579
|
-
] }),
|
|
580
|
-
t <= 0 ? /* @__PURE__ */ r(
|
|
581
|
-
"button",
|
|
582
|
-
{
|
|
583
|
-
type: "button",
|
|
584
|
-
onClick: () => G(e.id, 1),
|
|
585
|
-
disabled: T,
|
|
586
|
-
className: n.addToBundleButton,
|
|
587
|
-
"aria-label": `Add ${s} to bundle`,
|
|
588
|
-
children: "Add"
|
|
589
|
-
}
|
|
590
|
-
) : /* @__PURE__ */ N("div", { className: n.qtyControls, children: [
|
|
591
|
-
/* @__PURE__ */ r(
|
|
592
|
-
"button",
|
|
593
|
-
{
|
|
594
|
-
type: "button",
|
|
595
|
-
onClick: () => G(e.id, t - 1),
|
|
596
|
-
disabled: T || t <= 0,
|
|
597
|
-
className: n.qtyButton,
|
|
598
|
-
"aria-label": `Decrease ${s}`,
|
|
599
|
-
children: "−"
|
|
915
|
+
ref: rt,
|
|
916
|
+
className: u.searchInput,
|
|
917
|
+
type: "search",
|
|
918
|
+
value: b,
|
|
919
|
+
placeholder: "Search",
|
|
920
|
+
onChange: (a) => Q(a.target.value),
|
|
921
|
+
onBlur: () => {
|
|
922
|
+
b.trim() === "" && F(!1);
|
|
923
|
+
}
|
|
600
924
|
}
|
|
601
925
|
),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */ r(
|
|
926
|
+
b.trim() ? /* @__PURE__ */ d(
|
|
604
927
|
"button",
|
|
605
928
|
{
|
|
606
929
|
type: "button",
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
930
|
+
className: u.searchClearButton,
|
|
931
|
+
onMouseDown: (a) => {
|
|
932
|
+
a.preventDefault();
|
|
933
|
+
},
|
|
934
|
+
onClick: () => {
|
|
935
|
+
var a;
|
|
936
|
+
Q(""), (a = rt.current) == null || a.focus();
|
|
937
|
+
},
|
|
938
|
+
"aria-label": "Clear search",
|
|
939
|
+
children: "Clear"
|
|
612
940
|
}
|
|
613
|
-
)
|
|
614
|
-
] })
|
|
615
|
-
] },
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
s ? n.boxItemFilled : n.boxItemPlaceholder,
|
|
629
|
-
b ? n.boxItemThreshold : null,
|
|
630
|
-
s ? n.boxItemClickable : null
|
|
631
|
-
].filter(Boolean).join(" "),
|
|
632
|
-
role: s ? "button" : void 0,
|
|
633
|
-
tabIndex: s ? 0 : void 0,
|
|
634
|
-
onClick: s ? () => ae(a.id) : void 0,
|
|
635
|
-
onKeyDown: s ? (_e) => {
|
|
636
|
-
(_e.key === "Enter" || _e.key === " ") && (_e.preventDefault(), ae(a.id));
|
|
637
|
-
} : void 0,
|
|
638
|
-
"aria-label": u && p ? `${R}. Unlocks ${p}.` : R,
|
|
639
|
-
title: u && p ? `${R} • Unlocks ${p}` : R,
|
|
640
|
-
children: s ? (O = a.image) != null && O.url ? /* @__PURE__ */ r(
|
|
941
|
+
) : null
|
|
942
|
+
] }) })
|
|
943
|
+
] }),
|
|
944
|
+
/* @__PURE__ */ d("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
|
|
945
|
+
] }),
|
|
946
|
+
/* @__PURE__ */ P("div", { className: u.body, ref: kt, children: [
|
|
947
|
+
i ? /* @__PURE__ */ d("p", { className: u.muted, children: "Loading…" }) : null,
|
|
948
|
+
n ? /* @__PURE__ */ d("p", { className: u.error, children: n }) : null,
|
|
949
|
+
!i && l && !l.isActive ? /* @__PURE__ */ d("p", { className: u.error, children: "Bundles are not active." }) : null,
|
|
950
|
+
/* @__PURE__ */ d("div", { className: u.variants, children: /* @__PURE__ */ d("ul", { className: u.variantList, children: G.map((a) => {
|
|
951
|
+
var E, Y, nt, ht;
|
|
952
|
+
const s = k[a.id] ?? 0, h = tt(a), p = J(a.selectedOptions), f = vt(a), v = ot, _ = Number(a.price), B = v != null && Number.isFinite(v) && v > 0 && Number.isFinite(_), W = B ? Math.round(_ * (1 - v / 100) * 100) / 100 : null;
|
|
953
|
+
return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": a.id, children: [
|
|
954
|
+
/* @__PURE__ */ P("div", { className: u.variantLeft, children: [
|
|
955
|
+
/* @__PURE__ */ d("div", { className: u.variantThumb, "aria-hidden": "true", children: (E = a.image) != null && E.url ? /* @__PURE__ */ d(
|
|
641
956
|
"img",
|
|
642
957
|
{
|
|
643
|
-
className:
|
|
958
|
+
className: u.variantThumbImg,
|
|
644
959
|
src: a.image.url,
|
|
645
|
-
alt: a.image.altText ??
|
|
960
|
+
alt: a.image.altText ?? f,
|
|
646
961
|
loading: "lazy"
|
|
647
962
|
}
|
|
648
|
-
) : /* @__PURE__ */
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
963
|
+
) : /* @__PURE__ */ d("div", { className: u.variantThumbFallback, children: ((ht = (nt = (Y = a.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) }),
|
|
964
|
+
/* @__PURE__ */ P("div", { className: u.variantInfo, children: [
|
|
965
|
+
/* @__PURE__ */ d("div", { className: u.variantName, children: h }),
|
|
966
|
+
p ? /* @__PURE__ */ d("div", { className: u.variantMeta, children: p }) : null,
|
|
967
|
+
/* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
|
|
968
|
+
B ? /* @__PURE__ */ d("span", { className: u.variantCompareAt, children: C(Number.isFinite(_) ? _.toFixed(2) : a.price) }) : null,
|
|
969
|
+
/* @__PURE__ */ d("span", { className: u.variantPrice, children: C(
|
|
970
|
+
W != null ? W.toFixed(2) : Number.isFinite(_) ? _.toFixed(2) : a.price
|
|
971
|
+
) })
|
|
972
|
+
] })
|
|
973
|
+
] })
|
|
974
|
+
] }),
|
|
975
|
+
s <= 0 ? /* @__PURE__ */ d(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
onClick: () => R(a.id, 1),
|
|
980
|
+
disabled: r,
|
|
981
|
+
className: u.addToBundleButton,
|
|
982
|
+
"aria-label": `Add ${f} to bundle`,
|
|
983
|
+
children: "Add"
|
|
984
|
+
}
|
|
985
|
+
) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
|
|
986
|
+
/* @__PURE__ */ d(
|
|
987
|
+
"button",
|
|
988
|
+
{
|
|
989
|
+
type: "button",
|
|
990
|
+
onClick: () => R(a.id, s - 1),
|
|
991
|
+
disabled: r || s <= 0,
|
|
992
|
+
className: u.qtyButton,
|
|
993
|
+
"aria-label": `Decrease ${f}`,
|
|
994
|
+
children: "−"
|
|
995
|
+
}
|
|
996
|
+
),
|
|
997
|
+
/* @__PURE__ */ d("span", { className: u.qtyValue, "aria-label": `Quantity ${s}`, children: s }),
|
|
998
|
+
/* @__PURE__ */ d(
|
|
999
|
+
"button",
|
|
1000
|
+
{
|
|
1001
|
+
type: "button",
|
|
1002
|
+
onClick: () => R(a.id, s + 1),
|
|
1003
|
+
disabled: r,
|
|
1004
|
+
className: u.qtyButton,
|
|
1005
|
+
"aria-label": `Increase ${f}`,
|
|
1006
|
+
children: "+"
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
] })
|
|
1010
|
+
] }, a.id);
|
|
1011
|
+
}) }) })
|
|
1012
|
+
] }),
|
|
1013
|
+
/* @__PURE__ */ P("footer", { className: u.footer, ref: it, children: [
|
|
1014
|
+
/* @__PURE__ */ d("div", { className: u.boxSummaryWindow, ref: Ft, children: /* @__PURE__ */ d("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: Ut }).map((a, s) => {
|
|
1015
|
+
var E, Y, nt, ht;
|
|
1016
|
+
const h = xt[s], p = jt.get(s), f = !!h, v = !!p, _ = v && !f, B = p ? `${p.discountPercent}% off` : null, W = f ? h.displayName : `Slot ${s + 1}`;
|
|
1017
|
+
return /* @__PURE__ */ P("div", { "data-box-slot": s, className: u.boxSlot, children: [
|
|
1018
|
+
/* @__PURE__ */ d(
|
|
1019
|
+
"div",
|
|
1020
|
+
{
|
|
1021
|
+
className: [
|
|
1022
|
+
u.boxItem,
|
|
1023
|
+
f ? u.boxItemFilled : u.boxItemPlaceholder,
|
|
1024
|
+
v ? u.boxItemThreshold : null,
|
|
1025
|
+
f ? u.boxItemClickable : null
|
|
1026
|
+
].filter(Boolean).join(" "),
|
|
1027
|
+
role: f ? "button" : void 0,
|
|
1028
|
+
tabIndex: f ? 0 : void 0,
|
|
1029
|
+
onClick: f ? () => At(h.id) : void 0,
|
|
1030
|
+
onKeyDown: f ? (It) => {
|
|
1031
|
+
(It.key === "Enter" || It.key === " ") && (It.preventDefault(), At(h.id));
|
|
1032
|
+
} : void 0,
|
|
1033
|
+
"aria-label": _ && B ? `${W}. Unlocks ${B}.` : W,
|
|
1034
|
+
title: _ && B ? `${W} • Unlocks ${B}` : W,
|
|
1035
|
+
children: f ? (E = h.image) != null && E.url ? /* @__PURE__ */ d(
|
|
1036
|
+
"img",
|
|
1037
|
+
{
|
|
1038
|
+
className: u.boxItemImage,
|
|
1039
|
+
src: h.image.url,
|
|
1040
|
+
alt: h.image.altText ?? h.displayName,
|
|
1041
|
+
loading: "lazy"
|
|
1042
|
+
}
|
|
1043
|
+
) : /* @__PURE__ */ d("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((ht = (nt = (Y = h.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) : _ && B ? /* @__PURE__ */ d("div", { className: u.boxItemDiscountText, children: B }) : /* @__PURE__ */ d("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
v ? /* @__PURE__ */ d("div", { className: u.boxThresholdLabel, children: p.label }) : null
|
|
1047
|
+
] }, s);
|
|
1048
|
+
}) }) }),
|
|
1049
|
+
/* @__PURE__ */ d(
|
|
1050
|
+
"div",
|
|
1051
|
+
{
|
|
1052
|
+
className: [u.ctaTotalsWrap, L <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
|
|
1053
|
+
"aria-hidden": L > 0,
|
|
1054
|
+
children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
|
|
1055
|
+
ot ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
|
|
1056
|
+
D ? "Unlocked " : "",
|
|
1057
|
+
ot,
|
|
1058
|
+
"% off"
|
|
1059
|
+
] }) : /* @__PURE__ */ d("span", {}),
|
|
1060
|
+
/* @__PURE__ */ d("span", { children: D ? /* @__PURE__ */ P(Qt, { children: [
|
|
1061
|
+
/* @__PURE__ */ d("span", { className: u.ctaTotalsStrike, children: C(ut.toFixed(2)) }),
|
|
1062
|
+
" ",
|
|
1063
|
+
/* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C($t.toFixed(2)) })
|
|
1064
|
+
] }) : /* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C(ut.toFixed(2)) }) })
|
|
1065
|
+
] })
|
|
1066
|
+
}
|
|
1067
|
+
),
|
|
1068
|
+
/* @__PURE__ */ d("button", { type: "button", onClick: U, disabled: !j, className: u.cta, children: r ? "Adding…" : L > 0 ? `Add ${L} more product${L === 1 ? "" : "s"}` : "Add to Basket" })
|
|
1069
|
+
] })
|
|
674
1070
|
] })
|
|
675
|
-
]
|
|
1071
|
+
]
|
|
676
1072
|
}
|
|
677
1073
|
) : null;
|
|
678
1074
|
}
|
|
679
1075
|
export {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1076
|
+
Nn as BundleBuilderDrawer,
|
|
1077
|
+
Tn as BundleButton,
|
|
1078
|
+
gt as BundleLineAttributeKeys,
|
|
1079
|
+
Cn as BundleProvider,
|
|
1080
|
+
Nt as useBundleBuilder,
|
|
1081
|
+
Bn as useBundleBuilderDrawer
|
|
686
1082
|
};
|
|
687
1083
|
//# sourceMappingURL=index.js.map
|