@cimplify/sdk 0.52.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced.js +23 -22
- package/dist/advanced.mjs +4 -3
- package/dist/chunk-3G6RQLXK.mjs +21 -0
- package/dist/{chunk-MBR2DBEN.mjs → chunk-4QDCMYYB.mjs} +2 -2
- package/dist/{chunk-D22UVSFN.js → chunk-7A3D3LFI.js} +4 -4
- package/dist/{chunk-6RP6OPYO.js → chunk-7Y2O3E4D.js} +3 -3
- package/dist/{chunk-Z2AYLZDF.mjs → chunk-AMZXALF6.mjs} +1 -21
- package/dist/{chunk-DR4UPU6P.js → chunk-EQLT46ZR.js} +22 -22
- package/dist/{chunk-OFNVLUH4.mjs → chunk-GLAVTDDE.mjs} +2 -2
- package/dist/chunk-OWW5GUSB.js +28 -0
- package/dist/{chunk-GEWFWQYK.js → chunk-Q5VGDCQF.js} +235 -234
- package/dist/{chunk-632JEJUS.mjs → chunk-R3F55BRN.mjs} +2 -1
- package/dist/{chunk-24FK7VFL.mjs → chunk-RDORJT7Y.mjs} +2 -2
- package/dist/{chunk-XY2DFX5K.mjs → chunk-TD3AY34U.mjs} +1 -1
- package/dist/{chunk-CYGLTD7D.js → chunk-W6CCBNGL.js} +60 -60
- package/dist/{chunk-TKOTACKZ.js → chunk-XA3ZNR75.js} +0 -26
- package/dist/index.js +110 -109
- package/dist/index.mjs +5 -4
- package/dist/react.js +86 -85
- package/dist/react.mjs +5 -4
- package/dist/server/evict.d.mts +31 -0
- package/dist/server/evict.d.ts +31 -0
- package/dist/server/evict.js +75 -0
- package/dist/server/evict.mjs +73 -0
- package/dist/server.d.mts +1 -30
- package/dist/server.d.ts +1 -30
- package/dist/server.js +7 -76
- package/dist/server.mjs +6 -74
- package/dist/testing/msw.js +4 -3
- package/dist/testing/msw.mjs +3 -2
- package/dist/testing/suite.js +26 -25
- package/dist/testing/suite.mjs +7 -6
- package/dist/testing.js +82 -81
- package/dist/testing.mjs +8 -7
- package/dist/utils.js +30 -29
- package/dist/utils.mjs +3 -2
- package/package.json +7 -1
package/dist/react.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
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 chunkW6CCBNGL_js = require('./chunk-W6CCBNGL.js');
|
|
6
|
+
var chunkEQLT46ZR_js = require('./chunk-EQLT46ZR.js');
|
|
7
|
+
var chunk7Y2O3E4D_js = require('./chunk-7Y2O3E4D.js');
|
|
8
|
+
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
9
|
+
require('./chunk-OWW5GUSB.js');
|
|
9
10
|
var React10 = require('react');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
12
|
var clsx = require('clsx');
|
|
@@ -572,12 +573,12 @@ function attachInternalItemMetadata(item) {
|
|
|
572
573
|
return { ...item, _lineKey: lineKeyFromItem(item) };
|
|
573
574
|
}
|
|
574
575
|
function calculateLineSubtotal(item) {
|
|
575
|
-
let unitPrice =
|
|
576
|
+
let unitPrice = chunk7Y2O3E4D_js.parsePrice(item.product.default_price);
|
|
576
577
|
if (item.variant?.price_adjustment) {
|
|
577
|
-
unitPrice +=
|
|
578
|
+
unitPrice += chunk7Y2O3E4D_js.parsePrice(item.variant.price_adjustment);
|
|
578
579
|
}
|
|
579
580
|
for (const option of item.addOnOptions || []) {
|
|
580
|
-
if (option.default_price) unitPrice +=
|
|
581
|
+
if (option.default_price) unitPrice += chunk7Y2O3E4D_js.parsePrice(option.default_price);
|
|
581
582
|
}
|
|
582
583
|
return roundMoney(unitPrice * item.quantity);
|
|
583
584
|
}
|
|
@@ -1084,7 +1085,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1084
1085
|
function createDefaultClient() {
|
|
1085
1086
|
const processRef = globalThis.process;
|
|
1086
1087
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1087
|
-
return
|
|
1088
|
+
return chunkW6CCBNGL_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1088
1089
|
}
|
|
1089
1090
|
function getStoredLocationId() {
|
|
1090
1091
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1167,7 +1168,7 @@ function CimplifyProvider({
|
|
|
1167
1168
|
const setDisplayCurrency = React10.useCallback(
|
|
1168
1169
|
(currency) => {
|
|
1169
1170
|
const normalized = currency?.trim().toUpperCase() || null;
|
|
1170
|
-
if (normalized && !
|
|
1171
|
+
if (normalized && !chunkXA3ZNR75_js.isSupportedCurrency(normalized)) {
|
|
1171
1172
|
return;
|
|
1172
1173
|
}
|
|
1173
1174
|
setDisplayCurrencyOverride(normalized);
|
|
@@ -1759,7 +1760,7 @@ function Price({ amount, currency, className, prefix }) {
|
|
|
1759
1760
|
const resolvedAmount = typeof convertedAmount === "string" ? parseFloat(convertedAmount) || 0 : convertedAmount;
|
|
1760
1761
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
1761
1762
|
prefix,
|
|
1762
|
-
|
|
1763
|
+
chunk7Y2O3E4D_js.formatPrice(resolvedAmount, resolvedCurrency)
|
|
1763
1764
|
] });
|
|
1764
1765
|
}
|
|
1765
1766
|
function createCachedQuery(config) {
|
|
@@ -2766,16 +2767,16 @@ function useProductPrice(input) {
|
|
|
2766
2767
|
if (bundleTotalPrice != null) {
|
|
2767
2768
|
unitPrice = bundleTotalPrice;
|
|
2768
2769
|
} else if (compositePrice) {
|
|
2769
|
-
unitPrice =
|
|
2770
|
+
unitPrice = chunk7Y2O3E4D_js.parsePrice(compositePrice.final_price);
|
|
2770
2771
|
} else {
|
|
2771
|
-
unitPrice =
|
|
2772
|
+
unitPrice = chunk7Y2O3E4D_js.parsePrice(product.default_price);
|
|
2772
2773
|
if (variant?.price_adjustment) {
|
|
2773
|
-
unitPrice +=
|
|
2774
|
+
unitPrice += chunk7Y2O3E4D_js.parsePrice(variant.price_adjustment);
|
|
2774
2775
|
}
|
|
2775
2776
|
if (addOnOptions) {
|
|
2776
2777
|
for (const option of addOnOptions) {
|
|
2777
2778
|
if (option.default_price) {
|
|
2778
|
-
unitPrice +=
|
|
2779
|
+
unitPrice += chunk7Y2O3E4D_js.parsePrice(option.default_price);
|
|
2779
2780
|
}
|
|
2780
2781
|
}
|
|
2781
2782
|
}
|
|
@@ -3519,19 +3520,19 @@ function AuthElement({
|
|
|
3519
3520
|
}, [onReady, onAuthenticated, onRequiresOtp, onError]);
|
|
3520
3521
|
React10.useEffect(() => {
|
|
3521
3522
|
if (!elements || !containerRef.current) return;
|
|
3522
|
-
const element = elements.create(
|
|
3523
|
+
const element = elements.create(chunkEQLT46ZR_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
3523
3524
|
elementRef.current = element;
|
|
3524
|
-
element.on(
|
|
3525
|
+
element.on(chunkEQLT46ZR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3525
3526
|
element.on(
|
|
3526
|
-
|
|
3527
|
+
chunkEQLT46ZR_js.EVENT_TYPES.AUTHENTICATED,
|
|
3527
3528
|
(data) => onAuthenticatedRef.current?.(data)
|
|
3528
3529
|
);
|
|
3529
3530
|
element.on(
|
|
3530
|
-
|
|
3531
|
+
chunkEQLT46ZR_js.EVENT_TYPES.REQUIRES_OTP,
|
|
3531
3532
|
(data) => onRequiresOtpRef.current?.(data)
|
|
3532
3533
|
);
|
|
3533
3534
|
element.on(
|
|
3534
|
-
|
|
3535
|
+
chunkEQLT46ZR_js.EVENT_TYPES.ERROR,
|
|
3535
3536
|
(data) => onErrorRef.current?.(data)
|
|
3536
3537
|
);
|
|
3537
3538
|
element.mount(containerRef.current);
|
|
@@ -3560,15 +3561,15 @@ function AddressElement({
|
|
|
3560
3561
|
}, [onReady, onChange, onError]);
|
|
3561
3562
|
React10.useEffect(() => {
|
|
3562
3563
|
if (!elements || !containerRef.current) return;
|
|
3563
|
-
const element = elements.create(
|
|
3564
|
+
const element = elements.create(chunkEQLT46ZR_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
3564
3565
|
elementRef.current = element;
|
|
3565
|
-
element.on(
|
|
3566
|
+
element.on(chunkEQLT46ZR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3566
3567
|
element.on(
|
|
3567
|
-
|
|
3568
|
+
chunkEQLT46ZR_js.EVENT_TYPES.CHANGE,
|
|
3568
3569
|
(data) => onChangeRef.current?.(data)
|
|
3569
3570
|
);
|
|
3570
3571
|
element.on(
|
|
3571
|
-
|
|
3572
|
+
chunkEQLT46ZR_js.EVENT_TYPES.ERROR,
|
|
3572
3573
|
(data) => onErrorRef.current?.(data)
|
|
3573
3574
|
);
|
|
3574
3575
|
element.mount(containerRef.current);
|
|
@@ -3598,15 +3599,15 @@ function PaymentElement({
|
|
|
3598
3599
|
}, [onReady, onChange, onError]);
|
|
3599
3600
|
React10.useEffect(() => {
|
|
3600
3601
|
if (!elements || !containerRef.current) return;
|
|
3601
|
-
const element = elements.create(
|
|
3602
|
+
const element = elements.create(chunkEQLT46ZR_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
3602
3603
|
elementRef.current = element;
|
|
3603
|
-
element.on(
|
|
3604
|
+
element.on(chunkEQLT46ZR_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
3604
3605
|
element.on(
|
|
3605
|
-
|
|
3606
|
+
chunkEQLT46ZR_js.EVENT_TYPES.CHANGE,
|
|
3606
3607
|
(data) => onChangeRef.current?.(data)
|
|
3607
3608
|
);
|
|
3608
3609
|
element.on(
|
|
3609
|
-
|
|
3610
|
+
chunkEQLT46ZR_js.EVENT_TYPES.ERROR,
|
|
3610
3611
|
(data) => onErrorRef.current?.(data)
|
|
3611
3612
|
);
|
|
3612
3613
|
element.mount(containerRef.current);
|
|
@@ -3762,7 +3763,7 @@ function VariantSelector({
|
|
|
3762
3763
|
if (!variants || variants.length <= 1) {
|
|
3763
3764
|
return null;
|
|
3764
3765
|
}
|
|
3765
|
-
basePrice != null ?
|
|
3766
|
+
basePrice != null ? chunk7Y2O3E4D_js.parsePrice(basePrice) : 0;
|
|
3766
3767
|
if (variantAxes && variantAxes.length > 0) {
|
|
3767
3768
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
|
|
3768
3769
|
const labelId = `${idPrefix}-axis-${axis.id}`;
|
|
@@ -3838,7 +3839,7 @@ function VariantSelector({
|
|
|
3838
3839
|
className: cn("divide-y divide-border", classNames?.list),
|
|
3839
3840
|
children: variants.map((variant) => {
|
|
3840
3841
|
const isSelected = selectedVariantId === variant.id;
|
|
3841
|
-
const adjustment =
|
|
3842
|
+
const adjustment = chunk7Y2O3E4D_js.parsePrice(variant.price_adjustment);
|
|
3842
3843
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3843
3844
|
radio.Radio.Root,
|
|
3844
3845
|
{
|
|
@@ -4104,16 +4105,16 @@ function BundleSelector({
|
|
|
4104
4105
|
}, [components, selections, onReady]);
|
|
4105
4106
|
const totalPrice = React10.useMemo(() => {
|
|
4106
4107
|
if (pricingType === "fixed" && bundlePrice) {
|
|
4107
|
-
return
|
|
4108
|
+
return chunk7Y2O3E4D_js.parsePrice(bundlePrice);
|
|
4108
4109
|
}
|
|
4109
4110
|
const componentsTotal = components.reduce((sum, comp) => {
|
|
4110
4111
|
return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
|
|
4111
4112
|
}, 0);
|
|
4112
4113
|
if (pricingType === "percentage_discount" && discountValue) {
|
|
4113
|
-
return componentsTotal * (1 -
|
|
4114
|
+
return componentsTotal * (1 - chunk7Y2O3E4D_js.parsePrice(discountValue) / 100);
|
|
4114
4115
|
}
|
|
4115
4116
|
if (pricingType === "fixed_discount" && discountValue) {
|
|
4116
|
-
return componentsTotal -
|
|
4117
|
+
return componentsTotal - chunk7Y2O3E4D_js.parsePrice(discountValue);
|
|
4117
4118
|
}
|
|
4118
4119
|
return componentsTotal;
|
|
4119
4120
|
}, [components, variantChoices, pricingType, bundlePrice, discountValue]);
|
|
@@ -4174,15 +4175,15 @@ function BundleSelector({
|
|
|
4174
4175
|
}
|
|
4175
4176
|
function getComponentPrice(component, selectedVariantId) {
|
|
4176
4177
|
if (!selectedVariantId || component.available_variants.length === 0) {
|
|
4177
|
-
return
|
|
4178
|
+
return chunk7Y2O3E4D_js.parsePrice(component.effective_price);
|
|
4178
4179
|
}
|
|
4179
4180
|
if (selectedVariantId === component.variant_id) {
|
|
4180
|
-
return
|
|
4181
|
+
return chunk7Y2O3E4D_js.parsePrice(component.effective_price);
|
|
4181
4182
|
}
|
|
4182
4183
|
const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
|
|
4183
4184
|
const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
|
|
4184
|
-
if (!selectedAdj) return
|
|
4185
|
-
return
|
|
4185
|
+
if (!selectedAdj) return chunk7Y2O3E4D_js.parsePrice(component.effective_price);
|
|
4186
|
+
return chunk7Y2O3E4D_js.parsePrice(component.effective_price) - chunk7Y2O3E4D_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunk7Y2O3E4D_js.parsePrice(selectedAdj.price_adjustment);
|
|
4186
4187
|
}
|
|
4187
4188
|
function formatDuration(minutes, unit) {
|
|
4188
4189
|
if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
|
|
@@ -4295,7 +4296,7 @@ function BundleComponentCard({
|
|
|
4295
4296
|
className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
|
|
4296
4297
|
children: component.available_variants.map((variant) => {
|
|
4297
4298
|
const isSelected = selectedVariantId === variant.id;
|
|
4298
|
-
const adjustment =
|
|
4299
|
+
const adjustment = chunk7Y2O3E4D_js.parsePrice(variant.price_adjustment);
|
|
4299
4300
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4300
4301
|
radio.Radio.Root,
|
|
4301
4302
|
{
|
|
@@ -4741,7 +4742,7 @@ function CompositeSelector({
|
|
|
4741
4742
|
"data-cimplify-composite-summary": true,
|
|
4742
4743
|
className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
|
|
4743
4744
|
children: [
|
|
4744
|
-
|
|
4745
|
+
chunk7Y2O3E4D_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4745
4746
|
"div",
|
|
4746
4747
|
{
|
|
4747
4748
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -4752,7 +4753,7 @@ function CompositeSelector({
|
|
|
4752
4753
|
]
|
|
4753
4754
|
}
|
|
4754
4755
|
),
|
|
4755
|
-
|
|
4756
|
+
chunk7Y2O3E4D_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4756
4757
|
"div",
|
|
4757
4758
|
{
|
|
4758
4759
|
"data-cimplify-composite-summary-line": true,
|
|
@@ -5304,7 +5305,7 @@ function InputField({
|
|
|
5304
5305
|
onFileUpload,
|
|
5305
5306
|
classNames
|
|
5306
5307
|
}) {
|
|
5307
|
-
const hasPriceAdjustment = field.price_adjustment != null &&
|
|
5308
|
+
const hasPriceAdjustment = field.price_adjustment != null && chunk7Y2O3E4D_js.parsePrice(field.price_adjustment) > 0;
|
|
5308
5309
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customer-input": true, "data-field-type": field.field_type, className: classNames?.field, children: [
|
|
5309
5310
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
5310
5311
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: cn("text-sm font-semibold", classNames?.label), children: field.name }),
|
|
@@ -6611,18 +6612,18 @@ function ProductCustomizer({
|
|
|
6611
6612
|
}, [selectedAddOnOptionIds]);
|
|
6612
6613
|
const localTotalPrice = React10.useMemo(() => {
|
|
6613
6614
|
if (isComposite && compositePrice) {
|
|
6614
|
-
return
|
|
6615
|
+
return chunk7Y2O3E4D_js.parsePrice(compositePrice.final_price) * quantity;
|
|
6615
6616
|
}
|
|
6616
6617
|
if (isBundle && bundleTotalPrice != null) {
|
|
6617
6618
|
return bundleTotalPrice * quantity;
|
|
6618
6619
|
}
|
|
6619
|
-
let price =
|
|
6620
|
+
let price = chunk7Y2O3E4D_js.parsePrice(product.default_price);
|
|
6620
6621
|
if (selectedVariant?.price_adjustment) {
|
|
6621
|
-
price +=
|
|
6622
|
+
price += chunk7Y2O3E4D_js.parsePrice(selectedVariant.price_adjustment);
|
|
6622
6623
|
}
|
|
6623
6624
|
for (const option of selectedAddOnOptions) {
|
|
6624
6625
|
if (option.default_price) {
|
|
6625
|
-
price +=
|
|
6626
|
+
price += chunk7Y2O3E4D_js.parsePrice(option.default_price);
|
|
6626
6627
|
}
|
|
6627
6628
|
}
|
|
6628
6629
|
return price * quantity;
|
|
@@ -6671,7 +6672,7 @@ function ProductCustomizer({
|
|
|
6671
6672
|
const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
|
|
6672
6673
|
const perUnit = priceInfo.pre_tax_price;
|
|
6673
6674
|
if (perUnit === void 0 || perUnit === null) return void 0;
|
|
6674
|
-
return
|
|
6675
|
+
return chunk7Y2O3E4D_js.parsePrice(perUnit) * quantity;
|
|
6675
6676
|
}, [quote, quantity]);
|
|
6676
6677
|
const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
|
|
6677
6678
|
const handleVariantChange = React10.useCallback(
|
|
@@ -6809,7 +6810,7 @@ function ProductCustomizer({
|
|
|
6809
6810
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
|
|
6810
6811
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
6811
6812
|
"Deposit required: ",
|
|
6812
|
-
|
|
6813
|
+
chunk7Y2O3E4D_js.parsePrice(product.deposit_amount),
|
|
6813
6814
|
"%"
|
|
6814
6815
|
] }) }),
|
|
6815
6816
|
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(
|
|
@@ -6870,7 +6871,7 @@ function ProductCustomizer({
|
|
|
6870
6871
|
] })
|
|
6871
6872
|
] }),
|
|
6872
6873
|
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: [
|
|
6873
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
6874
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunk7Y2O3E4D_js.parsePrice(product.default_price)), className: "font-medium text-foreground" }),
|
|
6874
6875
|
" ea."
|
|
6875
6876
|
] }),
|
|
6876
6877
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7277,7 +7278,7 @@ function CartLineItemRow({
|
|
|
7277
7278
|
const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
|
|
7278
7279
|
const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
|
|
7279
7280
|
const isOptimistic = item.isOptimistic === true;
|
|
7280
|
-
const lineTotal =
|
|
7281
|
+
const lineTotal = chunk7Y2O3E4D_js.parsePrice(unitPrice) * item.quantity;
|
|
7281
7282
|
const imageUrl = item.product.image_url;
|
|
7282
7283
|
const variantLabel = item.variant ? chunkMN4PNKJA_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
7283
7284
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -7510,15 +7511,15 @@ function CartSummary({
|
|
|
7510
7511
|
] }),
|
|
7511
7512
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal, className: "tabular-nums" })
|
|
7512
7513
|
] }),
|
|
7513
|
-
totalDiscounts != null &&
|
|
7514
|
+
totalDiscounts != null && chunk7Y2O3E4D_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: cn("flex items-baseline justify-between", classNames?.discount), children: [
|
|
7514
7515
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Discount" }),
|
|
7515
7516
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-", className: "tabular-nums text-primary" })
|
|
7516
7517
|
] }),
|
|
7517
7518
|
deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: cn("flex items-baseline justify-between", classNames?.deliveryFee), children: [
|
|
7518
7519
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
7519
|
-
|
|
7520
|
+
chunk7Y2O3E4D_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee, className: "tabular-nums" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "Free" })
|
|
7520
7521
|
] }),
|
|
7521
|
-
serviceCharge != null &&
|
|
7522
|
+
serviceCharge != null && chunk7Y2O3E4D_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: cn("flex items-baseline justify-between", classNames?.serviceCharge), children: [
|
|
7522
7523
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Service charge" }),
|
|
7523
7524
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge, className: "tabular-nums" })
|
|
7524
7525
|
] }),
|
|
@@ -7608,16 +7609,16 @@ function SaleBadge({
|
|
|
7608
7609
|
className,
|
|
7609
7610
|
classNames
|
|
7610
7611
|
}) {
|
|
7611
|
-
const onSale =
|
|
7612
|
+
const onSale = chunk7Y2O3E4D_js.isOnSale(product);
|
|
7612
7613
|
const hasDeal = dealInfo !== void 0;
|
|
7613
7614
|
if (!hasDeal && !onSale && !label) {
|
|
7614
7615
|
return null;
|
|
7615
7616
|
}
|
|
7616
7617
|
let percentage = null;
|
|
7617
7618
|
if (hasDeal && dealInfo.benefit_type === "percentage") {
|
|
7618
|
-
percentage =
|
|
7619
|
+
percentage = chunk7Y2O3E4D_js.parsePrice(dealInfo.value);
|
|
7619
7620
|
} else if (onSale) {
|
|
7620
|
-
percentage =
|
|
7621
|
+
percentage = chunk7Y2O3E4D_js.getDiscountPercentage(product);
|
|
7621
7622
|
}
|
|
7622
7623
|
const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
|
|
7623
7624
|
if (!badgeText) {
|
|
@@ -7636,7 +7637,7 @@ function SaleBadge({
|
|
|
7636
7637
|
"%"
|
|
7637
7638
|
] }),
|
|
7638
7639
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
|
|
7639
|
-
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
7640
|
+
showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product) }) })
|
|
7640
7641
|
]
|
|
7641
7642
|
}
|
|
7642
7643
|
);
|
|
@@ -7894,8 +7895,8 @@ function SoldOutOverlay() {
|
|
|
7894
7895
|
);
|
|
7895
7896
|
}
|
|
7896
7897
|
function SaleBadge2({ product }) {
|
|
7897
|
-
if (!
|
|
7898
|
-
const pct =
|
|
7898
|
+
if (!chunk7Y2O3E4D_js.isOnSale(product)) return null;
|
|
7899
|
+
const pct = chunk7Y2O3E4D_js.getDiscountPercentage(product);
|
|
7899
7900
|
if (!pct || pct <= 0) return null;
|
|
7900
7901
|
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: [
|
|
7901
7902
|
"-",
|
|
@@ -7988,7 +7989,7 @@ function RetailProductCard({
|
|
|
7988
7989
|
}) {
|
|
7989
7990
|
const image = product.image_url || product.images?.[0] || "";
|
|
7990
7991
|
const outOfStock = product.inventory_status?.in_stock === false;
|
|
7991
|
-
const onSale =
|
|
7992
|
+
const onSale = chunk7Y2O3E4D_js.isOnSale(product);
|
|
7992
7993
|
const swatches = getColorSwatches(product);
|
|
7993
7994
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
7994
7995
|
outOfStock && /* @__PURE__ */ jsxRuntime.jsx(SoldOutOverlay, {}),
|
|
@@ -8006,7 +8007,7 @@ function RetailProductCard({
|
|
|
8006
8007
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
|
|
8007
8008
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
8008
8009
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
8009
|
-
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
8010
|
+
onSale && /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product), className: "text-xs text-muted-foreground line-through" })
|
|
8010
8011
|
] }),
|
|
8011
8012
|
swatches.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8012
8013
|
"span",
|
|
@@ -8023,9 +8024,9 @@ function RetailProductCard({
|
|
|
8023
8024
|
function PriceRange({ product, currency, className }) {
|
|
8024
8025
|
const context = useOptionalCimplify();
|
|
8025
8026
|
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
8026
|
-
const range =
|
|
8027
|
+
const range = chunk7Y2O3E4D_js.getPriceRange(product);
|
|
8027
8028
|
if (!range) return null;
|
|
8028
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children:
|
|
8029
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunk7Y2O3E4D_js.formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
8029
8030
|
}
|
|
8030
8031
|
function WholesaleProductCard({
|
|
8031
8032
|
product,
|
|
@@ -8114,8 +8115,8 @@ function BundleProductCard({
|
|
|
8114
8115
|
const image = product.image_url || product.images?.[0] || "";
|
|
8115
8116
|
const components = product.components || [];
|
|
8116
8117
|
const componentCount = components.length;
|
|
8117
|
-
const onSale =
|
|
8118
|
-
const discount =
|
|
8118
|
+
const onSale = chunk7Y2O3E4D_js.isOnSale(product);
|
|
8119
|
+
const discount = chunk7Y2O3E4D_js.getDiscountPercentage(product);
|
|
8119
8120
|
const hasVariantChoice = components.some((c) => c.allow_variant_choice);
|
|
8120
8121
|
return /* @__PURE__ */ jsxRuntime.jsxs(CardShell, { product, renderLink, className, children: [
|
|
8121
8122
|
/* @__PURE__ */ jsxRuntime.jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
@@ -8142,7 +8143,7 @@ function BundleProductCard({
|
|
|
8142
8143
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mt-2.5", children: [
|
|
8143
8144
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
8144
8145
|
onSale && product.bundle_price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8145
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
8146
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product), className: "text-xs text-muted-foreground line-through" }),
|
|
8146
8147
|
discount != null && discount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[10px] font-semibold text-emerald-600", children: [
|
|
8147
8148
|
"Save ",
|
|
8148
8149
|
discount,
|
|
@@ -9054,7 +9055,7 @@ function SearchInput({
|
|
|
9054
9055
|
}
|
|
9055
9056
|
),
|
|
9056
9057
|
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
|
|
9057
|
-
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children:
|
|
9058
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunk7Y2O3E4D_js.formatPrice(product.default_price) })
|
|
9058
9059
|
] })
|
|
9059
9060
|
},
|
|
9060
9061
|
product.id
|
|
@@ -9548,19 +9549,19 @@ function OrderSummary({
|
|
|
9548
9549
|
order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
|
|
9549
9550
|
] }),
|
|
9550
9551
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
|
|
9551
|
-
order.total_discount != null &&
|
|
9552
|
+
order.total_discount != null && chunk7Y2O3E4D_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
|
|
9552
9553
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
9553
9554
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
|
|
9554
9555
|
] }),
|
|
9555
|
-
order.delivery_fee != null &&
|
|
9556
|
+
order.delivery_fee != null && chunk7Y2O3E4D_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
|
|
9556
9557
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
|
|
9557
9558
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
|
|
9558
9559
|
] }),
|
|
9559
|
-
order.service_charge != null &&
|
|
9560
|
+
order.service_charge != null && chunk7Y2O3E4D_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
|
|
9560
9561
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
|
|
9561
9562
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
|
|
9562
9563
|
] }),
|
|
9563
|
-
order.tax != null &&
|
|
9564
|
+
order.tax != null && chunk7Y2O3E4D_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
|
|
9564
9565
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
|
|
9565
9566
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
|
|
9566
9567
|
] }),
|
|
@@ -10148,7 +10149,7 @@ function BookingPage({
|
|
|
10148
10149
|
const hasStaffStep = staff && staff.length > 0;
|
|
10149
10150
|
const depositType = product?.deposit_type;
|
|
10150
10151
|
const depositAmount = product?.deposit_amount;
|
|
10151
|
-
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 &&
|
|
10152
|
+
const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunk7Y2O3E4D_js.parsePrice(depositAmount) !== 0;
|
|
10152
10153
|
const cancellationMinutes = product?.cancellation_window_minutes;
|
|
10153
10154
|
const noShowFee = product?.no_show_fee;
|
|
10154
10155
|
const handleSlotSelect = React10.useCallback(
|
|
@@ -10280,14 +10281,14 @@ function BookingPage({
|
|
|
10280
10281
|
service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
|
|
10281
10282
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
10282
10283
|
"Deposit: ",
|
|
10283
|
-
depositType === "percentage" ? `${
|
|
10284
|
+
depositType === "percentage" ? `${chunk7Y2O3E4D_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
|
|
10284
10285
|
] }),
|
|
10285
10286
|
cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
|
|
10286
10287
|
"Free cancellation up to ",
|
|
10287
10288
|
cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
|
|
10288
10289
|
" before"
|
|
10289
10290
|
] }),
|
|
10290
|
-
noShowFee !== void 0 &&
|
|
10291
|
+
noShowFee !== void 0 && chunk7Y2O3E4D_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
|
|
10291
10292
|
"No-show fee: ",
|
|
10292
10293
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
|
|
10293
10294
|
] })
|
|
@@ -10364,7 +10365,7 @@ function BookingPage({
|
|
|
10364
10365
|
] }),
|
|
10365
10366
|
hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
|
|
10366
10367
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
|
|
10367
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${
|
|
10368
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunk7Y2O3E4D_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
|
|
10368
10369
|
] })
|
|
10369
10370
|
] }),
|
|
10370
10371
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11028,7 +11029,7 @@ function DefaultProductLayout({
|
|
|
11028
11029
|
}) {
|
|
11029
11030
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
11030
11031
|
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
11031
|
-
const onSale =
|
|
11032
|
+
const onSale = chunk7Y2O3E4D_js.isOnSale(product);
|
|
11032
11033
|
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
11033
11034
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
11034
11035
|
renderBreadcrumb?.(product),
|
|
@@ -11050,10 +11051,10 @@ function DefaultProductLayout({
|
|
|
11050
11051
|
/* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
|
|
11051
11052
|
/* @__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: [
|
|
11052
11053
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-extrabold" }),
|
|
11053
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount:
|
|
11054
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunk7Y2O3E4D_js.getBasePrice(product), className: "text-lg text-muted-foreground line-through" }),
|
|
11054
11055
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
11055
11056
|
"Save ",
|
|
11056
|
-
|
|
11057
|
+
chunk7Y2O3E4D_js.getDiscountPercentage(product),
|
|
11057
11058
|
"%"
|
|
11058
11059
|
] })
|
|
11059
11060
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
|
|
@@ -11272,7 +11273,7 @@ function ServiceProductLayout({
|
|
|
11272
11273
|
}) {
|
|
11273
11274
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
11274
11275
|
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
11275
|
-
const depositAmount = hasDeposit ?
|
|
11276
|
+
const depositAmount = hasDeposit ? chunk7Y2O3E4D_js.parsePrice(product.deposit_amount) : 0;
|
|
11276
11277
|
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
11277
11278
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
11278
11279
|
renderBreadcrumb?.(product),
|
|
@@ -11340,7 +11341,7 @@ function ServiceProductLayout({
|
|
|
11340
11341
|
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, className: "font-medium text-foreground" }),
|
|
11341
11342
|
" deposit charged at booking"
|
|
11342
11343
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11343
|
-
|
|
11344
|
+
chunk7Y2O3E4D_js.parsePrice(product.deposit_amount),
|
|
11344
11345
|
"% deposit charged at booking"
|
|
11345
11346
|
] }) })
|
|
11346
11347
|
] })
|
|
@@ -11499,13 +11500,13 @@ function BundleProductLayout({
|
|
|
11499
11500
|
}) {
|
|
11500
11501
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
11501
11502
|
const components = product.components || [];
|
|
11502
|
-
const onSale =
|
|
11503
|
-
const discount =
|
|
11503
|
+
const onSale = chunk7Y2O3E4D_js.isOnSale(product);
|
|
11504
|
+
const discount = chunk7Y2O3E4D_js.getDiscountPercentage(product);
|
|
11504
11505
|
const baseTotal = components.reduce(
|
|
11505
|
-
(sum, c) => sum +
|
|
11506
|
+
(sum, c) => sum + chunk7Y2O3E4D_js.parsePrice(c.effective_price ?? 0) * (c.quantity ?? 1),
|
|
11506
11507
|
0
|
|
11507
11508
|
);
|
|
11508
|
-
const bundlePrice =
|
|
11509
|
+
const bundlePrice = chunk7Y2O3E4D_js.parsePrice(product.default_price);
|
|
11509
11510
|
const savings = baseTotal > bundlePrice ? baseTotal - bundlePrice : 0;
|
|
11510
11511
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "bundle", className: cn("space-y-8", className), children: [
|
|
11511
11512
|
renderBreadcrumb?.(product),
|
|
@@ -11997,7 +11998,7 @@ function CartDrawer({
|
|
|
11997
11998
|
}) {
|
|
11998
11999
|
const { isOpen, close } = useCartDrawer();
|
|
11999
12000
|
const cart = useCart();
|
|
12000
|
-
const subtotalNum =
|
|
12001
|
+
const subtotalNum = chunk7Y2O3E4D_js.parsePrice(cart.subtotal);
|
|
12001
12002
|
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
12002
12003
|
React10.useEffect(() => {
|
|
12003
12004
|
if (!isOpen) return;
|
|
@@ -12391,9 +12392,9 @@ function CatalogueCollectionLayout({
|
|
|
12391
12392
|
result = result.filter((p) => p.tags?.includes(activeCategory));
|
|
12392
12393
|
}
|
|
12393
12394
|
if (sortBy === "price-asc") {
|
|
12394
|
-
result = [...result].sort((a, b) =>
|
|
12395
|
+
result = [...result].sort((a, b) => chunk7Y2O3E4D_js.parsePrice(a.default_price) - chunk7Y2O3E4D_js.parsePrice(b.default_price));
|
|
12395
12396
|
} else if (sortBy === "price-desc") {
|
|
12396
|
-
result = [...result].sort((a, b) =>
|
|
12397
|
+
result = [...result].sort((a, b) => chunk7Y2O3E4D_js.parsePrice(b.default_price) - chunk7Y2O3E4D_js.parsePrice(a.default_price));
|
|
12397
12398
|
} else if (sortBy === "name") {
|
|
12398
12399
|
result = [...result].sort((a, b) => a.name.localeCompare(b.name));
|
|
12399
12400
|
}
|
package/dist/react.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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-4QDCMYYB.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-GLAVTDDE.mjs';
|
|
6
|
+
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
|
|
7
|
+
import { isSupportedCurrency } from './chunk-AMZXALF6.mjs';
|
|
8
|
+
import './chunk-3G6RQLXK.mjs';
|
|
8
9
|
import React10, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
|
|
9
10
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
import { clsx } from 'clsx';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IncrementalCache } from '@opennextjs/aws/types/overrides';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cimplify incremental-cache override for Workers for Platforms storefronts.
|
|
5
|
+
*
|
|
6
|
+
* Replaces opennext's stale-while-revalidate model with an evict-on-invalidate
|
|
7
|
+
* model that fits Cimplify's event-driven domain:
|
|
8
|
+
*
|
|
9
|
+
* - `get`: standard R2 fetch. Returns the cached value or null.
|
|
10
|
+
* - `set`: writes to R2 AND emits a tag→cache_key index update to the shared
|
|
11
|
+
* `CIMPLIFY_PATH_INDEX` Durable Object (hosted in cimplify-tag-cache).
|
|
12
|
+
* - `delete`: standard R2 delete (called by opennext on explicit invalidate;
|
|
13
|
+
* also called by us from the Rust EvictionDispatcher path on tag events).
|
|
14
|
+
*
|
|
15
|
+
* The Rust EvictionDispatcher reads the index on bus events, deletes the
|
|
16
|
+
* matching R2 entries directly, and prunes the index — there is no SWR
|
|
17
|
+
* "background refresh" path. opennext's queue and `isStale` checks become
|
|
18
|
+
* no-ops; cached entries are by definition fresh (existed at write time and
|
|
19
|
+
* haven't been evicted), and absence means the next request synchronously
|
|
20
|
+
* re-renders.
|
|
21
|
+
*
|
|
22
|
+
* Why this exists: WfP user workers cannot have `WORKER_SELF_REFERENCE`,
|
|
23
|
+
* which is the binding every built-in opennext queue requires. Rather than
|
|
24
|
+
* recreate SWR via self-fetch tricks, we drop SWR for our domain — Cimplify
|
|
25
|
+
* always knows when data changes (every catalog mutation flows through the
|
|
26
|
+
* bus), so timer-based refresh adds no value.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare const evictIncrementalCache: IncrementalCache;
|
|
30
|
+
|
|
31
|
+
export { evictIncrementalCache };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IncrementalCache } from '@opennextjs/aws/types/overrides';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cimplify incremental-cache override for Workers for Platforms storefronts.
|
|
5
|
+
*
|
|
6
|
+
* Replaces opennext's stale-while-revalidate model with an evict-on-invalidate
|
|
7
|
+
* model that fits Cimplify's event-driven domain:
|
|
8
|
+
*
|
|
9
|
+
* - `get`: standard R2 fetch. Returns the cached value or null.
|
|
10
|
+
* - `set`: writes to R2 AND emits a tag→cache_key index update to the shared
|
|
11
|
+
* `CIMPLIFY_PATH_INDEX` Durable Object (hosted in cimplify-tag-cache).
|
|
12
|
+
* - `delete`: standard R2 delete (called by opennext on explicit invalidate;
|
|
13
|
+
* also called by us from the Rust EvictionDispatcher path on tag events).
|
|
14
|
+
*
|
|
15
|
+
* The Rust EvictionDispatcher reads the index on bus events, deletes the
|
|
16
|
+
* matching R2 entries directly, and prunes the index — there is no SWR
|
|
17
|
+
* "background refresh" path. opennext's queue and `isStale` checks become
|
|
18
|
+
* no-ops; cached entries are by definition fresh (existed at write time and
|
|
19
|
+
* haven't been evicted), and absence means the next request synchronously
|
|
20
|
+
* re-renders.
|
|
21
|
+
*
|
|
22
|
+
* Why this exists: WfP user workers cannot have `WORKER_SELF_REFERENCE`,
|
|
23
|
+
* which is the binding every built-in opennext queue requires. Rather than
|
|
24
|
+
* recreate SWR via self-fetch tricks, we drop SWR for our domain — Cimplify
|
|
25
|
+
* always knows when data changes (every catalog mutation flows through the
|
|
26
|
+
* bus), so timer-based refresh adds no value.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare const evictIncrementalCache: IncrementalCache;
|
|
30
|
+
|
|
31
|
+
export { evictIncrementalCache };
|