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