@loczer/storefront-sdk 0.163.0 → 0.165.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.
Files changed (89) hide show
  1. package/dist/StorefrontProvider.d.ts +29 -3
  2. package/dist/StorefrontProvider.d.ts.map +1 -1
  3. package/dist/StorefrontProvider.js +68 -58
  4. package/dist/chunks/booking-engine/dist/schemas/{base-booking-D9k8ehGi.js → base-booking-BMAjsw9r.js} +29 -26
  5. package/dist/chunks/booking-engine/dist/schemas/booking-engine-configuration-DTJD2G9w.js +123 -0
  6. package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-ByBK0IVJ.js → cart-inputs-BI_9nAXG.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-DKoak4s5.js → public-booking-engine-configuration-CrwffLO4.js} +1 -1
  8. package/dist/chunks/ui/dist/{MorphingModalWizard-D7hc-dDP.js → MorphingModalWizard-BuRND-yE.js} +3 -3
  9. package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/animation/optimized-appear/data-id-CNQuVmXa.js +6 -0
  10. package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/projection/node/create-projection-node-DL2q-YuA.js +9 -0
  11. package/dist/chunks/ui/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash-C-3PLS5x.js +6 -0
  12. package/dist/components/AboutSection/index.js +1 -1
  13. package/dist/components/BikeProductCard/index.d.ts +2 -1
  14. package/dist/components/BikeProductCard/index.d.ts.map +1 -1
  15. package/dist/components/BikeProductCard/index.js +59 -41
  16. package/dist/components/BookingBikeVariantDialog/index.js +1 -1
  17. package/dist/components/BookingFlowSteps/index.js +8 -8
  18. package/dist/components/BookingPeriodSelector/components/BookingEndDateField.js +1 -1
  19. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +28 -28
  21. package/dist/components/BookingPeriodSelector/components/BookingStartDateField.js +1 -1
  22. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +1 -1
  23. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  24. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +197 -203
  25. package/dist/components/ContactSection/index.js +4 -4
  26. package/dist/components/Header/index.js +1 -1
  27. package/dist/components/PoweredByLoczerBadge/index.js +1 -1
  28. package/dist/components/ProductPriceBadge/index.js +1 -1
  29. package/dist/components/ProductWarningNotice/index.js +10 -10
  30. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts +11 -0
  31. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -0
  32. package/dist/components/StorefrontCancellationPolicyNotice/index.js +93 -0
  33. package/dist/components/payment/MollieCardFieldsForm.js +1 -1
  34. package/dist/components/payment/StripeCardFieldsForm.js +13 -13
  35. package/dist/i18n/en.d.ts +12 -0
  36. package/dist/i18n/en.d.ts.map +1 -1
  37. package/dist/i18n/en.js +12 -0
  38. package/dist/i18n/fr.d.ts +12 -0
  39. package/dist/i18n/fr.d.ts.map +1 -1
  40. package/dist/i18n/fr.js +12 -0
  41. package/dist/index.d.ts +116 -7
  42. package/dist/index.js +312 -305
  43. package/dist/lib/cart.js +1 -1
  44. package/dist/lib/cartSummary.d.ts.map +1 -1
  45. package/dist/lib/cartSummary.js +28 -28
  46. package/dist/lib/checkoutPaymentDecision.d.ts +8 -0
  47. package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
  48. package/dist/lib/checkoutPaymentDecision.js +14 -6
  49. package/dist/lib/checkoutPaymentSession.d.ts +1 -0
  50. package/dist/lib/checkoutPaymentSession.d.ts.map +1 -1
  51. package/dist/lib/checkoutPaymentSession.js +12 -11
  52. package/dist/lib/checkoutSubmit.js +4 -4
  53. package/dist/lib/productVariants.d.ts.map +1 -1
  54. package/dist/lib/productVariants.js +34 -15
  55. package/dist/lib/products.d.ts +4 -0
  56. package/dist/lib/products.d.ts.map +1 -1
  57. package/dist/lib/products.js +74 -39
  58. package/dist/lib/securePaymentLink.d.ts +1 -0
  59. package/dist/lib/securePaymentLink.d.ts.map +1 -1
  60. package/dist/lib/securePaymentLink.js +1 -0
  61. package/dist/lib/storefrontAvailability.d.ts +9 -0
  62. package/dist/lib/storefrontAvailability.d.ts.map +1 -1
  63. package/dist/lib/storefrontAvailability.js +28 -18
  64. package/dist/pages/BookingPage.d.ts.map +1 -1
  65. package/dist/pages/BookingPage.js +290 -289
  66. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  67. package/dist/pages/CheckoutPage.js +224 -216
  68. package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
  69. package/dist/pages/CheckoutPaymentPage.js +92 -92
  70. package/dist/pages/ContractSaleDocumentPage.js +3 -3
  71. package/dist/pages/HomePage.d.ts.map +1 -1
  72. package/dist/pages/HomePage.js +167 -161
  73. package/dist/pages/PaymentLinkPage.d.ts.map +1 -1
  74. package/dist/pages/PaymentLinkPage.js +62 -62
  75. package/dist/pages/PaymentLinkSuccessPage.js +7 -7
  76. package/dist/pages/ProductPage.d.ts.map +1 -1
  77. package/dist/pages/ProductPage.js +161 -161
  78. package/dist/pages/checkout/components/CheckoutCouponCard.js +6 -6
  79. package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +15 -15
  80. package/dist/storefront.css +1 -1
  81. package/dist/storefrontSchemas.d.ts +14 -2
  82. package/dist/storefrontSchemas.d.ts.map +1 -1
  83. package/dist/storefrontSchemas.js +4 -4
  84. package/dist/ui/day-picker.js +5 -5
  85. package/package.json +2 -2
  86. package/dist/chunks/booking-engine/dist/schemas/booking-engine-configuration-BKlzwJJX.js +0 -105
  87. package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/animation/optimized-appear/data-id-DunDwGdX.js +0 -6
  88. package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/projection/node/create-projection-node-BDwaGtmx.js +0 -9
  89. package/dist/chunks/ui/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash-h54_qXon.js +0 -4
@@ -1,101 +1,101 @@
1
1
  import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
- import { useMemo as p, useState as S, useEffect as P } from "react";
3
- import { useParams as ne, useLocation as re, useSearchParams as oe, Link as it } from "@rpcbase/router";
4
- import { cn as ct } from "@rpcbase/ui";
5
- import { ArrowLeft as se, ShoppingCart as le, Bike as de, ArrowRight as $t } from "lucide-react";
6
- import { useTranslation as Rt } from "react-i18next";
7
- import { apiPost as It } from "../lib/apiCall.js";
8
- import { getProductVariantAttributeValue as ce, getStorefrontProductVariantDisplay as me } from "../lib/productVariants.js";
9
- import { getStorefrontCheckoutProductId as mt } from "../lib/products.js";
10
- import { ROUTE as Vt, responseSchema as Pt, buildStorefrontAvailabilityKey as h, getStorefrontAvailabilityStatus as K, getStorefrontAvailabilityIssue as Ft, isStorefrontAvailabilityInsufficient as ue } from "../lib/storefrontAvailability.js";
11
- import { getLocalizedValue as nt } from "../localization.js";
12
- import { Badge as Kt } from "../ui/badge.js";
13
- import { Button as E } from "../ui/button.js";
14
- import { Card as pe } from "../ui/card.js";
15
- import { RadioGroup as fe, RadioGroupItem as ge } from "../ui/radio-group.js";
16
- import { createBookingPeriodConfigFromStorefrontConfiguration as he, getDefaultBookingParamsForStorefrontConfiguration as be, resolveBookingSearchParamsFromSessionStorage as _e, getBookingParamsFromSearch as At, applyBookingParamsToSearch as wt, writeBookingSearchParamsToSessionStorage as ve } from "../lib/booking.js";
17
- import { createStorefrontTimeSlotsFetcher as ye } from "../lib/fetchStorefrontTimeSlots.js";
18
- import { useStorefrontCart as Se } from "../lib/cart.js";
19
- import { buildStorefrontCartSummary as ke } from "../lib/cartSummary.js";
20
- import { resolveProductImageContainerStyle as xe } from "../lib/productImageStyles.js";
21
- import { BookingFlowSteps as Ne } from "../components/BookingFlowSteps/index.js";
22
- import { StepSectionTitle as rt } from "../components/StepSectionTitle/index.js";
23
- import { BookingPeriodSelector as Ce } from "../components/BookingPeriodSelector/index.js";
24
- import { BikeProductCard as Ie } from "../components/BikeProductCard/index.js";
25
- import { StorefrontCartPanel as Ve } from "../components/StorefrontCartPanel/index.js";
26
- import { BookingBikeVariantDialog as Pe } from "../components/BookingBikeVariantDialog/index.js";
27
- import { FulfillmentSection as Ae } from "../components/FulfillmentSection/index.js";
28
- import { ProductPriceBadge as we } from "../components/ProductPriceBadge/index.js";
29
- import { ProductWarningNotice as Te } from "../components/ProductWarningNotice/index.js";
30
- import { useStorefront as Be, useStorefrontProducts as De } from "../StorefrontProvider.js";
31
- const Tt = (e) => String(e).padStart(2, "0"), ot = "product_modal", Bt = (e) => `${e.getFullYear()}-${Tt(e.getMonth() + 1)}-${Tt(e.getDate())}`, st = (e) => {
2
+ import { useMemo as p, useState as A, useEffect as B } from "react";
3
+ import { useParams as ee, useLocation as ae, useSearchParams as ie, Link as Q } from "@rpcbase/router";
4
+ import { cn as tt } from "@rpcbase/ui";
5
+ import { ArrowLeft as ne, ShoppingCart as re, Bike as oe, ArrowRight as At } from "lucide-react";
6
+ import { useTranslation as Bt } from "react-i18next";
7
+ import { apiPost as _t } from "../lib/apiCall.js";
8
+ import { getProductVariantAttributeValue as se, getStorefrontProductVariantDisplay as le } from "../lib/productVariants.js";
9
+ import { getStorefrontCheckoutProductId as K } from "../lib/products.js";
10
+ import { getValidStorefrontAvailabilitySchedule as vt, ROUTE as yt, responseSchema as St, buildStorefrontAvailabilityKey as h, getStorefrontAvailabilityStatus as Y, getStorefrontAvailabilityIssue as Tt, isStorefrontAvailabilityInsufficient as de } from "../lib/storefrontAvailability.js";
11
+ import { getLocalizedValue as H } from "../localization.js";
12
+ import { Badge as Ot } from "../ui/badge.js";
13
+ import { Button as F } from "../ui/button.js";
14
+ import { Card as ce } from "../ui/card.js";
15
+ import { RadioGroup as me, RadioGroupItem as ue } from "../ui/radio-group.js";
16
+ import { createBookingPeriodConfigFromStorefrontConfiguration as pe, getDefaultBookingParamsForStorefrontConfiguration as fe, resolveBookingSearchParamsFromSessionStorage as ge, getBookingParamsFromSearch as kt, applyBookingParamsToSearch as xt, writeBookingSearchParamsToSessionStorage as he } from "../lib/booking.js";
17
+ import { createStorefrontTimeSlotsFetcher as be } from "../lib/fetchStorefrontTimeSlots.js";
18
+ import { useStorefrontCart as _e } from "../lib/cart.js";
19
+ import { buildStorefrontCartSummary as ve } from "../lib/cartSummary.js";
20
+ import { resolveProductImageContainerStyle as ye } from "../lib/productImageStyles.js";
21
+ import { BookingFlowSteps as Se } from "../components/BookingFlowSteps/index.js";
22
+ import { StepSectionTitle as J } from "../components/StepSectionTitle/index.js";
23
+ import { BookingPeriodSelector as ke } from "../components/BookingPeriodSelector/index.js";
24
+ import { BikeProductCard as xe } from "../components/BikeProductCard/index.js";
25
+ import { StorefrontCartPanel as Ne } from "../components/StorefrontCartPanel/index.js";
26
+ import { BookingBikeVariantDialog as Ve } from "../components/BookingBikeVariantDialog/index.js";
27
+ import { FulfillmentSection as Ie } from "../components/FulfillmentSection/index.js";
28
+ import { ProductPriceBadge as Ce } from "../components/ProductPriceBadge/index.js";
29
+ import { ProductWarningNotice as Pe } from "../components/ProductWarningNotice/index.js";
30
+ import { useStorefront as we, useStorefrontProducts as Ae, useStorefrontBookingProducts as Be } from "../StorefrontProvider.js";
31
+ const Nt = (e) => String(e).padStart(2, "0"), X = "product_modal", Vt = (e) => `${e.getFullYear()}-${Nt(e.getMonth() + 1)}-${Nt(e.getDate())}`, Z = (e) => {
32
32
  if (!e) return;
33
33
  const n = e.match(/^(\d{4})-(\d{2})-(\d{2})$/);
34
34
  if (!n) return;
35
- const o = Number(n[1]), d = Number(n[2]), l = Number(n[3]), m = new Date(o, d - 1, l);
36
- if (!(Number.isNaN(m.getTime()) || m.getFullYear() !== o || m.getMonth() !== d - 1 || m.getDate() !== l))
35
+ const o = Number(n[1]), d = Number(n[2]), s = Number(n[3]), m = new Date(o, d - 1, s);
36
+ if (!(Number.isNaN(m.getTime()) || m.getFullYear() !== o || m.getMonth() !== d - 1 || m.getDate() !== s))
37
37
  return m;
38
- }, Dt = (e, n) => e.fulfillment === n.fulfillment && e.start_date === n.start_date && e.start_time === n.start_time && e.end_date === n.end_date && e.end_time === n.end_time && e.start_address === n.start_address && e.end_address === n.end_address, C = (e, n = () => !0) => {
38
+ }, It = (e, n) => e.fulfillment === n.fulfillment && e.start_date === n.start_date && e.start_time === n.start_time && e.end_date === n.end_date && e.end_time === n.end_time && e.start_address === n.start_address && e.end_address === n.end_address, x = (e, n = () => !0) => {
39
39
  if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
40
- const o = e.productVariants ?? [], l = o.find((m) => n(m.id))?.id ?? o[0]?.id;
41
- return typeof l == "string" && l.trim().length > 0 ? l : null;
42
- }, Lt = (e, n) => e.fulfillment === "delivery" && !n ? { ...e, fulfillment: "pickup" } : e, lt = (e, n) => {
43
- const o = mt(e), d = e.representedVariantId?.trim();
40
+ const o = e.productVariants ?? [], s = o.find((m) => n(m.id))?.id ?? o[0]?.id;
41
+ return typeof s == "string" && s.trim().length > 0 ? s : null;
42
+ }, Ct = (e, n) => e.fulfillment === "delivery" && !n ? { ...e, fulfillment: "pickup" } : e, Pt = (e, n) => {
43
+ const o = K(e), d = e.representedVariantId?.trim();
44
44
  if (d) {
45
- const l = n.get(h(o, d));
46
- if (l) return l;
45
+ const s = n.get(h(o, d));
46
+ if (s) return s;
47
47
  }
48
48
  return n.get(h(o));
49
- }, Ot = (e, n, o) => o.get(h(mt(e), n)), dt = (e, n, o) => {
50
- const d = Ft(n);
49
+ }, wt = (e, n, o) => o.get(h(K(e), n)), Te = (e, n, o) => {
50
+ const d = Tt(n);
51
51
  return d === "quantity_unavailable" ? e("availability_quantity_unavailable") : d === "unavailable" || o === "OUT_OF_STOCK" ? e("availability_out_of_stock") : n?.remaining !== void 0 ? e("availability_remaining_count", { count: n.remaining }) : n?.fewRemaining || o === "LOW_STOCK" ? e("availability_low_stock") : e("availability_in_stock");
52
- }, Le = (e) => {
52
+ }, Oe = (e) => {
53
53
  const n = /* @__PURE__ */ new Map();
54
54
  for (const o of e) {
55
- const d = mt(o);
55
+ const d = K(o);
56
56
  n.set(h(d), { productId: d });
57
57
  for (const m of o.productVariants ?? [])
58
58
  n.set(h(d, m.id), {
59
59
  productId: d,
60
60
  productVariantId: m.id
61
61
  });
62
- const l = o.representedVariantId?.trim();
63
- l && n.set(h(d, l), {
62
+ const s = o.representedVariantId?.trim();
63
+ s && n.set(h(d, s), {
64
64
  productId: d,
65
- productVariantId: l
65
+ productVariantId: s
66
66
  });
67
67
  }
68
68
  return Array.from(n.values());
69
69
  };
70
- function Oe({
70
+ function De({
71
71
  product: e,
72
72
  selectedVariantId: n,
73
73
  onSelect: o,
74
74
  onConfirm: d,
75
- onCancel: l,
75
+ onCancel: s,
76
76
  getVariantAvailabilityLabel: m,
77
- isVariantOutOfCapacity: k
77
+ isVariantOutOfCapacity: T
78
78
  }) {
79
- const { t: f } = Rt(), g = e.productVariants ?? [], I = g.some((u) => !!ce(u, "size")), A = f(I ? "product_size_label" : "product_variant_label");
79
+ const { t: v } = Bt(), y = e.productVariants ?? [], N = y.some((u) => !!se(u, "size")), f = v(N ? "product_size_label" : "product_variant_label");
80
80
  return /* @__PURE__ */ c("div", { className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3", children: [
81
- /* @__PURE__ */ i("p", { className: "text-xs font-medium text-slate-700", children: /* @__PURE__ */ i("span", { children: A }) }),
82
- /* @__PURE__ */ i(fe, { value: n, onValueChange: o, className: "grid gap-2", children: g.map((u) => {
83
- const w = `booking-variant-${e.id}-${u.id}`.toLowerCase(), z = `storefront-booking-variant-option-${e.id}-${u.id}`.toLowerCase(), { label: M, description: T } = me(u), U = k(u.id), b = m(u.id);
81
+ /* @__PURE__ */ i("p", { className: "text-xs font-medium text-slate-700", children: /* @__PURE__ */ i("span", { children: f }) }),
82
+ /* @__PURE__ */ i(me, { value: n, onValueChange: o, className: "grid gap-2", children: y.map((u) => {
83
+ const V = `booking-variant-${e.id}-${u.id}`.toLowerCase(), I = `storefront-booking-variant-option-${e.id}-${u.id}`.toLowerCase(), { label: E, description: O } = le(u), z = T(u.id), D = m(u.id);
84
84
  return /* @__PURE__ */ c(
85
85
  "label",
86
86
  {
87
- htmlFor: w,
88
- "data-testid": z,
89
- className: ct(
87
+ htmlFor: V,
88
+ "data-testid": I,
89
+ className: tt(
90
90
  "flex items-start gap-3 rounded-xl border p-3 transition",
91
91
  n === u.id ? "border-slate-900 bg-white" : "border-slate-200 bg-white"
92
92
  ),
93
93
  children: [
94
- /* @__PURE__ */ i(ge, { id: w, value: u.id, className: "mt-1" }),
94
+ /* @__PURE__ */ i(ue, { id: V, value: u.id, className: "mt-1" }),
95
95
  /* @__PURE__ */ c("span", { className: "flex flex-1 flex-col gap-0.5", children: [
96
- /* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-950", children: M }),
97
- T ? /* @__PURE__ */ i("span", { className: "text-xs text-slate-600", children: T }) : null,
98
- b ? /* @__PURE__ */ i("span", { className: "pt-1", children: /* @__PURE__ */ i(Kt, { variant: U ? "destructive" : "outline", children: /* @__PURE__ */ i("span", { children: b }) }) }) : null
96
+ /* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-950", children: E }),
97
+ O ? /* @__PURE__ */ i("span", { className: "text-xs text-slate-600", children: O }) : null,
98
+ D ? /* @__PURE__ */ i("span", { className: "pt-1", children: /* @__PURE__ */ i(Ot, { variant: z ? "destructive" : "outline", children: /* @__PURE__ */ i("span", { children: D }) }) }) : null
99
99
  ] })
100
100
  ]
101
101
  },
@@ -104,113 +104,109 @@ function Oe({
104
104
  }) }),
105
105
  /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
106
106
  /* @__PURE__ */ c(
107
- E,
107
+ F,
108
108
  {
109
109
  type: "button",
110
110
  size: "sm",
111
111
  className: "rounded-full gap-2",
112
112
  onClick: d,
113
113
  children: [
114
- /* @__PURE__ */ i("span", { children: f("add_to_cart") }),
115
- /* @__PURE__ */ i($t, { className: "h-4 w-4", "aria-hidden": "true" })
114
+ /* @__PURE__ */ i("span", { children: v("add_to_cart") }),
115
+ /* @__PURE__ */ i(At, { className: "h-4 w-4", "aria-hidden": "true" })
116
116
  ]
117
117
  }
118
118
  ),
119
- /* @__PURE__ */ i(E, { type: "button", size: "sm", variant: "outline", className: "rounded-full", onClick: l, children: /* @__PURE__ */ i("span", { children: f("booking_select_variant_cancel") }) })
119
+ /* @__PURE__ */ i(F, { type: "button", size: "sm", variant: "outline", className: "rounded-full", onClick: s, children: /* @__PURE__ */ i("span", { children: v("booking_select_variant_cancel") }) })
120
120
  ] })
121
121
  ] });
122
122
  }
123
123
  function ua() {
124
- const { t: e, i18n: n } = Rt(), { storeSlug: o } = ne(), d = re(), { storefrontConfiguration: l } = Be(), m = l.workspace?.workspaceLanguage, { bikes: k, accessories: f } = De(), [g, I] = oe(), { items: A, itemCount: u, addItem: w, clear: z, removeItem: M, setQuantity: T } = Se(), U = p(
125
- () => he(l),
126
- [l]
127
- ), b = p(
128
- () => be(l),
129
- [l]
130
- ), B = l.settings.fulfillmentModes.includes("delivery"), Et = l.settings.deliveryDisabledReason.trim(), zt = l.shop.address?.trim() ?? "", j = p(
131
- () => _e(g, o),
132
- [g, o]
133
- ), [s, ut] = S(
134
- () => Lt(At(j, b), B)
124
+ const { t: e, i18n: n } = Bt(), { storeSlug: o } = ee(), d = ae(), { storefrontConfiguration: s } = we(), m = s.workspace?.workspaceLanguage, { bikes: T, accessories: v } = Ae(), { bikes: y, accessories: N } = Be(), [f, u] = ie(), { items: V, itemCount: I, addItem: E, clear: O, removeItem: z, setQuantity: D } = _e(), Dt = p(
125
+ () => pe(s),
126
+ [s]
127
+ ), C = p(
128
+ () => fe(s),
129
+ [s]
130
+ ), L = s.settings.fulfillmentModes.includes("delivery"), Lt = s.settings.deliveryDisabledReason.trim(), $t = s.shop.address?.trim() ?? "", M = p(
131
+ () => ge(f, o),
132
+ [f, o]
133
+ ), [l, et] = A(
134
+ () => Ct(kt(M, C), L)
135
135
  );
136
- P(() => {
137
- ut((t) => {
136
+ B(() => {
137
+ et((t) => {
138
138
  const a = {
139
- ...b,
139
+ ...C,
140
140
  ...t,
141
- start_time: t.start_time.trim() ? t.start_time : b.start_time,
142
- end_time: t.end_time.trim() ? t.end_time : b.end_time
143
- }, r = Lt(At(j, a), B);
144
- return Dt(t, r) ? t : r;
141
+ start_time: t.start_time.trim() ? t.start_time : C.start_time,
142
+ end_time: t.end_time.trim() ? t.end_time : C.end_time
143
+ }, r = Ct(kt(M, a), L);
144
+ return It(t, r) ? t : r;
145
145
  });
146
- }, [j, b, B]), P(() => {
147
- const t = wt(g, s);
148
- t.toString() !== g.toString() && I(t, { replace: !0 });
149
- }, [s, g, I]), P(() => {
150
- ve(o, s);
151
- }, [s, o]);
152
- const W = p(
153
- () => Le([...k, ...f]),
154
- [f, k]
155
- ), [pt, D] = S([]), [ft, q] = S(!1);
156
- P(() => {
157
- if (!o || W.length === 0) {
158
- D([]), q(!1);
146
+ }, [M, C, L]), B(() => {
147
+ const t = xt(f, l);
148
+ t.toString() !== f.toString() && u(t, { replace: !0 });
149
+ }, [l, f, u]), B(() => {
150
+ he(o, l);
151
+ }, [l, o]);
152
+ const U = p(
153
+ () => Oe([...y, ...N]),
154
+ [N, y]
155
+ ), [at, it] = A([]);
156
+ B(() => {
157
+ if (!o || U.length === 0) {
158
+ it([]);
159
159
  return;
160
160
  }
161
- let t = !1;
162
- return q(!0), D([]), (async () => {
161
+ const t = vt(l);
162
+ if (!t)
163
+ return;
164
+ let a = !1;
165
+ return (async () => {
163
166
  try {
164
- const a = await It(
165
- Vt,
167
+ const r = await _t(
168
+ yt,
166
169
  {
167
170
  storeSlug: o,
168
- schedule: {
169
- startDate: s.start_date,
170
- endDate: s.end_date,
171
- startTime: s.start_time,
172
- endTime: s.end_time
173
- },
174
- products: W
171
+ schedule: t,
172
+ products: U
175
173
  }
176
- ), r = Pt.parse(a);
177
- if (t) return;
178
- D(r.success ? r.availability ?? [] : []);
179
- } catch (a) {
180
- if (t) return;
181
- console.error("Failed to load storefront availability", a), D([]);
182
- } finally {
183
- t || q(!1);
174
+ ), g = St.parse(r);
175
+ if (a) return;
176
+ it(g.success ? g.availability ?? [] : []);
177
+ } catch (r) {
178
+ if (a) return;
179
+ console.error("Failed to load storefront availability", r);
184
180
  }
185
181
  })(), () => {
186
- t = !0;
182
+ a = !0;
187
183
  };
188
184
  }, [
189
- W,
190
- s.end_date,
191
- s.end_time,
192
- s.start_date,
193
- s.start_time,
185
+ U,
186
+ l.end_date,
187
+ l.end_time,
188
+ l.start_date,
189
+ l.start_time,
194
190
  o
195
191
  ]);
196
- const x = p(() => new Map(
197
- pt.map((t) => [
192
+ const P = p(() => new Map(
193
+ at.map((t) => [
198
194
  h(t.productId, t.productVariantId),
199
195
  t
200
196
  ])
201
- ), [pt]), L = p(() => k.map((t) => {
202
- const a = lt(t, x);
197
+ ), [at]), nt = p(() => y.map((t) => {
198
+ const a = Pt(t, P);
203
199
  return {
204
200
  ...t,
205
- availabilityStatus: a ? K(a) : t.availabilityStatus ?? "AVAILABLE"
201
+ availabilityStatus: a ? Y(a) : t.availabilityStatus ?? "AVAILABLE"
206
202
  };
207
- }), [x, k]), gt = (t, a) => {
208
- const r = Ot(t, a, x);
209
- return r ? ue(r) : t.availabilityStatus === "OUT_OF_STOCK";
210
- }, ht = (t) => (t.productVariants ?? []).length > 0, bt = (t, a) => {
211
- const r = Ot(t, a, x);
212
- return r ? dt(e, r, K(r)) : t.availabilityStatus === "OUT_OF_STOCK" ? e("availability_out_of_stock") : null;
213
- }, Mt = ye(o), Ut = p(
203
+ }), [P, y]), rt = (t, a) => {
204
+ const r = wt(t, a, P);
205
+ return r ? de(r) : t.availabilityStatus === "OUT_OF_STOCK";
206
+ }, ot = (t) => (t.productVariants ?? []).length > 0, st = (t, a) => {
207
+ const r = wt(t, a, P);
208
+ return r ? Te(e, r, Y(r)) : t.availabilityStatus === "OUT_OF_STOCK" ? e("availability_out_of_stock") : null;
209
+ }, Rt = be(o), Ft = p(
214
210
  () => ({
215
211
  startDate: e("booking_start_date"),
216
212
  pickStartDate: e("booking_start_date"),
@@ -221,267 +217,272 @@ function ua() {
221
217
  selectedDaysTooltip: ({ count: t }) => e("booking_selected_days_tooltip", { count: t })
222
218
  }),
223
219
  [n.language, e]
224
- ), y = (t) => {
225
- ut((a) => {
220
+ ), S = (t) => {
221
+ et((a) => {
226
222
  const r = { ...a, ...t };
227
- return Dt(a, r) ? a : r;
223
+ return It(a, r) ? a : r;
228
224
  });
229
- }, jt = {
230
- startDate: st(s.start_date),
225
+ }, Kt = {
226
+ startDate: Z(l.start_date),
231
227
  onStartDateChange: (t) => {
232
- t && y({ start_date: Bt(t) });
228
+ t && S({ start_date: Vt(t) });
233
229
  },
234
- startTime: s.start_time,
235
- onStartTimeChange: (t) => y({ start_time: t }),
236
- endDate: st(s.end_date) ?? st(s.start_date),
230
+ startTime: l.start_time,
231
+ onStartTimeChange: (t) => S({ start_time: t }),
232
+ endDate: Z(l.end_date) ?? Z(l.start_date),
237
233
  onEndDateChange: (t) => {
238
- t && y({ end_date: Bt(t) });
234
+ t && S({ end_date: Vt(t) });
239
235
  },
240
- endTime: s.end_time,
241
- onEndTimeChange: (t) => y({ end_time: t }),
242
- bookingPeriodConfig: U,
243
- fetchTimeSlots: Mt,
244
- labels: Ut,
236
+ endTime: l.end_time,
237
+ onEndTimeChange: (t) => S({ end_time: t }),
238
+ bookingPeriodConfig: Dt,
239
+ fetchTimeSlots: Rt,
240
+ labels: Ft,
245
241
  localeCode: n.language
246
- }, V = p(
247
- () => ke({
248
- items: A,
242
+ }, w = p(
243
+ () => ve({
244
+ items: V,
249
245
  language: n.language,
250
246
  fallbackLanguage: m,
251
- products: { bikes: L, accessories: f }
247
+ products: { bikes: T, accessories: v }
252
248
  }),
253
- [f, L, n.language, A, m]
254
- ), G = p(
255
- () => V.lines.map((t) => ({
249
+ [v, T, n.language, V, m]
250
+ ), j = p(
251
+ () => w.lines.map((t) => ({
256
252
  productId: t.checkoutProductId,
257
253
  productVariantId: t.productVariantId,
258
254
  quantity: t.quantity
259
255
  })),
260
- [V.lines]
261
- ), [_t, O] = S([]), [Q, Y] = S(!1);
262
- P(() => {
263
- if (!o || G.length === 0) {
264
- O([]), Y(!1);
256
+ [w.lines]
257
+ ), [lt, dt] = A([]);
258
+ B(() => {
259
+ if (!o || j.length === 0) {
260
+ dt([]);
265
261
  return;
266
262
  }
267
- let t = !1;
268
- return Y(!0), O([]), (async () => {
263
+ const t = vt(l);
264
+ if (!t)
265
+ return;
266
+ let a = !1;
267
+ return (async () => {
269
268
  try {
270
- const a = await It(
271
- Vt,
269
+ const r = await _t(
270
+ yt,
272
271
  {
273
272
  storeSlug: o,
274
- schedule: {
275
- startDate: s.start_date,
276
- endDate: s.end_date,
277
- startTime: s.start_time,
278
- endTime: s.end_time
279
- },
280
- products: G
273
+ schedule: t,
274
+ products: j
281
275
  }
282
- ), r = Pt.parse(a);
283
- if (t) return;
284
- O(r.success ? r.availability ?? [] : []);
285
- } catch (a) {
286
- if (t) return;
287
- console.error("Failed to load storefront cart availability", a), O([]);
288
- } finally {
289
- t || Y(!1);
276
+ ), g = St.parse(r);
277
+ if (a) return;
278
+ dt(g.success ? g.availability ?? [] : []);
279
+ } catch (r) {
280
+ if (a) return;
281
+ console.error("Failed to load storefront cart availability", r);
290
282
  }
291
283
  })(), () => {
292
- t = !0;
284
+ a = !0;
293
285
  };
294
286
  }, [
295
- s.end_date,
296
- s.end_time,
297
- s.start_date,
298
- s.start_time,
299
- G,
287
+ l.end_date,
288
+ l.end_time,
289
+ l.start_date,
290
+ l.start_time,
291
+ j,
300
292
  o
301
293
  ]);
302
- const vt = p(() => new Map(
303
- _t.map((t) => [
294
+ const ct = p(() => new Map(
295
+ lt.map((t) => [
304
296
  h(t.productId, t.productVariantId),
305
297
  t
306
298
  ])
307
- ), [_t]), yt = p(
299
+ ), [lt]), mt = p(
308
300
  () => ({
309
- ...V,
310
- lines: V.lines.map((t) => {
311
- const a = vt.get(h(t.checkoutProductId, t.productVariantId)), r = a ? Ft(a) : t.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
301
+ ...w,
302
+ lines: w.lines.map((t) => {
303
+ const a = ct.get(h(t.checkoutProductId, t.productVariantId)), r = a ? Tt(a) : t.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
312
304
  return {
313
305
  ...t,
314
- insufficientCapacity: !Q && r !== void 0,
315
- availabilityIssue: Q ? void 0 : r
306
+ insufficientCapacity: r !== void 0,
307
+ availabilityIssue: r
316
308
  };
317
309
  })
318
310
  }),
319
- [vt, Q, V]
320
- ), N = wt(new URLSearchParams(), s).toString(), Wt = `/${o ?? ""}${N ? `?${N}` : ""}`, qt = `/${o ?? ""}/booking${N ? `?${N}` : ""}`, H = `/${o ?? ""}/checkout${N ? `?${N}` : ""}`, St = {
311
+ [ct, w]
312
+ ), k = xt(new URLSearchParams(), l).toString(), Et = `/${o ?? ""}${k ? `?${k}` : ""}`, zt = `/${o ?? ""}/booking${k ? `?${k}` : ""}`, q = `/${o ?? ""}/checkout${k ? `?${k}` : ""}`, ut = {
321
313
  backTo: `${d.pathname}${d.search}${d.hash}`
322
- }, [Gt, $] = S(null), [Qt, kt] = S({}), J = (t) => {
323
- const a = Qt[t.id];
324
- return a && t.productVariants?.some((r) => r.id === a) ? a : C(t);
325
- }, xt = g.get(ot)?.trim() ?? "", _ = xt ? L.find((t) => t.id === xt) ?? null : null, X = (t) => {
326
- const a = new URLSearchParams(g);
327
- t?.trim() ? a.set(ot, t) : a.delete(ot), I(a, { replace: !0 });
328
- }, Yt = (t) => {
329
- const a = C(t);
330
- a && (kt((r) => r[t.id] ? r : { ...r, [t.id]: a }), $(t.id));
331
- }, Ht = (t) => {
332
- C(t) && ($(null), X(t.id));
314
+ }, [Mt, $] = A(null), [Ut, pt] = A({}), G = (t) => {
315
+ const a = Ut[t.id];
316
+ return a && t.productVariants?.some((r) => r.id === a) ? a : x(t);
317
+ }, ft = f.get(X)?.trim() ?? "", b = ft ? nt.find((t) => t.id === ft) ?? null : null, W = (t) => {
318
+ const a = new URLSearchParams(f);
319
+ t?.trim() ? a.set(X, t) : a.delete(X), u(a, { replace: !0 });
320
+ }, jt = (t) => {
321
+ const a = x(t);
322
+ a && (pt((r) => r[t.id] ? r : { ...r, [t.id]: a }), $(t.id));
323
+ }, qt = (t) => {
324
+ x(t) && ($(null), W(t.id));
333
325
  }, R = (t, a, r = 1) => {
334
- w({
326
+ E({
335
327
  kind: t.kind,
336
- productId: t.id,
328
+ productId: K(t),
337
329
  ...a ? { productVariantId: a } : {},
338
330
  quantity: r
339
331
  });
340
- }, Jt = (t) => {
341
- const a = C(t), r = t.productVariants ?? [];
332
+ }, Gt = (t) => {
333
+ const a = x(t), r = t.productVariants ?? [];
342
334
  if (a && r.length <= 1) {
343
335
  R(t, a);
344
336
  return;
345
337
  }
346
- Ht(t);
347
- }, Xt = (t) => {
348
- const a = t.productVariants ?? [], r = J(t);
338
+ qt(t);
339
+ }, Wt = (t) => {
340
+ const a = t.productVariants ?? [], r = G(t);
349
341
  if (r) {
350
342
  if (a.length > 1) {
351
- Yt(t);
343
+ jt(t);
352
344
  return;
353
345
  }
354
346
  R(t, r);
355
347
  }
356
- }, Zt = (t) => {
357
- const a = J(t);
348
+ }, Qt = (t) => {
349
+ const a = G(t);
358
350
  a && (R(t, a), $((r) => r === t.id ? null : r));
359
351
  };
360
352
  return /* @__PURE__ */ c("div", { className: "mx-auto max-w-7xl px-4 py-8 sm:px-6", children: [
361
353
  /* @__PURE__ */ c("div", { className: "flex flex-col gap-4", children: [
362
- /* @__PURE__ */ i(Ne, { currentStep: "booking", bookingPath: qt, checkoutPath: H, checkoutEnabled: u > 0 }),
354
+ /* @__PURE__ */ i(Se, { currentStep: "booking", bookingPath: zt, checkoutPath: q, checkoutEnabled: I > 0 }),
363
355
  /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3", children: [
364
- /* @__PURE__ */ c(it, { to: Wt, className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950", children: [
365
- /* @__PURE__ */ i(se, { className: "h-4 w-4", "aria-hidden": "true" }),
356
+ /* @__PURE__ */ c(Q, { to: Et, className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950", children: [
357
+ /* @__PURE__ */ i(ne, { className: "h-4 w-4", "aria-hidden": "true" }),
366
358
  /* @__PURE__ */ i("span", { children: e("back_to_home") })
367
359
  ] }),
368
- /* @__PURE__ */ i(it, { to: H, className: ct(u > 0 ? "inline-flex" : "hidden"), children: /* @__PURE__ */ c(E, { size: "sm", className: "gap-2", children: [
369
- /* @__PURE__ */ i(le, { className: "h-4 w-4", "aria-hidden": "true" }),
360
+ /* @__PURE__ */ i(Q, { to: q, className: tt(I > 0 ? "inline-flex" : "hidden"), children: /* @__PURE__ */ c(F, { size: "sm", className: "gap-2", children: [
361
+ /* @__PURE__ */ i(re, { className: "h-4 w-4", "aria-hidden": "true" }),
370
362
  /* @__PURE__ */ i("span", { children: e("checkout_button") })
371
363
  ] }) })
372
364
  ] }),
373
365
  /* @__PURE__ */ c("div", { className: "grid gap-6 lg:grid-cols-12", children: [
374
366
  /* @__PURE__ */ i("div", { className: "lg:col-span-8", children: /* @__PURE__ */ c("div", { className: "space-y-6", children: [
375
367
  /* @__PURE__ */ c("div", { className: "space-y-3", children: [
376
- /* @__PURE__ */ i(rt, { stepNumber: 1, title: e("booking_summary_title") }),
368
+ /* @__PURE__ */ i(J, { stepNumber: 1, title: e("booking_summary_title") }),
377
369
  /* @__PURE__ */ i(
378
- Ce,
370
+ ke,
379
371
  {
380
- ...jt,
372
+ ...Kt,
381
373
  className: "gap-3",
382
374
  labelClassName: "text-xs font-medium text-slate-700",
383
375
  inputClassName: "h-10"
384
376
  }
385
377
  ),
386
378
  /* @__PURE__ */ i(
387
- Ae,
379
+ Ie,
388
380
  {
389
- value: s.fulfillment,
390
- onValueChange: (t) => y({ fulfillment: t }),
391
- pickupAddress: zt,
392
- deliveryEnabled: B,
393
- deliveryDisabledReason: Et,
394
- startAddress: s.start_address,
395
- onStartAddressChange: (t) => y({ start_address: t }),
396
- endAddress: s.end_address,
397
- onEndAddressChange: (t) => y({ end_address: t }),
381
+ value: l.fulfillment,
382
+ onValueChange: (t) => S({ fulfillment: t }),
383
+ pickupAddress: $t,
384
+ deliveryEnabled: L,
385
+ deliveryDisabledReason: Lt,
386
+ startAddress: l.start_address,
387
+ onStartAddressChange: (t) => S({ start_address: t }),
388
+ endAddress: l.end_address,
389
+ onEndAddressChange: (t) => S({ end_address: t }),
398
390
  testIdPrefix: "storefront-booking-fulfillment"
399
391
  }
400
392
  )
401
393
  ] }),
402
394
  /* @__PURE__ */ c("div", { id: "booking-products", className: "space-y-2 scroll-mt-32", children: [
403
- /* @__PURE__ */ i(rt, { stepNumber: 2, title: e("products_title") }),
395
+ /* @__PURE__ */ i(J, { stepNumber: 2, title: e("products_title") }),
404
396
  /* @__PURE__ */ i("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ i("span", { children: e("products_description") }) })
405
397
  ] }),
406
- /* @__PURE__ */ i("div", { className: "grid gap-4 md:grid-cols-2", children: L.map((t) => {
407
- const a = lt(t, x), r = K(a), Z = `/${o ?? ""}/products/${t.slug}`, F = !!C(t) || ht(t), et = ft ? e("availability_checking") : dt(e, a, r);
398
+ /* @__PURE__ */ i("div", { className: "grid gap-4 md:grid-cols-2", children: nt.map((t) => {
399
+ const a = `/${o ?? ""}/products/${t.slug}`, g = !!x(t) || ot(t);
408
400
  return /* @__PURE__ */ i(
409
- Ie,
401
+ xe,
410
402
  {
411
403
  bike: t,
412
- detailsPath: Z,
413
- productDetailsLinkState: St,
404
+ detailsPath: a,
405
+ productDetailsLinkState: ut,
414
406
  actionLabelKey: "add_to_cart",
415
- onAction: () => Jt(t),
416
- actionDisabled: !F,
417
- availabilityLabel: et,
407
+ onAction: () => Gt(t),
408
+ actionDisabled: !g,
418
409
  fallbackLanguage: m,
410
+ variant: "booking",
419
411
  testId: `storefront-booking-bike-card-${t.id}`.toLowerCase()
420
412
  },
421
413
  t.id
422
414
  );
423
415
  }) }),
424
416
  /* @__PURE__ */ c("div", { className: "space-y-2 pt-4", children: [
425
- /* @__PURE__ */ i(rt, { stepNumber: 3, title: e("accessories_title") }),
417
+ /* @__PURE__ */ i(J, { stepNumber: 3, title: e("accessories_title") }),
426
418
  /* @__PURE__ */ i("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ i("span", { children: e("accessories_description") }) })
427
419
  ] }),
428
- /* @__PURE__ */ i("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: f.map((t) => {
429
- const a = nt(t.name, n.language, m), r = nt(t.description, n.language, m), Z = nt(t.warning, n.language, m), tt = typeof t.images?.[0] == "string" ? t.images[0].trim() : "", F = xe(t.primaryImageStyle), et = `/${o ?? ""}/products/${t.slug}`, te = C(t), Nt = J(t), Ct = lt(t, x), at = K(Ct), ee = !!te || ht(t), ae = ft ? e("availability_checking") : dt(e, Ct, at);
420
+ /* @__PURE__ */ i("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: N.map((t) => {
421
+ const a = H(t.name, n.language, m), r = H(t.description, n.language, m), g = H(t.warning, n.language, m), gt = typeof t.images?.[0] == "string" ? t.images[0].trim() : "", ht = ye(t.primaryImageStyle), Yt = `/${o ?? ""}/products/${t.slug}`, Ht = x(t), bt = G(t), Jt = Pt(t, P), Xt = Y(Jt) === "OUT_OF_STOCK", Zt = !!Ht || ot(t);
430
422
  return /* @__PURE__ */ i(
431
- pe,
423
+ ce,
432
424
  {
433
- className: "border-slate-200 bg-white shadow-sm",
434
- children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-2 p-3", children: [
435
- /* @__PURE__ */ i(
425
+ className: "h-full border-slate-200 bg-white shadow-sm",
426
+ children: /* @__PURE__ */ c("div", { className: "flex h-full flex-col gap-2 p-3", children: [
427
+ /* @__PURE__ */ c(
436
428
  "div",
437
429
  {
438
- className: ct("relative aspect-[1618/1000] overflow-hidden rounded-xl", F.className),
439
- style: F.style,
440
- children: tt ? /* @__PURE__ */ i("img", { src: tt, alt: a, className: "absolute inset-0 h-full w-full object-contain p-1", loading: "lazy" }) : /* @__PURE__ */ i("div", { className: "absolute inset-0 flex items-center justify-center text-slate-400", children: /* @__PURE__ */ i(de, { className: "h-8 w-8", "aria-hidden": "true" }) })
430
+ className: tt("relative aspect-[1618/1000] overflow-hidden rounded-xl", ht.className),
431
+ style: ht.style,
432
+ children: [
433
+ gt ? /* @__PURE__ */ i("img", { src: gt, alt: a, className: "absolute inset-0 h-full w-full object-contain p-1", loading: "lazy" }) : /* @__PURE__ */ i("div", { className: "absolute inset-0 flex items-center justify-center text-slate-400", children: /* @__PURE__ */ i(oe, { className: "h-8 w-8", "aria-hidden": "true" }) }),
434
+ Xt ? /* @__PURE__ */ i(
435
+ Ot,
436
+ {
437
+ variant: "destructive",
438
+ className: "pointer-events-none absolute right-2 top-2 shadow-sm",
439
+ children: /* @__PURE__ */ i("span", { children: e("availability_out_of_stock") })
440
+ }
441
+ ) : null
442
+ ]
441
443
  }
442
444
  ),
443
445
  /* @__PURE__ */ c("div", { className: "flex flex-1 flex-col gap-1", children: [
444
- /* @__PURE__ */ i("p", { className: "text-sm font-semibold text-slate-950", children: /* @__PURE__ */ i("span", { children: a }) }),
446
+ /* @__PURE__ */ c("div", { className: "flex items-start justify-between gap-2", children: [
447
+ /* @__PURE__ */ i("p", { className: "min-w-0 text-sm font-semibold text-slate-950", children: /* @__PURE__ */ i("span", { children: a }) }),
448
+ /* @__PURE__ */ i(Ce, { prices: t.prices, className: "shrink-0" })
449
+ ] }),
445
450
  /* @__PURE__ */ i("p", { className: "line-clamp-2 text-xs text-slate-600", children: /* @__PURE__ */ i("span", { children: r }) }),
446
- /* @__PURE__ */ i(Te, { warning: Z, className: "mt-1" })
447
- ] }),
448
- /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
449
- /* @__PURE__ */ i(Kt, { variant: at === "OUT_OF_STOCK" ? "destructive" : at === "LOW_STOCK" ? "outline" : "secondary", children: /* @__PURE__ */ i("span", { children: ae }) }),
450
- /* @__PURE__ */ i(we, { prices: t.prices })
451
+ /* @__PURE__ */ i(Pe, { warning: g, className: "mt-1" })
451
452
  ] }),
452
- t.productVariants?.length && t.productVariants.length > 1 && Gt === t.id && Nt ? /* @__PURE__ */ i(
453
- Oe,
453
+ t.productVariants?.length && t.productVariants.length > 1 && Mt === t.id && bt ? /* @__PURE__ */ i(
454
+ De,
454
455
  {
455
456
  product: t,
456
- selectedVariantId: Nt,
457
- onSelect: (v) => kt((ie) => ({ ...ie, [t.id]: v })),
458
- onConfirm: () => Zt(t),
459
- onCancel: () => $((v) => v === t.id ? null : v),
460
- getVariantAvailabilityLabel: (v) => bt(t, v),
461
- isVariantOutOfCapacity: (v) => gt(t, v)
457
+ selectedVariantId: bt,
458
+ onSelect: (_) => pt((te) => ({ ...te, [t.id]: _ })),
459
+ onConfirm: () => Qt(t),
460
+ onCancel: () => $((_) => _ === t.id ? null : _),
461
+ getVariantAvailabilityLabel: (_) => st(t, _),
462
+ isVariantOutOfCapacity: (_) => rt(t, _)
462
463
  }
463
464
  ) : null,
464
- /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
465
+ /* @__PURE__ */ c("div", { className: "mt-auto flex items-center gap-2", children: [
465
466
  /* @__PURE__ */ i(
466
- it,
467
+ Q,
467
468
  {
468
- to: et,
469
- state: St,
469
+ to: Yt,
470
+ state: ut,
470
471
  className: "text-xs font-medium text-slate-700 hover:text-slate-950",
471
472
  children: /* @__PURE__ */ i("span", { children: e("product_details_link") })
472
473
  }
473
474
  ),
474
475
  /* @__PURE__ */ c(
475
- E,
476
+ F,
476
477
  {
477
478
  type: "button",
478
479
  size: "sm",
479
480
  className: "ml-auto rounded-full gap-2",
480
- onClick: () => Xt(t),
481
- disabled: !ee,
481
+ onClick: () => Wt(t),
482
+ disabled: !Zt,
482
483
  children: [
483
484
  /* @__PURE__ */ i("span", { children: e("add_to_cart") }),
484
- /* @__PURE__ */ i($t, { className: "h-4 w-4", "aria-hidden": "true" })
485
+ /* @__PURE__ */ i(At, { className: "h-4 w-4", "aria-hidden": "true" })
485
486
  ]
486
487
  }
487
488
  )
@@ -493,35 +494,35 @@ function ua() {
493
494
  }) })
494
495
  ] }) }),
495
496
  /* @__PURE__ */ i("div", { className: "lg:col-span-4", children: /* @__PURE__ */ i(
496
- Ve,
497
+ Ne,
497
498
  {
498
- lines: yt.lines,
499
- itemCount: u,
500
- totalPerDayMinor: yt.totalPerDayMinor,
501
- checkoutPath: H,
499
+ lines: mt.lines,
500
+ itemCount: I,
501
+ totalPerDayMinor: mt.totalPerDayMinor,
502
+ checkoutPath: q,
502
503
  showCheckoutAction: !0,
503
504
  showClearAction: !0,
504
505
  editable: !0,
505
506
  stickyTopClassName: "top-32",
506
- onQuantityChange: T,
507
- onRemove: M,
508
- onClear: z
507
+ onQuantityChange: D,
508
+ onRemove: z,
509
+ onClear: O
509
510
  }
510
511
  ) })
511
512
  ] })
512
513
  ] }),
513
514
  /* @__PURE__ */ i(
514
- Pe,
515
+ Ve,
515
516
  {
516
- open: !!_,
517
- product: _,
517
+ open: !!b,
518
+ product: b,
518
519
  onOpenChange: (t) => {
519
- t || X(null);
520
+ t || W(null);
520
521
  },
521
- getVariantAvailabilityLabel: (t) => _ ? bt(_, t) : null,
522
- isVariantOutOfCapacity: (t) => _ ? gt(_, t) : !1,
522
+ getVariantAvailabilityLabel: (t) => b ? st(b, t) : null,
523
+ isVariantOutOfCapacity: (t) => b ? rt(b, t) : !1,
523
524
  onAddVariant: (t, a) => {
524
- _ && (R(_, t, a), X(null));
525
+ b && (R(b, t, a), W(null));
525
526
  }
526
527
  }
527
528
  )