@loczer/storefront-sdk 0.159.0 → 0.161.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.
@@ -0,0 +1,4 @@
1
+ import { JourneyType, TimeSlot } from './booking-period-time-slots';
2
+ export type StorefrontTimeSlotsFetcher = (date: string, journey: JourneyType) => Promise<TimeSlot[] | null>;
3
+ export declare const createStorefrontTimeSlotsFetcher: (storeSlug?: string) => StorefrontTimeSlotsFetcher | undefined;
4
+ //# sourceMappingURL=fetchStorefrontTimeSlots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchStorefrontTimeSlots.d.ts","sourceRoot":"","sources":["../../src/lib/fetchStorefrontTimeSlots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAO7E,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAA;AAI3G,eAAO,MAAM,gCAAgC,GAAI,YAAY,MAAM,KAAG,0BAA0B,GAAG,SAsBlG,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { apiGet as l } from "./apiCall.js";
2
+ import { ROUTE as u, responseSchema as m } from "./storefrontTimeSlots.js";
3
+ const s = /* @__PURE__ */ new Map(), f = (c) => {
4
+ const e = c?.trim().toLowerCase();
5
+ if (!e)
6
+ return;
7
+ const t = s.get(e);
8
+ if (t)
9
+ return t;
10
+ const r = async (n, a) => {
11
+ const i = await l(u, {
12
+ storeSlug: e,
13
+ date: n,
14
+ journey: a
15
+ }), o = m.parse(i);
16
+ return o.success ? o.timeSlots ?? null : null;
17
+ };
18
+ return s.set(e, r), r;
19
+ };
20
+ export {
21
+ f as createStorefrontTimeSlotsFetcher
22
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAwQA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA+lBlC"}
1
+ {"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AAwQA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA2lBlC"}
@@ -2,39 +2,40 @@ import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
2
  import { useMemo as p, useState as S, useEffect as P } from "react";
3
3
  import { useParams as ne, useLocation as re, useSearchParams as oe, Link as it } from "@rpcbase/router";
4
4
  import { cn as ct } from "@rpcbase/ui";
5
- import { ArrowLeft as se, ShoppingCart as le, Bike as de, ArrowRight as Rt } from "lucide-react";
6
- import { useTranslation as Ft } from "react-i18next";
7
- import { apiPost as Vt } from "../lib/apiCall.js";
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
8
  import { getProductVariantAttributeValue as ce, getStorefrontProductVariantDisplay as me } from "../lib/productVariants.js";
9
9
  import { getStorefrontCheckoutProductId as mt } from "../lib/products.js";
10
- import { ROUTE as Pt, responseSchema as At, buildStorefrontAvailabilityKey as h, getStorefrontAvailabilityStatus as K, getStorefrontAvailabilityIssue as Kt, isStorefrontAvailabilityInsufficient as ue } from "../lib/storefrontAvailability.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
11
  import { getLocalizedValue as nt } from "../localization.js";
12
- import { Badge as Et } from "../ui/badge.js";
12
+ import { Badge as Kt } from "../ui/badge.js";
13
13
  import { Button as E } from "../ui/button.js";
14
14
  import { Card as pe } from "../ui/card.js";
15
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 Tt, applyBookingParamsToSearch as wt, writeBookingSearchParamsToSessionStorage as ve, TIME_OPTIONS as ye } from "../lib/booking.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";
17
18
  import { useStorefrontCart as Se } from "../lib/cart.js";
18
19
  import { buildStorefrontCartSummary as ke } from "../lib/cartSummary.js";
19
20
  import { resolveProductImageContainerStyle as xe } from "../lib/productImageStyles.js";
20
21
  import { BookingFlowSteps as Ne } from "../components/BookingFlowSteps/index.js";
21
22
  import { StepSectionTitle as rt } from "../components/StepSectionTitle/index.js";
22
- import { BookingPeriodSelector as Ie } from "../components/BookingPeriodSelector/index.js";
23
- import { BikeProductCard as Ce } from "../components/BikeProductCard/index.js";
23
+ import { BookingPeriodSelector as Ce } from "../components/BookingPeriodSelector/index.js";
24
+ import { BikeProductCard as Ie } from "../components/BikeProductCard/index.js";
24
25
  import { StorefrontCartPanel as Ve } from "../components/StorefrontCartPanel/index.js";
25
26
  import { BookingBikeVariantDialog as Pe } from "../components/BookingBikeVariantDialog/index.js";
26
27
  import { FulfillmentSection as Ae } from "../components/FulfillmentSection/index.js";
27
- import { ProductPriceBadge as Te } from "../components/ProductPriceBadge/index.js";
28
- import { ProductWarningNotice as we } from "../components/ProductWarningNotice/index.js";
29
- import { useStorefront as Oe, useStorefrontProducts as Be } from "../StorefrontProvider.js";
30
- const Ot = (e) => String(e).padStart(2, "0"), ot = "product_modal", Bt = (e) => `${e.getFullYear()}-${Ot(e.getMonth() + 1)}-${Ot(e.getDate())}`, st = (e) => {
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) => {
31
32
  if (!e) return;
32
33
  const n = e.match(/^(\d{4})-(\d{2})-(\d{2})$/);
33
34
  if (!n) return;
34
35
  const o = Number(n[1]), d = Number(n[2]), l = Number(n[3]), m = new Date(o, d - 1, l);
35
36
  if (!(Number.isNaN(m.getTime()) || m.getFullYear() !== o || m.getMonth() !== d - 1 || m.getDate() !== l))
36
37
  return m;
37
- }, 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, I = (e, n = () => !0) => {
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
39
  if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
39
40
  const o = e.productVariants ?? [], l = o.find((m) => n(m.id))?.id ?? o[0]?.id;
40
41
  return typeof l == "string" && l.trim().length > 0 ? l : null;
@@ -45,10 +46,10 @@ const Ot = (e) => String(e).padStart(2, "0"), ot = "product_modal", Bt = (e) =>
45
46
  if (l) return l;
46
47
  }
47
48
  return n.get(h(o));
48
- }, $t = (e, n, o) => o.get(h(mt(e), n)), dt = (e, n, o) => {
49
- const d = Kt(n);
49
+ }, Ot = (e, n, o) => o.get(h(mt(e), n)), dt = (e, n, o) => {
50
+ const d = Ft(n);
50
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");
51
- }, De = (e) => {
52
+ }, Le = (e) => {
52
53
  const n = /* @__PURE__ */ new Map();
53
54
  for (const o of e) {
54
55
  const d = mt(o);
@@ -66,7 +67,7 @@ const Ot = (e) => String(e).padStart(2, "0"), ot = "product_modal", Bt = (e) =>
66
67
  }
67
68
  return Array.from(n.values());
68
69
  };
69
- function Le({
70
+ function Oe({
70
71
  product: e,
71
72
  selectedVariantId: n,
72
73
  onSelect: o,
@@ -75,26 +76,26 @@ function Le({
75
76
  getVariantAvailabilityLabel: m,
76
77
  isVariantOutOfCapacity: k
77
78
  }) {
78
- const { t: f } = Ft(), g = e.productVariants ?? [], C = g.some((u) => !!ce(u, "size")), A = f(C ? "product_size_label" : "product_variant_label");
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
80
  return /* @__PURE__ */ c("div", { className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3", children: [
80
81
  /* @__PURE__ */ i("p", { className: "text-xs font-medium text-slate-700", children: /* @__PURE__ */ i("span", { children: A }) }),
81
82
  /* @__PURE__ */ i(fe, { value: n, onValueChange: o, className: "grid gap-2", children: g.map((u) => {
82
- const T = `booking-variant-${e.id}-${u.id}`.toLowerCase(), M = `storefront-booking-variant-option-${e.id}-${u.id}`.toLowerCase(), { label: z, description: w } = me(u), U = k(u.id), b = m(u.id);
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);
83
84
  return /* @__PURE__ */ c(
84
85
  "label",
85
86
  {
86
- htmlFor: T,
87
- "data-testid": M,
87
+ htmlFor: w,
88
+ "data-testid": z,
88
89
  className: ct(
89
90
  "flex items-start gap-3 rounded-xl border p-3 transition",
90
91
  n === u.id ? "border-slate-900 bg-white" : "border-slate-200 bg-white"
91
92
  ),
92
93
  children: [
93
- /* @__PURE__ */ i(ge, { id: T, value: u.id, className: "mt-1" }),
94
+ /* @__PURE__ */ i(ge, { id: w, value: u.id, className: "mt-1" }),
94
95
  /* @__PURE__ */ c("span", { className: "flex flex-1 flex-col gap-0.5", children: [
95
- /* @__PURE__ */ i("span", { className: "text-sm font-medium text-slate-950", children: z }),
96
- w ? /* @__PURE__ */ i("span", { className: "text-xs text-slate-600", children: w }) : null,
97
- b ? /* @__PURE__ */ i("span", { className: "pt-1", children: /* @__PURE__ */ i(Et, { variant: U ? "destructive" : "outline", children: /* @__PURE__ */ i("span", { children: b }) }) }) : null
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
98
99
  ] })
99
100
  ]
100
101
  },
@@ -111,7 +112,7 @@ function Le({
111
112
  onClick: d,
112
113
  children: [
113
114
  /* @__PURE__ */ i("span", { children: f("add_to_cart") }),
114
- /* @__PURE__ */ i(Rt, { className: "h-4 w-4", "aria-hidden": "true" })
115
+ /* @__PURE__ */ i($t, { className: "h-4 w-4", "aria-hidden": "true" })
115
116
  ]
116
117
  }
117
118
  ),
@@ -119,18 +120,18 @@ function Le({
119
120
  ] })
120
121
  ] });
121
122
  }
122
- function ma() {
123
- const { t: e, i18n: n } = Ft(), { storeSlug: o } = ne(), d = re(), { storefrontConfiguration: l } = Oe(), m = l.workspace?.workspaceLanguage, { bikes: k, accessories: f } = Be(), [g, C] = oe(), { items: A, itemCount: u, addItem: T, clear: M, removeItem: z, setQuantity: w } = Se(), U = p(
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(
124
125
  () => he(l),
125
126
  [l]
126
127
  ), b = p(
127
128
  () => be(l),
128
129
  [l]
129
- ), O = l.settings.fulfillmentModes.includes("delivery"), Mt = l.settings.deliveryDisabledReason.trim(), zt = l.shop.address?.trim() ?? "", j = p(
130
+ ), B = l.settings.fulfillmentModes.includes("delivery"), Et = l.settings.deliveryDisabledReason.trim(), zt = l.shop.address?.trim() ?? "", j = p(
130
131
  () => _e(g, o),
131
132
  [g, o]
132
133
  ), [s, ut] = S(
133
- () => Lt(Tt(j, b), O)
134
+ () => Lt(At(j, b), B)
134
135
  );
135
136
  P(() => {
136
137
  ut((t) => {
@@ -139,29 +140,29 @@ function ma() {
139
140
  ...t,
140
141
  start_time: t.start_time.trim() ? t.start_time : b.start_time,
141
142
  end_time: t.end_time.trim() ? t.end_time : b.end_time
142
- }, r = Lt(Tt(j, a), O);
143
+ }, r = Lt(At(j, a), B);
143
144
  return Dt(t, r) ? t : r;
144
145
  });
145
- }, [j, b, O]), P(() => {
146
+ }, [j, b, B]), P(() => {
146
147
  const t = wt(g, s);
147
- t.toString() !== g.toString() && C(t, { replace: !0 });
148
- }, [s, g, C]), P(() => {
148
+ t.toString() !== g.toString() && I(t, { replace: !0 });
149
+ }, [s, g, I]), P(() => {
149
150
  ve(o, s);
150
151
  }, [s, o]);
151
152
  const W = p(
152
- () => De([...k, ...f]),
153
+ () => Le([...k, ...f]),
153
154
  [f, k]
154
- ), [pt, B] = S([]), [ft, q] = S(!1);
155
+ ), [pt, D] = S([]), [ft, q] = S(!1);
155
156
  P(() => {
156
157
  if (!o || W.length === 0) {
157
- B([]), q(!1);
158
+ D([]), q(!1);
158
159
  return;
159
160
  }
160
161
  let t = !1;
161
- return q(!0), B([]), (async () => {
162
+ return q(!0), D([]), (async () => {
162
163
  try {
163
- const a = await Vt(
164
- Pt,
164
+ const a = await It(
165
+ Vt,
165
166
  {
166
167
  storeSlug: o,
167
168
  schedule: {
@@ -172,12 +173,12 @@ function ma() {
172
173
  },
173
174
  products: W
174
175
  }
175
- ), r = At.parse(a);
176
+ ), r = Pt.parse(a);
176
177
  if (t) return;
177
- B(r.success ? r.availability ?? [] : []);
178
+ D(r.success ? r.availability ?? [] : []);
178
179
  } catch (a) {
179
180
  if (t) return;
180
- console.error("Failed to load storefront availability", a), B([]);
181
+ console.error("Failed to load storefront availability", a), D([]);
181
182
  } finally {
182
183
  t || q(!1);
183
184
  }
@@ -197,22 +198,19 @@ function ma() {
197
198
  h(t.productId, t.productVariantId),
198
199
  t
199
200
  ])
200
- ), [pt]), D = p(() => k.map((t) => {
201
+ ), [pt]), L = p(() => k.map((t) => {
201
202
  const a = lt(t, x);
202
203
  return {
203
204
  ...t,
204
205
  availabilityStatus: a ? K(a) : t.availabilityStatus ?? "AVAILABLE"
205
206
  };
206
207
  }), [x, k]), gt = (t, a) => {
207
- const r = $t(t, a, x);
208
+ const r = Ot(t, a, x);
208
209
  return r ? ue(r) : t.availabilityStatus === "OUT_OF_STOCK";
209
210
  }, ht = (t) => (t.productVariants ?? []).length > 0, bt = (t, a) => {
210
- const r = $t(t, a, x);
211
+ const r = Ot(t, a, x);
211
212
  return r ? dt(e, r, K(r)) : t.availabilityStatus === "OUT_OF_STOCK" ? e("availability_out_of_stock") : null;
212
- }, _t = p(
213
- () => ye.map((t) => ({ value: t, label: t })),
214
- []
215
- ), Ut = p(
213
+ }, Mt = ye(o), Ut = p(
216
214
  () => ({
217
215
  startDate: e("booking_start_date"),
218
216
  pickStartDate: e("booking_start_date"),
@@ -241,9 +239,8 @@ function ma() {
241
239
  },
242
240
  endTime: s.end_time,
243
241
  onEndTimeChange: (t) => y({ end_time: t }),
244
- startTimeOptions: _t,
245
- endTimeOptions: _t,
246
242
  bookingPeriodConfig: U,
243
+ fetchTimeSlots: Mt,
247
244
  labels: Ut,
248
245
  localeCode: n.language
249
246
  }, V = p(
@@ -251,9 +248,9 @@ function ma() {
251
248
  items: A,
252
249
  language: n.language,
253
250
  fallbackLanguage: m,
254
- products: { bikes: D, accessories: f }
251
+ products: { bikes: L, accessories: f }
255
252
  }),
256
- [f, D, n.language, A, m]
253
+ [f, L, n.language, A, m]
257
254
  ), G = p(
258
255
  () => V.lines.map((t) => ({
259
256
  productId: t.checkoutProductId,
@@ -261,17 +258,17 @@ function ma() {
261
258
  quantity: t.quantity
262
259
  })),
263
260
  [V.lines]
264
- ), [vt, L] = S([]), [Q, Y] = S(!1);
261
+ ), [_t, O] = S([]), [Q, Y] = S(!1);
265
262
  P(() => {
266
263
  if (!o || G.length === 0) {
267
- L([]), Y(!1);
264
+ O([]), Y(!1);
268
265
  return;
269
266
  }
270
267
  let t = !1;
271
- return Y(!0), L([]), (async () => {
268
+ return Y(!0), O([]), (async () => {
272
269
  try {
273
- const a = await Vt(
274
- Pt,
270
+ const a = await It(
271
+ Vt,
275
272
  {
276
273
  storeSlug: o,
277
274
  schedule: {
@@ -282,12 +279,12 @@ function ma() {
282
279
  },
283
280
  products: G
284
281
  }
285
- ), r = At.parse(a);
282
+ ), r = Pt.parse(a);
286
283
  if (t) return;
287
- L(r.success ? r.availability ?? [] : []);
284
+ O(r.success ? r.availability ?? [] : []);
288
285
  } catch (a) {
289
286
  if (t) return;
290
- console.error("Failed to load storefront cart availability", a), L([]);
287
+ console.error("Failed to load storefront cart availability", a), O([]);
291
288
  } finally {
292
289
  t || Y(!1);
293
290
  }
@@ -302,16 +299,16 @@ function ma() {
302
299
  G,
303
300
  o
304
301
  ]);
305
- const yt = p(() => new Map(
306
- vt.map((t) => [
302
+ const vt = p(() => new Map(
303
+ _t.map((t) => [
307
304
  h(t.productId, t.productVariantId),
308
305
  t
309
306
  ])
310
- ), [vt]), St = p(
307
+ ), [_t]), yt = p(
311
308
  () => ({
312
309
  ...V,
313
310
  lines: V.lines.map((t) => {
314
- const a = yt.get(h(t.checkoutProductId, t.productVariantId)), r = a ? Kt(a) : t.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
311
+ const a = vt.get(h(t.checkoutProductId, t.productVariantId)), r = a ? Ft(a) : t.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
315
312
  return {
316
313
  ...t,
317
314
  insufficientCapacity: !Q && r !== void 0,
@@ -319,29 +316,29 @@ function ma() {
319
316
  };
320
317
  })
321
318
  }),
322
- [yt, Q, V]
323
- ), N = wt(new URLSearchParams(), s).toString(), Wt = `/${o ?? ""}${N ? `?${N}` : ""}`, qt = `/${o ?? ""}/booking${N ? `?${N}` : ""}`, H = `/${o ?? ""}/checkout${N ? `?${N}` : ""}`, kt = {
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 = {
324
321
  backTo: `${d.pathname}${d.search}${d.hash}`
325
- }, [Gt, $] = S(null), [Qt, xt] = S({}), J = (t) => {
322
+ }, [Gt, $] = S(null), [Qt, kt] = S({}), J = (t) => {
326
323
  const a = Qt[t.id];
327
- return a && t.productVariants?.some((r) => r.id === a) ? a : I(t);
328
- }, Nt = g.get(ot)?.trim() ?? "", _ = Nt ? D.find((t) => t.id === Nt) ?? null : null, X = (t) => {
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) => {
329
326
  const a = new URLSearchParams(g);
330
- t?.trim() ? a.set(ot, t) : a.delete(ot), C(a, { replace: !0 });
327
+ t?.trim() ? a.set(ot, t) : a.delete(ot), I(a, { replace: !0 });
331
328
  }, Yt = (t) => {
332
- const a = I(t);
333
- a && (xt((r) => r[t.id] ? r : { ...r, [t.id]: a }), $(t.id));
329
+ const a = C(t);
330
+ a && (kt((r) => r[t.id] ? r : { ...r, [t.id]: a }), $(t.id));
334
331
  }, Ht = (t) => {
335
- I(t) && ($(null), X(t.id));
332
+ C(t) && ($(null), X(t.id));
336
333
  }, R = (t, a, r = 1) => {
337
- T({
334
+ w({
338
335
  kind: t.kind,
339
336
  productId: t.id,
340
337
  ...a ? { productVariantId: a } : {},
341
338
  quantity: r
342
339
  });
343
340
  }, Jt = (t) => {
344
- const a = I(t), r = t.productVariants ?? [];
341
+ const a = C(t), r = t.productVariants ?? [];
345
342
  if (a && r.length <= 1) {
346
343
  R(t, a);
347
344
  return;
@@ -378,7 +375,7 @@ function ma() {
378
375
  /* @__PURE__ */ c("div", { className: "space-y-3", children: [
379
376
  /* @__PURE__ */ i(rt, { stepNumber: 1, title: e("booking_summary_title") }),
380
377
  /* @__PURE__ */ i(
381
- Ie,
378
+ Ce,
382
379
  {
383
380
  ...jt,
384
381
  className: "gap-3",
@@ -392,8 +389,8 @@ function ma() {
392
389
  value: s.fulfillment,
393
390
  onValueChange: (t) => y({ fulfillment: t }),
394
391
  pickupAddress: zt,
395
- deliveryEnabled: O,
396
- deliveryDisabledReason: Mt,
392
+ deliveryEnabled: B,
393
+ deliveryDisabledReason: Et,
397
394
  startAddress: s.start_address,
398
395
  onStartAddressChange: (t) => y({ start_address: t }),
399
396
  endAddress: s.end_address,
@@ -406,14 +403,14 @@ function ma() {
406
403
  /* @__PURE__ */ i(rt, { stepNumber: 2, title: e("products_title") }),
407
404
  /* @__PURE__ */ i("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ i("span", { children: e("products_description") }) })
408
405
  ] }),
409
- /* @__PURE__ */ i("div", { className: "grid gap-4 md:grid-cols-2", children: D.map((t) => {
410
- const a = lt(t, x), r = K(a), Z = `/${o ?? ""}/products/${t.slug}`, F = !!I(t) || ht(t), et = ft ? e("availability_checking") : dt(e, a, r);
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);
411
408
  return /* @__PURE__ */ i(
412
- Ce,
409
+ Ie,
413
410
  {
414
411
  bike: t,
415
412
  detailsPath: Z,
416
- productDetailsLinkState: kt,
413
+ productDetailsLinkState: St,
417
414
  actionLabelKey: "add_to_cart",
418
415
  onAction: () => Jt(t),
419
416
  actionDisabled: !F,
@@ -429,7 +426,7 @@ function ma() {
429
426
  /* @__PURE__ */ i("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ i("span", { children: e("accessories_description") }) })
430
427
  ] }),
431
428
  /* @__PURE__ */ i("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: f.map((t) => {
432
- 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 = I(t), It = J(t), Ct = lt(t, x), at = K(Ct), ee = !!te || ht(t), ae = ft ? e("availability_checking") : dt(e, Ct, at);
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);
433
430
  return /* @__PURE__ */ i(
434
431
  pe,
435
432
  {
@@ -446,18 +443,18 @@ function ma() {
446
443
  /* @__PURE__ */ c("div", { className: "flex flex-1 flex-col gap-1", children: [
447
444
  /* @__PURE__ */ i("p", { className: "text-sm font-semibold text-slate-950", children: /* @__PURE__ */ i("span", { children: a }) }),
448
445
  /* @__PURE__ */ i("p", { className: "line-clamp-2 text-xs text-slate-600", children: /* @__PURE__ */ i("span", { children: r }) }),
449
- /* @__PURE__ */ i(we, { warning: Z, className: "mt-1" })
446
+ /* @__PURE__ */ i(Te, { warning: Z, className: "mt-1" })
450
447
  ] }),
451
448
  /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
452
- /* @__PURE__ */ i(Et, { variant: at === "OUT_OF_STOCK" ? "destructive" : at === "LOW_STOCK" ? "outline" : "secondary", children: /* @__PURE__ */ i("span", { children: ae }) }),
453
- /* @__PURE__ */ i(Te, { prices: t.prices })
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 })
454
451
  ] }),
455
- t.productVariants?.length && t.productVariants.length > 1 && Gt === t.id && It ? /* @__PURE__ */ i(
456
- Le,
452
+ t.productVariants?.length && t.productVariants.length > 1 && Gt === t.id && Nt ? /* @__PURE__ */ i(
453
+ Oe,
457
454
  {
458
455
  product: t,
459
- selectedVariantId: It,
460
- onSelect: (v) => xt((ie) => ({ ...ie, [t.id]: v })),
456
+ selectedVariantId: Nt,
457
+ onSelect: (v) => kt((ie) => ({ ...ie, [t.id]: v })),
461
458
  onConfirm: () => Zt(t),
462
459
  onCancel: () => $((v) => v === t.id ? null : v),
463
460
  getVariantAvailabilityLabel: (v) => bt(t, v),
@@ -469,7 +466,7 @@ function ma() {
469
466
  it,
470
467
  {
471
468
  to: et,
472
- state: kt,
469
+ state: St,
473
470
  className: "text-xs font-medium text-slate-700 hover:text-slate-950",
474
471
  children: /* @__PURE__ */ i("span", { children: e("product_details_link") })
475
472
  }
@@ -484,7 +481,7 @@ function ma() {
484
481
  disabled: !ee,
485
482
  children: [
486
483
  /* @__PURE__ */ i("span", { children: e("add_to_cart") }),
487
- /* @__PURE__ */ i(Rt, { className: "h-4 w-4", "aria-hidden": "true" })
484
+ /* @__PURE__ */ i($t, { className: "h-4 w-4", "aria-hidden": "true" })
488
485
  ]
489
486
  }
490
487
  )
@@ -498,17 +495,17 @@ function ma() {
498
495
  /* @__PURE__ */ i("div", { className: "lg:col-span-4", children: /* @__PURE__ */ i(
499
496
  Ve,
500
497
  {
501
- lines: St.lines,
498
+ lines: yt.lines,
502
499
  itemCount: u,
503
- totalPerDayMinor: St.totalPerDayMinor,
500
+ totalPerDayMinor: yt.totalPerDayMinor,
504
501
  checkoutPath: H,
505
502
  showCheckoutAction: !0,
506
503
  showClearAction: !0,
507
504
  editable: !0,
508
505
  stickyTopClassName: "top-32",
509
- onQuantityChange: w,
510
- onRemove: z,
511
- onClear: M
506
+ onQuantityChange: T,
507
+ onRemove: M,
508
+ onClear: z
512
509
  }
513
510
  ) })
514
511
  ] })
@@ -531,5 +528,5 @@ function ma() {
531
528
  ] });
532
529
  }
533
530
  export {
534
- ma as default
531
+ ua as default
535
532
  };
@@ -1 +1 @@
1
- {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AAyGA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CA0pB/B"}
1
+ {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AAyGA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAspB/B"}