@cimplify/sdk 0.102.0 → 0.104.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-DCMXUKDQ.mjs → chunk-2WPVUIHX.mjs} +455 -105
- package/dist/{chunk-NIOUSKQQ.js → chunk-4BKOKHE3.js} +9 -0
- package/dist/{chunk-YDA46OZ6.js → chunk-5BDYDZ4U.js} +722 -90
- package/dist/{chunk-4KNFBPV2.mjs → chunk-5RT4HYMP.mjs} +61 -15
- package/dist/{chunk-WMEC5JWN.js → chunk-7PDEX54K.js} +50 -13
- package/dist/chunk-CNN7Z2IP.js +125 -0
- package/dist/{chunk-DLW3RWRK.mjs → chunk-DYIAX3WI.mjs} +46 -12
- package/dist/{chunk-LOWSMGRT.js → chunk-E4K2VQDD.js} +64 -16
- package/dist/chunk-GOHSXBKW.mjs +105 -0
- package/dist/{chunk-O3YUHLZL.mjs → chunk-H3RATH4B.mjs} +9 -0
- package/dist/{chunk-YER7DIOM.js → chunk-IQFFSKE2.js} +753 -594
- package/dist/{chunk-Z3K2D3TE.mjs → chunk-OCCNG6MO.mjs} +735 -558
- package/dist/{chunk-DKLHCZ5M.mjs → chunk-OKADBZAI.mjs} +652 -25
- package/dist/{chunk-EAZGA7LD.js → chunk-YVAEY3VC.js} +457 -107
- package/dist/{client-nsiMwuC1.d.ts → client-BVNWjk6W.d.ts} +2 -2
- package/dist/{client-B40KFazg.d.ts → client-BuLcOWLv.d.ts} +202 -319
- package/dist/{client-BizGfqB7.d.mts → client-D5AoobFc.d.mts} +202 -319
- package/dist/{client-BdErclfU.d.mts → client-fM716k7G.d.mts} +2 -2
- package/dist/{index-DpmnI__D.d.mts → index-BtcoqrY1.d.ts} +14 -4
- package/dist/{index-nEyXWIyR.d.ts → index-D7Tf3v7c.d.mts} +14 -4
- package/dist/index.d.mts +83 -8
- package/dist/index.d.ts +83 -8
- package/dist/index.js +203 -169
- package/dist/index.mjs +7 -5
- package/dist/link-D9iSVxt5.d.mts +308 -0
- package/dist/link-D9iSVxt5.d.ts +308 -0
- package/dist/mock/cli.mjs +463 -104
- package/dist/mock/library.js +463 -104
- package/dist/mock/library.mjs +463 -104
- package/dist/mock/msw.js +463 -104
- package/dist/mock/msw.mjs +463 -104
- package/dist/{product-Byf0unSy.d.mts → payment-g0HFkEDU.d.mts} +708 -61
- package/dist/{product-Byf0unSy.d.ts → payment-g0HFkEDU.d.ts} +708 -61
- package/dist/{price-BstChV9a.d.ts → price-BLIeAb8K.d.ts} +1 -1
- package/dist/{price-CS4E5zLS.d.mts → price-Czq_cTC_.d.mts} +1 -1
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +194 -169
- package/dist/react.mjs +55 -30
- package/dist/{server-DqbZh8Bk.d.mts → server-BkVhOIwn.d.mts} +14 -10
- package/dist/{server-Cj40R2ZD.d.ts → server-DKK_D-PP.d.ts} +14 -10
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +12 -10
- package/dist/server.mjs +6 -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 +195 -56
- package/dist/testing.d.ts +195 -56
- package/dist/testing.js +95 -82
- package/dist/testing.mjs +14 -9
- 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/registry/chat-widget.json +1 -1
- package/dist/payment-l0rkieEQ.d.mts +0 -113
- package/dist/payment-vzNnIi1n.d.ts +0 -113
package/dist/react.js
CHANGED
|
@@ -1,12 +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
|
-
var
|
|
9
|
-
|
|
5
|
+
var chunk5BDYDZ4U_js = require('./chunk-5BDYDZ4U.js');
|
|
6
|
+
var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
|
|
7
|
+
var chunkIQFFSKE2_js = require('./chunk-IQFFSKE2.js');
|
|
8
|
+
require('./chunk-CNN7Z2IP.js');
|
|
9
|
+
var chunk7PDEX54K_js = require('./chunk-7PDEX54K.js');
|
|
10
|
+
var chunk4BKOKHE3_js = require('./chunk-4BKOKHE3.js');
|
|
10
11
|
require('./chunk-OWW5GUSB.js');
|
|
11
12
|
var React14 = require('react');
|
|
12
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -634,14 +635,14 @@ function attachInternalItemMetadata(item, metadata = {}) {
|
|
|
634
635
|
}
|
|
635
636
|
function calculateLineSubtotal(item) {
|
|
636
637
|
if (item._quotedUnitPrice !== void 0) {
|
|
637
|
-
return roundMoney(
|
|
638
|
+
return roundMoney(chunk7PDEX54K_js.parsePrice(item._quotedUnitPrice) * item.quantity);
|
|
638
639
|
}
|
|
639
|
-
let unitPrice =
|
|
640
|
+
let unitPrice = chunk7PDEX54K_js.parsePrice(item.product.default_price);
|
|
640
641
|
if (item.variant?.price_adjustment) {
|
|
641
|
-
unitPrice +=
|
|
642
|
+
unitPrice += chunk7PDEX54K_js.parsePrice(item.variant.price_adjustment);
|
|
642
643
|
}
|
|
643
644
|
for (const option of item.addOnOptions || []) {
|
|
644
|
-
if (option.default_price) unitPrice +=
|
|
645
|
+
if (option.default_price) unitPrice += chunk7PDEX54K_js.parsePrice(option.default_price);
|
|
645
646
|
}
|
|
646
647
|
return roundMoney(unitPrice * item.quantity);
|
|
647
648
|
}
|
|
@@ -862,7 +863,7 @@ async function syncFromServer(entry) {
|
|
|
862
863
|
return next;
|
|
863
864
|
}
|
|
864
865
|
function emitMutationError(entry, operation, opId, idempotencyKey, error) {
|
|
865
|
-
entry.client.events.emit(
|
|
866
|
+
entry.client.events.emit(chunk5BDYDZ4U_js.MUTATION_ERROR, {
|
|
866
867
|
service: "cart",
|
|
867
868
|
operation,
|
|
868
869
|
opId,
|
|
@@ -902,10 +903,10 @@ function getOrCreateStore(params) {
|
|
|
902
903
|
syncTail: Promise.resolve(),
|
|
903
904
|
failedOpRemovers: /* @__PURE__ */ new Set()
|
|
904
905
|
};
|
|
905
|
-
client.events.on(
|
|
906
|
+
client.events.on(chunk5BDYDZ4U_js.SESSION_CLAIMED, () => {
|
|
906
907
|
if (entry.initialized) void syncFromServer(entry);
|
|
907
908
|
});
|
|
908
|
-
client.events.on(
|
|
909
|
+
client.events.on(chunk5BDYDZ4U_js.SESSION_CLEARED, () => {
|
|
909
910
|
if (entry.initialized) void syncFromServer(entry);
|
|
910
911
|
});
|
|
911
912
|
cartStores.set(storeKey, entry);
|
|
@@ -1213,7 +1214,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1213
1214
|
function createDefaultClient() {
|
|
1214
1215
|
const processRef = globalThis.process;
|
|
1215
1216
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1216
|
-
return
|
|
1217
|
+
return chunk5BDYDZ4U_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1217
1218
|
}
|
|
1218
1219
|
function getStoredLocationId() {
|
|
1219
1220
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1317,7 +1318,7 @@ function CimplifyProvider({
|
|
|
1317
1318
|
const setDisplayCurrency = React14.useCallback(
|
|
1318
1319
|
(currency) => {
|
|
1319
1320
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1320
|
-
if (normalized && !
|
|
1321
|
+
if (normalized && !chunk4BKOKHE3_js.isSupportedCurrency(normalized)) {
|
|
1321
1322
|
return;
|
|
1322
1323
|
}
|
|
1323
1324
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -3261,19 +3262,19 @@ function toAccountLineItem(item, currency) {
|
|
|
3261
3262
|
quantity: s.quantity,
|
|
3262
3263
|
name: s.product_name,
|
|
3263
3264
|
variantName: s.variant_name,
|
|
3264
|
-
priceLabel:
|
|
3265
|
+
priceLabel: chunk7PDEX54K_js.parsePrice(s.unit_price) > 0 ? chunk7PDEX54K_js.formatMoney(s.unit_price, currency) : void 0
|
|
3265
3266
|
}));
|
|
3266
3267
|
const customisations = item.composite_selections?.selections.map((s) => ({
|
|
3267
3268
|
quantity: s.quantity,
|
|
3268
3269
|
name: s.component_name,
|
|
3269
|
-
priceLabel:
|
|
3270
|
+
priceLabel: chunk7PDEX54K_js.parsePrice(s.unit_price) > 0 ? `+${chunk7PDEX54K_js.formatMoney(s.unit_price, currency)}` : void 0
|
|
3270
3271
|
}));
|
|
3271
3272
|
const data = {
|
|
3272
3273
|
id: item.id,
|
|
3273
3274
|
name: item.product_name ?? "Item",
|
|
3274
3275
|
imageUrl: item.image_url,
|
|
3275
3276
|
subtitle: lineSubtitle(item),
|
|
3276
|
-
priceLabel:
|
|
3277
|
+
priceLabel: chunk7PDEX54K_js.formatMoney(item.total_price, currency),
|
|
3277
3278
|
lineType: item.line_type,
|
|
3278
3279
|
includes,
|
|
3279
3280
|
customisations,
|
|
@@ -3323,20 +3324,20 @@ var PAYMENT_TONE = {
|
|
|
3323
3324
|
function toAccountOrderView(order, opts = {}) {
|
|
3324
3325
|
const currency = order.payment.currency;
|
|
3325
3326
|
const rows = [
|
|
3326
|
-
{ label: "Subtotal", value:
|
|
3327
|
+
{ label: "Subtotal", value: chunk7PDEX54K_js.formatMoney(order.pricing.subtotal, currency) }
|
|
3327
3328
|
];
|
|
3328
|
-
if (
|
|
3329
|
+
if (chunk7PDEX54K_js.parsePrice(order.pricing.total_discount) > 0) {
|
|
3329
3330
|
rows.push({
|
|
3330
3331
|
label: "Discount",
|
|
3331
|
-
value: `\u2212${
|
|
3332
|
+
value: `\u2212${chunk7PDEX54K_js.formatMoney(order.pricing.total_discount, currency)}`,
|
|
3332
3333
|
tone: "positive"
|
|
3333
3334
|
});
|
|
3334
3335
|
}
|
|
3335
|
-
if (order.pricing.tax &&
|
|
3336
|
-
rows.push({ label: "Tax", value:
|
|
3336
|
+
if (order.pricing.tax && chunk7PDEX54K_js.parsePrice(order.pricing.tax) > 0) {
|
|
3337
|
+
rows.push({ label: "Tax", value: chunk7PDEX54K_js.formatMoney(order.pricing.tax, currency) });
|
|
3337
3338
|
}
|
|
3338
|
-
if (order.pricing.service_charge &&
|
|
3339
|
-
rows.push({ label: "Service", value:
|
|
3339
|
+
if (order.pricing.service_charge && chunk7PDEX54K_js.parsePrice(order.pricing.service_charge) > 0) {
|
|
3340
|
+
rows.push({ label: "Service", value: chunk7PDEX54K_js.formatMoney(order.pricing.service_charge, currency) });
|
|
3340
3341
|
}
|
|
3341
3342
|
const placed = fmtDateTime(order.timestamps.created_at);
|
|
3342
3343
|
const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
@@ -3350,7 +3351,7 @@ function toAccountOrderView(order, opts = {}) {
|
|
|
3350
3351
|
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
3351
3352
|
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
3352
3353
|
rows,
|
|
3353
|
-
total: { label: "Total", value:
|
|
3354
|
+
total: { label: "Total", value: chunk7PDEX54K_js.formatMoney(order.pricing.total_price, currency) }
|
|
3354
3355
|
},
|
|
3355
3356
|
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
3356
3357
|
onBack: opts.onBack
|
|
@@ -3525,7 +3526,7 @@ function CimplifySignInButton({
|
|
|
3525
3526
|
const onClick = async () => {
|
|
3526
3527
|
if (busy || disabled || !signInOpts.clientId) return;
|
|
3527
3528
|
setBusy(true);
|
|
3528
|
-
await
|
|
3529
|
+
await chunkIQFFSKE2_js.startSignIn({
|
|
3529
3530
|
...signInOpts,
|
|
3530
3531
|
onSuccess: () => {
|
|
3531
3532
|
setBusy(false);
|
|
@@ -4380,7 +4381,7 @@ function Price({
|
|
|
4380
4381
|
const resolvedAmount = fxActive ? context.convertPrice(amount) : typeof amount === "string" ? parseFloat(amount) || 0 : amount;
|
|
4381
4382
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
4382
4383
|
prefix,
|
|
4383
|
-
|
|
4384
|
+
chunk7PDEX54K_js.formatPrice(resolvedAmount, resolvedCurrency)
|
|
4384
4385
|
] });
|
|
4385
4386
|
}
|
|
4386
4387
|
function createCachedQuery(config) {
|
|
@@ -4993,9 +4994,9 @@ function useClientSessionEpoch(client) {
|
|
|
4993
4994
|
const subscribe = React14.useCallback(
|
|
4994
4995
|
(notify) => {
|
|
4995
4996
|
const unsubscribe = [
|
|
4996
|
-
client.events.on(
|
|
4997
|
-
client.events.on(
|
|
4998
|
-
client.events.on(
|
|
4997
|
+
client.events.on(chunk5BDYDZ4U_js.AUTH_TOKEN_CHANGED, notify),
|
|
4998
|
+
client.events.on(chunk5BDYDZ4U_js.SESSION_CLAIMED, notify),
|
|
4999
|
+
client.events.on(chunk5BDYDZ4U_js.SESSION_CLEARED, notify)
|
|
4999
5000
|
];
|
|
5000
5001
|
return () => {
|
|
5001
5002
|
for (const stopListening of unsubscribe) {
|
|
@@ -5482,13 +5483,13 @@ function useProductPrice(input) {
|
|
|
5482
5483
|
if (bundleTotalPrice != null) {
|
|
5483
5484
|
unitPrice = bundleTotalPrice;
|
|
5484
5485
|
} else if (compositePrice) {
|
|
5485
|
-
unitPrice =
|
|
5486
|
+
unitPrice = chunk7PDEX54K_js.parsePrice(compositePrice.final_price);
|
|
5486
5487
|
} else {
|
|
5487
|
-
unitPrice =
|
|
5488
|
+
unitPrice = chunk7PDEX54K_js.getVariantUnitPrice(product, variant);
|
|
5488
5489
|
if (addOnOptions) {
|
|
5489
5490
|
for (const option of addOnOptions) {
|
|
5490
5491
|
if (option.default_price) {
|
|
5491
|
-
unitPrice +=
|
|
5492
|
+
unitPrice += chunk7PDEX54K_js.parsePrice(option.default_price);
|
|
5492
5493
|
}
|
|
5493
5494
|
}
|
|
5494
5495
|
}
|
|
@@ -6162,7 +6163,7 @@ function useChat(options = {}) {
|
|
|
6162
6163
|
if (!c) return;
|
|
6163
6164
|
const last = lastConfirmedMessage();
|
|
6164
6165
|
const result = await c.support.getMessages({
|
|
6165
|
-
|
|
6166
|
+
afterSequence: last?.sequence,
|
|
6166
6167
|
limit: 50
|
|
6167
6168
|
});
|
|
6168
6169
|
if (result.ok && result.value.length > 0) {
|
|
@@ -6205,9 +6206,9 @@ function useChat(options = {}) {
|
|
|
6205
6206
|
);
|
|
6206
6207
|
return mergeMessages(snapshot, extras);
|
|
6207
6208
|
});
|
|
6208
|
-
aiEnabledRef.current = result.value.conversation.
|
|
6209
|
-
setHumanRequested(result.value.conversation.
|
|
6210
|
-
setSeenAt(
|
|
6209
|
+
aiEnabledRef.current = result.value.conversation.ai_mode === "auto";
|
|
6210
|
+
setHumanRequested(result.value.conversation.ai_mode === "off");
|
|
6211
|
+
setSeenAt(null);
|
|
6211
6212
|
setMayHaveOlder(result.value.messages.length >= 50);
|
|
6212
6213
|
}, []);
|
|
6213
6214
|
const connectWebSocket = React14.useCallback(() => {
|
|
@@ -6235,23 +6236,36 @@ function useChat(options = {}) {
|
|
|
6235
6236
|
ws.onmessage = (event) => {
|
|
6236
6237
|
try {
|
|
6237
6238
|
const envelope = JSON.parse(event.data);
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6239
|
+
const update = chunk5BDYDZ4U_js.chatRealtimeUpdateFromWire(envelope);
|
|
6240
|
+
if (update.kind === "message") {
|
|
6241
|
+
appendMessages([update.message]);
|
|
6242
|
+
} else if (update.kind === "message_updated") {
|
|
6243
|
+
lastActivityRef.current = Date.now();
|
|
6244
|
+
setMessages(
|
|
6245
|
+
(previous) => update.message.deleted_at ? previous.filter((message) => message.id !== update.message.id) : previous.map(
|
|
6246
|
+
(message) => message.id === update.message.id ? update.message : message
|
|
6247
|
+
)
|
|
6248
|
+
);
|
|
6249
|
+
} else if (update.kind === "business_read") {
|
|
6250
|
+
setSeenAt(
|
|
6251
|
+
(prev) => !prev || prev < update.occurredAt ? update.occurredAt : prev
|
|
6252
|
+
);
|
|
6253
|
+
} else if (update.kind === "ai_mode") {
|
|
6254
|
+
aiEnabledRef.current = update.mode === "auto";
|
|
6255
|
+
setHumanRequested(update.mode === "off");
|
|
6256
|
+
if (update.mode !== "auto") stopAwaitingReply();
|
|
6257
|
+
} else if (update.kind === "handoff") {
|
|
6258
|
+
aiEnabledRef.current = false;
|
|
6259
|
+
setHumanRequested(true);
|
|
6260
|
+
stopAwaitingReply();
|
|
6261
|
+
} else if (update.kind === "reload") {
|
|
6262
|
+
void resyncConversation();
|
|
6263
|
+
} else if (update.kind === "resync") {
|
|
6264
|
+
const latest = update.latestSequence;
|
|
6249
6265
|
const last = lastConfirmedMessage();
|
|
6250
|
-
if (latest
|
|
6266
|
+
if (latest === void 0 || !last?.sequence || last.sequence < latest) {
|
|
6251
6267
|
fetchNewMessages();
|
|
6252
6268
|
}
|
|
6253
|
-
} else if (envelope.type === "rekey") {
|
|
6254
|
-
void resyncConversation();
|
|
6255
6269
|
}
|
|
6256
6270
|
} catch {
|
|
6257
6271
|
}
|
|
@@ -6272,7 +6286,15 @@ function useChat(options = {}) {
|
|
|
6272
6286
|
ws.onerror = () => {
|
|
6273
6287
|
};
|
|
6274
6288
|
wsRef.current = ws;
|
|
6275
|
-
}, [
|
|
6289
|
+
}, [
|
|
6290
|
+
appendMessages,
|
|
6291
|
+
startPolling,
|
|
6292
|
+
stopPolling,
|
|
6293
|
+
fetchNewMessages,
|
|
6294
|
+
resyncConversation,
|
|
6295
|
+
lastConfirmedMessage,
|
|
6296
|
+
stopAwaitingReply
|
|
6297
|
+
]);
|
|
6276
6298
|
const resetConversation = React14.useCallback(() => {
|
|
6277
6299
|
stopPolling();
|
|
6278
6300
|
if (wsReconnectTimerRef.current) {
|
|
@@ -6300,9 +6322,9 @@ function useChat(options = {}) {
|
|
|
6300
6322
|
const c = clientRef.current;
|
|
6301
6323
|
setMessages(value.messages);
|
|
6302
6324
|
setConversationOpened(true);
|
|
6303
|
-
aiEnabledRef.current = value.conversation.
|
|
6304
|
-
setHumanRequested(value.conversation.
|
|
6305
|
-
setSeenAt(
|
|
6325
|
+
aiEnabledRef.current = value.conversation.ai_mode === "auto";
|
|
6326
|
+
setHumanRequested(value.conversation.ai_mode === "off");
|
|
6327
|
+
setSeenAt(null);
|
|
6306
6328
|
setMayHaveOlder(value.messages.length >= 50);
|
|
6307
6329
|
setClaimedAs(c?.support.claimedCustomerName ?? null);
|
|
6308
6330
|
connectWebSocket();
|
|
@@ -6325,7 +6347,7 @@ function useChat(options = {}) {
|
|
|
6325
6347
|
const watchSessionClaims = React14.useCallback(() => {
|
|
6326
6348
|
const c = clientRef.current;
|
|
6327
6349
|
if (!c || claimUnsubRef.current) return;
|
|
6328
|
-
const unsubClaimed = c.events.on(
|
|
6350
|
+
const unsubClaimed = c.events.on(chunk5BDYDZ4U_js.SESSION_CLAIMED, (event) => {
|
|
6329
6351
|
setClaimedAs(event.customerName || c.support.claimedCustomerName || null);
|
|
6330
6352
|
if (!openedRef.current) {
|
|
6331
6353
|
void openIfExisting();
|
|
@@ -6334,7 +6356,7 @@ function useChat(options = {}) {
|
|
|
6334
6356
|
connectWebSocket();
|
|
6335
6357
|
void resyncConversation();
|
|
6336
6358
|
});
|
|
6337
|
-
const unsubCleared = c.events.on(
|
|
6359
|
+
const unsubCleared = c.events.on(chunk5BDYDZ4U_js.SESSION_CLEARED, resetConversation);
|
|
6338
6360
|
claimUnsubRef.current = () => {
|
|
6339
6361
|
unsubClaimed();
|
|
6340
6362
|
unsubCleared();
|
|
@@ -6386,7 +6408,7 @@ function useChat(options = {}) {
|
|
|
6386
6408
|
if (!openedRef.current) return false;
|
|
6387
6409
|
}
|
|
6388
6410
|
const replyTo = opts?.replyTo;
|
|
6389
|
-
const clientId =
|
|
6411
|
+
const clientId = chunkIQFFSKE2_js.generateIdempotencyKey();
|
|
6390
6412
|
const localId = optimisticId(clientId);
|
|
6391
6413
|
const optimistic = {
|
|
6392
6414
|
id: localId,
|
|
@@ -6471,7 +6493,7 @@ function useChat(options = {}) {
|
|
|
6471
6493
|
const c = clientRef.current;
|
|
6472
6494
|
const earliest = messagesRef.current[0];
|
|
6473
6495
|
if (!c || !earliest) return false;
|
|
6474
|
-
const result = await c.support.getMessages({
|
|
6496
|
+
const result = await c.support.getMessages({ beforeSequence: earliest.sequence, limit: 50 });
|
|
6475
6497
|
if (!result.ok) {
|
|
6476
6498
|
setError(result.error);
|
|
6477
6499
|
return false;
|
|
@@ -6575,15 +6597,15 @@ function AuthElement({
|
|
|
6575
6597
|
}, [onReady, onAuthenticated, onError]);
|
|
6576
6598
|
React14.useEffect(() => {
|
|
6577
6599
|
if (!elements || !containerRef.current) return;
|
|
6578
|
-
const element = elements.create(
|
|
6600
|
+
const element = elements.create(chunkIQFFSKE2_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
6579
6601
|
elementRef.current = element;
|
|
6580
|
-
element.on(
|
|
6602
|
+
element.on(chunkIQFFSKE2_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6581
6603
|
element.on(
|
|
6582
|
-
|
|
6604
|
+
chunkIQFFSKE2_js.EVENT_TYPES.AUTHENTICATED,
|
|
6583
6605
|
(data) => onAuthenticatedRef.current?.(data)
|
|
6584
6606
|
);
|
|
6585
6607
|
element.on(
|
|
6586
|
-
|
|
6608
|
+
chunkIQFFSKE2_js.EVENT_TYPES.ERROR,
|
|
6587
6609
|
(data) => onErrorRef.current?.(data)
|
|
6588
6610
|
);
|
|
6589
6611
|
element.mount(containerRef.current);
|
|
@@ -6612,15 +6634,15 @@ function AddressElement({
|
|
|
6612
6634
|
}, [onReady, onChange, onError]);
|
|
6613
6635
|
React14.useEffect(() => {
|
|
6614
6636
|
if (!elements || !containerRef.current) return;
|
|
6615
|
-
const element = elements.create(
|
|
6637
|
+
const element = elements.create(chunkIQFFSKE2_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
6616
6638
|
elementRef.current = element;
|
|
6617
|
-
element.on(
|
|
6639
|
+
element.on(chunkIQFFSKE2_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6618
6640
|
element.on(
|
|
6619
|
-
|
|
6641
|
+
chunkIQFFSKE2_js.EVENT_TYPES.CHANGE,
|
|
6620
6642
|
(data) => onChangeRef.current?.(data)
|
|
6621
6643
|
);
|
|
6622
6644
|
element.on(
|
|
6623
|
-
|
|
6645
|
+
chunkIQFFSKE2_js.EVENT_TYPES.ERROR,
|
|
6624
6646
|
(data) => onErrorRef.current?.(data)
|
|
6625
6647
|
);
|
|
6626
6648
|
element.mount(containerRef.current);
|
|
@@ -6650,15 +6672,15 @@ function PaymentElement({
|
|
|
6650
6672
|
}, [onReady, onChange, onError]);
|
|
6651
6673
|
React14.useEffect(() => {
|
|
6652
6674
|
if (!elements || !containerRef.current) return;
|
|
6653
|
-
const element = elements.create(
|
|
6675
|
+
const element = elements.create(chunkIQFFSKE2_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
6654
6676
|
elementRef.current = element;
|
|
6655
|
-
element.on(
|
|
6677
|
+
element.on(chunkIQFFSKE2_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
6656
6678
|
element.on(
|
|
6657
|
-
|
|
6679
|
+
chunkIQFFSKE2_js.EVENT_TYPES.CHANGE,
|
|
6658
6680
|
(data) => onChangeRef.current?.(data)
|
|
6659
6681
|
);
|
|
6660
6682
|
element.on(
|
|
6661
|
-
|
|
6683
|
+
chunkIQFFSKE2_js.EVENT_TYPES.ERROR,
|
|
6662
6684
|
(data) => onErrorRef.current?.(data)
|
|
6663
6685
|
);
|
|
6664
6686
|
element.mount(containerRef.current);
|
|
@@ -6815,7 +6837,7 @@ function VariantSelector({
|
|
|
6815
6837
|
if (!variants || variants.length <= 1) {
|
|
6816
6838
|
return null;
|
|
6817
6839
|
}
|
|
6818
|
-
basePrice != null ?
|
|
6840
|
+
basePrice != null ? chunk7PDEX54K_js.parsePrice(basePrice) : 0;
|
|
6819
6841
|
if (variantAxes && variantAxes.length > 0) {
|
|
6820
6842
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
6821
6843
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -6921,7 +6943,7 @@ function VariantSelector({
|
|
|
6921
6943
|
className: cn("divide-y divide-border", classNames?.list),
|
|
6922
6944
|
children: variants.map((variant) => {
|
|
6923
6945
|
const isSelected = selectedVariantId === variant.id;
|
|
6924
|
-
const adjustment =
|
|
6946
|
+
const adjustment = chunk7PDEX54K_js.parsePrice(variant.price_adjustment);
|
|
6925
6947
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6926
6948
|
radio.Radio.Root,
|
|
6927
6949
|
{
|
|
@@ -7189,16 +7211,16 @@ function BundleSelector({
|
|
|
7189
7211
|
}, [components, selections, onReady]);
|
|
7190
7212
|
const totalPrice = React14.useMemo(() => {
|
|
7191
7213
|
if (pricingType === "fixed" && bundlePrice) {
|
|
7192
|
-
return
|
|
7214
|
+
return chunk7PDEX54K_js.parsePrice(bundlePrice);
|
|
7193
7215
|
}
|
|
7194
7216
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
7195
7217
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
7196
7218
|
}, 0);
|
|
7197
7219
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
7198
|
-
return componentsTotal * (1 -
|
|
7220
|
+
return componentsTotal * (1 - chunk7PDEX54K_js.parsePrice(discountValue) / 100);
|
|
7199
7221
|
}
|
|
7200
7222
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
7201
|
-
return componentsTotal -
|
|
7223
|
+
return componentsTotal - chunk7PDEX54K_js.parsePrice(discountValue);
|
|
7202
7224
|
}
|
|
7203
7225
|
return componentsTotal;
|
|
7204
7226
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -7260,15 +7282,15 @@ function BundleSelector({
|
|
|
7260
7282
|
}
|
|
7261
7283
|
function getComponentPrice(component, selectedVariantId) {
|
|
7262
7284
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
7263
|
-
return
|
|
7285
|
+
return chunk7PDEX54K_js.parsePrice(component.effective_price);
|
|
7264
7286
|
}
|
|
7265
7287
|
if (selectedVariantId === component.variant_id) {
|
|
7266
|
-
return
|
|
7288
|
+
return chunk7PDEX54K_js.parsePrice(component.effective_price);
|
|
7267
7289
|
}
|
|
7268
7290
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
7269
7291
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
7270
|
-
if (!selectedAdj) return
|
|
7271
|
-
return
|
|
7292
|
+
if (!selectedAdj) return chunk7PDEX54K_js.parsePrice(component.effective_price);
|
|
7293
|
+
return chunk7PDEX54K_js.parsePrice(component.effective_price) - chunk7PDEX54K_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk7PDEX54K_js.parsePrice(selectedAdj.price_adjustment);
|
|
7272
7294
|
}
|
|
7273
7295
|
function formatDuration(minutes, unit) {
|
|
7274
7296
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -7382,7 +7404,7 @@ function BundleComponentCard({
|
|
|
7382
7404
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
7383
7405
|
children: component.available_variants.map((variant) => {
|
|
7384
7406
|
const isSelected = selectedVariantId === variant.id;
|
|
7385
|
-
const adjustment =
|
|
7407
|
+
const adjustment = chunk7PDEX54K_js.parsePrice(variant.price_adjustment);
|
|
7386
7408
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7387
7409
|
radio.Radio.Root,
|
|
7388
7410
|
{
|
|
@@ -7829,7 +7851,7 @@ function CompositeSelector({
|
|
|
7829
7851
|
"data-cimplify-composite-summary": true,
|
|
7830
7852
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
7831
7853
|
children: [
|
|
7832
|
-
|
|
7854
|
+
chunk7PDEX54K_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7833
7855
|
"div",
|
|
7834
7856
|
{
|
|
7835
7857
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7840,7 +7862,7 @@ function CompositeSelector({
|
|
|
7840
7862
|
]
|
|
7841
7863
|
}
|
|
7842
7864
|
),
|
|
7843
|
-
|
|
7865
|
+
chunk7PDEX54K_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
7844
7866
|
"div",
|
|
7845
7867
|
{
|
|
7846
7868
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -7984,7 +8006,7 @@ function BookingSummary({
|
|
|
7984
8006
|
className,
|
|
7985
8007
|
classNames
|
|
7986
8008
|
}) {
|
|
7987
|
-
const depositValue = depositAmount != null ?
|
|
8009
|
+
const depositValue = depositAmount != null ? chunk7PDEX54K_js.parsePrice(depositAmount) : 0;
|
|
7988
8010
|
const depositDue = depositType === "percentage" ? total * depositValue / 100 : depositType === "fixed" ? depositValue : 0;
|
|
7989
8011
|
const hasDeposit = depositDue > 0;
|
|
7990
8012
|
const balance = Math.max(0, total - depositDue);
|
|
@@ -8712,7 +8734,7 @@ function InputField({
|
|
|
8712
8734
|
currency,
|
|
8713
8735
|
classNames
|
|
8714
8736
|
}) {
|
|
8715
|
-
const hasPriceAdjustment = field.price_adjustment != null &&
|
|
8737
|
+
const hasPriceAdjustment = field.price_adjustment != null && chunk7PDEX54K_js.parsePrice(field.price_adjustment) > 0;
|
|
8716
8738
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
8717
8739
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
8718
8740
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -9844,15 +9866,15 @@ function ProductCustomizerContent({
|
|
|
9844
9866
|
}, [selectedAddOnOptionIds]);
|
|
9845
9867
|
const localTotalPrice = React14.useMemo(() => {
|
|
9846
9868
|
if (isComposite && compositePrice) {
|
|
9847
|
-
return
|
|
9869
|
+
return chunk7PDEX54K_js.parsePrice(compositePrice.final_price) * quantity;
|
|
9848
9870
|
}
|
|
9849
9871
|
if (isBundle && bundleTotalPrice != null) {
|
|
9850
9872
|
return bundleTotalPrice * quantity;
|
|
9851
9873
|
}
|
|
9852
|
-
let price =
|
|
9874
|
+
let price = chunk7PDEX54K_js.getVariantUnitPrice(product, selectedVariant);
|
|
9853
9875
|
for (const option of selectedAddOnOptions) {
|
|
9854
9876
|
if (option.default_price) {
|
|
9855
|
-
price +=
|
|
9877
|
+
price += chunk7PDEX54K_js.parsePrice(option.default_price);
|
|
9856
9878
|
}
|
|
9857
9879
|
}
|
|
9858
9880
|
return price * quantity;
|
|
@@ -9918,12 +9940,12 @@ function ProductCustomizerContent({
|
|
|
9918
9940
|
} = useQuote(quoteInput, {
|
|
9919
9941
|
enabled: quoteEnabled
|
|
9920
9942
|
});
|
|
9921
|
-
const currency = quote?.currency ??
|
|
9943
|
+
const currency = quote?.currency ?? chunk7PDEX54K_js.getProductCurrency(product);
|
|
9922
9944
|
const quoteId = quote?.quote_id;
|
|
9923
9945
|
const quotedUnitPrice = (quote?.quoted_total_price_info ?? quote?.final_price_info)?.final_price;
|
|
9924
9946
|
const quotedTotalPrice = React14.useMemo(() => {
|
|
9925
9947
|
if (quotedUnitPrice === void 0 || quotedUnitPrice === null) return void 0;
|
|
9926
|
-
return
|
|
9948
|
+
return chunk7PDEX54K_js.parsePrice(quotedUnitPrice) * quantity;
|
|
9927
9949
|
}, [quotedUnitPrice, quantity]);
|
|
9928
9950
|
const quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2;
|
|
9929
9951
|
const validationMessage = !quoteEnabled ? REQUIRED_OPTIONS_MESSAGE : quoteError ? QUOTE_UNAVAILABLE_MESSAGE : !quoteIsReady ? QUOTE_LOADING_MESSAGE : null;
|
|
@@ -10147,7 +10169,7 @@ function ProductCustomizerContent({
|
|
|
10147
10169
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
|
|
10148
10170
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10149
10171
|
"Deposit required: ",
|
|
10150
|
-
|
|
10172
|
+
chunk7PDEX54K_js.parsePrice(product.deposit_amount),
|
|
10151
10173
|
"%"
|
|
10152
10174
|
] })
|
|
10153
10175
|
}
|
|
@@ -10255,10 +10277,10 @@ function ProductCustomizerContent({
|
|
|
10255
10277
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10256
10278
|
Price,
|
|
10257
10279
|
{
|
|
10258
|
-
amount:
|
|
10280
|
+
amount: chunk7PDEX54K_js.getUnitPriceAtQuantity(
|
|
10259
10281
|
product.quantity_pricing,
|
|
10260
10282
|
quantity,
|
|
10261
|
-
|
|
10283
|
+
chunk7PDEX54K_js.parsePrice(product.default_price)
|
|
10262
10284
|
),
|
|
10263
10285
|
currency,
|
|
10264
10286
|
className: "font-medium text-foreground"
|
|
@@ -10724,11 +10746,11 @@ function CartLineItemRow({
|
|
|
10724
10746
|
addOnOptions: item.addOnOptions
|
|
10725
10747
|
});
|
|
10726
10748
|
const pinnedUnitPrice = item._quotedUnitPrice;
|
|
10727
|
-
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice :
|
|
10749
|
+
const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice : chunk7PDEX54K_js.parsePrice(pinnedUnitPrice);
|
|
10728
10750
|
const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
|
|
10729
10751
|
const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
|
|
10730
10752
|
const isOptimistic2 = item.isOptimistic === true;
|
|
10731
|
-
const lineTotal =
|
|
10753
|
+
const lineTotal = chunk7PDEX54K_js.parsePrice(unitPrice) * item.quantity;
|
|
10732
10754
|
const imageUrl = item.product.image_url;
|
|
10733
10755
|
const variantLabel2 = item.variant ? chunk2P4KXFB6_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
10734
10756
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11017,7 +11039,7 @@ function CartSummary({
|
|
|
11017
11039
|
removeItem,
|
|
11018
11040
|
updateQuantity
|
|
11019
11041
|
} = useCart();
|
|
11020
|
-
const displayCurrency = serverCart?.currency ??
|
|
11042
|
+
const displayCurrency = serverCart?.currency ?? chunk4BKOKHE3_js.currencyCode(currency);
|
|
11021
11043
|
const deliveryFee = serverCart?.delivery_fee;
|
|
11022
11044
|
const serviceCharge = serverCart?.service_charge;
|
|
11023
11045
|
const totalDiscounts = serverCart?.total_discounts;
|
|
@@ -11080,7 +11102,7 @@ function CartSummary({
|
|
|
11080
11102
|
]
|
|
11081
11103
|
}
|
|
11082
11104
|
),
|
|
11083
|
-
totalDiscounts != null &&
|
|
11105
|
+
totalDiscounts != null && chunk7PDEX54K_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11084
11106
|
"div",
|
|
11085
11107
|
{
|
|
11086
11108
|
"data-cimplify-cart-discount": true,
|
|
@@ -11106,7 +11128,7 @@ function CartSummary({
|
|
|
11106
11128
|
className: cn("flex items-baseline justify-between", classNames?.deliveryFee),
|
|
11107
11129
|
children: [
|
|
11108
11130
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
11109
|
-
|
|
11131
|
+
chunk7PDEX54K_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11110
11132
|
Price,
|
|
11111
11133
|
{
|
|
11112
11134
|
amount: deliveryFee,
|
|
@@ -11117,7 +11139,7 @@ function CartSummary({
|
|
|
11117
11139
|
]
|
|
11118
11140
|
}
|
|
11119
11141
|
),
|
|
11120
|
-
serviceCharge != null &&
|
|
11142
|
+
serviceCharge != null && chunk7PDEX54K_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11121
11143
|
"div",
|
|
11122
11144
|
{
|
|
11123
11145
|
"data-cimplify-cart-service-charge": true,
|
|
@@ -11251,18 +11273,18 @@ function SaleBadge({
|
|
|
11251
11273
|
className,
|
|
11252
11274
|
classNames
|
|
11253
11275
|
}) {
|
|
11254
|
-
const onSale =
|
|
11276
|
+
const onSale = chunk7PDEX54K_js.isOnSale(product);
|
|
11255
11277
|
const hasDeal = dealInfo !== void 0;
|
|
11256
11278
|
if (!hasDeal && !onSale && !label) {
|
|
11257
11279
|
return null;
|
|
11258
11280
|
}
|
|
11259
11281
|
let percentage = null;
|
|
11260
11282
|
if (product.sale) {
|
|
11261
|
-
percentage =
|
|
11283
|
+
percentage = chunk7PDEX54K_js.parsePrice(product.sale.percent_off);
|
|
11262
11284
|
} else if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
11263
|
-
percentage =
|
|
11285
|
+
percentage = chunk7PDEX54K_js.parsePrice(dealInfo.value);
|
|
11264
11286
|
} else if (onSale) {
|
|
11265
|
-
percentage =
|
|
11287
|
+
percentage = chunk7PDEX54K_js.getDiscountPercentage(product);
|
|
11266
11288
|
}
|
|
11267
11289
|
const badgeText = label ?? product.sale?.badge_text ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
11268
11290
|
if (!badgeText) {
|
|
@@ -11281,7 +11303,7 @@ function SaleBadge({
|
|
|
11281
11303
|
"%"
|
|
11282
11304
|
] }),
|
|
11283
11305
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
11284
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
11306
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7PDEX54K_js.getBasePrice(product), currency: chunk7PDEX54K_js.getProductCurrency(product) }) })
|
|
11285
11307
|
]
|
|
11286
11308
|
}
|
|
11287
11309
|
);
|
|
@@ -11299,7 +11321,7 @@ function SalePrice({
|
|
|
11299
11321
|
if (!sale) {
|
|
11300
11322
|
return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
|
|
11301
11323
|
}
|
|
11302
|
-
const off = Math.round(
|
|
11324
|
+
const off = Math.round(chunk7PDEX54K_js.parsePrice(sale.percent_off));
|
|
11303
11325
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11304
11326
|
"span",
|
|
11305
11327
|
{
|
|
@@ -11675,7 +11697,7 @@ function ProductSheet({
|
|
|
11675
11697
|
Price,
|
|
11676
11698
|
{
|
|
11677
11699
|
amount: fullProduct.default_price,
|
|
11678
|
-
currency:
|
|
11700
|
+
currency: chunk7PDEX54K_js.getProductCurrency(fullProduct),
|
|
11679
11701
|
className: classNames?.price
|
|
11680
11702
|
}
|
|
11681
11703
|
)
|
|
@@ -11861,10 +11883,10 @@ function SoldOutOverlay() {
|
|
|
11861
11883
|
function SaleBadge2({ product }) {
|
|
11862
11884
|
let label = null;
|
|
11863
11885
|
if (product.sale) {
|
|
11864
|
-
const off = Math.round(
|
|
11886
|
+
const off = Math.round(chunk7PDEX54K_js.parsePrice(product.sale.percent_off));
|
|
11865
11887
|
label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
|
|
11866
|
-
} else if (
|
|
11867
|
-
const pct =
|
|
11888
|
+
} else if (chunk7PDEX54K_js.isOnSale(product)) {
|
|
11889
|
+
const pct = chunk7PDEX54K_js.getDiscountPercentage(product);
|
|
11868
11890
|
label = pct && pct > 0 ? `-${pct}%` : null;
|
|
11869
11891
|
}
|
|
11870
11892
|
if (!label) return null;
|
|
@@ -11905,7 +11927,7 @@ function FoodProductCard({
|
|
|
11905
11927
|
className
|
|
11906
11928
|
}) {
|
|
11907
11929
|
const image = product.image_url || product.images?.[0] || "";
|
|
11908
|
-
const currency =
|
|
11930
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
11909
11931
|
const tags = product.tags || [];
|
|
11910
11932
|
const isSignature = product.metadata?.is_signature === true;
|
|
11911
11933
|
const isNew = product.metadata?.is_new === true;
|
|
@@ -11961,9 +11983,9 @@ function RetailProductCard({
|
|
|
11961
11983
|
className
|
|
11962
11984
|
}) {
|
|
11963
11985
|
const image = product.image_url || product.images?.[0] || "";
|
|
11964
|
-
const currency =
|
|
11986
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
11965
11987
|
const outOfStock = product.inventory_status?.in_stock === false;
|
|
11966
|
-
const onSale =
|
|
11988
|
+
const onSale = chunk7PDEX54K_js.isOnSale(product);
|
|
11967
11989
|
const swatches = getColorSwatches(product);
|
|
11968
11990
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
11969
11991
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
@@ -11984,7 +12006,7 @@ function RetailProductCard({
|
|
|
11984
12006
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
|
|
11985
12007
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11986
12008
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
11987
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
12009
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7PDEX54K_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
|
|
11988
12010
|
] }) }),
|
|
11989
12011
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11990
12012
|
"span",
|
|
@@ -11999,10 +12021,10 @@ function RetailProductCard({
|
|
|
11999
12021
|
] });
|
|
12000
12022
|
}
|
|
12001
12023
|
function PriceRange({ product, currency, className }) {
|
|
12002
|
-
const resolvedCurrency = currency ??
|
|
12003
|
-
const range =
|
|
12024
|
+
const resolvedCurrency = currency ?? chunk7PDEX54K_js.getProductCurrency(product);
|
|
12025
|
+
const range = chunk7PDEX54K_js.getPriceRange(product);
|
|
12004
12026
|
if (!range) return null;
|
|
12005
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
12027
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunk7PDEX54K_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
12006
12028
|
}
|
|
12007
12029
|
function WholesaleProductCard({
|
|
12008
12030
|
product,
|
|
@@ -12012,7 +12034,7 @@ function WholesaleProductCard({
|
|
|
12012
12034
|
className
|
|
12013
12035
|
}) {
|
|
12014
12036
|
const image = product.image_url || product.images?.[0] || "";
|
|
12015
|
-
const currency =
|
|
12037
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12016
12038
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12017
12039
|
const status = product.inventory_status;
|
|
12018
12040
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12060,7 +12082,7 @@ function DigitalProductCard({
|
|
|
12060
12082
|
className
|
|
12061
12083
|
}) {
|
|
12062
12084
|
const image = product.image_url || product.images?.[0] || "";
|
|
12063
|
-
const currency =
|
|
12085
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12064
12086
|
const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
|
|
12065
12087
|
const isTicket = product.digital_type === "ticket";
|
|
12066
12088
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
@@ -12091,11 +12113,11 @@ function BundleProductCard({
|
|
|
12091
12113
|
className
|
|
12092
12114
|
}) {
|
|
12093
12115
|
const image = product.image_url || product.images?.[0] || "";
|
|
12094
|
-
const currency =
|
|
12116
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12095
12117
|
const components = product.components || [];
|
|
12096
12118
|
const componentCount = components.length;
|
|
12097
|
-
const onSale =
|
|
12098
|
-
const discount =
|
|
12119
|
+
const onSale = chunk7PDEX54K_js.isOnSale(product);
|
|
12120
|
+
const discount = chunk7PDEX54K_js.getDiscountPercentage(product);
|
|
12099
12121
|
const hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
12100
12122
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12101
12123
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
@@ -12122,7 +12144,7 @@ function BundleProductCard({
|
|
|
12122
12144
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
12123
12145
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
|
|
12124
12146
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12125
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
12147
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7PDEX54K_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
|
|
12126
12148
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
12127
12149
|
"Save ",
|
|
12128
12150
|
discount,
|
|
@@ -12142,7 +12164,7 @@ function CompositeProductCard({
|
|
|
12142
12164
|
className
|
|
12143
12165
|
}) {
|
|
12144
12166
|
const image = product.image_url || product.images?.[0] || "";
|
|
12145
|
-
const currency =
|
|
12167
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12146
12168
|
const groups = product.groups || [];
|
|
12147
12169
|
const groupCount = groups.length;
|
|
12148
12170
|
groups.reduce((sum, g) => sum + g.components.length, 0);
|
|
@@ -12194,7 +12216,7 @@ function StandardServiceCard({
|
|
|
12194
12216
|
className
|
|
12195
12217
|
}) {
|
|
12196
12218
|
const image = product.image_url || product.images?.[0] || "";
|
|
12197
|
-
const currency =
|
|
12219
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12198
12220
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12199
12221
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
12200
12222
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
@@ -12249,7 +12271,7 @@ function CompactServiceCard({
|
|
|
12249
12271
|
className
|
|
12250
12272
|
}) {
|
|
12251
12273
|
const image = product.image_url || product.images?.[0] || "";
|
|
12252
|
-
const currency =
|
|
12274
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12253
12275
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12254
12276
|
const hasBillingPlans = product.billing_plans && product.billing_plans.length > 0;
|
|
12255
12277
|
const href = `/products/${product.slug}`;
|
|
@@ -12298,7 +12320,7 @@ function ScheduleServiceCard({
|
|
|
12298
12320
|
className
|
|
12299
12321
|
}) {
|
|
12300
12322
|
const image = product.image_url || product.images?.[0] || "";
|
|
12301
|
-
const currency =
|
|
12323
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12302
12324
|
const href = `/products/${product.slug}`;
|
|
12303
12325
|
const durationLabel = product.duration_minutes != null ? formatDuration2(product.duration_minutes, product.duration_unit) : null;
|
|
12304
12326
|
const displaySlots = (slots || []).slice(0, 3);
|
|
@@ -12370,7 +12392,7 @@ function RentalServiceCard({
|
|
|
12370
12392
|
className
|
|
12371
12393
|
}) {
|
|
12372
12394
|
const image = product.image_url || product.images?.[0] || "";
|
|
12373
|
-
const currency =
|
|
12395
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12374
12396
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12375
12397
|
const unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "day";
|
|
12376
12398
|
const priceUnit = product.price_basis === "per_person" ? "guest" : product.price_basis === "flat" ? "" : unit;
|
|
@@ -12440,7 +12462,7 @@ function AccommodationCard({
|
|
|
12440
12462
|
className
|
|
12441
12463
|
}) {
|
|
12442
12464
|
const image = product.image_url || product.images?.[0] || "";
|
|
12443
|
-
const currency =
|
|
12465
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12444
12466
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12445
12467
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
12446
12468
|
const tags = product.tags || [];
|
|
@@ -12506,7 +12528,7 @@ function LeaseServiceCard({
|
|
|
12506
12528
|
className
|
|
12507
12529
|
}) {
|
|
12508
12530
|
const image = product.image_url || product.images?.[0] || "";
|
|
12509
|
-
const currency =
|
|
12531
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12510
12532
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
12511
12533
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
12512
12534
|
const unit = product.duration_unit ? UNIT_LABELS3[product.duration_unit] || product.duration_unit : "mo";
|
|
@@ -12580,7 +12602,7 @@ function SubscriptionCard({
|
|
|
12580
12602
|
className
|
|
12581
12603
|
}) {
|
|
12582
12604
|
const image = product.image_url || product.images?.[0] || "";
|
|
12583
|
-
const currency =
|
|
12605
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
12584
12606
|
const plans = product.billing_plans || [];
|
|
12585
12607
|
const primaryPlan = plans[0];
|
|
12586
12608
|
const frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo";
|
|
@@ -12811,7 +12833,7 @@ function ProductCard({
|
|
|
12811
12833
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
|
|
12812
12834
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
|
|
12813
12835
|
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 }),
|
|
12814
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency:
|
|
12836
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunk7PDEX54K_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
|
|
12815
12837
|
] })
|
|
12816
12838
|
] });
|
|
12817
12839
|
})();
|
|
@@ -13140,7 +13162,7 @@ function SearchInput({
|
|
|
13140
13162
|
}
|
|
13141
13163
|
),
|
|
13142
13164
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
13143
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
13165
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk7PDEX54K_js.formatPrice(product.default_price) })
|
|
13144
13166
|
] })
|
|
13145
13167
|
},
|
|
13146
13168
|
product.id
|
|
@@ -13635,19 +13657,19 @@ function OrderSummary({
|
|
|
13635
13657
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
13636
13658
|
] }),
|
|
13637
13659
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
13638
|
-
order.total_discount != null &&
|
|
13660
|
+
order.total_discount != null && chunk7PDEX54K_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
13639
13661
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
13640
13662
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
13641
13663
|
] }),
|
|
13642
|
-
order.delivery_fee != null &&
|
|
13664
|
+
order.delivery_fee != null && chunk7PDEX54K_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
13643
13665
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
13644
13666
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
13645
13667
|
] }),
|
|
13646
|
-
order.service_charge != null &&
|
|
13668
|
+
order.service_charge != null && chunk7PDEX54K_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
13647
13669
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
13648
13670
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
13649
13671
|
] }),
|
|
13650
|
-
order.tax != null &&
|
|
13672
|
+
order.tax != null && chunk7PDEX54K_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
13651
13673
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
13652
13674
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
13653
13675
|
] }),
|
|
@@ -14178,7 +14200,7 @@ function BookingPage({
|
|
|
14178
14200
|
const hasStaffStep = staff && staff.length > 0;
|
|
14179
14201
|
const depositType = product?.deposit_type;
|
|
14180
14202
|
const depositAmount = product?.deposit_amount;
|
|
14181
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
14203
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk7PDEX54K_js.parsePrice(depositAmount) !== 0;
|
|
14182
14204
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
14183
14205
|
const noShowFee = product?.no_show_fee;
|
|
14184
14206
|
const handleSlotSelect = React14.useCallback(
|
|
@@ -14311,14 +14333,14 @@ function BookingPage({
|
|
|
14311
14333
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price, currency }) }),
|
|
14312
14334
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
14313
14335
|
"Deposit: ",
|
|
14314
|
-
depositType === "percentage" ? `${
|
|
14336
|
+
depositType === "percentage" ? `${chunk7PDEX54K_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
|
|
14315
14337
|
] }),
|
|
14316
14338
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
14317
14339
|
"Free cancellation up to ",
|
|
14318
14340
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
14319
14341
|
" before"
|
|
14320
14342
|
] }),
|
|
14321
|
-
noShowFee !== void 0 &&
|
|
14343
|
+
noShowFee !== void 0 && chunk7PDEX54K_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
14322
14344
|
"No-show fee: ",
|
|
14323
14345
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee, currency })
|
|
14324
14346
|
] })
|
|
@@ -14421,7 +14443,7 @@ function BookingPage({
|
|
|
14421
14443
|
] }),
|
|
14422
14444
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
14423
14445
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
14424
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
14446
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk7PDEX54K_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
|
|
14425
14447
|
] })
|
|
14426
14448
|
] }),
|
|
14427
14449
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15095,9 +15117,9 @@ function DefaultProductLayout({
|
|
|
15095
15117
|
}) {
|
|
15096
15118
|
const [selectedVariantId, setSelectedVariantId] = React14__default.default.useState();
|
|
15097
15119
|
const images = chunk2P4KXFB6_js.resolveGallery(product, selectedVariantId);
|
|
15098
|
-
const currency =
|
|
15120
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15099
15121
|
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
15100
|
-
const onSale =
|
|
15122
|
+
const onSale = chunk7PDEX54K_js.isOnSale(product);
|
|
15101
15123
|
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
15102
15124
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
15103
15125
|
renderBreadcrumb?.(product),
|
|
@@ -15120,13 +15142,13 @@ function DefaultProductLayout({
|
|
|
15120
15142
|
/* @__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: [
|
|
15121
15143
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
|
|
15122
15144
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15123
|
-
/* @__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(
|
|
15145
|
+
/* @__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(chunk7PDEX54K_js.parsePrice(product.sale.percent_off))}% OFF` })
|
|
15124
15146
|
] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15125
15147
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
|
|
15126
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
15148
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7PDEX54K_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
|
|
15127
15149
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
15128
15150
|
"Save ",
|
|
15129
|
-
|
|
15151
|
+
chunk7PDEX54K_js.getDiscountPercentage(product),
|
|
15130
15152
|
"%"
|
|
15131
15153
|
] })
|
|
15132
15154
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-semibold" }) }),
|
|
@@ -15188,7 +15210,7 @@ function FoodProductLayout({
|
|
|
15188
15210
|
className
|
|
15189
15211
|
}) {
|
|
15190
15212
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15191
|
-
const currency =
|
|
15213
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15192
15214
|
const tags = product.tags || [];
|
|
15193
15215
|
const ingredients = getMetadataStringList(product.metadata, "ingredients");
|
|
15194
15216
|
const pairings = getMetadataStringList(product.metadata, "pairings");
|
|
@@ -15263,7 +15285,7 @@ function WholesaleProductLayout({
|
|
|
15263
15285
|
className
|
|
15264
15286
|
}) {
|
|
15265
15287
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15266
|
-
const currency =
|
|
15288
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15267
15289
|
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
15268
15290
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
|
|
15269
15291
|
renderBreadcrumb?.(product),
|
|
@@ -15347,9 +15369,9 @@ function ServiceProductLayout({
|
|
|
15347
15369
|
className
|
|
15348
15370
|
}) {
|
|
15349
15371
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15350
|
-
const currency =
|
|
15372
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15351
15373
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
15352
|
-
const depositAmount = hasDeposit ?
|
|
15374
|
+
const depositAmount = hasDeposit ? chunk7PDEX54K_js.parsePrice(product.deposit_amount) : 0;
|
|
15353
15375
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
15354
15376
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
15355
15377
|
renderBreadcrumb?.(product),
|
|
@@ -15417,7 +15439,7 @@ function ServiceProductLayout({
|
|
|
15417
15439
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency, className: "font-medium text-foreground" }),
|
|
15418
15440
|
" deposit charged at booking"
|
|
15419
15441
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15420
|
-
|
|
15442
|
+
chunk7PDEX54K_js.parsePrice(product.deposit_amount),
|
|
15421
15443
|
"% deposit charged at booking"
|
|
15422
15444
|
] }) })
|
|
15423
15445
|
] })
|
|
@@ -15449,7 +15471,7 @@ function DigitalProductLayout({
|
|
|
15449
15471
|
className
|
|
15450
15472
|
}) {
|
|
15451
15473
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15452
|
-
const currency =
|
|
15474
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15453
15475
|
const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
|
|
15454
15476
|
const isTicket = product.digital_type === "ticket";
|
|
15455
15477
|
const isAccessPass = product.digital_type === "access_grant";
|
|
@@ -15576,15 +15598,15 @@ function BundleProductLayout({
|
|
|
15576
15598
|
className
|
|
15577
15599
|
}) {
|
|
15578
15600
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15579
|
-
const currency =
|
|
15601
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15580
15602
|
const components = product.components || [];
|
|
15581
|
-
const onSale =
|
|
15582
|
-
const discount =
|
|
15603
|
+
const onSale = chunk7PDEX54K_js.isOnSale(product);
|
|
15604
|
+
const discount = chunk7PDEX54K_js.getDiscountPercentage(product);
|
|
15583
15605
|
const baseTotal = components.reduce(
|
|
15584
|
-
(sum, c) => sum +
|
|
15606
|
+
(sum, c) => sum + chunk7PDEX54K_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
15585
15607
|
0
|
|
15586
15608
|
);
|
|
15587
|
-
const bundlePrice =
|
|
15609
|
+
const bundlePrice = chunk7PDEX54K_js.parsePrice(product.default_price);
|
|
15588
15610
|
const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
15589
15611
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
15590
15612
|
renderBreadcrumb?.(product),
|
|
@@ -15660,7 +15682,7 @@ function CompositeProductLayout({
|
|
|
15660
15682
|
className
|
|
15661
15683
|
}) {
|
|
15662
15684
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
15663
|
-
const currency =
|
|
15685
|
+
const currency = chunk7PDEX54K_js.getProductCurrency(product);
|
|
15664
15686
|
const groups = product.groups || [];
|
|
15665
15687
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "composite", className: cn("space-y-8", className), children: [
|
|
15666
15688
|
renderBreadcrumb?.(product),
|
|
@@ -16083,7 +16105,7 @@ function CartDrawer({
|
|
|
16083
16105
|
}) {
|
|
16084
16106
|
const { isOpen, close } = useCartDrawer();
|
|
16085
16107
|
const cart = useCart();
|
|
16086
|
-
const subtotalNum =
|
|
16108
|
+
const subtotalNum = chunk7PDEX54K_js.parsePrice(cart.subtotal);
|
|
16087
16109
|
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
16088
16110
|
React14.useEffect(() => {
|
|
16089
16111
|
if (!isOpen) return;
|
|
@@ -16477,9 +16499,9 @@ function CatalogueCollectionLayout({
|
|
|
16477
16499
|
result = result.filter((p) => p.tags?.includes(activeCategory));
|
|
16478
16500
|
}
|
|
16479
16501
|
if (sortBy === "price-asc") {
|
|
16480
|
-
result = [...result].sort((a, b) =>
|
|
16502
|
+
result = [...result].sort((a, b) => chunk7PDEX54K_js.parsePrice(a.default_price) - chunk7PDEX54K_js.parsePrice(b.default_price));
|
|
16481
16503
|
} else if (sortBy === "price-desc") {
|
|
16482
|
-
result = [...result].sort((a, b) =>
|
|
16504
|
+
result = [...result].sort((a, b) => chunk7PDEX54K_js.parsePrice(b.default_price) - chunk7PDEX54K_js.parsePrice(a.default_price));
|
|
16483
16505
|
} else if (sortBy === "name") {
|
|
16484
16506
|
result = [...result].sort((a, b) => a.name.localeCompare(b.name));
|
|
16485
16507
|
}
|
|
@@ -20008,7 +20030,7 @@ function toneChip(value) {
|
|
|
20008
20030
|
}
|
|
20009
20031
|
}
|
|
20010
20032
|
function money(amount, currency) {
|
|
20011
|
-
return
|
|
20033
|
+
return chunk7PDEX54K_js.formatPrice(chunk7PDEX54K_js.parsePrice(num(amount) ?? 0), text(currency));
|
|
20012
20034
|
}
|
|
20013
20035
|
var CHAT_GENUI_COMPONENTS = {
|
|
20014
20036
|
Stack: ({ node, ctx }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20256,7 +20278,7 @@ function ReplyCardView({
|
|
|
20256
20278
|
card.image_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
|
|
20257
20279
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
20258
20280
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
|
|
20259
|
-
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children:
|
|
20281
|
+
card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunk7PDEX54K_js.formatPrice(chunk7PDEX54K_js.parsePrice(card.price), currency ?? void 0) }),
|
|
20260
20282
|
fire2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
|
|
20261
20283
|
] })
|
|
20262
20284
|
]
|
|
@@ -20353,12 +20375,12 @@ function ChatWidget({
|
|
|
20353
20375
|
setAttachError(null);
|
|
20354
20376
|
if (!isAllowedAttachment(file)) {
|
|
20355
20377
|
setAttachError(
|
|
20356
|
-
new
|
|
20378
|
+
new chunk4BKOKHE3_js.CimplifyError("invalid_attachment", "Only photos and documents can be attached.")
|
|
20357
20379
|
);
|
|
20358
20380
|
return;
|
|
20359
20381
|
}
|
|
20360
20382
|
if (file.size > MAX_ATTACHMENT_BYTES) {
|
|
20361
|
-
setAttachError(new
|
|
20383
|
+
setAttachError(new chunk4BKOKHE3_js.CimplifyError("attachment_too_large", "Files must be under 25MB."));
|
|
20362
20384
|
return;
|
|
20363
20385
|
}
|
|
20364
20386
|
const uploaded = await client.uploads.upload(file);
|
|
@@ -20894,6 +20916,7 @@ function KeepConversation({ client }) {
|
|
|
20894
20916
|
const [dismissed, setDismissed] = React14.useState(readKeepDismissed);
|
|
20895
20917
|
const [contact, setContact] = React14.useState("");
|
|
20896
20918
|
const [code, setCode] = React14.useState("");
|
|
20919
|
+
const [challengeId, setChallengeId] = React14.useState(null);
|
|
20897
20920
|
const [busy, setBusy] = React14.useState(false);
|
|
20898
20921
|
const [verifyError, setVerifyError] = React14.useState(null);
|
|
20899
20922
|
if (dismissed) return null;
|
|
@@ -20906,6 +20929,7 @@ function KeepConversation({ client }) {
|
|
|
20906
20929
|
const result = await client.link.requestOtp({ contact: trimmed, contact_type: contactType });
|
|
20907
20930
|
setBusy(false);
|
|
20908
20931
|
if (result.ok) {
|
|
20932
|
+
setChallengeId(result.value.challenge_id);
|
|
20909
20933
|
setCode("");
|
|
20910
20934
|
setStep("code");
|
|
20911
20935
|
} else {
|
|
@@ -20913,10 +20937,11 @@ function KeepConversation({ client }) {
|
|
|
20913
20937
|
}
|
|
20914
20938
|
};
|
|
20915
20939
|
const verify = async (value) => {
|
|
20916
|
-
if (value.length !== 6 || busy) return;
|
|
20940
|
+
if (value.length !== 6 || busy || challengeId === null) return;
|
|
20917
20941
|
setBusy(true);
|
|
20918
20942
|
setVerifyError(null);
|
|
20919
20943
|
const result = await client.link.verifyOtp({
|
|
20944
|
+
...challengeId === void 0 ? {} : { challenge_id: challengeId },
|
|
20920
20945
|
contact: contact.trim(),
|
|
20921
20946
|
contact_type: contactType,
|
|
20922
20947
|
otp_code: value
|
|
@@ -21291,6 +21316,10 @@ async function genUIFingerprint(manifest) {
|
|
|
21291
21316
|
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
21292
21317
|
}
|
|
21293
21318
|
|
|
21319
|
+
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
21320
|
+
enumerable: true,
|
|
21321
|
+
get: function () { return chunk2P4KXFB6_js.getVariantDisplayName; }
|
|
21322
|
+
});
|
|
21294
21323
|
Object.defineProperty(exports, "messagePreview", {
|
|
21295
21324
|
enumerable: true,
|
|
21296
21325
|
get: function () { return chunkXREIZ56K_js.messagePreview; }
|
|
@@ -21299,10 +21328,6 @@ Object.defineProperty(exports, "splitGenUIContent", {
|
|
|
21299
21328
|
enumerable: true,
|
|
21300
21329
|
get: function () { return chunkXREIZ56K_js.splitGenUIContent; }
|
|
21301
21330
|
});
|
|
21302
|
-
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
21303
|
-
enumerable: true,
|
|
21304
|
-
get: function () { return chunk2P4KXFB6_js.getVariantDisplayName; }
|
|
21305
|
-
});
|
|
21306
21331
|
exports.AccommodationCard = AccommodationCard;
|
|
21307
21332
|
exports.AccountContent = AccountContent;
|
|
21308
21333
|
exports.AccountDashboardPage = AccountDashboardPage;
|