@cimplify/sdk 0.110.2 → 0.111.0
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/CHANGELOG.md +54 -0
- package/README.md +18 -0
- package/dist/advanced.d.mts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{catalogue-OTuS5zp-.d.ts → catalogue-1QcoGDO6.d.ts} +2 -2
- package/dist/{catalogue-CPTMyBUz.d.mts → catalogue-FdFQiWrU.d.mts} +2 -2
- package/dist/{chunk-SYEO2WV4.mjs → chunk-42JTCWIE.mjs} +3 -3
- package/dist/{chunk-OMTVH334.js → chunk-6QANXRUM.js} +203 -186
- package/dist/{chunk-6ETDAU62.mjs → chunk-B45X3HPO.mjs} +98 -39
- package/dist/{chunk-MKIJQL5Q.js → chunk-CJVEJPIG.js} +69 -69
- package/dist/{chunk-Q2Y3VMKH.js → chunk-ETZDIISN.js} +151 -151
- package/dist/{chunk-GCKWKLZF.mjs → chunk-FT6GFYJL.mjs} +17 -3
- package/dist/{chunk-A36JRXXH.mjs → chunk-KWZHIPRN.mjs} +26 -9
- package/dist/{chunk-SNNEOS5Z.js → chunk-MHDUUSG6.js} +75 -75
- package/dist/{chunk-UCR5HRYM.js → chunk-NFXCKTE2.js} +17 -3
- package/dist/{chunk-DFZWHNRG.js → chunk-QOCHWR4V.js} +105 -42
- package/dist/{chunk-IZDWAL53.mjs → chunk-UJDQQTBS.mjs} +8 -8
- package/dist/{chunk-BTUSVHIE.mjs → chunk-WLSU5QJT.mjs} +2 -2
- package/dist/{client-dqOhP9Nc.d.ts → client-CChON4-x.d.ts} +2 -2
- package/dist/{client-CX_WR0-J.d.mts → client-EeuGm5gj.d.mts} +2 -2
- package/dist/{elements-DdsRig-2.d.mts → elements-ss9xZgRg.d.mts} +27 -1
- package/dist/{elements-DdsRig-2.d.ts → elements-ss9xZgRg.d.ts} +27 -1
- package/dist/index-BB2gjVvA.d.mts +153 -0
- package/dist/index-BEfmBDAH.d.ts +153 -0
- package/dist/{index-B98Xac8e.d.ts → index-DQK8sTfu.d.ts} +2 -2
- package/dist/{index-DbAN_VQE.d.mts → index-DSVkhRmW.d.mts} +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +189 -177
- package/dist/index.mjs +8 -8
- package/dist/mock/cli.mjs +25 -10
- package/dist/mock/library.js +25 -10
- package/dist/mock/library.mjs +25 -10
- package/dist/mock/msw.js +25 -10
- package/dist/mock/msw.mjs +25 -10
- package/dist/{price-BOzexBww.d.mts → price-B-w4PwHm.d.mts} +1 -1
- package/dist/{price-C1h9sPxE.d.ts → price-BEvQFNJv.d.ts} +1 -1
- package/dist/react.d.mts +23 -15
- package/dist/react.d.ts +23 -15
- package/dist/react.js +254 -237
- package/dist/react.mjs +128 -111
- package/dist/{scheduling-D2ajXpMC.d.ts → scheduling-D9WwOxbo.d.ts} +1 -1
- package/dist/{scheduling-DSRbbaZb.d.mts → scheduling-DDmrYCr-.d.mts} +1 -1
- package/dist/{server-D29IIuDV.d.ts → server-BiKwxvnf.d.ts} +2 -2
- package/dist/{server-DQMWPnc8.d.mts → server-DPdtl2dd.d.mts} +2 -2
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +3 -3
- package/dist/testing/msw.d.ts +3 -3
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +117 -117
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +44 -32
- package/dist/utils.mjs +2 -2
- package/package.json +5 -3
- package/registry/cart-summary.json +1 -1
- package/registry/chat-widget.json +1 -1
- package/registry/price.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/search-input.json +1 -1
- package/dist/index-6gkHMGAq.d.mts +0 -86
- package/dist/index-B_ByTtIT.d.ts +0 -86
package/dist/react.js
CHANGED
|
@@ -7,12 +7,12 @@ var chunkTWM6DLYF_js = require('./chunk-TWM6DLYF.js');
|
|
|
7
7
|
require('./chunk-AHNR3BXI.js');
|
|
8
8
|
require('./chunk-MEXP6DA6.js');
|
|
9
9
|
require('./chunk-PQTQKNKD.js');
|
|
10
|
-
var
|
|
10
|
+
var chunkETZDIISN_js = require('./chunk-ETZDIISN.js');
|
|
11
11
|
var chunkWOF3AD3J_js = require('./chunk-WOF3AD3J.js');
|
|
12
|
-
var
|
|
12
|
+
var chunk6QANXRUM_js = require('./chunk-6QANXRUM.js');
|
|
13
13
|
var chunkGTJWQAGU_js = require('./chunk-GTJWQAGU.js');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
14
|
+
var chunkQOCHWR4V_js = require('./chunk-QOCHWR4V.js');
|
|
15
|
+
var chunkNFXCKTE2_js = require('./chunk-NFXCKTE2.js');
|
|
16
16
|
require('./chunk-JGBCIKJV.js');
|
|
17
17
|
var React14 = require('react');
|
|
18
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -387,8 +387,8 @@ function toNumber(value) {
|
|
|
387
387
|
}
|
|
388
388
|
return 0;
|
|
389
389
|
}
|
|
390
|
-
function roundMoney(value) {
|
|
391
|
-
return Math.max(0,
|
|
390
|
+
function roundMoney(value, currency) {
|
|
391
|
+
return Math.max(0, chunkQOCHWR4V_js.roundToCurrencyDigits(value, currency));
|
|
392
392
|
}
|
|
393
393
|
function clampQuantity(quantity) {
|
|
394
394
|
return Number.isFinite(quantity) ? Math.max(1, Math.floor(quantity)) : 1;
|
|
@@ -425,18 +425,21 @@ function attachInternalItemMetadata(item, metadata = {}) {
|
|
|
425
425
|
};
|
|
426
426
|
return metadata.quotedUnitPrice !== void 0 && (internalItem._quotedUnitPrice = metadata.quotedUnitPrice), internalItem;
|
|
427
427
|
}
|
|
428
|
-
function calculateLineSubtotal(item) {
|
|
428
|
+
function calculateLineSubtotal(item, currency) {
|
|
429
429
|
if (item._quotedUnitPrice !== void 0)
|
|
430
|
-
return roundMoney(
|
|
431
|
-
let unitPrice =
|
|
432
|
-
item.variant?.price_adjustment && (unitPrice +=
|
|
430
|
+
return roundMoney(chunkQOCHWR4V_js.parsePrice(item._quotedUnitPrice) * item.quantity, currency);
|
|
431
|
+
let unitPrice = chunkQOCHWR4V_js.parsePrice(item.product.default_price);
|
|
432
|
+
item.variant?.price_adjustment && (unitPrice += chunkQOCHWR4V_js.parsePrice(item.variant.price_adjustment));
|
|
433
433
|
for (let option of item.addOnOptions || [])
|
|
434
|
-
option.default_price && (unitPrice +=
|
|
435
|
-
return roundMoney(unitPrice * item.quantity);
|
|
434
|
+
option.default_price && (unitPrice += chunkQOCHWR4V_js.parsePrice(option.default_price));
|
|
435
|
+
return roundMoney(unitPrice * item.quantity, currency);
|
|
436
436
|
}
|
|
437
|
-
function calculateSummary(items) {
|
|
438
|
-
let subtotal = roundMoney(
|
|
439
|
-
|
|
437
|
+
function calculateSummary(items, currency) {
|
|
438
|
+
let subtotal = roundMoney(
|
|
439
|
+
items.reduce((sum, item) => sum + calculateLineSubtotal(item, currency), 0),
|
|
440
|
+
currency
|
|
441
|
+
), tax = roundMoney(subtotal * (0), currency);
|
|
442
|
+
return { subtotal, tax, total: roundMoney(subtotal + tax, currency) };
|
|
440
443
|
}
|
|
441
444
|
function applyCartPatch(base, patch) {
|
|
442
445
|
switch (patch.kind) {
|
|
@@ -452,17 +455,17 @@ function applyCartPatch(base, patch) {
|
|
|
452
455
|
};
|
|
453
456
|
} else
|
|
454
457
|
nextItems.push(patch.tempItem);
|
|
455
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
458
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
456
459
|
}
|
|
457
460
|
case "remove_item": {
|
|
458
461
|
let nextItems = base.items.filter((item) => item.id !== patch.itemId);
|
|
459
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
462
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
460
463
|
}
|
|
461
464
|
case "set_quantity": {
|
|
462
465
|
let resolved = clampQuantity(patch.quantity), nextItems = base.items.map(
|
|
463
466
|
(item) => item.id === patch.itemId ? { ...item, quantity: resolved } : item
|
|
464
467
|
);
|
|
465
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
468
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
466
469
|
}
|
|
467
470
|
case "clear":
|
|
468
471
|
return { ...base, items: [], subtotal: 0, tax: 0, total: 0 };
|
|
@@ -539,7 +542,8 @@ function toProductFromServerItem(item, businessId) {
|
|
|
539
542
|
metadata: { from_sdk: true }
|
|
540
543
|
};
|
|
541
544
|
}
|
|
542
|
-
function mapServerCart(serverCart,
|
|
545
|
+
function mapServerCart(serverCart, businessCurrency) {
|
|
546
|
+
let cartCurrency = serverCart.pricing.currency || businessCurrency;
|
|
543
547
|
return {
|
|
544
548
|
items: serverCart.items.map((item) => {
|
|
545
549
|
let variant = item.variant_info || item.variant_name ? {
|
|
@@ -583,14 +587,14 @@ function mapServerCart(serverCart, fallbackCurrency) {
|
|
|
583
587
|
{ quotedUnitPrice: item.total_price }
|
|
584
588
|
);
|
|
585
589
|
}),
|
|
586
|
-
subtotal: roundMoney(toNumber(serverCart.pricing.subtotal)),
|
|
587
|
-
tax: roundMoney(toNumber(serverCart.pricing.tax_amount)),
|
|
590
|
+
subtotal: roundMoney(toNumber(serverCart.pricing.subtotal), cartCurrency),
|
|
591
|
+
tax: roundMoney(toNumber(serverCart.pricing.tax_amount), cartCurrency),
|
|
588
592
|
taxRate: serverCart.pricing.tax_rate != null ? toNumber(serverCart.pricing.tax_rate) : null,
|
|
589
593
|
taxInclusive: serverCart.pricing.tax_inclusive,
|
|
590
594
|
displayGross: chunkZF7JCXCI_js.displaysGrossPrices(serverCart.pricing),
|
|
591
595
|
taxJurisdictionLabel: serverCart.pricing.tax_jurisdiction_label ?? null,
|
|
592
|
-
total: roundMoney(toNumber(serverCart.pricing.total_price)),
|
|
593
|
-
currency:
|
|
596
|
+
total: roundMoney(toNumber(serverCart.pricing.total_price), cartCurrency),
|
|
597
|
+
currency: cartCurrency,
|
|
594
598
|
isLoading: false
|
|
595
599
|
};
|
|
596
600
|
}
|
|
@@ -607,7 +611,7 @@ function annotateOptimisticItems(base, ops) {
|
|
|
607
611
|
};
|
|
608
612
|
}
|
|
609
613
|
function deriveView(base, ops) {
|
|
610
|
-
let folded = base ?? emptyBase(
|
|
614
|
+
let folded = base ?? emptyBase(null);
|
|
611
615
|
for (let op of ops)
|
|
612
616
|
folded = applyCartPatch(folded, op.patch);
|
|
613
617
|
return folded = annotateOptimisticItems(folded, ops), {
|
|
@@ -626,7 +630,7 @@ async function syncFromServer(entry) {
|
|
|
626
630
|
}), next;
|
|
627
631
|
}
|
|
628
632
|
function emitMutationError(entry, operation, opId, idempotencyKey, error) {
|
|
629
|
-
entry.client.events.emit(
|
|
633
|
+
entry.client.events.emit(chunk6QANXRUM_js.MUTATION_ERROR, {
|
|
630
634
|
service: "cart",
|
|
631
635
|
operation,
|
|
632
636
|
opId,
|
|
@@ -645,7 +649,7 @@ function getOrCreateStore(params) {
|
|
|
645
649
|
purgeLegacyCartCachesOnce();
|
|
646
650
|
let storeKey = buildStoreKey(client, locationId), existing = cartStores.get(storeKey);
|
|
647
651
|
if (existing)
|
|
648
|
-
return existing.optimisticEnabled = optimisticEnabled, existing;
|
|
652
|
+
return existing.optimisticEnabled = optimisticEnabled, currency !== null && (existing.currency = currency), existing;
|
|
649
653
|
let entry = {
|
|
650
654
|
collection: createCollection({
|
|
651
655
|
applyPatch: applyCartPatch,
|
|
@@ -661,9 +665,9 @@ function getOrCreateStore(params) {
|
|
|
661
665
|
syncTail: Promise.resolve(),
|
|
662
666
|
failedOpRemovers: /* @__PURE__ */ new Set()
|
|
663
667
|
};
|
|
664
|
-
return client.events.on(
|
|
668
|
+
return client.events.on(chunk6QANXRUM_js.SESSION_CLAIMED, () => {
|
|
665
669
|
entry.initialized && syncFromServer(entry);
|
|
666
|
-
}), client.events.on(
|
|
670
|
+
}), client.events.on(chunk6QANXRUM_js.SESSION_CLEARED, () => {
|
|
667
671
|
entry.initialized && syncFromServer(entry);
|
|
668
672
|
}), cartStores.set(storeKey, entry), entry;
|
|
669
673
|
}
|
|
@@ -790,7 +794,7 @@ function useCart(options = {}) {
|
|
|
790
794
|
let context = useOptionalCimplify(), client = options.client ?? context?.client;
|
|
791
795
|
if (!client)
|
|
792
796
|
throw new Error("useCart must be used within CimplifyProvider or passed { client }.");
|
|
793
|
-
let locationId = options.locationId ?? (context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId()), currency = options.currency ?? context?.currency ??
|
|
797
|
+
let locationId = options.locationId ?? (context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId()), currency = options.currency ?? context?.currency ?? null, optimisticEnabled = context?.optimistic ?? true, entry = React14.useMemo(
|
|
794
798
|
() => getOrCreateStore({
|
|
795
799
|
client,
|
|
796
800
|
locationId,
|
|
@@ -889,10 +893,10 @@ function preconnectOrigin(url, crossOrigin) {
|
|
|
889
893
|
let link = document.createElement("link");
|
|
890
894
|
link.rel = "preconnect", link.href = origin, crossOrigin && (link.crossOrigin = crossOrigin), document.head.appendChild(link);
|
|
891
895
|
}
|
|
892
|
-
var LOCATION_STORAGE_KEY = "cimplify_location_id", DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency", FX_REFRESH_INTERVAL = 12e4,
|
|
896
|
+
var LOCATION_STORAGE_KEY = "cimplify_location_id", DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency", FX_REFRESH_INTERVAL = 12e4, DEFAULT_COUNTRY = "US";
|
|
893
897
|
function createDefaultClient() {
|
|
894
898
|
let envPublicKey = globalThis.process?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
895
|
-
return
|
|
899
|
+
return chunkETZDIISN_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
896
900
|
}
|
|
897
901
|
function getStoredLocationId() {
|
|
898
902
|
if (typeof window > "u" || !window.localStorage)
|
|
@@ -919,7 +923,7 @@ function getStoredDisplayCurrency() {
|
|
|
919
923
|
if (!value)
|
|
920
924
|
return null;
|
|
921
925
|
let normalized = value.trim().toUpperCase();
|
|
922
|
-
return normalized
|
|
926
|
+
return chunkNFXCKTE2_js.isSupportedCurrency(normalized) ? normalized : null;
|
|
923
927
|
}
|
|
924
928
|
function setStoredDisplayCurrency(currency) {
|
|
925
929
|
if (!(typeof window > "u" || !window.localStorage)) {
|
|
@@ -969,26 +973,23 @@ function CimplifyProvider({
|
|
|
969
973
|
React14.useEffect(() => {
|
|
970
974
|
onLocationChangeRef.current = onLocationChange;
|
|
971
975
|
}, [onLocationChange]);
|
|
972
|
-
let baseCurrency = business?.default_currency ||
|
|
976
|
+
let baseCurrency = business?.default_currency || null, [displayCurrencyOverride, setDisplayCurrencyOverride] = React14.useState(
|
|
973
977
|
() => getStoredDisplayCurrency()
|
|
974
|
-
), [fxRate, setFxRate] = React14.useState(null), displayCurrency =
|
|
978
|
+
), [fxRate, setFxRate] = React14.useState(null), displayCurrency = baseCurrency !== null && displayCurrencyOverride !== null ? displayCurrencyOverride : baseCurrency, setDisplayCurrency = React14.useCallback(
|
|
975
979
|
(currency) => {
|
|
976
980
|
let normalized = currency?.trim().toUpperCase() || null;
|
|
977
|
-
normalized && !
|
|
981
|
+
normalized !== null && !chunkNFXCKTE2_js.isSupportedCurrency(normalized) || (setDisplayCurrencyOverride(normalized), setStoredDisplayCurrency(normalized), (!normalized || normalized === baseCurrency) && setFxRate(null));
|
|
978
982
|
},
|
|
979
983
|
[baseCurrency]
|
|
980
984
|
);
|
|
981
985
|
React14.useEffect(() => {
|
|
982
|
-
if (displayCurrency === baseCurrency) {
|
|
986
|
+
if (baseCurrency === null || displayCurrency === null || displayCurrency === baseCurrency) {
|
|
983
987
|
setFxRate(null);
|
|
984
988
|
return;
|
|
985
989
|
}
|
|
986
|
-
let cancelled = false;
|
|
990
|
+
let fromCurrency = baseCurrency, toCurrency = displayCurrency, cancelled = false;
|
|
987
991
|
async function fetchRate() {
|
|
988
|
-
let result = await resolvedClient.fx.getRate(
|
|
989
|
-
baseCurrency,
|
|
990
|
-
displayCurrency
|
|
991
|
-
);
|
|
992
|
+
let result = await resolvedClient.fx.getRate(fromCurrency, toCurrency);
|
|
992
993
|
cancelled || (result.ok ? setFxRate(Number(result.value.rate)) : setFxRate(null));
|
|
993
994
|
}
|
|
994
995
|
fetchRate();
|
|
@@ -1001,8 +1002,8 @@ function CimplifyProvider({
|
|
|
1001
1002
|
}, [resolvedClient, baseCurrency, displayCurrency]);
|
|
1002
1003
|
let convertPrice = React14.useCallback(
|
|
1003
1004
|
(amount) => {
|
|
1004
|
-
let
|
|
1005
|
-
return
|
|
1005
|
+
let value = chunkQOCHWR4V_js.parsePrice(amount);
|
|
1006
|
+
return !fxRate || displayCurrency === null || displayCurrency === baseCurrency ? value : chunkQOCHWR4V_js.roundToCurrencyDigits(value * fxRate, displayCurrency);
|
|
1006
1007
|
},
|
|
1007
1008
|
[fxRate, displayCurrency, baseCurrency]
|
|
1008
1009
|
);
|
|
@@ -1083,10 +1084,7 @@ function useCimplify() {
|
|
|
1083
1084
|
let clientContext = React14.useContext(CimplifyClientContext), stateContext = React14.useContext(CimplifyStateContext);
|
|
1084
1085
|
if (!clientContext || !stateContext)
|
|
1085
1086
|
throw new Error("useCimplify must be used within CimplifyProvider");
|
|
1086
|
-
return React14.useMemo(
|
|
1087
|
-
() => ({ ...clientContext, ...stateContext }),
|
|
1088
|
-
[clientContext, stateContext]
|
|
1089
|
-
);
|
|
1087
|
+
return React14.useMemo(() => ({ ...clientContext, ...stateContext }), [clientContext, stateContext]);
|
|
1090
1088
|
}
|
|
1091
1089
|
function useOptionalCimplify() {
|
|
1092
1090
|
let clientContext = React14.useContext(CimplifyClientContext), stateContext = React14.useContext(CimplifyStateContext);
|
|
@@ -1133,9 +1131,11 @@ function CimplifyCheckout({
|
|
|
1133
1131
|
() => orderTypes && orderTypes.length > 0 ? orderTypes : [chunkGTJWQAGU_js.ORDER_TYPE.PICKUP, chunkGTJWQAGU_js.ORDER_TYPE.DELIVERY],
|
|
1134
1132
|
[orderTypes]
|
|
1135
1133
|
), resolvedDefaultOrderType = React14.useMemo(() => defaultOrderType && resolvedOrderTypes.includes(defaultOrderType) ? defaultOrderType : resolvedOrderTypes[0] || chunkGTJWQAGU_js.ORDER_TYPE.PICKUP, [defaultOrderType, resolvedOrderTypes]), [orderType, setOrderType] = React14.useState(resolvedDefaultOrderType), [status, setStatus] = React14.useState(null), [statusText, setStatusText] = React14.useState(""), [isSubmitting, setIsSubmitting] = React14.useState(false), [isInitializing, setIsInitializing] = React14.useState(false), [errorMessage, setErrorMessage] = React14.useState(null), [resolvedBusinessId, setResolvedBusinessId] = React14.useState(businessId ?? null), [resolvedCartId, setResolvedCartId] = React14.useState(cartId ?? null), [resolvedCart, setResolvedCart] = React14.useState(null), checkoutMountRef = React14.useRef(null), elementsRef = React14.useRef(null), activeCheckoutRef = React14.useRef(null), initialAppearanceRef = React14.useRef(appearance), hasWarnedInlineAppearanceRef = React14.useRef(false), isMountedRef = React14.useRef(true), isTestMode = client.isTestMode(), cimplifyCtx = useOptionalCimplify(), fxOptions = React14.useMemo(() => {
|
|
1136
|
-
if (cimplifyCtx?.fxRate
|
|
1134
|
+
if (!cimplifyCtx?.fxRate) return;
|
|
1135
|
+
let displayCurrency = cimplifyCtx.displayCurrency;
|
|
1136
|
+
if (!(displayCurrency === null || displayCurrency === cimplifyCtx.baseCurrency))
|
|
1137
1137
|
return {
|
|
1138
|
-
displayCurrency
|
|
1138
|
+
displayCurrency,
|
|
1139
1139
|
convertPrice: cimplifyCtx.convertPrice
|
|
1140
1140
|
};
|
|
1141
1141
|
}, [
|
|
@@ -1158,7 +1158,7 @@ function CimplifyCheckout({
|
|
|
1158
1158
|
onComplete(result);
|
|
1159
1159
|
return;
|
|
1160
1160
|
}
|
|
1161
|
-
let code = result.error?.code ||
|
|
1161
|
+
let code = result.error?.code || chunkNFXCKTE2_js.ErrorCode.CHECKOUT_FAILED, message = result.error?.message || "Payment failed.";
|
|
1162
1162
|
setErrorMessage(message), fireError({ code, message });
|
|
1163
1163
|
});
|
|
1164
1164
|
React14.useEffect(() => {
|
|
@@ -1185,7 +1185,7 @@ function CimplifyCheckout({
|
|
|
1185
1185
|
} catch {
|
|
1186
1186
|
if (!cancelled) {
|
|
1187
1187
|
let message = "Unable to initialize checkout business context.";
|
|
1188
|
-
setResolvedBusinessId(null), setResolvedCartId(null), setErrorMessage(message), setIsInitializing(false), fireError({ code:
|
|
1188
|
+
setResolvedBusinessId(null), setResolvedCartId(null), setErrorMessage(message), setIsInitializing(false), fireError({ code: chunkNFXCKTE2_js.ErrorCode.BUSINESS_ID_REQUIRED, message });
|
|
1189
1189
|
}
|
|
1190
1190
|
return;
|
|
1191
1191
|
}
|
|
@@ -1195,7 +1195,7 @@ function CimplifyCheckout({
|
|
|
1195
1195
|
if (!cartResult.ok || !cartResult.value?.id || cartResult.value.items.length === 0) {
|
|
1196
1196
|
if (!cancelled) {
|
|
1197
1197
|
let message = "Your cart is empty. Add items before checkout.";
|
|
1198
|
-
setResolvedBusinessId(nextBusinessId), setResolvedCartId(null), setErrorMessage(message), setIsInitializing(false), fireError({ code:
|
|
1198
|
+
setResolvedBusinessId(nextBusinessId), setResolvedCartId(null), setErrorMessage(message), setIsInitializing(false), fireError({ code: chunkNFXCKTE2_js.ErrorCode.CART_EMPTY, message });
|
|
1199
1199
|
}
|
|
1200
1200
|
return;
|
|
1201
1201
|
}
|
|
@@ -1213,7 +1213,7 @@ function CimplifyCheckout({
|
|
|
1213
1213
|
if (isSubmitting || isInitializing || !resolvedCartId && !intentId) {
|
|
1214
1214
|
if (!resolvedCartId && !intentId && !isInitializing) {
|
|
1215
1215
|
let message = "A cart or purchase intent is required before checkout.";
|
|
1216
|
-
setErrorMessage(message), fireError({ code:
|
|
1216
|
+
setErrorMessage(message), fireError({ code: chunkNFXCKTE2_js.ErrorCode.CHECKOUT_AUTHORITY_REQUIRED, message });
|
|
1217
1217
|
}
|
|
1218
1218
|
return;
|
|
1219
1219
|
}
|
|
@@ -1221,7 +1221,7 @@ function CimplifyCheckout({
|
|
|
1221
1221
|
display_text: statusToLabel(chunkGTJWQAGU_js.CHECKOUT_STATUS.PREPARING)
|
|
1222
1222
|
}), !elementsRef.current) {
|
|
1223
1223
|
let message = "Checkout is still initializing. Please try again.";
|
|
1224
|
-
setErrorMessage(message), fireError({ code:
|
|
1224
|
+
setErrorMessage(message), fireError({ code: chunkNFXCKTE2_js.ErrorCode.CHECKOUT_NOT_READY, message }), setIsSubmitting(false);
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
1227
|
let checkout = elementsRef.current.processCheckout({
|
|
@@ -1242,7 +1242,7 @@ function CimplifyCheckout({
|
|
|
1242
1242
|
onComplete(result);
|
|
1243
1243
|
return;
|
|
1244
1244
|
}
|
|
1245
|
-
let code = result.error?.code ||
|
|
1245
|
+
let code = result.error?.code || chunkNFXCKTE2_js.ErrorCode.CHECKOUT_FAILED, message = result.error?.message || "Payment failed.";
|
|
1246
1246
|
setErrorMessage(message), fireError({ code, message });
|
|
1247
1247
|
} finally {
|
|
1248
1248
|
isMountedRef.current && (activeCheckoutRef.current = null, setIsSubmitting(false));
|
|
@@ -1258,7 +1258,7 @@ function CimplifyCheckout({
|
|
|
1258
1258
|
linkUrl
|
|
1259
1259
|
});
|
|
1260
1260
|
elementsRef.current = elements2;
|
|
1261
|
-
let checkout = elements2.create(
|
|
1261
|
+
let checkout = elements2.create(chunk6QANXRUM_js.ELEMENT_TYPES.CHECKOUT, {
|
|
1262
1262
|
orderTypes: resolvedOrderTypes,
|
|
1263
1263
|
defaultOrderType: resolvedDefaultOrderType,
|
|
1264
1264
|
submitLabel,
|
|
@@ -1267,16 +1267,16 @@ function CimplifyCheckout({
|
|
|
1267
1267
|
initialTerms,
|
|
1268
1268
|
offerSaveDetails: enrollInLink
|
|
1269
1269
|
});
|
|
1270
|
-
return checkoutMountRef.current && checkout.mount(checkoutMountRef.current), checkout.on(
|
|
1270
|
+
return checkoutMountRef.current && checkout.mount(checkoutMountRef.current), checkout.on(chunk6QANXRUM_js.EVENT_TYPES.READY, () => {
|
|
1271
1271
|
let cart = resolvedCartRef.current;
|
|
1272
1272
|
cart && checkout.setCart(chunkZF7JCXCI_js.transformToCheckoutCart(cart, fxOptionsRef.current));
|
|
1273
|
-
}), checkout.on(
|
|
1273
|
+
}), checkout.on(chunk6QANXRUM_js.EVENT_TYPES.ORDER_TYPE_CHANGED, ({ orderType: nextOrderType }) => {
|
|
1274
1274
|
nextOrderType && setOrderType(nextOrderType);
|
|
1275
|
-
}), checkout.on(
|
|
1275
|
+
}), checkout.on(chunk6QANXRUM_js.EVENT_TYPES.CHECKOUT_STATUS, ({ status: nextStatus, context }) => {
|
|
1276
1276
|
emitStatus(nextStatus, context);
|
|
1277
|
-
}), checkout.on(
|
|
1277
|
+
}), checkout.on(chunk6QANXRUM_js.EVENT_TYPES.CHECKOUT_COMPLETE, (result) => {
|
|
1278
1278
|
settleRecoveredCheckout(result);
|
|
1279
|
-
}), checkout.on(
|
|
1279
|
+
}), checkout.on(chunk6QANXRUM_js.EVENT_TYPES.REQUEST_SUBMIT, () => {
|
|
1280
1280
|
handleSubmit();
|
|
1281
1281
|
}), () => {
|
|
1282
1282
|
activeCheckoutRef.current?.abort(), activeCheckoutRef.current = null, elements2.destroy(), elementsRef.current = null;
|
|
@@ -1293,7 +1293,7 @@ function CimplifyCheckout({
|
|
|
1293
1293
|
enrollInLink
|
|
1294
1294
|
]), React14.useEffect(() => {
|
|
1295
1295
|
if (!resolvedCart || !elementsRef.current) return;
|
|
1296
|
-
let checkoutElement = elementsRef.current.getElement(
|
|
1296
|
+
let checkoutElement = elementsRef.current.getElement(chunk6QANXRUM_js.ELEMENT_TYPES.CHECKOUT);
|
|
1297
1297
|
checkoutElement && checkoutElement.setCart(chunkZF7JCXCI_js.transformToCheckoutCart(resolvedCart, fxOptions));
|
|
1298
1298
|
}, [resolvedCart, fxOptions]);
|
|
1299
1299
|
let colors = shellColors(isDark ?? false);
|
|
@@ -2716,17 +2716,17 @@ function toAccountLineItem(item, currency) {
|
|
|
2716
2716
|
quantity: s.quantity,
|
|
2717
2717
|
name: s.product_name,
|
|
2718
2718
|
variantName: s.variant_name,
|
|
2719
|
-
priceLabel:
|
|
2719
|
+
priceLabel: chunkQOCHWR4V_js.parsePrice(s.unit_price) > 0 ? chunkQOCHWR4V_js.formatMoney(s.unit_price, currency) : void 0
|
|
2720
2720
|
})), customisations = item.composite_selections?.selections.map((s) => ({
|
|
2721
2721
|
quantity: s.quantity,
|
|
2722
2722
|
name: s.component_name,
|
|
2723
|
-
priceLabel:
|
|
2723
|
+
priceLabel: chunkQOCHWR4V_js.parsePrice(s.unit_price) > 0 ? `+${chunkQOCHWR4V_js.formatMoney(s.unit_price, currency)}` : void 0
|
|
2724
2724
|
})), data = {
|
|
2725
2725
|
id: item.id,
|
|
2726
2726
|
name: item.product_name ?? "Item",
|
|
2727
2727
|
imageUrl: item.image_url,
|
|
2728
2728
|
subtitle: lineSubtitle(item),
|
|
2729
|
-
priceLabel:
|
|
2729
|
+
priceLabel: chunkQOCHWR4V_js.formatMoney(item.total_price, currency),
|
|
2730
2730
|
lineType: item.line_type,
|
|
2731
2731
|
includes,
|
|
2732
2732
|
customisations,
|
|
@@ -2758,13 +2758,13 @@ var STATUS_TONE2 = {
|
|
|
2758
2758
|
};
|
|
2759
2759
|
function toAccountOrderView(order, opts = {}) {
|
|
2760
2760
|
let currency = order.payment.currency, rows = [
|
|
2761
|
-
{ label: "Subtotal", value:
|
|
2761
|
+
{ label: "Subtotal", value: chunkQOCHWR4V_js.formatMoney(order.pricing.subtotal, currency) }
|
|
2762
2762
|
];
|
|
2763
|
-
|
|
2763
|
+
chunkQOCHWR4V_js.parsePrice(order.pricing.total_discount) > 0 && rows.push({
|
|
2764
2764
|
label: "Discount",
|
|
2765
|
-
value: `\u2212${
|
|
2765
|
+
value: `\u2212${chunkQOCHWR4V_js.formatMoney(order.pricing.total_discount, currency)}`,
|
|
2766
2766
|
tone: "positive"
|
|
2767
|
-
}), order.pricing.tax &&
|
|
2767
|
+
}), order.pricing.tax && chunkQOCHWR4V_js.parsePrice(order.pricing.tax) > 0 && rows.push({ label: "Tax", value: chunkQOCHWR4V_js.formatMoney(order.pricing.tax, currency) }), order.pricing.service_charge && chunkQOCHWR4V_js.parsePrice(order.pricing.service_charge) > 0 && rows.push({ label: "Service", value: chunkQOCHWR4V_js.formatMoney(order.pricing.service_charge, currency) });
|
|
2768
2768
|
let placed = fmtDateTime(order.timestamps.created_at), placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
2769
2769
|
return {
|
|
2770
2770
|
orderNumber: order.user_friendly_id,
|
|
@@ -2776,7 +2776,7 @@ function toAccountOrderView(order, opts = {}) {
|
|
|
2776
2776
|
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
2777
2777
|
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
2778
2778
|
rows,
|
|
2779
|
-
total: { label: "Total", value:
|
|
2779
|
+
total: { label: "Total", value: chunkQOCHWR4V_js.formatMoney(order.pricing.total_price, currency) }
|
|
2780
2780
|
},
|
|
2781
2781
|
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
2782
2782
|
onBack: opts.onBack
|
|
@@ -2930,10 +2930,10 @@ function NextDeliveryCard({
|
|
|
2930
2930
|
);
|
|
2931
2931
|
}
|
|
2932
2932
|
var BASE_CLASSES = "inline-flex items-center justify-center gap-2 font-medium text-sm rounded-md transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", VARIANT_CLASSES = {
|
|
2933
|
-
primary: "bg-[#
|
|
2933
|
+
primary: "bg-[#FFE01A] text-[#141413] hover:bg-[#E0A12E] px-4 py-2.5 border border-transparent",
|
|
2934
2934
|
outline: "bg-white text-zinc-900 hover:bg-zinc-50 px-4 py-2.5 border border-zinc-300",
|
|
2935
2935
|
dark: "bg-zinc-900 text-white hover:bg-zinc-800 px-4 py-2.5 border border-zinc-800",
|
|
2936
|
-
text: "bg-transparent text-[#
|
|
2936
|
+
text: "bg-transparent text-[#7A6300] hover:text-[#8A5508] px-2 py-1"
|
|
2937
2937
|
};
|
|
2938
2938
|
function CimplifySignInButton({
|
|
2939
2939
|
variant = "primary",
|
|
@@ -2951,7 +2951,7 @@ function CimplifySignInButton({
|
|
|
2951
2951
|
{
|
|
2952
2952
|
type: "button",
|
|
2953
2953
|
onClick: async () => {
|
|
2954
|
-
busy || disabled || !signInOpts.clientId || (setBusy(true), await
|
|
2954
|
+
busy || disabled || !signInOpts.clientId || (setBusy(true), await chunk6QANXRUM_js.startSignIn({
|
|
2955
2955
|
...signInOpts,
|
|
2956
2956
|
onSuccess: () => {
|
|
2957
2957
|
setBusy(false), onSuccess?.();
|
|
@@ -3757,10 +3757,12 @@ function Price({
|
|
|
3757
3757
|
prefix,
|
|
3758
3758
|
convert = true
|
|
3759
3759
|
}) {
|
|
3760
|
-
let context = useOptionalCimplify(), sourceCurrency = currency ?? context?.baseCurrency ??
|
|
3761
|
-
|
|
3760
|
+
let context = useOptionalCimplify(), sourceCurrency = currency ?? context?.baseCurrency ?? null;
|
|
3761
|
+
if (sourceCurrency === null) return null;
|
|
3762
|
+
let displayCurrency = context?.displayCurrency ?? null, formatted = convert && context !== null && context.fxRate != null && displayCurrency !== null && displayCurrency !== sourceCurrency && sourceCurrency === context.baseCurrency && context !== null && displayCurrency !== null ? chunkQOCHWR4V_js.formatCurrencyAmount(context.convertPrice(amount), displayCurrency) : chunkQOCHWR4V_js.formatCurrencyAmount(amount, sourceCurrency);
|
|
3763
|
+
return formatted === null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
3762
3764
|
prefix,
|
|
3763
|
-
|
|
3765
|
+
formatted
|
|
3764
3766
|
] });
|
|
3765
3767
|
}
|
|
3766
3768
|
function createCachedQuery(config) {
|
|
@@ -4219,9 +4221,9 @@ function useClientSessionEpoch(client) {
|
|
|
4219
4221
|
let subscribe = React14.useCallback(
|
|
4220
4222
|
(notify) => {
|
|
4221
4223
|
let unsubscribe = [
|
|
4222
|
-
client.events.on(
|
|
4223
|
-
client.events.on(
|
|
4224
|
-
client.events.on(
|
|
4224
|
+
client.events.on(chunk6QANXRUM_js.AUTH_TOKEN_CHANGED, notify),
|
|
4225
|
+
client.events.on(chunk6QANXRUM_js.SESSION_CLAIMED, notify),
|
|
4226
|
+
client.events.on(chunk6QANXRUM_js.SESSION_CLEARED, notify)
|
|
4225
4227
|
];
|
|
4226
4228
|
return () => {
|
|
4227
4229
|
for (let stopListening of unsubscribe)
|
|
@@ -4612,12 +4614,13 @@ function useProductPrice(input) {
|
|
|
4612
4614
|
if (bundleTotalPrice != null)
|
|
4613
4615
|
unitPrice = bundleTotalPrice;
|
|
4614
4616
|
else if (compositePrice)
|
|
4615
|
-
unitPrice =
|
|
4616
|
-
else if (unitPrice =
|
|
4617
|
+
unitPrice = chunkQOCHWR4V_js.parsePrice(compositePrice.final_price);
|
|
4618
|
+
else if (unitPrice = chunkQOCHWR4V_js.getVariantUnitPrice(product, variant), addOnOptions)
|
|
4617
4619
|
for (let option of addOnOptions)
|
|
4618
|
-
option.default_price && (unitPrice +=
|
|
4619
|
-
|
|
4620
|
-
|
|
4620
|
+
option.default_price && (unitPrice += chunkQOCHWR4V_js.parsePrice(option.default_price));
|
|
4621
|
+
let currency = chunkQOCHWR4V_js.getProductCurrency(product);
|
|
4622
|
+
unitPrice = chunkQOCHWR4V_js.roundToCurrencyDigits(unitPrice, currency);
|
|
4623
|
+
let totalPrice = chunkQOCHWR4V_js.roundToCurrencyDigits(unitPrice * quantity, currency);
|
|
4621
4624
|
return {
|
|
4622
4625
|
unitPrice,
|
|
4623
4626
|
totalPrice,
|
|
@@ -5193,7 +5196,7 @@ function useChat(options = {}) {
|
|
|
5193
5196
|
wsReconnectAttemptRef.current = 0, stopPolling();
|
|
5194
5197
|
}, ws.onmessage = (event) => {
|
|
5195
5198
|
try {
|
|
5196
|
-
let envelope = JSON.parse(event.data), update =
|
|
5199
|
+
let envelope = JSON.parse(event.data), update = chunkETZDIISN_js.chatRealtimeUpdateFromWire(envelope);
|
|
5197
5200
|
if (update.kind === "message")
|
|
5198
5201
|
appendMessages([update.message]);
|
|
5199
5202
|
else if (update.kind === "message_updated")
|
|
@@ -5252,13 +5255,13 @@ function useChat(options = {}) {
|
|
|
5252
5255
|
}, [hydrateConversation]), watchSessionClaims = React14.useCallback(() => {
|
|
5253
5256
|
let c = clientRef.current;
|
|
5254
5257
|
if (!c || claimUnsubRef.current) return;
|
|
5255
|
-
let unsubClaimed = c.events.on(
|
|
5258
|
+
let unsubClaimed = c.events.on(chunk6QANXRUM_js.SESSION_CLAIMED, (event) => {
|
|
5256
5259
|
if (setClaimedAs(event.customerName || c.session.claimedCustomerName || null), !openedRef.current) {
|
|
5257
5260
|
openIfExisting();
|
|
5258
5261
|
return;
|
|
5259
5262
|
}
|
|
5260
5263
|
connectWebSocket(), resyncConversation();
|
|
5261
|
-
}), unsubCleared = c.events.on(
|
|
5264
|
+
}), unsubCleared = c.events.on(chunk6QANXRUM_js.SESSION_CLEARED, resetConversation);
|
|
5262
5265
|
claimUnsubRef.current = () => {
|
|
5263
5266
|
unsubClaimed(), unsubCleared();
|
|
5264
5267
|
};
|
|
@@ -5279,7 +5282,7 @@ function useChat(options = {}) {
|
|
|
5279
5282
|
let attachments = opts?.attachments ?? [];
|
|
5280
5283
|
if (!client || !content.trim() && attachments.length === 0 || (setError(null), lastActivityRef.current = Date.now(), !openedRef.current && (await openConversation(), !openedRef.current)))
|
|
5281
5284
|
return false;
|
|
5282
|
-
let replyTo = opts?.replyTo, clientId =
|
|
5285
|
+
let replyTo = opts?.replyTo, clientId = chunk6QANXRUM_js.generateIdempotencyKey(), localId = optimisticId(clientId), optimistic = {
|
|
5283
5286
|
id: localId,
|
|
5284
5287
|
sender_type: "customer",
|
|
5285
5288
|
content: content.trim(),
|
|
@@ -5422,12 +5425,12 @@ function AuthElement({
|
|
|
5422
5425
|
onReadyRef.current = onReady, onAuthenticatedRef.current = onAuthenticated, onErrorRef.current = onError;
|
|
5423
5426
|
}, [onReady, onAuthenticated, onError]), React14.useEffect(() => {
|
|
5424
5427
|
if (!elements2 || !containerRef.current) return;
|
|
5425
|
-
let element = elements2.create(
|
|
5426
|
-
return elementRef.current = element, element.on(
|
|
5427
|
-
|
|
5428
|
+
let element = elements2.create(chunk6QANXRUM_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
5429
|
+
return elementRef.current = element, element.on(chunk6QANXRUM_js.EVENT_TYPES.READY, () => onReadyRef.current?.()), element.on(
|
|
5430
|
+
chunk6QANXRUM_js.EVENT_TYPES.AUTHENTICATED,
|
|
5428
5431
|
(data) => onAuthenticatedRef.current?.(data)
|
|
5429
5432
|
), element.on(
|
|
5430
|
-
|
|
5433
|
+
chunk6QANXRUM_js.EVENT_TYPES.ERROR,
|
|
5431
5434
|
(data) => onErrorRef.current?.(data)
|
|
5432
5435
|
), element.mount(containerRef.current), () => element.destroy();
|
|
5433
5436
|
}, [elements2, prefillEmail]), /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className, style });
|
|
@@ -5445,12 +5448,12 @@ function AddressElement({
|
|
|
5445
5448
|
onReadyRef.current = onReady, onChangeRef.current = onChange, onErrorRef.current = onError;
|
|
5446
5449
|
}, [onReady, onChange, onError]), React14.useEffect(() => {
|
|
5447
5450
|
if (!elements2 || !containerRef.current) return;
|
|
5448
|
-
let element = elements2.create(
|
|
5449
|
-
return elementRef.current = element, element.on(
|
|
5450
|
-
|
|
5451
|
+
let element = elements2.create(chunk6QANXRUM_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
5452
|
+
return elementRef.current = element, element.on(chunk6QANXRUM_js.EVENT_TYPES.READY, () => onReadyRef.current?.()), element.on(
|
|
5453
|
+
chunk6QANXRUM_js.EVENT_TYPES.CHANGE,
|
|
5451
5454
|
(data) => onChangeRef.current?.(data)
|
|
5452
5455
|
), element.on(
|
|
5453
|
-
|
|
5456
|
+
chunk6QANXRUM_js.EVENT_TYPES.ERROR,
|
|
5454
5457
|
(data) => onErrorRef.current?.(data)
|
|
5455
5458
|
), element.mount(containerRef.current), () => element.destroy();
|
|
5456
5459
|
}, [elements2, mode]), /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className, style });
|
|
@@ -5469,12 +5472,12 @@ function PaymentElement({
|
|
|
5469
5472
|
onReadyRef.current = onReady, onChangeRef.current = onChange, onErrorRef.current = onError;
|
|
5470
5473
|
}, [onReady, onChange, onError]), React14.useEffect(() => {
|
|
5471
5474
|
if (!elements2 || !containerRef.current) return;
|
|
5472
|
-
let element = elements2.create(
|
|
5473
|
-
return elementRef.current = element, element.on(
|
|
5474
|
-
|
|
5475
|
+
let element = elements2.create(chunk6QANXRUM_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
5476
|
+
return elementRef.current = element, element.on(chunk6QANXRUM_js.EVENT_TYPES.READY, () => onReadyRef.current?.()), element.on(
|
|
5477
|
+
chunk6QANXRUM_js.EVENT_TYPES.CHANGE,
|
|
5475
5478
|
(data) => onChangeRef.current?.(data)
|
|
5476
5479
|
), element.on(
|
|
5477
|
-
|
|
5480
|
+
chunk6QANXRUM_js.EVENT_TYPES.ERROR,
|
|
5478
5481
|
(data) => onErrorRef.current?.(data)
|
|
5479
5482
|
), element.mount(containerRef.current), () => element.destroy();
|
|
5480
5483
|
}, [elements2, amount, currency]), /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className, style });
|
|
@@ -5604,7 +5607,7 @@ function VariantSelector({
|
|
|
5604
5607
|
match && match.id !== selectedVariantId && onVariantChange(match.id, match);
|
|
5605
5608
|
}, [axisSelections, variants, variantAxes, selectedVariantId, onVariantChange]), !variants || variants.length <= 1)
|
|
5606
5609
|
return null;
|
|
5607
|
-
basePrice != null ?
|
|
5610
|
+
basePrice != null ? chunkQOCHWR4V_js.parsePrice(basePrice) : 0;
|
|
5608
5611
|
if (variantAxes && variantAxes.length > 0)
|
|
5609
5612
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
5610
5613
|
let labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -5708,7 +5711,7 @@ function VariantSelector({
|
|
|
5708
5711
|
"data-cimplify-variant-list": true,
|
|
5709
5712
|
className: cn("divide-y divide-border", classNames?.list),
|
|
5710
5713
|
children: variants.map((variant) => {
|
|
5711
|
-
let isSelected = selectedVariantId === variant.id, adjustment =
|
|
5714
|
+
let isSelected = selectedVariantId === variant.id, adjustment = chunkQOCHWR4V_js.parsePrice(variant.price_adjustment);
|
|
5712
5715
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5713
5716
|
radio.Radio.Root,
|
|
5714
5717
|
{
|
|
@@ -5947,9 +5950,9 @@ function BundleSelector({
|
|
|
5947
5950
|
}, [components, selections, onReady]);
|
|
5948
5951
|
let totalPrice = React14.useMemo(() => {
|
|
5949
5952
|
if (pricingType === "fixed" && bundlePrice)
|
|
5950
|
-
return
|
|
5953
|
+
return chunkQOCHWR4V_js.parsePrice(bundlePrice);
|
|
5951
5954
|
let componentsTotal = components.reduce((sum, comp) => sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity, 0);
|
|
5952
|
-
return pricingType === "percentage_discount" && discountValue ? componentsTotal * (1 -
|
|
5955
|
+
return pricingType === "percentage_discount" && discountValue ? componentsTotal * (1 - chunkQOCHWR4V_js.parsePrice(discountValue) / 100) : pricingType === "fixed_discount" && discountValue ? componentsTotal - chunkQOCHWR4V_js.parsePrice(discountValue) : componentsTotal;
|
|
5953
5956
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
5954
5957
|
React14.useEffect(() => {
|
|
5955
5958
|
onPriceChange?.(totalPrice);
|
|
@@ -6006,11 +6009,11 @@ function BundleSelector({
|
|
|
6006
6009
|
}
|
|
6007
6010
|
function getComponentPrice(component, selectedVariantId) {
|
|
6008
6011
|
if (!selectedVariantId || component.available_variants.length === 0)
|
|
6009
|
-
return
|
|
6012
|
+
return chunkQOCHWR4V_js.parsePrice(component.effective_price);
|
|
6010
6013
|
if (selectedVariantId === component.variant_id)
|
|
6011
|
-
return
|
|
6014
|
+
return chunkQOCHWR4V_js.parsePrice(component.effective_price);
|
|
6012
6015
|
let bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0, selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
6013
|
-
return selectedAdj ?
|
|
6016
|
+
return selectedAdj ? chunkQOCHWR4V_js.parsePrice(component.effective_price) - chunkQOCHWR4V_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkQOCHWR4V_js.parsePrice(selectedAdj.price_adjustment) : chunkQOCHWR4V_js.parsePrice(component.effective_price);
|
|
6014
6017
|
}
|
|
6015
6018
|
function formatDuration(minutes, unit) {
|
|
6016
6019
|
return unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0 ? `${Math.round(minutes / 60)}h` : unit === "days" || unit === "nights" ? `${Math.round(minutes / 1440)}${unit === "nights" ? "n" : "d"}` : `${minutes}min`;
|
|
@@ -6112,7 +6115,7 @@ function BundleComponentCard({
|
|
|
6112
6115
|
"data-cimplify-bundle-variant-picker": true,
|
|
6113
6116
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
6114
6117
|
children: component.available_variants.map((variant) => {
|
|
6115
|
-
let isSelected = selectedVariantId === variant.id, adjustment =
|
|
6118
|
+
let isSelected = selectedVariantId === variant.id, adjustment = chunkQOCHWR4V_js.parsePrice(variant.price_adjustment);
|
|
6116
6119
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6117
6120
|
radio.Radio.Root,
|
|
6118
6121
|
{
|
|
@@ -6505,7 +6508,7 @@ function CompositeSelector({
|
|
|
6505
6508
|
"data-cimplify-composite-summary": true,
|
|
6506
6509
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
6507
6510
|
children: [
|
|
6508
|
-
|
|
6511
|
+
chunkQOCHWR4V_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6509
6512
|
"div",
|
|
6510
6513
|
{
|
|
6511
6514
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -6516,7 +6519,7 @@ function CompositeSelector({
|
|
|
6516
6519
|
]
|
|
6517
6520
|
}
|
|
6518
6521
|
),
|
|
6519
|
-
|
|
6522
|
+
chunkQOCHWR4V_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6520
6523
|
"div",
|
|
6521
6524
|
{
|
|
6522
6525
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -6656,7 +6659,7 @@ function BookingSummary({
|
|
|
6656
6659
|
className,
|
|
6657
6660
|
classNames
|
|
6658
6661
|
}) {
|
|
6659
|
-
let depositValue = depositAmount != null ?
|
|
6662
|
+
let depositValue = depositAmount != null ? chunkQOCHWR4V_js.parsePrice(depositAmount) : 0, depositDue = depositType === "percentage" ? total * depositValue / 100 : depositType === "fixed" ? depositValue : 0, hasDeposit = depositDue > 0, balance = Math.max(0, total - depositDue), rowClass = cn("flex items-center justify-between", classNames?.row), labelClass = cn("text-muted-foreground", classNames?.label), valueClass = cn("font-medium", classNames?.value);
|
|
6660
6663
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6661
6664
|
"div",
|
|
6662
6665
|
{
|
|
@@ -7288,7 +7291,7 @@ function InputField({
|
|
|
7288
7291
|
currency,
|
|
7289
7292
|
classNames
|
|
7290
7293
|
}) {
|
|
7291
|
-
let hasPriceAdjustment = field.price_adjustment != null &&
|
|
7294
|
+
let hasPriceAdjustment = field.price_adjustment != null && chunkQOCHWR4V_js.parsePrice(field.price_adjustment) > 0;
|
|
7292
7295
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
7293
7296
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
7294
7297
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -8290,12 +8293,12 @@ function ProductCustomizerContent({
|
|
|
8290
8293
|
new Set(selectedAddOnOptionIds.map((id) => id.trim()).filter(Boolean))
|
|
8291
8294
|
).sort(), [selectedAddOnOptionIds]), localTotalPrice = React14.useMemo(() => {
|
|
8292
8295
|
if (isComposite && compositePrice)
|
|
8293
|
-
return
|
|
8296
|
+
return chunkQOCHWR4V_js.parsePrice(compositePrice.final_price) * quantity;
|
|
8294
8297
|
if (isBundle && bundleTotalPrice != null)
|
|
8295
8298
|
return bundleTotalPrice * quantity;
|
|
8296
|
-
let price =
|
|
8299
|
+
let price = chunkQOCHWR4V_js.getVariantUnitPrice(product, selectedVariant);
|
|
8297
8300
|
for (let option of selectedAddOnOptions)
|
|
8298
|
-
option.default_price && (price +=
|
|
8301
|
+
option.default_price && (price += chunkQOCHWR4V_js.parsePrice(option.default_price));
|
|
8299
8302
|
return price * quantity;
|
|
8300
8303
|
}, [
|
|
8301
8304
|
product.default_price,
|
|
@@ -8347,9 +8350,9 @@ function ProductCustomizerContent({
|
|
|
8347
8350
|
isExpired: isQuoteExpired2
|
|
8348
8351
|
} = useQuote(quoteInput, {
|
|
8349
8352
|
enabled: quoteEnabled
|
|
8350
|
-
}), currency = quote?.currency ??
|
|
8353
|
+
}), quotedPriceInfo = quote?.quoted_total_price_info ?? quote?.final_price_info, currency = quote?.currency ?? quotedPriceInfo?.currency ?? chunkQOCHWR4V_js.getProductCurrency(product), quoteId = quote?.quote_id, quotedUnitPrice = quotedPriceInfo?.final_price, quotedTotalPrice = React14.useMemo(() => {
|
|
8351
8354
|
if (quotedUnitPrice != null)
|
|
8352
|
-
return
|
|
8355
|
+
return chunkQOCHWR4V_js.parsePrice(quotedUnitPrice) * quantity;
|
|
8353
8356
|
}, [quotedUnitPrice, quantity]), quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2, validationMessage = quoteEnabled ? quoteError ? QUOTE_UNAVAILABLE_MESSAGE : quoteIsReady ? null : QUOTE_LOADING_MESSAGE : REQUIRED_OPTIONS_MESSAGE, displayTotalPrice = React14.useMemo(() => {
|
|
8354
8357
|
let total = quotedTotalPrice ?? localTotalPrice, multiplier = chunkZF7JCXCI_js.serviceBillingMultiplier(product, {
|
|
8355
8358
|
quantity,
|
|
@@ -8555,7 +8558,7 @@ function ProductCustomizerContent({
|
|
|
8555
8558
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
|
|
8556
8559
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
8557
8560
|
"Deposit required: ",
|
|
8558
|
-
|
|
8561
|
+
chunkQOCHWR4V_js.parsePrice(product.deposit_amount),
|
|
8559
8562
|
"%"
|
|
8560
8563
|
] })
|
|
8561
8564
|
}
|
|
@@ -8663,10 +8666,10 @@ function ProductCustomizerContent({
|
|
|
8663
8666
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8664
8667
|
Price,
|
|
8665
8668
|
{
|
|
8666
|
-
amount:
|
|
8669
|
+
amount: chunkQOCHWR4V_js.getUnitPriceAtQuantity(
|
|
8667
8670
|
product.quantity_pricing,
|
|
8668
8671
|
quantity,
|
|
8669
|
-
|
|
8672
|
+
chunkQOCHWR4V_js.parsePrice(product.default_price)
|
|
8670
8673
|
),
|
|
8671
8674
|
currency,
|
|
8672
8675
|
className: "font-medium text-foreground"
|
|
@@ -9087,7 +9090,7 @@ function CartLineItemRow({
|
|
|
9087
9090
|
product: item.product,
|
|
9088
9091
|
variant: item.variant,
|
|
9089
9092
|
addOnOptions: item.addOnOptions
|
|
9090
|
-
}), pinnedUnitPrice = item._quotedUnitPrice, unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice :
|
|
9093
|
+
}), pinnedUnitPrice = item._quotedUnitPrice, unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice : chunkQOCHWR4V_js.parsePrice(pinnedUnitPrice), hasComposite = item.compositeSelections && item.compositeSelections.length > 0, hasBundle = item.bundleSelections && item.bundleSelections.length > 0, isOptimistic2 = item.isOptimistic === true, lineTotal = chunkQOCHWR4V_js.parsePrice(unitPrice) * item.quantity, imageUrl = item.product.image_url, variantLabel2 = item.variant ? chunkZF7JCXCI_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
9091
9094
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9092
9095
|
"div",
|
|
9093
9096
|
{
|
|
@@ -9372,7 +9375,7 @@ function CartSummary({
|
|
|
9372
9375
|
currency,
|
|
9373
9376
|
removeItem,
|
|
9374
9377
|
updateQuantity
|
|
9375
|
-
} = useCart(), displayCurrency = serverCart?.currency ??
|
|
9378
|
+
} = useCart(), displayCurrency = serverCart?.currency ?? (currency === null ? null : chunkNFXCKTE2_js.currencyCode(currency)), deliveryFee = serverCart?.delivery_fee, serviceCharge = serverCart?.service_charge, totalDiscounts = serverCart?.total_discounts, handleRemove = (itemId) => {
|
|
9376
9379
|
onItemRemove ? onItemRemove(itemId) : removeItem(itemId);
|
|
9377
9380
|
}, handleQuantityChange = (itemId, qty) => {
|
|
9378
9381
|
onQuantityChange ? onQuantityChange(itemId, qty) : updateQuantity(itemId, qty);
|
|
@@ -9422,7 +9425,7 @@ function CartSummary({
|
|
|
9422
9425
|
]
|
|
9423
9426
|
}
|
|
9424
9427
|
),
|
|
9425
|
-
totalDiscounts != null &&
|
|
9428
|
+
totalDiscounts != null && chunkQOCHWR4V_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9426
9429
|
"div",
|
|
9427
9430
|
{
|
|
9428
9431
|
"data-cimplify-cart-discount": true,
|
|
@@ -9448,7 +9451,7 @@ function CartSummary({
|
|
|
9448
9451
|
className: cn("flex items-baseline justify-between", classNames?.deliveryFee),
|
|
9449
9452
|
children: [
|
|
9450
9453
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
9451
|
-
|
|
9454
|
+
chunkQOCHWR4V_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
9452
9455
|
Price,
|
|
9453
9456
|
{
|
|
9454
9457
|
amount: deliveryFee,
|
|
@@ -9459,7 +9462,7 @@ function CartSummary({
|
|
|
9459
9462
|
]
|
|
9460
9463
|
}
|
|
9461
9464
|
),
|
|
9462
|
-
serviceCharge != null &&
|
|
9465
|
+
serviceCharge != null && chunkQOCHWR4V_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9463
9466
|
"div",
|
|
9464
9467
|
{
|
|
9465
9468
|
"data-cimplify-cart-service-charge": true,
|
|
@@ -9589,11 +9592,11 @@ function SaleBadge({
|
|
|
9589
9592
|
className,
|
|
9590
9593
|
classNames
|
|
9591
9594
|
}) {
|
|
9592
|
-
let onSale =
|
|
9595
|
+
let onSale = chunkQOCHWR4V_js.isOnSale(product), hasDeal = dealInfo !== void 0;
|
|
9593
9596
|
if (!hasDeal && !onSale && !label)
|
|
9594
9597
|
return null;
|
|
9595
9598
|
let percentage = null;
|
|
9596
|
-
product.sale ? percentage =
|
|
9599
|
+
product.sale ? percentage = chunkQOCHWR4V_js.parsePrice(product.sale.percent_off) : hasDeal && dealInfo.benefit_type === "percentage" ? percentage = chunkQOCHWR4V_js.parsePrice(dealInfo.value) : onSale && (percentage = chunkQOCHWR4V_js.getDiscountPercentage(product));
|
|
9597
9600
|
let badgeText = label ?? product.sale?.badge_text ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
9598
9601
|
return badgeText ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9599
9602
|
"span",
|
|
@@ -9608,7 +9611,7 @@ function SaleBadge({
|
|
|
9608
9611
|
"%"
|
|
9609
9612
|
] }),
|
|
9610
9613
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
9611
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
9614
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkQOCHWR4V_js.getBasePrice(product), currency: chunkQOCHWR4V_js.getProductCurrency(product) }) })
|
|
9612
9615
|
]
|
|
9613
9616
|
}
|
|
9614
9617
|
) : null;
|
|
@@ -9625,7 +9628,7 @@ function SalePrice({
|
|
|
9625
9628
|
}) {
|
|
9626
9629
|
if (!sale)
|
|
9627
9630
|
return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
|
|
9628
|
-
let off = Math.round(
|
|
9631
|
+
let off = Math.round(chunkQOCHWR4V_js.parsePrice(sale.percent_off));
|
|
9629
9632
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9630
9633
|
"span",
|
|
9631
9634
|
{
|
|
@@ -9960,7 +9963,7 @@ function ProductSheet({
|
|
|
9960
9963
|
Price,
|
|
9961
9964
|
{
|
|
9962
9965
|
amount: fullProduct.default_price,
|
|
9963
|
-
currency:
|
|
9966
|
+
currency: chunkQOCHWR4V_js.getProductCurrency(fullProduct),
|
|
9964
9967
|
className: classNames?.price
|
|
9965
9968
|
}
|
|
9966
9969
|
)
|
|
@@ -10118,10 +10121,10 @@ function SoldOutOverlay() {
|
|
|
10118
10121
|
function SaleBadge2({ product }) {
|
|
10119
10122
|
let label = null;
|
|
10120
10123
|
if (product.sale) {
|
|
10121
|
-
let off = Math.round(
|
|
10124
|
+
let off = Math.round(chunkQOCHWR4V_js.parsePrice(product.sale.percent_off));
|
|
10122
10125
|
label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
|
|
10123
|
-
} else if (
|
|
10124
|
-
let pct =
|
|
10126
|
+
} else if (chunkQOCHWR4V_js.isOnSale(product)) {
|
|
10127
|
+
let pct = chunkQOCHWR4V_js.getDiscountPercentage(product);
|
|
10125
10128
|
label = pct && pct > 0 ? `-${pct}%` : null;
|
|
10126
10129
|
}
|
|
10127
10130
|
return label ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: label }) : null;
|
|
@@ -10155,7 +10158,7 @@ function FoodProductCard({
|
|
|
10155
10158
|
renderLink,
|
|
10156
10159
|
className
|
|
10157
10160
|
}) {
|
|
10158
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10161
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), tags = product.tags || [], isSignature = product.metadata?.is_signature === true, isNew = product.metadata?.is_new === true, isComposite = product.type === chunkZF7JCXCI_js.PRODUCT_TYPE.Composite;
|
|
10159
10162
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10160
10163
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
10161
10164
|
isSignature && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute top-3 left-3 inline-flex items-center gap-1 text-[11px] font-semibold tracking-wide bg-amber-50 text-amber-700 border border-amber-200/60 px-2 py-0.5 rounded-md", children: [
|
|
@@ -10201,7 +10204,7 @@ function RetailProductCard({
|
|
|
10201
10204
|
renderLink,
|
|
10202
10205
|
className
|
|
10203
10206
|
}) {
|
|
10204
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10207
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), outOfStock = product.inventory_status?.in_stock === false, onSale = chunkQOCHWR4V_js.isOnSale(product), swatches = getColorSwatches(product);
|
|
10205
10208
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
10206
10209
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
10207
10210
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "3/4", renderImage, children: [
|
|
@@ -10221,7 +10224,7 @@ function RetailProductCard({
|
|
|
10221
10224
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
|
|
10222
10225
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10223
10226
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
10224
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
10227
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkQOCHWR4V_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
|
|
10225
10228
|
] }) }),
|
|
10226
10229
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10227
10230
|
"span",
|
|
@@ -10236,8 +10239,8 @@ function RetailProductCard({
|
|
|
10236
10239
|
] });
|
|
10237
10240
|
}
|
|
10238
10241
|
function PriceRange({ product, currency, className }) {
|
|
10239
|
-
let resolvedCurrency = currency ??
|
|
10240
|
-
return range ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
10242
|
+
let resolvedCurrency = currency ?? chunkQOCHWR4V_js.getProductCurrency(product), range = chunkQOCHWR4V_js.getPriceRange(product);
|
|
10243
|
+
return range ? /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkQOCHWR4V_js.formatPriceRange(range.min, range.max, resolvedCurrency) }) : null;
|
|
10241
10244
|
}
|
|
10242
10245
|
function WholesaleProductCard({
|
|
10243
10246
|
product,
|
|
@@ -10246,7 +10249,7 @@ function WholesaleProductCard({
|
|
|
10246
10249
|
renderLink,
|
|
10247
10250
|
className
|
|
10248
10251
|
}) {
|
|
10249
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10252
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1, status = product.inventory_status;
|
|
10250
10253
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10251
10254
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
10252
10255
|
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-zinc-800 text-white px-2 py-0.5 rounded-md", children: [
|
|
@@ -10291,7 +10294,7 @@ function DigitalProductCard({
|
|
|
10291
10294
|
renderLink,
|
|
10292
10295
|
className
|
|
10293
10296
|
}) {
|
|
10294
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10297
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null, isTicket = product.digital_type === "ticket";
|
|
10295
10298
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10296
10299
|
/* @__PURE__ */ jsxRuntime.jsx(CardImage, { src: image, alt: product.name, aspectRatio: "4/3", renderImage, children: typeBadge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: `absolute top-3 left-3 text-[11px] font-semibold tracking-wide border px-2 py-0.5 rounded-md ${typeBadge.color}`, children: typeBadge.label }) }),
|
|
10297
10300
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3.5", children: [
|
|
@@ -10319,7 +10322,7 @@ function BundleProductCard({
|
|
|
10319
10322
|
renderLink,
|
|
10320
10323
|
className
|
|
10321
10324
|
}) {
|
|
10322
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10325
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), components = product.components || [], componentCount = components.length, onSale = chunkQOCHWR4V_js.isOnSale(product), discount = chunkQOCHWR4V_js.getDiscountPercentage(product), hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
10323
10326
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10324
10327
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
10325
10328
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-indigo-50 text-indigo-700 border border-indigo-200/60 px-2 py-0.5 rounded-md", children: "Bundle" }),
|
|
@@ -10345,7 +10348,7 @@ function BundleProductCard({
|
|
|
10345
10348
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
10346
10349
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
10347
10350
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10348
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
10351
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkQOCHWR4V_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
|
|
10349
10352
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
10350
10353
|
"Save ",
|
|
10351
10354
|
discount,
|
|
@@ -10364,7 +10367,7 @@ function CompositeProductCard({
|
|
|
10364
10367
|
renderLink,
|
|
10365
10368
|
className
|
|
10366
10369
|
}) {
|
|
10367
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10370
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), groups = product.groups || [], groupCount = groups.length; groups.reduce((sum, g) => sum + g.components.length, 0); let tags = product.tags || [];
|
|
10368
10371
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10369
10372
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
10370
10373
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-violet-50 text-violet-700 border border-violet-200/60 px-2 py-0.5 rounded-md", children: "Build Your Own" }),
|
|
@@ -10410,7 +10413,7 @@ function StandardServiceCard({
|
|
|
10410
10413
|
renderLink,
|
|
10411
10414
|
className
|
|
10412
10415
|
}) {
|
|
10413
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10416
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
10414
10417
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10415
10418
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
10416
10419
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
@@ -10460,7 +10463,7 @@ function CompactServiceCard({
|
|
|
10460
10463
|
renderLink,
|
|
10461
10464
|
className
|
|
10462
10465
|
}) {
|
|
10463
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10466
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount, hasBillingPlans = product.billing_plans && product.billing_plans.length > 0, href = `/products/${product.slug}`, content = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 p-3", children: [
|
|
10464
10467
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[72px] h-[72px] rounded-xl overflow-hidden bg-muted shrink-0", children: renderImage ? renderImage({ src: image, alt: product.name, className: "w-full h-full object-cover" }) : image ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: image, alt: product.name, className: "w-full h-full object-cover" }) : null }),
|
|
10465
10468
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
10466
10469
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[14px] font-semibold text-foreground leading-tight truncate", children: product.name }),
|
|
@@ -10500,7 +10503,7 @@ function ScheduleServiceCard({
|
|
|
10500
10503
|
renderLink,
|
|
10501
10504
|
className
|
|
10502
10505
|
}) {
|
|
10503
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10506
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), href = `/products/${product.slug}`, durationLabel = product.duration_minutes != null ? formatDuration2(product.duration_minutes, product.duration_unit) : null, displaySlots = (slots || []).slice(0, 3), shellClass = cn(
|
|
10504
10507
|
"group block text-left cursor-pointer bg-card rounded-[14px] overflow-hidden",
|
|
10505
10508
|
"shadow-[0_1px_3px_rgba(0,0,0,0.04),0_6px_24px_rgba(0,0,0,0.06)]",
|
|
10506
10509
|
"transition-all duration-300 ease-[cubic-bezier(0.19,1,0.22,1)]",
|
|
@@ -10561,7 +10564,7 @@ function RentalServiceCard({
|
|
|
10561
10564
|
renderLink,
|
|
10562
10565
|
className
|
|
10563
10566
|
}) {
|
|
10564
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10567
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount, unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "day", priceUnit = product.price_basis === "per_person" ? "guest" : product.price_basis === "flat" ? "" : unit, status = product.inventory_status;
|
|
10565
10568
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10566
10569
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
10567
10570
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
@@ -10624,7 +10627,7 @@ function AccommodationCard({
|
|
|
10624
10627
|
renderLink,
|
|
10625
10628
|
className
|
|
10626
10629
|
}) {
|
|
10627
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10630
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1, cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null, tags = product.tags || [];
|
|
10628
10631
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10629
10632
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
10630
10633
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
@@ -10684,7 +10687,7 @@ function LeaseServiceCard({
|
|
|
10684
10687
|
renderLink,
|
|
10685
10688
|
className
|
|
10686
10689
|
}) {
|
|
10687
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10690
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount, hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1, unit = product.duration_unit ? UNIT_LABELS3[product.duration_unit] || product.duration_unit : "mo", tags = product.tags || [], cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
10688
10691
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10689
10692
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
10690
10693
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
@@ -10750,7 +10753,7 @@ function SubscriptionCard({
|
|
|
10750
10753
|
renderLink,
|
|
10751
10754
|
className
|
|
10752
10755
|
}) {
|
|
10753
|
-
let image = product.image_url || product.images?.[0] || "", currency =
|
|
10756
|
+
let image = product.image_url || product.images?.[0] || "", currency = chunkQOCHWR4V_js.getProductCurrency(product), plans = product.billing_plans || [], primaryPlan = plans[0], frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo", hasTrial = primaryPlan?.trial_days != null && primaryPlan.trial_days > 0, tags = product.tags || [];
|
|
10754
10757
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
10755
10758
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
10756
10759
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
@@ -10908,7 +10911,7 @@ function ProductCard({
|
|
|
10908
10911
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
|
|
10909
10912
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
|
|
10910
10913
|
descriptionPreview && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-description": true, className: cn("text-sm text-muted-foreground line-clamp-2", classNames?.description), children: descriptionPreview }),
|
|
10911
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency:
|
|
10914
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunkQOCHWR4V_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
|
|
10912
10915
|
] })
|
|
10913
10916
|
] });
|
|
10914
10917
|
})();
|
|
@@ -11209,11 +11212,39 @@ function SearchInput({
|
|
|
11209
11212
|
alt: "",
|
|
11210
11213
|
"data-cimplify-search-result-image": true,
|
|
11211
11214
|
className: classNames?.resultImage,
|
|
11212
|
-
style: {
|
|
11215
|
+
style: {
|
|
11216
|
+
width: "2rem",
|
|
11217
|
+
height: "2rem",
|
|
11218
|
+
objectFit: "cover",
|
|
11219
|
+
borderRadius: "0.25rem",
|
|
11220
|
+
flexShrink: 0
|
|
11221
|
+
}
|
|
11213
11222
|
}
|
|
11214
11223
|
),
|
|
11215
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11216
|
-
|
|
11224
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11225
|
+
"span",
|
|
11226
|
+
{
|
|
11227
|
+
"data-cimplify-search-result-name": true,
|
|
11228
|
+
className: classNames?.resultName,
|
|
11229
|
+
style: { flex: 1, textAlign: "left" },
|
|
11230
|
+
children: product.name
|
|
11231
|
+
}
|
|
11232
|
+
),
|
|
11233
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11234
|
+
"span",
|
|
11235
|
+
{
|
|
11236
|
+
"data-cimplify-search-result-price": true,
|
|
11237
|
+
className: classNames?.resultPrice,
|
|
11238
|
+
style: { flexShrink: 0 },
|
|
11239
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11240
|
+
Price,
|
|
11241
|
+
{
|
|
11242
|
+
amount: product.default_price,
|
|
11243
|
+
currency: chunkQOCHWR4V_js.getProductCurrency(product)
|
|
11244
|
+
}
|
|
11245
|
+
)
|
|
11246
|
+
}
|
|
11247
|
+
)
|
|
11217
11248
|
] })
|
|
11218
11249
|
},
|
|
11219
11250
|
product.id
|
|
@@ -11660,19 +11691,19 @@ function OrderSummary({
|
|
|
11660
11691
|
order.customer_notes.map((note, index2) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index2))
|
|
11661
11692
|
] }),
|
|
11662
11693
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
11663
|
-
order.total_discount != null &&
|
|
11694
|
+
order.total_discount != null && chunkQOCHWR4V_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
11664
11695
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
11665
11696
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
11666
11697
|
] }),
|
|
11667
|
-
order.delivery_fee != null &&
|
|
11698
|
+
order.delivery_fee != null && chunkQOCHWR4V_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
11668
11699
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
11669
11700
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
11670
11701
|
] }),
|
|
11671
|
-
order.service_charge != null &&
|
|
11702
|
+
order.service_charge != null && chunkQOCHWR4V_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
11672
11703
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
11673
11704
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
11674
11705
|
] }),
|
|
11675
|
-
order.tax != null &&
|
|
11706
|
+
order.tax != null && chunkQOCHWR4V_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
11676
11707
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
11677
11708
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
11678
11709
|
] }),
|
|
@@ -12161,7 +12192,7 @@ function BookingPage({
|
|
|
12161
12192
|
className,
|
|
12162
12193
|
classNames
|
|
12163
12194
|
}) {
|
|
12164
|
-
let { addItem } = useCart(), { client } = useCimplifyClient(), currency = service.currency, isReschedule = existingBooking !== void 0, [step, setStep] = React14.useState(STEP.SELECT_SLOT), [selectedSlot, setSelectedSlot] = React14.useState(null), [selectedDate, setSelectedDate] = React14.useState(null), [selectedStaffId, setSelectedStaffId] = React14.useState(null), [selectedResourceId, setSelectedResourceId] = React14.useState(null), [bookingUnits, setBookingUnits] = React14.useState(1), [isSubmitting, setIsSubmitting] = React14.useState(false), [error, setError] = React14.useState(null), hasResourceStep = resources && resources.length > 0, hasStaffStep = staff && staff.length > 0, depositType = product?.deposit_type, depositAmount = product?.deposit_amount, hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
12195
|
+
let { addItem } = useCart(), { client } = useCimplifyClient(), currency = service.currency, isReschedule = existingBooking !== void 0, [step, setStep] = React14.useState(STEP.SELECT_SLOT), [selectedSlot, setSelectedSlot] = React14.useState(null), [selectedDate, setSelectedDate] = React14.useState(null), [selectedStaffId, setSelectedStaffId] = React14.useState(null), [selectedResourceId, setSelectedResourceId] = React14.useState(null), [bookingUnits, setBookingUnits] = React14.useState(1), [isSubmitting, setIsSubmitting] = React14.useState(false), [error, setError] = React14.useState(null), hasResourceStep = resources && resources.length > 0, hasStaffStep = staff && staff.length > 0, depositType = product?.deposit_type, depositAmount = product?.deposit_amount, hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkQOCHWR4V_js.parsePrice(depositAmount) !== 0, cancellationMinutes = product?.cancellation_window_minutes, noShowFee = product?.no_show_fee, handleSlotSelect = React14.useCallback(
|
|
12165
12196
|
(slot, date) => {
|
|
12166
12197
|
setSelectedSlot(slot), setSelectedDate(date), setError(null), setStep(hasResourceStep ? STEP.SELECT_RESOURCE : hasStaffStep ? STEP.SELECT_STAFF : STEP.CONFIRM);
|
|
12167
12198
|
},
|
|
@@ -12258,14 +12289,14 @@ function BookingPage({
|
|
|
12258
12289
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price, currency }) }),
|
|
12259
12290
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
12260
12291
|
"Deposit: ",
|
|
12261
|
-
depositType === "percentage" ? `${
|
|
12292
|
+
depositType === "percentage" ? `${chunkQOCHWR4V_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
|
|
12262
12293
|
] }),
|
|
12263
12294
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
12264
12295
|
"Free cancellation up to ",
|
|
12265
12296
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
12266
12297
|
" before"
|
|
12267
12298
|
] }),
|
|
12268
|
-
noShowFee !== void 0 &&
|
|
12299
|
+
noShowFee !== void 0 && chunkQOCHWR4V_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
12269
12300
|
"No-show fee: ",
|
|
12270
12301
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee, currency })
|
|
12271
12302
|
] })
|
|
@@ -12368,7 +12399,7 @@ function BookingPage({
|
|
|
12368
12399
|
] }),
|
|
12369
12400
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
12370
12401
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
12371
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
12402
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkQOCHWR4V_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
|
|
12372
12403
|
] })
|
|
12373
12404
|
] }),
|
|
12374
12405
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -12987,7 +13018,7 @@ function DefaultProductLayout({
|
|
|
12987
13018
|
showRelated = true,
|
|
12988
13019
|
className
|
|
12989
13020
|
}) {
|
|
12990
|
-
let [selectedVariantId, setSelectedVariantId] = React14__default.default.useState(), images = chunkZF7JCXCI_js.resolveGallery(product, selectedVariantId), currency =
|
|
13021
|
+
let [selectedVariantId, setSelectedVariantId] = React14__default.default.useState(), images = chunkZF7JCXCI_js.resolveGallery(product, selectedVariantId), currency = chunkQOCHWR4V_js.getProductCurrency(product), hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1, onSale = chunkQOCHWR4V_js.isOnSale(product), hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
12991
13022
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
12992
13023
|
renderBreadcrumb?.(product),
|
|
12993
13024
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13009,13 +13040,13 @@ function DefaultProductLayout({
|
|
|
13009
13040
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, currency, className: "text-2xl font-extrabold" }) : product.sale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13010
13041
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
|
|
13011
13042
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
|
|
13012
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: product.sale.badge_text ?? `${Math.round(
|
|
13043
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: product.sale.badge_text ?? `${Math.round(chunkQOCHWR4V_js.parsePrice(product.sale.percent_off))}% OFF` })
|
|
13013
13044
|
] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13014
13045
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
|
|
13015
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
13046
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkQOCHWR4V_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
|
|
13016
13047
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
13017
13048
|
"Save ",
|
|
13018
|
-
|
|
13049
|
+
chunkQOCHWR4V_js.getDiscountPercentage(product),
|
|
13019
13050
|
"%"
|
|
13020
13051
|
] })
|
|
13021
13052
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-semibold" }) }),
|
|
@@ -13076,7 +13107,7 @@ function FoodProductLayout({
|
|
|
13076
13107
|
showRelated = true,
|
|
13077
13108
|
className
|
|
13078
13109
|
}) {
|
|
13079
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13110
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), tags = product.tags || [], ingredients = getMetadataStringList(product.metadata, "ingredients"), pairings = getMetadataStringList(product.metadata, "pairings");
|
|
13080
13111
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "food", className: cn("space-y-8", className), children: [
|
|
13081
13112
|
renderBreadcrumb?.(product),
|
|
13082
13113
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13147,7 +13178,7 @@ function WholesaleProductLayout({
|
|
|
13147
13178
|
showRelated = true,
|
|
13148
13179
|
className
|
|
13149
13180
|
}) {
|
|
13150
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13181
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
13151
13182
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
|
|
13152
13183
|
renderBreadcrumb?.(product),
|
|
13153
13184
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13229,7 +13260,7 @@ function ServiceProductLayout({
|
|
|
13229
13260
|
showRelated = true,
|
|
13230
13261
|
className
|
|
13231
13262
|
}) {
|
|
13232
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13263
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount, depositAmount = hasDeposit ? chunkQOCHWR4V_js.parsePrice(product.deposit_amount) : 0, cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
13233
13264
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
13234
13265
|
renderBreadcrumb?.(product),
|
|
13235
13266
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13296,7 +13327,7 @@ function ServiceProductLayout({
|
|
|
13296
13327
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency, className: "font-medium text-foreground" }),
|
|
13297
13328
|
" deposit charged at booking"
|
|
13298
13329
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13299
|
-
|
|
13330
|
+
chunkQOCHWR4V_js.parsePrice(product.deposit_amount),
|
|
13300
13331
|
"% deposit charged at booking"
|
|
13301
13332
|
] }) })
|
|
13302
13333
|
] })
|
|
@@ -13327,7 +13358,7 @@ function DigitalProductLayout({
|
|
|
13327
13358
|
showRelated = true,
|
|
13328
13359
|
className
|
|
13329
13360
|
}) {
|
|
13330
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13361
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product", isTicket = product.digital_type === "ticket", isAccessPass = product.digital_type === "access_grant", isDownload = product.digital_type === "download" || product.digital_type === "license_key";
|
|
13331
13362
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "digital", className: cn("space-y-8", className), children: [
|
|
13332
13363
|
renderBreadcrumb?.(product),
|
|
13333
13364
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13449,10 +13480,10 @@ function BundleProductLayout({
|
|
|
13449
13480
|
showRelated = true,
|
|
13450
13481
|
className
|
|
13451
13482
|
}) {
|
|
13452
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13453
|
-
(sum, c) => sum +
|
|
13483
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), components = product.components || [], onSale = chunkQOCHWR4V_js.isOnSale(product), discount = chunkQOCHWR4V_js.getDiscountPercentage(product), baseTotal = components.reduce(
|
|
13484
|
+
(sum, c) => sum + chunkQOCHWR4V_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
13454
13485
|
0
|
|
13455
|
-
), bundlePrice =
|
|
13486
|
+
), bundlePrice = chunkQOCHWR4V_js.parsePrice(product.default_price), savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
13456
13487
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
13457
13488
|
renderBreadcrumb?.(product),
|
|
13458
13489
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13526,7 +13557,7 @@ function CompositeProductLayout({
|
|
|
13526
13557
|
showRelated = true,
|
|
13527
13558
|
className
|
|
13528
13559
|
}) {
|
|
13529
|
-
let images = product.images || (product.image_url ? [product.image_url] : []), currency =
|
|
13560
|
+
let images = product.images || (product.image_url ? [product.image_url] : []), currency = chunkQOCHWR4V_js.getProductCurrency(product), groups = product.groups || [];
|
|
13530
13561
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "composite", className: cn("space-y-8", className), children: [
|
|
13531
13562
|
renderBreadcrumb?.(product),
|
|
13532
13563
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -13865,7 +13896,7 @@ function CartDrawer({
|
|
|
13865
13896
|
freeShippingThreshold = 0,
|
|
13866
13897
|
className
|
|
13867
13898
|
}) {
|
|
13868
|
-
let { isOpen, close } = useCartDrawer(), cart = useCart(), subtotalNum =
|
|
13899
|
+
let { isOpen, close } = useCartDrawer(), cart = useCart(), subtotalNum = chunkQOCHWR4V_js.parsePrice(cart.subtotal), animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
13869
13900
|
React14.useEffect(() => {
|
|
13870
13901
|
if (!isOpen) return;
|
|
13871
13902
|
let original = document.body.style.overflow;
|
|
@@ -14227,7 +14258,7 @@ function CatalogueCollectionLayout({
|
|
|
14227
14258
|
(p) => p.name.toLowerCase().includes(q) || p.description?.toLowerCase().includes(q)
|
|
14228
14259
|
);
|
|
14229
14260
|
}
|
|
14230
|
-
return activeCategory && (result = result.filter((p) => p.tags?.includes(activeCategory))), sortBy === "price-asc" ? result = [...result].sort((a, b) =>
|
|
14261
|
+
return activeCategory && (result = result.filter((p) => p.tags?.includes(activeCategory))), sortBy === "price-asc" ? result = [...result].sort((a, b) => chunkQOCHWR4V_js.parsePrice(a.default_price) - chunkQOCHWR4V_js.parsePrice(b.default_price)) : sortBy === "price-desc" ? result = [...result].sort((a, b) => chunkQOCHWR4V_js.parsePrice(b.default_price) - chunkQOCHWR4V_js.parsePrice(a.default_price)) : sortBy === "name" && (result = [...result].sort((a, b) => a.name.localeCompare(b.name))), result;
|
|
14231
14262
|
}, [products, searchQuery, activeCategory, sortBy]);
|
|
14232
14263
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-collection-layout": "catalogue", className: cn("space-y-6", className), children: [
|
|
14233
14264
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -18139,16 +18170,16 @@ var COLOR = {
|
|
|
18139
18170
|
hairline: "#EDEEF1",
|
|
18140
18171
|
surface: "#FFFFFF",
|
|
18141
18172
|
fill: "#F1F1F3",
|
|
18142
|
-
accent: "#
|
|
18173
|
+
accent: "#FFE01A",
|
|
18143
18174
|
accentWash: "#FDF3DF",
|
|
18144
|
-
accentInk: "#
|
|
18175
|
+
accentInk: "#7A6300",
|
|
18145
18176
|
danger: "#C2410C",
|
|
18146
18177
|
iconDisabled: "#C4C8D0",
|
|
18147
|
-
onAccent: "#
|
|
18178
|
+
onAccent: "#141413",
|
|
18148
18179
|
transparent: "transparent"
|
|
18149
18180
|
}, SHADOW = {
|
|
18150
|
-
sheet: "0 12px 32px #
|
|
18151
|
-
form: "0 8px 24px #
|
|
18181
|
+
sheet: "0 12px 32px #14141314",
|
|
18182
|
+
form: "0 8px 24px #1414130F",
|
|
18152
18183
|
segment: "0 1px 3px #14161C1A",
|
|
18153
18184
|
knob: "0 2px 4px #0000001F",
|
|
18154
18185
|
focusRing: `0 0 0 4px ${COLOR.accentWash}`,
|
|
@@ -19302,7 +19333,7 @@ function toneChip(value) {
|
|
|
19302
19333
|
}
|
|
19303
19334
|
}
|
|
19304
19335
|
function money(amount, currency) {
|
|
19305
|
-
return
|
|
19336
|
+
return chunkQOCHWR4V_js.formatPrice(chunkQOCHWR4V_js.parsePrice(num(amount) ?? 0), text3(currency));
|
|
19306
19337
|
}
|
|
19307
19338
|
var CHAT_GENUI_COMPONENTS = {
|
|
19308
19339
|
Stack: ({ node, ctx }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -19427,7 +19458,10 @@ var CHAT_GENUI_COMPONENTS = {
|
|
|
19427
19458
|
{
|
|
19428
19459
|
role: action ? "button" : void 0,
|
|
19429
19460
|
onClick: action ? () => ctx.onAction({ action, label: title }) : void 0,
|
|
19430
|
-
className: cn(
|
|
19461
|
+
className: cn(
|
|
19462
|
+
"flex items-center gap-2.5 py-1",
|
|
19463
|
+
action && "cursor-pointer active:opacity-70"
|
|
19464
|
+
),
|
|
19431
19465
|
children: [
|
|
19432
19466
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 grow flex-col", children: [
|
|
19433
19467
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium text-foreground", children: title }),
|
|
@@ -19540,7 +19574,7 @@ function ReplyCardView({
|
|
|
19540
19574
|
card.image_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
|
|
19541
19575
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
19542
19576
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
|
|
19543
|
-
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children:
|
|
19577
|
+
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunkQOCHWR4V_js.formatPrice(chunkQOCHWR4V_js.parsePrice(card.price), currency) }),
|
|
19544
19578
|
fire2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
|
|
19545
19579
|
] })
|
|
19546
19580
|
]
|
|
@@ -19600,7 +19634,7 @@ function ChatWidget({
|
|
|
19600
19634
|
className,
|
|
19601
19635
|
classNames
|
|
19602
19636
|
}) {
|
|
19603
|
-
let context = useOptionalCimplifyClient(), client = clientProp ?? context?.client, businessName = businessNameProp ?? context?.business?.name ?? "Support", currency = currencyProp ?? context?.baseCurrency, [open, setOpen] = React14.useState(defaultOpen), [readAt, setReadAt] = React14.useState(null), [attachError, setAttachError] = React14.useState(null), [replyTo, setReplyTo] = React14.useState(null), {
|
|
19637
|
+
let context = useOptionalCimplifyClient(), client = clientProp ?? context?.client, businessName = businessNameProp ?? context?.business?.name ?? "Support", currency = currencyProp ?? context?.baseCurrency ?? void 0, [open, setOpen] = React14.useState(defaultOpen), [readAt, setReadAt] = React14.useState(null), [attachError, setAttachError] = React14.useState(null), [replyTo, setReplyTo] = React14.useState(null), {
|
|
19604
19638
|
messages,
|
|
19605
19639
|
isLoading,
|
|
19606
19640
|
isSending,
|
|
@@ -19623,12 +19657,12 @@ function ChatWidget({
|
|
|
19623
19657
|
if (!client) return;
|
|
19624
19658
|
if (setAttachError(null), !isAllowedAttachment(file)) {
|
|
19625
19659
|
setAttachError(
|
|
19626
|
-
new
|
|
19660
|
+
new chunkNFXCKTE2_js.CimplifyError("invalid_attachment", "Only photos and documents can be attached.")
|
|
19627
19661
|
);
|
|
19628
19662
|
return;
|
|
19629
19663
|
}
|
|
19630
19664
|
if (file.size > MAX_ATTACHMENT_BYTES) {
|
|
19631
|
-
setAttachError(new
|
|
19665
|
+
setAttachError(new chunkNFXCKTE2_js.CimplifyError("attachment_too_large", "Files must be under 25MB."));
|
|
19632
19666
|
return;
|
|
19633
19667
|
}
|
|
19634
19668
|
let uploaded = await client.uploads.upload(file);
|
|
@@ -19653,9 +19687,7 @@ function ChatWidget({
|
|
|
19653
19687
|
return setReplyTo(null), send(content, target ? { replyTo: target } : void 0);
|
|
19654
19688
|
},
|
|
19655
19689
|
[send, replyTo]
|
|
19656
|
-
), unread = open ? 0 : messages.filter(
|
|
19657
|
-
(m) => m.sender_type !== "customer" && (!readAt || m.created_at > readAt)
|
|
19658
|
-
).length;
|
|
19690
|
+
), unread = open ? 0 : messages.filter((m) => m.sender_type !== "customer" && (!readAt || m.created_at > readAt)).length;
|
|
19659
19691
|
React14.useState(() => {
|
|
19660
19692
|
defaultOpen && openIfExisting();
|
|
19661
19693
|
});
|
|
@@ -19675,14 +19707,7 @@ function ChatWidget({
|
|
|
19675
19707
|
classNames?.root
|
|
19676
19708
|
),
|
|
19677
19709
|
children: [
|
|
19678
|
-
!open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19679
|
-
Bubble,
|
|
19680
|
-
{
|
|
19681
|
-
unread,
|
|
19682
|
-
onClick: handleOpen,
|
|
19683
|
-
className: classNames?.bubble
|
|
19684
|
-
}
|
|
19685
|
-
),
|
|
19710
|
+
!open && /* @__PURE__ */ jsxRuntime.jsx(Bubble, { unread, onClick: handleOpen, className: classNames?.bubble }),
|
|
19686
19711
|
open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19687
19712
|
Panel,
|
|
19688
19713
|
{
|
|
@@ -19889,8 +19914,7 @@ function Panel({
|
|
|
19889
19914
|
}
|
|
19890
19915
|
),
|
|
19891
19916
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 border-t border-border bg-background px-4 py-1.5 text-center text-[10px] text-muted-foreground", children: [
|
|
19892
|
-
"Powered by",
|
|
19893
|
-
" ",
|
|
19917
|
+
"Powered by ",
|
|
19894
19918
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: "Cimplify" })
|
|
19895
19919
|
] })
|
|
19896
19920
|
]
|
|
@@ -20040,42 +20064,35 @@ function MessageList({
|
|
|
20040
20064
|
) }),
|
|
20041
20065
|
bubbles.map((msg, i) => {
|
|
20042
20066
|
let prev = bubbles[i - 1], newDay = !prev || !sameDay(prev.created_at, msg.created_at), group = groupPosition(timeline, i), startsRun = group === "single" || group === "first", delivery = deliveryState(msg, timeline, seenAt, isOptimistic);
|
|
20043
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20044
|
-
"
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20048
|
-
|
|
20049
|
-
|
|
20050
|
-
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
|
|
20054
|
-
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
|
|
20058
|
-
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
|
|
20063
|
-
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20067
|
-
|
|
20068
|
-
|
|
20069
|
-
|
|
20070
|
-
|
|
20071
|
-
|
|
20072
|
-
}
|
|
20073
|
-
)
|
|
20074
|
-
] })
|
|
20075
|
-
]
|
|
20076
|
-
},
|
|
20077
|
-
msg.id
|
|
20078
|
-
);
|
|
20067
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1.5", startsRun && i > 0 && "mt-2.5"), children: [
|
|
20068
|
+
newDay && /* @__PURE__ */ jsxRuntime.jsx(Seam, { variant: "chip", label: dayLabel(msg.created_at) }),
|
|
20069
|
+
msg.id === firstUnreadId && /* @__PURE__ */ jsxRuntime.jsx(
|
|
20070
|
+
Seam,
|
|
20071
|
+
{
|
|
20072
|
+
variant: "unread",
|
|
20073
|
+
label: `${unreadOnOpen} new message${unreadOnOpen === 1 ? "" : "s"}`
|
|
20074
|
+
}
|
|
20075
|
+
),
|
|
20076
|
+
msg.id === firstAgentMessageId && /* @__PURE__ */ jsxRuntime.jsx(Seam, { label: "A person joined" }),
|
|
20077
|
+
msg.sender_type === "system" ? /* @__PURE__ */ jsxRuntime.jsx(Seam, { label: "Passing you to the team" }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group relative", children: [
|
|
20078
|
+
msg.sender_type !== "customer" && !isOptimistic(msg) && /* @__PURE__ */ jsxRuntime.jsx(HoverRail, { message: msg, onReact, onReply }),
|
|
20079
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
20080
|
+
MessageBubble,
|
|
20081
|
+
{
|
|
20082
|
+
message: msg,
|
|
20083
|
+
reactions: reactionsByTarget.get(msg.id),
|
|
20084
|
+
businessName,
|
|
20085
|
+
group,
|
|
20086
|
+
delivery,
|
|
20087
|
+
onReply,
|
|
20088
|
+
avatar: /* @__PURE__ */ jsxRuntime.jsx(LetterAvatar, { name: businessName }),
|
|
20089
|
+
renderProgram: (source) => /* @__PURE__ */ jsxRuntime.jsx(ChatKitProgram, { source, onAction: onGenUIAction }),
|
|
20090
|
+
renderCards: (target) => /* @__PURE__ */ jsxRuntime.jsx(ChatReplyCards, { message: target, currency, onAction: onGenUIAction }),
|
|
20091
|
+
onQuoteMiss: async () => (onLoadOlder(), true)
|
|
20092
|
+
}
|
|
20093
|
+
)
|
|
20094
|
+
] })
|
|
20095
|
+
] }, msg.id);
|
|
20079
20096
|
}),
|
|
20080
20097
|
isSending && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-auto mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(TypingDots, {}) }),
|
|
20081
20098
|
offerHuman && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|