@cimplify/sdk 0.68.0 → 0.69.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.mjs CHANGED
@@ -6,7 +6,7 @@ import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-SOV4H6PQ.mjs';
6
6
  import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
7
7
  import { isSupportedCurrency } from './chunk-AMZXALF6.mjs';
8
8
  import './chunk-3G6RQLXK.mjs';
9
- import React12, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
9
+ import React14, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
10
10
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
11
11
  import { clsx } from 'clsx';
12
12
  import { twMerge } from 'tailwind-merge';
@@ -1427,14 +1427,14 @@ function CimplifyCheckout({
1427
1427
  const resolvedCartRef = useRef(resolvedCart);
1428
1428
  resolvedCartRef.current = resolvedCart;
1429
1429
  const isDark = appearance?.theme === "dark";
1430
- const emitStatus = React12.useEffectEvent(
1430
+ const emitStatus = React14.useEffectEvent(
1431
1431
  (nextStatus, context = {}) => {
1432
1432
  setStatus(nextStatus);
1433
1433
  setStatusText(context.display_text || "");
1434
1434
  onStatusChange?.(nextStatus, context);
1435
1435
  }
1436
1436
  );
1437
- const fireError = React12.useEffectEvent(
1437
+ const fireError = React14.useEffectEvent(
1438
1438
  (error) => {
1439
1439
  onError?.(error);
1440
1440
  }
@@ -1530,7 +1530,7 @@ function CimplifyCheckout({
1530
1530
  activeCheckoutRef.current = null;
1531
1531
  };
1532
1532
  }, []);
1533
- const handleSubmit = React12.useEffectEvent(async () => {
1533
+ const handleSubmit = React14.useEffectEvent(async () => {
1534
1534
  if (isSubmitting || isInitializing || !resolvedCartId) {
1535
1535
  if (!resolvedCartId && !isInitializing) {
1536
1536
  const message = "Your cart is empty. Add items before checkout.";
@@ -1668,7 +1668,7 @@ var BUTTON_SIZES = {
1668
1668
  sm: "px-[13px] py-[7px] text-[12.5px]",
1669
1669
  md: "px-[18px] py-[10px] text-[13.5px]"
1670
1670
  };
1671
- var Button = React12.forwardRef(function Button2({ variant = "primary", size = "md", className, children, ...props }, ref) {
1671
+ var Button = React14.forwardRef(function Button2({ variant = "primary", size = "md", className, children, ...props }, ref) {
1672
1672
  return /* @__PURE__ */ jsx(
1673
1673
  "button",
1674
1674
  {
@@ -2449,6 +2449,560 @@ function ContextCard({ rows, className }) {
2449
2449
  }
2450
2450
  );
2451
2451
  }
2452
+ function RiderAvatar({ rider, size }) {
2453
+ if (rider.photoUrl) {
2454
+ return /* @__PURE__ */ jsx(
2455
+ "img",
2456
+ {
2457
+ src: rider.photoUrl,
2458
+ alt: "",
2459
+ className: "rounded-full object-cover",
2460
+ style: { width: size, height: size }
2461
+ }
2462
+ );
2463
+ }
2464
+ return /* @__PURE__ */ jsx(
2465
+ "span",
2466
+ {
2467
+ "aria-hidden": true,
2468
+ className: "grid place-items-center rounded-full font-serif font-semibold text-white",
2469
+ style: { width: size, height: size, fontSize: size * 0.38, background: avatarGradient(rider.name) },
2470
+ children: initials(rider.name)
2471
+ }
2472
+ );
2473
+ }
2474
+ function RiderMeta({ rider }) {
2475
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2476
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
2477
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: rider.name }),
2478
+ rider.rating !== void 0 && /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-xs font-semibold text-amber-500", children: [
2479
+ "\u2605 ",
2480
+ rider.rating.toFixed(1)
2481
+ ] })
2482
+ ] }),
2483
+ rider.vehicle && /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-foreground/55", children: rider.vehicle })
2484
+ ] });
2485
+ }
2486
+ function DotStep({ steps }) {
2487
+ const current = steps.find((s) => s.state === "current") ?? [...steps].reverse().find((s) => s.state === "done");
2488
+ return /* @__PURE__ */ jsxs("div", { className: "mt-3.5", children: [
2489
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5", children: steps.map((step, i) => /* @__PURE__ */ jsxs(React14.Fragment, { children: [
2490
+ i > 0 && /* @__PURE__ */ jsx(
2491
+ "span",
2492
+ {
2493
+ className: cn(
2494
+ "h-0.5 flex-1 rounded-full",
2495
+ steps[i - 1].state === "done" ? "bg-primary" : "bg-border"
2496
+ )
2497
+ }
2498
+ ),
2499
+ /* @__PURE__ */ jsx(
2500
+ "span",
2501
+ {
2502
+ className: cn(
2503
+ "block size-[7px] shrink-0 rounded-full",
2504
+ step.state === "done" && "bg-primary",
2505
+ step.state === "current" && "bg-primary ring-4 ring-primary/15",
2506
+ step.state === "pending" && "bg-border"
2507
+ )
2508
+ }
2509
+ )
2510
+ ] }, step.label)) }),
2511
+ current && /* @__PURE__ */ jsx("div", { className: "mt-2 truncate text-center text-[11.5px] font-semibold text-primary", children: current.label })
2512
+ ] });
2513
+ }
2514
+ function DeliveryTracker({
2515
+ steps,
2516
+ statusLabel,
2517
+ etaLabel,
2518
+ rider,
2519
+ live,
2520
+ onTrackLive,
2521
+ onContactRider,
2522
+ variant = "card",
2523
+ className
2524
+ }) {
2525
+ return /* @__PURE__ */ jsx(
2526
+ "div",
2527
+ {
2528
+ "data-cimplify-delivery-tracker": true,
2529
+ "data-mode": live ? "live" : "steps",
2530
+ className: cn(
2531
+ "overflow-hidden",
2532
+ variant === "card" && "rounded-[var(--radius,12px)] border border-border/60 bg-card",
2533
+ className
2534
+ ),
2535
+ children: live ? /* @__PURE__ */ jsxs(Fragment, { children: [
2536
+ /* @__PURE__ */ jsxs("div", { className: "relative h-[216px] w-full overflow-hidden bg-muted", children: [
2537
+ live.map,
2538
+ /* @__PURE__ */ jsxs("div", { className: "absolute left-3 top-3 inline-flex items-center gap-1.5 rounded-full border border-border/40 bg-background/90 px-2.5 py-1 text-xs font-semibold shadow-sm backdrop-blur", children: [
2539
+ /* @__PURE__ */ jsx("span", { className: "relative size-[7px] rounded-full bg-emerald-500", children: /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-ping rounded-full bg-emerald-500" }) }),
2540
+ "Live"
2541
+ ] }),
2542
+ (live.etaLabel ?? etaLabel) && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-3 rounded-full bg-foreground px-3 py-1.5 text-xs font-semibold text-background shadow-lg", children: live.etaLabel ?? etaLabel })
2543
+ ] }),
2544
+ rider && /* @__PURE__ */ jsxs("div", { className: "relative z-[2] -mt-6 mx-3.5 mb-3.5 rounded-2xl border border-border/60 bg-card p-3.5 shadow-[0_10px_30px_-16px_rgba(16,24,40,0.32)]", children: [
2545
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
2546
+ /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
2547
+ /* @__PURE__ */ jsx(RiderAvatar, { rider, size: 46 }),
2548
+ /* @__PURE__ */ jsx("span", { className: "absolute -bottom-px -right-px size-3 rounded-full border-[2.5px] border-card bg-emerald-500" })
2549
+ ] }),
2550
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(RiderMeta, { rider }) }),
2551
+ (rider.etaLabel || rider.distanceLabel) && /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
2552
+ rider.etaLabel && /* @__PURE__ */ jsx("div", { className: "text-[15px] font-semibold tabular-nums text-foreground", children: rider.etaLabel }),
2553
+ rider.distanceLabel && /* @__PURE__ */ jsx("div", { className: "text-[11.5px] text-foreground/55", children: rider.distanceLabel })
2554
+ ] })
2555
+ ] }),
2556
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex gap-2", children: [
2557
+ /* @__PURE__ */ jsx(
2558
+ "button",
2559
+ {
2560
+ type: "button",
2561
+ onClick: onTrackLive,
2562
+ className: "h-10 flex-1 rounded-xl bg-primary text-sm font-semibold text-[var(--color-primary-foreground,#fff)] hover:brightness-105",
2563
+ children: "Track live"
2564
+ }
2565
+ ),
2566
+ /* @__PURE__ */ jsx(
2567
+ "button",
2568
+ {
2569
+ type: "button",
2570
+ onClick: onContactRider,
2571
+ "aria-label": `Contact ${rider.name}`,
2572
+ className: "grid size-10 place-items-center rounded-xl border border-border bg-card text-foreground hover:bg-muted/50",
2573
+ children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3 19.5 19.5 0 0 1-6-6 19.8 19.8 0 0 1-3-8.6A2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.2a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2Z" }) })
2574
+ }
2575
+ )
2576
+ ] }),
2577
+ /* @__PURE__ */ jsx(DotStep, { steps })
2578
+ ] })
2579
+ ] }) : /* @__PURE__ */ jsxs("div", { className: variant === "card" ? "p-4 sm:p-5" : "", children: [
2580
+ (statusLabel || etaLabel) && /* @__PURE__ */ jsxs("div", { className: "mb-4 flex items-center justify-between", children: [
2581
+ statusLabel && /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-amber-500/10 px-2.5 py-1 text-xs font-semibold text-amber-600", children: [
2582
+ /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-current" }),
2583
+ statusLabel
2584
+ ] }),
2585
+ etaLabel && /* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold tabular-nums text-foreground", children: etaLabel })
2586
+ ] }),
2587
+ /* @__PURE__ */ jsx("ol", { className: "relative ml-[9px] border-l-2 border-border", children: steps.map((step) => /* @__PURE__ */ jsxs("li", { className: "relative pb-4 pl-6 last:pb-0", children: [
2588
+ /* @__PURE__ */ jsxs(
2589
+ "span",
2590
+ {
2591
+ className: cn(
2592
+ "absolute -left-[9px] top-px grid size-[18px] place-items-center rounded-full border-2 bg-card",
2593
+ step.state === "done" && "border-primary bg-primary",
2594
+ step.state === "current" && "border-primary ring-4 ring-primary/15",
2595
+ step.state === "pending" && "border-border"
2596
+ ),
2597
+ children: [
2598
+ step.state === "done" && /* @__PURE__ */ jsx("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", strokeWidth: "3.5", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }),
2599
+ step.state === "current" && /* @__PURE__ */ jsx("span", { className: "size-[7px] rounded-full bg-primary" })
2600
+ ]
2601
+ }
2602
+ ),
2603
+ /* @__PURE__ */ jsx(
2604
+ "div",
2605
+ {
2606
+ className: cn(
2607
+ "text-[13px] font-semibold",
2608
+ step.state === "pending" ? "text-foreground/45" : "text-foreground"
2609
+ ),
2610
+ children: step.label
2611
+ }
2612
+ ),
2613
+ step.time && /* @__PURE__ */ jsx("div", { className: "text-xs text-foreground/55", children: step.time })
2614
+ ] }, step.label)) }),
2615
+ rider && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-3 border-t border-border/60 pt-4", children: [
2616
+ /* @__PURE__ */ jsx(RiderAvatar, { rider, size: 42 }),
2617
+ /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(RiderMeta, { rider }) }),
2618
+ /* @__PURE__ */ jsx(
2619
+ "button",
2620
+ {
2621
+ type: "button",
2622
+ onClick: onContactRider,
2623
+ className: "h-9 rounded-[10px] border border-border bg-card px-4 text-[13px] font-semibold text-foreground hover:bg-muted/50",
2624
+ children: "Contact"
2625
+ }
2626
+ )
2627
+ ] })
2628
+ ] })
2629
+ }
2630
+ );
2631
+ }
2632
+ var STATE_TONE = {
2633
+ preparing: "text-amber-600",
2634
+ ready: "text-emerald-600",
2635
+ delivered: "text-emerald-600",
2636
+ booked: "text-primary",
2637
+ cancelled: "text-destructive",
2638
+ default: "text-foreground/55"
2639
+ };
2640
+ function StateDot({ label, tone = "default" }) {
2641
+ return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1.5 text-xs font-medium", STATE_TONE[tone]), children: [
2642
+ /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-current" }),
2643
+ label
2644
+ ] });
2645
+ }
2646
+ var TYPE_GLYPH = {
2647
+ product: null,
2648
+ bundle: null,
2649
+ composite: null,
2650
+ service: /* @__PURE__ */ jsxs("svg", { width: "19", height: "19", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", children: [
2651
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "17", rx: "2" }),
2652
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18M8 2v4M16 2v4" })
2653
+ ] }),
2654
+ digital: /* @__PURE__ */ jsxs("svg", { width: "19", height: "19", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", children: [
2655
+ /* @__PURE__ */ jsx("path", { d: "M4 4h11l5 5v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1Z" }),
2656
+ /* @__PURE__ */ jsx("path", { d: "M14 4v5h5" })
2657
+ ] })
2658
+ };
2659
+ function Thumb({ item }) {
2660
+ const glyph = item.lineType ? TYPE_GLYPH[item.lineType] : null;
2661
+ return /* @__PURE__ */ jsx("div", { className: "mt-px size-[46px] shrink-0 overflow-hidden rounded-[10px] bg-muted/50", children: item.imageUrl ? /* @__PURE__ */ jsx("img", { src: item.imageUrl, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "grid size-full place-items-center text-foreground/35", children: glyph }) });
2662
+ }
2663
+ function AccountLineItem({ item, className }) {
2664
+ const [open, setOpen] = useState(false);
2665
+ const subtitle = item.subtitle ?? ([item.variant, item.addOns?.length ? `+ ${item.addOns.map((a) => a.name).join(", ")}` : null].filter(Boolean).join(" \xB7 ") || void 0);
2666
+ const hasDetail = !!item.customerInputs?.length || !!item.includes?.length || !!item.customisations?.length;
2667
+ return /* @__PURE__ */ jsx("div", { "data-cimplify-line-item": true, "data-type": item.lineType, className: cn("py-[15px]", className), children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[46px_minmax(0,1fr)_auto] items-start gap-x-[13px]", children: [
2668
+ /* @__PURE__ */ jsx(Thumb, { item }),
2669
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2670
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold leading-tight tracking-[-0.01em] text-foreground", children: item.name }),
2671
+ subtitle && /* @__PURE__ */ jsx("div", { className: "mt-0.5 text-[12.5px] text-foreground/55", children: subtitle }),
2672
+ item.scheduling && /* @__PURE__ */ jsxs("div", { className: "mt-0.5 text-[12.5px] text-foreground/55", children: [
2673
+ item.scheduling.whenLabel,
2674
+ item.scheduling.staffName && ` \xB7 with ${item.scheduling.staffName}`
2675
+ ] }),
2676
+ (item.stateLabel || item.scheduling?.confirmationCode || hasDetail || item.digital) && /* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-x-3 gap-y-1.5", children: [
2677
+ item.stateLabel && /* @__PURE__ */ jsx(StateDot, { label: item.stateLabel, tone: item.stateTone }),
2678
+ item.scheduling?.confirmationCode && /* @__PURE__ */ jsxs("span", { className: "text-xs text-foreground/45", children: [
2679
+ "#",
2680
+ item.scheduling.confirmationCode
2681
+ ] }),
2682
+ item.digital && /* @__PURE__ */ jsxs(Fragment, { children: [
2683
+ /* @__PURE__ */ jsx(
2684
+ StateDot,
2685
+ {
2686
+ label: item.digital.statusLabel,
2687
+ tone: item.digital.tone === "revoked" ? "cancelled" : "ready"
2688
+ }
2689
+ ),
2690
+ item.digital.usageSummary && /* @__PURE__ */ jsx("span", { className: "text-[11.5px] text-foreground/55", children: item.digital.usageSummary }),
2691
+ item.digital.onDownload && /* @__PURE__ */ jsxs(
2692
+ "button",
2693
+ {
2694
+ type: "button",
2695
+ onClick: item.digital.onDownload,
2696
+ className: "inline-flex items-center gap-1.5 text-xs font-semibold text-primary hover:underline",
2697
+ children: [
2698
+ /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M12 3v12m0 0 4-4m-4 4-4-4M5 21h14" }) }),
2699
+ "Download"
2700
+ ]
2701
+ }
2702
+ )
2703
+ ] }),
2704
+ hasDetail && /* @__PURE__ */ jsxs(
2705
+ "button",
2706
+ {
2707
+ type: "button",
2708
+ onClick: () => setOpen((v) => !v),
2709
+ "aria-expanded": open,
2710
+ className: "inline-flex items-center gap-1.5 text-[12.5px] font-semibold text-foreground/55 hover:text-foreground",
2711
+ children: [
2712
+ /* @__PURE__ */ jsx(
2713
+ "svg",
2714
+ {
2715
+ width: "13",
2716
+ height: "13",
2717
+ viewBox: "0 0 24 24",
2718
+ fill: "none",
2719
+ stroke: "currentColor",
2720
+ strokeWidth: "2",
2721
+ className: cn("transition-transform", open && "rotate-90"),
2722
+ children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
2723
+ }
2724
+ ),
2725
+ item.customisations?.length || item.customerInputs?.length ? "Customisations & details" : "What's included"
2726
+ ]
2727
+ }
2728
+ )
2729
+ ] }),
2730
+ open && hasDetail && /* @__PURE__ */ jsx(LineItemDetails, { item, className: "ml-[1px] mt-2.5" })
2731
+ ] }),
2732
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold tabular-nums text-foreground", children: item.priceLabel })
2733
+ ] }) });
2734
+ }
2735
+ function ChildRow({ sel }) {
2736
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-2 py-1.5 [&:not(:first-child)]:border-t [&:not(:first-child)]:border-border/50", children: [
2737
+ /* @__PURE__ */ jsxs("span", { className: "shrink-0 text-[11px] font-semibold tabular-nums text-foreground/55", children: [
2738
+ sel.quantity ?? 1,
2739
+ "\xD7"
2740
+ ] }),
2741
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
2742
+ /* @__PURE__ */ jsx("div", { className: "text-[12.5px] font-medium text-foreground", children: sel.name }),
2743
+ sel.variantName && /* @__PURE__ */ jsx("div", { className: "text-[11px] text-foreground/55", children: sel.variantName })
2744
+ ] }),
2745
+ sel.priceLabel && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[11.5px] tabular-nums text-foreground/55", children: sel.priceLabel })
2746
+ ] });
2747
+ }
2748
+ function LineItemDetails({
2749
+ item,
2750
+ className
2751
+ }) {
2752
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
2753
+ item.includes && item.includes.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
2754
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-[10px] font-bold uppercase tracking-wider text-foreground/45", children: "Bundle includes" }),
2755
+ item.includes.map((sel, i) => /* @__PURE__ */ jsx(ChildRow, { sel }, i))
2756
+ ] }),
2757
+ item.customisations && item.customisations.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
2758
+ /* @__PURE__ */ jsx("div", { className: "mb-1 text-[10px] font-bold uppercase tracking-wider text-foreground/45", children: "Customisations" }),
2759
+ item.customisations.map((sel, i) => /* @__PURE__ */ jsx(ChildRow, { sel }, i))
2760
+ ] }),
2761
+ item.customerInputs && item.customerInputs.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-[84px_minmax(0,1fr)] items-start gap-x-2.5 gap-y-1 text-xs sm:grid-cols-[104px_minmax(0,1fr)]", children: item.customerInputs.map((input) => /* @__PURE__ */ jsxs(React14.Fragment, { children: [
2762
+ /* @__PURE__ */ jsx("span", { className: "capitalize text-foreground/55", children: input.fieldName }),
2763
+ /* @__PURE__ */ jsx(CustomerInputValue, { input })
2764
+ ] }, input.fieldId)) })
2765
+ ] });
2766
+ }
2767
+ function asObject(v) {
2768
+ return v && typeof v === "object" && !Array.isArray(v) ? v : null;
2769
+ }
2770
+ function CustomerInputValue({ input }) {
2771
+ const v = input.value;
2772
+ const obj = asObject(v);
2773
+ if (input.semanticKind === "allergen" || input.semanticKind === "sensitivity") {
2774
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 font-medium text-amber-600", children: [
2775
+ /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }) }),
2776
+ String(v ?? "")
2777
+ ] });
2778
+ }
2779
+ switch (input.fieldType) {
2780
+ case "textarea":
2781
+ return /* @__PURE__ */ jsx("span", { className: "block whitespace-pre-wrap rounded-md bg-muted/40 px-2.5 py-1.5 leading-relaxed text-foreground/90", children: String(v ?? "") });
2782
+ case "number":
2783
+ return /* @__PURE__ */ jsx("span", { className: "font-semibold tabular-nums text-foreground", children: String(v ?? "") });
2784
+ case "select":
2785
+ case "radio":
2786
+ return /* @__PURE__ */ jsx("span", { className: "inline-flex w-fit items-center rounded-full border border-primary/20 bg-primary/[0.12] px-2 py-0.5 text-[11.5px] font-medium text-primary", children: String(v ?? "") });
2787
+ case "multi_select":
2788
+ case "checkbox": {
2789
+ if (typeof v === "boolean") return /* @__PURE__ */ jsx(BooleanBadge, { value: v });
2790
+ const list = Array.isArray(v) ? v.map(String) : [String(v ?? "")];
2791
+ return /* @__PURE__ */ jsx("span", { className: "flex flex-wrap gap-1", children: list.filter(Boolean).map((label, i) => /* @__PURE__ */ jsx("span", { className: "inline-flex items-center rounded-full border border-border bg-muted/40 px-2 py-0.5 text-[11px] font-medium", children: label }, i)) });
2792
+ }
2793
+ case "color": {
2794
+ const hex = String(v ?? "");
2795
+ const label = obj?.label ? String(obj.label) : hex;
2796
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 font-medium text-foreground", children: [
2797
+ /* @__PURE__ */ jsx("span", { className: "inline-block size-3.5 rounded-full border border-black/10", style: { background: hex } }),
2798
+ label,
2799
+ hex && hex !== label && /* @__PURE__ */ jsx("span", { className: "font-mono text-[11px] text-foreground/55", children: hex })
2800
+ ] });
2801
+ }
2802
+ case "date":
2803
+ case "date_time":
2804
+ case "time":
2805
+ return /* @__PURE__ */ jsx("span", { className: "font-medium tabular-nums text-foreground", children: String(v ?? "") });
2806
+ case "date_range": {
2807
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 font-medium tabular-nums text-foreground", children: [
2808
+ /* @__PURE__ */ jsx("span", { children: String(obj?.start ?? "") }),
2809
+ /* @__PURE__ */ jsx("span", { className: "text-foreground/55", children: "\u2192" }),
2810
+ /* @__PURE__ */ jsx("span", { children: String(obj?.end ?? "") })
2811
+ ] });
2812
+ }
2813
+ case "file": {
2814
+ const url = String(v ?? "");
2815
+ const filename = url.split("/").pop() || "Attachment";
2816
+ return /* @__PURE__ */ jsxs(
2817
+ "a",
2818
+ {
2819
+ href: url,
2820
+ target: "_blank",
2821
+ rel: "noopener noreferrer",
2822
+ className: "inline-flex w-fit max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1 text-foreground hover:border-primary hover:text-primary",
2823
+ children: [
2824
+ /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: /* @__PURE__ */ jsx("path", { d: "M14 3v5h5M15 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8Z" }) }),
2825
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[11.5px] font-medium", children: filename })
2826
+ ]
2827
+ }
2828
+ );
2829
+ }
2830
+ case "image": {
2831
+ const url = typeof v === "string" ? v : "";
2832
+ if (!url) return /* @__PURE__ */ jsx("span", { className: "italic text-foreground/55", children: "No image" });
2833
+ return /* @__PURE__ */ jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "block size-14 overflow-hidden rounded-md border border-border", children: /* @__PURE__ */ jsx("img", { src: url, alt: input.fieldName, className: "size-full object-cover" }) });
2834
+ }
2835
+ case "url": {
2836
+ const url = String(v ?? "");
2837
+ return /* @__PURE__ */ jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "inline-flex max-w-full items-center gap-1 truncate text-primary hover:underline", children: url.replace(/^https?:\/\//, "").replace(/\/$/, "") });
2838
+ }
2839
+ case "email":
2840
+ return /* @__PURE__ */ jsx("a", { href: `mailto:${String(v ?? "")}`, className: "text-primary hover:underline", children: String(v ?? "") });
2841
+ case "phone": {
2842
+ const display = obj?.formatted ? String(obj.formatted) : String(v ?? "");
2843
+ return /* @__PURE__ */ jsx("a", { href: `tel:${display}`, className: "tabular-nums text-primary hover:underline", children: display });
2844
+ }
2845
+ case "address": {
2846
+ const formatted = obj?.formatted_address ? String(obj.formatted_address) : String(v ?? "");
2847
+ return /* @__PURE__ */ jsx("span", { className: "block whitespace-pre-line rounded-md bg-muted/40 px-2.5 py-1.5 text-[11.5px] leading-relaxed", children: formatted });
2848
+ }
2849
+ case "location": {
2850
+ const label = obj?.label ? String(obj.label) : null;
2851
+ const lat = obj?.latitude;
2852
+ const lng = obj?.longitude;
2853
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 font-medium text-foreground", children: [
2854
+ /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", className: "text-destructive", children: [
2855
+ /* @__PURE__ */ jsx("path", { d: "M12 21s-7-5.5-7-11a7 7 0 0 1 14 0c0 5.5-7 11-7 11Z" }),
2856
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "2.5" })
2857
+ ] }),
2858
+ label ?? `${lat ?? "?"}, ${lng ?? "?"}`
2859
+ ] });
2860
+ }
2861
+ case "signature": {
2862
+ const signer = obj?.signer_name ? String(obj.signer_name) : null;
2863
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex w-fit items-center gap-1 rounded-full border border-emerald-500/20 bg-emerald-500/[0.12] px-2 py-0.5 text-[11px] font-semibold text-emerald-600", children: [
2864
+ /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }),
2865
+ signer ? `Signed by ${signer}` : "Signed"
2866
+ ] });
2867
+ }
2868
+ case "text":
2869
+ default:
2870
+ return /* @__PURE__ */ jsxs("span", { className: "italic text-foreground/90", children: [
2871
+ "\u201C",
2872
+ String(v ?? ""),
2873
+ "\u201D"
2874
+ ] });
2875
+ }
2876
+ }
2877
+ function BooleanBadge({ value }) {
2878
+ return value ? /* @__PURE__ */ jsxs("span", { className: "inline-flex w-fit items-center gap-1 rounded-full border border-emerald-500/20 bg-emerald-500/[0.12] px-2 py-0.5 text-[11px] font-semibold text-emerald-600", children: [
2879
+ /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }),
2880
+ "Yes"
2881
+ ] }) : /* @__PURE__ */ jsx("span", { className: "inline-flex w-fit items-center rounded-full bg-muted/40 px-2 py-0.5 text-[11px] font-medium text-foreground/55", children: "No" });
2882
+ }
2883
+ function AccountLineItems({ items, className }) {
2884
+ return /* @__PURE__ */ jsx("div", { "data-cimplify-line-items": true, className: cn("divide-y divide-border/60", className), children: items.map((item) => /* @__PURE__ */ jsx(AccountLineItem, { item }, item.id)) });
2885
+ }
2886
+ var STATUS_TONE = {
2887
+ progress: "bg-amber-500/10 text-amber-600",
2888
+ positive: "bg-emerald-500/10 text-emerald-600",
2889
+ muted: "bg-muted/60 text-foreground/60"
2890
+ };
2891
+ function SectionLabel({ children }) {
2892
+ return /* @__PURE__ */ jsx("div", { className: "text-[10px] font-bold uppercase tracking-wider text-foreground/45", children });
2893
+ }
2894
+ function AccountOrderView({
2895
+ orderNumber,
2896
+ placedLabel,
2897
+ statusLabel,
2898
+ statusTone = "progress",
2899
+ items,
2900
+ itemsLabel = "Items",
2901
+ delivery,
2902
+ payment,
2903
+ shipTo,
2904
+ actions,
2905
+ onBack,
2906
+ backLabel = "Back to orders",
2907
+ className
2908
+ }) {
2909
+ return /* @__PURE__ */ jsxs("div", { "data-cimplify-order-view": true, className: cn("min-w-0", className), children: [
2910
+ onBack && /* @__PURE__ */ jsxs(
2911
+ "button",
2912
+ {
2913
+ type: "button",
2914
+ onClick: onBack,
2915
+ className: "mb-5 inline-flex items-center gap-1.5 text-[13px] font-medium text-foreground/55 hover:text-foreground",
2916
+ children: [
2917
+ /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" }) }),
2918
+ backLabel
2919
+ ]
2920
+ }
2921
+ ),
2922
+ /* @__PURE__ */ jsxs("div", { className: "mb-5 flex items-start justify-between gap-3", children: [
2923
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2924
+ /* @__PURE__ */ jsxs("h1", { className: "font-serif text-2xl font-semibold tracking-[-0.02em] tabular-nums text-foreground", children: [
2925
+ "Order #",
2926
+ orderNumber
2927
+ ] }),
2928
+ placedLabel && /* @__PURE__ */ jsx("div", { className: "mt-0.5 text-[13px] text-foreground/55", children: placedLabel })
2929
+ ] }),
2930
+ statusLabel && /* @__PURE__ */ jsx(
2931
+ "span",
2932
+ {
2933
+ className: cn(
2934
+ "shrink-0 rounded-full px-2.5 py-1 text-xs font-semibold",
2935
+ STATUS_TONE[statusTone]
2936
+ ),
2937
+ children: statusLabel
2938
+ }
2939
+ )
2940
+ ] }),
2941
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-8 lg:grid-cols-[minmax(0,1fr)_300px] lg:gap-14", children: [
2942
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
2943
+ /* @__PURE__ */ jsxs("section", { children: [
2944
+ /* @__PURE__ */ jsx(SectionLabel, { children: itemsLabel }),
2945
+ /* @__PURE__ */ jsx(AccountLineItems, { items, className: "mt-2.5" })
2946
+ ] }),
2947
+ delivery && /* @__PURE__ */ jsxs("section", { className: "mt-6 border-t border-border/60 pt-6", children: [
2948
+ /* @__PURE__ */ jsx("div", { className: "mb-1 flex items-center justify-between", children: /* @__PURE__ */ jsx(SectionLabel, { children: delivery.label ?? "Delivery" }) }),
2949
+ delivery.note && /* @__PURE__ */ jsx("p", { className: "mb-4 text-[11.5px] text-foreground/55", children: delivery.note }),
2950
+ /* @__PURE__ */ jsx(
2951
+ DeliveryTracker,
2952
+ {
2953
+ variant: "plain",
2954
+ steps: delivery.steps,
2955
+ statusLabel: delivery.statusLabel,
2956
+ etaLabel: delivery.etaLabel,
2957
+ rider: delivery.rider,
2958
+ live: delivery.live,
2959
+ onTrackLive: delivery.onTrackLive,
2960
+ onContactRider: delivery.onContactRider
2961
+ }
2962
+ )
2963
+ ] })
2964
+ ] }),
2965
+ /* @__PURE__ */ jsxs("div", { children: [
2966
+ /* @__PURE__ */ jsxs("div", { className: "rounded-[var(--radius,12px)] bg-muted/40 p-4", children: [
2967
+ /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center justify-between", children: [
2968
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Payment" }),
2969
+ payment.stateLabel && /* @__PURE__ */ jsx(
2970
+ "span",
2971
+ {
2972
+ className: cn(
2973
+ "rounded-full px-2 py-0.5 text-[11.5px] font-semibold",
2974
+ payment.stateTone === "warning" ? "bg-amber-500/10 text-amber-600" : payment.stateTone === "muted" ? "bg-muted/70 text-foreground/60" : "bg-emerald-500/10 text-emerald-600"
2975
+ ),
2976
+ children: payment.stateLabel
2977
+ }
2978
+ )
2979
+ ] }),
2980
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2 text-[13px]", children: [
2981
+ payment.rows.map((row, i) => /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
2982
+ /* @__PURE__ */ jsx("span", { className: "text-foreground/55", children: row.label }),
2983
+ /* @__PURE__ */ jsx("span", { className: cn("tabular-nums", row.tone === "positive" && "text-emerald-600"), children: row.value })
2984
+ ] }, i)),
2985
+ /* @__PURE__ */ jsx("div", { className: "my-2 h-px bg-border" }),
2986
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-[15px] font-semibold", children: [
2987
+ /* @__PURE__ */ jsx("span", { children: payment.total.label }),
2988
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: payment.total.value })
2989
+ ] })
2990
+ ] }),
2991
+ payment.method && /* @__PURE__ */ jsxs(Fragment, { children: [
2992
+ /* @__PURE__ */ jsx("div", { className: "my-3 h-px bg-border" }),
2993
+ /* @__PURE__ */ jsx("div", { className: "text-[12.5px] text-foreground", children: payment.method })
2994
+ ] })
2995
+ ] }),
2996
+ shipTo && /* @__PURE__ */ jsxs("div", { className: "mt-7", children: [
2997
+ /* @__PURE__ */ jsx(SectionLabel, { children: shipTo.heading ?? "Delivering to" }),
2998
+ shipTo.name && /* @__PURE__ */ jsx("div", { className: "mt-2 text-[13px] font-semibold text-foreground", children: shipTo.name }),
2999
+ /* @__PURE__ */ jsx("div", { className: "mt-1 text-[12.5px] leading-relaxed text-foreground/55", children: shipTo.lines })
3000
+ ] }),
3001
+ actions && /* @__PURE__ */ jsx("div", { className: "mt-7 space-y-2.5", children: actions })
3002
+ ] })
3003
+ ] })
3004
+ ] });
3005
+ }
2452
3006
  function SubscriptionRow({
2453
3007
  subscription,
2454
3008
  onSelect,
@@ -3264,27 +3818,11 @@ var DEFAULT_LINKS = [
3264
3818
  ] })
3265
3819
  },
3266
3820
  {
3267
- label: "Addresses",
3268
- href: "/account/addresses",
3269
- icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
3270
- /* @__PURE__ */ jsx("path", { d: "M12 21s-7-5.5-7-11a7 7 0 0 1 14 0c0 5.5-7 11-7 11Z" }),
3271
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "2.5" })
3272
- ] })
3273
- },
3274
- {
3275
- label: "Payment methods",
3276
- href: "/account/payment",
3277
- icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
3278
- /* @__PURE__ */ jsx("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
3279
- /* @__PURE__ */ jsx("path", { d: "M2 10h20" })
3280
- ] })
3281
- },
3282
- {
3283
- label: "Account",
3284
- href: "/account",
3821
+ label: "Subscriptions",
3822
+ href: "/account/subscriptions",
3285
3823
  icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
3286
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
3287
- /* @__PURE__ */ jsx("path", { d: "M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1" })
3824
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
3825
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18M8 2v4M16 2v4" })
3288
3826
  ] })
3289
3827
  }
3290
3828
  ];
@@ -3401,7 +3939,7 @@ function CimplifyUserButton({
3401
3939
  id: menuId,
3402
3940
  role: "menu",
3403
3941
  className: cn(
3404
- "absolute top-[calc(100%+8px)] z-50 w-[280px] overflow-hidden",
3942
+ "absolute top-[calc(100%+8px)] z-50 w-[280px] max-w-[calc(100vw-1.5rem)] overflow-hidden",
3405
3943
  "rounded-[14px] border border-border bg-card",
3406
3944
  "shadow-[0_1px_2px_rgba(16,24,40,0.04),0_16px_40px_-16px_rgba(16,24,40,0.24)]",
3407
3945
  align === "end" ? "right-0" : "left-0"
@@ -7327,7 +7865,7 @@ function FileUploadInput({
7327
7865
  onFileUpload,
7328
7866
  classNames
7329
7867
  }) {
7330
- const [isUploading, setIsUploading] = React12.useState(false);
7868
+ const [isUploading, setIsUploading] = React14.useState(false);
7331
7869
  const fileUrl = typeof value === "string" ? value : void 0;
7332
7870
  const acceptedFormats = field.validation?.accepted_formats;
7333
7871
  const accept = acceptedFormats ? acceptedFormats.map((f) => `.${f}`).join(",") : field.field_type === INPUT_FIELD_TYPE.Image ? "image/*" : void 0;
@@ -7477,22 +8015,22 @@ function AddressInput({
7477
8015
  }) {
7478
8016
  const clientContext = useOptionalCimplifyClient();
7479
8017
  const addr = value && typeof value === "object" ? value : null;
7480
- const [inputText, setInputText] = React12.useState(addr?.formatted_address ?? "");
7481
- const [suggestions, setSuggestions] = React12.useState([]);
7482
- const [isOpen, setIsOpen] = React12.useState(false);
7483
- const [highlightedIndex, setHighlightedIndex] = React12.useState(-1);
7484
- const debounceRef = React12.useRef(null);
7485
- const seqRef = React12.useRef(0);
7486
- const sessionTokenRef = React12.useRef(createSessionToken());
7487
- const blurTimeoutRef = React12.useRef(null);
7488
- React12.useEffect(() => {
8018
+ const [inputText, setInputText] = React14.useState(addr?.formatted_address ?? "");
8019
+ const [suggestions, setSuggestions] = React14.useState([]);
8020
+ const [isOpen, setIsOpen] = React14.useState(false);
8021
+ const [highlightedIndex, setHighlightedIndex] = React14.useState(-1);
8022
+ const debounceRef = React14.useRef(null);
8023
+ const seqRef = React14.useRef(0);
8024
+ const sessionTokenRef = React14.useRef(createSessionToken());
8025
+ const blurTimeoutRef = React14.useRef(null);
8026
+ React14.useEffect(() => {
7489
8027
  return () => {
7490
8028
  if (debounceRef.current) clearTimeout(debounceRef.current);
7491
8029
  if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
7492
8030
  seqRef.current += 1;
7493
8031
  };
7494
8032
  }, []);
7495
- const fetchSuggestions = React12.useCallback(async (query) => {
8033
+ const fetchSuggestions = React14.useCallback(async (query) => {
7496
8034
  const client = clientContext?.client;
7497
8035
  if (!client || query.length < 3) {
7498
8036
  setSuggestions([]);
@@ -7516,7 +8054,7 @@ function AddressInput({
7516
8054
  if (debounceRef.current) clearTimeout(debounceRef.current);
7517
8055
  debounceRef.current = setTimeout(() => void fetchSuggestions(nextValue.trim()), 300);
7518
8056
  };
7519
- const selectSuggestion = React12.useCallback(async (suggestion) => {
8057
+ const selectSuggestion = React14.useCallback(async (suggestion) => {
7520
8058
  if (debounceRef.current) clearTimeout(debounceRef.current);
7521
8059
  if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
7522
8060
  const fallback = suggestion.description.split(",")[0]?.trim() || suggestion.description;
@@ -7619,22 +8157,22 @@ function LocationInput({
7619
8157
  }) {
7620
8158
  const clientContext = useOptionalCimplifyClient();
7621
8159
  const loc = value && typeof value === "object" ? value : null;
7622
- const [inputText, setInputText] = React12.useState(loc?.label ?? "");
7623
- const [suggestions, setSuggestions] = React12.useState([]);
7624
- const [isOpen, setIsOpen] = React12.useState(false);
7625
- const [highlightedIndex, setHighlightedIndex] = React12.useState(-1);
7626
- const debounceRef = React12.useRef(null);
7627
- const seqRef = React12.useRef(0);
7628
- const sessionTokenRef = React12.useRef(createSessionToken());
7629
- const blurTimeoutRef = React12.useRef(null);
7630
- React12.useEffect(() => {
8160
+ const [inputText, setInputText] = React14.useState(loc?.label ?? "");
8161
+ const [suggestions, setSuggestions] = React14.useState([]);
8162
+ const [isOpen, setIsOpen] = React14.useState(false);
8163
+ const [highlightedIndex, setHighlightedIndex] = React14.useState(-1);
8164
+ const debounceRef = React14.useRef(null);
8165
+ const seqRef = React14.useRef(0);
8166
+ const sessionTokenRef = React14.useRef(createSessionToken());
8167
+ const blurTimeoutRef = React14.useRef(null);
8168
+ React14.useEffect(() => {
7631
8169
  return () => {
7632
8170
  if (debounceRef.current) clearTimeout(debounceRef.current);
7633
8171
  if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
7634
8172
  seqRef.current += 1;
7635
8173
  };
7636
8174
  }, []);
7637
- const fetchSuggestions = React12.useCallback(async (query) => {
8175
+ const fetchSuggestions = React14.useCallback(async (query) => {
7638
8176
  const client = clientContext?.client;
7639
8177
  if (!client || query.length < 3) {
7640
8178
  setSuggestions([]);
@@ -7658,7 +8196,7 @@ function LocationInput({
7658
8196
  if (debounceRef.current) clearTimeout(debounceRef.current);
7659
8197
  debounceRef.current = setTimeout(() => void fetchSuggestions(nextValue.trim()), 300);
7660
8198
  };
7661
- const selectSuggestion = React12.useCallback(async (suggestion) => {
8199
+ const selectSuggestion = React14.useCallback(async (suggestion) => {
7662
8200
  if (debounceRef.current) clearTimeout(debounceRef.current);
7663
8201
  if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
7664
8202
  const label = suggestion.description.split(",")[0]?.trim() || suggestion.description;
@@ -7747,8 +8285,8 @@ function PhoneInput({
7747
8285
  inputClass
7748
8286
  }) {
7749
8287
  const phone = value && typeof value === "object" ? value : null;
7750
- const [code, setCode] = React12.useState(phone?.country_code ?? "+1");
7751
- const [number, setNumber] = React12.useState(phone?.number ?? "");
8288
+ const [code, setCode] = React14.useState(phone?.country_code ?? "+1");
8289
+ const [number, setNumber] = React14.useState(phone?.number ?? "");
7752
8290
  const update = (nextCode, nextNumber) => {
7753
8291
  setCode(nextCode);
7754
8292
  setNumber(nextNumber);
@@ -7793,8 +8331,8 @@ function SignatureInput({
7793
8331
  classNames
7794
8332
  }) {
7795
8333
  const sig = value && typeof value === "object" ? value : null;
7796
- const canvasRef = React12.useRef(null);
7797
- const isDrawing = React12.useRef(false);
8334
+ const canvasRef = React14.useRef(null);
8335
+ const isDrawing = React14.useRef(false);
7798
8336
  const getCtx = () => canvasRef.current?.getContext("2d") ?? null;
7799
8337
  const startDraw = (e) => {
7800
8338
  const ctx = getCtx();
@@ -8826,7 +9364,7 @@ function ProductModel3D({
8826
9364
  "data-cimplify-product-model-3d": true,
8827
9365
  className,
8828
9366
  style: { position: "relative", overflow: "hidden", ...ASPECT_STYLES3[aspectRatio] },
8829
- children: ready ? React12.createElement("model-viewer", {
9367
+ children: ready ? React14.createElement("model-viewer", {
8830
9368
  src,
8831
9369
  "ios-src": iosSrc,
8832
9370
  alt,
@@ -8837,12 +9375,12 @@ function ProductModel3D({
8837
9375
  "auto-rotate": autoRotate || void 0,
8838
9376
  "shadow-intensity": "1",
8839
9377
  style: { width: "100%", height: "100%", backgroundColor: "transparent" }
8840
- }) : poster ? React12.createElement("img", {
9378
+ }) : poster ? React14.createElement("img", {
8841
9379
  src: poster,
8842
9380
  alt: alt ?? "",
8843
9381
  "data-cimplify-product-model-3d-loading": true,
8844
9382
  style: { width: "100%", height: "100%", objectFit: "cover" }
8845
- }) : React12.createElement("div", {
9383
+ }) : React14.createElement("div", {
8846
9384
  "data-cimplify-product-model-3d-loading": true,
8847
9385
  style: { width: "100%", height: "100%", backgroundColor: "var(--muted, #f3f4f6)" }
8848
9386
  })
@@ -10769,13 +11307,13 @@ function ProductGrid({
10769
11307
  className,
10770
11308
  classNames
10771
11309
  }) {
10772
- const rawId = React12.useId();
11310
+ const rawId = React14.useId();
10773
11311
  const gridId = `cimplify-grid-${rawId.replace(/:/g, "")}`;
10774
11312
  const sm = columns?.sm ?? 1;
10775
11313
  const md = columns?.md ?? 2;
10776
11314
  const lg = columns?.lg ?? 3;
10777
11315
  const xl = columns?.xl ?? 4;
10778
- const css = React12.useMemo(
11316
+ const css = React14.useMemo(
10779
11317
  () => [
10780
11318
  `#${gridId}{display:grid;grid-template-columns:repeat(${sm},1fr);gap:1rem}`,
10781
11319
  `@media(min-width:768px){#${gridId}{grid-template-columns:repeat(${md},1fr)}}`,
@@ -11136,7 +11674,7 @@ function CategoryGrid({
11136
11674
  enabled: categoriesProp === void 0
11137
11675
  });
11138
11676
  const categories = categoriesProp ?? fetched;
11139
- const rawId = React12.useId();
11677
+ const rawId = React14.useId();
11140
11678
  const gridId = `cimplify-cat-grid-${rawId.replace(/:/g, "")}`;
11141
11679
  const sm = columns?.sm ?? 2;
11142
11680
  const md = columns?.md ?? 3;
@@ -11362,7 +11900,7 @@ function OrderSummary({
11362
11900
  /* @__PURE__ */ jsx("p", { children: order.delivery_address })
11363
11901
  ] }),
11364
11902
  /* @__PURE__ */ jsx("div", { "data-cimplify-order-items": true, className: classNames?.items, children: order.items.map(
11365
- (item) => renderLineItem ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderLineItem(item) }, item.id) : /* @__PURE__ */ jsxs("div", { "data-cimplify-order-line-item": true, className: classNames?.lineItem, children: [
11903
+ (item) => renderLineItem ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderLineItem(item) }, item.id) : /* @__PURE__ */ jsxs("div", { "data-cimplify-order-line-item": true, className: classNames?.lineItem, children: [
11366
11904
  /* @__PURE__ */ jsxs("div", { "data-cimplify-order-line-info": true, children: [
11367
11905
  /* @__PURE__ */ jsxs("span", { "data-cimplify-order-line-qty": true, children: [
11368
11906
  item.quantity,
@@ -12522,7 +13060,7 @@ function DefaultCatalogueLayout({
12522
13060
  /* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children: "No products found" }),
12523
13061
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Try adjusting your filters" })
12524
13062
  ] }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4", children: products.map(
12525
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
13063
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
12526
13064
  ProductCard,
12527
13065
  {
12528
13066
  product,
@@ -12629,7 +13167,7 @@ function CompactCatalogueLayout({
12629
13167
  /* @__PURE__ */ jsx("p", { className: "text-lg font-medium", children: "No items found" }),
12630
13168
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Try a different category or search" })
12631
13169
  ] }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-3 gap-5", children: products.map(
12632
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
13170
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
12633
13171
  ProductCard,
12634
13172
  {
12635
13173
  product,
@@ -12652,8 +13190,8 @@ var BUILT_IN_LAYOUTS = {
12652
13190
  ["compact" /* Compact */]: CompactCatalogueLayout
12653
13191
  };
12654
13192
  function useDebounce(value, delay) {
12655
- const [debounced, setDebounced] = React12.useState(value);
12656
- React12.useEffect(() => {
13193
+ const [debounced, setDebounced] = React14.useState(value);
13194
+ React14.useEffect(() => {
12657
13195
  const timer = setTimeout(() => setDebounced(value), delay);
12658
13196
  return () => clearTimeout(timer);
12659
13197
  }, [value, delay]);
@@ -12909,7 +13447,7 @@ function DefaultProductLayout({
12909
13447
  showRelated = true,
12910
13448
  className
12911
13449
  }) {
12912
- const [selectedVariantId, setSelectedVariantId] = React12.useState();
13450
+ const [selectedVariantId, setSelectedVariantId] = React14.useState();
12913
13451
  const images = resolveGallery(product, selectedVariantId);
12914
13452
  const hasRange = product.quantity_pricing && product.quantity_pricing.length > 1 || product.variants && product.variants.length > 1;
12915
13453
  const onSale = isOnSale(product);
@@ -14175,7 +14713,7 @@ function DefaultCollectionLayout({
14175
14713
  ] })
14176
14714
  ] }),
14177
14715
  filtered.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: filtered.map(
14178
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14716
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14179
14717
  ProductCard,
14180
14718
  {
14181
14719
  product,
@@ -14228,7 +14766,7 @@ function FeaturedCollectionLayout({
14228
14766
  ] })
14229
14767
  ] }),
14230
14768
  /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6", children: products.map(
14231
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14769
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14232
14770
  ProductCard,
14233
14771
  {
14234
14772
  product,
@@ -14352,7 +14890,7 @@ function CatalogueCollectionLayout({
14352
14890
  ] })
14353
14891
  ] }),
14354
14892
  filtered.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: filtered.map(
14355
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14893
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14356
14894
  ProductCard,
14357
14895
  {
14358
14896
  product,
@@ -14732,7 +15270,7 @@ function DefaultSearchLayout({
14732
15270
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Try a different search term" }),
14733
15271
  /* @__PURE__ */ jsx("button", { onClick: clear, className: "text-sm font-medium text-primary mt-4 hover:underline", children: "Clear search" })
14734
15272
  ] }) : results.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 gap-4", children: results.map(
14735
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
15273
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14736
15274
  ProductCard,
14737
15275
  {
14738
15276
  product,
@@ -14834,7 +15372,7 @@ function CompactSearchLayout({
14834
15372
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Try a different search term" }),
14835
15373
  /* @__PURE__ */ jsx("button", { onClick: clear, className: "text-sm font-medium text-primary mt-4 hover:underline", children: "Clear search" })
14836
15374
  ] }) : results.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 lg:grid-cols-3 gap-5", children: results.map(
14837
- (product) => renderCard ? /* @__PURE__ */ jsx(React12.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
15375
+ (product) => renderCard ? /* @__PURE__ */ jsx(React14.Fragment, { children: renderCard(product) }, product.id) : /* @__PURE__ */ jsx(
14838
15376
  ProductCard,
14839
15377
  {
14840
15378
  product,
@@ -15788,4 +16326,4 @@ function SparkleIcon({ className }) {
15788
16326
  );
15789
16327
  }
15790
16328
 
15791
- export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountNav, AccountOrderDetailPage, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage, CimplifyCheckout, CimplifyProvider, CimplifySignInButton, CimplifyUserButton, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, ContextCard, ContinuityCard, CurrencySelector, CustomAttributesTable, CustomerInputFields, DashboardIcon, DashboardIcon20, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LocationPicker, MediaGallery, MetadataStringList, MobileAccountShell, MobileBackButton, MobileMoreButton, MobileTabBar, NextDeliveryCard, OrderDetailHeader, OrderDetailMetaPipe, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderList, OrderRow, OrderSummary, OrderTimeline, OrderTotals, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, RichText, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, Section, SectionMore, ServiceProductLayout, SessionMessageBanner, SignOutIcon, Skeleton, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, Status, StoreNav, StoreVideo, SubscriptionCard, SubscriptionList, SubscriptionRow, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, Toast, TwoColumnGrid, VariantSelector, VolumePricing, WelcomeCard, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, sanitizeRichTextHtml, stripHtmlToText, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
16329
+ export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountLineItem, AccountLineItems, AccountNav, AccountOrderDetailPage, AccountOrderView, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage, CimplifyCheckout, CimplifyProvider, CimplifySignInButton, CimplifyUserButton, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, ContextCard, ContinuityCard, CurrencySelector, CustomAttributesTable, CustomerInputFields, DashboardIcon, DashboardIcon20, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DeliveryTracker, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LineItemDetails, LocationPicker, MediaGallery, MetadataStringList, MobileAccountShell, MobileBackButton, MobileMoreButton, MobileTabBar, NextDeliveryCard, OrderDetailHeader, OrderDetailMetaPipe, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderList, OrderRow, OrderSummary, OrderTimeline, OrderTotals, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, RichText, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, Section, SectionMore, ServiceProductLayout, SessionMessageBanner, SignOutIcon, Skeleton, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, Status, StoreNav, StoreVideo, SubscriptionCard, SubscriptionList, SubscriptionRow, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, Toast, TwoColumnGrid, VariantSelector, VolumePricing, WelcomeCard, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, sanitizeRichTextHtml, stripHtmlToText, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };