@cimplify/sdk 0.20.0 → 0.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkAVVLN353_js = require('./chunk-AVVLN353.js');
5
- var chunkKSN3RJFL_js = require('./chunk-KSN3RJFL.js');
6
- var chunk2BSYTQAY_js = require('./chunk-2BSYTQAY.js');
4
+ var chunkWXFEO3LT_js = require('./chunk-WXFEO3LT.js');
5
+ var chunkUVBJDWIV_js = require('./chunk-UVBJDWIV.js');
6
+ var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
7
7
  var React3 = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var numberField = require('@base-ui/react/number-field');
@@ -379,7 +379,7 @@ function transformToCheckoutCart(cart, fx) {
379
379
  };
380
380
  }
381
381
  var CART_STORAGE_PREFIX = "cimplify:cart:v2";
382
- var DEFAULT_TAX_RATE = 0.08875;
382
+ var DEFAULT_TAX_RATE = 0;
383
383
  var cartStores = /* @__PURE__ */ new Map();
384
384
  function clearAllCartStores() {
385
385
  for (const [, store] of cartStores) {
@@ -447,13 +447,13 @@ function buildLineKey(productId, options) {
447
447
  return parts.join("|");
448
448
  }
449
449
  function calculateLineSubtotal(item) {
450
- let unitPrice = chunk2BSYTQAY_js.parsePrice(item.product.default_price);
450
+ let unitPrice = chunk64OCG2TJ_js.parsePrice(item.product.default_price);
451
451
  if (item.variant?.price_adjustment) {
452
- unitPrice += chunk2BSYTQAY_js.parsePrice(item.variant.price_adjustment);
452
+ unitPrice += chunk64OCG2TJ_js.parsePrice(item.variant.price_adjustment);
453
453
  }
454
454
  for (const option of item.addOnOptions || []) {
455
455
  if (option.default_price) {
456
- unitPrice += chunk2BSYTQAY_js.parsePrice(option.default_price);
456
+ unitPrice += chunk64OCG2TJ_js.parsePrice(option.default_price);
457
457
  }
458
458
  }
459
459
  return roundMoney(unitPrice * item.quantity);
@@ -1016,7 +1016,7 @@ var DEFAULT_COUNTRY = "US";
1016
1016
  function createDefaultClient() {
1017
1017
  const processRef = globalThis.process;
1018
1018
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1019
- return chunkAVVLN353_js.createCimplifyClient({ publicKey: envPublicKey });
1019
+ return chunkWXFEO3LT_js.createCimplifyClient({ publicKey: envPublicKey });
1020
1020
  }
1021
1021
  function getStoredLocationId() {
1022
1022
  if (typeof window === "undefined" || !window.localStorage) {
@@ -1099,7 +1099,7 @@ function CimplifyProvider({
1099
1099
  const setDisplayCurrency = React3.useCallback(
1100
1100
  (currency) => {
1101
1101
  const normalized = currency?.trim().toUpperCase() || null;
1102
- if (normalized && !chunk2BSYTQAY_js.isSupportedCurrency(normalized)) {
1102
+ if (normalized && !chunk64OCG2TJ_js.isSupportedCurrency(normalized)) {
1103
1103
  return;
1104
1104
  }
1105
1105
  setDisplayCurrencyOverride(normalized);
@@ -1661,7 +1661,7 @@ function Price({ amount, className, prefix }) {
1661
1661
  const { displayCurrency, convertPrice } = useCimplify();
1662
1662
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
1663
1663
  prefix,
1664
- chunk2BSYTQAY_js.formatPrice(convertPrice(amount), displayCurrency)
1664
+ chunk64OCG2TJ_js.formatPrice(convertPrice(amount), displayCurrency)
1665
1665
  ] });
1666
1666
  }
1667
1667
  var productsCache = /* @__PURE__ */ new Map();
@@ -1696,6 +1696,7 @@ function useProducts(options = {}) {
1696
1696
  const previousLocationIdRef = React3.useRef(locationId);
1697
1697
  const requestIdRef = React3.useRef(0);
1698
1698
  const tagsSignature = options.tags?.join(",") ?? "";
1699
+ const propertiesSignature = options.properties ? JSON.stringify(options.properties) : "";
1699
1700
  const queryOptions = React3.useMemo(
1700
1701
  () => ({
1701
1702
  category: options.category,
@@ -1725,7 +1726,7 @@ function useProducts(options = {}) {
1725
1726
  options.min_price,
1726
1727
  options.max_price,
1727
1728
  options.page,
1728
- options.properties
1729
+ propertiesSignature
1729
1730
  ]
1730
1731
  );
1731
1732
  const cacheKey = React3.useMemo(
@@ -3504,16 +3505,16 @@ function useProductPrice(input) {
3504
3505
  if (bundleTotalPrice != null) {
3505
3506
  unitPrice = bundleTotalPrice;
3506
3507
  } else if (compositePrice) {
3507
- unitPrice = chunk2BSYTQAY_js.parsePrice(compositePrice.final_price);
3508
+ unitPrice = chunk64OCG2TJ_js.parsePrice(compositePrice.final_price);
3508
3509
  } else {
3509
- unitPrice = chunk2BSYTQAY_js.parsePrice(product.default_price);
3510
+ unitPrice = chunk64OCG2TJ_js.parsePrice(product.default_price);
3510
3511
  if (variant?.price_adjustment) {
3511
- unitPrice += chunk2BSYTQAY_js.parsePrice(variant.price_adjustment);
3512
+ unitPrice += chunk64OCG2TJ_js.parsePrice(variant.price_adjustment);
3512
3513
  }
3513
3514
  if (addOnOptions) {
3514
3515
  for (const option of addOnOptions) {
3515
3516
  if (option.default_price) {
3516
- unitPrice += chunk2BSYTQAY_js.parsePrice(option.default_price);
3517
+ unitPrice += chunk64OCG2TJ_js.parsePrice(option.default_price);
3517
3518
  }
3518
3519
  }
3519
3520
  }
@@ -4750,19 +4751,19 @@ function AuthElement({
4750
4751
  }, [onReady, onAuthenticated, onRequiresOtp, onError]);
4751
4752
  React3.useEffect(() => {
4752
4753
  if (!elements || !containerRef.current) return;
4753
- const element = elements.create(chunkKSN3RJFL_js.ELEMENT_TYPES.AUTH, { prefillEmail });
4754
+ const element = elements.create(chunkUVBJDWIV_js.ELEMENT_TYPES.AUTH, { prefillEmail });
4754
4755
  elementRef.current = element;
4755
- element.on(chunkKSN3RJFL_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4756
+ element.on(chunkUVBJDWIV_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4756
4757
  element.on(
4757
- chunkKSN3RJFL_js.EVENT_TYPES.AUTHENTICATED,
4758
+ chunkUVBJDWIV_js.EVENT_TYPES.AUTHENTICATED,
4758
4759
  (data) => onAuthenticatedRef.current?.(data)
4759
4760
  );
4760
4761
  element.on(
4761
- chunkKSN3RJFL_js.EVENT_TYPES.REQUIRES_OTP,
4762
+ chunkUVBJDWIV_js.EVENT_TYPES.REQUIRES_OTP,
4762
4763
  (data) => onRequiresOtpRef.current?.(data)
4763
4764
  );
4764
4765
  element.on(
4765
- chunkKSN3RJFL_js.EVENT_TYPES.ERROR,
4766
+ chunkUVBJDWIV_js.EVENT_TYPES.ERROR,
4766
4767
  (data) => onErrorRef.current?.(data)
4767
4768
  );
4768
4769
  element.mount(containerRef.current);
@@ -4791,15 +4792,15 @@ function AddressElement({
4791
4792
  }, [onReady, onChange, onError]);
4792
4793
  React3.useEffect(() => {
4793
4794
  if (!elements || !containerRef.current) return;
4794
- const element = elements.create(chunkKSN3RJFL_js.ELEMENT_TYPES.ADDRESS, { mode });
4795
+ const element = elements.create(chunkUVBJDWIV_js.ELEMENT_TYPES.ADDRESS, { mode });
4795
4796
  elementRef.current = element;
4796
- element.on(chunkKSN3RJFL_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4797
+ element.on(chunkUVBJDWIV_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4797
4798
  element.on(
4798
- chunkKSN3RJFL_js.EVENT_TYPES.CHANGE,
4799
+ chunkUVBJDWIV_js.EVENT_TYPES.CHANGE,
4799
4800
  (data) => onChangeRef.current?.(data)
4800
4801
  );
4801
4802
  element.on(
4802
- chunkKSN3RJFL_js.EVENT_TYPES.ERROR,
4803
+ chunkUVBJDWIV_js.EVENT_TYPES.ERROR,
4803
4804
  (data) => onErrorRef.current?.(data)
4804
4805
  );
4805
4806
  element.mount(containerRef.current);
@@ -4829,15 +4830,15 @@ function PaymentElement({
4829
4830
  }, [onReady, onChange, onError]);
4830
4831
  React3.useEffect(() => {
4831
4832
  if (!elements || !containerRef.current) return;
4832
- const element = elements.create(chunkKSN3RJFL_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
4833
+ const element = elements.create(chunkUVBJDWIV_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
4833
4834
  elementRef.current = element;
4834
- element.on(chunkKSN3RJFL_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4835
+ element.on(chunkUVBJDWIV_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
4835
4836
  element.on(
4836
- chunkKSN3RJFL_js.EVENT_TYPES.CHANGE,
4837
+ chunkUVBJDWIV_js.EVENT_TYPES.CHANGE,
4837
4838
  (data) => onChangeRef.current?.(data)
4838
4839
  );
4839
4840
  element.on(
4840
- chunkKSN3RJFL_js.EVENT_TYPES.ERROR,
4841
+ chunkUVBJDWIV_js.EVENT_TYPES.ERROR,
4841
4842
  (data) => onErrorRef.current?.(data)
4842
4843
  );
4843
4844
  element.mount(containerRef.current);
@@ -4996,7 +4997,7 @@ function VariantSelector({
4996
4997
  if (!variants || variants.length <= 1) {
4997
4998
  return null;
4998
4999
  }
4999
- basePrice != null ? chunk2BSYTQAY_js.parsePrice(basePrice) : 0;
5000
+ basePrice != null ? chunk64OCG2TJ_js.parsePrice(basePrice) : 0;
5000
5001
  if (variantAxes && variantAxes.length > 0) {
5001
5002
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
5002
5003
  const labelId = `${idPrefix}-axis-${axis.id}`;
@@ -5072,7 +5073,7 @@ function VariantSelector({
5072
5073
  className: cn("divide-y divide-border", classNames?.list),
5073
5074
  children: variants.map((variant) => {
5074
5075
  const isSelected = selectedVariantId === variant.id;
5075
- const adjustment = chunk2BSYTQAY_js.parsePrice(variant.price_adjustment);
5076
+ const adjustment = chunk64OCG2TJ_js.parsePrice(variant.price_adjustment);
5076
5077
  return /* @__PURE__ */ jsxRuntime.jsxs(
5077
5078
  radio.Radio.Root,
5078
5079
  {
@@ -5100,7 +5101,7 @@ function VariantSelector({
5100
5101
  {
5101
5102
  "data-cimplify-variant-name": true,
5102
5103
  className: cn("flex-1 min-w-0 text-sm", classNames?.name),
5103
- children: chunkAVVLN353_js.getVariantDisplayName(variant, productName)
5104
+ children: chunkWXFEO3LT_js.getVariantDisplayName(variant, productName)
5104
5105
  }
5105
5106
  ),
5106
5107
  /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
@@ -5338,16 +5339,16 @@ function BundleSelector({
5338
5339
  }, [components, selections, onReady]);
5339
5340
  const totalPrice = React3.useMemo(() => {
5340
5341
  if (pricingType === "fixed" && bundlePrice) {
5341
- return chunk2BSYTQAY_js.parsePrice(bundlePrice);
5342
+ return chunk64OCG2TJ_js.parsePrice(bundlePrice);
5342
5343
  }
5343
5344
  const componentsTotal = components.reduce((sum, comp) => {
5344
5345
  return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
5345
5346
  }, 0);
5346
5347
  if (pricingType === "percentage_discount" && discountValue) {
5347
- return componentsTotal * (1 - chunk2BSYTQAY_js.parsePrice(discountValue) / 100);
5348
+ return componentsTotal * (1 - chunk64OCG2TJ_js.parsePrice(discountValue) / 100);
5348
5349
  }
5349
5350
  if (pricingType === "fixed_discount" && discountValue) {
5350
- return componentsTotal - chunk2BSYTQAY_js.parsePrice(discountValue);
5351
+ return componentsTotal - chunk64OCG2TJ_js.parsePrice(discountValue);
5351
5352
  }
5352
5353
  return componentsTotal;
5353
5354
  }, [components, variantChoices, pricingType, bundlePrice, discountValue]);
@@ -5408,15 +5409,15 @@ function BundleSelector({
5408
5409
  }
5409
5410
  function getComponentPrice(component, selectedVariantId) {
5410
5411
  if (!selectedVariantId || component.available_variants.length === 0) {
5411
- return chunk2BSYTQAY_js.parsePrice(component.effective_price);
5412
+ return chunk64OCG2TJ_js.parsePrice(component.effective_price);
5412
5413
  }
5413
5414
  if (selectedVariantId === component.variant_id) {
5414
- return chunk2BSYTQAY_js.parsePrice(component.effective_price);
5415
+ return chunk64OCG2TJ_js.parsePrice(component.effective_price);
5415
5416
  }
5416
5417
  const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
5417
5418
  const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
5418
- if (!selectedAdj) return chunk2BSYTQAY_js.parsePrice(component.effective_price);
5419
- return chunk2BSYTQAY_js.parsePrice(component.effective_price) - chunk2BSYTQAY_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk2BSYTQAY_js.parsePrice(selectedAdj.price_adjustment);
5419
+ if (!selectedAdj) return chunk64OCG2TJ_js.parsePrice(component.effective_price);
5420
+ return chunk64OCG2TJ_js.parsePrice(component.effective_price) - chunk64OCG2TJ_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk64OCG2TJ_js.parsePrice(selectedAdj.price_adjustment);
5420
5421
  }
5421
5422
  function formatDuration(minutes, unit) {
5422
5423
  if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
@@ -5529,7 +5530,7 @@ function BundleComponentCard({
5529
5530
  className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
5530
5531
  children: component.available_variants.map((variant) => {
5531
5532
  const isSelected = selectedVariantId === variant.id;
5532
- const adjustment = chunk2BSYTQAY_js.parsePrice(variant.price_adjustment);
5533
+ const adjustment = chunk64OCG2TJ_js.parsePrice(variant.price_adjustment);
5533
5534
  return /* @__PURE__ */ jsxRuntime.jsxs(
5534
5535
  radio.Radio.Root,
5535
5536
  {
@@ -5975,7 +5976,7 @@ function CompositeSelector({
5975
5976
  "data-cimplify-composite-summary": true,
5976
5977
  className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
5977
5978
  children: [
5978
- chunk2BSYTQAY_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
5979
+ chunk64OCG2TJ_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
5979
5980
  "div",
5980
5981
  {
5981
5982
  "data-cimplify-composite-summary-line": true,
@@ -5986,7 +5987,7 @@ function CompositeSelector({
5986
5987
  ]
5987
5988
  }
5988
5989
  ),
5989
- chunk2BSYTQAY_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
5990
+ chunk64OCG2TJ_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
5990
5991
  "div",
5991
5992
  {
5992
5993
  "data-cimplify-composite-summary-line": true,
@@ -6091,18 +6092,18 @@ function ProductCustomizer({
6091
6092
  }, [selectedAddOnOptionIds]);
6092
6093
  const localTotalPrice = React3.useMemo(() => {
6093
6094
  if (isComposite && compositePrice) {
6094
- return chunk2BSYTQAY_js.parsePrice(compositePrice.final_price) * quantity;
6095
+ return chunk64OCG2TJ_js.parsePrice(compositePrice.final_price) * quantity;
6095
6096
  }
6096
6097
  if (isBundle && bundleTotalPrice != null) {
6097
6098
  return bundleTotalPrice * quantity;
6098
6099
  }
6099
- let price = chunk2BSYTQAY_js.parsePrice(product.default_price);
6100
+ let price = chunk64OCG2TJ_js.parsePrice(product.default_price);
6100
6101
  if (selectedVariant?.price_adjustment) {
6101
- price += chunk2BSYTQAY_js.parsePrice(selectedVariant.price_adjustment);
6102
+ price += chunk64OCG2TJ_js.parsePrice(selectedVariant.price_adjustment);
6102
6103
  }
6103
6104
  for (const option of selectedAddOnOptions) {
6104
6105
  if (option.default_price) {
6105
- price += chunk2BSYTQAY_js.parsePrice(option.default_price);
6106
+ price += chunk64OCG2TJ_js.parsePrice(option.default_price);
6106
6107
  }
6107
6108
  }
6108
6109
  return price * quantity;
@@ -6143,7 +6144,7 @@ function ProductCustomizer({
6143
6144
  const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
6144
6145
  const perUnit = priceInfo.pre_tax_price;
6145
6146
  if (perUnit === void 0 || perUnit === null) return void 0;
6146
- return chunk2BSYTQAY_js.parsePrice(perUnit) * quantity;
6147
+ return chunk64OCG2TJ_js.parsePrice(perUnit) * quantity;
6147
6148
  }, [quote, quantity]);
6148
6149
  const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
6149
6150
  const handleVariantChange = React3.useCallback(
@@ -6235,7 +6236,7 @@ function ProductCustomizer({
6235
6236
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
6236
6237
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6237
6238
  "Deposit required: ",
6238
- chunk2BSYTQAY_js.parsePrice(product.deposit_amount),
6239
+ chunk64OCG2TJ_js.parsePrice(product.deposit_amount),
6239
6240
  "%"
6240
6241
  ] }) }),
6241
6242
  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(
@@ -6414,7 +6415,7 @@ function CartLineItemRow({
6414
6415
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, className: classNames?.item, children: [
6415
6416
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
6416
6417
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
6417
- item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkAVVLN353_js.getVariantDisplayName(item.variant, item.product.name) }),
6418
+ item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkWXFEO3LT_js.getVariantDisplayName(item.variant, item.product.name) }),
6418
6419
  item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
6419
6420
  "+ ",
6420
6421
  item.addOnOptions.map((opt) => opt.name).join(", ")
@@ -6536,15 +6537,15 @@ function CartSummary({
6536
6537
  ] }),
6537
6538
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal })
6538
6539
  ] }),
6539
- totalDiscounts != null && chunk2BSYTQAY_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
6540
+ totalDiscounts != null && chunk64OCG2TJ_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
6540
6541
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
6541
6542
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-" })
6542
6543
  ] }),
6543
6544
  deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: classNames?.deliveryFee, children: [
6544
6545
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
6545
- chunk2BSYTQAY_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
6546
+ chunk64OCG2TJ_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
6546
6547
  ] }),
6547
- serviceCharge != null && chunk2BSYTQAY_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
6548
+ serviceCharge != null && chunk64OCG2TJ_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
6548
6549
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
6549
6550
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge })
6550
6551
  ] }),
@@ -6627,16 +6628,16 @@ function SaleBadge({
6627
6628
  className,
6628
6629
  classNames
6629
6630
  }) {
6630
- const onSale = chunk2BSYTQAY_js.isOnSale(product);
6631
+ const onSale = chunk64OCG2TJ_js.isOnSale(product);
6631
6632
  const hasDeal = dealInfo !== void 0;
6632
6633
  if (!hasDeal && !onSale && !label) {
6633
6634
  return null;
6634
6635
  }
6635
6636
  let percentage = null;
6636
6637
  if (hasDeal && dealInfo.benefit_type === "percentage") {
6637
- percentage = chunk2BSYTQAY_js.parsePrice(dealInfo.value);
6638
+ percentage = chunk64OCG2TJ_js.parsePrice(dealInfo.value);
6638
6639
  } else if (onSale) {
6639
- percentage = chunk2BSYTQAY_js.getDiscountPercentage(product);
6640
+ percentage = chunk64OCG2TJ_js.getDiscountPercentage(product);
6640
6641
  }
6641
6642
  const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
6642
6643
  if (!badgeText) {
@@ -6655,7 +6656,7 @@ function SaleBadge({
6655
6656
  "%"
6656
6657
  ] }),
6657
6658
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
6658
- showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk2BSYTQAY_js.getBasePrice(product) }) })
6659
+ showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk64OCG2TJ_js.getBasePrice(product) }) })
6659
6660
  ]
6660
6661
  }
6661
6662
  );
@@ -7171,7 +7172,7 @@ function SearchInput({
7171
7172
  }
7172
7173
  ),
7173
7174
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
7174
- product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk2BSYTQAY_js.formatPrice(product.default_price) })
7175
+ product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk64OCG2TJ_js.formatPrice(product.default_price) })
7175
7176
  ] })
7176
7177
  },
7177
7178
  product.id
@@ -7662,19 +7663,19 @@ function OrderSummary({
7662
7663
  order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
7663
7664
  ] }),
7664
7665
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
7665
- order.total_discount != null && chunk2BSYTQAY_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
7666
+ order.total_discount != null && chunk64OCG2TJ_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
7666
7667
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
7667
7668
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
7668
7669
  ] }),
7669
- order.delivery_fee != null && chunk2BSYTQAY_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
7670
+ order.delivery_fee != null && chunk64OCG2TJ_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
7670
7671
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
7671
7672
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
7672
7673
  ] }),
7673
- order.service_charge != null && chunk2BSYTQAY_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
7674
+ order.service_charge != null && chunk64OCG2TJ_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
7674
7675
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
7675
7676
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
7676
7677
  ] }),
7677
- order.tax != null && chunk2BSYTQAY_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
7678
+ order.tax != null && chunk64OCG2TJ_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
7678
7679
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
7679
7680
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
7680
7681
  ] }),
@@ -9228,7 +9229,7 @@ function BookingPage({
9228
9229
  const hasStaffStep = staff && staff.length > 0;
9229
9230
  const depositType = product?.deposit_type;
9230
9231
  const depositAmount = product?.deposit_amount;
9231
- const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk2BSYTQAY_js.parsePrice(depositAmount) !== 0;
9232
+ const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk64OCG2TJ_js.parsePrice(depositAmount) !== 0;
9232
9233
  const cancellationMinutes = product?.cancellation_window_minutes;
9233
9234
  const noShowFee = product?.no_show_fee;
9234
9235
  const handleSlotSelect = React3.useCallback(
@@ -9342,14 +9343,14 @@ function BookingPage({
9342
9343
  service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
9343
9344
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
9344
9345
  "Deposit: ",
9345
- depositType === "percentage" ? `${chunk2BSYTQAY_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
9346
+ depositType === "percentage" ? `${chunk64OCG2TJ_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
9346
9347
  ] }),
9347
9348
  cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
9348
9349
  "Free cancellation up to ",
9349
9350
  cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
9350
9351
  " before"
9351
9352
  ] }),
9352
- noShowFee !== void 0 && chunk2BSYTQAY_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
9353
+ noShowFee !== void 0 && chunk64OCG2TJ_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
9353
9354
  "No-show fee: ",
9354
9355
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
9355
9356
  ] })
@@ -9411,7 +9412,7 @@ function BookingPage({
9411
9412
  ] }),
9412
9413
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
9413
9414
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
9414
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk2BSYTQAY_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
9415
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk64OCG2TJ_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
9415
9416
  ] })
9416
9417
  ] }),
9417
9418
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -9971,7 +9972,7 @@ function CurrencySelector({
9971
9972
 
9972
9973
  Object.defineProperty(exports, "getVariantDisplayName", {
9973
9974
  enumerable: true,
9974
- get: function () { return chunkAVVLN353_js.getVariantDisplayName; }
9975
+ get: function () { return chunkWXFEO3LT_js.getVariantDisplayName; }
9975
9976
  });
9976
9977
  exports.Ad = Ad;
9977
9978
  exports.AdProvider = AdProvider;
package/dist/react.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { getVariantDisplayName, createCimplifyClient } from './chunk-676BJ3EU.mjs';
3
- export { getVariantDisplayName } from './chunk-676BJ3EU.mjs';
4
- import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-7KH2XJIW.mjs';
5
- import { isSupportedCurrency, formatPrice, parsePrice, isOnSale, getDiscountPercentage, getBasePrice } from './chunk-HG7GG3TT.mjs';
2
+ import { getVariantDisplayName, createCimplifyClient } from './chunk-X23RNZAD.mjs';
3
+ export { getVariantDisplayName } from './chunk-X23RNZAD.mjs';
4
+ import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-VTMRPTQ7.mjs';
5
+ import { isSupportedCurrency, formatPrice, parsePrice, isOnSale, getDiscountPercentage, getBasePrice } from './chunk-JFT63H34.mjs';
6
6
  import React3, { createContext, useContext, useState, useEffect, useRef, useMemo, useSyncExternalStore, useCallback, useId } from 'react';
7
7
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
8
8
  import { NumberField } from '@base-ui/react/number-field';
@@ -374,7 +374,7 @@ function transformToCheckoutCart(cart, fx) {
374
374
  };
375
375
  }
376
376
  var CART_STORAGE_PREFIX = "cimplify:cart:v2";
377
- var DEFAULT_TAX_RATE = 0.08875;
377
+ var DEFAULT_TAX_RATE = 0;
378
378
  var cartStores = /* @__PURE__ */ new Map();
379
379
  function clearAllCartStores() {
380
380
  for (const [, store] of cartStores) {
@@ -1691,6 +1691,7 @@ function useProducts(options = {}) {
1691
1691
  const previousLocationIdRef = useRef(locationId);
1692
1692
  const requestIdRef = useRef(0);
1693
1693
  const tagsSignature = options.tags?.join(",") ?? "";
1694
+ const propertiesSignature = options.properties ? JSON.stringify(options.properties) : "";
1694
1695
  const queryOptions = useMemo(
1695
1696
  () => ({
1696
1697
  category: options.category,
@@ -1720,7 +1721,7 @@ function useProducts(options = {}) {
1720
1721
  options.min_price,
1721
1722
  options.max_price,
1722
1723
  options.page,
1723
- options.properties
1724
+ propertiesSignature
1724
1725
  ]
1725
1726
  );
1726
1727
  const cacheKey = useMemo(
package/dist/utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkS6TU55KP_js = require('./chunk-S6TU55KP.js');
4
- var chunk2BSYTQAY_js = require('./chunk-2BSYTQAY.js');
4
+ var chunk64OCG2TJ_js = require('./chunk-64OCG2TJ.js');
5
5
 
6
6
 
7
7
 
@@ -19,109 +19,109 @@ Object.defineProperty(exports, "resolvePhoneCountryCode", {
19
19
  });
20
20
  Object.defineProperty(exports, "CURRENCY_SYMBOLS", {
21
21
  enumerable: true,
22
- get: function () { return chunk2BSYTQAY_js.CURRENCY_SYMBOLS; }
22
+ get: function () { return chunk64OCG2TJ_js.CURRENCY_SYMBOLS; }
23
23
  });
24
24
  Object.defineProperty(exports, "MOBILE_MONEY_PROVIDERS", {
25
25
  enumerable: true,
26
- get: function () { return chunk2BSYTQAY_js.MOBILE_MONEY_PROVIDERS; }
26
+ get: function () { return chunk64OCG2TJ_js.MOBILE_MONEY_PROVIDERS; }
27
27
  });
28
28
  Object.defineProperty(exports, "categorizePaymentError", {
29
29
  enumerable: true,
30
- get: function () { return chunk2BSYTQAY_js.categorizePaymentError; }
30
+ get: function () { return chunk64OCG2TJ_js.categorizePaymentError; }
31
31
  });
32
32
  Object.defineProperty(exports, "detectMobileMoneyProvider", {
33
33
  enumerable: true,
34
- get: function () { return chunk2BSYTQAY_js.detectMobileMoneyProvider; }
34
+ get: function () { return chunk64OCG2TJ_js.detectMobileMoneyProvider; }
35
35
  });
36
36
  Object.defineProperty(exports, "formatMoney", {
37
37
  enumerable: true,
38
- get: function () { return chunk2BSYTQAY_js.formatMoney; }
38
+ get: function () { return chunk64OCG2TJ_js.formatMoney; }
39
39
  });
40
40
  Object.defineProperty(exports, "formatNumberCompact", {
41
41
  enumerable: true,
42
- get: function () { return chunk2BSYTQAY_js.formatNumberCompact; }
42
+ get: function () { return chunk64OCG2TJ_js.formatNumberCompact; }
43
43
  });
44
44
  Object.defineProperty(exports, "formatPrice", {
45
45
  enumerable: true,
46
- get: function () { return chunk2BSYTQAY_js.formatPrice; }
46
+ get: function () { return chunk64OCG2TJ_js.formatPrice; }
47
47
  });
48
48
  Object.defineProperty(exports, "formatPriceAdjustment", {
49
49
  enumerable: true,
50
- get: function () { return chunk2BSYTQAY_js.formatPriceAdjustment; }
50
+ get: function () { return chunk64OCG2TJ_js.formatPriceAdjustment; }
51
51
  });
52
52
  Object.defineProperty(exports, "formatPriceCompact", {
53
53
  enumerable: true,
54
- get: function () { return chunk2BSYTQAY_js.formatPriceCompact; }
54
+ get: function () { return chunk64OCG2TJ_js.formatPriceCompact; }
55
55
  });
56
56
  Object.defineProperty(exports, "formatPriceWithTax", {
57
57
  enumerable: true,
58
- get: function () { return chunk2BSYTQAY_js.formatPriceWithTax; }
58
+ get: function () { return chunk64OCG2TJ_js.formatPriceWithTax; }
59
59
  });
60
60
  Object.defineProperty(exports, "formatProductPrice", {
61
61
  enumerable: true,
62
- get: function () { return chunk2BSYTQAY_js.formatProductPrice; }
62
+ get: function () { return chunk64OCG2TJ_js.formatProductPrice; }
63
63
  });
64
64
  Object.defineProperty(exports, "getBasePrice", {
65
65
  enumerable: true,
66
- get: function () { return chunk2BSYTQAY_js.getBasePrice; }
66
+ get: function () { return chunk64OCG2TJ_js.getBasePrice; }
67
67
  });
68
68
  Object.defineProperty(exports, "getCurrencySymbol", {
69
69
  enumerable: true,
70
- get: function () { return chunk2BSYTQAY_js.getCurrencySymbol; }
70
+ get: function () { return chunk64OCG2TJ_js.getCurrencySymbol; }
71
71
  });
72
72
  Object.defineProperty(exports, "getDiscountPercentage", {
73
73
  enumerable: true,
74
- get: function () { return chunk2BSYTQAY_js.getDiscountPercentage; }
74
+ get: function () { return chunk64OCG2TJ_js.getDiscountPercentage; }
75
75
  });
76
76
  Object.defineProperty(exports, "getDisplayPrice", {
77
77
  enumerable: true,
78
- get: function () { return chunk2BSYTQAY_js.getDisplayPrice; }
78
+ get: function () { return chunk64OCG2TJ_js.getDisplayPrice; }
79
79
  });
80
80
  Object.defineProperty(exports, "getMarkupPercentage", {
81
81
  enumerable: true,
82
- get: function () { return chunk2BSYTQAY_js.getMarkupPercentage; }
82
+ get: function () { return chunk64OCG2TJ_js.getMarkupPercentage; }
83
83
  });
84
84
  Object.defineProperty(exports, "getProductCurrency", {
85
85
  enumerable: true,
86
- get: function () { return chunk2BSYTQAY_js.getProductCurrency; }
86
+ get: function () { return chunk64OCG2TJ_js.getProductCurrency; }
87
87
  });
88
88
  Object.defineProperty(exports, "getTaxAmount", {
89
89
  enumerable: true,
90
- get: function () { return chunk2BSYTQAY_js.getTaxAmount; }
90
+ get: function () { return chunk64OCG2TJ_js.getTaxAmount; }
91
91
  });
92
92
  Object.defineProperty(exports, "hasTaxInfo", {
93
93
  enumerable: true,
94
- get: function () { return chunk2BSYTQAY_js.hasTaxInfo; }
94
+ get: function () { return chunk64OCG2TJ_js.hasTaxInfo; }
95
95
  });
96
96
  Object.defineProperty(exports, "isOnSale", {
97
97
  enumerable: true,
98
- get: function () { return chunk2BSYTQAY_js.isOnSale; }
98
+ get: function () { return chunk64OCG2TJ_js.isOnSale; }
99
99
  });
100
100
  Object.defineProperty(exports, "isPaymentStatusFailure", {
101
101
  enumerable: true,
102
- get: function () { return chunk2BSYTQAY_js.isPaymentStatusFailure; }
102
+ get: function () { return chunk64OCG2TJ_js.isPaymentStatusFailure; }
103
103
  });
104
104
  Object.defineProperty(exports, "isPaymentStatusRequiresAction", {
105
105
  enumerable: true,
106
- get: function () { return chunk2BSYTQAY_js.isPaymentStatusRequiresAction; }
106
+ get: function () { return chunk64OCG2TJ_js.isPaymentStatusRequiresAction; }
107
107
  });
108
108
  Object.defineProperty(exports, "isPaymentStatusSuccess", {
109
109
  enumerable: true,
110
- get: function () { return chunk2BSYTQAY_js.isPaymentStatusSuccess; }
110
+ get: function () { return chunk64OCG2TJ_js.isPaymentStatusSuccess; }
111
111
  });
112
112
  Object.defineProperty(exports, "isTaxInclusive", {
113
113
  enumerable: true,
114
- get: function () { return chunk2BSYTQAY_js.isTaxInclusive; }
114
+ get: function () { return chunk64OCG2TJ_js.isTaxInclusive; }
115
115
  });
116
116
  Object.defineProperty(exports, "normalizePaymentResponse", {
117
117
  enumerable: true,
118
- get: function () { return chunk2BSYTQAY_js.normalizePaymentResponse; }
118
+ get: function () { return chunk64OCG2TJ_js.normalizePaymentResponse; }
119
119
  });
120
120
  Object.defineProperty(exports, "normalizeStatusResponse", {
121
121
  enumerable: true,
122
- get: function () { return chunk2BSYTQAY_js.normalizeStatusResponse; }
122
+ get: function () { return chunk64OCG2TJ_js.normalizeStatusResponse; }
123
123
  });
124
124
  Object.defineProperty(exports, "parsePrice", {
125
125
  enumerable: true,
126
- get: function () { return chunk2BSYTQAY_js.parsePrice; }
126
+ get: function () { return chunk64OCG2TJ_js.parsePrice; }
127
127
  });
package/dist/utils.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-WDIMISRC.mjs';
2
- export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, getTaxAmount, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice } from './chunk-HG7GG3TT.mjs';
2
+ export { CURRENCY_SYMBOLS, MOBILE_MONEY_PROVIDERS, categorizePaymentError, detectMobileMoneyProvider, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatPriceWithTax, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, getTaxAmount, hasTaxInfo, isOnSale, isPaymentStatusFailure, isPaymentStatusRequiresAction, isPaymentStatusSuccess, isTaxInclusive, normalizePaymentResponse, normalizeStatusResponse, parsePrice } from './chunk-JFT63H34.mjs';