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