@cimplify/sdk 0.23.0 → 0.24.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.js +21 -21
- package/dist/advanced.mjs +2 -2
- package/dist/{chunk-OANVYH27.mjs → chunk-E3HC2YAE.mjs} +1 -1
- package/dist/{chunk-3GSXQNWV.mjs → chunk-H34GSEGR.mjs} +2 -2
- package/dist/{chunk-TXQHTHY5.js → chunk-I4F4Y3D4.js} +20 -20
- package/dist/{chunk-RAKLT6J2.js → chunk-IYQGGFVQ.js} +39 -39
- package/dist/{chunk-KRNWMUBN.js → chunk-PEDLCL72.js} +1 -1
- package/dist/{chunk-BYQPMSH2.mjs → chunk-TBZLJPM4.mjs} +1 -1
- package/dist/{index-BodyCOun.d.mts → index-DCoxHrmr.d.mts} +2 -2
- package/dist/{index-IH1wOTmD.d.ts → index-DT0Mzy8v.d.ts} +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +101 -101
- package/dist/index.mjs +3 -3
- package/dist/react.d.mts +78 -23
- package/dist/react.d.ts +78 -23
- package/dist/react.js +797 -105
- package/dist/react.mjs +725 -46
- package/dist/styles.css +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +28 -28
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
- package/registry/product-page.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getVariantDisplayName, createCimplifyClient } from './chunk-
|
|
3
|
-
export { getVariantDisplayName } from './chunk-
|
|
4
|
-
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-
|
|
5
|
-
import { isSupportedCurrency, formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-
|
|
2
|
+
import { getVariantDisplayName, createCimplifyClient } from './chunk-H34GSEGR.mjs';
|
|
3
|
+
export { getVariantDisplayName } from './chunk-H34GSEGR.mjs';
|
|
4
|
+
import { ELEMENT_TYPES, EVENT_TYPES } from './chunk-TBZLJPM4.mjs';
|
|
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';
|
|
7
7
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { NumberField } from '@base-ui/react/number-field';
|
|
@@ -7482,21 +7482,713 @@ function useDebounce(value, delay) {
|
|
|
7482
7482
|
}, [value, delay]);
|
|
7483
7483
|
return debounced;
|
|
7484
7484
|
}
|
|
7485
|
+
function TwoColumnGrid({
|
|
7486
|
+
left,
|
|
7487
|
+
right,
|
|
7488
|
+
className
|
|
7489
|
+
}) {
|
|
7490
|
+
return /* @__PURE__ */ jsxs(
|
|
7491
|
+
"div",
|
|
7492
|
+
{
|
|
7493
|
+
"data-cimplify-product-layout-grid": true,
|
|
7494
|
+
className: cn("grid lg:grid-cols-2 gap-8 lg:gap-12", className),
|
|
7495
|
+
children: [
|
|
7496
|
+
/* @__PURE__ */ jsx("div", { "data-cimplify-product-layout-media": true, children: left }),
|
|
7497
|
+
/* @__PURE__ */ jsx("div", { "data-cimplify-product-layout-info": true, children: right })
|
|
7498
|
+
]
|
|
7499
|
+
}
|
|
7500
|
+
);
|
|
7501
|
+
}
|
|
7502
|
+
function MetadataStringList({
|
|
7503
|
+
items,
|
|
7504
|
+
label,
|
|
7505
|
+
icon,
|
|
7506
|
+
className
|
|
7507
|
+
}) {
|
|
7508
|
+
if (items.length === 0) return null;
|
|
7509
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-metadata-list": true, className: cn("space-y-2", className), children: [
|
|
7510
|
+
/* @__PURE__ */ jsxs("h3", { className: "flex items-center gap-2 text-sm font-medium", children: [
|
|
7511
|
+
icon,
|
|
7512
|
+
label
|
|
7513
|
+
] }),
|
|
7514
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, i) => /* @__PURE__ */ jsx(
|
|
7515
|
+
"span",
|
|
7516
|
+
{
|
|
7517
|
+
className: "text-xs text-muted-foreground px-2.5 py-1 bg-muted",
|
|
7518
|
+
children: item
|
|
7519
|
+
},
|
|
7520
|
+
`${item}-${i}`
|
|
7521
|
+
)) })
|
|
7522
|
+
] });
|
|
7523
|
+
}
|
|
7524
|
+
function CustomAttributesTable({
|
|
7525
|
+
attributes,
|
|
7526
|
+
className
|
|
7527
|
+
}) {
|
|
7528
|
+
if (!attributes || attributes.length === 0) return null;
|
|
7529
|
+
const groups = /* @__PURE__ */ new Map();
|
|
7530
|
+
for (const attr of attributes) {
|
|
7531
|
+
const group = attr.group_name || "Details";
|
|
7532
|
+
if (!groups.has(group)) groups.set(group, []);
|
|
7533
|
+
groups.get(group).push(attr);
|
|
7534
|
+
}
|
|
7535
|
+
return /* @__PURE__ */ jsx("div", { "data-cimplify-custom-attributes": true, className: cn("space-y-4", className), children: Array.from(groups.entries()).map(([groupName, attrs]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
7536
|
+
/* @__PURE__ */ jsx("h3", { "data-cimplify-attribute-group": true, className: "text-sm font-semibold mb-2", children: groupName }),
|
|
7537
|
+
/* @__PURE__ */ jsx("div", { className: "border border-border divide-y divide-border", children: attrs.map((attr) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 text-sm", children: [
|
|
7538
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: attr.name }),
|
|
7539
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: formatAttributeValue(attr) })
|
|
7540
|
+
] }, attr.definition_id)) })
|
|
7541
|
+
] }, groupName)) });
|
|
7542
|
+
}
|
|
7543
|
+
function formatAttributeValue(attr) {
|
|
7544
|
+
if (attr.value === null || attr.value === void 0) return "\u2014";
|
|
7545
|
+
if (typeof attr.value === "boolean") return attr.value ? "Yes" : "No";
|
|
7546
|
+
if (Array.isArray(attr.value)) return attr.value.join(", ");
|
|
7547
|
+
if (typeof attr.value === "object" && "value" in attr.value) {
|
|
7548
|
+
return `${attr.value.value}${attr.unit ? ` ${attr.unit}` : ""}`;
|
|
7549
|
+
}
|
|
7550
|
+
const str = String(attr.value);
|
|
7551
|
+
return attr.unit ? `${str} ${attr.unit}` : str;
|
|
7552
|
+
}
|
|
7553
|
+
function PropertiesTable({
|
|
7554
|
+
properties,
|
|
7555
|
+
className
|
|
7556
|
+
}) {
|
|
7557
|
+
if (!properties || properties.length === 0) return null;
|
|
7558
|
+
return /* @__PURE__ */ jsx("div", { "data-cimplify-properties": true, className, children: /* @__PURE__ */ jsx("div", { className: "border border-border divide-y divide-border", children: properties.map((prop) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 text-sm", children: [
|
|
7559
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: prop.name }),
|
|
7560
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
7561
|
+
prop.values.filter(Boolean).join(", "),
|
|
7562
|
+
prop.unit ? ` ${prop.unit}` : ""
|
|
7563
|
+
] })
|
|
7564
|
+
] }, prop.slug)) }) });
|
|
7565
|
+
}
|
|
7566
|
+
function TagPills({
|
|
7567
|
+
tags,
|
|
7568
|
+
className
|
|
7569
|
+
}) {
|
|
7570
|
+
if (!tags || tags.length === 0) return null;
|
|
7571
|
+
return /* @__PURE__ */ jsx("div", { "data-cimplify-tags": true, className: cn("flex flex-wrap gap-1.5", className), children: tags.map((tag) => /* @__PURE__ */ jsx(
|
|
7572
|
+
"span",
|
|
7573
|
+
{
|
|
7574
|
+
className: "text-xs font-medium text-muted-foreground px-2.5 py-1 bg-muted rounded-full",
|
|
7575
|
+
children: tag
|
|
7576
|
+
},
|
|
7577
|
+
tag
|
|
7578
|
+
)) });
|
|
7579
|
+
}
|
|
7580
|
+
function InventoryBadge({
|
|
7581
|
+
product,
|
|
7582
|
+
className
|
|
7583
|
+
}) {
|
|
7584
|
+
const status = product.inventory_status;
|
|
7585
|
+
if (!status) return null;
|
|
7586
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-inventory-badge": true, className: cn("flex items-center gap-2 text-sm", className), children: [
|
|
7587
|
+
/* @__PURE__ */ jsx("span", { className: cn(
|
|
7588
|
+
"w-2 h-2 rounded-full",
|
|
7589
|
+
status.in_stock ? "bg-green-500" : "bg-red-500"
|
|
7590
|
+
) }),
|
|
7591
|
+
/* @__PURE__ */ jsx("span", { className: status.in_stock ? "text-green-700 font-medium" : "text-red-700 font-medium", children: status.in_stock ? "In stock" : "Out of stock" }),
|
|
7592
|
+
status.in_stock && status.stock_level != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
7593
|
+
"\xB7 ",
|
|
7594
|
+
status.stock_level.toLocaleString(),
|
|
7595
|
+
" available"
|
|
7596
|
+
] }),
|
|
7597
|
+
status.low_stock && /* @__PURE__ */ jsx("span", { className: "text-amber-600 font-medium", children: "\xB7 Low stock" })
|
|
7598
|
+
] });
|
|
7599
|
+
}
|
|
7600
|
+
function RelatedProductsSection({
|
|
7601
|
+
products,
|
|
7602
|
+
title = "You might also like",
|
|
7603
|
+
renderImage,
|
|
7604
|
+
className
|
|
7605
|
+
}) {
|
|
7606
|
+
if (products.length === 0) return null;
|
|
7607
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-related": true, className: cn("mt-12 pt-8 border-t border-border", className), children: [
|
|
7608
|
+
/* @__PURE__ */ jsx(
|
|
7609
|
+
"h2",
|
|
7610
|
+
{
|
|
7611
|
+
"data-cimplify-product-layout-related-title": true,
|
|
7612
|
+
className: "text-xl font-semibold mb-6",
|
|
7613
|
+
children: title
|
|
7614
|
+
}
|
|
7615
|
+
),
|
|
7616
|
+
/* @__PURE__ */ jsx(ProductGrid, { products, renderImage })
|
|
7617
|
+
] });
|
|
7618
|
+
}
|
|
7619
|
+
function getMetadataStringList(metadata, key) {
|
|
7620
|
+
const value = metadata?.[key];
|
|
7621
|
+
if (!Array.isArray(value)) return [];
|
|
7622
|
+
return value.filter((item) => typeof item === "string");
|
|
7623
|
+
}
|
|
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
|
+
function DefaultProductLayout({
|
|
7631
|
+
product,
|
|
7632
|
+
onAddToCart,
|
|
7633
|
+
renderBreadcrumb,
|
|
7634
|
+
relatedProducts,
|
|
7635
|
+
showRelated = true,
|
|
7636
|
+
className
|
|
7637
|
+
}) {
|
|
7638
|
+
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
7639
|
+
const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
|
|
7640
|
+
const onSale = isOnSale(product);
|
|
7641
|
+
const hasPhysicalDetails = product.sku || product.vendor || product.material;
|
|
7642
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
|
|
7643
|
+
renderBreadcrumb?.(product),
|
|
7644
|
+
/* @__PURE__ */ jsx(
|
|
7645
|
+
TwoColumnGrid,
|
|
7646
|
+
{
|
|
7647
|
+
left: /* @__PURE__ */ jsx(
|
|
7648
|
+
ProductImageGallery,
|
|
7649
|
+
{
|
|
7650
|
+
images,
|
|
7651
|
+
productName: product.name
|
|
7652
|
+
}
|
|
7653
|
+
),
|
|
7654
|
+
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7655
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
7656
|
+
product.vendor && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-widest", children: product.vendor }),
|
|
7657
|
+
/* @__PURE__ */ jsx(TagPills, { tags: product.tags || [] })
|
|
7658
|
+
] }),
|
|
7659
|
+
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
|
|
7660
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsx(PriceRange, { product, className: "text-2xl font-extrabold" }) : onSale ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7661
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-extrabold" }),
|
|
7662
|
+
/* @__PURE__ */ jsx(Price, { amount: getBasePrice(product), className: "text-lg text-muted-foreground line-through" }),
|
|
7663
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
|
|
7664
|
+
"Save ",
|
|
7665
|
+
getDiscountPercentage(product),
|
|
7666
|
+
"%"
|
|
7667
|
+
] })
|
|
7668
|
+
] }) : /* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
|
|
7669
|
+
/* @__PURE__ */ jsx(InventoryBadge, { product }),
|
|
7670
|
+
product.description && /* @__PURE__ */ jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
|
|
7671
|
+
hasPhysicalDetails && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-details": true, className: "space-y-1 text-sm text-muted-foreground", children: [
|
|
7672
|
+
product.sku && /* @__PURE__ */ jsxs("p", { children: [
|
|
7673
|
+
"SKU: ",
|
|
7674
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-foreground", children: product.sku })
|
|
7675
|
+
] }),
|
|
7676
|
+
product.barcode && /* @__PURE__ */ jsxs("p", { children: [
|
|
7677
|
+
"Barcode: ",
|
|
7678
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-foreground", children: product.barcode })
|
|
7679
|
+
] }),
|
|
7680
|
+
product.material && /* @__PURE__ */ jsxs("p", { children: [
|
|
7681
|
+
"Material: ",
|
|
7682
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: product.material })
|
|
7683
|
+
] }),
|
|
7684
|
+
product.vendor && /* @__PURE__ */ jsxs("p", { children: [
|
|
7685
|
+
"Brand: ",
|
|
7686
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: product.vendor })
|
|
7687
|
+
] }),
|
|
7688
|
+
(product.length_mm || product.width_mm || product.height_mm) && /* @__PURE__ */ jsxs("p", { children: [
|
|
7689
|
+
"Dimensions: ",
|
|
7690
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: [product.length_mm, product.width_mm, product.height_mm].filter(Boolean).map((d) => `${(d / 10).toFixed(1)} cm`).join(" x ") })
|
|
7691
|
+
] }),
|
|
7692
|
+
product.item_condition && product.item_condition !== "new" && /* @__PURE__ */ jsxs("p", { children: [
|
|
7693
|
+
"Condition: ",
|
|
7694
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground capitalize", children: product.item_condition })
|
|
7695
|
+
] })
|
|
7696
|
+
] }),
|
|
7697
|
+
/* @__PURE__ */ jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
|
|
7698
|
+
/* @__PURE__ */ jsx(PropertiesTable, { properties: product.properties || [] }),
|
|
7699
|
+
/* @__PURE__ */ jsx(
|
|
7700
|
+
ProductCustomizer,
|
|
7701
|
+
{
|
|
7702
|
+
product,
|
|
7703
|
+
onAddToCart
|
|
7704
|
+
}
|
|
7705
|
+
)
|
|
7706
|
+
] })
|
|
7707
|
+
}
|
|
7708
|
+
),
|
|
7709
|
+
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsx(
|
|
7710
|
+
RelatedProductsSection,
|
|
7711
|
+
{
|
|
7712
|
+
products: relatedProducts
|
|
7713
|
+
}
|
|
7714
|
+
)
|
|
7715
|
+
] });
|
|
7716
|
+
}
|
|
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
|
+
function FoodProductLayout({
|
|
7730
|
+
product,
|
|
7731
|
+
onAddToCart,
|
|
7732
|
+
renderBreadcrumb,
|
|
7733
|
+
relatedProducts,
|
|
7734
|
+
showRelated = true,
|
|
7735
|
+
className
|
|
7736
|
+
}) {
|
|
7737
|
+
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
7738
|
+
const allTags = product.tags || [];
|
|
7739
|
+
const dietaryTags = allTags.filter((t) => DIETARY_TAGS.has(t));
|
|
7740
|
+
const otherTags = allTags.filter((t) => !DIETARY_TAGS.has(t));
|
|
7741
|
+
const ingredients = getMetadataStringList(product.metadata, "ingredients");
|
|
7742
|
+
const pairings = getMetadataStringList(product.metadata, "pairings");
|
|
7743
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "food", className: cn("space-y-8", className), children: [
|
|
7744
|
+
renderBreadcrumb?.(product),
|
|
7745
|
+
/* @__PURE__ */ jsx(
|
|
7746
|
+
TwoColumnGrid,
|
|
7747
|
+
{
|
|
7748
|
+
left: /* @__PURE__ */ jsx(
|
|
7749
|
+
ProductImageGallery,
|
|
7750
|
+
{
|
|
7751
|
+
images,
|
|
7752
|
+
productName: product.name
|
|
7753
|
+
}
|
|
7754
|
+
),
|
|
7755
|
+
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7756
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
7757
|
+
dietaryTags.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
|
+
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
|
+
"Contains ",
|
|
7760
|
+
allergy
|
|
7761
|
+
] }, allergy))
|
|
7762
|
+
] }),
|
|
7763
|
+
/* @__PURE__ */ jsx(TagPills, { tags: otherTags }),
|
|
7764
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7765
|
+
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-bold tracking-tight", children: product.name }),
|
|
7766
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold mt-2 block" })
|
|
7767
|
+
] }),
|
|
7768
|
+
(product.calories != null || product.preparation_time_minutes != null) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-stats": true, className: "flex flex-wrap gap-4 py-3 border-y border-border", children: [
|
|
7769
|
+
product.preparation_time_minutes != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm text-muted-foreground", children: [
|
|
7770
|
+
/* @__PURE__ */ jsxs("strong", { className: "text-foreground", children: [
|
|
7771
|
+
product.preparation_time_minutes,
|
|
7772
|
+
" min"
|
|
7773
|
+
] }),
|
|
7774
|
+
" prep time"
|
|
7775
|
+
] }),
|
|
7776
|
+
product.calories != null && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm text-muted-foreground", children: [
|
|
7777
|
+
/* @__PURE__ */ jsx("strong", { className: "text-foreground", children: product.calories }),
|
|
7778
|
+
" calories"
|
|
7779
|
+
] })
|
|
7780
|
+
] }),
|
|
7781
|
+
product.description && /* @__PURE__ */ jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
|
|
7782
|
+
(ingredients.length > 0 || pairings.length > 0) && /* @__PURE__ */ jsxs("div", { className: "grid sm:grid-cols-2 gap-4", children: [
|
|
7783
|
+
/* @__PURE__ */ jsx(MetadataStringList, { items: ingredients, label: "Key Ingredients" }),
|
|
7784
|
+
/* @__PURE__ */ jsx(MetadataStringList, { items: pairings, label: "Pairings" })
|
|
7785
|
+
] }),
|
|
7786
|
+
/* @__PURE__ */ jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
|
|
7787
|
+
/* @__PURE__ */ jsx(
|
|
7788
|
+
ProductCustomizer,
|
|
7789
|
+
{
|
|
7790
|
+
product,
|
|
7791
|
+
onAddToCart
|
|
7792
|
+
}
|
|
7793
|
+
)
|
|
7794
|
+
] })
|
|
7795
|
+
}
|
|
7796
|
+
),
|
|
7797
|
+
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsx(
|
|
7798
|
+
RelatedProductsSection,
|
|
7799
|
+
{
|
|
7800
|
+
products: relatedProducts,
|
|
7801
|
+
title: "You may also enjoy"
|
|
7802
|
+
}
|
|
7803
|
+
)
|
|
7804
|
+
] });
|
|
7805
|
+
}
|
|
7806
|
+
function WholesaleProductLayout({
|
|
7807
|
+
product,
|
|
7808
|
+
onAddToCart,
|
|
7809
|
+
renderBreadcrumb,
|
|
7810
|
+
relatedProducts,
|
|
7811
|
+
showRelated = true,
|
|
7812
|
+
className
|
|
7813
|
+
}) {
|
|
7814
|
+
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
7815
|
+
const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
|
|
7816
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
|
|
7817
|
+
renderBreadcrumb?.(product),
|
|
7818
|
+
/* @__PURE__ */ jsx(
|
|
7819
|
+
TwoColumnGrid,
|
|
7820
|
+
{
|
|
7821
|
+
left: /* @__PURE__ */ jsx(
|
|
7822
|
+
ProductImageGallery,
|
|
7823
|
+
{
|
|
7824
|
+
images,
|
|
7825
|
+
productName: product.name
|
|
7826
|
+
}
|
|
7827
|
+
),
|
|
7828
|
+
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7829
|
+
/* @__PURE__ */ jsx(TagPills, { tags: product.tags || [] }),
|
|
7830
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7831
|
+
product.sku && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground font-medium uppercase tracking-wider mb-1", children: [
|
|
7832
|
+
"SKU: ",
|
|
7833
|
+
product.sku
|
|
7834
|
+
] }),
|
|
7835
|
+
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name })
|
|
7836
|
+
] }),
|
|
7837
|
+
/* @__PURE__ */ jsx("div", { children: hasTiers ? /* @__PURE__ */ jsx(PriceRange, { product, className: "text-2xl font-extrabold" }) : /* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
|
|
7838
|
+
/* @__PURE__ */ jsx(InventoryBadge, { product }),
|
|
7839
|
+
product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-moq": true, className: "flex items-center gap-3 p-3 bg-amber-50 border border-amber-200 text-sm text-amber-800", children: [
|
|
7840
|
+
"Minimum order quantity: ",
|
|
7841
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
7842
|
+
product.min_order_quantity,
|
|
7843
|
+
" units"
|
|
7844
|
+
] })
|
|
7845
|
+
] }),
|
|
7846
|
+
product.description && /* @__PURE__ */ jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
|
|
7847
|
+
hasTiers && /* @__PURE__ */ jsx(
|
|
7848
|
+
VolumePricing,
|
|
7849
|
+
{
|
|
7850
|
+
tiers: product.quantity_pricing,
|
|
7851
|
+
defaultOpen: true
|
|
7852
|
+
}
|
|
7853
|
+
),
|
|
7854
|
+
(product.sku || product.barcode || product.vendor) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-details": true, className: "space-y-1 text-sm text-muted-foreground", children: [
|
|
7855
|
+
product.barcode && /* @__PURE__ */ jsxs("p", { children: [
|
|
7856
|
+
"Barcode: ",
|
|
7857
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-foreground", children: product.barcode })
|
|
7858
|
+
] }),
|
|
7859
|
+
product.vendor && /* @__PURE__ */ jsxs("p", { children: [
|
|
7860
|
+
"Supplier: ",
|
|
7861
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: product.vendor })
|
|
7862
|
+
] }),
|
|
7863
|
+
product.hs_code && /* @__PURE__ */ jsxs("p", { children: [
|
|
7864
|
+
"HS Code: ",
|
|
7865
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-foreground", children: product.hs_code })
|
|
7866
|
+
] })
|
|
7867
|
+
] }),
|
|
7868
|
+
/* @__PURE__ */ jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
|
|
7869
|
+
/* @__PURE__ */ jsx(PropertiesTable, { properties: product.properties || [] }),
|
|
7870
|
+
/* @__PURE__ */ jsx(
|
|
7871
|
+
ProductCustomizer,
|
|
7872
|
+
{
|
|
7873
|
+
product,
|
|
7874
|
+
onAddToCart
|
|
7875
|
+
}
|
|
7876
|
+
)
|
|
7877
|
+
] })
|
|
7878
|
+
}
|
|
7879
|
+
),
|
|
7880
|
+
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsx(
|
|
7881
|
+
RelatedProductsSection,
|
|
7882
|
+
{
|
|
7883
|
+
products: relatedProducts,
|
|
7884
|
+
title: "Related products"
|
|
7885
|
+
}
|
|
7886
|
+
)
|
|
7887
|
+
] });
|
|
7888
|
+
}
|
|
7889
|
+
function formatMinutes(minutes) {
|
|
7890
|
+
if (minutes >= 1440) return `${Math.floor(minutes / 1440)} day${minutes >= 2880 ? "s" : ""}`;
|
|
7891
|
+
if (minutes >= 60) {
|
|
7892
|
+
const h = Math.floor(minutes / 60);
|
|
7893
|
+
const m = minutes % 60;
|
|
7894
|
+
return m > 0 ? `${h}h ${m}min` : `${h} hour${h > 1 ? "s" : ""}`;
|
|
7895
|
+
}
|
|
7896
|
+
return `${minutes} min`;
|
|
7897
|
+
}
|
|
7898
|
+
function ServiceProductLayout({
|
|
7899
|
+
product,
|
|
7900
|
+
onAddToCart,
|
|
7901
|
+
renderBreadcrumb,
|
|
7902
|
+
relatedProducts,
|
|
7903
|
+
showRelated = true,
|
|
7904
|
+
className
|
|
7905
|
+
}) {
|
|
7906
|
+
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
7907
|
+
const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
|
|
7908
|
+
const depositAmount = hasDeposit ? parsePrice(product.deposit_amount) : 0;
|
|
7909
|
+
const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
|
|
7910
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
|
|
7911
|
+
renderBreadcrumb?.(product),
|
|
7912
|
+
/* @__PURE__ */ jsx(
|
|
7913
|
+
TwoColumnGrid,
|
|
7914
|
+
{
|
|
7915
|
+
left: /* @__PURE__ */ jsx(
|
|
7916
|
+
ProductImageGallery,
|
|
7917
|
+
{
|
|
7918
|
+
images,
|
|
7919
|
+
productName: product.name
|
|
7920
|
+
}
|
|
7921
|
+
),
|
|
7922
|
+
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
7923
|
+
/* @__PURE__ */ jsx(TagPills, { tags: product.tags || [] }),
|
|
7924
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
7925
|
+
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
|
|
7926
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-bold text-primary mt-2 block" })
|
|
7927
|
+
] }),
|
|
7928
|
+
/* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-service-info": true, className: "flex flex-wrap gap-2", children: [
|
|
7929
|
+
product.duration_minutes != null && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted text-sm text-muted-foreground rounded-full", children: formatMinutes(product.duration_minutes) }),
|
|
7930
|
+
hasDeposit && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted text-sm text-muted-foreground rounded-full", children: [
|
|
7931
|
+
/* @__PURE__ */ jsx(Price, { amount: depositAmount }),
|
|
7932
|
+
" deposit"
|
|
7933
|
+
] }),
|
|
7934
|
+
product.general_service_capacity != null && product.general_service_capacity > 1 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted text-sm text-muted-foreground rounded-full", children: [
|
|
7935
|
+
"Up to ",
|
|
7936
|
+
product.general_service_capacity,
|
|
7937
|
+
" people"
|
|
7938
|
+
] }),
|
|
7939
|
+
product.buffer_before_minutes != null && product.buffer_before_minutes > 0 && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted text-sm text-muted-foreground rounded-full", children: [
|
|
7940
|
+
product.buffer_before_minutes,
|
|
7941
|
+
" min buffer"
|
|
7942
|
+
] })
|
|
7943
|
+
] }),
|
|
7944
|
+
product.description && /* @__PURE__ */ jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
|
|
7945
|
+
(product.requires_specific_staff || product.requires_specific_resource) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-requirements": true, className: "text-sm text-muted-foreground space-y-1", children: [
|
|
7946
|
+
product.requires_specific_staff && /* @__PURE__ */ jsx("p", { children: "Staff selection required" }),
|
|
7947
|
+
product.requires_specific_resource && /* @__PURE__ */ jsx("p", { children: "Resource selection required" })
|
|
7948
|
+
] }),
|
|
7949
|
+
/* @__PURE__ */ jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
|
|
7950
|
+
/* @__PURE__ */ jsx(
|
|
7951
|
+
ProductCustomizer,
|
|
7952
|
+
{
|
|
7953
|
+
product,
|
|
7954
|
+
onAddToCart,
|
|
7955
|
+
showSpecialInstructions: false
|
|
7956
|
+
}
|
|
7957
|
+
),
|
|
7958
|
+
(cancellationHours != null || product.no_show_fee) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-cancellation": true, className: "border border-border p-4 space-y-2 text-sm", children: [
|
|
7959
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold", children: "Cancellation Policy" }),
|
|
7960
|
+
cancellationHours != null && /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
|
|
7961
|
+
"Free cancellation up to ",
|
|
7962
|
+
/* @__PURE__ */ jsxs("strong", { className: "text-foreground", children: [
|
|
7963
|
+
cancellationHours,
|
|
7964
|
+
" hours"
|
|
7965
|
+
] }),
|
|
7966
|
+
" before the appointment"
|
|
7967
|
+
] }),
|
|
7968
|
+
product.no_show_fee && /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground", children: [
|
|
7969
|
+
"No-show fee: ",
|
|
7970
|
+
/* @__PURE__ */ jsx(Price, { amount: product.no_show_fee, className: "font-medium text-foreground" })
|
|
7971
|
+
] }),
|
|
7972
|
+
hasDeposit && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: product.deposit_type === "fixed" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7973
|
+
/* @__PURE__ */ jsx(Price, { amount: depositAmount, className: "font-medium text-foreground" }),
|
|
7974
|
+
" deposit charged at booking"
|
|
7975
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7976
|
+
parsePrice(product.deposit_amount),
|
|
7977
|
+
"% deposit charged at booking"
|
|
7978
|
+
] }) })
|
|
7979
|
+
] })
|
|
7980
|
+
] })
|
|
7981
|
+
}
|
|
7982
|
+
),
|
|
7983
|
+
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsx(
|
|
7984
|
+
RelatedProductsSection,
|
|
7985
|
+
{
|
|
7986
|
+
products: relatedProducts,
|
|
7987
|
+
title: "Other services"
|
|
7988
|
+
}
|
|
7989
|
+
)
|
|
7990
|
+
] });
|
|
7991
|
+
}
|
|
7992
|
+
var DIGITAL_TYPE_LABELS = {
|
|
7993
|
+
download: "Digital download",
|
|
7994
|
+
license: "Software license",
|
|
7995
|
+
event_ticket: "Event ticket",
|
|
7996
|
+
access_pass: "Access pass",
|
|
7997
|
+
gift_card: "Gift card"
|
|
7998
|
+
};
|
|
7999
|
+
function DigitalProductLayout({
|
|
8000
|
+
product,
|
|
8001
|
+
onAddToCart,
|
|
8002
|
+
renderBreadcrumb,
|
|
8003
|
+
relatedProducts,
|
|
8004
|
+
showRelated = true,
|
|
8005
|
+
className
|
|
8006
|
+
}) {
|
|
8007
|
+
const images = product.images || (product.image_url ? [product.image_url] : []);
|
|
8008
|
+
const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
|
|
8009
|
+
const isTicket = product.digital_type === "event_ticket";
|
|
8010
|
+
const isAccessPass = product.digital_type === "access_pass";
|
|
8011
|
+
const isDownload = product.digital_type === "download" || product.digital_type === "license";
|
|
8012
|
+
return /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout": "digital", className: cn("space-y-8", className), children: [
|
|
8013
|
+
renderBreadcrumb?.(product),
|
|
8014
|
+
/* @__PURE__ */ jsx(
|
|
8015
|
+
TwoColumnGrid,
|
|
8016
|
+
{
|
|
8017
|
+
left: /* @__PURE__ */ jsx(
|
|
8018
|
+
ProductImageGallery,
|
|
8019
|
+
{
|
|
8020
|
+
images,
|
|
8021
|
+
productName: product.name
|
|
8022
|
+
}
|
|
8023
|
+
),
|
|
8024
|
+
right: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
8025
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
8026
|
+
/* @__PURE__ */ jsx("span", { "data-cimplify-product-layout-badge": true, className: "text-xs font-semibold uppercase tracking-wider text-primary bg-primary/10 px-2.5 py-1 rounded-full", children: typeLabel }),
|
|
8027
|
+
/* @__PURE__ */ jsx(TagPills, { tags: product.tags || [] })
|
|
8028
|
+
] }),
|
|
8029
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
8030
|
+
/* @__PURE__ */ jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
|
|
8031
|
+
/* @__PURE__ */ jsx(Price, { amount: product.default_price, className: "text-2xl font-bold mt-2 block" })
|
|
8032
|
+
] }),
|
|
8033
|
+
product.description && /* @__PURE__ */ jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
|
|
8034
|
+
isDownload && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-delivery": true, className: "flex items-center gap-3 px-4 py-3 bg-muted rounded-lg", children: [
|
|
8035
|
+
/* @__PURE__ */ jsx("svg", { className: "w-5 h-5 text-primary shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
|
|
8036
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
8037
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Instant delivery" }),
|
|
8038
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Download immediately after purchase" })
|
|
8039
|
+
] })
|
|
8040
|
+
] }),
|
|
8041
|
+
isTicket && (product.event_date || product.venue) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-event": true, className: "border border-border p-4 space-y-2", children: [
|
|
8042
|
+
product.event_date && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8043
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Date:" }),
|
|
8044
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: new Date(product.event_date).toLocaleDateString(void 0, { weekday: "long", year: "numeric", month: "long", day: "numeric" }) })
|
|
8045
|
+
] }),
|
|
8046
|
+
product.venue && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8047
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Venue:" }),
|
|
8048
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: product.venue })
|
|
8049
|
+
] }),
|
|
8050
|
+
product.ticket_type && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8051
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Type:" }),
|
|
8052
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium capitalize", children: product.ticket_type })
|
|
8053
|
+
] })
|
|
8054
|
+
] }),
|
|
8055
|
+
isAccessPass && (product.access_type || product.access_duration_days) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-access": true, className: "border border-border p-4 space-y-2", children: [
|
|
8056
|
+
product.access_type && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8057
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Access:" }),
|
|
8058
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium capitalize", children: product.access_type })
|
|
8059
|
+
] }),
|
|
8060
|
+
product.access_level && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8061
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Level:" }),
|
|
8062
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium capitalize", children: product.access_level })
|
|
8063
|
+
] }),
|
|
8064
|
+
product.access_duration_days && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
8065
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Duration:" }),
|
|
8066
|
+
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
8067
|
+
product.access_duration_days,
|
|
8068
|
+
" days"
|
|
8069
|
+
] })
|
|
8070
|
+
] })
|
|
8071
|
+
] }),
|
|
8072
|
+
isDownload && (product.file_size_mb || product.file_type || product.version || product.max_downloads) && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-layout-file-details": true, className: "grid grid-cols-2 gap-3", children: [
|
|
8073
|
+
product.file_type && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8074
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Format" }),
|
|
8075
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: product.file_type.toUpperCase() })
|
|
8076
|
+
] }),
|
|
8077
|
+
product.file_size_mb != null && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8078
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Size" }),
|
|
8079
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: product.file_size_mb >= 1024 ? `${(product.file_size_mb / 1024).toFixed(1)} GB` : `${product.file_size_mb} MB` })
|
|
8080
|
+
] }),
|
|
8081
|
+
product.max_downloads != null && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8082
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Downloads" }),
|
|
8083
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: product.max_downloads })
|
|
8084
|
+
] }),
|
|
8085
|
+
product.version && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8086
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Version" }),
|
|
8087
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold", children: [
|
|
8088
|
+
"v",
|
|
8089
|
+
product.version
|
|
8090
|
+
] })
|
|
8091
|
+
] }),
|
|
8092
|
+
product.download_expires_days != null && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8093
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Expires" }),
|
|
8094
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold", children: [
|
|
8095
|
+
product.download_expires_days,
|
|
8096
|
+
" days"
|
|
8097
|
+
] })
|
|
8098
|
+
] }),
|
|
8099
|
+
product.max_activations != null && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
|
|
8100
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Activations" }),
|
|
8101
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: product.max_activations })
|
|
8102
|
+
] })
|
|
8103
|
+
] }),
|
|
8104
|
+
/* @__PURE__ */ jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
|
|
8105
|
+
/* @__PURE__ */ jsx(
|
|
8106
|
+
ProductCustomizer,
|
|
8107
|
+
{
|
|
8108
|
+
product,
|
|
8109
|
+
onAddToCart,
|
|
8110
|
+
showSpecialInstructions: false
|
|
8111
|
+
}
|
|
8112
|
+
)
|
|
8113
|
+
] })
|
|
8114
|
+
}
|
|
8115
|
+
),
|
|
8116
|
+
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsx(
|
|
8117
|
+
RelatedProductsSection,
|
|
8118
|
+
{
|
|
8119
|
+
products: relatedProducts,
|
|
8120
|
+
title: "More digital products"
|
|
8121
|
+
}
|
|
8122
|
+
)
|
|
8123
|
+
] });
|
|
8124
|
+
}
|
|
8125
|
+
var ProductTemplate = /* @__PURE__ */ ((ProductTemplate2) => {
|
|
8126
|
+
ProductTemplate2["Default"] = "default";
|
|
8127
|
+
ProductTemplate2["Food"] = "food";
|
|
8128
|
+
ProductTemplate2["Wholesale"] = "wholesale";
|
|
8129
|
+
ProductTemplate2["Service"] = "service";
|
|
8130
|
+
ProductTemplate2["Digital"] = "digital";
|
|
8131
|
+
ProductTemplate2["Physical"] = "physical";
|
|
8132
|
+
return ProductTemplate2;
|
|
8133
|
+
})(ProductTemplate || {});
|
|
8134
|
+
var BUILT_IN_LAYOUTS = {
|
|
8135
|
+
["food" /* Food */]: FoodProductLayout,
|
|
8136
|
+
["wholesale" /* Wholesale */]: WholesaleProductLayout,
|
|
8137
|
+
["service" /* Service */]: ServiceProductLayout,
|
|
8138
|
+
["digital" /* Digital */]: DigitalProductLayout,
|
|
8139
|
+
["default" /* Default */]: DefaultProductLayout
|
|
8140
|
+
};
|
|
8141
|
+
function resolveTemplateKey(product) {
|
|
8142
|
+
const metaTemplate = product.metadata?.page_template;
|
|
8143
|
+
if (typeof metaTemplate === "string" && metaTemplate.trim()) {
|
|
8144
|
+
return metaTemplate.trim();
|
|
8145
|
+
}
|
|
8146
|
+
if (product.quantity_pricing && product.quantity_pricing.length > 1) {
|
|
8147
|
+
return "wholesale" /* Wholesale */;
|
|
8148
|
+
}
|
|
8149
|
+
if (product.type === "service") {
|
|
8150
|
+
return "service" /* Service */;
|
|
8151
|
+
}
|
|
8152
|
+
if (product.type === "digital") {
|
|
8153
|
+
return "digital" /* Digital */;
|
|
8154
|
+
}
|
|
8155
|
+
if (product.render_hint === "food") {
|
|
8156
|
+
return "food" /* Food */;
|
|
8157
|
+
}
|
|
8158
|
+
if (product.render_hint === "physical") {
|
|
8159
|
+
return "physical" /* Physical */;
|
|
8160
|
+
}
|
|
8161
|
+
return "default" /* Default */;
|
|
8162
|
+
}
|
|
8163
|
+
function resolveLayout(product, pages, templates) {
|
|
8164
|
+
if (pages?.[product.slug]) {
|
|
8165
|
+
return pages[product.slug];
|
|
8166
|
+
}
|
|
8167
|
+
const key = resolveTemplateKey(product);
|
|
8168
|
+
if (templates?.[key]) {
|
|
8169
|
+
return templates[key];
|
|
8170
|
+
}
|
|
8171
|
+
if (BUILT_IN_LAYOUTS[key]) {
|
|
8172
|
+
return BUILT_IN_LAYOUTS[key];
|
|
8173
|
+
}
|
|
8174
|
+
return DefaultProductLayout;
|
|
8175
|
+
}
|
|
7485
8176
|
function ProductPage({
|
|
7486
8177
|
productId,
|
|
7487
8178
|
product: productProp,
|
|
7488
|
-
|
|
8179
|
+
pages,
|
|
8180
|
+
templates,
|
|
7489
8181
|
onAddToCart,
|
|
7490
8182
|
renderImage,
|
|
7491
|
-
|
|
7492
|
-
|
|
8183
|
+
renderBreadcrumb,
|
|
8184
|
+
relatedProducts,
|
|
7493
8185
|
showRelated = true,
|
|
7494
|
-
relatedTitle = "You might also like",
|
|
7495
8186
|
className,
|
|
7496
8187
|
classNames
|
|
7497
8188
|
}) {
|
|
7498
|
-
const
|
|
7499
|
-
|
|
8189
|
+
const resolvedId = productId || productProp?.slug || productProp?.id || "";
|
|
8190
|
+
const { product: fetched, isLoading } = useProduct(resolvedId, {
|
|
8191
|
+
enabled: !productProp && resolvedId.length > 0
|
|
7500
8192
|
});
|
|
7501
8193
|
const product = productProp ?? fetched;
|
|
7502
8194
|
if (isLoading && !product) {
|
|
@@ -7506,41 +8198,34 @@ function ProductPage({
|
|
|
7506
8198
|
"data-cimplify-product-page": true,
|
|
7507
8199
|
"aria-busy": "true",
|
|
7508
8200
|
className: cn(className, classNames?.root, classNames?.loading),
|
|
7509
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
7510
|
-
/* @__PURE__ */ jsx("div", {
|
|
7511
|
-
/* @__PURE__ */
|
|
7512
|
-
|
|
8201
|
+
children: /* @__PURE__ */ jsxs("div", { className: "grid lg:grid-cols-2 gap-8 lg:gap-12 animate-pulse", children: [
|
|
8202
|
+
/* @__PURE__ */ jsx("div", { className: "aspect-square bg-muted" }),
|
|
8203
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 py-4", children: [
|
|
8204
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-3/5 bg-muted" }),
|
|
8205
|
+
/* @__PURE__ */ jsx("div", { className: "h-6 w-2/5 bg-muted" }),
|
|
8206
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-4/5 bg-muted" }),
|
|
8207
|
+
/* @__PURE__ */ jsx("div", { className: "h-4 w-3/5 bg-muted" }),
|
|
8208
|
+
/* @__PURE__ */ jsx("div", { className: "h-14 w-full bg-muted mt-8" })
|
|
8209
|
+
] })
|
|
7513
8210
|
] })
|
|
7514
8211
|
}
|
|
7515
8212
|
);
|
|
7516
8213
|
}
|
|
7517
8214
|
if (!product) {
|
|
7518
|
-
return /* @__PURE__ */ jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsx("p", { children: "Product not found." }) });
|
|
8215
|
+
return /* @__PURE__ */ jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Product not found." }) });
|
|
7519
8216
|
}
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
) }),
|
|
7533
|
-
showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxs("div", { "data-cimplify-product-page-related": true, className: classNames?.relatedSection, children: [
|
|
7534
|
-
/* @__PURE__ */ jsx("h2", { "data-cimplify-product-page-related-title": true, className: classNames?.relatedTitle, children: relatedTitle }),
|
|
7535
|
-
/* @__PURE__ */ jsx(
|
|
7536
|
-
ProductGrid,
|
|
7537
|
-
{
|
|
7538
|
-
products: relatedProducts,
|
|
7539
|
-
renderImage
|
|
7540
|
-
}
|
|
7541
|
-
)
|
|
7542
|
-
] })
|
|
7543
|
-
] });
|
|
8217
|
+
const Layout = resolveLayout(product, pages, templates);
|
|
8218
|
+
return /* @__PURE__ */ jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsx(
|
|
8219
|
+
Layout,
|
|
8220
|
+
{
|
|
8221
|
+
product,
|
|
8222
|
+
onAddToCart,
|
|
8223
|
+
renderImage,
|
|
8224
|
+
renderBreadcrumb,
|
|
8225
|
+
relatedProducts,
|
|
8226
|
+
showRelated
|
|
8227
|
+
}
|
|
8228
|
+
) });
|
|
7544
8229
|
}
|
|
7545
8230
|
function CartPage({
|
|
7546
8231
|
title = "Your Cart",
|
|
@@ -8570,12 +9255,6 @@ function RecentlyViewed({
|
|
|
8570
9255
|
product.product_id
|
|
8571
9256
|
)) });
|
|
8572
9257
|
}
|
|
8573
|
-
function PriceRange({ product, className }) {
|
|
8574
|
-
const { displayCurrency } = useCimplify();
|
|
8575
|
-
const range = getPriceRange(product);
|
|
8576
|
-
if (!range) return null;
|
|
8577
|
-
return /* @__PURE__ */ jsx("span", { "data-cimplify-price-range": true, className, children: formatPriceRange(range.min, range.max, displayCurrency) });
|
|
8578
|
-
}
|
|
8579
9258
|
function DeliveryEstimate({
|
|
8580
9259
|
latitude,
|
|
8581
9260
|
longitude,
|
|
@@ -8723,4 +9402,4 @@ function CurrencySelector({
|
|
|
8723
9402
|
}) });
|
|
8724
9403
|
}
|
|
8725
9404
|
|
|
8726
|
-
export { Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BundleSelector, CartPage, CartSummary, CataloguePage, CategoryFilter, CategoryGrid, CheckoutPage, CimplifyCheckout, CimplifyProvider, CollectionPage, CompositeSelector, CurrencySelector, DateSlotPicker, DealBanner, DealsPage, DeliveryEstimate, DiscountInput, ElementsProvider, LocationPicker, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderSummary, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductPage, ProductSheet, QuantitySelector, RecentlyViewed, RecommendationCarousel, ResourcePicker, SaleBadge, SearchInput, SearchPage, ServiceCard, ServiceGrid, SessionMessageBanner, SlotPicker, StaffPicker, StoreNav, VariantSelector, VolumePricing, 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 };
|
|
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 };
|