@best-bundles/bundle-ui 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/LiquidAdapter.d.ts.map +1 -1
- package/dist/index.js +252 -279
- package/dist/index.js.map +1 -1
- package/dist/liquid/bundle-ui.iife.js +12 -12
- package/dist/liquid/bundle-ui.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
2
|
import { jsx as f, jsxs as O, Fragment as vt } from "react/jsx-runtime";
|
|
3
|
-
import De, { useState as k, useRef as V, useEffect as
|
|
3
|
+
import De, { useState as k, useRef as V, useEffect as A, useCallback as le, useMemo as N, createContext as gt, useContext as xt, forwardRef as mt, createElement as Qe } from "react";
|
|
4
4
|
const Re = {
|
|
5
5
|
bundleId: "_bundle_id",
|
|
6
6
|
bundleConfig: "_bundle_config",
|
|
@@ -107,7 +107,7 @@ function It() {
|
|
|
107
107
|
function ut(i) {
|
|
108
108
|
return Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function hr(i) {
|
|
111
111
|
const {
|
|
112
112
|
apiBaseUrl: e,
|
|
113
113
|
shop: t,
|
|
@@ -115,34 +115,34 @@ function fr(i) {
|
|
|
115
115
|
configHandle: r = "default",
|
|
116
116
|
initialData: n,
|
|
117
117
|
configFetcher: u,
|
|
118
|
-
analyticsEndpoint:
|
|
119
|
-
children:
|
|
120
|
-
} = i,
|
|
118
|
+
analyticsEndpoint: c,
|
|
119
|
+
children: _
|
|
120
|
+
} = i, g = c ?? `${e}/api/public/bundle-analytics`, [D, E] = k(!1), [C, te] = k(!n), [q, X] = k(!1), [$, T] = k(null), [M, Q] = k((n == null ? void 0 : n.currencyCode) ?? null), [w, de] = k((n == null ? void 0 : n.config) ?? null), [ie, we] = k(
|
|
121
121
|
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
122
122
|
), [he, ze] = k(
|
|
123
123
|
() => ({ selections: {}, order: [] })
|
|
124
124
|
), je = V(null);
|
|
125
|
-
|
|
125
|
+
A(() => {
|
|
126
126
|
var U;
|
|
127
127
|
if (n) return;
|
|
128
128
|
(U = je.current) == null || U.abort();
|
|
129
129
|
const d = new AbortController();
|
|
130
130
|
je.current = d;
|
|
131
131
|
const x = u ?? Ct;
|
|
132
|
-
return te(!0), T(null), x({ apiBaseUrl: e, shop: t, signal: d.signal }).then((
|
|
133
|
-
if (!
|
|
134
|
-
T(
|
|
132
|
+
return te(!0), T(null), x({ apiBaseUrl: e, shop: t, signal: d.signal }).then((y) => {
|
|
133
|
+
if (!y.ok) {
|
|
134
|
+
T(y.error || "Failed to load bundle config."), de(null), we([]), Q(null);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
Q(
|
|
138
|
-
}).catch((
|
|
139
|
-
const J =
|
|
137
|
+
Q(y.currencyCode ?? null), de(y.config), we(y.eligibleVariants ?? []);
|
|
138
|
+
}).catch((y) => {
|
|
139
|
+
const J = y instanceof Error ? y.message : "Failed to load bundle config.";
|
|
140
140
|
T(J), de(null), we([]), Q(null);
|
|
141
141
|
}).finally(() => te(!1)), () => d.abort();
|
|
142
|
-
}, [e, t, n, u]),
|
|
143
|
-
const d = lt(
|
|
142
|
+
}, [e, t, n, u]), A(() => {
|
|
143
|
+
const d = lt(w == null ? void 0 : w.styleSettings);
|
|
144
144
|
d && ct(d);
|
|
145
|
-
}, [
|
|
145
|
+
}, [w == null ? void 0 : w.styleSettings]), A(() => {
|
|
146
146
|
if (typeof window > "u") return;
|
|
147
147
|
const d = () => {
|
|
148
148
|
const x = lt(void 0);
|
|
@@ -151,10 +151,10 @@ function fr(i) {
|
|
|
151
151
|
return window.addEventListener("bundle-preview-styles-updated", d), () => window.removeEventListener("bundle-preview-styles-updated", d);
|
|
152
152
|
}, []);
|
|
153
153
|
const ye = le(() => {
|
|
154
|
-
if (
|
|
154
|
+
if (E(!0), g)
|
|
155
155
|
try {
|
|
156
156
|
const d = Oe();
|
|
157
|
-
_e(
|
|
157
|
+
_e(g, t, {
|
|
158
158
|
eventType: "DRAWER_OPENED",
|
|
159
159
|
shop: t,
|
|
160
160
|
anonymousUserId: d,
|
|
@@ -166,11 +166,11 @@ function fr(i) {
|
|
|
166
166
|
} catch (d) {
|
|
167
167
|
console.warn("[Bundle Analytics] Error in open() callback:", d);
|
|
168
168
|
}
|
|
169
|
-
}, [
|
|
170
|
-
if (
|
|
169
|
+
}, [g, t]), ne = le(() => {
|
|
170
|
+
if (g)
|
|
171
171
|
try {
|
|
172
172
|
const d = Oe();
|
|
173
|
-
_e(
|
|
173
|
+
_e(g, t, {
|
|
174
174
|
eventType: "DRAWER_CLOSED",
|
|
175
175
|
shop: t,
|
|
176
176
|
anonymousUserId: d,
|
|
@@ -182,9 +182,9 @@ function fr(i) {
|
|
|
182
182
|
} catch (d) {
|
|
183
183
|
console.warn("[Bundle Analytics] Error in close() callback:", d);
|
|
184
184
|
}
|
|
185
|
-
|
|
186
|
-
}, [
|
|
187
|
-
|
|
185
|
+
E(!1), typeof window < "u" && window.location.hash === st && window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
186
|
+
}, [g, t]);
|
|
187
|
+
A(() => {
|
|
188
188
|
if (typeof window > "u") return;
|
|
189
189
|
const d = () => {
|
|
190
190
|
window.location.hash === st && ye();
|
|
@@ -192,13 +192,13 @@ function fr(i) {
|
|
|
192
192
|
return d(), window.addEventListener("hashchange", d), () => window.removeEventListener("hashchange", d);
|
|
193
193
|
}, [ye]);
|
|
194
194
|
const Me = le(() => {
|
|
195
|
-
|
|
195
|
+
E((d) => {
|
|
196
196
|
if (d)
|
|
197
197
|
ne();
|
|
198
|
-
else if (
|
|
198
|
+
else if (g)
|
|
199
199
|
try {
|
|
200
200
|
const x = Oe();
|
|
201
|
-
_e(
|
|
201
|
+
_e(g, t, {
|
|
202
202
|
eventType: "DRAWER_OPENED",
|
|
203
203
|
shop: t,
|
|
204
204
|
anonymousUserId: x,
|
|
@@ -212,68 +212,68 @@ function fr(i) {
|
|
|
212
212
|
}
|
|
213
213
|
return !d;
|
|
214
214
|
});
|
|
215
|
-
}, [
|
|
216
|
-
const d = Number((
|
|
215
|
+
}, [g, t, ne]), Pe = N(() => {
|
|
216
|
+
const d = Number((w == null ? void 0 : w.maxBundleSize) ?? NaN), x = Number.isFinite(d) ? Math.floor(d) : 100;
|
|
217
217
|
return Math.max(2, Math.min(100, x));
|
|
218
|
-
}, [
|
|
218
|
+
}, [w == null ? void 0 : w.maxBundleSize]), fe = N(() => new Set(
|
|
219
219
|
ie.filter((d) => d.availableForSale !== !1).map((d) => d.id)
|
|
220
220
|
), [ie]), L = N(() => {
|
|
221
|
-
const d = (
|
|
221
|
+
const d = (w == null ? void 0 : w.rules) ?? [], x = d.length ? Math.min(...d.map((U) => U.minBundleSize)) : 2;
|
|
222
222
|
return Number.isFinite(x) && x > 0 ? x : 2;
|
|
223
|
-
}, [
|
|
223
|
+
}, [w]), Se = le((d, x) => {
|
|
224
224
|
if (!fe.has(d))
|
|
225
225
|
return;
|
|
226
226
|
const U = ut(x);
|
|
227
|
-
ze((
|
|
228
|
-
const J =
|
|
229
|
-
let
|
|
230
|
-
if (
|
|
231
|
-
const { [d]:
|
|
232
|
-
|
|
233
|
-
} else J ===
|
|
234
|
-
let se =
|
|
227
|
+
ze((y) => {
|
|
228
|
+
const J = y.selections[d] ?? 0, W = U - J, ge = Object.values(y.selections).reduce((F, j) => F + (j || 0), 0), z = W > 0 ? Math.min(W, Math.max(0, Pe - ge)) : W, R = J + z;
|
|
229
|
+
let P;
|
|
230
|
+
if (R <= 0) {
|
|
231
|
+
const { [d]: F, ...j } = y.selections;
|
|
232
|
+
P = j;
|
|
233
|
+
} else J === R ? P = y.selections : P = { ...y.selections, [d]: R };
|
|
234
|
+
let se = y.order;
|
|
235
235
|
if (z > 0)
|
|
236
|
-
se = [...
|
|
236
|
+
se = [...y.order, ...Array.from({ length: z }, () => d)];
|
|
237
237
|
else if (z < 0) {
|
|
238
|
-
let
|
|
238
|
+
let F = -z;
|
|
239
239
|
const j = [];
|
|
240
|
-
for (let I =
|
|
241
|
-
const m =
|
|
242
|
-
if (m === d &&
|
|
243
|
-
|
|
240
|
+
for (let I = y.order.length - 1; I >= 0; I--) {
|
|
241
|
+
const m = y.order[I];
|
|
242
|
+
if (m === d && F > 0) {
|
|
243
|
+
F--;
|
|
244
244
|
continue;
|
|
245
245
|
}
|
|
246
246
|
j.push(m);
|
|
247
247
|
}
|
|
248
248
|
j.reverse(), se = j;
|
|
249
249
|
}
|
|
250
|
-
if (
|
|
251
|
-
const xe = ge, pe = Object.values(
|
|
252
|
-
if (
|
|
250
|
+
if (P === y.selections && se === y.order) return y;
|
|
251
|
+
const xe = ge, pe = Object.values(P).reduce((F, j) => F + (j || 0), 0);
|
|
252
|
+
if (g)
|
|
253
253
|
try {
|
|
254
|
-
const
|
|
254
|
+
const F = Oe(), j = {
|
|
255
255
|
eventType: "VARIANT_SELECTION_CHANGED",
|
|
256
256
|
shop: t,
|
|
257
|
-
anonymousUserId:
|
|
258
|
-
before: { ...
|
|
259
|
-
after: { ...
|
|
257
|
+
anonymousUserId: F,
|
|
258
|
+
before: { ...y.selections },
|
|
259
|
+
after: { ...P },
|
|
260
260
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
261
261
|
};
|
|
262
|
-
_e(
|
|
262
|
+
_e(g, t, j), xe === 0 && pe >= 1 && _e(g, t, {
|
|
263
263
|
...j,
|
|
264
264
|
mixpanelEvent: "bundle_started"
|
|
265
|
-
}), xe < L && pe >= L && _e(
|
|
265
|
+
}), xe < L && pe >= L && _e(g, t, {
|
|
266
266
|
...j,
|
|
267
267
|
mixpanelEvent: "bundle_completed"
|
|
268
268
|
});
|
|
269
269
|
} catch {
|
|
270
270
|
}
|
|
271
|
-
return { selections:
|
|
271
|
+
return { selections: P, order: se };
|
|
272
272
|
});
|
|
273
|
-
}, [Pe, L, fe,
|
|
273
|
+
}, [Pe, L, fe, g, t]), me = le(() => ze({ selections: {}, order: [] }), []), Z = he.selections, Ae = he.order, K = N(() => Object.values(Z).reduce((d, x) => d + (x || 0), 0), [Z]), ve = N(() => !(C || q || $ || !(w != null && w.isActive) || K < L), [K, w == null ? void 0 : w.isActive, $, C, L, q]), ae = le(async (d) => {
|
|
274
274
|
var j, I;
|
|
275
|
-
if (!ve || !
|
|
276
|
-
const x = It(), U = (
|
|
275
|
+
if (!ve || !w) return;
|
|
276
|
+
const x = It(), U = (w.title ?? "").trim().slice(0, 255), y = Object.entries(Z).map(([m, Y]) => ({ merchandiseId: m, quantity: ut(Y) })).filter((m) => m.quantity > 0).filter((m) => fe.has(m.merchandiseId)).map((m) => ({
|
|
277
277
|
merchandiseId: m.merchandiseId,
|
|
278
278
|
quantity: m.quantity,
|
|
279
279
|
attributes: [
|
|
@@ -283,7 +283,7 @@ function fr(i) {
|
|
|
283
283
|
...U ? [{ key: Re.bundleTitle, value: U }] : []
|
|
284
284
|
]
|
|
285
285
|
}));
|
|
286
|
-
if (!
|
|
286
|
+
if (!y.length) return;
|
|
287
287
|
const J = new Map(ie.map((m) => [m.id, m]));
|
|
288
288
|
let W = 0;
|
|
289
289
|
for (const [m, Y] of Object.entries(Z)) {
|
|
@@ -293,31 +293,31 @@ function fr(i) {
|
|
|
293
293
|
Number.isFinite(Ce) && (W += Ce * ce);
|
|
294
294
|
}
|
|
295
295
|
W = Math.round(W * 100) / 100;
|
|
296
|
-
const ge = [...
|
|
296
|
+
const ge = [...w.rules ?? []].sort((m, Y) => m.minBundleSize - Y.minBundleSize);
|
|
297
297
|
let z = null;
|
|
298
298
|
for (const m of ge)
|
|
299
299
|
K >= m.minBundleSize && (z = m);
|
|
300
|
-
const
|
|
300
|
+
const R = z ? (() => {
|
|
301
301
|
const m = Number.parseFloat(z.discountPercent);
|
|
302
302
|
return Number.isFinite(m) && m > 0 ? m : null;
|
|
303
|
-
})() : null,
|
|
303
|
+
})() : null, P = R ? Math.round(W * (1 - R / 100) * 100) / 100 : W, se = W - P, xe = y.map((m) => m.merchandiseId), pe = (z == null ? void 0 : z.handle) ?? "", F = ((j = z == null ? void 0 : z.label) == null ? void 0 : j.trim()) || "";
|
|
304
304
|
X(!0);
|
|
305
305
|
try {
|
|
306
|
-
if (d != null && d.checkout ? await o.linesAddForCheckout(
|
|
306
|
+
if (d != null && d.checkout ? await o.linesAddForCheckout(y) : await o.linesAdd(y), g)
|
|
307
307
|
try {
|
|
308
308
|
const m = Oe(), Y = !!(d != null && d.checkout);
|
|
309
|
-
_e(
|
|
309
|
+
_e(g, t, {
|
|
310
310
|
eventType: "BUNDLE_ADDED_TO_BASKET",
|
|
311
311
|
shop: t,
|
|
312
312
|
anonymousUserId: m,
|
|
313
313
|
bundleId: x,
|
|
314
314
|
productVariantIds: xe,
|
|
315
315
|
grossPrice: W,
|
|
316
|
-
discountedPrice:
|
|
317
|
-
currency:
|
|
316
|
+
discountedPrice: P,
|
|
317
|
+
currency: M ?? void 0,
|
|
318
318
|
discountThresholdIdentifier: pe,
|
|
319
|
-
discountLabel:
|
|
320
|
-
discountPercentage:
|
|
319
|
+
discountLabel: F,
|
|
320
|
+
discountPercentage: R,
|
|
321
321
|
discountedAmount: se,
|
|
322
322
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
323
323
|
checkout: Y,
|
|
@@ -334,14 +334,14 @@ function fr(i) {
|
|
|
334
334
|
o,
|
|
335
335
|
me,
|
|
336
336
|
ne,
|
|
337
|
-
|
|
337
|
+
w,
|
|
338
338
|
r,
|
|
339
|
-
|
|
339
|
+
M,
|
|
340
340
|
Z,
|
|
341
341
|
fe,
|
|
342
342
|
ie,
|
|
343
343
|
K,
|
|
344
|
-
|
|
344
|
+
g,
|
|
345
345
|
t
|
|
346
346
|
]), Ie = le(async () => {
|
|
347
347
|
await ae(
|
|
@@ -364,15 +364,15 @@ function fr(i) {
|
|
|
364
364
|
);
|
|
365
365
|
}, [ae, o]), Ee = N(
|
|
366
366
|
() => ({
|
|
367
|
-
isOpen:
|
|
367
|
+
isOpen: D,
|
|
368
368
|
open: ye,
|
|
369
369
|
close: ne,
|
|
370
370
|
toggle: Me,
|
|
371
371
|
loading: C,
|
|
372
372
|
submitting: q,
|
|
373
373
|
error: $,
|
|
374
|
-
currencyCode:
|
|
375
|
-
config:
|
|
374
|
+
currencyCode: M,
|
|
375
|
+
config: w,
|
|
376
376
|
eligibleVariants: ie,
|
|
377
377
|
selections: Z,
|
|
378
378
|
selectionOrder: Ae,
|
|
@@ -385,15 +385,15 @@ function fr(i) {
|
|
|
385
385
|
submitAndCheckout: re
|
|
386
386
|
}),
|
|
387
387
|
[
|
|
388
|
-
|
|
388
|
+
D,
|
|
389
389
|
ye,
|
|
390
390
|
ne,
|
|
391
391
|
Me,
|
|
392
392
|
C,
|
|
393
393
|
q,
|
|
394
394
|
$,
|
|
395
|
-
|
|
396
|
-
|
|
395
|
+
M,
|
|
396
|
+
w,
|
|
397
397
|
ie,
|
|
398
398
|
Z,
|
|
399
399
|
Ae,
|
|
@@ -406,7 +406,7 @@ function fr(i) {
|
|
|
406
406
|
re
|
|
407
407
|
]
|
|
408
408
|
);
|
|
409
|
-
return /* @__PURE__ */ f(pt.Provider, { value: Ee, children:
|
|
409
|
+
return /* @__PURE__ */ f(pt.Provider, { value: Ee, children: _ });
|
|
410
410
|
}
|
|
411
411
|
function Ye() {
|
|
412
412
|
const i = xt(pt);
|
|
@@ -414,14 +414,14 @@ function Ye() {
|
|
|
414
414
|
throw new Error("useBundleBuilder must be used within <BundleProvider />");
|
|
415
415
|
return i;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function fr() {
|
|
418
418
|
const { isOpen: i, open: e, close: t, toggle: o } = Ye();
|
|
419
419
|
return { isOpen: i, open: e, close: t, toggle: o };
|
|
420
420
|
}
|
|
421
421
|
const Bt = "_button_18rtl_1", Nt = {
|
|
422
422
|
button: Bt
|
|
423
423
|
};
|
|
424
|
-
function
|
|
424
|
+
function mr(i) {
|
|
425
425
|
const { toggle: e } = Ye();
|
|
426
426
|
return /* @__PURE__ */ f(
|
|
427
427
|
"button",
|
|
@@ -527,16 +527,16 @@ function Tt() {
|
|
|
527
527
|
return (e /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
|
|
528
528
|
},
|
|
529
529
|
easeInElastic: function(e, t, o, r) {
|
|
530
|
-
var n = o - t, u,
|
|
531
|
-
return
|
|
530
|
+
var n = o - t, u, c, _;
|
|
531
|
+
return _ = 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, _ = c / 4) : _ = c / (2 * Math.PI) * Math.asin(n / u), -(u * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - _) * (2 * Math.PI) / c)) + t);
|
|
532
532
|
},
|
|
533
533
|
easeOutElastic: function(e, t, o, r) {
|
|
534
|
-
var n = o - t, u,
|
|
535
|
-
return
|
|
534
|
+
var n = o - t, u, c, _;
|
|
535
|
+
return _ = 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, _ = c / 4) : _ = c / (2 * Math.PI) * Math.asin(n / u), u * Math.pow(2, -10 * e) * Math.sin((e * r - _) * (2 * Math.PI) / c) + n + t);
|
|
536
536
|
},
|
|
537
537
|
easeInOutElastic: function(e, t, o, r) {
|
|
538
|
-
var n = o - t, u,
|
|
539
|
-
return
|
|
538
|
+
var n = o - t, u, c, _;
|
|
539
|
+
return _ = 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, _ = c / 4) : _ = c / (2 * Math.PI) * Math.asin(n / u), e < 1 ? -0.5 * (u * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - _) * (2 * Math.PI) / c)) + t : u * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - _) * (2 * Math.PI) / c) * 0.5 + n + t);
|
|
540
540
|
},
|
|
541
541
|
easeInBack: function(e, t, o, r, n) {
|
|
542
542
|
var u = o - t;
|
|
@@ -587,14 +587,14 @@ const jt = 1e3 / 60;
|
|
|
587
587
|
class Mt {
|
|
588
588
|
constructor(e, t, o, r) {
|
|
589
589
|
this.getOptions = t;
|
|
590
|
-
const { colors: n, initialVelocityX: u, initialVelocityY:
|
|
591
|
-
this.context = e, this.x = o, 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
|
|
590
|
+
const { colors: n, initialVelocityX: u, initialVelocityY: c } = this.getOptions();
|
|
591
|
+
this.context = e, this.x = o, 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 = zt(0, 2), this.angle = kt(G(0, 360)), this.angularSpin = G(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = G(0, 1), this.rotationDirection = G(0, 1) ? ue.Positive : ue.Negative;
|
|
592
592
|
}
|
|
593
593
|
update(e) {
|
|
594
|
-
const { gravity: t, wind: o, friction: r, opacity: n, drawShape: u } = this.getOptions(),
|
|
595
|
-
this.x += this.vx *
|
|
596
|
-
const
|
|
597
|
-
if (this.rotateY +=
|
|
594
|
+
const { gravity: t, wind: o, friction: r, opacity: n, drawShape: u } = this.getOptions(), c = e / jt;
|
|
595
|
+
this.x += this.vx * c, this.y += this.vy * c, this.vy += t * c, this.vx += o * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection === ue.Positive ? this.rotationDirection = ue.Negative : this.rotateY <= -1 && this.rotationDirection === ue.Negative && (this.rotationDirection = ue.Positive);
|
|
596
|
+
const _ = 0.1 * this.rotationDirection * c;
|
|
597
|
+
if (this.rotateY += _, 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")
|
|
598
598
|
u.call(this, this.context);
|
|
599
599
|
else
|
|
600
600
|
switch (this.shape) {
|
|
@@ -622,23 +622,23 @@ class Pt {
|
|
|
622
622
|
const r = G(this.x, this.w + this.x), n = G(this.y, this.h + this.y);
|
|
623
623
|
return new Mt(this.context, this.getOptions, r, n);
|
|
624
624
|
}, this.animate = (r) => {
|
|
625
|
-
const { canvas: n, context: u, particlesGenerated:
|
|
626
|
-
if (!
|
|
625
|
+
const { canvas: n, context: u, particlesGenerated: c, lastNumberOfPieces: _ } = this, { run: g, recycle: D, numberOfPieces: E, debug: C, tweenFunction: te, tweenDuration: q } = this.getOptions();
|
|
626
|
+
if (!g)
|
|
627
627
|
return !1;
|
|
628
|
-
const X = this.particles.length, $ =
|
|
629
|
-
if ($ <
|
|
630
|
-
|
|
631
|
-
const T = te(this.tweenProgress, this.tweenFrom,
|
|
632
|
-
for (let Q = 0; Q <
|
|
628
|
+
const X = this.particles.length, $ = D ? X : c;
|
|
629
|
+
if ($ < E) {
|
|
630
|
+
_ !== E && (this.tweenProgress = 0, this.tweenFrom = $, this.lastNumberOfPieces = E), this.tweenProgress = Math.min(q, Math.max(0, this.tweenProgress + r));
|
|
631
|
+
const T = te(this.tweenProgress, this.tweenFrom, E, q), M = Math.round(T - $);
|
|
632
|
+
for (let Q = 0; Q < M; Q++)
|
|
633
633
|
this.particles.push(this.getParticle());
|
|
634
|
-
this.particlesGenerated +=
|
|
634
|
+
this.particlesGenerated += M;
|
|
635
635
|
}
|
|
636
636
|
C && (u.font = "12px sans-serif", u.fillStyle = "#333", u.textAlign = "right", u.fillText(`Particles: ${X}`, n.width - 10, n.height - 20));
|
|
637
637
|
for (let T = this.particles.length - 1; T >= 0; T--) {
|
|
638
|
-
const
|
|
639
|
-
|
|
638
|
+
const M = this.particles[T];
|
|
639
|
+
M.update(r), (M.y > n.height || M.y < -100 || M.x > n.width + 100 || M.x < -100) && (D && $ <= E ? this.particles[T] = this.getParticle() : this.removeParticleAt(T));
|
|
640
640
|
}
|
|
641
|
-
return X > 0 || $ <
|
|
641
|
+
return X > 0 || $ < E;
|
|
642
642
|
}, this.canvas = e;
|
|
643
643
|
const o = this.canvas.getContext("2d");
|
|
644
644
|
if (!o)
|
|
@@ -698,12 +698,12 @@ class At {
|
|
|
698
698
|
...r
|
|
699
699
|
}, Object.assign(this, r.confettiSource);
|
|
700
700
|
}, this.update = (r = 0) => {
|
|
701
|
-
const { options: { run: n, onConfettiComplete: u, frameRate:
|
|
702
|
-
if (
|
|
701
|
+
const { options: { run: n, onConfettiComplete: u, frameRate: c }, canvas: _, context: g } = this, D = Math.min(r - this.lastFrameTime, 50);
|
|
702
|
+
if (c && D < 1e3 / c) {
|
|
703
703
|
this.rafId = requestAnimationFrame(this.update);
|
|
704
704
|
return;
|
|
705
705
|
}
|
|
706
|
-
this.lastFrameTime = r - (
|
|
706
|
+
this.lastFrameTime = r - (c ? D % c : 0), n && (g.fillStyle = "white", g.clearRect(0, 0, _.width, _.height)), this.generator.animate(D) ? this.rafId = requestAnimationFrame(this.update) : (u && typeof u == "function" && this.generator.particlesGenerated > 0 && u.call(this, this), this._options.run = !1);
|
|
707
707
|
}, this.reset = () => {
|
|
708
708
|
this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
|
|
709
709
|
}, this.stop = () => {
|
|
@@ -768,8 +768,8 @@ function Ve(i) {
|
|
|
768
768
|
"frameRate"
|
|
769
769
|
], n = ["canvasRef"];
|
|
770
770
|
for (const u in i) {
|
|
771
|
-
const
|
|
772
|
-
r.includes(u) ? e[u] =
|
|
771
|
+
const c = i[u];
|
|
772
|
+
r.includes(u) ? e[u] = c : n.includes(u) ? n[u] = c : o[u] = c;
|
|
773
773
|
}
|
|
774
774
|
return [e, o, t];
|
|
775
775
|
}
|
|
@@ -823,22 +823,22 @@ const $t = mt(
|
|
|
823
823
|
className: r = "",
|
|
824
824
|
children: n,
|
|
825
825
|
iconNode: u,
|
|
826
|
-
...
|
|
827
|
-
},
|
|
826
|
+
...c
|
|
827
|
+
}, _) => Qe(
|
|
828
828
|
"svg",
|
|
829
829
|
{
|
|
830
|
-
ref:
|
|
830
|
+
ref: _,
|
|
831
831
|
...qt,
|
|
832
832
|
width: e,
|
|
833
833
|
height: e,
|
|
834
834
|
stroke: i,
|
|
835
835
|
strokeWidth: o ? Number(t) * 24 / Number(e) : t,
|
|
836
836
|
className: bt("lucide", r),
|
|
837
|
-
...!n && !Lt(
|
|
838
|
-
...
|
|
837
|
+
...!n && !Lt(c) && { "aria-hidden": "true" },
|
|
838
|
+
...c
|
|
839
839
|
},
|
|
840
840
|
[
|
|
841
|
-
...u.map(([
|
|
841
|
+
...u.map(([g, D]) => Qe(g, D)),
|
|
842
842
|
...Array.isArray(n) ? n : [n]
|
|
843
843
|
]
|
|
844
844
|
)
|
|
@@ -945,7 +945,7 @@ const Wt = [
|
|
|
945
945
|
ctaTotalsStrike: sr,
|
|
946
946
|
ctaTotalsPrice: cr
|
|
947
947
|
};
|
|
948
|
-
function
|
|
948
|
+
function pr(i) {
|
|
949
949
|
var ot, it;
|
|
950
950
|
const {
|
|
951
951
|
isOpen: e,
|
|
@@ -954,17 +954,17 @@ function br(i) {
|
|
|
954
954
|
submitting: r,
|
|
955
955
|
error: n,
|
|
956
956
|
currencyCode: u,
|
|
957
|
-
config:
|
|
958
|
-
eligibleVariants:
|
|
959
|
-
selections:
|
|
960
|
-
selectionOrder:
|
|
961
|
-
setQuantity:
|
|
957
|
+
config: c,
|
|
958
|
+
eligibleVariants: _,
|
|
959
|
+
selections: g,
|
|
960
|
+
selectionOrder: D,
|
|
961
|
+
setQuantity: E,
|
|
962
962
|
bundleSize: C,
|
|
963
963
|
minRequired: te,
|
|
964
964
|
canSubmit: q,
|
|
965
965
|
submit: X,
|
|
966
966
|
submitAndCheckout: $
|
|
967
|
-
} = Ye(), [T,
|
|
967
|
+
} = Ye(), [T, M] = k(!1), [Q, w] = k(""), de = V(null), ie = V(null), we = V(null), [he, ze] = k(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [je, ye] = k(0), [ne, Me] = k(null), [Pe, fe] = k(!1), L = V(null), Se = V(C), me = 7e3, [Z, Ae] = k(0), [K, ve] = k(null), [ae, Ie] = k(!1), re = V(null), Ee = 2800, d = [
|
|
968
968
|
"#2563eb",
|
|
969
969
|
"#3b82f6",
|
|
970
970
|
"#60a5fa",
|
|
@@ -972,56 +972,56 @@ function br(i) {
|
|
|
972
972
|
"#bae6fd",
|
|
973
973
|
"#e0f2fe"
|
|
974
974
|
], x = N(() => {
|
|
975
|
-
var
|
|
976
|
-
const a = (
|
|
975
|
+
var s;
|
|
976
|
+
const a = (s = c == null ? void 0 : c.styleSettings) == null ? void 0 : s.confettiColors;
|
|
977
977
|
return Array.isArray(a) && a.length >= 6 ? a.slice(0, 6).map(
|
|
978
|
-
(h,
|
|
978
|
+
(h, b) => typeof h == "string" && h.trim() ? h : d[b]
|
|
979
979
|
) : [...d];
|
|
980
|
-
}, [(ot =
|
|
981
|
-
const
|
|
982
|
-
return Number.isFinite(
|
|
983
|
-
},
|
|
984
|
-
const
|
|
985
|
-
var S,
|
|
986
|
-
const
|
|
987
|
-
return !(!
|
|
980
|
+
}, [(ot = c == null ? void 0 : c.styleSettings) == null ? void 0 : ot.confettiColors]), U = (a) => {
|
|
981
|
+
const s = Number.parseFloat(a);
|
|
982
|
+
return Number.isFinite(s) ? String(Math.round(s)) : a;
|
|
983
|
+
}, y = (a) => {
|
|
984
|
+
const s = (a ?? []).filter((h) => {
|
|
985
|
+
var S, v;
|
|
986
|
+
const b = (S = h == null ? void 0 : h.name) == null ? void 0 : S.trim(), p = (v = h == null ? void 0 : h.value) == null ? void 0 : v.trim();
|
|
987
|
+
return !(!b || !p || b.toLowerCase() === "title");
|
|
988
988
|
});
|
|
989
|
-
return
|
|
989
|
+
return s.length ? s.map((h) => `${h.name}: ${h.value}`).join(" · ") : null;
|
|
990
990
|
}, J = (a) => {
|
|
991
|
-
var
|
|
992
|
-
return ((
|
|
991
|
+
var s;
|
|
992
|
+
return ((s = a.product) == null ? void 0 : s.title) ?? a.displayName ?? a.title;
|
|
993
993
|
}, W = (a) => {
|
|
994
|
-
const
|
|
995
|
-
return [
|
|
996
|
-
}, [ge, z] = k(e),
|
|
997
|
-
const
|
|
998
|
-
if (!Number.isFinite(
|
|
994
|
+
const s = J(a), h = y(a.selectedOptions);
|
|
995
|
+
return [s, h].filter(Boolean).join(" — ");
|
|
996
|
+
}, [ge, z] = k(e), R = V(null), P = (a) => {
|
|
997
|
+
const s = Number(a);
|
|
998
|
+
if (!Number.isFinite(s)) return a;
|
|
999
999
|
if (u)
|
|
1000
1000
|
try {
|
|
1001
|
-
return new Intl.NumberFormat(void 0, { style: "currency", currency: u }).format(
|
|
1001
|
+
return new Intl.NumberFormat(void 0, { style: "currency", currency: u }).format(s);
|
|
1002
1002
|
} catch {
|
|
1003
1003
|
}
|
|
1004
|
-
return `$${
|
|
1005
|
-
}, se = ((it =
|
|
1006
|
-
const a = Number((
|
|
1007
|
-
return Math.max(2, Math.min(100,
|
|
1008
|
-
}, [
|
|
1004
|
+
return `$${s.toFixed(2)}`;
|
|
1005
|
+
}, se = ((it = c == null ? void 0 : c.title) == null ? void 0 : it.trim()) || "Build your bundle", xe = N(() => {
|
|
1006
|
+
const a = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(a) ? Math.floor(a) : 100;
|
|
1007
|
+
return Math.max(2, Math.min(100, s));
|
|
1008
|
+
}, [c == null ? void 0 : c.maxBundleSize]), pe = C >= xe, F = N(() => [..._].sort((a, s) => a.displayName.localeCompare(s.displayName)), [_]), j = N(() => {
|
|
1009
1009
|
const a = Q.trim().toLowerCase();
|
|
1010
|
-
if (!a) return
|
|
1011
|
-
const
|
|
1012
|
-
var
|
|
1010
|
+
if (!a) return F;
|
|
1011
|
+
const s = a.split(/\s+/).filter(Boolean), h = (b) => {
|
|
1012
|
+
var v;
|
|
1013
1013
|
const p = [];
|
|
1014
|
-
p.push(
|
|
1015
|
-
for (const B of
|
|
1014
|
+
p.push(b.displayName), (v = b.product) != null && v.title && p.push(b.product.title);
|
|
1015
|
+
for (const B of b.selectedOptions ?? [])
|
|
1016
1016
|
p.push(B.name), p.push(B.value);
|
|
1017
1017
|
const S = p.join(" ").toLowerCase();
|
|
1018
|
-
return
|
|
1018
|
+
return s.every((B) => S.includes(B));
|
|
1019
1019
|
};
|
|
1020
|
-
return
|
|
1021
|
-
}, [Q,
|
|
1020
|
+
return F.filter(h);
|
|
1021
|
+
}, [Q, F]), I = N(() => [...(c == null ? void 0 : c.rules) ?? []].sort((a, s) => a.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), m = N(() => Math.max(0, te - C), [C, te]), Y = N(() => {
|
|
1022
1022
|
let a = null;
|
|
1023
|
-
for (const
|
|
1024
|
-
C >=
|
|
1023
|
+
for (const s of I)
|
|
1024
|
+
C >= s.minBundleSize && (a = s);
|
|
1025
1025
|
return a;
|
|
1026
1026
|
}, [C, I]), ce = N(() => {
|
|
1027
1027
|
if (!Y) return null;
|
|
@@ -1030,126 +1030,126 @@ function br(i) {
|
|
|
1030
1030
|
}, [Y]), Be = N(() => {
|
|
1031
1031
|
const a = I[0];
|
|
1032
1032
|
if (!a) return null;
|
|
1033
|
-
const
|
|
1034
|
-
return !Number.isFinite(
|
|
1033
|
+
const s = Number.parseFloat(a.discountPercent);
|
|
1034
|
+
return !Number.isFinite(s) || s <= 0 ? null : s;
|
|
1035
1035
|
}, [I]), Ce = ce ?? Be, Ne = N(() => {
|
|
1036
|
-
const a = new Map(
|
|
1037
|
-
let
|
|
1038
|
-
for (const [h,
|
|
1039
|
-
const p =
|
|
1036
|
+
const a = new Map(_.map((h) => [h.id, h]));
|
|
1037
|
+
let s = 0;
|
|
1038
|
+
for (const [h, b] of Object.entries(g)) {
|
|
1039
|
+
const p = b ?? 0;
|
|
1040
1040
|
if (p <= 0) continue;
|
|
1041
|
-
const S = a.get(h),
|
|
1042
|
-
Number.isFinite(
|
|
1041
|
+
const S = a.get(h), v = Number(S == null ? void 0 : S.price);
|
|
1042
|
+
Number.isFinite(v) && (s += v * p);
|
|
1043
1043
|
}
|
|
1044
|
-
return Math.round(
|
|
1045
|
-
}, [
|
|
1044
|
+
return Math.round(s * 100) / 100;
|
|
1045
|
+
}, [_, g]), _t = N(() => {
|
|
1046
1046
|
if (!ce) return Ne;
|
|
1047
1047
|
const a = Ne * (1 - ce / 100);
|
|
1048
1048
|
return Math.round(a * 100) / 100;
|
|
1049
1049
|
}, [ce, Ne]), Xe = N(() => I.length ? Math.max(...I.map((a) => a.minBundleSize)) : 0, [I]), Le = N(() => {
|
|
1050
|
-
const a = new Map(
|
|
1051
|
-
return
|
|
1052
|
-
}, [
|
|
1053
|
-
var
|
|
1050
|
+
const a = new Map(_.map((s) => [s.id, s]));
|
|
1051
|
+
return D.map((s) => a.get(s)).filter((s) => !!s);
|
|
1052
|
+
}, [_, D]), wt = N(() => {
|
|
1053
|
+
var s;
|
|
1054
1054
|
const a = /* @__PURE__ */ new Map();
|
|
1055
1055
|
for (const h of I) {
|
|
1056
|
-
const
|
|
1057
|
-
a.set(
|
|
1056
|
+
const b = Math.max(0, h.minBundleSize - 1);
|
|
1057
|
+
a.set(b, {
|
|
1058
1058
|
discountPercent: h.discountPercent,
|
|
1059
1059
|
minBundleSize: h.minBundleSize,
|
|
1060
|
-
label: ((
|
|
1060
|
+
label: ((s = h.label) == null ? void 0 : s.trim()) || `Buy ${h.minBundleSize}+`
|
|
1061
1061
|
});
|
|
1062
1062
|
}
|
|
1063
1063
|
return a;
|
|
1064
1064
|
}, [I]), yt = N(() => Math.max(Xe || te, Le.length), [Le.length, Xe, te]), [qe, Ze] = k(!0), Je = V(m);
|
|
1065
|
-
|
|
1066
|
-
if (((
|
|
1067
|
-
const
|
|
1068
|
-
Ze(!(
|
|
1065
|
+
A(() => {
|
|
1066
|
+
if (((c == null ? void 0 : c.ctaButtonMode) || "add_to_cart") === "add_to_cart_checkout") {
|
|
1067
|
+
const s = Je.current > 0;
|
|
1068
|
+
Ze(!(s && m === 0));
|
|
1069
1069
|
}
|
|
1070
1070
|
Je.current = m;
|
|
1071
|
-
}, [m,
|
|
1071
|
+
}, [m, c == null ? void 0 : c.ctaButtonMode]);
|
|
1072
1072
|
const $e = V(null), et = V(null), tt = V(null), nt = V(C), rt = (a) => {
|
|
1073
|
-
const
|
|
1074
|
-
if (!
|
|
1075
|
-
const h =
|
|
1073
|
+
const s = et.current;
|
|
1074
|
+
if (!s) return;
|
|
1075
|
+
const h = s.querySelector(`[data-variant-row="${a}"]`);
|
|
1076
1076
|
if (!h) return;
|
|
1077
|
-
const
|
|
1078
|
-
if (p.top >=
|
|
1079
|
-
const B = Math.max(0,
|
|
1080
|
-
|
|
1077
|
+
const b = s.getBoundingClientRect(), p = h.getBoundingClientRect(), S = 8;
|
|
1078
|
+
if (p.top >= b.top + S && p.bottom <= b.bottom - S) return;
|
|
1079
|
+
const B = Math.max(0, s.scrollHeight - s.clientHeight), H = p.top - b.top + p.height / 2, ee = s.scrollTop + H - s.clientHeight / 2, oe = Math.min(B, Math.max(0, ee));
|
|
1080
|
+
s.scrollTo({ top: oe, behavior: "smooth" });
|
|
1081
1081
|
};
|
|
1082
|
-
return
|
|
1082
|
+
return A(() => {
|
|
1083
1083
|
if (!e) return;
|
|
1084
|
-
const a = (
|
|
1085
|
-
|
|
1084
|
+
const a = (s) => {
|
|
1085
|
+
s.key === "Escape" && t();
|
|
1086
1086
|
};
|
|
1087
1087
|
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
1088
|
-
}, [t, e]),
|
|
1088
|
+
}, [t, e]), A(() => {
|
|
1089
1089
|
if (typeof window > "u") return;
|
|
1090
1090
|
const a = () => ze({ width: window.innerWidth, height: window.innerHeight });
|
|
1091
1091
|
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
1092
|
-
}, []),
|
|
1093
|
-
if (
|
|
1092
|
+
}, []), A(() => {
|
|
1093
|
+
if (R.current != null && (window.clearTimeout(R.current), R.current = null), e) {
|
|
1094
1094
|
z(!0);
|
|
1095
1095
|
return;
|
|
1096
1096
|
}
|
|
1097
|
-
|
|
1098
|
-
z(!1),
|
|
1097
|
+
R.current = window.setTimeout(() => {
|
|
1098
|
+
z(!1), R.current = null;
|
|
1099
1099
|
}, 220);
|
|
1100
|
-
}, [e]),
|
|
1101
|
-
|
|
1102
|
-
}, []),
|
|
1100
|
+
}, [e]), A(() => () => {
|
|
1101
|
+
R.current != null && window.clearTimeout(R.current);
|
|
1102
|
+
}, []), A(() => () => {
|
|
1103
1103
|
L.current != null && window.clearTimeout(L.current);
|
|
1104
|
-
}, []),
|
|
1104
|
+
}, []), A(() => () => {
|
|
1105
1105
|
re.current != null && window.clearTimeout(re.current);
|
|
1106
|
-
}, []),
|
|
1106
|
+
}, []), A(() => {
|
|
1107
1107
|
if (!e || !T) return;
|
|
1108
1108
|
const a = requestAnimationFrame(() => {
|
|
1109
|
-
var
|
|
1110
|
-
return (
|
|
1109
|
+
var s;
|
|
1110
|
+
return (s = de.current) == null ? void 0 : s.focus();
|
|
1111
1111
|
});
|
|
1112
1112
|
return () => cancelAnimationFrame(a);
|
|
1113
|
-
}, [e, T]),
|
|
1113
|
+
}, [e, T]), A(() => {
|
|
1114
1114
|
const a = nt.current;
|
|
1115
1115
|
if (nt.current = C, C <= a) return;
|
|
1116
|
-
const
|
|
1117
|
-
if (!
|
|
1118
|
-
const h = I.some((
|
|
1116
|
+
const s = tt.current;
|
|
1117
|
+
if (!s) return;
|
|
1118
|
+
const h = I.some((v) => v.minBundleSize === C), b = I.find((v) => v.minBundleSize > C), p = b && h ? b.minBundleSize - 1 : b ? null : C - 1;
|
|
1119
1119
|
if (p == null || p < 0) return;
|
|
1120
1120
|
const S = requestAnimationFrame(() => {
|
|
1121
|
-
const
|
|
1122
|
-
if (!
|
|
1123
|
-
const B =
|
|
1121
|
+
const v = s.querySelector(`[data-box-slot="${p}"]`);
|
|
1122
|
+
if (!v) return;
|
|
1123
|
+
const B = s.getBoundingClientRect(), ee = v.getBoundingClientRect().right - B.right;
|
|
1124
1124
|
if (ee <= 1) return;
|
|
1125
|
-
const oe = Math.max(0,
|
|
1126
|
-
|
|
1125
|
+
const oe = Math.max(0, s.scrollWidth - s.clientWidth), be = Math.min(oe, Math.max(0, s.scrollLeft + ee));
|
|
1126
|
+
s.scrollTo({ left: be, behavior: "smooth" });
|
|
1127
1127
|
});
|
|
1128
1128
|
return () => cancelAnimationFrame(S);
|
|
1129
|
-
}, [C, I]),
|
|
1129
|
+
}, [C, I]), A(() => {
|
|
1130
1130
|
if (!e) return;
|
|
1131
1131
|
const a = Se.current;
|
|
1132
1132
|
if (Se.current = C, C <= a) return;
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1133
|
+
const s = I.find((h) => h.minBundleSize === C);
|
|
1134
|
+
s && (ve(`You received a ${U(s.discountPercent)}% discount!`), Ae((h) => h + 1), Ie(!0), re.current != null && window.clearTimeout(re.current), re.current = window.setTimeout(() => {
|
|
1135
1135
|
Ie(!1), re.current = null;
|
|
1136
1136
|
}, Ee));
|
|
1137
|
-
}, [C, e, I]),
|
|
1137
|
+
}, [C, e, I]), A(() => {
|
|
1138
1138
|
if (!e || !ae || !K) return;
|
|
1139
1139
|
const a = requestAnimationFrame(() => {
|
|
1140
1140
|
var B;
|
|
1141
|
-
const
|
|
1141
|
+
const s = we.current, h = s == null ? void 0 : s.getBoundingClientRect(), b = (B = $e.current) == null ? void 0 : B.getBoundingClientRect(), p = h ? h.left + h.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, S = h ? h.top + h.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, v = {
|
|
1142
1142
|
x: p - 2,
|
|
1143
1143
|
y: S - 2,
|
|
1144
1144
|
w: 4,
|
|
1145
1145
|
h: 4
|
|
1146
1146
|
};
|
|
1147
|
-
Me(
|
|
1147
|
+
Me(v), ye((H) => H + 1), fe(!0), L.current != null && window.clearTimeout(L.current), L.current = window.setTimeout(() => {
|
|
1148
1148
|
fe(!1), L.current = null;
|
|
1149
1149
|
}, me);
|
|
1150
1150
|
});
|
|
1151
1151
|
return () => cancelAnimationFrame(a);
|
|
1152
|
-
}, [Z, K, me, ae, e]),
|
|
1152
|
+
}, [Z, K, me, ae, e]), A(() => {
|
|
1153
1153
|
var a;
|
|
1154
1154
|
e && ((a = $e.current) == null || a.focus());
|
|
1155
1155
|
}, [e]), ge ? /* @__PURE__ */ O(
|
|
@@ -1191,7 +1191,7 @@ function br(i) {
|
|
|
1191
1191
|
"aria-label": T ? "Search (expanded)" : "Search",
|
|
1192
1192
|
"aria-expanded": T,
|
|
1193
1193
|
onClick: () => {
|
|
1194
|
-
|
|
1194
|
+
M(!0);
|
|
1195
1195
|
},
|
|
1196
1196
|
children: /* @__PURE__ */ f(Vt, { size: 18, "aria-hidden": "true" })
|
|
1197
1197
|
}
|
|
@@ -1207,9 +1207,9 @@ function br(i) {
|
|
|
1207
1207
|
type: "search",
|
|
1208
1208
|
value: Q,
|
|
1209
1209
|
placeholder: "Search",
|
|
1210
|
-
onChange: (a) =>
|
|
1210
|
+
onChange: (a) => w(a.target.value),
|
|
1211
1211
|
onBlur: () => {
|
|
1212
|
-
Q.trim() === "" &&
|
|
1212
|
+
Q.trim() === "" && M(!1);
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
1215
|
),
|
|
@@ -1223,7 +1223,7 @@ function br(i) {
|
|
|
1223
1223
|
},
|
|
1224
1224
|
onClick: () => {
|
|
1225
1225
|
var a;
|
|
1226
|
-
|
|
1226
|
+
w(""), (a = de.current) == null || a.focus();
|
|
1227
1227
|
},
|
|
1228
1228
|
"aria-label": "Clear search",
|
|
1229
1229
|
children: "Clear"
|
|
@@ -1236,10 +1236,10 @@ function br(i) {
|
|
|
1236
1236
|
/* @__PURE__ */ O("div", { className: l.body, ref: et, children: [
|
|
1237
1237
|
o ? /* @__PURE__ */ f("p", { className: l.muted, children: "Loading…" }) : null,
|
|
1238
1238
|
n ? /* @__PURE__ */ f("p", { className: l.error, children: n }) : null,
|
|
1239
|
-
!o &&
|
|
1239
|
+
!o && c && !c.isActive ? /* @__PURE__ */ f("p", { className: l.error, children: "Bundles are not active." }) : null,
|
|
1240
1240
|
/* @__PURE__ */ f("div", { className: l.variants, children: /* @__PURE__ */ f("ul", { className: l.variantList, children: j.map((a) => {
|
|
1241
1241
|
var ee, oe, be, Te;
|
|
1242
|
-
const
|
|
1242
|
+
const s = g[a.id] ?? 0, h = J(a), b = y(a.selectedOptions), p = W(a), S = Ce, v = Number(a.price), B = S != null && Number.isFinite(S) && S > 0 && Number.isFinite(v), H = B ? Math.round(v * (1 - S / 100) * 100) / 100 : null;
|
|
1243
1243
|
return /* @__PURE__ */ O(
|
|
1244
1244
|
"li",
|
|
1245
1245
|
{
|
|
@@ -1258,11 +1258,11 @@ function br(i) {
|
|
|
1258
1258
|
) : /* @__PURE__ */ f("div", { className: l.variantThumbFallback, children: ((Te = (be = (oe = a.product) == null ? void 0 : oe.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) }),
|
|
1259
1259
|
/* @__PURE__ */ O("div", { className: l.variantInfo, children: [
|
|
1260
1260
|
/* @__PURE__ */ f("div", { className: l.variantName, children: h }),
|
|
1261
|
-
|
|
1261
|
+
b ? /* @__PURE__ */ f("div", { className: l.variantMeta, children: b }) : null,
|
|
1262
1262
|
/* @__PURE__ */ O("div", { className: l.variantPriceRow, children: [
|
|
1263
|
-
B ? /* @__PURE__ */ f("span", { className: l.variantCompareAt, children:
|
|
1264
|
-
/* @__PURE__ */ f("span", { className: l.variantPrice, children:
|
|
1265
|
-
H != null ? H.toFixed(2) : Number.isFinite(
|
|
1263
|
+
B ? /* @__PURE__ */ f("span", { className: l.variantCompareAt, children: P(Number.isFinite(v) ? v.toFixed(2) : a.price) }) : null,
|
|
1264
|
+
/* @__PURE__ */ f("span", { className: l.variantPrice, children: P(
|
|
1265
|
+
H != null ? H.toFixed(2) : Number.isFinite(v) ? v.toFixed(2) : a.price
|
|
1266
1266
|
) })
|
|
1267
1267
|
] })
|
|
1268
1268
|
] })
|
|
@@ -1271,11 +1271,11 @@ function br(i) {
|
|
|
1271
1271
|
"Sold",
|
|
1272
1272
|
/* @__PURE__ */ f("br", {}),
|
|
1273
1273
|
"Out"
|
|
1274
|
-
] }) }) :
|
|
1274
|
+
] }) }) : s <= 0 ? /* @__PURE__ */ f(
|
|
1275
1275
|
"button",
|
|
1276
1276
|
{
|
|
1277
1277
|
type: "button",
|
|
1278
|
-
onClick: () =>
|
|
1278
|
+
onClick: () => E(a.id, 1),
|
|
1279
1279
|
disabled: r || pe,
|
|
1280
1280
|
className: l.addToBundleButton,
|
|
1281
1281
|
"aria-label": `Add ${p} to bundle`,
|
|
@@ -1286,19 +1286,19 @@ function br(i) {
|
|
|
1286
1286
|
"button",
|
|
1287
1287
|
{
|
|
1288
1288
|
type: "button",
|
|
1289
|
-
onClick: () =>
|
|
1290
|
-
disabled: r ||
|
|
1289
|
+
onClick: () => E(a.id, s - 1),
|
|
1290
|
+
disabled: r || s <= 0,
|
|
1291
1291
|
className: l.qtyButton,
|
|
1292
1292
|
"aria-label": `Decrease ${p}`,
|
|
1293
1293
|
children: "−"
|
|
1294
1294
|
}
|
|
1295
1295
|
),
|
|
1296
|
-
/* @__PURE__ */ f("span", { className: l.qtyValue, "aria-label": `Quantity ${
|
|
1296
|
+
/* @__PURE__ */ f("span", { className: l.qtyValue, "aria-label": `Quantity ${s}`, children: s }),
|
|
1297
1297
|
/* @__PURE__ */ f(
|
|
1298
1298
|
"button",
|
|
1299
1299
|
{
|
|
1300
1300
|
type: "button",
|
|
1301
|
-
onClick: () =>
|
|
1301
|
+
onClick: () => E(a.id, s + 1),
|
|
1302
1302
|
disabled: r || pe,
|
|
1303
1303
|
className: l.qtyButton,
|
|
1304
1304
|
"aria-label": `Increase ${p}`,
|
|
@@ -1313,10 +1313,10 @@ function br(i) {
|
|
|
1313
1313
|
}) }) })
|
|
1314
1314
|
] }),
|
|
1315
1315
|
/* @__PURE__ */ O("footer", { className: l.footer, ref: ie, children: [
|
|
1316
|
-
/* @__PURE__ */ f("div", { className: l.boxSummaryWindow, ref: tt, children: /* @__PURE__ */ f("div", { className: l.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: yt }).map((a,
|
|
1316
|
+
/* @__PURE__ */ f("div", { className: l.boxSummaryWindow, ref: tt, children: /* @__PURE__ */ f("div", { className: l.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: yt }).map((a, s) => {
|
|
1317
1317
|
var ee, oe, be, Te;
|
|
1318
|
-
const h = Le[
|
|
1319
|
-
return /* @__PURE__ */ O("div", { "data-box-slot":
|
|
1318
|
+
const h = Le[s], b = wt.get(s), p = !!h, S = !!b, v = S && !p, B = b ? `${b.discountPercent}% off` : null, H = p ? h.displayName : `Slot ${s + 1}`;
|
|
1319
|
+
return /* @__PURE__ */ O("div", { "data-box-slot": s, className: l.boxSlot, children: [
|
|
1320
1320
|
/* @__PURE__ */ f(
|
|
1321
1321
|
"div",
|
|
1322
1322
|
{
|
|
@@ -1332,8 +1332,8 @@ function br(i) {
|
|
|
1332
1332
|
onKeyDown: p ? (Ue) => {
|
|
1333
1333
|
(Ue.key === "Enter" || Ue.key === " ") && (Ue.preventDefault(), rt(h.id));
|
|
1334
1334
|
} : void 0,
|
|
1335
|
-
"aria-label":
|
|
1336
|
-
title:
|
|
1335
|
+
"aria-label": v && B ? `${H}. Unlocks ${B}.` : H,
|
|
1336
|
+
title: v && B ? `${H} • Unlocks ${B}` : H,
|
|
1337
1337
|
children: p ? (ee = h.image) != null && ee.url ? /* @__PURE__ */ f(
|
|
1338
1338
|
"img",
|
|
1339
1339
|
{
|
|
@@ -1342,11 +1342,11 @@ function br(i) {
|
|
|
1342
1342
|
alt: h.image.altText ?? h.displayName,
|
|
1343
1343
|
loading: "lazy"
|
|
1344
1344
|
}
|
|
1345
|
-
) : /* @__PURE__ */ f("div", { className: l.boxItemFallback, "aria-hidden": "true", children: ((Te = (be = (oe = h.product) == null ? void 0 : oe.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) :
|
|
1345
|
+
) : /* @__PURE__ */ f("div", { className: l.boxItemFallback, "aria-hidden": "true", children: ((Te = (be = (oe = h.product) == null ? void 0 : oe.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) : v && B ? /* @__PURE__ */ f("div", { className: l.boxItemDiscountText, children: B }) : /* @__PURE__ */ f("div", { className: l.boxItemPlus, "aria-hidden": "true", children: "+" })
|
|
1346
1346
|
}
|
|
1347
1347
|
),
|
|
1348
|
-
S ? /* @__PURE__ */ f("div", { className: l.boxThresholdLabel, children:
|
|
1349
|
-
] },
|
|
1348
|
+
S ? /* @__PURE__ */ f("div", { className: l.boxThresholdLabel, children: b.label }) : null
|
|
1349
|
+
] }, s);
|
|
1350
1350
|
}) }) }),
|
|
1351
1351
|
/* @__PURE__ */ f(
|
|
1352
1352
|
"div",
|
|
@@ -1359,15 +1359,15 @@ function br(i) {
|
|
|
1359
1359
|
"% Discount"
|
|
1360
1360
|
] }) : /* @__PURE__ */ f("span", {}),
|
|
1361
1361
|
/* @__PURE__ */ f("span", { children: ce ? /* @__PURE__ */ O(vt, { children: [
|
|
1362
|
-
/* @__PURE__ */ f("span", { className: l.ctaTotalsStrike, children:
|
|
1362
|
+
/* @__PURE__ */ f("span", { className: l.ctaTotalsStrike, children: P(Ne.toFixed(2)) }),
|
|
1363
1363
|
" ",
|
|
1364
|
-
/* @__PURE__ */ f("span", { className: l.ctaTotalsPrice, children:
|
|
1365
|
-
] }) : /* @__PURE__ */ f("span", { className: l.ctaTotalsPrice, children:
|
|
1364
|
+
/* @__PURE__ */ f("span", { className: l.ctaTotalsPrice, children: P(_t.toFixed(2)) })
|
|
1365
|
+
] }) : /* @__PURE__ */ f("span", { className: l.ctaTotalsPrice, children: P(Ne.toFixed(2)) }) })
|
|
1366
1366
|
] })
|
|
1367
1367
|
}
|
|
1368
1368
|
),
|
|
1369
1369
|
(() => {
|
|
1370
|
-
const a = (
|
|
1370
|
+
const a = (c == null ? void 0 : c.ctaButtonMode) || "add_to_cart";
|
|
1371
1371
|
return a === "add_to_cart_checkout" ? m > 0 ? /* @__PURE__ */ f("button", { type: "button", onClick: X, disabled: !q, className: l.cta, children: r ? "Adding…" : `Add ${m} more product${m === 1 ? "" : "s"}` }) : /* @__PURE__ */ O("div", { className: `${l.ctaButtonGroup} ${qe ? l.ctaButtonGroupAnimating : ""}`, children: [
|
|
1372
1372
|
/* @__PURE__ */ f(
|
|
1373
1373
|
"button",
|
|
@@ -1410,32 +1410,7 @@ function ft(i) {
|
|
|
1410
1410
|
return e ? e[1] : i;
|
|
1411
1411
|
}
|
|
1412
1412
|
function lr() {
|
|
1413
|
-
|
|
1414
|
-
return ((i = window == null ? void 0 : window.routes) == null ? void 0 : i.cart_url) || "/cart";
|
|
1415
|
-
}
|
|
1416
|
-
async function ur() {
|
|
1417
|
-
try {
|
|
1418
|
-
const i = lr(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${i}?sections=${e}`, { method: "GET" });
|
|
1419
|
-
if (!t.ok) return;
|
|
1420
|
-
const o = await t.json().catch(() => null);
|
|
1421
|
-
if (!o) return;
|
|
1422
|
-
const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
|
|
1423
|
-
for (const s of r) {
|
|
1424
|
-
const b = o[s];
|
|
1425
|
-
if (!b) continue;
|
|
1426
|
-
const w = new DOMParser().parseFromString(b, "text/html"), M = w.getElementById(s) || w.querySelector(s), P = document.getElementById(s) || document.querySelector(s);
|
|
1427
|
-
P && M && P.replaceWith(M);
|
|
1428
|
-
}
|
|
1429
|
-
const n = document.querySelector("cart-drawer");
|
|
1430
|
-
if (n && typeof n.open == "function") {
|
|
1431
|
-
n.open();
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
document.body.classList.add("overflow-hidden");
|
|
1435
|
-
const u = document.querySelector("cart-drawer") || document.querySelector("cart-notification");
|
|
1436
|
-
u && (u.classList.contains("is-empty") && u.classList.remove("is-empty"), u.classList.add("active"));
|
|
1437
|
-
} catch {
|
|
1438
|
-
}
|
|
1413
|
+
window.location.reload();
|
|
1439
1414
|
}
|
|
1440
1415
|
async function Fe(i, e) {
|
|
1441
1416
|
const t = await fetch(i, {
|
|
@@ -1452,7 +1427,7 @@ async function Fe(i, e) {
|
|
|
1452
1427
|
}
|
|
1453
1428
|
return t.json().catch(() => null);
|
|
1454
1429
|
}
|
|
1455
|
-
function
|
|
1430
|
+
function br() {
|
|
1456
1431
|
return {
|
|
1457
1432
|
async linesAdd(i) {
|
|
1458
1433
|
const e = i.map((t) => ({
|
|
@@ -1483,9 +1458,7 @@ function _r() {
|
|
|
1483
1458
|
await Fe("/cart/change.js", { id: e, quantity: 0 });
|
|
1484
1459
|
},
|
|
1485
1460
|
openCartUI() {
|
|
1486
|
-
window.setTimeout(() =>
|
|
1487
|
-
ur();
|
|
1488
|
-
}, 0);
|
|
1461
|
+
window.setTimeout(() => lr(), 0);
|
|
1489
1462
|
},
|
|
1490
1463
|
navigateToCheckout() {
|
|
1491
1464
|
window.location.href = "/checkout";
|
|
@@ -1493,12 +1466,12 @@ function _r() {
|
|
|
1493
1466
|
};
|
|
1494
1467
|
}
|
|
1495
1468
|
export {
|
|
1496
|
-
|
|
1497
|
-
|
|
1469
|
+
pr as BundleBuilderDrawer,
|
|
1470
|
+
mr as BundleButton,
|
|
1498
1471
|
Re as BundleLineAttributeKeys,
|
|
1499
|
-
|
|
1500
|
-
|
|
1472
|
+
hr as BundleProvider,
|
|
1473
|
+
br as createLiquidCartAdapter,
|
|
1501
1474
|
Ye as useBundleBuilder,
|
|
1502
|
-
|
|
1475
|
+
fr as useBundleBuilderDrawer
|
|
1503
1476
|
};
|
|
1504
1477
|
//# sourceMappingURL=index.js.map
|