@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/react.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkRAKLT6J2_js = require('./chunk-RAKLT6J2.js');
5
- var chunkTXQHTHY5_js = require('./chunk-TXQHTHY5.js');
6
- var chunkKRNWMUBN_js = require('./chunk-KRNWMUBN.js');
4
+ var chunkIYQGGFVQ_js = require('./chunk-IYQGGFVQ.js');
5
+ var chunkI4F4Y3D4_js = require('./chunk-I4F4Y3D4.js');
6
+ var chunkPEDLCL72_js = require('./chunk-PEDLCL72.js');
7
7
  var React3 = require('react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var numberField = require('@base-ui/react/number-field');
@@ -475,13 +475,13 @@ function buildLineKey(productId, options) {
475
475
  return parts.join("|");
476
476
  }
477
477
  function calculateLineSubtotal(item) {
478
- let unitPrice = chunkKRNWMUBN_js.parsePrice(item.product.default_price);
478
+ let unitPrice = chunkPEDLCL72_js.parsePrice(item.product.default_price);
479
479
  if (item.variant?.price_adjustment) {
480
- unitPrice += chunkKRNWMUBN_js.parsePrice(item.variant.price_adjustment);
480
+ unitPrice += chunkPEDLCL72_js.parsePrice(item.variant.price_adjustment);
481
481
  }
482
482
  for (const option of item.addOnOptions || []) {
483
483
  if (option.default_price) {
484
- unitPrice += chunkKRNWMUBN_js.parsePrice(option.default_price);
484
+ unitPrice += chunkPEDLCL72_js.parsePrice(option.default_price);
485
485
  }
486
486
  }
487
487
  return roundMoney(unitPrice * item.quantity);
@@ -1061,7 +1061,7 @@ var DEFAULT_COUNTRY = "US";
1061
1061
  function createDefaultClient() {
1062
1062
  const processRef = globalThis.process;
1063
1063
  const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
1064
- return chunkRAKLT6J2_js.createCimplifyClient({ publicKey: envPublicKey });
1064
+ return chunkIYQGGFVQ_js.createCimplifyClient({ publicKey: envPublicKey });
1065
1065
  }
1066
1066
  function getStoredLocationId() {
1067
1067
  if (typeof window === "undefined" || !window.localStorage) {
@@ -1144,7 +1144,7 @@ function CimplifyProvider({
1144
1144
  const setDisplayCurrency = React3.useCallback(
1145
1145
  (currency) => {
1146
1146
  const normalized = currency?.trim().toUpperCase() || null;
1147
- if (normalized && !chunkKRNWMUBN_js.isSupportedCurrency(normalized)) {
1147
+ if (normalized && !chunkPEDLCL72_js.isSupportedCurrency(normalized)) {
1148
1148
  return;
1149
1149
  }
1150
1150
  setDisplayCurrencyOverride(normalized);
@@ -1706,7 +1706,7 @@ function Price({ amount, className, prefix }) {
1706
1706
  const { displayCurrency, convertPrice } = useCimplify();
1707
1707
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
1708
1708
  prefix,
1709
- chunkKRNWMUBN_js.formatPrice(convertPrice(amount), displayCurrency)
1709
+ chunkPEDLCL72_js.formatPrice(convertPrice(amount), displayCurrency)
1710
1710
  ] });
1711
1711
  }
1712
1712
  function createCachedQuery(config) {
@@ -2713,16 +2713,16 @@ function useProductPrice(input) {
2713
2713
  if (bundleTotalPrice != null) {
2714
2714
  unitPrice = bundleTotalPrice;
2715
2715
  } else if (compositePrice) {
2716
- unitPrice = chunkKRNWMUBN_js.parsePrice(compositePrice.final_price);
2716
+ unitPrice = chunkPEDLCL72_js.parsePrice(compositePrice.final_price);
2717
2717
  } else {
2718
- unitPrice = chunkKRNWMUBN_js.parsePrice(product.default_price);
2718
+ unitPrice = chunkPEDLCL72_js.parsePrice(product.default_price);
2719
2719
  if (variant?.price_adjustment) {
2720
- unitPrice += chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
2720
+ unitPrice += chunkPEDLCL72_js.parsePrice(variant.price_adjustment);
2721
2721
  }
2722
2722
  if (addOnOptions) {
2723
2723
  for (const option of addOnOptions) {
2724
2724
  if (option.default_price) {
2725
- unitPrice += chunkKRNWMUBN_js.parsePrice(option.default_price);
2725
+ unitPrice += chunkPEDLCL72_js.parsePrice(option.default_price);
2726
2726
  }
2727
2727
  }
2728
2728
  }
@@ -3212,19 +3212,19 @@ function AuthElement({
3212
3212
  }, [onReady, onAuthenticated, onRequiresOtp, onError]);
3213
3213
  React3.useEffect(() => {
3214
3214
  if (!elements || !containerRef.current) return;
3215
- const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.AUTH, { prefillEmail });
3215
+ const element = elements.create(chunkI4F4Y3D4_js.ELEMENT_TYPES.AUTH, { prefillEmail });
3216
3216
  elementRef.current = element;
3217
- element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3217
+ element.on(chunkI4F4Y3D4_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3218
3218
  element.on(
3219
- chunkTXQHTHY5_js.EVENT_TYPES.AUTHENTICATED,
3219
+ chunkI4F4Y3D4_js.EVENT_TYPES.AUTHENTICATED,
3220
3220
  (data) => onAuthenticatedRef.current?.(data)
3221
3221
  );
3222
3222
  element.on(
3223
- chunkTXQHTHY5_js.EVENT_TYPES.REQUIRES_OTP,
3223
+ chunkI4F4Y3D4_js.EVENT_TYPES.REQUIRES_OTP,
3224
3224
  (data) => onRequiresOtpRef.current?.(data)
3225
3225
  );
3226
3226
  element.on(
3227
- chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3227
+ chunkI4F4Y3D4_js.EVENT_TYPES.ERROR,
3228
3228
  (data) => onErrorRef.current?.(data)
3229
3229
  );
3230
3230
  element.mount(containerRef.current);
@@ -3253,15 +3253,15 @@ function AddressElement({
3253
3253
  }, [onReady, onChange, onError]);
3254
3254
  React3.useEffect(() => {
3255
3255
  if (!elements || !containerRef.current) return;
3256
- const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.ADDRESS, { mode });
3256
+ const element = elements.create(chunkI4F4Y3D4_js.ELEMENT_TYPES.ADDRESS, { mode });
3257
3257
  elementRef.current = element;
3258
- element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3258
+ element.on(chunkI4F4Y3D4_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3259
3259
  element.on(
3260
- chunkTXQHTHY5_js.EVENT_TYPES.CHANGE,
3260
+ chunkI4F4Y3D4_js.EVENT_TYPES.CHANGE,
3261
3261
  (data) => onChangeRef.current?.(data)
3262
3262
  );
3263
3263
  element.on(
3264
- chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3264
+ chunkI4F4Y3D4_js.EVENT_TYPES.ERROR,
3265
3265
  (data) => onErrorRef.current?.(data)
3266
3266
  );
3267
3267
  element.mount(containerRef.current);
@@ -3291,15 +3291,15 @@ function PaymentElement({
3291
3291
  }, [onReady, onChange, onError]);
3292
3292
  React3.useEffect(() => {
3293
3293
  if (!elements || !containerRef.current) return;
3294
- const element = elements.create(chunkTXQHTHY5_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
3294
+ const element = elements.create(chunkI4F4Y3D4_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
3295
3295
  elementRef.current = element;
3296
- element.on(chunkTXQHTHY5_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3296
+ element.on(chunkI4F4Y3D4_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
3297
3297
  element.on(
3298
- chunkTXQHTHY5_js.EVENT_TYPES.CHANGE,
3298
+ chunkI4F4Y3D4_js.EVENT_TYPES.CHANGE,
3299
3299
  (data) => onChangeRef.current?.(data)
3300
3300
  );
3301
3301
  element.on(
3302
- chunkTXQHTHY5_js.EVENT_TYPES.ERROR,
3302
+ chunkI4F4Y3D4_js.EVENT_TYPES.ERROR,
3303
3303
  (data) => onErrorRef.current?.(data)
3304
3304
  );
3305
3305
  element.mount(containerRef.current);
@@ -3458,7 +3458,7 @@ function VariantSelector({
3458
3458
  if (!variants || variants.length <= 1) {
3459
3459
  return null;
3460
3460
  }
3461
- basePrice != null ? chunkKRNWMUBN_js.parsePrice(basePrice) : 0;
3461
+ basePrice != null ? chunkPEDLCL72_js.parsePrice(basePrice) : 0;
3462
3462
  if (variantAxes && variantAxes.length > 0) {
3463
3463
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-variant-selector": true, className: cn("space-y-5", className, classNames?.root), children: variantAxes.map((axis) => {
3464
3464
  const labelId = `${idPrefix}-axis-${axis.id}`;
@@ -3534,7 +3534,7 @@ function VariantSelector({
3534
3534
  className: cn("divide-y divide-border", classNames?.list),
3535
3535
  children: variants.map((variant) => {
3536
3536
  const isSelected = selectedVariantId === variant.id;
3537
- const adjustment = chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
3537
+ const adjustment = chunkPEDLCL72_js.parsePrice(variant.price_adjustment);
3538
3538
  return /* @__PURE__ */ jsxRuntime.jsxs(
3539
3539
  radio.Radio.Root,
3540
3540
  {
@@ -3562,7 +3562,7 @@ function VariantSelector({
3562
3562
  {
3563
3563
  "data-cimplify-variant-name": true,
3564
3564
  className: cn("flex-1 min-w-0 text-sm", classNames?.name),
3565
- children: chunkRAKLT6J2_js.getVariantDisplayName(variant, productName)
3565
+ children: chunkIYQGGFVQ_js.getVariantDisplayName(variant, productName)
3566
3566
  }
3567
3567
  ),
3568
3568
  /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-variant-pricing": true, className: cn("text-sm text-muted-foreground", classNames?.pricing), children: [
@@ -3800,16 +3800,16 @@ function BundleSelector({
3800
3800
  }, [components, selections, onReady]);
3801
3801
  const totalPrice = React3.useMemo(() => {
3802
3802
  if (pricingType === "fixed" && bundlePrice) {
3803
- return chunkKRNWMUBN_js.parsePrice(bundlePrice);
3803
+ return chunkPEDLCL72_js.parsePrice(bundlePrice);
3804
3804
  }
3805
3805
  const componentsTotal = components.reduce((sum, comp) => {
3806
3806
  return sum + getComponentPrice(comp, variantChoices[comp.id]) * comp.quantity;
3807
3807
  }, 0);
3808
3808
  if (pricingType === "percentage_discount" && discountValue) {
3809
- return componentsTotal * (1 - chunkKRNWMUBN_js.parsePrice(discountValue) / 100);
3809
+ return componentsTotal * (1 - chunkPEDLCL72_js.parsePrice(discountValue) / 100);
3810
3810
  }
3811
3811
  if (pricingType === "fixed_discount" && discountValue) {
3812
- return componentsTotal - chunkKRNWMUBN_js.parsePrice(discountValue);
3812
+ return componentsTotal - chunkPEDLCL72_js.parsePrice(discountValue);
3813
3813
  }
3814
3814
  return componentsTotal;
3815
3815
  }, [components, variantChoices, pricingType, bundlePrice, discountValue]);
@@ -3870,15 +3870,15 @@ function BundleSelector({
3870
3870
  }
3871
3871
  function getComponentPrice(component, selectedVariantId) {
3872
3872
  if (!selectedVariantId || component.available_variants.length === 0) {
3873
- return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3873
+ return chunkPEDLCL72_js.parsePrice(component.effective_price);
3874
3874
  }
3875
3875
  if (selectedVariantId === component.variant_id) {
3876
- return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3876
+ return chunkPEDLCL72_js.parsePrice(component.effective_price);
3877
3877
  }
3878
3878
  const bakedAdj = component.variant_id ? component.available_variants.find((v) => v.id === component.variant_id) : void 0;
3879
3879
  const selectedAdj = component.available_variants.find((v) => v.id === selectedVariantId);
3880
- if (!selectedAdj) return chunkKRNWMUBN_js.parsePrice(component.effective_price);
3881
- return chunkKRNWMUBN_js.parsePrice(component.effective_price) - chunkKRNWMUBN_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkKRNWMUBN_js.parsePrice(selectedAdj.price_adjustment);
3880
+ if (!selectedAdj) return chunkPEDLCL72_js.parsePrice(component.effective_price);
3881
+ return chunkPEDLCL72_js.parsePrice(component.effective_price) - chunkPEDLCL72_js.parsePrice(bakedAdj?.price_adjustment ?? "0") + chunkPEDLCL72_js.parsePrice(selectedAdj.price_adjustment);
3882
3882
  }
3883
3883
  function formatDuration(minutes, unit) {
3884
3884
  if (unit === "hours" || !unit && minutes >= 60 && minutes % 60 === 0) {
@@ -3991,7 +3991,7 @@ function BundleComponentCard({
3991
3991
  className: cn("mt-3 divide-y divide-border", classNames?.variantPicker),
3992
3992
  children: component.available_variants.map((variant) => {
3993
3993
  const isSelected = selectedVariantId === variant.id;
3994
- const adjustment = chunkKRNWMUBN_js.parsePrice(variant.price_adjustment);
3994
+ const adjustment = chunkPEDLCL72_js.parsePrice(variant.price_adjustment);
3995
3995
  return /* @__PURE__ */ jsxRuntime.jsxs(
3996
3996
  radio.Radio.Root,
3997
3997
  {
@@ -4437,7 +4437,7 @@ function CompositeSelector({
4437
4437
  "data-cimplify-composite-summary": true,
4438
4438
  className: cn("border-t border-border pt-4 space-y-1 text-sm", classNames?.summary),
4439
4439
  children: [
4440
- chunkKRNWMUBN_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4440
+ chunkPEDLCL72_js.parsePrice(priceResult.base_price) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4441
4441
  "div",
4442
4442
  {
4443
4443
  "data-cimplify-composite-summary-line": true,
@@ -4448,7 +4448,7 @@ function CompositeSelector({
4448
4448
  ]
4449
4449
  }
4450
4450
  ),
4451
- chunkKRNWMUBN_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4451
+ chunkPEDLCL72_js.parsePrice(priceResult.components_total) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs(
4452
4452
  "div",
4453
4453
  {
4454
4454
  "data-cimplify-composite-summary-line": true,
@@ -4744,18 +4744,18 @@ function ProductCustomizer({
4744
4744
  }, [selectedAddOnOptionIds]);
4745
4745
  const localTotalPrice = React3.useMemo(() => {
4746
4746
  if (isComposite && compositePrice) {
4747
- return chunkKRNWMUBN_js.parsePrice(compositePrice.final_price) * quantity;
4747
+ return chunkPEDLCL72_js.parsePrice(compositePrice.final_price) * quantity;
4748
4748
  }
4749
4749
  if (isBundle && bundleTotalPrice != null) {
4750
4750
  return bundleTotalPrice * quantity;
4751
4751
  }
4752
- let price = chunkKRNWMUBN_js.parsePrice(product.default_price);
4752
+ let price = chunkPEDLCL72_js.parsePrice(product.default_price);
4753
4753
  if (selectedVariant?.price_adjustment) {
4754
- price += chunkKRNWMUBN_js.parsePrice(selectedVariant.price_adjustment);
4754
+ price += chunkPEDLCL72_js.parsePrice(selectedVariant.price_adjustment);
4755
4755
  }
4756
4756
  for (const option of selectedAddOnOptions) {
4757
4757
  if (option.default_price) {
4758
- price += chunkKRNWMUBN_js.parsePrice(option.default_price);
4758
+ price += chunkPEDLCL72_js.parsePrice(option.default_price);
4759
4759
  }
4760
4760
  }
4761
4761
  return price * quantity;
@@ -4796,7 +4796,7 @@ function ProductCustomizer({
4796
4796
  const priceInfo = quote.quoted_total_price_info ?? quote.final_price_info;
4797
4797
  const perUnit = priceInfo.pre_tax_price;
4798
4798
  if (perUnit === void 0 || perUnit === null) return void 0;
4799
- return chunkKRNWMUBN_js.parsePrice(perUnit) * quantity;
4799
+ return chunkPEDLCL72_js.parsePrice(perUnit) * quantity;
4800
4800
  }, [quote, quantity]);
4801
4801
  const displayTotalPrice = quotedTotalPrice ?? localTotalPrice;
4802
4802
  const handleVariantChange = React3.useCallback(
@@ -4906,7 +4906,7 @@ function ProductCustomizer({
4906
4906
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.deposit_amount })
4907
4907
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
4908
4908
  "Deposit required: ",
4909
- chunkKRNWMUBN_js.parsePrice(product.deposit_amount),
4909
+ chunkPEDLCL72_js.parsePrice(product.deposit_amount),
4910
4910
  "%"
4911
4911
  ] }) }),
4912
4912
  product.allergies && product.allergies.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-customizer-allergens": true, className: cn("flex flex-wrap gap-1.5", classNames?.allergens), children: product.allergies.map((allergen) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -4969,7 +4969,7 @@ function ProductCustomizer({
4969
4969
  ] })
4970
4970
  ] }),
4971
4971
  product.quantity_pricing && product.quantity_pricing.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-customizer-unit-price": true, className: "text-sm text-muted-foreground text-right shrink-0", children: [
4972
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkKRNWMUBN_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunkKRNWMUBN_js.parsePrice(product.default_price)), className: "font-medium text-foreground" }),
4972
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPEDLCL72_js.getUnitPriceAtQuantity(product.quantity_pricing, quantity, chunkPEDLCL72_js.parsePrice(product.default_price)), className: "font-medium text-foreground" }),
4973
4973
  " ea."
4974
4974
  ] }),
4975
4975
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5095,7 +5095,7 @@ function CartLineItemRow({
5095
5095
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item": true, className: classNames?.item, children: [
5096
5096
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, children: [
5097
5097
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-name": true, className: classNames?.itemName, children: item.product.name }),
5098
- item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkRAKLT6J2_js.getVariantDisplayName(item.variant, item.product.name) }),
5098
+ item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, children: chunkIYQGGFVQ_js.getVariantDisplayName(item.variant, item.product.name) }),
5099
5099
  item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, children: [
5100
5100
  "+ ",
5101
5101
  item.addOnOptions.map((opt) => opt.name).join(", ")
@@ -5217,15 +5217,15 @@ function CartSummary({
5217
5217
  ] }),
5218
5218
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal })
5219
5219
  ] }),
5220
- totalDiscounts != null && chunkKRNWMUBN_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
5220
+ totalDiscounts != null && chunkPEDLCL72_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: classNames?.discount, children: [
5221
5221
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
5222
5222
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-" })
5223
5223
  ] }),
5224
5224
  deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: classNames?.deliveryFee, children: [
5225
5225
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
5226
- chunkKRNWMUBN_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
5226
+ chunkPEDLCL72_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Free delivery" })
5227
5227
  ] }),
5228
- serviceCharge != null && chunkKRNWMUBN_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
5228
+ serviceCharge != null && chunkPEDLCL72_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: classNames?.serviceCharge, children: [
5229
5229
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
5230
5230
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge })
5231
5231
  ] }),
@@ -5308,16 +5308,16 @@ function SaleBadge({
5308
5308
  className,
5309
5309
  classNames
5310
5310
  }) {
5311
- const onSale = chunkKRNWMUBN_js.isOnSale(product);
5311
+ const onSale = chunkPEDLCL72_js.isOnSale(product);
5312
5312
  const hasDeal = dealInfo !== void 0;
5313
5313
  if (!hasDeal && !onSale && !label) {
5314
5314
  return null;
5315
5315
  }
5316
5316
  let percentage = null;
5317
5317
  if (hasDeal && dealInfo.benefit_type === "percentage") {
5318
- percentage = chunkKRNWMUBN_js.parsePrice(dealInfo.value);
5318
+ percentage = chunkPEDLCL72_js.parsePrice(dealInfo.value);
5319
5319
  } else if (onSale) {
5320
- percentage = chunkKRNWMUBN_js.getDiscountPercentage(product);
5320
+ percentage = chunkPEDLCL72_js.getDiscountPercentage(product);
5321
5321
  }
5322
5322
  const badgeText = label ?? dealInfo?.label ?? (percentage != null && percentage > 0 ? `${percentage}% off` : null);
5323
5323
  if (!badgeText) {
@@ -5336,7 +5336,7 @@ function SaleBadge({
5336
5336
  "%"
5337
5337
  ] }),
5338
5338
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-label": true, className: classNames?.label, children: badgeText }),
5339
- showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkKRNWMUBN_js.getBasePrice(product) }) })
5339
+ showOriginalPrice && onSale && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-sale-original-price": true, className: classNames?.originalPrice, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPEDLCL72_js.getBasePrice(product) }) })
5340
5340
  ]
5341
5341
  }
5342
5342
  );
@@ -5842,7 +5842,7 @@ function SearchInput({
5842
5842
  }
5843
5843
  ),
5844
5844
  /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-name": true, className: classNames?.resultName, style: { flex: 1, textAlign: "left" }, children: product.name }),
5845
- product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkKRNWMUBN_js.formatPrice(product.default_price) })
5845
+ product.default_price !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-search-result-price": true, className: classNames?.resultPrice, style: { flexShrink: 0 }, children: chunkPEDLCL72_js.formatPrice(product.default_price) })
5846
5846
  ] })
5847
5847
  },
5848
5848
  product.id
@@ -6336,19 +6336,19 @@ function OrderSummary({
6336
6336
  order.customer_notes.map((note, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-order-note": true, children: note }, index))
6337
6337
  ] }),
6338
6338
  /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-totals": true, className: classNames?.totals, children: [
6339
- order.total_discount != null && chunkKRNWMUBN_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
6339
+ order.total_discount != null && chunkPEDLCL72_js.parsePrice(order.total_discount) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-discount": true, children: [
6340
6340
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Discount" }),
6341
6341
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.total_discount, prefix: "-" })
6342
6342
  ] }),
6343
- order.delivery_fee != null && chunkKRNWMUBN_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
6343
+ order.delivery_fee != null && chunkPEDLCL72_js.parsePrice(order.delivery_fee) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-delivery-fee": true, children: [
6344
6344
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Delivery fee" }),
6345
6345
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.delivery_fee })
6346
6346
  ] }),
6347
- order.service_charge != null && chunkKRNWMUBN_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
6347
+ order.service_charge != null && chunkPEDLCL72_js.parsePrice(order.service_charge) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-service-charge": true, children: [
6348
6348
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Service charge" }),
6349
6349
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.service_charge })
6350
6350
  ] }),
6351
- order.tax != null && chunkKRNWMUBN_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
6351
+ order.tax != null && chunkPEDLCL72_js.parsePrice(order.tax) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-order-tax": true, children: [
6352
6352
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Tax" }),
6353
6353
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: order.tax })
6354
6354
  ] }),
@@ -7487,21 +7487,713 @@ function useDebounce(value, delay) {
7487
7487
  }, [value, delay]);
7488
7488
  return debounced;
7489
7489
  }
7490
+ function TwoColumnGrid({
7491
+ left,
7492
+ right,
7493
+ className
7494
+ }) {
7495
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7496
+ "div",
7497
+ {
7498
+ "data-cimplify-product-layout-grid": true,
7499
+ className: cn("grid lg:grid-cols-2 gap-8 lg:gap-12", className),
7500
+ children: [
7501
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-layout-media": true, children: left }),
7502
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-layout-info": true, children: right })
7503
+ ]
7504
+ }
7505
+ );
7506
+ }
7507
+ function MetadataStringList({
7508
+ items,
7509
+ label,
7510
+ icon,
7511
+ className
7512
+ }) {
7513
+ if (items.length === 0) return null;
7514
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-metadata-list": true, className: cn("space-y-2", className), children: [
7515
+ /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "flex items-center gap-2 text-sm font-medium", children: [
7516
+ icon,
7517
+ label
7518
+ ] }),
7519
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5", children: items.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(
7520
+ "span",
7521
+ {
7522
+ className: "text-xs text-muted-foreground px-2.5 py-1 bg-muted",
7523
+ children: item
7524
+ },
7525
+ `${item}-${i}`
7526
+ )) })
7527
+ ] });
7528
+ }
7529
+ function CustomAttributesTable({
7530
+ attributes,
7531
+ className
7532
+ }) {
7533
+ if (!attributes || attributes.length === 0) return null;
7534
+ const groups = /* @__PURE__ */ new Map();
7535
+ for (const attr of attributes) {
7536
+ const group = attr.group_name || "Details";
7537
+ if (!groups.has(group)) groups.set(group, []);
7538
+ groups.get(group).push(attr);
7539
+ }
7540
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-custom-attributes": true, className: cn("space-y-4", className), children: Array.from(groups.entries()).map(([groupName, attrs]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7541
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { "data-cimplify-attribute-group": true, className: "text-sm font-semibold mb-2", children: groupName }),
7542
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border divide-y divide-border", children: attrs.map((attr) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 text-sm", children: [
7543
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: attr.name }),
7544
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: formatAttributeValue(attr) })
7545
+ ] }, attr.definition_id)) })
7546
+ ] }, groupName)) });
7547
+ }
7548
+ function formatAttributeValue(attr) {
7549
+ if (attr.value === null || attr.value === void 0) return "\u2014";
7550
+ if (typeof attr.value === "boolean") return attr.value ? "Yes" : "No";
7551
+ if (Array.isArray(attr.value)) return attr.value.join(", ");
7552
+ if (typeof attr.value === "object" && "value" in attr.value) {
7553
+ return `${attr.value.value}${attr.unit ? ` ${attr.unit}` : ""}`;
7554
+ }
7555
+ const str = String(attr.value);
7556
+ return attr.unit ? `${str} ${attr.unit}` : str;
7557
+ }
7558
+ function PropertiesTable({
7559
+ properties,
7560
+ className
7561
+ }) {
7562
+ if (!properties || properties.length === 0) return null;
7563
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-properties": true, className, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border border-border divide-y divide-border", children: properties.map((prop) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 text-sm", children: [
7564
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: prop.name }),
7565
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
7566
+ prop.values.filter(Boolean).join(", "),
7567
+ prop.unit ? ` ${prop.unit}` : ""
7568
+ ] })
7569
+ ] }, prop.slug)) }) });
7570
+ }
7571
+ function TagPills({
7572
+ tags,
7573
+ className
7574
+ }) {
7575
+ if (!tags || tags.length === 0) return null;
7576
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-tags": true, className: cn("flex flex-wrap gap-1.5", className), children: tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
7577
+ "span",
7578
+ {
7579
+ className: "text-xs font-medium text-muted-foreground px-2.5 py-1 bg-muted rounded-full",
7580
+ children: tag
7581
+ },
7582
+ tag
7583
+ )) });
7584
+ }
7585
+ function InventoryBadge({
7586
+ product,
7587
+ className
7588
+ }) {
7589
+ const status = product.inventory_status;
7590
+ if (!status) return null;
7591
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-inventory-badge": true, className: cn("flex items-center gap-2 text-sm", className), children: [
7592
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
7593
+ "w-2 h-2 rounded-full",
7594
+ status.in_stock ? "bg-green-500" : "bg-red-500"
7595
+ ) }),
7596
+ /* @__PURE__ */ jsxRuntime.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" }),
7597
+ status.in_stock && status.stock_level != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
7598
+ "\xB7 ",
7599
+ status.stock_level.toLocaleString(),
7600
+ " available"
7601
+ ] }),
7602
+ status.low_stock && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-amber-600 font-medium", children: "\xB7 Low stock" })
7603
+ ] });
7604
+ }
7605
+ function RelatedProductsSection({
7606
+ products,
7607
+ title = "You might also like",
7608
+ renderImage,
7609
+ className
7610
+ }) {
7611
+ if (products.length === 0) return null;
7612
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-related": true, className: cn("mt-12 pt-8 border-t border-border", className), children: [
7613
+ /* @__PURE__ */ jsxRuntime.jsx(
7614
+ "h2",
7615
+ {
7616
+ "data-cimplify-product-layout-related-title": true,
7617
+ className: "text-xl font-semibold mb-6",
7618
+ children: title
7619
+ }
7620
+ ),
7621
+ /* @__PURE__ */ jsxRuntime.jsx(ProductGrid, { products, renderImage })
7622
+ ] });
7623
+ }
7624
+ function getMetadataStringList(metadata, key) {
7625
+ const value = metadata?.[key];
7626
+ if (!Array.isArray(value)) return [];
7627
+ return value.filter((item) => typeof item === "string");
7628
+ }
7629
+ function PriceRange({ product, className }) {
7630
+ const { displayCurrency } = useCimplify();
7631
+ const range = chunkPEDLCL72_js.getPriceRange(product);
7632
+ if (!range) return null;
7633
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkPEDLCL72_js.formatPriceRange(range.min, range.max, displayCurrency) });
7634
+ }
7635
+ function DefaultProductLayout({
7636
+ product,
7637
+ onAddToCart,
7638
+ renderBreadcrumb,
7639
+ relatedProducts,
7640
+ showRelated = true,
7641
+ className
7642
+ }) {
7643
+ const images = product.images || (product.image_url ? [product.image_url] : []);
7644
+ const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
7645
+ const onSale = chunkPEDLCL72_js.isOnSale(product);
7646
+ const hasPhysicalDetails = product.sku || product.vendor || product.material;
7647
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "default", className: cn("space-y-8", className), children: [
7648
+ renderBreadcrumb?.(product),
7649
+ /* @__PURE__ */ jsxRuntime.jsx(
7650
+ TwoColumnGrid,
7651
+ {
7652
+ left: /* @__PURE__ */ jsxRuntime.jsx(
7653
+ ProductImageGallery,
7654
+ {
7655
+ images,
7656
+ productName: product.name
7657
+ }
7658
+ ),
7659
+ right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
7660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
7661
+ product.vendor && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-widest", children: product.vendor }),
7662
+ /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: product.tags || [] })
7663
+ ] }),
7664
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
7665
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline gap-3", children: hasRange ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, className: "text-2xl font-extrabold" }) : onSale ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7666
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-extrabold" }),
7667
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: chunkPEDLCL72_js.getBasePrice(product), className: "text-lg text-muted-foreground line-through" }),
7668
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-destructive bg-destructive/10 px-2 py-0.5", children: [
7669
+ "Save ",
7670
+ chunkPEDLCL72_js.getDiscountPercentage(product),
7671
+ "%"
7672
+ ] })
7673
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
7674
+ /* @__PURE__ */ jsxRuntime.jsx(InventoryBadge, { product }),
7675
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
7676
+ hasPhysicalDetails && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-details": true, className: "space-y-1 text-sm text-muted-foreground", children: [
7677
+ product.sku && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7678
+ "SKU: ",
7679
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-foreground", children: product.sku })
7680
+ ] }),
7681
+ product.barcode && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7682
+ "Barcode: ",
7683
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-foreground", children: product.barcode })
7684
+ ] }),
7685
+ product.material && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7686
+ "Material: ",
7687
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product.material })
7688
+ ] }),
7689
+ product.vendor && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7690
+ "Brand: ",
7691
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product.vendor })
7692
+ ] }),
7693
+ (product.length_mm || product.width_mm || product.height_mm) && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7694
+ "Dimensions: ",
7695
+ /* @__PURE__ */ jsxRuntime.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 ") })
7696
+ ] }),
7697
+ product.item_condition && product.item_condition !== "new" && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7698
+ "Condition: ",
7699
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground capitalize", children: product.item_condition })
7700
+ ] })
7701
+ ] }),
7702
+ /* @__PURE__ */ jsxRuntime.jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
7703
+ /* @__PURE__ */ jsxRuntime.jsx(PropertiesTable, { properties: product.properties || [] }),
7704
+ /* @__PURE__ */ jsxRuntime.jsx(
7705
+ ProductCustomizer,
7706
+ {
7707
+ product,
7708
+ onAddToCart
7709
+ }
7710
+ )
7711
+ ] })
7712
+ }
7713
+ ),
7714
+ showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7715
+ RelatedProductsSection,
7716
+ {
7717
+ products: relatedProducts
7718
+ }
7719
+ )
7720
+ ] });
7721
+ }
7722
+ var DIETARY_TAGS = /* @__PURE__ */ new Set([
7723
+ "vegetarian",
7724
+ "vegan",
7725
+ "gluten-free",
7726
+ "dairy-free",
7727
+ "nut-free",
7728
+ "spicy",
7729
+ "halal",
7730
+ "kosher",
7731
+ "organic",
7732
+ "sugar-free"
7733
+ ]);
7734
+ function FoodProductLayout({
7735
+ product,
7736
+ onAddToCart,
7737
+ renderBreadcrumb,
7738
+ relatedProducts,
7739
+ showRelated = true,
7740
+ className
7741
+ }) {
7742
+ const images = product.images || (product.image_url ? [product.image_url] : []);
7743
+ const allTags = product.tags || [];
7744
+ const dietaryTags = allTags.filter((t) => DIETARY_TAGS.has(t));
7745
+ const otherTags = allTags.filter((t) => !DIETARY_TAGS.has(t));
7746
+ const ingredients = getMetadataStringList(product.metadata, "ingredients");
7747
+ const pairings = getMetadataStringList(product.metadata, "pairings");
7748
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "food", className: cn("space-y-8", className), children: [
7749
+ renderBreadcrumb?.(product),
7750
+ /* @__PURE__ */ jsxRuntime.jsx(
7751
+ TwoColumnGrid,
7752
+ {
7753
+ left: /* @__PURE__ */ jsxRuntime.jsx(
7754
+ ProductImageGallery,
7755
+ {
7756
+ images,
7757
+ productName: product.name
7758
+ }
7759
+ ),
7760
+ right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
7761
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
7762
+ dietaryTags.map((tag) => /* @__PURE__ */ jsxRuntime.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)),
7763
+ product.allergies && product.allergies.map((allergy) => /* @__PURE__ */ jsxRuntime.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: [
7764
+ "Contains ",
7765
+ allergy
7766
+ ] }, allergy))
7767
+ ] }),
7768
+ /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: otherTags }),
7769
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7770
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-bold tracking-tight", children: product.name }),
7771
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold mt-2 block" })
7772
+ ] }),
7773
+ (product.calories != null || product.preparation_time_minutes != null) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-stats": true, className: "flex flex-wrap gap-4 py-3 border-y border-border", children: [
7774
+ product.preparation_time_minutes != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5 text-sm text-muted-foreground", children: [
7775
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "text-foreground", children: [
7776
+ product.preparation_time_minutes,
7777
+ " min"
7778
+ ] }),
7779
+ " prep time"
7780
+ ] }),
7781
+ product.calories != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1.5 text-sm text-muted-foreground", children: [
7782
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-foreground", children: product.calories }),
7783
+ " calories"
7784
+ ] })
7785
+ ] }),
7786
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
7787
+ (ingredients.length > 0 || pairings.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid sm:grid-cols-2 gap-4", children: [
7788
+ /* @__PURE__ */ jsxRuntime.jsx(MetadataStringList, { items: ingredients, label: "Key Ingredients" }),
7789
+ /* @__PURE__ */ jsxRuntime.jsx(MetadataStringList, { items: pairings, label: "Pairings" })
7790
+ ] }),
7791
+ /* @__PURE__ */ jsxRuntime.jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
7792
+ /* @__PURE__ */ jsxRuntime.jsx(
7793
+ ProductCustomizer,
7794
+ {
7795
+ product,
7796
+ onAddToCart
7797
+ }
7798
+ )
7799
+ ] })
7800
+ }
7801
+ ),
7802
+ showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7803
+ RelatedProductsSection,
7804
+ {
7805
+ products: relatedProducts,
7806
+ title: "You may also enjoy"
7807
+ }
7808
+ )
7809
+ ] });
7810
+ }
7811
+ function WholesaleProductLayout({
7812
+ product,
7813
+ onAddToCart,
7814
+ renderBreadcrumb,
7815
+ relatedProducts,
7816
+ showRelated = true,
7817
+ className
7818
+ }) {
7819
+ const images = product.images || (product.image_url ? [product.image_url] : []);
7820
+ const hasTiers = product.quantity_pricing && product.quantity_pricing.length > 1;
7821
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "wholesale", className: cn("space-y-8", className), children: [
7822
+ renderBreadcrumb?.(product),
7823
+ /* @__PURE__ */ jsxRuntime.jsx(
7824
+ TwoColumnGrid,
7825
+ {
7826
+ left: /* @__PURE__ */ jsxRuntime.jsx(
7827
+ ProductImageGallery,
7828
+ {
7829
+ images,
7830
+ productName: product.name
7831
+ }
7832
+ ),
7833
+ right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
7834
+ /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: product.tags || [] }),
7835
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7836
+ product.sku && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground font-medium uppercase tracking-wider mb-1", children: [
7837
+ "SKU: ",
7838
+ product.sku
7839
+ ] }),
7840
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name })
7841
+ ] }),
7842
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: hasTiers ? /* @__PURE__ */ jsxRuntime.jsx(PriceRange, { product, className: "text-2xl font-extrabold" }) : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-semibold" }) }),
7843
+ /* @__PURE__ */ jsxRuntime.jsx(InventoryBadge, { product }),
7844
+ product.min_order_quantity != null && product.min_order_quantity > 1 && /* @__PURE__ */ jsxRuntime.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: [
7845
+ "Minimum order quantity: ",
7846
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
7847
+ product.min_order_quantity,
7848
+ " units"
7849
+ ] })
7850
+ ] }),
7851
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
7852
+ hasTiers && /* @__PURE__ */ jsxRuntime.jsx(
7853
+ VolumePricing,
7854
+ {
7855
+ tiers: product.quantity_pricing,
7856
+ defaultOpen: true
7857
+ }
7858
+ ),
7859
+ (product.sku || product.barcode || product.vendor) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-details": true, className: "space-y-1 text-sm text-muted-foreground", children: [
7860
+ product.barcode && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7861
+ "Barcode: ",
7862
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-foreground", children: product.barcode })
7863
+ ] }),
7864
+ product.vendor && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7865
+ "Supplier: ",
7866
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground", children: product.vendor })
7867
+ ] }),
7868
+ product.hs_code && /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
7869
+ "HS Code: ",
7870
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono text-foreground", children: product.hs_code })
7871
+ ] })
7872
+ ] }),
7873
+ /* @__PURE__ */ jsxRuntime.jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
7874
+ /* @__PURE__ */ jsxRuntime.jsx(PropertiesTable, { properties: product.properties || [] }),
7875
+ /* @__PURE__ */ jsxRuntime.jsx(
7876
+ ProductCustomizer,
7877
+ {
7878
+ product,
7879
+ onAddToCart
7880
+ }
7881
+ )
7882
+ ] })
7883
+ }
7884
+ ),
7885
+ showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7886
+ RelatedProductsSection,
7887
+ {
7888
+ products: relatedProducts,
7889
+ title: "Related products"
7890
+ }
7891
+ )
7892
+ ] });
7893
+ }
7894
+ function formatMinutes(minutes) {
7895
+ if (minutes >= 1440) return `${Math.floor(minutes / 1440)} day${minutes >= 2880 ? "s" : ""}`;
7896
+ if (minutes >= 60) {
7897
+ const h = Math.floor(minutes / 60);
7898
+ const m = minutes % 60;
7899
+ return m > 0 ? `${h}h ${m}min` : `${h} hour${h > 1 ? "s" : ""}`;
7900
+ }
7901
+ return `${minutes} min`;
7902
+ }
7903
+ function ServiceProductLayout({
7904
+ product,
7905
+ onAddToCart,
7906
+ renderBreadcrumb,
7907
+ relatedProducts,
7908
+ showRelated = true,
7909
+ className
7910
+ }) {
7911
+ const images = product.images || (product.image_url ? [product.image_url] : []);
7912
+ const hasDeposit = product.deposit_type && product.deposit_type !== "none" && product.deposit_amount;
7913
+ const depositAmount = hasDeposit ? chunkPEDLCL72_js.parsePrice(product.deposit_amount) : 0;
7914
+ const cancellationHours = product.cancellation_window_minutes ? Math.floor(product.cancellation_window_minutes / 60) : null;
7915
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "service", className: cn("space-y-8", className), children: [
7916
+ renderBreadcrumb?.(product),
7917
+ /* @__PURE__ */ jsxRuntime.jsx(
7918
+ TwoColumnGrid,
7919
+ {
7920
+ left: /* @__PURE__ */ jsxRuntime.jsx(
7921
+ ProductImageGallery,
7922
+ {
7923
+ images,
7924
+ productName: product.name
7925
+ }
7926
+ ),
7927
+ right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
7928
+ /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: product.tags || [] }),
7929
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7930
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
7931
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-bold text-primary mt-2 block" })
7932
+ ] }),
7933
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-service-info": true, className: "flex flex-wrap gap-2", children: [
7934
+ product.duration_minutes != null && /* @__PURE__ */ jsxRuntime.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) }),
7935
+ hasDeposit && /* @__PURE__ */ jsxRuntime.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: [
7936
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }),
7937
+ " deposit"
7938
+ ] }),
7939
+ product.general_service_capacity != null && product.general_service_capacity > 1 && /* @__PURE__ */ jsxRuntime.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
+ "Up to ",
7941
+ product.general_service_capacity,
7942
+ " people"
7943
+ ] }),
7944
+ product.buffer_before_minutes != null && product.buffer_before_minutes > 0 && /* @__PURE__ */ jsxRuntime.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: [
7945
+ product.buffer_before_minutes,
7946
+ " min buffer"
7947
+ ] })
7948
+ ] }),
7949
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
7950
+ (product.requires_specific_staff || product.requires_specific_resource) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-requirements": true, className: "text-sm text-muted-foreground space-y-1", children: [
7951
+ product.requires_specific_staff && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Staff selection required" }),
7952
+ product.requires_specific_resource && /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Resource selection required" })
7953
+ ] }),
7954
+ /* @__PURE__ */ jsxRuntime.jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
7955
+ /* @__PURE__ */ jsxRuntime.jsx(
7956
+ ProductCustomizer,
7957
+ {
7958
+ product,
7959
+ onAddToCart,
7960
+ showSpecialInstructions: false
7961
+ }
7962
+ ),
7963
+ (cancellationHours != null || product.no_show_fee) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-cancellation": true, className: "border border-border p-4 space-y-2 text-sm", children: [
7964
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold", children: "Cancellation Policy" }),
7965
+ cancellationHours != null && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground", children: [
7966
+ "Free cancellation up to ",
7967
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { className: "text-foreground", children: [
7968
+ cancellationHours,
7969
+ " hours"
7970
+ ] }),
7971
+ " before the appointment"
7972
+ ] }),
7973
+ product.no_show_fee && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground", children: [
7974
+ "No-show fee: ",
7975
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.no_show_fee, className: "font-medium text-foreground" })
7976
+ ] }),
7977
+ hasDeposit && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: product.deposit_type === "fixed" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7978
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount, className: "font-medium text-foreground" }),
7979
+ " deposit charged at booking"
7980
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7981
+ chunkPEDLCL72_js.parsePrice(product.deposit_amount),
7982
+ "% deposit charged at booking"
7983
+ ] }) })
7984
+ ] })
7985
+ ] })
7986
+ }
7987
+ ),
7988
+ showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7989
+ RelatedProductsSection,
7990
+ {
7991
+ products: relatedProducts,
7992
+ title: "Other services"
7993
+ }
7994
+ )
7995
+ ] });
7996
+ }
7997
+ var DIGITAL_TYPE_LABELS = {
7998
+ download: "Digital download",
7999
+ license: "Software license",
8000
+ event_ticket: "Event ticket",
8001
+ access_pass: "Access pass",
8002
+ gift_card: "Gift card"
8003
+ };
8004
+ function DigitalProductLayout({
8005
+ product,
8006
+ onAddToCart,
8007
+ renderBreadcrumb,
8008
+ relatedProducts,
8009
+ showRelated = true,
8010
+ className
8011
+ }) {
8012
+ const images = product.images || (product.image_url ? [product.image_url] : []);
8013
+ const typeLabel = product.digital_type ? DIGITAL_TYPE_LABELS[product.digital_type] || product.digital_type : "Digital product";
8014
+ const isTicket = product.digital_type === "event_ticket";
8015
+ const isAccessPass = product.digital_type === "access_pass";
8016
+ const isDownload = product.digital_type === "download" || product.digital_type === "license";
8017
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout": "digital", className: cn("space-y-8", className), children: [
8018
+ renderBreadcrumb?.(product),
8019
+ /* @__PURE__ */ jsxRuntime.jsx(
8020
+ TwoColumnGrid,
8021
+ {
8022
+ left: /* @__PURE__ */ jsxRuntime.jsx(
8023
+ ProductImageGallery,
8024
+ {
8025
+ images,
8026
+ productName: product.name
8027
+ }
8028
+ ),
8029
+ right: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
8030
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
8031
+ /* @__PURE__ */ jsxRuntime.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 }),
8032
+ /* @__PURE__ */ jsxRuntime.jsx(TagPills, { tags: product.tags || [] })
8033
+ ] }),
8034
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8035
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { "data-cimplify-product-layout-name": true, className: "text-3xl lg:text-4xl font-extrabold tracking-tight", children: product.name }),
8036
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: product.default_price, className: "text-2xl font-bold mt-2 block" })
8037
+ ] }),
8038
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-cimplify-product-layout-description": true, className: "text-muted-foreground leading-relaxed", children: product.description }),
8039
+ isDownload && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-delivery": true, className: "flex items-center gap-3 px-4 py-3 bg-muted rounded-lg", children: [
8040
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-5 h-5 text-primary shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
8041
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
8042
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: "Instant delivery" }),
8043
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Download immediately after purchase" })
8044
+ ] })
8045
+ ] }),
8046
+ isTicket && (product.event_date || product.venue) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-event": true, className: "border border-border p-4 space-y-2", children: [
8047
+ product.event_date && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8048
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Date:" }),
8049
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: new Date(product.event_date).toLocaleDateString(void 0, { weekday: "long", year: "numeric", month: "long", day: "numeric" }) })
8050
+ ] }),
8051
+ product.venue && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8052
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Venue:" }),
8053
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: product.venue })
8054
+ ] }),
8055
+ product.ticket_type && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8056
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Type:" }),
8057
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium capitalize", children: product.ticket_type })
8058
+ ] })
8059
+ ] }),
8060
+ isAccessPass && (product.access_type || product.access_duration_days) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-access": true, className: "border border-border p-4 space-y-2", children: [
8061
+ product.access_type && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8062
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Access:" }),
8063
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium capitalize", children: product.access_type })
8064
+ ] }),
8065
+ product.access_level && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8066
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Level:" }),
8067
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium capitalize", children: product.access_level })
8068
+ ] }),
8069
+ product.access_duration_days && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
8070
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Duration:" }),
8071
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
8072
+ product.access_duration_days,
8073
+ " days"
8074
+ ] })
8075
+ ] })
8076
+ ] }),
8077
+ isDownload && (product.file_size_mb || product.file_type || product.version || product.max_downloads) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-layout-file-details": true, className: "grid grid-cols-2 gap-3", children: [
8078
+ product.file_type && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8079
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Format" }),
8080
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: product.file_type.toUpperCase() })
8081
+ ] }),
8082
+ product.file_size_mb != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8083
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Size" }),
8084
+ /* @__PURE__ */ jsxRuntime.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` })
8085
+ ] }),
8086
+ product.max_downloads != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8087
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Downloads" }),
8088
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: product.max_downloads })
8089
+ ] }),
8090
+ product.version && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8091
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Version" }),
8092
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm font-semibold", children: [
8093
+ "v",
8094
+ product.version
8095
+ ] })
8096
+ ] }),
8097
+ product.download_expires_days != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8098
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Expires" }),
8099
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm font-semibold", children: [
8100
+ product.download_expires_days,
8101
+ " days"
8102
+ ] })
8103
+ ] }),
8104
+ product.max_activations != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-3 py-2 bg-muted text-center", children: [
8105
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Activations" }),
8106
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold", children: product.max_activations })
8107
+ ] })
8108
+ ] }),
8109
+ /* @__PURE__ */ jsxRuntime.jsx(CustomAttributesTable, { attributes: product.custom_attributes || [] }),
8110
+ /* @__PURE__ */ jsxRuntime.jsx(
8111
+ ProductCustomizer,
8112
+ {
8113
+ product,
8114
+ onAddToCart,
8115
+ showSpecialInstructions: false
8116
+ }
8117
+ )
8118
+ ] })
8119
+ }
8120
+ ),
8121
+ showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
8122
+ RelatedProductsSection,
8123
+ {
8124
+ products: relatedProducts,
8125
+ title: "More digital products"
8126
+ }
8127
+ )
8128
+ ] });
8129
+ }
8130
+ var ProductTemplate = /* @__PURE__ */ ((ProductTemplate2) => {
8131
+ ProductTemplate2["Default"] = "default";
8132
+ ProductTemplate2["Food"] = "food";
8133
+ ProductTemplate2["Wholesale"] = "wholesale";
8134
+ ProductTemplate2["Service"] = "service";
8135
+ ProductTemplate2["Digital"] = "digital";
8136
+ ProductTemplate2["Physical"] = "physical";
8137
+ return ProductTemplate2;
8138
+ })(ProductTemplate || {});
8139
+ var BUILT_IN_LAYOUTS = {
8140
+ ["food" /* Food */]: FoodProductLayout,
8141
+ ["wholesale" /* Wholesale */]: WholesaleProductLayout,
8142
+ ["service" /* Service */]: ServiceProductLayout,
8143
+ ["digital" /* Digital */]: DigitalProductLayout,
8144
+ ["default" /* Default */]: DefaultProductLayout
8145
+ };
8146
+ function resolveTemplateKey(product) {
8147
+ const metaTemplate = product.metadata?.page_template;
8148
+ if (typeof metaTemplate === "string" && metaTemplate.trim()) {
8149
+ return metaTemplate.trim();
8150
+ }
8151
+ if (product.quantity_pricing && product.quantity_pricing.length > 1) {
8152
+ return "wholesale" /* Wholesale */;
8153
+ }
8154
+ if (product.type === "service") {
8155
+ return "service" /* Service */;
8156
+ }
8157
+ if (product.type === "digital") {
8158
+ return "digital" /* Digital */;
8159
+ }
8160
+ if (product.render_hint === "food") {
8161
+ return "food" /* Food */;
8162
+ }
8163
+ if (product.render_hint === "physical") {
8164
+ return "physical" /* Physical */;
8165
+ }
8166
+ return "default" /* Default */;
8167
+ }
8168
+ function resolveLayout(product, pages, templates) {
8169
+ if (pages?.[product.slug]) {
8170
+ return pages[product.slug];
8171
+ }
8172
+ const key = resolveTemplateKey(product);
8173
+ if (templates?.[key]) {
8174
+ return templates[key];
8175
+ }
8176
+ if (BUILT_IN_LAYOUTS[key]) {
8177
+ return BUILT_IN_LAYOUTS[key];
8178
+ }
8179
+ return DefaultProductLayout;
8180
+ }
7490
8181
  function ProductPage({
7491
8182
  productId,
7492
8183
  product: productProp,
7493
- relatedProducts,
8184
+ pages,
8185
+ templates,
7494
8186
  onAddToCart,
7495
8187
  renderImage,
7496
- showAvailability = true,
7497
- showSaleBadge = true,
8188
+ renderBreadcrumb,
8189
+ relatedProducts,
7498
8190
  showRelated = true,
7499
- relatedTitle = "You might also like",
7500
8191
  className,
7501
8192
  classNames
7502
8193
  }) {
7503
- const { product: fetched, isLoading } = useProduct(productId, {
7504
- enabled: !productProp
8194
+ const resolvedId = productId || productProp?.slug || productProp?.id || "";
8195
+ const { product: fetched, isLoading } = useProduct(resolvedId, {
8196
+ enabled: !productProp && resolvedId.length > 0
7505
8197
  });
7506
8198
  const product = productProp ?? fetched;
7507
8199
  if (isLoading && !product) {
@@ -7511,41 +8203,34 @@ function ProductPage({
7511
8203
  "data-cimplify-product-page": true,
7512
8204
  "aria-busy": "true",
7513
8205
  className: cn(className, classNames?.root, classNames?.loading),
7514
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-page-skeleton": true, style: { display: "flex", flexDirection: "column", gap: "1rem" }, children: [
7515
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { aspectRatio: "4/3", backgroundColor: "rgba(0,0,0,0.06)", borderRadius: "0.5rem" } }),
7516
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "2rem", width: "60%", backgroundColor: "rgba(0,0,0,0.06)", borderRadius: "0.25rem" } }),
7517
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "1rem", width: "30%", backgroundColor: "rgba(0,0,0,0.06)", borderRadius: "0.25rem" } })
8206
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-2 gap-8 lg:gap-12 animate-pulse", children: [
8207
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-square bg-muted" }),
8208
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 py-4", children: [
8209
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-8 w-3/5 bg-muted" }),
8210
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 w-2/5 bg-muted" }),
8211
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-4/5 bg-muted" }),
8212
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-3/5 bg-muted" }),
8213
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 w-full bg-muted mt-8" })
8214
+ ] })
7518
8215
  ] })
7519
8216
  }
7520
8217
  );
7521
8218
  }
7522
8219
  if (!product) {
7523
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Product not found." }) });
8220
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground", children: "Product not found." }) });
7524
8221
  }
7525
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: [
7526
- (showAvailability || showSaleBadge) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-page-badges": true, className: classNames?.badges, children: [
7527
- showAvailability && /* @__PURE__ */ jsxRuntime.jsx(AvailabilityBadge, { product }),
7528
- showSaleBadge && /* @__PURE__ */ jsxRuntime.jsx(SaleBadge, { product })
7529
- ] }),
7530
- /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-page-main": true, className: classNames?.main, children: /* @__PURE__ */ jsxRuntime.jsx(
7531
- ProductSheet,
7532
- {
7533
- product,
7534
- onAddToCart,
7535
- renderImage
7536
- }
7537
- ) }),
7538
- showRelated && relatedProducts && relatedProducts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-product-page-related": true, className: classNames?.relatedSection, children: [
7539
- /* @__PURE__ */ jsxRuntime.jsx("h2", { "data-cimplify-product-page-related-title": true, className: classNames?.relatedTitle, children: relatedTitle }),
7540
- /* @__PURE__ */ jsxRuntime.jsx(
7541
- ProductGrid,
7542
- {
7543
- products: relatedProducts,
7544
- renderImage
7545
- }
7546
- )
7547
- ] })
7548
- ] });
8222
+ const Layout = resolveLayout(product, pages, templates);
8223
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-product-page": true, className: cn(className, classNames?.root), children: /* @__PURE__ */ jsxRuntime.jsx(
8224
+ Layout,
8225
+ {
8226
+ product,
8227
+ onAddToCart,
8228
+ renderImage,
8229
+ renderBreadcrumb,
8230
+ relatedProducts,
8231
+ showRelated
8232
+ }
8233
+ ) });
7549
8234
  }
7550
8235
  function CartPage({
7551
8236
  title = "Your Cart",
@@ -8044,7 +8729,7 @@ function BookingPage({
8044
8729
  const hasStaffStep = staff && staff.length > 0;
8045
8730
  const depositType = product?.deposit_type;
8046
8731
  const depositAmount = product?.deposit_amount;
8047
- const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkKRNWMUBN_js.parsePrice(depositAmount) !== 0;
8732
+ const hasDeposit = depositType !== void 0 && depositType !== "none" && depositAmount !== void 0 && chunkPEDLCL72_js.parsePrice(depositAmount) !== 0;
8048
8733
  const cancellationMinutes = product?.cancellation_window_minutes;
8049
8734
  const noShowFee = product?.no_show_fee;
8050
8735
  const handleSlotSelect = React3.useCallback(
@@ -8176,14 +8861,14 @@ function BookingPage({
8176
8861
  service.price && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-booking-service-price": true, children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: service.price }) }),
8177
8862
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-deposit-info": true, className: classNames?.depositInfo, children: [
8178
8863
  "Deposit: ",
8179
- depositType === "percentage" ? `${chunkKRNWMUBN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
8864
+ depositType === "percentage" ? `${chunkPEDLCL72_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount })
8180
8865
  ] }),
8181
8866
  cancellationMinutes !== void 0 && cancellationMinutes > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-cancellation-policy": true, className: classNames?.cancellationPolicy, children: [
8182
8867
  "Free cancellation up to ",
8183
8868
  cancellationMinutes >= 60 ? `${Math.floor(cancellationMinutes / 60)} hour${Math.floor(cancellationMinutes / 60) !== 1 ? "s" : ""}` : `${cancellationMinutes} minute${cancellationMinutes !== 1 ? "s" : ""}`,
8184
8869
  " before"
8185
8870
  ] }),
8186
- noShowFee !== void 0 && chunkKRNWMUBN_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
8871
+ noShowFee !== void 0 && chunkPEDLCL72_js.parsePrice(noShowFee) !== 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-booking-no-show-fee": true, className: classNames?.cancellationPolicy, children: [
8187
8872
  "No-show fee: ",
8188
8873
  /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: noShowFee })
8189
8874
  ] })
@@ -8260,7 +8945,7 @@ function BookingPage({
8260
8945
  ] }),
8261
8946
  hasDeposit && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-booking-summary-row": true, className: cn(classNames?.summaryRow, classNames?.depositInfo), children: [
8262
8947
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Deposit" }),
8263
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkKRNWMUBN_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
8948
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: depositType === "percentage" ? `${chunkPEDLCL72_js.parsePrice(depositAmount)}%` : /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: depositAmount }) })
8264
8949
  ] })
8265
8950
  ] }),
8266
8951
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8575,12 +9260,6 @@ function RecentlyViewed({
8575
9260
  product.product_id
8576
9261
  )) });
8577
9262
  }
8578
- function PriceRange({ product, className }) {
8579
- const { displayCurrency } = useCimplify();
8580
- const range = chunkKRNWMUBN_js.getPriceRange(product);
8581
- if (!range) return null;
8582
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-price-range": true, className, children: chunkKRNWMUBN_js.formatPriceRange(range.min, range.max, displayCurrency) });
8583
- }
8584
9263
  function DeliveryEstimate({
8585
9264
  latitude,
8586
9265
  longitude,
@@ -8730,7 +9409,7 @@ function CurrencySelector({
8730
9409
 
8731
9410
  Object.defineProperty(exports, "getVariantDisplayName", {
8732
9411
  enumerable: true,
8733
- get: function () { return chunkRAKLT6J2_js.getVariantDisplayName; }
9412
+ get: function () { return chunkIYQGGFVQ_js.getVariantDisplayName; }
8734
9413
  });
8735
9414
  exports.Ad = Ad;
8736
9415
  exports.AdProvider = AdProvider;
@@ -8755,13 +9434,19 @@ exports.CimplifyProvider = CimplifyProvider;
8755
9434
  exports.CollectionPage = CollectionPage;
8756
9435
  exports.CompositeSelector = CompositeSelector;
8757
9436
  exports.CurrencySelector = CurrencySelector;
9437
+ exports.CustomAttributesTable = CustomAttributesTable;
8758
9438
  exports.DateSlotPicker = DateSlotPicker;
8759
9439
  exports.DealBanner = DealBanner;
8760
9440
  exports.DealsPage = DealsPage;
9441
+ exports.DefaultProductLayout = DefaultProductLayout;
8761
9442
  exports.DeliveryEstimate = DeliveryEstimate;
9443
+ exports.DigitalProductLayout = DigitalProductLayout;
8762
9444
  exports.DiscountInput = DiscountInput;
8763
9445
  exports.ElementsProvider = ElementsProvider;
9446
+ exports.FoodProductLayout = FoodProductLayout;
9447
+ exports.InventoryBadge = InventoryBadge;
8764
9448
  exports.LocationPicker = LocationPicker;
9449
+ exports.MetadataStringList = MetadataStringList;
8765
9450
  exports.OrderDetailPage = OrderDetailPage;
8766
9451
  exports.OrderHistory = OrderHistory;
8767
9452
  exports.OrderHistoryPage = OrderHistoryPage;
@@ -8775,21 +9460,28 @@ exports.ProductGrid = ProductGrid;
8775
9460
  exports.ProductImageGallery = ProductImageGallery;
8776
9461
  exports.ProductPage = ProductPage;
8777
9462
  exports.ProductSheet = ProductSheet;
9463
+ exports.ProductTemplate = ProductTemplate;
9464
+ exports.PropertiesTable = PropertiesTable;
8778
9465
  exports.QuantitySelector = QuantitySelector;
8779
9466
  exports.RecentlyViewed = RecentlyViewed;
8780
9467
  exports.RecommendationCarousel = RecommendationCarousel;
9468
+ exports.RelatedProductsSection = RelatedProductsSection;
8781
9469
  exports.ResourcePicker = ResourcePicker;
8782
9470
  exports.SaleBadge = SaleBadge;
8783
9471
  exports.SearchInput = SearchInput;
8784
9472
  exports.SearchPage = SearchPage;
8785
9473
  exports.ServiceCard = ServiceCard;
8786
9474
  exports.ServiceGrid = ServiceGrid;
9475
+ exports.ServiceProductLayout = ServiceProductLayout;
8787
9476
  exports.SessionMessageBanner = SessionMessageBanner;
8788
9477
  exports.SlotPicker = SlotPicker;
8789
9478
  exports.StaffPicker = StaffPicker;
8790
9479
  exports.StoreNav = StoreNav;
9480
+ exports.TagPills = TagPills;
9481
+ exports.TwoColumnGrid = TwoColumnGrid;
8791
9482
  exports.VariantSelector = VariantSelector;
8792
9483
  exports.VolumePricing = VolumePricing;
9484
+ exports.WholesaleProductLayout = WholesaleProductLayout;
8793
9485
  exports.cn = cn;
8794
9486
  exports.roomToResource = roomToResource;
8795
9487
  exports.useActivityState = useActivityState;