@cimplify/sdk 0.103.0 → 0.104.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +3 -7
- package/dist/advanced.d.ts +3 -7
- package/dist/advanced.js +23 -23
- package/dist/advanced.mjs +4 -4
- package/dist/{client-DHBwvh7U.d.ts → catalogue-BlQ85Uma.d.mts} +492 -748
- package/dist/{client-BfpNjJ_a.d.mts → catalogue-C8TqOj9K.d.ts} +492 -748
- package/dist/{payment-H5LoIvXU.d.mts → checkout-BqK9XUz5.d.mts} +4338 -1495
- package/dist/{payment-H5LoIvXU.d.ts → checkout-BqK9XUz5.d.ts} +4338 -1495
- package/dist/{chunk-GOHSXBKW.mjs → chunk-33VCYWVL.mjs} +25 -1
- package/dist/{chunk-C2JSNJUC.mjs → chunk-6G3ANKQA.mjs} +1080 -369
- package/dist/{chunk-QOWPGS7Z.js → chunk-BWEIMKLF.js} +572 -17
- package/dist/{chunk-JSWJ4XDE.js → chunk-DQEXY542.js} +1630 -824
- package/dist/{chunk-CNN7Z2IP.js → chunk-EV2EVOYS.js} +27 -0
- package/dist/{chunk-VIL6IQCG.js → chunk-HYFA67A7.js} +1084 -373
- package/dist/{chunk-H7ACMHM3.mjs → chunk-L5SNEU2O.mjs} +553 -16
- package/dist/{chunk-JG5CQNCB.js → chunk-RBNBSQI7.mjs} +221 -19
- package/dist/{chunk-VNPEYLB2.mjs → chunk-SFUJMS5E.js} +265 -2
- package/dist/{chunk-M4URVKHE.mjs → chunk-U54CWUUT.mjs} +11 -2
- package/dist/{chunk-GERXZQSX.mjs → chunk-UFOWPN3D.mjs} +967 -582
- package/dist/{chunk-J6PNHDHL.mjs → chunk-V4457OKB.mjs} +1580 -785
- package/dist/{chunk-R6OLQ33I.js → chunk-WXREIBFW.js} +1041 -654
- package/dist/{chunk-NNG6IFFX.js → chunk-XAUSDMMZ.js} +13 -3
- package/dist/{client-DpqRobY9.d.mts → client-DhXeiUrf.d.ts} +2 -2
- package/dist/{client-Dqg2mc-7.d.ts → client-mXiUrV4X.d.mts} +2 -2
- package/dist/{index-C8uDqLwJ.d.ts → index-B0AdZvrM.d.mts} +9 -4
- package/dist/{index-e2y6AK70.d.mts → index-CK8Nk5uQ.d.ts} +9 -4
- package/dist/index-DPWI5XcU.d.ts +8 -0
- package/dist/index-DVfUh-ci.d.mts +8 -0
- package/dist/index.d.mts +34 -15
- package/dist/index.d.ts +34 -15
- package/dist/index.js +306 -133
- package/dist/index.mjs +7 -6
- package/dist/mock/cli.mjs +1494 -395
- package/dist/mock/library.js +1220 -361
- package/dist/mock/library.mjs +1220 -361
- package/dist/mock/msw.js +1220 -361
- package/dist/mock/msw.mjs +1220 -361
- package/dist/{price-C2RqscMY.d.ts → price-6hQIIac9.d.ts} +1 -1
- package/dist/{price-BvePgDXe.d.mts → price-BUDv1rI7.d.mts} +1 -1
- package/dist/react.d.mts +10 -5
- package/dist/react.d.ts +10 -5
- package/dist/react.js +279 -225
- package/dist/react.mjs +140 -86
- package/dist/{server-DoXIpSd7.d.ts → server-DJ0mSs9i.d.mts} +33 -57
- package/dist/{server-C7FyLdrz.d.mts → server-DSTX76Ki.d.ts} +33 -57
- package/dist/server.d.mts +3 -4
- package/dist/server.d.ts +3 -4
- package/dist/server.js +12 -11
- package/dist/server.mjs +6 -5
- package/dist/styles.css +2 -2
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +4 -4
- package/dist/testing/msw.mjs +3 -3
- package/dist/testing/suite.d.mts +5 -6
- package/dist/testing/suite.d.ts +5 -6
- package/dist/testing/suite.js +29 -28
- package/dist/testing/suite.mjs +10 -9
- package/dist/testing.d.mts +2217 -14
- package/dist/testing.d.ts +2217 -14
- package/dist/testing.js +173 -83
- package/dist/testing.mjs +28 -10
- package/dist/utils.d.mts +3 -4
- package/dist/utils.d.ts +3 -4
- package/dist/utils.js +35 -31
- package/dist/utils.mjs +2 -2
- package/package.json +9 -9
- package/registry/chat-widget.json +1 -1
- package/registry/order-history.json +1 -1
- package/registry/order-summary.json +1 -1
- package/dist/link-cuNVYc2s.d.mts +0 -297
- package/dist/link-cuNVYc2s.d.ts +0 -297
package/dist/react.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
5
4
|
var chunk2P4KXFB6_js = require('./chunk-2P4KXFB6.js');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
var
|
|
10
|
-
var
|
|
5
|
+
var chunkWXREIBFW_js = require('./chunk-WXREIBFW.js');
|
|
6
|
+
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
7
|
+
var chunkDQEXY542_js = require('./chunk-DQEXY542.js');
|
|
8
|
+
var chunkEV2EVOYS_js = require('./chunk-EV2EVOYS.js');
|
|
9
|
+
var chunkXAUSDMMZ_js = require('./chunk-XAUSDMMZ.js');
|
|
10
|
+
var chunkSFUJMS5E_js = require('./chunk-SFUJMS5E.js');
|
|
11
11
|
require('./chunk-OWW5GUSB.js');
|
|
12
12
|
var React14 = require('react');
|
|
13
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -635,14 +635,14 @@ function attachInternalItemMetadata(item, metadata = {}) {
|
|
|
635
635
|
}
|
|
636
636
|
function calculateLineSubtotal(item) {
|
|
637
637
|
if (item._quotedUnitPrice !== void 0) {
|
|
638
|
-
return roundMoney(
|
|
638
|
+
return roundMoney(chunkXAUSDMMZ_js.parsePrice(item._quotedUnitPrice) * item.quantity);
|
|
639
639
|
}
|
|
640
|
-
let unitPrice =
|
|
640
|
+
let unitPrice = chunkXAUSDMMZ_js.parsePrice(item.product.default_price);
|
|
641
641
|
if (item.variant?.price_adjustment) {
|
|
642
|
-
unitPrice +=
|
|
642
|
+
unitPrice += chunkXAUSDMMZ_js.parsePrice(item.variant.price_adjustment);
|
|
643
643
|
}
|
|
644
644
|
for (const option of item.addOnOptions || []) {
|
|
645
|
-
if (option.default_price) unitPrice +=
|
|
645
|
+
if (option.default_price) unitPrice += chunkXAUSDMMZ_js.parsePrice(option.default_price);
|
|
646
646
|
}
|
|
647
647
|
return roundMoney(unitPrice * item.quantity);
|
|
648
648
|
}
|
|
@@ -863,7 +863,7 @@ async function syncFromServer(entry) {
|
|
|
863
863
|
return next;
|
|
864
864
|
}
|
|
865
865
|
function emitMutationError(entry, operation, opId, idempotencyKey, error) {
|
|
866
|
-
entry.client.events.emit(
|
|
866
|
+
entry.client.events.emit(chunkWXREIBFW_js.MUTATION_ERROR, {
|
|
867
867
|
service: "cart",
|
|
868
868
|
operation,
|
|
869
869
|
opId,
|
|
@@ -903,10 +903,10 @@ function getOrCreateStore(params) {
|
|
|
903
903
|
syncTail: Promise.resolve(),
|
|
904
904
|
failedOpRemovers: /* @__PURE__ */ new Set()
|
|
905
905
|
};
|
|
906
|
-
client.events.on(
|
|
906
|
+
client.events.on(chunkWXREIBFW_js.SESSION_CLAIMED, () => {
|
|
907
907
|
if (entry.initialized) void syncFromServer(entry);
|
|
908
908
|
});
|
|
909
|
-
client.events.on(
|
|
909
|
+
client.events.on(chunkWXREIBFW_js.SESSION_CLEARED, () => {
|
|
910
910
|
if (entry.initialized) void syncFromServer(entry);
|
|
911
911
|
});
|
|
912
912
|
cartStores.set(storeKey, entry);
|
|
@@ -1214,7 +1214,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1214
1214
|
function createDefaultClient() {
|
|
1215
1215
|
const processRef = globalThis.process;
|
|
1216
1216
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1217
|
-
return
|
|
1217
|
+
return chunkWXREIBFW_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1218
1218
|
}
|
|
1219
1219
|
function getStoredLocationId() {
|
|
1220
1220
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1318,7 +1318,7 @@ function CimplifyProvider({
|
|
|
1318
1318
|
const setDisplayCurrency = React14.useCallback(
|
|
1319
1319
|
(currency) => {
|
|
1320
1320
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1321
|
-
if (normalized && !
|
|
1321
|
+
if (normalized && !chunkSFUJMS5E_js.isSupportedCurrency(normalized)) {
|
|
1322
1322
|
return;
|
|
1323
1323
|
}
|
|
1324
1324
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -1518,25 +1518,28 @@ function statusToLabel(status) {
|
|
|
1518
1518
|
if (!status) {
|
|
1519
1519
|
return "";
|
|
1520
1520
|
}
|
|
1521
|
-
if (status ===
|
|
1521
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.PREPARING) {
|
|
1522
1522
|
return "Preparing checkout";
|
|
1523
1523
|
}
|
|
1524
|
-
if (status ===
|
|
1524
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.REVIEWING_TERMS) {
|
|
1525
|
+
return "Review updated terms";
|
|
1526
|
+
}
|
|
1527
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.RECOVERING) {
|
|
1525
1528
|
return "Resuming payment";
|
|
1526
1529
|
}
|
|
1527
|
-
if (status ===
|
|
1530
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.PROCESSING) {
|
|
1528
1531
|
return "Processing payment";
|
|
1529
1532
|
}
|
|
1530
|
-
if (status ===
|
|
1533
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.AWAITING_AUTHORIZATION) {
|
|
1531
1534
|
return "Waiting for authorization";
|
|
1532
1535
|
}
|
|
1533
|
-
if (status ===
|
|
1536
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.POLLING) {
|
|
1534
1537
|
return "Confirming payment";
|
|
1535
1538
|
}
|
|
1536
|
-
if (status ===
|
|
1539
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.FINALIZING) {
|
|
1537
1540
|
return "Finalizing order";
|
|
1538
1541
|
}
|
|
1539
|
-
if (status ===
|
|
1542
|
+
if (status === chunkEV2EVOYS_js.CHECKOUT_STATUS.SUCCESS) {
|
|
1540
1543
|
return "Payment complete";
|
|
1541
1544
|
}
|
|
1542
1545
|
return "Payment failed";
|
|
@@ -1545,6 +1548,9 @@ function CimplifyCheckout({
|
|
|
1545
1548
|
client,
|
|
1546
1549
|
businessId,
|
|
1547
1550
|
cartId,
|
|
1551
|
+
intentId,
|
|
1552
|
+
hostedSessionId,
|
|
1553
|
+
initialTerms,
|
|
1548
1554
|
locationId,
|
|
1549
1555
|
linkUrl,
|
|
1550
1556
|
orderTypes,
|
|
@@ -1558,14 +1564,14 @@ function CimplifyCheckout({
|
|
|
1558
1564
|
className
|
|
1559
1565
|
}) {
|
|
1560
1566
|
const resolvedOrderTypes = React14.useMemo(
|
|
1561
|
-
() => orderTypes && orderTypes.length > 0 ? orderTypes : [
|
|
1567
|
+
() => orderTypes && orderTypes.length > 0 ? orderTypes : [chunkEV2EVOYS_js.ORDER_TYPE.PICKUP, chunkEV2EVOYS_js.ORDER_TYPE.DELIVERY],
|
|
1562
1568
|
[orderTypes]
|
|
1563
1569
|
);
|
|
1564
1570
|
const resolvedDefaultOrderType = React14.useMemo(() => {
|
|
1565
1571
|
if (defaultOrderType && resolvedOrderTypes.includes(defaultOrderType)) {
|
|
1566
1572
|
return defaultOrderType;
|
|
1567
1573
|
}
|
|
1568
|
-
return resolvedOrderTypes[0] ||
|
|
1574
|
+
return resolvedOrderTypes[0] || chunkEV2EVOYS_js.ORDER_TYPE.PICKUP;
|
|
1569
1575
|
}, [defaultOrderType, resolvedOrderTypes]);
|
|
1570
1576
|
const [orderType, setOrderType] = React14.useState(resolvedDefaultOrderType);
|
|
1571
1577
|
const [status, setStatus] = React14.useState(null);
|
|
@@ -1591,7 +1597,12 @@ function CimplifyCheckout({
|
|
|
1591
1597
|
displayCurrency: cimplifyCtx.displayCurrency,
|
|
1592
1598
|
convertPrice: cimplifyCtx.convertPrice
|
|
1593
1599
|
};
|
|
1594
|
-
}, [
|
|
1600
|
+
}, [
|
|
1601
|
+
cimplifyCtx?.fxRate,
|
|
1602
|
+
cimplifyCtx?.displayCurrency,
|
|
1603
|
+
cimplifyCtx?.baseCurrency,
|
|
1604
|
+
cimplifyCtx?.convertPrice
|
|
1605
|
+
]);
|
|
1595
1606
|
const fxOptionsRef = React14.useRef(fxOptions);
|
|
1596
1607
|
fxOptionsRef.current = fxOptions;
|
|
1597
1608
|
const resolvedCartRef = React14.useRef(resolvedCart);
|
|
@@ -1604,11 +1615,9 @@ function CimplifyCheckout({
|
|
|
1604
1615
|
onStatusChange?.(nextStatus, context);
|
|
1605
1616
|
}
|
|
1606
1617
|
);
|
|
1607
|
-
const fireError = React14__default.default.useEffectEvent(
|
|
1608
|
-
(error)
|
|
1609
|
-
|
|
1610
|
-
}
|
|
1611
|
-
);
|
|
1618
|
+
const fireError = React14__default.default.useEffectEvent((error) => {
|
|
1619
|
+
onError?.(error);
|
|
1620
|
+
});
|
|
1612
1621
|
React14.useEffect(() => {
|
|
1613
1622
|
if (!resolvedOrderTypes.includes(orderType)) {
|
|
1614
1623
|
setOrderType(resolvedDefaultOrderType);
|
|
@@ -1626,20 +1635,23 @@ function CimplifyCheckout({
|
|
|
1626
1635
|
let cancelled = false;
|
|
1627
1636
|
async function bootstrap() {
|
|
1628
1637
|
const needsBusinessResolve = !businessId;
|
|
1629
|
-
const needsCartResolve = !cartId;
|
|
1638
|
+
const needsCartResolve = !cartId && !intentId;
|
|
1630
1639
|
if (!needsBusinessResolve && !needsCartResolve) {
|
|
1631
1640
|
if (!cancelled) {
|
|
1632
1641
|
setResolvedBusinessId(businessId || null);
|
|
1633
|
-
setResolvedCartId(cartId || null);
|
|
1642
|
+
setResolvedCartId(intentId ? null : cartId || null);
|
|
1643
|
+
if (intentId) setResolvedCart(null);
|
|
1634
1644
|
setIsInitializing(false);
|
|
1635
1645
|
setErrorMessage(null);
|
|
1636
1646
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1647
|
+
if (!intentId) {
|
|
1648
|
+
client.cart.get().then((cartResult) => {
|
|
1649
|
+
if (!cancelled && cartResult.ok && cartResult.value) {
|
|
1650
|
+
setResolvedCart(cartResult.value);
|
|
1651
|
+
}
|
|
1652
|
+
}).catch(() => {
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1643
1655
|
return;
|
|
1644
1656
|
}
|
|
1645
1657
|
if (!cancelled) {
|
|
@@ -1657,13 +1669,13 @@ function CimplifyCheckout({
|
|
|
1657
1669
|
setResolvedCartId(null);
|
|
1658
1670
|
setErrorMessage(message);
|
|
1659
1671
|
setIsInitializing(false);
|
|
1660
|
-
fireError({ code:
|
|
1672
|
+
fireError({ code: chunkSFUJMS5E_js.ErrorCode.BUSINESS_ID_REQUIRED, message });
|
|
1661
1673
|
}
|
|
1662
1674
|
return;
|
|
1663
1675
|
}
|
|
1664
1676
|
}
|
|
1665
|
-
let nextCartId = cartId ?? null;
|
|
1666
|
-
if (!nextCartId) {
|
|
1677
|
+
let nextCartId = intentId ? null : cartId ?? null;
|
|
1678
|
+
if (!intentId && !nextCartId) {
|
|
1667
1679
|
const cartResult = await client.cart.get();
|
|
1668
1680
|
if (!cartResult.ok || !cartResult.value?.id || cartResult.value.items.length === 0) {
|
|
1669
1681
|
if (!cancelled) {
|
|
@@ -1672,7 +1684,7 @@ function CimplifyCheckout({
|
|
|
1672
1684
|
setResolvedCartId(null);
|
|
1673
1685
|
setErrorMessage(message);
|
|
1674
1686
|
setIsInitializing(false);
|
|
1675
|
-
fireError({ code:
|
|
1687
|
+
fireError({ code: chunkSFUJMS5E_js.ErrorCode.CART_EMPTY, message });
|
|
1676
1688
|
}
|
|
1677
1689
|
return;
|
|
1678
1690
|
}
|
|
@@ -1692,7 +1704,7 @@ function CimplifyCheckout({
|
|
|
1692
1704
|
return () => {
|
|
1693
1705
|
cancelled = true;
|
|
1694
1706
|
};
|
|
1695
|
-
}, [businessId, cartId, client]);
|
|
1707
|
+
}, [businessId, cartId, client, intentId]);
|
|
1696
1708
|
React14.useEffect(() => {
|
|
1697
1709
|
return () => {
|
|
1698
1710
|
isMountedRef.current = false;
|
|
@@ -1701,31 +1713,36 @@ function CimplifyCheckout({
|
|
|
1701
1713
|
};
|
|
1702
1714
|
}, []);
|
|
1703
1715
|
const handleSubmit = React14__default.default.useEffectEvent(async () => {
|
|
1704
|
-
if (isSubmitting || isInitializing || !resolvedCartId) {
|
|
1705
|
-
if (!resolvedCartId && !isInitializing) {
|
|
1706
|
-
const message = "
|
|
1716
|
+
if (isSubmitting || isInitializing || !resolvedCartId && !intentId) {
|
|
1717
|
+
if (!resolvedCartId && !intentId && !isInitializing) {
|
|
1718
|
+
const message = "A cart or purchase intent is required before checkout.";
|
|
1707
1719
|
setErrorMessage(message);
|
|
1708
|
-
fireError({ code:
|
|
1720
|
+
fireError({ code: chunkSFUJMS5E_js.ErrorCode.CHECKOUT_AUTHORITY_REQUIRED, message });
|
|
1709
1721
|
}
|
|
1710
1722
|
return;
|
|
1711
1723
|
}
|
|
1712
1724
|
setErrorMessage(null);
|
|
1713
1725
|
setIsSubmitting(true);
|
|
1714
|
-
emitStatus(
|
|
1726
|
+
emitStatus(chunkEV2EVOYS_js.CHECKOUT_STATUS.PREPARING, {
|
|
1727
|
+
display_text: statusToLabel(chunkEV2EVOYS_js.CHECKOUT_STATUS.PREPARING)
|
|
1728
|
+
});
|
|
1715
1729
|
if (!elementsRef.current) {
|
|
1716
1730
|
const message = "Checkout is still initializing. Please try again.";
|
|
1717
1731
|
setErrorMessage(message);
|
|
1718
|
-
fireError({ code:
|
|
1732
|
+
fireError({ code: chunkSFUJMS5E_js.ErrorCode.CHECKOUT_NOT_READY, message });
|
|
1719
1733
|
setIsSubmitting(false);
|
|
1720
1734
|
return;
|
|
1721
1735
|
}
|
|
1722
1736
|
const checkout = elementsRef.current.processCheckout({
|
|
1723
|
-
cart_id: resolvedCartId,
|
|
1737
|
+
cart_id: intentId ? void 0 : resolvedCartId ?? void 0,
|
|
1738
|
+
intent_id: intentId,
|
|
1739
|
+
hosted_session_id: hostedSessionId,
|
|
1740
|
+
initial_terms: initialTerms,
|
|
1724
1741
|
location_id: locationId ?? client.getLocationId() ?? void 0,
|
|
1725
1742
|
order_type: orderType,
|
|
1726
1743
|
enroll_in_link: enrollInLink,
|
|
1727
1744
|
on_status_change: emitStatus,
|
|
1728
|
-
pay_currency: fxOptions?.displayCurrency
|
|
1745
|
+
pay_currency: intentId ? void 0 : fxOptions?.displayCurrency
|
|
1729
1746
|
});
|
|
1730
1747
|
activeCheckoutRef.current = checkout;
|
|
1731
1748
|
try {
|
|
@@ -1734,7 +1751,7 @@ function CimplifyCheckout({
|
|
|
1734
1751
|
onComplete(result);
|
|
1735
1752
|
return;
|
|
1736
1753
|
}
|
|
1737
|
-
const code = result.error?.code ||
|
|
1754
|
+
const code = result.error?.code || chunkSFUJMS5E_js.ErrorCode.CHECKOUT_FAILED;
|
|
1738
1755
|
const message = result.error?.message || "Payment failed.";
|
|
1739
1756
|
setErrorMessage(message);
|
|
1740
1757
|
fireError({ code, message });
|
|
@@ -1755,27 +1772,30 @@ function CimplifyCheckout({
|
|
|
1755
1772
|
linkUrl
|
|
1756
1773
|
});
|
|
1757
1774
|
elementsRef.current = elements;
|
|
1758
|
-
const checkout = elements.create(
|
|
1775
|
+
const checkout = elements.create(chunkDQEXY542_js.ELEMENT_TYPES.CHECKOUT, {
|
|
1759
1776
|
orderTypes: resolvedOrderTypes,
|
|
1760
1777
|
defaultOrderType: resolvedDefaultOrderType,
|
|
1761
|
-
submitLabel
|
|
1778
|
+
submitLabel,
|
|
1779
|
+
intentId,
|
|
1780
|
+
hostedSessionId,
|
|
1781
|
+
initialTerms
|
|
1762
1782
|
});
|
|
1763
1783
|
if (checkoutMountRef.current) {
|
|
1764
1784
|
checkout.mount(checkoutMountRef.current);
|
|
1765
1785
|
}
|
|
1766
|
-
checkout.on(
|
|
1786
|
+
checkout.on(chunkDQEXY542_js.EVENT_TYPES.READY, () => {
|
|
1767
1787
|
const cart = resolvedCartRef.current;
|
|
1768
1788
|
if (cart) {
|
|
1769
1789
|
checkout.setCart(transformToCheckoutCart(cart, fxOptionsRef.current));
|
|
1770
1790
|
}
|
|
1771
1791
|
});
|
|
1772
|
-
checkout.on(
|
|
1792
|
+
checkout.on(chunkDQEXY542_js.EVENT_TYPES.ORDER_TYPE_CHANGED, (data) => {
|
|
1773
1793
|
const typed = data;
|
|
1774
1794
|
if (typed.orderType) {
|
|
1775
1795
|
setOrderType(typed.orderType);
|
|
1776
1796
|
}
|
|
1777
1797
|
});
|
|
1778
|
-
checkout.on(
|
|
1798
|
+
checkout.on(chunkDQEXY542_js.EVENT_TYPES.REQUEST_SUBMIT, () => {
|
|
1779
1799
|
void handleSubmit();
|
|
1780
1800
|
});
|
|
1781
1801
|
return () => {
|
|
@@ -1789,11 +1809,14 @@ function CimplifyCheckout({
|
|
|
1789
1809
|
resolvedBusinessId,
|
|
1790
1810
|
resolvedOrderTypes,
|
|
1791
1811
|
resolvedDefaultOrderType,
|
|
1792
|
-
submitLabel
|
|
1812
|
+
submitLabel,
|
|
1813
|
+
intentId,
|
|
1814
|
+
hostedSessionId,
|
|
1815
|
+
initialTerms
|
|
1793
1816
|
]);
|
|
1794
1817
|
React14.useEffect(() => {
|
|
1795
1818
|
if (!resolvedCart || !elementsRef.current) return;
|
|
1796
|
-
const checkoutElement = elementsRef.current.getElement(
|
|
1819
|
+
const checkoutElement = elementsRef.current.getElement(chunkDQEXY542_js.ELEMENT_TYPES.CHECKOUT);
|
|
1797
1820
|
if (checkoutElement) {
|
|
1798
1821
|
checkoutElement.setCart(transformToCheckoutCart(resolvedCart, fxOptions));
|
|
1799
1822
|
}
|
|
@@ -1802,7 +1825,7 @@ function CimplifyCheckout({
|
|
|
1802
1825
|
if (isInitializing) {
|
|
1803
1826
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-cimplify-checkout": "", children: /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-status": "", style: { fontSize: 13, color: colors.textSecondary }, children: "Preparing checkout..." }) });
|
|
1804
1827
|
}
|
|
1805
|
-
if (!resolvedBusinessId || !resolvedCartId) {
|
|
1828
|
+
if (!resolvedBusinessId || !resolvedCartId && !intentId) {
|
|
1806
1829
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, "data-cimplify-checkout": "", children: /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-error": "", style: { fontSize: 13, color: colors.error }, children: errorMessage || "Unable to initialize checkout. Please refresh and try again." }) });
|
|
1807
1830
|
}
|
|
1808
1831
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-cimplify-checkout": "", children: [
|
|
@@ -1820,7 +1843,14 @@ function CimplifyCheckout({
|
|
|
1820
1843
|
}
|
|
1821
1844
|
),
|
|
1822
1845
|
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-section": "checkout", children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: checkoutMountRef }) }),
|
|
1823
|
-
status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1846
|
+
status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1847
|
+
"p",
|
|
1848
|
+
{
|
|
1849
|
+
"data-cimplify-status": "",
|
|
1850
|
+
style: { marginTop: 8, fontSize: 13, color: colors.textSecondary },
|
|
1851
|
+
children: statusText || statusToLabel(status)
|
|
1852
|
+
}
|
|
1853
|
+
),
|
|
1824
1854
|
errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-error": "", style: { marginTop: 8, fontSize: 13, color: colors.error }, children: errorMessage })
|
|
1825
1855
|
] });
|
|
1826
1856
|
}
|
|
@@ -3262,19 +3292,19 @@ function toAccountLineItem(item, currency) {
|
|
|
3262
3292
|
quantity: s.quantity,
|
|
3263
3293
|
name: s.product_name,
|
|
3264
3294
|
variantName: s.variant_name,
|
|
3265
|
-
priceLabel:
|
|
3295
|
+
priceLabel: chunkXAUSDMMZ_js.parsePrice(s.unit_price) > 0 ? chunkXAUSDMMZ_js.formatMoney(s.unit_price, currency) : void 0
|
|
3266
3296
|
}));
|
|
3267
3297
|
const customisations = item.composite_selections?.selections.map((s) => ({
|
|
3268
3298
|
quantity: s.quantity,
|
|
3269
3299
|
name: s.component_name,
|
|
3270
|
-
priceLabel:
|
|
3300
|
+
priceLabel: chunkXAUSDMMZ_js.parsePrice(s.unit_price) > 0 ? `+${chunkXAUSDMMZ_js.formatMoney(s.unit_price, currency)}` : void 0
|
|
3271
3301
|
}));
|
|
3272
3302
|
const data = {
|
|
3273
3303
|
id: item.id,
|
|
3274
3304
|
name: item.product_name ?? "Item",
|
|
3275
3305
|
imageUrl: item.image_url,
|
|
3276
3306
|
subtitle: lineSubtitle(item),
|
|
3277
|
-
priceLabel:
|
|
3307
|
+
priceLabel: chunkXAUSDMMZ_js.formatMoney(item.total_price, currency),
|
|
3278
3308
|
lineType: item.line_type,
|
|
3279
3309
|
includes,
|
|
3280
3310
|
customisations,
|
|
@@ -3312,8 +3342,7 @@ var STATUS_TONE2 = {
|
|
|
3312
3342
|
picked_up: "positive",
|
|
3313
3343
|
served: "positive",
|
|
3314
3344
|
completed: "positive",
|
|
3315
|
-
cancelled: "muted"
|
|
3316
|
-
refunded: "muted"
|
|
3345
|
+
cancelled: "muted"
|
|
3317
3346
|
};
|
|
3318
3347
|
var PAYMENT_TONE = {
|
|
3319
3348
|
paid: "positive",
|
|
@@ -3324,20 +3353,20 @@ var PAYMENT_TONE = {
|
|
|
3324
3353
|
function toAccountOrderView(order, opts = {}) {
|
|
3325
3354
|
const currency = order.payment.currency;
|
|
3326
3355
|
const rows = [
|
|
3327
|
-
{ label: "Subtotal", value:
|
|
3356
|
+
{ label: "Subtotal", value: chunkXAUSDMMZ_js.formatMoney(order.pricing.subtotal, currency) }
|
|
3328
3357
|
];
|
|
3329
|
-
if (
|
|
3358
|
+
if (chunkXAUSDMMZ_js.parsePrice(order.pricing.total_discount) > 0) {
|
|
3330
3359
|
rows.push({
|
|
3331
3360
|
label: "Discount",
|
|
3332
|
-
value: `\u2212${
|
|
3361
|
+
value: `\u2212${chunkXAUSDMMZ_js.formatMoney(order.pricing.total_discount, currency)}`,
|
|
3333
3362
|
tone: "positive"
|
|
3334
3363
|
});
|
|
3335
3364
|
}
|
|
3336
|
-
if (order.pricing.tax &&
|
|
3337
|
-
rows.push({ label: "Tax", value:
|
|
3365
|
+
if (order.pricing.tax && chunkXAUSDMMZ_js.parsePrice(order.pricing.tax) > 0) {
|
|
3366
|
+
rows.push({ label: "Tax", value: chunkXAUSDMMZ_js.formatMoney(order.pricing.tax, currency) });
|
|
3338
3367
|
}
|
|
3339
|
-
if (order.pricing.service_charge &&
|
|
3340
|
-
rows.push({ label: "Service", value:
|
|
3368
|
+
if (order.pricing.service_charge && chunkXAUSDMMZ_js.parsePrice(order.pricing.service_charge) > 0) {
|
|
3369
|
+
rows.push({ label: "Service", value: chunkXAUSDMMZ_js.formatMoney(order.pricing.service_charge, currency) });
|
|
3341
3370
|
}
|
|
3342
3371
|
const placed = fmtDateTime(order.timestamps.created_at);
|
|
3343
3372
|
const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
@@ -3351,7 +3380,7 @@ function toAccountOrderView(order, opts = {}) {
|
|
|
3351
3380
|
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
3352
3381
|
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
3353
3382
|
rows,
|
|
3354
|
-
total: { label: "Total", value:
|
|
3383
|
+
total: { label: "Total", value: chunkXAUSDMMZ_js.formatMoney(order.pricing.total_price, currency) }
|
|
3355
3384
|
},
|
|
3356
3385
|
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
3357
3386
|
onBack: opts.onBack
|
|
@@ -3526,7 +3555,7 @@ function CimplifySignInButton({
|
|
|
3526
3555
|
const onClick = async () => {
|
|
3527
3556
|
if (busy || disabled || !signInOpts.clientId) return;
|
|
3528
3557
|
setBusy(true);
|
|
3529
|
-
await
|
|
3558
|
+
await chunkDQEXY542_js.startSignIn({
|
|
3530
3559
|
...signInOpts,
|
|
3531
3560
|
onSuccess: () => {
|
|
3532
3561
|
setBusy(false);
|
|
@@ -4381,7 +4410,7 @@ function Price({
|
|
|
4381
4410
|
const resolvedAmount = fxActive ? context.convertPrice(amount) : typeof amount === "string" ? parseFloat(amount) || 0 : amount;
|
|
4382
4411
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
4383
4412
|
prefix,
|
|
4384
|
-
|
|
4413
|
+
chunkXAUSDMMZ_js.formatPrice(resolvedAmount, resolvedCurrency)
|
|
4385
4414
|
] });
|
|
4386
4415
|
}
|
|
4387
4416
|
function createCachedQuery(config) {
|
|
@@ -4613,9 +4642,12 @@ function useCategories(options = {}) {
|
|
|
4613
4642
|
const { data, isLoading, error, refetch } = categoriesQuery(options);
|
|
4614
4643
|
return { categories: data ?? [], isLoading, error, refetch };
|
|
4615
4644
|
}
|
|
4616
|
-
var TERMINAL_STATUSES =
|
|
4645
|
+
var TERMINAL_STATUSES = {
|
|
4646
|
+
completed: true,
|
|
4647
|
+
cancelled: true
|
|
4648
|
+
};
|
|
4617
4649
|
function isTerminalOrderStatus(status) {
|
|
4618
|
-
return
|
|
4650
|
+
return Object.prototype.hasOwnProperty.call(TERMINAL_STATUSES, status);
|
|
4619
4651
|
}
|
|
4620
4652
|
var orderCache = /* @__PURE__ */ new Map();
|
|
4621
4653
|
var orderInflight = /* @__PURE__ */ new Map();
|
|
@@ -4708,7 +4740,7 @@ function useOrder(orderId, options = {}) {
|
|
|
4708
4740
|
React14.useEffect(() => {
|
|
4709
4741
|
void load(false);
|
|
4710
4742
|
}, [load]);
|
|
4711
|
-
const isTerminal = order ?
|
|
4743
|
+
const isTerminal = order ? isTerminalOrderStatus(order.status) : false;
|
|
4712
4744
|
React14.useEffect(() => {
|
|
4713
4745
|
if (!poll || !enabled || normalizedOrderId.length === 0 || isTerminal) {
|
|
4714
4746
|
return;
|
|
@@ -4994,9 +5026,9 @@ function useClientSessionEpoch(client) {
|
|
|
4994
5026
|
const subscribe = React14.useCallback(
|
|
4995
5027
|
(notify) => {
|
|
4996
5028
|
const unsubscribe = [
|
|
4997
|
-
client.events.on(
|
|
4998
|
-
client.events.on(
|
|
4999
|
-
client.events.on(
|
|
5029
|
+
client.events.on(chunkWXREIBFW_js.AUTH_TOKEN_CHANGED, notify),
|
|
5030
|
+
client.events.on(chunkWXREIBFW_js.SESSION_CLAIMED, notify),
|
|
5031
|
+
client.events.on(chunkWXREIBFW_js.SESSION_CLEARED, notify)
|
|
5000
5032
|
];
|
|
5001
5033
|
return () => {
|
|
5002
5034
|
for (const stopListening of unsubscribe) {
|
|
@@ -5483,13 +5515,13 @@ function useProductPrice(input) {
|
|
|
5483
5515
|
if (bundleTotalPrice != null) {
|
|
5484
5516
|
unitPrice = bundleTotalPrice;
|
|
5485
5517
|
} else if (compositePrice) {
|
|
5486
|
-
unitPrice =
|
|
5518
|
+
unitPrice = chunkXAUSDMMZ_js.parsePrice(compositePrice.final_price);
|
|
5487
5519
|
} else {
|
|
5488
|
-
unitPrice =
|
|
5520
|
+
unitPrice = chunkXAUSDMMZ_js.getVariantUnitPrice(product, variant);
|
|
5489
5521
|
if (addOnOptions) {
|
|
5490
5522
|
for (const option of addOnOptions) {
|
|
5491
5523
|
if (option.default_price) {
|
|
5492
|
-
unitPrice +=
|
|
5524
|
+
unitPrice += chunkXAUSDMMZ_js.parsePrice(option.default_price);
|
|
5493
5525
|
}
|
|
5494
5526
|
}
|
|
5495
5527
|
}
|
|
@@ -6163,7 +6195,7 @@ function useChat(options = {}) {
|
|
|
6163
6195
|
if (!c) return;
|
|
6164
6196
|
const last = lastConfirmedMessage();
|
|
6165
6197
|
const result = await c.support.getMessages({
|
|
6166
|
-
|
|
6198
|
+
afterSequence: last?.sequence,
|
|
6167
6199
|
limit: 50
|
|
6168
6200
|
});
|
|
6169
6201
|
if (result.ok && result.value.length > 0) {
|
|
@@ -6206,9 +6238,9 @@ function useChat(options = {}) {
|
|
|
6206
6238
|
);
|
|
6207
6239
|
return mergeMessages(snapshot, extras);
|
|
6208
6240
|
});
|
|
6209
|
-
aiEnabledRef.current = result.value.conversation.
|
|
6210
|
-
setHumanRequested(result.value.conversation.
|
|
6211
|
-
setSeenAt(
|
|
6241
|
+
aiEnabledRef.current = result.value.conversation.ai_mode === "auto";
|
|
6242
|
+
setHumanRequested(result.value.conversation.ai_mode === "off");
|
|
6243
|
+
setSeenAt(null);
|
|
6212
6244
|
setMayHaveOlder(result.value.messages.length >= 50);
|
|
6213
6245
|
}, []);
|
|
6214
6246
|
const connectWebSocket = React14.useCallback(() => {
|
|
@@ -6236,23 +6268,36 @@ function useChat(options = {}) {
|
|
|
6236
6268
|
ws.onmessage = (event) => {
|
|
6237
6269
|
try {
|
|
6238
6270
|
const envelope = JSON.parse(event.data);
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6271
|
+
const update = chunkWXREIBFW_js.chatRealtimeUpdateFromWire(envelope);
|
|
6272
|
+
if (update.kind === "message") {
|
|
6273
|
+
appendMessages([update.message]);
|
|
6274
|
+
} else if (update.kind === "message_updated") {
|
|
6275
|
+
lastActivityRef.current = Date.now();
|
|
6276
|
+
setMessages(
|
|
6277
|
+
(previous) => update.message.deleted_at ? previous.filter((message) => message.id !== update.message.id) : previous.map(
|
|
6278
|
+
(message) => message.id === update.message.id ? update.message : message
|
|
6279
|
+
)
|
|
6280
|
+
);
|
|
6281
|
+
} else if (update.kind === "business_read") {
|
|
6282
|
+
setSeenAt(
|
|
6283
|
+
(prev) => !prev || prev < update.occurredAt ? update.occurredAt : prev
|
|
6284
|
+
);
|
|
6285
|
+
} else if (update.kind === "ai_mode") {
|
|
6286
|
+
aiEnabledRef.current = update.mode === "auto";
|
|
6287
|
+
setHumanRequested(update.mode === "off");
|
|
6288
|
+
if (update.mode !== "auto") stopAwaitingReply();
|
|
6289
|
+
} else if (update.kind === "handoff") {
|
|
6290
|
+
aiEnabledRef.current = false;
|
|
6291
|
+
setHumanRequested(true);
|
|
6292
|
+
stopAwaitingReply();
|
|
6293
|
+
} else if (update.kind === "reload") {
|
|
6294
|
+
void resyncConversation();
|
|
6295
|
+
} else if (update.kind === "resync") {
|
|
6296
|
+
const latest = update.latestSequence;
|
|
6250
6297
|
const last = lastConfirmedMessage();
|
|
6251
|
-
if (latest
|
|
6298
|
+
if (latest === void 0 || !last?.sequence || last.sequence < latest) {
|
|
6252
6299
|
fetchNewMessages();
|
|
6253
6300
|
}
|
|
6254
|
-
} else if (envelope.type === "rekey") {
|
|
6255
|
-
void resyncConversation();
|
|
6256
6301
|
}
|
|
6257
6302
|
} catch {
|
|
6258
6303
|
}
|
|
@@ -6273,7 +6318,15 @@ function useChat(options = {}) {
|
|
|
6273
6318
|
ws.onerror = () => {
|
|
6274
6319
|
};
|
|
6275
6320
|
wsRef.current = ws;
|
|
6276
|
-
}, [
|
|
6321
|
+
}, [
|
|
6322
|
+
appendMessages,
|
|
6323
|
+
startPolling,
|
|
6324
|
+
stopPolling,
|
|
6325
|
+
fetchNewMessages,
|
|
6326
|
+
resyncConversation,
|
|
6327
|
+
lastConfirmedMessage,
|
|
6328
|
+
stopAwaitingReply
|
|
6329
|
+
]);
|
|
6277
6330
|
const resetConversation = React14.useCallback(() => {
|
|
6278
6331
|
stopPolling();
|
|
6279
6332
|
if (wsReconnectTimerRef.current) {
|
|
@@ -6301,9 +6354,9 @@ function useChat(options = {}) {
|
|
|
6301
6354
|
const c = clientRef.current;
|
|
6302
6355
|
setMessages(value.messages);
|
|
6303
6356
|
setConversationOpened(true);
|
|
6304
|
-
aiEnabledRef.current = value.conversation.
|
|
6305
|
-
setHumanRequested(value.conversation.
|
|
6306
|
-
setSeenAt(
|
|
6357
|
+
aiEnabledRef.current = value.conversation.ai_mode === "auto";
|
|
6358
|
+
setHumanRequested(value.conversation.ai_mode === "off");
|
|
6359
|
+
setSeenAt(null);
|
|
6307
6360
|
setMayHaveOlder(value.messages.length >= 50);
|
|
6308
6361
|
setClaimedAs(c?.support.claimedCustomerName ?? null);
|
|
6309
6362
|
connectWebSocket();
|
|
@@ -6326,7 +6379,7 @@ function useChat(options = {}) {
|
|
|
6326
6379
|
const watchSessionClaims = React14.useCallback(() => {
|
|
6327
6380
|
const c = clientRef.current;
|
|
6328
6381
|
if (!c || claimUnsubRef.current) return;
|
|
6329
|
-
const unsubClaimed = c.events.on(
|
|
6382
|
+
const unsubClaimed = c.events.on(chunkWXREIBFW_js.SESSION_CLAIMED, (event) => {
|
|
6330
6383
|
setClaimedAs(event.customerName || c.support.claimedCustomerName || null);
|
|
6331
6384
|
if (!openedRef.current) {
|
|
6332
6385
|
void openIfExisting();
|
|
@@ -6335,7 +6388,7 @@ function useChat(options = {}) {
|
|
|
6335
6388
|
connectWebSocket();
|
|
6336
6389
|
void resyncConversation();
|
|
6337
6390
|
});
|
|
6338
|
-
const unsubCleared = c.events.on(
|
|
6391
|
+
const unsubCleared = c.events.on(chunkWXREIBFW_js.SESSION_CLEARED, resetConversation);
|
|
6339
6392
|
claimUnsubRef.current = () => {
|
|
6340
6393
|
unsubClaimed();
|
|
6341
6394
|
unsubCleared();
|
|
@@ -6387,7 +6440,7 @@ function useChat(options = {}) {
|
|
|
6387
6440
|
if (!openedRef.current) return false;
|
|
6388
6441
|
}
|
|
6389
6442
|
const replyTo = opts?.replyTo;
|
|
6390
|
-
const clientId =
|
|
6443
|
+
const clientId = chunkDQEXY542_js.generateIdempotencyKey();
|
|
6391
6444
|
const localId = optimisticId(clientId);
|
|
6392
6445
|
const optimistic = {
|
|
6393
6446
|
id: localId,
|
|
@@ -6472,7 +6525,7 @@ function useChat(options = {}) {
|
|
|
6472
6525
|
const c = clientRef.current;
|
|
6473
6526
|
const earliest = messagesRef.current[0];
|
|
6474
6527
|
if (!c || !earliest) return false;
|
|
6475
|
-
const result = await c.support.getMessages({
|
|
6528
|
+
const result = await c.support.getMessages({ beforeSequence: earliest.sequence, limit: 50 });
|
|
6476
6529
|
if (!result.ok) {
|
|
6477
6530
|
setError(result.error);
|
|
6478
6531
|
return false;
|
|
@@ -6576,15 +6629,15 @@ function AuthElement({
|
|
|
6576
6629
|
}, [onReady, onAuthenticated, onError]);
|
|
6577
6630
|
React14.useEffect(() => {
|
|
6578
6631
|
if (!elements || !containerRef.current) return;
|
|
6579
|
-
const element = elements.create(
|
|
6632
|
+
const element = elements.create(chunkDQEXY542_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
6580
6633
|
elementRef.current = element;
|
|
6581
|
-
element.on(
|
|
6634
|
+
element.on(chunkDQEXY542_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6582
6635
|
element.on(
|
|
6583
|
-
|
|
6636
|
+
chunkDQEXY542_js.EVENT_TYPES.AUTHENTICATED,
|
|
6584
6637
|
(data) => onAuthenticatedRef.current?.(data)
|
|
6585
6638
|
);
|
|
6586
6639
|
element.on(
|
|
6587
|
-
|
|
6640
|
+
chunkDQEXY542_js.EVENT_TYPES.ERROR,
|
|
6588
6641
|
(data) => onErrorRef.current?.(data)
|
|
6589
6642
|
);
|
|
6590
6643
|
element.mount(containerRef.current);
|
|
@@ -6613,15 +6666,15 @@ function AddressElement({
|
|
|
6613
6666
|
}, [onReady, onChange, onError]);
|
|
6614
6667
|
React14.useEffect(() => {
|
|
6615
6668
|
if (!elements || !containerRef.current) return;
|
|
6616
|
-
const element = elements.create(
|
|
6669
|
+
const element = elements.create(chunkDQEXY542_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
6617
6670
|
elementRef.current = element;
|
|
6618
|
-
element.on(
|
|
6671
|
+
element.on(chunkDQEXY542_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6619
6672
|
element.on(
|
|
6620
|
-
|
|
6673
|
+
chunkDQEXY542_js.EVENT_TYPES.CHANGE,
|
|
6621
6674
|
(data) => onChangeRef.current?.(data)
|
|
6622
6675
|
);
|
|
6623
6676
|
element.on(
|
|
6624
|
-
|
|
6677
|
+
chunkDQEXY542_js.EVENT_TYPES.ERROR,
|
|
6625
6678
|
(data) => onErrorRef.current?.(data)
|
|
6626
6679
|
);
|
|
6627
6680
|
element.mount(containerRef.current);
|
|
@@ -6651,15 +6704,15 @@ function PaymentElement({
|
|
|
6651
6704
|
}, [onReady, onChange, onError]);
|
|
6652
6705
|
React14.useEffect(() => {
|
|
6653
6706
|
if (!elements || !containerRef.current) return;
|
|
6654
|
-
const element = elements.create(
|
|
6707
|
+
const element = elements.create(chunkDQEXY542_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
6655
6708
|
elementRef.current = element;
|
|
6656
|
-
element.on(
|
|
6709
|
+
element.on(chunkDQEXY542_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6657
6710
|
element.on(
|
|
6658
|
-
|
|
6711
|
+
chunkDQEXY542_js.EVENT_TYPES.CHANGE,
|
|
6659
6712
|
(data) => onChangeRef.current?.(data)
|
|
6660
6713
|
);
|
|
6661
6714
|
element.on(
|
|
6662
|
-
|
|
6715
|
+
chunkDQEXY542_js.EVENT_TYPES.ERROR,
|
|
6663
6716
|
(data) => onErrorRef.current?.(data)
|
|
6664
6717
|
);
|
|
6665
6718
|
element.mount(containerRef.current);
|
|
@@ -6816,7 +6869,7 @@ function VariantSelector({
|
|
|
6816
6869
|
if (!variants || variants.length <= 1) {
|
|
6817
6870
|
return null;
|
|
6818
6871
|
}
|
|
6819
|
-
basePrice != null ?
|
|
6872
|
+
basePrice != null ? chunkXAUSDMMZ_js.parsePrice(basePrice) : 0;
|
|
6820
6873
|
if (variantAxes && variantAxes.length > 0) {
|
|
6821
6874
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
6822
6875
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -6922,7 +6975,7 @@ function VariantSelector({
|
|
|
6922
6975
|
className: cn("divide-y divide-border", classNames?.list),
|
|
6923
6976
|
children: variants.map((variant) => {
|
|
6924
6977
|
const isSelected = selectedVariantId === variant.id;
|
|
6925
|
-
const adjustment =
|
|
6978
|
+
const adjustment = chunkXAUSDMMZ_js.parsePrice(variant.price_adjustment);
|
|
6926
6979
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6927
6980
|
radio.Radio.Root,
|
|
6928
6981
|
{
|
|
@@ -7190,16 +7243,16 @@ function BundleSelector({
|
|
|
7190
7243
|
}, [components, selections, onReady]);
|
|
7191
7244
|
const totalPrice = React14.useMemo(() => {
|
|
7192
7245
|
if (pricingType === "fixed" && bundlePrice) {
|
|
7193
|
-
return
|
|
7246
|
+
return chunkXAUSDMMZ_js.parsePrice(bundlePrice);
|
|
7194
7247
|
}
|
|
7195
7248
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
7196
7249
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
7197
7250
|
}, 0);
|
|
7198
7251
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
7199
|
-
return componentsTotal * (1 -
|
|
7252
|
+
return componentsTotal * (1 - chunkXAUSDMMZ_js.parsePrice(discountValue) / 100);
|
|
7200
7253
|
}
|
|
7201
7254
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
7202
|
-
return componentsTotal -
|
|
7255
|
+
return componentsTotal - chunkXAUSDMMZ_js.parsePrice(discountValue);
|
|
7203
7256
|
}
|
|
7204
7257
|
return componentsTotal;
|
|
7205
7258
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -7261,15 +7314,15 @@ function BundleSelector({
|
|
|
7261
7314
|
}
|
|
7262
7315
|
function getComponentPrice(component, selectedVariantId) {
|
|
7263
7316
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
7264
|
-
return
|
|
7317
|
+
return chunkXAUSDMMZ_js.parsePrice(component.effective_price);
|
|
7265
7318
|
}
|
|
7266
7319
|
if (selectedVariantId === component.variant_id) {
|
|
7267
|
-
return
|
|
7320
|
+
return chunkXAUSDMMZ_js.parsePrice(component.effective_price);
|
|
7268
7321
|
}
|
|
7269
7322
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
7270
7323
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
7271
|
-
if (!selectedAdj) return
|
|
7272
|
-
return
|
|
7324
|
+
if (!selectedAdj) return chunkXAUSDMMZ_js.parsePrice(component.effective_price);
|
|
7325
|
+
return chunkXAUSDMMZ_js.parsePrice(component.effective_price) - chunkXAUSDMMZ_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkXAUSDMMZ_js.parsePrice(selectedAdj.price_adjustment);
|
|
7273
7326
|
}
|
|
7274
7327
|
function formatDuration(minutes, unit) {
|
|
7275
7328
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -7383,7 +7436,7 @@ function BundleComponentCard({
|
|
|
7383
7436
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
7384
7437
|
children: component.available_variants.map((variant) => {
|
|
7385
7438
|
const isSelected = selectedVariantId === variant.id;
|
|
7386
|
-
const adjustment =
|
|
7439
|
+
const adjustment = chunkXAUSDMMZ_js.parsePrice(variant.price_adjustment);
|
|
7387
7440
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7388
7441
|
radio.Radio.Root,
|
|
7389
7442
|
{
|
|
@@ -7830,7 +7883,7 @@ function CompositeSelector({
|
|
|
7830
7883
|
"data-cimplify-composite-summary": true,
|
|
7831
7884
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
7832
7885
|
children: [
|
|
7833
|
-
|
|
7886
|
+
chunkXAUSDMMZ_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7834
7887
|
"div",
|
|
7835
7888
|
{
|
|
7836
7889
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7841,7 +7894,7 @@ function CompositeSelector({
|
|
|
7841
7894
|
]
|
|
7842
7895
|
}
|
|
7843
7896
|
),
|
|
7844
|
-
|
|
7897
|
+
chunkXAUSDMMZ_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7845
7898
|
"div",
|
|
7846
7899
|
{
|
|
7847
7900
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7985,7 +8038,7 @@ function BookingSummary({
|
|
|
7985
8038
|
className,
|
|
7986
8039
|
classNames
|
|
7987
8040
|
}) {
|
|
7988
|
-
const depositValue = depositAmount != null ?
|
|
8041
|
+
const depositValue = depositAmount != null ? chunkXAUSDMMZ_js.parsePrice(depositAmount) : 0;
|
|
7989
8042
|
const depositDue = depositType === "percentage" ? total * depositValue / 100 : depositType === "fixed" ? depositValue : 0;
|
|
7990
8043
|
const hasDeposit = depositDue > 0;
|
|
7991
8044
|
const balance = Math.max(0, total - depositDue);
|
|
@@ -8713,7 +8766,7 @@ function InputField({
|
|
|
8713
8766
|
currency,
|
|
8714
8767
|
classNames
|
|
8715
8768
|
}) {
|
|
8716
|
-
const hasPriceAdjustment = field.price_adjustment != null &&
|
|
8769
|
+
const hasPriceAdjustment = field.price_adjustment != null && chunkXAUSDMMZ_js.parsePrice(field.price_adjustment) > 0;
|
|
8717
8770
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
8718
8771
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
8719
8772
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -9845,15 +9898,15 @@ function ProductCustomizerContent({
|
|
|
9845
9898
|
}, [selectedAddOnOptionIds]);
|
|
9846
9899
|
const localTotalPrice = React14.useMemo(() => {
|
|
9847
9900
|
if (isComposite && compositePrice) {
|
|
9848
|
-
return
|
|
9901
|
+
return chunkXAUSDMMZ_js.parsePrice(compositePrice.final_price) * quantity;
|
|
9849
9902
|
}
|
|
9850
9903
|
if (isBundle && bundleTotalPrice != null) {
|
|
9851
9904
|
return bundleTotalPrice * quantity;
|
|
9852
9905
|
}
|
|
9853
|
-
let price =
|
|
9906
|
+
let price = chunkXAUSDMMZ_js.getVariantUnitPrice(product, selectedVariant);
|
|
9854
9907
|
for (const option of selectedAddOnOptions) {
|
|
9855
9908
|
if (option.default_price) {
|
|
9856
|
-
price +=
|
|
9909
|
+
price += chunkXAUSDMMZ_js.parsePrice(option.default_price);
|
|
9857
9910
|
}
|
|
9858
9911
|
}
|
|
9859
9912
|
return price * quantity;
|
|
@@ -9919,12 +9972,12 @@ function ProductCustomizerContent({
|
|
|
9919
9972
|
} = useQuote(quoteInput, {
|
|
9920
9973
|
enabled: quoteEnabled
|
|
9921
9974
|
});
|
|
9922
|
-
const currency = quote?.currency ??
|
|
9975
|
+
const currency = quote?.currency ?? chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
9923
9976
|
const quoteId = quote?.quote_id;
|
|
9924
9977
|
const quotedUnitPrice = (quote?.quoted_total_price_info ?? quote?.final_price_info)?.final_price;
|
|
9925
9978
|
const quotedTotalPrice = React14.useMemo(() => {
|
|
9926
9979
|
if (quotedUnitPrice === void 0 || quotedUnitPrice === null) return void 0;
|
|
9927
|
-
return
|
|
9980
|
+
return chunkXAUSDMMZ_js.parsePrice(quotedUnitPrice) * quantity;
|
|
9928
9981
|
}, [quotedUnitPrice, quantity]);
|
|
9929
9982
|
const quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2;
|
|
9930
9983
|
const validationMessage = !quoteEnabled ? REQUIRED_OPTIONS_MESSAGE : quoteError ? QUOTE_UNAVAILABLE_MESSAGE : !quoteIsReady ? QUOTE_LOADING_MESSAGE : null;
|
|
@@ -10148,7 +10201,7 @@ function ProductCustomizerContent({
|
|
|
10148
10201
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
|
|
10149
10202
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10150
10203
|
"Deposit required: ",
|
|
10151
|
-
|
|
10204
|
+
chunkXAUSDMMZ_js.parsePrice(product.deposit_amount),
|
|
10152
10205
|
"%"
|
|
10153
10206
|
] })
|
|
10154
10207
|
}
|
|
@@ -10256,10 +10309,10 @@ function ProductCustomizerContent({
|
|
|
10256
10309
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10257
10310
|
Price,
|
|
10258
10311
|
{
|
|
10259
|
-
amount:
|
|
10312
|
+
amount: chunkXAUSDMMZ_js.getUnitPriceAtQuantity(
|
|
10260
10313
|
product.quantity_pricing,
|
|
10261
10314
|
quantity,
|
|
10262
|
-
|
|
10315
|
+
chunkXAUSDMMZ_js.parsePrice(product.default_price)
|
|
10263
10316
|
),
|
|
10264
10317
|
currency,
|
|
10265
10318
|
className: "font-medium text-foreground"
|
|
@@ -10725,11 +10778,11 @@ function CartLineItemRow({
|
|
|
10725
10778
|
addOnOptions: item.addOnOptions
|
|
10726
10779
|
});
|
|
10727
10780
|
const pinnedUnitPrice = item._quotedUnitPrice;
|
|
10728
|
-
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice :
|
|
10781
|
+
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice : chunkXAUSDMMZ_js.parsePrice(pinnedUnitPrice);
|
|
10729
10782
|
const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
|
|
10730
10783
|
const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
|
|
10731
10784
|
const isOptimistic2 = item.isOptimistic === true;
|
|
10732
|
-
const lineTotal =
|
|
10785
|
+
const lineTotal = chunkXAUSDMMZ_js.parsePrice(unitPrice) * item.quantity;
|
|
10733
10786
|
const imageUrl = item.product.image_url;
|
|
10734
10787
|
const variantLabel2 = item.variant ? chunk2P4KXFB6_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
10735
10788
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11018,7 +11071,7 @@ function CartSummary({
|
|
|
11018
11071
|
removeItem,
|
|
11019
11072
|
updateQuantity
|
|
11020
11073
|
} = useCart();
|
|
11021
|
-
const displayCurrency = serverCart?.currency ??
|
|
11074
|
+
const displayCurrency = serverCart?.currency ?? chunkSFUJMS5E_js.currencyCode(currency);
|
|
11022
11075
|
const deliveryFee = serverCart?.delivery_fee;
|
|
11023
11076
|
const serviceCharge = serverCart?.service_charge;
|
|
11024
11077
|
const totalDiscounts = serverCart?.total_discounts;
|
|
@@ -11081,7 +11134,7 @@ function CartSummary({
|
|
|
11081
11134
|
]
|
|
11082
11135
|
}
|
|
11083
11136
|
),
|
|
11084
|
-
totalDiscounts != null &&
|
|
11137
|
+
totalDiscounts != null && chunkXAUSDMMZ_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11085
11138
|
"div",
|
|
11086
11139
|
{
|
|
11087
11140
|
"data-cimplify-cart-discount": true,
|
|
@@ -11107,7 +11160,7 @@ function CartSummary({
|
|
|
11107
11160
|
className: cn("flex items-baseline justify-between", classNames?.deliveryFee),
|
|
11108
11161
|
children: [
|
|
11109
11162
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
11110
|
-
|
|
11163
|
+
chunkXAUSDMMZ_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11111
11164
|
Price,
|
|
11112
11165
|
{
|
|
11113
11166
|
amount: deliveryFee,
|
|
@@ -11118,7 +11171,7 @@ function CartSummary({
|
|
|
11118
11171
|
]
|
|
11119
11172
|
}
|
|
11120
11173
|
),
|
|
11121
|
-
serviceCharge != null &&
|
|
11174
|
+
serviceCharge != null && chunkXAUSDMMZ_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11122
11175
|
"div",
|
|
11123
11176
|
{
|
|
11124
11177
|
"data-cimplify-cart-service-charge": true,
|
|
@@ -11252,18 +11305,18 @@ function SaleBadge({
|
|
|
11252
11305
|
className,
|
|
11253
11306
|
classNames
|
|
11254
11307
|
}) {
|
|
11255
|
-
const onSale =
|
|
11308
|
+
const onSale = chunkXAUSDMMZ_js.isOnSale(product);
|
|
11256
11309
|
const hasDeal = dealInfo !== void 0;
|
|
11257
11310
|
if (!hasDeal && !onSale && !label) {
|
|
11258
11311
|
return null;
|
|
11259
11312
|
}
|
|
11260
11313
|
let percentage = null;
|
|
11261
11314
|
if (product.sale) {
|
|
11262
|
-
percentage =
|
|
11315
|
+
percentage = chunkXAUSDMMZ_js.parsePrice(product.sale.percent_off);
|
|
11263
11316
|
} else if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
11264
|
-
percentage =
|
|
11317
|
+
percentage = chunkXAUSDMMZ_js.parsePrice(dealInfo.value);
|
|
11265
11318
|
} else if (onSale) {
|
|
11266
|
-
percentage =
|
|
11319
|
+
percentage = chunkXAUSDMMZ_js.getDiscountPercentage(product);
|
|
11267
11320
|
}
|
|
11268
11321
|
const badgeText = label ?? product.sale?.badge_text ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
11269
11322
|
if (!badgeText) {
|
|
@@ -11282,7 +11335,7 @@ function SaleBadge({
|
|
|
11282
11335
|
"%"
|
|
11283
11336
|
] }),
|
|
11284
11337
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
11285
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
11338
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkXAUSDMMZ_js.getBasePrice(product), currency: chunkXAUSDMMZ_js.getProductCurrency(product) }) })
|
|
11286
11339
|
]
|
|
11287
11340
|
}
|
|
11288
11341
|
);
|
|
@@ -11300,7 +11353,7 @@ function SalePrice({
|
|
|
11300
11353
|
if (!sale) {
|
|
11301
11354
|
return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
|
|
11302
11355
|
}
|
|
11303
|
-
const off = Math.round(
|
|
11356
|
+
const off = Math.round(chunkXAUSDMMZ_js.parsePrice(sale.percent_off));
|
|
11304
11357
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11305
11358
|
"span",
|
|
11306
11359
|
{
|
|
@@ -11676,7 +11729,7 @@ function ProductSheet({
|
|
|
11676
11729
|
Price,
|
|
11677
11730
|
{
|
|
11678
11731
|
amount: fullProduct.default_price,
|
|
11679
|
-
currency:
|
|
11732
|
+
currency: chunkXAUSDMMZ_js.getProductCurrency(fullProduct),
|
|
11680
11733
|
className: classNames?.price
|
|
11681
11734
|
}
|
|
11682
11735
|
)
|
|
@@ -11862,10 +11915,10 @@ function SoldOutOverlay() {
|
|
|
11862
11915
|
function SaleBadge2({ product }) {
|
|
11863
11916
|
let label = null;
|
|
11864
11917
|
if (product.sale) {
|
|
11865
|
-
const off = Math.round(
|
|
11918
|
+
const off = Math.round(chunkXAUSDMMZ_js.parsePrice(product.sale.percent_off));
|
|
11866
11919
|
label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
|
|
11867
|
-
} else if (
|
|
11868
|
-
const pct =
|
|
11920
|
+
} else if (chunkXAUSDMMZ_js.isOnSale(product)) {
|
|
11921
|
+
const pct = chunkXAUSDMMZ_js.getDiscountPercentage(product);
|
|
11869
11922
|
label = pct && pct > 0 ? `-${pct}%` : null;
|
|
11870
11923
|
}
|
|
11871
11924
|
if (!label) return null;
|
|
@@ -11906,7 +11959,7 @@ function FoodProductCard({
|
|
|
11906
11959
|
className
|
|
11907
11960
|
}) {
|
|
11908
11961
|
const image = product.image_url || product.images?.[0] || "";
|
|
11909
|
-
const currency =
|
|
11962
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
11910
11963
|
const tags = product.tags || [];
|
|
11911
11964
|
const isSignature = product.metadata?.is_signature === true;
|
|
11912
11965
|
const isNew = product.metadata?.is_new === true;
|
|
@@ -11962,9 +12015,9 @@ function RetailProductCard({
|
|
|
11962
12015
|
className
|
|
11963
12016
|
}) {
|
|
11964
12017
|
const image = product.image_url || product.images?.[0] || "";
|
|
11965
|
-
const currency =
|
|
12018
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
11966
12019
|
const outOfStock = product.inventory_status?.in_stock === false;
|
|
11967
|
-
const onSale =
|
|
12020
|
+
const onSale = chunkXAUSDMMZ_js.isOnSale(product);
|
|
11968
12021
|
const swatches = getColorSwatches(product);
|
|
11969
12022
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
11970
12023
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
@@ -11985,7 +12038,7 @@ function RetailProductCard({
|
|
|
11985
12038
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
|
|
11986
12039
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11987
12040
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
11988
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
12041
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkXAUSDMMZ_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
|
|
11989
12042
|
] }) }),
|
|
11990
12043
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11991
12044
|
"span",
|
|
@@ -12000,10 +12053,10 @@ function RetailProductCard({
|
|
|
12000
12053
|
] });
|
|
12001
12054
|
}
|
|
12002
12055
|
function PriceRange({ product, currency, className }) {
|
|
12003
|
-
const resolvedCurrency = currency ??
|
|
12004
|
-
const range =
|
|
12056
|
+
const resolvedCurrency = currency ?? chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12057
|
+
const range = chunkXAUSDMMZ_js.getPriceRange(product);
|
|
12005
12058
|
if (!range) return null;
|
|
12006
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
12059
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkXAUSDMMZ_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
12007
12060
|
}
|
|
12008
12061
|
function WholesaleProductCard({
|
|
12009
12062
|
product,
|
|
@@ -12013,7 +12066,7 @@ function WholesaleProductCard({
|
|
|
12013
12066
|
className
|
|
12014
12067
|
}) {
|
|
12015
12068
|
const image = product.image_url || product.images?.[0] || "";
|
|
12016
|
-
const currency =
|
|
12069
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12017
12070
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12018
12071
|
const status = product.inventory_status;
|
|
12019
12072
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12061,7 +12114,7 @@ function DigitalProductCard({
|
|
|
12061
12114
|
className
|
|
12062
12115
|
}) {
|
|
12063
12116
|
const image = product.image_url || product.images?.[0] || "";
|
|
12064
|
-
const currency =
|
|
12117
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12065
12118
|
const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
|
|
12066
12119
|
const isTicket = product.digital_type === "ticket";
|
|
12067
12120
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12092,11 +12145,11 @@ function BundleProductCard({
|
|
|
12092
12145
|
className
|
|
12093
12146
|
}) {
|
|
12094
12147
|
const image = product.image_url || product.images?.[0] || "";
|
|
12095
|
-
const currency =
|
|
12148
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12096
12149
|
const components = product.components || [];
|
|
12097
12150
|
const componentCount = components.length;
|
|
12098
|
-
const onSale =
|
|
12099
|
-
const discount =
|
|
12151
|
+
const onSale = chunkXAUSDMMZ_js.isOnSale(product);
|
|
12152
|
+
const discount = chunkXAUSDMMZ_js.getDiscountPercentage(product);
|
|
12100
12153
|
const hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
12101
12154
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12102
12155
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
@@ -12123,7 +12176,7 @@ function BundleProductCard({
|
|
|
12123
12176
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
12124
12177
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
12125
12178
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12126
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
12179
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkXAUSDMMZ_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
|
|
12127
12180
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
12128
12181
|
"Save ",
|
|
12129
12182
|
discount,
|
|
@@ -12143,7 +12196,7 @@ function CompositeProductCard({
|
|
|
12143
12196
|
className
|
|
12144
12197
|
}) {
|
|
12145
12198
|
const image = product.image_url || product.images?.[0] || "";
|
|
12146
|
-
const currency =
|
|
12199
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12147
12200
|
const groups = product.groups || [];
|
|
12148
12201
|
const groupCount = groups.length;
|
|
12149
12202
|
groups.reduce((sum, g) => sum + g.components.length, 0);
|
|
@@ -12195,7 +12248,7 @@ function StandardServiceCard({
|
|
|
12195
12248
|
className
|
|
12196
12249
|
}) {
|
|
12197
12250
|
const image = product.image_url || product.images?.[0] || "";
|
|
12198
|
-
const currency =
|
|
12251
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12199
12252
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12200
12253
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12201
12254
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
@@ -12250,7 +12303,7 @@ function CompactServiceCard({
|
|
|
12250
12303
|
className
|
|
12251
12304
|
}) {
|
|
12252
12305
|
const image = product.image_url || product.images?.[0] || "";
|
|
12253
|
-
const currency =
|
|
12306
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12254
12307
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12255
12308
|
const hasBillingPlans = product.billing_plans && product.billing_plans.length > 0;
|
|
12256
12309
|
const href = `/products/${product.slug}`;
|
|
@@ -12299,7 +12352,7 @@ function ScheduleServiceCard({
|
|
|
12299
12352
|
className
|
|
12300
12353
|
}) {
|
|
12301
12354
|
const image = product.image_url || product.images?.[0] || "";
|
|
12302
|
-
const currency =
|
|
12355
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12303
12356
|
const href = `/products/${product.slug}`;
|
|
12304
12357
|
const durationLabel = product.duration_minutes != null ? formatDuration2(product.duration_minutes, product.duration_unit) : null;
|
|
12305
12358
|
const displaySlots = (slots || []).slice(0, 3);
|
|
@@ -12371,7 +12424,7 @@ function RentalServiceCard({
|
|
|
12371
12424
|
className
|
|
12372
12425
|
}) {
|
|
12373
12426
|
const image = product.image_url || product.images?.[0] || "";
|
|
12374
|
-
const currency =
|
|
12427
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12375
12428
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12376
12429
|
const unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "day";
|
|
12377
12430
|
const priceUnit = product.price_basis === "per_person" ? "guest" : product.price_basis === "flat" ? "" : unit;
|
|
@@ -12441,7 +12494,7 @@ function AccommodationCard({
|
|
|
12441
12494
|
className
|
|
12442
12495
|
}) {
|
|
12443
12496
|
const image = product.image_url || product.images?.[0] || "";
|
|
12444
|
-
const currency =
|
|
12497
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12445
12498
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12446
12499
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
12447
12500
|
const tags = product.tags || [];
|
|
@@ -12507,7 +12560,7 @@ function LeaseServiceCard({
|
|
|
12507
12560
|
className
|
|
12508
12561
|
}) {
|
|
12509
12562
|
const image = product.image_url || product.images?.[0] || "";
|
|
12510
|
-
const currency =
|
|
12563
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12511
12564
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12512
12565
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12513
12566
|
const unit = product.duration_unit ? UNIT_LABELS3[product.duration_unit] || product.duration_unit : "mo";
|
|
@@ -12581,7 +12634,7 @@ function SubscriptionCard({
|
|
|
12581
12634
|
className
|
|
12582
12635
|
}) {
|
|
12583
12636
|
const image = product.image_url || product.images?.[0] || "";
|
|
12584
|
-
const currency =
|
|
12637
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
12585
12638
|
const plans = product.billing_plans || [];
|
|
12586
12639
|
const primaryPlan = plans[0];
|
|
12587
12640
|
const frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo";
|
|
@@ -12812,7 +12865,7 @@ function ProductCard({
|
|
|
12812
12865
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
|
|
12813
12866
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
|
|
12814
12867
|
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 }),
|
|
12815
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency:
|
|
12868
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunkXAUSDMMZ_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
|
|
12816
12869
|
] })
|
|
12817
12870
|
] });
|
|
12818
12871
|
})();
|
|
@@ -13141,7 +13194,7 @@ function SearchInput({
|
|
|
13141
13194
|
}
|
|
13142
13195
|
),
|
|
13143
13196
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
13144
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
13197
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkXAUSDMMZ_js.formatPrice(product.default_price) })
|
|
13145
13198
|
] })
|
|
13146
13199
|
},
|
|
13147
13200
|
product.id
|
|
@@ -13478,8 +13531,7 @@ var STATUS_LABELS = {
|
|
|
13478
13531
|
delivered: "Delivered",
|
|
13479
13532
|
picked_up: "Picked Up",
|
|
13480
13533
|
completed: "Completed",
|
|
13481
|
-
cancelled: "Cancelled"
|
|
13482
|
-
refunded: "Refunded"
|
|
13534
|
+
cancelled: "Cancelled"
|
|
13483
13535
|
};
|
|
13484
13536
|
var PAYMENT_STATE_LABELS = {
|
|
13485
13537
|
not_paid: "Not Paid",
|
|
@@ -13636,19 +13688,19 @@ function OrderSummary({
|
|
|
13636
13688
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
13637
13689
|
] }),
|
|
13638
13690
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
13639
|
-
order.total_discount != null &&
|
|
13691
|
+
order.total_discount != null && chunkXAUSDMMZ_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
13640
13692
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
13641
13693
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
13642
13694
|
] }),
|
|
13643
|
-
order.delivery_fee != null &&
|
|
13695
|
+
order.delivery_fee != null && chunkXAUSDMMZ_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
13644
13696
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
13645
13697
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
13646
13698
|
] }),
|
|
13647
|
-
order.service_charge != null &&
|
|
13699
|
+
order.service_charge != null && chunkXAUSDMMZ_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
13648
13700
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
13649
13701
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
13650
13702
|
] }),
|
|
13651
|
-
order.tax != null &&
|
|
13703
|
+
order.tax != null && chunkXAUSDMMZ_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
13652
13704
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
13653
13705
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
13654
13706
|
] }),
|
|
@@ -13691,8 +13743,7 @@ var STATUS_LABELS2 = {
|
|
|
13691
13743
|
delivered: "Delivered",
|
|
13692
13744
|
picked_up: "Picked Up",
|
|
13693
13745
|
completed: "Completed",
|
|
13694
|
-
cancelled: "Cancelled"
|
|
13695
|
-
refunded: "Refunded"
|
|
13746
|
+
cancelled: "Cancelled"
|
|
13696
13747
|
};
|
|
13697
13748
|
function OrderHistory({
|
|
13698
13749
|
orders: ordersProp,
|
|
@@ -14179,7 +14230,7 @@ function BookingPage({
|
|
|
14179
14230
|
const hasStaffStep = staff && staff.length > 0;
|
|
14180
14231
|
const depositType = product?.deposit_type;
|
|
14181
14232
|
const depositAmount = product?.deposit_amount;
|
|
14182
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
14233
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkXAUSDMMZ_js.parsePrice(depositAmount) !== 0;
|
|
14183
14234
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
14184
14235
|
const noShowFee = product?.no_show_fee;
|
|
14185
14236
|
const handleSlotSelect = React14.useCallback(
|
|
@@ -14312,14 +14363,14 @@ function BookingPage({
|
|
|
14312
14363
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price, currency }) }),
|
|
14313
14364
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
14314
14365
|
"Deposit: ",
|
|
14315
|
-
depositType === "percentage" ? `${
|
|
14366
|
+
depositType === "percentage" ? `${chunkXAUSDMMZ_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
|
|
14316
14367
|
] }),
|
|
14317
14368
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
14318
14369
|
"Free cancellation up to ",
|
|
14319
14370
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
14320
14371
|
" before"
|
|
14321
14372
|
] }),
|
|
14322
|
-
noShowFee !== void 0 &&
|
|
14373
|
+
noShowFee !== void 0 && chunkXAUSDMMZ_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
14323
14374
|
"No-show fee: ",
|
|
14324
14375
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee, currency })
|
|
14325
14376
|
] })
|
|
@@ -14422,7 +14473,7 @@ function BookingPage({
|
|
|
14422
14473
|
] }),
|
|
14423
14474
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
14424
14475
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
14425
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
14476
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkXAUSDMMZ_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
|
|
14426
14477
|
] })
|
|
14427
14478
|
] }),
|
|
14428
14479
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15096,9 +15147,9 @@ function DefaultProductLayout({
|
|
|
15096
15147
|
}) {
|
|
15097
15148
|
const [selectedVariantId, setSelectedVariantId] = React14__default.default.useState();
|
|
15098
15149
|
const images = chunk2P4KXFB6_js.resolveGallery(product, selectedVariantId);
|
|
15099
|
-
const currency =
|
|
15150
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15100
15151
|
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
15101
|
-
const onSale =
|
|
15152
|
+
const onSale = chunkXAUSDMMZ_js.isOnSale(product);
|
|
15102
15153
|
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
15103
15154
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
15104
15155
|
renderBreadcrumb?.(product),
|
|
@@ -15121,13 +15172,13 @@ function DefaultProductLayout({
|
|
|
15121
15172
|
/* @__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: [
|
|
15122
15173
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
|
|
15123
15174
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15124
|
-
/* @__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(
|
|
15175
|
+
/* @__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(chunkXAUSDMMZ_js.parsePrice(product.sale.percent_off))}% OFF` })
|
|
15125
15176
|
] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15126
15177
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
|
|
15127
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
15178
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkXAUSDMMZ_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15128
15179
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
15129
15180
|
"Save ",
|
|
15130
|
-
|
|
15181
|
+
chunkXAUSDMMZ_js.getDiscountPercentage(product),
|
|
15131
15182
|
"%"
|
|
15132
15183
|
] })
|
|
15133
15184
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-semibold" }) }),
|
|
@@ -15189,7 +15240,7 @@ function FoodProductLayout({
|
|
|
15189
15240
|
className
|
|
15190
15241
|
}) {
|
|
15191
15242
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15192
|
-
const currency =
|
|
15243
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15193
15244
|
const tags = product.tags || [];
|
|
15194
15245
|
const ingredients = getMetadataStringList(product.metadata, "ingredients");
|
|
15195
15246
|
const pairings = getMetadataStringList(product.metadata, "pairings");
|
|
@@ -15264,7 +15315,7 @@ function WholesaleProductLayout({
|
|
|
15264
15315
|
className
|
|
15265
15316
|
}) {
|
|
15266
15317
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15267
|
-
const currency =
|
|
15318
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15268
15319
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
15269
15320
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
|
|
15270
15321
|
renderBreadcrumb?.(product),
|
|
@@ -15348,9 +15399,9 @@ function ServiceProductLayout({
|
|
|
15348
15399
|
className
|
|
15349
15400
|
}) {
|
|
15350
15401
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15351
|
-
const currency =
|
|
15402
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15352
15403
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
15353
|
-
const depositAmount = hasDeposit ?
|
|
15404
|
+
const depositAmount = hasDeposit ? chunkXAUSDMMZ_js.parsePrice(product.deposit_amount) : 0;
|
|
15354
15405
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
15355
15406
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
15356
15407
|
renderBreadcrumb?.(product),
|
|
@@ -15418,7 +15469,7 @@ function ServiceProductLayout({
|
|
|
15418
15469
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency, className: "font-medium text-foreground" }),
|
|
15419
15470
|
" deposit charged at booking"
|
|
15420
15471
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15421
|
-
|
|
15472
|
+
chunkXAUSDMMZ_js.parsePrice(product.deposit_amount),
|
|
15422
15473
|
"% deposit charged at booking"
|
|
15423
15474
|
] }) })
|
|
15424
15475
|
] })
|
|
@@ -15450,7 +15501,7 @@ function DigitalProductLayout({
|
|
|
15450
15501
|
className
|
|
15451
15502
|
}) {
|
|
15452
15503
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15453
|
-
const currency =
|
|
15504
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15454
15505
|
const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
|
|
15455
15506
|
const isTicket = product.digital_type === "ticket";
|
|
15456
15507
|
const isAccessPass = product.digital_type === "access_grant";
|
|
@@ -15577,15 +15628,15 @@ function BundleProductLayout({
|
|
|
15577
15628
|
className
|
|
15578
15629
|
}) {
|
|
15579
15630
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15580
|
-
const currency =
|
|
15631
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15581
15632
|
const components = product.components || [];
|
|
15582
|
-
const onSale =
|
|
15583
|
-
const discount =
|
|
15633
|
+
const onSale = chunkXAUSDMMZ_js.isOnSale(product);
|
|
15634
|
+
const discount = chunkXAUSDMMZ_js.getDiscountPercentage(product);
|
|
15584
15635
|
const baseTotal = components.reduce(
|
|
15585
|
-
(sum, c) => sum +
|
|
15636
|
+
(sum, c) => sum + chunkXAUSDMMZ_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
15586
15637
|
0
|
|
15587
15638
|
);
|
|
15588
|
-
const bundlePrice =
|
|
15639
|
+
const bundlePrice = chunkXAUSDMMZ_js.parsePrice(product.default_price);
|
|
15589
15640
|
const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
15590
15641
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
15591
15642
|
renderBreadcrumb?.(product),
|
|
@@ -15661,7 +15712,7 @@ function CompositeProductLayout({
|
|
|
15661
15712
|
className
|
|
15662
15713
|
}) {
|
|
15663
15714
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15664
|
-
const currency =
|
|
15715
|
+
const currency = chunkXAUSDMMZ_js.getProductCurrency(product);
|
|
15665
15716
|
const groups = product.groups || [];
|
|
15666
15717
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "composite", className: cn("space-y-8", className), children: [
|
|
15667
15718
|
renderBreadcrumb?.(product),
|
|
@@ -16084,7 +16135,7 @@ function CartDrawer({
|
|
|
16084
16135
|
}) {
|
|
16085
16136
|
const { isOpen, close } = useCartDrawer();
|
|
16086
16137
|
const cart = useCart();
|
|
16087
|
-
const subtotalNum =
|
|
16138
|
+
const subtotalNum = chunkXAUSDMMZ_js.parsePrice(cart.subtotal);
|
|
16088
16139
|
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
16089
16140
|
React14.useEffect(() => {
|
|
16090
16141
|
if (!isOpen) return;
|
|
@@ -16478,9 +16529,9 @@ function CatalogueCollectionLayout({
|
|
|
16478
16529
|
result = result.filter((p) => p.tags?.includes(activeCategory));
|
|
16479
16530
|
}
|
|
16480
16531
|
if (sortBy === "price-asc") {
|
|
16481
|
-
result = [...result].sort((a, b) =>
|
|
16532
|
+
result = [...result].sort((a, b) => chunkXAUSDMMZ_js.parsePrice(a.default_price) - chunkXAUSDMMZ_js.parsePrice(b.default_price));
|
|
16482
16533
|
} else if (sortBy === "price-desc") {
|
|
16483
|
-
result = [...result].sort((a, b) =>
|
|
16534
|
+
result = [...result].sort((a, b) => chunkXAUSDMMZ_js.parsePrice(b.default_price) - chunkXAUSDMMZ_js.parsePrice(a.default_price));
|
|
16484
16535
|
} else if (sortBy === "name") {
|
|
16485
16536
|
result = [...result].sort((a, b) => a.name.localeCompare(b.name));
|
|
16486
16537
|
}
|
|
@@ -20009,7 +20060,7 @@ function toneChip(value) {
|
|
|
20009
20060
|
}
|
|
20010
20061
|
}
|
|
20011
20062
|
function money(amount, currency) {
|
|
20012
|
-
return
|
|
20063
|
+
return chunkXAUSDMMZ_js.formatPrice(chunkXAUSDMMZ_js.parsePrice(num(amount) ?? 0), text(currency));
|
|
20013
20064
|
}
|
|
20014
20065
|
var CHAT_GENUI_COMPONENTS = {
|
|
20015
20066
|
Stack: ({ node, ctx }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20257,7 +20308,7 @@ function ReplyCardView({
|
|
|
20257
20308
|
card.image_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
|
|
20258
20309
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
20259
20310
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
|
|
20260
|
-
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children:
|
|
20311
|
+
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunkXAUSDMMZ_js.formatPrice(chunkXAUSDMMZ_js.parsePrice(card.price), currency ?? void 0) }),
|
|
20261
20312
|
fire2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
|
|
20262
20313
|
] })
|
|
20263
20314
|
]
|
|
@@ -20354,12 +20405,12 @@ function ChatWidget({
|
|
|
20354
20405
|
setAttachError(null);
|
|
20355
20406
|
if (!isAllowedAttachment(file)) {
|
|
20356
20407
|
setAttachError(
|
|
20357
|
-
new
|
|
20408
|
+
new chunkSFUJMS5E_js.CimplifyError("invalid_attachment", "Only photos and documents can be attached.")
|
|
20358
20409
|
);
|
|
20359
20410
|
return;
|
|
20360
20411
|
}
|
|
20361
20412
|
if (file.size > MAX_ATTACHMENT_BYTES) {
|
|
20362
|
-
setAttachError(new
|
|
20413
|
+
setAttachError(new chunkSFUJMS5E_js.CimplifyError("attachment_too_large", "Files must be under 25MB."));
|
|
20363
20414
|
return;
|
|
20364
20415
|
}
|
|
20365
20416
|
const uploaded = await client.uploads.upload(file);
|
|
@@ -20895,6 +20946,7 @@ function KeepConversation({ client }) {
|
|
|
20895
20946
|
const [dismissed, setDismissed] = React14.useState(readKeepDismissed);
|
|
20896
20947
|
const [contact, setContact] = React14.useState("");
|
|
20897
20948
|
const [code, setCode] = React14.useState("");
|
|
20949
|
+
const [challengeId, setChallengeId] = React14.useState(null);
|
|
20898
20950
|
const [busy, setBusy] = React14.useState(false);
|
|
20899
20951
|
const [verifyError, setVerifyError] = React14.useState(null);
|
|
20900
20952
|
if (dismissed) return null;
|
|
@@ -20907,6 +20959,7 @@ function KeepConversation({ client }) {
|
|
|
20907
20959
|
const result = await client.link.requestOtp({ contact: trimmed, contact_type: contactType });
|
|
20908
20960
|
setBusy(false);
|
|
20909
20961
|
if (result.ok) {
|
|
20962
|
+
setChallengeId(result.value.challenge_id);
|
|
20910
20963
|
setCode("");
|
|
20911
20964
|
setStep("code");
|
|
20912
20965
|
} else {
|
|
@@ -20914,10 +20967,11 @@ function KeepConversation({ client }) {
|
|
|
20914
20967
|
}
|
|
20915
20968
|
};
|
|
20916
20969
|
const verify = async (value) => {
|
|
20917
|
-
if (value.length !== 6 || busy) return;
|
|
20970
|
+
if (value.length !== 6 || busy || challengeId === null) return;
|
|
20918
20971
|
setBusy(true);
|
|
20919
20972
|
setVerifyError(null);
|
|
20920
20973
|
const result = await client.link.verifyOtp({
|
|
20974
|
+
...challengeId === void 0 ? {} : { challenge_id: challengeId },
|
|
20921
20975
|
contact: contact.trim(),
|
|
20922
20976
|
contact_type: contactType,
|
|
20923
20977
|
otp_code: value
|
|
@@ -21292,6 +21346,10 @@ async function genUIFingerprint(manifest) {
|
|
|
21292
21346
|
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
21293
21347
|
}
|
|
21294
21348
|
|
|
21349
|
+
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
21350
|
+
enumerable: true,
|
|
21351
|
+
get: function () { return chunk2P4KXFB6_js.getVariantDisplayName; }
|
|
21352
|
+
});
|
|
21295
21353
|
Object.defineProperty(exports, "messagePreview", {
|
|
21296
21354
|
enumerable: true,
|
|
21297
21355
|
get: function () { return chunkXREIZ56K_js.messagePreview; }
|
|
@@ -21300,10 +21358,6 @@ Object.defineProperty(exports, "splitGenUIContent", {
|
|
|
21300
21358
|
enumerable: true,
|
|
21301
21359
|
get: function () { return chunkXREIZ56K_js.splitGenUIContent; }
|
|
21302
21360
|
});
|
|
21303
|
-
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
21304
|
-
enumerable: true,
|
|
21305
|
-
get: function () { return chunk2P4KXFB6_js.getVariantDisplayName; }
|
|
21306
|
-
});
|
|
21307
21361
|
exports.AccommodationCard = AccommodationCard;
|
|
21308
21362
|
exports.AccountContent = AccountContent;
|
|
21309
21363
|
exports.AccountDashboardPage = AccountDashboardPage;
|