@best-bundles/bundle-ui 0.0.12 → 0.0.13
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/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/liquid/bundle-ui.iife.js +1 -1
- package/dist/liquid/bundle-ui.iife.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.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_364yo_1{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--bb-backdrop-z-index, 9999);display:flex;justify-content:flex-end;background:var(--bb-backdrop-bg, rgba(0, 0, 0, .5));-webkit-backdrop-filter:blur(var(--bb-backdrop-blur, 2px));backdrop-filter:blur(var(--bb-backdrop-blur, 2px));padding:var(--bb-backdrop-padding, 12px);opacity:0;transition:opacity var(--bb-drawer-transition-duration, .22s) ease}._celebrationOverlay_364yo_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_364yo_23{font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.03em;font-size:18px;line-height:1;padding:12px 16px;border-radius:999px;color:#0b1b44;background:linear-gradient(180deg,#fff,#bae6fd);border:2px solid rgba(37,99,235,.28);box-shadow:0 18px 55px #0006,0 10px 28px #2563eb33,inset 0 1px #ffffffbf;transform-origin:50% 60%;will-change:transform,opacity,filter;animation:_bbCelebrationPop_364yo_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_364yo_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_364yo_74{opacity:1}._backdropClosed_364yo_78{opacity:0}._panel_364yo_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_364yo_102{animation:_bbSlideInFromRight_364yo_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_364yo_106{animation:_bbSlideOutToRight_364yo_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_364yo_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_364yo_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_364yo_1{transition:none}._celebrationChip_364yo_23,._panelOpen_364yo_102,._panelClosed_364yo_106{animation:none}}._header_364yo_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_364yo_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_364yo_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_364yo_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_364yo_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_364yo_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_364yo_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_364yo_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_364yo_209 ._headerTitleWrap_364yo_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_364yo_209 ._headerSearchWrap_364yo_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_364yo_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_364yo_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_364yo_233::-webkit-search-cancel-button,._searchInput_364yo_233::-webkit-search-decoration,._searchInput_364yo_233::-webkit-search-results-button,._searchInput_364yo_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_364yo_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_364yo_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_364yo_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_364yo_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_364yo_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_364yo_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_364yo_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_364yo_193,._headerSearchWrap_364yo_197{transition:none}}._body_364yo_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_364yo_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_364yo_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_364yo_324{margin-top:4px}._variantList_364yo_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_364yo_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_364yo_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_364yo_351{height:100%;align-self:stretch;border-radius:12px;border:none;background:var(--bb-cta-bg, #91aae5);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:800;padding:0 16px;cursor:pointer;white-space:nowrap}._addToBundleButton_364yo_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_364yo_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_364yo_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_364yo_379{width:60px;height:60px;border-radius:12px;overflow:hidden;border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));flex:0 0 auto}._variantThumbImg_364yo_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_364yo_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_364yo_406{min-width:0}._variantName_364yo_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_364yo_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_364yo_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_364yo_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_364yo_427{font-size:13px;font-weight:800}._qtyControls_364yo_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_364yo_451{width:34px;height:34px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);cursor:pointer;line-height:1;font-size:16px}._qtyButton_364yo_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_364yo_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_364yo_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_364yo_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_364yo_483{padding:var(--bb-footer-padding, 12px 16px 16px 16px);border-top:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);position:relative}._poweredBy_364yo_490{font-size:10px;color:var(rgba(17, 24, 39, .6));text-align:center;margin-top:10px}._poweredBy_364yo_490 a{color:inherit;text-decoration:none}._boxSummaryWindow_364yo_502{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_364yo_502::-webkit-scrollbar{display:none}._boxSummaryRow_364yo_519{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_364yo_527{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_364yo_535{width:100%;aspect-ratio:1 / 1;border-radius:12px;position:relative;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;box-sizing:border-box}._boxItemClickable_364yo_547{cursor:pointer}._boxItemClickable_364yo_547:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_364yo_556{font-size:11px;line-height:1.15;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._boxItemPlaceholder_364yo_567{border:1px dashed var(--bb-border-strong-color, rgba(17, 24, 39, .18));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));color:var(--bb-muted-color, rgba(17, 24, 39, .6))}._boxItemFilled_364yo_573{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_364yo_579{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:linear-gradient(180deg,#2563eb1a,#2563eb08);color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_364yo_587{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_364yo_595{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_364yo_602{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_364yo_609{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .04));color:var(--bb-text-color, #111827);font-weight:800}._cta_364yo_620{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer}._ctaTotals_364yo_632{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_364yo_640{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_364yo_654{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_364yo_667{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_364yo_674{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_364yo_681{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_364yo_654{transition:none}}._cta_364yo_620:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_364yo_620:disabled{opacity:.6;cursor:not-allowed}._cta_364yo_620:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_364yo_706{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_364yo_1{padding:0;justify-content:stretch}._panel_364yo_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
import { jsx as h, jsxs as R, Fragment as lt } from "react/jsx-runtime";
|
|
3
3
|
import Ae, { useState as M, useRef as V, useEffect as j, useCallback as be, useMemo as N, createContext as ut, useContext as dt, forwardRef as rt, createElement as ze } from "react";
|
|
4
|
-
const
|
|
4
|
+
const ke = {
|
|
5
5
|
bundleId: "_bundle_id",
|
|
6
6
|
bundleConfig: "_bundle_config",
|
|
7
7
|
bundleSource: "_bundle_source",
|
|
@@ -18,7 +18,7 @@ async function ht(i) {
|
|
|
18
18
|
return !o || typeof o != "object" ? { ok: !1, error: "Invalid response." } : o;
|
|
19
19
|
}
|
|
20
20
|
const Je = "bb_anonymous_user_id";
|
|
21
|
-
function
|
|
21
|
+
function Fe() {
|
|
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 {
|
|
@@ -84,7 +84,7 @@ function Yn(i) {
|
|
|
84
84
|
configFetcher: l,
|
|
85
85
|
analyticsEndpoint: c,
|
|
86
86
|
children: f
|
|
87
|
-
} = i, v = c ?? `${e}/api/public/bundle-analytics`, [O, P] = M(!1), [x, X] = M(!n), [J, re] = M(!1), [T, q] = M(null), [
|
|
87
|
+
} = i, v = c ?? `${e}/api/public/bundle-analytics`, [O, P] = M(!1), [x, X] = M(!n), [J, re] = M(!1), [T, q] = M(null), [k, Z] = M((n == null ? void 0 : n.currencyCode) ?? null), [g, we] = M((n == null ? void 0 : n.config) ?? null), [ee, oe] = M(
|
|
88
88
|
(n == null ? void 0 : n.eligibleVariants) ?? []
|
|
89
89
|
), [Ne, Te] = M(
|
|
90
90
|
() => ({ selections: {}, order: [] })
|
|
@@ -110,7 +110,7 @@ function Yn(i) {
|
|
|
110
110
|
const _e = be(() => {
|
|
111
111
|
if (P(!0), v)
|
|
112
112
|
try {
|
|
113
|
-
const y =
|
|
113
|
+
const y = Fe();
|
|
114
114
|
Re(v, t, {
|
|
115
115
|
eventType: "DRAWER_OPENED",
|
|
116
116
|
shop: t,
|
|
@@ -126,7 +126,7 @@ function Yn(i) {
|
|
|
126
126
|
P((y) => {
|
|
127
127
|
if (!y && v)
|
|
128
128
|
try {
|
|
129
|
-
const C =
|
|
129
|
+
const C = Fe();
|
|
130
130
|
Re(v, t, {
|
|
131
131
|
eventType: "DRAWER_OPENED",
|
|
132
132
|
shop: t,
|
|
@@ -148,17 +148,17 @@ function Yn(i) {
|
|
|
148
148
|
return;
|
|
149
149
|
const A = Ze(C);
|
|
150
150
|
Te((_) => {
|
|
151
|
-
const D = _.selections[y] ?? 0, he = A - D, E = Object.values(_.selections).reduce((z, L) => z + (L || 0), 0),
|
|
151
|
+
const D = _.selections[y] ?? 0, he = A - D, E = Object.values(_.selections).reduce((z, L) => z + (L || 0), 0), F = he > 0 ? Math.min(he, Math.max(0, ve - E)) : he, $ = D + F;
|
|
152
152
|
let G;
|
|
153
153
|
if ($ <= 0) {
|
|
154
154
|
const { [y]: z, ...L } = _.selections;
|
|
155
155
|
G = L;
|
|
156
156
|
} else D === $ ? G = _.selections : G = { ..._.selections, [y]: $ };
|
|
157
157
|
let se = _.order;
|
|
158
|
-
if (
|
|
159
|
-
se = [..._.order, ...Array.from({ length:
|
|
160
|
-
else if (
|
|
161
|
-
let z = -
|
|
158
|
+
if (F > 0)
|
|
159
|
+
se = [..._.order, ...Array.from({ length: F }, () => y)];
|
|
160
|
+
else if (F < 0) {
|
|
161
|
+
let z = -F;
|
|
162
162
|
const L = [];
|
|
163
163
|
for (let ce = _.order.length - 1; ce >= 0; ce--) {
|
|
164
164
|
const B = _.order[ce];
|
|
@@ -173,7 +173,7 @@ function Yn(i) {
|
|
|
173
173
|
if (G === _.selections && se === _.order) return _;
|
|
174
174
|
if (v)
|
|
175
175
|
try {
|
|
176
|
-
const z =
|
|
176
|
+
const z = Fe();
|
|
177
177
|
Re(v, t, {
|
|
178
178
|
eventType: "VARIANT_SELECTION_CHANGED",
|
|
179
179
|
shop: t,
|
|
@@ -196,10 +196,10 @@ function Yn(i) {
|
|
|
196
196
|
merchandiseId: b.merchandiseId,
|
|
197
197
|
quantity: b.quantity,
|
|
198
198
|
attributes: [
|
|
199
|
-
{ key:
|
|
200
|
-
{ key:
|
|
201
|
-
{ key:
|
|
202
|
-
...C ? [{ key:
|
|
199
|
+
{ key: ke.bundleId, value: y },
|
|
200
|
+
{ key: ke.bundleConfig, value: r },
|
|
201
|
+
{ key: ke.bundleSource, value: "bundle_builder" },
|
|
202
|
+
...C ? [{ key: ke.bundleTitle, value: C }] : []
|
|
203
203
|
]
|
|
204
204
|
}));
|
|
205
205
|
if (!A.length) return;
|
|
@@ -216,15 +216,15 @@ function Yn(i) {
|
|
|
216
216
|
let E = null;
|
|
217
217
|
for (const b of he)
|
|
218
218
|
Y >= b.minBundleSize && (E = b);
|
|
219
|
-
const
|
|
219
|
+
const F = E ? (() => {
|
|
220
220
|
const b = Number.parseFloat(E.discountPercent);
|
|
221
221
|
return Number.isFinite(b) && b > 0 ? b : null;
|
|
222
|
-
})() : null, $ =
|
|
222
|
+
})() : null, $ = F ? Math.round(D * (1 - F / 100) * 100) / 100 : D, G = D - $, se = A.map((b) => b.merchandiseId), z = (E == null ? void 0 : E.handle) ?? "", L = ((ce = E == null ? void 0 : E.label) == null ? void 0 : ce.trim()) || "";
|
|
223
223
|
re(!0);
|
|
224
224
|
try {
|
|
225
225
|
if (await o.linesAdd(A), v)
|
|
226
226
|
try {
|
|
227
|
-
const b =
|
|
227
|
+
const b = Fe();
|
|
228
228
|
Re(v, t, {
|
|
229
229
|
eventType: "BUNDLE_ADDED_TO_BASKET",
|
|
230
230
|
shop: t,
|
|
@@ -235,7 +235,7 @@ function Yn(i) {
|
|
|
235
235
|
discountedPrice: $,
|
|
236
236
|
discountThresholdIdentifier: z,
|
|
237
237
|
discountLabel: L,
|
|
238
|
-
discountPercentage:
|
|
238
|
+
discountPercentage: F,
|
|
239
239
|
discountedAmount: G,
|
|
240
240
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
241
241
|
});
|
|
@@ -267,7 +267,7 @@ function Yn(i) {
|
|
|
267
267
|
loading: x,
|
|
268
268
|
submitting: J,
|
|
269
269
|
error: T,
|
|
270
|
-
currencyCode:
|
|
270
|
+
currencyCode: k,
|
|
271
271
|
config: g,
|
|
272
272
|
eligibleVariants: ee,
|
|
273
273
|
selections: K,
|
|
@@ -287,7 +287,7 @@ function Yn(i) {
|
|
|
287
287
|
x,
|
|
288
288
|
J,
|
|
289
289
|
T,
|
|
290
|
-
|
|
290
|
+
k,
|
|
291
291
|
g,
|
|
292
292
|
ee,
|
|
293
293
|
K,
|
|
@@ -522,15 +522,15 @@ class xt {
|
|
|
522
522
|
const re = this.particles.length, T = O ? re : c;
|
|
523
523
|
if (T < P) {
|
|
524
524
|
f !== P && (this.tweenProgress = 0, this.tweenFrom = T, this.lastNumberOfPieces = P), this.tweenProgress = Math.min(J, Math.max(0, this.tweenProgress + r));
|
|
525
|
-
const q = X(this.tweenProgress, this.tweenFrom, P, J),
|
|
526
|
-
for (let Z = 0; Z <
|
|
525
|
+
const q = X(this.tweenProgress, this.tweenFrom, P, J), k = Math.round(q - T);
|
|
526
|
+
for (let Z = 0; Z < k; Z++)
|
|
527
527
|
this.particles.push(this.getParticle());
|
|
528
|
-
this.particlesGenerated +=
|
|
528
|
+
this.particlesGenerated += k;
|
|
529
529
|
}
|
|
530
530
|
x && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${re}`, n.width - 10, n.height - 20));
|
|
531
531
|
for (let q = this.particles.length - 1; q >= 0; q--) {
|
|
532
|
-
const
|
|
533
|
-
|
|
532
|
+
const k = this.particles[q];
|
|
533
|
+
k.update(r), (k.y > n.height || k.y < -100 || k.x > n.width + 100 || k.x < -100) && (O && T <= P ? this.particles[q] = this.getParticle() : this.removeParticleAt(q));
|
|
534
534
|
}
|
|
535
535
|
return re > 0 || T < P;
|
|
536
536
|
}, this.canvas = e;
|
|
@@ -764,10 +764,10 @@ const Pt = (i, e) => {
|
|
|
764
764
|
* This source code is licensed under the ISC license.
|
|
765
765
|
* See the LICENSE file in the root directory of this source tree.
|
|
766
766
|
*/
|
|
767
|
-
const
|
|
767
|
+
const kt = [
|
|
768
768
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
769
769
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
770
|
-
],
|
|
770
|
+
], Ft = Pt("search", kt), Rt = "_backdrop_364yo_1", At = "_celebrationOverlay_364yo_14", Dt = "_celebrationChip_364yo_23", qt = "_backdropOpen_364yo_74", Et = "_backdropClosed_364yo_78", Lt = "_panel_364yo_82", Ut = "_panelOpen_364yo_102", $t = "_panelClosed_364yo_106", zt = "_header_364yo_145", Wt = "_headerCenter_364yo_154", Vt = "_title_364yo_162", jt = "_searchIconButton_364yo_171", Qt = "_headerTitleWrap_364yo_193", Yt = "_headerSearchWrap_364yo_197", Kt = "_headerSearchOpen_364yo_209", Gt = "_searchBar_364yo_221", Ht = "_searchInput_364yo_233", Xt = "_searchClearButton_364yo_254", Jt = "_closeButton_364yo_276", Zt = "_body_364yo_309", en = "_muted_364yo_314", tn = "_error_364yo_319", nn = "_variants_364yo_324", rn = "_variantList_364yo_328", on = "_variantRow_364yo_336", an = "_variantLeft_364yo_344", sn = "_addToBundleButton_364yo_351", cn = "_variantThumb_364yo_379", ln = "_variantThumbImg_364yo_389", un = "_variantThumbFallback_364yo_396", dn = "_variantInfo_364yo_406", hn = "_variantName_364yo_410", fn = "_variantMeta_364yo_419", mn = "_variantPriceRow_364yo_427", pn = "_variantCompareAt_364yo_434", yn = "_variantPrice_364yo_427", bn = "_qtyControls_364yo_445", wn = "_qtyButton_364yo_451", _n = "_qtyValue_364yo_476", vn = "_footer_364yo_483", gn = "_poweredBy_364yo_490", xn = "_boxSummaryWindow_364yo_502", In = "_boxSummaryRow_364yo_519", Cn = "_boxSlot_364yo_527", Sn = "_boxItem_364yo_535", Bn = "_boxItemClickable_364yo_547", Nn = "_boxThresholdLabel_364yo_556", Tn = "_boxItemPlaceholder_364yo_567", Mn = "_boxItemFilled_364yo_573", On = "_boxItemThreshold_364yo_579", Pn = "_boxItemDiscountText_364yo_587", kn = "_boxItemPlus_364yo_595", Fn = "_boxItemImage_364yo_602", Rn = "_boxItemFallback_364yo_609", An = "_cta_364yo_620", Dn = "_ctaTotals_364yo_632", qn = "_ctaDiscountBadge_364yo_640", En = "_ctaTotalsWrap_364yo_654", Ln = "_ctaTotalsWrapVisible_364yo_667", Un = "_ctaTotalsStrike_364yo_674", $n = "_ctaTotalsPrice_364yo_681", u = {
|
|
771
771
|
backdrop: Rt,
|
|
772
772
|
celebrationOverlay: At,
|
|
773
773
|
celebrationChip: Dt,
|
|
@@ -819,8 +819,8 @@ const Ft = [
|
|
|
819
819
|
boxItemFilled: Mn,
|
|
820
820
|
boxItemThreshold: On,
|
|
821
821
|
boxItemDiscountText: Pn,
|
|
822
|
-
boxItemPlus:
|
|
823
|
-
boxItemImage:
|
|
822
|
+
boxItemPlus: kn,
|
|
823
|
+
boxItemImage: Fn,
|
|
824
824
|
boxItemFallback: Rn,
|
|
825
825
|
cta: An,
|
|
826
826
|
ctaTotals: Dn,
|
|
@@ -848,7 +848,7 @@ function Hn(i) {
|
|
|
848
848
|
minRequired: X,
|
|
849
849
|
canSubmit: J,
|
|
850
850
|
submit: re
|
|
851
|
-
} = We(), [T, q] = M(!1), [
|
|
851
|
+
} = We(), [T, q] = M(!1), [k, Z] = M(""), g = V(null), we = V(null), ee = V(null), [oe, Ne] = M(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Te, Me] = M(0), [_e, me] = M(null), [Oe, ve] = M(!1), Q = V(null), ge = V(x), de = 7e3, [K, Pe] = M(0), [Y, pe] = M(null), [ie, xe] = M(!1), ae = V(null), y = 2800, C = (a) => {
|
|
852
852
|
const s = Number.parseFloat(a);
|
|
853
853
|
return Number.isFinite(s) ? String(Math.round(s)) : a;
|
|
854
854
|
}, A = (a) => {
|
|
@@ -864,7 +864,7 @@ function Hn(i) {
|
|
|
864
864
|
}, D = (a) => {
|
|
865
865
|
const s = _(a), d = A(a.selectedOptions);
|
|
866
866
|
return [s, d].filter(Boolean).join(" — ");
|
|
867
|
-
}, [he, E] = M(e),
|
|
867
|
+
}, [he, E] = M(e), F = V(null), $ = (a) => {
|
|
868
868
|
const s = Number(a);
|
|
869
869
|
if (!Number.isFinite(s)) return a;
|
|
870
870
|
if (l)
|
|
@@ -877,7 +877,7 @@ function Hn(i) {
|
|
|
877
877
|
const a = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(a) ? Math.floor(a) : 100;
|
|
878
878
|
return Math.max(2, Math.min(100, s));
|
|
879
879
|
}, [c == null ? void 0 : c.maxBundleSize]), z = x >= se, L = N(() => [...f].sort((a, s) => a.displayName.localeCompare(s.displayName)), [f]), ce = N(() => {
|
|
880
|
-
const a =
|
|
880
|
+
const a = k.trim().toLowerCase();
|
|
881
881
|
if (!a) return L;
|
|
882
882
|
const s = a.split(/\s+/).filter(Boolean), d = (p) => {
|
|
883
883
|
var w;
|
|
@@ -889,7 +889,7 @@ function Hn(i) {
|
|
|
889
889
|
return s.every((S) => I.includes(S));
|
|
890
890
|
};
|
|
891
891
|
return L.filter(d);
|
|
892
|
-
}, [
|
|
892
|
+
}, [k, L]), B = N(() => [...(c == null ? void 0 : c.rules) ?? []].sort((a, s) => a.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), b = N(() => Math.max(0, X - x), [x, X]), te = N(() => {
|
|
893
893
|
let a = null;
|
|
894
894
|
for (const s of B)
|
|
895
895
|
x >= s.minBundleSize && (a = s);
|
|
@@ -953,15 +953,15 @@ function Hn(i) {
|
|
|
953
953
|
const a = () => Ne({ width: window.innerWidth, height: window.innerHeight });
|
|
954
954
|
return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
|
|
955
955
|
}, []), j(() => {
|
|
956
|
-
if (
|
|
956
|
+
if (F.current != null && (window.clearTimeout(F.current), F.current = null), e) {
|
|
957
957
|
E(!0);
|
|
958
958
|
return;
|
|
959
959
|
}
|
|
960
|
-
|
|
961
|
-
E(!1),
|
|
960
|
+
F.current = window.setTimeout(() => {
|
|
961
|
+
E(!1), F.current = null;
|
|
962
962
|
}, 220);
|
|
963
963
|
}, [e]), j(() => () => {
|
|
964
|
-
|
|
964
|
+
F.current != null && window.clearTimeout(F.current);
|
|
965
965
|
}, []), j(() => () => {
|
|
966
966
|
Q.current != null && window.clearTimeout(Q.current);
|
|
967
967
|
}, []), j(() => () => {
|
|
@@ -1069,7 +1069,7 @@ function Hn(i) {
|
|
|
1069
1069
|
onClick: () => {
|
|
1070
1070
|
q(!0);
|
|
1071
1071
|
},
|
|
1072
|
-
children: /* @__PURE__ */ h(
|
|
1072
|
+
children: /* @__PURE__ */ h(Ft, { size: 18, "aria-hidden": "true" })
|
|
1073
1073
|
}
|
|
1074
1074
|
),
|
|
1075
1075
|
/* @__PURE__ */ R("div", { className: u.headerCenter, children: [
|
|
@@ -1081,15 +1081,15 @@ function Hn(i) {
|
|
|
1081
1081
|
ref: g,
|
|
1082
1082
|
className: u.searchInput,
|
|
1083
1083
|
type: "search",
|
|
1084
|
-
value:
|
|
1084
|
+
value: k,
|
|
1085
1085
|
placeholder: "Search",
|
|
1086
1086
|
onChange: (a) => Z(a.target.value),
|
|
1087
1087
|
onBlur: () => {
|
|
1088
|
-
|
|
1088
|
+
k.trim() === "" && q(!1);
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
),
|
|
1092
|
-
|
|
1092
|
+
k.trim() ? /* @__PURE__ */ h(
|
|
1093
1093
|
"button",
|
|
1094
1094
|
{
|
|
1095
1095
|
type: "button",
|
|
@@ -1233,7 +1233,7 @@ function Hn(i) {
|
|
|
1233
1233
|
/* @__PURE__ */ h("button", { type: "button", onClick: re, disabled: !J, className: u.cta, children: r ? "Adding…" : b > 0 ? `Add ${b} more product${b === 1 ? "" : "s"}` : "Add to Basket" }),
|
|
1234
1234
|
/* @__PURE__ */ R("div", { className: u.poweredBy, children: [
|
|
1235
1235
|
"powered by ",
|
|
1236
|
-
/* @__PURE__ */ h("a", { href: "https://best-bundles.onrender.com", children: " BestBundles" })
|
|
1236
|
+
/* @__PURE__ */ h("a", { href: "https://best-bundles.onrender.com", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
|
|
1237
1237
|
] })
|
|
1238
1238
|
] })
|
|
1239
1239
|
] })
|
|
@@ -1324,7 +1324,7 @@ function Xn() {
|
|
|
1324
1324
|
export {
|
|
1325
1325
|
Hn as BundleBuilderDrawer,
|
|
1326
1326
|
Gn as BundleButton,
|
|
1327
|
-
|
|
1327
|
+
ke as BundleLineAttributeKeys,
|
|
1328
1328
|
Yn as BundleProvider,
|
|
1329
1329
|
Xn as createLiquidCartAdapter,
|
|
1330
1330
|
We as useBundleBuilder,
|