@loczer/storefront-sdk 0.165.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.
- package/dist/components/BikeProductCard/index.d.ts.map +1 -1
- package/dist/components/BikeProductCard/index.js +40 -45
- package/dist/components/ContactSection/index.d.ts.map +1 -1
- package/dist/components/ContactSection/index.js +73 -98
- package/dist/components/DelayedReveal/index.js +1 -1
- package/dist/components/Footer/index.d.ts +2 -1
- package/dist/components/Footer/index.d.ts.map +1 -1
- package/dist/components/Footer/index.js +38 -48
- package/dist/components/Header/index.d.ts +2 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +56 -63
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Layout/index.js +35 -26
- package/dist/components/StorefrontCancellationPolicyNotice/index.js +2 -2
- package/dist/i18n/en.d.ts +2 -4
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +5 -7
- package/dist/i18n/fr.d.ts +2 -4
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +5 -7
- package/dist/index.d.ts +8 -10
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +171 -179
- package/dist/pages/CheckoutPaymentPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPaymentPage.js +124 -145
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +186 -174
- package/dist/storefront.css +1 -1
- package/package.json +1 -1
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as c, useMemo as u, useEffect as
|
|
3
|
-
import { toast as
|
|
4
|
-
import { useForm as
|
|
5
|
-
import { useParams as
|
|
6
|
-
import { ArrowLeft as
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
import { apiPost as
|
|
9
|
-
import { ROUTE as
|
|
10
|
-
import { ROUTE as
|
|
11
|
-
import { ROUTE as
|
|
12
|
-
import { getValidStorefrontAvailabilitySchedule as
|
|
13
|
-
import { resolveBookingSearchParamsFromSessionStorage as
|
|
14
|
-
import { buildStorefrontCartSummary as
|
|
15
|
-
import { useStorefrontCart as
|
|
16
|
-
import { useStorefront as
|
|
17
|
-
import { BookingFlowSteps as
|
|
18
|
-
import { Button as
|
|
19
|
-
import { CheckoutDetailsCard as
|
|
20
|
-
import { CheckoutPaymentSummaryCard as
|
|
21
|
-
import { CheckoutSummaryColumn as
|
|
22
|
-
import { FulfillmentSection as
|
|
23
|
-
import { checkoutFormSchema as
|
|
24
|
-
const
|
|
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:
|
|
28
|
+
currency: r.toUpperCase()
|
|
29
29
|
}).format(o / 100);
|
|
30
30
|
} catch {
|
|
31
|
-
return `${(o / 100).toFixed(2)} ${
|
|
31
|
+
return `${(o / 100).toFixed(2)} ${r.toUpperCase()}`;
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, Ae = (o, r) => {
|
|
34
34
|
try {
|
|
35
|
-
return new Intl.NumberFormat(
|
|
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
|
-
},
|
|
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(
|
|
50
|
+
return new Intl.DateTimeFormat(r, { ...M, timeZone: p }).format(o);
|
|
51
51
|
} catch {
|
|
52
52
|
}
|
|
53
|
-
return new Intl.DateTimeFormat(
|
|
53
|
+
return new Intl.DateTimeFormat(r, M).format(o);
|
|
54
54
|
};
|
|
55
|
-
function
|
|
56
|
-
const { t: o, i18n:
|
|
57
|
-
() =>
|
|
58
|
-
[
|
|
59
|
-
), I = p.settings.fulfillmentModes.includes("delivery"),
|
|
60
|
-
const e =
|
|
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
|
-
}, [
|
|
63
|
-
() =>
|
|
64
|
-
items:
|
|
65
|
-
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:
|
|
68
|
-
estimatedDays:
|
|
67
|
+
products: { bikes: G, accessories: J },
|
|
68
|
+
estimatedDays: pe
|
|
69
69
|
}),
|
|
70
|
-
[
|
|
71
|
-
),
|
|
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
|
-
), [
|
|
79
|
-
|
|
80
|
-
if (!i ||
|
|
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 =
|
|
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
|
|
93
|
-
|
|
92
|
+
const n = await $(
|
|
93
|
+
mt,
|
|
94
94
|
{
|
|
95
95
|
storeSlug: i,
|
|
96
96
|
schedule: e,
|
|
97
|
-
products:
|
|
97
|
+
products: z
|
|
98
98
|
}
|
|
99
|
-
), S =
|
|
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
|
-
|
|
116
|
+
z,
|
|
117
117
|
i
|
|
118
118
|
]);
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
const fe = u(() => new Map(
|
|
120
|
+
he.map((e) => [
|
|
121
|
+
ve(e.productId, e.productVariantId),
|
|
122
122
|
e
|
|
123
123
|
])
|
|
124
|
-
), [
|
|
124
|
+
), [he]), N = u(
|
|
125
125
|
() => ({
|
|
126
126
|
...d,
|
|
127
127
|
lines: d.lines.map((e) => {
|
|
128
|
-
const s =
|
|
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
|
-
[
|
|
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
|
-
),
|
|
146
|
-
resolver:
|
|
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
|
-
|
|
149
|
+
U(() => {
|
|
150
|
+
Me(i, t);
|
|
151
151
|
}, [t, i]);
|
|
152
|
-
const
|
|
153
|
-
const s = { ...t, ...e }, n =
|
|
154
|
-
|
|
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
|
-
|
|
158
|
+
P(null), w(null), q(!1), b(null), k(null);
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
|
-
const e =
|
|
161
|
+
const e = ae.trim(), s = e.length === 0 && !K;
|
|
162
162
|
let n = !1;
|
|
163
|
-
return
|
|
163
|
+
return q(!0), k(null), b(null), (async () => {
|
|
164
164
|
try {
|
|
165
|
-
const S = await
|
|
166
|
-
|
|
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 =
|
|
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
|
-
|
|
188
|
+
P(null), k(m.message || o("checkout_coupon_invalid"));
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
|
|
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),
|
|
194
|
+
console.error("Failed to verify checkout coupon", S), P(null), w(null), k(o("checkout_coupon_error"));
|
|
195
195
|
} finally {
|
|
196
|
-
n ||
|
|
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
|
-
|
|
209
|
+
ae,
|
|
210
210
|
o
|
|
211
|
-
]),
|
|
211
|
+
]), U(() => {
|
|
212
212
|
if (!i || d.lines.length === 0) {
|
|
213
|
-
T(null), D(null),
|
|
213
|
+
T(null), D(null), O(!1);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
let e = !1;
|
|
217
|
-
return
|
|
217
|
+
return O(!0), D(null), (async () => {
|
|
218
218
|
try {
|
|
219
|
-
const s = await
|
|
220
|
-
|
|
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 =
|
|
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 ||
|
|
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
|
|
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
|
|
261
|
-
}, [
|
|
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 :
|
|
265
|
-
}, [
|
|
266
|
-
percent:
|
|
267
|
-
|
|
268
|
-
}) :
|
|
269
|
-
|
|
270
|
-
|
|
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
|
-
|
|
281
|
-
Z,
|
|
273
|
+
W,
|
|
282
274
|
l,
|
|
283
275
|
o
|
|
284
|
-
]),
|
|
276
|
+
]), Ge = ge.handleSubmit(async (e) => {
|
|
285
277
|
if (!(!i || C.length === 0)) {
|
|
286
|
-
|
|
278
|
+
Y(!0);
|
|
287
279
|
try {
|
|
288
|
-
const s = await
|
|
289
|
-
|
|
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:
|
|
302
|
-
couponAutoApplied: K ? !1 :
|
|
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 =
|
|
303
|
+
), n = ut.parse(s);
|
|
312
304
|
if (!n.success || !n.checkout) {
|
|
313
|
-
|
|
305
|
+
Z.error(n.message || o("checkout_payment_error"));
|
|
314
306
|
return;
|
|
315
307
|
}
|
|
316
|
-
n.checkout.requiresPayment ||
|
|
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),
|
|
310
|
+
console.error("Failed to submit storefront checkout", s), Z.error(o("checkout_payment_error"));
|
|
319
311
|
} finally {
|
|
320
|
-
|
|
312
|
+
Y(!1);
|
|
321
313
|
}
|
|
322
314
|
}
|
|
323
|
-
}),
|
|
324
|
-
return d.lines.length === 0 ? /* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
329
|
-
/* @__PURE__ */
|
|
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__ */
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
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__ */
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
|
|
342
|
-
|
|
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) =>
|
|
346
|
-
pickupAddress:
|
|
337
|
+
onValueChange: (e) => Q({ fulfillment: e }),
|
|
338
|
+
pickupAddress: Fe,
|
|
347
339
|
deliveryEnabled: I,
|
|
348
|
-
deliveryDisabledReason:
|
|
340
|
+
deliveryDisabledReason: de,
|
|
349
341
|
startAddress: t.start_address,
|
|
350
|
-
onStartAddressChange: (e) =>
|
|
342
|
+
onStartAddressChange: (e) => Q({ start_address: e }),
|
|
351
343
|
endAddress: t.end_address,
|
|
352
|
-
onEndAddressChange: (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__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
|
|
349
|
+
/* @__PURE__ */ a(Mt, { form: ge }),
|
|
350
|
+
/* @__PURE__ */ a(
|
|
351
|
+
xt,
|
|
360
352
|
{
|
|
361
|
-
estimatedTotalLabel:
|
|
362
|
-
couponCode:
|
|
363
|
-
discountAmountLabel:
|
|
364
|
-
totalExcludingTaxLabel:
|
|
365
|
-
vatAmountLabel:
|
|
366
|
-
vatRateLabel:
|
|
367
|
-
depositAmountLabel:
|
|
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:
|
|
370
|
-
paymentSummaryHelper:
|
|
371
|
-
paymentDecisionLoading:
|
|
372
|
-
paymentDecisionError:
|
|
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:
|
|
368
|
+
submitting: B,
|
|
377
369
|
onSelectPaymentMethod: () => {
|
|
378
370
|
}
|
|
379
371
|
}
|
|
380
372
|
),
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
|
|
373
|
+
/* @__PURE__ */ a(
|
|
374
|
+
xe,
|
|
383
375
|
{
|
|
384
376
|
type: "button",
|
|
385
377
|
size: "lg",
|
|
386
378
|
onClick: () => {
|
|
387
|
-
|
|
379
|
+
Ge();
|
|
388
380
|
},
|
|
389
|
-
disabled: !
|
|
381
|
+
disabled: !Xe,
|
|
390
382
|
className: "mt-4 w-fit",
|
|
391
|
-
children: /* @__PURE__ */
|
|
383
|
+
children: /* @__PURE__ */ a("span", { children: Je })
|
|
392
384
|
}
|
|
393
385
|
),
|
|
394
|
-
|
|
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__ */
|
|
398
|
-
|
|
389
|
+
/* @__PURE__ */ a(
|
|
390
|
+
Pt,
|
|
399
391
|
{
|
|
400
392
|
lines: N.lines,
|
|
401
|
-
itemCount:
|
|
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:
|
|
408
|
-
couponCode:
|
|
409
|
-
durationLabel:
|
|
410
|
-
onQuantityChange:
|
|
411
|
-
onRemove:
|
|
399
|
+
lateReturnSurchargeMinor: se?.lateReturnSurchargeMinor,
|
|
400
|
+
couponCode: f?.code,
|
|
401
|
+
durationLabel: Ue.label,
|
|
402
|
+
onQuantityChange: Ie,
|
|
403
|
+
onRemove: Le,
|
|
412
404
|
coupon: {
|
|
413
|
-
code:
|
|
414
|
-
appliedCode:
|
|
415
|
-
discountLabel:
|
|
416
|
-
message:
|
|
417
|
-
error:
|
|
418
|
-
loading:
|
|
419
|
-
disabled:
|
|
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
|
-
|
|
413
|
+
V(e), k(null), b(null);
|
|
422
414
|
},
|
|
423
415
|
onApply: () => {
|
|
424
|
-
|
|
416
|
+
ce(!1), re(ne.trim());
|
|
425
417
|
},
|
|
426
418
|
onRemove: () => {
|
|
427
|
-
|
|
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
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"CheckoutPaymentPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPaymentPage.tsx"],"names":[],"mappings":"AAkGA,MAAM,CAAC,OAAO,UAAU,mBAAmB,4CA0V1C"}
|