@cimplify/sdk 0.99.2 → 0.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/advanced.d.mts +3 -3
  2. package/dist/advanced.d.ts +3 -3
  3. package/dist/advanced.js +22 -22
  4. package/dist/advanced.mjs +3 -3
  5. package/dist/{chunk-R7FAU2ZF.js → chunk-BHQCSHIG.js} +78 -72
  6. package/dist/{chunk-KFLGQGMC.mjs → chunk-DLW3RWRK.mjs} +35 -15
  7. package/dist/{chunk-QYBGG3ZJ.mjs → chunk-KEC2CX4R.mjs} +2 -2
  8. package/dist/{chunk-FECGCIVV.js → chunk-NH3HYUC3.js} +3 -3
  9. package/dist/{chunk-AETVRBKI.js → chunk-NIOUSKQQ.js} +1 -0
  10. package/dist/{chunk-7TEMLVDT.mjs → chunk-NKZIXLKW.mjs} +1 -1
  11. package/dist/{chunk-J64F56EB.js → chunk-NR4Z2SFY.js} +4 -4
  12. package/dist/{chunk-K5EN2W2Q.mjs → chunk-O3YUHLZL.mjs} +1 -0
  13. package/dist/{chunk-ZFI2TKTO.mjs → chunk-PTKAN4SI.mjs} +25 -15
  14. package/dist/{chunk-4S5EMSF5.js → chunk-QGFKIAEM.js} +48 -38
  15. package/dist/{chunk-DOEGVGTM.mjs → chunk-T2B656RS.mjs} +8 -3
  16. package/dist/{chunk-PTPOQVXS.js → chunk-WMEC5JWN.js} +37 -16
  17. package/dist/{client-CX59ew7C.d.ts → client-B0Lku_lc.d.mts} +17 -16
  18. package/dist/{client-CCCOOaI3.d.ts → client-DRgEa78P.d.ts} +2 -2
  19. package/dist/{client-BNfVL2IL.d.mts → client-DxgC_lXU.d.ts} +17 -16
  20. package/dist/{client-BeMhSkRT.d.mts → client-T5c-Nxq-.d.mts} +2 -2
  21. package/dist/{index-D-w5h82t.d.ts → index-CzKN1hjf.d.ts} +3 -3
  22. package/dist/{index-BuNjyfaV.d.mts → index-DzuLT5wi.d.mts} +3 -3
  23. package/dist/index.d.mts +7 -7
  24. package/dist/index.d.ts +7 -7
  25. package/dist/index.js +117 -117
  26. package/dist/index.mjs +5 -5
  27. package/dist/{payment-pKPpaORI.d.mts → payment-D8NEwCna.d.mts} +2 -2
  28. package/dist/{payment-By0JidTe.d.ts → payment-lZBP7h5M.d.ts} +2 -2
  29. package/dist/{price-BvRtp6ak.d.mts → price-DepWAmcL.d.mts} +1 -1
  30. package/dist/{price-23RNXftz.d.ts → price-ncQb-TC8.d.ts} +1 -1
  31. package/dist/{product-O8-wcHSe.d.ts → product-B384_Qm2.d.mts} +38 -49
  32. package/dist/{product-O8-wcHSe.d.mts → product-B384_Qm2.d.ts} +38 -49
  33. package/dist/react.d.mts +10 -5
  34. package/dist/react.d.ts +10 -5
  35. package/dist/react.js +830 -446
  36. package/dist/react.mjs +711 -327
  37. package/dist/{server-JBuTPY-j.d.ts → server-B7O4ttpv.d.ts} +1 -1
  38. package/dist/{server-HVDbbqR9.d.mts → server-oCGNIO_K.d.mts} +1 -1
  39. package/dist/server.d.mts +4 -4
  40. package/dist/server.d.ts +4 -4
  41. package/dist/server.js +10 -10
  42. package/dist/server.mjs +4 -4
  43. package/dist/testing/msw.d.mts +2 -2
  44. package/dist/testing/msw.d.ts +2 -2
  45. package/dist/testing/msw.js +3 -3
  46. package/dist/testing/msw.mjs +2 -2
  47. package/dist/testing/suite.d.mts +6 -6
  48. package/dist/testing/suite.d.ts +6 -6
  49. package/dist/testing/suite.js +25 -25
  50. package/dist/testing/suite.mjs +6 -6
  51. package/dist/testing.d.mts +5 -5
  52. package/dist/testing.d.ts +5 -5
  53. package/dist/testing.js +81 -81
  54. package/dist/testing.mjs +7 -7
  55. package/dist/utils.d.mts +4 -4
  56. package/dist/utils.d.ts +4 -4
  57. package/dist/utils.js +29 -29
  58. package/dist/utils.mjs +2 -2
  59. package/package.json +1 -1
  60. package/registry/cart-summary.json +1 -1
  61. package/registry/product-customizer.json +1 -1
  62. package/registry/sale-badge.json +1 -1
package/dist/react.js CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  var chunkQPRI2NII_js = require('./chunk-QPRI2NII.js');
5
5
  var chunkXREIZ56K_js = require('./chunk-XREIZ56K.js');
6
- var chunkR7FAU2ZF_js = require('./chunk-R7FAU2ZF.js');
7
- var chunk4S5EMSF5_js = require('./chunk-4S5EMSF5.js');
8
- var chunkPTPOQVXS_js = require('./chunk-PTPOQVXS.js');
9
- var chunkAETVRBKI_js = require('./chunk-AETVRBKI.js');
6
+ var chunkBHQCSHIG_js = require('./chunk-BHQCSHIG.js');
7
+ var chunkQGFKIAEM_js = require('./chunk-QGFKIAEM.js');
8
+ var chunkWMEC5JWN_js = require('./chunk-WMEC5JWN.js');
9
+ var chunkNIOUSKQQ_js = require('./chunk-NIOUSKQQ.js');
10
10
  require('./chunk-OWW5GUSB.js');
11
11
  var React14 = require('react');
12
12
  var jsxRuntime = require('react/jsx-runtime');
@@ -598,16 +598,26 @@ function lineKeyFromItem(item) {
598
598
  staffId: item.staffId
599
599
  });
600
600
  }
601
- function attachInternalItemMetadata(item) {
602
- return { ...item, _lineKey: lineKeyFromItem(item) };
601
+ function attachInternalItemMetadata(item, metadata = {}) {
602
+ const internalItem = {
603
+ ...item,
604
+ _lineKey: lineKeyFromItem(item)
605
+ };
606
+ if (metadata.quotedUnitPrice !== void 0) {
607
+ internalItem._quotedUnitPrice = metadata.quotedUnitPrice;
608
+ }
609
+ return internalItem;
603
610
  }
604
611
  function calculateLineSubtotal(item) {
605
- let unitPrice = chunkPTPOQVXS_js.parsePrice(item.product.default_price);
612
+ if (item._quotedUnitPrice !== void 0) {
613
+ return roundMoney(chunkWMEC5JWN_js.parsePrice(item._quotedUnitPrice) * item.quantity);
614
+ }
615
+ let unitPrice = chunkWMEC5JWN_js.parsePrice(item.product.default_price);
606
616
  if (item.variant?.price_adjustment) {
607
- unitPrice += chunkPTPOQVXS_js.parsePrice(item.variant.price_adjustment);
617
+ unitPrice += chunkWMEC5JWN_js.parsePrice(item.variant.price_adjustment);
608
618
  }
609
619
  for (const option of item.addOnOptions || []) {
610
- if (option.default_price) unitPrice += chunkPTPOQVXS_js.parsePrice(option.default_price);
620
+ if (option.default_price) unitPrice += chunkWMEC5JWN_js.parsePrice(option.default_price);
611
621
  }
612
622
  return roundMoney(unitPrice * item.quantity);
613
623
  }
@@ -677,10 +687,7 @@ function emptyBase(currency, isLoading = true) {
677
687
  return { items: [], subtotal: 0, tax: 0, total: 0, currency, isLoading };
678
688
  }
679
689
  function buildStoreKey(client, locationId) {
680
- return [
681
- client.getPublicKey() || "__no_public_key__",
682
- locationId || "__no_location__"
683
- ].join(":");
690
+ return [client.getPublicKey() || "__no_public_key__", locationId || "__no_location__"].join(":");
684
691
  }
685
692
  function purgeLegacyCartCachesOnce() {
686
693
  if (legacyCachesPurged) return;
@@ -709,7 +716,10 @@ function toProductFromServerItem(item, businessId) {
709
716
  slug: item.item_id,
710
717
  description: item.description,
711
718
  image_url: item.image_url,
712
- default_price: item.base_price,
719
+ // Cart price_info is the accepted item price path. Do not reconstruct it
720
+ // from the catalogue base after a sale or shopper-specific quote.
721
+ default_price: item.price_info.final_price,
722
+ currency: item.price_info.currency,
713
723
  type: "product",
714
724
  inventory_type: "none",
715
725
  variant_strategy: "fetch_all",
@@ -724,37 +734,44 @@ function mapServerCart(serverCart, fallbackCurrency) {
724
734
  const variant = item.variant_info || item.variant_name ? {
725
735
  id: item.variant_info?.id || item.variant_id || "",
726
736
  name: item.variant_info?.name || item.variant_name || "Variant",
727
- price_adjustment: item.variant_info?.price_adjustment
737
+ price_adjustment: item.variant_info?.price_adjustment,
738
+ price_info: item.price_info
728
739
  } : void 0;
729
740
  const quoteId = typeof item.metadata?.quote_id === "string" ? item.metadata.quote_id : void 0;
730
- return attachInternalItemMetadata({
731
- id: item.id,
732
- product: toProductFromServerItem(item, serverCart.business_id),
733
- quantity: clampQuantity(item.quantity),
734
- locationId: serverCart.location_id,
735
- variantId: item.variant_id,
736
- variant,
737
- quoteId,
738
- addOnOptionIds: normalizeOptionIds(item.add_on_option_ids || void 0),
739
- addOnOptions: (item.add_on_options || []).map((option) => ({
740
- id: option.id,
741
- name: option.name,
742
- default_price: option.price
743
- })),
744
- bundleSelections: item.bundle_selections || void 0,
745
- compositeSelections: item.composite_selections || void 0,
746
- specialInstructions: item.special_instructions,
747
- scheduledStart: item.scheduled_start || void 0,
748
- scheduledEnd: item.scheduled_end || void 0,
749
- staffId: item.staff_id || void 0,
750
- units: item.units || void 0,
751
- lineType: item.line_type,
752
- confirmationCode: item.confirmation_code || void 0,
753
- serviceStatus: item.service_status || void 0,
754
- bundleResolved: item.bundle_resolved || void 0,
755
- compositeResolved: item.composite_resolved || void 0,
756
- customerInputs: item.customer_inputs || void 0
757
- });
741
+ return attachInternalItemMetadata(
742
+ {
743
+ id: item.id,
744
+ product: toProductFromServerItem(item, serverCart.business_id),
745
+ quantity: clampQuantity(item.quantity),
746
+ locationId: serverCart.location_id,
747
+ variantId: item.variant_id,
748
+ variant,
749
+ quoteId,
750
+ addOnOptionIds: normalizeOptionIds(item.add_on_option_ids || void 0),
751
+ addOnOptions: (item.add_on_options || []).map((option) => ({
752
+ id: option.id,
753
+ name: option.name,
754
+ default_price: option.price
755
+ })),
756
+ bundleSelections: item.bundle_selections || void 0,
757
+ compositeSelections: item.composite_selections || void 0,
758
+ specialInstructions: item.special_instructions,
759
+ scheduledStart: item.scheduled_start || void 0,
760
+ scheduledEnd: item.scheduled_end || void 0,
761
+ staffId: item.staff_id || void 0,
762
+ units: item.units || void 0,
763
+ lineType: item.line_type,
764
+ confirmationCode: item.confirmation_code || void 0,
765
+ serviceStatus: item.service_status || void 0,
766
+ bundleResolved: item.bundle_resolved || void 0,
767
+ compositeResolved: item.composite_resolved || void 0,
768
+ customerInputs: item.customer_inputs || void 0
769
+ },
770
+ // CartItemDetails.total_price is the accepted configured unit amount,
771
+ // including add-ons. It is the only safe basis for optimistic quantity
772
+ // changes and line rendering after the server replaces the temp item.
773
+ { quotedUnitPrice: item.total_price }
774
+ );
758
775
  });
759
776
  return {
760
777
  items,
@@ -806,7 +823,7 @@ async function syncFromServer(entry) {
806
823
  return next;
807
824
  }
808
825
  function emitMutationError(entry, operation, opId, idempotencyKey, error) {
809
- entry.client.events.emit(chunkR7FAU2ZF_js.MUTATION_ERROR, {
826
+ entry.client.events.emit(chunkBHQCSHIG_js.MUTATION_ERROR, {
810
827
  service: "cart",
811
828
  operation,
812
829
  opId,
@@ -846,10 +863,10 @@ function getOrCreateStore(params) {
846
863
  syncTail: Promise.resolve(),
847
864
  failedOpRemovers: /* @__PURE__ */ new Set()
848
865
  };
849
- client.events.on(chunkR7FAU2ZF_js.SESSION_CLAIMED, () => {
866
+ client.events.on(chunkBHQCSHIG_js.SESSION_CLAIMED, () => {
850
867
  if (entry.initialized) void syncFromServer(entry);
851
868
  });
852
- client.events.on(chunkR7FAU2ZF_js.SESSION_CLEARED, () => {
869
+ client.events.on(chunkBHQCSHIG_js.SESSION_CLEARED, () => {
853
870
  if (entry.initialized) void syncFromServer(entry);
854
871
  });
855
872
  cartStores.set(storeKey, entry);
@@ -895,24 +912,27 @@ async function performAddItem(entry, product, quantity, options) {
895
912
  addOnOptionIds: normalizeOptionIds(options.addOnOptionIds)
896
913
  };
897
914
  const lineKey = buildLineKey(product.id, normalizedOptions);
898
- const tempItem = attachInternalItemMetadata({
899
- id: `tmp_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
900
- product,
901
- quantity: resolvedQuantity,
902
- locationId: normalizedOptions.locationId,
903
- variantId: normalizedOptions.variantId,
904
- variant: normalizedOptions.variant,
905
- quoteId: normalizedOptions.quoteId,
906
- addOnOptionIds: normalizedOptions.addOnOptionIds,
907
- addOnOptions: normalizedOptions.addOnOptions,
908
- bundleSelections: normalizedOptions.bundleSelections,
909
- compositeSelections: normalizedOptions.compositeSelections,
910
- specialInstructions: normalizedOptions.specialInstructions,
911
- scheduledStart: normalizedOptions.scheduledStart,
912
- scheduledEnd: normalizedOptions.scheduledEnd,
913
- staffId: normalizedOptions.staffId,
914
- units: normalizedOptions.units
915
- });
915
+ const tempItem = attachInternalItemMetadata(
916
+ {
917
+ id: `tmp_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`,
918
+ product,
919
+ quantity: resolvedQuantity,
920
+ locationId: normalizedOptions.locationId,
921
+ variantId: normalizedOptions.variantId,
922
+ variant: normalizedOptions.variant,
923
+ quoteId: normalizedOptions.quoteId,
924
+ addOnOptionIds: normalizedOptions.addOnOptionIds,
925
+ addOnOptions: normalizedOptions.addOnOptions,
926
+ bundleSelections: normalizedOptions.bundleSelections,
927
+ compositeSelections: normalizedOptions.compositeSelections,
928
+ specialInstructions: normalizedOptions.specialInstructions,
929
+ scheduledStart: normalizedOptions.scheduledStart,
930
+ scheduledEnd: normalizedOptions.scheduledEnd,
931
+ staffId: normalizedOptions.staffId,
932
+ units: normalizedOptions.units
933
+ },
934
+ { quotedUnitPrice: normalizedOptions.quotedUnitPrice }
935
+ );
916
936
  const idempotencyKey = `idem_${typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}_${Math.random().toString(36).slice(2, 10)}`}`;
917
937
  const patch = { kind: "add_item", tempItem, lineKey };
918
938
  const useOptimistic = entry.optimisticEnabled;
@@ -1022,12 +1042,12 @@ async function performReorder(entry, orderId) {
1022
1042
  return result.value;
1023
1043
  }
1024
1044
  function useCart(options = {}) {
1025
- const context = useOptionalCimplifyClient();
1045
+ const context = useOptionalCimplify();
1026
1046
  const client = options.client ?? context?.client;
1027
1047
  if (!client) {
1028
1048
  throw new Error("useCart must be used within CimplifyProvider or passed { client }.");
1029
1049
  }
1030
- const locationId = options.locationId ?? client.getLocationId();
1050
+ const locationId = options.locationId ?? (context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId());
1031
1051
  const currency = options.currency ?? context?.currency ?? "USD";
1032
1052
  const optimisticEnabled = context?.optimistic ?? true;
1033
1053
  const entry = React14.useMemo(
@@ -1040,6 +1060,11 @@ function useCart(options = {}) {
1040
1060
  [client, currency, locationId, optimisticEnabled]
1041
1061
  );
1042
1062
  const view = useCollectionStore(entry.collection);
1063
+ React14.useEffect(() => {
1064
+ if (client.getLocationId() !== locationId) {
1065
+ client.setLocationId(locationId);
1066
+ }
1067
+ }, [client, locationId]);
1043
1068
  React14.useEffect(() => {
1044
1069
  void ensureInitialized(entry);
1045
1070
  }, [entry]);
@@ -1145,7 +1170,7 @@ var DEFAULT_COUNTRY = "US";
1145
1170
  function createDefaultClient() {
1146
1171
  const processRef = globalThis.process;
1147
1172
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1148
- return chunkR7FAU2ZF_js.createCimplifyClient({ publicKey: envPublicKey });
1173
+ return chunkBHQCSHIG_js.createCimplifyClient({ publicKey: envPublicKey });
1149
1174
  }
1150
1175
  function getStoredLocationId() {
1151
1176
  if (typeof window === "undefined" || !window.localStorage) {
@@ -1249,7 +1274,7 @@ function CimplifyProvider({
1249
1274
  const setDisplayCurrency = React14.useCallback(
1250
1275
  (currency) => {
1251
1276
  const normalized = currency?.trim().toUpperCase() || null;
1252
- if (normalized && !chunkAETVRBKI_js.isSupportedCurrency(normalized)) {
1277
+ if (normalized && !chunkNIOUSKQQ_js.isSupportedCurrency(normalized)) {
1253
1278
  return;
1254
1279
  }
1255
1280
  setDisplayCurrencyOverride(normalized);
@@ -3193,19 +3218,19 @@ function toAccountLineItem(item, currency) {
3193
3218
  quantity: s.quantity,
3194
3219
  name: s.product_name,
3195
3220
  variantName: s.variant_name,
3196
- priceLabel: chunkPTPOQVXS_js.parsePrice(s.unit_price) > 0 ? chunkPTPOQVXS_js.formatMoney(s.unit_price, currency) : void 0
3221
+ priceLabel: chunkWMEC5JWN_js.parsePrice(s.unit_price) > 0 ? chunkWMEC5JWN_js.formatMoney(s.unit_price, currency) : void 0
3197
3222
  }));
3198
3223
  const customisations = item.composite_selections?.selections.map((s) => ({
3199
3224
  quantity: s.quantity,
3200
3225
  name: s.component_name,
3201
- priceLabel: chunkPTPOQVXS_js.parsePrice(s.unit_price) > 0 ? `+${chunkPTPOQVXS_js.formatMoney(s.unit_price, currency)}` : void 0
3226
+ priceLabel: chunkWMEC5JWN_js.parsePrice(s.unit_price) > 0 ? `+${chunkWMEC5JWN_js.formatMoney(s.unit_price, currency)}` : void 0
3202
3227
  }));
3203
3228
  const data = {
3204
3229
  id: item.id,
3205
3230
  name: item.product_name ?? "Item",
3206
3231
  imageUrl: item.image_url,
3207
3232
  subtitle: lineSubtitle(item),
3208
- priceLabel: chunkPTPOQVXS_js.formatMoney(item.total_price, currency),
3233
+ priceLabel: chunkWMEC5JWN_js.formatMoney(item.total_price, currency),
3209
3234
  lineType: item.line_type,
3210
3235
  includes,
3211
3236
  customisations,
@@ -3255,20 +3280,20 @@ var PAYMENT_TONE = {
3255
3280
  function toAccountOrderView(order, opts = {}) {
3256
3281
  const currency = order.payment.currency;
3257
3282
  const rows = [
3258
- { label: "Subtotal", value: chunkPTPOQVXS_js.formatMoney(order.pricing.subtotal, currency) }
3283
+ { label: "Subtotal", value: chunkWMEC5JWN_js.formatMoney(order.pricing.subtotal, currency) }
3259
3284
  ];
3260
- if (chunkPTPOQVXS_js.parsePrice(order.pricing.total_discount) > 0) {
3285
+ if (chunkWMEC5JWN_js.parsePrice(order.pricing.total_discount) > 0) {
3261
3286
  rows.push({
3262
3287
  label: "Discount",
3263
- value: `\u2212${chunkPTPOQVXS_js.formatMoney(order.pricing.total_discount, currency)}`,
3288
+ value: `\u2212${chunkWMEC5JWN_js.formatMoney(order.pricing.total_discount, currency)}`,
3264
3289
  tone: "positive"
3265
3290
  });
3266
3291
  }
3267
- if (order.pricing.tax && chunkPTPOQVXS_js.parsePrice(order.pricing.tax) > 0) {
3268
- rows.push({ label: "Tax", value: chunkPTPOQVXS_js.formatMoney(order.pricing.tax, currency) });
3292
+ if (order.pricing.tax && chunkWMEC5JWN_js.parsePrice(order.pricing.tax) > 0) {
3293
+ rows.push({ label: "Tax", value: chunkWMEC5JWN_js.formatMoney(order.pricing.tax, currency) });
3269
3294
  }
3270
- if (order.pricing.service_charge && chunkPTPOQVXS_js.parsePrice(order.pricing.service_charge) > 0) {
3271
- rows.push({ label: "Service", value: chunkPTPOQVXS_js.formatMoney(order.pricing.service_charge, currency) });
3295
+ if (order.pricing.service_charge && chunkWMEC5JWN_js.parsePrice(order.pricing.service_charge) > 0) {
3296
+ rows.push({ label: "Service", value: chunkWMEC5JWN_js.formatMoney(order.pricing.service_charge, currency) });
3272
3297
  }
3273
3298
  const placed = fmtDateTime(order.timestamps.created_at);
3274
3299
  const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
@@ -3282,7 +3307,7 @@ function toAccountOrderView(order, opts = {}) {
3282
3307
  stateLabel: cap(order.payment.computed_status ?? order.payment.state),
3283
3308
  stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
3284
3309
  rows,
3285
- total: { label: "Total", value: chunkPTPOQVXS_js.formatMoney(order.pricing.total_price, currency) }
3310
+ total: { label: "Total", value: chunkWMEC5JWN_js.formatMoney(order.pricing.total_price, currency) }
3286
3311
  },
3287
3312
  shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
3288
3313
  onBack: opts.onBack
@@ -3457,7 +3482,7 @@ function CimplifySignInButton({
3457
3482
  const onClick = async () => {
3458
3483
  if (busy || disabled || !signInOpts.clientId) return;
3459
3484
  setBusy(true);
3460
- await chunk4S5EMSF5_js.startSignIn({
3485
+ await chunkQGFKIAEM_js.startSignIn({
3461
3486
  ...signInOpts,
3462
3487
  onSuccess: () => {
3463
3488
  setBusy(false);
@@ -4312,7 +4337,7 @@ function Price({
4312
4337
  const resolvedAmount = fxActive ? context.convertPrice(amount) : typeof amount === "string" ? parseFloat(amount) || 0 : amount;
4313
4338
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
4314
4339
  prefix,
4315
- chunkPTPOQVXS_js.formatPrice(resolvedAmount, resolvedCurrency)
4340
+ chunkWMEC5JWN_js.formatPrice(resolvedAmount, resolvedCurrency)
4316
4341
  ] });
4317
4342
  }
4318
4343
  function createCachedQuery(config) {
@@ -4899,19 +4924,53 @@ function useSearch(options = {}) {
4899
4924
  }
4900
4925
  var quoteCache = /* @__PURE__ */ new Map();
4901
4926
  var quoteInflight = /* @__PURE__ */ new Map();
4902
- function buildQuoteCacheKey(client, locationId, inputSignature) {
4903
- return [client.getPublicKey(), locationId ?? "", inputSignature].join("|");
4927
+ var quoteClientNamespaces = /* @__PURE__ */ new WeakMap();
4928
+ var nextQuoteClientNamespace = 0;
4929
+ var QUOTE_LOAD_DEBOUNCE_MS = 150;
4930
+ var MIN_AUTO_REFRESH_DELAY_MS = 1e3;
4931
+ function getQuoteClientNamespace(client) {
4932
+ const existing = quoteClientNamespaces.get(client);
4933
+ if (existing !== void 0) {
4934
+ return existing;
4935
+ }
4936
+ const namespace = nextQuoteClientNamespace++;
4937
+ quoteClientNamespaces.set(client, namespace);
4938
+ return namespace;
4939
+ }
4940
+ function buildQuoteCacheKey(client, sessionEpoch, locationId, inputSignature) {
4941
+ return JSON.stringify([
4942
+ getQuoteClientNamespace(client),
4943
+ client.getPublicKey(),
4944
+ sessionEpoch,
4945
+ locationId ?? "",
4946
+ inputSignature
4947
+ ]);
4948
+ }
4949
+ function useClientSessionEpoch(client) {
4950
+ const subscribe = React14.useCallback(
4951
+ (notify) => {
4952
+ const unsubscribe = [
4953
+ client.events.on(chunkBHQCSHIG_js.AUTH_TOKEN_CHANGED, notify),
4954
+ client.events.on(chunkBHQCSHIG_js.SESSION_CLAIMED, notify),
4955
+ client.events.on(chunkBHQCSHIG_js.SESSION_CLEARED, notify)
4956
+ ];
4957
+ return () => {
4958
+ for (const stopListening of unsubscribe) {
4959
+ stopListening();
4960
+ }
4961
+ };
4962
+ },
4963
+ [client]
4964
+ );
4965
+ const getSnapshot = React14.useCallback(() => client.getSessionEpoch(), [client]);
4966
+ return React14.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
4904
4967
  }
4905
4968
  function serializeQuoteBundleSelections(selections) {
4906
4969
  if (!selections || selections.length === 0) {
4907
4970
  return "";
4908
4971
  }
4909
4972
  return selections.map((selection) => {
4910
- return [
4911
- selection.component_id,
4912
- selection.quantity,
4913
- selection.variant_id ?? ""
4914
- ].join(":");
4973
+ return [selection.component_id, selection.quantity, selection.variant_id ?? ""].join(":");
4915
4974
  }).join(";");
4916
4975
  }
4917
4976
  function serializeQuoteCompositeSelections(selections) {
@@ -4941,15 +5000,37 @@ function buildQuoteInputSignature(input) {
4941
5000
  serializeQuoteCompositeSelections(input.compositeSelections)
4942
5001
  ].join("|");
4943
5002
  }
4944
- function isQuoteExpired(quote) {
5003
+ function quoteExpiryTimestamp(quote) {
4945
5004
  if (!quote?.expires_at) {
4946
- return false;
5005
+ return Number.NaN;
4947
5006
  }
4948
5007
  const expiresAt = Date.parse(quote.expires_at);
4949
- if (!Number.isFinite(expiresAt)) {
4950
- return false;
5008
+ return Number.isFinite(expiresAt) ? expiresAt : Number.NaN;
5009
+ }
5010
+ function isQuoteExpired(quote, now = Date.now()) {
5011
+ const expiresAt = quoteExpiryTimestamp(quote);
5012
+ return Number.isFinite(expiresAt) && expiresAt <= now;
5013
+ }
5014
+ function readUsableCachedQuote(cacheKey2) {
5015
+ const entry = quoteCache.get(cacheKey2);
5016
+ if (!entry) {
5017
+ return null;
4951
5018
  }
4952
- return expiresAt <= Date.now();
5019
+ if (isQuoteExpired(entry.quote)) {
5020
+ quoteCache.delete(cacheKey2);
5021
+ return null;
5022
+ }
5023
+ return entry.quote;
5024
+ }
5025
+ function requestState(cacheKey2, quote, isLoading) {
5026
+ return {
5027
+ cacheKey: cacheKey2,
5028
+ quote,
5029
+ isLoading,
5030
+ error: null,
5031
+ isExpired: false,
5032
+ messages: quote?.ui_messages ?? []
5033
+ };
4953
5034
  }
4954
5035
  function normalizeInput(input, fallbackLocationId) {
4955
5036
  const productId = input.productId.trim();
@@ -4966,7 +5047,7 @@ function normalizeInput(input, fallbackLocationId) {
4966
5047
  };
4967
5048
  }
4968
5049
  function useQuote(input, options = {}) {
4969
- const context = useOptionalCimplifyClient();
5050
+ const context = useOptionalCimplify();
4970
5051
  const client = options.client ?? context?.client;
4971
5052
  if (!client) {
4972
5053
  throw new Error("useQuote must be used within CimplifyProvider or passed { client }.");
@@ -4974,59 +5055,58 @@ function useQuote(input, options = {}) {
4974
5055
  const enabled = options.enabled ?? true;
4975
5056
  const autoRefresh = options.autoRefresh ?? true;
4976
5057
  const refreshBeforeExpiryMs = Math.max(0, options.refreshBeforeExpiryMs ?? 3e4);
4977
- const locationId = client.getLocationId();
5058
+ const sessionEpoch = useClientSessionEpoch(client);
5059
+ const fallbackLocationId = context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId();
4978
5060
  const requestIdRef = React14.useRef(0);
4979
- const debounceTimerRef = React14.useRef(null);
4980
5061
  const inputSignature = buildQuoteInputSignature(input);
4981
5062
  const normalizedInput = React14.useMemo(() => {
4982
5063
  if (!input) {
4983
5064
  return null;
4984
5065
  }
4985
- const normalized = normalizeInput(input, locationId);
5066
+ const normalized = normalizeInput(input, fallbackLocationId);
4986
5067
  return normalized.product_id.length > 0 ? normalized : null;
4987
- }, [inputSignature, locationId]);
5068
+ }, [inputSignature, fallbackLocationId]);
4988
5069
  const cacheKey2 = React14.useMemo(
4989
- () => buildQuoteCacheKey(client, locationId, inputSignature),
4990
- [client, inputSignature, locationId]
5070
+ () => buildQuoteCacheKey(
5071
+ client,
5072
+ sessionEpoch,
5073
+ normalizedInput?.location_id ?? null,
5074
+ inputSignature
5075
+ ),
5076
+ [client, inputSignature, normalizedInput?.location_id, sessionEpoch]
4991
5077
  );
4992
- const cached = quoteCache.get(cacheKey2);
4993
- const [quote, setQuote] = React14.useState(cached?.quote ?? null);
4994
- const [isLoading, setIsLoading] = React14.useState(enabled && normalizedInput !== null && !cached);
4995
- const [error, setError] = React14.useState(null);
4996
- const [isExpired, setIsExpired] = React14.useState(isQuoteExpired(cached?.quote ?? null));
4997
- const [messages, setMessages] = React14.useState(cached?.quote?.ui_messages ?? []);
4998
- const quoteExpiryTimestamp = React14.useMemo(() => {
4999
- if (!quote?.expires_at) {
5000
- return Number.NaN;
5001
- }
5002
- const expiresAt = Date.parse(quote.expires_at);
5003
- return Number.isFinite(expiresAt) ? expiresAt : Number.NaN;
5004
- }, [quote?.expires_at]);
5078
+ const [state, setState] = React14.useState(() => {
5079
+ const cached = enabled && normalizedInput ? readUsableCachedQuote(cacheKey2) : null;
5080
+ return requestState(cacheKey2, cached, enabled && normalizedInput !== null && !cached);
5081
+ });
5082
+ const stateIsCurrent = state.cacheKey === cacheKey2 && enabled && normalizedInput !== null;
5083
+ const activeQuote = stateIsCurrent ? state.quote : null;
5084
+ const activeQuoteExpired = isQuoteExpired(activeQuote);
5085
+ const quote = activeQuoteExpired ? null : activeQuote;
5086
+ const isLoading = enabled && normalizedInput !== null && (!stateIsCurrent || state.isLoading);
5087
+ const error = stateIsCurrent ? state.error : null;
5088
+ const isExpired = stateIsCurrent ? state.isExpired || activeQuoteExpired : false;
5089
+ const messages = stateIsCurrent ? state.messages : [];
5090
+ const expiresAt = quoteExpiryTimestamp(activeQuote);
5005
5091
  const load = React14.useCallback(
5006
5092
  async (force = false) => {
5007
5093
  if (!enabled || !normalizedInput) {
5008
- setQuote(null);
5009
- setMessages([]);
5010
- setIsExpired(false);
5011
- setError(null);
5012
- setIsLoading(false);
5094
+ requestIdRef.current += 1;
5095
+ setState(requestState(cacheKey2, null, false));
5013
5096
  return;
5014
5097
  }
5015
5098
  const nextRequestId = ++requestIdRef.current;
5016
- setError(null);
5017
5099
  if (!force) {
5018
- const cacheEntry = quoteCache.get(cacheKey2);
5019
- if (cacheEntry) {
5020
- setQuote(cacheEntry.quote);
5021
- setMessages(cacheEntry.quote?.ui_messages ?? []);
5022
- setIsExpired(isQuoteExpired(cacheEntry.quote));
5023
- setIsLoading(false);
5100
+ const cachedQuote = readUsableCachedQuote(cacheKey2);
5101
+ if (cachedQuote) {
5102
+ setState(requestState(cacheKey2, cachedQuote, false));
5024
5103
  return;
5025
5104
  }
5026
5105
  }
5027
- setIsLoading(true);
5028
- setQuote(null);
5029
- setMessages([]);
5106
+ setState((current) => ({
5107
+ ...requestState(cacheKey2, null, true),
5108
+ isExpired: current.cacheKey === cacheKey2 && current.isExpired
5109
+ }));
5030
5110
  try {
5031
5111
  const existing = quoteInflight.get(cacheKey2);
5032
5112
  const promise = existing ?? (async () => {
@@ -5043,55 +5123,58 @@ function useQuote(input, options = {}) {
5043
5123
  }).catch(() => void 0);
5044
5124
  }
5045
5125
  const value = await promise;
5046
- quoteCache.set(cacheKey2, { quote: value });
5047
- if (nextRequestId === requestIdRef.current) {
5048
- setQuote(value);
5049
- setMessages(value.ui_messages ?? []);
5050
- setIsExpired(isQuoteExpired(value));
5051
- setError(null);
5126
+ const expired = isQuoteExpired(value);
5127
+ if (expired) {
5128
+ quoteCache.delete(cacheKey2);
5129
+ } else {
5130
+ quoteCache.set(cacheKey2, { quote: value });
5052
5131
  }
5053
- } catch (loadError) {
5054
5132
  if (nextRequestId === requestIdRef.current) {
5055
- setError(loadError);
5133
+ setState({
5134
+ ...requestState(cacheKey2, expired ? null : value, false),
5135
+ isExpired: expired
5136
+ });
5056
5137
  }
5057
- } finally {
5138
+ } catch (loadError) {
5058
5139
  if (nextRequestId === requestIdRef.current) {
5059
- setIsLoading(false);
5140
+ setState((current) => ({
5141
+ ...requestState(cacheKey2, null, false),
5142
+ error: loadError,
5143
+ isExpired: current.cacheKey === cacheKey2 && current.isExpired
5144
+ }));
5060
5145
  }
5061
5146
  }
5062
5147
  },
5063
5148
  [cacheKey2, client, enabled, normalizedInput]
5064
5149
  );
5065
5150
  React14.useEffect(() => {
5066
- if (debounceTimerRef.current) {
5067
- clearTimeout(debounceTimerRef.current);
5068
- }
5069
- const hasCached = quoteCache.has(cacheKey2);
5070
- if (hasCached || !enabled || !normalizedInput) {
5151
+ if (!enabled || !normalizedInput || readUsableCachedQuote(cacheKey2)) {
5071
5152
  void load(false);
5072
- } else {
5073
- debounceTimerRef.current = setTimeout(() => {
5074
- void load(false);
5075
- }, 150);
5153
+ return;
5076
5154
  }
5155
+ const timer = setTimeout(() => {
5156
+ void load(false);
5157
+ }, QUOTE_LOAD_DEBOUNCE_MS);
5077
5158
  return () => {
5078
- if (debounceTimerRef.current) {
5079
- clearTimeout(debounceTimerRef.current);
5080
- debounceTimerRef.current = null;
5081
- }
5159
+ clearTimeout(timer);
5082
5160
  };
5083
5161
  }, [load, cacheKey2, enabled, normalizedInput]);
5084
5162
  const refresh = React14.useCallback(async () => {
5085
5163
  if (!enabled || !normalizedInput) {
5086
5164
  return;
5087
5165
  }
5088
- if (!quote?.quote_id) {
5166
+ if (!quote?.quote_id || isQuoteExpired(quote)) {
5167
+ quoteCache.delete(cacheKey2);
5089
5168
  await load(true);
5090
5169
  return;
5091
5170
  }
5092
5171
  const nextRequestId = ++requestIdRef.current;
5093
- setError(null);
5094
- setIsLoading(true);
5172
+ setState((current) => ({
5173
+ ...current,
5174
+ cacheKey: cacheKey2,
5175
+ isLoading: true,
5176
+ error: null
5177
+ }));
5095
5178
  try {
5096
5179
  const result = await client.catalogue.refreshQuote({
5097
5180
  quote_id: quote.quote_id,
@@ -5101,52 +5184,67 @@ function useQuote(input, options = {}) {
5101
5184
  throw result.error;
5102
5185
  }
5103
5186
  const refreshed = result.value.quote;
5104
- quoteCache.set(cacheKey2, { quote: refreshed });
5105
- if (nextRequestId === requestIdRef.current) {
5106
- setQuote(refreshed);
5107
- setMessages(refreshed.ui_messages ?? []);
5108
- setIsExpired(isQuoteExpired(refreshed));
5109
- setError(null);
5187
+ const expired = isQuoteExpired(refreshed);
5188
+ if (expired) {
5189
+ quoteCache.delete(cacheKey2);
5190
+ } else {
5191
+ quoteCache.set(cacheKey2, { quote: refreshed });
5110
5192
  }
5111
- } catch (refreshError) {
5112
5193
  if (nextRequestId === requestIdRef.current) {
5113
- setError(refreshError);
5194
+ setState({
5195
+ ...requestState(cacheKey2, expired ? null : refreshed, false),
5196
+ isExpired: expired
5197
+ });
5114
5198
  }
5115
- } finally {
5199
+ } catch (refreshError) {
5116
5200
  if (nextRequestId === requestIdRef.current) {
5117
- setIsLoading(false);
5201
+ setState((current) => ({
5202
+ ...current,
5203
+ cacheKey: cacheKey2,
5204
+ isLoading: false,
5205
+ error: refreshError
5206
+ }));
5118
5207
  }
5119
5208
  }
5120
5209
  }, [cacheKey2, client, enabled, load, normalizedInput, quote]);
5121
5210
  React14.useEffect(() => {
5122
- if (!Number.isFinite(quoteExpiryTimestamp)) {
5123
- setIsExpired(false);
5211
+ if (!activeQuote || !Number.isFinite(expiresAt)) {
5124
5212
  return;
5125
5213
  }
5126
- const now = Date.now();
5127
- const isCurrentlyExpired = quoteExpiryTimestamp <= now;
5128
- const timers = [];
5129
- setIsExpired(isCurrentlyExpired);
5130
- if (!isCurrentlyExpired) {
5131
- timers.push(
5132
- setTimeout(() => {
5133
- setIsExpired(true);
5134
- }, Math.max(0, quoteExpiryTimestamp - now))
5135
- );
5136
- }
5137
- if (autoRefresh && enabled && !isCurrentlyExpired) {
5138
- timers.push(
5139
- setTimeout(() => {
5140
- void refresh();
5141
- }, Math.max(0, quoteExpiryTimestamp - now - refreshBeforeExpiryMs))
5142
- );
5214
+ const remainingMs = expiresAt - Date.now();
5215
+ if (remainingMs <= 0) {
5216
+ quoteCache.delete(cacheKey2);
5217
+ void load(true);
5218
+ return;
5143
5219
  }
5220
+ const expiryTimer = setTimeout(() => {
5221
+ quoteCache.delete(cacheKey2);
5222
+ setState({
5223
+ ...requestState(cacheKey2, null, true),
5224
+ isExpired: true
5225
+ });
5226
+ void load(true);
5227
+ }, remainingMs);
5228
+ const refreshDelayMs = remainingMs - refreshBeforeExpiryMs;
5229
+ const refreshTimer = autoRefresh && enabled && refreshDelayMs >= MIN_AUTO_REFRESH_DELAY_MS ? setTimeout(() => {
5230
+ void refresh();
5231
+ }, refreshDelayMs) : null;
5144
5232
  return () => {
5145
- for (const timer of timers) {
5146
- clearTimeout(timer);
5233
+ clearTimeout(expiryTimer);
5234
+ if (refreshTimer) {
5235
+ clearTimeout(refreshTimer);
5147
5236
  }
5148
5237
  };
5149
- }, [autoRefresh, enabled, quoteExpiryTimestamp, refresh, refreshBeforeExpiryMs]);
5238
+ }, [
5239
+ activeQuote,
5240
+ autoRefresh,
5241
+ cacheKey2,
5242
+ enabled,
5243
+ expiresAt,
5244
+ load,
5245
+ refresh,
5246
+ refreshBeforeExpiryMs
5247
+ ]);
5150
5248
  return { quote, isLoading, error, refresh, isExpired, messages };
5151
5249
  }
5152
5250
 
@@ -5335,29 +5433,19 @@ function useBundles(options = {}) {
5335
5433
  return { bundles: data ?? [], isLoading, error, refetch };
5336
5434
  }
5337
5435
  function useProductPrice(input) {
5338
- const {
5339
- product,
5340
- quantity = 1,
5341
- variant,
5342
- addOnOptions,
5343
- compositePrice,
5344
- bundleTotalPrice
5345
- } = input;
5436
+ const { product, quantity = 1, variant, addOnOptions, compositePrice, bundleTotalPrice } = input;
5346
5437
  return React14.useMemo(() => {
5347
5438
  let unitPrice;
5348
5439
  if (bundleTotalPrice != null) {
5349
5440
  unitPrice = bundleTotalPrice;
5350
5441
  } else if (compositePrice) {
5351
- unitPrice = chunkPTPOQVXS_js.parsePrice(compositePrice.final_price);
5442
+ unitPrice = chunkWMEC5JWN_js.parsePrice(compositePrice.final_price);
5352
5443
  } else {
5353
- unitPrice = chunkPTPOQVXS_js.parsePrice(product.default_price);
5354
- if (variant?.price_adjustment) {
5355
- unitPrice += chunkPTPOQVXS_js.parsePrice(variant.price_adjustment);
5356
- }
5444
+ unitPrice = chunkWMEC5JWN_js.getVariantUnitPrice(product, variant);
5357
5445
  if (addOnOptions) {
5358
5446
  for (const option of addOnOptions) {
5359
5447
  if (option.default_price) {
5360
- unitPrice += chunkPTPOQVXS_js.parsePrice(option.default_price);
5448
+ unitPrice += chunkWMEC5JWN_js.parsePrice(option.default_price);
5361
5449
  }
5362
5450
  }
5363
5451
  }
@@ -5369,7 +5457,15 @@ function useProductPrice(input) {
5369
5457
  totalPrice,
5370
5458
  displayTotalPrice: totalPrice
5371
5459
  };
5372
- }, [product.default_price, quantity, variant?.price_adjustment, addOnOptions, compositePrice, bundleTotalPrice]);
5460
+ }, [
5461
+ product,
5462
+ quantity,
5463
+ variant?.price_adjustment,
5464
+ variant?.price_info,
5465
+ addOnOptions,
5466
+ compositePrice,
5467
+ bundleTotalPrice
5468
+ ]);
5373
5469
  }
5374
5470
 
5375
5471
  // src/react/hooks/use-orders.ts
@@ -6186,7 +6282,7 @@ function useChat(options = {}) {
6186
6282
  const watchSessionClaims = React14.useCallback(() => {
6187
6283
  const c = clientRef.current;
6188
6284
  if (!c || claimUnsubRef.current) return;
6189
- const unsubClaimed = c.events.on(chunkR7FAU2ZF_js.SESSION_CLAIMED, (event) => {
6285
+ const unsubClaimed = c.events.on(chunkBHQCSHIG_js.SESSION_CLAIMED, (event) => {
6190
6286
  setClaimedAs(event.customerName || c.support.claimedCustomerName || null);
6191
6287
  if (!openedRef.current) {
6192
6288
  void openIfExisting();
@@ -6195,7 +6291,7 @@ function useChat(options = {}) {
6195
6291
  connectWebSocket();
6196
6292
  void resyncConversation();
6197
6293
  });
6198
- const unsubCleared = c.events.on(chunkR7FAU2ZF_js.SESSION_CLEARED, resetConversation);
6294
+ const unsubCleared = c.events.on(chunkBHQCSHIG_js.SESSION_CLEARED, resetConversation);
6199
6295
  claimUnsubRef.current = () => {
6200
6296
  unsubClaimed();
6201
6297
  unsubCleared();
@@ -6247,7 +6343,7 @@ function useChat(options = {}) {
6247
6343
  if (!openedRef.current) return false;
6248
6344
  }
6249
6345
  const replyTo = opts?.replyTo;
6250
- const clientId = chunk4S5EMSF5_js.generateIdempotencyKey();
6346
+ const clientId = chunkQGFKIAEM_js.generateIdempotencyKey();
6251
6347
  const localId = optimisticId(clientId);
6252
6348
  const optimistic = {
6253
6349
  id: localId,
@@ -6436,15 +6532,15 @@ function AuthElement({
6436
6532
  }, [onReady, onAuthenticated, onError]);
6437
6533
  React14.useEffect(() => {
6438
6534
  if (!elements || !containerRef.current) return;
6439
- const element = elements.create(chunk4S5EMSF5_js.ELEMENT_TYPES.AUTH, { prefillEmail });
6535
+ const element = elements.create(chunkQGFKIAEM_js.ELEMENT_TYPES.AUTH, { prefillEmail });
6440
6536
  elementRef.current = element;
6441
- element.on(chunk4S5EMSF5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6537
+ element.on(chunkQGFKIAEM_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6442
6538
  element.on(
6443
- chunk4S5EMSF5_js.EVENT_TYPES.AUTHENTICATED,
6539
+ chunkQGFKIAEM_js.EVENT_TYPES.AUTHENTICATED,
6444
6540
  (data) => onAuthenticatedRef.current?.(data)
6445
6541
  );
6446
6542
  element.on(
6447
- chunk4S5EMSF5_js.EVENT_TYPES.ERROR,
6543
+ chunkQGFKIAEM_js.EVENT_TYPES.ERROR,
6448
6544
  (data) => onErrorRef.current?.(data)
6449
6545
  );
6450
6546
  element.mount(containerRef.current);
@@ -6473,15 +6569,15 @@ function AddressElement({
6473
6569
  }, [onReady, onChange, onError]);
6474
6570
  React14.useEffect(() => {
6475
6571
  if (!elements || !containerRef.current) return;
6476
- const element = elements.create(chunk4S5EMSF5_js.ELEMENT_TYPES.ADDRESS, { mode });
6572
+ const element = elements.create(chunkQGFKIAEM_js.ELEMENT_TYPES.ADDRESS, { mode });
6477
6573
  elementRef.current = element;
6478
- element.on(chunk4S5EMSF5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6574
+ element.on(chunkQGFKIAEM_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6479
6575
  element.on(
6480
- chunk4S5EMSF5_js.EVENT_TYPES.CHANGE,
6576
+ chunkQGFKIAEM_js.EVENT_TYPES.CHANGE,
6481
6577
  (data) => onChangeRef.current?.(data)
6482
6578
  );
6483
6579
  element.on(
6484
- chunk4S5EMSF5_js.EVENT_TYPES.ERROR,
6580
+ chunkQGFKIAEM_js.EVENT_TYPES.ERROR,
6485
6581
  (data) => onErrorRef.current?.(data)
6486
6582
  );
6487
6583
  element.mount(containerRef.current);
@@ -6511,15 +6607,15 @@ function PaymentElement({
6511
6607
  }, [onReady, onChange, onError]);
6512
6608
  React14.useEffect(() => {
6513
6609
  if (!elements || !containerRef.current) return;
6514
- const element = elements.create(chunk4S5EMSF5_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
6610
+ const element = elements.create(chunkQGFKIAEM_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
6515
6611
  elementRef.current = element;
6516
- element.on(chunk4S5EMSF5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6612
+ element.on(chunkQGFKIAEM_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
6517
6613
  element.on(
6518
- chunk4S5EMSF5_js.EVENT_TYPES.CHANGE,
6614
+ chunkQGFKIAEM_js.EVENT_TYPES.CHANGE,
6519
6615
  (data) => onChangeRef.current?.(data)
6520
6616
  );
6521
6617
  element.on(
6522
- chunk4S5EMSF5_js.EVENT_TYPES.ERROR,
6618
+ chunkQGFKIAEM_js.EVENT_TYPES.ERROR,
6523
6619
  (data) => onErrorRef.current?.(data)
6524
6620
  );
6525
6621
  element.mount(containerRef.current);
@@ -6676,7 +6772,7 @@ function VariantSelector({
6676
6772
  if (!variants || variants.length <= 1) {
6677
6773
  return null;
6678
6774
  }
6679
- basePrice != null ? chunkPTPOQVXS_js.parsePrice(basePrice) : 0;
6775
+ basePrice != null ? chunkWMEC5JWN_js.parsePrice(basePrice) : 0;
6680
6776
  if (variantAxes && variantAxes.length > 0) {
6681
6777
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
6682
6778
  const labelId = `${idPrefix}-axis-${axis.id}`;
@@ -6782,7 +6878,7 @@ function VariantSelector({
6782
6878
  className: cn("divide-y divide-border", classNames?.list),
6783
6879
  children: variants.map((variant) => {
6784
6880
  const isSelected = selectedVariantId === variant.id;
6785
- const adjustment = chunkPTPOQVXS_js.parsePrice(variant.price_adjustment);
6881
+ const adjustment = chunkWMEC5JWN_js.parsePrice(variant.price_adjustment);
6786
6882
  return /* @__PURE__ */ jsxRuntime.jsxs(
6787
6883
  radio.Radio.Root,
6788
6884
  {
@@ -7050,16 +7146,16 @@ function BundleSelector({
7050
7146
  }, [components, selections, onReady]);
7051
7147
  const totalPrice = React14.useMemo(() => {
7052
7148
  if (pricingType === "fixed" && bundlePrice) {
7053
- return chunkPTPOQVXS_js.parsePrice(bundlePrice);
7149
+ return chunkWMEC5JWN_js.parsePrice(bundlePrice);
7054
7150
  }
7055
7151
  const componentsTotal = components.reduce((sum, comp) => {
7056
7152
  return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
7057
7153
  }, 0);
7058
7154
  if (pricingType === "percentage_discount" && discountValue) {
7059
- return componentsTotal * (1 - chunkPTPOQVXS_js.parsePrice(discountValue) / 100);
7155
+ return componentsTotal * (1 - chunkWMEC5JWN_js.parsePrice(discountValue) / 100);
7060
7156
  }
7061
7157
  if (pricingType === "fixed_discount" && discountValue) {
7062
- return componentsTotal - chunkPTPOQVXS_js.parsePrice(discountValue);
7158
+ return componentsTotal - chunkWMEC5JWN_js.parsePrice(discountValue);
7063
7159
  }
7064
7160
  return componentsTotal;
7065
7161
  }, [components, variantChoices, pricingType, bundlePrice, discountValue]);
@@ -7121,15 +7217,15 @@ function BundleSelector({
7121
7217
  }
7122
7218
  function getComponentPrice(component, selectedVariantId) {
7123
7219
  if (!selectedVariantId || component.available_variants.length === 0) {
7124
- return chunkPTPOQVXS_js.parsePrice(component.effective_price);
7220
+ return chunkWMEC5JWN_js.parsePrice(component.effective_price);
7125
7221
  }
7126
7222
  if (selectedVariantId === component.variant_id) {
7127
- return chunkPTPOQVXS_js.parsePrice(component.effective_price);
7223
+ return chunkWMEC5JWN_js.parsePrice(component.effective_price);
7128
7224
  }
7129
7225
  const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
7130
7226
  const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
7131
- if (!selectedAdj) return chunkPTPOQVXS_js.parsePrice(component.effective_price);
7132
- return chunkPTPOQVXS_js.parsePrice(component.effective_price) - chunkPTPOQVXS_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkPTPOQVXS_js.parsePrice(selectedAdj.price_adjustment);
7227
+ if (!selectedAdj) return chunkWMEC5JWN_js.parsePrice(component.effective_price);
7228
+ return chunkWMEC5JWN_js.parsePrice(component.effective_price) - chunkWMEC5JWN_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkWMEC5JWN_js.parsePrice(selectedAdj.price_adjustment);
7133
7229
  }
7134
7230
  function formatDuration(minutes, unit) {
7135
7231
  if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
@@ -7243,7 +7339,7 @@ function BundleComponentCard({
7243
7339
  className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
7244
7340
  children: component.available_variants.map((variant) => {
7245
7341
  const isSelected = selectedVariantId === variant.id;
7246
- const adjustment = chunkPTPOQVXS_js.parsePrice(variant.price_adjustment);
7342
+ const adjustment = chunkWMEC5JWN_js.parsePrice(variant.price_adjustment);
7247
7343
  return /* @__PURE__ */ jsxRuntime.jsxs(
7248
7344
  radio.Radio.Root,
7249
7345
  {
@@ -7690,7 +7786,7 @@ function CompositeSelector({
7690
7786
  "data-cimplify-composite-summary": true,
7691
7787
  className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
7692
7788
  children: [
7693
- chunkPTPOQVXS_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
7789
+ chunkWMEC5JWN_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
7694
7790
  "div",
7695
7791
  {
7696
7792
  "data-cimplify-composite-summary-line": true,
@@ -7701,7 +7797,7 @@ function CompositeSelector({
7701
7797
  ]
7702
7798
  }
7703
7799
  ),
7704
- chunkPTPOQVXS_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
7800
+ chunkWMEC5JWN_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
7705
7801
  "div",
7706
7802
  {
7707
7803
  "data-cimplify-composite-summary-line": true,
@@ -7845,7 +7941,7 @@ function BookingSummary({
7845
7941
  className,
7846
7942
  classNames
7847
7943
  }) {
7848
- const depositValue = depositAmount != null ? chunkPTPOQVXS_js.parsePrice(depositAmount) : 0;
7944
+ const depositValue = depositAmount != null ? chunkWMEC5JWN_js.parsePrice(depositAmount) : 0;
7849
7945
  const depositDue = depositType === "percentage" ? total * depositValue / 100 : depositType === "fixed" ? depositValue : 0;
7850
7946
  const hasDeposit = depositDue > 0;
7851
7947
  const balance = Math.max(0, total - depositDue);
@@ -8568,7 +8664,7 @@ function InputField({
8568
8664
  currency,
8569
8665
  classNames
8570
8666
  }) {
8571
- const hasPriceAdjustment = field.price_adjustment != null && chunkPTPOQVXS_js.parsePrice(field.price_adjustment) > 0;
8667
+ const hasPriceAdjustment = field.price_adjustment != null && chunkWMEC5JWN_js.parsePrice(field.price_adjustment) > 0;
8572
8668
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
8573
8669
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
8574
8670
  /* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
@@ -9621,7 +9717,18 @@ function DateSlotPicker({
9621
9717
  }
9622
9718
  );
9623
9719
  }
9624
- function ProductCustomizer({
9720
+ var REQUIRED_OPTIONS_MESSAGE = "Please select all required options";
9721
+ var QUOTE_LOADING_MESSAGE = "Updating price\u2026";
9722
+ var QUOTE_UNAVAILABLE_MESSAGE = "Price is unavailable. Please try again.";
9723
+ var CUSTOMIZER_VALIDATION_ID = "cimplify-customizer-validation";
9724
+ function initialVariantSelection(product) {
9725
+ const variant = product.variants?.find((candidate) => candidate.is_default) ?? product.variants?.[0];
9726
+ return { id: variant?.id, variant };
9727
+ }
9728
+ function ProductCustomizer(props) {
9729
+ return /* @__PURE__ */ jsxRuntime.jsx(ProductCustomizerContent, { ...props }, props.product.id);
9730
+ }
9731
+ function ProductCustomizerContent({
9625
9732
  product,
9626
9733
  onAddToCart,
9627
9734
  onVariantChange,
@@ -9633,8 +9740,11 @@ function ProductCustomizer({
9633
9740
  const [quantity, setQuantity] = React14.useState(product.min_order_quantity ?? 1);
9634
9741
  const [isAdded, setIsAdded] = React14.useState(false);
9635
9742
  const [isSubmitting, setIsSubmitting] = React14.useState(false);
9636
- const [selectedVariantId, setSelectedVariantId] = React14.useState();
9637
- const [selectedVariant, setSelectedVariant] = React14.useState();
9743
+ const [variantSelection, setVariantSelection] = React14.useState(
9744
+ () => initialVariantSelection(product)
9745
+ );
9746
+ const selectedVariantId = variantSelection.id;
9747
+ const selectedVariant = variantSelection.variant;
9638
9748
  const [selectedAddOnOptionIds, setSelectedAddOnOptionIds] = React14.useState([]);
9639
9749
  const [compositeSelections, setCompositeSelections] = React14.useState([]);
9640
9750
  const [compositePrice, setCompositePrice] = React14.useState(null);
@@ -9649,7 +9759,6 @@ function ProductCustomizer({
9649
9759
  const [selectedStaffId, setSelectedStaffId] = React14.useState(null);
9650
9760
  const [unitsCount, setUnitsCount] = React14.useState(1);
9651
9761
  const cart = useCart();
9652
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
9653
9762
  const productType = product.type || "product";
9654
9763
  const isComposite = productType === "composite";
9655
9764
  const isBundle = productType === "bundle";
@@ -9659,26 +9768,6 @@ function ProductCustomizer({
9659
9768
  const isStandard = !isComposite && !isBundle;
9660
9769
  const hasVariants = isStandard && product.variants && product.variants.length > 0;
9661
9770
  const hasAddOns = isStandard && product.add_ons && product.add_ons.length > 0;
9662
- React14.useEffect(() => {
9663
- setQuantity(product.min_order_quantity ?? 1);
9664
- setIsAdded(false);
9665
- setIsSubmitting(false);
9666
- setSelectedVariantId(void 0);
9667
- setSelectedVariant(void 0);
9668
- setSelectedAddOnOptionIds([]);
9669
- setCompositeSelections([]);
9670
- setCompositePrice(null);
9671
- setCompositeReady(false);
9672
- setBundleSelections([]);
9673
- setBundleTotalPrice(null);
9674
- setBundleReady(false);
9675
- setSelectedBillingPlan(null);
9676
- setCustomerInputValues({});
9677
- setSpecialInstructions("");
9678
- setSelectedSlot(null);
9679
- setSelectedStaffId(null);
9680
- setUnitsCount(1);
9681
- }, [product.id, product.min_order_quantity]);
9682
9771
  const slotStaff = React14.useMemo(
9683
9772
  () => (selectedSlot?.available_staff ?? []).map((member) => ({
9684
9773
  id: member.staff_id,
@@ -9701,26 +9790,34 @@ function ProductCustomizer({
9701
9790
  }, [product.add_ons, selectedAddOnOptionIds]);
9702
9791
  const normalizedAddOnOptionIds = React14.useMemo(() => {
9703
9792
  if (selectedAddOnOptionIds.length === 0) return [];
9704
- return Array.from(new Set(selectedAddOnOptionIds.map((id) => id.trim()).filter(Boolean))).sort();
9793
+ return Array.from(
9794
+ new Set(selectedAddOnOptionIds.map((id) => id.trim()).filter(Boolean))
9795
+ ).sort();
9705
9796
  }, [selectedAddOnOptionIds]);
9706
9797
  const localTotalPrice = React14.useMemo(() => {
9707
9798
  if (isComposite && compositePrice) {
9708
- return chunkPTPOQVXS_js.parsePrice(compositePrice.final_price) * quantity;
9799
+ return chunkWMEC5JWN_js.parsePrice(compositePrice.final_price) * quantity;
9709
9800
  }
9710
9801
  if (isBundle && bundleTotalPrice != null) {
9711
9802
  return bundleTotalPrice * quantity;
9712
9803
  }
9713
- let price = chunkPTPOQVXS_js.parsePrice(product.default_price);
9714
- if (selectedVariant?.price_adjustment) {
9715
- price += chunkPTPOQVXS_js.parsePrice(selectedVariant.price_adjustment);
9716
- }
9804
+ let price = chunkWMEC5JWN_js.getVariantUnitPrice(product, selectedVariant);
9717
9805
  for (const option of selectedAddOnOptions) {
9718
9806
  if (option.default_price) {
9719
- price += chunkPTPOQVXS_js.parsePrice(option.default_price);
9807
+ price += chunkWMEC5JWN_js.parsePrice(option.default_price);
9720
9808
  }
9721
9809
  }
9722
9810
  return price * quantity;
9723
- }, [product.default_price, selectedVariant, selectedAddOnOptions, quantity, isComposite, compositePrice, isBundle, bundleTotalPrice]);
9811
+ }, [
9812
+ product.default_price,
9813
+ selectedVariant,
9814
+ selectedAddOnOptions,
9815
+ quantity,
9816
+ isComposite,
9817
+ compositePrice,
9818
+ isBundle,
9819
+ bundleTotalPrice
9820
+ ]);
9724
9821
  const requiredAddOnsSatisfied = React14.useMemo(() => {
9725
9822
  if (!product.add_ons) return true;
9726
9823
  for (const addOn of product.add_ons) {
@@ -9745,7 +9842,16 @@ function ProductCustomizer({
9745
9842
  bundleSelections: isBundle && bundleSelections.length > 0 ? bundleSelections : void 0,
9746
9843
  compositeSelections: isComposite && compositeSelections.length > 0 ? compositeSelections : void 0
9747
9844
  }),
9748
- [product.id, quantity, selectedVariantId, normalizedAddOnOptionIds, isBundle, bundleSelections, isComposite, compositeSelections]
9845
+ [
9846
+ product.id,
9847
+ quantity,
9848
+ selectedVariantId,
9849
+ normalizedAddOnOptionIds,
9850
+ isBundle,
9851
+ bundleSelections,
9852
+ isComposite,
9853
+ compositeSelections
9854
+ ]
9749
9855
  );
9750
9856
  const requiredInputsSatisfied = React14.useMemo(() => {
9751
9857
  if (!product.input_fields || product.input_fields.length === 0) return true;
@@ -9756,17 +9862,23 @@ function ProductCustomizer({
9756
9862
  });
9757
9863
  }, [product.input_fields, customerInputValues]);
9758
9864
  const quoteEnabled = isComposite ? compositeReady && requiredInputsSatisfied : isBundle ? bundleReady && requiredInputsSatisfied : requiredAddOnsSatisfied && requiredInputsSatisfied;
9759
- const { quote } = useQuote(quoteInput, {
9865
+ const {
9866
+ quote,
9867
+ isLoading: isQuoteLoading,
9868
+ error: quoteError,
9869
+ isExpired: isQuoteExpired2
9870
+ } = useQuote(quoteInput, {
9760
9871
  enabled: quoteEnabled
9761
9872
  });
9873
+ const currency = quote?.currency ?? chunkWMEC5JWN_js.getProductCurrency(product);
9762
9874
  const quoteId = quote?.quote_id;
9875
+ const quotedUnitPrice = (quote?.quoted_total_price_info ?? quote?.final_price_info)?.final_price;
9763
9876
  const quotedTotalPrice = React14.useMemo(() => {
9764
- if (!quote) return void 0;
9765
- const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
9766
- const perUnit = priceInfo.pre_tax_price;
9767
- if (perUnit === void 0 || perUnit === null) return void 0;
9768
- return chunkPTPOQVXS_js.parsePrice(perUnit) * quantity;
9769
- }, [quote, quantity]);
9877
+ if (quotedUnitPrice === void 0 || quotedUnitPrice === null) return void 0;
9878
+ return chunkWMEC5JWN_js.parsePrice(quotedUnitPrice) * quantity;
9879
+ }, [quotedUnitPrice, quantity]);
9880
+ const quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2;
9881
+ const validationMessage = !quoteEnabled ? REQUIRED_OPTIONS_MESSAGE : quoteError ? QUOTE_UNAVAILABLE_MESSAGE : !quoteIsReady ? QUOTE_LOADING_MESSAGE : null;
9770
9882
  const displayTotalPrice = React14.useMemo(() => {
9771
9883
  const total = quotedTotalPrice ?? localTotalPrice;
9772
9884
  const multiplier = chunkQPRI2NII_js.serviceBillingMultiplier(product, {
@@ -9780,8 +9892,7 @@ function ProductCustomizer({
9780
9892
  }, [quotedTotalPrice, localTotalPrice, product, quantity, unitsCount, selectedSlot]);
9781
9893
  const handleVariantChange = React14.useCallback(
9782
9894
  (variantId, variant) => {
9783
- setSelectedVariantId(variantId);
9784
- setSelectedVariant(variant);
9895
+ setVariantSelection({ id: variantId, variant });
9785
9896
  onVariantChange?.(variantId, variant);
9786
9897
  },
9787
9898
  [onVariantChange]
@@ -9789,12 +9900,21 @@ function ProductCustomizer({
9789
9900
  const addedTimerRef = React14.useRef(void 0);
9790
9901
  React14.useEffect(() => () => clearTimeout(addedTimerRef.current), []);
9791
9902
  const handleAddToCart = React14.useCallback(async () => {
9792
- if (isSubmitting) return;
9903
+ if (isSubmitting || !quoteIsReady || !quote || quotedUnitPrice === void 0 || quotedUnitPrice === null) {
9904
+ return;
9905
+ }
9793
9906
  setIsSubmitting(true);
9794
9907
  const options = {
9908
+ locationId: quote.location_id ?? void 0,
9795
9909
  variantId: selectedVariantId,
9796
- variant: selectedVariant ? { id: selectedVariant.id, name: selectedVariant.name || "", price_adjustment: selectedVariant.price_adjustment } : void 0,
9910
+ variant: selectedVariant ? {
9911
+ id: selectedVariant.id,
9912
+ name: selectedVariant.name || "",
9913
+ price_adjustment: selectedVariant.price_adjustment,
9914
+ price_info: selectedVariant.price_info
9915
+ } : void 0,
9797
9916
  quoteId,
9917
+ quotedUnitPrice,
9798
9918
  addOnOptionIds: normalizedAddOnOptionIds.length > 0 ? normalizedAddOnOptionIds : void 0,
9799
9919
  addOnOptions: selectedAddOnOptions.length > 0 ? selectedAddOnOptions.map((opt) => ({
9800
9920
  id: opt.id,
@@ -9831,7 +9951,32 @@ function ProductCustomizer({
9831
9951
  } finally {
9832
9952
  setIsSubmitting(false);
9833
9953
  }
9834
- }, [product, quantity, selectedVariantId, selectedVariant, quoteId, normalizedAddOnOptionIds, selectedAddOnOptions, isComposite, compositeSelections, isBundle, bundleSelections, selectedBillingPlan, customerInputValues, specialInstructions, isService, selectedSlot, selectedStaffId, unitsCount, isSubmitting, onAddToCart, cart]);
9954
+ }, [
9955
+ product,
9956
+ quantity,
9957
+ selectedVariantId,
9958
+ selectedVariant,
9959
+ quoteId,
9960
+ quotedUnitPrice,
9961
+ normalizedAddOnOptionIds,
9962
+ selectedAddOnOptions,
9963
+ isComposite,
9964
+ compositeSelections,
9965
+ isBundle,
9966
+ bundleSelections,
9967
+ selectedBillingPlan,
9968
+ customerInputValues,
9969
+ specialInstructions,
9970
+ isService,
9971
+ selectedSlot,
9972
+ selectedStaffId,
9973
+ unitsCount,
9974
+ isSubmitting,
9975
+ onAddToCart,
9976
+ cart,
9977
+ quoteIsReady,
9978
+ quote
9979
+ ]);
9835
9980
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customizer": true, className: cn("space-y-6", className, classNames?.root), children: [
9836
9981
  isComposite && product.groups && product.composite_id && /* @__PURE__ */ jsxRuntime.jsx(
9837
9982
  CompositeSelector,
@@ -9944,27 +10089,48 @@ function ProductCustomizer({
9944
10089
  currency
9945
10090
  }
9946
10091
  ),
9947
- product.deposit_type && product.deposit_type !== "none" && product.deposit_amount && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-deposit": true, className: cn("text-sm text-muted-foreground", classNames?.depositInfo), children: product.deposit_type === "fixed" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9948
- "Deposit required: ",
9949
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
9950
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9951
- "Deposit required: ",
9952
- chunkPTPOQVXS_js.parsePrice(product.deposit_amount),
9953
- "%"
9954
- ] }) }),
9955
- product.allergies && product.allergies.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-allergens": true, className: cn("flex flex-wrap gap-1.5", classNames?.allergens), children: product.allergies.map((allergen) => /* @__PURE__ */ jsxRuntime.jsx(
9956
- "span",
10092
+ product.deposit_type && product.deposit_type !== "none" && product.deposit_amount && /* @__PURE__ */ jsxRuntime.jsx(
10093
+ "div",
9957
10094
  {
9958
- "data-cimplify-allergen-tag": true,
9959
- className: "inline-block text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground",
9960
- children: allergen
9961
- },
9962
- allergen
9963
- )) }),
9964
- isService && product.duration_minutes != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customizer-duration": true, className: cn("text-sm text-muted-foreground", classNames?.duration), children: [
9965
- "Duration: ",
9966
- formatDuration2(product.duration_minutes, product.duration_unit)
9967
- ] }),
10095
+ "data-cimplify-customizer-deposit": true,
10096
+ className: cn("text-sm text-muted-foreground", classNames?.depositInfo),
10097
+ children: product.deposit_type === "fixed" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
10098
+ "Deposit required: ",
10099
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount, currency })
10100
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
10101
+ "Deposit required: ",
10102
+ chunkWMEC5JWN_js.parsePrice(product.deposit_amount),
10103
+ "%"
10104
+ ] })
10105
+ }
10106
+ ),
10107
+ product.allergies && product.allergies.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
10108
+ "div",
10109
+ {
10110
+ "data-cimplify-customizer-allergens": true,
10111
+ className: cn("flex flex-wrap gap-1.5", classNames?.allergens),
10112
+ children: product.allergies.map((allergen) => /* @__PURE__ */ jsxRuntime.jsx(
10113
+ "span",
10114
+ {
10115
+ "data-cimplify-allergen-tag": true,
10116
+ className: "inline-block text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground",
10117
+ children: allergen
10118
+ },
10119
+ allergen
10120
+ ))
10121
+ }
10122
+ ),
10123
+ isService && product.duration_minutes != null && /* @__PURE__ */ jsxRuntime.jsxs(
10124
+ "div",
10125
+ {
10126
+ "data-cimplify-customizer-duration": true,
10127
+ className: cn("text-sm text-muted-foreground", classNames?.duration),
10128
+ children: [
10129
+ "Duration: ",
10130
+ formatDuration2(product.duration_minutes, product.duration_unit)
10131
+ ]
10132
+ }
10133
+ ),
9968
10134
  showSpecialInstructions && !isDigital && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-special-instructions": true, children: /* @__PURE__ */ jsxRuntime.jsx(
9969
10135
  "textarea",
9970
10136
  {
@@ -9997,13 +10163,17 @@ function ProductCustomizer({
9997
10163
  "data-cimplify-customizer-actions": true,
9998
10164
  className: cn("pt-4 border-t border-border", classNames?.actions),
9999
10165
  children: [
10000
- !quoteEnabled && /* @__PURE__ */ jsxRuntime.jsx(
10166
+ validationMessage && /* @__PURE__ */ jsxRuntime.jsx(
10001
10167
  "p",
10002
10168
  {
10003
- id: "cimplify-customizer-validation",
10169
+ id: CUSTOMIZER_VALIDATION_ID,
10004
10170
  "data-cimplify-customizer-validation": true,
10005
- className: cn("text-sm text-destructive mb-3", classNames?.validation),
10006
- children: "Please select all required options"
10171
+ className: cn(
10172
+ "text-sm mb-3",
10173
+ quoteError ? "text-destructive" : "text-muted-foreground",
10174
+ classNames?.validation
10175
+ ),
10176
+ children: validationMessage
10007
10177
  }
10008
10178
  ),
10009
10179
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [
@@ -10016,28 +10186,54 @@ function ProductCustomizer({
10016
10186
  min: product.min_order_quantity ?? 1
10017
10187
  }
10018
10188
  ),
10019
- product.min_order_quantity && product.min_order_quantity > 1 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-customizer-min-hint": true, className: "text-xs text-muted-foreground text-center", children: [
10020
- "Min. ",
10021
- product.min_order_quantity
10022
- ] })
10023
- ] }),
10024
- product.quantity_pricing && product.quantity_pricing.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customizer-unit-price": true, className: "text-sm text-muted-foreground text-right shrink-0", children: [
10025
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPTPOQVXS_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunkPTPOQVXS_js.parsePrice(product.default_price)), currency, className: "font-medium text-foreground" }),
10026
- " ea."
10189
+ product.min_order_quantity && product.min_order_quantity > 1 && /* @__PURE__ */ jsxRuntime.jsxs(
10190
+ "span",
10191
+ {
10192
+ "data-cimplify-customizer-min-hint": true,
10193
+ className: "text-xs text-muted-foreground text-center",
10194
+ children: [
10195
+ "Min. ",
10196
+ product.min_order_quantity
10197
+ ]
10198
+ }
10199
+ )
10027
10200
  ] }),
10201
+ product.quantity_pricing && product.quantity_pricing.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
10202
+ "div",
10203
+ {
10204
+ "data-cimplify-customizer-unit-price": true,
10205
+ className: "text-sm text-muted-foreground text-right shrink-0",
10206
+ children: [
10207
+ /* @__PURE__ */ jsxRuntime.jsx(
10208
+ Price,
10209
+ {
10210
+ amount: chunkWMEC5JWN_js.getUnitPriceAtQuantity(
10211
+ product.quantity_pricing,
10212
+ quantity,
10213
+ chunkWMEC5JWN_js.parsePrice(product.default_price)
10214
+ ),
10215
+ currency,
10216
+ className: "font-medium text-foreground"
10217
+ }
10218
+ ),
10219
+ " ",
10220
+ "ea."
10221
+ ]
10222
+ }
10223
+ ),
10028
10224
  /* @__PURE__ */ jsxRuntime.jsx(
10029
10225
  button.Button,
10030
10226
  {
10031
10227
  onClick: handleAddToCart,
10032
- disabled: isAdded || isSubmitting || !quoteEnabled,
10033
- "aria-describedby": !quoteEnabled ? "cimplify-customizer-validation" : void 0,
10228
+ disabled: isAdded || isSubmitting || !quoteIsReady,
10229
+ "aria-describedby": validationMessage ? CUSTOMIZER_VALIDATION_ID : void 0,
10034
10230
  "data-cimplify-customizer-submit": true,
10035
10231
  className: cn(
10036
10232
  "flex-1 h-14 text-base bg-primary text-primary-foreground font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed rounded-full",
10037
10233
  isAdded && classNames?.submitButtonAdded,
10038
10234
  classNames?.submitButton
10039
10235
  ),
10040
- children: isAdded ? "Added" : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10236
+ children: isAdded ? "Added" : !quoteEnabled ? submitLabel ?? "Add to Cart" : !quoteIsReady ? quoteError ? QUOTE_UNAVAILABLE_MESSAGE : QUOTE_LOADING_MESSAGE : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10041
10237
  submitLabel ?? "Add to Cart",
10042
10238
  " \xB7",
10043
10239
  " ",
@@ -10471,17 +10667,20 @@ function CartLineItemRow({
10471
10667
  item,
10472
10668
  onRemove,
10473
10669
  onQuantityChange,
10670
+ currency,
10474
10671
  classNames
10475
10672
  }) {
10476
- const { unitPrice } = useProductPrice({
10673
+ const { unitPrice: locallyResolvedUnitPrice } = useProductPrice({
10477
10674
  product: item.product,
10478
10675
  variant: item.variant,
10479
10676
  addOnOptions: item.addOnOptions
10480
10677
  });
10678
+ const pinnedUnitPrice = item._quotedUnitPrice;
10679
+ const unitPrice = pinnedUnitPrice === void 0 ? locallyResolvedUnitPrice : chunkWMEC5JWN_js.parsePrice(pinnedUnitPrice);
10481
10680
  const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
10482
10681
  const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
10483
10682
  const isOptimistic2 = item.isOptimistic === true;
10484
- const lineTotal = chunkPTPOQVXS_js.parsePrice(unitPrice) * item.quantity;
10683
+ const lineTotal = chunkWMEC5JWN_js.parsePrice(unitPrice) * item.quantity;
10485
10684
  const imageUrl = item.product.image_url;
10486
10685
  const variantLabel2 = item.variant ? chunkQPRI2NII_js.getVariantDisplayName(item.variant, item.product.name) : null;
10487
10686
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -10500,15 +10699,25 @@ function CartLineItemRow({
10500
10699
  {
10501
10700
  "data-cimplify-cart-item-image": true,
10502
10701
  className: "relative w-20 h-20 shrink-0 rounded-md overflow-hidden bg-muted",
10503
- children: imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(
10504
- "img",
10702
+ children: imageUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: imageUrl, alt: "", className: "w-full h-full object-cover", loading: "lazy" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full grid place-items-center text-muted-foreground/40", children: /* @__PURE__ */ jsxRuntime.jsx(
10703
+ "svg",
10505
10704
  {
10506
- src: imageUrl,
10507
- alt: "",
10508
- className: "w-full h-full object-cover",
10509
- loading: "lazy"
10705
+ className: "w-6 h-6",
10706
+ fill: "none",
10707
+ stroke: "currentColor",
10708
+ strokeWidth: "1.5",
10709
+ viewBox: "0 0 24 24",
10710
+ "aria-hidden": true,
10711
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10712
+ "path",
10713
+ {
10714
+ strokeLinecap: "round",
10715
+ strokeLinejoin: "round",
10716
+ d: "M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
10717
+ }
10718
+ )
10510
10719
  }
10511
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full grid place-items-center text-muted-foreground/40", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" }) }) })
10720
+ ) })
10512
10721
  }
10513
10722
  ),
10514
10723
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, className: "flex-1 min-w-0 flex flex-col", children: [
@@ -10532,7 +10741,18 @@ function CartLineItemRow({
10532
10741
  classNames?.removeButton
10533
10742
  ),
10534
10743
  "aria-label": `Remove ${item.product.name}`,
10535
- children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
10744
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10745
+ "svg",
10746
+ {
10747
+ className: "w-3.5 h-3.5",
10748
+ fill: "none",
10749
+ stroke: "currentColor",
10750
+ strokeWidth: "2",
10751
+ viewBox: "0 0 24 24",
10752
+ "aria-hidden": true,
10753
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
10754
+ }
10755
+ )
10536
10756
  }
10537
10757
  )
10538
10758
  ] }),
@@ -10578,43 +10798,124 @@ function CartLineItemRow({
10578
10798
  ]
10579
10799
  }
10580
10800
  ),
10581
- item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("dl", { "data-cimplify-cart-customer-inputs": true, className: cn("mt-1.5 text-xs space-y-0.5", classNames?.customerInputs), children: item.customerInputs.map((input) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-input": true, className: "flex gap-1.5", children: [
10582
- /* @__PURE__ */ jsxRuntime.jsxs("dt", { "data-cimplify-cart-input-label": true, className: "text-muted-foreground", children: [
10583
- input.field_name,
10584
- ":"
10585
- ] }),
10586
- /* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkQPRI2NII_js.INPUT_FIELD_TYPE.File || input.field_type === chunkQPRI2NII_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
10587
- ] }, input.field_id)) }),
10588
- (item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: cn("mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground", classNames?.serviceInfo), children: [
10589
- /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
10590
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
10591
- new Date(item.scheduledStart).toLocaleDateString(void 0, { month: "short", day: "numeric" }),
10592
- " at",
10593
- " ",
10594
- new Date(item.scheduledStart).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
10595
- ] }),
10596
- item.serviceStatus && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-status": item.serviceStatus, className: "ml-auto px-1.5 py-0.5 rounded-full bg-muted text-[10px] uppercase tracking-wider", children: item.serviceStatus })
10597
- ] }),
10598
- (item.lineType === "digital" || item.product.type === "digital") && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-digital-info": true, className: cn("mt-1.5 flex items-center gap-1 text-xs text-muted-foreground", classNames?.digitalInfo), children: [
10599
- /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
10600
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Instant digital delivery" })
10601
- ] }),
10801
+ item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
10802
+ "dl",
10803
+ {
10804
+ "data-cimplify-cart-customer-inputs": true,
10805
+ className: cn("mt-1.5 text-xs space-y-0.5", classNames?.customerInputs),
10806
+ children: item.customerInputs.map((input) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-input": true, className: "flex gap-1.5", children: [
10807
+ /* @__PURE__ */ jsxRuntime.jsxs("dt", { "data-cimplify-cart-input-label": true, className: "text-muted-foreground", children: [
10808
+ input.field_name,
10809
+ ":"
10810
+ ] }),
10811
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkQPRI2NII_js.INPUT_FIELD_TYPE.File || input.field_type === chunkQPRI2NII_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
10812
+ ] }, input.field_id))
10813
+ }
10814
+ ),
10815
+ (item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs(
10816
+ "div",
10817
+ {
10818
+ "data-cimplify-cart-service-info": true,
10819
+ className: cn(
10820
+ "mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground",
10821
+ classNames?.serviceInfo
10822
+ ),
10823
+ children: [
10824
+ /* @__PURE__ */ jsxRuntime.jsx(
10825
+ "svg",
10826
+ {
10827
+ className: "w-3.5 h-3.5 shrink-0",
10828
+ fill: "none",
10829
+ stroke: "currentColor",
10830
+ strokeWidth: "2",
10831
+ viewBox: "0 0 24 24",
10832
+ "aria-hidden": true,
10833
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10834
+ "path",
10835
+ {
10836
+ strokeLinecap: "round",
10837
+ strokeLinejoin: "round",
10838
+ d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
10839
+ }
10840
+ )
10841
+ }
10842
+ ),
10843
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
10844
+ new Date(item.scheduledStart).toLocaleDateString(void 0, {
10845
+ month: "short",
10846
+ day: "numeric"
10847
+ }),
10848
+ " ",
10849
+ "at",
10850
+ " ",
10851
+ new Date(item.scheduledStart).toLocaleTimeString([], {
10852
+ hour: "2-digit",
10853
+ minute: "2-digit"
10854
+ })
10855
+ ] }),
10856
+ item.serviceStatus && /* @__PURE__ */ jsxRuntime.jsx(
10857
+ "span",
10858
+ {
10859
+ "data-status": item.serviceStatus,
10860
+ className: "ml-auto px-1.5 py-0.5 rounded-full bg-muted text-[10px] uppercase tracking-wider",
10861
+ children: item.serviceStatus
10862
+ }
10863
+ )
10864
+ ]
10865
+ }
10866
+ ),
10867
+ (item.lineType === "digital" || item.product.type === "digital") && /* @__PURE__ */ jsxRuntime.jsxs(
10868
+ "div",
10869
+ {
10870
+ "data-cimplify-cart-digital-info": true,
10871
+ className: cn(
10872
+ "mt-1.5 flex items-center gap-1 text-xs text-muted-foreground",
10873
+ classNames?.digitalInfo
10874
+ ),
10875
+ children: [
10876
+ /* @__PURE__ */ jsxRuntime.jsx(
10877
+ "svg",
10878
+ {
10879
+ className: "w-3.5 h-3.5 shrink-0",
10880
+ fill: "none",
10881
+ stroke: "currentColor",
10882
+ strokeWidth: "2",
10883
+ viewBox: "0 0 24 24",
10884
+ "aria-hidden": true,
10885
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 10V3L4 14h7v7l9-11h-7z" })
10886
+ }
10887
+ ),
10888
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Instant digital delivery" })
10889
+ ]
10890
+ }
10891
+ ),
10602
10892
  (item.bundleResolved || item.compositeResolved) && /* @__PURE__ */ jsxRuntime.jsx(
10603
10893
  "ul",
10604
10894
  {
10605
10895
  "data-cimplify-cart-composite-breakdown": item.compositeResolved ? "" : void 0,
10606
10896
  "data-cimplify-cart-bundle-breakdown": item.bundleResolved ? "" : void 0,
10607
- className: cn("mt-1.5 pl-3 border-l border-border space-y-0.5 text-xs text-muted-foreground", item.compositeResolved ? classNames?.compositeBreakdown : classNames?.bundleBreakdown),
10897
+ className: cn(
10898
+ "mt-1.5 pl-3 border-l border-border space-y-0.5 text-xs text-muted-foreground",
10899
+ item.compositeResolved ? classNames?.compositeBreakdown : classNames?.bundleBreakdown
10900
+ ),
10608
10901
  children: (item.bundleResolved?.selections ?? item.compositeResolved?.selections ?? []).map((sel) => {
10609
10902
  const name = sel.product_name ?? sel.component_name ?? "";
10610
10903
  const compId = sel.component_id ?? `${name}-${sel.quantity}`;
10611
- return /* @__PURE__ */ jsxRuntime.jsxs("li", { "data-product-type": sel.product_type, className: "flex items-baseline gap-1.5 m-0", children: [
10612
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-foreground/80", children: [
10613
- sel.quantity,
10614
- "\\u00D7"
10615
- ] }),
10616
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: name })
10617
- ] }, compId);
10904
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10905
+ "li",
10906
+ {
10907
+ "data-product-type": sel.product_type,
10908
+ className: "flex items-baseline gap-1.5 m-0",
10909
+ children: [
10910
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-foreground/80", children: [
10911
+ sel.quantity,
10912
+ "\\u00D7"
10913
+ ] }),
10914
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: name })
10915
+ ]
10916
+ },
10917
+ compId
10918
+ );
10618
10919
  })
10619
10920
  }
10620
10921
  ),
@@ -10623,6 +10924,7 @@ function CartLineItemRow({
10623
10924
  Price,
10624
10925
  {
10625
10926
  amount: lineTotal,
10927
+ currency,
10626
10928
  className: cn("text-sm font-semibold tabular-nums", classNames?.itemPrice)
10627
10929
  }
10628
10930
  ),
@@ -10660,9 +10962,11 @@ function CartSummary({
10660
10962
  isEmpty,
10661
10963
  isOptimistic: isOptimistic2,
10662
10964
  pendingOpCount,
10965
+ currency,
10663
10966
  removeItem,
10664
10967
  updateQuantity
10665
10968
  } = useCart();
10969
+ const displayCurrency = serverCart?.currency ?? chunkNIOUSKQQ_js.currencyCode(currency);
10666
10970
  const deliveryFee = serverCart?.delivery_fee;
10667
10971
  const serviceCharge = serverCart?.service_charge;
10668
10972
  const totalDiscounts = serverCart?.total_discounts;
@@ -10694,6 +10998,7 @@ function CartSummary({
10694
10998
  item,
10695
10999
  onRemove: handleRemove,
10696
11000
  onQuantityChange: handleQuantityChange,
11001
+ currency: displayCurrency,
10697
11002
  classNames
10698
11003
  },
10699
11004
  item.id
@@ -10702,38 +11007,115 @@ function CartSummary({
10702
11007
  "div",
10703
11008
  {
10704
11009
  "data-cimplify-cart-totals": true,
10705
- className: cn("mt-6 pt-4 border-t border-border space-y-2 text-sm", classNames?.totals),
11010
+ className: cn(
11011
+ "mt-6 pt-4 border-t border-border space-y-2 text-sm",
11012
+ classNames?.totals
11013
+ ),
10706
11014
  children: [
10707
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-subtotal": true, className: cn("flex items-baseline justify-between", classNames?.subtotal), children: [
10708
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
10709
- "Subtotal (",
10710
- itemCount,
10711
- " ",
10712
- itemCount === 1 ? "item" : "items",
10713
- ")"
10714
- ] }),
10715
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal, className: "tabular-nums" })
10716
- ] }),
10717
- totalDiscounts != null && chunkPTPOQVXS_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: cn("flex items-baseline justify-between", classNames?.discount), children: [
10718
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Discount" }),
10719
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-", className: "tabular-nums text-primary" })
10720
- ] }),
10721
- deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: cn("flex items-baseline justify-between", classNames?.deliveryFee), children: [
10722
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
10723
- chunkPTPOQVXS_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee, className: "tabular-nums" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "Free" })
10724
- ] }),
10725
- serviceCharge != null && chunkPTPOQVXS_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: cn("flex items-baseline justify-between", classNames?.serviceCharge), children: [
10726
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Service charge" }),
10727
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge, className: "tabular-nums" })
10728
- ] }),
10729
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-tax": true, className: cn("flex items-baseline justify-between", classNames?.tax), children: [
10730
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Tax" }),
10731
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: tax, className: "tabular-nums" })
10732
- ] }),
10733
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-total": true, className: cn("flex items-baseline justify-between pt-3 mt-1 border-t border-border", classNames?.total), children: [
10734
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Total" }),
10735
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: total, className: "text-base font-bold tabular-nums" })
10736
- ] })
11015
+ /* @__PURE__ */ jsxRuntime.jsxs(
11016
+ "div",
11017
+ {
11018
+ "data-cimplify-cart-subtotal": true,
11019
+ className: cn("flex items-baseline justify-between", classNames?.subtotal),
11020
+ children: [
11021
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
11022
+ "Subtotal (",
11023
+ itemCount,
11024
+ " ",
11025
+ itemCount === 1 ? "item" : "items",
11026
+ ")"
11027
+ ] }),
11028
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal, currency: displayCurrency, className: "tabular-nums" })
11029
+ ]
11030
+ }
11031
+ ),
11032
+ totalDiscounts != null && chunkWMEC5JWN_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11033
+ "div",
11034
+ {
11035
+ "data-cimplify-cart-discount": true,
11036
+ className: cn("flex items-baseline justify-between", classNames?.discount),
11037
+ children: [
11038
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Discount" }),
11039
+ /* @__PURE__ */ jsxRuntime.jsx(
11040
+ Price,
11041
+ {
11042
+ amount: totalDiscounts,
11043
+ currency: displayCurrency,
11044
+ prefix: "-",
11045
+ className: "tabular-nums text-primary"
11046
+ }
11047
+ )
11048
+ ]
11049
+ }
11050
+ ),
11051
+ deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs(
11052
+ "div",
11053
+ {
11054
+ "data-cimplify-cart-delivery-fee": true,
11055
+ className: cn("flex items-baseline justify-between", classNames?.deliveryFee),
11056
+ children: [
11057
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
11058
+ chunkWMEC5JWN_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
11059
+ Price,
11060
+ {
11061
+ amount: deliveryFee,
11062
+ currency: displayCurrency,
11063
+ className: "tabular-nums"
11064
+ }
11065
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "Free" })
11066
+ ]
11067
+ }
11068
+ ),
11069
+ serviceCharge != null && chunkWMEC5JWN_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
11070
+ "div",
11071
+ {
11072
+ "data-cimplify-cart-service-charge": true,
11073
+ className: cn("flex items-baseline justify-between", classNames?.serviceCharge),
11074
+ children: [
11075
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Service charge" }),
11076
+ /* @__PURE__ */ jsxRuntime.jsx(
11077
+ Price,
11078
+ {
11079
+ amount: serviceCharge,
11080
+ currency: displayCurrency,
11081
+ className: "tabular-nums"
11082
+ }
11083
+ )
11084
+ ]
11085
+ }
11086
+ ),
11087
+ /* @__PURE__ */ jsxRuntime.jsxs(
11088
+ "div",
11089
+ {
11090
+ "data-cimplify-cart-tax": true,
11091
+ className: cn("flex items-baseline justify-between", classNames?.tax),
11092
+ children: [
11093
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Tax" }),
11094
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: tax, currency: displayCurrency, className: "tabular-nums" })
11095
+ ]
11096
+ }
11097
+ ),
11098
+ /* @__PURE__ */ jsxRuntime.jsxs(
11099
+ "div",
11100
+ {
11101
+ "data-cimplify-cart-total": true,
11102
+ className: cn(
11103
+ "flex items-baseline justify-between pt-3 mt-1 border-t border-border",
11104
+ classNames?.total
11105
+ ),
11106
+ children: [
11107
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Total" }),
11108
+ /* @__PURE__ */ jsxRuntime.jsx(
11109
+ Price,
11110
+ {
11111
+ amount: total,
11112
+ currency: displayCurrency,
11113
+ className: "text-base font-bold tabular-nums"
11114
+ }
11115
+ )
11116
+ ]
11117
+ }
11118
+ )
10737
11119
  ]
10738
11120
  }
10739
11121
  ),
@@ -10812,18 +11194,20 @@ function SaleBadge({
10812
11194
  className,
10813
11195
  classNames
10814
11196
  }) {
10815
- const onSale = chunkPTPOQVXS_js.isOnSale(product);
11197
+ const onSale = chunkWMEC5JWN_js.isOnSale(product);
10816
11198
  const hasDeal = dealInfo !== void 0;
10817
11199
  if (!hasDeal && !onSale && !label) {
10818
11200
  return null;
10819
11201
  }
10820
11202
  let percentage = null;
10821
- if (hasDeal && dealInfo.benefit_type === "percentage") {
10822
- percentage = chunkPTPOQVXS_js.parsePrice(dealInfo.value);
11203
+ if (product.sale) {
11204
+ percentage = chunkWMEC5JWN_js.parsePrice(product.sale.percent_off);
11205
+ } else if (hasDeal && dealInfo.benefit_type === "percentage") {
11206
+ percentage = chunkWMEC5JWN_js.parsePrice(dealInfo.value);
10823
11207
  } else if (onSale) {
10824
- percentage = chunkPTPOQVXS_js.getDiscountPercentage(product);
11208
+ percentage = chunkWMEC5JWN_js.getDiscountPercentage(product);
10825
11209
  }
10826
- const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
11210
+ const badgeText = label ?? product.sale?.badge_text ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
10827
11211
  if (!badgeText) {
10828
11212
  return null;
10829
11213
  }
@@ -10840,7 +11224,7 @@ function SaleBadge({
10840
11224
  "%"
10841
11225
  ] }),
10842
11226
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
10843
- showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPTPOQVXS_js.getBasePrice(product), currency: chunkPTPOQVXS_js.getProductCurrency(product) }) })
11227
+ showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkWMEC5JWN_js.getBasePrice(product), currency: chunkWMEC5JWN_js.getProductCurrency(product) }) })
10844
11228
  ]
10845
11229
  }
10846
11230
  );
@@ -10858,7 +11242,7 @@ function SalePrice({
10858
11242
  if (!sale) {
10859
11243
  return /* @__PURE__ */ jsxRuntime.jsx(Price, { amount, currency, className });
10860
11244
  }
10861
- const off = Math.round(chunkPTPOQVXS_js.parsePrice(sale.percent_off));
11245
+ const off = Math.round(chunkWMEC5JWN_js.parsePrice(sale.percent_off));
10862
11246
  return /* @__PURE__ */ jsxRuntime.jsxs(
10863
11247
  "span",
10864
11248
  {
@@ -11234,7 +11618,7 @@ function ProductSheet({
11234
11618
  Price,
11235
11619
  {
11236
11620
  amount: fullProduct.default_price,
11237
- currency: chunkPTPOQVXS_js.getProductCurrency(fullProduct),
11621
+ currency: chunkWMEC5JWN_js.getProductCurrency(fullProduct),
11238
11622
  className: classNames?.price
11239
11623
  }
11240
11624
  )
@@ -11420,10 +11804,10 @@ function SoldOutOverlay() {
11420
11804
  function SaleBadge2({ product }) {
11421
11805
  let label = null;
11422
11806
  if (product.sale) {
11423
- const off = Math.round(chunkPTPOQVXS_js.parsePrice(product.sale.percent_off));
11807
+ const off = Math.round(chunkWMEC5JWN_js.parsePrice(product.sale.percent_off));
11424
11808
  label = product.sale.badge_text ?? (off > 0 ? `-${off}%` : null);
11425
- } else if (chunkPTPOQVXS_js.isOnSale(product)) {
11426
- const pct = chunkPTPOQVXS_js.getDiscountPercentage(product);
11809
+ } else if (chunkWMEC5JWN_js.isOnSale(product)) {
11810
+ const pct = chunkWMEC5JWN_js.getDiscountPercentage(product);
11427
11811
  label = pct && pct > 0 ? `-${pct}%` : null;
11428
11812
  }
11429
11813
  if (!label) return null;
@@ -11464,7 +11848,7 @@ function FoodProductCard({
11464
11848
  className
11465
11849
  }) {
11466
11850
  const image = product.image_url || product.images?.[0] || "";
11467
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
11851
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11468
11852
  const tags = product.tags || [];
11469
11853
  const isSignature = product.metadata?.is_signature === true;
11470
11854
  const isNew = product.metadata?.is_new === true;
@@ -11520,9 +11904,9 @@ function RetailProductCard({
11520
11904
  className
11521
11905
  }) {
11522
11906
  const image = product.image_url || product.images?.[0] || "";
11523
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
11907
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11524
11908
  const outOfStock = product.inventory_status?.in_stock === false;
11525
- const onSale = chunkPTPOQVXS_js.isOnSale(product);
11909
+ const onSale = chunkWMEC5JWN_js.isOnSale(product);
11526
11910
  const swatches = getColorSwatches(product);
11527
11911
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
11528
11912
  outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
@@ -11543,7 +11927,7 @@ function RetailProductCard({
11543
11927
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-xs text-muted-foreground line-through" })
11544
11928
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11545
11929
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
11546
- onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPTPOQVXS_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
11930
+ onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkWMEC5JWN_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" })
11547
11931
  ] }) }),
11548
11932
  swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
11549
11933
  "span",
@@ -11558,10 +11942,10 @@ function RetailProductCard({
11558
11942
  ] });
11559
11943
  }
11560
11944
  function PriceRange({ product, currency, className }) {
11561
- const resolvedCurrency = currency ?? chunkPTPOQVXS_js.getProductCurrency(product);
11562
- const range = chunkPTPOQVXS_js.getPriceRange(product);
11945
+ const resolvedCurrency = currency ?? chunkWMEC5JWN_js.getProductCurrency(product);
11946
+ const range = chunkWMEC5JWN_js.getPriceRange(product);
11563
11947
  if (!range) return null;
11564
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkPTPOQVXS_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
11948
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkWMEC5JWN_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
11565
11949
  }
11566
11950
  function WholesaleProductCard({
11567
11951
  product,
@@ -11571,7 +11955,7 @@ function WholesaleProductCard({
11571
11955
  className
11572
11956
  }) {
11573
11957
  const image = product.image_url || product.images?.[0] || "";
11574
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
11958
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11575
11959
  const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
11576
11960
  const status = product.inventory_status;
11577
11961
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
@@ -11619,7 +12003,7 @@ function DigitalProductCard({
11619
12003
  className
11620
12004
  }) {
11621
12005
  const image = product.image_url || product.images?.[0] || "";
11622
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12006
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11623
12007
  const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
11624
12008
  const isTicket = product.digital_type === "ticket";
11625
12009
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
@@ -11650,11 +12034,11 @@ function BundleProductCard({
11650
12034
  className
11651
12035
  }) {
11652
12036
  const image = product.image_url || product.images?.[0] || "";
11653
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12037
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11654
12038
  const components = product.components || [];
11655
12039
  const componentCount = components.length;
11656
- const onSale = chunkPTPOQVXS_js.isOnSale(product);
11657
- const discount = chunkPTPOQVXS_js.getDiscountPercentage(product);
12040
+ const onSale = chunkWMEC5JWN_js.isOnSale(product);
12041
+ const discount = chunkWMEC5JWN_js.getDiscountPercentage(product);
11658
12042
  const hasVariantChoice = components.some((c) => c.allow_variant_choice);
11659
12043
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
11660
12044
  /* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
@@ -11681,7 +12065,7 @@ function BundleProductCard({
11681
12065
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
11682
12066
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-sm font-bold" }),
11683
12067
  onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11684
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPTPOQVXS_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
12068
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkWMEC5JWN_js.getBasePrice(product), currency, className: "text-xs text-muted-foreground line-through" }),
11685
12069
  discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
11686
12070
  "Save ",
11687
12071
  discount,
@@ -11701,7 +12085,7 @@ function CompositeProductCard({
11701
12085
  className
11702
12086
  }) {
11703
12087
  const image = product.image_url || product.images?.[0] || "";
11704
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12088
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11705
12089
  const groups = product.groups || [];
11706
12090
  const groupCount = groups.length;
11707
12091
  groups.reduce((sum, g) => sum + g.components.length, 0);
@@ -11753,7 +12137,7 @@ function StandardServiceCard({
11753
12137
  className
11754
12138
  }) {
11755
12139
  const image = product.image_url || product.images?.[0] || "";
11756
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12140
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11757
12141
  const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
11758
12142
  return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
11759
12143
  /* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
@@ -11808,7 +12192,7 @@ function CompactServiceCard({
11808
12192
  className
11809
12193
  }) {
11810
12194
  const image = product.image_url || product.images?.[0] || "";
11811
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12195
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11812
12196
  const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
11813
12197
  const hasBillingPlans = product.billing_plans && product.billing_plans.length > 0;
11814
12198
  const href = `/products/${product.slug}`;
@@ -11857,7 +12241,7 @@ function ScheduleServiceCard({
11857
12241
  className
11858
12242
  }) {
11859
12243
  const image = product.image_url || product.images?.[0] || "";
11860
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12244
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11861
12245
  const href = `/products/${product.slug}`;
11862
12246
  const durationLabel = product.duration_minutes != null ? formatDuration2(product.duration_minutes, product.duration_unit) : null;
11863
12247
  const displaySlots = (slots || []).slice(0, 3);
@@ -11929,7 +12313,7 @@ function RentalServiceCard({
11929
12313
  className
11930
12314
  }) {
11931
12315
  const image = product.image_url || product.images?.[0] || "";
11932
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12316
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
11933
12317
  const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
11934
12318
  const unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "day";
11935
12319
  const priceUnit = product.price_basis === "per_person" ? "guest" : product.price_basis === "flat" ? "" : unit;
@@ -11999,7 +12383,7 @@ function AccommodationCard({
11999
12383
  className
12000
12384
  }) {
12001
12385
  const image = product.image_url || product.images?.[0] || "";
12002
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12386
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
12003
12387
  const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
12004
12388
  const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
12005
12389
  const tags = product.tags || [];
@@ -12065,7 +12449,7 @@ function LeaseServiceCard({
12065
12449
  className
12066
12450
  }) {
12067
12451
  const image = product.image_url || product.images?.[0] || "";
12068
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12452
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
12069
12453
  const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
12070
12454
  const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
12071
12455
  const unit = product.duration_unit ? UNIT_LABELS3[product.duration_unit] || product.duration_unit : "mo";
@@ -12139,7 +12523,7 @@ function SubscriptionCard({
12139
12523
  className
12140
12524
  }) {
12141
12525
  const image = product.image_url || product.images?.[0] || "";
12142
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
12526
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
12143
12527
  const plans = product.billing_plans || [];
12144
12528
  const primaryPlan = plans[0];
12145
12529
  const frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo";
@@ -12370,7 +12754,7 @@ function ProductCard({
12370
12754
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
12371
12755
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
12372
12756
  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 }),
12373
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunkPTPOQVXS_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
12757
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency: chunkWMEC5JWN_js.getProductCurrency(product), className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
12374
12758
  ] })
12375
12759
  ] });
12376
12760
  })();
@@ -12699,7 +13083,7 @@ function SearchInput({
12699
13083
  }
12700
13084
  ),
12701
13085
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
12702
- product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkPTPOQVXS_js.formatPrice(product.default_price) })
13086
+ product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkWMEC5JWN_js.formatPrice(product.default_price) })
12703
13087
  ] })
12704
13088
  },
12705
13089
  product.id
@@ -13194,19 +13578,19 @@ function OrderSummary({
13194
13578
  order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
13195
13579
  ] }),
13196
13580
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
13197
- order.total_discount != null && chunkPTPOQVXS_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
13581
+ order.total_discount != null && chunkWMEC5JWN_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
13198
13582
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
13199
13583
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
13200
13584
  ] }),
13201
- order.delivery_fee != null && chunkPTPOQVXS_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
13585
+ order.delivery_fee != null && chunkWMEC5JWN_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
13202
13586
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
13203
13587
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
13204
13588
  ] }),
13205
- order.service_charge != null && chunkPTPOQVXS_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
13589
+ order.service_charge != null && chunkWMEC5JWN_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
13206
13590
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
13207
13591
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
13208
13592
  ] }),
13209
- order.tax != null && chunkPTPOQVXS_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
13593
+ order.tax != null && chunkWMEC5JWN_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
13210
13594
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
13211
13595
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
13212
13596
  ] }),
@@ -13737,7 +14121,7 @@ function BookingPage({
13737
14121
  const hasStaffStep = staff && staff.length > 0;
13738
14122
  const depositType = product?.deposit_type;
13739
14123
  const depositAmount = product?.deposit_amount;
13740
- const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkPTPOQVXS_js.parsePrice(depositAmount) !== 0;
14124
+ const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkWMEC5JWN_js.parsePrice(depositAmount) !== 0;
13741
14125
  const cancellationMinutes = product?.cancellation_window_minutes;
13742
14126
  const noShowFee = product?.no_show_fee;
13743
14127
  const handleSlotSelect = React14.useCallback(
@@ -13870,14 +14254,14 @@ function BookingPage({
13870
14254
  service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price, currency }) }),
13871
14255
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
13872
14256
  "Deposit: ",
13873
- depositType === "percentage" ? `${chunkPTPOQVXS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
14257
+ depositType === "percentage" ? `${chunkWMEC5JWN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency })
13874
14258
  ] }),
13875
14259
  cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
13876
14260
  "Free cancellation up to ",
13877
14261
  cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
13878
14262
  " before"
13879
14263
  ] }),
13880
- noShowFee !== void 0 && chunkPTPOQVXS_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
14264
+ noShowFee !== void 0 && chunkWMEC5JWN_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
13881
14265
  "No-show fee: ",
13882
14266
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee, currency })
13883
14267
  ] })
@@ -13980,7 +14364,7 @@ function BookingPage({
13980
14364
  ] }),
13981
14365
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
13982
14366
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
13983
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkPTPOQVXS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
14367
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkWMEC5JWN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency }) })
13984
14368
  ] })
13985
14369
  ] }),
13986
14370
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -14654,9 +15038,9 @@ function DefaultProductLayout({
14654
15038
  }) {
14655
15039
  const [selectedVariantId, setSelectedVariantId] = React14__default.default.useState();
14656
15040
  const images = chunkQPRI2NII_js.resolveGallery(product, selectedVariantId);
14657
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15041
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
14658
15042
  const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
14659
- const onSale = chunkPTPOQVXS_js.isOnSale(product);
15043
+ const onSale = chunkWMEC5JWN_js.isOnSale(product);
14660
15044
  const hasPhysicalDetails = product.sku || product.vendor || product.material;
14661
15045
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
14662
15046
  renderBreadcrumb?.(product),
@@ -14679,13 +15063,13 @@ function DefaultProductLayout({
14679
15063
  /* @__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: [
14680
15064
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.price, currency, className: "text-2xl font-extrabold" }),
14681
15065
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.sale.original, currency, className: "text-lg text-muted-foreground line-through" }),
14682
- /* @__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(chunkPTPOQVXS_js.parsePrice(product.sale.percent_off))}% OFF` })
15066
+ /* @__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(chunkWMEC5JWN_js.parsePrice(product.sale.percent_off))}% OFF` })
14683
15067
  ] }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14684
15068
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-extrabold" }),
14685
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPTPOQVXS_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
15069
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkWMEC5JWN_js.getBasePrice(product), currency, className: "text-lg text-muted-foreground line-through" }),
14686
15070
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
14687
15071
  "Save ",
14688
- chunkPTPOQVXS_js.getDiscountPercentage(product),
15072
+ chunkWMEC5JWN_js.getDiscountPercentage(product),
14689
15073
  "%"
14690
15074
  ] })
14691
15075
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, currency, className: "text-2xl font-semibold" }) }),
@@ -14747,7 +15131,7 @@ function FoodProductLayout({
14747
15131
  className
14748
15132
  }) {
14749
15133
  const images = product.images || (product.image_url ? [product.image_url] : []);
14750
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15134
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
14751
15135
  const tags = product.tags || [];
14752
15136
  const ingredients = getMetadataStringList(product.metadata, "ingredients");
14753
15137
  const pairings = getMetadataStringList(product.metadata, "pairings");
@@ -14822,7 +15206,7 @@ function WholesaleProductLayout({
14822
15206
  className
14823
15207
  }) {
14824
15208
  const images = product.images || (product.image_url ? [product.image_url] : []);
14825
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15209
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
14826
15210
  const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
14827
15211
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
14828
15212
  renderBreadcrumb?.(product),
@@ -14906,9 +15290,9 @@ function ServiceProductLayout({
14906
15290
  className
14907
15291
  }) {
14908
15292
  const images = product.images || (product.image_url ? [product.image_url] : []);
14909
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15293
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
14910
15294
  const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
14911
- const depositAmount = hasDeposit ? chunkPTPOQVXS_js.parsePrice(product.deposit_amount) : 0;
15295
+ const depositAmount = hasDeposit ? chunkWMEC5JWN_js.parsePrice(product.deposit_amount) : 0;
14912
15296
  const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
14913
15297
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
14914
15298
  renderBreadcrumb?.(product),
@@ -14976,7 +15360,7 @@ function ServiceProductLayout({
14976
15360
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, currency, className: "font-medium text-foreground" }),
14977
15361
  " deposit charged at booking"
14978
15362
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14979
- chunkPTPOQVXS_js.parsePrice(product.deposit_amount),
15363
+ chunkWMEC5JWN_js.parsePrice(product.deposit_amount),
14980
15364
  "% deposit charged at booking"
14981
15365
  ] }) })
14982
15366
  ] })
@@ -15008,7 +15392,7 @@ function DigitalProductLayout({
15008
15392
  className
15009
15393
  }) {
15010
15394
  const images = product.images || (product.image_url ? [product.image_url] : []);
15011
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15395
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
15012
15396
  const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
15013
15397
  const isTicket = product.digital_type === "ticket";
15014
15398
  const isAccessPass = product.digital_type === "access_grant";
@@ -15135,15 +15519,15 @@ function BundleProductLayout({
15135
15519
  className
15136
15520
  }) {
15137
15521
  const images = product.images || (product.image_url ? [product.image_url] : []);
15138
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15522
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
15139
15523
  const components = product.components || [];
15140
- const onSale = chunkPTPOQVXS_js.isOnSale(product);
15141
- const discount = chunkPTPOQVXS_js.getDiscountPercentage(product);
15524
+ const onSale = chunkWMEC5JWN_js.isOnSale(product);
15525
+ const discount = chunkWMEC5JWN_js.getDiscountPercentage(product);
15142
15526
  const baseTotal = components.reduce(
15143
- (sum, c) => sum + chunkPTPOQVXS_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
15527
+ (sum, c) => sum + chunkWMEC5JWN_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
15144
15528
  0
15145
15529
  );
15146
- const bundlePrice = chunkPTPOQVXS_js.parsePrice(product.default_price);
15530
+ const bundlePrice = chunkWMEC5JWN_js.parsePrice(product.default_price);
15147
15531
  const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
15148
15532
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
15149
15533
  renderBreadcrumb?.(product),
@@ -15219,7 +15603,7 @@ function CompositeProductLayout({
15219
15603
  className
15220
15604
  }) {
15221
15605
  const images = product.images || (product.image_url ? [product.image_url] : []);
15222
- const currency = chunkPTPOQVXS_js.getProductCurrency(product);
15606
+ const currency = chunkWMEC5JWN_js.getProductCurrency(product);
15223
15607
  const groups = product.groups || [];
15224
15608
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "composite", className: cn("space-y-8", className), children: [
15225
15609
  renderBreadcrumb?.(product),
@@ -15642,7 +16026,7 @@ function CartDrawer({
15642
16026
  }) {
15643
16027
  const { isOpen, close } = useCartDrawer();
15644
16028
  const cart = useCart();
15645
- const subtotalNum = chunkPTPOQVXS_js.parsePrice(cart.subtotal);
16029
+ const subtotalNum = chunkWMEC5JWN_js.parsePrice(cart.subtotal);
15646
16030
  const animatedSubtotal = useAnimatedNumber(subtotalNum);
15647
16031
  React14.useEffect(() => {
15648
16032
  if (!isOpen) return;
@@ -16036,9 +16420,9 @@ function CatalogueCollectionLayout({
16036
16420
  result = result.filter((p) => p.tags?.includes(activeCategory));
16037
16421
  }
16038
16422
  if (sortBy === "price-asc") {
16039
- result = [...result].sort((a, b) => chunkPTPOQVXS_js.parsePrice(a.default_price) - chunkPTPOQVXS_js.parsePrice(b.default_price));
16423
+ result = [...result].sort((a, b) => chunkWMEC5JWN_js.parsePrice(a.default_price) - chunkWMEC5JWN_js.parsePrice(b.default_price));
16040
16424
  } else if (sortBy === "price-desc") {
16041
- result = [...result].sort((a, b) => chunkPTPOQVXS_js.parsePrice(b.default_price) - chunkPTPOQVXS_js.parsePrice(a.default_price));
16425
+ result = [...result].sort((a, b) => chunkWMEC5JWN_js.parsePrice(b.default_price) - chunkWMEC5JWN_js.parsePrice(a.default_price));
16042
16426
  } else if (sortBy === "name") {
16043
16427
  result = [...result].sort((a, b) => a.name.localeCompare(b.name));
16044
16428
  }
@@ -19567,7 +19951,7 @@ function toneChip(value) {
19567
19951
  }
19568
19952
  }
19569
19953
  function money(amount, currency) {
19570
- return chunkPTPOQVXS_js.formatPrice(chunkPTPOQVXS_js.parsePrice(num(amount) ?? 0), text(currency));
19954
+ return chunkWMEC5JWN_js.formatPrice(chunkWMEC5JWN_js.parsePrice(num(amount) ?? 0), text(currency));
19571
19955
  }
19572
19956
  var CHAT_GENUI_COMPONENTS = {
19573
19957
  Stack: ({ node, ctx }) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -19815,7 +20199,7 @@ function ReplyCardView({
19815
20199
  card.image_url && /* @__PURE__ */ jsxRuntime.jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
19816
20200
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
19817
20201
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
19818
- card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunkPTPOQVXS_js.formatPrice(chunkPTPOQVXS_js.parsePrice(card.price), currency ?? void 0) }),
20202
+ card.price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: chunkWMEC5JWN_js.formatPrice(chunkWMEC5JWN_js.parsePrice(card.price), currency ?? void 0) }),
19819
20203
  fire2 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
19820
20204
  ] })
19821
20205
  ]
@@ -19898,11 +20282,11 @@ function ChatWidget({
19898
20282
  if (!client) return;
19899
20283
  setAttachError(null);
19900
20284
  if (!file.type.startsWith("image/")) {
19901
- setAttachError(new chunkAETVRBKI_js.CimplifyError("invalid_attachment", "Only photos can be attached."));
20285
+ setAttachError(new chunkNIOUSKQQ_js.CimplifyError("invalid_attachment", "Only photos can be attached."));
19902
20286
  return;
19903
20287
  }
19904
20288
  if (file.size > MAX_ATTACHMENT_BYTES) {
19905
- setAttachError(new chunkAETVRBKI_js.CimplifyError("attachment_too_large", "Photos must be under 5MB."));
20289
+ setAttachError(new chunkNIOUSKQQ_js.CimplifyError("attachment_too_large", "Photos must be under 5MB."));
19906
20290
  return;
19907
20291
  }
19908
20292
  const uploaded = await client.uploads.upload(file);