@loczer/storefront-sdk 0.192.0 → 0.194.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 (56) hide show
  1. package/dist/chunks/pkg/booking-engine/dist/models/{Product.shared-cjcvMCMa.js → Product.shared-iVSHRdn4.js} +21 -21
  2. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-asset-CsOe0vXi.js → base-asset-BRQVuIes.js} +1 -1
  3. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-booking-Sjsqh31e.js → base-booking-Bhy2Kww1.js} +2 -2
  4. package/dist/chunks/pkg/booking-engine/dist/schemas/{base-product-C_ATjuc6.js → base-product-BJHQLX8t.js} +1 -1
  5. package/dist/chunks/pkg/booking-engine/dist/schemas/{insurance-B01h642r.js → insurance-CPeHsTss.js} +1 -1
  6. package/dist/chunks/pkg/booking-engine/dist/schemas-BfXM1Dgb.js +14 -0
  7. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  8. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +35 -53
  9. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  10. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +35 -53
  11. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +1 -1
  12. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.d.ts +7 -0
  13. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.d.ts.map +1 -0
  14. package/dist/components/BookingPeriodSelector/components/internal/BookingHourPickerField.js +29 -0
  15. package/dist/components/BookingPeriodSelector/components/internal/ModalHourPickerField.d.ts.map +1 -1
  16. package/dist/components/BookingPeriodSelector/components/internal/ModalHourPickerField.js +11 -2
  17. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +3 -0
  18. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  19. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +114 -110
  20. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.d.ts +10 -0
  21. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.d.ts.map +1 -0
  22. package/dist/components/ContractSaleDocument/DocumentAcceptanceSection.js +104 -0
  23. package/dist/components/ContractSaleDocument/Invoice.d.ts +2 -2
  24. package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
  25. package/dist/components/ContractSaleDocument/Invoice.js +182 -135
  26. package/dist/components/ContractSaleDocument/InvoiceDetails.d.ts.map +1 -1
  27. package/dist/components/ContractSaleDocument/InvoiceDetails.js +106 -138
  28. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts +0 -2
  29. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.d.ts.map +1 -1
  30. package/dist/components/ContractSaleDocument/TermsAndConditionsContent.js +32 -37
  31. package/dist/i18n/en.d.ts +4 -0
  32. package/dist/i18n/en.d.ts.map +1 -1
  33. package/dist/i18n/en.js +4 -0
  34. package/dist/i18n/fr.d.ts +4 -0
  35. package/dist/i18n/fr.d.ts.map +1 -1
  36. package/dist/i18n/fr.js +4 -0
  37. package/dist/index.d.ts +126 -9
  38. package/dist/index.js +70 -70
  39. package/dist/lib/booking.js +1 -1
  40. package/dist/lib/checkoutSubmit.js +2 -2
  41. package/dist/lib/contractSaleDocument.d.ts +44 -3
  42. package/dist/lib/contractSaleDocument.d.ts.map +1 -1
  43. package/dist/lib/contractSaleDocument.js +33 -17
  44. package/dist/lib/contractSaleDocumentApi.d.ts +54 -6
  45. package/dist/lib/contractSaleDocumentApi.d.ts.map +1 -1
  46. package/dist/lib/contractSaleDocumentApi.js +41 -37
  47. package/dist/pages/BookingPage.d.ts.map +1 -1
  48. package/dist/pages/BookingPage.js +180 -152
  49. package/dist/pages/ContractSaleDocumentPage.d.ts +21 -9
  50. package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
  51. package/dist/pages/HomePage.d.ts.map +1 -1
  52. package/dist/pages/HomePage.js +263 -257
  53. package/dist/storefront.css +1 -1
  54. package/dist/storefrontSchemas.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/chunks/pkg/booking-engine/dist/schemas-D_yUBLa0.js +0 -14
@@ -29,30 +29,30 @@ import { Link as E, useLocation as ye, useParams as be, useSearchParams as xe }
29
29
  import { useTranslation as Se } from "react-i18next";
30
30
  import { ArrowLeft as Ce, ArrowRight as we, Bike as Te, ShoppingCart as Ee } from "lucide-react";
31
31
  //#region src/pages/BookingPage.tsx
32
- var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e.getFullYear()}-${D(e.getMonth() + 1)}-${D(e.getDate())}`, k = (e) => {
32
+ var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e.getFullYear()}-${D(e.getMonth() + 1)}-${D(e.getDate())}`, Oe = (e) => {
33
33
  if (!e) return;
34
34
  let t = e.match(/^(\d{4})-(\d{2})-(\d{2})$/);
35
35
  if (!t) return;
36
36
  let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a = new Date(n, r - 1, i);
37
37
  if (!(Number.isNaN(a.getTime()) || a.getFullYear() !== n || a.getMonth() !== r - 1 || a.getDate() !== i)) return a;
38
- }, Oe = (e, t) => e.fulfillment === t.fulfillment && e.start_date === t.start_date && e.start_time === t.start_time && e.end_date === t.end_date && e.end_time === t.end_time && e.start_address === t.start_address && e.end_address === t.end_address, A = (e, t = () => !0) => {
38
+ }, ke = (e, t) => e.fulfillment === t.fulfillment && e.start_date === t.start_date && e.start_time === t.start_time && e.end_date === t.end_date && e.end_time === t.end_time && e.start_address === t.start_address && e.end_address === t.end_address, k = (e, t = () => !0) => {
39
39
  if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
40
40
  let n = e.productVariants ?? [], r = n.find((e) => t(e.id))?.id ?? n[0]?.id;
41
41
  return typeof r == "string" && r.trim().length > 0 ? r : null;
42
- }, ke = (e, t) => e.fulfillment === "delivery" && !t ? {
42
+ }, Ae = (e, t) => e.fulfillment === "delivery" && !t ? {
43
43
  ...e,
44
44
  fulfillment: "pickup"
45
- } : e, Ae = (e, t) => {
45
+ } : e, je = (e, t) => {
46
46
  let n = c(e), r = e.representedVariantId?.trim();
47
47
  if (r) {
48
48
  let e = t.get(p(n, r));
49
49
  if (e) return e;
50
50
  }
51
51
  return t.get(p(n));
52
- }, je = (e, t, n) => n.get(p(c(e), t)), Me = (e, t, n) => {
52
+ }, Me = (e, t, n) => n.get(p(c(e), t)), Ne = (e, t, n) => {
53
53
  let r = ee(t);
54
54
  return r === "quantity_unavailable" ? e("availability_quantity_unavailable") : r === "unavailable" || n === "OUT_OF_STOCK" ? e("availability_out_of_stock") : t?.remaining === void 0 ? t?.fewRemaining || n === "LOW_STOCK" ? e("availability_low_stock") : e("availability_in_stock") : e("availability_remaining_count", { count: t.remaining });
55
- }, Ne = (e) => {
55
+ }, Pe = (e) => {
56
56
  let t = /* @__PURE__ */ new Map();
57
57
  for (let n of e) {
58
58
  let e = c(n);
@@ -69,7 +69,7 @@ var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e
69
69
  }
70
70
  return Array.from(t.values());
71
71
  };
72
- function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: c, confirmDisabled: l = !1 }) {
72
+ function Fe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: c, confirmDisabled: l = !1 }) {
73
73
  let { t: u } = Se(), d = e.productVariants ?? [];
74
74
  return /* @__PURE__ */ w("div", {
75
75
  className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3",
@@ -139,39 +139,61 @@ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCan
139
139
  ]
140
140
  });
141
141
  }
142
- function j() {
143
- let { t: o, i18n: s } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), j = D.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = ce(), { bikes: M, accessories: N } = se(), [P, F] = xe(), { items: Le, itemCount: I, addItem: Re, clear: ze, removeItem: Be, setQuantity: Ve } = l(), He = x(() => t(D), [D]), L = x(() => r(D), [D]), R = D.settings.fulfillmentModes.includes("delivery"), Ue = D.settings.deliveryDisabledReason.trim(), We = D.shop.address?.trim() ?? "", z = x(() => i(P, v), [P, v]), [B, Ge] = S(() => ke(n(z, L), R)), [Ke, qe] = S(void 0);
142
+ function A() {
143
+ let { t: o, i18n: s } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), A = D.workspace?.workspaceLanguage, { bikes: Ie, accessories: Le } = ce(), { bikes: j, accessories: M } = se(), [N, P] = xe(), { items: Re, itemCount: F, addItem: ze, clear: Be, removeItem: Ve, setQuantity: He } = l(), Ue = x(() => t(D), [D]), I = x(() => r(D), [D]), L = D.settings.fulfillmentModes.includes("delivery"), We = D.settings.deliveryDisabledReason.trim(), Ge = D.shop.address?.trim() ?? "", R = x(() => i(N, v), [N, v]), [z, Ke] = S(() => Ae(n(R, I), L)), [qe, Je] = S(void 0), Ye = [
144
+ z.start_date,
145
+ z.start_time,
146
+ z.end_date,
147
+ z.end_time
148
+ ].join(":"), B = qe === Ye, V = B ? z.start_time : "", H = B ? z.end_time : "", Xe = !B && N.get("start_date") === z.start_date && N.get("start_time") === z.start_time && N.get("end_date") === z.end_date && N.get("end_time") === z.end_time;
144
149
  b(() => {
145
- Ge((e) => {
150
+ Ke((e) => {
146
151
  let t = {
147
- ...L,
152
+ ...I,
148
153
  ...e
149
- }, r = ke(n(z, t), R);
150
- return Oe(e, r) ? e : r;
154
+ }, r = Ae(n(R, t), L);
155
+ return ke(e, r) ? e : r;
151
156
  });
152
157
  }, [
153
- z,
154
- L,
155
- R
158
+ R,
159
+ I,
160
+ L
156
161
  ]), b(() => {
157
- let t = e(P, B);
158
- t.toString() !== P.toString() && F(t, { replace: !0 });
162
+ if (Xe) return;
163
+ let t = e(N, {
164
+ ...z,
165
+ start_time: V,
166
+ end_time: H
167
+ });
168
+ t.toString() !== N.toString() && P(t, { replace: !0 });
159
169
  }, [
160
- B,
161
- P,
162
- F
170
+ z,
171
+ Xe,
172
+ H,
173
+ V,
174
+ N,
175
+ P
163
176
  ]), b(() => {
164
- a(v, B);
165
- }, [B, v]);
166
- let V = x(() => Ne([...M, ...N]), [N, M]), [Je, H] = S([]);
177
+ a(v, {
178
+ ...z,
179
+ start_time: V,
180
+ end_time: H
181
+ });
182
+ }, [
183
+ z,
184
+ H,
185
+ V,
186
+ v
187
+ ]);
188
+ let U = x(() => Pe([...j, ...M]), [M, j]), [Ze, W] = S([]);
167
189
  b(() => {
168
- if (!v || V.length === 0) {
169
- H([]);
190
+ if (!v || U.length === 0) {
191
+ W([]);
170
192
  return;
171
193
  }
172
- let e = h(B);
194
+ let e = B ? h(z) : null;
173
195
  if (!e) {
174
- H([]);
196
+ W([]);
175
197
  return;
176
198
  }
177
199
  let t = !1;
@@ -180,10 +202,10 @@ function j() {
180
202
  let n = await he(f, {
181
203
  storeSlug: v,
182
204
  schedule: e,
183
- products: V
205
+ products: U
184
206
  }), r = ne.parse(n);
185
207
  if (t) return;
186
- H(r.success ? r.availability ?? [] : []);
208
+ W(r.success ? r.availability ?? [] : []);
187
209
  } catch (e) {
188
210
  if (t) return;
189
211
  console.error("Failed to load storefront availability", e);
@@ -192,26 +214,27 @@ function j() {
192
214
  t = !0;
193
215
  };
194
216
  }, [
195
- V,
196
- B.end_date,
197
- B.end_time,
198
- B.start_date,
199
- B.start_time,
217
+ U,
218
+ z.end_date,
219
+ z.end_time,
220
+ z.start_date,
221
+ z.start_time,
222
+ B,
200
223
  v
201
224
  ]);
202
- let U = x(() => new Map(Je.map((e) => [p(e.productId, e.productVariantId), e])), [Je]), Ye = x(() => M.map((e) => {
203
- let t = Ae(e, U);
225
+ let G = x(() => new Map(Ze.map((e) => [p(e.productId, e.productVariantId), e])), [Ze]), Qe = x(() => j.map((e) => {
226
+ let t = je(e, G);
204
227
  return {
205
228
  ...e,
206
229
  availabilityStatus: t ? m(t) : e.availabilityStatus ?? "AVAILABLE"
207
230
  };
208
- }), [U, M]), Xe = (e, t) => {
209
- let n = je(e, t, U);
231
+ }), [G, j]), $e = (e, t) => {
232
+ let n = Me(e, t, G);
210
233
  return n ? te(n) : e.availabilityStatus === "OUT_OF_STOCK";
211
- }, Ze = (e) => (e.productVariants ?? []).length > 0, Qe = (e, t) => {
212
- let n = je(e, t, U);
213
- return n ? Me(o, n, m(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? o("availability_out_of_stock") : null;
214
- }, $e = ge(v), et = x(() => ({
234
+ }, et = (e) => (e.productVariants ?? []).length > 0, tt = (e, t) => {
235
+ let n = Me(e, t, G);
236
+ return n ? Ne(o, n, m(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? o("availability_out_of_stock") : null;
237
+ }, nt = ge(v), rt = x(() => ({
215
238
  startDate: o("booking_start_date"),
216
239
  pickStartDate: o("booking_start_date"),
217
240
  startTime: o("booking_start_time"),
@@ -223,61 +246,61 @@ function j() {
223
246
  timeSlotsUnavailable: o("booking_time_slots_unavailable"),
224
247
  timeSlotsLoadError: o("booking_time_slots_load_error"),
225
248
  retryTimeSlots: o("booking_time_slots_retry")
226
- }), [s.language, o]), W = (e) => {
227
- Ge((t) => {
249
+ }), [s.language, o]), K = (e) => {
250
+ Ke((t) => {
228
251
  let n = {
229
252
  ...t,
230
253
  ...e
231
254
  };
232
- return Oe(t, n) ? t : n;
255
+ return ke(t, n) ? t : n;
233
256
  });
234
- }, tt = `${B.start_date}:${B.end_date}`, nt = {
235
- startDate: k(B.start_date),
257
+ }, it = {
258
+ startDate: Oe(z.start_date),
236
259
  onStartDateChange: (e) => {
237
- e && W({ start_date: De(e) });
260
+ e && K({ start_date: De(e) });
238
261
  },
239
- startTime: B.start_time,
240
- onStartTimeChange: (e) => W({ start_time: e }),
241
- endDate: k(B.end_date) ?? k(B.start_date),
262
+ startTime: z.start_time,
263
+ onStartTimeChange: (e) => K({ start_time: e }),
264
+ endDate: Oe(z.end_date) ?? Oe(z.start_date),
242
265
  onEndDateChange: (e) => {
243
- e && W({ end_date: De(e) });
266
+ e && K({ end_date: De(e) });
244
267
  },
245
- endTime: B.end_time,
246
- onEndTimeChange: (e) => W({ end_time: e }),
247
- bookingPeriodConfig: He,
248
- fetchTimeSlots: $e,
249
- onTimeSlotsAvailabilityChange: (e) => {
250
- qe(e ? tt : void 0);
268
+ endTime: z.end_time,
269
+ onEndTimeChange: (e) => K({ end_time: e }),
270
+ bookingPeriodConfig: Ue,
271
+ fetchTimeSlots: nt,
272
+ onTimeSlotsConfirmationChange: (e) => {
273
+ Je(e ? Ye : void 0);
251
274
  },
252
- labels: et,
275
+ labels: rt,
253
276
  localeCode: s.language
254
- }, G = x(() => d({
255
- items: Le,
277
+ }, q = x(() => d({
278
+ items: Re,
256
279
  language: s.language,
257
- fallbackLanguage: j,
280
+ fallbackLanguage: A,
258
281
  products: {
259
- bikes: Fe,
260
- accessories: Ie
282
+ bikes: Ie,
283
+ accessories: Le
261
284
  }
262
285
  }), [
286
+ Le,
263
287
  Ie,
264
- Fe,
265
288
  s.language,
266
- Le,
267
- j
268
- ]), K = x(() => G.lines.map((e) => ({
289
+ Re,
290
+ A
291
+ ]), J = x(() => q.lines.map((e) => ({
269
292
  productId: e.checkoutProductId,
270
293
  productVariantId: e.productVariantId,
271
294
  quantity: e.quantity
272
- })), [G.lines]), [rt, q] = S([]);
295
+ })), [q.lines]), [at, ot] = S([]);
273
296
  b(() => {
274
- if (!v || K.length === 0) {
275
- q([]);
297
+ if (!v || J.length === 0) {
298
+ ot([]);
276
299
  return;
277
300
  }
278
- let e = h(B);
301
+ let e = B ? h(z) : null;
279
302
  if (!e) {
280
- q([]);
303
+ ot([]);
281
304
  return;
282
305
  }
283
306
  let t = !1;
@@ -286,10 +309,10 @@ function j() {
286
309
  let n = await he(f, {
287
310
  storeSlug: v,
288
311
  schedule: e,
289
- products: K
312
+ products: J
290
313
  }), r = ne.parse(n);
291
314
  if (t) return;
292
- q(r.success ? r.availability ?? [] : []);
315
+ ot(r.success ? r.availability ?? [] : []);
293
316
  } catch (e) {
294
317
  if (t) return;
295
318
  console.error("Failed to load storefront cart availability", e);
@@ -298,62 +321,67 @@ function j() {
298
321
  t = !0;
299
322
  };
300
323
  }, [
301
- B.end_date,
302
- B.end_time,
303
- B.start_date,
304
- B.start_time,
305
- K,
324
+ z.end_date,
325
+ z.end_time,
326
+ z.start_date,
327
+ z.start_time,
328
+ B,
329
+ J,
306
330
  v
307
331
  ]);
308
- let it = x(() => new Map(rt.map((e) => [p(e.productId, e.productVariantId), e])), [rt]), at = x(() => ({
309
- ...G,
310
- lines: G.lines.map((e) => {
311
- let t = it.get(p(e.checkoutProductId, e.productVariantId)), n = t ? ee(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
332
+ let st = x(() => new Map(at.map((e) => [p(e.productId, e.productVariantId), e])), [at]), ct = x(() => ({
333
+ ...q,
334
+ lines: q.lines.map((e) => {
335
+ let t = st.get(p(e.checkoutProductId, e.productVariantId)), n = t ? ee(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
312
336
  return {
313
337
  ...e,
314
338
  insufficientCapacity: n !== void 0,
315
339
  availabilityIssue: n
316
340
  };
317
341
  })
318
- }), [it, G]), J = e(new URLSearchParams(), B).toString(), Y = Ke === tt && h(B) !== null, ot = `/${v ?? ""}${J ? `?${J}` : ""}`, st = `/${v ?? ""}/booking${J ? `?${J}` : ""}`, X = `/${v ?? ""}/checkout${J ? `?${J}` : ""}`, ct = { backTo: `${y.pathname}${y.search}${y.hash}` }, [lt, Z] = S(null), [ut, dt] = S({}), ft = (e) => {
319
- let t = ut[e.id];
320
- return t && e.productVariants?.some((e) => e.id === t) ? t : A(e);
321
- }, pt = P.get(O)?.trim() ?? "", Q = pt ? Ye.find((e) => e.id === pt) ?? null : null, mt = (e) => {
322
- let t = new URLSearchParams(P);
323
- e?.trim() ? t.set(O, e) : t.delete(O), F(t, { replace: !0 });
324
- }, ht = (e) => {
325
- let t = A(e);
326
- t && (dt((n) => n[e.id] ? n : {
342
+ }), [st, q]), Y = e(new URLSearchParams(), {
343
+ ...z,
344
+ start_time: V,
345
+ end_time: H
346
+ }).toString(), X = B && h(z) !== null, lt = `/${v ?? ""}${Y ? `?${Y}` : ""}`, ut = `/${v ?? ""}/booking${Y ? `?${Y}` : ""}`, dt = `/${v ?? ""}/checkout${Y ? `?${Y}` : ""}`, ft = { backTo: `${y.pathname}${y.search}${y.hash}` }, [pt, Z] = S(null), [mt, ht] = S({}), gt = (e) => {
347
+ let t = mt[e.id];
348
+ return t && e.productVariants?.some((e) => e.id === t) ? t : k(e);
349
+ }, _t = N.get(O)?.trim() ?? "", Q = _t ? Qe.find((e) => e.id === _t) ?? null : null, vt = (e) => {
350
+ let t = new URLSearchParams(N);
351
+ e?.trim() ? t.set(O, e) : t.delete(O), P(t, { replace: !0 });
352
+ }, yt = (e) => {
353
+ let t = k(e);
354
+ t && (ht((n) => n[e.id] ? n : {
327
355
  ...n,
328
356
  [e.id]: t
329
357
  }), Z(e.id));
330
- }, gt = (e) => {
331
- A(e) && (Z(null), mt(e.id));
358
+ }, bt = (e) => {
359
+ k(e) && (Z(null), vt(e.id));
332
360
  }, $ = (e, t, n = 1) => {
333
- Y && Re({
361
+ X && ze({
334
362
  kind: e.kind,
335
363
  productId: c(e),
336
364
  ...t ? { productVariantId: t } : {},
337
365
  quantity: n
338
366
  });
339
- }, _t = (e) => {
340
- let t = A(e), n = e.productVariants ?? [];
367
+ }, xt = (e) => {
368
+ let t = k(e), n = e.productVariants ?? [];
341
369
  if (t && n.length <= 1) {
342
370
  $(e, t);
343
371
  return;
344
372
  }
345
- gt(e);
346
- }, vt = (e) => {
347
- let t = e.productVariants ?? [], n = ft(e);
373
+ bt(e);
374
+ }, St = (e) => {
375
+ let t = e.productVariants ?? [], n = gt(e);
348
376
  if (n) {
349
377
  if (t.length > 1) {
350
- ht(e);
378
+ yt(e);
351
379
  return;
352
380
  }
353
381
  $(e, n);
354
382
  }
355
- }, yt = (e) => {
356
- let t = ft(e);
383
+ }, Ct = (e) => {
384
+ let t = gt(e);
357
385
  t && ($(e, t), Z((t) => t === e.id ? null : t));
358
386
  };
359
387
  return /* @__PURE__ */ w("div", {
@@ -363,22 +391,22 @@ function j() {
363
391
  children: [
364
392
  /* @__PURE__ */ C(ae, {
365
393
  currentStep: "booking",
366
- bookingPath: st,
367
- checkoutPath: X,
368
- checkoutEnabled: I > 0 && Y
394
+ bookingPath: ut,
395
+ checkoutPath: dt,
396
+ checkoutEnabled: F > 0 && X
369
397
  }),
370
398
  /* @__PURE__ */ w("div", {
371
399
  className: "flex items-center justify-between gap-3",
372
400
  children: [/* @__PURE__ */ w(E, {
373
- to: ot,
401
+ to: lt,
374
402
  className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
375
403
  children: [/* @__PURE__ */ C(Ce, {
376
404
  className: "h-4 w-4",
377
405
  "aria-hidden": "true"
378
406
  }), /* @__PURE__ */ C("span", { children: o("back_to_home") })]
379
407
  }), /* @__PURE__ */ C(E, {
380
- to: X,
381
- className: T(I > 0 && Y ? "inline-flex" : "hidden"),
408
+ to: dt,
409
+ className: T(F > 0 && X ? "inline-flex" : "hidden"),
382
410
  children: /* @__PURE__ */ w(g, {
383
411
  size: "sm",
384
412
  className: "gap-2",
@@ -404,21 +432,21 @@ function j() {
404
432
  title: o("booking_summary_title")
405
433
  }),
406
434
  /* @__PURE__ */ C(ie, {
407
- ...nt,
435
+ ...it,
408
436
  className: "gap-3",
409
437
  labelClassName: "text-xs font-medium text-slate-700",
410
438
  inputClassName: "h-10"
411
439
  }),
412
440
  /* @__PURE__ */ C(_e, {
413
- value: B.fulfillment,
414
- onValueChange: (e) => W({ fulfillment: e }),
415
- pickupAddress: We,
416
- deliveryEnabled: R,
417
- deliveryDisabledReason: Ue,
418
- startAddress: B.start_address,
419
- onStartAddressChange: (e) => W({ start_address: e }),
420
- endAddress: B.end_address,
421
- onEndAddressChange: (e) => W({ end_address: e }),
441
+ value: z.fulfillment,
442
+ onValueChange: (e) => K({ fulfillment: e }),
443
+ pickupAddress: Ge,
444
+ deliveryEnabled: L,
445
+ deliveryDisabledReason: We,
446
+ startAddress: z.start_address,
447
+ onStartAddressChange: (e) => K({ start_address: e }),
448
+ endAddress: z.end_address,
449
+ onEndAddressChange: (e) => K({ end_address: e }),
422
450
  testIdPrefix: "storefront-booking-fulfillment"
423
451
  })
424
452
  ]
@@ -436,16 +464,16 @@ function j() {
436
464
  }),
437
465
  /* @__PURE__ */ C("div", {
438
466
  className: "grid gap-4 md:grid-cols-2",
439
- children: Ye.map((e) => {
440
- let t = `/${v ?? ""}/products/${e.slug}`, n = !!A(e) || Ze(e);
467
+ children: Qe.map((e) => {
468
+ let t = `/${v ?? ""}/products/${e.slug}`, n = !!k(e) || et(e);
441
469
  return /* @__PURE__ */ C(me, {
442
470
  bike: e,
443
471
  detailsPath: t,
444
- productDetailsLinkState: ct,
472
+ productDetailsLinkState: ft,
445
473
  actionLabelKey: "add_to_cart",
446
- onAction: () => _t(e),
447
- actionDisabled: !n || !Y,
448
- fallbackLanguage: j,
474
+ onAction: () => xt(e),
475
+ actionDisabled: !n || !X,
476
+ fallbackLanguage: A,
449
477
  variant: "booking",
450
478
  testId: `storefront-booking-bike-card-${e.id}`.toLowerCase()
451
479
  }, e.id);
@@ -463,8 +491,8 @@ function j() {
463
491
  }),
464
492
  /* @__PURE__ */ C("div", {
465
493
  className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
466
- children: N.map((e) => {
467
- let t = u(e.name, s.language, j), n = u(e.description, s.language, j), r = u(e.warning, s.language, j), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), c = `/${v ?? ""}/products/${e.slug}`, l = A(e), d = ft(e), f = m(Ae(e, U)) === "OUT_OF_STOCK", p = !!l || Ze(e);
494
+ children: M.map((e) => {
495
+ let t = u(e.name, s.language, A), n = u(e.description, s.language, A), r = u(e.warning, s.language, A), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), c = `/${v ?? ""}/products/${e.slug}`, l = k(e), d = gt(e), f = m(je(e, G)) === "OUT_OF_STOCK", p = !!l || et(e);
468
496
  return /* @__PURE__ */ C(le, {
469
497
  className: "h-full border-slate-200 bg-white shadow-sm",
470
498
  children: /* @__PURE__ */ w("div", {
@@ -513,32 +541,32 @@ function j() {
513
541
  })
514
542
  ]
515
543
  }),
516
- e.productVariants?.length && e.productVariants.length > 1 && lt === e.id && d ? /* @__PURE__ */ C(Pe, {
544
+ e.productVariants?.length && e.productVariants.length > 1 && pt === e.id && d ? /* @__PURE__ */ C(Fe, {
517
545
  product: e,
518
546
  selectedVariantId: d,
519
- onSelect: (t) => dt((n) => ({
547
+ onSelect: (t) => ht((n) => ({
520
548
  ...n,
521
549
  [e.id]: t
522
550
  })),
523
- onConfirm: () => yt(e),
551
+ onConfirm: () => Ct(e),
524
552
  onCancel: () => Z((t) => t === e.id ? null : t),
525
- getVariantAvailabilityLabel: (t) => Qe(e, t),
526
- isVariantOutOfCapacity: (t) => Xe(e, t),
527
- confirmDisabled: !Y
553
+ getVariantAvailabilityLabel: (t) => tt(e, t),
554
+ isVariantOutOfCapacity: (t) => $e(e, t),
555
+ confirmDisabled: !X
528
556
  }) : null,
529
557
  /* @__PURE__ */ w("div", {
530
558
  className: "mt-auto flex items-center gap-2",
531
559
  children: [/* @__PURE__ */ C(E, {
532
560
  to: c,
533
- state: ct,
561
+ state: ft,
534
562
  className: "text-xs font-medium text-slate-700 hover:text-slate-950",
535
563
  children: /* @__PURE__ */ C("span", { children: o("product_details_link") })
536
564
  }), /* @__PURE__ */ w(g, {
537
565
  type: "button",
538
566
  size: "sm",
539
567
  className: "ml-auto rounded-full gap-2",
540
- onClick: () => vt(e),
541
- disabled: !p || !Y,
568
+ onClick: () => St(e),
569
+ disabled: !p || !X,
542
570
  children: [/* @__PURE__ */ C("span", { children: o("add_to_cart") }), /* @__PURE__ */ C(we, {
543
571
  className: "h-4 w-4",
544
572
  "aria-hidden": "true"
@@ -555,17 +583,17 @@ function j() {
555
583
  }), /* @__PURE__ */ C("div", {
556
584
  className: "lg:col-span-4",
557
585
  children: /* @__PURE__ */ C(de, {
558
- lines: at.lines,
559
- itemCount: I,
560
- totalPerDayMinor: at.totalPerDayMinor,
561
- checkoutPath: X,
562
- showCheckoutAction: Y,
586
+ lines: ct.lines,
587
+ itemCount: F,
588
+ totalPerDayMinor: ct.totalPerDayMinor,
589
+ checkoutPath: dt,
590
+ showCheckoutAction: X,
563
591
  showClearAction: !0,
564
592
  editable: !0,
565
593
  stickyTopClassName: "top-32",
566
- onQuantityChange: Ve,
567
- onRemove: Be,
568
- onClear: ze
594
+ onQuantityChange: He,
595
+ onRemove: Ve,
596
+ onClear: Be
569
597
  })
570
598
  })]
571
599
  })
@@ -574,16 +602,16 @@ function j() {
574
602
  open: !!Q,
575
603
  product: Q,
576
604
  onOpenChange: (e) => {
577
- e || mt(null);
605
+ e || vt(null);
578
606
  },
579
- getVariantAvailabilityLabel: (e) => Q ? Qe(Q, e) : null,
580
- isVariantOutOfCapacity: (e) => Q ? Xe(Q, e) : !1,
581
- addDisabled: !Y,
607
+ getVariantAvailabilityLabel: (e) => Q ? tt(Q, e) : null,
608
+ isVariantOutOfCapacity: (e) => Q ? $e(Q, e) : !1,
609
+ addDisabled: !X,
582
610
  onAddVariant: (e, t) => {
583
- Q && ($(Q, e, t), mt(null));
611
+ Q && ($(Q, e, t), vt(null));
584
612
  }
585
613
  })]
586
614
  });
587
615
  }
588
616
  //#endregion
589
- export { j as default };
617
+ export { A as default };
@@ -74,26 +74,38 @@ export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderA
74
74
  taxRate?: number | undefined;
75
75
  taxExemptionReason?: string | undefined;
76
76
  }[];
77
- acceptanceLevel: "none" | "acceptance" | "signature";
78
- date: Date;
79
- dueDate: Date;
80
- language?: {
81
- legal: "fr" | "en";
82
- customer: "fr" | "en";
83
- translation?: "fr" | "en" | undefined;
84
- } | undefined;
85
- terms?: {
77
+ appendices: {
78
+ id: string;
79
+ kind: "rental_contract" | "rental_terms" | "sale_terms";
86
80
  title: string;
87
81
  articles: {
88
82
  id: string;
89
83
  title: string;
90
84
  body: string;
85
+ bodyHtml?: string | undefined;
91
86
  translationTitle?: string | undefined;
92
87
  translationBody?: string | undefined;
88
+ translationBodyHtml?: string | undefined;
93
89
  }[];
90
+ }[];
91
+ acceptanceLevel: "none" | "acceptance" | "signature";
92
+ date: Date;
93
+ dueDate: Date;
94
+ language?: {
95
+ legal: "fr" | "en";
96
+ customer: "fr" | "en";
97
+ translation?: "fr" | "en" | undefined;
94
98
  } | undefined;
95
99
  taxRate?: number | undefined;
96
100
  notes?: string | undefined;
101
+ rental?: {
102
+ bookingNumber: string;
103
+ start: Date;
104
+ end: Date;
105
+ pickupAddress?: string | undefined;
106
+ returnAddress?: string | undefined;
107
+ timeZone?: string | undefined;
108
+ } | undefined;
97
109
  acceptance?: {
98
110
  mode: "acceptance";
99
111
  date: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAmC,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAsLnG,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,CAAA;AAYnB,MAAM,CAAC,OAAO,UAAU,wBAAwB,4CAqP/C"}
1
+ {"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAmC,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAsLnG,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEA,CAAA;AAYnB,MAAM,CAAC,OAAO,UAAU,wBAAwB,4CAqP/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA2IA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAstB/B"}
1
+ {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA2IA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAouB/B"}