@cimplify/sdk 0.24.1 → 0.25.0
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 +2 -2
- package/dist/advanced.d.ts +2 -2
- package/dist/{chunk-H34GSEGR.mjs → chunk-JMNMSVDQ.mjs} +24 -1
- package/dist/{chunk-IYQGGFVQ.js → chunk-WMQXSDRC.js} +26 -0
- package/dist/{index-DCoxHrmr.d.mts → index-2JxW7TuQ.d.mts} +2 -2
- package/dist/{index-DIHoZUz_.d.mts → index-7mX_cUpQ.d.mts} +1 -1
- package/dist/{index-DT0Mzy8v.d.ts → index-DBM89ktY.d.ts} +2 -2
- package/dist/{index-CJZMsbDi.d.ts → index-DEx3GwlW.d.ts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +18 -6
- package/dist/index.mjs +1 -1
- package/dist/{payment-DqiwuLma.d.mts → payment-5a21yzi7.d.mts} +22 -1
- package/dist/{payment-DqiwuLma.d.ts → payment-5a21yzi7.d.ts} +22 -1
- package/dist/{price-BZlddg1A.d.ts → price-BS0Z5Oi9.d.ts} +1 -1
- package/dist/{price-DVQrpE7j.d.mts → price-CGPMlQUk.d.mts} +1 -1
- package/dist/react.d.mts +104 -11
- package/dist/react.d.ts +104 -11
- package/dist/react.js +895 -99
- package/dist/react.mjs +876 -97
- package/dist/styles.css +1 -1
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/package.json +1 -1
- package/registry/accommodation-card.json +17 -0
- package/registry/compact-service-card.json +16 -0
- package/registry/digital-product-card.json +16 -0
- package/registry/food-product-card.json +16 -0
- package/registry/food-product-layout.json +1 -1
- package/registry/index.json +113 -0
- package/registry/lease-service-card.json +17 -0
- package/registry/price-range.json +1 -1
- package/registry/price.json +1 -1
- package/registry/product-card.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/product-page.json +1 -1
- package/registry/rental-service-card.json +16 -0
- package/registry/retail-product-card.json +16 -0
- package/registry/schedule-service-card.json +16 -0
- package/registry/standard-service-card.json +16 -0
- package/registry/subscription-card.json +16 -0
- package/registry/wholesale-product-card.json +17 -0
package/dist/react.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getVariantDisplayName, createCimplifyClient } from './chunk-
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
2
|
+
import { DURATION_UNIT, getVariantDisplayName, PRODUCT_TYPE, createCimplifyClient, RENDER_HINT } from './chunk-JMNMSVDQ.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-JMNMSVDQ.mjs';
|
|
4
4
|
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-TBZLJPM4.mjs';
|
|
5
5
|
import { isSupportedCurrency, formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-E3HC2YAE.mjs';
|
|
6
6
|
import React3, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useSyncExternalStore, useId } from 'react';
|
|
@@ -1031,7 +1031,7 @@ function useCart(options = {}) {
|
|
|
1031
1031
|
() => snapshot.items.reduce((sum, item) => sum + item.quantity, 0),
|
|
1032
1032
|
[snapshot.items]
|
|
1033
1033
|
);
|
|
1034
|
-
return {
|
|
1034
|
+
return useMemo(() => ({
|
|
1035
1035
|
items: snapshot.items,
|
|
1036
1036
|
itemCount,
|
|
1037
1037
|
subtotal: snapshot.subtotal,
|
|
@@ -1046,7 +1046,7 @@ function useCart(options = {}) {
|
|
|
1046
1046
|
clearCart,
|
|
1047
1047
|
sync,
|
|
1048
1048
|
reorder
|
|
1049
|
-
};
|
|
1049
|
+
}), [snapshot.items, itemCount, snapshot.subtotal, snapshot.tax, snapshot.total, snapshot.currency, snapshot.isLoading, addItem, removeItem, updateQuantity, clearCart, sync, reorder]);
|
|
1050
1050
|
}
|
|
1051
1051
|
var LOCATION_STORAGE_KEY = "cimplify_location_id";
|
|
1052
1052
|
var DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency";
|
|
@@ -1697,11 +1697,14 @@ function CimplifyCheckout({
|
|
|
1697
1697
|
errorMessage && /* @__PURE__ */ jsx("p", { "data-cimplify-error": "", style: { marginTop: SPACE.sm, fontSize: 13, color: colors.error }, children: errorMessage })
|
|
1698
1698
|
] });
|
|
1699
1699
|
}
|
|
1700
|
-
function Price({ amount, className, prefix }) {
|
|
1701
|
-
const
|
|
1700
|
+
function Price({ amount, currency, className, prefix }) {
|
|
1701
|
+
const context = useOptionalCimplify();
|
|
1702
|
+
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
1703
|
+
const convertedAmount = !currency && context?.convertPrice ? context.convertPrice(amount) : amount;
|
|
1704
|
+
const resolvedAmount = typeof convertedAmount === "string" ? parseFloat(convertedAmount) || 0 : convertedAmount;
|
|
1702
1705
|
return /* @__PURE__ */ jsxs("span", { className, children: [
|
|
1703
1706
|
prefix,
|
|
1704
|
-
formatPrice(
|
|
1707
|
+
formatPrice(resolvedAmount, resolvedCurrency)
|
|
1705
1708
|
] });
|
|
1706
1709
|
}
|
|
1707
1710
|
function createCachedQuery(config) {
|
|
@@ -4801,7 +4804,9 @@ function ProductCustomizer({
|
|
|
4801
4804
|
},
|
|
4802
4805
|
[]
|
|
4803
4806
|
);
|
|
4804
|
-
const
|
|
4807
|
+
const addedTimerRef = useRef(void 0);
|
|
4808
|
+
useEffect(() => () => clearTimeout(addedTimerRef.current), []);
|
|
4809
|
+
const handleAddToCart = useCallback(async () => {
|
|
4805
4810
|
if (isSubmitting) return;
|
|
4806
4811
|
setIsSubmitting(true);
|
|
4807
4812
|
const options = {
|
|
@@ -4827,15 +4832,16 @@ function ProductCustomizer({
|
|
|
4827
4832
|
await cart.addItem(product, quantity, options);
|
|
4828
4833
|
}
|
|
4829
4834
|
setIsAdded(true);
|
|
4830
|
-
|
|
4835
|
+
clearTimeout(addedTimerRef.current);
|
|
4836
|
+
addedTimerRef.current = setTimeout(() => {
|
|
4831
4837
|
setIsAdded(false);
|
|
4832
|
-
setQuantity(1);
|
|
4838
|
+
setQuantity(product.min_order_quantity ?? 1);
|
|
4833
4839
|
}, 2e3);
|
|
4834
4840
|
} catch {
|
|
4835
4841
|
} finally {
|
|
4836
4842
|
setIsSubmitting(false);
|
|
4837
4843
|
}
|
|
4838
|
-
};
|
|
4844
|
+
}, [product, quantity, selectedVariantId, selectedVariant, quoteId, normalizedAddOnOptionIds, selectedAddOnOptions, isComposite, compositeSelections, isBundle, bundleSelections, selectedBillingPlan, specialInstructions, isSubmitting, onAddToCart, cart]);
|
|
4839
4845
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-customizer": true, className: cn("space-y-6", className, classNames?.root), children: [
|
|
4840
4846
|
isComposite && product.groups && product.composite_id && /* @__PURE__ */ jsx(
|
|
4841
4847
|
CompositeSelector,
|
|
@@ -5487,19 +5493,832 @@ function ProductSheet({
|
|
|
5487
5493
|
}
|
|
5488
5494
|
);
|
|
5489
5495
|
}
|
|
5496
|
+
function CardImage({
|
|
5497
|
+
src,
|
|
5498
|
+
alt,
|
|
5499
|
+
aspectRatio = "square",
|
|
5500
|
+
renderImage,
|
|
5501
|
+
className,
|
|
5502
|
+
children
|
|
5503
|
+
}) {
|
|
5504
|
+
const aspectClass = {
|
|
5505
|
+
square: "aspect-square",
|
|
5506
|
+
"3/4": "aspect-[3/4]",
|
|
5507
|
+
"4/3": "aspect-[4/3]",
|
|
5508
|
+
"16/9": "aspect-[16/9]"
|
|
5509
|
+
}[aspectRatio];
|
|
5510
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-card-image": true, className: cn("relative overflow-hidden bg-muted", aspectClass, className), children: [
|
|
5511
|
+
renderImage ? renderImage({ src, alt, className: "w-full h-full object-cover transition-transform duration-700 ease-out group-hover:scale-[1.04]" }) : /* @__PURE__ */ jsx(
|
|
5512
|
+
"img",
|
|
5513
|
+
{
|
|
5514
|
+
src,
|
|
5515
|
+
alt,
|
|
5516
|
+
className: "w-full h-full object-cover transition-transform duration-700 ease-out group-hover:scale-[1.04]"
|
|
5517
|
+
}
|
|
5518
|
+
),
|
|
5519
|
+
children
|
|
5520
|
+
] });
|
|
5521
|
+
}
|
|
5522
|
+
function QuickAddButton({
|
|
5523
|
+
onClick,
|
|
5524
|
+
className
|
|
5525
|
+
}) {
|
|
5526
|
+
return /* @__PURE__ */ jsx(
|
|
5527
|
+
"button",
|
|
5528
|
+
{
|
|
5529
|
+
"data-cimplify-card-quick-add": true,
|
|
5530
|
+
onClick: (e) => {
|
|
5531
|
+
e.stopPropagation();
|
|
5532
|
+
onClick?.();
|
|
5533
|
+
},
|
|
5534
|
+
className: cn(
|
|
5535
|
+
"w-9 h-9 rounded-full bg-background text-foreground flex items-center justify-center",
|
|
5536
|
+
"shadow-[0_1px_4px_rgba(0,0,0,0.10),0_4px_12px_rgba(0,0,0,0.08)]",
|
|
5537
|
+
"transition-all duration-200 ease-out",
|
|
5538
|
+
"opacity-0 group-hover:opacity-100 translate-y-1 group-hover:translate-y-0",
|
|
5539
|
+
"hover:!bg-foreground hover:!text-background hover:!scale-110",
|
|
5540
|
+
className
|
|
5541
|
+
),
|
|
5542
|
+
children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: [
|
|
5543
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "3", x2: "8", y2: "13" }),
|
|
5544
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "8", x2: "13", y2: "8" })
|
|
5545
|
+
] })
|
|
5546
|
+
}
|
|
5547
|
+
);
|
|
5548
|
+
}
|
|
5549
|
+
function WishlistButton({
|
|
5550
|
+
filled = false,
|
|
5551
|
+
onClick,
|
|
5552
|
+
className
|
|
5553
|
+
}) {
|
|
5554
|
+
return /* @__PURE__ */ jsx(
|
|
5555
|
+
"button",
|
|
5556
|
+
{
|
|
5557
|
+
"data-cimplify-card-wishlist": true,
|
|
5558
|
+
onClick: (e) => {
|
|
5559
|
+
e.stopPropagation();
|
|
5560
|
+
onClick?.();
|
|
5561
|
+
},
|
|
5562
|
+
className: cn(
|
|
5563
|
+
"w-8 h-8 rounded-full bg-background/90 backdrop-blur flex items-center justify-center",
|
|
5564
|
+
"transition-all duration-200 ease-out hover:scale-110 hover:bg-background",
|
|
5565
|
+
filled ? "text-destructive" : "text-muted-foreground hover:text-destructive",
|
|
5566
|
+
className
|
|
5567
|
+
),
|
|
5568
|
+
children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", fill: filled ? "currentColor" : "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z" }) })
|
|
5569
|
+
}
|
|
5570
|
+
);
|
|
5571
|
+
}
|
|
5572
|
+
function SoldOutOverlay() {
|
|
5573
|
+
return /* @__PURE__ */ jsx(
|
|
5574
|
+
"div",
|
|
5575
|
+
{
|
|
5576
|
+
"data-cimplify-card-sold-out": true,
|
|
5577
|
+
className: "absolute inset-0 bg-background/50 backdrop-blur-[1px] flex items-center justify-center z-10 rounded-[inherit]",
|
|
5578
|
+
children: /* @__PURE__ */ jsx("span", { className: "bg-background/90 text-foreground text-xs font-bold px-4 py-2 uppercase tracking-wider", children: "Sold Out" })
|
|
5579
|
+
}
|
|
5580
|
+
);
|
|
5581
|
+
}
|
|
5582
|
+
function SaleBadge2({ product }) {
|
|
5583
|
+
if (!isOnSale(product)) return null;
|
|
5584
|
+
const pct = getDiscountPercentage(product);
|
|
5585
|
+
if (!pct || pct <= 0) return null;
|
|
5586
|
+
return /* @__PURE__ */ 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: [
|
|
5587
|
+
"-",
|
|
5588
|
+
pct,
|
|
5589
|
+
"%"
|
|
5590
|
+
] });
|
|
5591
|
+
}
|
|
5592
|
+
function CardShell({
|
|
5593
|
+
product,
|
|
5594
|
+
renderLink,
|
|
5595
|
+
disabled = false,
|
|
5596
|
+
className,
|
|
5597
|
+
children
|
|
5598
|
+
}) {
|
|
5599
|
+
const href = `/products/${product.slug}`;
|
|
5600
|
+
const shellClass = cn(
|
|
5601
|
+
"group block text-left cursor-pointer bg-card rounded-[14px] overflow-hidden",
|
|
5602
|
+
"shadow-[0_1px_3px_rgba(0,0,0,0.04),0_6px_24px_rgba(0,0,0,0.06)]",
|
|
5603
|
+
"transition-all duration-300 ease-[cubic-bezier(0.19,1,0.22,1)]",
|
|
5604
|
+
!disabled && "hover:-translate-y-1 hover:shadow-[0_2px_6px_rgba(0,0,0,0.04),0_12px_40px_rgba(0,0,0,0.10)]",
|
|
5605
|
+
disabled && "opacity-60 cursor-default",
|
|
5606
|
+
className
|
|
5607
|
+
);
|
|
5608
|
+
if (renderLink) {
|
|
5609
|
+
return renderLink({ href, className: shellClass, children: /* @__PURE__ */ jsx(Fragment, { children }) });
|
|
5610
|
+
}
|
|
5611
|
+
return /* @__PURE__ */ jsx("a", { href, className: shellClass, "data-cimplify-card": true, children });
|
|
5612
|
+
}
|
|
5613
|
+
function FoodProductCard({
|
|
5614
|
+
product,
|
|
5615
|
+
onQuickAdd,
|
|
5616
|
+
renderImage,
|
|
5617
|
+
renderLink,
|
|
5618
|
+
className
|
|
5619
|
+
}) {
|
|
5620
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5621
|
+
const tags = product.tags || [];
|
|
5622
|
+
const isSignature = product.metadata?.is_signature === true;
|
|
5623
|
+
const isNew = product.metadata?.is_new === true;
|
|
5624
|
+
const isComposite = product.type === PRODUCT_TYPE.Composite;
|
|
5625
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
5626
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
5627
|
+
isSignature && /* @__PURE__ */ jsxs("span", { className: "absolute top-3 left-3 inline-flex items-center gap-1 text-[11px] font-semibold tracking-wide bg-amber-50 text-amber-700 border border-amber-200/60 px-2 py-0.5 rounded-md", children: [
|
|
5628
|
+
/* @__PURE__ */ jsx("svg", { className: "w-3 h-3 opacity-70", fill: "currentColor", viewBox: "0 0 16 16", children: /* @__PURE__ */ jsx("path", { d: "M8 .75l1.85 4.95L15 6.2l-3.7 3.2 1.1 5.1L8 12.15 3.6 14.5l1.1-5.1L1 6.2l5.15-.5z" }) }),
|
|
5629
|
+
"Signature"
|
|
5630
|
+
] }),
|
|
5631
|
+
isNew && !isSignature && /* @__PURE__ */ jsx("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-emerald-50 text-emerald-700 border border-emerald-200/60 px-2 py-0.5 rounded-md", children: "New" }),
|
|
5632
|
+
isComposite && /* @__PURE__ */ jsx("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-violet-50 text-violet-700 border border-violet-200/60 px-2 py-0.5 rounded-md", children: "Customizable" }),
|
|
5633
|
+
/* @__PURE__ */ jsx(
|
|
5634
|
+
QuickAddButton,
|
|
5635
|
+
{
|
|
5636
|
+
onClick: () => onQuickAdd?.(product),
|
|
5637
|
+
className: "absolute bottom-3 right-3"
|
|
5638
|
+
}
|
|
5639
|
+
)
|
|
5640
|
+
] }),
|
|
5641
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
|
|
5642
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight truncate", children: product.name }),
|
|
5643
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
5644
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3", children: [
|
|
5645
|
+
isComposite ? /* @__PURE__ */ jsxs("span", { className: "text-sm font-bold", children: [
|
|
5646
|
+
"From ",
|
|
5647
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price })
|
|
5648
|
+
] }) : /* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
5649
|
+
tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: tags.slice(0, 2).map((tag) => /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: tag }, tag)) })
|
|
5650
|
+
] })
|
|
5651
|
+
] })
|
|
5652
|
+
] });
|
|
5653
|
+
}
|
|
5654
|
+
function getColorSwatches(product) {
|
|
5655
|
+
const variants = product.variants;
|
|
5656
|
+
if (!variants || variants.length === 0) return [];
|
|
5657
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5658
|
+
for (const v of variants) {
|
|
5659
|
+
if (v.display_attributes) {
|
|
5660
|
+
for (const attr of v.display_attributes) {
|
|
5661
|
+
if (attr.axis_name.toLowerCase() === "color" && !seen.has(attr.value_name)) {
|
|
5662
|
+
seen.add(attr.value_name);
|
|
5663
|
+
}
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
}
|
|
5667
|
+
return Array.from(seen).slice(0, 5);
|
|
5668
|
+
}
|
|
5669
|
+
function RetailProductCard({
|
|
5670
|
+
product,
|
|
5671
|
+
renderImage,
|
|
5672
|
+
renderLink,
|
|
5673
|
+
className
|
|
5674
|
+
}) {
|
|
5675
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5676
|
+
const outOfStock = product.inventory_status?.in_stock === false;
|
|
5677
|
+
const onSale = isOnSale(product);
|
|
5678
|
+
const swatches = getColorSwatches(product);
|
|
5679
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, disabled: outOfStock, className, children: [
|
|
5680
|
+
outOfStock && /* @__PURE__ */ jsx(SoldOutOverlay, {}),
|
|
5681
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "3/4", renderImage, children: [
|
|
5682
|
+
onSale && /* @__PURE__ */ jsx("div", { className: "absolute top-3 left-3", children: /* @__PURE__ */ jsx(SaleBadge2, { product }) }),
|
|
5683
|
+
/* @__PURE__ */ jsx(WishlistButton, { className: "absolute top-3 right-3" }),
|
|
5684
|
+
product.inventory_status?.low_stock && product.inventory_status?.stock_level && /* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 left-3 text-[11px] font-semibold bg-amber-50 text-amber-700 border border-amber-200/60 px-2 py-0.5 rounded-md", children: [
|
|
5685
|
+
"Only ",
|
|
5686
|
+
product.inventory_status.stock_level,
|
|
5687
|
+
" left"
|
|
5688
|
+
] })
|
|
5689
|
+
] }),
|
|
5690
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
|
|
5691
|
+
product.vendor && /* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-widest", children: product.vendor }),
|
|
5692
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
|
|
5693
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5694
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
5695
|
+
onSale && /* @__PURE__ */ jsx(Price, { amount: getBasePrice(product), className: "text-xs text-muted-foreground line-through" })
|
|
5696
|
+
] }),
|
|
5697
|
+
swatches.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 mt-2.5", children: swatches.map((name) => /* @__PURE__ */ jsx(
|
|
5698
|
+
"span",
|
|
5699
|
+
{
|
|
5700
|
+
title: name,
|
|
5701
|
+
className: "text-[9px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded",
|
|
5702
|
+
children: name
|
|
5703
|
+
},
|
|
5704
|
+
name
|
|
5705
|
+
)) })
|
|
5706
|
+
] })
|
|
5707
|
+
] });
|
|
5708
|
+
}
|
|
5709
|
+
function PriceRange({ product, currency, className }) {
|
|
5710
|
+
const context = useOptionalCimplify();
|
|
5711
|
+
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
5712
|
+
const range = getPriceRange(product);
|
|
5713
|
+
if (!range) return null;
|
|
5714
|
+
return /* @__PURE__ */ jsx("span", { "data-cimplify-price-range": true, className, children: formatPriceRange(range.min, range.max, resolvedCurrency) });
|
|
5715
|
+
}
|
|
5716
|
+
function WholesaleProductCard({
|
|
5717
|
+
product,
|
|
5718
|
+
onQuickAdd,
|
|
5719
|
+
renderImage,
|
|
5720
|
+
renderLink,
|
|
5721
|
+
className
|
|
5722
|
+
}) {
|
|
5723
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5724
|
+
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
5725
|
+
const status = product.inventory_status;
|
|
5726
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
5727
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "square", renderImage, children: [
|
|
5728
|
+
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxs("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-zinc-800 text-white px-2 py-0.5 rounded-md", children: [
|
|
5729
|
+
"MOQ: ",
|
|
5730
|
+
product.min_order_quantity
|
|
5731
|
+
] }),
|
|
5732
|
+
/* @__PURE__ */ jsx(
|
|
5733
|
+
QuickAddButton,
|
|
5734
|
+
{
|
|
5735
|
+
onClick: () => onQuickAdd?.(product),
|
|
5736
|
+
className: "absolute bottom-3 right-3"
|
|
5737
|
+
}
|
|
5738
|
+
)
|
|
5739
|
+
] }),
|
|
5740
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
|
|
5741
|
+
product.sku && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground font-mono", children: product.sku }),
|
|
5742
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight mt-1 truncate", children: product.name }),
|
|
5743
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2", children: hasTiers ? /* @__PURE__ */ jsx(PriceRange, { product, className: "text-sm font-bold" }) : /* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }) }),
|
|
5744
|
+
status && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mt-2", children: [
|
|
5745
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
5746
|
+
"w-[7px] h-[7px] rounded-full shrink-0",
|
|
5747
|
+
status.in_stock ? status.low_stock ? "bg-amber-500" : "bg-emerald-500" : "bg-red-500"
|
|
5748
|
+
) }),
|
|
5749
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
5750
|
+
"text-[10.5px] font-medium",
|
|
5751
|
+
status.in_stock ? status.low_stock ? "text-amber-600" : "text-emerald-600" : "text-red-600"
|
|
5752
|
+
), children: !status.in_stock ? "Out of stock" : status.stock_level != null ? `${status.stock_level.toLocaleString()} in stock` : "In stock" })
|
|
5753
|
+
] })
|
|
5754
|
+
] })
|
|
5755
|
+
] });
|
|
5756
|
+
}
|
|
5757
|
+
var TYPE_BADGES = {
|
|
5758
|
+
download: { label: "Download", color: "bg-sky-50 text-sky-700 border-sky-200/60" },
|
|
5759
|
+
license: { label: "License", color: "bg-blue-50 text-blue-700 border-blue-200/60" },
|
|
5760
|
+
event_ticket: { label: "Event", color: "bg-violet-50 text-violet-700 border-violet-200/60" },
|
|
5761
|
+
access_pass: { label: "Access", color: "bg-emerald-50 text-emerald-700 border-emerald-200/60" },
|
|
5762
|
+
gift_card: { label: "Gift Card", color: "bg-amber-50 text-amber-700 border-amber-200/60" }
|
|
5763
|
+
};
|
|
5764
|
+
function DigitalProductCard({
|
|
5765
|
+
product,
|
|
5766
|
+
renderImage,
|
|
5767
|
+
renderLink,
|
|
5768
|
+
className
|
|
5769
|
+
}) {
|
|
5770
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5771
|
+
const typeBadge = product.digital_type ? TYPE_BADGES[product.digital_type] : null;
|
|
5772
|
+
const isTicket = product.digital_type === "event_ticket";
|
|
5773
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
5774
|
+
/* @__PURE__ */ jsx(CardImage, { src: image, alt: product.name, aspectRatio: "4/3", renderImage, children: typeBadge && /* @__PURE__ */ jsx("span", { className: `absolute top-3 left-3 text-[11px] font-semibold tracking-wide border px-2 py-0.5 rounded-md ${typeBadge.color}`, children: typeBadge.label }) }),
|
|
5775
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3.5", children: [
|
|
5776
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-semibold text-foreground leading-snug tracking-tight truncate", children: product.name }),
|
|
5777
|
+
isTicket && (product.event_date || product.venue) && /* @__PURE__ */ jsxs("p", { className: "text-[12px] text-muted-foreground mt-1 truncate", children: [
|
|
5778
|
+
product.event_date && new Date(product.event_date).toLocaleDateString(void 0, { month: "short", day: "numeric" }),
|
|
5779
|
+
product.event_date && product.venue && " \xB7 ",
|
|
5780
|
+
product.venue
|
|
5781
|
+
] }),
|
|
5782
|
+
!isTicket && product.description && /* @__PURE__ */ jsx("p", { className: "text-[12px] text-muted-foreground mt-1 line-clamp-1", children: product.description }),
|
|
5783
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-2.5", children: [
|
|
5784
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
5785
|
+
product.file_type && /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded", children: [
|
|
5786
|
+
product.file_type.toUpperCase(),
|
|
5787
|
+
product.file_size_mb != null && ` \xB7 ${product.file_size_mb >= 1024 ? `${(product.file_size_mb / 1024).toFixed(1)}GB` : `${product.file_size_mb}MB`}`
|
|
5788
|
+
] })
|
|
5789
|
+
] })
|
|
5790
|
+
] })
|
|
5791
|
+
] });
|
|
5792
|
+
}
|
|
5793
|
+
function formatDuration2(minutes, unit) {
|
|
5794
|
+
if (unit && unit !== "minutes") return `${minutes} ${unit}`;
|
|
5795
|
+
if (minutes >= 60) {
|
|
5796
|
+
const h = Math.floor(minutes / 60);
|
|
5797
|
+
const m = minutes % 60;
|
|
5798
|
+
return m > 0 ? `${h}h ${m}m` : `${h} hr${h > 1 ? "s" : ""}`;
|
|
5799
|
+
}
|
|
5800
|
+
return `${minutes} min`;
|
|
5801
|
+
}
|
|
5802
|
+
function StandardServiceCard({
|
|
5803
|
+
product,
|
|
5804
|
+
onBook,
|
|
5805
|
+
renderImage,
|
|
5806
|
+
renderLink,
|
|
5807
|
+
className
|
|
5808
|
+
}) {
|
|
5809
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5810
|
+
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
5811
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
5812
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
5813
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
5814
|
+
product.duration_minutes != null && /* @__PURE__ */ jsx("span", { className: "absolute bottom-3 left-3 inline-flex items-center gap-1 text-[12px] font-semibold px-2.5 py-1 rounded-lg bg-background/92 backdrop-blur-xl text-foreground shadow-sm", children: formatDuration2(product.duration_minutes, product.duration_unit) }),
|
|
5815
|
+
/* @__PURE__ */ jsx("span", { className: "absolute bottom-3 right-3 text-white font-bold text-lg drop-shadow-sm", children: /* @__PURE__ */ jsx(Price, { amount: product.default_price }) })
|
|
5816
|
+
] }),
|
|
5817
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
5818
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
5819
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
5820
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3 pt-3 border-t border-border", children: [
|
|
5821
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: [
|
|
5822
|
+
/* @__PURE__ */ jsx("span", { className: "w-[7px] h-[7px] rounded-full bg-emerald-500 animate-pulse" }),
|
|
5823
|
+
/* @__PURE__ */ jsx("span", { children: "Available" }),
|
|
5824
|
+
hasDeposit && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5825
|
+
/* @__PURE__ */ jsx("span", { className: "text-border", children: "\xB7" }),
|
|
5826
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
5827
|
+
/* @__PURE__ */ jsx(Price, { amount: product.deposit_amount }),
|
|
5828
|
+
" deposit"
|
|
5829
|
+
] })
|
|
5830
|
+
] })
|
|
5831
|
+
] }),
|
|
5832
|
+
/* @__PURE__ */ jsx(
|
|
5833
|
+
"button",
|
|
5834
|
+
{
|
|
5835
|
+
onClick: (e) => {
|
|
5836
|
+
e.preventDefault();
|
|
5837
|
+
e.stopPropagation();
|
|
5838
|
+
onBook?.(product);
|
|
5839
|
+
},
|
|
5840
|
+
className: "text-[13px] font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
5841
|
+
children: "Book now \u2192"
|
|
5842
|
+
}
|
|
5843
|
+
)
|
|
5844
|
+
] })
|
|
5845
|
+
] })
|
|
5846
|
+
] });
|
|
5847
|
+
}
|
|
5848
|
+
function formatDuration3(minutes, unit) {
|
|
5849
|
+
if (unit && unit !== "minutes") return `${minutes} ${unit}`;
|
|
5850
|
+
if (minutes >= 60) {
|
|
5851
|
+
const h = Math.floor(minutes / 60);
|
|
5852
|
+
const m = minutes % 60;
|
|
5853
|
+
return m > 0 ? `${h}h ${m}m` : `${h} hr`;
|
|
5854
|
+
}
|
|
5855
|
+
return `${minutes} min`;
|
|
5856
|
+
}
|
|
5857
|
+
function CompactServiceCard({
|
|
5858
|
+
product,
|
|
5859
|
+
renderImage,
|
|
5860
|
+
renderLink,
|
|
5861
|
+
className
|
|
5862
|
+
}) {
|
|
5863
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5864
|
+
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
5865
|
+
const hasBillingPlans = product.billing_plans && product.billing_plans.length > 0;
|
|
5866
|
+
const href = `/products/${product.slug}`;
|
|
5867
|
+
const content = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 p-3", children: [
|
|
5868
|
+
/* @__PURE__ */ jsx("div", { className: "w-[72px] h-[72px] rounded-xl overflow-hidden bg-muted shrink-0", children: renderImage ? renderImage({ src: image, alt: product.name, className: "w-full h-full object-cover" }) : /* @__PURE__ */ jsx("img", { src: image, alt: product.name, className: "w-full h-full object-cover" }) }),
|
|
5869
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
5870
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14px] font-semibold text-foreground leading-tight truncate", children: product.name }),
|
|
5871
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12px] text-muted-foreground mt-0.5 truncate", children: product.description }),
|
|
5872
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2 flex-wrap", children: [
|
|
5873
|
+
product.duration_minutes != null && /* @__PURE__ */ jsx("span", { className: "text-[10.5px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: formatDuration3(product.duration_minutes, product.duration_unit) }),
|
|
5874
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-[10.5px] font-medium text-emerald-600", children: [
|
|
5875
|
+
/* @__PURE__ */ jsx("span", { className: "w-[6px] h-[6px] rounded-full bg-emerald-500" }),
|
|
5876
|
+
"Available"
|
|
5877
|
+
] }),
|
|
5878
|
+
hasDeposit && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-medium text-amber-600", children: [
|
|
5879
|
+
/* @__PURE__ */ jsx(Price, { amount: product.deposit_amount }),
|
|
5880
|
+
" deposit"
|
|
5881
|
+
] }),
|
|
5882
|
+
hasBillingPlans && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5 text-[10.5px] font-semibold text-primary px-1.5 py-0.5 bg-primary/10 rounded", children: "Subscription" })
|
|
5883
|
+
] })
|
|
5884
|
+
] }),
|
|
5885
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
5886
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-sm font-bold" }),
|
|
5887
|
+
/* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-muted-foreground group-hover:text-primary transition-colors", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" }) })
|
|
5888
|
+
] })
|
|
5889
|
+
] });
|
|
5890
|
+
const shellClass = cn(
|
|
5891
|
+
"group block text-left cursor-pointer bg-card rounded-[14px] overflow-hidden",
|
|
5892
|
+
"shadow-[0_1px_3px_rgba(0,0,0,0.04),0_6px_24px_rgba(0,0,0,0.06)]",
|
|
5893
|
+
"border border-transparent",
|
|
5894
|
+
"transition-all duration-300 ease-[cubic-bezier(0.19,1,0.22,1)]",
|
|
5895
|
+
"hover:-translate-y-[1px] hover:shadow-[0_2px_6px_rgba(0,0,0,0.04),0_12px_40px_rgba(0,0,0,0.10)] hover:border-primary/20",
|
|
5896
|
+
className
|
|
5897
|
+
);
|
|
5898
|
+
if (renderLink) {
|
|
5899
|
+
return renderLink({ href, className: shellClass, children: content });
|
|
5900
|
+
}
|
|
5901
|
+
return /* @__PURE__ */ jsx("a", { href, className: shellClass, "data-cimplify-card": true, children: content });
|
|
5902
|
+
}
|
|
5903
|
+
function ScheduleServiceCard({
|
|
5904
|
+
product,
|
|
5905
|
+
slots,
|
|
5906
|
+
onBook,
|
|
5907
|
+
renderImage,
|
|
5908
|
+
renderLink,
|
|
5909
|
+
className
|
|
5910
|
+
}) {
|
|
5911
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5912
|
+
const href = `/products/${product.slug}`;
|
|
5913
|
+
const durationLabel = product.duration_minutes != null ? `${product.duration_minutes} ${product.duration_unit ?? "min"}` : null;
|
|
5914
|
+
const displaySlots = (slots || []).slice(0, 3);
|
|
5915
|
+
const shellClass = cn(
|
|
5916
|
+
"group block text-left cursor-pointer bg-card rounded-[14px] overflow-hidden",
|
|
5917
|
+
"shadow-[0_1px_3px_rgba(0,0,0,0.04),0_6px_24px_rgba(0,0,0,0.06)]",
|
|
5918
|
+
"transition-all duration-300 ease-[cubic-bezier(0.19,1,0.22,1)]",
|
|
5919
|
+
"hover:-translate-y-1 hover:shadow-[0_2px_6px_rgba(0,0,0,0.04),0_12px_40px_rgba(0,0,0,0.10)]",
|
|
5920
|
+
className
|
|
5921
|
+
);
|
|
5922
|
+
const inner = /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
5923
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
5924
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
5925
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
5926
|
+
/* @__PURE__ */ jsxs("p", { className: "text-[12.5px] text-muted-foreground mt-0.5", children: [
|
|
5927
|
+
durationLabel && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5928
|
+
durationLabel,
|
|
5929
|
+
" \xB7 "
|
|
5930
|
+
] }),
|
|
5931
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price })
|
|
5932
|
+
] })
|
|
5933
|
+
] }),
|
|
5934
|
+
image && /* @__PURE__ */ jsx("div", { className: "w-14 h-14 rounded-xl overflow-hidden bg-muted shrink-0", children: renderImage ? renderImage({ src: image, alt: product.name, className: "w-full h-full object-cover" }) : /* @__PURE__ */ jsx("img", { src: image, alt: product.name, className: "w-full h-full object-cover" }) })
|
|
5935
|
+
] }),
|
|
5936
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12px] text-muted-foreground mt-2 line-clamp-2 leading-relaxed", children: product.description }),
|
|
5937
|
+
displaySlots.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-4 pt-3 border-t border-border", children: [
|
|
5938
|
+
/* @__PURE__ */ jsx("p", { className: "text-[10px] font-semibold text-muted-foreground uppercase tracking-widest mb-2", children: product.general_service_capacity != null && product.general_service_capacity > 1 ? "Upcoming classes" : "Next available" }),
|
|
5939
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-2 flex-wrap", children: displaySlots.map((slot, i) => /* @__PURE__ */ jsx(
|
|
5940
|
+
"button",
|
|
5941
|
+
{
|
|
5942
|
+
onClick: (e) => {
|
|
5943
|
+
e.preventDefault();
|
|
5944
|
+
e.stopPropagation();
|
|
5945
|
+
onBook?.(product);
|
|
5946
|
+
},
|
|
5947
|
+
className: cn(
|
|
5948
|
+
"text-[12.5px] font-medium px-3 py-1.5 rounded-lg transition-all duration-200 ease-out hover:scale-[1.04]",
|
|
5949
|
+
i === 0 ? "bg-primary text-primary-foreground font-semibold shadow-sm" : "bg-muted text-foreground hover:bg-muted/80"
|
|
5950
|
+
),
|
|
5951
|
+
children: new Date(slot.start_time).toLocaleString(void 0, {
|
|
5952
|
+
weekday: "short",
|
|
5953
|
+
hour: "numeric",
|
|
5954
|
+
minute: "2-digit"
|
|
5955
|
+
})
|
|
5956
|
+
},
|
|
5957
|
+
i
|
|
5958
|
+
)) })
|
|
5959
|
+
] })
|
|
5960
|
+
] });
|
|
5961
|
+
if (renderLink) {
|
|
5962
|
+
return renderLink({ href, className: shellClass, children: inner });
|
|
5963
|
+
}
|
|
5964
|
+
return /* @__PURE__ */ jsx("a", { href, className: shellClass, "data-cimplify-card": true, children: inner });
|
|
5965
|
+
}
|
|
5966
|
+
var UNIT_LABELS = {
|
|
5967
|
+
minutes: "min",
|
|
5968
|
+
hours: "hr",
|
|
5969
|
+
days: "day",
|
|
5970
|
+
nights: "night",
|
|
5971
|
+
weeks: "week",
|
|
5972
|
+
months: "mo",
|
|
5973
|
+
years: "yr"
|
|
5974
|
+
};
|
|
5975
|
+
function RentalServiceCard({
|
|
5976
|
+
product,
|
|
5977
|
+
onBook,
|
|
5978
|
+
renderImage,
|
|
5979
|
+
renderLink,
|
|
5980
|
+
className
|
|
5981
|
+
}) {
|
|
5982
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
5983
|
+
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
5984
|
+
const unit = product.duration_unit ? UNIT_LABELS[product.duration_unit] || product.duration_unit : "day";
|
|
5985
|
+
const status = product.inventory_status;
|
|
5986
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
5987
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
5988
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
5989
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 left-3 inline-flex items-center text-[12px] font-semibold px-2.5 py-1 rounded-lg bg-background/92 backdrop-blur-xl text-foreground shadow-sm", children: [
|
|
5990
|
+
"Per ",
|
|
5991
|
+
unit
|
|
5992
|
+
] }),
|
|
5993
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 right-3 text-white font-bold text-lg drop-shadow-sm", children: [
|
|
5994
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price }),
|
|
5995
|
+
"/",
|
|
5996
|
+
unit
|
|
5997
|
+
] }),
|
|
5998
|
+
product.general_service_capacity != null && product.general_service_capacity > 1 && /* @__PURE__ */ jsxs("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-blue-50/90 text-blue-700 border border-blue-200/50 backdrop-blur px-2 py-0.5 rounded-md", children: [
|
|
5999
|
+
"Up to ",
|
|
6000
|
+
product.general_service_capacity,
|
|
6001
|
+
" guests"
|
|
6002
|
+
] })
|
|
6003
|
+
] }),
|
|
6004
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
6005
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
6006
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
6007
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 mt-3", children: [
|
|
6008
|
+
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: [
|
|
6009
|
+
"Min. ",
|
|
6010
|
+
product.min_order_quantity,
|
|
6011
|
+
" ",
|
|
6012
|
+
unit,
|
|
6013
|
+
product.min_order_quantity > 1 ? "s" : ""
|
|
6014
|
+
] }),
|
|
6015
|
+
hasDeposit && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-medium text-amber-600", children: [
|
|
6016
|
+
/* @__PURE__ */ jsx(Price, { amount: product.deposit_amount }),
|
|
6017
|
+
" deposit"
|
|
6018
|
+
] })
|
|
6019
|
+
] }),
|
|
6020
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3 pt-3 border-t border-border", children: [
|
|
6021
|
+
status && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-[12px]", children: [
|
|
6022
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
6023
|
+
"w-[7px] h-[7px] rounded-full shrink-0",
|
|
6024
|
+
status.in_stock ? "bg-emerald-500" : "bg-red-500"
|
|
6025
|
+
) }),
|
|
6026
|
+
/* @__PURE__ */ jsx("span", { className: status.in_stock ? "text-muted-foreground" : "text-red-600", children: status.in_stock ? status.stock_level != null ? `${status.stock_level} available` : "Available" : "Unavailable" })
|
|
6027
|
+
] }),
|
|
6028
|
+
/* @__PURE__ */ jsx(
|
|
6029
|
+
"button",
|
|
6030
|
+
{
|
|
6031
|
+
onClick: (e) => {
|
|
6032
|
+
e.preventDefault();
|
|
6033
|
+
e.stopPropagation();
|
|
6034
|
+
onBook?.(product);
|
|
6035
|
+
},
|
|
6036
|
+
className: "text-[13px] font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
6037
|
+
children: "Reserve now \u2192"
|
|
6038
|
+
}
|
|
6039
|
+
)
|
|
6040
|
+
] })
|
|
6041
|
+
] })
|
|
6042
|
+
] });
|
|
6043
|
+
}
|
|
6044
|
+
function AccommodationCard({
|
|
6045
|
+
product,
|
|
6046
|
+
onBook,
|
|
6047
|
+
renderImage,
|
|
6048
|
+
renderLink,
|
|
6049
|
+
className
|
|
6050
|
+
}) {
|
|
6051
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
6052
|
+
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
6053
|
+
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
6054
|
+
const tags = product.tags || [];
|
|
6055
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
6056
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
6057
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
6058
|
+
/* @__PURE__ */ jsx("span", { className: "absolute bottom-3 left-3 inline-flex items-center text-[12px] font-semibold px-2.5 py-1 rounded-lg bg-background/92 backdrop-blur-xl text-foreground shadow-sm", children: "Per night" }),
|
|
6059
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 right-3 text-white font-bold text-lg drop-shadow-sm", children: [
|
|
6060
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price }),
|
|
6061
|
+
"/night"
|
|
6062
|
+
] })
|
|
6063
|
+
] }),
|
|
6064
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
6065
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
6066
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
6067
|
+
tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-2.5", children: tags.slice(0, 4).map((tag) => /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: tag }, tag)) }),
|
|
6068
|
+
product.general_service_capacity != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 mt-2 text-[11px] text-muted-foreground", children: [
|
|
6069
|
+
/* @__PURE__ */ jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0" }) }),
|
|
6070
|
+
product.general_service_capacity,
|
|
6071
|
+
" guest",
|
|
6072
|
+
product.general_service_capacity > 1 ? "s" : ""
|
|
6073
|
+
] }),
|
|
6074
|
+
hasTiers && /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(VolumePricing, { tiers: product.quantity_pricing }) }),
|
|
6075
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3 pt-3 border-t border-border", children: [
|
|
6076
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[11px] text-muted-foreground", children: [
|
|
6077
|
+
cancellationHours != null && /* @__PURE__ */ jsxs("span", { className: "text-emerald-600 font-medium", children: [
|
|
6078
|
+
"Free cancellation ",
|
|
6079
|
+
cancellationHours,
|
|
6080
|
+
"h"
|
|
6081
|
+
] }),
|
|
6082
|
+
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxs("span", { children: [
|
|
6083
|
+
"Min. ",
|
|
6084
|
+
product.min_order_quantity,
|
|
6085
|
+
" nights"
|
|
6086
|
+
] })
|
|
6087
|
+
] }),
|
|
6088
|
+
/* @__PURE__ */ jsx(
|
|
6089
|
+
"button",
|
|
6090
|
+
{
|
|
6091
|
+
onClick: (e) => {
|
|
6092
|
+
e.preventDefault();
|
|
6093
|
+
e.stopPropagation();
|
|
6094
|
+
onBook?.(product);
|
|
6095
|
+
},
|
|
6096
|
+
className: "text-[13px] font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
6097
|
+
children: "Book room \u2192"
|
|
6098
|
+
}
|
|
6099
|
+
)
|
|
6100
|
+
] })
|
|
6101
|
+
] })
|
|
6102
|
+
] });
|
|
6103
|
+
}
|
|
6104
|
+
var UNIT_LABELS2 = {
|
|
6105
|
+
weeks: "week",
|
|
6106
|
+
months: "mo",
|
|
6107
|
+
years: "yr"
|
|
6108
|
+
};
|
|
6109
|
+
function LeaseServiceCard({
|
|
6110
|
+
product,
|
|
6111
|
+
onBook,
|
|
6112
|
+
renderImage,
|
|
6113
|
+
renderLink,
|
|
6114
|
+
className
|
|
6115
|
+
}) {
|
|
6116
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
6117
|
+
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
6118
|
+
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
6119
|
+
const unit = product.duration_unit ? UNIT_LABELS2[product.duration_unit] || product.duration_unit : "mo";
|
|
6120
|
+
const tags = product.tags || [];
|
|
6121
|
+
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
6122
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
6123
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
6124
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
6125
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 left-3 inline-flex items-center text-[12px] font-semibold px-2.5 py-1 rounded-lg bg-background/92 backdrop-blur-xl text-foreground shadow-sm", children: [
|
|
6126
|
+
"Per ",
|
|
6127
|
+
unit
|
|
6128
|
+
] }),
|
|
6129
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 right-3 text-white font-bold text-lg drop-shadow-sm", children: [
|
|
6130
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price }),
|
|
6131
|
+
"/",
|
|
6132
|
+
unit
|
|
6133
|
+
] })
|
|
6134
|
+
] }),
|
|
6135
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
6136
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
6137
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
6138
|
+
tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-2.5", children: tags.slice(0, 4).map((tag) => /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: tag }, tag)) }),
|
|
6139
|
+
hasTiers && /* @__PURE__ */ jsx("div", { className: "mt-3", children: /* @__PURE__ */ jsx(VolumePricing, { tiers: product.quantity_pricing }) }),
|
|
6140
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 mt-3", children: [
|
|
6141
|
+
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: [
|
|
6142
|
+
"Min. ",
|
|
6143
|
+
product.min_order_quantity,
|
|
6144
|
+
" ",
|
|
6145
|
+
unit,
|
|
6146
|
+
product.min_order_quantity > 1 ? "s" : ""
|
|
6147
|
+
] }),
|
|
6148
|
+
hasDeposit && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-medium text-amber-600", children: [
|
|
6149
|
+
/* @__PURE__ */ jsx(Price, { amount: product.deposit_amount }),
|
|
6150
|
+
" deposit"
|
|
6151
|
+
] }),
|
|
6152
|
+
cancellationHours != null && /* @__PURE__ */ jsx("span", { className: "text-[10.5px] font-medium text-muted-foreground", children: cancellationHours >= 720 ? `${Math.floor(cancellationHours / 720)} month notice` : `${cancellationHours}h notice` })
|
|
6153
|
+
] }),
|
|
6154
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3 pt-3 border-t border-border", children: [
|
|
6155
|
+
product.billing_plans && product.billing_plans.length > 0 && /* @__PURE__ */ jsxs("span", { className: "text-[10.5px] font-semibold text-primary px-1.5 py-0.5 bg-primary/10 rounded", children: [
|
|
6156
|
+
product.billing_plans[0].frequency,
|
|
6157
|
+
" billing"
|
|
6158
|
+
] }),
|
|
6159
|
+
/* @__PURE__ */ jsx(
|
|
6160
|
+
"button",
|
|
6161
|
+
{
|
|
6162
|
+
onClick: (e) => {
|
|
6163
|
+
e.preventDefault();
|
|
6164
|
+
e.stopPropagation();
|
|
6165
|
+
onBook?.(product);
|
|
6166
|
+
},
|
|
6167
|
+
className: "text-[13px] font-semibold text-primary hover:text-primary/80 transition-colors ml-auto",
|
|
6168
|
+
children: "Enquire now \u2192"
|
|
6169
|
+
}
|
|
6170
|
+
)
|
|
6171
|
+
] })
|
|
6172
|
+
] })
|
|
6173
|
+
] });
|
|
6174
|
+
}
|
|
6175
|
+
var FREQUENCY_LABELS2 = {
|
|
6176
|
+
weekly: "/week",
|
|
6177
|
+
monthly: "/mo",
|
|
6178
|
+
quarterly: "/qtr",
|
|
6179
|
+
annually: "/yr"
|
|
6180
|
+
};
|
|
6181
|
+
function SubscriptionCard({
|
|
6182
|
+
product,
|
|
6183
|
+
onBook,
|
|
6184
|
+
renderImage,
|
|
6185
|
+
renderLink,
|
|
6186
|
+
className
|
|
6187
|
+
}) {
|
|
6188
|
+
const image = product.image_url || product.images?.[0] || "";
|
|
6189
|
+
const plans = product.billing_plans || [];
|
|
6190
|
+
const primaryPlan = plans[0];
|
|
6191
|
+
const frequency = primaryPlan?.frequency ? FREQUENCY_LABELS2[primaryPlan.frequency] || `/${primaryPlan.frequency}` : "/mo";
|
|
6192
|
+
const hasTrial = primaryPlan?.trial_days != null && primaryPlan.trial_days > 0;
|
|
6193
|
+
const tags = product.tags || [];
|
|
6194
|
+
return /* @__PURE__ */ jsxs(CardShell, { product, renderLink, className, children: [
|
|
6195
|
+
/* @__PURE__ */ jsxs(CardImage, { src: image, alt: product.name, aspectRatio: "16/9", renderImage, children: [
|
|
6196
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent pointer-events-none" }),
|
|
6197
|
+
/* @__PURE__ */ jsxs("span", { className: "absolute bottom-3 right-3 text-white font-bold text-lg drop-shadow-sm", children: [
|
|
6198
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price }),
|
|
6199
|
+
frequency
|
|
6200
|
+
] }),
|
|
6201
|
+
hasTrial && /* @__PURE__ */ jsxs("span", { className: "absolute top-3 left-3 text-[11px] font-semibold tracking-wide bg-emerald-50/90 text-emerald-700 border border-emerald-200/50 backdrop-blur px-2 py-0.5 rounded-md", children: [
|
|
6202
|
+
primaryPlan.trial_days,
|
|
6203
|
+
"-day free trial"
|
|
6204
|
+
] })
|
|
6205
|
+
] }),
|
|
6206
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4", children: [
|
|
6207
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[14.5px] font-bold text-foreground leading-snug tracking-tight", children: product.name }),
|
|
6208
|
+
product.description && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground mt-1 leading-relaxed line-clamp-2", children: product.description }),
|
|
6209
|
+
tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mt-2.5", children: tags.slice(0, 3).map((tag) => /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-muted-foreground px-1.5 py-0.5 bg-muted rounded", children: tag }, tag)) }),
|
|
6210
|
+
plans.length > 1 && /* @__PURE__ */ jsx("div", { className: "mt-3 space-y-1", children: plans.slice(0, 3).map((plan) => {
|
|
6211
|
+
const label = plan.frequency ? plan.frequency.charAt(0).toUpperCase() + plan.frequency.slice(1) : "Standard";
|
|
6212
|
+
const hasMarkup = plan.markup_type && plan.markup_amount;
|
|
6213
|
+
const isSavings = plan.markup_type === "percentage" && plan.markup_amount != null && plan.markup_amount < 0;
|
|
6214
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-[11px]", children: [
|
|
6215
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
|
|
6216
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: hasMarkup && isSavings && /* @__PURE__ */ jsxs("span", { className: "text-emerald-600 mr-1", children: [
|
|
6217
|
+
"Save ",
|
|
6218
|
+
Math.abs(plan.markup_amount),
|
|
6219
|
+
"%"
|
|
6220
|
+
] }) })
|
|
6221
|
+
] }, plan.id);
|
|
6222
|
+
}) }),
|
|
6223
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mt-3 pt-3 border-t border-border", children: [
|
|
6224
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[11px] text-muted-foreground", children: [
|
|
6225
|
+
hasTrial && /* @__PURE__ */ jsx("span", { className: "text-emerald-600 font-medium", children: "Free trial" }),
|
|
6226
|
+
primaryPlan?.setup_fee != null && primaryPlan.setup_fee > 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
6227
|
+
/* @__PURE__ */ jsx(Price, { amount: primaryPlan.setup_fee }),
|
|
6228
|
+
" setup"
|
|
6229
|
+
] })
|
|
6230
|
+
] }),
|
|
6231
|
+
/* @__PURE__ */ jsx(
|
|
6232
|
+
"button",
|
|
6233
|
+
{
|
|
6234
|
+
onClick: (e) => {
|
|
6235
|
+
e.preventDefault();
|
|
6236
|
+
e.stopPropagation();
|
|
6237
|
+
onBook?.(product);
|
|
6238
|
+
},
|
|
6239
|
+
className: "text-[13px] font-semibold text-primary hover:text-primary/80 transition-colors",
|
|
6240
|
+
children: "Subscribe \u2192"
|
|
6241
|
+
}
|
|
6242
|
+
)
|
|
6243
|
+
] })
|
|
6244
|
+
] })
|
|
6245
|
+
] });
|
|
6246
|
+
}
|
|
6247
|
+
|
|
6248
|
+
// src/react/cards/index.ts
|
|
6249
|
+
var CardVariant = /* @__PURE__ */ ((CardVariant2) => {
|
|
6250
|
+
CardVariant2["Food"] = "food";
|
|
6251
|
+
CardVariant2["Retail"] = "retail";
|
|
6252
|
+
CardVariant2["Wholesale"] = "wholesale";
|
|
6253
|
+
CardVariant2["Digital"] = "digital";
|
|
6254
|
+
CardVariant2["Standard"] = "standard";
|
|
6255
|
+
CardVariant2["Compact"] = "compact";
|
|
6256
|
+
CardVariant2["Schedule"] = "schedule";
|
|
6257
|
+
CardVariant2["Rental"] = "rental";
|
|
6258
|
+
CardVariant2["Accommodation"] = "accommodation";
|
|
6259
|
+
CardVariant2["Lease"] = "lease";
|
|
6260
|
+
CardVariant2["Subscription"] = "subscription";
|
|
6261
|
+
return CardVariant2;
|
|
6262
|
+
})(CardVariant || {});
|
|
5490
6263
|
var ASPECT_STYLES2 = {
|
|
5491
6264
|
square: { aspectRatio: "1/1" },
|
|
5492
6265
|
"4/3": { aspectRatio: "4/3" },
|
|
5493
6266
|
"16/10": { aspectRatio: "16/10" },
|
|
5494
6267
|
"3/4": { aspectRatio: "3/4" }
|
|
5495
6268
|
};
|
|
6269
|
+
var BUILT_IN_CARDS = {
|
|
6270
|
+
["food" /* Food */]: FoodProductCard,
|
|
6271
|
+
["retail" /* Retail */]: RetailProductCard,
|
|
6272
|
+
["wholesale" /* Wholesale */]: WholesaleProductCard,
|
|
6273
|
+
["digital" /* Digital */]: DigitalProductCard,
|
|
6274
|
+
["standard" /* Standard */]: StandardServiceCard,
|
|
6275
|
+
["rental" /* Rental */]: RentalServiceCard,
|
|
6276
|
+
["accommodation" /* Accommodation */]: AccommodationCard,
|
|
6277
|
+
["lease" /* Lease */]: LeaseServiceCard,
|
|
6278
|
+
["subscription" /* Subscription */]: SubscriptionCard
|
|
6279
|
+
};
|
|
6280
|
+
var RENTAL_UNITS = /* @__PURE__ */ new Set([DURATION_UNIT.Days, DURATION_UNIT.Hours]);
|
|
6281
|
+
var LEASE_UNITS = /* @__PURE__ */ new Set([DURATION_UNIT.Weeks, DURATION_UNIT.Months, DURATION_UNIT.Years]);
|
|
6282
|
+
function resolveCardVariant(product) {
|
|
6283
|
+
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
6284
|
+
return "wholesale" /* Wholesale */;
|
|
6285
|
+
}
|
|
6286
|
+
if (product.type === PRODUCT_TYPE.Digital) {
|
|
6287
|
+
return "digital" /* Digital */;
|
|
6288
|
+
}
|
|
6289
|
+
if (product.type === PRODUCT_TYPE.Service) {
|
|
6290
|
+
if (product.duration_unit && RENTAL_UNITS.has(product.duration_unit)) {
|
|
6291
|
+
return "rental" /* Rental */;
|
|
6292
|
+
}
|
|
6293
|
+
if (product.duration_unit === DURATION_UNIT.Nights) {
|
|
6294
|
+
return "accommodation" /* Accommodation */;
|
|
6295
|
+
}
|
|
6296
|
+
if (product.duration_unit && LEASE_UNITS.has(product.duration_unit)) {
|
|
6297
|
+
return "lease" /* Lease */;
|
|
6298
|
+
}
|
|
6299
|
+
if (product.billing_plans && product.billing_plans.length > 0 && !product.duration_minutes) {
|
|
6300
|
+
return "subscription" /* Subscription */;
|
|
6301
|
+
}
|
|
6302
|
+
return "standard" /* Standard */;
|
|
6303
|
+
}
|
|
6304
|
+
if (product.render_hint === RENDER_HINT.Food) {
|
|
6305
|
+
return "food" /* Food */;
|
|
6306
|
+
}
|
|
6307
|
+
if (product.render_hint === RENDER_HINT.Physical) {
|
|
6308
|
+
return "retail" /* Retail */;
|
|
6309
|
+
}
|
|
6310
|
+
return "retail" /* Retail */;
|
|
6311
|
+
}
|
|
5496
6312
|
function ProductCard({
|
|
5497
6313
|
product,
|
|
5498
6314
|
displayMode,
|
|
6315
|
+
variant,
|
|
6316
|
+
cards,
|
|
5499
6317
|
href,
|
|
5500
6318
|
renderModal,
|
|
5501
6319
|
renderImage,
|
|
5502
6320
|
renderLink,
|
|
6321
|
+
onQuickAdd,
|
|
5503
6322
|
children,
|
|
5504
6323
|
aspectRatio = "4/3",
|
|
5505
6324
|
className,
|
|
@@ -5525,61 +6344,42 @@ function ProductCard({
|
|
|
5525
6344
|
setIsOpen(false);
|
|
5526
6345
|
}, []);
|
|
5527
6346
|
const imageUrl = product.image_url || product.images?.[0];
|
|
5528
|
-
const cardBody =
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
}
|
|
5547
|
-
|
|
5548
|
-
}
|
|
5549
|
-
),
|
|
5550
|
-
/* @__PURE__ */ jsxs(
|
|
5551
|
-
"div",
|
|
5552
|
-
{
|
|
5553
|
-
"data-cimplify-product-card-body": true,
|
|
5554
|
-
className: cn("p-4 flex flex-col gap-1", classNames?.body),
|
|
5555
|
-
children: [
|
|
5556
|
-
/* @__PURE__ */ jsx(
|
|
5557
|
-
"span",
|
|
5558
|
-
{
|
|
5559
|
-
"data-cimplify-product-card-name": true,
|
|
5560
|
-
className: cn("font-semibold text-foreground leading-tight", classNames?.name),
|
|
5561
|
-
children: product.name
|
|
5562
|
-
}
|
|
5563
|
-
),
|
|
5564
|
-
product.description && /* @__PURE__ */ jsx(
|
|
5565
|
-
"span",
|
|
5566
|
-
{
|
|
5567
|
-
"data-cimplify-product-card-description": true,
|
|
5568
|
-
className: cn("text-sm text-muted-foreground line-clamp-2", classNames?.description),
|
|
5569
|
-
children: product.description
|
|
5570
|
-
}
|
|
5571
|
-
),
|
|
5572
|
-
/* @__PURE__ */ jsx(
|
|
5573
|
-
Price,
|
|
6347
|
+
const cardBody = (() => {
|
|
6348
|
+
if (children) return children;
|
|
6349
|
+
const SlugCard = cards?.[product.slug];
|
|
6350
|
+
if (SlugCard) {
|
|
6351
|
+
return /* @__PURE__ */ jsx(SlugCard, { product, onQuickAdd, renderImage, renderLink });
|
|
6352
|
+
}
|
|
6353
|
+
const key = variant ?? resolveCardVariant(product);
|
|
6354
|
+
const ResolvedCard = BUILT_IN_CARDS[key];
|
|
6355
|
+
if (ResolvedCard) {
|
|
6356
|
+
return /* @__PURE__ */ jsx(ResolvedCard, { product, onQuickAdd, renderImage, renderLink });
|
|
6357
|
+
}
|
|
6358
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6359
|
+
imageUrl && /* @__PURE__ */ jsx(
|
|
6360
|
+
"div",
|
|
6361
|
+
{
|
|
6362
|
+
"data-cimplify-product-card-image-container": true,
|
|
6363
|
+
className: cn("overflow-hidden rounded-t-xl", classNames?.imageContainer),
|
|
6364
|
+
style: ASPECT_STYLES2[aspectRatio],
|
|
6365
|
+
children: renderImage ? renderImage({ src: imageUrl, alt: product.name, className: classNames?.image }) : /* @__PURE__ */ jsx(
|
|
6366
|
+
"img",
|
|
5574
6367
|
{
|
|
5575
|
-
|
|
5576
|
-
|
|
6368
|
+
src: imageUrl,
|
|
6369
|
+
alt: product.name,
|
|
6370
|
+
className: cn("w-full h-full object-cover transition-transform duration-300 group-hover:scale-105", classNames?.image),
|
|
6371
|
+
"data-cimplify-product-card-image": true
|
|
5577
6372
|
}
|
|
5578
6373
|
)
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
6374
|
+
}
|
|
6375
|
+
),
|
|
6376
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-product-card-body": true, className: cn("p-4 flex flex-col gap-1", classNames?.body), children: [
|
|
6377
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-product-card-name": true, className: cn("font-semibold text-foreground leading-tight", classNames?.name), children: product.name }),
|
|
6378
|
+
product.description && /* @__PURE__ */ jsx("span", { "data-cimplify-product-card-description": true, className: cn("text-sm text-muted-foreground line-clamp-2", classNames?.description), children: product.description }),
|
|
6379
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: cn("text-sm font-medium text-foreground mt-1", classNames?.price) })
|
|
6380
|
+
] })
|
|
6381
|
+
] });
|
|
6382
|
+
})();
|
|
5583
6383
|
if (mode === "page") {
|
|
5584
6384
|
const linkHref = href ?? `/menu/${product.slug}`;
|
|
5585
6385
|
const linkClassName = cn("group block no-underline text-[inherit] rounded-xl border border-border bg-background transition-shadow duration-200 hover:shadow-md", className, classNames?.root);
|
|
@@ -7073,7 +7873,7 @@ function BookingList({
|
|
|
7073
7873
|
}
|
|
7074
7874
|
|
|
7075
7875
|
// src/react/utils/format-duration.ts
|
|
7076
|
-
var
|
|
7876
|
+
var UNIT_LABELS3 = {
|
|
7077
7877
|
minutes: { singular: "min", plural: "min" },
|
|
7078
7878
|
hours: { singular: "hr", plural: "hrs" },
|
|
7079
7879
|
days: { singular: "day", plural: "days" },
|
|
@@ -7082,9 +7882,9 @@ var UNIT_LABELS = {
|
|
|
7082
7882
|
months: { singular: "month", plural: "months" },
|
|
7083
7883
|
years: { singular: "year", plural: "years" }
|
|
7084
7884
|
};
|
|
7085
|
-
function
|
|
7885
|
+
function formatDuration4(value, unit) {
|
|
7086
7886
|
const resolved = unit ?? "minutes";
|
|
7087
|
-
const labels =
|
|
7887
|
+
const labels = UNIT_LABELS3[resolved];
|
|
7088
7888
|
const label = value === 1 ? labels.singular : labels.plural;
|
|
7089
7889
|
return `${value} ${label}`;
|
|
7090
7890
|
}
|
|
@@ -7139,7 +7939,7 @@ function ServiceCard({
|
|
|
7139
7939
|
}
|
|
7140
7940
|
),
|
|
7141
7941
|
/* @__PURE__ */ jsxs("div", { "data-cimplify-service-card-meta": true, className: cn("flex items-center gap-2 mt-1 text-sm", classNames?.meta), children: [
|
|
7142
|
-
/* @__PURE__ */ jsx("span", { "data-cimplify-service-card-duration": true, className: cn("text-muted-foreground", classNames?.duration), children:
|
|
7942
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-service-card-duration": true, className: cn("text-muted-foreground", classNames?.duration), children: formatDuration4(service.duration_minutes, service.duration_unit) }),
|
|
7143
7943
|
service.price && /* @__PURE__ */ jsx("span", { "data-cimplify-service-card-price": true, className: cn("font-medium text-foreground", classNames?.price), children: /* @__PURE__ */ jsx(Price, { amount: service.price }) })
|
|
7144
7944
|
] })
|
|
7145
7945
|
] }),
|
|
@@ -7621,12 +8421,6 @@ function getMetadataStringList(metadata, key) {
|
|
|
7621
8421
|
if (!Array.isArray(value)) return [];
|
|
7622
8422
|
return value.filter((item) => typeof item === "string");
|
|
7623
8423
|
}
|
|
7624
|
-
function PriceRange({ product, className }) {
|
|
7625
|
-
const { displayCurrency } = useCimplify();
|
|
7626
|
-
const range = getPriceRange(product);
|
|
7627
|
-
if (!range) return null;
|
|
7628
|
-
return /* @__PURE__ */ jsx("span", { "data-cimplify-price-range": true, className, children: formatPriceRange(range.min, range.max, displayCurrency) });
|
|
7629
|
-
}
|
|
7630
8424
|
function DefaultProductLayout({
|
|
7631
8425
|
product,
|
|
7632
8426
|
onAddToCart,
|
|
@@ -7714,18 +8508,6 @@ function DefaultProductLayout({
|
|
|
7714
8508
|
)
|
|
7715
8509
|
] });
|
|
7716
8510
|
}
|
|
7717
|
-
var DIETARY_TAGS = /* @__PURE__ */ new Set([
|
|
7718
|
-
"vegetarian",
|
|
7719
|
-
"vegan",
|
|
7720
|
-
"gluten-free",
|
|
7721
|
-
"dairy-free",
|
|
7722
|
-
"nut-free",
|
|
7723
|
-
"spicy",
|
|
7724
|
-
"halal",
|
|
7725
|
-
"kosher",
|
|
7726
|
-
"organic",
|
|
7727
|
-
"sugar-free"
|
|
7728
|
-
]);
|
|
7729
8511
|
function FoodProductLayout({
|
|
7730
8512
|
product,
|
|
7731
8513
|
onAddToCart,
|
|
@@ -7735,9 +8517,7 @@ function FoodProductLayout({
|
|
|
7735
8517
|
className
|
|
7736
8518
|
}) {
|
|
7737
8519
|
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
7738
|
-
const
|
|
7739
|
-
const dietaryTags = allTags.filter((t) => DIETARY_TAGS.has(t));
|
|
7740
|
-
const otherTags = allTags.filter((t) => !DIETARY_TAGS.has(t));
|
|
8520
|
+
const tags = product.tags || [];
|
|
7741
8521
|
const ingredients = getMetadataStringList(product.metadata, "ingredients");
|
|
7742
8522
|
const pairings = getMetadataStringList(product.metadata, "pairings");
|
|
7743
8523
|
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "food", className: cn("space-y-8", className), children: [
|
|
@@ -7754,13 +8534,12 @@ function FoodProductLayout({
|
|
|
7754
8534
|
),
|
|
7755
8535
|
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7756
8536
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
7757
|
-
|
|
8537
|
+
tags.map((tag) => /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-green-100 text-green-800 text-xs font-medium rounded-full", children: tag }, tag)),
|
|
7758
8538
|
product.allergies && product.allergies.map((allergy) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 px-2.5 py-1 bg-amber-100 text-amber-800 text-xs font-medium rounded-full", children: [
|
|
7759
8539
|
"Contains ",
|
|
7760
8540
|
allergy
|
|
7761
8541
|
] }, allergy))
|
|
7762
8542
|
] }),
|
|
7763
|
-
/* @__PURE__ */ jsx(TagPills, { tags: otherTags }),
|
|
7764
8543
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
7765
8544
|
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-bold tracking-tight", children: product.name }),
|
|
7766
8545
|
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold mt-2 block" })
|
|
@@ -8146,16 +8925,16 @@ function resolveTemplateKey(product) {
|
|
|
8146
8925
|
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
8147
8926
|
return "wholesale" /* Wholesale */;
|
|
8148
8927
|
}
|
|
8149
|
-
if (product.type ===
|
|
8928
|
+
if (product.type === PRODUCT_TYPE.Service) {
|
|
8150
8929
|
return "service" /* Service */;
|
|
8151
8930
|
}
|
|
8152
|
-
if (product.type ===
|
|
8931
|
+
if (product.type === PRODUCT_TYPE.Digital) {
|
|
8153
8932
|
return "digital" /* Digital */;
|
|
8154
8933
|
}
|
|
8155
|
-
if (product.render_hint ===
|
|
8934
|
+
if (product.render_hint === RENDER_HINT.Food) {
|
|
8156
8935
|
return "food" /* Food */;
|
|
8157
8936
|
}
|
|
8158
|
-
if (product.render_hint ===
|
|
8937
|
+
if (product.render_hint === RENDER_HINT.Physical) {
|
|
8159
8938
|
return "physical" /* Physical */;
|
|
8160
8939
|
}
|
|
8161
8940
|
return "default" /* Default */;
|
|
@@ -8852,7 +9631,7 @@ function BookingPage({
|
|
|
8852
9631
|
] }) }),
|
|
8853
9632
|
/* @__PURE__ */ jsxs("div", { "data-cimplify-booking-service-info": true, className: classNames?.serviceInfo, children: [
|
|
8854
9633
|
/* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-name": true, children: service.name }),
|
|
8855
|
-
/* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-duration": true, children:
|
|
9634
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-duration": true, children: formatDuration4(service.duration_minutes, service.duration_unit) }),
|
|
8856
9635
|
service.price && /* @__PURE__ */ jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsx(Price, { amount: service.price }) }),
|
|
8857
9636
|
hasDeposit && /* @__PURE__ */ jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
|
|
8858
9637
|
"Deposit: ",
|
|
@@ -8924,7 +9703,7 @@ function BookingPage({
|
|
|
8924
9703
|
] }),
|
|
8925
9704
|
/* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
|
|
8926
9705
|
/* @__PURE__ */ jsx("span", { children: "Duration" }),
|
|
8927
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
9706
|
+
/* @__PURE__ */ jsx("span", { children: formatDuration4(service.duration_minutes, service.duration_unit) })
|
|
8928
9707
|
] }),
|
|
8929
9708
|
selectedResourceId && resources && /* @__PURE__ */ jsxs("div", { "data-cimplify-booking-summary-row": true, className: classNames?.summaryRow, children: [
|
|
8930
9709
|
/* @__PURE__ */ jsx("span", { children: "Room" }),
|
|
@@ -9402,4 +10181,4 @@ function CurrencySelector({
|
|
|
9402
10181
|
}) });
|
|
9403
10182
|
}
|
|
9404
10183
|
|
|
9405
|
-
export { Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleSelector, CartPage, CartSummary, CataloguePage, CategoryFilter, CategoryGrid, CheckoutPage, CimplifyCheckout, CimplifyProvider, CollectionPage, CompositeSelector, CurrencySelector, CustomAttributesTable, DateSlotPicker, DealBanner, DealsPage, DefaultProductLayout, DeliveryEstimate, DigitalProductLayout, DiscountInput, ElementsProvider, FoodProductLayout, InventoryBadge, LocationPicker, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, ResourcePicker, SaleBadge, SearchInput, SearchPage, ServiceCard, ServiceGrid, ServiceProductLayout, SessionMessageBanner, SlotPicker, StaffPicker, StoreNav, TagPills, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductLayout, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCategories, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
|
10184
|
+
export { AccommodationCard, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleSelector, CardImage, CardShell, CardVariant, CartPage, CartSummary, CataloguePage, CategoryFilter, CategoryGrid, CheckoutPage, CimplifyCheckout, CimplifyProvider, CollectionPage, CompactServiceCard, CompositeSelector, CurrencySelector, CustomAttributesTable, DateSlotPicker, DealBanner, DealsPage, DefaultProductLayout, DeliveryEstimate, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, FoodProductCard, FoodProductLayout, InventoryBadge, LeaseServiceCard, LocationPicker, MetadataStringList, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, ServiceCard, ServiceGrid, ServiceProductLayout, SessionMessageBanner, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, StoreNav, SubscriptionCard, TagPills, TwoColumnGrid, VariantSelector, VolumePricing, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCategories, useCheckout, useCimplify, useCimplifyClient, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|