@best-bundles/bundle-ui 0.0.5 → 0.0.6
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/context/BundleProvider.d.ts.map +1 -1
- package/dist/index.js +539 -530
- package/dist/index.js.map +1 -1
- package/dist/liquid/bundle-ui.iife.js +13 -13
- package/dist/liquid/bundle-ui.iife.js.map +1 -1
- package/dist/stories/BundleUI.stories.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,191 +1,194 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.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_jv9mc_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_jv9mc_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_jv9mc_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_jv9mc_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_jv9mc_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_jv9mc_74{opacity:1}._backdropClosed_jv9mc_78{opacity:0}._panel_jv9mc_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_jv9mc_102{animation:_bbSlideInFromRight_jv9mc_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_jv9mc_106{animation:_bbSlideOutToRight_jv9mc_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_jv9mc_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_jv9mc_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_jv9mc_1{transition:none}._celebrationChip_jv9mc_23,._panelOpen_jv9mc_102,._panelClosed_jv9mc_106{animation:none}}._header_jv9mc_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_jv9mc_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_jv9mc_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_jv9mc_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_jv9mc_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_jv9mc_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_jv9mc_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_jv9mc_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_jv9mc_209 ._headerTitleWrap_jv9mc_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_jv9mc_209 ._headerSearchWrap_jv9mc_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_jv9mc_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_jv9mc_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_jv9mc_233::-webkit-search-cancel-button,._searchInput_jv9mc_233::-webkit-search-decoration,._searchInput_jv9mc_233::-webkit-search-results-button,._searchInput_jv9mc_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_jv9mc_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_jv9mc_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_jv9mc_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_jv9mc_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_jv9mc_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_jv9mc_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_jv9mc_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_jv9mc_193,._headerSearchWrap_jv9mc_197{transition:none}}._body_jv9mc_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_jv9mc_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_jv9mc_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_jv9mc_324{margin-top:4px}._variantList_jv9mc_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_jv9mc_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_jv9mc_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_jv9mc_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_jv9mc_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_jv9mc_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_jv9mc_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_jv9mc_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_jv9mc_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_jv9mc_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_jv9mc_406{min-width:0}._variantName_jv9mc_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_jv9mc_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_jv9mc_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_jv9mc_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_jv9mc_427{font-size:13px;font-weight:800}._qtyControls_jv9mc_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_jv9mc_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_jv9mc_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_jv9mc_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_jv9mc_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_jv9mc_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_jv9mc_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}._boxSummaryWindow_jv9mc_490{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_jv9mc_490::-webkit-scrollbar{display:none}._boxSummaryRow_jv9mc_507{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_jv9mc_515{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_jv9mc_523{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_jv9mc_535{cursor:pointer}._boxItemClickable_jv9mc_535:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_jv9mc_544{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_jv9mc_555{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_jv9mc_561{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_jv9mc_567{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_jv9mc_575{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_jv9mc_583{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_jv9mc_590{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_jv9mc_597{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_jv9mc_608{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_jv9mc_620{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_jv9mc_628{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_jv9mc_642{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_jv9mc_655{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_jv9mc_662{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_jv9mc_669{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_jv9mc_642{transition:none}}._cta_jv9mc_608:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_jv9mc_608:disabled{opacity:.6;cursor:not-allowed}._cta_jv9mc_608:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_jv9mc_694{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_jv9mc_1{padding:0;justify-content:stretch}._panel_jv9mc_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
2
|
-
import { jsx as h, jsxs as P, Fragment as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsx as h, jsxs as P, Fragment as ot } from "react/jsx-runtime";
|
|
3
|
+
import Se, { useState as B, useRef as L, useEffect as z, useCallback as ce, useMemo as I, createContext as st, useContext as ct, forwardRef as Je, createElement as De } from "react";
|
|
4
|
+
const Ne = {
|
|
5
5
|
bundleId: "_bundle_id",
|
|
6
6
|
bundleConfig: "_bundle_config",
|
|
7
7
|
bundleSource: "_bundle_source",
|
|
8
8
|
bundleTitle: "_bundle_title"
|
|
9
9
|
};
|
|
10
|
-
async function
|
|
11
|
-
const e = new URL("/api/public/bundle-config",
|
|
12
|
-
e.searchParams.set("shop",
|
|
10
|
+
async function lt(a) {
|
|
11
|
+
const e = new URL("/api/public/bundle-config", a.apiBaseUrl);
|
|
12
|
+
e.searchParams.set("shop", a.shop);
|
|
13
13
|
const i = await (await fetch(e, {
|
|
14
14
|
method: "GET",
|
|
15
|
-
signal:
|
|
15
|
+
signal: a.signal,
|
|
16
16
|
headers: { "Content-Type": "application/json" }
|
|
17
17
|
})).json().catch(() => null);
|
|
18
18
|
return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
20
|
+
const Ze = st(null);
|
|
21
|
+
function ut() {
|
|
22
22
|
try {
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
23
|
+
const a = globalThis.crypto;
|
|
24
|
+
if (a != null && a.randomUUID) return a.randomUUID();
|
|
25
25
|
} catch {
|
|
26
26
|
}
|
|
27
27
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return Number.isFinite(
|
|
29
|
+
function Ge(a) {
|
|
30
|
+
return Number.isFinite(a) ? Math.max(0, Math.floor(a)) : 0;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function $n(a) {
|
|
33
33
|
const {
|
|
34
34
|
apiBaseUrl: e,
|
|
35
35
|
shop: t,
|
|
36
36
|
cartAdapter: i,
|
|
37
37
|
configHandle: r = "default",
|
|
38
38
|
initialData: n,
|
|
39
|
-
configFetcher:
|
|
40
|
-
children:
|
|
41
|
-
} =
|
|
39
|
+
configFetcher: l,
|
|
40
|
+
children: c
|
|
41
|
+
} = a, [m, N] = B(!1), [C, T] = B(!n), [y, $] = B(!1), [V, U] = B(null), [M, O] = B((n == null ? void 0 : n.currencyCode) ?? null), [f, Q] = B((n == null ? void 0 : n.config) ?? null), [ae, le] = B(
|
|
42
42
|
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
43
|
-
), [
|
|
43
|
+
), [ue, J] = B(
|
|
44
44
|
() => ({ selections: {}, order: [] })
|
|
45
|
-
),
|
|
46
|
-
|
|
47
|
-
var
|
|
45
|
+
), ge = L(null);
|
|
46
|
+
z(() => {
|
|
47
|
+
var j;
|
|
48
48
|
if (n) return;
|
|
49
|
-
(
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
return
|
|
54
|
-
if (!
|
|
55
|
-
|
|
49
|
+
(j = ge.current) == null || j.abort();
|
|
50
|
+
const w = new AbortController();
|
|
51
|
+
ge.current = w;
|
|
52
|
+
const S = l ?? lt;
|
|
53
|
+
return T(!0), U(null), S({ apiBaseUrl: e, shop: t, signal: w.signal }).then((_) => {
|
|
54
|
+
if (!_.ok) {
|
|
55
|
+
U(_.error || "Failed to load bundle config."), Q(null), le([]), O(null);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
}).catch((
|
|
60
|
-
const F =
|
|
61
|
-
|
|
62
|
-
}).finally(() =>
|
|
63
|
-
}, [e, t, n,
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
58
|
+
O(_.currencyCode ?? null), Q(_.config), le(_.eligibleVariants ?? []);
|
|
59
|
+
}).catch((_) => {
|
|
60
|
+
const F = _ instanceof Error ? _.message : "Failed to load bundle config.";
|
|
61
|
+
U(F), Q(null), le([]), O(null);
|
|
62
|
+
}).finally(() => T(!1)), () => w.abort();
|
|
63
|
+
}, [e, t, n, l]);
|
|
64
|
+
const xe = ce(() => N(!0), []), oe = ce(() => N(!1), []), de = ce(() => N((w) => !w), []), Ce = I(() => {
|
|
65
|
+
const w = Number((f == null ? void 0 : f.maxBundleSize) ?? NaN), S = Number.isFinite(w) ? Math.floor(w) : 100;
|
|
66
|
+
return Math.max(2, Math.min(100, S));
|
|
67
|
+
}, [f == null ? void 0 : f.maxBundleSize]), Ie = ce((w, S) => {
|
|
68
|
+
const j = Ge(S);
|
|
69
|
+
J((_) => {
|
|
70
|
+
const F = _.selections[w] ?? 0, K = j - F, Be = Object.values(_.selections).reduce((W, Y) => W + (Y || 0), 0), re = K > 0 ? Math.min(K, Math.max(0, Ce - Be)) : K, me = F + re;
|
|
71
|
+
let H;
|
|
72
|
+
if (me <= 0) {
|
|
73
|
+
const { [w]: W, ...Y } = _.selections;
|
|
74
|
+
H = Y;
|
|
75
|
+
} else F === me ? H = _.selections : H = { ..._.selections, [w]: me };
|
|
76
|
+
let A = _.order;
|
|
77
|
+
if (re > 0)
|
|
78
|
+
A = [..._.order, ...Array.from({ length: re }, () => w)];
|
|
79
|
+
else if (re < 0) {
|
|
80
|
+
let W = -re;
|
|
81
|
+
const Y = [];
|
|
82
|
+
for (let fe = _.order.length - 1; fe >= 0; fe--) {
|
|
83
|
+
const pe = _.order[fe];
|
|
84
|
+
if (pe === w && W > 0) {
|
|
85
|
+
W--;
|
|
83
86
|
continue;
|
|
84
87
|
}
|
|
85
|
-
|
|
88
|
+
Y.push(pe);
|
|
86
89
|
}
|
|
87
|
-
|
|
90
|
+
Y.reverse(), A = Y;
|
|
88
91
|
}
|
|
89
|
-
return
|
|
92
|
+
return H === _.selections && A === _.order ? _ : { selections: H, order: A };
|
|
90
93
|
});
|
|
91
|
-
}, []),
|
|
92
|
-
const
|
|
93
|
-
return Number.isFinite(
|
|
94
|
-
}, [
|
|
95
|
-
var
|
|
96
|
-
if (!
|
|
97
|
-
const
|
|
94
|
+
}, [Ce]), Z = ce(() => J({ selections: {}, order: [] }), []), R = ue.selections, he = ue.order, ee = I(() => Object.values(R).reduce((w, S) => w + (S || 0), 0), [R]), te = I(() => {
|
|
95
|
+
const w = (f == null ? void 0 : f.rules) ?? [], S = w.length ? Math.min(...w.map((j) => j.minBundleSize)) : 2;
|
|
96
|
+
return Number.isFinite(S) && S > 0 ? S : 2;
|
|
97
|
+
}, [f]), se = I(() => !(C || y || V || !(f != null && f.isActive) || ee < te), [ee, f == null ? void 0 : f.isActive, V, C, te, y]), ne = ce(async () => {
|
|
98
|
+
var _;
|
|
99
|
+
if (!se || !f) return;
|
|
100
|
+
const w = ut(), S = (f.title ?? "").trim().slice(0, 255), j = Object.entries(R).map(([F, K]) => ({ merchandiseId: F, quantity: Ge(K) })).filter((F) => F.quantity > 0).map((F) => ({
|
|
98
101
|
merchandiseId: F.merchandiseId,
|
|
99
102
|
quantity: F.quantity,
|
|
100
103
|
attributes: [
|
|
101
|
-
{ key:
|
|
102
|
-
{ key:
|
|
103
|
-
{ key:
|
|
104
|
-
...
|
|
104
|
+
{ key: Ne.bundleId, value: w },
|
|
105
|
+
{ key: Ne.bundleConfig, value: r },
|
|
106
|
+
{ key: Ne.bundleSource, value: "bundle_builder" },
|
|
107
|
+
...S ? [{ key: Ne.bundleTitle, value: S }] : []
|
|
105
108
|
]
|
|
106
109
|
}));
|
|
107
|
-
if (
|
|
108
|
-
|
|
110
|
+
if (j.length) {
|
|
111
|
+
$(!0);
|
|
109
112
|
try {
|
|
110
|
-
await i.linesAdd(
|
|
113
|
+
await i.linesAdd(j), Z(), oe(), (_ = i.openCartUI) == null || _.call(i);
|
|
111
114
|
} finally {
|
|
112
|
-
|
|
115
|
+
$(!1);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
}, [
|
|
118
|
+
}, [se, i, Z, oe, f, r, R]), Te = I(
|
|
116
119
|
() => ({
|
|
117
120
|
isOpen: m,
|
|
118
|
-
open:
|
|
121
|
+
open: xe,
|
|
119
122
|
close: oe,
|
|
120
|
-
toggle:
|
|
123
|
+
toggle: de,
|
|
121
124
|
loading: C,
|
|
122
|
-
submitting:
|
|
123
|
-
error:
|
|
124
|
-
currencyCode:
|
|
125
|
-
config:
|
|
126
|
-
eligibleVariants:
|
|
127
|
-
selections:
|
|
128
|
-
selectionOrder:
|
|
129
|
-
setQuantity:
|
|
130
|
-
clearSelections:
|
|
125
|
+
submitting: y,
|
|
126
|
+
error: V,
|
|
127
|
+
currencyCode: M,
|
|
128
|
+
config: f,
|
|
129
|
+
eligibleVariants: ae,
|
|
130
|
+
selections: R,
|
|
131
|
+
selectionOrder: he,
|
|
132
|
+
setQuantity: Ie,
|
|
133
|
+
clearSelections: Z,
|
|
131
134
|
bundleSize: ee,
|
|
132
135
|
minRequired: te,
|
|
133
|
-
canSubmit:
|
|
134
|
-
submit:
|
|
136
|
+
canSubmit: se,
|
|
137
|
+
submit: ne
|
|
135
138
|
}),
|
|
136
139
|
[
|
|
137
140
|
m,
|
|
138
|
-
|
|
141
|
+
xe,
|
|
139
142
|
oe,
|
|
140
|
-
|
|
143
|
+
de,
|
|
141
144
|
C,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
ie,
|
|
147
|
-
U,
|
|
148
|
-
Q,
|
|
149
|
-
ge,
|
|
145
|
+
y,
|
|
146
|
+
V,
|
|
147
|
+
M,
|
|
148
|
+
f,
|
|
150
149
|
ae,
|
|
150
|
+
R,
|
|
151
|
+
he,
|
|
152
|
+
Ie,
|
|
153
|
+
Z,
|
|
151
154
|
ee,
|
|
152
155
|
te,
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
se,
|
|
157
|
+
ne
|
|
155
158
|
]
|
|
156
159
|
);
|
|
157
|
-
return /* @__PURE__ */ h(
|
|
160
|
+
return /* @__PURE__ */ h(Ze.Provider, { value: Te, children: c });
|
|
158
161
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
162
|
+
function Le() {
|
|
163
|
+
const a = ct(Ze);
|
|
164
|
+
if (!a)
|
|
162
165
|
throw new Error("useBundleBuilder must be used within <BundleProvider />");
|
|
163
|
-
return
|
|
166
|
+
return a;
|
|
164
167
|
}
|
|
165
|
-
function
|
|
166
|
-
const { isOpen:
|
|
167
|
-
return { isOpen:
|
|
168
|
+
function Vn() {
|
|
169
|
+
const { isOpen: a, open: e, close: t, toggle: i } = Le();
|
|
170
|
+
return { isOpen: a, open: e, close: t, toggle: i };
|
|
168
171
|
}
|
|
169
|
-
const
|
|
170
|
-
button:
|
|
172
|
+
const dt = "_button_18rtl_1", ht = {
|
|
173
|
+
button: dt
|
|
171
174
|
};
|
|
172
|
-
function
|
|
173
|
-
const { toggle: e } =
|
|
175
|
+
function Un(a) {
|
|
176
|
+
const { toggle: e } = Le();
|
|
174
177
|
return /* @__PURE__ */ h(
|
|
175
178
|
"button",
|
|
176
179
|
{
|
|
177
180
|
type: "button",
|
|
178
181
|
onClick: e,
|
|
179
|
-
className: [
|
|
180
|
-
children:
|
|
182
|
+
className: [ht.button, a.className].filter(Boolean).join(" "),
|
|
183
|
+
children: a.children ?? "Build a bundle"
|
|
181
184
|
}
|
|
182
185
|
);
|
|
183
186
|
}
|
|
184
|
-
var
|
|
185
|
-
function
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
var
|
|
187
|
+
var Re, Ke;
|
|
188
|
+
function mt() {
|
|
189
|
+
if (Ke) return Re;
|
|
190
|
+
Ke = 1;
|
|
191
|
+
var a = {
|
|
189
192
|
linear: function(e, t, i, r) {
|
|
190
193
|
var n = i - t;
|
|
191
194
|
return n * e / r + t;
|
|
@@ -275,86 +278,86 @@ function ut() {
|
|
|
275
278
|
return (e /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
|
|
276
279
|
},
|
|
277
280
|
easeInElastic: function(e, t, i, r) {
|
|
278
|
-
var n = i - t,
|
|
279
|
-
return m = 1.70158,
|
|
281
|
+
var n = i - t, l, c, m;
|
|
282
|
+
return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c)) + t);
|
|
280
283
|
},
|
|
281
284
|
easeOutElastic: function(e, t, i, r) {
|
|
282
|
-
var n = i - t,
|
|
283
|
-
return m = 1.70158,
|
|
285
|
+
var n = i - t, l, c, m;
|
|
286
|
+
return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * e) * Math.sin((e * r - m) * (2 * Math.PI) / c) + n + t);
|
|
284
287
|
},
|
|
285
288
|
easeInOutElastic: function(e, t, i, r) {
|
|
286
|
-
var n = i - t,
|
|
287
|
-
return m = 1.70158,
|
|
289
|
+
var n = i - t, l, c, m;
|
|
290
|
+
return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r / 2) === 2 ? t + n : (c || (c = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), e < 1 ? -0.5 * (l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c)) + t : l * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c) * 0.5 + n + t);
|
|
288
291
|
},
|
|
289
292
|
easeInBack: function(e, t, i, r, n) {
|
|
290
|
-
var
|
|
291
|
-
return n === void 0 && (n = 1.70158),
|
|
293
|
+
var l = i - t;
|
|
294
|
+
return n === void 0 && (n = 1.70158), l * (e /= r) * e * ((n + 1) * e - n) + t;
|
|
292
295
|
},
|
|
293
296
|
easeOutBack: function(e, t, i, r, n) {
|
|
294
|
-
var
|
|
295
|
-
return n === void 0 && (n = 1.70158),
|
|
297
|
+
var l = i - t;
|
|
298
|
+
return n === void 0 && (n = 1.70158), l * ((e = e / r - 1) * e * ((n + 1) * e + n) + 1) + t;
|
|
296
299
|
},
|
|
297
300
|
easeInOutBack: function(e, t, i, r, n) {
|
|
298
|
-
var
|
|
299
|
-
return n === void 0 && (n = 1.70158), (e /= r / 2) < 1 ?
|
|
301
|
+
var l = i - t;
|
|
302
|
+
return n === void 0 && (n = 1.70158), (e /= r / 2) < 1 ? l / 2 * (e * e * (((n *= 1.525) + 1) * e - n)) + t : l / 2 * ((e -= 2) * e * (((n *= 1.525) + 1) * e + n) + 2) + t;
|
|
300
303
|
},
|
|
301
304
|
easeInBounce: function(e, t, i, r) {
|
|
302
|
-
var n = i - t,
|
|
303
|
-
return
|
|
305
|
+
var n = i - t, l;
|
|
306
|
+
return l = a.easeOutBounce(r - e, 0, n, r), n - l + t;
|
|
304
307
|
},
|
|
305
308
|
easeOutBounce: function(e, t, i, r) {
|
|
306
309
|
var n = i - t;
|
|
307
310
|
return (e /= r) < 1 / 2.75 ? n * (7.5625 * e * e) + t : e < 2 / 2.75 ? n * (7.5625 * (e -= 1.5 / 2.75) * e + 0.75) + t : e < 2.5 / 2.75 ? n * (7.5625 * (e -= 2.25 / 2.75) * e + 0.9375) + t : n * (7.5625 * (e -= 2.625 / 2.75) * e + 0.984375) + t;
|
|
308
311
|
},
|
|
309
312
|
easeInOutBounce: function(e, t, i, r) {
|
|
310
|
-
var n = i - t,
|
|
311
|
-
return e < r / 2 ? (
|
|
313
|
+
var n = i - t, l;
|
|
314
|
+
return e < r / 2 ? (l = a.easeInBounce(e * 2, 0, n, r), l * 0.5 + t) : (l = a.easeOutBounce(e * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + t);
|
|
312
315
|
}
|
|
313
316
|
};
|
|
314
|
-
return
|
|
317
|
+
return Re = a, Re;
|
|
315
318
|
}
|
|
316
|
-
var
|
|
317
|
-
function
|
|
318
|
-
return
|
|
319
|
+
var ft = mt();
|
|
320
|
+
function pt(a) {
|
|
321
|
+
return a * Math.PI / 180;
|
|
319
322
|
}
|
|
320
|
-
function
|
|
321
|
-
return
|
|
323
|
+
function q(a, e) {
|
|
324
|
+
return a + Math.random() * (e - a);
|
|
322
325
|
}
|
|
323
|
-
function
|
|
324
|
-
return Math.floor(
|
|
326
|
+
function vt(a, e) {
|
|
327
|
+
return Math.floor(a + Math.random() * (e - a + 1));
|
|
325
328
|
}
|
|
326
|
-
var
|
|
327
|
-
(function(
|
|
328
|
-
|
|
329
|
-
})(
|
|
330
|
-
var
|
|
331
|
-
(function(
|
|
332
|
-
|
|
333
|
-
})(
|
|
334
|
-
const
|
|
335
|
-
class
|
|
329
|
+
var ye;
|
|
330
|
+
(function(a) {
|
|
331
|
+
a[a.Circle = 0] = "Circle", a[a.Square = 1] = "Square", a[a.Strip = 2] = "Strip";
|
|
332
|
+
})(ye || (ye = {}));
|
|
333
|
+
var X;
|
|
334
|
+
(function(a) {
|
|
335
|
+
a[a.Positive = 1] = "Positive", a[a.Negative = -1] = "Negative";
|
|
336
|
+
})(X || (X = {}));
|
|
337
|
+
const bt = 1e3 / 60;
|
|
338
|
+
class _t {
|
|
336
339
|
constructor(e, t, i, r) {
|
|
337
340
|
this.getOptions = t;
|
|
338
|
-
const { colors: n, initialVelocityX:
|
|
339
|
-
this.context = e, this.x = i, this.y = r, this.w =
|
|
341
|
+
const { colors: n, initialVelocityX: l, initialVelocityY: c } = this.getOptions();
|
|
342
|
+
this.context = e, this.x = i, this.y = r, this.w = q(5, 20), this.h = q(5, 20), this.radius = q(5, 10), this.vx = typeof l == "number" ? q(-l, l) : q(l.min, l.max), this.vy = typeof c == "number" ? q(-c, 0) : q(c.min, c.max), this.shape = vt(0, 2), this.angle = pt(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) ? X.Positive : X.Negative;
|
|
340
343
|
}
|
|
341
344
|
update(e) {
|
|
342
|
-
const { gravity: t, wind: i, friction: r, opacity: n, drawShape:
|
|
343
|
-
this.x += this.vx *
|
|
344
|
-
const m = 0.1 * this.rotationDirection *
|
|
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,
|
|
346
|
-
|
|
345
|
+
const { gravity: t, wind: i, friction: r, opacity: n, drawShape: l } = this.getOptions(), c = e / bt;
|
|
346
|
+
this.x += this.vx * c, this.y += this.vy * c, this.vy += t * c, this.vx += i * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection === X.Positive ? this.rotationDirection = X.Negative : this.rotateY <= -1 && this.rotationDirection === X.Negative && (this.rotationDirection = X.Positive);
|
|
347
|
+
const m = 0.1 * this.rotationDirection * c;
|
|
348
|
+
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")
|
|
349
|
+
l.call(this, this.context);
|
|
347
350
|
else
|
|
348
351
|
switch (this.shape) {
|
|
349
|
-
case
|
|
352
|
+
case ye.Circle: {
|
|
350
353
|
this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
|
|
351
354
|
break;
|
|
352
355
|
}
|
|
353
|
-
case
|
|
356
|
+
case ye.Square: {
|
|
354
357
|
this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
|
|
355
358
|
break;
|
|
356
359
|
}
|
|
357
|
-
case
|
|
360
|
+
case ye.Strip: {
|
|
358
361
|
this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
|
|
359
362
|
break;
|
|
360
363
|
}
|
|
@@ -362,31 +365,31 @@ class pt {
|
|
|
362
365
|
this.context.closePath(), this.context.restore();
|
|
363
366
|
}
|
|
364
367
|
}
|
|
365
|
-
class
|
|
368
|
+
class wt {
|
|
366
369
|
constructor(e, t) {
|
|
367
370
|
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
371
|
this.particles.splice(r, 1);
|
|
369
372
|
}, this.getParticle = () => {
|
|
370
|
-
const r =
|
|
371
|
-
return new
|
|
373
|
+
const r = q(this.x, this.w + this.x), n = q(this.y, this.h + this.y);
|
|
374
|
+
return new _t(this.context, this.getOptions, r, n);
|
|
372
375
|
}, this.animate = (r) => {
|
|
373
|
-
const { canvas: n, context:
|
|
374
|
-
if (!
|
|
376
|
+
const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: N, recycle: C, numberOfPieces: T, debug: y, tweenFunction: $, tweenDuration: V } = this.getOptions();
|
|
377
|
+
if (!N)
|
|
375
378
|
return !1;
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
m !==
|
|
379
|
-
const
|
|
380
|
-
for (let
|
|
379
|
+
const U = this.particles.length, M = C ? U : c;
|
|
380
|
+
if (M < T) {
|
|
381
|
+
m !== T && (this.tweenProgress = 0, this.tweenFrom = M, this.lastNumberOfPieces = T), this.tweenProgress = Math.min(V, Math.max(0, this.tweenProgress + r));
|
|
382
|
+
const O = $(this.tweenProgress, this.tweenFrom, T, V), f = Math.round(O - M);
|
|
383
|
+
for (let Q = 0; Q < f; Q++)
|
|
381
384
|
this.particles.push(this.getParticle());
|
|
382
|
-
this.particlesGenerated +=
|
|
385
|
+
this.particlesGenerated += f;
|
|
383
386
|
}
|
|
384
|
-
|
|
385
|
-
for (let
|
|
386
|
-
const
|
|
387
|
-
|
|
387
|
+
y && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${U}`, n.width - 10, n.height - 20));
|
|
388
|
+
for (let O = this.particles.length - 1; O >= 0; O--) {
|
|
389
|
+
const f = this.particles[O];
|
|
390
|
+
f.update(r), (f.y > n.height || f.y < -100 || f.x > n.width + 100 || f.x < -100) && (C && M <= T ? this.particles[O] = this.getParticle() : this.removeParticleAt(O));
|
|
388
391
|
}
|
|
389
|
-
return
|
|
392
|
+
return U > 0 || M < T;
|
|
390
393
|
}, this.canvas = e;
|
|
391
394
|
const i = this.canvas.getContext("2d");
|
|
392
395
|
if (!i)
|
|
@@ -394,7 +397,7 @@ class vt {
|
|
|
394
397
|
this.context = i, this.getOptions = t;
|
|
395
398
|
}
|
|
396
399
|
}
|
|
397
|
-
const
|
|
400
|
+
const ze = {
|
|
398
401
|
width: typeof window < "u" ? window.innerWidth : 300,
|
|
399
402
|
height: typeof window < "u" ? window.innerHeight : 200,
|
|
400
403
|
numberOfPieces: 200,
|
|
@@ -424,12 +427,12 @@ const qe = {
|
|
|
424
427
|
],
|
|
425
428
|
opacity: 1,
|
|
426
429
|
debug: !1,
|
|
427
|
-
tweenFunction:
|
|
430
|
+
tweenFunction: ft.easeInOutQuad,
|
|
428
431
|
tweenDuration: 5e3,
|
|
429
432
|
recycle: !0,
|
|
430
433
|
run: !0
|
|
431
434
|
};
|
|
432
|
-
class
|
|
435
|
+
class yt {
|
|
433
436
|
constructor(e, t) {
|
|
434
437
|
this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
|
|
435
438
|
const n = {
|
|
@@ -442,16 +445,16 @@ class bt {
|
|
|
442
445
|
};
|
|
443
446
|
this._options = {
|
|
444
447
|
...n,
|
|
445
|
-
...
|
|
448
|
+
...ze,
|
|
446
449
|
...r
|
|
447
450
|
}, Object.assign(this, r.confettiSource);
|
|
448
451
|
}, this.update = (r = 0) => {
|
|
449
|
-
const { options: { run: n, onConfettiComplete:
|
|
450
|
-
if (
|
|
452
|
+
const { options: { run: n, onConfettiComplete: l, frameRate: c }, canvas: m, context: N } = this, C = Math.min(r - this.lastFrameTime, 50);
|
|
453
|
+
if (c && C < 1e3 / c) {
|
|
451
454
|
this.rafId = requestAnimationFrame(this.update);
|
|
452
455
|
return;
|
|
453
456
|
}
|
|
454
|
-
this.lastFrameTime = r - (
|
|
457
|
+
this.lastFrameTime = r - (c ? C % c : 0), n && (N.fillStyle = "white", N.clearRect(0, 0, m.width, m.height)), this.generator.animate(C) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
|
|
455
458
|
}, this.reset = () => {
|
|
456
459
|
this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
|
|
457
460
|
}, this.stop = () => {
|
|
@@ -460,7 +463,7 @@ class bt {
|
|
|
460
463
|
const i = this.canvas.getContext("2d");
|
|
461
464
|
if (!i)
|
|
462
465
|
throw new Error("Could not get canvas context");
|
|
463
|
-
this.context = i, this.generator = new
|
|
466
|
+
this.context = i, this.generator = new wt(this.canvas, () => this.options), this.options = t, this.update();
|
|
464
467
|
}
|
|
465
468
|
get options() {
|
|
466
469
|
return this._options;
|
|
@@ -471,26 +474,26 @@ class bt {
|
|
|
471
474
|
this.setOptionsWithDefaults(e), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof e.recycle == "boolean" && e.recycle && i === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof e.run == "boolean" && e.run && t === !1 && this.update();
|
|
472
475
|
}
|
|
473
476
|
}
|
|
474
|
-
const
|
|
475
|
-
class
|
|
477
|
+
const gt = Se.createRef();
|
|
478
|
+
class We extends Se.Component {
|
|
476
479
|
constructor(e) {
|
|
477
|
-
super(e), this.canvas =
|
|
480
|
+
super(e), this.canvas = Se.createRef(), this.canvas = e.canvasRef || gt;
|
|
478
481
|
}
|
|
479
482
|
componentDidMount() {
|
|
480
483
|
if (this.canvas.current) {
|
|
481
|
-
const e =
|
|
482
|
-
this.confetti = new
|
|
484
|
+
const e = qe(this.props)[0];
|
|
485
|
+
this.confetti = new yt(this.canvas.current, e);
|
|
483
486
|
}
|
|
484
487
|
}
|
|
485
488
|
componentDidUpdate() {
|
|
486
|
-
const e =
|
|
489
|
+
const e = qe(this.props)[0];
|
|
487
490
|
this.confetti && (this.confetti.options = e);
|
|
488
491
|
}
|
|
489
492
|
componentWillUnmount() {
|
|
490
493
|
this.confetti && this.confetti.stop(), this.confetti = void 0;
|
|
491
494
|
}
|
|
492
495
|
render() {
|
|
493
|
-
const [e, t] =
|
|
496
|
+
const [e, t] = qe(this.props), i = {
|
|
494
497
|
zIndex: 2,
|
|
495
498
|
position: "absolute",
|
|
496
499
|
pointerEvents: "none",
|
|
@@ -503,39 +506,39 @@ class Ae extends Ie.Component {
|
|
|
503
506
|
return h("canvas", { width: e.width, height: e.height, ref: this.canvas, ...t, style: i });
|
|
504
507
|
}
|
|
505
508
|
}
|
|
506
|
-
|
|
507
|
-
...
|
|
509
|
+
We.defaultProps = {
|
|
510
|
+
...ze
|
|
508
511
|
};
|
|
509
|
-
|
|
510
|
-
function
|
|
512
|
+
We.displayName = "ReactConfetti";
|
|
513
|
+
function qe(a) {
|
|
511
514
|
const e = {}, t = {}, i = {}, r = [
|
|
512
|
-
...Object.keys(
|
|
515
|
+
...Object.keys(ze),
|
|
513
516
|
"confettiSource",
|
|
514
517
|
"drawShape",
|
|
515
518
|
"onConfettiComplete",
|
|
516
519
|
"frameRate"
|
|
517
520
|
], n = ["canvasRef"];
|
|
518
|
-
for (const
|
|
519
|
-
const
|
|
520
|
-
r.includes(
|
|
521
|
+
for (const l in a) {
|
|
522
|
+
const c = a[l];
|
|
523
|
+
r.includes(l) ? e[l] = c : n.includes(l) ? n[l] = c : i[l] = c;
|
|
521
524
|
}
|
|
522
525
|
return [e, i, t];
|
|
523
526
|
}
|
|
524
|
-
const
|
|
527
|
+
const xt = Se.forwardRef((a, e) => h(We, { canvasRef: e, ...a }));
|
|
525
528
|
/**
|
|
526
529
|
* @license lucide-react v0.515.0 - ISC
|
|
527
530
|
*
|
|
528
531
|
* This source code is licensed under the ISC license.
|
|
529
532
|
* See the LICENSE file in the root directory of this source tree.
|
|
530
533
|
*/
|
|
531
|
-
const
|
|
534
|
+
const Ct = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), It = (a) => a.replace(
|
|
532
535
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
533
536
|
(e, t, i) => i ? i.toUpperCase() : t.toLowerCase()
|
|
534
|
-
),
|
|
535
|
-
const e =
|
|
537
|
+
), He = (a) => {
|
|
538
|
+
const e = It(a);
|
|
536
539
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
537
|
-
},
|
|
538
|
-
for (const e in
|
|
540
|
+
}, et = (...a) => a.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim(), Bt = (a) => {
|
|
541
|
+
for (const e in a)
|
|
539
542
|
if (e.startsWith("aria-") || e === "role" || e === "title")
|
|
540
543
|
return !0;
|
|
541
544
|
};
|
|
@@ -545,7 +548,7 @@ const wt = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), gt = (
|
|
|
545
548
|
* This source code is licensed under the ISC license.
|
|
546
549
|
* See the LICENSE file in the root directory of this source tree.
|
|
547
550
|
*/
|
|
548
|
-
var
|
|
551
|
+
var Nt = {
|
|
549
552
|
xmlns: "http://www.w3.org/2000/svg",
|
|
550
553
|
width: 24,
|
|
551
554
|
height: 24,
|
|
@@ -562,31 +565,31 @@ var Ct = {
|
|
|
562
565
|
* This source code is licensed under the ISC license.
|
|
563
566
|
* See the LICENSE file in the root directory of this source tree.
|
|
564
567
|
*/
|
|
565
|
-
const
|
|
568
|
+
const St = Je(
|
|
566
569
|
({
|
|
567
|
-
color:
|
|
570
|
+
color: a = "currentColor",
|
|
568
571
|
size: e = 24,
|
|
569
572
|
strokeWidth: t = 2,
|
|
570
573
|
absoluteStrokeWidth: i,
|
|
571
574
|
className: r = "",
|
|
572
575
|
children: n,
|
|
573
|
-
iconNode:
|
|
574
|
-
...
|
|
575
|
-
}, m) =>
|
|
576
|
+
iconNode: l,
|
|
577
|
+
...c
|
|
578
|
+
}, m) => De(
|
|
576
579
|
"svg",
|
|
577
580
|
{
|
|
578
581
|
ref: m,
|
|
579
|
-
...
|
|
582
|
+
...Nt,
|
|
580
583
|
width: e,
|
|
581
584
|
height: e,
|
|
582
|
-
stroke:
|
|
585
|
+
stroke: a,
|
|
583
586
|
strokeWidth: i ? Number(t) * 24 / Number(e) : t,
|
|
584
|
-
className:
|
|
585
|
-
...!n && !
|
|
586
|
-
...
|
|
587
|
+
className: et("lucide", r),
|
|
588
|
+
...!n && !Bt(c) && { "aria-hidden": "true" },
|
|
589
|
+
...c
|
|
587
590
|
},
|
|
588
591
|
[
|
|
589
|
-
...
|
|
592
|
+
...l.map(([N, C]) => De(N, C)),
|
|
590
593
|
...Array.isArray(n) ? n : [n]
|
|
591
594
|
]
|
|
592
595
|
)
|
|
@@ -597,20 +600,20 @@ const It = Ge(
|
|
|
597
600
|
* This source code is licensed under the ISC license.
|
|
598
601
|
* See the LICENSE file in the root directory of this source tree.
|
|
599
602
|
*/
|
|
600
|
-
const Tt = (
|
|
601
|
-
const t =
|
|
602
|
-
({ className: i, ...r }, n) =>
|
|
603
|
+
const Tt = (a, e) => {
|
|
604
|
+
const t = Je(
|
|
605
|
+
({ className: i, ...r }, n) => De(St, {
|
|
603
606
|
ref: n,
|
|
604
607
|
iconNode: e,
|
|
605
|
-
className:
|
|
606
|
-
`lucide-${
|
|
607
|
-
`lucide-${
|
|
608
|
+
className: et(
|
|
609
|
+
`lucide-${Ct(He(a))}`,
|
|
610
|
+
`lucide-${a}`,
|
|
608
611
|
i
|
|
609
612
|
),
|
|
610
613
|
...r
|
|
611
614
|
})
|
|
612
615
|
);
|
|
613
|
-
return t.displayName =
|
|
616
|
+
return t.displayName = He(a), t;
|
|
614
617
|
};
|
|
615
618
|
/**
|
|
616
619
|
* @license lucide-react v0.515.0 - ISC
|
|
@@ -618,267 +621,273 @@ const Tt = (o, e) => {
|
|
|
618
621
|
* This source code is licensed under the ISC license.
|
|
619
622
|
* See the LICENSE file in the root directory of this source tree.
|
|
620
623
|
*/
|
|
621
|
-
const
|
|
624
|
+
const Mt = [
|
|
622
625
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
623
626
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
624
|
-
],
|
|
625
|
-
backdrop:
|
|
626
|
-
celebrationOverlay:
|
|
627
|
-
celebrationChip:
|
|
628
|
-
backdropOpen:
|
|
629
|
-
backdropClosed:
|
|
630
|
-
panel:
|
|
631
|
-
panelOpen:
|
|
632
|
-
panelClosed:
|
|
633
|
-
header:
|
|
634
|
-
headerCenter:
|
|
635
|
-
title:
|
|
636
|
-
searchIconButton:
|
|
637
|
-
headerTitleWrap:
|
|
638
|
-
headerSearchWrap:
|
|
639
|
-
headerSearchOpen:
|
|
640
|
-
searchBar:
|
|
641
|
-
searchInput:
|
|
642
|
-
searchClearButton:
|
|
643
|
-
closeButton:
|
|
644
|
-
body:
|
|
645
|
-
muted:
|
|
646
|
-
error:
|
|
647
|
-
variants:
|
|
648
|
-
variantList:
|
|
649
|
-
variantRow:
|
|
650
|
-
variantLeft:
|
|
651
|
-
addToBundleButton:
|
|
652
|
-
variantThumb:
|
|
653
|
-
variantThumbImg:
|
|
654
|
-
variantThumbFallback:
|
|
655
|
-
variantInfo:
|
|
656
|
-
variantName:
|
|
657
|
-
variantMeta:
|
|
658
|
-
variantPriceRow:
|
|
659
|
-
variantCompareAt:
|
|
660
|
-
variantPrice:
|
|
661
|
-
qtyControls:
|
|
662
|
-
qtyButton:
|
|
663
|
-
qtyValue:
|
|
664
|
-
footer:
|
|
665
|
-
boxSummaryWindow:
|
|
666
|
-
boxSummaryRow:
|
|
667
|
-
boxSlot:
|
|
668
|
-
boxItem:
|
|
669
|
-
boxItemClickable:
|
|
670
|
-
boxThresholdLabel:
|
|
671
|
-
boxItemPlaceholder:
|
|
672
|
-
boxItemFilled:
|
|
673
|
-
boxItemThreshold:
|
|
674
|
-
boxItemDiscountText:
|
|
627
|
+
], jt = Tt("search", Mt), Pt = "_backdrop_jv9mc_1", Ot = "_celebrationOverlay_jv9mc_14", Ft = "_celebrationChip_jv9mc_23", kt = "_backdropOpen_jv9mc_74", Rt = "_backdropClosed_jv9mc_78", qt = "_panel_jv9mc_82", At = "_panelOpen_jv9mc_102", Dt = "_panelClosed_jv9mc_106", Lt = "_header_jv9mc_145", zt = "_headerCenter_jv9mc_154", Wt = "_title_jv9mc_162", Et = "_searchIconButton_jv9mc_171", $t = "_headerTitleWrap_jv9mc_193", Vt = "_headerSearchWrap_jv9mc_197", Ut = "_headerSearchOpen_jv9mc_209", Qt = "_searchBar_jv9mc_221", Yt = "_searchInput_jv9mc_233", Gt = "_searchClearButton_jv9mc_254", Kt = "_closeButton_jv9mc_276", Ht = "_body_jv9mc_309", Xt = "_muted_jv9mc_314", Jt = "_error_jv9mc_319", Zt = "_variants_jv9mc_324", en = "_variantList_jv9mc_328", tn = "_variantRow_jv9mc_336", nn = "_variantLeft_jv9mc_344", rn = "_addToBundleButton_jv9mc_351", an = "_variantThumb_jv9mc_379", on = "_variantThumbImg_jv9mc_389", sn = "_variantThumbFallback_jv9mc_396", cn = "_variantInfo_jv9mc_406", ln = "_variantName_jv9mc_410", un = "_variantMeta_jv9mc_419", dn = "_variantPriceRow_jv9mc_427", hn = "_variantCompareAt_jv9mc_434", mn = "_variantPrice_jv9mc_427", fn = "_qtyControls_jv9mc_445", pn = "_qtyButton_jv9mc_451", vn = "_qtyValue_jv9mc_476", bn = "_footer_jv9mc_483", _n = "_boxSummaryWindow_jv9mc_490", wn = "_boxSummaryRow_jv9mc_507", yn = "_boxSlot_jv9mc_515", gn = "_boxItem_jv9mc_523", xn = "_boxItemClickable_jv9mc_535", Cn = "_boxThresholdLabel_jv9mc_544", In = "_boxItemPlaceholder_jv9mc_555", Bn = "_boxItemFilled_jv9mc_561", Nn = "_boxItemThreshold_jv9mc_567", Sn = "_boxItemDiscountText_jv9mc_575", Tn = "_boxItemPlus_jv9mc_583", Mn = "_boxItemImage_jv9mc_590", jn = "_boxItemFallback_jv9mc_597", Pn = "_cta_jv9mc_608", On = "_ctaTotals_jv9mc_620", Fn = "_ctaDiscountBadge_jv9mc_628", kn = "_ctaTotalsWrap_jv9mc_642", Rn = "_ctaTotalsWrapVisible_jv9mc_655", qn = "_ctaTotalsStrike_jv9mc_662", An = "_ctaTotalsPrice_jv9mc_669", u = {
|
|
628
|
+
backdrop: Pt,
|
|
629
|
+
celebrationOverlay: Ot,
|
|
630
|
+
celebrationChip: Ft,
|
|
631
|
+
backdropOpen: kt,
|
|
632
|
+
backdropClosed: Rt,
|
|
633
|
+
panel: qt,
|
|
634
|
+
panelOpen: At,
|
|
635
|
+
panelClosed: Dt,
|
|
636
|
+
header: Lt,
|
|
637
|
+
headerCenter: zt,
|
|
638
|
+
title: Wt,
|
|
639
|
+
searchIconButton: Et,
|
|
640
|
+
headerTitleWrap: $t,
|
|
641
|
+
headerSearchWrap: Vt,
|
|
642
|
+
headerSearchOpen: Ut,
|
|
643
|
+
searchBar: Qt,
|
|
644
|
+
searchInput: Yt,
|
|
645
|
+
searchClearButton: Gt,
|
|
646
|
+
closeButton: Kt,
|
|
647
|
+
body: Ht,
|
|
648
|
+
muted: Xt,
|
|
649
|
+
error: Jt,
|
|
650
|
+
variants: Zt,
|
|
651
|
+
variantList: en,
|
|
652
|
+
variantRow: tn,
|
|
653
|
+
variantLeft: nn,
|
|
654
|
+
addToBundleButton: rn,
|
|
655
|
+
variantThumb: an,
|
|
656
|
+
variantThumbImg: on,
|
|
657
|
+
variantThumbFallback: sn,
|
|
658
|
+
variantInfo: cn,
|
|
659
|
+
variantName: ln,
|
|
660
|
+
variantMeta: un,
|
|
661
|
+
variantPriceRow: dn,
|
|
662
|
+
variantCompareAt: hn,
|
|
663
|
+
variantPrice: mn,
|
|
664
|
+
qtyControls: fn,
|
|
665
|
+
qtyButton: pn,
|
|
666
|
+
qtyValue: vn,
|
|
667
|
+
footer: bn,
|
|
668
|
+
boxSummaryWindow: _n,
|
|
669
|
+
boxSummaryRow: wn,
|
|
670
|
+
boxSlot: yn,
|
|
671
|
+
boxItem: gn,
|
|
672
|
+
boxItemClickable: xn,
|
|
673
|
+
boxThresholdLabel: Cn,
|
|
674
|
+
boxItemPlaceholder: In,
|
|
675
|
+
boxItemFilled: Bn,
|
|
676
|
+
boxItemThreshold: Nn,
|
|
677
|
+
boxItemDiscountText: Sn,
|
|
675
678
|
boxItemPlus: Tn,
|
|
676
|
-
boxItemImage:
|
|
677
|
-
boxItemFallback:
|
|
678
|
-
cta:
|
|
679
|
-
ctaTotals:
|
|
680
|
-
ctaDiscountBadge:
|
|
681
|
-
ctaTotalsWrap:
|
|
682
|
-
ctaTotalsWrapVisible:
|
|
683
|
-
ctaTotalsStrike:
|
|
684
|
-
ctaTotalsPrice:
|
|
679
|
+
boxItemImage: Mn,
|
|
680
|
+
boxItemFallback: jn,
|
|
681
|
+
cta: Pn,
|
|
682
|
+
ctaTotals: On,
|
|
683
|
+
ctaDiscountBadge: Fn,
|
|
684
|
+
ctaTotalsWrap: kn,
|
|
685
|
+
ctaTotalsWrapVisible: Rn,
|
|
686
|
+
ctaTotalsStrike: qn,
|
|
687
|
+
ctaTotalsPrice: An
|
|
685
688
|
};
|
|
686
|
-
function
|
|
687
|
-
var
|
|
689
|
+
function Qn(a) {
|
|
690
|
+
var Ye;
|
|
688
691
|
const {
|
|
689
692
|
isOpen: e,
|
|
690
693
|
close: t,
|
|
691
694
|
loading: i,
|
|
692
695
|
submitting: r,
|
|
693
696
|
error: n,
|
|
694
|
-
currencyCode:
|
|
695
|
-
config:
|
|
697
|
+
currencyCode: l,
|
|
698
|
+
config: c,
|
|
696
699
|
eligibleVariants: m,
|
|
697
|
-
selections:
|
|
700
|
+
selections: N,
|
|
698
701
|
selectionOrder: C,
|
|
699
|
-
setQuantity:
|
|
700
|
-
bundleSize:
|
|
701
|
-
minRequired:
|
|
702
|
-
canSubmit:
|
|
703
|
-
submit:
|
|
704
|
-
} =
|
|
705
|
-
const s =
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
702
|
+
setQuantity: T,
|
|
703
|
+
bundleSize: y,
|
|
704
|
+
minRequired: $,
|
|
705
|
+
canSubmit: V,
|
|
706
|
+
submit: U
|
|
707
|
+
} = Le(), [M, O] = B(!1), [f, Q] = B(""), ae = L(null), le = L(null), ue = L(null), [J, ge] = B(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [xe, oe] = B(0), [de, Ce] = B(null), [Ie, Z] = B(!1), R = L(null), he = L(y), ee = 7e3, [te, se] = B(0), [ne, Te] = B(null), [w, S] = B(!1), j = L(null), _ = 2800, F = (o) => {
|
|
708
|
+
const s = Number.parseFloat(o);
|
|
709
|
+
return Number.isFinite(s) ? String(Math.round(s)) : o;
|
|
710
|
+
}, K = (o) => {
|
|
711
|
+
const s = (o ?? []).filter((d) => {
|
|
712
|
+
var g, b;
|
|
713
|
+
const v = (g = d == null ? void 0 : d.name) == null ? void 0 : g.trim(), p = (b = d == null ? void 0 : d.value) == null ? void 0 : b.trim();
|
|
714
|
+
return !(!v || !p || v.toLowerCase() === "title");
|
|
709
715
|
});
|
|
710
716
|
return s.length ? s.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
|
|
711
|
-
},
|
|
717
|
+
}, Be = (o) => {
|
|
712
718
|
var s;
|
|
713
|
-
return ((s =
|
|
714
|
-
},
|
|
715
|
-
const s =
|
|
719
|
+
return ((s = o.product) == null ? void 0 : s.title) ?? o.displayName ?? o.title;
|
|
720
|
+
}, re = (o) => {
|
|
721
|
+
const s = Be(o), d = K(o.selectedOptions);
|
|
716
722
|
return [s, d].filter(Boolean).join(" — ");
|
|
717
|
-
}, [me, H] =
|
|
718
|
-
const s = Number(
|
|
719
|
-
if (!Number.isFinite(s)) return
|
|
720
|
-
if (
|
|
723
|
+
}, [me, H] = B(e), A = L(null), W = (o) => {
|
|
724
|
+
const s = Number(o);
|
|
725
|
+
if (!Number.isFinite(s)) return o;
|
|
726
|
+
if (l)
|
|
721
727
|
try {
|
|
722
|
-
return new Intl.NumberFormat(void 0, { style: "currency", currency:
|
|
728
|
+
return new Intl.NumberFormat(void 0, { style: "currency", currency: l }).format(s);
|
|
723
729
|
} catch {
|
|
724
730
|
}
|
|
725
731
|
return `$${s.toFixed(2)}`;
|
|
726
|
-
},
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
732
|
+
}, Y = ((Ye = c == null ? void 0 : c.title) == null ? void 0 : Ye.trim()) || "Build your bundle", fe = I(() => {
|
|
733
|
+
const o = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(o) ? Math.floor(o) : 100;
|
|
734
|
+
return Math.max(2, Math.min(100, s));
|
|
735
|
+
}, [c == null ? void 0 : c.maxBundleSize]), pe = y >= fe, Me = I(() => [...m].sort((o, s) => o.displayName.localeCompare(s.displayName)), [m]), tt = I(() => {
|
|
736
|
+
const o = f.trim().toLowerCase();
|
|
737
|
+
if (!o) return Me;
|
|
738
|
+
const s = o.split(/\s+/).filter(Boolean), d = (v) => {
|
|
739
|
+
var b;
|
|
740
|
+
const p = [];
|
|
741
|
+
p.push(v.displayName), (b = v.product) != null && b.title && p.push(v.product.title);
|
|
742
|
+
for (const x of v.selectedOptions ?? [])
|
|
743
|
+
p.push(x.name), p.push(x.value);
|
|
744
|
+
const g = p.join(" ").toLowerCase();
|
|
745
|
+
return s.every((x) => g.includes(x));
|
|
737
746
|
};
|
|
738
|
-
return
|
|
739
|
-
}, [
|
|
740
|
-
let
|
|
747
|
+
return Me.filter(d);
|
|
748
|
+
}, [f, Me]), k = I(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), ve = I(() => Math.max(0, $ - y), [y, $]), je = I(() => {
|
|
749
|
+
let o = null;
|
|
741
750
|
for (const s of k)
|
|
742
|
-
|
|
743
|
-
return
|
|
744
|
-
}, [
|
|
745
|
-
if (!
|
|
746
|
-
const
|
|
747
|
-
return !Number.isFinite(
|
|
748
|
-
}, [
|
|
749
|
-
const
|
|
750
|
-
if (!
|
|
751
|
-
const s = Number.parseFloat(
|
|
751
|
+
y >= s.minBundleSize && (o = s);
|
|
752
|
+
return o;
|
|
753
|
+
}, [y, k]), be = I(() => {
|
|
754
|
+
if (!je) return null;
|
|
755
|
+
const o = Number.parseFloat(je.discountPercent);
|
|
756
|
+
return !Number.isFinite(o) || o <= 0 ? null : o;
|
|
757
|
+
}, [je]), nt = I(() => {
|
|
758
|
+
const o = k[0];
|
|
759
|
+
if (!o) return null;
|
|
760
|
+
const s = Number.parseFloat(o.discountPercent);
|
|
752
761
|
return !Number.isFinite(s) || s <= 0 ? null : s;
|
|
753
|
-
}, [k]),
|
|
754
|
-
const
|
|
762
|
+
}, [k]), Pe = be ?? nt, _e = I(() => {
|
|
763
|
+
const o = new Map(m.map((d) => [d.id, d]));
|
|
755
764
|
let s = 0;
|
|
756
|
-
for (const [d,
|
|
757
|
-
const
|
|
758
|
-
if (
|
|
759
|
-
const
|
|
760
|
-
Number.isFinite(
|
|
765
|
+
for (const [d, v] of Object.entries(N)) {
|
|
766
|
+
const p = v ?? 0;
|
|
767
|
+
if (p <= 0) continue;
|
|
768
|
+
const g = o.get(d), b = Number(g == null ? void 0 : g.price);
|
|
769
|
+
Number.isFinite(b) && (s += b * p);
|
|
761
770
|
}
|
|
762
771
|
return Math.round(s * 100) / 100;
|
|
763
|
-
}, [m,
|
|
764
|
-
if (!
|
|
765
|
-
const
|
|
766
|
-
return Math.round(
|
|
767
|
-
}, [
|
|
768
|
-
const
|
|
769
|
-
return C.map((s) =>
|
|
770
|
-
}, [m, C]),
|
|
772
|
+
}, [m, N]), rt = I(() => {
|
|
773
|
+
if (!be) return _e;
|
|
774
|
+
const o = _e * (1 - be / 100);
|
|
775
|
+
return Math.round(o * 100) / 100;
|
|
776
|
+
}, [be, _e]), Ee = I(() => k.length ? Math.max(...k.map((o) => o.minBundleSize)) : 0, [k]), Oe = I(() => {
|
|
777
|
+
const o = new Map(m.map((s) => [s.id, s]));
|
|
778
|
+
return C.map((s) => o.get(s)).filter((s) => !!s);
|
|
779
|
+
}, [m, C]), it = I(() => {
|
|
771
780
|
var s;
|
|
772
|
-
const
|
|
781
|
+
const o = /* @__PURE__ */ new Map();
|
|
773
782
|
for (const d of k) {
|
|
774
|
-
const
|
|
775
|
-
|
|
783
|
+
const v = Math.max(0, d.minBundleSize - 1);
|
|
784
|
+
o.set(v, {
|
|
776
785
|
discountPercent: d.discountPercent,
|
|
777
786
|
minBundleSize: d.minBundleSize,
|
|
778
787
|
label: ((s = d.label) == null ? void 0 : s.trim()) || `Buy ${d.minBundleSize}+`
|
|
779
788
|
});
|
|
780
789
|
}
|
|
781
|
-
return
|
|
782
|
-
}, [k]),
|
|
783
|
-
const s =
|
|
790
|
+
return o;
|
|
791
|
+
}, [k]), at = I(() => Math.max(Ee || $, Oe.length), [Oe.length, Ee, $]), Fe = L(null), $e = L(null), Ve = L(null), Ue = L(y), Qe = (o) => {
|
|
792
|
+
const s = $e.current;
|
|
784
793
|
if (!s) return;
|
|
785
|
-
const d = s.querySelector(`[data-variant-row="${
|
|
794
|
+
const d = s.querySelector(`[data-variant-row="${o}"]`);
|
|
786
795
|
if (!d) return;
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
const
|
|
796
|
+
const v = s.getBoundingClientRect(), p = d.getBoundingClientRect(), g = 8;
|
|
797
|
+
if (p.top >= v.top + g && p.bottom <= v.bottom - g) return;
|
|
798
|
+
const x = Math.max(0, s.scrollHeight - s.clientHeight), D = p.top - v.top + p.height / 2, E = s.scrollTop + D - s.clientHeight / 2, G = Math.min(x, Math.max(0, E));
|
|
790
799
|
s.scrollTo({ top: G, behavior: "smooth" });
|
|
791
800
|
};
|
|
792
|
-
return
|
|
801
|
+
return z(() => {
|
|
793
802
|
if (!e) return;
|
|
794
|
-
const
|
|
803
|
+
const o = (s) => {
|
|
795
804
|
s.key === "Escape" && t();
|
|
796
805
|
};
|
|
797
|
-
return window.addEventListener("keydown",
|
|
798
|
-
}, [t, e]),
|
|
806
|
+
return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
|
|
807
|
+
}, [t, e]), z(() => {
|
|
799
808
|
if (typeof window > "u") return;
|
|
800
|
-
const
|
|
801
|
-
return
|
|
802
|
-
}, []),
|
|
803
|
-
if (
|
|
809
|
+
const o = () => ge({ width: window.innerWidth, height: window.innerHeight });
|
|
810
|
+
return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
|
|
811
|
+
}, []), z(() => {
|
|
812
|
+
if (A.current != null && (window.clearTimeout(A.current), A.current = null), e) {
|
|
804
813
|
H(!0);
|
|
805
814
|
return;
|
|
806
815
|
}
|
|
807
|
-
|
|
808
|
-
H(!1),
|
|
816
|
+
A.current = window.setTimeout(() => {
|
|
817
|
+
H(!1), A.current = null;
|
|
809
818
|
}, 220);
|
|
810
|
-
}, [e]),
|
|
811
|
-
|
|
812
|
-
}, []),
|
|
813
|
-
|
|
814
|
-
}, []),
|
|
815
|
-
|
|
816
|
-
}, []),
|
|
817
|
-
if (!e || !
|
|
818
|
-
const
|
|
819
|
+
}, [e]), z(() => () => {
|
|
820
|
+
A.current != null && window.clearTimeout(A.current);
|
|
821
|
+
}, []), z(() => () => {
|
|
822
|
+
R.current != null && window.clearTimeout(R.current);
|
|
823
|
+
}, []), z(() => () => {
|
|
824
|
+
j.current != null && window.clearTimeout(j.current);
|
|
825
|
+
}, []), z(() => {
|
|
826
|
+
if (!e || !M) return;
|
|
827
|
+
const o = requestAnimationFrame(() => {
|
|
819
828
|
var s;
|
|
820
|
-
return (s =
|
|
829
|
+
return (s = ae.current) == null ? void 0 : s.focus();
|
|
821
830
|
});
|
|
822
|
-
return () => cancelAnimationFrame(
|
|
823
|
-
}, [e,
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
826
|
-
const s =
|
|
831
|
+
return () => cancelAnimationFrame(o);
|
|
832
|
+
}, [e, M]), z(() => {
|
|
833
|
+
const o = Ue.current;
|
|
834
|
+
if (Ue.current = y, y <= o) return;
|
|
835
|
+
const s = Ve.current;
|
|
827
836
|
if (!s) return;
|
|
828
|
-
const d = k.some((
|
|
829
|
-
if (
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
if (!
|
|
833
|
-
const
|
|
834
|
-
if (
|
|
835
|
-
const G = Math.max(0, s.scrollWidth - s.clientWidth),
|
|
836
|
-
s.scrollTo({ left:
|
|
837
|
+
const d = k.some((b) => b.minBundleSize === y), v = k.find((b) => b.minBundleSize > y), p = v && d ? v.minBundleSize - 1 : v ? null : y - 1;
|
|
838
|
+
if (p == null || p < 0) return;
|
|
839
|
+
const g = requestAnimationFrame(() => {
|
|
840
|
+
const b = s.querySelector(`[data-box-slot="${p}"]`);
|
|
841
|
+
if (!b) return;
|
|
842
|
+
const x = s.getBoundingClientRect(), E = b.getBoundingClientRect().right - x.right;
|
|
843
|
+
if (E <= 1) return;
|
|
844
|
+
const G = Math.max(0, s.scrollWidth - s.clientWidth), ie = Math.min(G, Math.max(0, s.scrollLeft + E));
|
|
845
|
+
s.scrollTo({ left: ie, behavior: "smooth" });
|
|
837
846
|
});
|
|
838
|
-
return () => cancelAnimationFrame(
|
|
839
|
-
}, [
|
|
847
|
+
return () => cancelAnimationFrame(g);
|
|
848
|
+
}, [y, k]), z(() => {
|
|
840
849
|
if (!e) return;
|
|
841
|
-
const
|
|
842
|
-
if (
|
|
843
|
-
const s = k.find((d) => d.minBundleSize ===
|
|
844
|
-
s && (
|
|
845
|
-
|
|
846
|
-
},
|
|
847
|
-
}, [
|
|
848
|
-
if (!e || !
|
|
849
|
-
const
|
|
850
|
-
var
|
|
851
|
-
const s =
|
|
852
|
-
x:
|
|
853
|
-
y:
|
|
850
|
+
const o = he.current;
|
|
851
|
+
if (he.current = y, y <= o) return;
|
|
852
|
+
const s = k.find((d) => d.minBundleSize === y);
|
|
853
|
+
s && (Te(`You received a ${F(s.discountPercent)}% discount!`), se((d) => d + 1), S(!0), j.current != null && window.clearTimeout(j.current), j.current = window.setTimeout(() => {
|
|
854
|
+
S(!1), j.current = null;
|
|
855
|
+
}, _));
|
|
856
|
+
}, [y, e, k]), z(() => {
|
|
857
|
+
if (!e || !w || !ne) return;
|
|
858
|
+
const o = requestAnimationFrame(() => {
|
|
859
|
+
var x;
|
|
860
|
+
const s = ue.current, d = s == null ? void 0 : s.getBoundingClientRect(), v = (x = Fe.current) == null ? void 0 : x.getBoundingClientRect(), p = d ? d.left + d.width / 2 : v ? v.left + v.width / 2 : window.innerWidth / 2, g = d ? d.top + d.height / 2 : v ? v.top + v.height / 2 : window.innerHeight / 2, b = {
|
|
861
|
+
x: p - 2,
|
|
862
|
+
y: g - 2,
|
|
854
863
|
w: 4,
|
|
855
864
|
h: 4
|
|
856
865
|
};
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
},
|
|
866
|
+
Ce(b), oe((D) => D + 1), Z(!0), R.current != null && window.clearTimeout(R.current), R.current = window.setTimeout(() => {
|
|
867
|
+
Z(!1), R.current = null;
|
|
868
|
+
}, ee);
|
|
860
869
|
});
|
|
861
|
-
return () => cancelAnimationFrame(
|
|
862
|
-
}, [
|
|
863
|
-
var
|
|
864
|
-
e && ((
|
|
870
|
+
return () => cancelAnimationFrame(o);
|
|
871
|
+
}, [te, ne, ee, w, e]), z(() => {
|
|
872
|
+
var o;
|
|
873
|
+
e && ((o = Fe.current) == null || o.focus());
|
|
865
874
|
}, [e]), me ? /* @__PURE__ */ P(
|
|
866
875
|
"div",
|
|
867
876
|
{
|
|
868
877
|
role: "dialog",
|
|
869
878
|
"aria-modal": "true",
|
|
870
879
|
"aria-label": "Bundle builder",
|
|
871
|
-
className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed,
|
|
872
|
-
onMouseDown: (
|
|
873
|
-
|
|
880
|
+
className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed, a.className].filter(Boolean).join(" "),
|
|
881
|
+
onMouseDown: (o) => {
|
|
882
|
+
o.target === o.currentTarget && t();
|
|
874
883
|
},
|
|
875
884
|
children: [
|
|
876
|
-
|
|
877
|
-
|
|
885
|
+
Ie && de && J.width > 0 && J.height > 0 ? /* @__PURE__ */ h(
|
|
886
|
+
xt,
|
|
878
887
|
{
|
|
879
|
-
width:
|
|
880
|
-
height:
|
|
881
|
-
confettiSource:
|
|
888
|
+
width: J.width,
|
|
889
|
+
height: J.height,
|
|
890
|
+
confettiSource: de,
|
|
882
891
|
colors: [
|
|
883
892
|
"#2563eb",
|
|
884
893
|
// blue-600
|
|
@@ -901,52 +910,52 @@ function Vn(o) {
|
|
|
901
910
|
initialVelocityX: { min: -6, max: 6 },
|
|
902
911
|
style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
|
|
903
912
|
},
|
|
904
|
-
|
|
913
|
+
xe
|
|
905
914
|
) : null,
|
|
906
|
-
/* @__PURE__ */ P("aside", { ref:
|
|
907
|
-
|
|
908
|
-
/* @__PURE__ */ P("header", { className: [u.header,
|
|
915
|
+
/* @__PURE__ */ P("aside", { ref: Fe, className: [u.panel, e ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
|
|
916
|
+
w && ne ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: ue, className: u.celebrationChip, children: ne }, te) }) : null,
|
|
917
|
+
/* @__PURE__ */ P("header", { className: [u.header, M ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
|
|
909
918
|
/* @__PURE__ */ h(
|
|
910
919
|
"button",
|
|
911
920
|
{
|
|
912
921
|
type: "button",
|
|
913
922
|
className: u.searchIconButton,
|
|
914
|
-
"aria-label":
|
|
915
|
-
"aria-expanded":
|
|
923
|
+
"aria-label": M ? "Search (expanded)" : "Search",
|
|
924
|
+
"aria-expanded": M,
|
|
916
925
|
onClick: () => {
|
|
917
|
-
|
|
926
|
+
O(!0);
|
|
918
927
|
},
|
|
919
|
-
children: /* @__PURE__ */ h(
|
|
928
|
+
children: /* @__PURE__ */ h(jt, { size: 18, "aria-hidden": "true" })
|
|
920
929
|
}
|
|
921
930
|
),
|
|
922
931
|
/* @__PURE__ */ P("div", { className: u.headerCenter, children: [
|
|
923
|
-
/* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden":
|
|
924
|
-
/* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !
|
|
932
|
+
/* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": M, children: /* @__PURE__ */ h("h2", { className: u.title, children: Y }) }),
|
|
933
|
+
/* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !M, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
|
|
925
934
|
/* @__PURE__ */ h(
|
|
926
935
|
"input",
|
|
927
936
|
{
|
|
928
|
-
ref:
|
|
937
|
+
ref: ae,
|
|
929
938
|
className: u.searchInput,
|
|
930
939
|
type: "search",
|
|
931
|
-
value:
|
|
940
|
+
value: f,
|
|
932
941
|
placeholder: "Search",
|
|
933
|
-
onChange: (
|
|
942
|
+
onChange: (o) => Q(o.target.value),
|
|
934
943
|
onBlur: () => {
|
|
935
|
-
|
|
944
|
+
f.trim() === "" && O(!1);
|
|
936
945
|
}
|
|
937
946
|
}
|
|
938
947
|
),
|
|
939
|
-
|
|
948
|
+
f.trim() ? /* @__PURE__ */ h(
|
|
940
949
|
"button",
|
|
941
950
|
{
|
|
942
951
|
type: "button",
|
|
943
952
|
className: u.searchClearButton,
|
|
944
|
-
onMouseDown: (
|
|
945
|
-
|
|
953
|
+
onMouseDown: (o) => {
|
|
954
|
+
o.preventDefault();
|
|
946
955
|
},
|
|
947
956
|
onClick: () => {
|
|
948
|
-
var
|
|
949
|
-
|
|
957
|
+
var o;
|
|
958
|
+
Q(""), (o = ae.current) == null || o.focus();
|
|
950
959
|
},
|
|
951
960
|
"aria-label": "Clear search",
|
|
952
961
|
children: "Clear"
|
|
@@ -956,31 +965,31 @@ function Vn(o) {
|
|
|
956
965
|
] }),
|
|
957
966
|
/* @__PURE__ */ h("button", { type: "button", onClick: t, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
|
|
958
967
|
] }),
|
|
959
|
-
/* @__PURE__ */ P("div", { className: u.body, ref:
|
|
968
|
+
/* @__PURE__ */ P("div", { className: u.body, ref: $e, children: [
|
|
960
969
|
i ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
|
|
961
970
|
n ? /* @__PURE__ */ h("p", { className: u.error, children: n }) : null,
|
|
962
|
-
!i &&
|
|
963
|
-
/* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children:
|
|
964
|
-
var
|
|
965
|
-
const s =
|
|
966
|
-
return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row":
|
|
971
|
+
!i && c && !c.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
|
|
972
|
+
/* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children: tt.map((o) => {
|
|
973
|
+
var E, G, ie, we;
|
|
974
|
+
const s = N[o.id] ?? 0, d = Be(o), v = K(o.selectedOptions), p = re(o), g = Pe, b = Number(o.price), x = g != null && Number.isFinite(g) && g > 0 && Number.isFinite(b), D = x ? Math.round(b * (1 - g / 100) * 100) / 100 : null;
|
|
975
|
+
return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": o.id, children: [
|
|
967
976
|
/* @__PURE__ */ P("div", { className: u.variantLeft, children: [
|
|
968
|
-
/* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (
|
|
977
|
+
/* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (E = o.image) != null && E.url ? /* @__PURE__ */ h(
|
|
969
978
|
"img",
|
|
970
979
|
{
|
|
971
980
|
className: u.variantThumbImg,
|
|
972
|
-
src:
|
|
973
|
-
alt:
|
|
981
|
+
src: o.image.url,
|
|
982
|
+
alt: o.image.altText ?? p,
|
|
974
983
|
loading: "lazy"
|
|
975
984
|
}
|
|
976
|
-
) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((
|
|
985
|
+
) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((we = (ie = (G = o.product) == null ? void 0 : G.title) == null ? void 0 : ie.slice(0, 1)) == null ? void 0 : we.toUpperCase()) ?? "•" }) }),
|
|
977
986
|
/* @__PURE__ */ P("div", { className: u.variantInfo, children: [
|
|
978
987
|
/* @__PURE__ */ h("div", { className: u.variantName, children: d }),
|
|
979
|
-
|
|
988
|
+
v ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: v }) : null,
|
|
980
989
|
/* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
|
|
981
|
-
|
|
982
|
-
/* @__PURE__ */ h("span", { className: u.variantPrice, children:
|
|
983
|
-
|
|
990
|
+
x ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: W(Number.isFinite(b) ? b.toFixed(2) : o.price) }) : null,
|
|
991
|
+
/* @__PURE__ */ h("span", { className: u.variantPrice, children: W(
|
|
992
|
+
D != null ? D.toFixed(2) : Number.isFinite(b) ? b.toFixed(2) : o.price
|
|
984
993
|
) })
|
|
985
994
|
] })
|
|
986
995
|
] })
|
|
@@ -989,10 +998,10 @@ function Vn(o) {
|
|
|
989
998
|
"button",
|
|
990
999
|
{
|
|
991
1000
|
type: "button",
|
|
992
|
-
onClick: () =>
|
|
993
|
-
disabled: r,
|
|
1001
|
+
onClick: () => T(o.id, 1),
|
|
1002
|
+
disabled: r || pe,
|
|
994
1003
|
className: u.addToBundleButton,
|
|
995
|
-
"aria-label": `Add ${
|
|
1004
|
+
"aria-label": `Add ${p} to bundle`,
|
|
996
1005
|
children: "Add"
|
|
997
1006
|
}
|
|
998
1007
|
) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
|
|
@@ -1000,10 +1009,10 @@ function Vn(o) {
|
|
|
1000
1009
|
"button",
|
|
1001
1010
|
{
|
|
1002
1011
|
type: "button",
|
|
1003
|
-
onClick: () =>
|
|
1012
|
+
onClick: () => T(o.id, s - 1),
|
|
1004
1013
|
disabled: r || s <= 0,
|
|
1005
1014
|
className: u.qtyButton,
|
|
1006
|
-
"aria-label": `Decrease ${
|
|
1015
|
+
"aria-label": `Decrease ${p}`,
|
|
1007
1016
|
children: "−"
|
|
1008
1017
|
}
|
|
1009
1018
|
),
|
|
@@ -1012,40 +1021,40 @@ function Vn(o) {
|
|
|
1012
1021
|
"button",
|
|
1013
1022
|
{
|
|
1014
1023
|
type: "button",
|
|
1015
|
-
onClick: () =>
|
|
1016
|
-
disabled: r,
|
|
1024
|
+
onClick: () => T(o.id, s + 1),
|
|
1025
|
+
disabled: r || pe,
|
|
1017
1026
|
className: u.qtyButton,
|
|
1018
|
-
"aria-label": `Increase ${
|
|
1027
|
+
"aria-label": `Increase ${p}`,
|
|
1019
1028
|
children: "+"
|
|
1020
1029
|
}
|
|
1021
1030
|
)
|
|
1022
1031
|
] })
|
|
1023
|
-
] },
|
|
1032
|
+
] }, o.id);
|
|
1024
1033
|
}) }) })
|
|
1025
1034
|
] }),
|
|
1026
|
-
/* @__PURE__ */ P("footer", { className: u.footer, ref:
|
|
1027
|
-
/* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref:
|
|
1028
|
-
var
|
|
1029
|
-
const d =
|
|
1035
|
+
/* @__PURE__ */ P("footer", { className: u.footer, ref: le, children: [
|
|
1036
|
+
/* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: Ve, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: at }).map((o, s) => {
|
|
1037
|
+
var E, G, ie, we;
|
|
1038
|
+
const d = Oe[s], v = it.get(s), p = !!d, g = !!v, b = g && !p, x = v ? `${v.discountPercent}% off` : null, D = p ? d.displayName : `Slot ${s + 1}`;
|
|
1030
1039
|
return /* @__PURE__ */ P("div", { "data-box-slot": s, className: u.boxSlot, children: [
|
|
1031
1040
|
/* @__PURE__ */ h(
|
|
1032
1041
|
"div",
|
|
1033
1042
|
{
|
|
1034
1043
|
className: [
|
|
1035
1044
|
u.boxItem,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1045
|
+
p ? u.boxItemFilled : u.boxItemPlaceholder,
|
|
1046
|
+
g ? u.boxItemThreshold : null,
|
|
1047
|
+
p ? u.boxItemClickable : null
|
|
1039
1048
|
].filter(Boolean).join(" "),
|
|
1040
|
-
role:
|
|
1041
|
-
tabIndex:
|
|
1042
|
-
onClick:
|
|
1043
|
-
onKeyDown:
|
|
1044
|
-
(
|
|
1049
|
+
role: p ? "button" : void 0,
|
|
1050
|
+
tabIndex: p ? 0 : void 0,
|
|
1051
|
+
onClick: p ? () => Qe(d.id) : void 0,
|
|
1052
|
+
onKeyDown: p ? (ke) => {
|
|
1053
|
+
(ke.key === "Enter" || ke.key === " ") && (ke.preventDefault(), Qe(d.id));
|
|
1045
1054
|
} : void 0,
|
|
1046
|
-
"aria-label":
|
|
1047
|
-
title:
|
|
1048
|
-
children:
|
|
1055
|
+
"aria-label": b && x ? `${D}. Unlocks ${x}.` : D,
|
|
1056
|
+
title: b && x ? `${D} • Unlocks ${x}` : D,
|
|
1057
|
+
children: p ? (E = d.image) != null && E.url ? /* @__PURE__ */ h(
|
|
1049
1058
|
"img",
|
|
1050
1059
|
{
|
|
1051
1060
|
className: u.boxItemImage,
|
|
@@ -1053,61 +1062,61 @@ function Vn(o) {
|
|
|
1053
1062
|
alt: d.image.altText ?? d.displayName,
|
|
1054
1063
|
loading: "lazy"
|
|
1055
1064
|
}
|
|
1056
|
-
) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((
|
|
1065
|
+
) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((we = (ie = (G = d.product) == null ? void 0 : G.title) == null ? void 0 : ie.slice(0, 1)) == null ? void 0 : we.toUpperCase()) ?? "•" }) : b && x ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: x }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
|
|
1057
1066
|
}
|
|
1058
1067
|
),
|
|
1059
|
-
|
|
1068
|
+
g ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: v.label }) : null
|
|
1060
1069
|
] }, s);
|
|
1061
1070
|
}) }) }),
|
|
1062
1071
|
/* @__PURE__ */ h(
|
|
1063
1072
|
"div",
|
|
1064
1073
|
{
|
|
1065
|
-
className: [u.ctaTotalsWrap,
|
|
1066
|
-
"aria-hidden":
|
|
1074
|
+
className: [u.ctaTotalsWrap, ve <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
|
|
1075
|
+
"aria-hidden": ve > 0,
|
|
1067
1076
|
children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
|
|
1068
|
-
|
|
1069
|
-
|
|
1077
|
+
Pe ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
|
|
1078
|
+
Pe,
|
|
1070
1079
|
"% Discount"
|
|
1071
1080
|
] }) : /* @__PURE__ */ h("span", {}),
|
|
1072
|
-
/* @__PURE__ */ h("span", { children:
|
|
1073
|
-
/* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children:
|
|
1081
|
+
/* @__PURE__ */ h("span", { children: be ? /* @__PURE__ */ P(ot, { children: [
|
|
1082
|
+
/* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: W(_e.toFixed(2)) }),
|
|
1074
1083
|
" ",
|
|
1075
|
-
/* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children:
|
|
1076
|
-
] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children:
|
|
1084
|
+
/* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: W(rt.toFixed(2)) })
|
|
1085
|
+
] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: W(_e.toFixed(2)) }) })
|
|
1077
1086
|
] })
|
|
1078
1087
|
}
|
|
1079
1088
|
),
|
|
1080
|
-
/* @__PURE__ */ h("button", { type: "button", onClick:
|
|
1089
|
+
/* @__PURE__ */ h("button", { type: "button", onClick: U, disabled: !V, className: u.cta, children: r ? "Adding…" : ve > 0 ? `Add ${ve} more product${ve === 1 ? "" : "s"}` : "Add to Basket" })
|
|
1081
1090
|
] })
|
|
1082
1091
|
] })
|
|
1083
1092
|
]
|
|
1084
1093
|
}
|
|
1085
1094
|
) : null;
|
|
1086
1095
|
}
|
|
1087
|
-
function
|
|
1088
|
-
if (
|
|
1089
|
-
return
|
|
1096
|
+
function Xe(a) {
|
|
1097
|
+
if (a != null && a.length)
|
|
1098
|
+
return a.reduce((e, t) => (t != null && t.key && (e[t.key] = t.value ?? ""), e), {});
|
|
1090
1099
|
}
|
|
1091
|
-
function
|
|
1092
|
-
const e = /\/(\d+)$/.exec(
|
|
1093
|
-
return e ? e[1] :
|
|
1100
|
+
function Dn(a) {
|
|
1101
|
+
const e = /\/(\d+)$/.exec(a);
|
|
1102
|
+
return e ? e[1] : a;
|
|
1094
1103
|
}
|
|
1095
|
-
function
|
|
1096
|
-
var
|
|
1097
|
-
return ((
|
|
1104
|
+
function Ln() {
|
|
1105
|
+
var a;
|
|
1106
|
+
return ((a = window == null ? void 0 : window.routes) == null ? void 0 : a.cart_url) || "/cart";
|
|
1098
1107
|
}
|
|
1099
|
-
async function
|
|
1108
|
+
async function zn() {
|
|
1100
1109
|
try {
|
|
1101
|
-
const
|
|
1110
|
+
const a = Ln(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${a}?sections=${e}`, { method: "GET" });
|
|
1102
1111
|
if (!t.ok) return;
|
|
1103
1112
|
const i = await t.json().catch(() => null);
|
|
1104
1113
|
if (!i) return;
|
|
1105
1114
|
const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
|
|
1106
|
-
for (const
|
|
1107
|
-
const m = i[
|
|
1115
|
+
for (const c of r) {
|
|
1116
|
+
const m = i[c];
|
|
1108
1117
|
if (!m) continue;
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1118
|
+
const N = new DOMParser().parseFromString(m, "text/html"), C = N.getElementById(c) || N.querySelector(c), T = document.getElementById(c) || document.querySelector(c);
|
|
1119
|
+
T && C && T.replaceWith(C);
|
|
1111
1120
|
}
|
|
1112
1121
|
const n = document.querySelector("cart-drawer");
|
|
1113
1122
|
if (n && typeof n.open == "function") {
|
|
@@ -1115,13 +1124,13 @@ async function An() {
|
|
|
1115
1124
|
return;
|
|
1116
1125
|
}
|
|
1117
1126
|
document.body.classList.add("overflow-hidden");
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1127
|
+
const l = document.querySelector("cart-drawer") || document.querySelector("cart-notification");
|
|
1128
|
+
l && (l.classList.contains("is-empty") && l.classList.remove("is-empty"), l.classList.add("active"));
|
|
1120
1129
|
} catch {
|
|
1121
1130
|
}
|
|
1122
1131
|
}
|
|
1123
|
-
async function
|
|
1124
|
-
const t = await fetch(
|
|
1132
|
+
async function Ae(a, e) {
|
|
1133
|
+
const t = await fetch(a, {
|
|
1125
1134
|
method: "POST",
|
|
1126
1135
|
headers: {
|
|
1127
1136
|
Accept: "application/json",
|
|
@@ -1135,42 +1144,42 @@ async function ke(o, e) {
|
|
|
1135
1144
|
}
|
|
1136
1145
|
return t.json().catch(() => null);
|
|
1137
1146
|
}
|
|
1138
|
-
function
|
|
1147
|
+
function Yn() {
|
|
1139
1148
|
return {
|
|
1140
|
-
async linesAdd(
|
|
1141
|
-
const e =
|
|
1142
|
-
id:
|
|
1149
|
+
async linesAdd(a) {
|
|
1150
|
+
const e = a.map((t) => ({
|
|
1151
|
+
id: Dn(t.merchandiseId),
|
|
1143
1152
|
quantity: t.quantity,
|
|
1144
|
-
properties:
|
|
1153
|
+
properties: Xe(t.attributes)
|
|
1145
1154
|
}));
|
|
1146
|
-
await
|
|
1155
|
+
await Ae("/cart/add.js", { items: e });
|
|
1147
1156
|
},
|
|
1148
|
-
async linesUpdate(
|
|
1149
|
-
for (const e of
|
|
1150
|
-
await
|
|
1157
|
+
async linesUpdate(a) {
|
|
1158
|
+
for (const e of a)
|
|
1159
|
+
await Ae("/cart/change.js", {
|
|
1151
1160
|
id: e.id,
|
|
1152
1161
|
quantity: e.quantity,
|
|
1153
|
-
properties:
|
|
1162
|
+
properties: Xe(e.attributes)
|
|
1154
1163
|
});
|
|
1155
1164
|
},
|
|
1156
|
-
async linesRemove(
|
|
1157
|
-
for (const e of
|
|
1158
|
-
await
|
|
1165
|
+
async linesRemove(a) {
|
|
1166
|
+
for (const e of a)
|
|
1167
|
+
await Ae("/cart/change.js", { id: e, quantity: 0 });
|
|
1159
1168
|
},
|
|
1160
1169
|
openCartUI() {
|
|
1161
1170
|
window.setTimeout(() => {
|
|
1162
|
-
|
|
1171
|
+
zn();
|
|
1163
1172
|
}, 0);
|
|
1164
1173
|
}
|
|
1165
1174
|
};
|
|
1166
1175
|
}
|
|
1167
1176
|
export {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1177
|
+
Qn as BundleBuilderDrawer,
|
|
1178
|
+
Un as BundleButton,
|
|
1179
|
+
Ne as BundleLineAttributeKeys,
|
|
1180
|
+
$n as BundleProvider,
|
|
1181
|
+
Yn as createLiquidCartAdapter,
|
|
1182
|
+
Le as useBundleBuilder,
|
|
1183
|
+
Vn as useBundleBuilderDrawer
|
|
1175
1184
|
};
|
|
1176
1185
|
//# sourceMappingURL=index.js.map
|