@cimplify/sdk 0.44.8 → 0.44.11
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/mock/cli.mjs +100 -5
- package/dist/mock/library.d.mts +2 -2
- package/dist/mock/library.d.ts +2 -2
- package/dist/mock/library.js +100 -5
- package/dist/mock/library.mjs +100 -5
- package/dist/mock/msw.d.mts +1 -1
- package/dist/mock/msw.d.ts +1 -1
- package/dist/mock/msw.js +100 -5
- package/dist/mock/msw.mjs +100 -5
- package/dist/react.d.mts +13 -5
- package/dist/react.d.ts +13 -5
- package/dist/react.js +373 -215
- package/dist/react.mjs +373 -215
- package/dist/{server-DD-Cd1Ob.d.mts → server-CUbuQxOV.d.mts} +32 -0
- package/dist/{server-DD-Cd1Ob.d.ts → server-CUbuQxOV.d.ts} +32 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/registry/cart-summary.json +1 -1
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
|
-
"
|
|
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.
|
|
6462
|
-
|
|
6463
|
-
|
|
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-
|
|
6466
|
-
className:
|
|
6467
|
-
children:
|
|
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.
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
6496
|
-
"
|
|
6497
|
-
" Instant digital delivery"
|
|
6498
|
-
] })
|
|
6499
|
-
item.bundleResolved
|
|
6500
|
-
|
|
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
|
-
|
|
6526
|
-
|
|
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
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
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
|
);
|
|
@@ -6565,6 +6613,8 @@ function CartSummary({
|
|
|
6565
6613
|
onItemRemove,
|
|
6566
6614
|
onQuantityChange,
|
|
6567
6615
|
emptyMessage = "Your cart is empty",
|
|
6616
|
+
showTotals = true,
|
|
6617
|
+
showCheckoutButton,
|
|
6568
6618
|
className,
|
|
6569
6619
|
classNames
|
|
6570
6620
|
}) {
|
|
@@ -6615,45 +6665,55 @@ function CartSummary({
|
|
|
6615
6665
|
},
|
|
6616
6666
|
item.id
|
|
6617
6667
|
)) }),
|
|
6618
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6668
|
+
showTotals && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6669
|
+
"div",
|
|
6670
|
+
{
|
|
6671
|
+
"data-cimplify-cart-totals": true,
|
|
6672
|
+
className: cn("mt-6 pt-4 border-t border-border space-y-2 text-sm", classNames?.totals),
|
|
6673
|
+
children: [
|
|
6674
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-subtotal": true, className: cn("flex items-baseline justify-between", classNames?.subtotal), children: [
|
|
6675
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
|
|
6676
|
+
"Subtotal (",
|
|
6677
|
+
itemCount,
|
|
6678
|
+
" ",
|
|
6679
|
+
itemCount === 1 ? "item" : "items",
|
|
6680
|
+
")"
|
|
6681
|
+
] }),
|
|
6682
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: subtotal, className: "tabular-nums" })
|
|
6683
|
+
] }),
|
|
6684
|
+
totalDiscounts != null && chunkV2O5AO7I_js.parsePrice(totalDiscounts) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-discount": true, className: cn("flex items-baseline justify-between", classNames?.discount), children: [
|
|
6685
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Discount" }),
|
|
6686
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: totalDiscounts, prefix: "-", className: "tabular-nums text-primary" })
|
|
6687
|
+
] }),
|
|
6688
|
+
deliveryFee != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-delivery-fee": true, className: cn("flex items-baseline justify-between", classNames?.deliveryFee), children: [
|
|
6689
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Delivery" }),
|
|
6690
|
+
chunkV2O5AO7I_js.parsePrice(deliveryFee) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: deliveryFee, className: "tabular-nums" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-primary", children: "Free" })
|
|
6691
|
+
] }),
|
|
6692
|
+
serviceCharge != null && chunkV2O5AO7I_js.parsePrice(serviceCharge) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-service-charge": true, className: cn("flex items-baseline justify-between", classNames?.serviceCharge), children: [
|
|
6693
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Service charge" }),
|
|
6694
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: serviceCharge, className: "tabular-nums" })
|
|
6695
|
+
] }),
|
|
6696
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-tax": true, className: cn("flex items-baseline justify-between", classNames?.tax), children: [
|
|
6697
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Tax" }),
|
|
6698
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: tax, className: "tabular-nums" })
|
|
6699
|
+
] }),
|
|
6700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-total": true, className: cn("flex items-baseline justify-between pt-3 mt-1 border-t border-border", classNames?.total), children: [
|
|
6701
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold", children: "Total" }),
|
|
6702
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: total, className: "text-base font-bold tabular-nums" })
|
|
6703
|
+
] })
|
|
6704
|
+
]
|
|
6705
|
+
}
|
|
6706
|
+
),
|
|
6707
|
+
(showCheckoutButton ?? Boolean(onCheckout)) && onCheckout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6651
6708
|
"button",
|
|
6652
6709
|
{
|
|
6653
6710
|
type: "button",
|
|
6654
6711
|
onClick: onCheckout,
|
|
6655
6712
|
"data-cimplify-cart-checkout": true,
|
|
6656
|
-
className:
|
|
6713
|
+
className: cn(
|
|
6714
|
+
"mt-4 w-full h-12 rounded-full bg-foreground text-background font-semibold text-sm hover:bg-foreground/90 active:scale-[0.99] transition-all",
|
|
6715
|
+
classNames?.checkout
|
|
6716
|
+
),
|
|
6657
6717
|
children: "Proceed to Checkout"
|
|
6658
6718
|
}
|
|
6659
6719
|
)
|
|
@@ -10689,42 +10749,65 @@ function DefaultCartLayout({
|
|
|
10689
10749
|
className
|
|
10690
10750
|
}) {
|
|
10691
10751
|
if (cart.isEmpty) {
|
|
10692
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("text-center py-
|
|
10693
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10752
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("max-w-md mx-auto text-center py-24", className), children: [
|
|
10753
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-24 h-24 mx-auto mb-6", children: [
|
|
10754
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-muted" }),
|
|
10755
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10756
|
+
"svg",
|
|
10757
|
+
{
|
|
10758
|
+
className: "relative w-12 h-12 m-auto top-1/2 -translate-y-1/2 text-muted-foreground/60",
|
|
10759
|
+
fill: "none",
|
|
10760
|
+
stroke: "currentColor",
|
|
10761
|
+
strokeWidth: "1.5",
|
|
10762
|
+
viewBox: "0 0 24 24",
|
|
10763
|
+
"aria-hidden": true,
|
|
10764
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l-1 12H6L5 9z" })
|
|
10765
|
+
}
|
|
10766
|
+
)
|
|
10767
|
+
] }),
|
|
10768
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-bold tracking-tight m-0", children: "Your cart is empty" }),
|
|
10769
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-2", children: "Browse the shop and add something you'll love." }),
|
|
10770
|
+
onContinueShopping && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10697
10771
|
"button",
|
|
10698
10772
|
{
|
|
10773
|
+
type: "button",
|
|
10699
10774
|
onClick: onContinueShopping,
|
|
10700
|
-
className: "text-sm font-
|
|
10701
|
-
children:
|
|
10775
|
+
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",
|
|
10776
|
+
children: [
|
|
10777
|
+
"Shop now",
|
|
10778
|
+
/* @__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" }) })
|
|
10779
|
+
]
|
|
10702
10780
|
}
|
|
10703
10781
|
)
|
|
10704
10782
|
] });
|
|
10705
10783
|
}
|
|
10706
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("space-y-
|
|
10707
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
10708
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10709
|
-
|
|
10784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-layout": "default", className: cn("space-y-8", className), children: [
|
|
10785
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-baseline justify-between gap-4", children: [
|
|
10786
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-3xl sm:text-4xl font-bold tracking-tight m-0", children: "Cart" }),
|
|
10787
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground tabular-nums", children: [
|
|
10710
10788
|
cart.itemCount,
|
|
10711
10789
|
" ",
|
|
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
|
-
)
|
|
10790
|
+
cart.itemCount === 1 ? "item" : "items"
|
|
10791
|
+
] })
|
|
10723
10792
|
] }),
|
|
10724
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-[
|
|
10725
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10726
|
-
|
|
10727
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10793
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-[1fr_360px] gap-10", children: [
|
|
10794
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
10795
|
+
/* @__PURE__ */ jsxRuntime.jsx(CartSummary, { showTotals: false, showCheckoutButton: false }),
|
|
10796
|
+
onContinueShopping && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10797
|
+
"button",
|
|
10798
|
+
{
|
|
10799
|
+
type: "button",
|
|
10800
|
+
onClick: onContinueShopping,
|
|
10801
|
+
className: "mt-6 inline-flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
10802
|
+
children: [
|
|
10803
|
+
/* @__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" }) }),
|
|
10804
|
+
"Continue shopping"
|
|
10805
|
+
]
|
|
10806
|
+
}
|
|
10807
|
+
)
|
|
10808
|
+
] }),
|
|
10809
|
+
/* @__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: [
|
|
10810
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold uppercase tracking-[0.16em] text-muted-foreground m-0", children: "Summary" }),
|
|
10728
10811
|
showDiscount && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10729
10812
|
DiscountInput,
|
|
10730
10813
|
{
|
|
@@ -10733,28 +10816,34 @@ function DefaultCartLayout({
|
|
|
10733
10816
|
onClear: onDiscountClear
|
|
10734
10817
|
}
|
|
10735
10818
|
),
|
|
10736
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
10737
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
|
|
10738
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
10739
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal })
|
|
10819
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "space-y-2 text-sm", children: [
|
|
10820
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
10821
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-muted-foreground", children: "Subtotal" }),
|
|
10822
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal }) })
|
|
10740
10823
|
] }),
|
|
10741
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
|
|
10742
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
10743
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.tax })
|
|
10824
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
10825
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-muted-foreground", children: "Tax" }),
|
|
10826
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.tax }) })
|
|
10744
10827
|
] }),
|
|
10745
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between
|
|
10746
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
10747
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.total })
|
|
10828
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between pt-3 mt-1 border-t border-border", children: [
|
|
10829
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "font-semibold", children: "Total" }),
|
|
10830
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "m-0 text-lg font-bold tabular-nums", children: /* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.total }) })
|
|
10748
10831
|
] })
|
|
10749
10832
|
] }),
|
|
10833
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-muted-foreground", children: "Shipping calculated at checkout." }),
|
|
10750
10834
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10751
10835
|
"button",
|
|
10752
10836
|
{
|
|
10837
|
+
type: "button",
|
|
10753
10838
|
onClick: onCheckout,
|
|
10754
|
-
className: "w-full h-12 bg-foreground text-background font-
|
|
10839
|
+
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
10840
|
children: checkoutLabel
|
|
10756
10841
|
}
|
|
10757
|
-
)
|
|
10842
|
+
),
|
|
10843
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-1.5 text-[10px] text-muted-foreground/70 uppercase tracking-wider", children: [
|
|
10844
|
+
/* @__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" }) }),
|
|
10845
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Secure checkout" })
|
|
10846
|
+
] })
|
|
10758
10847
|
] }) })
|
|
10759
10848
|
] })
|
|
10760
10849
|
] });
|
|
@@ -10851,28 +10940,52 @@ function useCartDrawer() {
|
|
|
10851
10940
|
function CartDrawerProvider({ children, openOnAdd = true }) {
|
|
10852
10941
|
const [isOpen, setIsOpen] = React10.useState(false);
|
|
10853
10942
|
const cart = useCart();
|
|
10854
|
-
const
|
|
10943
|
+
const lastPendingRef = React10.useRef(0);
|
|
10855
10944
|
const open = React10.useCallback(() => setIsOpen(true), []);
|
|
10856
10945
|
const close = React10.useCallback(() => setIsOpen(false), []);
|
|
10857
10946
|
const toggle = React10.useCallback(() => setIsOpen((v) => !v), []);
|
|
10858
10947
|
React10.useEffect(() => {
|
|
10859
10948
|
if (!openOnAdd) return;
|
|
10860
|
-
if (cart.pendingOpCount >
|
|
10949
|
+
if (cart.pendingOpCount > lastPendingRef.current && cart.pendingOpCount > 0) {
|
|
10861
10950
|
setIsOpen(true);
|
|
10862
10951
|
}
|
|
10863
|
-
|
|
10864
|
-
}, [cart.pendingOpCount,
|
|
10952
|
+
lastPendingRef.current = cart.pendingOpCount;
|
|
10953
|
+
}, [cart.pendingOpCount, openOnAdd]);
|
|
10865
10954
|
const value = React10.useMemo(() => ({ isOpen, open, close, toggle }), [isOpen, open, close, toggle]);
|
|
10866
10955
|
return /* @__PURE__ */ jsxRuntime.jsx(CartDrawerContext.Provider, { value, children });
|
|
10867
10956
|
}
|
|
10957
|
+
function useAnimatedNumber(target, durationMs = 250) {
|
|
10958
|
+
const [value, setValue] = React10.useState(target);
|
|
10959
|
+
const fromRef = React10.useRef(target);
|
|
10960
|
+
const startRef = React10.useRef(null);
|
|
10961
|
+
React10.useEffect(() => {
|
|
10962
|
+
fromRef.current = value;
|
|
10963
|
+
startRef.current = null;
|
|
10964
|
+
let raf = 0;
|
|
10965
|
+
const tick = (t) => {
|
|
10966
|
+
if (startRef.current == null) startRef.current = t;
|
|
10967
|
+
const p = Math.min(1, (t - startRef.current) / durationMs);
|
|
10968
|
+
const eased = 1 - Math.pow(1 - p, 3);
|
|
10969
|
+
setValue(fromRef.current + (target - fromRef.current) * eased);
|
|
10970
|
+
if (p < 1) raf = requestAnimationFrame(tick);
|
|
10971
|
+
};
|
|
10972
|
+
raf = requestAnimationFrame(tick);
|
|
10973
|
+
return () => cancelAnimationFrame(raf);
|
|
10974
|
+
}, [target, durationMs]);
|
|
10975
|
+
return value;
|
|
10976
|
+
}
|
|
10868
10977
|
function CartDrawer({
|
|
10869
10978
|
onCheckout,
|
|
10870
10979
|
onContinueShopping,
|
|
10871
|
-
|
|
10980
|
+
onShop,
|
|
10981
|
+
title = "Cart",
|
|
10982
|
+
freeShippingThreshold = 0,
|
|
10872
10983
|
className
|
|
10873
10984
|
}) {
|
|
10874
10985
|
const { isOpen, close } = useCartDrawer();
|
|
10875
10986
|
const cart = useCart();
|
|
10987
|
+
const subtotalNum = chunkV2O5AO7I_js.parsePrice(cart.subtotal);
|
|
10988
|
+
const animatedSubtotal = useAnimatedNumber(subtotalNum);
|
|
10876
10989
|
React10.useEffect(() => {
|
|
10877
10990
|
if (!isOpen) return;
|
|
10878
10991
|
const original = document.body.style.overflow;
|
|
@@ -10891,11 +11004,17 @@ function CartDrawer({
|
|
|
10891
11004
|
onCheckout?.();
|
|
10892
11005
|
};
|
|
10893
11006
|
const handleContinue = () => {
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
11007
|
+
onContinueShopping?.();
|
|
11008
|
+
close();
|
|
11009
|
+
};
|
|
11010
|
+
const handleShop = () => {
|
|
11011
|
+
onShop?.();
|
|
10897
11012
|
close();
|
|
10898
11013
|
};
|
|
11014
|
+
const showShippingBar = freeShippingThreshold > 0 && !cart.isEmpty;
|
|
11015
|
+
const remainingForShipping = Math.max(0, freeShippingThreshold - subtotalNum);
|
|
11016
|
+
const shippingProgress = freeShippingThreshold > 0 ? Math.min(100, subtotalNum / freeShippingThreshold * 100) : 0;
|
|
11017
|
+
const shippingUnlocked = subtotalNum >= freeShippingThreshold && freeShippingThreshold > 0;
|
|
10899
11018
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10900
11019
|
"div",
|
|
10901
11020
|
{
|
|
@@ -10912,7 +11031,7 @@ function CartDrawer({
|
|
|
10912
11031
|
{
|
|
10913
11032
|
onClick: close,
|
|
10914
11033
|
className: cn(
|
|
10915
|
-
"absolute inset-0 bg-foreground/40 backdrop-blur-sm transition-opacity duration-
|
|
11034
|
+
"absolute inset-0 bg-foreground/40 backdrop-blur-sm transition-opacity duration-300",
|
|
10916
11035
|
isOpen ? "opacity-100" : "opacity-0"
|
|
10917
11036
|
)
|
|
10918
11037
|
}
|
|
@@ -10924,20 +11043,21 @@ function CartDrawer({
|
|
|
10924
11043
|
"aria-modal": "true",
|
|
10925
11044
|
"aria-label": title,
|
|
10926
11045
|
className: cn(
|
|
10927
|
-
"absolute top-0 right-0 h-full w-full sm:max-w-
|
|
11046
|
+
"absolute top-0 right-0 h-full w-full sm:max-w-[480px] bg-background shadow-2xl flex flex-col",
|
|
11047
|
+
"transition-transform duration-300",
|
|
10928
11048
|
isOpen ? "translate-x-0" : "translate-x-full",
|
|
11049
|
+
// ease-out cubic-bezier for a "pull" feel
|
|
11050
|
+
"[transition-timing-function:cubic-bezier(0.16,1,0.3,1)]",
|
|
10929
11051
|
className
|
|
10930
11052
|
),
|
|
10931
11053
|
children: [
|
|
10932
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-center justify-between gap-4 px-6 py-
|
|
10933
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
10934
|
-
title,
|
|
10935
|
-
cart.itemCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "
|
|
10936
|
-
"(",
|
|
11054
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "relative flex items-center justify-between gap-4 px-6 py-5 shrink-0", children: [
|
|
11055
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-2", children: [
|
|
11056
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-bold tracking-tight m-0", children: title }),
|
|
11057
|
+
cart.itemCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-muted-foreground tabular-nums", children: [
|
|
10937
11058
|
cart.itemCount,
|
|
10938
11059
|
" ",
|
|
10939
|
-
cart.itemCount === 1 ? "item" : "items"
|
|
10940
|
-
")"
|
|
11060
|
+
cart.itemCount === 1 ? "item" : "items"
|
|
10941
11061
|
] })
|
|
10942
11062
|
] }),
|
|
10943
11063
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10946,52 +11066,55 @@ function CartDrawer({
|
|
|
10946
11066
|
type: "button",
|
|
10947
11067
|
onClick: close,
|
|
10948
11068
|
"aria-label": "Close cart",
|
|
10949
|
-
className: "grid place-items-center w-
|
|
10950
|
-
children: "
|
|
11069
|
+
className: "grid place-items-center w-9 h-9 rounded-full hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
|
|
11070
|
+
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" }) })
|
|
10951
11071
|
}
|
|
10952
11072
|
)
|
|
10953
11073
|
] }),
|
|
10954
|
-
/* @__PURE__ */ jsxRuntime.
|
|
11074
|
+
showShippingBar && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-shipping-bar": true, className: "px-6 pb-4 shrink-0", children: [
|
|
11075
|
+
/* @__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: [
|
|
11076
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: remainingForShipping, className: "font-semibold text-foreground" }),
|
|
11077
|
+
" away from free shipping"
|
|
11078
|
+
] }) }),
|
|
11079
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1 rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
11080
|
+
"div",
|
|
11081
|
+
{
|
|
11082
|
+
className: "h-full bg-primary transition-[width] duration-500 ease-out",
|
|
11083
|
+
style: { width: `${shippingProgress}%` }
|
|
11084
|
+
}
|
|
11085
|
+
) })
|
|
11086
|
+
] }),
|
|
11087
|
+
/* @__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, { showTotals: false, showCheckoutButton: false }) }),
|
|
11088
|
+
!cart.isEmpty && /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "border-t border-border px-6 py-5 shrink-0 space-y-3 bg-background", children: [
|
|
11089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between", children: [
|
|
11090
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Subtotal" }),
|
|
11091
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: animatedSubtotal, className: "text-lg font-bold tabular-nums" })
|
|
11092
|
+
] }),
|
|
11093
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] text-muted-foreground", children: "Tax and shipping calculated at checkout." }),
|
|
11094
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11095
|
+
"button",
|
|
11096
|
+
{
|
|
11097
|
+
type: "button",
|
|
11098
|
+
onClick: handleCheckout,
|
|
11099
|
+
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",
|
|
11100
|
+
children: [
|
|
11101
|
+
"Checkout \u2014 ",
|
|
11102
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal, className: "tabular-nums" })
|
|
11103
|
+
]
|
|
11104
|
+
}
|
|
11105
|
+
),
|
|
10955
11106
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10956
|
-
"
|
|
11107
|
+
"button",
|
|
10957
11108
|
{
|
|
10958
|
-
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
viewBox: "0 0 24 24",
|
|
10963
|
-
"aria-hidden": true,
|
|
10964
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z" })
|
|
11109
|
+
type: "button",
|
|
11110
|
+
onClick: handleContinue,
|
|
11111
|
+
className: "w-full text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
11112
|
+
children: "Continue shopping"
|
|
10965
11113
|
}
|
|
10966
11114
|
),
|
|
10967
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
!cart.isEmpty && /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: "border-t border-border px-6 py-4 space-y-3 shrink-0", children: [
|
|
10971
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between text-sm", children: [
|
|
10972
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Subtotal" }),
|
|
10973
|
-
/* @__PURE__ */ jsxRuntime.jsx(Price, { amount: cart.subtotal, className: "font-semibold text-base" })
|
|
10974
|
-
] }),
|
|
10975
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Tax and delivery calculated at checkout." }),
|
|
10976
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 pt-1", children: [
|
|
10977
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10978
|
-
"button",
|
|
10979
|
-
{
|
|
10980
|
-
type: "button",
|
|
10981
|
-
onClick: handleCheckout,
|
|
10982
|
-
className: "w-full h-11 rounded-md bg-foreground text-background font-medium text-sm hover:bg-foreground/90 transition-colors",
|
|
10983
|
-
children: "Checkout"
|
|
10984
|
-
}
|
|
10985
|
-
),
|
|
10986
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10987
|
-
"button",
|
|
10988
|
-
{
|
|
10989
|
-
type: "button",
|
|
10990
|
-
onClick: handleContinue,
|
|
10991
|
-
className: "w-full h-10 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",
|
|
10992
|
-
children: "Continue shopping"
|
|
10993
|
-
}
|
|
10994
|
-
)
|
|
11115
|
+
/* @__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: [
|
|
11116
|
+
/* @__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" }) }),
|
|
11117
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Secure checkout" })
|
|
10995
11118
|
] })
|
|
10996
11119
|
] })
|
|
10997
11120
|
]
|
|
@@ -11001,6 +11124,41 @@ function CartDrawer({
|
|
|
11001
11124
|
}
|
|
11002
11125
|
);
|
|
11003
11126
|
}
|
|
11127
|
+
function EmptyState({ onShop }) {
|
|
11128
|
+
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: [
|
|
11129
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-20 h-20 mx-auto", children: [
|
|
11130
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-muted" }),
|
|
11131
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11132
|
+
"svg",
|
|
11133
|
+
{
|
|
11134
|
+
className: "relative w-10 h-10 m-auto top-1/2 -translate-y-1/2 text-muted-foreground/60",
|
|
11135
|
+
fill: "none",
|
|
11136
|
+
stroke: "currentColor",
|
|
11137
|
+
strokeWidth: "1.5",
|
|
11138
|
+
viewBox: "0 0 24 24",
|
|
11139
|
+
"aria-hidden": true,
|
|
11140
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M16 11V7a4 4 0 00-8 0v4M5 9h14l-1 12H6L5 9z" })
|
|
11141
|
+
}
|
|
11142
|
+
)
|
|
11143
|
+
] }),
|
|
11144
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
11145
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-semibold m-0", children: "Your cart is empty" }),
|
|
11146
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Discover something you'll love." })
|
|
11147
|
+
] }),
|
|
11148
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11149
|
+
"button",
|
|
11150
|
+
{
|
|
11151
|
+
type: "button",
|
|
11152
|
+
onClick: onShop,
|
|
11153
|
+
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",
|
|
11154
|
+
children: [
|
|
11155
|
+
"Shop now",
|
|
11156
|
+
/* @__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" }) })
|
|
11157
|
+
]
|
|
11158
|
+
}
|
|
11159
|
+
)
|
|
11160
|
+
] }) });
|
|
11161
|
+
}
|
|
11004
11162
|
function CheckoutPage({
|
|
11005
11163
|
title = "Checkout",
|
|
11006
11164
|
onComplete,
|