@cimplify/sdk 0.22.3 → 0.22.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.js +21 -21
- package/dist/advanced.mjs +2 -2
- package/dist/{chunk-JFT63H34.mjs → chunk-4Z74TIJP.mjs} +4 -4
- package/dist/{chunk-64OCG2TJ.js → chunk-5FK7MDHS.js} +4 -4
- package/dist/{chunk-X7FRCS2Q.mjs → chunk-DNN5VN64.mjs} +15 -2
- package/dist/{chunk-7QQOYYEB.js → chunk-KLRTWBDF.js} +39 -39
- package/dist/{chunk-KBKAYGMI.mjs → chunk-Y2BD2XFJ.mjs} +2 -2
- package/dist/{chunk-RETQI2CJ.js → chunk-YMXFVI3N.js} +34 -21
- package/dist/index.js +98 -98
- package/dist/index.mjs +3 -3
- package/dist/react.js +63 -63
- package/dist/react.mjs +4 -4
- package/dist/utils.js +28 -28
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunkKLRTWBDF_js = require('./chunk-KLRTWBDF.js');
|
|
5
|
+
var chunkYMXFVI3N_js = require('./chunk-YMXFVI3N.js');
|
|
6
|
+
var chunk5FK7MDHS_js = require('./chunk-5FK7MDHS.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');
|
|
@@ -475,13 +475,13 @@ function buildLineKey(productId, options) {
|
|
|
475
475
|
return parts.join("|");
|
|
476
476
|
}
|
|
477
477
|
function calculateLineSubtotal(item) {
|
|
478
|
-
let unitPrice =
|
|
478
|
+
let unitPrice = chunk5FK7MDHS_js.parsePrice(item.product.default_price);
|
|
479
479
|
if (item.variant?.price_adjustment) {
|
|
480
|
-
unitPrice +=
|
|
480
|
+
unitPrice += chunk5FK7MDHS_js.parsePrice(item.variant.price_adjustment);
|
|
481
481
|
}
|
|
482
482
|
for (const option of item.addOnOptions || []) {
|
|
483
483
|
if (option.default_price) {
|
|
484
|
-
unitPrice +=
|
|
484
|
+
unitPrice += chunk5FK7MDHS_js.parsePrice(option.default_price);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
return roundMoney(unitPrice * item.quantity);
|
|
@@ -1061,7 +1061,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1061
1061
|
function createDefaultClient() {
|
|
1062
1062
|
const processRef = globalThis.process;
|
|
1063
1063
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1064
|
-
return
|
|
1064
|
+
return chunkKLRTWBDF_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1065
1065
|
}
|
|
1066
1066
|
function getStoredLocationId() {
|
|
1067
1067
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1144,7 +1144,7 @@ function CimplifyProvider({
|
|
|
1144
1144
|
const setDisplayCurrency = React3.useCallback(
|
|
1145
1145
|
(currency) => {
|
|
1146
1146
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1147
|
-
if (normalized && !
|
|
1147
|
+
if (normalized && !chunk5FK7MDHS_js.isSupportedCurrency(normalized)) {
|
|
1148
1148
|
return;
|
|
1149
1149
|
}
|
|
1150
1150
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -1706,7 +1706,7 @@ function Price({ amount, className, prefix }) {
|
|
|
1706
1706
|
const { displayCurrency, convertPrice } = useCimplify();
|
|
1707
1707
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
1708
1708
|
prefix,
|
|
1709
|
-
|
|
1709
|
+
chunk5FK7MDHS_js.formatPrice(convertPrice(amount), displayCurrency)
|
|
1710
1710
|
] });
|
|
1711
1711
|
}
|
|
1712
1712
|
function createCachedQuery(config) {
|
|
@@ -2713,16 +2713,16 @@ function useProductPrice(input) {
|
|
|
2713
2713
|
if (bundleTotalPrice != null) {
|
|
2714
2714
|
unitPrice = bundleTotalPrice;
|
|
2715
2715
|
} else if (compositePrice) {
|
|
2716
|
-
unitPrice =
|
|
2716
|
+
unitPrice = chunk5FK7MDHS_js.parsePrice(compositePrice.final_price);
|
|
2717
2717
|
} else {
|
|
2718
|
-
unitPrice =
|
|
2718
|
+
unitPrice = chunk5FK7MDHS_js.parsePrice(product.default_price);
|
|
2719
2719
|
if (variant?.price_adjustment) {
|
|
2720
|
-
unitPrice +=
|
|
2720
|
+
unitPrice += chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
|
|
2721
2721
|
}
|
|
2722
2722
|
if (addOnOptions) {
|
|
2723
2723
|
for (const option of addOnOptions) {
|
|
2724
2724
|
if (option.default_price) {
|
|
2725
|
-
unitPrice +=
|
|
2725
|
+
unitPrice += chunk5FK7MDHS_js.parsePrice(option.default_price);
|
|
2726
2726
|
}
|
|
2727
2727
|
}
|
|
2728
2728
|
}
|
|
@@ -3212,19 +3212,19 @@ function AuthElement({
|
|
|
3212
3212
|
}, [onReady, onAuthenticated, onRequiresOtp, onError]);
|
|
3213
3213
|
React3.useEffect(() => {
|
|
3214
3214
|
if (!elements || !containerRef.current) return;
|
|
3215
|
-
const element = elements.create(
|
|
3215
|
+
const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
3216
3216
|
elementRef.current = element;
|
|
3217
|
-
element.on(
|
|
3217
|
+
element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3218
3218
|
element.on(
|
|
3219
|
-
|
|
3219
|
+
chunkYMXFVI3N_js.EVENT_TYPES.AUTHENTICATED,
|
|
3220
3220
|
(data) => onAuthenticatedRef.current?.(data)
|
|
3221
3221
|
);
|
|
3222
3222
|
element.on(
|
|
3223
|
-
|
|
3223
|
+
chunkYMXFVI3N_js.EVENT_TYPES.REQUIRES_OTP,
|
|
3224
3224
|
(data) => onRequiresOtpRef.current?.(data)
|
|
3225
3225
|
);
|
|
3226
3226
|
element.on(
|
|
3227
|
-
|
|
3227
|
+
chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
|
|
3228
3228
|
(data) => onErrorRef.current?.(data)
|
|
3229
3229
|
);
|
|
3230
3230
|
element.mount(containerRef.current);
|
|
@@ -3253,15 +3253,15 @@ function AddressElement({
|
|
|
3253
3253
|
}, [onReady, onChange, onError]);
|
|
3254
3254
|
React3.useEffect(() => {
|
|
3255
3255
|
if (!elements || !containerRef.current) return;
|
|
3256
|
-
const element = elements.create(
|
|
3256
|
+
const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
3257
3257
|
elementRef.current = element;
|
|
3258
|
-
element.on(
|
|
3258
|
+
element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3259
3259
|
element.on(
|
|
3260
|
-
|
|
3260
|
+
chunkYMXFVI3N_js.EVENT_TYPES.CHANGE,
|
|
3261
3261
|
(data) => onChangeRef.current?.(data)
|
|
3262
3262
|
);
|
|
3263
3263
|
element.on(
|
|
3264
|
-
|
|
3264
|
+
chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
|
|
3265
3265
|
(data) => onErrorRef.current?.(data)
|
|
3266
3266
|
);
|
|
3267
3267
|
element.mount(containerRef.current);
|
|
@@ -3291,15 +3291,15 @@ function PaymentElement({
|
|
|
3291
3291
|
}, [onReady, onChange, onError]);
|
|
3292
3292
|
React3.useEffect(() => {
|
|
3293
3293
|
if (!elements || !containerRef.current) return;
|
|
3294
|
-
const element = elements.create(
|
|
3294
|
+
const element = elements.create(chunkYMXFVI3N_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
3295
3295
|
elementRef.current = element;
|
|
3296
|
-
element.on(
|
|
3296
|
+
element.on(chunkYMXFVI3N_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3297
3297
|
element.on(
|
|
3298
|
-
|
|
3298
|
+
chunkYMXFVI3N_js.EVENT_TYPES.CHANGE,
|
|
3299
3299
|
(data) => onChangeRef.current?.(data)
|
|
3300
3300
|
);
|
|
3301
3301
|
element.on(
|
|
3302
|
-
|
|
3302
|
+
chunkYMXFVI3N_js.EVENT_TYPES.ERROR,
|
|
3303
3303
|
(data) => onErrorRef.current?.(data)
|
|
3304
3304
|
);
|
|
3305
3305
|
element.mount(containerRef.current);
|
|
@@ -3458,7 +3458,7 @@ function VariantSelector({
|
|
|
3458
3458
|
if (!variants || variants.length <= 1) {
|
|
3459
3459
|
return null;
|
|
3460
3460
|
}
|
|
3461
|
-
basePrice != null ?
|
|
3461
|
+
basePrice != null ? chunk5FK7MDHS_js.parsePrice(basePrice) : 0;
|
|
3462
3462
|
if (variantAxes && variantAxes.length > 0) {
|
|
3463
3463
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
3464
3464
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -3534,7 +3534,7 @@ function VariantSelector({
|
|
|
3534
3534
|
className: cn("divide-y divide-border", classNames?.list),
|
|
3535
3535
|
children: variants.map((variant) => {
|
|
3536
3536
|
const isSelected = selectedVariantId === variant.id;
|
|
3537
|
-
const adjustment =
|
|
3537
|
+
const adjustment = chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
|
|
3538
3538
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3539
3539
|
radio.Radio.Root,
|
|
3540
3540
|
{
|
|
@@ -3562,7 +3562,7 @@ function VariantSelector({
|
|
|
3562
3562
|
{
|
|
3563
3563
|
"data-cimplify-variant-name": true,
|
|
3564
3564
|
className: cn("flex-1 min-w-0 text-sm", classNames?.name),
|
|
3565
|
-
children:
|
|
3565
|
+
children: chunkKLRTWBDF_js.getVariantDisplayName(variant, productName)
|
|
3566
3566
|
}
|
|
3567
3567
|
),
|
|
3568
3568
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
|
|
@@ -3800,16 +3800,16 @@ function BundleSelector({
|
|
|
3800
3800
|
}, [components, selections, onReady]);
|
|
3801
3801
|
const totalPrice = React3.useMemo(() => {
|
|
3802
3802
|
if (pricingType === "fixed" && bundlePrice) {
|
|
3803
|
-
return
|
|
3803
|
+
return chunk5FK7MDHS_js.parsePrice(bundlePrice);
|
|
3804
3804
|
}
|
|
3805
3805
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
3806
3806
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
3807
3807
|
}, 0);
|
|
3808
3808
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
3809
|
-
return componentsTotal * (1 -
|
|
3809
|
+
return componentsTotal * (1 - chunk5FK7MDHS_js.parsePrice(discountValue) / 100);
|
|
3810
3810
|
}
|
|
3811
3811
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
3812
|
-
return componentsTotal -
|
|
3812
|
+
return componentsTotal - chunk5FK7MDHS_js.parsePrice(discountValue);
|
|
3813
3813
|
}
|
|
3814
3814
|
return componentsTotal;
|
|
3815
3815
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -3870,15 +3870,15 @@ function BundleSelector({
|
|
|
3870
3870
|
}
|
|
3871
3871
|
function getComponentPrice(component, selectedVariantId) {
|
|
3872
3872
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
3873
|
-
return
|
|
3873
|
+
return chunk5FK7MDHS_js.parsePrice(component.effective_price);
|
|
3874
3874
|
}
|
|
3875
3875
|
if (selectedVariantId === component.variant_id) {
|
|
3876
|
-
return
|
|
3876
|
+
return chunk5FK7MDHS_js.parsePrice(component.effective_price);
|
|
3877
3877
|
}
|
|
3878
3878
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
3879
3879
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
3880
|
-
if (!selectedAdj) return
|
|
3881
|
-
return
|
|
3880
|
+
if (!selectedAdj) return chunk5FK7MDHS_js.parsePrice(component.effective_price);
|
|
3881
|
+
return chunk5FK7MDHS_js.parsePrice(component.effective_price) - chunk5FK7MDHS_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk5FK7MDHS_js.parsePrice(selectedAdj.price_adjustment);
|
|
3882
3882
|
}
|
|
3883
3883
|
function formatDuration(minutes, unit) {
|
|
3884
3884
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -3991,7 +3991,7 @@ function BundleComponentCard({
|
|
|
3991
3991
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
3992
3992
|
children: component.available_variants.map((variant) => {
|
|
3993
3993
|
const isSelected = selectedVariantId === variant.id;
|
|
3994
|
-
const adjustment =
|
|
3994
|
+
const adjustment = chunk5FK7MDHS_js.parsePrice(variant.price_adjustment);
|
|
3995
3995
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3996
3996
|
radio.Radio.Root,
|
|
3997
3997
|
{
|
|
@@ -4437,7 +4437,7 @@ function CompositeSelector({
|
|
|
4437
4437
|
"data-cimplify-composite-summary": true,
|
|
4438
4438
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
4439
4439
|
children: [
|
|
4440
|
-
|
|
4440
|
+
chunk5FK7MDHS_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4441
4441
|
"div",
|
|
4442
4442
|
{
|
|
4443
4443
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -4448,7 +4448,7 @@ function CompositeSelector({
|
|
|
4448
4448
|
]
|
|
4449
4449
|
}
|
|
4450
4450
|
),
|
|
4451
|
-
|
|
4451
|
+
chunk5FK7MDHS_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4452
4452
|
"div",
|
|
4453
4453
|
{
|
|
4454
4454
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -4553,18 +4553,18 @@ function ProductCustomizer({
|
|
|
4553
4553
|
}, [selectedAddOnOptionIds]);
|
|
4554
4554
|
const localTotalPrice = React3.useMemo(() => {
|
|
4555
4555
|
if (isComposite && compositePrice) {
|
|
4556
|
-
return
|
|
4556
|
+
return chunk5FK7MDHS_js.parsePrice(compositePrice.final_price) * quantity;
|
|
4557
4557
|
}
|
|
4558
4558
|
if (isBundle && bundleTotalPrice != null) {
|
|
4559
4559
|
return bundleTotalPrice * quantity;
|
|
4560
4560
|
}
|
|
4561
|
-
let price =
|
|
4561
|
+
let price = chunk5FK7MDHS_js.parsePrice(product.default_price);
|
|
4562
4562
|
if (selectedVariant?.price_adjustment) {
|
|
4563
|
-
price +=
|
|
4563
|
+
price += chunk5FK7MDHS_js.parsePrice(selectedVariant.price_adjustment);
|
|
4564
4564
|
}
|
|
4565
4565
|
for (const option of selectedAddOnOptions) {
|
|
4566
4566
|
if (option.default_price) {
|
|
4567
|
-
price +=
|
|
4567
|
+
price += chunk5FK7MDHS_js.parsePrice(option.default_price);
|
|
4568
4568
|
}
|
|
4569
4569
|
}
|
|
4570
4570
|
return price * quantity;
|
|
@@ -4605,7 +4605,7 @@ function ProductCustomizer({
|
|
|
4605
4605
|
const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
|
|
4606
4606
|
const perUnit = priceInfo.pre_tax_price;
|
|
4607
4607
|
if (perUnit === void 0 || perUnit === null) return void 0;
|
|
4608
|
-
return
|
|
4608
|
+
return chunk5FK7MDHS_js.parsePrice(perUnit) * quantity;
|
|
4609
4609
|
}, [quote, quantity]);
|
|
4610
4610
|
const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
|
|
4611
4611
|
const handleVariantChange = React3.useCallback(
|
|
@@ -4697,7 +4697,7 @@ function ProductCustomizer({
|
|
|
4697
4697
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
|
|
4698
4698
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4699
4699
|
"Deposit required: ",
|
|
4700
|
-
|
|
4700
|
+
chunk5FK7MDHS_js.parsePrice(product.deposit_amount),
|
|
4701
4701
|
"%"
|
|
4702
4702
|
] }) }),
|
|
4703
4703
|
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(
|
|
@@ -4876,7 +4876,7 @@ function CartLineItemRow({
|
|
|
4876
4876
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, className: classNames?.item, children: [
|
|
4877
4877
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
|
|
4878
4878
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
|
|
4879
|
-
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children:
|
|
4879
|
+
item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkKLRTWBDF_js.getVariantDisplayName(item.variant, item.product.name) }),
|
|
4880
4880
|
item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
|
|
4881
4881
|
"+ ",
|
|
4882
4882
|
item.addOnOptions.map((opt) => opt.name).join(", ")
|
|
@@ -4998,15 +4998,15 @@ function CartSummary({
|
|
|
4998
4998
|
] }),
|
|
4999
4999
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal })
|
|
5000
5000
|
] }),
|
|
5001
|
-
totalDiscounts != null &&
|
|
5001
|
+
totalDiscounts != null && chunk5FK7MDHS_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
|
|
5002
5002
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
5003
5003
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-" })
|
|
5004
5004
|
] }),
|
|
5005
5005
|
deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: classNames?.deliveryFee, children: [
|
|
5006
5006
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
5007
|
-
|
|
5007
|
+
chunk5FK7MDHS_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
|
|
5008
5008
|
] }),
|
|
5009
|
-
serviceCharge != null &&
|
|
5009
|
+
serviceCharge != null && chunk5FK7MDHS_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
|
|
5010
5010
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
5011
5011
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge })
|
|
5012
5012
|
] }),
|
|
@@ -5089,16 +5089,16 @@ function SaleBadge({
|
|
|
5089
5089
|
className,
|
|
5090
5090
|
classNames
|
|
5091
5091
|
}) {
|
|
5092
|
-
const onSale =
|
|
5092
|
+
const onSale = chunk5FK7MDHS_js.isOnSale(product);
|
|
5093
5093
|
const hasDeal = dealInfo !== void 0;
|
|
5094
5094
|
if (!hasDeal && !onSale && !label) {
|
|
5095
5095
|
return null;
|
|
5096
5096
|
}
|
|
5097
5097
|
let percentage = null;
|
|
5098
5098
|
if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
5099
|
-
percentage =
|
|
5099
|
+
percentage = chunk5FK7MDHS_js.parsePrice(dealInfo.value);
|
|
5100
5100
|
} else if (onSale) {
|
|
5101
|
-
percentage =
|
|
5101
|
+
percentage = chunk5FK7MDHS_js.getDiscountPercentage(product);
|
|
5102
5102
|
}
|
|
5103
5103
|
const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
5104
5104
|
if (!badgeText) {
|
|
@@ -5117,7 +5117,7 @@ function SaleBadge({
|
|
|
5117
5117
|
"%"
|
|
5118
5118
|
] }),
|
|
5119
5119
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
5120
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
5120
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk5FK7MDHS_js.getBasePrice(product) }) })
|
|
5121
5121
|
]
|
|
5122
5122
|
}
|
|
5123
5123
|
);
|
|
@@ -5623,7 +5623,7 @@ function SearchInput({
|
|
|
5623
5623
|
}
|
|
5624
5624
|
),
|
|
5625
5625
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
5626
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
5626
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk5FK7MDHS_js.formatPrice(product.default_price) })
|
|
5627
5627
|
] })
|
|
5628
5628
|
},
|
|
5629
5629
|
product.id
|
|
@@ -6117,19 +6117,19 @@ function OrderSummary({
|
|
|
6117
6117
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
6118
6118
|
] }),
|
|
6119
6119
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
6120
|
-
order.total_discount != null &&
|
|
6120
|
+
order.total_discount != null && chunk5FK7MDHS_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
6121
6121
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
6122
6122
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
6123
6123
|
] }),
|
|
6124
|
-
order.delivery_fee != null &&
|
|
6124
|
+
order.delivery_fee != null && chunk5FK7MDHS_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
6125
6125
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
6126
6126
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
6127
6127
|
] }),
|
|
6128
|
-
order.service_charge != null &&
|
|
6128
|
+
order.service_charge != null && chunk5FK7MDHS_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
6129
6129
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
6130
6130
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
6131
6131
|
] }),
|
|
6132
|
-
order.tax != null &&
|
|
6132
|
+
order.tax != null && chunk5FK7MDHS_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
6133
6133
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
6134
6134
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
6135
6135
|
] }),
|
|
@@ -7825,7 +7825,7 @@ function BookingPage({
|
|
|
7825
7825
|
const hasStaffStep = staff && staff.length > 0;
|
|
7826
7826
|
const depositType = product?.deposit_type;
|
|
7827
7827
|
const depositAmount = product?.deposit_amount;
|
|
7828
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
7828
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk5FK7MDHS_js.parsePrice(depositAmount) !== 0;
|
|
7829
7829
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
7830
7830
|
const noShowFee = product?.no_show_fee;
|
|
7831
7831
|
const handleSlotSelect = React3.useCallback(
|
|
@@ -7957,14 +7957,14 @@ function BookingPage({
|
|
|
7957
7957
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
|
|
7958
7958
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
7959
7959
|
"Deposit: ",
|
|
7960
|
-
depositType === "percentage" ? `${
|
|
7960
|
+
depositType === "percentage" ? `${chunk5FK7MDHS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
|
|
7961
7961
|
] }),
|
|
7962
7962
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
7963
7963
|
"Free cancellation up to ",
|
|
7964
7964
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
7965
7965
|
" before"
|
|
7966
7966
|
] }),
|
|
7967
|
-
noShowFee !== void 0 &&
|
|
7967
|
+
noShowFee !== void 0 && chunk5FK7MDHS_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
7968
7968
|
"No-show fee: ",
|
|
7969
7969
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
|
|
7970
7970
|
] })
|
|
@@ -8041,7 +8041,7 @@ function BookingPage({
|
|
|
8041
8041
|
] }),
|
|
8042
8042
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
8043
8043
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
8044
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
8044
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk5FK7MDHS_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
|
|
8045
8045
|
] })
|
|
8046
8046
|
] }),
|
|
8047
8047
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8601,7 +8601,7 @@ function CurrencySelector({
|
|
|
8601
8601
|
|
|
8602
8602
|
Object.defineProperty(exports, "getVariantDisplayName", {
|
|
8603
8603
|
enumerable: true,
|
|
8604
|
-
get: function () { return
|
|
8604
|
+
get: function () { return chunkKLRTWBDF_js.getVariantDisplayName; }
|
|
8605
8605
|
});
|
|
8606
8606
|
exports.Ad = Ad;
|
|
8607
8607
|
exports.AdProvider = AdProvider;
|
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getVariantDisplayName, createCimplifyClient } from './chunk-
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
4
|
-
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-
|
|
5
|
-
import { isSupportedCurrency, formatPrice, parsePrice, isOnSale, getDiscountPercentage, getBasePrice } from './chunk-
|
|
2
|
+
import { getVariantDisplayName, createCimplifyClient } from './chunk-Y2BD2XFJ.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-Y2BD2XFJ.mjs';
|
|
4
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-DNN5VN64.mjs';
|
|
5
|
+
import { isSupportedCurrency, formatPrice, parsePrice, isOnSale, getDiscountPercentage, getBasePrice } from './chunk-4Z74TIJP.mjs';
|
|
6
6
|
import React3, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useSyncExternalStore, useId } from 'react';
|
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { NumberField } from '@base-ui/react/number-field';
|
package/dist/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkL5GKVQVJ_js = require('./chunk-L5GKVQVJ.js');
|
|
4
|
-
var
|
|
4
|
+
var chunk5FK7MDHS_js = require('./chunk-5FK7MDHS.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
|
|
22
|
+
get: function () { return chunk5FK7MDHS_js.CURRENCY_SYMBOLS; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "MOBILE_MONEY_PROVIDERS", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk5FK7MDHS_js.MOBILE_MONEY_PROVIDERS; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "categorizePaymentError", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk5FK7MDHS_js.categorizePaymentError; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "detectMobileMoneyProvider", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk5FK7MDHS_js.detectMobileMoneyProvider; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "formatMoney", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk5FK7MDHS_js.formatMoney; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "formatNumberCompact", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk5FK7MDHS_js.formatNumberCompact; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "formatPrice", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk5FK7MDHS_js.formatPrice; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "formatPriceAdjustment", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk5FK7MDHS_js.formatPriceAdjustment; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "formatPriceCompact", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk5FK7MDHS_js.formatPriceCompact; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "formatPriceWithTax", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunk5FK7MDHS_js.formatPriceWithTax; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "formatProductPrice", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunk5FK7MDHS_js.formatProductPrice; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "getBasePrice", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunk5FK7MDHS_js.getBasePrice; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "getCurrencySymbol", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunk5FK7MDHS_js.getCurrencySymbol; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "getDiscountPercentage", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunk5FK7MDHS_js.getDiscountPercentage; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "getDisplayPrice", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunk5FK7MDHS_js.getDisplayPrice; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "getMarkupPercentage", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk5FK7MDHS_js.getMarkupPercentage; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "getProductCurrency", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunk5FK7MDHS_js.getProductCurrency; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "getTaxAmount", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunk5FK7MDHS_js.getTaxAmount; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "hasTaxInfo", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunk5FK7MDHS_js.hasTaxInfo; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "isOnSale", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunk5FK7MDHS_js.isOnSale; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "isPaymentStatusFailure", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunk5FK7MDHS_js.isPaymentStatusFailure; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "isPaymentStatusRequiresAction", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunk5FK7MDHS_js.isPaymentStatusRequiresAction; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "isPaymentStatusSuccess", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunk5FK7MDHS_js.isPaymentStatusSuccess; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "isTaxInclusive", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunk5FK7MDHS_js.isTaxInclusive; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "normalizePaymentResponse", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunk5FK7MDHS_js.normalizePaymentResponse; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "normalizeStatusResponse", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunk5FK7MDHS_js.normalizeStatusResponse; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "parsePrice", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunk5FK7MDHS_js.parsePrice; }
|
|
127
127
|
});
|
package/dist/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { isValidPhoneForContext, normalizePhoneToE164, resolvePhoneCountryCode } from './chunk-YOIVZ6OA.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-
|
|
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-4Z74TIJP.mjs';
|