@sonordev/site-kit 1.4.4 → 1.4.6
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/{chunk-GA2MN6CF.mjs → chunk-EG2FNRKR.mjs} +291 -15
- package/dist/chunk-EG2FNRKR.mjs.map +1 -0
- package/dist/{chunk-BYXMT7IG.js → chunk-WAY6CT4A.js} +291 -14
- package/dist/chunk-WAY6CT4A.js.map +1 -0
- package/dist/commerce/index.d.mts +3 -3
- package/dist/commerce/index.d.ts +3 -3
- package/dist/commerce/index.js +48 -44
- package/dist/commerce/index.mjs +1 -1
- package/dist/commerce/server.d.mts +1 -1
- package/dist/commerce/server.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -25
- package/dist/index.mjs +1 -1
- package/dist/{types-Bn7nF4Ty.d.mts → types-B0xmgGw-.d.mts} +16 -0
- package/dist/{types-Bn7nF4Ty.d.ts → types-B0xmgGw-.d.ts} +16 -0
- package/dist/{useEventModal-DGZ3Wu1t.d.mts → useEventModal-C4Dr4Psb.d.ts} +18 -2
- package/dist/{useEventModal-DojKfkPE.d.ts → useEventModal-DvqBRau-.d.mts} +18 -2
- package/package.json +1 -1
- package/dist/chunk-BYXMT7IG.js.map +0 -1
- package/dist/chunk-GA2MN6CF.mjs.map +0 -1
|
@@ -319,6 +319,26 @@ async function registerForEvent(eventId, scheduleId, customer) {
|
|
|
319
319
|
return { success: false, error: "Network error. Please try again." };
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
+
async function validateDiscountCode(code, subtotal, offeringIds = []) {
|
|
323
|
+
const { apiUrl, apiKey } = getApiConfig();
|
|
324
|
+
try {
|
|
325
|
+
const response = await fetch(`${apiUrl}/api/public/commerce/discount/validate`, {
|
|
326
|
+
method: "POST",
|
|
327
|
+
headers: {
|
|
328
|
+
"Content-Type": "application/json",
|
|
329
|
+
"x-api-key": apiKey
|
|
330
|
+
},
|
|
331
|
+
body: JSON.stringify({ code, subtotal, offeringIds })
|
|
332
|
+
});
|
|
333
|
+
if (!response.ok) {
|
|
334
|
+
const body = await response.json().catch(() => ({}));
|
|
335
|
+
return { valid: false, message: body?.message || "Invalid discount code" };
|
|
336
|
+
}
|
|
337
|
+
return await response.json();
|
|
338
|
+
} catch {
|
|
339
|
+
return { valid: false, message: "Could not validate discount code" };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
322
342
|
async function fetchProcessorConfig() {
|
|
323
343
|
const { apiUrl, apiKey } = getApiConfig();
|
|
324
344
|
if (!apiKey) return null;
|
|
@@ -1267,9 +1287,9 @@ function SizeChart({ chart, selectedSize, className }) {
|
|
|
1267
1287
|
gap: 0
|
|
1268
1288
|
},
|
|
1269
1289
|
children: [
|
|
1270
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight:
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: activeUnit === "inches" ? 700 : 400, opacity: activeUnit === "inches" ? 1 : 0.45 }, children: "in" }),
|
|
1271
1291
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { margin: "0 3px", opacity: 0.3 }, children: "/" }),
|
|
1272
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight:
|
|
1292
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: activeUnit === "cm" ? 700 : 400, opacity: activeUnit === "cm" ? 1 : 0.45 }, children: "cm" })
|
|
1273
1293
|
]
|
|
1274
1294
|
}
|
|
1275
1295
|
)
|
|
@@ -1707,7 +1727,7 @@ var ICON_MAP = {
|
|
|
1707
1727
|
return: IconReturn,
|
|
1708
1728
|
shield: IconShield
|
|
1709
1729
|
};
|
|
1710
|
-
function ProductGallery({ images, productName, selectedIndex, onSelect }) {
|
|
1730
|
+
function ProductGallery({ images, productName, selectedIndex, onSelect, imageIds, imageModelInfo }) {
|
|
1711
1731
|
const [zoomStyle, setZoomStyle] = React5.useState(null);
|
|
1712
1732
|
const [isHovering, setIsHovering] = React5.useState(false);
|
|
1713
1733
|
const handleMouseMove = (e) => {
|
|
@@ -1748,6 +1768,39 @@ function ProductGallery({ images, productName, selectedIndex, onSelect }) {
|
|
|
1748
1768
|
draggable: false
|
|
1749
1769
|
}
|
|
1750
1770
|
),
|
|
1771
|
+
(() => {
|
|
1772
|
+
const currentImgId = imageIds?.[selectedIndex];
|
|
1773
|
+
const modelInfo = currentImgId && imageModelInfo?.[currentImgId];
|
|
1774
|
+
if (!modelInfo) return null;
|
|
1775
|
+
const parts = [];
|
|
1776
|
+
if (modelInfo.height) parts.push(modelInfo.height);
|
|
1777
|
+
if (modelInfo.weight) parts.push(modelInfo.weight);
|
|
1778
|
+
const line1 = parts.length ? `Model: ${parts.join(", ")}` : modelInfo.model_name ? `Model: ${modelInfo.model_name}` : null;
|
|
1779
|
+
const line2 = modelInfo.wearing_size ? `Wearing size ${modelInfo.wearing_size}` : null;
|
|
1780
|
+
if (!line1 && !line2) return null;
|
|
1781
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1782
|
+
"div",
|
|
1783
|
+
{
|
|
1784
|
+
style: {
|
|
1785
|
+
position: "absolute",
|
|
1786
|
+
bottom: 0,
|
|
1787
|
+
left: 0,
|
|
1788
|
+
right: 0,
|
|
1789
|
+
background: "linear-gradient(transparent, rgba(0,0,0,0.65))",
|
|
1790
|
+
padding: "1.5rem 1rem 0.75rem",
|
|
1791
|
+
color: "#fff",
|
|
1792
|
+
fontSize: "0.8125rem",
|
|
1793
|
+
lineHeight: 1.4,
|
|
1794
|
+
pointerEvents: "none",
|
|
1795
|
+
zIndex: 2
|
|
1796
|
+
},
|
|
1797
|
+
children: [
|
|
1798
|
+
line1 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600 }, children: line1 }),
|
|
1799
|
+
line2 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 400, opacity: 0.9 }, children: line2 })
|
|
1800
|
+
]
|
|
1801
|
+
}
|
|
1802
|
+
);
|
|
1803
|
+
})(),
|
|
1751
1804
|
images.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1752
1805
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1753
1806
|
"button",
|
|
@@ -1874,20 +1927,33 @@ function VariantSelector({ variants, selected, isClothing, showInventory, onSele
|
|
|
1874
1927
|
disabled: variantOutOfStock,
|
|
1875
1928
|
style: {
|
|
1876
1929
|
position: "relative",
|
|
1877
|
-
padding: "0.5rem 1rem",
|
|
1930
|
+
padding: variantOutOfStock ? "0.375rem 1rem 0.25rem" : "0.5rem 1rem",
|
|
1878
1931
|
borderRadius: "var(--commerce-radius-sm, 8px)",
|
|
1879
|
-
border: isSelected ? "2px solid var(--commerce-accent, #2563eb)" : "1px solid var(--commerce-border, #e5e7eb)",
|
|
1880
|
-
backgroundColor: isSelected ? "color-mix(in srgb, var(--commerce-accent, #2563eb) 8%, transparent)" : "var(--commerce-surface, #f9fafb)",
|
|
1932
|
+
border: isSelected ? "2px solid var(--commerce-accent, #2563eb)" : variantOutOfStock ? "1px solid var(--commerce-border, #e5e7eb)" : "1px solid var(--commerce-border, #e5e7eb)",
|
|
1933
|
+
backgroundColor: isSelected ? "color-mix(in srgb, var(--commerce-accent, #2563eb) 8%, transparent)" : variantOutOfStock ? "var(--commerce-surface, #f9fafb)" : "var(--commerce-surface, #f9fafb)",
|
|
1881
1934
|
color: variantOutOfStock ? "var(--commerce-text-muted, #9ca3af)" : "var(--commerce-text, #111827)",
|
|
1882
1935
|
fontSize: "0.875rem",
|
|
1883
1936
|
fontWeight: 500,
|
|
1884
1937
|
cursor: variantOutOfStock ? "not-allowed" : "pointer",
|
|
1885
|
-
opacity: variantOutOfStock ? 0.
|
|
1938
|
+
opacity: variantOutOfStock ? 0.6 : 1,
|
|
1886
1939
|
transition: "all 0.15s ease",
|
|
1887
|
-
textDecoration:
|
|
1940
|
+
textDecoration: "none",
|
|
1941
|
+
display: "flex",
|
|
1942
|
+
flexDirection: "column",
|
|
1943
|
+
alignItems: "center",
|
|
1944
|
+
gap: variantOutOfStock ? "1px" : 0,
|
|
1945
|
+
minWidth: 48
|
|
1888
1946
|
},
|
|
1889
1947
|
children: [
|
|
1890
|
-
variant.options?.Size || variant.name,
|
|
1948
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { textDecoration: variantOutOfStock ? "line-through" : "none" }, children: variant.options?.Size || variant.name }),
|
|
1949
|
+
variantOutOfStock && /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
|
|
1950
|
+
fontSize: "0.5625rem",
|
|
1951
|
+
fontWeight: 600,
|
|
1952
|
+
color: "var(--commerce-danger, #dc2626)",
|
|
1953
|
+
textTransform: "uppercase",
|
|
1954
|
+
letterSpacing: "0.03em",
|
|
1955
|
+
lineHeight: 1
|
|
1956
|
+
}, children: "Sold Out" }),
|
|
1891
1957
|
showInventory && !variantOutOfStock && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1892
1958
|
"span",
|
|
1893
1959
|
{
|
|
@@ -3124,6 +3190,21 @@ function ProductDetail({
|
|
|
3124
3190
|
...product.variants?.map((v) => v.image_url).filter(Boolean) || []
|
|
3125
3191
|
].filter(Boolean);
|
|
3126
3192
|
}, [product]);
|
|
3193
|
+
const allImageIds = React5.useMemo(() => {
|
|
3194
|
+
if (!product) return [];
|
|
3195
|
+
const ids = [
|
|
3196
|
+
product.featured_image_id,
|
|
3197
|
+
...product.gallery_image_ids || [],
|
|
3198
|
+
...product.variants?.map((v) => v.id) || []
|
|
3199
|
+
// variant images don't have separate IDs for model info
|
|
3200
|
+
];
|
|
3201
|
+
const urls = [
|
|
3202
|
+
product.featured_image_url,
|
|
3203
|
+
...product.gallery_images || [],
|
|
3204
|
+
...product.variants?.map((v) => v.image_url).filter(Boolean) || []
|
|
3205
|
+
];
|
|
3206
|
+
return urls.map((url, i) => url ? ids[i] : void 0).filter((_id, i) => urls[i]);
|
|
3207
|
+
}, [product]);
|
|
3127
3208
|
const currentPrice = product ? selectedVariant?.price ?? product.price ?? 0 : 0;
|
|
3128
3209
|
const compareAtPrice = product?.compare_at_price;
|
|
3129
3210
|
const hasDiscount = compareAtPrice != null && compareAtPrice > currentPrice;
|
|
@@ -3332,7 +3413,9 @@ function ProductDetail({
|
|
|
3332
3413
|
images: allImages,
|
|
3333
3414
|
productName: product.name,
|
|
3334
3415
|
selectedIndex: selectedImage,
|
|
3335
|
-
onSelect: setSelectedImage
|
|
3416
|
+
onSelect: setSelectedImage,
|
|
3417
|
+
imageIds: allImageIds,
|
|
3418
|
+
imageModelInfo: product.metadata?.image_model_info
|
|
3336
3419
|
}
|
|
3337
3420
|
),
|
|
3338
3421
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -3499,6 +3582,18 @@ function ProductDetail({
|
|
|
3499
3582
|
onSelect: handleVariantChange
|
|
3500
3583
|
}
|
|
3501
3584
|
),
|
|
3585
|
+
product.metadata?.sizing_notes && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3586
|
+
"div",
|
|
3587
|
+
{
|
|
3588
|
+
style: {
|
|
3589
|
+
marginTop: "0.5rem",
|
|
3590
|
+
fontSize: "0.8125rem",
|
|
3591
|
+
color: "var(--commerce-text-secondary, #6b7280)",
|
|
3592
|
+
fontStyle: "italic"
|
|
3593
|
+
},
|
|
3594
|
+
children: product.metadata.sizing_notes
|
|
3595
|
+
}
|
|
3596
|
+
),
|
|
3502
3597
|
product.size_chart?.fit_note && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3503
3598
|
"div",
|
|
3504
3599
|
{
|
|
@@ -3526,6 +3621,34 @@ function ProductDetail({
|
|
|
3526
3621
|
]
|
|
3527
3622
|
}
|
|
3528
3623
|
),
|
|
3624
|
+
product.metadata?.notices?.map((notice, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3625
|
+
"div",
|
|
3626
|
+
{
|
|
3627
|
+
style: {
|
|
3628
|
+
marginTop: "0.75rem",
|
|
3629
|
+
padding: "0.625rem 0.875rem",
|
|
3630
|
+
borderRadius: "var(--commerce-radius-sm, 8px)",
|
|
3631
|
+
backgroundColor: "color-mix(in srgb, var(--commerce-warning, #d97706) 10%, transparent)",
|
|
3632
|
+
border: "1px solid color-mix(in srgb, var(--commerce-warning, #d97706) 25%, transparent)",
|
|
3633
|
+
display: "flex",
|
|
3634
|
+
alignItems: "flex-start",
|
|
3635
|
+
gap: "0.5rem",
|
|
3636
|
+
fontSize: "0.8125rem",
|
|
3637
|
+
color: "var(--commerce-warning, #d97706)",
|
|
3638
|
+
fontWeight: 500,
|
|
3639
|
+
lineHeight: 1.4
|
|
3640
|
+
},
|
|
3641
|
+
children: [
|
|
3642
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0, marginTop: 1 }, children: [
|
|
3643
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }),
|
|
3644
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
3645
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
3646
|
+
] }),
|
|
3647
|
+
notice
|
|
3648
|
+
]
|
|
3649
|
+
},
|
|
3650
|
+
idx
|
|
3651
|
+
)),
|
|
3529
3652
|
showSizeChart && product.is_clothing && product.size_chart && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "0.625rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3530
3653
|
SizeChart,
|
|
3531
3654
|
{
|
|
@@ -3588,6 +3711,35 @@ function ProductDetail({
|
|
|
3588
3711
|
}
|
|
3589
3712
|
),
|
|
3590
3713
|
showTrustBadges && /* @__PURE__ */ jsxRuntime.jsx(TrustBadges, { badges: trustBadges }),
|
|
3714
|
+
product.metadata?.care_instructions && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3715
|
+
"div",
|
|
3716
|
+
{
|
|
3717
|
+
style: {
|
|
3718
|
+
marginTop: "1rem",
|
|
3719
|
+
padding: "0.75rem 1rem",
|
|
3720
|
+
borderRadius: "var(--commerce-radius-sm, 8px)",
|
|
3721
|
+
backgroundColor: "color-mix(in srgb, var(--commerce-accent, #2563eb) 6%, transparent)",
|
|
3722
|
+
border: "1px solid color-mix(in srgb, var(--commerce-accent, #2563eb) 18%, transparent)",
|
|
3723
|
+
display: "flex",
|
|
3724
|
+
alignItems: "flex-start",
|
|
3725
|
+
gap: "0.625rem",
|
|
3726
|
+
fontSize: "0.8125rem",
|
|
3727
|
+
color: "var(--commerce-text-secondary, #6b7280)",
|
|
3728
|
+
lineHeight: 1.5
|
|
3729
|
+
},
|
|
3730
|
+
children: [
|
|
3731
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "var(--commerce-accent, #2563eb)", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { flexShrink: 0, marginTop: 2 }, children: [
|
|
3732
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" }),
|
|
3733
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
3734
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
3735
|
+
] }),
|
|
3736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3737
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 600, color: "var(--commerce-text, #111827)", marginBottom: 2 }, children: "Care Instructions" }),
|
|
3738
|
+
product.metadata.care_instructions
|
|
3739
|
+
] })
|
|
3740
|
+
]
|
|
3741
|
+
}
|
|
3742
|
+
),
|
|
3591
3743
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3592
3744
|
ProductTabs,
|
|
3593
3745
|
{
|
|
@@ -4326,6 +4478,9 @@ function CheckoutForm({
|
|
|
4326
4478
|
name: "",
|
|
4327
4479
|
phone: ""
|
|
4328
4480
|
});
|
|
4481
|
+
const [discountCode, setDiscountCode] = React5.useState("");
|
|
4482
|
+
const [discountResult, setDiscountResult] = React5.useState(null);
|
|
4483
|
+
const [applyingDiscount, setApplyingDiscount] = React5.useState(false);
|
|
4329
4484
|
const isProduct = offering.type === "product";
|
|
4330
4485
|
const analytics = chunkGTLIGQDM_js.useAnalyticsOptional();
|
|
4331
4486
|
React5.useEffect(() => {
|
|
@@ -4340,7 +4495,30 @@ function CheckoutForm({
|
|
|
4340
4495
|
const defaultSubmitText = actualMode === "register" ? "Register" : isFree ? "Complete Order" : "Continue to Payment";
|
|
4341
4496
|
const subtotal = offering.price ? offering.price * quantity : 0;
|
|
4342
4497
|
const shippingCost = selectedRate ? parseFloat(selectedRate.amount) : 0;
|
|
4343
|
-
const
|
|
4498
|
+
const discountAmount = discountResult?.valid ? discountResult.discount_amount ?? 0 : 0;
|
|
4499
|
+
const total = Math.max(0, subtotal + shippingCost - discountAmount);
|
|
4500
|
+
const handleApplyDiscount = async () => {
|
|
4501
|
+
if (!discountCode.trim()) return;
|
|
4502
|
+
setApplyingDiscount(true);
|
|
4503
|
+
try {
|
|
4504
|
+
const result = await validateDiscountCode(discountCode.trim(), subtotal, [offering.id]);
|
|
4505
|
+
setDiscountResult(result);
|
|
4506
|
+
if (!result.valid) {
|
|
4507
|
+
setError(result.message || "Invalid discount code");
|
|
4508
|
+
} else {
|
|
4509
|
+
setError(null);
|
|
4510
|
+
}
|
|
4511
|
+
} catch {
|
|
4512
|
+
setDiscountResult(null);
|
|
4513
|
+
setError("Could not validate discount code");
|
|
4514
|
+
} finally {
|
|
4515
|
+
setApplyingDiscount(false);
|
|
4516
|
+
}
|
|
4517
|
+
};
|
|
4518
|
+
const handleRemoveDiscount = () => {
|
|
4519
|
+
setDiscountCode("");
|
|
4520
|
+
setDiscountResult(null);
|
|
4521
|
+
};
|
|
4344
4522
|
const updateShippingAddress = (field, value) => {
|
|
4345
4523
|
setShippingAddress((prev) => ({ ...prev, [field]: value }));
|
|
4346
4524
|
};
|
|
@@ -4392,7 +4570,8 @@ function CheckoutForm({
|
|
|
4392
4570
|
variantId,
|
|
4393
4571
|
scheduleId,
|
|
4394
4572
|
quantity,
|
|
4395
|
-
customer
|
|
4573
|
+
customer,
|
|
4574
|
+
discountCode: discountResult?.valid ? discountCode.trim() : void 0
|
|
4396
4575
|
};
|
|
4397
4576
|
if (shippingEnabled && shippingAddress.street1 && selectedRate) {
|
|
4398
4577
|
checkoutOptions.shippingAddress = {
|
|
@@ -4471,6 +4650,103 @@ function CheckoutForm({
|
|
|
4471
4650
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginLeft: "auto", fontWeight: 600 }, children: shippingEnabled && selectedRate ? `Subtotal: ${formatPrice(subtotal, offering.currency)}` : `Total: ${formatPrice(total, offering.currency)}` })
|
|
4472
4651
|
] })
|
|
4473
4652
|
] }),
|
|
4653
|
+
!isFree && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginBottom: "1.5rem" }, children: discountResult?.valid ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
|
|
4654
|
+
display: "flex",
|
|
4655
|
+
alignItems: "center",
|
|
4656
|
+
justifyContent: "space-between",
|
|
4657
|
+
padding: "0.625rem 0.875rem",
|
|
4658
|
+
background: "#f0fdf4",
|
|
4659
|
+
border: "1px solid #bbf7d0",
|
|
4660
|
+
borderRadius: "6px"
|
|
4661
|
+
}, children: [
|
|
4662
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4663
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "0.875rem", fontWeight: 500, color: "#166534" }, children: discountResult.name || discountCode }),
|
|
4664
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "0.875rem", color: "#15803d", marginLeft: "0.5rem" }, children: [
|
|
4665
|
+
"\u2212",
|
|
4666
|
+
formatPrice(discountAmount, offering.currency)
|
|
4667
|
+
] })
|
|
4668
|
+
] }),
|
|
4669
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4670
|
+
"button",
|
|
4671
|
+
{
|
|
4672
|
+
type: "button",
|
|
4673
|
+
onClick: handleRemoveDiscount,
|
|
4674
|
+
style: {
|
|
4675
|
+
background: "none",
|
|
4676
|
+
border: "none",
|
|
4677
|
+
color: "#dc2626",
|
|
4678
|
+
cursor: "pointer",
|
|
4679
|
+
fontSize: "0.75rem",
|
|
4680
|
+
fontWeight: 500
|
|
4681
|
+
},
|
|
4682
|
+
children: "Remove"
|
|
4683
|
+
}
|
|
4684
|
+
)
|
|
4685
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
4686
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4687
|
+
"input",
|
|
4688
|
+
{
|
|
4689
|
+
type: "text",
|
|
4690
|
+
value: discountCode,
|
|
4691
|
+
onChange: (e) => setDiscountCode(e.target.value.toUpperCase()),
|
|
4692
|
+
placeholder: "Discount code",
|
|
4693
|
+
className: inputClassName,
|
|
4694
|
+
style: {
|
|
4695
|
+
flex: 1,
|
|
4696
|
+
padding: "0.5rem 0.75rem",
|
|
4697
|
+
borderRadius: "6px",
|
|
4698
|
+
border: "1px solid #d1d5db",
|
|
4699
|
+
fontSize: "0.875rem"
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
),
|
|
4703
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4704
|
+
"button",
|
|
4705
|
+
{
|
|
4706
|
+
type: "button",
|
|
4707
|
+
onClick: handleApplyDiscount,
|
|
4708
|
+
disabled: applyingDiscount || !discountCode.trim(),
|
|
4709
|
+
style: {
|
|
4710
|
+
padding: "0.5rem 1rem",
|
|
4711
|
+
borderRadius: "6px",
|
|
4712
|
+
border: "1px solid #d1d5db",
|
|
4713
|
+
background: "white",
|
|
4714
|
+
fontSize: "0.875rem",
|
|
4715
|
+
fontWeight: 500,
|
|
4716
|
+
cursor: applyingDiscount || !discountCode.trim() ? "not-allowed" : "pointer",
|
|
4717
|
+
opacity: applyingDiscount || !discountCode.trim() ? 0.5 : 1
|
|
4718
|
+
},
|
|
4719
|
+
children: applyingDiscount ? "..." : "Apply"
|
|
4720
|
+
}
|
|
4721
|
+
)
|
|
4722
|
+
] }) }),
|
|
4723
|
+
discountResult?.valid && !isFree && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
|
|
4724
|
+
padding: "0.75rem 1rem",
|
|
4725
|
+
background: "#f9fafb",
|
|
4726
|
+
borderRadius: "6px",
|
|
4727
|
+
marginBottom: "1.5rem",
|
|
4728
|
+
fontSize: "0.875rem"
|
|
4729
|
+
}, children: [
|
|
4730
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "0.25rem" }, children: [
|
|
4731
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666" }, children: "Subtotal" }),
|
|
4732
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatPrice(subtotal, offering.currency) })
|
|
4733
|
+
] }),
|
|
4734
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "0.25rem", color: "#16a34a" }, children: [
|
|
4735
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
|
|
4736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4737
|
+
"\u2212",
|
|
4738
|
+
formatPrice(discountAmount, offering.currency)
|
|
4739
|
+
] })
|
|
4740
|
+
] }),
|
|
4741
|
+
shippingCost > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "0.25rem" }, children: [
|
|
4742
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666" }, children: "Shipping" }),
|
|
4743
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatPrice(shippingCost, offering.currency) })
|
|
4744
|
+
] }),
|
|
4745
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", borderTop: "1px solid #e5e7eb", paddingTop: "0.5rem", marginTop: "0.25rem", fontWeight: 600 }, children: [
|
|
4746
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Total" }),
|
|
4747
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatPrice(total, offering.currency) })
|
|
4748
|
+
] })
|
|
4749
|
+
] }),
|
|
4474
4750
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
|
|
4475
4751
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4476
4752
|
/* @__PURE__ */ jsxRuntime.jsx("label", { style: { display: "block", fontSize: "0.875rem", fontWeight: 500, marginBottom: "0.25rem" }, children: "Full Name *" }),
|
|
@@ -6622,5 +6898,6 @@ exports.isEventSoldOut = isEventSoldOut;
|
|
|
6622
6898
|
exports.registerForEvent = registerForEvent;
|
|
6623
6899
|
exports.useEventModal = useEventModal;
|
|
6624
6900
|
exports.validateAddress = validateAddress;
|
|
6625
|
-
|
|
6626
|
-
//# sourceMappingURL=chunk-
|
|
6901
|
+
exports.validateDiscountCode = validateDiscountCode;
|
|
6902
|
+
//# sourceMappingURL=chunk-WAY6CT4A.js.map
|
|
6903
|
+
//# sourceMappingURL=chunk-WAY6CT4A.js.map
|