@loczer/storefront-sdk 0.166.0 → 0.167.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.
@@ -1,38 +1,38 @@
1
- import { jsx as r, jsxs as _ } from "react/jsx-runtime";
2
- import { useState as c, useMemo as u, useEffect as $ } from "react";
3
- import { toast as J } from "@rpcbase/client";
4
- import { useForm as tt, zodResolver as ot } from "@rpcbase/form";
5
- import { useParams as nt, useSearchParams as at, useNavigate as rt, Link as Se } from "@rpcbase/router";
6
- import { ArrowLeft as Me } from "lucide-react";
7
- import { useTranslation as st } from "react-i18next";
8
- import { apiPost as B } from "../lib/apiCall.js";
9
- import { ROUTE as it, responseSchema as lt } from "../lib/checkoutPaymentDecision.js";
10
- import { ROUTE as ct, responseSchema as ut } from "../lib/checkoutVerifyCoupon.js";
11
- import { ROUTE as dt, responseSchema as mt } from "../lib/checkoutSubmit.js";
12
- import { getValidStorefrontAvailabilitySchedule as pt, ROUTE as ht, responseSchema as ft, buildStorefrontAvailabilityKey as Pe, getStorefrontAvailabilityIssue as gt } from "../lib/storefrontAvailability.js";
13
- import { resolveBookingSearchParamsFromSessionStorage as yt, getBookingParamsFromSearch as _t, getBookingDurationLabel as bt, getBookingDurationMinutes as kt, applyBookingParamsToSearch as xe, writeBookingSearchParamsToSessionStorage as Ae } from "../lib/booking.js";
14
- import { buildStorefrontCartSummary as Ct } from "../lib/cartSummary.js";
15
- import { useStorefrontCart as vt } from "../lib/cart.js";
16
- import { useStorefront as St, useStorefrontProducts as Mt } from "../StorefrontProvider.js";
17
- import { BookingFlowSteps as Pt } from "../components/BookingFlowSteps/index.js";
18
- import { Button as Te } from "../ui/button.js";
19
- import { CheckoutDetailsCard as xt } from "./checkout/components/CheckoutDetailsCard.js";
20
- import { CheckoutPaymentSummaryCard as At } from "./checkout/components/CheckoutPaymentSummaryCard.js";
21
- import { CheckoutSummaryColumn as Tt } from "./checkout/components/CheckoutSummaryColumn.js";
22
- import { FulfillmentSection as Dt } from "../components/FulfillmentSection/index.js";
23
- import { checkoutFormSchema as wt } from "./checkout/types.js";
24
- const De = 0.2, It = (o) => o <= 0 ? 1 : Math.max(1, Math.ceil(o / 1440)), g = (o, a, p) => {
1
+ import { jsx as a, jsxs as y } from "react/jsx-runtime";
2
+ import { useState as c, useMemo as u, useEffect as U } from "react";
3
+ import { toast as Z } from "@rpcbase/client";
4
+ import { useForm as Ye, zodResolver as et } from "@rpcbase/form";
5
+ import { useParams as tt, useSearchParams as ot, useNavigate as nt, Link as ke } from "@rpcbase/router";
6
+ import { ArrowLeft as Ce } from "lucide-react";
7
+ import { useTranslation as at } from "react-i18next";
8
+ import { apiPost as $ } from "../lib/apiCall.js";
9
+ import { ROUTE as rt, responseSchema as st } from "../lib/checkoutPaymentDecision.js";
10
+ import { ROUTE as it, responseSchema as lt } from "../lib/checkoutVerifyCoupon.js";
11
+ import { ROUTE as ct, responseSchema as ut } from "../lib/checkoutSubmit.js";
12
+ import { getValidStorefrontAvailabilitySchedule as dt, ROUTE as mt, responseSchema as pt, buildStorefrontAvailabilityKey as ve, getStorefrontAvailabilityIssue as ht } from "../lib/storefrontAvailability.js";
13
+ import { resolveBookingSearchParamsFromSessionStorage as ft, getBookingParamsFromSearch as gt, getBookingDurationLabel as yt, getBookingDurationMinutes as _t, applyBookingParamsToSearch as Se, writeBookingSearchParamsToSessionStorage as Me } from "../lib/booking.js";
14
+ import { buildStorefrontCartSummary as bt } from "../lib/cartSummary.js";
15
+ import { useStorefrontCart as kt } from "../lib/cart.js";
16
+ import { useStorefront as Ct, useStorefrontProducts as vt } from "../StorefrontProvider.js";
17
+ import { BookingFlowSteps as St } from "../components/BookingFlowSteps/index.js";
18
+ import { Button as xe } from "../ui/button.js";
19
+ import { CheckoutDetailsCard as Mt } from "./checkout/components/CheckoutDetailsCard.js";
20
+ import { CheckoutPaymentSummaryCard as xt } from "./checkout/components/CheckoutPaymentSummaryCard.js";
21
+ import { CheckoutSummaryColumn as Pt } from "./checkout/components/CheckoutSummaryColumn.js";
22
+ import { FulfillmentSection as At } from "../components/FulfillmentSection/index.js";
23
+ import { checkoutFormSchema as Tt } from "./checkout/types.js";
24
+ const Pe = 0.2, Dt = (o) => o <= 0 ? 1 : Math.max(1, Math.ceil(o / 1440)), _ = (o, r, p) => {
25
25
  try {
26
26
  return new Intl.NumberFormat(p, {
27
27
  style: "currency",
28
- currency: a.toUpperCase()
28
+ currency: r.toUpperCase()
29
29
  }).format(o / 100);
30
30
  } catch {
31
- return `${(o / 100).toFixed(2)} ${a.toUpperCase()}`;
31
+ return `${(o / 100).toFixed(2)} ${r.toUpperCase()}`;
32
32
  }
33
- }, X = (o, a) => {
33
+ }, Ae = (o, r) => {
34
34
  try {
35
- return new Intl.NumberFormat(a, {
35
+ return new Intl.NumberFormat(r, {
36
36
  style: "percent",
37
37
  minimumFractionDigits: 0,
38
38
  maximumFractionDigits: 2
@@ -40,48 +40,48 @@ const De = 0.2, It = (o) => o <= 0 ? 1 : Math.max(1, Math.ceil(o / 1440)), g = (
40
40
  } catch {
41
41
  return `${Math.round(o * 100)}%`;
42
42
  }
43
- }, Lt = (o, a, p) => {
43
+ }, wt = (o, r, p) => {
44
44
  const M = {
45
45
  dateStyle: "medium",
46
46
  timeStyle: "short"
47
47
  };
48
48
  if (p)
49
49
  try {
50
- return new Intl.DateTimeFormat(a, { ...M, timeZone: p }).format(o);
50
+ return new Intl.DateTimeFormat(r, { ...M, timeZone: p }).format(o);
51
51
  } catch {
52
52
  }
53
- return new Intl.DateTimeFormat(a, M).format(o);
53
+ return new Intl.DateTimeFormat(r, M).format(o);
54
54
  };
55
- function oo() {
56
- const { t: o, i18n: a } = st(), { storefrontConfiguration: p } = St(), M = p.workspace?.workspaceLanguage, { bikes: Y, accessories: ee } = Mt(), { storeSlug: i } = nt(), [P, we] = at(), Ie = rt(), { items: te, itemCount: Le, setQuantity: Re, removeItem: Ne, clear: Ee } = vt(), [O, oe] = c(!1), [l, T] = c(null), [ne, V] = c(!1), [ae, D] = c(null), re = P.get("coupon") ?? P.get("code") ?? "", [se, q] = c(re), [ie, le] = c(re.trim()), [y, x] = c(null), [ce, w] = c(null), [ue, H] = c(!1), [Fe, b] = c(null), [de, k] = c(null), [K, me] = c(!1), pe = u(
57
- () => yt(P, i),
58
- [P, i]
59
- ), I = p.settings.fulfillmentModes.includes("delivery"), he = p.settings.deliveryDisabledReason.trim(), Ue = I || he.length > 0, $e = p.shop.address?.trim() ?? "", t = u(() => {
60
- const e = _t(pe);
55
+ function eo() {
56
+ const { t: o, i18n: r } = at(), { storefrontConfiguration: p } = Ct(), M = p.workspace?.workspaceLanguage, { bikes: G, accessories: J } = vt(), { storeSlug: i } = tt(), [x, Te] = ot(), De = nt(), { items: X, itemCount: we, setQuantity: Ie, removeItem: Le, clear: Re } = kt(), [B, Y] = c(!1), [l, T] = c(null), [ee, O] = c(!1), [te, D] = c(null), oe = x.get("coupon") ?? x.get("code") ?? "", [ne, V] = c(oe), [ae, re] = c(oe.trim()), [f, P] = c(null), [se, w] = c(null), [ie, q] = c(!1), [Ne, b] = c(null), [le, k] = c(null), [K, ce] = c(!1), ue = u(
57
+ () => ft(x, i),
58
+ [x, i]
59
+ ), I = p.settings.fulfillmentModes.includes("delivery"), de = p.settings.deliveryDisabledReason.trim(), Ee = I || de.length > 0, Fe = p.shop.address?.trim() ?? "", t = u(() => {
60
+ const e = gt(ue);
61
61
  return e.fulfillment === "delivery" && !I ? { ...e, fulfillment: "pickup" } : e;
62
- }, [pe, I]), Be = u(() => bt(t), [t]), fe = u(() => kt(t), [t]), ge = u(() => It(fe), [fe]), d = u(
63
- () => Ct({
64
- items: te,
65
- language: a.language,
62
+ }, [ue, I]), Ue = u(() => yt(t), [t]), me = u(() => _t(t), [t]), pe = u(() => Dt(me), [me]), d = u(
63
+ () => bt({
64
+ items: X,
65
+ language: r.language,
66
66
  fallbackLanguage: M,
67
- products: { bikes: Y, accessories: ee },
68
- estimatedDays: ge
67
+ products: { bikes: G, accessories: J },
68
+ estimatedDays: pe
69
69
  }),
70
- [ee, Y, ge, a.language, te, M]
71
- ), Q = u(
70
+ [J, G, pe, r.language, X, M]
71
+ ), z = u(
72
72
  () => d.lines.map((e) => ({
73
73
  productId: e.checkoutProductId,
74
74
  productVariantId: e.productVariantId,
75
75
  quantity: e.quantity
76
76
  })),
77
77
  [d.lines]
78
- ), [ye, L] = c([]), [j, R] = c(!1);
79
- $(() => {
80
- if (!i || Q.length === 0) {
78
+ ), [he, L] = c([]), [j, R] = c(!1);
79
+ U(() => {
80
+ if (!i || z.length === 0) {
81
81
  L([]), R(!1);
82
82
  return;
83
83
  }
84
- const e = pt(t);
84
+ const e = dt(t);
85
85
  if (!e) {
86
86
  R(!1);
87
87
  return;
@@ -89,14 +89,14 @@ function oo() {
89
89
  let s = !1;
90
90
  return R(!0), L([]), (async () => {
91
91
  try {
92
- const n = await B(
93
- ht,
92
+ const n = await $(
93
+ mt,
94
94
  {
95
95
  storeSlug: i,
96
96
  schedule: e,
97
- products: Q
97
+ products: z
98
98
  }
99
- ), S = ft.parse(n);
99
+ ), S = pt.parse(n);
100
100
  if (s) return;
101
101
  L(S.success ? S.availability ?? [] : []);
102
102
  } catch (n) {
@@ -113,19 +113,19 @@ function oo() {
113
113
  t.end_time,
114
114
  t.start_date,
115
115
  t.start_time,
116
- Q,
116
+ z,
117
117
  i
118
118
  ]);
119
- const _e = u(() => new Map(
120
- ye.map((e) => [
121
- Pe(e.productId, e.productVariantId),
119
+ const fe = u(() => new Map(
120
+ he.map((e) => [
121
+ ve(e.productId, e.productVariantId),
122
122
  e
123
123
  ])
124
- ), [ye]), N = u(
124
+ ), [he]), N = u(
125
125
  () => ({
126
126
  ...d,
127
127
  lines: d.lines.map((e) => {
128
- const s = _e.get(Pe(e.checkoutProductId, e.productVariantId)), n = s ? gt(s) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
128
+ const s = fe.get(ve(e.checkoutProductId, e.productVariantId)), n = s ? ht(s) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
129
129
  return {
130
130
  ...e,
131
131
  insufficientCapacity: !j && n !== void 0,
@@ -133,7 +133,7 @@ function oo() {
133
133
  };
134
134
  })
135
135
  }),
136
- [_e, j, d]
136
+ [fe, j, d]
137
137
  ), C = u(
138
138
  () => d.lines.map((e) => ({
139
139
  kind: e.kind,
@@ -142,28 +142,28 @@ function oo() {
142
142
  quantity: e.quantity
143
143
  })),
144
144
  [d.lines]
145
- ), Oe = d.estimatedTotalMinor ?? d.totalPerDayMinor, v = ce?.totalMinor ?? Oe, A = y?.discountAmountMinor ?? 0, E = xe(new URLSearchParams(), t).toString(), z = `/${i ?? ""}/booking${E ? `?${E}` : ""}`, Ve = `/${i ?? ""}/checkout${E ? `?${E}` : ""}`, be = tt({
146
- resolver: ot(wt),
145
+ ), $e = d.estimatedTotalMinor ?? d.totalPerDayMinor, v = se?.totalMinor ?? $e, A = f?.discountAmountMinor ?? 0, E = Se(new URLSearchParams(), t).toString(), H = `/${i ?? ""}/booking${E ? `?${E}` : ""}`, Be = `/${i ?? ""}/checkout${E ? `?${E}` : ""}`, ge = Ye({
146
+ resolver: et(Tt),
147
147
  defaultValues: { full_name: "", email: "", phone: "", notes: "" }
148
148
  });
149
- $(() => {
150
- Ae(i, t);
149
+ U(() => {
150
+ Me(i, t);
151
151
  }, [t, i]);
152
- const W = (e) => {
153
- const s = { ...t, ...e }, n = xe(P, s);
154
- we(n, { replace: !0 }), Ae(i, n);
152
+ const Q = (e) => {
153
+ const s = { ...t, ...e }, n = Se(x, s);
154
+ Te(n, { replace: !0 }), Me(i, n);
155
155
  };
156
- $(() => {
156
+ U(() => {
157
157
  if (!i || C.length === 0) {
158
- x(null), w(null), H(!1), b(null), k(null);
158
+ P(null), w(null), q(!1), b(null), k(null);
159
159
  return;
160
160
  }
161
- const e = ie.trim(), s = e.length === 0 && !K;
161
+ const e = ae.trim(), s = e.length === 0 && !K;
162
162
  let n = !1;
163
- return H(!0), k(null), b(null), (async () => {
163
+ return q(!0), k(null), b(null), (async () => {
164
164
  try {
165
- const S = await B(
166
- ct,
165
+ const S = await $(
166
+ it,
167
167
  {
168
168
  storeSlug: i,
169
169
  schedule: {
@@ -176,7 +176,7 @@ function oo() {
176
176
  couponCode: e || void 0,
177
177
  includeAutoApply: s
178
178
  }
179
- ), m = ut.parse(S);
179
+ ), m = lt.parse(S);
180
180
  if (n) return;
181
181
  if (w(
182
182
  typeof m.subtotalMinor == "number" && typeof m.totalMinor == "number" ? {
@@ -185,15 +185,15 @@ function oo() {
185
185
  lateReturnSurchargeMinor: m.lateReturnSurchargeMinor
186
186
  } : null
187
187
  ), !m.success) {
188
- x(null), k(m.message || o("checkout_coupon_invalid"));
188
+ P(null), k(m.message || o("checkout_coupon_invalid"));
189
189
  return;
190
190
  }
191
- x(m.coupon ?? null), m.coupon && (m.coupon.autoApplied && e.length === 0 ? (q(m.coupon.code), b(o("checkout_coupon_auto_applied", { code: m.coupon.code }))) : b(o("checkout_coupon_manual_applied")));
191
+ P(m.coupon ?? null), m.coupon && (m.coupon.autoApplied && e.length === 0 ? (V(m.coupon.code), b(o("checkout_coupon_auto_applied", { code: m.coupon.code }))) : b(o("checkout_coupon_manual_applied")));
192
192
  } catch (S) {
193
193
  if (n) return;
194
- console.error("Failed to verify checkout coupon", S), x(null), w(null), k(o("checkout_coupon_error"));
194
+ console.error("Failed to verify checkout coupon", S), P(null), w(null), k(o("checkout_coupon_error"));
195
195
  } finally {
196
- n || H(!1);
196
+ n || q(!1);
197
197
  }
198
198
  })(), () => {
199
199
  n = !0;
@@ -206,18 +206,18 @@ function oo() {
206
206
  t.start_time,
207
207
  C,
208
208
  i,
209
- ie,
209
+ ae,
210
210
  o
211
- ]), $(() => {
211
+ ]), U(() => {
212
212
  if (!i || d.lines.length === 0) {
213
- T(null), D(null), V(!1);
213
+ T(null), D(null), O(!1);
214
214
  return;
215
215
  }
216
216
  let e = !1;
217
- return V(!0), D(null), (async () => {
217
+ return O(!0), D(null), (async () => {
218
218
  try {
219
- const s = await B(
220
- it,
219
+ const s = await $(
220
+ rt,
221
221
  {
222
222
  storeSlug: i,
223
223
  schedule: {
@@ -228,7 +228,7 @@ function oo() {
228
228
  },
229
229
  estimatedTotalMinor: v
230
230
  }
231
- ), n = lt.parse(s);
231
+ ), n = st.parse(s);
232
232
  if (e) return;
233
233
  if (!n.success || !n.decision) {
234
234
  T(null), D(n.message || o("checkout_payment_error"));
@@ -239,7 +239,7 @@ function oo() {
239
239
  if (e) return;
240
240
  console.error("Failed to load checkout payment decision", s), T(null), D(o("checkout_payment_error"));
241
241
  } finally {
242
- e || V(!1);
242
+ e || O(!1);
243
243
  }
244
244
  })(), () => {
245
245
  e = !0;
@@ -254,39 +254,31 @@ function oo() {
254
254
  i,
255
255
  o
256
256
  ]);
257
- const f = l?.currency ?? "EUR", qe = g(v, f, a.language), He = A > 0 ? `-${g(A, f, a.language)}` : null, ke = Math.round(v / (1 + De)), Ke = Math.max(0, v - ke), Qe = g(ke, f, a.language), je = g(Ke, f, a.language), ze = X(De, a.language), h = l?.amountToCollectMinor ?? 0, We = g(h, f, a.language), Ze = l?.paymentMode === "deposit" && h > 0 ? g(h, f, a.language) : null, Ge = l?.shouldCollectOnlinePayment === !0 && h > 0, Ce = p.shop.timeZone?.trim() || void 0, F = u(() => {
257
+ const g = l?.currency ?? "EUR", Oe = _(v, g, r.language), Ve = A > 0 ? `-${_(A, g, r.language)}` : null, ye = Math.round(v / (1 + Pe)), qe = Math.max(0, v - ye), Ke = _(ye, g, r.language), ze = _(qe, g, r.language), je = Ae(Pe, r.language), h = l?.amountToCollectMinor ?? 0, He = _(h, g, r.language), Qe = l?.paymentMode === "deposit" && h > 0 ? _(h, g, r.language) : null, We = l?.shouldCollectOnlinePayment === !0 && h > 0, _e = p.shop.timeZone?.trim() || void 0, F = u(() => {
258
258
  if (!l) return null;
259
259
  const e = Math.max(0, Math.min(1, l.bookingDepositPercentage));
260
- return X(e, a.language);
261
- }, [a.language, l]), Z = u(() => {
260
+ return Ae(e, r.language);
261
+ }, [r.language, l]), W = u(() => {
262
262
  if (!l?.depositRefundableUntilIso) return null;
263
263
  const e = new Date(l.depositRefundableUntilIso);
264
- return Number.isNaN(e.getTime()) ? null : Lt(e, a.language, Ce);
265
- }, [a.language, l?.depositRefundableUntilIso, Ce]), G = l?.cancellationQuote, U = G?.policyEnabled ? o("checkout_payment_cancellation_policy_helper", {
266
- percent: X(G.refundPercentage, a.language),
267
- amount: g(G.refundableAmountMinor, f, a.language)
268
- }) : null, Je = u(() => {
269
- if (!l) return null;
270
- const e = (s) => [s, U].filter(Boolean).join(" ");
271
- return l.paymentMode === "deposit" && h > 0 && F ? e(Z ? o("checkout_payment_due_now_helper_deposit_refundable_until", {
272
- percent: F,
273
- date: Z
274
- }) : o("checkout_payment_due_now_helper_deposit", {
275
- percent: F
276
- })) : l.paymentMode === "full" && h > 0 ? U : l.paymentMode === "none" || h <= 0 ? e(o("checkout_payment_due_now_helper_none")) : U;
277
- }, [
264
+ return Number.isNaN(e.getTime()) ? null : wt(e, r.language, _e);
265
+ }, [r.language, l?.depositRefundableUntilIso, _e]), Ze = u(() => l ? l.paymentMode === "deposit" && h > 0 && F ? W ? o("checkout_payment_due_now_helper_deposit_refundable_until", {
266
+ percent: F,
267
+ date: W
268
+ }) : o("checkout_payment_due_now_helper_deposit", {
269
+ percent: F
270
+ }) : l.paymentMode === "none" || h <= 0 ? o("checkout_payment_due_now_helper_none") : null : null, [
278
271
  h,
279
272
  F,
280
- U,
281
- Z,
273
+ W,
282
274
  l,
283
275
  o
284
- ]), Xe = be.handleSubmit(async (e) => {
276
+ ]), Ge = ge.handleSubmit(async (e) => {
285
277
  if (!(!i || C.length === 0)) {
286
- oe(!0);
278
+ Y(!0);
287
279
  try {
288
- const s = await B(
289
- dt,
280
+ const s = await $(
281
+ ct,
290
282
  {
291
283
  storeSlug: i,
292
284
  schedule: {
@@ -298,8 +290,8 @@ function oo() {
298
290
  fulfillment: t.fulfillment,
299
291
  startAddress: t.fulfillment === "delivery" ? t.start_address : void 0,
300
292
  endAddress: t.fulfillment === "delivery" ? t.end_address : void 0,
301
- couponCode: y?.code,
302
- couponAutoApplied: K ? !1 : y?.autoApplied,
293
+ couponCode: f?.code,
294
+ couponAutoApplied: K ? !1 : f?.autoApplied,
303
295
  customer: {
304
296
  fullName: e.full_name,
305
297
  email: e.email,
@@ -308,123 +300,123 @@ function oo() {
308
300
  },
309
301
  items: C
310
302
  }
311
- ), n = mt.parse(s);
303
+ ), n = ut.parse(s);
312
304
  if (!n.success || !n.checkout) {
313
- J.error(n.message || o("checkout_payment_error"));
305
+ Z.error(n.message || o("checkout_payment_error"));
314
306
  return;
315
307
  }
316
- n.checkout.requiresPayment || J.success(o("checkout_success_toast")), await Ie(n.checkout.nextPath), Ee();
308
+ n.checkout.requiresPayment || Z.success(o("checkout_success_toast")), await De(n.checkout.nextPath), Re();
317
309
  } catch (s) {
318
- console.error("Failed to submit storefront checkout", s), J.error(o("checkout_payment_error"));
310
+ console.error("Failed to submit storefront checkout", s), Z.error(o("checkout_payment_error"));
319
311
  } finally {
320
- oe(!1);
312
+ Y(!1);
321
313
  }
322
314
  }
323
- }), Ye = o(Ge ? "checkout_continue_to_payment" : "checkout_submit"), ve = t.fulfillment === "delivery" && t.start_address.trim().length === 0, et = !O && !ne && !ae && !ue && !de && !!l && !ve && C.length > 0;
324
- return d.lines.length === 0 ? /* @__PURE__ */ r("div", { className: "mx-auto max-w-3xl px-4 py-10 sm:px-6", children: /* @__PURE__ */ _("div", { className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm", children: [
325
- /* @__PURE__ */ r("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ r("span", { children: o("cart_empty_title") }) }),
326
- /* @__PURE__ */ r("p", { className: "mt-2 text-sm text-slate-600", children: /* @__PURE__ */ r("span", { children: o("cart_empty_description") }) }),
327
- /* @__PURE__ */ r("div", { className: "mt-6", children: /* @__PURE__ */ r(Se, { to: z, children: /* @__PURE__ */ _(Te, { className: "gap-2", children: [
328
- /* @__PURE__ */ r(Me, { className: "h-4 w-4", "aria-hidden": "true" }),
329
- /* @__PURE__ */ r("span", { children: o("back_to_booking") })
315
+ }), Je = o(We ? "checkout_continue_to_payment" : "checkout_submit"), be = t.fulfillment === "delivery" && t.start_address.trim().length === 0, Xe = !B && !ee && !te && !ie && !le && !!l && !be && C.length > 0;
316
+ return d.lines.length === 0 ? /* @__PURE__ */ a("div", { className: "mx-auto max-w-3xl px-4 py-10 sm:px-6", children: /* @__PURE__ */ y("div", { className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm", children: [
317
+ /* @__PURE__ */ a("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ a("span", { children: o("cart_empty_title") }) }),
318
+ /* @__PURE__ */ a("p", { className: "mt-2 text-sm text-slate-600", children: /* @__PURE__ */ a("span", { children: o("cart_empty_description") }) }),
319
+ /* @__PURE__ */ a("div", { className: "mt-6", children: /* @__PURE__ */ a(ke, { to: H, children: /* @__PURE__ */ y(xe, { className: "gap-2", children: [
320
+ /* @__PURE__ */ a(Ce, { className: "h-4 w-4", "aria-hidden": "true" }),
321
+ /* @__PURE__ */ a("span", { children: o("back_to_booking") })
330
322
  ] }) }) })
331
- ] }) }) : /* @__PURE__ */ r("div", { className: "mx-auto max-w-7xl px-4 py-8 sm:px-6", children: /* @__PURE__ */ _("div", { className: "flex flex-col gap-6", children: [
332
- /* @__PURE__ */ r(Pt, { currentStep: "checkout", bookingPath: z, checkoutPath: Ve }),
333
- /* @__PURE__ */ _(Se, { to: z, className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950", children: [
334
- /* @__PURE__ */ r(Me, { className: "h-4 w-4", "aria-hidden": "true" }),
335
- /* @__PURE__ */ r("span", { children: o("back_to_booking") })
323
+ ] }) }) : /* @__PURE__ */ a("div", { className: "mx-auto max-w-7xl px-4 py-8 sm:px-6", children: /* @__PURE__ */ y("div", { className: "flex flex-col gap-6", children: [
324
+ /* @__PURE__ */ a(St, { currentStep: "checkout", bookingPath: H, checkoutPath: Be }),
325
+ /* @__PURE__ */ y(ke, { to: H, className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950", children: [
326
+ /* @__PURE__ */ a(Ce, { className: "h-4 w-4", "aria-hidden": "true" }),
327
+ /* @__PURE__ */ a("span", { children: o("back_to_booking") })
336
328
  ] }),
337
- /* @__PURE__ */ _("div", { className: "grid gap-6 lg:grid-cols-12", children: [
338
- /* @__PURE__ */ _("div", { className: "lg:col-span-7", children: [
339
- /* @__PURE__ */ r("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ r("span", { children: o("checkout_title") }) }),
340
- /* @__PURE__ */ _("div", { className: "mt-5 grid gap-4", children: [
341
- Ue ? /* @__PURE__ */ r("div", { className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm", children: /* @__PURE__ */ r(
342
- Dt,
329
+ /* @__PURE__ */ y("div", { className: "grid gap-6 lg:grid-cols-12", children: [
330
+ /* @__PURE__ */ y("div", { className: "lg:col-span-7", children: [
331
+ /* @__PURE__ */ a("h1", { className: "text-xl font-semibold tracking-tight text-slate-950", children: /* @__PURE__ */ a("span", { children: o("checkout_title") }) }),
332
+ /* @__PURE__ */ y("div", { className: "mt-5 grid gap-4", children: [
333
+ Ee ? /* @__PURE__ */ a("div", { className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm", children: /* @__PURE__ */ a(
334
+ At,
343
335
  {
344
336
  value: t.fulfillment,
345
- onValueChange: (e) => W({ fulfillment: e }),
346
- pickupAddress: $e,
337
+ onValueChange: (e) => Q({ fulfillment: e }),
338
+ pickupAddress: Fe,
347
339
  deliveryEnabled: I,
348
- deliveryDisabledReason: he,
340
+ deliveryDisabledReason: de,
349
341
  startAddress: t.start_address,
350
- onStartAddressChange: (e) => W({ start_address: e }),
342
+ onStartAddressChange: (e) => Q({ start_address: e }),
351
343
  endAddress: t.end_address,
352
- onEndAddressChange: (e) => W({ end_address: e }),
344
+ onEndAddressChange: (e) => Q({ end_address: e }),
353
345
  showPickupAddressWhenPickupOnly: !1,
354
346
  testIdPrefix: "storefront-checkout-fulfillment"
355
347
  }
356
348
  ) }) : null,
357
- /* @__PURE__ */ r(xt, { form: be }),
358
- /* @__PURE__ */ r(
359
- At,
349
+ /* @__PURE__ */ a(Mt, { form: ge }),
350
+ /* @__PURE__ */ a(
351
+ xt,
360
352
  {
361
- estimatedTotalLabel: qe,
362
- couponCode: y?.code,
363
- discountAmountLabel: He,
364
- totalExcludingTaxLabel: Qe,
365
- vatAmountLabel: je,
366
- vatRateLabel: ze,
367
- depositAmountLabel: Ze,
353
+ estimatedTotalLabel: Oe,
354
+ couponCode: f?.code,
355
+ discountAmountLabel: Ve,
356
+ totalExcludingTaxLabel: Ke,
357
+ vatAmountLabel: ze,
358
+ vatRateLabel: je,
359
+ depositAmountLabel: Qe,
368
360
  amountToCollectMinor: h,
369
- amountToCollectLabel: We,
370
- paymentSummaryHelper: Je,
371
- paymentDecisionLoading: ne,
372
- paymentDecisionError: ae,
361
+ amountToCollectLabel: He,
362
+ paymentSummaryHelper: Ze,
363
+ paymentDecisionLoading: ee,
364
+ paymentDecisionError: te,
373
365
  canChoosePaymentMethod: !1,
374
366
  showAmountDueNowRow: !0,
375
367
  selectedPaymentMethod: "card",
376
- submitting: O,
368
+ submitting: B,
377
369
  onSelectPaymentMethod: () => {
378
370
  }
379
371
  }
380
372
  ),
381
- /* @__PURE__ */ r(
382
- Te,
373
+ /* @__PURE__ */ a(
374
+ xe,
383
375
  {
384
376
  type: "button",
385
377
  size: "lg",
386
378
  onClick: () => {
387
- Xe();
379
+ Ge();
388
380
  },
389
- disabled: !et,
381
+ disabled: !Xe,
390
382
  className: "mt-4 w-fit",
391
- children: /* @__PURE__ */ r("span", { children: Ye })
383
+ children: /* @__PURE__ */ a("span", { children: Je })
392
384
  }
393
385
  ),
394
- ve ? /* @__PURE__ */ r("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ r("span", { children: o("checkout_delivery_address_required") }) }) : null
386
+ be ? /* @__PURE__ */ a("p", { className: "text-sm text-slate-600", children: /* @__PURE__ */ a("span", { children: o("checkout_delivery_address_required") }) }) : null
395
387
  ] })
396
388
  ] }),
397
- /* @__PURE__ */ r(
398
- Tt,
389
+ /* @__PURE__ */ a(
390
+ Pt,
399
391
  {
400
392
  lines: N.lines,
401
- itemCount: Le,
393
+ itemCount: we,
402
394
  totalPerDayMinor: N.totalPerDayMinor,
403
395
  estimatedDays: N.estimatedDays,
404
396
  estimatedTotalMinor: N.estimatedTotalMinor,
405
397
  discountedEstimatedTotalMinor: v,
406
398
  discountAmountMinor: A,
407
- lateReturnSurchargeMinor: ce?.lateReturnSurchargeMinor,
408
- couponCode: y?.code,
409
- durationLabel: Be.label,
410
- onQuantityChange: Re,
411
- onRemove: Ne,
399
+ lateReturnSurchargeMinor: se?.lateReturnSurchargeMinor,
400
+ couponCode: f?.code,
401
+ durationLabel: Ue.label,
402
+ onQuantityChange: Ie,
403
+ onRemove: Le,
412
404
  coupon: {
413
- code: se,
414
- appliedCode: y?.code,
415
- discountLabel: y && A > 0 ? g(A, f, a.language) : null,
416
- message: Fe,
417
- error: de,
418
- loading: ue,
419
- disabled: O,
405
+ code: ne,
406
+ appliedCode: f?.code,
407
+ discountLabel: f && A > 0 ? _(A, g, r.language) : null,
408
+ message: Ne,
409
+ error: le,
410
+ loading: ie,
411
+ disabled: B,
420
412
  onCodeChange: (e) => {
421
- q(e), k(null), b(null);
413
+ V(e), k(null), b(null);
422
414
  },
423
415
  onApply: () => {
424
- me(!1), le(se.trim());
416
+ ce(!1), re(ne.trim());
425
417
  },
426
418
  onRemove: () => {
427
- q(""), le(""), x(null), w(null), k(null), b(null), me(!0);
419
+ V(""), re(""), P(null), w(null), k(null), b(null), ce(!0);
428
420
  }
429
421
  }
430
422
  }
@@ -433,5 +425,5 @@ function oo() {
433
425
  ] }) });
434
426
  }
435
427
  export {
436
- oo as default
428
+ eo as default
437
429
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutPaymentPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPaymentPage.tsx"],"names":[],"mappings":"AAkGA,MAAM,CAAC,OAAO,UAAU,mBAAmB,4CAwW1C"}
1
+ {"version":3,"file":"CheckoutPaymentPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPaymentPage.tsx"],"names":[],"mappings":"AAkGA,MAAM,CAAC,OAAO,UAAU,mBAAmB,4CA0V1C"}