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