@cimplify/sdk 0.44.7 → 0.44.10

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
@@ -6448,113 +6448,161 @@ function CartLineItemRow({
6448
6448
  const hasComposite = item.compositeSelections && item.compositeSelections.length > 0;
6449
6449
  const hasBundle = item.bundleSelections && item.bundleSelections.length > 0;
6450
6450
  const isOptimistic = item.isOptimistic === true;
6451
+ const lineTotal = chunkV2O5AO7I_js.parsePrice(unitPrice) * item.quantity;
6452
+ const imageUrl = item.product.image_url;
6453
+ const variantLabel = item.variant ? chunkBGCEKFLA_js.getVariantDisplayName(item.variant, item.product.name) : null;
6451
6454
  return /* @__PURE__ */ jsxRuntime.jsxs(
6452
6455
  "div",
6453
6456
  {
6454
6457
  "data-cimplify-cart-item": true,
6455
6458
  "data-optimistic": isOptimistic ? "true" : void 0,
6456
6459
  className: cn(
6457
- "flex items-start justify-between gap-4 py-4 border-b border-border last:border-b-0",
6460
+ "group relative flex gap-3 py-4 border-b border-border last:border-b-0 transition-opacity",
6461
+ isOptimistic && "opacity-60",
6458
6462
  classNames?.item
6459
6463
  ),
6460
6464
  children: [
6461
- /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, className: "flex-1 min-w-0 space-y-1", children: [
6462
- /* @__PURE__ */ jsxRuntime.jsx(
6463
- "span",
6465
+ /* @__PURE__ */ jsxRuntime.jsx(
6466
+ "div",
6467
+ {
6468
+ "data-cimplify-cart-item-image": true,
6469
+ className: "relative w-20 h-20 shrink-0 rounded-md overflow-hidden bg-muted",
6470
+ children: imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(
6471
+ "img",
6472
+ {
6473
+ src: imageUrl,
6474
+ alt: "",
6475
+ className: "w-full h-full object-cover",
6476
+ loading: "lazy"
6477
+ }
6478
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full grid place-items-center text-muted-foreground/40", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-6 h-6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z" }) }) })
6479
+ }
6480
+ ),
6481
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-info": true, className: "flex-1 min-w-0 flex flex-col", children: [
6482
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
6483
+ /* @__PURE__ */ jsxRuntime.jsx(
6484
+ "h3",
6485
+ {
6486
+ "data-cimplify-cart-item-name": true,
6487
+ className: cn("text-sm font-medium leading-tight m-0 truncate", classNames?.itemName),
6488
+ children: item.product.name
6489
+ }
6490
+ ),
6491
+ /* @__PURE__ */ jsxRuntime.jsx(
6492
+ "button",
6493
+ {
6494
+ type: "button",
6495
+ onClick: () => onRemove(item.id),
6496
+ "data-cimplify-cart-item-remove": true,
6497
+ className: cn(
6498
+ "shrink-0 -mr-1 -mt-1 grid place-items-center w-7 h-7 rounded-full text-muted-foreground/60 hover:text-foreground hover:bg-muted transition-colors",
6499
+ classNames?.removeButton
6500
+ ),
6501
+ "aria-label": `Remove ${item.product.name}`,
6502
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
6503
+ }
6504
+ )
6505
+ ] }),
6506
+ (variantLabel || item.addOnOptions && item.addOnOptions.length > 0 || hasComposite || hasBundle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-pills": true, className: "flex flex-wrap gap-1.5 mt-1.5", children: [
6507
+ variantLabel && /* @__PURE__ */ jsxRuntime.jsx(
6508
+ "span",
6509
+ {
6510
+ "data-cimplify-cart-item-variant": true,
6511
+ className: "inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-foreground",
6512
+ children: variantLabel
6513
+ }
6514
+ ),
6515
+ item.addOnOptions?.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
6516
+ "span",
6517
+ {
6518
+ "data-cimplify-cart-item-addon": true,
6519
+ className: "inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-muted-foreground",
6520
+ children: [
6521
+ "+ ",
6522
+ opt.name
6523
+ ]
6524
+ },
6525
+ opt.id
6526
+ )),
6527
+ (hasComposite || hasBundle) && /* @__PURE__ */ jsxRuntime.jsx(
6528
+ "span",
6529
+ {
6530
+ "data-cimplify-cart-item-badge": true,
6531
+ className: "inline-flex items-center px-2 py-0.5 rounded-full bg-primary/10 text-[11px] font-semibold uppercase tracking-wider text-primary",
6532
+ children: hasComposite ? "Custom" : "Bundle"
6533
+ }
6534
+ )
6535
+ ] }),
6536
+ item.specialInstructions && /* @__PURE__ */ jsxRuntime.jsxs(
6537
+ "p",
6464
6538
  {
6465
- "data-cimplify-cart-item-name": true,
6466
- className: cn("block font-medium", classNames?.itemName),
6467
- children: item.product.name
6539
+ "data-cimplify-cart-item-instructions": true,
6540
+ className: "mt-1.5 text-xs italic text-muted-foreground line-clamp-2",
6541
+ children: [
6542
+ "\\u201C",
6543
+ item.specialInstructions,
6544
+ "\\u201D"
6545
+ ]
6468
6546
  }
6469
6547
  ),
6470
- item.variant && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-variant": true, className: "block text-xs text-muted-foreground", children: chunkBGCEKFLA_js.getVariantDisplayName(item.variant, item.product.name) }),
6471
- item.addOnOptions && item.addOnOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-cimplify-cart-item-addons": true, className: "block text-xs text-muted-foreground", children: [
6472
- "+ ",
6473
- item.addOnOptions.map((opt) => opt.name).join(", ")
6474
- ] }),
6475
- (hasComposite || hasBundle) && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-badge": true, children: hasComposite ? "Custom" : "Bundle" }),
6476
- item.specialInstructions && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-item-instructions": true, className: "text-xs text-muted-foreground", children: item.specialInstructions }),
6477
- item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-customer-inputs": true, className: classNames?.customerInputs, children: item.customerInputs.map((input) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-input": true, children: [
6478
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-input-label": true, children: input.field_name }),
6479
- /* @__PURE__ */ jsxRuntime.jsx("span", { "data-cimplify-cart-input-value": true, children: input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.File || input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
6548
+ item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("dl", { "data-cimplify-cart-customer-inputs": true, className: cn("mt-1.5 text-xs space-y-0.5", classNames?.customerInputs), children: item.customerInputs.map((input) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-input": true, className: "flex gap-1.5", children: [
6549
+ /* @__PURE__ */ jsxRuntime.jsxs("dt", { "data-cimplify-cart-input-label": true, className: "text-muted-foreground", children: [
6550
+ input.field_name,
6551
+ ":"
6552
+ ] }),
6553
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { "data-cimplify-cart-input-value": true, className: "text-foreground m-0 truncate", children: input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.File || input.field_type === chunkBGCEKFLA_js.INPUT_FIELD_TYPE.Image ? String(input.value).split("/").pop() || "Uploaded file" : String(input.value) })
6480
6554
  ] }, input.field_id)) }),
6481
- (item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: classNames?.serviceInfo, children: [
6555
+ (item.lineType === "service" || item.product.type === "service") && item.scheduledStart && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-info": true, className: cn("mt-1.5 flex items-center gap-1.5 text-xs text-muted-foreground", classNames?.serviceInfo), children: [
6556
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
6482
6557
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6483
- "\u{1F4C5}",
6558
+ new Date(item.scheduledStart).toLocaleDateString(void 0, { month: "short", day: "numeric" }),
6559
+ " at",
6484
6560
  " ",
6485
- new Date(item.scheduledStart).toLocaleDateString(),
6486
- " at ",
6487
6561
  new Date(item.scheduledStart).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })
6488
6562
  ] }),
6489
- item.confirmationCode && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6490
- "Confirmation: ",
6491
- item.confirmationCode
6492
- ] }),
6493
- item.serviceStatus && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-status": item.serviceStatus, children: item.serviceStatus })
6563
+ item.serviceStatus && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-status": item.serviceStatus, className: "ml-auto px-1.5 py-0.5 rounded-full bg-muted text-[10px] uppercase tracking-wider", children: item.serviceStatus })
6494
6564
  ] }),
6495
- (item.lineType === "digital" || item.product.type === "digital") && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-digital-info": true, className: classNames?.digitalInfo, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6496
- "\u26A1",
6497
- " Instant digital delivery"
6498
- ] }) }),
6499
- item.bundleResolved && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-bundle-breakdown": true, className: classNames?.bundleBreakdown, children: item.bundleResolved.selections.map((sel) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-product-type": sel.product_type, children: [
6500
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6501
- sel.quantity,
6502
- "\xD7 ",
6503
- sel.product_name
6504
- ] }),
6505
- sel.product_type === "service" && sel.scheduling?.scheduled_start && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6506
- " \u2014 ",
6507
- new Date(sel.scheduling.scheduled_start).toLocaleDateString()
6508
- ] }),
6509
- sel.product_type === "digital" && /* @__PURE__ */ jsxRuntime.jsx("span", { children: " \u2014 Digital" })
6510
- ] }, sel.component_id)) }),
6511
- item.compositeResolved && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-composite-breakdown": true, className: classNames?.compositeBreakdown, children: item.compositeResolved.selections.map((sel) => /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-product-type": sel.product_type, children: [
6512
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6513
- sel.quantity,
6514
- "\xD7 ",
6515
- sel.component_name
6516
- ] }),
6517
- sel.product_type === "service" && sel.scheduling?.scheduled_start && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
6518
- " \u2014 ",
6519
- new Date(sel.scheduling.scheduled_start).toLocaleDateString()
6520
- ] })
6521
- ] }, sel.component_id)) }),
6522
- /* @__PURE__ */ jsxRuntime.jsx(
6523
- Price,
6565
+ (item.lineType === "digital" || item.product.type === "digital") && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-digital-info": true, className: cn("mt-1.5 flex items-center gap-1 text-xs text-muted-foreground", classNames?.digitalInfo), children: [
6566
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5 shrink-0", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
6567
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Instant digital delivery" })
6568
+ ] }),
6569
+ (item.bundleResolved || item.compositeResolved) && /* @__PURE__ */ jsxRuntime.jsx(
6570
+ "ul",
6524
6571
  {
6525
- amount: unitPrice,
6526
- className: cn("block pt-1 text-sm font-semibold", classNames?.itemPrice)
6572
+ "data-cimplify-cart-composite-breakdown": item.compositeResolved ? "" : void 0,
6573
+ "data-cimplify-cart-bundle-breakdown": item.bundleResolved ? "" : void 0,
6574
+ className: cn("mt-1.5 pl-3 border-l border-border space-y-0.5 text-xs text-muted-foreground", item.compositeResolved ? classNames?.compositeBreakdown : classNames?.bundleBreakdown),
6575
+ children: (item.bundleResolved?.selections ?? item.compositeResolved?.selections ?? []).map((sel) => {
6576
+ const name = sel.product_name ?? sel.component_name ?? "";
6577
+ const compId = sel.component_id ?? `${name}-${sel.quantity}`;
6578
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { "data-product-type": sel.product_type, className: "flex items-baseline gap-1.5 m-0", children: [
6579
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium text-foreground/80", children: [
6580
+ sel.quantity,
6581
+ "\\u00D7"
6582
+ ] }),
6583
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: name })
6584
+ ] }, compId);
6585
+ })
6527
6586
  }
6528
- )
6529
- ] }),
6530
- /* @__PURE__ */ jsxRuntime.jsxs(
6531
- "div",
6532
- {
6533
- "data-cimplify-cart-item-controls": true,
6534
- className: cn("flex flex-col items-end gap-2 shrink-0", classNames?.quantity),
6535
- children: [
6536
- /* @__PURE__ */ jsxRuntime.jsx(
6537
- QuantitySelector,
6538
- {
6539
- value: item.quantity,
6540
- onChange: (qty) => onQuantityChange(item.id, qty),
6541
- min: 0
6542
- }
6543
- ),
6544
- /* @__PURE__ */ jsxRuntime.jsx(
6545
- "button",
6546
- {
6547
- type: "button",
6548
- onClick: () => onRemove(item.id),
6549
- "data-cimplify-cart-item-remove": true,
6550
- className: cn("text-xs text-muted-foreground hover:text-foreground hover:underline transition-colors", classNames?.removeButton),
6551
- "aria-label": `Remove ${item.product.name}`,
6552
- children: "Remove"
6553
- }
6554
- )
6555
- ]
6556
- }
6557
- )
6587
+ ),
6588
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex items-center justify-between gap-3", children: [
6589
+ /* @__PURE__ */ jsxRuntime.jsx(
6590
+ Price,
6591
+ {
6592
+ amount: lineTotal,
6593
+ className: cn("text-sm font-semibold tabular-nums", classNames?.itemPrice)
6594
+ }
6595
+ ),
6596
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-item-controls": true, className: classNames?.quantity, children: /* @__PURE__ */ jsxRuntime.jsx(
6597
+ QuantitySelector,
6598
+ {
6599
+ value: item.quantity,
6600
+ onChange: (qty) => onQuantityChange(item.id, qty),
6601
+ min: 0
6602
+ }
6603
+ ) })
6604
+ ] })
6605
+ ] })
6558
6606
  ]
6559
6607
  }
6560
6608
  );
@@ -10689,42 +10737,65 @@ function DefaultCartLayout({
10689
10737
  className
10690
10738
  }) {
10691
10739
  if (cart.isEmpty) {
10692
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("text-center py-20", className), children: [
10693
- /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-16 h-16 mx-auto text-muted-foreground/30", fill: "none", stroke: "currentColor", strokeWidth: "1", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" }) }),
10694
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-medium mt-4", children: "Your cart is empty" }),
10695
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Add some items to get started" }),
10696
- onContinueShopping && /* @__PURE__ */ jsxRuntime.jsx(
10740
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("max-w-md mx-auto text-center py-24", className), children: [
10741
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-24 h-24 mx-auto mb-6", children: [
10742
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-muted" }),
10743
+ /* @__PURE__ */ jsxRuntime.jsx(
10744
+ "svg",
10745
+ {
10746
+ className: "relative w-12 h-12 m-auto top-1/2 -translate-y-1/2 text-muted-foreground/60",
10747
+ fill: "none",
10748
+ stroke: "currentColor",
10749
+ strokeWidth: "1.5",
10750
+ viewBox: "0 0 24 24",
10751
+ "aria-hidden": true,
10752
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l-1 12H6L5 9z" })
10753
+ }
10754
+ )
10755
+ ] }),
10756
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold tracking-tight m-0", children: "Your cart is empty" }),
10757
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Browse the shop and add something you'll love." }),
10758
+ onContinueShopping && /* @__PURE__ */ jsxRuntime.jsxs(
10697
10759
  "button",
10698
10760
  {
10761
+ type: "button",
10699
10762
  onClick: onContinueShopping,
10700
- className: "text-sm font-medium text-primary mt-4 hover:underline",
10701
- children: "Continue shopping"
10763
+ className: "mt-6 inline-flex items-center gap-1.5 h-11 px-6 rounded-full bg-foreground text-background text-sm font-semibold hover:bg-foreground/90 active:scale-[0.99] transition-all",
10764
+ children: [
10765
+ "Shop now",
10766
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.5", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14 5l7 7m0 0l-7 7m7-7H3" }) })
10767
+ ]
10702
10768
  }
10703
10769
  )
10704
10770
  ] });
10705
10771
  }
10706
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("space-y-6", className), children: [
10707
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
10708
- /* @__PURE__ */ jsxRuntime.jsxs("h1", { className: "text-2xl font-bold tracking-tight", children: [
10709
- "Your Cart (",
10772
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("space-y-8", className), children: [
10773
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-baseline justify-between gap-4", children: [
10774
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl sm:text-4xl font-bold tracking-tight m-0", children: "Cart" }),
10775
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground tabular-nums", children: [
10710
10776
  cart.itemCount,
10711
10777
  " ",
10712
- cart.itemCount === 1 ? "item" : "items",
10713
- ")"
10714
- ] }),
10715
- onContinueShopping && /* @__PURE__ */ jsxRuntime.jsx(
10716
- "button",
10717
- {
10718
- onClick: onContinueShopping,
10719
- className: "text-sm text-muted-foreground hover:text-foreground transition-colors",
10720
- children: "Continue shopping"
10721
- }
10722
- )
10778
+ cart.itemCount === 1 ? "item" : "items"
10779
+ ] })
10723
10780
  ] }),
10724
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-[1fr_380px] gap-8", children: [
10725
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(CartSummary, {}) }),
10726
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:sticky lg:top-6 h-fit space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-border rounded-[14px] p-6 space-y-4", children: [
10727
- /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold", children: "Order Summary" }),
10781
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-[1fr_360px] gap-10", children: [
10782
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10783
+ /* @__PURE__ */ jsxRuntime.jsx(CartSummary, {}),
10784
+ onContinueShopping && /* @__PURE__ */ jsxRuntime.jsxs(
10785
+ "button",
10786
+ {
10787
+ type: "button",
10788
+ onClick: onContinueShopping,
10789
+ className: "mt-6 inline-flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
10790
+ children: [
10791
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.5", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M10 19l-7-7m0 0l7-7m-7 7h18" }) }),
10792
+ "Continue shopping"
10793
+ ]
10794
+ }
10795
+ )
10796
+ ] }),
10797
+ /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "lg:sticky lg:top-6 h-fit", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl bg-muted/40 p-6 space-y-5", children: [
10798
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold uppercase tracking-[0.16em] text-muted-foreground m-0", children: "Summary" }),
10728
10799
  showDiscount && /* @__PURE__ */ jsxRuntime.jsx(
10729
10800
  DiscountInput,
10730
10801
  {
@@ -10733,28 +10804,34 @@ function DefaultCartLayout({
10733
10804
  onClear: onDiscountClear
10734
10805
  }
10735
10806
  ),
10736
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 text-sm", children: [
10737
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
10738
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Subtotal" }),
10739
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal })
10807
+ /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "space-y-2 text-sm", children: [
10808
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
10809
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-muted-foreground", children: "Subtotal" }),
10810
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal }) })
10740
10811
  ] }),
10741
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
10742
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Tax" }),
10743
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.tax })
10812
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
10813
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-muted-foreground", children: "Tax" }),
10814
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.tax }) })
10744
10815
  ] }),
10745
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between font-semibold text-base pt-2 border-t border-border", children: [
10746
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Total" }),
10747
- /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.total })
10816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between pt-3 mt-1 border-t border-border", children: [
10817
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-semibold", children: "Total" }),
10818
+ /* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 text-lg font-bold tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.total }) })
10748
10819
  ] })
10749
10820
  ] }),
10821
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-muted-foreground", children: "Shipping calculated at checkout." }),
10750
10822
  /* @__PURE__ */ jsxRuntime.jsx(
10751
10823
  "button",
10752
10824
  {
10825
+ type: "button",
10753
10826
  onClick: onCheckout,
10754
- className: "w-full h-12 bg-foreground text-background font-medium text-sm rounded-lg hover:bg-foreground/90 transition-colors",
10827
+ className: "w-full h-12 rounded-full bg-foreground text-background font-semibold text-sm hover:bg-foreground/90 active:scale-[0.99] transition-all",
10755
10828
  children: checkoutLabel
10756
10829
  }
10757
- )
10830
+ ),
10831
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-1.5 text-[10px] text-muted-foreground/70 uppercase tracking-wider", children: [
10832
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" }) }),
10833
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Secure checkout" })
10834
+ ] })
10758
10835
  ] }) })
10759
10836
  ] })
10760
10837
  ] });
@@ -10840,6 +10917,236 @@ function CartPage({
10840
10917
  }
10841
10918
  ) });
10842
10919
  }
10920
+ var CartDrawerContext = React10.createContext(null);
10921
+ function useCartDrawer() {
10922
+ const ctx = React10.useContext(CartDrawerContext);
10923
+ if (!ctx) {
10924
+ throw new Error("useCartDrawer must be used within <CartDrawerProvider>");
10925
+ }
10926
+ return ctx;
10927
+ }
10928
+ function CartDrawerProvider({ children, openOnAdd = true }) {
10929
+ const [isOpen, setIsOpen] = React10.useState(false);
10930
+ const cart = useCart();
10931
+ const lastPendingRef = React10.useRef(0);
10932
+ const open = React10.useCallback(() => setIsOpen(true), []);
10933
+ const close = React10.useCallback(() => setIsOpen(false), []);
10934
+ const toggle = React10.useCallback(() => setIsOpen((v) => !v), []);
10935
+ React10.useEffect(() => {
10936
+ if (!openOnAdd) return;
10937
+ if (cart.pendingOpCount > lastPendingRef.current && cart.pendingOpCount > 0) {
10938
+ setIsOpen(true);
10939
+ }
10940
+ lastPendingRef.current = cart.pendingOpCount;
10941
+ }, [cart.pendingOpCount, openOnAdd]);
10942
+ const value = React10.useMemo(() => ({ isOpen, open, close, toggle }), [isOpen, open, close, toggle]);
10943
+ return /* @__PURE__ */ jsxRuntime.jsx(CartDrawerContext.Provider, { value, children });
10944
+ }
10945
+ function useAnimatedNumber(target, durationMs = 250) {
10946
+ const [value, setValue] = React10.useState(target);
10947
+ const fromRef = React10.useRef(target);
10948
+ const startRef = React10.useRef(null);
10949
+ React10.useEffect(() => {
10950
+ fromRef.current = value;
10951
+ startRef.current = null;
10952
+ let raf = 0;
10953
+ const tick = (t) => {
10954
+ if (startRef.current == null) startRef.current = t;
10955
+ const p = Math.min(1, (t - startRef.current) / durationMs);
10956
+ const eased = 1 - Math.pow(1 - p, 3);
10957
+ setValue(fromRef.current + (target - fromRef.current) * eased);
10958
+ if (p < 1) raf = requestAnimationFrame(tick);
10959
+ };
10960
+ raf = requestAnimationFrame(tick);
10961
+ return () => cancelAnimationFrame(raf);
10962
+ }, [target, durationMs]);
10963
+ return value;
10964
+ }
10965
+ function CartDrawer({
10966
+ onCheckout,
10967
+ onContinueShopping,
10968
+ onShop,
10969
+ title = "Cart",
10970
+ freeShippingThreshold = 0,
10971
+ className
10972
+ }) {
10973
+ const { isOpen, close } = useCartDrawer();
10974
+ const cart = useCart();
10975
+ const subtotalNum = chunkV2O5AO7I_js.parsePrice(cart.subtotal);
10976
+ const animatedSubtotal = useAnimatedNumber(subtotalNum);
10977
+ React10.useEffect(() => {
10978
+ if (!isOpen) return;
10979
+ const original = document.body.style.overflow;
10980
+ document.body.style.overflow = "hidden";
10981
+ const onKey = (e) => {
10982
+ if (e.key === "Escape") close();
10983
+ };
10984
+ window.addEventListener("keydown", onKey);
10985
+ return () => {
10986
+ document.body.style.overflow = original;
10987
+ window.removeEventListener("keydown", onKey);
10988
+ };
10989
+ }, [isOpen, close]);
10990
+ const handleCheckout = () => {
10991
+ close();
10992
+ onCheckout?.();
10993
+ };
10994
+ const handleContinue = () => {
10995
+ onContinueShopping?.();
10996
+ close();
10997
+ };
10998
+ const handleShop = () => {
10999
+ onShop?.();
11000
+ close();
11001
+ };
11002
+ const showShippingBar = freeShippingThreshold > 0 && !cart.isEmpty;
11003
+ const remainingForShipping = Math.max(0, freeShippingThreshold - subtotalNum);
11004
+ const shippingProgress = freeShippingThreshold > 0 ? Math.min(100, subtotalNum / freeShippingThreshold * 100) : 0;
11005
+ const shippingUnlocked = subtotalNum >= freeShippingThreshold && freeShippingThreshold > 0;
11006
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11007
+ "div",
11008
+ {
11009
+ "data-cimplify-cart-drawer": true,
11010
+ "data-open": isOpen ? "true" : "false",
11011
+ "aria-hidden": !isOpen,
11012
+ className: cn(
11013
+ "fixed inset-0 z-[200]",
11014
+ isOpen ? "pointer-events-auto" : "pointer-events-none"
11015
+ ),
11016
+ children: [
11017
+ /* @__PURE__ */ jsxRuntime.jsx(
11018
+ "div",
11019
+ {
11020
+ onClick: close,
11021
+ className: cn(
11022
+ "absolute inset-0 bg-foreground/40 backdrop-blur-sm transition-opacity duration-300",
11023
+ isOpen ? "opacity-100" : "opacity-0"
11024
+ )
11025
+ }
11026
+ ),
11027
+ /* @__PURE__ */ jsxRuntime.jsxs(
11028
+ "aside",
11029
+ {
11030
+ role: "dialog",
11031
+ "aria-modal": "true",
11032
+ "aria-label": title,
11033
+ className: cn(
11034
+ "absolute top-0 right-0 h-full w-full sm:max-w-[480px] bg-background shadow-2xl flex flex-col",
11035
+ "transition-transform duration-300",
11036
+ isOpen ? "translate-x-0" : "translate-x-full",
11037
+ // ease-out cubic-bezier for a "pull" feel
11038
+ "[transition-timing-function:cubic-bezier(0.16,1,0.3,1)]",
11039
+ className
11040
+ ),
11041
+ children: [
11042
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "relative flex items-center justify-between gap-4 px-6 py-5 shrink-0", children: [
11043
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-2", children: [
11044
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-bold tracking-tight m-0", children: title }),
11045
+ cart.itemCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground tabular-nums", children: [
11046
+ cart.itemCount,
11047
+ " ",
11048
+ cart.itemCount === 1 ? "item" : "items"
11049
+ ] })
11050
+ ] }),
11051
+ /* @__PURE__ */ jsxRuntime.jsx(
11052
+ "button",
11053
+ {
11054
+ type: "button",
11055
+ onClick: close,
11056
+ "aria-label": "Close cart",
11057
+ className: "grid place-items-center w-9 h-9 rounded-full hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
11058
+ children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
11059
+ }
11060
+ )
11061
+ ] }),
11062
+ showShippingBar && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-shipping-bar": true, className: "px-6 pb-4 shrink-0", children: [
11063
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-baseline justify-between gap-2 mb-1.5 text-xs", children: shippingUnlocked ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "\u2713 Free shipping unlocked" }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
11064
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: remainingForShipping, className: "font-semibold text-foreground" }),
11065
+ " away from free shipping"
11066
+ ] }) }),
11067
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1 rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
11068
+ "div",
11069
+ {
11070
+ className: "h-full bg-primary transition-[width] duration-500 ease-out",
11071
+ style: { width: `${shippingProgress}%` }
11072
+ }
11073
+ ) })
11074
+ ] }),
11075
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto px-6", children: cart.isEmpty ? /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { onShop: handleShop }) : /* @__PURE__ */ jsxRuntime.jsx(CartSummary, {}) }),
11076
+ !cart.isEmpty && /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "border-t border-border px-6 py-5 shrink-0 space-y-3 bg-background", children: [
11077
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
11078
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Subtotal" }),
11079
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: animatedSubtotal, className: "text-lg font-bold tabular-nums" })
11080
+ ] }),
11081
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-muted-foreground", children: "Tax and shipping calculated at checkout." }),
11082
+ /* @__PURE__ */ jsxRuntime.jsxs(
11083
+ "button",
11084
+ {
11085
+ type: "button",
11086
+ onClick: handleCheckout,
11087
+ className: "w-full h-12 rounded-full bg-foreground text-background font-semibold text-sm hover:bg-foreground/90 active:scale-[0.99] transition-all",
11088
+ children: [
11089
+ "Checkout \u2014 ",
11090
+ /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal, className: "tabular-nums" })
11091
+ ]
11092
+ }
11093
+ ),
11094
+ /* @__PURE__ */ jsxRuntime.jsx(
11095
+ "button",
11096
+ {
11097
+ type: "button",
11098
+ onClick: handleContinue,
11099
+ className: "w-full text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",
11100
+ children: "Continue shopping"
11101
+ }
11102
+ ),
11103
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-1.5 text-[10px] text-muted-foreground/70 uppercase tracking-wider pt-1", children: [
11104
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" }) }),
11105
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Secure checkout" })
11106
+ ] })
11107
+ ] })
11108
+ ]
11109
+ }
11110
+ )
11111
+ ]
11112
+ }
11113
+ );
11114
+ }
11115
+ function EmptyState({ onShop }) {
11116
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-cimplify-cart-empty": true, className: "h-full grid place-items-center text-center py-16", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5 max-w-[260px]", children: [
11117
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-20 h-20 mx-auto", children: [
11118
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-muted" }),
11119
+ /* @__PURE__ */ jsxRuntime.jsx(
11120
+ "svg",
11121
+ {
11122
+ className: "relative w-10 h-10 m-auto top-1/2 -translate-y-1/2 text-muted-foreground/60",
11123
+ fill: "none",
11124
+ stroke: "currentColor",
11125
+ strokeWidth: "1.5",
11126
+ viewBox: "0 0 24 24",
11127
+ "aria-hidden": true,
11128
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l-1 12H6L5 9z" })
11129
+ }
11130
+ )
11131
+ ] }),
11132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
11133
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-semibold m-0", children: "Your cart is empty" }),
11134
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Discover something you'll love." })
11135
+ ] }),
11136
+ /* @__PURE__ */ jsxRuntime.jsxs(
11137
+ "button",
11138
+ {
11139
+ type: "button",
11140
+ onClick: onShop,
11141
+ className: "inline-flex items-center gap-1.5 h-11 px-6 rounded-full bg-foreground text-background text-sm font-semibold hover:bg-foreground/90 active:scale-[0.99] transition-all",
11142
+ children: [
11143
+ "Shop now",
11144
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2.5", viewBox: "0 0 24 24", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14 5l7 7m0 0l-7 7m7-7H3" }) })
11145
+ ]
11146
+ }
11147
+ )
11148
+ ] }) });
11149
+ }
10843
11150
  function CheckoutPage({
10844
11151
  title = "Checkout",
10845
11152
  onComplete,
@@ -12688,6 +12995,8 @@ exports.BundleSelector = BundleSelector;
12688
12995
  exports.CardImage = CardImage;
12689
12996
  exports.CardShell = CardShell;
12690
12997
  exports.CardVariant = CardVariant;
12998
+ exports.CartDrawer = CartDrawer;
12999
+ exports.CartDrawerProvider = CartDrawerProvider;
12691
13000
  exports.CartPage = CartPage;
12692
13001
  exports.CartSummary = CartSummary;
12693
13002
  exports.CartTemplate = CartTemplate;
@@ -12787,6 +13096,7 @@ exports.useBookings = useBookings;
12787
13096
  exports.useBootstrap = useBootstrap;
12788
13097
  exports.useBundles = useBundles;
12789
13098
  exports.useCart = useCart;
13099
+ exports.useCartDrawer = useCartDrawer;
12790
13100
  exports.useCategories = useCategories;
12791
13101
  exports.useChat = useChat;
12792
13102
  exports.useCheckout = useCheckout;