@loczer/storefront-sdk 0.187.0 → 0.189.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 (66) hide show
  1. package/dist/chunks/booking-engine/dist/models/{Product.shared-CTuk4fiR.js → Product.shared-IYOeC3N7.js} +12 -10
  2. package/dist/chunks/booking-engine/dist/schemas/{base-asset-B_Dm8_Vk.js → base-asset-zsUj5_3O.js} +1 -1
  3. package/dist/chunks/booking-engine/dist/schemas/{base-booking-DW8AEPKo.js → base-booking-TzCge_mR.js} +2 -2
  4. package/dist/chunks/booking-engine/dist/schemas/{base-product-1H8l2aUv.js → base-product-DvFFzAcg.js} +1 -1
  5. package/dist/chunks/booking-engine/dist/schemas/{booking-engine-configuration-D02MRF9U.js → booking-engine-configuration-LnrhShqm.js} +4 -1
  6. package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-j1yWfJxO.js → cart-inputs-B0HpcFe5.js} +1 -1
  7. package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-BnJ_H-p1.js → public-booking-engine-configuration-CEM9mexX.js} +1 -1
  8. package/dist/chunks/booking-engine/dist/schemas-BNUzqsci.js +13 -0
  9. package/dist/chunks/ui/dist/Map/{MapContent-QPkuTBvK.js → MapContent-PK-ptOx6.js} +126 -94
  10. package/dist/chunks/ui/dist/Map/mapboxError-oRn0l3EE.js +25 -0
  11. package/dist/chunks/ui/dist/{Map-BXmRf5Ep.js → Map-BwXj49kV.js} +1 -1
  12. package/dist/components/BookingBikeVariantDialog/index.d.ts +2 -1
  13. package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
  14. package/dist/components/BookingBikeVariantDialog/index.js +39 -38
  15. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
  16. package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +32 -30
  17. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.d.ts.map +1 -1
  18. package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +127 -122
  19. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
  20. package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +32 -30
  21. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts +7 -0
  22. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -0
  23. package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +29 -0
  24. package/dist/components/BookingPeriodSelector/index.d.ts +2 -1
  25. package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
  26. package/dist/components/BookingPeriodSelector/index.js +15 -14
  27. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +11 -0
  28. package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
  29. package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +280 -216
  30. package/dist/components/ContactSection/index.d.ts.map +1 -1
  31. package/dist/components/ContactSection/index.js +120 -116
  32. package/dist/components/Header/index.d.ts.map +1 -1
  33. package/dist/components/Header/index.js +35 -35
  34. package/dist/components/Map/index.js +1 -1
  35. package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
  36. package/dist/components/StorefrontCancellationPolicyNotice/index.js +51 -48
  37. package/dist/components/StorefrontInsuranceNotice/index.d.ts +9 -0
  38. package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -0
  39. package/dist/components/StorefrontInsuranceNotice/index.js +191 -0
  40. package/dist/i18n/en.d.ts +24 -0
  41. package/dist/i18n/en.d.ts.map +1 -1
  42. package/dist/i18n/en.js +26 -2
  43. package/dist/i18n/fr.d.ts +24 -0
  44. package/dist/i18n/fr.d.ts.map +1 -1
  45. package/dist/i18n/fr.js +26 -2
  46. package/dist/index.d.ts +91 -0
  47. package/dist/index.js +69 -68
  48. package/dist/lib/booking.js +2 -2
  49. package/dist/lib/checkoutSubmit.js +3 -3
  50. package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -1
  51. package/dist/lib/fetchStorefrontTimeSlots.js +2 -1
  52. package/dist/lib/storefrontProducts.d.ts +16 -0
  53. package/dist/lib/storefrontProducts.d.ts.map +1 -1
  54. package/dist/lib/storefrontProducts.js +27 -22
  55. package/dist/pages/BookingPage.d.ts.map +1 -1
  56. package/dist/pages/BookingPage.js +109 -95
  57. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  58. package/dist/pages/CheckoutPage.js +229 -231
  59. package/dist/pages/HomePage.d.ts.map +1 -1
  60. package/dist/pages/HomePage.js +339 -314
  61. package/dist/pages/ProductPage.d.ts.map +1 -1
  62. package/dist/pages/ProductPage.js +60 -52
  63. package/dist/storefront.css +1 -1
  64. package/dist/storefrontSchemas.js +2 -2
  65. package/package.json +1 -1
  66. package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +0 -13
@@ -1,10 +1,10 @@
1
- import { applyBookingParamsToSearch as e, getBookingDurationLabel as t, getBookingDurationMinutes as n, getBookingParamsFromSearch as r, resolveBookingSearchParamsFromSessionStorage as i, writeBookingSearchParamsToSessionStorage as ee } from "../lib/booking.js";
2
- import { useStorefrontCart as te } from "../lib/cart.js";
3
- import { buildStorefrontCartSummary as ne } from "../lib/cartSummary.js";
4
- import { ROUTE as re, responseSchema as ie } from "../lib/checkoutPaymentDecision.js";
5
- import { ROUTE as ae, responseSchema as oe } from "../lib/checkoutSubmit.js";
6
- import { ROUTE as se, buildStorefrontAvailabilityKey as ce, getStorefrontAvailabilityIssue as le, getValidStorefrontAvailabilitySchedule as ue, responseSchema as de } from "../lib/storefrontAvailability.js";
7
- import { Button as a } from "../ui/button.js";
1
+ import { applyBookingParamsToSearch as e, getBookingDurationLabel as t, getBookingDurationMinutes as n, getBookingParamsFromSearch as r, resolveBookingSearchParamsFromSessionStorage as i, writeBookingSearchParamsToSessionStorage as a } from "../lib/booking.js";
2
+ import { useStorefrontCart as ee } from "../lib/cart.js";
3
+ import { buildStorefrontCartSummary as te } from "../lib/cartSummary.js";
4
+ import { ROUTE as ne, responseSchema as re } from "../lib/checkoutPaymentDecision.js";
5
+ import { ROUTE as ie, responseSchema as ae } from "../lib/checkoutSubmit.js";
6
+ import { ROUTE as oe, buildStorefrontAvailabilityKey as se, getStorefrontAvailabilityIssue as ce, getValidStorefrontAvailabilitySchedule as le, responseSchema as ue } from "../lib/storefrontAvailability.js";
7
+ import { Button as de } from "../ui/button.js";
8
8
  import { BookingFlowSteps as fe } from "../components/BookingFlowSteps/index.js";
9
9
  import { useStorefront as pe, useStorefrontProducts as me } from "../StorefrontProvider.js";
10
10
  import { apiPost as o } from "../lib/apiCall.js";
@@ -55,90 +55,93 @@ var Ae = .2, je = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), p = (e,
55
55
  return new Intl.DateTimeFormat(t, r).format(e);
56
56
  };
57
57
  function m() {
58
- let { t: m, i18n: h } = Ee(), { storefrontConfiguration: g } = pe(), _ = g.workspace?.workspaceLanguage, { bikes: v, accessories: y } = me(), { storeSlug: b } = we(), [x, Pe] = Te(), Fe = Ce(), { items: Ie, itemCount: Le, setQuantity: Re, removeItem: ze, clear: Be } = te(), [S, Ve] = l(!1), [C, w] = l(null), [He, T] = l(!1), [Ue, E] = l(null), We = x.get("coupon") ?? x.get("code") ?? "", [D, O] = l(We), [Ge, Ke] = l(We.trim()), [k, A] = l(null), [qe, j] = l(null), [Je, M] = l(!1), [Ye, N] = l(null), [Xe, P] = l(null), [F, Ze] = l(!1), Qe = c(() => i(x, b), [x, b]), I = g.settings.fulfillmentModes.includes("delivery"), $e = g.settings.deliveryDisabledReason.trim(), et = I || $e.length > 0, tt = g.shop.address?.trim() ?? "", L = c(() => {
59
- let e = r(Qe);
60
- return e.fulfillment === "delivery" && !I ? {
58
+ let { t: m, i18n: h } = Ee(), { storefrontConfiguration: g } = pe(), Pe = g.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = me(), { storeSlug: _ } = we(), [v, Le] = Te(), Re = Ce(), { items: ze, itemCount: Be, setQuantity: Ve, removeItem: He, clear: Ue } = ee(), [y, We] = l(!1), [b, x] = l(null), [Ge, S] = l(!1), [Ke, C] = l(null), qe = v.get("coupon") ?? v.get("code") ?? "", [Je, w] = l(qe), [Ye, Xe] = l(qe.trim()), [T, E] = l(null), [Ze, D] = l(null), [Qe, O] = l(!1), [$e, k] = l(null), [et, A] = l(null), [j, tt] = l(!1), M = c(() => i(v, _), [v, _]), N = g.settings.fulfillmentModes.includes("delivery"), P = g.settings.deliveryDisabledReason.trim(), nt = N || P.length > 0, rt = g.shop.address?.trim() ?? "", F = c(() => {
59
+ let e = r(M, {
60
+ start_time: "",
61
+ end_time: ""
62
+ });
63
+ return e.fulfillment === "delivery" && !N ? {
61
64
  ...e,
62
65
  fulfillment: "pickup"
63
66
  } : e;
64
- }, [Qe, I]), nt = c(() => t(L), [L]), rt = c(() => n(L), [L]), it = c(() => je(rt), [rt]), R = c(() => ne({
65
- items: Ie,
67
+ }, [M, N]), I = c(() => le(F), [F]), it = c(() => t(F), [F]), at = c(() => n(F), [F]), ot = c(() => je(at), [at]), L = c(() => te({
68
+ items: ze,
66
69
  language: h.language,
67
- fallbackLanguage: _,
70
+ fallbackLanguage: Pe,
68
71
  products: {
69
- bikes: v,
70
- accessories: y
72
+ bikes: Fe,
73
+ accessories: Ie
71
74
  },
72
- estimatedDays: it
75
+ estimatedDays: ot
73
76
  }), [
74
- y,
75
- v,
76
- it,
77
- h.language,
78
77
  Ie,
79
- _
80
- ]), z = c(() => R.lines.map((e) => ({
78
+ Fe,
79
+ ot,
80
+ h.language,
81
+ ze,
82
+ Pe
83
+ ]), R = c(() => L.lines.map((e) => ({
81
84
  productId: e.checkoutProductId,
82
85
  productVariantId: e.productVariantId,
83
86
  quantity: e.quantity
84
- })), [R.lines]), [at, B] = l([]), [V, H] = l(!1);
87
+ })), [L.lines]), [st, z] = l([]), [B, V] = l(!1);
85
88
  s(() => {
86
- if (!b || z.length === 0) {
87
- B([]), H(!1);
89
+ if (!_ || R.length === 0) {
90
+ z([]), V(!1);
88
91
  return;
89
92
  }
90
- let e = ue(L);
91
- if (!e) {
92
- H(!1);
93
+ if (!I) {
94
+ z([]), V(!1);
93
95
  return;
94
96
  }
95
- let t = !1;
96
- return H(!0), B([]), (async () => {
97
+ let e = !1;
98
+ return V(!0), z([]), (async () => {
97
99
  try {
98
- let n = await o(se, {
99
- storeSlug: b,
100
- schedule: e,
101
- products: z
102
- }), r = de.parse(n);
103
- if (t) return;
104
- B(r.success ? r.availability ?? [] : []);
105
- } catch (e) {
106
- if (t) return;
107
- console.error("Failed to load checkout cart availability", e), B([]);
100
+ let t = await o(oe, {
101
+ storeSlug: _,
102
+ schedule: I,
103
+ products: R
104
+ }), n = ue.parse(t);
105
+ if (e) return;
106
+ z(n.success ? n.availability ?? [] : []);
107
+ } catch (t) {
108
+ if (e) return;
109
+ console.error("Failed to load checkout cart availability", t), z([]);
108
110
  } finally {
109
- t || H(!1);
111
+ e || V(!1);
110
112
  }
111
113
  })(), () => {
112
- t = !0;
114
+ e = !0;
113
115
  };
114
116
  }, [
115
- L.end_date,
116
- L.end_time,
117
- L.start_date,
118
- L.start_time,
119
- z,
120
- b
117
+ F.end_date,
118
+ F.end_time,
119
+ F.start_date,
120
+ F.start_time,
121
+ I,
122
+ R,
123
+ _
121
124
  ]);
122
- let ot = c(() => new Map(at.map((e) => [ce(e.productId, e.productVariantId), e])), [at]), U = c(() => ({
123
- ...R,
124
- lines: R.lines.map((e) => {
125
- let t = ot.get(ce(e.checkoutProductId, e.productVariantId)), n = t ? le(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
125
+ let ct = c(() => new Map(st.map((e) => [se(e.productId, e.productVariantId), e])), [st]), H = c(() => ({
126
+ ...L,
127
+ lines: L.lines.map((e) => {
128
+ let t = ct.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
126
129
  return {
127
130
  ...e,
128
- insufficientCapacity: !V && n !== void 0,
129
- availabilityIssue: V ? void 0 : n
131
+ insufficientCapacity: !B && n !== void 0,
132
+ availabilityIssue: B ? void 0 : n
130
133
  };
131
134
  })
132
135
  }), [
133
- ot,
134
- V,
135
- R
136
- ]), W = c(() => R.lines.map((e) => ({
136
+ ct,
137
+ B,
138
+ L
139
+ ]), U = c(() => L.lines.map((e) => ({
137
140
  kind: e.kind,
138
141
  productId: e.checkoutProductId,
139
142
  productVariantId: e.productVariantId,
140
143
  quantity: e.quantity
141
- })), [R.lines]), st = R.estimatedTotalMinor ?? R.totalPerDayMinor, G = qe?.totalMinor ?? st, K = k?.discountAmountMinor ?? 0, q = e(new URLSearchParams(), L).toString(), J = `/${b ?? ""}/booking${q ? `?${q}` : ""}`, ct = `/${b ?? ""}/checkout${q ? `?${q}` : ""}`, lt = Oe({
144
+ })), [L.lines]), lt = L.estimatedTotalMinor ?? L.totalPerDayMinor, W = Ze?.totalMinor ?? lt, G = T?.discountAmountMinor ?? 0, K = e(new URLSearchParams(), F).toString(), q = `/${_ ?? ""}/booking${K ? `?${K}` : ""}`, ut = `/${_ ?? ""}/checkout${K ? `?${K}` : ""}`, dt = Oe({
142
145
  resolver: ke(xe),
143
146
  defaultValues: {
144
147
  full_name: "",
@@ -148,162 +151,149 @@ function m() {
148
151
  }
149
152
  });
150
153
  s(() => {
151
- ee(b, L);
152
- }, [L, b]);
153
- let Y = (t) => {
154
+ a(_, F);
155
+ }, [F, _]);
156
+ let J = (t) => {
154
157
  let n = {
155
- ...L,
158
+ ...F,
156
159
  ...t
157
- }, r = e(x, n);
158
- Pe(r, { replace: !0 }), ee(b, r);
160
+ }, r = e(v, n);
161
+ Le(r, { replace: !0 }), a(_, r);
159
162
  };
160
163
  s(() => {
161
- if (!b || W.length === 0) {
162
- A(null), j(null), M(!1), N(null), P(null);
164
+ if (!_ || U.length === 0 || !I) {
165
+ E(null), D(null), O(!1), k(null), A(null);
163
166
  return;
164
167
  }
165
- let e = Ge.trim(), t = e.length === 0 && !F, n = !1;
166
- return M(!0), P(null), N(null), (async () => {
168
+ let e = Ye.trim(), t = e.length === 0 && !j, n = !1;
169
+ return O(!0), A(null), k(null), (async () => {
167
170
  try {
168
171
  let r = await o(ge, {
169
- storeSlug: b,
170
- schedule: {
171
- startDate: L.start_date,
172
- endDate: L.end_date,
173
- startTime: L.start_time,
174
- endTime: L.end_time
175
- },
176
- items: W,
172
+ storeSlug: _,
173
+ schedule: I,
174
+ items: U,
177
175
  couponCode: e || void 0,
178
176
  includeAutoApply: t
179
177
  }), i = _e.parse(r);
180
178
  if (n) return;
181
- if (j(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
179
+ if (D(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
182
180
  subtotalMinor: i.subtotalMinor,
183
181
  totalMinor: i.totalMinor,
184
182
  lateReturnSurchargeMinor: i.lateReturnSurchargeMinor
185
183
  } : null), !i.success) {
186
- A(null), P(i.message || m("checkout_coupon_invalid"));
184
+ E(null), A(i.message || m("checkout_coupon_invalid"));
187
185
  return;
188
186
  }
189
- A(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (O(i.coupon.code), N(m("checkout_coupon_auto_applied", { code: i.coupon.code }))) : N(m("checkout_coupon_manual_applied")));
187
+ E(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (w(i.coupon.code), k(m("checkout_coupon_auto_applied", { code: i.coupon.code }))) : k(m("checkout_coupon_manual_applied")));
190
188
  } catch (e) {
191
189
  if (n) return;
192
- console.error("Failed to verify checkout coupon", e), A(null), j(null), P(m("checkout_coupon_error"));
190
+ console.error("Failed to verify checkout coupon", e), E(null), D(null), A(m("checkout_coupon_error"));
193
191
  } finally {
194
- n || M(!1);
192
+ n || O(!1);
195
193
  }
196
194
  })(), () => {
197
195
  n = !0;
198
196
  };
199
197
  }, [
200
- F,
201
- L.end_date,
202
- L.end_time,
203
- L.start_date,
204
- L.start_time,
205
- W,
206
- b,
207
- Ge,
198
+ j,
199
+ F.end_date,
200
+ F.end_time,
201
+ F.start_date,
202
+ F.start_time,
203
+ I,
204
+ U,
205
+ _,
206
+ Ye,
208
207
  m
209
208
  ]), s(() => {
210
- if (!b || R.lines.length === 0) {
211
- w(null), E(null), T(!1);
209
+ if (!_ || L.lines.length === 0 || !I) {
210
+ x(null), C(null), S(!1);
212
211
  return;
213
212
  }
214
213
  let e = !1;
215
- return T(!0), E(null), (async () => {
214
+ return S(!0), C(null), (async () => {
216
215
  try {
217
- let t = await o(re, {
218
- storeSlug: b,
219
- schedule: {
220
- startDate: L.start_date,
221
- endDate: L.end_date,
222
- startTime: L.start_time,
223
- endTime: L.end_time
224
- },
225
- estimatedTotalMinor: G
226
- }), n = ie.parse(t);
216
+ let t = await o(ne, {
217
+ storeSlug: _,
218
+ schedule: I,
219
+ estimatedTotalMinor: W
220
+ }), n = re.parse(t);
227
221
  if (e) return;
228
222
  if (!n.success || !n.decision) {
229
- w(null), E(n.errorCode === "online_payment_provider_missing" ? m("checkout_payment_error") : n.message || m("checkout_payment_error"));
223
+ x(null), C(n.errorCode === "online_payment_provider_missing" ? m("checkout_payment_error") : n.message || m("checkout_payment_error"));
230
224
  return;
231
225
  }
232
- w(n.decision);
226
+ x(n.decision);
233
227
  } catch (t) {
234
228
  if (e) return;
235
- console.error("Failed to load checkout payment decision", t), w(null), E(m("checkout_payment_error"));
229
+ console.error("Failed to load checkout payment decision", t), x(null), C(m("checkout_payment_error"));
236
230
  } finally {
237
- e || T(!1);
231
+ e || S(!1);
238
232
  }
239
233
  })(), () => {
240
234
  e = !0;
241
235
  };
242
236
  }, [
243
- L.end_date,
244
- L.end_time,
245
- L.start_date,
246
- L.start_time,
247
- G,
248
- R.lines.length,
249
- b,
237
+ F.end_date,
238
+ F.end_time,
239
+ F.start_date,
240
+ F.start_time,
241
+ I,
242
+ W,
243
+ L.lines.length,
244
+ _,
250
245
  m
251
246
  ]);
252
- let X = C?.currency ?? "EUR", ut = p(G, X, h.language), dt = K > 0 ? `-${p(K, X, h.language)}` : null, ft = Math.round(G / 1.2), pt = Math.max(0, G - ft), mt = p(ft, X, h.language), ht = p(pt, X, h.language), gt = Me(Ae, h.language), Z = C?.amountToCollectMinor ?? 0, _t = p(Z, X, h.language), vt = C?.paymentMode === "deposit" && Z > 0 ? p(Z, X, h.language) : null, yt = C?.shouldCollectOnlinePayment === !0 && Z > 0, bt = g.shop.timeZone?.trim() || void 0, Q = c(() => C ? Me(Math.max(0, Math.min(1, C.bookingDepositPercentage)), h.language) : null, [h.language, C]), $ = c(() => {
253
- if (!C?.depositRefundableUntilIso) return null;
254
- let e = new Date(C.depositRefundableUntilIso);
255
- return Number.isNaN(e.getTime()) ? null : Ne(e, h.language, bt);
247
+ let Y = b?.currency ?? "EUR", ft = p(W, Y, h.language), pt = G > 0 ? `-${p(G, Y, h.language)}` : null, mt = Math.round(W / 1.2), ht = Math.max(0, W - mt), gt = p(mt, Y, h.language), _t = p(ht, Y, h.language), vt = Me(Ae, h.language), X = b?.amountToCollectMinor ?? 0, yt = p(X, Y, h.language), bt = b?.paymentMode === "deposit" && X > 0 ? p(X, Y, h.language) : null, xt = b?.shouldCollectOnlinePayment === !0 && X > 0, Z = g.shop.timeZone?.trim() || void 0, Q = c(() => b ? Me(Math.max(0, Math.min(1, b.bookingDepositPercentage)), h.language) : null, [h.language, b]), $ = c(() => {
248
+ if (!b?.depositRefundableUntilIso) return null;
249
+ let e = new Date(b.depositRefundableUntilIso);
250
+ return Number.isNaN(e.getTime()) ? null : Ne(e, h.language, Z);
256
251
  }, [
257
252
  h.language,
258
- C?.depositRefundableUntilIso,
259
- bt
260
- ]), xt = c(() => C ? C.paymentMode === "deposit" && Z > 0 && Q ? $ ? m("checkout_payment_due_now_helper_deposit_refundable_until", {
253
+ b?.depositRefundableUntilIso,
254
+ Z
255
+ ]), St = c(() => b ? b.paymentMode === "deposit" && X > 0 && Q ? $ ? m("checkout_payment_due_now_helper_deposit_refundable_until", {
261
256
  percent: Q,
262
257
  date: $
263
- }) : m("checkout_payment_due_now_helper_deposit", { percent: Q }) : C.paymentMode === "none" || Z <= 0 ? m("checkout_payment_due_now_helper_none") : null : null, [
264
- Z,
258
+ }) : m("checkout_payment_due_now_helper_deposit", { percent: Q }) : b.paymentMode === "none" || X <= 0 ? m("checkout_payment_due_now_helper_none") : null : null, [
259
+ X,
265
260
  Q,
266
261
  $,
267
- C,
262
+ b,
268
263
  m
269
- ]), St = lt.handleSubmit(async (e) => {
270
- if (!(!b || W.length === 0)) {
271
- Ve(!0);
264
+ ]), Ct = dt.handleSubmit(async (e) => {
265
+ if (!(!_ || U.length === 0 || !I)) {
266
+ We(!0);
272
267
  try {
273
- let t = await o(ae, {
274
- storeSlug: b,
275
- schedule: {
276
- startDate: L.start_date,
277
- endDate: L.end_date,
278
- startTime: L.start_time,
279
- endTime: L.end_time
280
- },
281
- fulfillment: L.fulfillment,
282
- startAddress: L.fulfillment === "delivery" ? L.start_address : void 0,
283
- endAddress: L.fulfillment === "delivery" ? L.end_address : void 0,
284
- couponCode: k?.code,
285
- couponAutoApplied: !F && k?.autoApplied,
268
+ let t = await o(ie, {
269
+ storeSlug: _,
270
+ schedule: I,
271
+ fulfillment: F.fulfillment,
272
+ startAddress: F.fulfillment === "delivery" ? F.start_address : void 0,
273
+ endAddress: F.fulfillment === "delivery" ? F.end_address : void 0,
274
+ couponCode: T?.code,
275
+ couponAutoApplied: !j && T?.autoApplied,
286
276
  customer: {
287
277
  fullName: e.full_name,
288
278
  email: e.email,
289
279
  phone: e.phone,
290
280
  notes: e.notes
291
281
  },
292
- items: W
293
- }), n = oe.parse(t);
282
+ items: U
283
+ }), n = ae.parse(t);
294
284
  if (!n.success || !n.checkout) {
295
285
  f.error(n.errorCode === "online_payment_provider_missing" ? m("checkout_payment_error") : n.message || m("checkout_payment_error"));
296
286
  return;
297
287
  }
298
- n.checkout.requiresPayment || f.success(m("checkout_success_toast")), await Fe(n.checkout.nextPath), Be();
288
+ n.checkout.requiresPayment || f.success(m("checkout_success_toast")), await Re(n.checkout.nextPath), Ue();
299
289
  } catch (e) {
300
290
  console.error("Failed to submit storefront checkout", e), f.error(m("checkout_payment_error"));
301
291
  } finally {
302
- Ve(!1);
292
+ We(!1);
303
293
  }
304
294
  }
305
- }), Ct = m(yt ? "checkout_continue_to_payment" : "checkout_submit"), wt = L.fulfillment === "delivery" && L.start_address.trim().length === 0, Tt = !S && !He && !Ue && !Je && !Xe && !!C && !wt && W.length > 0;
306
- return R.lines.length === 0 ? /* @__PURE__ */ u("div", {
295
+ }), wt = m(xt ? "checkout_continue_to_payment" : "checkout_submit"), Tt = F.fulfillment === "delivery" && F.start_address.trim().length === 0, Et = !y && !Ge && !Ke && !Qe && !et && !!b && !!I && !Tt && U.length > 0;
296
+ return L.lines.length === 0 ? /* @__PURE__ */ u("div", {
307
297
  className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
308
298
  children: /* @__PURE__ */ d("div", {
309
299
  className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
@@ -319,8 +309,8 @@ function m() {
319
309
  /* @__PURE__ */ u("div", {
320
310
  className: "mt-6",
321
311
  children: /* @__PURE__ */ u(Se, {
322
- to: J,
323
- children: /* @__PURE__ */ d(a, {
312
+ to: q,
313
+ children: /* @__PURE__ */ d(de, {
324
314
  className: "gap-2",
325
315
  children: [/* @__PURE__ */ u(De, {
326
316
  className: "h-4 w-4",
@@ -338,11 +328,11 @@ function m() {
338
328
  children: [
339
329
  /* @__PURE__ */ u(fe, {
340
330
  currentStep: "checkout",
341
- bookingPath: J,
342
- checkoutPath: ct
331
+ bookingPath: q,
332
+ checkoutPath: ut
343
333
  }),
344
334
  /* @__PURE__ */ d(Se, {
345
- to: J,
335
+ to: q,
346
336
  className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
347
337
  children: [/* @__PURE__ */ u(De, {
348
338
  className: "h-4 w-4",
@@ -353,93 +343,101 @@ function m() {
353
343
  className: "grid gap-6 lg:grid-cols-12",
354
344
  children: [/* @__PURE__ */ d("div", {
355
345
  className: "lg:col-span-7",
356
- children: [/* @__PURE__ */ u("h1", {
357
- className: "text-xl font-semibold tracking-tight text-slate-950",
358
- children: /* @__PURE__ */ u("span", { children: m("checkout_title") })
359
- }), /* @__PURE__ */ d("div", {
360
- className: "mt-5 grid gap-4",
361
- children: [
362
- et ? /* @__PURE__ */ u("div", {
363
- className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
364
- children: /* @__PURE__ */ u(he, {
365
- value: L.fulfillment,
366
- onValueChange: (e) => Y({ fulfillment: e }),
367
- pickupAddress: tt,
368
- deliveryEnabled: I,
369
- deliveryDisabledReason: $e,
370
- startAddress: L.start_address,
371
- onStartAddressChange: (e) => Y({ start_address: e }),
372
- endAddress: L.end_address,
373
- onEndAddressChange: (e) => Y({ end_address: e }),
374
- showPickupAddressWhenPickupOnly: !1,
375
- testIdPrefix: "storefront-checkout-fulfillment"
376
- })
377
- }) : null,
378
- /* @__PURE__ */ u(ve, { form: lt }),
379
- /* @__PURE__ */ u(ye, {
380
- estimatedTotalLabel: ut,
381
- couponCode: k?.code,
382
- discountAmountLabel: dt,
383
- totalExcludingTaxLabel: mt,
384
- vatAmountLabel: ht,
385
- vatRateLabel: gt,
386
- depositAmountLabel: vt,
387
- amountToCollectMinor: Z,
388
- amountToCollectLabel: _t,
389
- paymentSummaryHelper: xt,
390
- paymentDecisionLoading: He,
391
- paymentDecisionError: Ue,
392
- canChoosePaymentMethod: !1,
393
- showAmountDueNowRow: !0,
394
- selectedPaymentMethod: "card",
395
- submitting: S,
396
- onSelectPaymentMethod: () => {}
397
- }),
398
- /* @__PURE__ */ u(a, {
399
- type: "button",
400
- size: "lg",
401
- onClick: () => {
402
- St();
403
- },
404
- disabled: !Tt,
405
- className: "mt-4 w-fit",
406
- children: /* @__PURE__ */ u("span", { children: Ct })
407
- }),
408
- wt ? /* @__PURE__ */ u("p", {
409
- className: "text-sm text-slate-600",
410
- children: /* @__PURE__ */ u("span", { children: m("checkout_delivery_address_required") })
411
- }) : null
412
- ]
413
- })]
346
+ children: [
347
+ /* @__PURE__ */ u("h1", {
348
+ className: "text-xl font-semibold tracking-tight text-slate-950",
349
+ children: /* @__PURE__ */ u("span", { children: m("checkout_title") })
350
+ }),
351
+ I ? null : /* @__PURE__ */ u("p", {
352
+ role: "alert",
353
+ className: "mt-3 text-sm text-destructive",
354
+ children: /* @__PURE__ */ u("span", { children: m("booking_time_slots_required") })
355
+ }),
356
+ /* @__PURE__ */ d("div", {
357
+ className: "mt-5 grid gap-4",
358
+ children: [
359
+ nt ? /* @__PURE__ */ u("div", {
360
+ className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
361
+ children: /* @__PURE__ */ u(he, {
362
+ value: F.fulfillment,
363
+ onValueChange: (e) => J({ fulfillment: e }),
364
+ pickupAddress: rt,
365
+ deliveryEnabled: N,
366
+ deliveryDisabledReason: P,
367
+ startAddress: F.start_address,
368
+ onStartAddressChange: (e) => J({ start_address: e }),
369
+ endAddress: F.end_address,
370
+ onEndAddressChange: (e) => J({ end_address: e }),
371
+ showPickupAddressWhenPickupOnly: !1,
372
+ testIdPrefix: "storefront-checkout-fulfillment"
373
+ })
374
+ }) : null,
375
+ /* @__PURE__ */ u(ve, { form: dt }),
376
+ /* @__PURE__ */ u(ye, {
377
+ estimatedTotalLabel: ft,
378
+ couponCode: T?.code,
379
+ discountAmountLabel: pt,
380
+ totalExcludingTaxLabel: gt,
381
+ vatAmountLabel: _t,
382
+ vatRateLabel: vt,
383
+ depositAmountLabel: bt,
384
+ amountToCollectMinor: X,
385
+ amountToCollectLabel: yt,
386
+ paymentSummaryHelper: St,
387
+ paymentDecisionLoading: Ge,
388
+ paymentDecisionError: Ke,
389
+ canChoosePaymentMethod: !1,
390
+ showAmountDueNowRow: !0,
391
+ selectedPaymentMethod: "card",
392
+ submitting: y,
393
+ onSelectPaymentMethod: () => {}
394
+ }),
395
+ /* @__PURE__ */ u(de, {
396
+ type: "button",
397
+ size: "lg",
398
+ onClick: () => {
399
+ Ct();
400
+ },
401
+ disabled: !Et,
402
+ className: "mt-4 w-fit",
403
+ children: /* @__PURE__ */ u("span", { children: wt })
404
+ }),
405
+ Tt ? /* @__PURE__ */ u("p", {
406
+ className: "text-sm text-slate-600",
407
+ children: /* @__PURE__ */ u("span", { children: m("checkout_delivery_address_required") })
408
+ }) : null
409
+ ]
410
+ })
411
+ ]
414
412
  }), /* @__PURE__ */ u(be, {
415
- lines: U.lines,
416
- itemCount: Le,
417
- totalPerDayMinor: U.totalPerDayMinor,
418
- estimatedDays: U.estimatedDays,
419
- estimatedTotalMinor: U.estimatedTotalMinor,
420
- discountedEstimatedTotalMinor: G,
421
- discountAmountMinor: K,
422
- lateReturnSurchargeMinor: qe?.lateReturnSurchargeMinor,
423
- couponCode: k?.code,
424
- durationLabel: nt.label,
425
- onQuantityChange: Re,
426
- onRemove: ze,
413
+ lines: H.lines,
414
+ itemCount: Be,
415
+ totalPerDayMinor: H.totalPerDayMinor,
416
+ estimatedDays: H.estimatedDays,
417
+ estimatedTotalMinor: H.estimatedTotalMinor,
418
+ discountedEstimatedTotalMinor: W,
419
+ discountAmountMinor: G,
420
+ lateReturnSurchargeMinor: Ze?.lateReturnSurchargeMinor,
421
+ couponCode: T?.code,
422
+ durationLabel: it.label,
423
+ onQuantityChange: Ve,
424
+ onRemove: He,
427
425
  coupon: {
428
- code: D,
429
- appliedCode: k?.code,
430
- discountLabel: k && K > 0 ? p(K, X, h.language) : null,
431
- message: Ye,
432
- error: Xe,
433
- loading: Je,
434
- disabled: S,
426
+ code: Je,
427
+ appliedCode: T?.code,
428
+ discountLabel: T && G > 0 ? p(G, Y, h.language) : null,
429
+ message: $e,
430
+ error: et,
431
+ loading: Qe,
432
+ disabled: y,
435
433
  onCodeChange: (e) => {
436
- O(e), P(null), N(null);
434
+ w(e), A(null), k(null);
437
435
  },
438
436
  onApply: () => {
439
- Ze(!1), Ke(D.trim());
437
+ tt(!1), Xe(Je.trim());
440
438
  },
441
439
  onRemove: () => {
442
- O(""), Ke(""), A(null), j(null), P(null), N(null), Ze(!0);
440
+ w(""), Xe(""), E(null), D(null), A(null), k(null), tt(!0);
443
441
  }
444
442
  }
445
443
  })]
@@ -1 +1 @@
1
- {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA8GA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAwrB/B"}
1
+ {"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA2IA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAstB/B"}