@cimplify/sdk 0.101.1 → 0.103.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/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +23 -22
- package/dist/advanced.mjs +4 -3
- package/dist/{chunk-QPRI2NII.js → chunk-2P4KXFB6.js} +6 -0
- package/dist/{chunk-4G5UWFC3.mjs → chunk-3V4DVXV3.mjs} +6 -1
- package/dist/{chunk-YHPMFTMN.mjs → chunk-C2JSNJUC.mjs} +406 -95
- package/dist/chunk-CNN7Z2IP.js +125 -0
- package/dist/{chunk-DKLHCZ5M.mjs → chunk-GERXZQSX.mjs} +487 -11
- package/dist/chunk-GOHSXBKW.mjs +105 -0
- package/dist/{chunk-7H6IL7CX.mjs → chunk-H7ACMHM3.mjs} +40 -15
- package/dist/{chunk-Z3K2D3TE.mjs → chunk-J6PNHDHL.mjs} +453 -483
- package/dist/{chunk-NIOUSKQQ.js → chunk-JG5CQNCB.js} +5 -0
- package/dist/{chunk-YER7DIOM.js → chunk-JSWJ4XDE.js} +471 -519
- package/dist/{chunk-DLW3RWRK.mjs → chunk-M4URVKHE.mjs} +46 -12
- package/dist/{chunk-WMEC5JWN.js → chunk-NNG6IFFX.js} +50 -13
- package/dist/{chunk-ICCCSVN3.js → chunk-QOWPGS7Z.js} +42 -16
- package/dist/{chunk-YDA46OZ6.js → chunk-R6OLQ33I.js} +560 -80
- package/dist/{chunk-H5SSGN7W.js → chunk-VIL6IQCG.js} +408 -97
- package/dist/{chunk-O3YUHLZL.mjs → chunk-VNPEYLB2.mjs} +5 -0
- package/dist/{client-Db554902.d.ts → client-BfpNjJ_a.d.mts} +93 -299
- package/dist/{client-CdTx7X_X.d.mts → client-DHBwvh7U.d.ts} +93 -299
- package/dist/{client-WkUcvRvO.d.mts → client-DpqRobY9.d.mts} +2 -2
- package/dist/{client-D40kI8z2.d.ts → client-Dqg2mc-7.d.ts} +2 -2
- package/dist/{index-D3UXgAYl.d.ts → index-C8uDqLwJ.d.ts} +14 -4
- package/dist/{index-BjWUkYgY.d.mts → index-e2y6AK70.d.mts} +14 -4
- package/dist/index.d.mts +92 -8
- package/dist/index.d.ts +92 -8
- package/dist/index.js +225 -188
- package/dist/index.mjs +7 -6
- package/dist/link-cuNVYc2s.d.mts +297 -0
- package/dist/link-cuNVYc2s.d.ts +297 -0
- package/dist/mock/cli.mjs +412 -94
- package/dist/mock/library.js +412 -94
- package/dist/mock/library.mjs +412 -94
- package/dist/mock/msw.js +412 -94
- package/dist/mock/msw.mjs +412 -94
- package/dist/{product-DwKdC_to.d.mts → payment-H5LoIvXU.d.mts} +207 -7
- package/dist/{product-DwKdC_to.d.ts → payment-H5LoIvXU.d.ts} +207 -7
- package/dist/{price-CiQUd_XX.d.mts → price-BvePgDXe.d.mts} +1 -1
- package/dist/{price-D9EOj8y8.d.ts → price-C2RqscMY.d.ts} +1 -1
- package/dist/react.d.mts +6 -4
- package/dist/react.d.ts +6 -4
- package/dist/react.js +203 -198
- package/dist/react.mjs +11 -6
- package/dist/{server-CeDb93WA.d.ts → server-C7FyLdrz.d.mts} +11 -9
- package/dist/{server-D-nSkrUr.d.mts → server-DoXIpSd7.d.ts} +11 -9
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +11 -10
- package/dist/server.mjs +5 -4
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +4 -3
- package/dist/testing/msw.mjs +3 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.d.mts +175 -45
- package/dist/testing.d.ts +175 -45
- package/dist/testing.js +86 -81
- package/dist/testing.mjs +8 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +37 -29
- package/dist/utils.mjs +2 -2
- package/package.json +7 -1
- package/dist/payment-CRqjGrx6.d.mts +0 -113
- package/dist/payment-DO1Z1Ip6.d.ts +0 -113
package/dist/react.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
5
|
+
var chunk2P4KXFB6_js = require('./chunk-2P4KXFB6.js');
|
|
6
|
+
var chunkR6OLQ33I_js = require('./chunk-R6OLQ33I.js');
|
|
7
|
+
var chunkJSWJ4XDE_js = require('./chunk-JSWJ4XDE.js');
|
|
8
|
+
require('./chunk-CNN7Z2IP.js');
|
|
9
|
+
var chunkNNG6IFFX_js = require('./chunk-NNG6IFFX.js');
|
|
10
|
+
var chunkJG5CQNCB_js = require('./chunk-JG5CQNCB.js');
|
|
10
11
|
require('./chunk-OWW5GUSB.js');
|
|
11
12
|
var React14 = require('react');
|
|
12
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -455,6 +456,7 @@ function transformToCheckoutCart(cart, fx, checkout) {
|
|
|
455
456
|
currency: fx?.displayCurrency ?? cart.pricing.currency,
|
|
456
457
|
tax_inclusive: cart.pricing.tax_inclusive ?? false,
|
|
457
458
|
tax_rate: cart.pricing.tax_rate,
|
|
459
|
+
price_display_mode: cart.pricing.price_display_mode,
|
|
458
460
|
deposit_required: cart.pricing.deposit_required ?? false,
|
|
459
461
|
deposit_amount: cart.pricing.deposit_amount != null ? amt(cart.pricing.deposit_amount) : void 0,
|
|
460
462
|
requires_delivery: cart.requires_delivery
|
|
@@ -633,14 +635,14 @@ function attachInternalItemMetadata(item, metadata = {}) {
|
|
|
633
635
|
}
|
|
634
636
|
function calculateLineSubtotal(item) {
|
|
635
637
|
if (item._quotedUnitPrice !== void 0) {
|
|
636
|
-
return roundMoney(
|
|
638
|
+
return roundMoney(chunkNNG6IFFX_js.parsePrice(item._quotedUnitPrice) * item.quantity);
|
|
637
639
|
}
|
|
638
|
-
let unitPrice =
|
|
640
|
+
let unitPrice = chunkNNG6IFFX_js.parsePrice(item.product.default_price);
|
|
639
641
|
if (item.variant?.price_adjustment) {
|
|
640
|
-
unitPrice +=
|
|
642
|
+
unitPrice += chunkNNG6IFFX_js.parsePrice(item.variant.price_adjustment);
|
|
641
643
|
}
|
|
642
644
|
for (const option of item.addOnOptions || []) {
|
|
643
|
-
if (option.default_price) unitPrice +=
|
|
645
|
+
if (option.default_price) unitPrice += chunkNNG6IFFX_js.parsePrice(option.default_price);
|
|
644
646
|
}
|
|
645
647
|
return roundMoney(unitPrice * item.quantity);
|
|
646
648
|
}
|
|
@@ -713,6 +715,7 @@ function emptyBase(currency, isLoading = true) {
|
|
|
713
715
|
tax: 0,
|
|
714
716
|
taxRate: null,
|
|
715
717
|
taxInclusive: false,
|
|
718
|
+
displayGross: false,
|
|
716
719
|
taxJurisdictionLabel: null,
|
|
717
720
|
total: 0,
|
|
718
721
|
currency,
|
|
@@ -812,6 +815,7 @@ function mapServerCart(serverCart, fallbackCurrency) {
|
|
|
812
815
|
tax: roundMoney(toNumber(serverCart.pricing.tax_amount)),
|
|
813
816
|
taxRate: serverCart.pricing.tax_rate != null ? toNumber(serverCart.pricing.tax_rate) : null,
|
|
814
817
|
taxInclusive: serverCart.pricing.tax_inclusive,
|
|
818
|
+
displayGross: chunk2P4KXFB6_js.displaysGrossPrices(serverCart.pricing),
|
|
815
819
|
taxJurisdictionLabel: serverCart.pricing.tax_jurisdiction_label ?? null,
|
|
816
820
|
total: roundMoney(toNumber(serverCart.pricing.total_price)),
|
|
817
821
|
currency: serverCart.pricing.currency || fallbackCurrency,
|
|
@@ -859,7 +863,7 @@ async function syncFromServer(entry) {
|
|
|
859
863
|
return next;
|
|
860
864
|
}
|
|
861
865
|
function emitMutationError(entry, operation, opId, idempotencyKey, error) {
|
|
862
|
-
entry.client.events.emit(
|
|
866
|
+
entry.client.events.emit(chunkR6OLQ33I_js.MUTATION_ERROR, {
|
|
863
867
|
service: "cart",
|
|
864
868
|
operation,
|
|
865
869
|
opId,
|
|
@@ -899,10 +903,10 @@ function getOrCreateStore(params) {
|
|
|
899
903
|
syncTail: Promise.resolve(),
|
|
900
904
|
failedOpRemovers: /* @__PURE__ */ new Set()
|
|
901
905
|
};
|
|
902
|
-
client.events.on(
|
|
906
|
+
client.events.on(chunkR6OLQ33I_js.SESSION_CLAIMED, () => {
|
|
903
907
|
if (entry.initialized) void syncFromServer(entry);
|
|
904
908
|
});
|
|
905
|
-
client.events.on(
|
|
909
|
+
client.events.on(chunkR6OLQ33I_js.SESSION_CLEARED, () => {
|
|
906
910
|
if (entry.initialized) void syncFromServer(entry);
|
|
907
911
|
});
|
|
908
912
|
cartStores.set(storeKey, entry);
|
|
@@ -1146,6 +1150,7 @@ function useCart(options = {}) {
|
|
|
1146
1150
|
tax: view.tax,
|
|
1147
1151
|
taxRate: view.taxRate,
|
|
1148
1152
|
taxInclusive: view.taxInclusive,
|
|
1153
|
+
displayGross: view.displayGross,
|
|
1149
1154
|
taxJurisdictionLabel: view.taxJurisdictionLabel,
|
|
1150
1155
|
total: view.total,
|
|
1151
1156
|
currency: view.currency,
|
|
@@ -1209,7 +1214,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1209
1214
|
function createDefaultClient() {
|
|
1210
1215
|
const processRef = globalThis.process;
|
|
1211
1216
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1212
|
-
return
|
|
1217
|
+
return chunkR6OLQ33I_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1213
1218
|
}
|
|
1214
1219
|
function getStoredLocationId() {
|
|
1215
1220
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1313,7 +1318,7 @@ function CimplifyProvider({
|
|
|
1313
1318
|
const setDisplayCurrency = React14.useCallback(
|
|
1314
1319
|
(currency) => {
|
|
1315
1320
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1316
|
-
if (normalized && !
|
|
1321
|
+
if (normalized && !chunkJG5CQNCB_js.isSupportedCurrency(normalized)) {
|
|
1317
1322
|
return;
|
|
1318
1323
|
}
|
|
1319
1324
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -1362,7 +1367,7 @@ function CimplifyProvider({
|
|
|
1362
1367
|
const apiCredentials = resolvedClient.getCredentialsMode() === "include" ? "use-credentials" : "anonymous";
|
|
1363
1368
|
preconnectOrigin(resolvedClient.getBaseUrl(), apiCredentials);
|
|
1364
1369
|
preconnectOrigin(resolvedClient.getLinkApiUrl(), apiCredentials);
|
|
1365
|
-
preconnectOrigin(
|
|
1370
|
+
preconnectOrigin(chunk2P4KXFB6_js.DEFAULT_CDN_BASE_URL);
|
|
1366
1371
|
}
|
|
1367
1372
|
const setCurrentLocation = React14.useCallback(
|
|
1368
1373
|
(location) => {
|
|
@@ -3257,19 +3262,19 @@ function toAccountLineItem(item, currency) {
|
|
|
3257
3262
|
quantity: s.quantity,
|
|
3258
3263
|
name: s.product_name,
|
|
3259
3264
|
variantName: s.variant_name,
|
|
3260
|
-
priceLabel:
|
|
3265
|
+
priceLabel: chunkNNG6IFFX_js.parsePrice(s.unit_price) > 0 ? chunkNNG6IFFX_js.formatMoney(s.unit_price, currency) : void 0
|
|
3261
3266
|
}));
|
|
3262
3267
|
const customisations = item.composite_selections?.selections.map((s) => ({
|
|
3263
3268
|
quantity: s.quantity,
|
|
3264
3269
|
name: s.component_name,
|
|
3265
|
-
priceLabel:
|
|
3270
|
+
priceLabel: chunkNNG6IFFX_js.parsePrice(s.unit_price) > 0 ? `+${chunkNNG6IFFX_js.formatMoney(s.unit_price, currency)}` : void 0
|
|
3266
3271
|
}));
|
|
3267
3272
|
const data = {
|
|
3268
3273
|
id: item.id,
|
|
3269
3274
|
name: item.product_name ?? "Item",
|
|
3270
3275
|
imageUrl: item.image_url,
|
|
3271
3276
|
subtitle: lineSubtitle(item),
|
|
3272
|
-
priceLabel:
|
|
3277
|
+
priceLabel: chunkNNG6IFFX_js.formatMoney(item.total_price, currency),
|
|
3273
3278
|
lineType: item.line_type,
|
|
3274
3279
|
includes,
|
|
3275
3280
|
customisations,
|
|
@@ -3319,20 +3324,20 @@ var PAYMENT_TONE = {
|
|
|
3319
3324
|
function toAccountOrderView(order, opts = {}) {
|
|
3320
3325
|
const currency = order.payment.currency;
|
|
3321
3326
|
const rows = [
|
|
3322
|
-
{ label: "Subtotal", value:
|
|
3327
|
+
{ label: "Subtotal", value: chunkNNG6IFFX_js.formatMoney(order.pricing.subtotal, currency) }
|
|
3323
3328
|
];
|
|
3324
|
-
if (
|
|
3329
|
+
if (chunkNNG6IFFX_js.parsePrice(order.pricing.total_discount) > 0) {
|
|
3325
3330
|
rows.push({
|
|
3326
3331
|
label: "Discount",
|
|
3327
|
-
value: `\u2212${
|
|
3332
|
+
value: `\u2212${chunkNNG6IFFX_js.formatMoney(order.pricing.total_discount, currency)}`,
|
|
3328
3333
|
tone: "positive"
|
|
3329
3334
|
});
|
|
3330
3335
|
}
|
|
3331
|
-
if (order.pricing.tax &&
|
|
3332
|
-
rows.push({ label: "Tax", value:
|
|
3336
|
+
if (order.pricing.tax && chunkNNG6IFFX_js.parsePrice(order.pricing.tax) > 0) {
|
|
3337
|
+
rows.push({ label: "Tax", value: chunkNNG6IFFX_js.formatMoney(order.pricing.tax, currency) });
|
|
3333
3338
|
}
|
|
3334
|
-
if (order.pricing.service_charge &&
|
|
3335
|
-
rows.push({ label: "Service", value:
|
|
3339
|
+
if (order.pricing.service_charge && chunkNNG6IFFX_js.parsePrice(order.pricing.service_charge) > 0) {
|
|
3340
|
+
rows.push({ label: "Service", value: chunkNNG6IFFX_js.formatMoney(order.pricing.service_charge, currency) });
|
|
3336
3341
|
}
|
|
3337
3342
|
const placed = fmtDateTime(order.timestamps.created_at);
|
|
3338
3343
|
const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
@@ -3346,7 +3351,7 @@ function toAccountOrderView(order, opts = {}) {
|
|
|
3346
3351
|
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
3347
3352
|
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
3348
3353
|
rows,
|
|
3349
|
-
total: { label: "Total", value:
|
|
3354
|
+
total: { label: "Total", value: chunkNNG6IFFX_js.formatMoney(order.pricing.total_price, currency) }
|
|
3350
3355
|
},
|
|
3351
3356
|
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
3352
3357
|
onBack: opts.onBack
|
|
@@ -3521,7 +3526,7 @@ function CimplifySignInButton({
|
|
|
3521
3526
|
const onClick = async () => {
|
|
3522
3527
|
if (busy || disabled || !signInOpts.clientId) return;
|
|
3523
3528
|
setBusy(true);
|
|
3524
|
-
await
|
|
3529
|
+
await chunkJSWJ4XDE_js.startSignIn({
|
|
3525
3530
|
...signInOpts,
|
|
3526
3531
|
onSuccess: () => {
|
|
3527
3532
|
setBusy(false);
|
|
@@ -4376,7 +4381,7 @@ function Price({
|
|
|
4376
4381
|
const resolvedAmount = fxActive ? context.convertPrice(amount) : typeof amount === "string" ? parseFloat(amount) || 0 : amount;
|
|
4377
4382
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
4378
4383
|
prefix,
|
|
4379
|
-
|
|
4384
|
+
chunkNNG6IFFX_js.formatPrice(resolvedAmount, resolvedCurrency)
|
|
4380
4385
|
] });
|
|
4381
4386
|
}
|
|
4382
4387
|
function createCachedQuery(config) {
|
|
@@ -4989,9 +4994,9 @@ function useClientSessionEpoch(client) {
|
|
|
4989
4994
|
const subscribe = React14.useCallback(
|
|
4990
4995
|
(notify) => {
|
|
4991
4996
|
const unsubscribe = [
|
|
4992
|
-
client.events.on(
|
|
4993
|
-
client.events.on(
|
|
4994
|
-
client.events.on(
|
|
4997
|
+
client.events.on(chunkR6OLQ33I_js.AUTH_TOKEN_CHANGED, notify),
|
|
4998
|
+
client.events.on(chunkR6OLQ33I_js.SESSION_CLAIMED, notify),
|
|
4999
|
+
client.events.on(chunkR6OLQ33I_js.SESSION_CLEARED, notify)
|
|
4995
5000
|
];
|
|
4996
5001
|
return () => {
|
|
4997
5002
|
for (const stopListening of unsubscribe) {
|
|
@@ -5478,13 +5483,13 @@ function useProductPrice(input) {
|
|
|
5478
5483
|
if (bundleTotalPrice != null) {
|
|
5479
5484
|
unitPrice = bundleTotalPrice;
|
|
5480
5485
|
} else if (compositePrice) {
|
|
5481
|
-
unitPrice =
|
|
5486
|
+
unitPrice = chunkNNG6IFFX_js.parsePrice(compositePrice.final_price);
|
|
5482
5487
|
} else {
|
|
5483
|
-
unitPrice =
|
|
5488
|
+
unitPrice = chunkNNG6IFFX_js.getVariantUnitPrice(product, variant);
|
|
5484
5489
|
if (addOnOptions) {
|
|
5485
5490
|
for (const option of addOnOptions) {
|
|
5486
5491
|
if (option.default_price) {
|
|
5487
|
-
unitPrice +=
|
|
5492
|
+
unitPrice += chunkNNG6IFFX_js.parsePrice(option.default_price);
|
|
5488
5493
|
}
|
|
5489
5494
|
}
|
|
5490
5495
|
}
|
|
@@ -6321,7 +6326,7 @@ function useChat(options = {}) {
|
|
|
6321
6326
|
const watchSessionClaims = React14.useCallback(() => {
|
|
6322
6327
|
const c = clientRef.current;
|
|
6323
6328
|
if (!c || claimUnsubRef.current) return;
|
|
6324
|
-
const unsubClaimed = c.events.on(
|
|
6329
|
+
const unsubClaimed = c.events.on(chunkR6OLQ33I_js.SESSION_CLAIMED, (event) => {
|
|
6325
6330
|
setClaimedAs(event.customerName || c.support.claimedCustomerName || null);
|
|
6326
6331
|
if (!openedRef.current) {
|
|
6327
6332
|
void openIfExisting();
|
|
@@ -6330,7 +6335,7 @@ function useChat(options = {}) {
|
|
|
6330
6335
|
connectWebSocket();
|
|
6331
6336
|
void resyncConversation();
|
|
6332
6337
|
});
|
|
6333
|
-
const unsubCleared = c.events.on(
|
|
6338
|
+
const unsubCleared = c.events.on(chunkR6OLQ33I_js.SESSION_CLEARED, resetConversation);
|
|
6334
6339
|
claimUnsubRef.current = () => {
|
|
6335
6340
|
unsubClaimed();
|
|
6336
6341
|
unsubCleared();
|
|
@@ -6382,7 +6387,7 @@ function useChat(options = {}) {
|
|
|
6382
6387
|
if (!openedRef.current) return false;
|
|
6383
6388
|
}
|
|
6384
6389
|
const replyTo = opts?.replyTo;
|
|
6385
|
-
const clientId =
|
|
6390
|
+
const clientId = chunkJSWJ4XDE_js.generateIdempotencyKey();
|
|
6386
6391
|
const localId = optimisticId(clientId);
|
|
6387
6392
|
const optimistic = {
|
|
6388
6393
|
id: localId,
|
|
@@ -6571,15 +6576,15 @@ function AuthElement({
|
|
|
6571
6576
|
}, [onReady, onAuthenticated, onError]);
|
|
6572
6577
|
React14.useEffect(() => {
|
|
6573
6578
|
if (!elements || !containerRef.current) return;
|
|
6574
|
-
const element = elements.create(
|
|
6579
|
+
const element = elements.create(chunkJSWJ4XDE_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
6575
6580
|
elementRef.current = element;
|
|
6576
|
-
element.on(
|
|
6581
|
+
element.on(chunkJSWJ4XDE_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6577
6582
|
element.on(
|
|
6578
|
-
|
|
6583
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.AUTHENTICATED,
|
|
6579
6584
|
(data) => onAuthenticatedRef.current?.(data)
|
|
6580
6585
|
);
|
|
6581
6586
|
element.on(
|
|
6582
|
-
|
|
6587
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.ERROR,
|
|
6583
6588
|
(data) => onErrorRef.current?.(data)
|
|
6584
6589
|
);
|
|
6585
6590
|
element.mount(containerRef.current);
|
|
@@ -6608,15 +6613,15 @@ function AddressElement({
|
|
|
6608
6613
|
}, [onReady, onChange, onError]);
|
|
6609
6614
|
React14.useEffect(() => {
|
|
6610
6615
|
if (!elements || !containerRef.current) return;
|
|
6611
|
-
const element = elements.create(
|
|
6616
|
+
const element = elements.create(chunkJSWJ4XDE_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
6612
6617
|
elementRef.current = element;
|
|
6613
|
-
element.on(
|
|
6618
|
+
element.on(chunkJSWJ4XDE_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6614
6619
|
element.on(
|
|
6615
|
-
|
|
6620
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.CHANGE,
|
|
6616
6621
|
(data) => onChangeRef.current?.(data)
|
|
6617
6622
|
);
|
|
6618
6623
|
element.on(
|
|
6619
|
-
|
|
6624
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.ERROR,
|
|
6620
6625
|
(data) => onErrorRef.current?.(data)
|
|
6621
6626
|
);
|
|
6622
6627
|
element.mount(containerRef.current);
|
|
@@ -6646,15 +6651,15 @@ function PaymentElement({
|
|
|
6646
6651
|
}, [onReady, onChange, onError]);
|
|
6647
6652
|
React14.useEffect(() => {
|
|
6648
6653
|
if (!elements || !containerRef.current) return;
|
|
6649
|
-
const element = elements.create(
|
|
6654
|
+
const element = elements.create(chunkJSWJ4XDE_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
6650
6655
|
elementRef.current = element;
|
|
6651
|
-
element.on(
|
|
6656
|
+
element.on(chunkJSWJ4XDE_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6652
6657
|
element.on(
|
|
6653
|
-
|
|
6658
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.CHANGE,
|
|
6654
6659
|
(data) => onChangeRef.current?.(data)
|
|
6655
6660
|
);
|
|
6656
6661
|
element.on(
|
|
6657
|
-
|
|
6662
|
+
chunkJSWJ4XDE_js.EVENT_TYPES.ERROR,
|
|
6658
6663
|
(data) => onErrorRef.current?.(data)
|
|
6659
6664
|
);
|
|
6660
6665
|
element.mount(containerRef.current);
|
|
@@ -6811,7 +6816,7 @@ function VariantSelector({
|
|
|
6811
6816
|
if (!variants || variants.length <= 1) {
|
|
6812
6817
|
return null;
|
|
6813
6818
|
}
|
|
6814
|
-
basePrice != null ?
|
|
6819
|
+
basePrice != null ? chunkNNG6IFFX_js.parsePrice(basePrice) : 0;
|
|
6815
6820
|
if (variantAxes && variantAxes.length > 0) {
|
|
6816
6821
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
6817
6822
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -6917,7 +6922,7 @@ function VariantSelector({
|
|
|
6917
6922
|
className: cn("divide-y divide-border", classNames?.list),
|
|
6918
6923
|
children: variants.map((variant) => {
|
|
6919
6924
|
const isSelected = selectedVariantId === variant.id;
|
|
6920
|
-
const adjustment =
|
|
6925
|
+
const adjustment = chunkNNG6IFFX_js.parsePrice(variant.price_adjustment);
|
|
6921
6926
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6922
6927
|
radio.Radio.Root,
|
|
6923
6928
|
{
|
|
@@ -6945,7 +6950,7 @@ function VariantSelector({
|
|
|
6945
6950
|
{
|
|
6946
6951
|
"data-cimplify-variant-name": true,
|
|
6947
6952
|
className: cn("flex-1 min-w-0 text-sm", classNames?.name),
|
|
6948
|
-
children:
|
|
6953
|
+
children: chunk2P4KXFB6_js.getVariantDisplayName(variant, productName)
|
|
6949
6954
|
}
|
|
6950
6955
|
),
|
|
6951
6956
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
|
|
@@ -7185,16 +7190,16 @@ function BundleSelector({
|
|
|
7185
7190
|
}, [components, selections, onReady]);
|
|
7186
7191
|
const totalPrice = React14.useMemo(() => {
|
|
7187
7192
|
if (pricingType === "fixed" && bundlePrice) {
|
|
7188
|
-
return
|
|
7193
|
+
return chunkNNG6IFFX_js.parsePrice(bundlePrice);
|
|
7189
7194
|
}
|
|
7190
7195
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
7191
7196
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
7192
7197
|
}, 0);
|
|
7193
7198
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
7194
|
-
return componentsTotal * (1 -
|
|
7199
|
+
return componentsTotal * (1 - chunkNNG6IFFX_js.parsePrice(discountValue) / 100);
|
|
7195
7200
|
}
|
|
7196
7201
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
7197
|
-
return componentsTotal -
|
|
7202
|
+
return componentsTotal - chunkNNG6IFFX_js.parsePrice(discountValue);
|
|
7198
7203
|
}
|
|
7199
7204
|
return componentsTotal;
|
|
7200
7205
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -7256,15 +7261,15 @@ function BundleSelector({
|
|
|
7256
7261
|
}
|
|
7257
7262
|
function getComponentPrice(component, selectedVariantId) {
|
|
7258
7263
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
7259
|
-
return
|
|
7264
|
+
return chunkNNG6IFFX_js.parsePrice(component.effective_price);
|
|
7260
7265
|
}
|
|
7261
7266
|
if (selectedVariantId === component.variant_id) {
|
|
7262
|
-
return
|
|
7267
|
+
return chunkNNG6IFFX_js.parsePrice(component.effective_price);
|
|
7263
7268
|
}
|
|
7264
7269
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
7265
7270
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
7266
|
-
if (!selectedAdj) return
|
|
7267
|
-
return
|
|
7271
|
+
if (!selectedAdj) return chunkNNG6IFFX_js.parsePrice(component.effective_price);
|
|
7272
|
+
return chunkNNG6IFFX_js.parsePrice(component.effective_price) - chunkNNG6IFFX_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkNNG6IFFX_js.parsePrice(selectedAdj.price_adjustment);
|
|
7268
7273
|
}
|
|
7269
7274
|
function formatDuration(minutes, unit) {
|
|
7270
7275
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -7378,7 +7383,7 @@ function BundleComponentCard({
|
|
|
7378
7383
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
7379
7384
|
children: component.available_variants.map((variant) => {
|
|
7380
7385
|
const isSelected = selectedVariantId === variant.id;
|
|
7381
|
-
const adjustment =
|
|
7386
|
+
const adjustment = chunkNNG6IFFX_js.parsePrice(variant.price_adjustment);
|
|
7382
7387
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7383
7388
|
radio.Radio.Root,
|
|
7384
7389
|
{
|
|
@@ -7825,7 +7830,7 @@ function CompositeSelector({
|
|
|
7825
7830
|
"data-cimplify-composite-summary": true,
|
|
7826
7831
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
7827
7832
|
children: [
|
|
7828
|
-
|
|
7833
|
+
chunkNNG6IFFX_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7829
7834
|
"div",
|
|
7830
7835
|
{
|
|
7831
7836
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7836,7 +7841,7 @@ function CompositeSelector({
|
|
|
7836
7841
|
]
|
|
7837
7842
|
}
|
|
7838
7843
|
),
|
|
7839
|
-
|
|
7844
|
+
chunkNNG6IFFX_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7840
7845
|
"div",
|
|
7841
7846
|
{
|
|
7842
7847
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7980,7 +7985,7 @@ function BookingSummary({
|
|
|
7980
7985
|
className,
|
|
7981
7986
|
classNames
|
|
7982
7987
|
}) {
|
|
7983
|
-
const depositValue = depositAmount != null ?
|
|
7988
|
+
const depositValue = depositAmount != null ? chunkNNG6IFFX_js.parsePrice(depositAmount) : 0;
|
|
7984
7989
|
const depositDue = depositType === "percentage" ? total * depositValue / 100 : depositType === "fixed" ? depositValue : 0;
|
|
7985
7990
|
const hasDeposit = depositDue > 0;
|
|
7986
7991
|
const balance = Math.max(0, total - depositDue);
|
|
@@ -8708,7 +8713,7 @@ function InputField({
|
|
|
8708
8713
|
currency,
|
|
8709
8714
|
classNames
|
|
8710
8715
|
}) {
|
|
8711
|
-
const hasPriceAdjustment = field.price_adjustment != null &&
|
|
8716
|
+
const hasPriceAdjustment = field.price_adjustment != null && chunkNNG6IFFX_js.parsePrice(field.price_adjustment) > 0;
|
|
8712
8717
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
8713
8718
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
8714
8719
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -8743,12 +8748,12 @@ function FieldInput({
|
|
|
8743
8748
|
classNames?.input
|
|
8744
8749
|
);
|
|
8745
8750
|
switch (field.field_type) {
|
|
8746
|
-
case
|
|
8747
|
-
case
|
|
8751
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Text:
|
|
8752
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Url:
|
|
8748
8753
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8749
8754
|
"input",
|
|
8750
8755
|
{
|
|
8751
|
-
type: field.field_type ===
|
|
8756
|
+
type: field.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Url ? "url" : "text",
|
|
8752
8757
|
value: typeof value === "string" ? value : "",
|
|
8753
8758
|
onChange: (e) => onValueChange(e.target.value),
|
|
8754
8759
|
placeholder: field.placeholder,
|
|
@@ -8757,7 +8762,7 @@ function FieldInput({
|
|
|
8757
8762
|
className: inputClass
|
|
8758
8763
|
}
|
|
8759
8764
|
);
|
|
8760
|
-
case
|
|
8765
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Textarea:
|
|
8761
8766
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8762
8767
|
"textarea",
|
|
8763
8768
|
{
|
|
@@ -8770,7 +8775,7 @@ function FieldInput({
|
|
|
8770
8775
|
className: cn(inputClass, "resize-none", classNames?.textarea)
|
|
8771
8776
|
}
|
|
8772
8777
|
);
|
|
8773
|
-
case
|
|
8778
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Number:
|
|
8774
8779
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8775
8780
|
"input",
|
|
8776
8781
|
{
|
|
@@ -8784,7 +8789,7 @@ function FieldInput({
|
|
|
8784
8789
|
className: inputClass
|
|
8785
8790
|
}
|
|
8786
8791
|
);
|
|
8787
|
-
case
|
|
8792
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Select:
|
|
8788
8793
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8789
8794
|
"select",
|
|
8790
8795
|
{
|
|
@@ -8798,7 +8803,7 @@ function FieldInput({
|
|
|
8798
8803
|
]
|
|
8799
8804
|
}
|
|
8800
8805
|
);
|
|
8801
|
-
case
|
|
8806
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Radio:
|
|
8802
8807
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.radioGroup), children: (field.options || []).map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8803
8808
|
"label",
|
|
8804
8809
|
{
|
|
@@ -8823,7 +8828,7 @@ function FieldInput({
|
|
|
8823
8828
|
},
|
|
8824
8829
|
opt
|
|
8825
8830
|
)) });
|
|
8826
|
-
case
|
|
8831
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Checkbox:
|
|
8827
8832
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: cn("flex items-center gap-2 text-sm cursor-pointer", classNames?.checkboxLabel), children: [
|
|
8828
8833
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8829
8834
|
"input",
|
|
@@ -8836,7 +8841,7 @@ function FieldInput({
|
|
|
8836
8841
|
),
|
|
8837
8842
|
field.placeholder || field.name
|
|
8838
8843
|
] });
|
|
8839
|
-
case
|
|
8844
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Color:
|
|
8840
8845
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8841
8846
|
"input",
|
|
8842
8847
|
{
|
|
@@ -8846,7 +8851,7 @@ function FieldInput({
|
|
|
8846
8851
|
className: cn("w-12 h-10 rounded-md border border-input cursor-pointer", classNames?.colorInput)
|
|
8847
8852
|
}
|
|
8848
8853
|
);
|
|
8849
|
-
case
|
|
8854
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Date:
|
|
8850
8855
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8851
8856
|
DatePicker,
|
|
8852
8857
|
{
|
|
@@ -8857,8 +8862,8 @@ function FieldInput({
|
|
|
8857
8862
|
"aria-label": field.name
|
|
8858
8863
|
}
|
|
8859
8864
|
);
|
|
8860
|
-
case
|
|
8861
|
-
case
|
|
8865
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.File:
|
|
8866
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Image:
|
|
8862
8867
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8863
8868
|
FileUploadInput,
|
|
8864
8869
|
{
|
|
@@ -8869,7 +8874,7 @@ function FieldInput({
|
|
|
8869
8874
|
classNames
|
|
8870
8875
|
}
|
|
8871
8876
|
);
|
|
8872
|
-
case
|
|
8877
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Email:
|
|
8873
8878
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8874
8879
|
"input",
|
|
8875
8880
|
{
|
|
@@ -8881,7 +8886,7 @@ function FieldInput({
|
|
|
8881
8886
|
className: inputClass
|
|
8882
8887
|
}
|
|
8883
8888
|
);
|
|
8884
|
-
case
|
|
8889
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.DateTime: {
|
|
8885
8890
|
const stringValue = typeof value === "string" ? value : "";
|
|
8886
8891
|
const [datePart, timePartRaw] = stringValue.includes("T") ? stringValue.split("T", 2) : [stringValue, ""];
|
|
8887
8892
|
const timePart = (timePartRaw ?? "").slice(0, 5);
|
|
@@ -8920,7 +8925,7 @@ function FieldInput({
|
|
|
8920
8925
|
)
|
|
8921
8926
|
] });
|
|
8922
8927
|
}
|
|
8923
|
-
case
|
|
8928
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Time:
|
|
8924
8929
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8925
8930
|
TimePicker,
|
|
8926
8931
|
{
|
|
@@ -8931,7 +8936,7 @@ function FieldInput({
|
|
|
8931
8936
|
"aria-label": field.name
|
|
8932
8937
|
}
|
|
8933
8938
|
);
|
|
8934
|
-
case
|
|
8939
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.MultiSelect:
|
|
8935
8940
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8936
8941
|
MultiSelectInput,
|
|
8937
8942
|
{
|
|
@@ -8941,7 +8946,7 @@ function FieldInput({
|
|
|
8941
8946
|
classNames
|
|
8942
8947
|
}
|
|
8943
8948
|
);
|
|
8944
|
-
case
|
|
8949
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.DateRange:
|
|
8945
8950
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8946
8951
|
DateRangeInput,
|
|
8947
8952
|
{
|
|
@@ -8951,7 +8956,7 @@ function FieldInput({
|
|
|
8951
8956
|
classNames
|
|
8952
8957
|
}
|
|
8953
8958
|
);
|
|
8954
|
-
case
|
|
8959
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Address:
|
|
8955
8960
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8956
8961
|
AddressInput,
|
|
8957
8962
|
{
|
|
@@ -8962,7 +8967,7 @@ function FieldInput({
|
|
|
8962
8967
|
inputClass
|
|
8963
8968
|
}
|
|
8964
8969
|
);
|
|
8965
|
-
case
|
|
8970
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Location:
|
|
8966
8971
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8967
8972
|
LocationInput,
|
|
8968
8973
|
{
|
|
@@ -8973,7 +8978,7 @@ function FieldInput({
|
|
|
8973
8978
|
inputClass
|
|
8974
8979
|
}
|
|
8975
8980
|
);
|
|
8976
|
-
case
|
|
8981
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Phone:
|
|
8977
8982
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8978
8983
|
PhoneInput,
|
|
8979
8984
|
{
|
|
@@ -8984,7 +8989,7 @@ function FieldInput({
|
|
|
8984
8989
|
inputClass
|
|
8985
8990
|
}
|
|
8986
8991
|
);
|
|
8987
|
-
case
|
|
8992
|
+
case chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Signature:
|
|
8988
8993
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8989
8994
|
SignatureInput,
|
|
8990
8995
|
{
|
|
@@ -9017,7 +9022,7 @@ function FileUploadInput({
|
|
|
9017
9022
|
const [isUploading, setIsUploading] = React14__default.default.useState(false);
|
|
9018
9023
|
const fileUrl = typeof value === "string" ? value : void 0;
|
|
9019
9024
|
const acceptedFormats = field.validation?.accepted_formats;
|
|
9020
|
-
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type ===
|
|
9025
|
+
const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
|
|
9021
9026
|
const handleFile = async (file) => {
|
|
9022
9027
|
if (!onFileUpload) return;
|
|
9023
9028
|
if (field.validation?.max_size_mb) {
|
|
@@ -9035,7 +9040,7 @@ function FileUploadInput({
|
|
|
9035
9040
|
}
|
|
9036
9041
|
};
|
|
9037
9042
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("space-y-2", classNames?.fileInput), children: fileUrl ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
9038
|
-
field.field_type ===
|
|
9043
|
+
field.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: fileUrl, alt: "Uploaded", className: "w-16 h-16 object-cover rounded-md border border-border" }),
|
|
9039
9044
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground truncate", children: fileUrl.split("/").pop() }) }),
|
|
9040
9045
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9041
9046
|
"button",
|
|
@@ -9061,7 +9066,7 @@ function FileUploadInput({
|
|
|
9061
9066
|
}
|
|
9062
9067
|
),
|
|
9063
9068
|
isUploading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Uploading..." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9064
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type ===
|
|
9069
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: field.placeholder || `Upload ${field.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Image ? "image" : "file"}` }),
|
|
9065
9070
|
acceptedFormats && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground/60 mt-1", children: [
|
|
9066
9071
|
acceptedFormats.map((f) => f.toUpperCase()).join(", "),
|
|
9067
9072
|
field.validation?.max_size_mb && ` \xB7 Max ${field.validation.max_size_mb}MB`
|
|
@@ -9808,7 +9813,7 @@ function ProductCustomizerContent({
|
|
|
9808
9813
|
const isBundle = productType === "bundle";
|
|
9809
9814
|
const isDigital = productType === "digital";
|
|
9810
9815
|
const isService = productType === "service";
|
|
9811
|
-
const offersUnits = isService &&
|
|
9816
|
+
const offersUnits = isService && chunk2P4KXFB6_js.isMultiDayService(product);
|
|
9812
9817
|
const isStandard = !isComposite && !isBundle;
|
|
9813
9818
|
const hasVariants = isStandard && product.variants && product.variants.length > 0;
|
|
9814
9819
|
const hasAddOns = isStandard && product.add_ons && product.add_ons.length > 0;
|
|
@@ -9840,15 +9845,15 @@ function ProductCustomizerContent({
|
|
|
9840
9845
|
}, [selectedAddOnOptionIds]);
|
|
9841
9846
|
const localTotalPrice = React14.useMemo(() => {
|
|
9842
9847
|
if (isComposite && compositePrice) {
|
|
9843
|
-
return
|
|
9848
|
+
return chunkNNG6IFFX_js.parsePrice(compositePrice.final_price) * quantity;
|
|
9844
9849
|
}
|
|
9845
9850
|
if (isBundle && bundleTotalPrice != null) {
|
|
9846
9851
|
return bundleTotalPrice * quantity;
|
|
9847
9852
|
}
|
|
9848
|
-
let price =
|
|
9853
|
+
let price = chunkNNG6IFFX_js.getVariantUnitPrice(product, selectedVariant);
|
|
9849
9854
|
for (const option of selectedAddOnOptions) {
|
|
9850
9855
|
if (option.default_price) {
|
|
9851
|
-
price +=
|
|
9856
|
+
price += chunkNNG6IFFX_js.parsePrice(option.default_price);
|
|
9852
9857
|
}
|
|
9853
9858
|
}
|
|
9854
9859
|
return price * quantity;
|
|
@@ -9914,18 +9919,18 @@ function ProductCustomizerContent({
|
|
|
9914
9919
|
} = useQuote(quoteInput, {
|
|
9915
9920
|
enabled: quoteEnabled
|
|
9916
9921
|
});
|
|
9917
|
-
const currency = quote?.currency ??
|
|
9922
|
+
const currency = quote?.currency ?? chunkNNG6IFFX_js.getProductCurrency(product);
|
|
9918
9923
|
const quoteId = quote?.quote_id;
|
|
9919
9924
|
const quotedUnitPrice = (quote?.quoted_total_price_info ?? quote?.final_price_info)?.final_price;
|
|
9920
9925
|
const quotedTotalPrice = React14.useMemo(() => {
|
|
9921
9926
|
if (quotedUnitPrice === void 0 || quotedUnitPrice === null) return void 0;
|
|
9922
|
-
return
|
|
9927
|
+
return chunkNNG6IFFX_js.parsePrice(quotedUnitPrice) * quantity;
|
|
9923
9928
|
}, [quotedUnitPrice, quantity]);
|
|
9924
9929
|
const quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2;
|
|
9925
9930
|
const validationMessage = !quoteEnabled ? REQUIRED_OPTIONS_MESSAGE : quoteError ? QUOTE_UNAVAILABLE_MESSAGE : !quoteIsReady ? QUOTE_LOADING_MESSAGE : null;
|
|
9926
9931
|
const displayTotalPrice = React14.useMemo(() => {
|
|
9927
9932
|
const total = quotedTotalPrice ?? localTotalPrice;
|
|
9928
|
-
const multiplier =
|
|
9933
|
+
const multiplier = chunk2P4KXFB6_js.serviceBillingMultiplier(product, {
|
|
9929
9934
|
quantity,
|
|
9930
9935
|
units: unitsCount,
|
|
9931
9936
|
scheduledStart: selectedSlot?.start_time,
|
|
@@ -10143,7 +10148,7 @@ function ProductCustomizerContent({
|
|
|
10143
10148
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
|
|
10144
10149
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10145
10150
|
"Deposit required: ",
|
|
10146
|
-
|
|
10151
|
+
chunkNNG6IFFX_js.parsePrice(product.deposit_amount),
|
|
10147
10152
|
"%"
|
|
10148
10153
|
] })
|
|
10149
10154
|
}
|
|
@@ -10251,10 +10256,10 @@ function ProductCustomizerContent({
|
|
|
10251
10256
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10252
10257
|
Price,
|
|
10253
10258
|
{
|
|
10254
|
-
amount:
|
|
10259
|
+
amount: chunkNNG6IFFX_js.getUnitPriceAtQuantity(
|
|
10255
10260
|
product.quantity_pricing,
|
|
10256
10261
|
quantity,
|
|
10257
|
-
|
|
10262
|
+
chunkNNG6IFFX_js.parsePrice(product.default_price)
|
|
10258
10263
|
),
|
|
10259
10264
|
currency,
|
|
10260
10265
|
className: "font-medium text-foreground"
|
|
@@ -10720,13 +10725,13 @@ function CartLineItemRow({
|
|
|
10720
10725
|
addOnOptions: item.addOnOptions
|
|
10721
10726
|
});
|
|
10722
10727
|
const pinnedUnitPrice = item._quotedUnitPrice;
|
|
10723
|
-
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice :
|
|
10728
|
+
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice : chunkNNG6IFFX_js.parsePrice(pinnedUnitPrice);
|
|
10724
10729
|
const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
|
|
10725
10730
|
const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
|
|
10726
10731
|
const isOptimistic2 = item.isOptimistic === true;
|
|
10727
|
-
const lineTotal =
|
|
10732
|
+
const lineTotal = chunkNNG6IFFX_js.parsePrice(unitPrice) * item.quantity;
|
|
10728
10733
|
const imageUrl = item.product.image_url;
|
|
10729
|
-
const variantLabel2 = item.variant ?
|
|
10734
|
+
const variantLabel2 = item.variant ? chunk2P4KXFB6_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
10730
10735
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10731
10736
|
"div",
|
|
10732
10737
|
{
|
|
@@ -10852,7 +10857,7 @@ function CartLineItemRow({
|
|
|
10852
10857
|
input.field_name,
|
|
10853
10858
|
":"
|
|
10854
10859
|
] }),
|
|
10855
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type ===
|
|
10860
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.File || input.field_type === chunk2P4KXFB6_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
|
|
10856
10861
|
] }, input.field_id))
|
|
10857
10862
|
}
|
|
10858
10863
|
),
|
|
@@ -11013,7 +11018,7 @@ function CartSummary({
|
|
|
11013
11018
|
removeItem,
|
|
11014
11019
|
updateQuantity
|
|
11015
11020
|
} = useCart();
|
|
11016
|
-
const displayCurrency = serverCart?.currency ??
|
|
11021
|
+
const displayCurrency = serverCart?.currency ?? chunkJG5CQNCB_js.currencyCode(currency);
|
|
11017
11022
|
const deliveryFee = serverCart?.delivery_fee;
|
|
11018
11023
|
const serviceCharge = serverCart?.service_charge;
|
|
11019
11024
|
const totalDiscounts = serverCart?.total_discounts;
|
|
@@ -11076,7 +11081,7 @@ function CartSummary({
|
|
|
11076
11081
|
]
|
|
11077
11082
|
}
|
|
11078
11083
|
),
|
|
11079
|
-
totalDiscounts != null &&
|
|
11084
|
+
totalDiscounts != null && chunkNNG6IFFX_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11080
11085
|
"div",
|
|
11081
11086
|
{
|
|
11082
11087
|
"data-cimplify-cart-discount": true,
|
|
@@ -11102,7 +11107,7 @@ function CartSummary({
|
|
|
11102
11107
|
className: cn("flex items-baseline justify-between", classNames?.deliveryFee),
|
|
11103
11108
|
children: [
|
|
11104
11109
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
11105
|
-
|
|
11110
|
+
chunkNNG6IFFX_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11106
11111
|
Price,
|
|
11107
11112
|
{
|
|
11108
11113
|
amount: deliveryFee,
|
|
@@ -11113,7 +11118,7 @@ function CartSummary({
|
|
|
11113
11118
|
]
|
|
11114
11119
|
}
|
|
11115
11120
|
),
|
|
11116
|
-
serviceCharge != null &&
|
|
11121
|
+
serviceCharge != null && chunkNNG6IFFX_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11117
11122
|
"div",
|
|
11118
11123
|
{
|
|
11119
11124
|
"data-cimplify-cart-service-charge": true,
|
|
@@ -11247,18 +11252,18 @@ function SaleBadge({
|
|
|
11247
11252
|
className,
|
|
11248
11253
|
classNames
|
|
11249
11254
|
}) {
|
|
11250
|
-
const onSale =
|
|
11255
|
+
const onSale = chunkNNG6IFFX_js.isOnSale(product);
|
|
11251
11256
|
const hasDeal = dealInfo !== void 0;
|
|
11252
11257
|
if (!hasDeal && !onSale && !label) {
|
|
11253
11258
|
return null;
|
|
11254
11259
|
}
|
|
11255
11260
|
let percentage = null;
|
|
11256
11261
|
if (product.sale) {
|
|
11257
|
-
percentage =
|
|
11262
|
+
percentage = chunkNNG6IFFX_js.parsePrice(product.sale.percent_off);
|
|
11258
11263
|
} else if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
11259
|
-
percentage =
|
|
11264
|
+
percentage = chunkNNG6IFFX_js.parsePrice(dealInfo.value);
|
|
11260
11265
|
} else if (onSale) {
|
|
11261
|
-
percentage =
|
|
11266
|
+
percentage = chunkNNG6IFFX_js.getDiscountPercentage(product);
|
|
11262
11267
|
}
|
|
11263
11268
|
const badgeText = label ?? product.sale?.badge_text ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
11264
11269
|
if (!badgeText) {
|
|
@@ -11277,7 +11282,7 @@ function SaleBadge({
|
|
|
11277
11282
|
"%"
|
|
11278
11283
|
] }),
|
|
11279
11284
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
11280
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
11285
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkNNG6IFFX_js.getBasePrice(product), currency: chunkNNG6IFFX_js.getProductCurrency(product) }) })
|
|
11281
11286
|
]
|
|
11282
11287
|
}
|
|
11283
11288
|
);
|
|
@@ -11295,7 +11300,7 @@ function SalePrice({
|
|
|
11295
11300
|
if (!sale) {
|
|
11296
11301
|
return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
|
|
11297
11302
|
}
|
|
11298
|
-
const off = Math.round(
|
|
11303
|
+
const off = Math.round(chunkNNG6IFFX_js.parsePrice(sale.percent_off));
|
|
11299
11304
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11300
11305
|
"span",
|
|
11301
11306
|
{
|
|
@@ -11671,7 +11676,7 @@ function ProductSheet({
|
|
|
11671
11676
|
Price,
|
|
11672
11677
|
{
|
|
11673
11678
|
amount: fullProduct.default_price,
|
|
11674
|
-
currency:
|
|
11679
|
+
currency: chunkNNG6IFFX_js.getProductCurrency(fullProduct),
|
|
11675
11680
|
className: classNames?.price
|
|
11676
11681
|
}
|
|
11677
11682
|
)
|
|
@@ -11857,10 +11862,10 @@ function SoldOutOverlay() {
|
|
|
11857
11862
|
function SaleBadge2({ product }) {
|
|
11858
11863
|
let label = null;
|
|
11859
11864
|
if (product.sale) {
|
|
11860
|
-
const off = Math.round(
|
|
11865
|
+
const off = Math.round(chunkNNG6IFFX_js.parsePrice(product.sale.percent_off));
|
|
11861
11866
|
label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
|
|
11862
|
-
} else if (
|
|
11863
|
-
const pct =
|
|
11867
|
+
} else if (chunkNNG6IFFX_js.isOnSale(product)) {
|
|
11868
|
+
const pct = chunkNNG6IFFX_js.getDiscountPercentage(product);
|
|
11864
11869
|
label = pct && pct > 0 ? `-${pct}%` : null;
|
|
11865
11870
|
}
|
|
11866
11871
|
if (!label) return null;
|
|
@@ -11901,11 +11906,11 @@ function FoodProductCard({
|
|
|
11901
11906
|
className
|
|
11902
11907
|
}) {
|
|
11903
11908
|
const image = product.image_url || product.images?.[0] || "";
|
|
11904
|
-
const currency =
|
|
11909
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
11905
11910
|
const tags = product.tags || [];
|
|
11906
11911
|
const isSignature = product.metadata?.is_signature === true;
|
|
11907
11912
|
const isNew = product.metadata?.is_new === true;
|
|
11908
|
-
const isComposite = product.type ===
|
|
11913
|
+
const isComposite = product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Composite;
|
|
11909
11914
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
11910
11915
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
11911
11916
|
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: [
|
|
@@ -11957,9 +11962,9 @@ function RetailProductCard({
|
|
|
11957
11962
|
className
|
|
11958
11963
|
}) {
|
|
11959
11964
|
const image = product.image_url || product.images?.[0] || "";
|
|
11960
|
-
const currency =
|
|
11965
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
11961
11966
|
const outOfStock = product.inventory_status?.in_stock === false;
|
|
11962
|
-
const onSale =
|
|
11967
|
+
const onSale = chunkNNG6IFFX_js.isOnSale(product);
|
|
11963
11968
|
const swatches = getColorSwatches(product);
|
|
11964
11969
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
11965
11970
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
@@ -11980,7 +11985,7 @@ function RetailProductCard({
|
|
|
11980
11985
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
|
|
11981
11986
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11982
11987
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
11983
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
11988
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkNNG6IFFX_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
|
|
11984
11989
|
] }) }),
|
|
11985
11990
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11986
11991
|
"span",
|
|
@@ -11995,10 +12000,10 @@ function RetailProductCard({
|
|
|
11995
12000
|
] });
|
|
11996
12001
|
}
|
|
11997
12002
|
function PriceRange({ product, currency, className }) {
|
|
11998
|
-
const resolvedCurrency = currency ??
|
|
11999
|
-
const range =
|
|
12003
|
+
const resolvedCurrency = currency ?? chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12004
|
+
const range = chunkNNG6IFFX_js.getPriceRange(product);
|
|
12000
12005
|
if (!range) return null;
|
|
12001
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
12006
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkNNG6IFFX_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
12002
12007
|
}
|
|
12003
12008
|
function WholesaleProductCard({
|
|
12004
12009
|
product,
|
|
@@ -12008,7 +12013,7 @@ function WholesaleProductCard({
|
|
|
12008
12013
|
className
|
|
12009
12014
|
}) {
|
|
12010
12015
|
const image = product.image_url || product.images?.[0] || "";
|
|
12011
|
-
const currency =
|
|
12016
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12012
12017
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12013
12018
|
const status = product.inventory_status;
|
|
12014
12019
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12056,7 +12061,7 @@ function DigitalProductCard({
|
|
|
12056
12061
|
className
|
|
12057
12062
|
}) {
|
|
12058
12063
|
const image = product.image_url || product.images?.[0] || "";
|
|
12059
|
-
const currency =
|
|
12064
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12060
12065
|
const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
|
|
12061
12066
|
const isTicket = product.digital_type === "ticket";
|
|
12062
12067
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12087,11 +12092,11 @@ function BundleProductCard({
|
|
|
12087
12092
|
className
|
|
12088
12093
|
}) {
|
|
12089
12094
|
const image = product.image_url || product.images?.[0] || "";
|
|
12090
|
-
const currency =
|
|
12095
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12091
12096
|
const components = product.components || [];
|
|
12092
12097
|
const componentCount = components.length;
|
|
12093
|
-
const onSale =
|
|
12094
|
-
const discount =
|
|
12098
|
+
const onSale = chunkNNG6IFFX_js.isOnSale(product);
|
|
12099
|
+
const discount = chunkNNG6IFFX_js.getDiscountPercentage(product);
|
|
12095
12100
|
const hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
12096
12101
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12097
12102
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
@@ -12118,7 +12123,7 @@ function BundleProductCard({
|
|
|
12118
12123
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
12119
12124
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
12120
12125
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12121
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
12126
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkNNG6IFFX_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
|
|
12122
12127
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
12123
12128
|
"Save ",
|
|
12124
12129
|
discount,
|
|
@@ -12138,7 +12143,7 @@ function CompositeProductCard({
|
|
|
12138
12143
|
className
|
|
12139
12144
|
}) {
|
|
12140
12145
|
const image = product.image_url || product.images?.[0] || "";
|
|
12141
|
-
const currency =
|
|
12146
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12142
12147
|
const groups = product.groups || [];
|
|
12143
12148
|
const groupCount = groups.length;
|
|
12144
12149
|
groups.reduce((sum, g) => sum + g.components.length, 0);
|
|
@@ -12190,7 +12195,7 @@ function StandardServiceCard({
|
|
|
12190
12195
|
className
|
|
12191
12196
|
}) {
|
|
12192
12197
|
const image = product.image_url || product.images?.[0] || "";
|
|
12193
|
-
const currency =
|
|
12198
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12194
12199
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12195
12200
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12196
12201
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
@@ -12245,7 +12250,7 @@ function CompactServiceCard({
|
|
|
12245
12250
|
className
|
|
12246
12251
|
}) {
|
|
12247
12252
|
const image = product.image_url || product.images?.[0] || "";
|
|
12248
|
-
const currency =
|
|
12253
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12249
12254
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12250
12255
|
const hasBillingPlans = product.billing_plans && product.billing_plans.length > 0;
|
|
12251
12256
|
const href = `/products/${product.slug}`;
|
|
@@ -12294,7 +12299,7 @@ function ScheduleServiceCard({
|
|
|
12294
12299
|
className
|
|
12295
12300
|
}) {
|
|
12296
12301
|
const image = product.image_url || product.images?.[0] || "";
|
|
12297
|
-
const currency =
|
|
12302
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12298
12303
|
const href = `/products/${product.slug}`;
|
|
12299
12304
|
const durationLabel = product.duration_minutes != null ? formatDuration2(product.duration_minutes, product.duration_unit) : null;
|
|
12300
12305
|
const displaySlots = (slots || []).slice(0, 3);
|
|
@@ -12366,7 +12371,7 @@ function RentalServiceCard({
|
|
|
12366
12371
|
className
|
|
12367
12372
|
}) {
|
|
12368
12373
|
const image = product.image_url || product.images?.[0] || "";
|
|
12369
|
-
const currency =
|
|
12374
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12370
12375
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12371
12376
|
const unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "day";
|
|
12372
12377
|
const priceUnit = product.price_basis === "per_person" ? "guest" : product.price_basis === "flat" ? "" : unit;
|
|
@@ -12436,7 +12441,7 @@ function AccommodationCard({
|
|
|
12436
12441
|
className
|
|
12437
12442
|
}) {
|
|
12438
12443
|
const image = product.image_url || product.images?.[0] || "";
|
|
12439
|
-
const currency =
|
|
12444
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12440
12445
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12441
12446
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
12442
12447
|
const tags = product.tags || [];
|
|
@@ -12502,7 +12507,7 @@ function LeaseServiceCard({
|
|
|
12502
12507
|
className
|
|
12503
12508
|
}) {
|
|
12504
12509
|
const image = product.image_url || product.images?.[0] || "";
|
|
12505
|
-
const currency =
|
|
12510
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12506
12511
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12507
12512
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12508
12513
|
const unit = product.duration_unit ? UNIT_LABELS3[product.duration_unit] || product.duration_unit : "mo";
|
|
@@ -12576,7 +12581,7 @@ function SubscriptionCard({
|
|
|
12576
12581
|
className
|
|
12577
12582
|
}) {
|
|
12578
12583
|
const image = product.image_url || product.images?.[0] || "";
|
|
12579
|
-
const currency =
|
|
12584
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
12580
12585
|
const plans = product.billing_plans || [];
|
|
12581
12586
|
const primaryPlan = plans[0];
|
|
12582
12587
|
const frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo";
|
|
@@ -12672,36 +12677,36 @@ var BUILT_IN_CARDS = {
|
|
|
12672
12677
|
["composite" /* Composite */]: CompositeProductCard,
|
|
12673
12678
|
["subscription" /* Subscription */]: SubscriptionCard
|
|
12674
12679
|
};
|
|
12675
|
-
var RENTAL_UNITS = /* @__PURE__ */ new Set([
|
|
12676
|
-
var LEASE_UNITS = /* @__PURE__ */ new Set([
|
|
12680
|
+
var RENTAL_UNITS = /* @__PURE__ */ new Set([chunk2P4KXFB6_js.DURATION_UNIT.Days, chunk2P4KXFB6_js.DURATION_UNIT.Hours]);
|
|
12681
|
+
var LEASE_UNITS = /* @__PURE__ */ new Set([chunk2P4KXFB6_js.DURATION_UNIT.Weeks, chunk2P4KXFB6_js.DURATION_UNIT.Months, chunk2P4KXFB6_js.DURATION_UNIT.Years]);
|
|
12677
12682
|
function resolveCardVariant(product) {
|
|
12678
|
-
if (product.type ===
|
|
12683
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Bundle) {
|
|
12679
12684
|
return "bundle" /* Bundle */;
|
|
12680
12685
|
}
|
|
12681
|
-
if (product.type ===
|
|
12686
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Composite) {
|
|
12682
12687
|
return "composite" /* Composite */;
|
|
12683
12688
|
}
|
|
12684
12689
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
12685
12690
|
return "wholesale" /* Wholesale */;
|
|
12686
12691
|
}
|
|
12687
|
-
if (product.type ===
|
|
12692
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Digital) {
|
|
12688
12693
|
return "digital" /* Digital */;
|
|
12689
12694
|
}
|
|
12690
|
-
if (product.type ===
|
|
12695
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Service) {
|
|
12691
12696
|
switch (product.boundary_kind) {
|
|
12692
|
-
case
|
|
12697
|
+
case chunk2P4KXFB6_js.BOUNDARY_KIND.CheckInOut:
|
|
12693
12698
|
return "accommodation" /* Accommodation */;
|
|
12694
|
-
case
|
|
12699
|
+
case chunk2P4KXFB6_js.BOUNDARY_KIND.MoveInOut:
|
|
12695
12700
|
return "lease" /* Lease */;
|
|
12696
|
-
case
|
|
12697
|
-
case
|
|
12698
|
-
case
|
|
12701
|
+
case chunk2P4KXFB6_js.BOUNDARY_KIND.PickupReturn:
|
|
12702
|
+
case chunk2P4KXFB6_js.BOUNDARY_KIND.DeliveryCollection:
|
|
12703
|
+
case chunk2P4KXFB6_js.BOUNDARY_KIND.AccessVacate:
|
|
12699
12704
|
return "rental" /* Rental */;
|
|
12700
12705
|
}
|
|
12701
12706
|
if (product.duration_unit && RENTAL_UNITS.has(product.duration_unit)) {
|
|
12702
12707
|
return "rental" /* Rental */;
|
|
12703
12708
|
}
|
|
12704
|
-
if (product.duration_unit ===
|
|
12709
|
+
if (product.duration_unit === chunk2P4KXFB6_js.DURATION_UNIT.Nights) {
|
|
12705
12710
|
return "accommodation" /* Accommodation */;
|
|
12706
12711
|
}
|
|
12707
12712
|
if (product.duration_unit && LEASE_UNITS.has(product.duration_unit)) {
|
|
@@ -12712,10 +12717,10 @@ function resolveCardVariant(product) {
|
|
|
12712
12717
|
}
|
|
12713
12718
|
return "standard" /* Standard */;
|
|
12714
12719
|
}
|
|
12715
|
-
if (product.render_hint ===
|
|
12720
|
+
if (product.render_hint === chunk2P4KXFB6_js.RENDER_HINT.Food) {
|
|
12716
12721
|
return "food" /* Food */;
|
|
12717
12722
|
}
|
|
12718
|
-
if (product.render_hint ===
|
|
12723
|
+
if (product.render_hint === chunk2P4KXFB6_js.RENDER_HINT.Physical) {
|
|
12719
12724
|
return "retail" /* Retail */;
|
|
12720
12725
|
}
|
|
12721
12726
|
return "retail" /* Retail */;
|
|
@@ -12807,7 +12812,7 @@ function ProductCard({
|
|
|
12807
12812
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
|
|
12808
12813
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
|
|
12809
12814
|
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 }),
|
|
12810
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency:
|
|
12815
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunkNNG6IFFX_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
|
|
12811
12816
|
] })
|
|
12812
12817
|
] });
|
|
12813
12818
|
})();
|
|
@@ -12995,14 +13000,14 @@ var PRESET_LABELS = {
|
|
|
12995
13000
|
move_in_out: { start: "Move-in", end: "Move-out" }
|
|
12996
13001
|
};
|
|
12997
13002
|
function defaultBoundaryKind(unit) {
|
|
12998
|
-
return unit ===
|
|
13003
|
+
return unit === chunk2P4KXFB6_js.DURATION_UNIT.Nights ? chunk2P4KXFB6_js.BOUNDARY_KIND.CheckInOut : chunk2P4KXFB6_js.BOUNDARY_KIND.PickupReturn;
|
|
12999
13004
|
}
|
|
13000
13005
|
function resolveBoundaryKind(product) {
|
|
13001
13006
|
return product.boundary_kind ?? defaultBoundaryKind(product.duration_unit);
|
|
13002
13007
|
}
|
|
13003
13008
|
function getBoundaryLabels(product) {
|
|
13004
13009
|
const kind = resolveBoundaryKind(product);
|
|
13005
|
-
if (kind ===
|
|
13010
|
+
if (kind === chunk2P4KXFB6_js.BOUNDARY_KIND.Custom) {
|
|
13006
13011
|
return {
|
|
13007
13012
|
start: product.boundary_start_label?.trim() || "Start",
|
|
13008
13013
|
end: product.boundary_end_label?.trim() || "End"
|
|
@@ -13136,7 +13141,7 @@ function SearchInput({
|
|
|
13136
13141
|
}
|
|
13137
13142
|
),
|
|
13138
13143
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
13139
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
13144
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkNNG6IFFX_js.formatPrice(product.default_price) })
|
|
13140
13145
|
] })
|
|
13141
13146
|
},
|
|
13142
13147
|
product.id
|
|
@@ -13631,19 +13636,19 @@ function OrderSummary({
|
|
|
13631
13636
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
13632
13637
|
] }),
|
|
13633
13638
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
13634
|
-
order.total_discount != null &&
|
|
13639
|
+
order.total_discount != null && chunkNNG6IFFX_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
13635
13640
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
13636
13641
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
13637
13642
|
] }),
|
|
13638
|
-
order.delivery_fee != null &&
|
|
13643
|
+
order.delivery_fee != null && chunkNNG6IFFX_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
13639
13644
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
13640
13645
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
13641
13646
|
] }),
|
|
13642
|
-
order.service_charge != null &&
|
|
13647
|
+
order.service_charge != null && chunkNNG6IFFX_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
13643
13648
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
13644
13649
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
13645
13650
|
] }),
|
|
13646
|
-
order.tax != null &&
|
|
13651
|
+
order.tax != null && chunkNNG6IFFX_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
13647
13652
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
13648
13653
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
13649
13654
|
] }),
|
|
@@ -14174,7 +14179,7 @@ function BookingPage({
|
|
|
14174
14179
|
const hasStaffStep = staff && staff.length > 0;
|
|
14175
14180
|
const depositType = product?.deposit_type;
|
|
14176
14181
|
const depositAmount = product?.deposit_amount;
|
|
14177
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
14182
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkNNG6IFFX_js.parsePrice(depositAmount) !== 0;
|
|
14178
14183
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
14179
14184
|
const noShowFee = product?.no_show_fee;
|
|
14180
14185
|
const handleSlotSelect = React14.useCallback(
|
|
@@ -14307,14 +14312,14 @@ function BookingPage({
|
|
|
14307
14312
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price, currency }) }),
|
|
14308
14313
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
14309
14314
|
"Deposit: ",
|
|
14310
|
-
depositType === "percentage" ? `${
|
|
14315
|
+
depositType === "percentage" ? `${chunkNNG6IFFX_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
|
|
14311
14316
|
] }),
|
|
14312
14317
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
14313
14318
|
"Free cancellation up to ",
|
|
14314
14319
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
14315
14320
|
" before"
|
|
14316
14321
|
] }),
|
|
14317
|
-
noShowFee !== void 0 &&
|
|
14322
|
+
noShowFee !== void 0 && chunkNNG6IFFX_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
14318
14323
|
"No-show fee: ",
|
|
14319
14324
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee, currency })
|
|
14320
14325
|
] })
|
|
@@ -14417,7 +14422,7 @@ function BookingPage({
|
|
|
14417
14422
|
] }),
|
|
14418
14423
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
14419
14424
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
14420
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
14425
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkNNG6IFFX_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
|
|
14421
14426
|
] })
|
|
14422
14427
|
] }),
|
|
14423
14428
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15090,10 +15095,10 @@ function DefaultProductLayout({
|
|
|
15090
15095
|
className
|
|
15091
15096
|
}) {
|
|
15092
15097
|
const [selectedVariantId, setSelectedVariantId] = React14__default.default.useState();
|
|
15093
|
-
const images =
|
|
15094
|
-
const currency =
|
|
15098
|
+
const images = chunk2P4KXFB6_js.resolveGallery(product, selectedVariantId);
|
|
15099
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15095
15100
|
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
15096
|
-
const onSale =
|
|
15101
|
+
const onSale = chunkNNG6IFFX_js.isOnSale(product);
|
|
15097
15102
|
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
15098
15103
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
15099
15104
|
renderBreadcrumb?.(product),
|
|
@@ -15116,13 +15121,13 @@ function DefaultProductLayout({
|
|
|
15116
15121
|
/* @__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: [
|
|
15117
15122
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
|
|
15118
15123
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15119
|
-
/* @__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(
|
|
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(chunkNNG6IFFX_js.parsePrice(product.sale.percent_off))}% OFF` })
|
|
15120
15125
|
] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15121
15126
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
|
|
15122
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
15127
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkNNG6IFFX_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15123
15128
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
15124
15129
|
"Save ",
|
|
15125
|
-
|
|
15130
|
+
chunkNNG6IFFX_js.getDiscountPercentage(product),
|
|
15126
15131
|
"%"
|
|
15127
15132
|
] })
|
|
15128
15133
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-semibold" }) }),
|
|
@@ -15184,7 +15189,7 @@ function FoodProductLayout({
|
|
|
15184
15189
|
className
|
|
15185
15190
|
}) {
|
|
15186
15191
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15187
|
-
const currency =
|
|
15192
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15188
15193
|
const tags = product.tags || [];
|
|
15189
15194
|
const ingredients = getMetadataStringList(product.metadata, "ingredients");
|
|
15190
15195
|
const pairings = getMetadataStringList(product.metadata, "pairings");
|
|
@@ -15259,7 +15264,7 @@ function WholesaleProductLayout({
|
|
|
15259
15264
|
className
|
|
15260
15265
|
}) {
|
|
15261
15266
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15262
|
-
const currency =
|
|
15267
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15263
15268
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
15264
15269
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
|
|
15265
15270
|
renderBreadcrumb?.(product),
|
|
@@ -15343,9 +15348,9 @@ function ServiceProductLayout({
|
|
|
15343
15348
|
className
|
|
15344
15349
|
}) {
|
|
15345
15350
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15346
|
-
const currency =
|
|
15351
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15347
15352
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
15348
|
-
const depositAmount = hasDeposit ?
|
|
15353
|
+
const depositAmount = hasDeposit ? chunkNNG6IFFX_js.parsePrice(product.deposit_amount) : 0;
|
|
15349
15354
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
15350
15355
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
15351
15356
|
renderBreadcrumb?.(product),
|
|
@@ -15413,7 +15418,7 @@ function ServiceProductLayout({
|
|
|
15413
15418
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency, className: "font-medium text-foreground" }),
|
|
15414
15419
|
" deposit charged at booking"
|
|
15415
15420
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15416
|
-
|
|
15421
|
+
chunkNNG6IFFX_js.parsePrice(product.deposit_amount),
|
|
15417
15422
|
"% deposit charged at booking"
|
|
15418
15423
|
] }) })
|
|
15419
15424
|
] })
|
|
@@ -15445,7 +15450,7 @@ function DigitalProductLayout({
|
|
|
15445
15450
|
className
|
|
15446
15451
|
}) {
|
|
15447
15452
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15448
|
-
const currency =
|
|
15453
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15449
15454
|
const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
|
|
15450
15455
|
const isTicket = product.digital_type === "ticket";
|
|
15451
15456
|
const isAccessPass = product.digital_type === "access_grant";
|
|
@@ -15572,15 +15577,15 @@ function BundleProductLayout({
|
|
|
15572
15577
|
className
|
|
15573
15578
|
}) {
|
|
15574
15579
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15575
|
-
const currency =
|
|
15580
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15576
15581
|
const components = product.components || [];
|
|
15577
|
-
const onSale =
|
|
15578
|
-
const discount =
|
|
15582
|
+
const onSale = chunkNNG6IFFX_js.isOnSale(product);
|
|
15583
|
+
const discount = chunkNNG6IFFX_js.getDiscountPercentage(product);
|
|
15579
15584
|
const baseTotal = components.reduce(
|
|
15580
|
-
(sum, c) => sum +
|
|
15585
|
+
(sum, c) => sum + chunkNNG6IFFX_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
15581
15586
|
0
|
|
15582
15587
|
);
|
|
15583
|
-
const bundlePrice =
|
|
15588
|
+
const bundlePrice = chunkNNG6IFFX_js.parsePrice(product.default_price);
|
|
15584
15589
|
const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
15585
15590
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
15586
15591
|
renderBreadcrumb?.(product),
|
|
@@ -15656,7 +15661,7 @@ function CompositeProductLayout({
|
|
|
15656
15661
|
className
|
|
15657
15662
|
}) {
|
|
15658
15663
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15659
|
-
const currency =
|
|
15664
|
+
const currency = chunkNNG6IFFX_js.getProductCurrency(product);
|
|
15660
15665
|
const groups = product.groups || [];
|
|
15661
15666
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "composite", className: cn("space-y-8", className), children: [
|
|
15662
15667
|
renderBreadcrumb?.(product),
|
|
@@ -15737,25 +15742,25 @@ function resolveTemplateKey(product) {
|
|
|
15737
15742
|
if (typeof metaTemplate === "string" && metaTemplate.trim()) {
|
|
15738
15743
|
return metaTemplate.trim();
|
|
15739
15744
|
}
|
|
15740
|
-
if (product.type ===
|
|
15745
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Bundle) {
|
|
15741
15746
|
return "bundle" /* Bundle */;
|
|
15742
15747
|
}
|
|
15743
|
-
if (product.type ===
|
|
15748
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Composite) {
|
|
15744
15749
|
return "composite" /* Composite */;
|
|
15745
15750
|
}
|
|
15746
15751
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
15747
15752
|
return "wholesale" /* Wholesale */;
|
|
15748
15753
|
}
|
|
15749
|
-
if (product.type ===
|
|
15754
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Service) {
|
|
15750
15755
|
return "service" /* Service */;
|
|
15751
15756
|
}
|
|
15752
|
-
if (product.type ===
|
|
15757
|
+
if (product.type === chunk2P4KXFB6_js.PRODUCT_TYPE.Digital) {
|
|
15753
15758
|
return "digital" /* Digital */;
|
|
15754
15759
|
}
|
|
15755
|
-
if (product.render_hint ===
|
|
15760
|
+
if (product.render_hint === chunk2P4KXFB6_js.RENDER_HINT.Food) {
|
|
15756
15761
|
return "food" /* Food */;
|
|
15757
15762
|
}
|
|
15758
|
-
if (product.render_hint ===
|
|
15763
|
+
if (product.render_hint === chunk2P4KXFB6_js.RENDER_HINT.Physical) {
|
|
15759
15764
|
return "physical" /* Physical */;
|
|
15760
15765
|
}
|
|
15761
15766
|
return "default" /* Default */;
|
|
@@ -16079,7 +16084,7 @@ function CartDrawer({
|
|
|
16079
16084
|
}) {
|
|
16080
16085
|
const { isOpen, close } = useCartDrawer();
|
|
16081
16086
|
const cart = useCart();
|
|
16082
|
-
const subtotalNum =
|
|
16087
|
+
const subtotalNum = chunkNNG6IFFX_js.parsePrice(cart.subtotal);
|
|
16083
16088
|
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
16084
16089
|
React14.useEffect(() => {
|
|
16085
16090
|
if (!isOpen) return;
|
|
@@ -16473,9 +16478,9 @@ function CatalogueCollectionLayout({
|
|
|
16473
16478
|
result = result.filter((p) => p.tags?.includes(activeCategory));
|
|
16474
16479
|
}
|
|
16475
16480
|
if (sortBy === "price-asc") {
|
|
16476
|
-
result = [...result].sort((a, b) =>
|
|
16481
|
+
result = [...result].sort((a, b) => chunkNNG6IFFX_js.parsePrice(a.default_price) - chunkNNG6IFFX_js.parsePrice(b.default_price));
|
|
16477
16482
|
} else if (sortBy === "price-desc") {
|
|
16478
|
-
result = [...result].sort((a, b) =>
|
|
16483
|
+
result = [...result].sort((a, b) => chunkNNG6IFFX_js.parsePrice(b.default_price) - chunkNNG6IFFX_js.parsePrice(a.default_price));
|
|
16479
16484
|
} else if (sortBy === "name") {
|
|
16480
16485
|
result = [...result].sort((a, b) => a.name.localeCompare(b.name));
|
|
16481
16486
|
}
|
|
@@ -18141,7 +18146,7 @@ function chatTimeline(messages, options = {}) {
|
|
|
18141
18146
|
const { readAt = null, rendersPrograms = false } = options;
|
|
18142
18147
|
const partitioned = partitionMessages(messages);
|
|
18143
18148
|
const bubbles = partitioned.bubbles.filter(
|
|
18144
|
-
(message) => message.sender_type === "system" || message.attachments.length > 0 ||
|
|
18149
|
+
(message) => message.sender_type === "system" || message.attachments.length > 0 || chunk2P4KXFB6_js.chatMessageCards(message).length > 0 || rendersPrograms && hasProgram(message.content) || (message.sender_type === "customer" ? message.content.trim() !== "" : proseOf(message.content) !== "")
|
|
18145
18150
|
);
|
|
18146
18151
|
let firstUnreadId;
|
|
18147
18152
|
let unreadOnOpen = 0;
|
|
@@ -20004,7 +20009,7 @@ function toneChip(value) {
|
|
|
20004
20009
|
}
|
|
20005
20010
|
}
|
|
20006
20011
|
function money(amount, currency) {
|
|
20007
|
-
return
|
|
20012
|
+
return chunkNNG6IFFX_js.formatPrice(chunkNNG6IFFX_js.parsePrice(num(amount) ?? 0), text(currency));
|
|
20008
20013
|
}
|
|
20009
20014
|
var CHAT_GENUI_COMPONENTS = {
|
|
20010
20015
|
Stack: ({ node, ctx }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20227,7 +20232,7 @@ function ChatKitProgram({ source, onAction }) {
|
|
|
20227
20232
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full max-w-[290px]", children: /* @__PURE__ */ jsxRuntime.jsx(GenUIView, { root: parsed.root, components: CHAT_GENUI_COMPONENTS, onAction }) });
|
|
20228
20233
|
}
|
|
20229
20234
|
function ChatReplyCards({ message, currency, onAction }) {
|
|
20230
|
-
const cards =
|
|
20235
|
+
const cards = chunk2P4KXFB6_js.chatMessageCards(message);
|
|
20231
20236
|
if (cards.length === 0) return null;
|
|
20232
20237
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "scrollbar-hide flex max-w-full gap-2 overflow-x-auto pl-[30px]", children: cards.map((card, index) => /* @__PURE__ */ jsxRuntime.jsx(ReplyCardView, { card, currency, onAction }, index)) });
|
|
20233
20238
|
}
|
|
@@ -20252,7 +20257,7 @@ function ReplyCardView({
|
|
|
20252
20257
|
card.image_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
|
|
20253
20258
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
20254
20259
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
|
|
20255
|
-
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children:
|
|
20260
|
+
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunkNNG6IFFX_js.formatPrice(chunkNNG6IFFX_js.parsePrice(card.price), currency ?? void 0) }),
|
|
20256
20261
|
fire2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
|
|
20257
20262
|
] })
|
|
20258
20263
|
]
|
|
@@ -20349,12 +20354,12 @@ function ChatWidget({
|
|
|
20349
20354
|
setAttachError(null);
|
|
20350
20355
|
if (!isAllowedAttachment(file)) {
|
|
20351
20356
|
setAttachError(
|
|
20352
|
-
new
|
|
20357
|
+
new chunkJG5CQNCB_js.CimplifyError("invalid_attachment", "Only photos and documents can be attached.")
|
|
20353
20358
|
);
|
|
20354
20359
|
return;
|
|
20355
20360
|
}
|
|
20356
20361
|
if (file.size > MAX_ATTACHMENT_BYTES) {
|
|
20357
|
-
setAttachError(new
|
|
20362
|
+
setAttachError(new chunkJG5CQNCB_js.CimplifyError("attachment_too_large", "Files must be under 25MB."));
|
|
20358
20363
|
return;
|
|
20359
20364
|
}
|
|
20360
20365
|
const uploaded = await client.uploads.upload(file);
|
|
@@ -21297,7 +21302,7 @@ Object.defineProperty(exports, "splitGenUIContent", {
|
|
|
21297
21302
|
});
|
|
21298
21303
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
21299
21304
|
enumerable: true,
|
|
21300
|
-
get: function () { return
|
|
21305
|
+
get: function () { return chunk2P4KXFB6_js.getVariantDisplayName; }
|
|
21301
21306
|
});
|
|
21302
21307
|
exports.AccommodationCard = AccommodationCard;
|
|
21303
21308
|
exports.AccountContent = AccountContent;
|