@loczer/storefront-sdk 0.198.0 → 0.199.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/StorefrontContext.d.ts +483 -0
- package/dist/StorefrontContext.d.ts.map +1 -0
- package/dist/StorefrontContext.js +39 -0
- package/dist/StorefrontProvider.d.ts +6 -486
- package/dist/StorefrontProvider.d.ts.map +1 -1
- package/dist/StorefrontProvider.js +34 -67
- package/dist/components/AboutSection/index.js +5 -5
- package/dist/components/BikeProductCard/index.d.ts.map +1 -1
- package/dist/components/BikeProductCard/index.js +27 -27
- package/dist/components/BookingBikeVariantDialog/index.js +14 -8
- package/dist/components/ContactSection/index.js +107 -107
- package/dist/components/ContractSaleDocument/Invoice.d.ts.map +1 -1
- package/dist/components/ContractSaleDocument/Invoice.js +117 -111
- package/dist/components/Header/index.js +4 -4
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Layout/index.js +47 -40
- package/dist/components/ProductPriceBadge/index.d.ts +2 -1
- package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
- package/dist/components/ProductPriceBadge/index.js +72 -70
- package/dist/components/TestimonialsSection/index.js +1 -1
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +1 -0
- package/dist/i18n/fr.d.ts +1 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +59 -58
- package/dist/lib/cartSummary.js +7 -7
- package/dist/lib/products.d.ts +6 -0
- package/dist/lib/products.d.ts.map +1 -1
- package/dist/lib/products.js +36 -32
- package/dist/lib/toast.d.ts +9 -0
- package/dist/lib/toast.d.ts.map +1 -0
- package/dist/lib/toast.js +13 -0
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +143 -138
- package/dist/pages/CheckoutPage.js +217 -217
- package/dist/pages/CheckoutPaymentPage.js +124 -124
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +83 -83
- package/dist/pages/HomePage.js +6 -3
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +177 -165
- package/package.json +2 -1
|
@@ -5,9 +5,10 @@ import { ROUTE as re, responseSchema as ie } from "../lib/checkoutPaymentDecisio
|
|
|
5
5
|
import { ROUTE as ae, responseSchema as oe } from "../lib/checkoutSubmit.js";
|
|
6
6
|
import { ROUTE as se, buildStorefrontAvailabilityKey as ce, getStorefrontAvailabilityIssue as le, getValidStorefrontAvailabilitySchedule as ue, responseSchema as de } from "../lib/storefrontAvailability.js";
|
|
7
7
|
import { Button as fe } from "../ui/button.js";
|
|
8
|
+
import { toast as a } from "../lib/toast.js";
|
|
8
9
|
import { BookingFlowSteps as pe } from "../components/BookingFlowSteps/index.js";
|
|
9
|
-
import { useStorefront as me, useStorefrontProducts as he } from "../
|
|
10
|
-
import { apiPost as
|
|
10
|
+
import { useStorefront as me, useStorefrontProducts as he } from "../StorefrontContext.js";
|
|
11
|
+
import { apiPost as o } from "../lib/apiCall.js";
|
|
11
12
|
import { FulfillmentSection as ge } from "../components/FulfillmentSection/index.js";
|
|
12
13
|
import { ROUTE as _e, responseSchema as ve } from "../lib/checkoutVerifyCoupon.js";
|
|
13
14
|
import { CheckoutDetailsCard as ye } from "./checkout/components/CheckoutDetailsCard.js";
|
|
@@ -15,15 +16,14 @@ import { CheckoutPaymentSummaryCard as be } from "./checkout/components/Checkout
|
|
|
15
16
|
import { CheckoutInsuranceCard as xe } from "./checkout/components/CheckoutInsuranceCard.js";
|
|
16
17
|
import { CheckoutSummaryColumn as Se } from "./checkout/components/CheckoutSummaryColumn.js";
|
|
17
18
|
import { checkoutFormSchema as Ce } from "./checkout/types.js";
|
|
18
|
-
import { useEffect as
|
|
19
|
-
import { jsx as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { useForm as je, zodResolver as Me } from "@rpcbase/form";
|
|
19
|
+
import { useEffect as s, useMemo as c, useState as l } from "react";
|
|
20
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
21
|
+
import { Link as we, useNavigate as Te, useParams as Ee, useSearchParams as De } from "@rpcbase/router";
|
|
22
|
+
import { useTranslation as Oe } from "react-i18next";
|
|
23
|
+
import { ArrowLeft as ke } from "lucide-react";
|
|
24
|
+
import { useForm as Ae, zodResolver as je } from "@rpcbase/form";
|
|
25
25
|
//#region src/pages/CheckoutPage.tsx
|
|
26
|
-
var
|
|
26
|
+
var Me = .2, Ne = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), f = (e, t, n) => {
|
|
27
27
|
try {
|
|
28
28
|
return new Intl.NumberFormat(n, {
|
|
29
29
|
style: "currency",
|
|
@@ -32,7 +32,7 @@ var Ne = .2, Pe = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), d = (e,
|
|
|
32
32
|
} catch {
|
|
33
33
|
return `${(e / 100).toFixed(2)} ${t.toUpperCase()}`;
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, Pe = (e, t) => {
|
|
36
36
|
try {
|
|
37
37
|
return new Intl.NumberFormat(t, {
|
|
38
38
|
style: "percent",
|
|
@@ -42,7 +42,7 @@ var Ne = .2, Pe = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), d = (e,
|
|
|
42
42
|
} catch {
|
|
43
43
|
return `${Math.round(e * 100)}%`;
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, Fe = (e, t, n) => {
|
|
46
46
|
let r = {
|
|
47
47
|
dateStyle: "medium",
|
|
48
48
|
timeStyle: "short"
|
|
@@ -55,102 +55,102 @@ var Ne = .2, Pe = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), d = (e,
|
|
|
55
55
|
} catch {}
|
|
56
56
|
return new Intl.DateTimeFormat(t, r).format(e);
|
|
57
57
|
};
|
|
58
|
-
function
|
|
59
|
-
let { t:
|
|
60
|
-
let e = r(
|
|
58
|
+
function p() {
|
|
59
|
+
let { t: p, i18n: m } = Oe(), { storefrontConfiguration: h } = me(), Ie = h.workspace?.workspaceLanguage, { bikes: Le, accessories: Re } = he(), { storeSlug: g } = Ee(), [_, ze] = De(), Be = Te(), { items: Ve, itemCount: He, setQuantity: Ue, removeItem: We, clear: Ge } = te(), [v, Ke] = l(!1), [y, b] = l(null), [qe, Je] = l(!1), [Ye, x] = l(null), Xe = _.get("coupon") ?? _.get("code") ?? "", [Ze, S] = l(Xe), [Qe, $e] = l(Xe.trim()), [C, w] = l(null), [T, E] = l(null), [et, D] = l(!1), [tt, O] = l(null), [nt, k] = l(null), [A, rt] = l(!1), [j, it] = l(!1), at = c(() => i(_, g), [_, g]), M = h.settings.fulfillmentModes.includes("delivery"), ot = h.settings.deliveryDisabledReason.trim(), st = M || ot.length > 0, ct = h.shop.address?.trim() ?? "", N = c(() => {
|
|
60
|
+
let e = r(at, {
|
|
61
61
|
start_time: "",
|
|
62
62
|
end_time: ""
|
|
63
63
|
});
|
|
64
|
-
return e.fulfillment === "delivery" && !
|
|
64
|
+
return e.fulfillment === "delivery" && !M ? {
|
|
65
65
|
...e,
|
|
66
66
|
fulfillment: "pickup"
|
|
67
67
|
} : e;
|
|
68
|
-
}, [
|
|
69
|
-
items:
|
|
70
|
-
language:
|
|
71
|
-
fallbackLanguage:
|
|
68
|
+
}, [at, M]), P = c(() => ue(N), [N]), lt = c(() => t(N), [N]), ut = c(() => n(N), [N]), dt = c(() => Ne(ut), [ut]), F = c(() => ne({
|
|
69
|
+
items: Ve,
|
|
70
|
+
language: m.language,
|
|
71
|
+
fallbackLanguage: Ie,
|
|
72
72
|
products: {
|
|
73
|
-
bikes:
|
|
74
|
-
accessories:
|
|
73
|
+
bikes: Le,
|
|
74
|
+
accessories: Re
|
|
75
75
|
},
|
|
76
|
-
estimatedDays:
|
|
76
|
+
estimatedDays: dt
|
|
77
77
|
}), [
|
|
78
|
-
ze,
|
|
79
78
|
Re,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
Le,
|
|
80
|
+
dt,
|
|
81
|
+
m.language,
|
|
82
|
+
Ve,
|
|
83
|
+
Ie
|
|
84
|
+
]), I = c(() => F.lines.map((e) => ({
|
|
85
85
|
productId: e.checkoutProductId,
|
|
86
86
|
productVariantId: e.productVariantId,
|
|
87
87
|
quantity: e.quantity
|
|
88
|
-
})), [
|
|
89
|
-
|
|
90
|
-
if (!
|
|
91
|
-
|
|
88
|
+
})), [F.lines]), [ft, L] = l([]), [R, z] = l(!1);
|
|
89
|
+
s(() => {
|
|
90
|
+
if (!g || I.length === 0) {
|
|
91
|
+
L([]), z(!1);
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
|
-
if (!
|
|
95
|
-
|
|
94
|
+
if (!P) {
|
|
95
|
+
L([]), z(!1);
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
let e = !1;
|
|
99
|
-
return
|
|
99
|
+
return z(!0), L([]), (async () => {
|
|
100
100
|
try {
|
|
101
|
-
let t = await
|
|
102
|
-
storeSlug:
|
|
103
|
-
schedule:
|
|
104
|
-
products:
|
|
101
|
+
let t = await o(se, {
|
|
102
|
+
storeSlug: g,
|
|
103
|
+
schedule: P,
|
|
104
|
+
products: I
|
|
105
105
|
}), n = de.parse(t);
|
|
106
106
|
if (e) return;
|
|
107
|
-
|
|
107
|
+
L(n.success ? n.availability ?? [] : []);
|
|
108
108
|
} catch (t) {
|
|
109
109
|
if (e) return;
|
|
110
|
-
console.error("Failed to load checkout cart availability", t),
|
|
110
|
+
console.error("Failed to load checkout cart availability", t), L([]);
|
|
111
111
|
} finally {
|
|
112
|
-
e ||
|
|
112
|
+
e || z(!1);
|
|
113
113
|
}
|
|
114
114
|
})(), () => {
|
|
115
115
|
e = !0;
|
|
116
116
|
};
|
|
117
117
|
}, [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
N.end_date,
|
|
119
|
+
N.end_time,
|
|
120
|
+
N.start_date,
|
|
121
|
+
N.start_time,
|
|
122
|
+
P,
|
|
123
|
+
I,
|
|
124
|
+
g
|
|
125
125
|
]);
|
|
126
|
-
let
|
|
127
|
-
...
|
|
128
|
-
lines:
|
|
129
|
-
let t =
|
|
126
|
+
let pt = c(() => new Map(ft.map((e) => [ce(e.productId, e.productVariantId), e])), [ft]), B = c(() => ({
|
|
127
|
+
...F,
|
|
128
|
+
lines: F.lines.map((e) => {
|
|
129
|
+
let t = pt.get(ce(e.checkoutProductId, e.productVariantId)), n = t ? le(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
130
130
|
return {
|
|
131
131
|
...e,
|
|
132
|
-
insufficientCapacity: !
|
|
133
|
-
availabilityIssue:
|
|
132
|
+
insufficientCapacity: !R && n !== void 0,
|
|
133
|
+
availabilityIssue: R ? void 0 : n
|
|
134
134
|
};
|
|
135
135
|
})
|
|
136
136
|
}), [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
]),
|
|
137
|
+
pt,
|
|
138
|
+
R,
|
|
139
|
+
F
|
|
140
|
+
]), V = c(() => F.lines.map((e) => ({
|
|
141
141
|
kind: e.kind,
|
|
142
142
|
productId: e.checkoutProductId,
|
|
143
143
|
productVariantId: e.productVariantId,
|
|
144
144
|
quantity: e.quantity
|
|
145
|
-
})), [
|
|
146
|
-
let t =
|
|
145
|
+
})), [F.lines]), mt = new Map(Le.map((e) => [e.checkoutProductId?.trim() || e.id, e])), H = F.lines.flatMap((e) => {
|
|
146
|
+
let t = mt.get(e.checkoutProductId);
|
|
147
147
|
return t?.insurance?.enabled ? [{
|
|
148
148
|
quantity: e.quantity,
|
|
149
149
|
pricePerDayMinor: t.insurance.pricePerDayMinor,
|
|
150
150
|
deductibleAmountMinor: t.insurance.deductibleAmountMinor
|
|
151
151
|
}] : [];
|
|
152
|
-
}),
|
|
153
|
-
resolver:
|
|
152
|
+
}), U = h.modules?.insurance?.enabled === !0 && H.length > 0, W = U && j, ht = H.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), gt = H.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), _t = F.estimatedTotalMinor ?? F.totalPerDayMinor, G = T?.totalMinor ?? _t, K = C?.discountAmountMinor ?? 0, q = e(new URLSearchParams(), N).toString(), J = `/${g ?? ""}/booking${q ? `?${q}` : ""}`, vt = `/${g ?? ""}/checkout${q ? `?${q}` : ""}`, yt = Ae({
|
|
153
|
+
resolver: je(Ce),
|
|
154
154
|
defaultValues: {
|
|
155
155
|
first_name: "",
|
|
156
156
|
last_name: "",
|
|
@@ -159,33 +159,33 @@ function f() {
|
|
|
159
159
|
notes: ""
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
|
|
163
|
-
ee(
|
|
164
|
-
}, [
|
|
165
|
-
!
|
|
166
|
-
}, [
|
|
167
|
-
let
|
|
162
|
+
s(() => {
|
|
163
|
+
ee(g, N);
|
|
164
|
+
}, [N, g]), s(() => {
|
|
165
|
+
!U && j && it(!1);
|
|
166
|
+
}, [j, U]);
|
|
167
|
+
let bt = (t) => {
|
|
168
168
|
let n = {
|
|
169
|
-
...
|
|
169
|
+
...N,
|
|
170
170
|
...t
|
|
171
|
-
}, r = e(
|
|
172
|
-
|
|
171
|
+
}, r = e(_, n);
|
|
172
|
+
ze(r, { replace: !0 }), ee(g, r);
|
|
173
173
|
};
|
|
174
|
-
|
|
175
|
-
if (!
|
|
176
|
-
w(null), E(null),
|
|
174
|
+
s(() => {
|
|
175
|
+
if (!g || V.length === 0 || !P) {
|
|
176
|
+
w(null), E(null), D(!1), O(null), k(null);
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
let e = Qe.trim(), t = e.length === 0 && !
|
|
180
|
-
return
|
|
179
|
+
let e = Qe.trim(), t = e.length === 0 && !A, n = !1;
|
|
180
|
+
return D(!0), k(null), O(null), (async () => {
|
|
181
181
|
try {
|
|
182
|
-
let r = await
|
|
183
|
-
storeSlug:
|
|
184
|
-
schedule:
|
|
185
|
-
items:
|
|
182
|
+
let r = await o(_e, {
|
|
183
|
+
storeSlug: g,
|
|
184
|
+
schedule: P,
|
|
185
|
+
items: V,
|
|
186
186
|
couponCode: e || void 0,
|
|
187
187
|
includeAutoApply: t,
|
|
188
|
-
insuranceAccepted:
|
|
188
|
+
insuranceAccepted: W
|
|
189
189
|
}), i = ve.parse(r);
|
|
190
190
|
if (n) return;
|
|
191
191
|
if (E(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
|
|
@@ -195,100 +195,100 @@ function f() {
|
|
|
195
195
|
insuranceSubtotalMinor: i.insuranceSubtotalMinor,
|
|
196
196
|
insuranceBillableDays: i.insuranceBillableDays
|
|
197
197
|
} : null), !i.success) {
|
|
198
|
-
w(null),
|
|
198
|
+
w(null), k(i.message || p("checkout_coupon_invalid"));
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
w(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (S(i.coupon.code),
|
|
201
|
+
w(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (S(i.coupon.code), O(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : O(p("checkout_coupon_manual_applied")));
|
|
202
202
|
} catch (e) {
|
|
203
203
|
if (n) return;
|
|
204
|
-
console.error("Failed to verify checkout coupon", e), w(null), E(null),
|
|
204
|
+
console.error("Failed to verify checkout coupon", e), w(null), E(null), k(p("checkout_coupon_error"));
|
|
205
205
|
} finally {
|
|
206
|
-
n ||
|
|
206
|
+
n || D(!1);
|
|
207
207
|
}
|
|
208
208
|
})(), () => {
|
|
209
209
|
n = !0;
|
|
210
210
|
};
|
|
211
211
|
}, [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
A,
|
|
213
|
+
N.end_date,
|
|
214
|
+
N.end_time,
|
|
215
|
+
N.start_date,
|
|
216
|
+
N.start_time,
|
|
217
|
+
P,
|
|
218
|
+
V,
|
|
219
|
+
W,
|
|
220
|
+
g,
|
|
221
221
|
Qe,
|
|
222
|
-
|
|
223
|
-
]),
|
|
224
|
-
if (!
|
|
225
|
-
|
|
222
|
+
p
|
|
223
|
+
]), s(() => {
|
|
224
|
+
if (!g || F.lines.length === 0 || !P) {
|
|
225
|
+
b(null), x(null), Je(!1);
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
let e = !1;
|
|
229
|
-
return
|
|
229
|
+
return Je(!0), x(null), (async () => {
|
|
230
230
|
try {
|
|
231
|
-
let t = await
|
|
232
|
-
storeSlug:
|
|
233
|
-
schedule:
|
|
234
|
-
estimatedTotalMinor:
|
|
231
|
+
let t = await o(re, {
|
|
232
|
+
storeSlug: g,
|
|
233
|
+
schedule: P,
|
|
234
|
+
estimatedTotalMinor: G
|
|
235
235
|
}), n = ie.parse(t);
|
|
236
236
|
if (e) return;
|
|
237
237
|
if (!n.success || !n.decision) {
|
|
238
|
-
|
|
238
|
+
b(null), x(n.errorCode === "online_payment_provider_missing" ? p("checkout_payment_error") : n.message || p("checkout_payment_error"));
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
b(n.decision);
|
|
242
242
|
} catch (t) {
|
|
243
243
|
if (e) return;
|
|
244
|
-
console.error("Failed to load checkout payment decision", t),
|
|
244
|
+
console.error("Failed to load checkout payment decision", t), b(null), x(p("checkout_payment_error"));
|
|
245
245
|
} finally {
|
|
246
|
-
e ||
|
|
246
|
+
e || Je(!1);
|
|
247
247
|
}
|
|
248
248
|
})(), () => {
|
|
249
249
|
e = !0;
|
|
250
250
|
};
|
|
251
251
|
}, [
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
252
|
+
N.end_date,
|
|
253
|
+
N.end_time,
|
|
254
|
+
N.start_date,
|
|
255
|
+
N.start_time,
|
|
256
|
+
P,
|
|
257
|
+
G,
|
|
258
|
+
F.lines.length,
|
|
259
|
+
g,
|
|
260
|
+
p
|
|
261
261
|
]);
|
|
262
|
-
let Y =
|
|
263
|
-
if (!
|
|
264
|
-
let e = new Date(
|
|
265
|
-
return Number.isNaN(e.getTime()) ? null :
|
|
262
|
+
let Y = y?.currency ?? "EUR", xt = f(G, Y, m.language), St = K > 0 ? `-${f(K, Y, m.language)}` : null, X = T?.insuranceSubtotalMinor ?? 0, Ct = Math.max(0, G - X), wt = Math.round(Ct / 1.2), Tt = wt + X, Et = Math.max(0, Ct - wt), Dt = f(Tt, Y, m.language), Ot = f(Et, Y, m.language), kt = Pe(Me, m.language), At = X > 0 ? f(X, Y, m.language) : void 0, Z = y?.amountToCollectMinor ?? 0, jt = f(Z, Y, m.language), Mt = y?.paymentMode === "deposit" && Z > 0 ? f(Z, Y, m.language) : null, Nt = y?.shouldCollectOnlinePayment === !0 && Z > 0, Pt = h.shop.timeZone?.trim() || void 0, Q = c(() => y ? Pe(Math.max(0, Math.min(1, y.bookingDepositPercentage)), m.language) : null, [m.language, y]), $ = c(() => {
|
|
263
|
+
if (!y?.depositRefundableUntilIso) return null;
|
|
264
|
+
let e = new Date(y.depositRefundableUntilIso);
|
|
265
|
+
return Number.isNaN(e.getTime()) ? null : Fe(e, m.language, Pt);
|
|
266
266
|
}, [
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
m.language,
|
|
268
|
+
y?.depositRefundableUntilIso,
|
|
269
269
|
Pt
|
|
270
|
-
]), Ft =
|
|
270
|
+
]), Ft = c(() => y ? y.paymentMode === "deposit" && Z > 0 && Q ? $ ? p("checkout_payment_due_now_helper_deposit_refundable_until", {
|
|
271
271
|
percent: Q,
|
|
272
272
|
date: $
|
|
273
|
-
}) :
|
|
273
|
+
}) : p("checkout_payment_due_now_helper_deposit", { percent: Q }) : y.paymentMode === "none" || Z <= 0 ? p("checkout_payment_due_now_helper_none") : null : null, [
|
|
274
274
|
Z,
|
|
275
275
|
Q,
|
|
276
276
|
$,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
]), It =
|
|
280
|
-
if (!(!
|
|
281
|
-
|
|
277
|
+
y,
|
|
278
|
+
p
|
|
279
|
+
]), It = yt.handleSubmit(async (e) => {
|
|
280
|
+
if (!(!g || V.length === 0 || !P)) {
|
|
281
|
+
Ke(!0);
|
|
282
282
|
try {
|
|
283
|
-
let t = await
|
|
284
|
-
storeSlug:
|
|
285
|
-
schedule:
|
|
286
|
-
fulfillment:
|
|
287
|
-
startAddress:
|
|
288
|
-
endAddress:
|
|
283
|
+
let t = await o(ae, {
|
|
284
|
+
storeSlug: g,
|
|
285
|
+
schedule: P,
|
|
286
|
+
fulfillment: N.fulfillment,
|
|
287
|
+
startAddress: N.fulfillment === "delivery" ? N.start_address : void 0,
|
|
288
|
+
endAddress: N.fulfillment === "delivery" ? N.end_address : void 0,
|
|
289
289
|
couponCode: C?.code,
|
|
290
|
-
couponAutoApplied: !
|
|
291
|
-
insuranceAccepted:
|
|
290
|
+
couponAutoApplied: !A && C?.autoApplied,
|
|
291
|
+
insuranceAccepted: W,
|
|
292
292
|
customer: {
|
|
293
293
|
firstName: e.first_name,
|
|
294
294
|
lastName: e.last_name,
|
|
@@ -296,110 +296,110 @@ function f() {
|
|
|
296
296
|
phone: e.phone,
|
|
297
297
|
notes: e.notes
|
|
298
298
|
},
|
|
299
|
-
items:
|
|
299
|
+
items: V
|
|
300
300
|
}), n = oe.parse(t);
|
|
301
301
|
if (!n.success || !n.checkout) {
|
|
302
|
-
|
|
302
|
+
a.error(n.errorCode === "online_payment_provider_missing" ? p("checkout_payment_error") : n.message || p("checkout_payment_error"));
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
n.checkout.requiresPayment ||
|
|
305
|
+
n.checkout.requiresPayment || a.success(p("checkout_success_toast")), await Be(n.checkout.nextPath), Ge();
|
|
306
306
|
} catch (e) {
|
|
307
|
-
console.error("Failed to submit storefront checkout", e),
|
|
307
|
+
console.error("Failed to submit storefront checkout", e), a.error(p("checkout_payment_error"));
|
|
308
308
|
} finally {
|
|
309
|
-
|
|
309
|
+
Ke(!1);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
}), Lt =
|
|
313
|
-
return
|
|
312
|
+
}), Lt = p(Nt ? "checkout_continue_to_payment" : "checkout_submit"), Rt = N.fulfillment === "delivery" && N.start_address.trim().length === 0, zt = !v && !qe && !Ye && !et && !nt && !!y && !!P && !Rt && V.length > 0;
|
|
313
|
+
return F.lines.length === 0 ? /* @__PURE__ */ u("div", {
|
|
314
314
|
className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
|
|
315
|
-
children: /* @__PURE__ */
|
|
315
|
+
children: /* @__PURE__ */ d("div", {
|
|
316
316
|
className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
|
|
317
317
|
children: [
|
|
318
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ u("h1", {
|
|
319
319
|
className: "text-xl font-semibold tracking-tight text-slate-950",
|
|
320
|
-
children: /* @__PURE__ */
|
|
320
|
+
children: /* @__PURE__ */ u("span", { children: p("cart_empty_title") })
|
|
321
321
|
}),
|
|
322
|
-
/* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ u("p", {
|
|
323
323
|
className: "mt-2 text-sm text-slate-600",
|
|
324
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ u("span", { children: p("cart_empty_description") })
|
|
325
325
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ u("div", {
|
|
327
327
|
className: "mt-6",
|
|
328
|
-
children: /* @__PURE__ */
|
|
329
|
-
to:
|
|
330
|
-
children: /* @__PURE__ */
|
|
328
|
+
children: /* @__PURE__ */ u(we, {
|
|
329
|
+
to: J,
|
|
330
|
+
children: /* @__PURE__ */ d(fe, {
|
|
331
331
|
className: "gap-2",
|
|
332
|
-
children: [/* @__PURE__ */
|
|
332
|
+
children: [/* @__PURE__ */ u(ke, {
|
|
333
333
|
className: "h-4 w-4",
|
|
334
334
|
"aria-hidden": "true"
|
|
335
|
-
}), /* @__PURE__ */
|
|
335
|
+
}), /* @__PURE__ */ u("span", { children: p("back_to_booking") })]
|
|
336
336
|
})
|
|
337
337
|
})
|
|
338
338
|
})
|
|
339
339
|
]
|
|
340
340
|
})
|
|
341
|
-
}) : /* @__PURE__ */
|
|
341
|
+
}) : /* @__PURE__ */ u("div", {
|
|
342
342
|
className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
|
|
343
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ d("div", {
|
|
344
344
|
className: "flex flex-col gap-6",
|
|
345
345
|
children: [
|
|
346
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ u(pe, {
|
|
347
347
|
currentStep: "checkout",
|
|
348
|
-
bookingPath:
|
|
349
|
-
checkoutPath:
|
|
348
|
+
bookingPath: J,
|
|
349
|
+
checkoutPath: vt
|
|
350
350
|
}),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
to:
|
|
351
|
+
/* @__PURE__ */ d(we, {
|
|
352
|
+
to: J,
|
|
353
353
|
className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
|
|
354
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ u(ke, {
|
|
355
355
|
className: "h-4 w-4",
|
|
356
356
|
"aria-hidden": "true"
|
|
357
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ u("span", { children: p("back_to_booking") })]
|
|
358
358
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
359
|
+
/* @__PURE__ */ d("div", {
|
|
360
360
|
className: "grid gap-6 lg:grid-cols-12",
|
|
361
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ d("div", {
|
|
362
362
|
className: "lg:col-span-7",
|
|
363
363
|
children: [
|
|
364
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ u("h1", {
|
|
365
365
|
className: "text-xl font-semibold tracking-tight text-slate-950",
|
|
366
|
-
children: /* @__PURE__ */
|
|
366
|
+
children: /* @__PURE__ */ u("span", { children: p("checkout_title") })
|
|
367
367
|
}),
|
|
368
|
-
|
|
368
|
+
P ? null : /* @__PURE__ */ u("p", {
|
|
369
369
|
role: "alert",
|
|
370
370
|
className: "mt-3 text-sm text-destructive",
|
|
371
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ u("span", { children: p("booking_time_slots_required") })
|
|
372
372
|
}),
|
|
373
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ d("div", {
|
|
374
374
|
className: "mt-5 grid gap-4",
|
|
375
375
|
children: [
|
|
376
|
-
|
|
376
|
+
st ? /* @__PURE__ */ u("div", {
|
|
377
377
|
className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
|
|
378
|
-
children: /* @__PURE__ */
|
|
379
|
-
value:
|
|
380
|
-
onValueChange: (e) =>
|
|
381
|
-
pickupAddress:
|
|
382
|
-
deliveryEnabled:
|
|
383
|
-
deliveryDisabledReason:
|
|
384
|
-
startAddress:
|
|
385
|
-
onStartAddressChange: (e) =>
|
|
386
|
-
endAddress:
|
|
387
|
-
onEndAddressChange: (e) =>
|
|
378
|
+
children: /* @__PURE__ */ u(ge, {
|
|
379
|
+
value: N.fulfillment,
|
|
380
|
+
onValueChange: (e) => bt({ fulfillment: e }),
|
|
381
|
+
pickupAddress: ct,
|
|
382
|
+
deliveryEnabled: M,
|
|
383
|
+
deliveryDisabledReason: ot,
|
|
384
|
+
startAddress: N.start_address,
|
|
385
|
+
onStartAddressChange: (e) => bt({ start_address: e }),
|
|
386
|
+
endAddress: N.end_address,
|
|
387
|
+
onEndAddressChange: (e) => bt({ end_address: e }),
|
|
388
388
|
showPickupAddressWhenPickupOnly: !1,
|
|
389
389
|
testIdPrefix: "storefront-checkout-fulfillment"
|
|
390
390
|
})
|
|
391
391
|
}) : null,
|
|
392
|
-
/* @__PURE__ */
|
|
393
|
-
|
|
394
|
-
accepted:
|
|
395
|
-
disabled:
|
|
396
|
-
dailyAmountLabel:
|
|
392
|
+
/* @__PURE__ */ u(ye, { form: yt }),
|
|
393
|
+
U ? /* @__PURE__ */ u(xe, {
|
|
394
|
+
accepted: W,
|
|
395
|
+
disabled: v || et,
|
|
396
|
+
dailyAmountLabel: f(ht, Y, m.language),
|
|
397
397
|
totalAmountLabel: At,
|
|
398
398
|
billableDays: T?.insuranceBillableDays,
|
|
399
|
-
deductibleLabel:
|
|
400
|
-
onAcceptedChange:
|
|
399
|
+
deductibleLabel: gt > 0 ? f(gt, Y, m.language) : void 0,
|
|
400
|
+
onAcceptedChange: it
|
|
401
401
|
}) : null,
|
|
402
|
-
/* @__PURE__ */
|
|
402
|
+
/* @__PURE__ */ u(be, {
|
|
403
403
|
estimatedTotalLabel: xt,
|
|
404
404
|
couponCode: C?.code,
|
|
405
405
|
discountAmountLabel: St,
|
|
@@ -411,15 +411,15 @@ function f() {
|
|
|
411
411
|
amountToCollectMinor: Z,
|
|
412
412
|
amountToCollectLabel: jt,
|
|
413
413
|
paymentSummaryHelper: Ft,
|
|
414
|
-
paymentDecisionLoading:
|
|
414
|
+
paymentDecisionLoading: qe,
|
|
415
415
|
paymentDecisionError: Ye,
|
|
416
416
|
canChoosePaymentMethod: !1,
|
|
417
417
|
showAmountDueNowRow: !0,
|
|
418
418
|
selectedPaymentMethod: "card",
|
|
419
|
-
submitting:
|
|
419
|
+
submitting: v,
|
|
420
420
|
onSelectPaymentMethod: () => {}
|
|
421
421
|
}),
|
|
422
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ u(fe, {
|
|
423
423
|
type: "button",
|
|
424
424
|
size: "lg",
|
|
425
425
|
onClick: () => {
|
|
@@ -427,44 +427,44 @@ function f() {
|
|
|
427
427
|
},
|
|
428
428
|
disabled: !zt,
|
|
429
429
|
className: "mt-4 w-fit",
|
|
430
|
-
children: /* @__PURE__ */
|
|
430
|
+
children: /* @__PURE__ */ u("span", { children: Lt })
|
|
431
431
|
}),
|
|
432
|
-
Rt ? /* @__PURE__ */
|
|
432
|
+
Rt ? /* @__PURE__ */ u("p", {
|
|
433
433
|
className: "text-sm text-slate-600",
|
|
434
|
-
children: /* @__PURE__ */
|
|
434
|
+
children: /* @__PURE__ */ u("span", { children: p("checkout_delivery_address_required") })
|
|
435
435
|
}) : null
|
|
436
436
|
]
|
|
437
437
|
})
|
|
438
438
|
]
|
|
439
|
-
}), /* @__PURE__ */
|
|
440
|
-
lines:
|
|
441
|
-
itemCount:
|
|
442
|
-
totalPerDayMinor:
|
|
443
|
-
estimatedDays:
|
|
444
|
-
estimatedTotalMinor:
|
|
445
|
-
discountedEstimatedTotalMinor:
|
|
446
|
-
discountAmountMinor:
|
|
439
|
+
}), /* @__PURE__ */ u(Se, {
|
|
440
|
+
lines: B.lines,
|
|
441
|
+
itemCount: He,
|
|
442
|
+
totalPerDayMinor: B.totalPerDayMinor,
|
|
443
|
+
estimatedDays: B.estimatedDays,
|
|
444
|
+
estimatedTotalMinor: B.estimatedTotalMinor,
|
|
445
|
+
discountedEstimatedTotalMinor: G,
|
|
446
|
+
discountAmountMinor: K,
|
|
447
447
|
lateReturnSurchargeMinor: T?.lateReturnSurchargeMinor,
|
|
448
448
|
couponCode: C?.code,
|
|
449
|
-
durationLabel:
|
|
450
|
-
onQuantityChange:
|
|
451
|
-
onRemove:
|
|
449
|
+
durationLabel: lt.label,
|
|
450
|
+
onQuantityChange: Ue,
|
|
451
|
+
onRemove: We,
|
|
452
452
|
coupon: {
|
|
453
453
|
code: Ze,
|
|
454
454
|
appliedCode: C?.code,
|
|
455
|
-
discountLabel: C &&
|
|
456
|
-
message:
|
|
457
|
-
error:
|
|
455
|
+
discountLabel: C && K > 0 ? f(K, Y, m.language) : null,
|
|
456
|
+
message: tt,
|
|
457
|
+
error: nt,
|
|
458
458
|
loading: et,
|
|
459
|
-
disabled:
|
|
459
|
+
disabled: v,
|
|
460
460
|
onCodeChange: (e) => {
|
|
461
|
-
S(e),
|
|
461
|
+
S(e), k(null), O(null);
|
|
462
462
|
},
|
|
463
463
|
onApply: () => {
|
|
464
|
-
|
|
464
|
+
rt(!1), $e(Ze.trim());
|
|
465
465
|
},
|
|
466
466
|
onRemove: () => {
|
|
467
|
-
S(""), $e(""), w(null), E(null),
|
|
467
|
+
S(""), $e(""), w(null), E(null), k(null), O(null), rt(!0);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
})]
|
|
@@ -474,4 +474,4 @@ function f() {
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
//#endregion
|
|
477
|
-
export {
|
|
477
|
+
export { p as default };
|