@best-bundles/bundle-ui 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context/BundleProvider.d.ts.map +1 -1
- package/dist/index.js +714 -703
- package/dist/index.js.map +1 -1
- package/dist/liquid/bundle-ui.iife.js +11 -11
- package/dist/liquid/bundle-ui.iife.js.map +1 -1
- package/dist/utils/analytics.d.ts +6 -0
- package/dist/utils/analytics.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
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_227w4_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_227w4_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_227w4_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:var(--bb-celebration-text, #0b1b44);background:linear-gradient(180deg,var(--bb-celebration-bg-top, #ffffff),var(--bb-celebration-bg-bottom, #bae6fd));border:2px solid var(--bb-celebration-border, 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_227w4_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_227w4_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_227w4_74{opacity:1}._backdropClosed_227w4_78{opacity:0}._panel_227w4_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_227w4_102{animation:_bbSlideInFromRight_227w4_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_227w4_106{animation:_bbSlideOutToRight_227w4_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_227w4_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_227w4_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_227w4_1{transition:none}._celebrationChip_227w4_23,._panelOpen_227w4_102,._panelClosed_227w4_106{animation:none}}._header_227w4_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_227w4_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_227w4_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_227w4_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_227w4_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_227w4_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_227w4_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_227w4_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_227w4_209 ._headerTitleWrap_227w4_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_227w4_209 ._headerSearchWrap_227w4_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_227w4_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_227w4_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_227w4_233::-webkit-search-cancel-button,._searchInput_227w4_233::-webkit-search-decoration,._searchInput_227w4_233::-webkit-search-results-button,._searchInput_227w4_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_227w4_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_227w4_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_227w4_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_227w4_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_227w4_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_227w4_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_227w4_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_227w4_193,._headerSearchWrap_227w4_197{transition:none}}._body_227w4_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_227w4_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_227w4_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_227w4_324{margin-top:4px}._variantList_227w4_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_227w4_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_227w4_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_227w4_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_227w4_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_227w4_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_227w4_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_227w4_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_227w4_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_227w4_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_227w4_406{min-width:0}._variantName_227w4_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_227w4_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_227w4_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_227w4_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_227w4_427{font-size:13px;font-weight:800}._qtyControls_227w4_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_227w4_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_227w4_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_227w4_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_227w4_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_227w4_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_227w4_483{padding:var(--bb-footer-padding, 12px 16px 16px 16px);border-top:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);position:relative}._poweredBy_227w4_490{font-size:10px;color:var(rgba(17, 24, 39, .6));text-align:center;margin-top:10px}._poweredBy_227w4_490 a{color:inherit;text-decoration:none}._boxSummaryWindow_227w4_502{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_227w4_502::-webkit-scrollbar{display:none}._boxSummaryRow_227w4_519{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_227w4_527{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_227w4_535{width:100%;aspect-ratio:1 / 1;border-radius:12px;position:relative;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;box-sizing:border-box}._boxItemClickable_227w4_547{cursor:pointer}._boxItemClickable_227w4_547:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_227w4_556{font-size:11px;line-height:1.15;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._boxItemPlaceholder_227w4_567{border:1px dashed var(--bb-border-strong-color, rgba(17, 24, 39, .18));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));color:var(--bb-muted-color, rgba(17, 24, 39, .6))}._boxItemFilled_227w4_573{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_227w4_579{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:var(--bb-tier-bg, rgba(37, 99, 235, .08));color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_227w4_587{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_227w4_595{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_227w4_602{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_227w4_609{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .04));color:var(--bb-text-color, #111827);font-weight:800}._ctaButtonGroup_227w4_620{display:flex;gap:8px;width:100%;transition:gap .3s cubic-bezier(.4,0,.2,1)}._ctaButtonGroupAnimating_227w4_627{gap:0}._cta_227w4_620{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer}._ctaSecondary_227w4_643{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer}._ctaDualLeft_227w4_655{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),background .3s cubic-bezier(.4,0,.2,1),color .3s cubic-bezier(.4,0,.2,1),border-right-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualLeftAnimating_227w4_673{border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0;background:var(--bb-cta-bg, #2563eb);opacity:.6;color:var(--bb-cta-text, #ffffff)}._ctaDualLeftAnimating_227w4_673>span{opacity:0}._ctaDualRight_227w4_686{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),border-left-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualRightAnimating_227w4_702{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;opacity:.6}._ctaDualRightAnimating_227w4_702>span{opacity:0}._ctaTotals_227w4_713{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_227w4_721{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;background:linear-gradient(180deg,#2563eb24,#2563eb0f);border:1px solid rgba(37,99,235,.3);color:#1d4ed8f2;white-space:nowrap}._ctaTotalsWrap_227w4_735{overflow:hidden;max-height:0;opacity:0;transform:translateY(4px);margin-bottom:0;transition:max-height .22s ease,opacity .16s ease,transform .22s ease,margin-bottom .22s ease}._ctaTotalsWrapVisible_227w4_748{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_227w4_755{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_227w4_762{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_227w4_735{transition:none}}._cta_227w4_620:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_227w4_620:disabled{opacity:.6;cursor:not-allowed}._cta_227w4_620:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaSecondary_227w4_643:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaSecondary_227w4_643:disabled{opacity:.6;cursor:not-allowed}._ctaSecondary_227w4_643:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualLeft_227w4_655:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaDualLeft_227w4_655:disabled{opacity:.6;cursor:not-allowed}._ctaDualLeft_227w4_655:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualRight_227w4_686:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._ctaDualRight_227w4_686:disabled{opacity:.6;cursor:not-allowed}._ctaDualRight_227w4_686:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_227w4_831{margin-top:8px;font-size:12px;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center}@media(max-width:767px){._backdrop_227w4_1{padding:0;justify-content:stretch}._panel_227w4_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
|
|
3
|
-
import
|
|
4
|
-
const
|
|
2
|
+
import { jsx as f, jsxs as P, Fragment as yt } from "react/jsx-runtime";
|
|
3
|
+
import Le, { useState as k, useRef as V, useEffect as q, useCallback as ce, useMemo as T, createContext as gt, useContext as vt, forwardRef as ft, createElement as Qe } from "react";
|
|
4
|
+
const Fe = {
|
|
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
|
|
12
|
-
|
|
13
|
-
const
|
|
10
|
+
async function xt(o) {
|
|
11
|
+
const e = new URL("/api/public/bundle-config", o.apiBaseUrl);
|
|
12
|
+
e.searchParams.set("shop", o.shop);
|
|
13
|
+
const i = await (await fetch(e, {
|
|
14
14
|
method: "GET",
|
|
15
|
-
signal:
|
|
15
|
+
signal: o.signal,
|
|
16
16
|
headers: { "Content-Type": "application/json" }
|
|
17
17
|
})).json().catch(() => null);
|
|
18
|
-
return !
|
|
18
|
+
return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
function
|
|
20
|
+
const at = "bb_anonymous_user_id";
|
|
21
|
+
function De() {
|
|
22
22
|
if (typeof window > "u" || typeof localStorage > "u")
|
|
23
23
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
24
24
|
try {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
28
|
-
let
|
|
25
|
+
const o = localStorage.getItem(at);
|
|
26
|
+
if (o && typeof o == "string" && o.length > 0)
|
|
27
|
+
return o;
|
|
28
|
+
let e;
|
|
29
29
|
try {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
|
|
30
|
+
const t = globalThis.crypto;
|
|
31
|
+
if (t != null && t.randomUUID)
|
|
32
|
+
e = t.randomUUID();
|
|
33
33
|
else
|
|
34
34
|
throw new Error("crypto.randomUUID not available");
|
|
35
35
|
} catch {
|
|
36
|
-
|
|
36
|
+
e = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
37
37
|
}
|
|
38
|
-
return localStorage.setItem(
|
|
38
|
+
return localStorage.setItem(at, e), e;
|
|
39
39
|
} catch {
|
|
40
40
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
async function
|
|
43
|
+
async function xe(o, e, t) {
|
|
44
44
|
if (!(typeof window > "u"))
|
|
45
45
|
try {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const r = await fetch(
|
|
46
|
+
const i = new URL(o, window.location.origin);
|
|
47
|
+
i.searchParams.set("shop", e);
|
|
48
|
+
const r = await fetch(i, {
|
|
49
49
|
method: "POST",
|
|
50
50
|
headers: {
|
|
51
51
|
"Content-Type": "application/json"
|
|
52
52
|
},
|
|
53
|
-
body: JSON.stringify(
|
|
53
|
+
body: JSON.stringify(t),
|
|
54
54
|
// Don't wait for response - fire and forget
|
|
55
55
|
keepalive: !0
|
|
56
56
|
});
|
|
@@ -58,11 +58,11 @@ async function Dt(i, t, e) {
|
|
|
58
58
|
`[Bundle Analytics] Event tracking failed with status ${r.status}:`,
|
|
59
59
|
await r.text().catch(() => "Unable to read response")
|
|
60
60
|
);
|
|
61
|
-
} catch (
|
|
62
|
-
console.warn("[Bundle Analytics] Failed to track event:",
|
|
61
|
+
} catch (i) {
|
|
62
|
+
console.warn("[Bundle Analytics] Failed to track event:", i);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const mt = gt(null), Ct = {
|
|
66
66
|
primaryColor: "--bb-cta-bg",
|
|
67
67
|
primaryHoverColor: "--bb-cta-bg-hover",
|
|
68
68
|
primaryTextColor: "--bb-cta-text",
|
|
@@ -83,490 +83,501 @@ const me = ge(null), Ce = {
|
|
|
83
83
|
celebrationBgBottom: "--bb-celebration-bg-bottom",
|
|
84
84
|
celebrationBorderColor: "--bb-celebration-border"
|
|
85
85
|
};
|
|
86
|
-
function
|
|
87
|
-
if (!
|
|
88
|
-
const
|
|
89
|
-
Object.entries(
|
|
90
|
-
const r =
|
|
91
|
-
r &&
|
|
86
|
+
function st(o) {
|
|
87
|
+
if (!o) return;
|
|
88
|
+
const e = document.documentElement;
|
|
89
|
+
Object.entries(Ct).forEach(([t, i]) => {
|
|
90
|
+
const r = o[t];
|
|
91
|
+
r && e.style.setProperty(i, r);
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
if (typeof window > "u") return
|
|
96
|
-
const
|
|
97
|
-
return
|
|
94
|
+
function ct(o) {
|
|
95
|
+
if (typeof window > "u") return o;
|
|
96
|
+
const e = window.__BUNDLE_PREVIEW_STYLES__;
|
|
97
|
+
return e && typeof e == "object" ? e : o;
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function It() {
|
|
100
100
|
try {
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
101
|
+
const o = globalThis.crypto;
|
|
102
|
+
if (o != null && o.randomUUID) return o.randomUUID();
|
|
103
103
|
} catch {
|
|
104
104
|
}
|
|
105
105
|
return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return Number.isFinite(
|
|
107
|
+
function lt(o) {
|
|
108
|
+
return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
|
|
109
109
|
}
|
|
110
|
-
function lr(
|
|
110
|
+
function lr(o) {
|
|
111
111
|
const {
|
|
112
|
-
apiBaseUrl:
|
|
113
|
-
shop:
|
|
114
|
-
cartAdapter:
|
|
112
|
+
apiBaseUrl: e,
|
|
113
|
+
shop: t,
|
|
114
|
+
cartAdapter: i,
|
|
115
115
|
configHandle: r = "default",
|
|
116
116
|
initialData: n,
|
|
117
117
|
configFetcher: l,
|
|
118
118
|
analyticsEndpoint: s,
|
|
119
119
|
children: p
|
|
120
|
-
} =
|
|
120
|
+
} = o, v = s ?? `${e}/api/public/bundle-analytics`, [A, R] = k(!1), [C, te] = k(!n), [U, X] = k(!1), [z, N] = k(null), [F, Q] = k((n == null ? void 0 : n.currencyCode) ?? null), [_, ue] = k((n == null ? void 0 : n.config) ?? null), [ie, we] = k(
|
|
121
121
|
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
122
|
-
), [
|
|
122
|
+
), [de, ke] = k(
|
|
123
123
|
() => ({ selections: {}, order: [] })
|
|
124
|
-
),
|
|
125
|
-
|
|
126
|
-
var
|
|
124
|
+
), Me = V(null);
|
|
125
|
+
q(() => {
|
|
126
|
+
var W;
|
|
127
127
|
if (n) return;
|
|
128
|
-
(
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
const x = l ??
|
|
132
|
-
return
|
|
133
|
-
if (!
|
|
134
|
-
|
|
128
|
+
(W = Me.current) == null || W.abort();
|
|
129
|
+
const h = new AbortController();
|
|
130
|
+
Me.current = h;
|
|
131
|
+
const x = l ?? xt;
|
|
132
|
+
return te(!0), N(null), x({ apiBaseUrl: e, shop: t, signal: h.signal }).then((y) => {
|
|
133
|
+
if (!y.ok) {
|
|
134
|
+
N(y.error || "Failed to load bundle config."), ue(null), we([]), Q(null);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
}).catch((
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
}).finally(() =>
|
|
142
|
-
}, [
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
}, [
|
|
137
|
+
Q(y.currencyCode ?? null), ue(y.config), we(y.eligibleVariants ?? []);
|
|
138
|
+
}).catch((y) => {
|
|
139
|
+
const J = y instanceof Error ? y.message : "Failed to load bundle config.";
|
|
140
|
+
N(J), ue(null), we([]), Q(null);
|
|
141
|
+
}).finally(() => te(!1)), () => h.abort();
|
|
142
|
+
}, [e, t, n, l]), q(() => {
|
|
143
|
+
const h = ct(_ == null ? void 0 : _.styleSettings);
|
|
144
|
+
h && st(h);
|
|
145
|
+
}, [_ == null ? void 0 : _.styleSettings]), q(() => {
|
|
146
146
|
if (typeof window > "u") return;
|
|
147
|
-
const
|
|
148
|
-
const x =
|
|
149
|
-
x &&
|
|
147
|
+
const h = () => {
|
|
148
|
+
const x = ct(void 0);
|
|
149
|
+
x && st(x);
|
|
150
150
|
};
|
|
151
|
-
return window.addEventListener("bundle-preview-styles-updated",
|
|
151
|
+
return window.addEventListener("bundle-preview-styles-updated", h), () => window.removeEventListener("bundle-preview-styles-updated", h);
|
|
152
152
|
}, []);
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
153
|
+
const Oe = ce(() => {
|
|
154
|
+
if (R(!0), v)
|
|
155
155
|
try {
|
|
156
|
-
const
|
|
157
|
-
|
|
156
|
+
const h = De();
|
|
157
|
+
xe(v, t, {
|
|
158
158
|
eventType: "DRAWER_OPENED",
|
|
159
|
-
shop:
|
|
160
|
-
anonymousUserId:
|
|
161
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
159
|
+
shop: t,
|
|
160
|
+
anonymousUserId: h,
|
|
161
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
162
|
+
mixpanelEvent: "bundle_opened"
|
|
162
163
|
}).catch((x) => {
|
|
163
164
|
console.warn("[Bundle Analytics] Failed to track drawer opened:", x);
|
|
164
165
|
});
|
|
165
|
-
} catch (
|
|
166
|
-
console.warn("[Bundle Analytics] Error in open() callback:",
|
|
166
|
+
} catch (h) {
|
|
167
|
+
console.warn("[Bundle Analytics] Error in open() callback:", h);
|
|
167
168
|
}
|
|
168
|
-
}, [v,
|
|
169
|
-
|
|
170
|
-
if (!
|
|
169
|
+
}, [v, t]), he = ce(() => R(!1), []), Pe = ce(() => {
|
|
170
|
+
R((h) => {
|
|
171
|
+
if (!h && v)
|
|
171
172
|
try {
|
|
172
|
-
const x =
|
|
173
|
-
|
|
173
|
+
const x = De();
|
|
174
|
+
xe(v, t, {
|
|
174
175
|
eventType: "DRAWER_OPENED",
|
|
175
|
-
shop:
|
|
176
|
+
shop: t,
|
|
176
177
|
anonymousUserId: x,
|
|
177
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
179
|
+
mixpanelEvent: "bundle_opened"
|
|
180
|
+
}).catch((W) => {
|
|
181
|
+
console.warn("[Bundle Analytics] Failed to track drawer opened:", W);
|
|
180
182
|
});
|
|
181
183
|
} catch (x) {
|
|
182
184
|
console.warn("[Bundle Analytics] Error in toggle() callback:", x);
|
|
183
185
|
}
|
|
184
|
-
return !
|
|
186
|
+
return !h;
|
|
185
187
|
});
|
|
186
|
-
}, [v,
|
|
187
|
-
const
|
|
188
|
+
}, [v, t]), Ae = T(() => {
|
|
189
|
+
const h = Number((_ == null ? void 0 : _.maxBundleSize) ?? NaN), x = Number.isFinite(h) ? Math.floor(h) : 100;
|
|
188
190
|
return Math.max(2, Math.min(100, x));
|
|
189
|
-
}, [
|
|
190
|
-
|
|
191
|
+
}, [_ == null ? void 0 : _.maxBundleSize]), fe = T(() => new Set(ie.map((h) => h.id)), [ie]), $ = T(() => {
|
|
192
|
+
const h = (_ == null ? void 0 : _.rules) ?? [], x = h.length ? Math.min(...h.map((W) => W.minBundleSize)) : 2;
|
|
193
|
+
return Number.isFinite(x) && x > 0 ? x : 2;
|
|
194
|
+
}, [_]), Ce = ce((h, x) => {
|
|
195
|
+
if (!fe.has(h))
|
|
191
196
|
return;
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
const
|
|
197
|
+
const W = lt(x);
|
|
198
|
+
ke((y) => {
|
|
199
|
+
const J = y.selections[h] ?? 0, j = W - J, ye = Object.values(y.selections).reduce((L, O) => L + (O || 0), 0), M = j > 0 ? Math.min(j, Math.max(0, Ae - ye)) : j, E = J + M;
|
|
195
200
|
let D;
|
|
196
|
-
if (
|
|
197
|
-
const { [
|
|
198
|
-
D =
|
|
199
|
-
} else
|
|
200
|
-
let
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
else if (
|
|
204
|
-
let
|
|
205
|
-
const
|
|
206
|
-
for (let
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
209
|
-
|
|
201
|
+
if (E <= 0) {
|
|
202
|
+
const { [h]: L, ...O } = y.selections;
|
|
203
|
+
D = O;
|
|
204
|
+
} else J === E ? D = y.selections : D = { ...y.selections, [h]: E };
|
|
205
|
+
let ae = y.order;
|
|
206
|
+
if (M > 0)
|
|
207
|
+
ae = [...y.order, ...Array.from({ length: M }, () => h)];
|
|
208
|
+
else if (M < 0) {
|
|
209
|
+
let L = -M;
|
|
210
|
+
const O = [];
|
|
211
|
+
for (let S = y.order.length - 1; S >= 0; S--) {
|
|
212
|
+
const m = y.order[S];
|
|
213
|
+
if (m === h && L > 0) {
|
|
214
|
+
L--;
|
|
210
215
|
continue;
|
|
211
216
|
}
|
|
212
|
-
|
|
217
|
+
O.push(m);
|
|
213
218
|
}
|
|
214
|
-
|
|
219
|
+
O.reverse(), ae = O;
|
|
215
220
|
}
|
|
216
|
-
if (D ===
|
|
221
|
+
if (D === y.selections && ae === y.order) return y;
|
|
222
|
+
const ge = ye, pe = Object.values(D).reduce((L, O) => L + (O || 0), 0);
|
|
217
223
|
if (v)
|
|
218
224
|
try {
|
|
219
|
-
const
|
|
220
|
-
Dt(v, e, {
|
|
225
|
+
const L = De(), O = {
|
|
221
226
|
eventType: "VARIANT_SELECTION_CHANGED",
|
|
222
|
-
shop:
|
|
223
|
-
anonymousUserId:
|
|
224
|
-
before: { ...
|
|
227
|
+
shop: t,
|
|
228
|
+
anonymousUserId: L,
|
|
229
|
+
before: { ...y.selections },
|
|
225
230
|
after: { ...D },
|
|
226
231
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
232
|
+
};
|
|
233
|
+
xe(v, t, O), ge === 0 && pe >= 1 && xe(v, t, {
|
|
234
|
+
...O,
|
|
235
|
+
mixpanelEvent: "bundle_started"
|
|
236
|
+
}), ge < $ && pe >= $ && xe(v, t, {
|
|
237
|
+
...O,
|
|
238
|
+
mixpanelEvent: "bundle_completed"
|
|
227
239
|
});
|
|
228
240
|
} catch {
|
|
229
241
|
}
|
|
230
|
-
return { selections: D, order:
|
|
242
|
+
return { selections: D, order: ae };
|
|
231
243
|
});
|
|
232
|
-
}, [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
var wt, A;
|
|
237
|
-
if (!gt || !y) return;
|
|
238
|
-
const x = Ie(), $ = (y.title ?? "").trim().slice(0, 255), _ = Object.entries(K).map(([m, rt]) => ({ merchandiseId: m, quantity: le(rt) })).filter((m) => m.quantity > 0).filter((m) => pt.has(m.merchandiseId)).map((m) => ({
|
|
244
|
+
}, [Ae, $, fe, v, t]), me = ce(() => ke({ selections: {}, order: [] }), []), Z = de.selections, Re = de.order, H = T(() => Object.values(Z).reduce((h, x) => h + (x || 0), 0), [Z]), _e = T(() => !(C || U || z || !(_ != null && _.isActive) || H < $), [H, _ == null ? void 0 : _.isActive, z, C, $, U]), oe = ce(async (h) => {
|
|
245
|
+
var O, S;
|
|
246
|
+
if (!_e || !_) return;
|
|
247
|
+
const x = It(), W = (_.title ?? "").trim().slice(0, 255), y = Object.entries(Z).map(([m, Y]) => ({ merchandiseId: m, quantity: lt(Y) })).filter((m) => m.quantity > 0).filter((m) => fe.has(m.merchandiseId)).map((m) => ({
|
|
239
248
|
merchandiseId: m.merchandiseId,
|
|
240
249
|
quantity: m.quantity,
|
|
241
250
|
attributes: [
|
|
242
|
-
{ key:
|
|
243
|
-
{ key:
|
|
244
|
-
{ key:
|
|
245
|
-
|
|
251
|
+
{ key: Fe.bundleId, value: x },
|
|
252
|
+
{ key: Fe.bundleConfig, value: r },
|
|
253
|
+
{ key: Fe.bundleSource, value: "bundle_builder" },
|
|
254
|
+
...W ? [{ key: Fe.bundleTitle, value: W }] : []
|
|
246
255
|
]
|
|
247
256
|
}));
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
let
|
|
251
|
-
for (const [m,
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
255
|
-
Number.isFinite(
|
|
257
|
+
if (!y.length) return;
|
|
258
|
+
const J = new Map(ie.map((m) => [m.id, m]));
|
|
259
|
+
let j = 0;
|
|
260
|
+
for (const [m, Y] of Object.entries(Z)) {
|
|
261
|
+
const se = Y ?? 0;
|
|
262
|
+
if (se <= 0) continue;
|
|
263
|
+
const Se = J.get(m), ve = Number(Se == null ? void 0 : Se.price);
|
|
264
|
+
Number.isFinite(ve) && (j += ve * se);
|
|
256
265
|
}
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
let
|
|
260
|
-
for (const m of
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
const m = Number.parseFloat(
|
|
266
|
+
j = Math.round(j * 100) / 100;
|
|
267
|
+
const ye = [..._.rules ?? []].sort((m, Y) => m.minBundleSize - Y.minBundleSize);
|
|
268
|
+
let M = null;
|
|
269
|
+
for (const m of ye)
|
|
270
|
+
H >= m.minBundleSize && (M = m);
|
|
271
|
+
const E = M ? (() => {
|
|
272
|
+
const m = Number.parseFloat(M.discountPercent);
|
|
264
273
|
return Number.isFinite(m) && m > 0 ? m : null;
|
|
265
|
-
})() : null, D =
|
|
266
|
-
|
|
274
|
+
})() : null, D = E ? Math.round(j * (1 - E / 100) * 100) / 100 : j, ae = j - D, ge = y.map((m) => m.merchandiseId), pe = (M == null ? void 0 : M.handle) ?? "", L = ((O = M == null ? void 0 : M.label) == null ? void 0 : O.trim()) || "";
|
|
275
|
+
X(!0);
|
|
267
276
|
try {
|
|
268
|
-
if (
|
|
277
|
+
if (h != null && h.checkout ? await i.linesAddForCheckout(y) : await i.linesAdd(y), v)
|
|
269
278
|
try {
|
|
270
|
-
const m =
|
|
271
|
-
|
|
279
|
+
const m = De(), Y = !!(h != null && h.checkout);
|
|
280
|
+
xe(v, t, {
|
|
272
281
|
eventType: "BUNDLE_ADDED_TO_BASKET",
|
|
273
|
-
shop:
|
|
282
|
+
shop: t,
|
|
274
283
|
anonymousUserId: m,
|
|
275
284
|
bundleId: x,
|
|
276
|
-
productVariantIds:
|
|
277
|
-
grossPrice:
|
|
285
|
+
productVariantIds: ge,
|
|
286
|
+
grossPrice: j,
|
|
278
287
|
discountedPrice: D,
|
|
279
|
-
currency:
|
|
280
|
-
discountThresholdIdentifier:
|
|
281
|
-
discountLabel:
|
|
282
|
-
discountPercentage:
|
|
283
|
-
discountedAmount:
|
|
284
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
288
|
+
currency: F ?? void 0,
|
|
289
|
+
discountThresholdIdentifier: pe,
|
|
290
|
+
discountLabel: L,
|
|
291
|
+
discountPercentage: E,
|
|
292
|
+
discountedAmount: ae,
|
|
293
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
294
|
+
checkout: Y,
|
|
295
|
+
mixpanelEvent: Y ? "checkout_started_with_bundle" : "bundle_added_to_cart"
|
|
285
296
|
});
|
|
286
297
|
} catch {
|
|
287
298
|
}
|
|
288
|
-
|
|
299
|
+
me(), he(), (S = h == null ? void 0 : h.onComplete) == null || S.call(h);
|
|
289
300
|
} finally {
|
|
290
|
-
|
|
301
|
+
X(!1);
|
|
291
302
|
}
|
|
292
303
|
}, [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
_e,
|
|
305
|
+
i,
|
|
306
|
+
me,
|
|
307
|
+
he,
|
|
308
|
+
_,
|
|
298
309
|
r,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
310
|
+
F,
|
|
311
|
+
Z,
|
|
312
|
+
fe,
|
|
313
|
+
ie,
|
|
314
|
+
H,
|
|
304
315
|
v,
|
|
305
|
-
|
|
306
|
-
]),
|
|
307
|
-
await
|
|
316
|
+
t
|
|
317
|
+
]), Ie = ce(async () => {
|
|
318
|
+
await oe(
|
|
308
319
|
{
|
|
309
320
|
onComplete: () => {
|
|
310
|
-
var
|
|
311
|
-
(
|
|
321
|
+
var h;
|
|
322
|
+
(h = i.openCartUI) == null || h.call(i);
|
|
312
323
|
}
|
|
313
324
|
}
|
|
314
325
|
);
|
|
315
|
-
}, [
|
|
316
|
-
await
|
|
326
|
+
}, [oe, i]), ne = ce(async () => {
|
|
327
|
+
await oe(
|
|
317
328
|
{
|
|
318
329
|
checkout: !0,
|
|
319
330
|
onComplete: () => {
|
|
320
|
-
var
|
|
321
|
-
(
|
|
331
|
+
var h;
|
|
332
|
+
(h = i.navigateToCheckout) == null || h.call(i);
|
|
322
333
|
}
|
|
323
334
|
}
|
|
324
335
|
);
|
|
325
|
-
}, [
|
|
336
|
+
}, [oe, i]), qe = T(
|
|
326
337
|
() => ({
|
|
327
|
-
isOpen:
|
|
328
|
-
open:
|
|
329
|
-
close:
|
|
330
|
-
toggle:
|
|
338
|
+
isOpen: A,
|
|
339
|
+
open: Oe,
|
|
340
|
+
close: he,
|
|
341
|
+
toggle: Pe,
|
|
331
342
|
loading: C,
|
|
332
|
-
submitting:
|
|
333
|
-
error:
|
|
334
|
-
currencyCode:
|
|
335
|
-
config:
|
|
336
|
-
eligibleVariants:
|
|
337
|
-
selections:
|
|
338
|
-
selectionOrder:
|
|
339
|
-
setQuantity:
|
|
340
|
-
clearSelections:
|
|
341
|
-
bundleSize:
|
|
342
|
-
minRequired:
|
|
343
|
-
canSubmit:
|
|
344
|
-
submit:
|
|
345
|
-
submitAndCheckout:
|
|
343
|
+
submitting: U,
|
|
344
|
+
error: z,
|
|
345
|
+
currencyCode: F,
|
|
346
|
+
config: _,
|
|
347
|
+
eligibleVariants: ie,
|
|
348
|
+
selections: Z,
|
|
349
|
+
selectionOrder: Re,
|
|
350
|
+
setQuantity: Ce,
|
|
351
|
+
clearSelections: me,
|
|
352
|
+
bundleSize: H,
|
|
353
|
+
minRequired: $,
|
|
354
|
+
canSubmit: _e,
|
|
355
|
+
submit: Ie,
|
|
356
|
+
submitAndCheckout: ne
|
|
346
357
|
}),
|
|
347
358
|
[
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
359
|
+
A,
|
|
360
|
+
Oe,
|
|
361
|
+
he,
|
|
362
|
+
Pe,
|
|
352
363
|
C,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
U,
|
|
365
|
+
z,
|
|
366
|
+
F,
|
|
367
|
+
_,
|
|
368
|
+
ie,
|
|
369
|
+
Z,
|
|
370
|
+
Re,
|
|
371
|
+
Ce,
|
|
372
|
+
me,
|
|
373
|
+
H,
|
|
374
|
+
$,
|
|
375
|
+
_e,
|
|
376
|
+
Ie,
|
|
377
|
+
ne
|
|
367
378
|
]
|
|
368
379
|
);
|
|
369
|
-
return /* @__PURE__ */
|
|
380
|
+
return /* @__PURE__ */ f(mt.Provider, { value: qe, children: p });
|
|
370
381
|
}
|
|
371
|
-
function
|
|
372
|
-
const
|
|
373
|
-
if (!
|
|
382
|
+
function Ye() {
|
|
383
|
+
const o = vt(mt);
|
|
384
|
+
if (!o)
|
|
374
385
|
throw new Error("useBundleBuilder must be used within <BundleProvider />");
|
|
375
|
-
return
|
|
386
|
+
return o;
|
|
376
387
|
}
|
|
377
388
|
function ur() {
|
|
378
|
-
const { isOpen:
|
|
379
|
-
return { isOpen:
|
|
389
|
+
const { isOpen: o, open: e, close: t, toggle: i } = Ye();
|
|
390
|
+
return { isOpen: o, open: e, close: t, toggle: i };
|
|
380
391
|
}
|
|
381
|
-
const
|
|
382
|
-
button:
|
|
392
|
+
const St = "_button_18rtl_1", Bt = {
|
|
393
|
+
button: St
|
|
383
394
|
};
|
|
384
|
-
function dr(
|
|
385
|
-
const { toggle:
|
|
386
|
-
return /* @__PURE__ */
|
|
395
|
+
function dr(o) {
|
|
396
|
+
const { toggle: e } = Ye();
|
|
397
|
+
return /* @__PURE__ */ f(
|
|
387
398
|
"button",
|
|
388
399
|
{
|
|
389
400
|
type: "button",
|
|
390
|
-
onClick:
|
|
391
|
-
className: [
|
|
392
|
-
children:
|
|
401
|
+
onClick: e,
|
|
402
|
+
className: [Bt.button, o.className].filter(Boolean).join(" "),
|
|
403
|
+
children: o.children ?? "Build a bundle"
|
|
393
404
|
}
|
|
394
405
|
);
|
|
395
406
|
}
|
|
396
|
-
var
|
|
397
|
-
function
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
-
var
|
|
401
|
-
linear: function(
|
|
402
|
-
var n =
|
|
403
|
-
return n *
|
|
407
|
+
var je, ut;
|
|
408
|
+
function Tt() {
|
|
409
|
+
if (ut) return je;
|
|
410
|
+
ut = 1;
|
|
411
|
+
var o = {
|
|
412
|
+
linear: function(e, t, i, r) {
|
|
413
|
+
var n = i - t;
|
|
414
|
+
return n * e / r + t;
|
|
404
415
|
},
|
|
405
|
-
easeInQuad: function(
|
|
406
|
-
var n =
|
|
407
|
-
return n * (
|
|
416
|
+
easeInQuad: function(e, t, i, r) {
|
|
417
|
+
var n = i - t;
|
|
418
|
+
return n * (e /= r) * e + t;
|
|
408
419
|
},
|
|
409
|
-
easeOutQuad: function(
|
|
410
|
-
var n =
|
|
411
|
-
return -n * (
|
|
420
|
+
easeOutQuad: function(e, t, i, r) {
|
|
421
|
+
var n = i - t;
|
|
422
|
+
return -n * (e /= r) * (e - 2) + t;
|
|
412
423
|
},
|
|
413
|
-
easeInOutQuad: function(
|
|
414
|
-
var n =
|
|
415
|
-
return (
|
|
424
|
+
easeInOutQuad: function(e, t, i, r) {
|
|
425
|
+
var n = i - t;
|
|
426
|
+
return (e /= r / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t;
|
|
416
427
|
},
|
|
417
|
-
easeInCubic: function(
|
|
418
|
-
var n =
|
|
419
|
-
return n * (
|
|
428
|
+
easeInCubic: function(e, t, i, r) {
|
|
429
|
+
var n = i - t;
|
|
430
|
+
return n * (e /= r) * e * e + t;
|
|
420
431
|
},
|
|
421
|
-
easeOutCubic: function(
|
|
422
|
-
var n =
|
|
423
|
-
return n * ((
|
|
432
|
+
easeOutCubic: function(e, t, i, r) {
|
|
433
|
+
var n = i - t;
|
|
434
|
+
return n * ((e = e / r - 1) * e * e + 1) + t;
|
|
424
435
|
},
|
|
425
|
-
easeInOutCubic: function(
|
|
426
|
-
var n =
|
|
427
|
-
return (
|
|
436
|
+
easeInOutCubic: function(e, t, i, r) {
|
|
437
|
+
var n = i - t;
|
|
438
|
+
return (e /= r / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t;
|
|
428
439
|
},
|
|
429
|
-
easeInQuart: function(
|
|
430
|
-
var n =
|
|
431
|
-
return n * (
|
|
440
|
+
easeInQuart: function(e, t, i, r) {
|
|
441
|
+
var n = i - t;
|
|
442
|
+
return n * (e /= r) * e * e * e + t;
|
|
432
443
|
},
|
|
433
|
-
easeOutQuart: function(
|
|
434
|
-
var n =
|
|
435
|
-
return -n * ((
|
|
444
|
+
easeOutQuart: function(e, t, i, r) {
|
|
445
|
+
var n = i - t;
|
|
446
|
+
return -n * ((e = e / r - 1) * e * e * e - 1) + t;
|
|
436
447
|
},
|
|
437
|
-
easeInOutQuart: function(
|
|
438
|
-
var n =
|
|
439
|
-
return (
|
|
448
|
+
easeInOutQuart: function(e, t, i, r) {
|
|
449
|
+
var n = i - t;
|
|
450
|
+
return (e /= r / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t;
|
|
440
451
|
},
|
|
441
|
-
easeInQuint: function(
|
|
442
|
-
var n =
|
|
443
|
-
return n * (
|
|
452
|
+
easeInQuint: function(e, t, i, r) {
|
|
453
|
+
var n = i - t;
|
|
454
|
+
return n * (e /= r) * e * e * e * e + t;
|
|
444
455
|
},
|
|
445
|
-
easeOutQuint: function(
|
|
446
|
-
var n =
|
|
447
|
-
return n * ((
|
|
456
|
+
easeOutQuint: function(e, t, i, r) {
|
|
457
|
+
var n = i - t;
|
|
458
|
+
return n * ((e = e / r - 1) * e * e * e * e + 1) + t;
|
|
448
459
|
},
|
|
449
|
-
easeInOutQuint: function(
|
|
450
|
-
var n =
|
|
451
|
-
return (
|
|
460
|
+
easeInOutQuint: function(e, t, i, r) {
|
|
461
|
+
var n = i - t;
|
|
462
|
+
return (e /= r / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t;
|
|
452
463
|
},
|
|
453
|
-
easeInSine: function(
|
|
454
|
-
var n =
|
|
455
|
-
return -n * Math.cos(
|
|
464
|
+
easeInSine: function(e, t, i, r) {
|
|
465
|
+
var n = i - t;
|
|
466
|
+
return -n * Math.cos(e / r * (Math.PI / 2)) + n + t;
|
|
456
467
|
},
|
|
457
|
-
easeOutSine: function(
|
|
458
|
-
var n =
|
|
459
|
-
return n * Math.sin(
|
|
468
|
+
easeOutSine: function(e, t, i, r) {
|
|
469
|
+
var n = i - t;
|
|
470
|
+
return n * Math.sin(e / r * (Math.PI / 2)) + t;
|
|
460
471
|
},
|
|
461
|
-
easeInOutSine: function(
|
|
462
|
-
var n =
|
|
463
|
-
return -n / 2 * (Math.cos(Math.PI *
|
|
472
|
+
easeInOutSine: function(e, t, i, r) {
|
|
473
|
+
var n = i - t;
|
|
474
|
+
return -n / 2 * (Math.cos(Math.PI * e / r) - 1) + t;
|
|
464
475
|
},
|
|
465
|
-
easeInExpo: function(
|
|
466
|
-
var n =
|
|
467
|
-
return
|
|
476
|
+
easeInExpo: function(e, t, i, r) {
|
|
477
|
+
var n = i - t;
|
|
478
|
+
return e == 0 ? t : n * Math.pow(2, 10 * (e / r - 1)) + t;
|
|
468
479
|
},
|
|
469
|
-
easeOutExpo: function(
|
|
470
|
-
var n =
|
|
471
|
-
return
|
|
480
|
+
easeOutExpo: function(e, t, i, r) {
|
|
481
|
+
var n = i - t;
|
|
482
|
+
return e == r ? t + n : n * (-Math.pow(2, -10 * e / r) + 1) + t;
|
|
472
483
|
},
|
|
473
|
-
easeInOutExpo: function(
|
|
474
|
-
var n =
|
|
475
|
-
return
|
|
484
|
+
easeInOutExpo: function(e, t, i, r) {
|
|
485
|
+
var n = i - t;
|
|
486
|
+
return e === 0 ? t : e === r ? t + n : (e /= r / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + t : n / 2 * (-Math.pow(2, -10 * --e) + 2) + t;
|
|
476
487
|
},
|
|
477
|
-
easeInCirc: function(
|
|
478
|
-
var n =
|
|
479
|
-
return -n * (Math.sqrt(1 - (
|
|
488
|
+
easeInCirc: function(e, t, i, r) {
|
|
489
|
+
var n = i - t;
|
|
490
|
+
return -n * (Math.sqrt(1 - (e /= r) * e) - 1) + t;
|
|
480
491
|
},
|
|
481
|
-
easeOutCirc: function(
|
|
482
|
-
var n =
|
|
483
|
-
return n * Math.sqrt(1 - (
|
|
492
|
+
easeOutCirc: function(e, t, i, r) {
|
|
493
|
+
var n = i - t;
|
|
494
|
+
return n * Math.sqrt(1 - (e = e / r - 1) * e) + t;
|
|
484
495
|
},
|
|
485
|
-
easeInOutCirc: function(
|
|
486
|
-
var n =
|
|
487
|
-
return (
|
|
496
|
+
easeInOutCirc: function(e, t, i, r) {
|
|
497
|
+
var n = i - t;
|
|
498
|
+
return (e /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
|
|
488
499
|
},
|
|
489
|
-
easeInElastic: function(
|
|
490
|
-
var n =
|
|
491
|
-
return p = 1.70158, s = 0, l = n,
|
|
500
|
+
easeInElastic: function(e, t, i, r) {
|
|
501
|
+
var n = i - t, l, s, p;
|
|
502
|
+
return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s)) + t);
|
|
492
503
|
},
|
|
493
|
-
easeOutElastic: function(
|
|
494
|
-
var n =
|
|
495
|
-
return p = 1.70158, s = 0, l = n,
|
|
504
|
+
easeOutElastic: function(e, t, i, r) {
|
|
505
|
+
var n = i - t, l, s, p;
|
|
506
|
+
return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * e) * Math.sin((e * r - p) * (2 * Math.PI) / s) + n + t);
|
|
496
507
|
},
|
|
497
|
-
easeInOutElastic: function(
|
|
498
|
-
var n =
|
|
499
|
-
return p = 1.70158, s = 0, l = n,
|
|
508
|
+
easeInOutElastic: function(e, t, i, r) {
|
|
509
|
+
var n = i - t, l, s, p;
|
|
510
|
+
return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r / 2) === 2 ? t + n : (s || (s = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), e < 1 ? -0.5 * (l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s)) + t : l * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s) * 0.5 + n + t);
|
|
500
511
|
},
|
|
501
|
-
easeInBack: function(
|
|
502
|
-
var l =
|
|
503
|
-
return n === void 0 && (n = 1.70158), l * (
|
|
512
|
+
easeInBack: function(e, t, i, r, n) {
|
|
513
|
+
var l = i - t;
|
|
514
|
+
return n === void 0 && (n = 1.70158), l * (e /= r) * e * ((n + 1) * e - n) + t;
|
|
504
515
|
},
|
|
505
|
-
easeOutBack: function(
|
|
506
|
-
var l =
|
|
507
|
-
return n === void 0 && (n = 1.70158), l * ((
|
|
516
|
+
easeOutBack: function(e, t, i, r, n) {
|
|
517
|
+
var l = i - t;
|
|
518
|
+
return n === void 0 && (n = 1.70158), l * ((e = e / r - 1) * e * ((n + 1) * e + n) + 1) + t;
|
|
508
519
|
},
|
|
509
|
-
easeInOutBack: function(
|
|
510
|
-
var l =
|
|
511
|
-
return n === void 0 && (n = 1.70158), (
|
|
520
|
+
easeInOutBack: function(e, t, i, r, n) {
|
|
521
|
+
var l = i - t;
|
|
522
|
+
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;
|
|
512
523
|
},
|
|
513
|
-
easeInBounce: function(
|
|
514
|
-
var n =
|
|
515
|
-
return l =
|
|
524
|
+
easeInBounce: function(e, t, i, r) {
|
|
525
|
+
var n = i - t, l;
|
|
526
|
+
return l = o.easeOutBounce(r - e, 0, n, r), n - l + t;
|
|
516
527
|
},
|
|
517
|
-
easeOutBounce: function(
|
|
518
|
-
var n =
|
|
519
|
-
return (
|
|
528
|
+
easeOutBounce: function(e, t, i, r) {
|
|
529
|
+
var n = i - t;
|
|
530
|
+
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;
|
|
520
531
|
},
|
|
521
|
-
easeInOutBounce: function(
|
|
522
|
-
var n =
|
|
523
|
-
return
|
|
532
|
+
easeInOutBounce: function(e, t, i, r) {
|
|
533
|
+
var n = i - t, l;
|
|
534
|
+
return e < r / 2 ? (l = o.easeInBounce(e * 2, 0, n, r), l * 0.5 + t) : (l = o.easeOutBounce(e * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + t);
|
|
524
535
|
}
|
|
525
536
|
};
|
|
526
|
-
return
|
|
537
|
+
return je = o, je;
|
|
527
538
|
}
|
|
528
|
-
var
|
|
529
|
-
function
|
|
530
|
-
return
|
|
539
|
+
var Nt = Tt();
|
|
540
|
+
function kt(o) {
|
|
541
|
+
return o * Math.PI / 180;
|
|
531
542
|
}
|
|
532
|
-
function
|
|
533
|
-
return
|
|
543
|
+
function G(o, e) {
|
|
544
|
+
return o + Math.random() * (e - o);
|
|
534
545
|
}
|
|
535
|
-
function
|
|
536
|
-
return Math.floor(
|
|
546
|
+
function Mt(o, e) {
|
|
547
|
+
return Math.floor(o + Math.random() * (e - o + 1));
|
|
537
548
|
}
|
|
538
|
-
var
|
|
539
|
-
(function(
|
|
540
|
-
|
|
541
|
-
})(
|
|
542
|
-
var
|
|
543
|
-
(function(
|
|
544
|
-
|
|
545
|
-
})(
|
|
546
|
-
const
|
|
547
|
-
class
|
|
548
|
-
constructor(
|
|
549
|
-
this.getOptions =
|
|
549
|
+
var Ne;
|
|
550
|
+
(function(o) {
|
|
551
|
+
o[o.Circle = 0] = "Circle", o[o.Square = 1] = "Square", o[o.Strip = 2] = "Strip";
|
|
552
|
+
})(Ne || (Ne = {}));
|
|
553
|
+
var le;
|
|
554
|
+
(function(o) {
|
|
555
|
+
o[o.Positive = 1] = "Positive", o[o.Negative = -1] = "Negative";
|
|
556
|
+
})(le || (le = {}));
|
|
557
|
+
const Ot = 1e3 / 60;
|
|
558
|
+
class Pt {
|
|
559
|
+
constructor(e, t, i, r) {
|
|
560
|
+
this.getOptions = t;
|
|
550
561
|
const { colors: n, initialVelocityX: l, initialVelocityY: s } = this.getOptions();
|
|
551
|
-
this.context =
|
|
562
|
+
this.context = e, this.x = i, this.y = r, this.w = G(5, 20), this.h = G(5, 20), this.radius = G(5, 10), this.vx = typeof l == "number" ? G(-l, l) : G(l.min, l.max), this.vy = typeof s == "number" ? G(-s, 0) : G(s.min, s.max), this.shape = Mt(0, 2), this.angle = kt(G(0, 360)), this.angularSpin = G(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = G(0, 1), this.rotationDirection = G(0, 1) ? le.Positive : le.Negative;
|
|
552
563
|
}
|
|
553
|
-
update(
|
|
554
|
-
const { gravity:
|
|
555
|
-
this.x += this.vx * s, this.y += this.vy * s, this.vy +=
|
|
564
|
+
update(e) {
|
|
565
|
+
const { gravity: t, wind: i, friction: r, opacity: n, drawShape: l } = this.getOptions(), s = e / Ot;
|
|
566
|
+
this.x += this.vx * s, this.y += this.vy * s, this.vy += t * s, this.vx += i * s, this.vx *= r ** s, this.vy *= r ** s, this.rotateY >= 1 && this.rotationDirection === le.Positive ? this.rotationDirection = le.Negative : this.rotateY <= -1 && this.rotationDirection === le.Negative && (this.rotationDirection = le.Positive);
|
|
556
567
|
const p = 0.1 * this.rotationDirection * s;
|
|
557
568
|
if (this.rotateY += p, 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")
|
|
558
569
|
l.call(this, this.context);
|
|
559
570
|
else
|
|
560
571
|
switch (this.shape) {
|
|
561
|
-
case
|
|
572
|
+
case Ne.Circle: {
|
|
562
573
|
this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
|
|
563
574
|
break;
|
|
564
575
|
}
|
|
565
|
-
case
|
|
576
|
+
case Ne.Square: {
|
|
566
577
|
this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
|
|
567
578
|
break;
|
|
568
579
|
}
|
|
569
|
-
case
|
|
580
|
+
case Ne.Strip: {
|
|
570
581
|
this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
|
|
571
582
|
break;
|
|
572
583
|
}
|
|
@@ -574,39 +585,39 @@ class Pe {
|
|
|
574
585
|
this.context.closePath(), this.context.restore();
|
|
575
586
|
}
|
|
576
587
|
}
|
|
577
|
-
class
|
|
578
|
-
constructor(
|
|
588
|
+
class At {
|
|
589
|
+
constructor(e, t) {
|
|
579
590
|
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) => {
|
|
580
591
|
this.particles.splice(r, 1);
|
|
581
592
|
}, this.getParticle = () => {
|
|
582
|
-
const r =
|
|
583
|
-
return new
|
|
593
|
+
const r = G(this.x, this.w + this.x), n = G(this.y, this.h + this.y);
|
|
594
|
+
return new Pt(this.context, this.getOptions, r, n);
|
|
584
595
|
}, this.animate = (r) => {
|
|
585
|
-
const { canvas: n, context: l, particlesGenerated: s, lastNumberOfPieces: p } = this, { run: v, recycle:
|
|
596
|
+
const { canvas: n, context: l, particlesGenerated: s, lastNumberOfPieces: p } = this, { run: v, recycle: A, numberOfPieces: R, debug: C, tweenFunction: te, tweenDuration: U } = this.getOptions();
|
|
586
597
|
if (!v)
|
|
587
598
|
return !1;
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
p !==
|
|
591
|
-
const
|
|
592
|
-
for (let
|
|
599
|
+
const X = this.particles.length, z = A ? X : s;
|
|
600
|
+
if (z < R) {
|
|
601
|
+
p !== R && (this.tweenProgress = 0, this.tweenFrom = z, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(U, Math.max(0, this.tweenProgress + r));
|
|
602
|
+
const N = te(this.tweenProgress, this.tweenFrom, R, U), F = Math.round(N - z);
|
|
603
|
+
for (let Q = 0; Q < F; Q++)
|
|
593
604
|
this.particles.push(this.getParticle());
|
|
594
|
-
this.particlesGenerated +=
|
|
605
|
+
this.particlesGenerated += F;
|
|
595
606
|
}
|
|
596
|
-
C && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${
|
|
597
|
-
for (let
|
|
598
|
-
const
|
|
599
|
-
|
|
607
|
+
C && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${X}`, n.width - 10, n.height - 20));
|
|
608
|
+
for (let N = this.particles.length - 1; N >= 0; N--) {
|
|
609
|
+
const F = this.particles[N];
|
|
610
|
+
F.update(r), (F.y > n.height || F.y < -100 || F.x > n.width + 100 || F.x < -100) && (A && z <= R ? this.particles[N] = this.getParticle() : this.removeParticleAt(N));
|
|
600
611
|
}
|
|
601
|
-
return
|
|
602
|
-
}, this.canvas =
|
|
603
|
-
const
|
|
604
|
-
if (!
|
|
612
|
+
return X > 0 || z < R;
|
|
613
|
+
}, this.canvas = e;
|
|
614
|
+
const i = this.canvas.getContext("2d");
|
|
615
|
+
if (!i)
|
|
605
616
|
throw new Error("Could not get canvas context");
|
|
606
|
-
this.context =
|
|
617
|
+
this.context = i, this.getOptions = t;
|
|
607
618
|
}
|
|
608
619
|
}
|
|
609
|
-
const
|
|
620
|
+
const Ke = {
|
|
610
621
|
width: typeof window < "u" ? window.innerWidth : 300,
|
|
611
622
|
height: typeof window < "u" ? window.innerHeight : 200,
|
|
612
623
|
numberOfPieces: 200,
|
|
@@ -636,13 +647,13 @@ const Kt = {
|
|
|
636
647
|
],
|
|
637
648
|
opacity: 1,
|
|
638
649
|
debug: !1,
|
|
639
|
-
tweenFunction:
|
|
650
|
+
tweenFunction: Nt.easeInOutQuad,
|
|
640
651
|
tweenDuration: 5e3,
|
|
641
652
|
recycle: !0,
|
|
642
653
|
run: !0
|
|
643
654
|
};
|
|
644
|
-
class
|
|
645
|
-
constructor(
|
|
655
|
+
class Rt {
|
|
656
|
+
constructor(e, t) {
|
|
646
657
|
this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
|
|
647
658
|
const n = {
|
|
648
659
|
confettiSource: {
|
|
@@ -654,55 +665,55 @@ class Re {
|
|
|
654
665
|
};
|
|
655
666
|
this._options = {
|
|
656
667
|
...n,
|
|
657
|
-
...
|
|
668
|
+
...Ke,
|
|
658
669
|
...r
|
|
659
670
|
}, Object.assign(this, r.confettiSource);
|
|
660
671
|
}, this.update = (r = 0) => {
|
|
661
|
-
const { options: { run: n, onConfettiComplete: l, frameRate: s }, canvas: p, context: v } = this,
|
|
662
|
-
if (s &&
|
|
672
|
+
const { options: { run: n, onConfettiComplete: l, frameRate: s }, canvas: p, context: v } = this, A = Math.min(r - this.lastFrameTime, 50);
|
|
673
|
+
if (s && A < 1e3 / s) {
|
|
663
674
|
this.rafId = requestAnimationFrame(this.update);
|
|
664
675
|
return;
|
|
665
676
|
}
|
|
666
|
-
this.lastFrameTime = r - (s ?
|
|
677
|
+
this.lastFrameTime = r - (s ? A % s : 0), n && (v.fillStyle = "white", v.clearRect(0, 0, p.width, p.height)), this.generator.animate(A) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
|
|
667
678
|
}, this.reset = () => {
|
|
668
679
|
this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
|
|
669
680
|
}, this.stop = () => {
|
|
670
681
|
this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
|
|
671
|
-
}, this.canvas =
|
|
672
|
-
const
|
|
673
|
-
if (!
|
|
682
|
+
}, this.canvas = e;
|
|
683
|
+
const i = this.canvas.getContext("2d");
|
|
684
|
+
if (!i)
|
|
674
685
|
throw new Error("Could not get canvas context");
|
|
675
|
-
this.context =
|
|
686
|
+
this.context = i, this.generator = new At(this.canvas, () => this.options), this.options = t, this.update();
|
|
676
687
|
}
|
|
677
688
|
get options() {
|
|
678
689
|
return this._options;
|
|
679
690
|
}
|
|
680
|
-
set options(
|
|
691
|
+
set options(e) {
|
|
681
692
|
var r, n;
|
|
682
|
-
const
|
|
683
|
-
this.setOptionsWithDefaults(
|
|
693
|
+
const t = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
|
|
694
|
+
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();
|
|
684
695
|
}
|
|
685
696
|
}
|
|
686
|
-
const
|
|
687
|
-
class
|
|
688
|
-
constructor(
|
|
689
|
-
super(
|
|
697
|
+
const Ft = Le.createRef();
|
|
698
|
+
class He extends Le.Component {
|
|
699
|
+
constructor(e) {
|
|
700
|
+
super(e), this.canvas = Le.createRef(), this.canvas = e.canvasRef || Ft;
|
|
690
701
|
}
|
|
691
702
|
componentDidMount() {
|
|
692
703
|
if (this.canvas.current) {
|
|
693
|
-
const
|
|
694
|
-
this.confetti = new
|
|
704
|
+
const e = Ve(this.props)[0];
|
|
705
|
+
this.confetti = new Rt(this.canvas.current, e);
|
|
695
706
|
}
|
|
696
707
|
}
|
|
697
708
|
componentDidUpdate() {
|
|
698
|
-
const
|
|
699
|
-
this.confetti && (this.confetti.options =
|
|
709
|
+
const e = Ve(this.props)[0];
|
|
710
|
+
this.confetti && (this.confetti.options = e);
|
|
700
711
|
}
|
|
701
712
|
componentWillUnmount() {
|
|
702
713
|
this.confetti && this.confetti.stop(), this.confetti = void 0;
|
|
703
714
|
}
|
|
704
715
|
render() {
|
|
705
|
-
const [
|
|
716
|
+
const [e, t] = Ve(this.props), i = {
|
|
706
717
|
zIndex: 2,
|
|
707
718
|
position: "absolute",
|
|
708
719
|
pointerEvents: "none",
|
|
@@ -710,45 +721,45 @@ class Ht extends Lt.Component {
|
|
|
710
721
|
left: 0,
|
|
711
722
|
bottom: 0,
|
|
712
723
|
right: 0,
|
|
713
|
-
...
|
|
724
|
+
...t.style
|
|
714
725
|
};
|
|
715
|
-
return
|
|
726
|
+
return f("canvas", { width: e.width, height: e.height, ref: this.canvas, ...t, style: i });
|
|
716
727
|
}
|
|
717
728
|
}
|
|
718
|
-
|
|
719
|
-
...
|
|
729
|
+
He.defaultProps = {
|
|
730
|
+
...Ke
|
|
720
731
|
};
|
|
721
|
-
|
|
722
|
-
function
|
|
723
|
-
const
|
|
724
|
-
...Object.keys(
|
|
732
|
+
He.displayName = "ReactConfetti";
|
|
733
|
+
function Ve(o) {
|
|
734
|
+
const e = {}, t = {}, i = {}, r = [
|
|
735
|
+
...Object.keys(Ke),
|
|
725
736
|
"confettiSource",
|
|
726
737
|
"drawShape",
|
|
727
738
|
"onConfettiComplete",
|
|
728
739
|
"frameRate"
|
|
729
740
|
], n = ["canvasRef"];
|
|
730
|
-
for (const l in
|
|
731
|
-
const s =
|
|
732
|
-
r.includes(l) ?
|
|
741
|
+
for (const l in o) {
|
|
742
|
+
const s = o[l];
|
|
743
|
+
r.includes(l) ? e[l] = s : n.includes(l) ? n[l] = s : i[l] = s;
|
|
733
744
|
}
|
|
734
|
-
return [
|
|
745
|
+
return [e, i, t];
|
|
735
746
|
}
|
|
736
|
-
const
|
|
747
|
+
const Dt = Le.forwardRef((o, e) => f(He, { canvasRef: e, ...o }));
|
|
737
748
|
/**
|
|
738
749
|
* @license lucide-react v0.515.0 - ISC
|
|
739
750
|
*
|
|
740
751
|
* This source code is licensed under the ISC license.
|
|
741
752
|
* See the LICENSE file in the root directory of this source tree.
|
|
742
753
|
*/
|
|
743
|
-
const
|
|
754
|
+
const Et = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Lt = (o) => o.replace(
|
|
744
755
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
745
|
-
(
|
|
746
|
-
),
|
|
747
|
-
const
|
|
748
|
-
return
|
|
749
|
-
},
|
|
750
|
-
for (const
|
|
751
|
-
if (
|
|
756
|
+
(e, t, i) => i ? i.toUpperCase() : t.toLowerCase()
|
|
757
|
+
), dt = (o) => {
|
|
758
|
+
const e = Lt(o);
|
|
759
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
760
|
+
}, pt = (...o) => o.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim(), qt = (o) => {
|
|
761
|
+
for (const e in o)
|
|
762
|
+
if (e.startsWith("aria-") || e === "role" || e === "title")
|
|
752
763
|
return !0;
|
|
753
764
|
};
|
|
754
765
|
/**
|
|
@@ -757,7 +768,7 @@ const Ee = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Le = (
|
|
|
757
768
|
* This source code is licensed under the ISC license.
|
|
758
769
|
* See the LICENSE file in the root directory of this source tree.
|
|
759
770
|
*/
|
|
760
|
-
var $
|
|
771
|
+
var $t = {
|
|
761
772
|
xmlns: "http://www.w3.org/2000/svg",
|
|
762
773
|
width: 24,
|
|
763
774
|
height: 24,
|
|
@@ -774,31 +785,31 @@ var $e = {
|
|
|
774
785
|
* This source code is licensed under the ISC license.
|
|
775
786
|
* See the LICENSE file in the root directory of this source tree.
|
|
776
787
|
*/
|
|
777
|
-
const
|
|
788
|
+
const Ut = ft(
|
|
778
789
|
({
|
|
779
|
-
color:
|
|
780
|
-
size:
|
|
781
|
-
strokeWidth:
|
|
782
|
-
absoluteStrokeWidth:
|
|
790
|
+
color: o = "currentColor",
|
|
791
|
+
size: e = 24,
|
|
792
|
+
strokeWidth: t = 2,
|
|
793
|
+
absoluteStrokeWidth: i,
|
|
783
794
|
className: r = "",
|
|
784
795
|
children: n,
|
|
785
796
|
iconNode: l,
|
|
786
797
|
...s
|
|
787
|
-
}, p) =>
|
|
798
|
+
}, p) => Qe(
|
|
788
799
|
"svg",
|
|
789
800
|
{
|
|
790
801
|
ref: p,
|
|
791
|
-
...$
|
|
792
|
-
width:
|
|
793
|
-
height:
|
|
794
|
-
stroke:
|
|
795
|
-
strokeWidth:
|
|
796
|
-
className:
|
|
797
|
-
...!n && !
|
|
802
|
+
...$t,
|
|
803
|
+
width: e,
|
|
804
|
+
height: e,
|
|
805
|
+
stroke: o,
|
|
806
|
+
strokeWidth: i ? Number(t) * 24 / Number(e) : t,
|
|
807
|
+
className: pt("lucide", r),
|
|
808
|
+
...!n && !qt(s) && { "aria-hidden": "true" },
|
|
798
809
|
...s
|
|
799
810
|
},
|
|
800
811
|
[
|
|
801
|
-
...l.map(([v,
|
|
812
|
+
...l.map(([v, A]) => Qe(v, A)),
|
|
802
813
|
...Array.isArray(n) ? n : [n]
|
|
803
814
|
]
|
|
804
815
|
)
|
|
@@ -809,20 +820,20 @@ const Ue = fe(
|
|
|
809
820
|
* This source code is licensed under the ISC license.
|
|
810
821
|
* See the LICENSE file in the root directory of this source tree.
|
|
811
822
|
*/
|
|
812
|
-
const
|
|
813
|
-
const
|
|
814
|
-
({ className:
|
|
823
|
+
const zt = (o, e) => {
|
|
824
|
+
const t = ft(
|
|
825
|
+
({ className: i, ...r }, n) => Qe(Ut, {
|
|
815
826
|
ref: n,
|
|
816
|
-
iconNode:
|
|
817
|
-
className:
|
|
818
|
-
`lucide-${
|
|
819
|
-
`lucide-${
|
|
820
|
-
|
|
827
|
+
iconNode: e,
|
|
828
|
+
className: pt(
|
|
829
|
+
`lucide-${Et(dt(o))}`,
|
|
830
|
+
`lucide-${o}`,
|
|
831
|
+
i
|
|
821
832
|
),
|
|
822
833
|
...r
|
|
823
834
|
})
|
|
824
835
|
);
|
|
825
|
-
return
|
|
836
|
+
return t.displayName = dt(o), t;
|
|
826
837
|
};
|
|
827
838
|
/**
|
|
828
839
|
* @license lucide-react v0.515.0 - ISC
|
|
@@ -830,21 +841,21 @@ const ze = (i, t) => {
|
|
|
830
841
|
* This source code is licensed under the ISC license.
|
|
831
842
|
* See the LICENSE file in the root directory of this source tree.
|
|
832
843
|
*/
|
|
833
|
-
const
|
|
844
|
+
const Wt = [
|
|
834
845
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
835
846
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
836
|
-
],
|
|
837
|
-
backdrop:
|
|
838
|
-
celebrationOverlay:
|
|
839
|
-
celebrationChip:
|
|
840
|
-
backdropOpen:
|
|
841
|
-
backdropClosed:
|
|
842
|
-
panel:
|
|
843
|
-
panelOpen:
|
|
844
|
-
panelClosed:
|
|
845
|
-
header:
|
|
846
|
-
headerCenter:
|
|
847
|
-
title:
|
|
847
|
+
], jt = zt("search", Wt), Vt = "_backdrop_227w4_1", Gt = "_celebrationOverlay_227w4_14", Qt = "_celebrationChip_227w4_23", Yt = "_backdropOpen_227w4_74", Kt = "_backdropClosed_227w4_78", Ht = "_panel_227w4_82", Xt = "_panelOpen_227w4_102", Zt = "_panelClosed_227w4_106", Jt = "_header_227w4_145", en = "_headerCenter_227w4_154", tn = "_title_227w4_162", nn = "_searchIconButton_227w4_171", rn = "_headerTitleWrap_227w4_193", on = "_headerSearchWrap_227w4_197", an = "_headerSearchOpen_227w4_209", sn = "_searchBar_227w4_221", cn = "_searchInput_227w4_233", ln = "_searchClearButton_227w4_254", un = "_closeButton_227w4_276", dn = "_body_227w4_309", hn = "_muted_227w4_314", fn = "_error_227w4_319", mn = "_variants_227w4_324", pn = "_variantList_227w4_328", bn = "_variantRow_227w4_336", wn = "_variantLeft_227w4_344", _n = "_addToBundleButton_227w4_351", yn = "_variantThumb_227w4_379", gn = "_variantThumbImg_227w4_389", vn = "_variantThumbFallback_227w4_396", xn = "_variantInfo_227w4_406", Cn = "_variantName_227w4_410", In = "_variantMeta_227w4_419", Sn = "_variantPriceRow_227w4_427", Bn = "_variantCompareAt_227w4_434", Tn = "_variantPrice_227w4_427", Nn = "_qtyControls_227w4_445", kn = "_qtyButton_227w4_451", Mn = "_qtyValue_227w4_476", On = "_footer_227w4_483", Pn = "_poweredBy_227w4_490", An = "_boxSummaryWindow_227w4_502", Rn = "_boxSummaryRow_227w4_519", Fn = "_boxSlot_227w4_527", Dn = "_boxItem_227w4_535", En = "_boxItemClickable_227w4_547", Ln = "_boxThresholdLabel_227w4_556", qn = "_boxItemPlaceholder_227w4_567", $n = "_boxItemFilled_227w4_573", Un = "_boxItemThreshold_227w4_579", zn = "_boxItemDiscountText_227w4_587", Wn = "_boxItemPlus_227w4_595", jn = "_boxItemImage_227w4_602", Vn = "_boxItemFallback_227w4_609", Gn = "_ctaButtonGroup_227w4_620", Qn = "_ctaButtonGroupAnimating_227w4_627", Yn = "_cta_227w4_620", Kn = "_ctaDualLeft_227w4_655", Hn = "_ctaDualLeftAnimating_227w4_673", Xn = "_ctaDualRight_227w4_686", Zn = "_ctaDualRightAnimating_227w4_702", Jn = "_ctaTotals_227w4_713", er = "_ctaDiscountBadge_227w4_721", tr = "_ctaTotalsWrap_227w4_735", nr = "_ctaTotalsWrapVisible_227w4_748", rr = "_ctaTotalsStrike_227w4_755", ir = "_ctaTotalsPrice_227w4_762", u = {
|
|
848
|
+
backdrop: Vt,
|
|
849
|
+
celebrationOverlay: Gt,
|
|
850
|
+
celebrationChip: Qt,
|
|
851
|
+
backdropOpen: Yt,
|
|
852
|
+
backdropClosed: Kt,
|
|
853
|
+
panel: Ht,
|
|
854
|
+
panelOpen: Xt,
|
|
855
|
+
panelClosed: Zt,
|
|
856
|
+
header: Jt,
|
|
857
|
+
headerCenter: en,
|
|
858
|
+
title: tn,
|
|
848
859
|
searchIconButton: nn,
|
|
849
860
|
headerTitleWrap: rn,
|
|
850
861
|
headerSearchWrap: on,
|
|
@@ -860,8 +871,8 @@ const We = [
|
|
|
860
871
|
variantList: pn,
|
|
861
872
|
variantRow: bn,
|
|
862
873
|
variantLeft: wn,
|
|
863
|
-
addToBundleButton:
|
|
864
|
-
variantThumb:
|
|
874
|
+
addToBundleButton: _n,
|
|
875
|
+
variantThumb: yn,
|
|
865
876
|
variantThumbImg: gn,
|
|
866
877
|
variantThumbFallback: vn,
|
|
867
878
|
variantInfo: xn,
|
|
@@ -896,61 +907,61 @@ const We = [
|
|
|
896
907
|
ctaDualRight: Xn,
|
|
897
908
|
ctaDualRightAnimating: Zn,
|
|
898
909
|
ctaTotals: Jn,
|
|
899
|
-
ctaDiscountBadge:
|
|
900
|
-
ctaTotalsWrap:
|
|
910
|
+
ctaDiscountBadge: er,
|
|
911
|
+
ctaTotalsWrap: tr,
|
|
901
912
|
ctaTotalsWrapVisible: nr,
|
|
902
913
|
ctaTotalsStrike: rr,
|
|
903
|
-
ctaTotalsPrice:
|
|
914
|
+
ctaTotalsPrice: ir
|
|
904
915
|
};
|
|
905
|
-
function hr(
|
|
906
|
-
var
|
|
916
|
+
function hr(o) {
|
|
917
|
+
var it, ot;
|
|
907
918
|
const {
|
|
908
|
-
isOpen:
|
|
909
|
-
close:
|
|
910
|
-
loading:
|
|
919
|
+
isOpen: e,
|
|
920
|
+
close: t,
|
|
921
|
+
loading: i,
|
|
911
922
|
submitting: r,
|
|
912
923
|
error: n,
|
|
913
924
|
currencyCode: l,
|
|
914
925
|
config: s,
|
|
915
926
|
eligibleVariants: p,
|
|
916
927
|
selections: v,
|
|
917
|
-
selectionOrder:
|
|
918
|
-
setQuantity:
|
|
928
|
+
selectionOrder: A,
|
|
929
|
+
setQuantity: R,
|
|
919
930
|
bundleSize: C,
|
|
920
|
-
minRequired:
|
|
921
|
-
canSubmit:
|
|
922
|
-
submit:
|
|
923
|
-
submitAndCheckout:
|
|
924
|
-
} =
|
|
931
|
+
minRequired: te,
|
|
932
|
+
canSubmit: U,
|
|
933
|
+
submit: X,
|
|
934
|
+
submitAndCheckout: z
|
|
935
|
+
} = Ye(), [N, F] = k(!1), [Q, _] = k(""), ue = V(null), ie = V(null), we = V(null), [de, ke] = k(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Me, Oe] = k(0), [he, Pe] = k(null), [Ae, fe] = k(!1), $ = V(null), Ce = V(C), me = 7e3, [Z, Re] = k(0), [H, _e] = k(null), [oe, Ie] = k(!1), ne = V(null), qe = 2800, h = [
|
|
925
936
|
"#2563eb",
|
|
926
937
|
"#3b82f6",
|
|
927
938
|
"#60a5fa",
|
|
928
939
|
"#93c5fd",
|
|
929
940
|
"#bae6fd",
|
|
930
941
|
"#e0f2fe"
|
|
931
|
-
], x =
|
|
942
|
+
], x = T(() => {
|
|
932
943
|
var c;
|
|
933
944
|
const a = (c = s == null ? void 0 : s.styleSettings) == null ? void 0 : c.confettiColors;
|
|
934
945
|
return Array.isArray(a) && a.length >= 6 ? a.slice(0, 6).map(
|
|
935
|
-
(d, b) => typeof d == "string" && d.trim() ? d :
|
|
936
|
-
) : [...
|
|
937
|
-
}, [(
|
|
946
|
+
(d, b) => typeof d == "string" && d.trim() ? d : h[b]
|
|
947
|
+
) : [...h];
|
|
948
|
+
}, [(it = s == null ? void 0 : s.styleSettings) == null ? void 0 : it.confettiColors]), W = (a) => {
|
|
938
949
|
const c = Number.parseFloat(a);
|
|
939
950
|
return Number.isFinite(c) ? String(Math.round(c)) : a;
|
|
940
|
-
},
|
|
951
|
+
}, y = (a) => {
|
|
941
952
|
const c = (a ?? []).filter((d) => {
|
|
942
953
|
var I, g;
|
|
943
954
|
const b = (I = d == null ? void 0 : d.name) == null ? void 0 : I.trim(), w = (g = d == null ? void 0 : d.value) == null ? void 0 : g.trim();
|
|
944
955
|
return !(!b || !w || b.toLowerCase() === "title");
|
|
945
956
|
});
|
|
946
957
|
return c.length ? c.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
|
|
947
|
-
},
|
|
958
|
+
}, J = (a) => {
|
|
948
959
|
var c;
|
|
949
960
|
return ((c = a.product) == null ? void 0 : c.title) ?? a.displayName ?? a.title;
|
|
950
|
-
},
|
|
951
|
-
const c =
|
|
961
|
+
}, j = (a) => {
|
|
962
|
+
const c = J(a), d = y(a.selectedOptions);
|
|
952
963
|
return [c, d].filter(Boolean).join(" — ");
|
|
953
|
-
}, [
|
|
964
|
+
}, [ye, M] = k(e), E = V(null), D = (a) => {
|
|
954
965
|
const c = Number(a);
|
|
955
966
|
if (!Number.isFinite(c)) return a;
|
|
956
967
|
if (l)
|
|
@@ -959,37 +970,37 @@ function hr(i) {
|
|
|
959
970
|
} catch {
|
|
960
971
|
}
|
|
961
972
|
return `$${c.toFixed(2)}`;
|
|
962
|
-
},
|
|
973
|
+
}, ae = ((ot = s == null ? void 0 : s.title) == null ? void 0 : ot.trim()) || "Build your bundle", ge = T(() => {
|
|
963
974
|
const a = Number((s == null ? void 0 : s.maxBundleSize) ?? NaN), c = Number.isFinite(a) ? Math.floor(a) : 100;
|
|
964
975
|
return Math.max(2, Math.min(100, c));
|
|
965
|
-
}, [s == null ? void 0 : s.maxBundleSize]),
|
|
966
|
-
const a =
|
|
967
|
-
if (!a) return
|
|
976
|
+
}, [s == null ? void 0 : s.maxBundleSize]), pe = C >= ge, L = T(() => [...p].sort((a, c) => a.displayName.localeCompare(c.displayName)), [p]), O = T(() => {
|
|
977
|
+
const a = Q.trim().toLowerCase();
|
|
978
|
+
if (!a) return L;
|
|
968
979
|
const c = a.split(/\s+/).filter(Boolean), d = (b) => {
|
|
969
980
|
var g;
|
|
970
981
|
const w = [];
|
|
971
982
|
w.push(b.displayName), (g = b.product) != null && g.title && w.push(b.product.title);
|
|
972
|
-
for (const
|
|
973
|
-
w.push(
|
|
983
|
+
for (const B of b.selectedOptions ?? [])
|
|
984
|
+
w.push(B.name), w.push(B.value);
|
|
974
985
|
const I = w.join(" ").toLowerCase();
|
|
975
|
-
return c.every((
|
|
986
|
+
return c.every((B) => I.includes(B));
|
|
976
987
|
};
|
|
977
|
-
return
|
|
978
|
-
}, [
|
|
988
|
+
return L.filter(d);
|
|
989
|
+
}, [Q, L]), S = T(() => [...(s == null ? void 0 : s.rules) ?? []].sort((a, c) => a.minBundleSize - c.minBundleSize), [s == null ? void 0 : s.rules]), m = T(() => Math.max(0, te - C), [C, te]), Y = T(() => {
|
|
979
990
|
let a = null;
|
|
980
|
-
for (const c of
|
|
991
|
+
for (const c of S)
|
|
981
992
|
C >= c.minBundleSize && (a = c);
|
|
982
993
|
return a;
|
|
983
|
-
}, [C,
|
|
984
|
-
if (!
|
|
985
|
-
const a = Number.parseFloat(
|
|
994
|
+
}, [C, S]), se = T(() => {
|
|
995
|
+
if (!Y) return null;
|
|
996
|
+
const a = Number.parseFloat(Y.discountPercent);
|
|
986
997
|
return !Number.isFinite(a) || a <= 0 ? null : a;
|
|
987
|
-
}, [
|
|
988
|
-
const a =
|
|
998
|
+
}, [Y]), Se = T(() => {
|
|
999
|
+
const a = S[0];
|
|
989
1000
|
if (!a) return null;
|
|
990
1001
|
const c = Number.parseFloat(a.discountPercent);
|
|
991
1002
|
return !Number.isFinite(c) || c <= 0 ? null : c;
|
|
992
|
-
}, [
|
|
1003
|
+
}, [S]), ve = se ?? Se, Be = T(() => {
|
|
993
1004
|
const a = new Map(p.map((d) => [d.id, d]));
|
|
994
1005
|
let c = 0;
|
|
995
1006
|
for (const [d, b] of Object.entries(v)) {
|
|
@@ -999,17 +1010,17 @@ function hr(i) {
|
|
|
999
1010
|
Number.isFinite(g) && (c += g * w);
|
|
1000
1011
|
}
|
|
1001
1012
|
return Math.round(c * 100) / 100;
|
|
1002
|
-
}, [p, v]),
|
|
1003
|
-
if (!
|
|
1004
|
-
const a =
|
|
1013
|
+
}, [p, v]), bt = T(() => {
|
|
1014
|
+
if (!se) return Be;
|
|
1015
|
+
const a = Be * (1 - se / 100);
|
|
1005
1016
|
return Math.round(a * 100) / 100;
|
|
1006
|
-
}, [
|
|
1017
|
+
}, [se, Be]), Xe = T(() => S.length ? Math.max(...S.map((a) => a.minBundleSize)) : 0, [S]), $e = T(() => {
|
|
1007
1018
|
const a = new Map(p.map((c) => [c.id, c]));
|
|
1008
|
-
return
|
|
1009
|
-
}, [p,
|
|
1019
|
+
return A.map((c) => a.get(c)).filter((c) => !!c);
|
|
1020
|
+
}, [p, A]), wt = T(() => {
|
|
1010
1021
|
var c;
|
|
1011
1022
|
const a = /* @__PURE__ */ new Map();
|
|
1012
|
-
for (const d of
|
|
1023
|
+
for (const d of S) {
|
|
1013
1024
|
const b = Math.max(0, d.minBundleSize - 1);
|
|
1014
1025
|
a.set(b, {
|
|
1015
1026
|
discountPercent: d.discountPercent,
|
|
@@ -1018,114 +1029,114 @@ function hr(i) {
|
|
|
1018
1029
|
});
|
|
1019
1030
|
}
|
|
1020
1031
|
return a;
|
|
1021
|
-
}, [
|
|
1022
|
-
|
|
1032
|
+
}, [S]), _t = T(() => Math.max(Xe || te, $e.length), [$e.length, Xe, te]), [Ue, Ze] = k(!0), Je = V(m);
|
|
1033
|
+
q(() => {
|
|
1023
1034
|
if (((s == null ? void 0 : s.ctaButtonMode) || "add_to_cart") === "add_to_cart_checkout") {
|
|
1024
|
-
const c =
|
|
1025
|
-
|
|
1035
|
+
const c = Je.current > 0;
|
|
1036
|
+
Ze(!(c && m === 0));
|
|
1026
1037
|
}
|
|
1027
|
-
|
|
1038
|
+
Je.current = m;
|
|
1028
1039
|
}, [m, s == null ? void 0 : s.ctaButtonMode]);
|
|
1029
|
-
const
|
|
1030
|
-
const c =
|
|
1040
|
+
const ze = V(null), et = V(null), tt = V(null), nt = V(C), rt = (a) => {
|
|
1041
|
+
const c = et.current;
|
|
1031
1042
|
if (!c) return;
|
|
1032
1043
|
const d = c.querySelector(`[data-variant-row="${a}"]`);
|
|
1033
1044
|
if (!d) return;
|
|
1034
1045
|
const b = c.getBoundingClientRect(), w = d.getBoundingClientRect(), I = 8;
|
|
1035
1046
|
if (w.top >= b.top + I && w.bottom <= b.bottom - I) return;
|
|
1036
|
-
const
|
|
1037
|
-
c.scrollTo({ top:
|
|
1047
|
+
const B = Math.max(0, c.scrollHeight - c.clientHeight), K = w.top - b.top + w.height / 2, ee = c.scrollTop + K - c.clientHeight / 2, re = Math.min(B, Math.max(0, ee));
|
|
1048
|
+
c.scrollTo({ top: re, behavior: "smooth" });
|
|
1038
1049
|
};
|
|
1039
|
-
return
|
|
1040
|
-
if (!
|
|
1050
|
+
return q(() => {
|
|
1051
|
+
if (!e) return;
|
|
1041
1052
|
const a = (c) => {
|
|
1042
|
-
c.key === "Escape" &&
|
|
1053
|
+
c.key === "Escape" && t();
|
|
1043
1054
|
};
|
|
1044
1055
|
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
1045
|
-
}, [
|
|
1056
|
+
}, [t, e]), q(() => {
|
|
1046
1057
|
if (typeof window > "u") return;
|
|
1047
|
-
const a = () =>
|
|
1058
|
+
const a = () => ke({ width: window.innerWidth, height: window.innerHeight });
|
|
1048
1059
|
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
1049
|
-
}, []),
|
|
1050
|
-
if (
|
|
1051
|
-
|
|
1060
|
+
}, []), q(() => {
|
|
1061
|
+
if (E.current != null && (window.clearTimeout(E.current), E.current = null), e) {
|
|
1062
|
+
M(!0);
|
|
1052
1063
|
return;
|
|
1053
1064
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1065
|
+
E.current = window.setTimeout(() => {
|
|
1066
|
+
M(!1), E.current = null;
|
|
1056
1067
|
}, 220);
|
|
1057
|
-
}, [
|
|
1058
|
-
|
|
1059
|
-
}, []),
|
|
1060
|
-
|
|
1061
|
-
}, []),
|
|
1062
|
-
|
|
1063
|
-
}, []),
|
|
1064
|
-
if (!
|
|
1068
|
+
}, [e]), q(() => () => {
|
|
1069
|
+
E.current != null && window.clearTimeout(E.current);
|
|
1070
|
+
}, []), q(() => () => {
|
|
1071
|
+
$.current != null && window.clearTimeout($.current);
|
|
1072
|
+
}, []), q(() => () => {
|
|
1073
|
+
ne.current != null && window.clearTimeout(ne.current);
|
|
1074
|
+
}, []), q(() => {
|
|
1075
|
+
if (!e || !N) return;
|
|
1065
1076
|
const a = requestAnimationFrame(() => {
|
|
1066
1077
|
var c;
|
|
1067
|
-
return (c =
|
|
1078
|
+
return (c = ue.current) == null ? void 0 : c.focus();
|
|
1068
1079
|
});
|
|
1069
1080
|
return () => cancelAnimationFrame(a);
|
|
1070
|
-
}, [
|
|
1071
|
-
const a =
|
|
1072
|
-
if (
|
|
1073
|
-
const c =
|
|
1081
|
+
}, [e, N]), q(() => {
|
|
1082
|
+
const a = nt.current;
|
|
1083
|
+
if (nt.current = C, C <= a) return;
|
|
1084
|
+
const c = tt.current;
|
|
1074
1085
|
if (!c) return;
|
|
1075
|
-
const d =
|
|
1086
|
+
const d = S.some((g) => g.minBundleSize === C), b = S.find((g) => g.minBundleSize > C), w = b && d ? b.minBundleSize - 1 : b ? null : C - 1;
|
|
1076
1087
|
if (w == null || w < 0) return;
|
|
1077
1088
|
const I = requestAnimationFrame(() => {
|
|
1078
1089
|
const g = c.querySelector(`[data-box-slot="${w}"]`);
|
|
1079
1090
|
if (!g) return;
|
|
1080
|
-
const
|
|
1081
|
-
if (
|
|
1082
|
-
const
|
|
1083
|
-
c.scrollTo({ left:
|
|
1091
|
+
const B = c.getBoundingClientRect(), ee = g.getBoundingClientRect().right - B.right;
|
|
1092
|
+
if (ee <= 1) return;
|
|
1093
|
+
const re = Math.max(0, c.scrollWidth - c.clientWidth), be = Math.min(re, Math.max(0, c.scrollLeft + ee));
|
|
1094
|
+
c.scrollTo({ left: be, behavior: "smooth" });
|
|
1084
1095
|
});
|
|
1085
1096
|
return () => cancelAnimationFrame(I);
|
|
1086
|
-
}, [C,
|
|
1087
|
-
if (!
|
|
1088
|
-
const a =
|
|
1089
|
-
if (
|
|
1090
|
-
const c =
|
|
1091
|
-
c && (
|
|
1092
|
-
|
|
1093
|
-
},
|
|
1094
|
-
}, [C,
|
|
1095
|
-
if (!
|
|
1097
|
+
}, [C, S]), q(() => {
|
|
1098
|
+
if (!e) return;
|
|
1099
|
+
const a = Ce.current;
|
|
1100
|
+
if (Ce.current = C, C <= a) return;
|
|
1101
|
+
const c = S.find((d) => d.minBundleSize === C);
|
|
1102
|
+
c && (_e(`You received a ${W(c.discountPercent)}% discount!`), Re((d) => d + 1), Ie(!0), ne.current != null && window.clearTimeout(ne.current), ne.current = window.setTimeout(() => {
|
|
1103
|
+
Ie(!1), ne.current = null;
|
|
1104
|
+
}, qe));
|
|
1105
|
+
}, [C, e, S]), q(() => {
|
|
1106
|
+
if (!e || !oe || !H) return;
|
|
1096
1107
|
const a = requestAnimationFrame(() => {
|
|
1097
|
-
var
|
|
1098
|
-
const c =
|
|
1108
|
+
var B;
|
|
1109
|
+
const c = we.current, d = c == null ? void 0 : c.getBoundingClientRect(), b = (B = ze.current) == null ? void 0 : B.getBoundingClientRect(), w = d ? d.left + d.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, I = d ? d.top + d.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, g = {
|
|
1099
1110
|
x: w - 2,
|
|
1100
1111
|
y: I - 2,
|
|
1101
1112
|
w: 4,
|
|
1102
1113
|
h: 4
|
|
1103
1114
|
};
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
},
|
|
1115
|
+
Pe(g), Oe((K) => K + 1), fe(!0), $.current != null && window.clearTimeout($.current), $.current = window.setTimeout(() => {
|
|
1116
|
+
fe(!1), $.current = null;
|
|
1117
|
+
}, me);
|
|
1107
1118
|
});
|
|
1108
1119
|
return () => cancelAnimationFrame(a);
|
|
1109
|
-
}, [
|
|
1120
|
+
}, [Z, H, me, oe, e]), q(() => {
|
|
1110
1121
|
var a;
|
|
1111
|
-
|
|
1112
|
-
}, [
|
|
1122
|
+
e && ((a = ze.current) == null || a.focus());
|
|
1123
|
+
}, [e]), ye ? /* @__PURE__ */ P(
|
|
1113
1124
|
"div",
|
|
1114
1125
|
{
|
|
1115
1126
|
role: "dialog",
|
|
1116
1127
|
"aria-modal": "true",
|
|
1117
1128
|
"aria-label": "Bundle builder",
|
|
1118
|
-
className: [u.backdrop,
|
|
1129
|
+
className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
|
|
1119
1130
|
onMouseDown: (a) => {
|
|
1120
|
-
a.target === a.currentTarget &&
|
|
1131
|
+
a.target === a.currentTarget && t();
|
|
1121
1132
|
},
|
|
1122
1133
|
children: [
|
|
1123
|
-
|
|
1124
|
-
|
|
1134
|
+
Ae && he && de.width > 0 && de.height > 0 ? /* @__PURE__ */ f(
|
|
1135
|
+
Dt,
|
|
1125
1136
|
{
|
|
1126
|
-
width:
|
|
1127
|
-
height:
|
|
1128
|
-
confettiSource:
|
|
1137
|
+
width: de.width,
|
|
1138
|
+
height: de.height,
|
|
1139
|
+
confettiSource: he,
|
|
1129
1140
|
colors: x,
|
|
1130
1141
|
recycle: !1,
|
|
1131
1142
|
numberOfPieces: 70,
|
|
@@ -1135,42 +1146,42 @@ function hr(i) {
|
|
|
1135
1146
|
initialVelocityX: { min: -6, max: 6 },
|
|
1136
1147
|
style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
|
|
1137
1148
|
},
|
|
1138
|
-
|
|
1149
|
+
Me
|
|
1139
1150
|
) : null,
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
/* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ P("aside", { ref: ze, className: [u.panel, e ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
|
|
1152
|
+
oe && H ? /* @__PURE__ */ f("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ f("div", { ref: we, className: u.celebrationChip, children: H }, Z) }) : null,
|
|
1153
|
+
/* @__PURE__ */ P("header", { className: [u.header, N ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
|
|
1154
|
+
/* @__PURE__ */ f(
|
|
1144
1155
|
"button",
|
|
1145
1156
|
{
|
|
1146
1157
|
type: "button",
|
|
1147
1158
|
className: u.searchIconButton,
|
|
1148
|
-
"aria-label":
|
|
1149
|
-
"aria-expanded":
|
|
1159
|
+
"aria-label": N ? "Search (expanded)" : "Search",
|
|
1160
|
+
"aria-expanded": N,
|
|
1150
1161
|
onClick: () => {
|
|
1151
|
-
|
|
1162
|
+
F(!0);
|
|
1152
1163
|
},
|
|
1153
|
-
children: /* @__PURE__ */
|
|
1164
|
+
children: /* @__PURE__ */ f(jt, { size: 18, "aria-hidden": "true" })
|
|
1154
1165
|
}
|
|
1155
1166
|
),
|
|
1156
|
-
/* @__PURE__ */
|
|
1157
|
-
/* @__PURE__ */
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
/* @__PURE__ */
|
|
1167
|
+
/* @__PURE__ */ P("div", { className: u.headerCenter, children: [
|
|
1168
|
+
/* @__PURE__ */ f("div", { className: u.headerTitleWrap, "aria-hidden": N, children: /* @__PURE__ */ f("h2", { className: u.title, children: ae }) }),
|
|
1169
|
+
/* @__PURE__ */ f("div", { className: u.headerSearchWrap, "aria-hidden": !N, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
|
|
1170
|
+
/* @__PURE__ */ f(
|
|
1160
1171
|
"input",
|
|
1161
1172
|
{
|
|
1162
|
-
ref:
|
|
1173
|
+
ref: ue,
|
|
1163
1174
|
className: u.searchInput,
|
|
1164
1175
|
type: "search",
|
|
1165
|
-
value:
|
|
1176
|
+
value: Q,
|
|
1166
1177
|
placeholder: "Search",
|
|
1167
|
-
onChange: (a) =>
|
|
1178
|
+
onChange: (a) => _(a.target.value),
|
|
1168
1179
|
onBlur: () => {
|
|
1169
|
-
|
|
1180
|
+
Q.trim() === "" && F(!1);
|
|
1170
1181
|
}
|
|
1171
1182
|
}
|
|
1172
1183
|
),
|
|
1173
|
-
|
|
1184
|
+
Q.trim() ? /* @__PURE__ */ f(
|
|
1174
1185
|
"button",
|
|
1175
1186
|
{
|
|
1176
1187
|
type: "button",
|
|
@@ -1180,7 +1191,7 @@ function hr(i) {
|
|
|
1180
1191
|
},
|
|
1181
1192
|
onClick: () => {
|
|
1182
1193
|
var a;
|
|
1183
|
-
|
|
1194
|
+
_(""), (a = ue.current) == null || a.focus();
|
|
1184
1195
|
},
|
|
1185
1196
|
"aria-label": "Clear search",
|
|
1186
1197
|
children: "Clear"
|
|
@@ -1188,18 +1199,18 @@ function hr(i) {
|
|
|
1188
1199
|
) : null
|
|
1189
1200
|
] }) })
|
|
1190
1201
|
] }),
|
|
1191
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ f("button", { type: "button", onClick: t, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
|
|
1192
1203
|
] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
|
|
1195
|
-
n ? /* @__PURE__ */
|
|
1196
|
-
!
|
|
1197
|
-
/* @__PURE__ */
|
|
1198
|
-
var
|
|
1199
|
-
const c = v[a.id] ?? 0, d =
|
|
1200
|
-
return /* @__PURE__ */
|
|
1201
|
-
/* @__PURE__ */
|
|
1202
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ P("div", { className: u.body, ref: et, children: [
|
|
1205
|
+
i ? /* @__PURE__ */ f("p", { className: u.muted, children: "Loading…" }) : null,
|
|
1206
|
+
n ? /* @__PURE__ */ f("p", { className: u.error, children: n }) : null,
|
|
1207
|
+
!i && s && !s.isActive ? /* @__PURE__ */ f("p", { className: u.error, children: "Bundles are not active." }) : null,
|
|
1208
|
+
/* @__PURE__ */ f("div", { className: u.variants, children: /* @__PURE__ */ f("ul", { className: u.variantList, children: O.map((a) => {
|
|
1209
|
+
var ee, re, be, Te;
|
|
1210
|
+
const c = v[a.id] ?? 0, d = J(a), b = y(a.selectedOptions), w = j(a), I = ve, g = Number(a.price), B = I != null && Number.isFinite(I) && I > 0 && Number.isFinite(g), K = B ? Math.round(g * (1 - I / 100) * 100) / 100 : null;
|
|
1211
|
+
return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": a.id, children: [
|
|
1212
|
+
/* @__PURE__ */ P("div", { className: u.variantLeft, children: [
|
|
1213
|
+
/* @__PURE__ */ f("div", { className: u.variantThumb, "aria-hidden": "true", children: (ee = a.image) != null && ee.url ? /* @__PURE__ */ f(
|
|
1203
1214
|
"img",
|
|
1204
1215
|
{
|
|
1205
1216
|
className: u.variantThumbImg,
|
|
@@ -1207,47 +1218,47 @@ function hr(i) {
|
|
|
1207
1218
|
alt: a.image.altText ?? w,
|
|
1208
1219
|
loading: "lazy"
|
|
1209
1220
|
}
|
|
1210
|
-
) : /* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
b ? /* @__PURE__ */
|
|
1214
|
-
/* @__PURE__ */
|
|
1215
|
-
|
|
1216
|
-
/* @__PURE__ */
|
|
1217
|
-
|
|
1221
|
+
) : /* @__PURE__ */ f("div", { className: u.variantThumbFallback, children: ((Te = (be = (re = a.product) == null ? void 0 : re.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) }),
|
|
1222
|
+
/* @__PURE__ */ P("div", { className: u.variantInfo, children: [
|
|
1223
|
+
/* @__PURE__ */ f("div", { className: u.variantName, children: d }),
|
|
1224
|
+
b ? /* @__PURE__ */ f("div", { className: u.variantMeta, children: b }) : null,
|
|
1225
|
+
/* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
|
|
1226
|
+
B ? /* @__PURE__ */ f("span", { className: u.variantCompareAt, children: D(Number.isFinite(g) ? g.toFixed(2) : a.price) }) : null,
|
|
1227
|
+
/* @__PURE__ */ f("span", { className: u.variantPrice, children: D(
|
|
1228
|
+
K != null ? K.toFixed(2) : Number.isFinite(g) ? g.toFixed(2) : a.price
|
|
1218
1229
|
) })
|
|
1219
1230
|
] })
|
|
1220
1231
|
] })
|
|
1221
1232
|
] }),
|
|
1222
|
-
c <= 0 ? /* @__PURE__ */
|
|
1233
|
+
c <= 0 ? /* @__PURE__ */ f(
|
|
1223
1234
|
"button",
|
|
1224
1235
|
{
|
|
1225
1236
|
type: "button",
|
|
1226
|
-
onClick: () =>
|
|
1227
|
-
disabled: r ||
|
|
1237
|
+
onClick: () => R(a.id, 1),
|
|
1238
|
+
disabled: r || pe,
|
|
1228
1239
|
className: u.addToBundleButton,
|
|
1229
1240
|
"aria-label": `Add ${w} to bundle`,
|
|
1230
1241
|
children: "Add"
|
|
1231
1242
|
}
|
|
1232
|
-
) : /* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1243
|
+
) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
|
|
1244
|
+
/* @__PURE__ */ f(
|
|
1234
1245
|
"button",
|
|
1235
1246
|
{
|
|
1236
1247
|
type: "button",
|
|
1237
|
-
onClick: () =>
|
|
1248
|
+
onClick: () => R(a.id, c - 1),
|
|
1238
1249
|
disabled: r || c <= 0,
|
|
1239
1250
|
className: u.qtyButton,
|
|
1240
1251
|
"aria-label": `Decrease ${w}`,
|
|
1241
1252
|
children: "−"
|
|
1242
1253
|
}
|
|
1243
1254
|
),
|
|
1244
|
-
/* @__PURE__ */
|
|
1245
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ f("span", { className: u.qtyValue, "aria-label": `Quantity ${c}`, children: c }),
|
|
1256
|
+
/* @__PURE__ */ f(
|
|
1246
1257
|
"button",
|
|
1247
1258
|
{
|
|
1248
1259
|
type: "button",
|
|
1249
|
-
onClick: () =>
|
|
1250
|
-
disabled: r ||
|
|
1260
|
+
onClick: () => R(a.id, c + 1),
|
|
1261
|
+
disabled: r || pe,
|
|
1251
1262
|
className: u.qtyButton,
|
|
1252
1263
|
"aria-label": `Increase ${w}`,
|
|
1253
1264
|
children: "+"
|
|
@@ -1257,12 +1268,12 @@ function hr(i) {
|
|
|
1257
1268
|
] }, a.id);
|
|
1258
1269
|
}) }) })
|
|
1259
1270
|
] }),
|
|
1260
|
-
/* @__PURE__ */
|
|
1261
|
-
/* @__PURE__ */
|
|
1262
|
-
var
|
|
1263
|
-
const d = $
|
|
1264
|
-
return /* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ P("footer", { className: u.footer, ref: ie, children: [
|
|
1272
|
+
/* @__PURE__ */ f("div", { className: u.boxSummaryWindow, ref: tt, children: /* @__PURE__ */ f("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: _t }).map((a, c) => {
|
|
1273
|
+
var ee, re, be, Te;
|
|
1274
|
+
const d = $e[c], b = wt.get(c), w = !!d, I = !!b, g = I && !w, B = b ? `${b.discountPercent}% off` : null, K = w ? d.displayName : `Slot ${c + 1}`;
|
|
1275
|
+
return /* @__PURE__ */ P("div", { "data-box-slot": c, className: u.boxSlot, children: [
|
|
1276
|
+
/* @__PURE__ */ f(
|
|
1266
1277
|
"div",
|
|
1267
1278
|
{
|
|
1268
1279
|
className: [
|
|
@@ -1273,13 +1284,13 @@ function hr(i) {
|
|
|
1273
1284
|
].filter(Boolean).join(" "),
|
|
1274
1285
|
role: w ? "button" : void 0,
|
|
1275
1286
|
tabIndex: w ? 0 : void 0,
|
|
1276
|
-
onClick: w ? () =>
|
|
1277
|
-
onKeyDown: w ? (
|
|
1278
|
-
(
|
|
1287
|
+
onClick: w ? () => rt(d.id) : void 0,
|
|
1288
|
+
onKeyDown: w ? (We) => {
|
|
1289
|
+
(We.key === "Enter" || We.key === " ") && (We.preventDefault(), rt(d.id));
|
|
1279
1290
|
} : void 0,
|
|
1280
|
-
"aria-label": g &&
|
|
1281
|
-
title: g &&
|
|
1282
|
-
children: w ? (
|
|
1291
|
+
"aria-label": g && B ? `${K}. Unlocks ${B}.` : K,
|
|
1292
|
+
title: g && B ? `${K} • Unlocks ${B}` : K,
|
|
1293
|
+
children: w ? (ee = d.image) != null && ee.url ? /* @__PURE__ */ f(
|
|
1283
1294
|
"img",
|
|
1284
1295
|
{
|
|
1285
1296
|
className: u.boxItemImage,
|
|
@@ -1287,58 +1298,58 @@ function hr(i) {
|
|
|
1287
1298
|
alt: d.image.altText ?? d.displayName,
|
|
1288
1299
|
loading: "lazy"
|
|
1289
1300
|
}
|
|
1290
|
-
) : /* @__PURE__ */
|
|
1301
|
+
) : /* @__PURE__ */ f("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Te = (be = (re = d.product) == null ? void 0 : re.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) : g && B ? /* @__PURE__ */ f("div", { className: u.boxItemDiscountText, children: B }) : /* @__PURE__ */ f("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
|
|
1291
1302
|
}
|
|
1292
1303
|
),
|
|
1293
|
-
I ? /* @__PURE__ */
|
|
1304
|
+
I ? /* @__PURE__ */ f("div", { className: u.boxThresholdLabel, children: b.label }) : null
|
|
1294
1305
|
] }, c);
|
|
1295
1306
|
}) }) }),
|
|
1296
|
-
/* @__PURE__ */
|
|
1307
|
+
/* @__PURE__ */ f(
|
|
1297
1308
|
"div",
|
|
1298
1309
|
{
|
|
1299
1310
|
className: [u.ctaTotalsWrap, m <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
|
|
1300
1311
|
"aria-hidden": m > 0,
|
|
1301
|
-
children: /* @__PURE__ */
|
|
1302
|
-
|
|
1303
|
-
|
|
1312
|
+
children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
|
|
1313
|
+
ve ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
|
|
1314
|
+
ve,
|
|
1304
1315
|
"% Discount"
|
|
1305
|
-
] }) : /* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1316
|
+
] }) : /* @__PURE__ */ f("span", {}),
|
|
1317
|
+
/* @__PURE__ */ f("span", { children: se ? /* @__PURE__ */ P(yt, { children: [
|
|
1318
|
+
/* @__PURE__ */ f("span", { className: u.ctaTotalsStrike, children: D(Be.toFixed(2)) }),
|
|
1308
1319
|
" ",
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
] }) : /* @__PURE__ */
|
|
1320
|
+
/* @__PURE__ */ f("span", { className: u.ctaTotalsPrice, children: D(bt.toFixed(2)) })
|
|
1321
|
+
] }) : /* @__PURE__ */ f("span", { className: u.ctaTotalsPrice, children: D(Be.toFixed(2)) }) })
|
|
1311
1322
|
] })
|
|
1312
1323
|
}
|
|
1313
1324
|
),
|
|
1314
1325
|
(() => {
|
|
1315
1326
|
const a = (s == null ? void 0 : s.ctaButtonMode) || "add_to_cart";
|
|
1316
|
-
return a === "add_to_cart_checkout" ? m > 0 ? /* @__PURE__ */
|
|
1317
|
-
/* @__PURE__ */
|
|
1327
|
+
return a === "add_to_cart_checkout" ? m > 0 ? /* @__PURE__ */ f("button", { type: "button", onClick: X, disabled: !U, className: u.cta, children: r ? "Adding…" : `Add ${m} more product${m === 1 ? "" : "s"}` }) : /* @__PURE__ */ P("div", { className: `${u.ctaButtonGroup} ${Ue ? u.ctaButtonGroupAnimating : ""}`, children: [
|
|
1328
|
+
/* @__PURE__ */ f(
|
|
1318
1329
|
"button",
|
|
1319
1330
|
{
|
|
1320
1331
|
type: "button",
|
|
1321
|
-
onClick:
|
|
1322
|
-
disabled: !
|
|
1323
|
-
className: `${u.ctaDualLeft} ${
|
|
1324
|
-
children: /* @__PURE__ */
|
|
1332
|
+
onClick: X,
|
|
1333
|
+
disabled: !U,
|
|
1334
|
+
className: `${u.ctaDualLeft} ${Ue ? u.ctaDualLeftAnimating : ""}`,
|
|
1335
|
+
children: /* @__PURE__ */ f("span", { children: r ? "Adding…" : "Add to Basket" })
|
|
1325
1336
|
}
|
|
1326
1337
|
),
|
|
1327
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ f(
|
|
1328
1339
|
"button",
|
|
1329
1340
|
{
|
|
1330
1341
|
type: "button",
|
|
1331
|
-
onClick:
|
|
1332
|
-
disabled: !
|
|
1333
|
-
className: `${u.ctaDualRight} ${
|
|
1334
|
-
children: /* @__PURE__ */
|
|
1342
|
+
onClick: z,
|
|
1343
|
+
disabled: !U,
|
|
1344
|
+
className: `${u.ctaDualRight} ${Ue ? u.ctaDualRightAnimating : ""}`,
|
|
1345
|
+
children: /* @__PURE__ */ f("span", { children: r ? "Processing…" : "Checkout" })
|
|
1335
1346
|
}
|
|
1336
1347
|
)
|
|
1337
|
-
] }) : a === "checkout" ? /* @__PURE__ */
|
|
1348
|
+
] }) : a === "checkout" ? /* @__PURE__ */ f("button", { type: "button", onClick: z, disabled: !U, className: u.cta, children: r ? "Processing…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ f("button", { type: "button", onClick: X, disabled: !U, className: u.cta, children: r ? "Adding…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Add to Basket" });
|
|
1338
1349
|
})(),
|
|
1339
|
-
/* @__PURE__ */
|
|
1350
|
+
/* @__PURE__ */ P("div", { className: u.poweredBy, children: [
|
|
1340
1351
|
"powered by ",
|
|
1341
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ f("a", { href: "https://apps.shopify.com/best-bundles", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
|
|
1342
1353
|
] })
|
|
1343
1354
|
] })
|
|
1344
1355
|
] })
|
|
@@ -1346,30 +1357,30 @@ function hr(i) {
|
|
|
1346
1357
|
}
|
|
1347
1358
|
) : null;
|
|
1348
1359
|
}
|
|
1349
|
-
function
|
|
1350
|
-
if (
|
|
1351
|
-
return
|
|
1360
|
+
function Ge(o) {
|
|
1361
|
+
if (o != null && o.length)
|
|
1362
|
+
return o.reduce((e, t) => (t != null && t.key && (e[t.key] = t.value ?? ""), e), {});
|
|
1352
1363
|
}
|
|
1353
|
-
function
|
|
1354
|
-
const
|
|
1355
|
-
return
|
|
1364
|
+
function ht(o) {
|
|
1365
|
+
const e = /\/(\d+)$/.exec(o);
|
|
1366
|
+
return e ? e[1] : o;
|
|
1356
1367
|
}
|
|
1357
|
-
function
|
|
1358
|
-
var
|
|
1359
|
-
return ((
|
|
1368
|
+
function or() {
|
|
1369
|
+
var o;
|
|
1370
|
+
return ((o = window == null ? void 0 : window.routes) == null ? void 0 : o.cart_url) || "/cart";
|
|
1360
1371
|
}
|
|
1361
1372
|
async function ar() {
|
|
1362
1373
|
try {
|
|
1363
|
-
const
|
|
1364
|
-
if (!
|
|
1365
|
-
const
|
|
1366
|
-
if (!
|
|
1374
|
+
const o = or(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${o}?sections=${e}`, { method: "GET" });
|
|
1375
|
+
if (!t.ok) return;
|
|
1376
|
+
const i = await t.json().catch(() => null);
|
|
1377
|
+
if (!i) return;
|
|
1367
1378
|
const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
|
|
1368
1379
|
for (const s of r) {
|
|
1369
|
-
const p =
|
|
1380
|
+
const p = i[s];
|
|
1370
1381
|
if (!p) continue;
|
|
1371
|
-
const v = new DOMParser().parseFromString(p, "text/html"),
|
|
1372
|
-
|
|
1382
|
+
const v = new DOMParser().parseFromString(p, "text/html"), A = v.getElementById(s) || v.querySelector(s), R = document.getElementById(s) || document.querySelector(s);
|
|
1383
|
+
R && A && R.replaceWith(A);
|
|
1373
1384
|
}
|
|
1374
1385
|
const n = document.querySelector("cart-drawer");
|
|
1375
1386
|
if (n && typeof n.open == "function") {
|
|
@@ -1382,50 +1393,50 @@ async function ar() {
|
|
|
1382
1393
|
} catch {
|
|
1383
1394
|
}
|
|
1384
1395
|
}
|
|
1385
|
-
async function
|
|
1386
|
-
const
|
|
1396
|
+
async function Ee(o, e) {
|
|
1397
|
+
const t = await fetch(o, {
|
|
1387
1398
|
method: "POST",
|
|
1388
1399
|
headers: {
|
|
1389
1400
|
Accept: "application/json",
|
|
1390
1401
|
"Content-Type": "application/json"
|
|
1391
1402
|
},
|
|
1392
|
-
body: JSON.stringify(
|
|
1403
|
+
body: JSON.stringify(e)
|
|
1393
1404
|
});
|
|
1394
|
-
if (!
|
|
1395
|
-
const
|
|
1396
|
-
throw new Error(
|
|
1405
|
+
if (!t.ok) {
|
|
1406
|
+
const i = await t.text().catch(() => "");
|
|
1407
|
+
throw new Error(i || `Cart request failed: ${t.status}`);
|
|
1397
1408
|
}
|
|
1398
|
-
return
|
|
1409
|
+
return t.json().catch(() => null);
|
|
1399
1410
|
}
|
|
1400
1411
|
function fr() {
|
|
1401
1412
|
return {
|
|
1402
|
-
async linesAdd(
|
|
1403
|
-
const
|
|
1404
|
-
id:
|
|
1405
|
-
quantity:
|
|
1406
|
-
properties:
|
|
1413
|
+
async linesAdd(o) {
|
|
1414
|
+
const e = o.map((t) => ({
|
|
1415
|
+
id: ht(t.merchandiseId),
|
|
1416
|
+
quantity: t.quantity,
|
|
1417
|
+
properties: Ge(t.attributes)
|
|
1407
1418
|
}));
|
|
1408
|
-
await
|
|
1419
|
+
await Ee("/cart/add.js", { items: e });
|
|
1409
1420
|
},
|
|
1410
|
-
async linesAddForCheckout(
|
|
1411
|
-
const
|
|
1412
|
-
id:
|
|
1413
|
-
quantity:
|
|
1414
|
-
properties:
|
|
1421
|
+
async linesAddForCheckout(o) {
|
|
1422
|
+
const e = o.map((t) => ({
|
|
1423
|
+
id: ht(t.merchandiseId),
|
|
1424
|
+
quantity: t.quantity,
|
|
1425
|
+
properties: Ge(t.attributes)
|
|
1415
1426
|
}));
|
|
1416
|
-
await
|
|
1427
|
+
await Ee("/cart/add.js", { items: e });
|
|
1417
1428
|
},
|
|
1418
|
-
async linesUpdate(
|
|
1419
|
-
for (const
|
|
1420
|
-
await
|
|
1421
|
-
id:
|
|
1422
|
-
quantity:
|
|
1423
|
-
properties:
|
|
1429
|
+
async linesUpdate(o) {
|
|
1430
|
+
for (const e of o)
|
|
1431
|
+
await Ee("/cart/change.js", {
|
|
1432
|
+
id: e.id,
|
|
1433
|
+
quantity: e.quantity,
|
|
1434
|
+
properties: Ge(e.attributes)
|
|
1424
1435
|
});
|
|
1425
1436
|
},
|
|
1426
|
-
async linesRemove(
|
|
1427
|
-
for (const
|
|
1428
|
-
await
|
|
1437
|
+
async linesRemove(o) {
|
|
1438
|
+
for (const e of o)
|
|
1439
|
+
await Ee("/cart/change.js", { id: e, quantity: 0 });
|
|
1429
1440
|
},
|
|
1430
1441
|
openCartUI() {
|
|
1431
1442
|
window.setTimeout(() => {
|
|
@@ -1440,10 +1451,10 @@ function fr() {
|
|
|
1440
1451
|
export {
|
|
1441
1452
|
hr as BundleBuilderDrawer,
|
|
1442
1453
|
dr as BundleButton,
|
|
1443
|
-
|
|
1454
|
+
Fe as BundleLineAttributeKeys,
|
|
1444
1455
|
lr as BundleProvider,
|
|
1445
1456
|
fr as createLiquidCartAdapter,
|
|
1446
|
-
|
|
1457
|
+
Ye as useBundleBuilder,
|
|
1447
1458
|
ur as useBundleBuilderDrawer
|
|
1448
1459
|
};
|
|
1449
1460
|
//# sourceMappingURL=index.js.map
|