@cimplify/sdk 0.46.1 → 0.46.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.d.mts +3 -3
- package/dist/advanced.d.ts +3 -3
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{chunk-5LZNTG4V.mjs → chunk-632JEJUS.mjs} +1 -1
- package/dist/{chunk-AUS4B7PA.mjs → chunk-6HYKWYUF.mjs} +2 -2
- package/dist/{chunk-Z3CHDA24.js → chunk-6RP6OPYO.js} +3 -3
- package/dist/{chunk-6V67MAWO.js → chunk-7ZACMER7.js} +22 -22
- package/dist/{chunk-UJ5BBLKL.mjs → chunk-CKRMA5F7.mjs} +2 -2
- package/dist/{chunk-4KNCSWE4.js → chunk-GEWFWQYK.js} +234 -234
- package/dist/{chunk-DETRNWHF.js → chunk-TKOTACKZ.js} +22 -0
- package/dist/{chunk-NKZ5YN5D.js → chunk-TW4OFRWV.js} +4 -4
- package/dist/{chunk-7H2DYO4T.mjs → chunk-WUIERJ6J.mjs} +2 -2
- package/dist/{chunk-7RRVM2X2.mjs → chunk-XY2DFX5K.mjs} +1 -1
- package/dist/{chunk-3HXYEK5K.mjs → chunk-Z2AYLZDF.mjs} +21 -1
- package/dist/{chunk-HNPVZGTO.js → chunk-Z2MLAIID.js} +60 -60
- package/dist/{client-D7nI2XmP.d.ts → client-B76ZNW5r.d.ts} +2 -2
- package/dist/{client-BScRT1Rz.d.mts → client-CT9NwIDX.d.mts} +2 -2
- package/dist/{client-DyrpQRza.d.mts → client-G2WCoxv2.d.mts} +2 -2
- package/dist/{client-B9r5rH3O.d.ts → client-QVINYu1X.d.ts} +2 -2
- package/dist/{index-DC_ZcSgO.d.ts → index-BAohYhdg.d.ts} +3 -3
- package/dist/{index-3C9J8Wb-.d.mts → index-Bo0NjgR6.d.mts} +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +115 -107
- package/dist/index.mjs +4 -4
- package/dist/mock/cli.mjs +2 -0
- package/dist/mock/library.js +2 -0
- package/dist/mock/library.mjs +2 -0
- package/dist/mock/msw.js +2 -0
- package/dist/mock/msw.mjs +2 -0
- package/dist/{payment-Bse2XJ-c.d.mts → payment-9L_-GWqQ.d.mts} +1 -1
- package/dist/{payment-JcNqOf_T.d.ts → payment-_e99nSRj.d.ts} +1 -1
- package/dist/{price-YBGk5seG.d.mts → price-BjehlIhG.d.mts} +1 -1
- package/dist/{price-mHkRncgW.d.ts → price-CWQ5TQmk.d.ts} +1 -1
- package/dist/{product-DiX-HGkT.d.ts → product-C-xLzh7Q.d.mts} +16 -1
- package/dist/{product-DiX-HGkT.d.mts → product-C-xLzh7Q.d.ts} +16 -1
- package/dist/react.d.mts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +93 -85
- package/dist/react.mjs +12 -4
- package/dist/{server-Bg3VtA1D.d.ts → server-72rzvJ4Y.d.ts} +1 -1
- package/dist/{server-kakjHRgj.d.mts → server-BgccqOLT.d.mts} +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +2 -2
- package/dist/testing/msw.d.ts +2 -2
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +81 -81
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +29 -29
- package/dist/utils.mjs +2 -2
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkMN4PNKJA_js = require('./chunk-MN4PNKJA.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var chunkZ2MLAIID_js = require('./chunk-Z2MLAIID.js');
|
|
6
|
+
var chunk7ZACMER7_js = require('./chunk-7ZACMER7.js');
|
|
7
|
+
var chunk6RP6OPYO_js = require('./chunk-6RP6OPYO.js');
|
|
8
|
+
var chunkTKOTACKZ_js = require('./chunk-TKOTACKZ.js');
|
|
9
9
|
var React10 = require('react');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var clsx = require('clsx');
|
|
@@ -569,12 +569,12 @@ function attachInternalItemMetadata(item) {
|
|
|
569
569
|
return { ...item, _lineKey: lineKeyFromItem(item) };
|
|
570
570
|
}
|
|
571
571
|
function calculateLineSubtotal(item) {
|
|
572
|
-
let unitPrice =
|
|
572
|
+
let unitPrice = chunk6RP6OPYO_js.parsePrice(item.product.default_price);
|
|
573
573
|
if (item.variant?.price_adjustment) {
|
|
574
|
-
unitPrice +=
|
|
574
|
+
unitPrice += chunk6RP6OPYO_js.parsePrice(item.variant.price_adjustment);
|
|
575
575
|
}
|
|
576
576
|
for (const option of item.addOnOptions || []) {
|
|
577
|
-
if (option.default_price) unitPrice +=
|
|
577
|
+
if (option.default_price) unitPrice += chunk6RP6OPYO_js.parsePrice(option.default_price);
|
|
578
578
|
}
|
|
579
579
|
return roundMoney(unitPrice * item.quantity);
|
|
580
580
|
}
|
|
@@ -760,6 +760,7 @@ function deriveView(base, ops) {
|
|
|
760
760
|
}
|
|
761
761
|
function persistBase(entry) {
|
|
762
762
|
if (typeof window === "undefined" || !window.localStorage) return;
|
|
763
|
+
if (!entry.isDemoMode) return;
|
|
763
764
|
if (entry.persistTimer) return;
|
|
764
765
|
entry.persistTimer = setTimeout(() => {
|
|
765
766
|
entry.persistTimer = null;
|
|
@@ -783,6 +784,13 @@ function persistBase(entry) {
|
|
|
783
784
|
}
|
|
784
785
|
function hydrateFromStorage(entry) {
|
|
785
786
|
if (typeof window === "undefined" || !window.localStorage) return;
|
|
787
|
+
if (!entry.isDemoMode) {
|
|
788
|
+
try {
|
|
789
|
+
window.localStorage.removeItem(entry.storageKey);
|
|
790
|
+
} catch {
|
|
791
|
+
}
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
786
794
|
try {
|
|
787
795
|
const raw = window.localStorage.getItem(entry.storageKey);
|
|
788
796
|
if (!raw) return;
|
|
@@ -1153,7 +1161,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1153
1161
|
function createDefaultClient() {
|
|
1154
1162
|
const processRef = globalThis.process;
|
|
1155
1163
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1156
|
-
return
|
|
1164
|
+
return chunkZ2MLAIID_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1157
1165
|
}
|
|
1158
1166
|
function getStoredLocationId() {
|
|
1159
1167
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1237,7 +1245,7 @@ function CimplifyProvider({
|
|
|
1237
1245
|
const setDisplayCurrency = React10.useCallback(
|
|
1238
1246
|
(currency) => {
|
|
1239
1247
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1240
|
-
if (normalized && !
|
|
1248
|
+
if (normalized && !chunkTKOTACKZ_js.isSupportedCurrency(normalized)) {
|
|
1241
1249
|
return;
|
|
1242
1250
|
}
|
|
1243
1251
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -1899,7 +1907,7 @@ function Price({ amount, currency, className, prefix }) {
|
|
|
1899
1907
|
const resolvedAmount = typeof convertedAmount === "string" ? parseFloat(convertedAmount) || 0 : convertedAmount;
|
|
1900
1908
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
1901
1909
|
prefix,
|
|
1902
|
-
|
|
1910
|
+
chunk6RP6OPYO_js.formatPrice(resolvedAmount, resolvedCurrency)
|
|
1903
1911
|
] });
|
|
1904
1912
|
}
|
|
1905
1913
|
function createCachedQuery(config) {
|
|
@@ -2906,16 +2914,16 @@ function useProductPrice(input) {
|
|
|
2906
2914
|
if (bundleTotalPrice != null) {
|
|
2907
2915
|
unitPrice = bundleTotalPrice;
|
|
2908
2916
|
} else if (compositePrice) {
|
|
2909
|
-
unitPrice =
|
|
2917
|
+
unitPrice = chunk6RP6OPYO_js.parsePrice(compositePrice.final_price);
|
|
2910
2918
|
} else {
|
|
2911
|
-
unitPrice =
|
|
2919
|
+
unitPrice = chunk6RP6OPYO_js.parsePrice(product.default_price);
|
|
2912
2920
|
if (variant?.price_adjustment) {
|
|
2913
|
-
unitPrice +=
|
|
2921
|
+
unitPrice += chunk6RP6OPYO_js.parsePrice(variant.price_adjustment);
|
|
2914
2922
|
}
|
|
2915
2923
|
if (addOnOptions) {
|
|
2916
2924
|
for (const option of addOnOptions) {
|
|
2917
2925
|
if (option.default_price) {
|
|
2918
|
-
unitPrice +=
|
|
2926
|
+
unitPrice += chunk6RP6OPYO_js.parsePrice(option.default_price);
|
|
2919
2927
|
}
|
|
2920
2928
|
}
|
|
2921
2929
|
}
|
|
@@ -3659,19 +3667,19 @@ function AuthElement({
|
|
|
3659
3667
|
}, [onReady, onAuthenticated, onRequiresOtp, onError]);
|
|
3660
3668
|
React10.useEffect(() => {
|
|
3661
3669
|
if (!elements || !containerRef.current) return;
|
|
3662
|
-
const element = elements.create(
|
|
3670
|
+
const element = elements.create(chunk7ZACMER7_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
3663
3671
|
elementRef.current = element;
|
|
3664
|
-
element.on(
|
|
3672
|
+
element.on(chunk7ZACMER7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3665
3673
|
element.on(
|
|
3666
|
-
|
|
3674
|
+
chunk7ZACMER7_js.EVENT_TYPES.AUTHENTICATED,
|
|
3667
3675
|
(data) => onAuthenticatedRef.current?.(data)
|
|
3668
3676
|
);
|
|
3669
3677
|
element.on(
|
|
3670
|
-
|
|
3678
|
+
chunk7ZACMER7_js.EVENT_TYPES.REQUIRES_OTP,
|
|
3671
3679
|
(data) => onRequiresOtpRef.current?.(data)
|
|
3672
3680
|
);
|
|
3673
3681
|
element.on(
|
|
3674
|
-
|
|
3682
|
+
chunk7ZACMER7_js.EVENT_TYPES.ERROR,
|
|
3675
3683
|
(data) => onErrorRef.current?.(data)
|
|
3676
3684
|
);
|
|
3677
3685
|
element.mount(containerRef.current);
|
|
@@ -3700,15 +3708,15 @@ function AddressElement({
|
|
|
3700
3708
|
}, [onReady, onChange, onError]);
|
|
3701
3709
|
React10.useEffect(() => {
|
|
3702
3710
|
if (!elements || !containerRef.current) return;
|
|
3703
|
-
const element = elements.create(
|
|
3711
|
+
const element = elements.create(chunk7ZACMER7_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
3704
3712
|
elementRef.current = element;
|
|
3705
|
-
element.on(
|
|
3713
|
+
element.on(chunk7ZACMER7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3706
3714
|
element.on(
|
|
3707
|
-
|
|
3715
|
+
chunk7ZACMER7_js.EVENT_TYPES.CHANGE,
|
|
3708
3716
|
(data) => onChangeRef.current?.(data)
|
|
3709
3717
|
);
|
|
3710
3718
|
element.on(
|
|
3711
|
-
|
|
3719
|
+
chunk7ZACMER7_js.EVENT_TYPES.ERROR,
|
|
3712
3720
|
(data) => onErrorRef.current?.(data)
|
|
3713
3721
|
);
|
|
3714
3722
|
element.mount(containerRef.current);
|
|
@@ -3738,15 +3746,15 @@ function PaymentElement({
|
|
|
3738
3746
|
}, [onReady, onChange, onError]);
|
|
3739
3747
|
React10.useEffect(() => {
|
|
3740
3748
|
if (!elements || !containerRef.current) return;
|
|
3741
|
-
const element = elements.create(
|
|
3749
|
+
const element = elements.create(chunk7ZACMER7_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
3742
3750
|
elementRef.current = element;
|
|
3743
|
-
element.on(
|
|
3751
|
+
element.on(chunk7ZACMER7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3744
3752
|
element.on(
|
|
3745
|
-
|
|
3753
|
+
chunk7ZACMER7_js.EVENT_TYPES.CHANGE,
|
|
3746
3754
|
(data) => onChangeRef.current?.(data)
|
|
3747
3755
|
);
|
|
3748
3756
|
element.on(
|
|
3749
|
-
|
|
3757
|
+
chunk7ZACMER7_js.EVENT_TYPES.ERROR,
|
|
3750
3758
|
(data) => onErrorRef.current?.(data)
|
|
3751
3759
|
);
|
|
3752
3760
|
element.mount(containerRef.current);
|
|
@@ -3902,7 +3910,7 @@ function VariantSelector({
|
|
|
3902
3910
|
if (!variants || variants.length <= 1) {
|
|
3903
3911
|
return null;
|
|
3904
3912
|
}
|
|
3905
|
-
basePrice != null ?
|
|
3913
|
+
basePrice != null ? chunk6RP6OPYO_js.parsePrice(basePrice) : 0;
|
|
3906
3914
|
if (variantAxes && variantAxes.length > 0) {
|
|
3907
3915
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
3908
3916
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -3978,7 +3986,7 @@ function VariantSelector({
|
|
|
3978
3986
|
className: cn("divide-y divide-border", classNames?.list),
|
|
3979
3987
|
children: variants.map((variant) => {
|
|
3980
3988
|
const isSelected = selectedVariantId === variant.id;
|
|
3981
|
-
const adjustment =
|
|
3989
|
+
const adjustment = chunk6RP6OPYO_js.parsePrice(variant.price_adjustment);
|
|
3982
3990
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3983
3991
|
radio.Radio.Root,
|
|
3984
3992
|
{
|
|
@@ -4244,16 +4252,16 @@ function BundleSelector({
|
|
|
4244
4252
|
}, [components, selections, onReady]);
|
|
4245
4253
|
const totalPrice = React10.useMemo(() => {
|
|
4246
4254
|
if (pricingType === "fixed" && bundlePrice) {
|
|
4247
|
-
return
|
|
4255
|
+
return chunk6RP6OPYO_js.parsePrice(bundlePrice);
|
|
4248
4256
|
}
|
|
4249
4257
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
4250
4258
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
4251
4259
|
}, 0);
|
|
4252
4260
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
4253
|
-
return componentsTotal * (1 -
|
|
4261
|
+
return componentsTotal * (1 - chunk6RP6OPYO_js.parsePrice(discountValue) / 100);
|
|
4254
4262
|
}
|
|
4255
4263
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
4256
|
-
return componentsTotal -
|
|
4264
|
+
return componentsTotal - chunk6RP6OPYO_js.parsePrice(discountValue);
|
|
4257
4265
|
}
|
|
4258
4266
|
return componentsTotal;
|
|
4259
4267
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -4314,15 +4322,15 @@ function BundleSelector({
|
|
|
4314
4322
|
}
|
|
4315
4323
|
function getComponentPrice(component, selectedVariantId) {
|
|
4316
4324
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
4317
|
-
return
|
|
4325
|
+
return chunk6RP6OPYO_js.parsePrice(component.effective_price);
|
|
4318
4326
|
}
|
|
4319
4327
|
if (selectedVariantId === component.variant_id) {
|
|
4320
|
-
return
|
|
4328
|
+
return chunk6RP6OPYO_js.parsePrice(component.effective_price);
|
|
4321
4329
|
}
|
|
4322
4330
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
4323
4331
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
4324
|
-
if (!selectedAdj) return
|
|
4325
|
-
return
|
|
4332
|
+
if (!selectedAdj) return chunk6RP6OPYO_js.parsePrice(component.effective_price);
|
|
4333
|
+
return chunk6RP6OPYO_js.parsePrice(component.effective_price) - chunk6RP6OPYO_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk6RP6OPYO_js.parsePrice(selectedAdj.price_adjustment);
|
|
4326
4334
|
}
|
|
4327
4335
|
function formatDuration(minutes, unit) {
|
|
4328
4336
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -4435,7 +4443,7 @@ function BundleComponentCard({
|
|
|
4435
4443
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
4436
4444
|
children: component.available_variants.map((variant) => {
|
|
4437
4445
|
const isSelected = selectedVariantId === variant.id;
|
|
4438
|
-
const adjustment =
|
|
4446
|
+
const adjustment = chunk6RP6OPYO_js.parsePrice(variant.price_adjustment);
|
|
4439
4447
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4440
4448
|
radio.Radio.Root,
|
|
4441
4449
|
{
|
|
@@ -4881,7 +4889,7 @@ function CompositeSelector({
|
|
|
4881
4889
|
"data-cimplify-composite-summary": true,
|
|
4882
4890
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
4883
4891
|
children: [
|
|
4884
|
-
|
|
4892
|
+
chunk6RP6OPYO_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4885
4893
|
"div",
|
|
4886
4894
|
{
|
|
4887
4895
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -4892,7 +4900,7 @@ function CompositeSelector({
|
|
|
4892
4900
|
]
|
|
4893
4901
|
}
|
|
4894
4902
|
),
|
|
4895
|
-
|
|
4903
|
+
chunk6RP6OPYO_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4896
4904
|
"div",
|
|
4897
4905
|
{
|
|
4898
4906
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -5188,7 +5196,7 @@ function InputField({
|
|
|
5188
5196
|
onFileUpload,
|
|
5189
5197
|
classNames
|
|
5190
5198
|
}) {
|
|
5191
|
-
const hasPriceAdjustment = field.price_adjustment != null &&
|
|
5199
|
+
const hasPriceAdjustment = field.price_adjustment != null && chunk6RP6OPYO_js.parsePrice(field.price_adjustment) > 0;
|
|
5192
5200
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
5193
5201
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
5194
5202
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -6357,18 +6365,18 @@ function ProductCustomizer({
|
|
|
6357
6365
|
}, [selectedAddOnOptionIds]);
|
|
6358
6366
|
const localTotalPrice = React10.useMemo(() => {
|
|
6359
6367
|
if (isComposite && compositePrice) {
|
|
6360
|
-
return
|
|
6368
|
+
return chunk6RP6OPYO_js.parsePrice(compositePrice.final_price) * quantity;
|
|
6361
6369
|
}
|
|
6362
6370
|
if (isBundle && bundleTotalPrice != null) {
|
|
6363
6371
|
return bundleTotalPrice * quantity;
|
|
6364
6372
|
}
|
|
6365
|
-
let price =
|
|
6373
|
+
let price = chunk6RP6OPYO_js.parsePrice(product.default_price);
|
|
6366
6374
|
if (selectedVariant?.price_adjustment) {
|
|
6367
|
-
price +=
|
|
6375
|
+
price += chunk6RP6OPYO_js.parsePrice(selectedVariant.price_adjustment);
|
|
6368
6376
|
}
|
|
6369
6377
|
for (const option of selectedAddOnOptions) {
|
|
6370
6378
|
if (option.default_price) {
|
|
6371
|
-
price +=
|
|
6379
|
+
price += chunk6RP6OPYO_js.parsePrice(option.default_price);
|
|
6372
6380
|
}
|
|
6373
6381
|
}
|
|
6374
6382
|
return price * quantity;
|
|
@@ -6417,7 +6425,7 @@ function ProductCustomizer({
|
|
|
6417
6425
|
const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
|
|
6418
6426
|
const perUnit = priceInfo.pre_tax_price;
|
|
6419
6427
|
if (perUnit === void 0 || perUnit === null) return void 0;
|
|
6420
|
-
return
|
|
6428
|
+
return chunk6RP6OPYO_js.parsePrice(perUnit) * quantity;
|
|
6421
6429
|
}, [quote, quantity]);
|
|
6422
6430
|
const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
|
|
6423
6431
|
const handleVariantChange = React10.useCallback(
|
|
@@ -6555,7 +6563,7 @@ function ProductCustomizer({
|
|
|
6555
6563
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
|
|
6556
6564
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6557
6565
|
"Deposit required: ",
|
|
6558
|
-
|
|
6566
|
+
chunk6RP6OPYO_js.parsePrice(product.deposit_amount),
|
|
6559
6567
|
"%"
|
|
6560
6568
|
] }) }),
|
|
6561
6569
|
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(
|
|
@@ -6616,7 +6624,7 @@ function ProductCustomizer({
|
|
|
6616
6624
|
] })
|
|
6617
6625
|
] }),
|
|
6618
6626
|
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: [
|
|
6619
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
6627
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk6RP6OPYO_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunk6RP6OPYO_js.parsePrice(product.default_price)), className: "font-medium text-foreground" }),
|
|
6620
6628
|
" ea."
|
|
6621
6629
|
] }),
|
|
6622
6630
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6740,7 +6748,7 @@ function CartLineItemRow({
|
|
|
6740
6748
|
const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
|
|
6741
6749
|
const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
|
|
6742
6750
|
const isOptimistic = item.isOptimistic === true;
|
|
6743
|
-
const lineTotal =
|
|
6751
|
+
const lineTotal = chunk6RP6OPYO_js.parsePrice(unitPrice) * item.quantity;
|
|
6744
6752
|
const imageUrl = item.product.image_url;
|
|
6745
6753
|
const variantLabel = item.variant ? chunkMN4PNKJA_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
6746
6754
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6973,15 +6981,15 @@ function CartSummary({
|
|
|
6973
6981
|
] }),
|
|
6974
6982
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal, className: "tabular-nums" })
|
|
6975
6983
|
] }),
|
|
6976
|
-
totalDiscounts != null &&
|
|
6984
|
+
totalDiscounts != null && chunk6RP6OPYO_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: cn("flex items-baseline justify-between", classNames?.discount), children: [
|
|
6977
6985
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Discount" }),
|
|
6978
6986
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-", className: "tabular-nums text-primary" })
|
|
6979
6987
|
] }),
|
|
6980
6988
|
deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: cn("flex items-baseline justify-between", classNames?.deliveryFee), children: [
|
|
6981
6989
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
6982
|
-
|
|
6990
|
+
chunk6RP6OPYO_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee, className: "tabular-nums" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "Free" })
|
|
6983
6991
|
] }),
|
|
6984
|
-
serviceCharge != null &&
|
|
6992
|
+
serviceCharge != null && chunk6RP6OPYO_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: cn("flex items-baseline justify-between", classNames?.serviceCharge), children: [
|
|
6985
6993
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Service charge" }),
|
|
6986
6994
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge, className: "tabular-nums" })
|
|
6987
6995
|
] }),
|
|
@@ -7071,16 +7079,16 @@ function SaleBadge({
|
|
|
7071
7079
|
className,
|
|
7072
7080
|
classNames
|
|
7073
7081
|
}) {
|
|
7074
|
-
const onSale =
|
|
7082
|
+
const onSale = chunk6RP6OPYO_js.isOnSale(product);
|
|
7075
7083
|
const hasDeal = dealInfo !== void 0;
|
|
7076
7084
|
if (!hasDeal && !onSale && !label) {
|
|
7077
7085
|
return null;
|
|
7078
7086
|
}
|
|
7079
7087
|
let percentage = null;
|
|
7080
7088
|
if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
7081
|
-
percentage =
|
|
7089
|
+
percentage = chunk6RP6OPYO_js.parsePrice(dealInfo.value);
|
|
7082
7090
|
} else if (onSale) {
|
|
7083
|
-
percentage =
|
|
7091
|
+
percentage = chunk6RP6OPYO_js.getDiscountPercentage(product);
|
|
7084
7092
|
}
|
|
7085
7093
|
const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
7086
7094
|
if (!badgeText) {
|
|
@@ -7099,7 +7107,7 @@ function SaleBadge({
|
|
|
7099
7107
|
"%"
|
|
7100
7108
|
] }),
|
|
7101
7109
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
7102
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
7110
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk6RP6OPYO_js.getBasePrice(product) }) })
|
|
7103
7111
|
]
|
|
7104
7112
|
}
|
|
7105
7113
|
);
|
|
@@ -7358,8 +7366,8 @@ function SoldOutOverlay() {
|
|
|
7358
7366
|
);
|
|
7359
7367
|
}
|
|
7360
7368
|
function SaleBadge2({ product }) {
|
|
7361
|
-
if (!
|
|
7362
|
-
const pct =
|
|
7369
|
+
if (!chunk6RP6OPYO_js.isOnSale(product)) return null;
|
|
7370
|
+
const pct = chunk6RP6OPYO_js.getDiscountPercentage(product);
|
|
7363
7371
|
if (!pct || pct <= 0) return null;
|
|
7364
7372
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-card-sale-badge": true, className: "inline-flex items-center text-[11px] font-semibold tracking-wide bg-destructive text-destructive-foreground px-2 py-0.5 rounded-md", children: [
|
|
7365
7373
|
"-",
|
|
@@ -7452,7 +7460,7 @@ function RetailProductCard({
|
|
|
7452
7460
|
}) {
|
|
7453
7461
|
const image = product.image_url || product.images?.[0] || "";
|
|
7454
7462
|
const outOfStock = product.inventory_status?.in_stock === false;
|
|
7455
|
-
const onSale =
|
|
7463
|
+
const onSale = chunk6RP6OPYO_js.isOnSale(product);
|
|
7456
7464
|
const swatches = getColorSwatches(product);
|
|
7457
7465
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
7458
7466
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
@@ -7470,7 +7478,7 @@ function RetailProductCard({
|
|
|
7470
7478
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
|
|
7471
7479
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
7472
7480
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
7473
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
7481
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk6RP6OPYO_js.getBasePrice(product), className: "text-xs text-muted-foreground line-through" })
|
|
7474
7482
|
] }),
|
|
7475
7483
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
7476
7484
|
"span",
|
|
@@ -7487,9 +7495,9 @@ function RetailProductCard({
|
|
|
7487
7495
|
function PriceRange({ product, currency, className }) {
|
|
7488
7496
|
const context = useOptionalCimplify();
|
|
7489
7497
|
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
7490
|
-
const range =
|
|
7498
|
+
const range = chunk6RP6OPYO_js.getPriceRange(product);
|
|
7491
7499
|
if (!range) return null;
|
|
7492
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
7500
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunk6RP6OPYO_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
7493
7501
|
}
|
|
7494
7502
|
function WholesaleProductCard({
|
|
7495
7503
|
product,
|
|
@@ -7578,8 +7586,8 @@ function BundleProductCard({
|
|
|
7578
7586
|
const image = product.image_url || product.images?.[0] || "";
|
|
7579
7587
|
const components = product.components || [];
|
|
7580
7588
|
const componentCount = components.length;
|
|
7581
|
-
const onSale =
|
|
7582
|
-
const discount =
|
|
7589
|
+
const onSale = chunk6RP6OPYO_js.isOnSale(product);
|
|
7590
|
+
const discount = chunk6RP6OPYO_js.getDiscountPercentage(product);
|
|
7583
7591
|
const hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
7584
7592
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
7585
7593
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
@@ -7606,7 +7614,7 @@ function BundleProductCard({
|
|
|
7606
7614
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
7607
7615
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
7608
7616
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7609
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
7617
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk6RP6OPYO_js.getBasePrice(product), className: "text-xs text-muted-foreground line-through" }),
|
|
7610
7618
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
7611
7619
|
"Save ",
|
|
7612
7620
|
discount,
|
|
@@ -8518,7 +8526,7 @@ function SearchInput({
|
|
|
8518
8526
|
}
|
|
8519
8527
|
),
|
|
8520
8528
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
8521
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
8529
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk6RP6OPYO_js.formatPrice(product.default_price) })
|
|
8522
8530
|
] })
|
|
8523
8531
|
},
|
|
8524
8532
|
product.id
|
|
@@ -9012,19 +9020,19 @@ function OrderSummary({
|
|
|
9012
9020
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
9013
9021
|
] }),
|
|
9014
9022
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
9015
|
-
order.total_discount != null &&
|
|
9023
|
+
order.total_discount != null && chunk6RP6OPYO_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
9016
9024
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
9017
9025
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
9018
9026
|
] }),
|
|
9019
|
-
order.delivery_fee != null &&
|
|
9027
|
+
order.delivery_fee != null && chunk6RP6OPYO_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
9020
9028
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
9021
9029
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
9022
9030
|
] }),
|
|
9023
|
-
order.service_charge != null &&
|
|
9031
|
+
order.service_charge != null && chunk6RP6OPYO_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
9024
9032
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
9025
9033
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
9026
9034
|
] }),
|
|
9027
|
-
order.tax != null &&
|
|
9035
|
+
order.tax != null && chunk6RP6OPYO_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
9028
9036
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
9029
9037
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
9030
9038
|
] }),
|
|
@@ -9612,7 +9620,7 @@ function BookingPage({
|
|
|
9612
9620
|
const hasStaffStep = staff && staff.length > 0;
|
|
9613
9621
|
const depositType = product?.deposit_type;
|
|
9614
9622
|
const depositAmount = product?.deposit_amount;
|
|
9615
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
9623
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk6RP6OPYO_js.parsePrice(depositAmount) !== 0;
|
|
9616
9624
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
9617
9625
|
const noShowFee = product?.no_show_fee;
|
|
9618
9626
|
const handleSlotSelect = React10.useCallback(
|
|
@@ -9744,14 +9752,14 @@ function BookingPage({
|
|
|
9744
9752
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
|
|
9745
9753
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
9746
9754
|
"Deposit: ",
|
|
9747
|
-
depositType === "percentage" ? `${
|
|
9755
|
+
depositType === "percentage" ? `${chunk6RP6OPYO_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
|
|
9748
9756
|
] }),
|
|
9749
9757
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
9750
9758
|
"Free cancellation up to ",
|
|
9751
9759
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
9752
9760
|
" before"
|
|
9753
9761
|
] }),
|
|
9754
|
-
noShowFee !== void 0 &&
|
|
9762
|
+
noShowFee !== void 0 && chunk6RP6OPYO_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
9755
9763
|
"No-show fee: ",
|
|
9756
9764
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
|
|
9757
9765
|
] })
|
|
@@ -9828,7 +9836,7 @@ function BookingPage({
|
|
|
9828
9836
|
] }),
|
|
9829
9837
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
9830
9838
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
9831
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
9839
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk6RP6OPYO_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
|
|
9832
9840
|
] })
|
|
9833
9841
|
] }),
|
|
9834
9842
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10492,7 +10500,7 @@ function DefaultProductLayout({
|
|
|
10492
10500
|
}) {
|
|
10493
10501
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
10494
10502
|
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
10495
|
-
const onSale =
|
|
10503
|
+
const onSale = chunk6RP6OPYO_js.isOnSale(product);
|
|
10496
10504
|
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
10497
10505
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
10498
10506
|
renderBreadcrumb?.(product),
|
|
@@ -10514,10 +10522,10 @@ function DefaultProductLayout({
|
|
|
10514
10522
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
|
|
10515
10523
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, className: "text-2xl font-extrabold" }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10516
10524
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-extrabold" }),
|
|
10517
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
10525
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk6RP6OPYO_js.getBasePrice(product), className: "text-lg text-muted-foreground line-through" }),
|
|
10518
10526
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
10519
10527
|
"Save ",
|
|
10520
|
-
|
|
10528
|
+
chunk6RP6OPYO_js.getDiscountPercentage(product),
|
|
10521
10529
|
"%"
|
|
10522
10530
|
] })
|
|
10523
10531
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
|
|
@@ -10736,7 +10744,7 @@ function ServiceProductLayout({
|
|
|
10736
10744
|
}) {
|
|
10737
10745
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
10738
10746
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
10739
|
-
const depositAmount = hasDeposit ?
|
|
10747
|
+
const depositAmount = hasDeposit ? chunk6RP6OPYO_js.parsePrice(product.deposit_amount) : 0;
|
|
10740
10748
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
10741
10749
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
10742
10750
|
renderBreadcrumb?.(product),
|
|
@@ -10804,7 +10812,7 @@ function ServiceProductLayout({
|
|
|
10804
10812
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, className: "font-medium text-foreground" }),
|
|
10805
10813
|
" deposit charged at booking"
|
|
10806
10814
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10807
|
-
|
|
10815
|
+
chunk6RP6OPYO_js.parsePrice(product.deposit_amount),
|
|
10808
10816
|
"% deposit charged at booking"
|
|
10809
10817
|
] }) })
|
|
10810
10818
|
] })
|
|
@@ -10963,13 +10971,13 @@ function BundleProductLayout({
|
|
|
10963
10971
|
}) {
|
|
10964
10972
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
10965
10973
|
const components = product.components || [];
|
|
10966
|
-
const onSale =
|
|
10967
|
-
const discount =
|
|
10974
|
+
const onSale = chunk6RP6OPYO_js.isOnSale(product);
|
|
10975
|
+
const discount = chunk6RP6OPYO_js.getDiscountPercentage(product);
|
|
10968
10976
|
const baseTotal = components.reduce(
|
|
10969
|
-
(sum, c) => sum +
|
|
10977
|
+
(sum, c) => sum + chunk6RP6OPYO_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
10970
10978
|
0
|
|
10971
10979
|
);
|
|
10972
|
-
const bundlePrice =
|
|
10980
|
+
const bundlePrice = chunk6RP6OPYO_js.parsePrice(product.default_price);
|
|
10973
10981
|
const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
10974
10982
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
10975
10983
|
renderBreadcrumb?.(product),
|
|
@@ -11461,7 +11469,7 @@ function CartDrawer({
|
|
|
11461
11469
|
}) {
|
|
11462
11470
|
const { isOpen, close } = useCartDrawer();
|
|
11463
11471
|
const cart = useCart();
|
|
11464
|
-
const subtotalNum =
|
|
11472
|
+
const subtotalNum = chunk6RP6OPYO_js.parsePrice(cart.subtotal);
|
|
11465
11473
|
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
11466
11474
|
React10.useEffect(() => {
|
|
11467
11475
|
if (!isOpen) return;
|
|
@@ -11855,9 +11863,9 @@ function CatalogueCollectionLayout({
|
|
|
11855
11863
|
result = result.filter((p) => p.tags?.includes(activeCategory));
|
|
11856
11864
|
}
|
|
11857
11865
|
if (sortBy === "price-asc") {
|
|
11858
|
-
result = [...result].sort((a, b) =>
|
|
11866
|
+
result = [...result].sort((a, b) => chunk6RP6OPYO_js.parsePrice(a.default_price) - chunk6RP6OPYO_js.parsePrice(b.default_price));
|
|
11859
11867
|
} else if (sortBy === "price-desc") {
|
|
11860
|
-
result = [...result].sort((a, b) =>
|
|
11868
|
+
result = [...result].sort((a, b) => chunk6RP6OPYO_js.parsePrice(b.default_price) - chunk6RP6OPYO_js.parsePrice(a.default_price));
|
|
11861
11869
|
} else if (sortBy === "name") {
|
|
11862
11870
|
result = [...result].sort((a, b) => a.name.localeCompare(b.name));
|
|
11863
11871
|
}
|
package/dist/react.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, RENDER_HINT } from './chunk-NRDRVZ62.mjs';
|
|
3
3
|
export { getVariantDisplayName } from './chunk-NRDRVZ62.mjs';
|
|
4
|
-
import { createCimplifyClient } from './chunk-
|
|
5
|
-
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-
|
|
6
|
-
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-
|
|
7
|
-
import { isSupportedCurrency } from './chunk-
|
|
4
|
+
import { createCimplifyClient } from './chunk-WUIERJ6J.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-CKRMA5F7.mjs';
|
|
6
|
+
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-XY2DFX5K.mjs';
|
|
7
|
+
import { isSupportedCurrency } from './chunk-Z2AYLZDF.mjs';
|
|
8
8
|
import React10, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
|
|
9
9
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
@@ -755,6 +755,7 @@ function deriveView(base, ops) {
|
|
|
755
755
|
}
|
|
756
756
|
function persistBase(entry) {
|
|
757
757
|
if (typeof window === "undefined" || !window.localStorage) return;
|
|
758
|
+
if (!entry.isDemoMode) return;
|
|
758
759
|
if (entry.persistTimer) return;
|
|
759
760
|
entry.persistTimer = setTimeout(() => {
|
|
760
761
|
entry.persistTimer = null;
|
|
@@ -778,6 +779,13 @@ function persistBase(entry) {
|
|
|
778
779
|
}
|
|
779
780
|
function hydrateFromStorage(entry) {
|
|
780
781
|
if (typeof window === "undefined" || !window.localStorage) return;
|
|
782
|
+
if (!entry.isDemoMode) {
|
|
783
|
+
try {
|
|
784
|
+
window.localStorage.removeItem(entry.storageKey);
|
|
785
|
+
} catch {
|
|
786
|
+
}
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
781
789
|
try {
|
|
782
790
|
const raw = window.localStorage.getItem(entry.storageKey);
|
|
783
791
|
if (!raw) return;
|
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './client-
|
|
2
|
-
export { aN as Result } from './client-
|
|
3
|
-
export {
|
|
4
|
-
import './payment-
|
|
1
|
+
import { C as CimplifyClient } from './client-G2WCoxv2.mjs';
|
|
2
|
+
export { aN as Result } from './client-G2WCoxv2.mjs';
|
|
3
|
+
export { ap as Category, h as CimplifyError, ar as Collection, X as Product, aa as ProductWithDetails } from './product-C-xLzh7Q.mjs';
|
|
4
|
+
import './payment-9L_-GWqQ.mjs';
|
|
5
5
|
|
|
6
6
|
interface ServerClientOptions {
|
|
7
7
|
/**
|