@loczer/storefront-sdk 0.237.0 → 0.238.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 (27) hide show
  1. package/dist/components/Layout/index.d.ts.map +1 -1
  2. package/dist/components/Layout/index.js +38 -26
  3. package/dist/components/StorefrontCartPanel/index.d.ts +2 -1
  4. package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
  5. package/dist/components/StorefrontCartPanel/index.js +24 -24
  6. package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.d.ts +4 -2
  7. package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.d.ts.map +1 -1
  8. package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.js +8 -8
  9. package/dist/i18n/en.d.ts +3 -0
  10. package/dist/i18n/en.d.ts.map +1 -1
  11. package/dist/i18n/en.js +3 -0
  12. package/dist/i18n/fr.d.ts +3 -0
  13. package/dist/i18n/fr.d.ts.map +1 -1
  14. package/dist/i18n/fr.js +3 -0
  15. package/dist/index.d.ts +12 -3
  16. package/dist/pages/CheckoutPage.d.ts.map +1 -1
  17. package/dist/pages/CheckoutPage.js +198 -184
  18. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts.map +1 -1
  19. package/dist/pages/checkout/components/CheckoutLoadingSkeleton.js +10 -6
  20. package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.d.ts +13 -0
  21. package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.d.ts.map +1 -0
  22. package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.js +95 -0
  23. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +4 -1
  24. package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
  25. package/dist/pages/checkout/components/CheckoutSummaryColumn.js +22 -20
  26. package/dist/storefront.css +1 -1
  27. package/package.json +1 -1
@@ -16,16 +16,17 @@ import { ROUTE as ye, responseSchema as be } from "../lib/checkoutVerifyCoupon.j
16
16
  import { CheckoutDetailsCard as xe } from "./checkout/components/CheckoutDetailsCard.js";
17
17
  import { CheckoutInsuranceCard as Se } from "./checkout/components/CheckoutInsuranceCard.js";
18
18
  import { CheckoutLoadingSkeleton as Ce } from "./checkout/components/CheckoutLoadingSkeleton.js";
19
- import { CheckoutSummaryColumn as we } from "./checkout/components/CheckoutSummaryColumn.js";
20
- import { checkoutFormSchema as Te } from "./checkout/types.js";
21
- import { useEffect as s, useMemo as c, useRef as Ee, useState as l } from "react";
19
+ import { CheckoutMobileSummaryDrawer as we } from "./checkout/components/CheckoutMobileSummaryDrawer.js";
20
+ import { CheckoutSummaryColumn as Te } from "./checkout/components/CheckoutSummaryColumn.js";
21
+ import { checkoutFormSchema as Ee } from "./checkout/types.js";
22
+ import { useEffect as s, useMemo as c, useRef as De, useState as l } from "react";
22
23
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
23
- import { Link as De, useNavigate as Oe, useParams as ke, useSearchParams as Ae } from "@rpcbase/router";
24
- import { useTranslation as je } from "react-i18next";
25
- import { AlertTriangle as Me, ArrowLeft as Ne } from "lucide-react";
26
- import { useForm as Pe, zodResolver as Fe } from "@rpcbase/form";
24
+ import { Link as Oe, useNavigate as ke, useParams as Ae, useSearchParams as je } from "@rpcbase/router";
25
+ import { useTranslation as Me } from "react-i18next";
26
+ import { AlertTriangle as Ne, ArrowLeft as Pe } from "lucide-react";
27
+ import { useForm as Fe, zodResolver as Ie } from "@rpcbase/form";
27
28
  //#region src/pages/CheckoutPage.tsx
28
- var Ie = .2, f = (e, t, n) => {
29
+ var Le = .2, f = (e, t, n) => {
29
30
  try {
30
31
  return new Intl.NumberFormat(n, {
31
32
  style: "currency",
@@ -34,7 +35,7 @@ var Ie = .2, f = (e, t, n) => {
34
35
  } catch {
35
36
  return `${(e / 100).toFixed(2)} ${t.toUpperCase()}`;
36
37
  }
37
- }, Le = (e, t) => {
38
+ }, Re = (e, t) => {
38
39
  try {
39
40
  return new Intl.NumberFormat(t, {
40
41
  style: "percent",
@@ -46,60 +47,60 @@ var Ie = .2, f = (e, t, n) => {
46
47
  }
47
48
  };
48
49
  function p() {
49
- let { t: p, i18n: m } = je(), { storefrontConfiguration: h } = fe(), Re = h.workspace?.workspaceLanguage, { bikes: g, accessories: ze } = pe(), { storeSlug: _ } = ke(), [v, Be] = Ae(), Ve = Oe(), { items: He, itemCount: Ue, isReady: We, setQuantity: Ge, removeItem: Ke, beginCheckoutSubmission: qe, confirmCheckoutPaymentSession: Je, clearCheckoutSession: Ye, clear: Xe } = ee(), [y, Ze] = l(!1), b = Ee(!1), [x, S] = l(null), [Qe, C] = l(!1), [w, T] = l(null), $e = v.get("coupon") ?? v.get("code") ?? "", [et, E] = l($e), [tt, nt] = l($e.trim()), [D, O] = l(null), [k, A] = l(null), [j, M] = l(!1), [rt, N] = l(null), [it, P] = l(null), [F, at] = l(!1), [I, ot] = l(!1), st = n(v).toString(), ct = c(() => r(new URLSearchParams(st), _), [st, _]), L = h.settings.fulfillmentModes.includes("delivery"), lt = h.settings.deliveryDisabledReason.trim(), ut = L || lt.length > 0, dt = h.shop.address?.trim() ?? "", R = c(() => {
50
- let e = t(ct, {
50
+ let { t: p, i18n: m } = Me(), { storefrontConfiguration: h } = fe(), ze = h.workspace?.workspaceLanguage, { bikes: g, accessories: Be } = pe(), { storeSlug: _ } = Ae(), [v, Ve] = je(), He = ke(), { items: Ue, itemCount: We, isReady: Ge, setQuantity: Ke, removeItem: qe, beginCheckoutSubmission: Je, confirmCheckoutPaymentSession: Ye, clearCheckoutSession: Xe, clear: Ze } = ee(), [y, Qe] = l(!1), b = De(!1), [x, S] = l(null), [$e, et] = l(!1), [C, w] = l(null), tt = v.get("coupon") ?? v.get("code") ?? "", [nt, T] = l(tt), [rt, it] = l(tt.trim()), [E, D] = l(null), [O, k] = l(null), [A, j] = l(!1), [at, M] = l(null), [ot, N] = l(null), [P, st] = l(!1), [F, ct] = l(!1), lt = n(v).toString(), ut = c(() => r(new URLSearchParams(lt), _), [lt, _]), I = h.settings.fulfillmentModes.includes("delivery"), dt = h.settings.deliveryDisabledReason.trim(), ft = I || dt.length > 0, pt = h.shop.address?.trim() ?? "", L = c(() => {
51
+ let e = t(ut, {
51
52
  startTime: "",
52
53
  endTime: ""
53
54
  });
54
- return e.fulfillment === "delivery" && !L ? {
55
+ return e.fulfillment === "delivery" && !I ? {
55
56
  ...e,
56
57
  fulfillment: "pickup"
57
58
  } : e;
58
- }, [ct, L]), z = c(() => le(R), [R]), B = h.bookingEngine.pricing, ft = te(R, B, h.bookingEngine.shop.timeZone), pt = ne(B.baseUnit, p), mt = ft?.billableUnitCount, V = c(() => re({
59
- items: He,
59
+ }, [ut, I]), R = c(() => le(L), [L]), z = h.bookingEngine.pricing, mt = te(L, z, h.bookingEngine.shop.timeZone), ht = ne(z.baseUnit, p), gt = mt?.billableUnitCount, B = c(() => re({
60
+ items: Ue,
60
61
  language: m.language,
61
- fallbackLanguage: Re,
62
+ fallbackLanguage: ze,
62
63
  products: {
63
64
  bikes: g,
64
- accessories: ze
65
+ accessories: Be
65
66
  },
66
- priceUnit: B.baseUnit,
67
- billableUnitCount: mt
67
+ priceUnit: z.baseUnit,
68
+ billableUnitCount: gt
68
69
  }), [
69
- ze,
70
+ Be,
70
71
  g,
71
- mt,
72
+ gt,
72
73
  m.language,
73
- He,
74
- B.baseUnit,
75
- Re
76
- ]), H = c(() => V.lines.map((e) => ({
74
+ Ue,
75
+ z.baseUnit,
76
+ ze
77
+ ]), V = c(() => B.lines.map((e) => ({
77
78
  productId: e.checkoutProductId,
78
79
  productVariantId: e.productVariantId,
79
80
  quantity: e.quantity
80
- })), [V.lines]), [ht, U] = l([]), [gt, W] = l(!1);
81
+ })), [B.lines]), [_t, H] = l([]), [U, W] = l(!1);
81
82
  s(() => {
82
- if (!_ || H.length === 0) {
83
- U([]), W(!1);
83
+ if (!_ || V.length === 0) {
84
+ H([]), W(!1);
84
85
  return;
85
86
  }
86
- if (!z) {
87
- U([]), W(!1);
87
+ if (!R) {
88
+ H([]), W(!1);
88
89
  return;
89
90
  }
90
91
  let e = !1;
91
- return W(!0), U([]), (async () => {
92
+ return W(!0), H([]), (async () => {
92
93
  try {
93
94
  let t = await o(oe, {
94
95
  storeSlug: _,
95
- schedule: z,
96
- products: H
96
+ schedule: R,
97
+ products: V
97
98
  }), n = ue.parse(t);
98
99
  if (e) return;
99
- U(n.success ? n.availability ?? [] : []);
100
+ H(n.success ? n.availability ?? [] : []);
100
101
  } catch (t) {
101
102
  if (e) return;
102
- console.error("Failed to load checkout cart availability", t), U([]);
103
+ console.error("Failed to load checkout cart availability", t), H([]);
103
104
  } finally {
104
105
  e || W(!1);
105
106
  }
@@ -107,42 +108,42 @@ function p() {
107
108
  e = !0;
108
109
  };
109
110
  }, [
110
- R.endDate,
111
- R.endTime,
112
- R.startDate,
113
- R.startTime,
114
- z,
115
- H,
111
+ L.endDate,
112
+ L.endTime,
113
+ L.startDate,
114
+ L.startTime,
115
+ R,
116
+ V,
116
117
  _
117
118
  ]);
118
- let _t = c(() => new Map(ht.map((e) => [se(e.productId, e.productVariantId), e])), [ht]), vt = c(() => ({
119
- ...V,
120
- lines: V.lines.map((e) => {
121
- let t = _t.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
119
+ let vt = c(() => new Map(_t.map((e) => [se(e.productId, e.productVariantId), e])), [_t]), yt = c(() => ({
120
+ ...B,
121
+ lines: B.lines.map((e) => {
122
+ let t = vt.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
122
123
  return {
123
124
  ...e,
124
- insufficientCapacity: !gt && n !== void 0,
125
- availabilityIssue: gt ? void 0 : n
125
+ insufficientCapacity: !U && n !== void 0,
126
+ availabilityIssue: U ? void 0 : n
126
127
  };
127
128
  })
128
129
  }), [
129
- _t,
130
- gt,
131
- V
132
- ]), G = c(() => V.lines.map((e) => ({
130
+ vt,
131
+ U,
132
+ B
133
+ ]), G = c(() => B.lines.map((e) => ({
133
134
  kind: e.kind,
134
135
  productId: e.checkoutProductId,
135
136
  productVariantId: e.productVariantId,
136
137
  quantity: e.quantity
137
- })), [V.lines]), yt = new Map(g.map((e) => [e.checkoutProductId?.trim() || e.id, e])), bt = V.lines.flatMap((e) => {
138
- let t = yt.get(e.checkoutProductId);
138
+ })), [B.lines]), bt = new Map(g.map((e) => [e.checkoutProductId?.trim() || e.id, e])), K = B.lines.flatMap((e) => {
139
+ let t = bt.get(e.checkoutProductId);
139
140
  return t?.insurance?.enabled ? [{
140
141
  quantity: e.quantity,
141
142
  pricePerDayMinor: t.insurance.pricePerDayMinor,
142
143
  deductibleAmountMinor: t.insurance.deductibleAmountMinor
143
144
  }] : [];
144
- }), K = h.modules?.insurance?.enabled === !0 && bt.length > 0, q = K && I, xt = bt.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), St = bt.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), Ct = V.totalMinor ?? 0, J = k?.totalMinor ?? Ct, Y = k?.insuranceSubtotalMinor ?? 0, wt = D?.discountAmountMinor ?? 0, X = e(new URLSearchParams(), R).toString(), Z = `/${_ ?? ""}/booking${X ? `?${X}` : ""}`, Tt = `/${_ ?? ""}/checkout${X ? `?${X}` : ""}`, Et = Pe({
145
- resolver: Fe(Te),
145
+ }), q = h.modules?.insurance?.enabled === !0 && K.length > 0, J = q && F, xt = K.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), St = K.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), Ct = B.totalMinor ?? 0, Y = O?.totalMinor ?? Ct, X = O?.insuranceSubtotalMinor ?? 0, wt = E?.discountAmountMinor ?? 0, Z = e(new URLSearchParams(), L).toString(), Q = `/${_ ?? ""}/booking${Z ? `?${Z}` : ""}`, Tt = `/${_ ?? ""}/checkout${Z ? `?${Z}` : ""}`, Et = Fe({
146
+ resolver: Ie(Ee),
146
147
  defaultValues: {
147
148
  fullName: "",
148
149
  email: "",
@@ -151,123 +152,123 @@ function p() {
151
152
  }
152
153
  });
153
154
  s(() => {
154
- i(_, R);
155
- }, [R, _]), s(() => {
156
- !K && I && ot(!1);
157
- }, [I, K]);
158
- let Q = (t) => {
155
+ i(_, L);
156
+ }, [L, _]), s(() => {
157
+ !q && F && ct(!1);
158
+ }, [F, q]);
159
+ let Dt = (t) => {
159
160
  let n = {
160
- ...R,
161
+ ...L,
161
162
  ...t
162
163
  }, r = e(v, n);
163
- r.toString() !== v.toString() && (Be(r, { replace: !0 }), i(_, r));
164
+ r.toString() !== v.toString() && (Ve(r, { replace: !0 }), i(_, r));
164
165
  };
165
166
  s(() => {
166
- if (!_ || G.length === 0 || !z) {
167
- O(null), A(null), M(!1), N(null), P(null);
167
+ if (!_ || G.length === 0 || !R) {
168
+ D(null), k(null), j(!1), M(null), N(null);
168
169
  return;
169
170
  }
170
- let e = tt.trim(), t = e.length === 0 && !F, n = !1;
171
- return M(!0), P(null), N(null), (async () => {
171
+ let e = rt.trim(), t = e.length === 0 && !P, n = !1;
172
+ return j(!0), N(null), M(null), (async () => {
172
173
  try {
173
174
  let r = await o(ye, {
174
175
  storeSlug: _,
175
- schedule: z,
176
+ schedule: R,
176
177
  items: G,
177
178
  couponCode: e || void 0,
178
179
  includeAutoApply: t,
179
- insuranceAccepted: q
180
+ insuranceAccepted: J
180
181
  }), i = be.parse(r);
181
182
  if (n) return;
182
- if (A(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
183
+ if (k(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
183
184
  subtotalMinor: i.subtotalMinor,
184
185
  totalMinor: i.totalMinor,
185
186
  lateReturnSurchargeMinor: i.lateReturnSurchargeMinor,
186
187
  insuranceSubtotalMinor: i.insuranceSubtotalMinor,
187
188
  insuranceBillableDays: i.insuranceBillableDays
188
189
  } : null), !i.success) {
189
- O(null), P(i.message || p("checkout_coupon_invalid"));
190
+ D(null), N(i.message || p("checkout_coupon_invalid"));
190
191
  return;
191
192
  }
192
- O(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (E(i.coupon.code), N(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : N(p("checkout_coupon_manual_applied")));
193
+ D(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (T(i.coupon.code), M(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : M(p("checkout_coupon_manual_applied")));
193
194
  } catch (e) {
194
195
  if (n) return;
195
- console.error("Failed to verify checkout coupon", e), O(null), A(null), P(p("checkout_coupon_error"));
196
+ console.error("Failed to verify checkout coupon", e), D(null), k(null), N(p("checkout_coupon_error"));
196
197
  } finally {
197
- n || M(!1);
198
+ n || j(!1);
198
199
  }
199
200
  })(), () => {
200
201
  n = !0;
201
202
  };
202
203
  }, [
203
- F,
204
- R.endDate,
205
- R.endTime,
206
- R.startDate,
207
- R.startTime,
208
- z,
204
+ P,
205
+ L.endDate,
206
+ L.endTime,
207
+ L.startDate,
208
+ L.startTime,
209
+ R,
209
210
  G,
210
- q,
211
+ J,
211
212
  _,
212
- tt,
213
+ rt,
213
214
  p
214
215
  ]), s(() => {
215
- if (!_ || V.lines.length === 0 || !z) {
216
- S(null), T(null), C(!1);
216
+ if (!_ || B.lines.length === 0 || !R) {
217
+ S(null), w(null), et(!1);
217
218
  return;
218
219
  }
219
220
  let e = !1;
220
- return C(!0), T(null), (async () => {
221
+ return et(!0), w(null), (async () => {
221
222
  try {
222
223
  let t = await o(_e, {
223
224
  storeSlug: _,
224
- schedule: z,
225
- estimatedTotalMinor: J,
226
- insuranceAmountMinor: Y
225
+ schedule: R,
226
+ estimatedTotalMinor: Y,
227
+ insuranceAmountMinor: X
227
228
  }), n = ve.parse(t);
228
229
  if (e) return;
229
230
  if (!n.success || !n.decision) {
230
- S(null), T(n.message || p("checkout_payment_error"));
231
+ S(null), w(n.message || p("checkout_payment_error"));
231
232
  return;
232
233
  }
233
234
  S(n.decision);
234
235
  } catch (t) {
235
236
  if (e) return;
236
- console.error("Failed to load checkout payment decision", t), S(null), T(p("checkout_payment_error"));
237
+ console.error("Failed to load checkout payment decision", t), S(null), w(p("checkout_payment_error"));
237
238
  } finally {
238
- e || C(!1);
239
+ e || et(!1);
239
240
  }
240
241
  })(), () => {
241
242
  e = !0;
242
243
  };
243
244
  }, [
244
- R.endDate,
245
- R.endTime,
246
- R.startDate,
247
- R.startTime,
248
- z,
249
- J,
250
- V.lines.length,
245
+ L.endDate,
246
+ L.endTime,
247
+ L.startDate,
248
+ L.startTime,
249
+ R,
251
250
  Y,
251
+ B.lines.length,
252
+ X,
252
253
  _,
253
254
  p
254
255
  ]);
255
- let $ = x?.currency ?? "EUR", Dt = f(J, $, m.language), Ot = Math.max(0, J - Y), kt = Math.round(Ot / 1.2), At = kt + Y, jt = Math.max(0, Ot - kt), Mt = f(At, $, m.language), Nt = f(jt, $, m.language), Pt = Le(Ie, m.language), Ft = Y > 0 ? f(Y, $, m.language) : void 0, It = x?.amountToCollectMinor ?? 0, Lt = x?.shouldCollectOnlinePayment === !0 && It > 0, Rt = Et.handleSubmit(async (e) => {
256
- if (!_ || G.length === 0 || !z || b.current) return;
257
- Ze(!0), b.current = !0;
258
- let t = qe();
256
+ let $ = x?.currency ?? "EUR", Ot = f(Y, $, m.language), kt = Math.max(0, Y - X), At = Math.round(kt / 1.2), jt = At + X, Mt = Math.max(0, kt - At), Nt = f(jt, $, m.language), Pt = f(Mt, $, m.language), Ft = Re(Le, m.language), It = X > 0 ? f(X, $, m.language) : void 0, Lt = x?.amountToCollectMinor ?? 0, Rt = x?.shouldCollectOnlinePayment === !0 && Lt > 0, zt = Et.handleSubmit(async (e) => {
257
+ if (!_ || G.length === 0 || !R || b.current) return;
258
+ Qe(!0), b.current = !0;
259
+ let t = Je();
259
260
  try {
260
261
  let n = await o(ie, {
261
262
  storeSlug: _,
262
263
  checkoutSessionId: t.checkoutSessionId,
263
264
  replacesCheckoutSessionId: t.replacesCheckoutSessionId,
264
- schedule: z,
265
- fulfillment: R.fulfillment,
266
- startAddress: R.fulfillment === "delivery" ? R.startAddress : void 0,
267
- endAddress: R.fulfillment === "delivery" ? R.endAddress : void 0,
268
- couponCode: D?.code,
269
- couponAutoApplied: !F && D?.autoApplied,
270
- insuranceAccepted: q,
265
+ schedule: R,
266
+ fulfillment: L.fulfillment,
267
+ startAddress: L.fulfillment === "delivery" ? L.startAddress : void 0,
268
+ endAddress: L.fulfillment === "delivery" ? L.endAddress : void 0,
269
+ couponCode: E?.code,
270
+ couponAutoApplied: !P && E?.autoApplied,
271
+ insuranceAccepted: J,
271
272
  customer: {
272
273
  name: e.fullName,
273
274
  email: e.email,
@@ -277,17 +278,55 @@ function p() {
277
278
  items: G
278
279
  }), r = ae.parse(n);
279
280
  if (!r.success || !r.checkout) {
280
- Ye(), a.error(r.message || p("checkout_payment_error"));
281
+ Xe(), a.error(r.message || p("checkout_payment_error"));
281
282
  return;
282
283
  }
283
- r.checkout.requiresPayment ? Je(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : a.success(p("checkout_success_toast")), await Ve(r.checkout.nextPath), r.checkout.requiresPayment || Xe();
284
+ r.checkout.requiresPayment ? Ye(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : a.success(p("checkout_success_toast")), await He(r.checkout.nextPath), r.checkout.requiresPayment || Ze();
284
285
  } catch (e) {
285
286
  console.error("Failed to submit storefront checkout", e), a.error(p("checkout_payment_error"));
286
287
  } finally {
287
- b.current = !1, Ze(!1);
288
+ b.current = !1, Qe(!1);
289
+ }
290
+ }), Bt = p(Rt ? "checkout_continue_to_payment" : "checkout_submit"), Vt = p(Rt ? "checkout_mobile_continue_to_payment" : "checkout_mobile_submit"), Ht = L.fulfillment === "delivery" && L.startAddress.trim().length === 0, Ut = !y && !$e && !C && !U && !A && !ot && !!x && !!R && !Ht && G.length > 0, Wt = ({ className: e, presentation: t, stickyTopClassName: n } = {}) => /* @__PURE__ */ u(Te, {
291
+ className: e,
292
+ lines: yt.lines,
293
+ itemCount: We,
294
+ baseUnitLabel: ht,
295
+ bookingSubtotalLabel: Nt,
296
+ vatAmountLabel: Pt,
297
+ vatRateLabel: Ft,
298
+ bookingTotalLabel: Ot,
299
+ bookingPeriod: R ? {
300
+ bookingPath: Q,
301
+ startDate: R.startDate,
302
+ startTime: R.startTime,
303
+ endDate: R.endDate,
304
+ endTime: R.endTime
305
+ } : void 0,
306
+ presentation: t,
307
+ stickyTopClassName: n,
308
+ onQuantityChange: Ke,
309
+ onRemove: qe,
310
+ coupon: {
311
+ code: nt,
312
+ appliedCode: E?.code,
313
+ discountLabel: E && wt > 0 ? f(wt, $, m.language) : null,
314
+ message: at,
315
+ error: ot,
316
+ loading: A,
317
+ disabled: y,
318
+ onCodeChange: (e) => {
319
+ T(e), N(null), M(null);
320
+ },
321
+ onApply: () => {
322
+ st(!1), it(nt.trim());
323
+ },
324
+ onRemove: () => {
325
+ T(""), it(""), D(null), k(null), N(null), M(null), st(!0);
326
+ }
288
327
  }
289
- }), zt = p(Lt ? "checkout_continue_to_payment" : "checkout_submit"), Bt = R.fulfillment === "delivery" && R.startAddress.trim().length === 0, Vt = !y && !Qe && !w && !j && !it && !!x && !!z && !Bt && G.length > 0;
290
- return We ? V.lines.length === 0 ? /* @__PURE__ */ u("div", {
328
+ });
329
+ return Ge ? B.lines.length === 0 ? /* @__PURE__ */ u("div", {
291
330
  className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
292
331
  children: /* @__PURE__ */ d("div", {
293
332
  className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
@@ -302,11 +341,11 @@ function p() {
302
341
  }),
303
342
  /* @__PURE__ */ u("div", {
304
343
  className: "mt-6",
305
- children: /* @__PURE__ */ u(De, {
306
- to: Z,
344
+ children: /* @__PURE__ */ u(Oe, {
345
+ to: Q,
307
346
  children: /* @__PURE__ */ d(de, {
308
347
  className: "gap-2",
309
- children: [/* @__PURE__ */ u(Ne, {
348
+ children: [/* @__PURE__ */ u(Pe, {
310
349
  className: "h-4 w-4",
311
350
  "aria-hidden": "true"
312
351
  }), /* @__PURE__ */ u("span", { children: p("back_to_booking") })]
@@ -315,14 +354,14 @@ function p() {
315
354
  })
316
355
  ]
317
356
  })
318
- }) : /* @__PURE__ */ u(he, {
357
+ }) : /* @__PURE__ */ d(he, {
319
358
  currentStep: "checkout",
320
- bookingPath: Z,
359
+ bookingPath: Q,
321
360
  checkoutPath: Tt,
322
- backPath: Z,
361
+ backPath: Q,
323
362
  backLabel: p("back_to_booking"),
324
- children: /* @__PURE__ */ d("div", {
325
- className: "grid gap-6 lg:grid-cols-12",
363
+ children: [/* @__PURE__ */ d("div", {
364
+ className: "grid gap-6 pb-24 lg:grid-cols-12 lg:pb-0",
326
365
  children: [/* @__PURE__ */ d("div", {
327
366
  className: "lg:col-span-7",
328
367
  children: [
@@ -330,7 +369,7 @@ function p() {
330
369
  className: "text-xl font-semibold tracking-tight text-slate-950",
331
370
  children: /* @__PURE__ */ u("span", { children: p("checkout_title") })
332
371
  }),
333
- z ? null : /* @__PURE__ */ u("p", {
372
+ R ? null : /* @__PURE__ */ u("p", {
334
373
  role: "alert",
335
374
  className: "mt-3 text-sm text-destructive",
336
375
  children: /* @__PURE__ */ u("span", { children: p("booking_time_slots_required") })
@@ -338,33 +377,33 @@ function p() {
338
377
  /* @__PURE__ */ d("div", {
339
378
  className: "mt-5 grid gap-4",
340
379
  children: [
341
- ut ? /* @__PURE__ */ u("div", {
380
+ ft ? /* @__PURE__ */ u("div", {
342
381
  className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
343
382
  children: /* @__PURE__ */ u(me, {
344
- value: R.fulfillment,
345
- onValueChange: (e) => Q({ fulfillment: e }),
346
- pickupAddress: dt,
347
- deliveryEnabled: L,
348
- deliveryDisabledReason: lt,
349
- startAddress: R.startAddress,
350
- onStartAddressChange: (e) => Q({ startAddress: e }),
351
- endAddress: R.endAddress,
352
- onEndAddressChange: (e) => Q({ endAddress: e }),
383
+ value: L.fulfillment,
384
+ onValueChange: (e) => Dt({ fulfillment: e }),
385
+ pickupAddress: pt,
386
+ deliveryEnabled: I,
387
+ deliveryDisabledReason: dt,
388
+ startAddress: L.startAddress,
389
+ onStartAddressChange: (e) => Dt({ startAddress: e }),
390
+ endAddress: L.endAddress,
391
+ onEndAddressChange: (e) => Dt({ endAddress: e }),
353
392
  showPickupAddressWhenPickupOnly: !1,
354
393
  testIdPrefix: "storefront-checkout-fulfillment"
355
394
  })
356
395
  }) : null,
357
396
  /* @__PURE__ */ u(xe, { form: Et }),
358
- K ? /* @__PURE__ */ u(Se, {
359
- accepted: q,
360
- disabled: y || j,
397
+ q ? /* @__PURE__ */ u(Se, {
398
+ accepted: J,
399
+ disabled: y || A,
361
400
  dailyAmountLabel: f(xt, $, m.language),
362
- totalAmountLabel: Ft,
363
- billableDays: k?.insuranceBillableDays,
401
+ totalAmountLabel: It,
402
+ billableDays: O?.insuranceBillableDays,
364
403
  deductibleLabel: St > 0 ? f(St, $, m.language) : void 0,
365
- onAcceptedChange: ot
404
+ onAcceptedChange: ct
366
405
  }) : null,
367
- Qe ? /* @__PURE__ */ d("div", {
406
+ $e ? /* @__PURE__ */ d("div", {
368
407
  className: "flex items-center gap-2 text-sm text-slate-600",
369
408
  role: "status",
370
409
  children: [/* @__PURE__ */ u(ge, {
@@ -372,70 +411,45 @@ function p() {
372
411
  "aria-hidden": "true"
373
412
  }), /* @__PURE__ */ u("span", { children: p("checkout_payment_loading") })]
374
413
  }) : null,
375
- w ? /* @__PURE__ */ d("div", {
414
+ C ? /* @__PURE__ */ d("div", {
376
415
  className: "flex items-start gap-2 rounded-md bg-destructive p-3 text-sm text-destructive-foreground shadow-sm",
377
416
  role: "alert",
378
- children: [/* @__PURE__ */ u(Me, {
417
+ children: [/* @__PURE__ */ u(Ne, {
379
418
  className: "mt-0.5 h-4 w-4",
380
419
  "aria-hidden": "true"
381
- }), /* @__PURE__ */ u("span", { children: w })]
420
+ }), /* @__PURE__ */ u("span", { children: C })]
382
421
  }) : null,
383
422
  /* @__PURE__ */ u(de, {
384
423
  type: "button",
385
424
  size: "lg",
386
425
  onClick: () => {
387
- Rt();
426
+ zt();
388
427
  },
389
- disabled: !Vt,
390
- className: "mt-4 w-fit",
391
- children: /* @__PURE__ */ u("span", { children: zt })
428
+ disabled: !Ut,
429
+ className: "mt-4 hidden w-fit lg:inline-flex",
430
+ children: /* @__PURE__ */ u("span", { children: Bt })
392
431
  }),
393
- Bt ? /* @__PURE__ */ u("p", {
432
+ Ht ? /* @__PURE__ */ u("p", {
394
433
  className: "text-sm text-slate-600",
395
434
  children: /* @__PURE__ */ u("span", { children: p("checkout_delivery_address_required") })
396
435
  }) : null
397
436
  ]
398
437
  })
399
438
  ]
400
- }), /* @__PURE__ */ u(we, {
401
- lines: vt.lines,
402
- itemCount: Ue,
403
- baseUnitLabel: pt,
404
- bookingSubtotalLabel: Mt,
405
- vatAmountLabel: Nt,
406
- vatRateLabel: Pt,
407
- bookingTotalLabel: Dt,
408
- bookingPeriod: z ? {
409
- bookingPath: Z,
410
- startDate: z.startDate,
411
- startTime: z.startTime,
412
- endDate: z.endDate,
413
- endTime: z.endTime
414
- } : void 0,
415
- onQuantityChange: Ge,
416
- onRemove: Ke,
417
- coupon: {
418
- code: et,
419
- appliedCode: D?.code,
420
- discountLabel: D && wt > 0 ? f(wt, $, m.language) : null,
421
- message: rt,
422
- error: it,
423
- loading: j,
424
- disabled: y,
425
- onCodeChange: (e) => {
426
- E(e), P(null), N(null);
427
- },
428
- onApply: () => {
429
- at(!1), nt(et.trim());
430
- },
431
- onRemove: () => {
432
- E(""), nt(""), O(null), A(null), P(null), N(null), at(!0);
433
- }
434
- }
435
- })]
436
- })
439
+ }), Wt({ className: "hidden lg:block" })]
440
+ }), /* @__PURE__ */ u(we, {
441
+ canSubmit: Ut,
442
+ compactSubmitLabel: Vt,
443
+ itemCount: We,
444
+ submitLabel: Bt,
445
+ totalLabel: Ot,
446
+ onSubmit: () => {
447
+ zt();
448
+ },
449
+ children: Wt({ presentation: "flat" })
450
+ })]
437
451
  }) : /* @__PURE__ */ u(Ce, {
438
- bookingPath: Z,
452
+ bookingPath: Q,
439
453
  checkoutPath: Tt
440
454
  });
441
455
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutLoadingSkeleton.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutLoadingSkeleton.tsx"],"names":[],"mappings":"AAMA,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAMD,wBAAgB,uBAAuB,CAAC,EACtC,WAAW,EACX,YAAY,GACb,EAAE,4BAA4B,2CAuF9B"}
1
+ {"version":3,"file":"CheckoutLoadingSkeleton.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutLoadingSkeleton.tsx"],"names":[],"mappings":"AAMA,KAAK,4BAA4B,GAAG;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AAMD,wBAAgB,uBAAuB,CAAC,EACtC,WAAW,EACX,YAAY,GACb,EAAE,4BAA4B,2CA8F9B"}
@@ -6,14 +6,14 @@ import { cn as i } from "@rpcbase/ui";
6
6
  var a = ({ className: e }) => /* @__PURE__ */ t("div", { className: i("rounded bg-slate-200", e) });
7
7
  function o({ bookingPath: i, checkoutPath: o }) {
8
8
  let { t: s } = r();
9
- return /* @__PURE__ */ t(e, {
9
+ return /* @__PURE__ */ n(e, {
10
10
  currentStep: "checkout",
11
11
  bookingPath: i,
12
12
  checkoutPath: o,
13
13
  backPath: i,
14
14
  backLabel: s("back_to_booking"),
15
- children: /* @__PURE__ */ n("div", {
16
- className: "grid animate-pulse gap-6 lg:grid-cols-12",
15
+ children: [/* @__PURE__ */ n("div", {
16
+ className: "grid animate-pulse gap-6 pb-24 lg:grid-cols-12 lg:pb-0",
17
17
  "data-testid": "checkout-cart-skeleton",
18
18
  role: "status",
19
19
  "aria-busy": "true",
@@ -47,11 +47,11 @@ function o({ bookingPath: i, checkoutPath: o }) {
47
47
  })]
48
48
  })]
49
49
  }),
50
- /* @__PURE__ */ t(a, { className: "mt-8 h-11 w-52" })
50
+ /* @__PURE__ */ t(a, { className: "mt-8 hidden h-11 w-52 lg:block" })
51
51
  ]
52
52
  }),
53
53
  /* @__PURE__ */ t("div", {
54
- className: "lg:col-span-5",
54
+ className: "hidden lg:col-span-5 lg:block",
55
55
  "aria-hidden": "true",
56
56
  children: /* @__PURE__ */ n("div", {
57
57
  className: "overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm",
@@ -98,7 +98,11 @@ function o({ bookingPath: i, checkoutPath: o }) {
98
98
  })
99
99
  })
100
100
  ]
101
- })
101
+ }), /* @__PURE__ */ n("div", {
102
+ className: "fixed inset-x-0 bottom-0 z-40 flex animate-pulse gap-2 border-t border-slate-200/80 bg-white/95 p-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] shadow-[0_-12px_30px_-22px_rgba(15,23,42,0.45)] backdrop-blur-lg lg:hidden",
103
+ "aria-hidden": "true",
104
+ children: [/* @__PURE__ */ t(a, { className: "h-12 min-w-0 flex-1" }), /* @__PURE__ */ t(a, { className: "h-12 min-w-0 flex-1" })]
105
+ })]
102
106
  });
103
107
  }
104
108
  //#endregion