@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.
- package/dist/components/Layout/index.d.ts.map +1 -1
- package/dist/components/Layout/index.js +38 -26
- package/dist/components/StorefrontCartPanel/index.d.ts +2 -1
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +24 -24
- package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.d.ts +4 -2
- package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.d.ts.map +1 -1
- package/dist/components/WhatsAppFloatingButton/WhatsAppFloatingButton.js +8 -8
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +3 -0
- package/dist/i18n/fr.d.ts +3 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +3 -0
- package/dist/index.d.ts +12 -3
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +198 -184
- package/dist/pages/checkout/components/CheckoutLoadingSkeleton.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutLoadingSkeleton.js +10 -6
- package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.d.ts +13 -0
- package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.d.ts.map +1 -0
- package/dist/pages/checkout/components/CheckoutMobileSummaryDrawer.js +95 -0
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +4 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +22 -20
- package/dist/storefront.css +1 -1
- 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 {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
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
|
|
24
|
-
import { useTranslation as
|
|
25
|
-
import { AlertTriangle as
|
|
26
|
-
import { useForm as
|
|
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
|
|
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
|
-
},
|
|
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 } =
|
|
50
|
-
let e = t(
|
|
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" && !
|
|
55
|
+
return e.fulfillment === "delivery" && !I ? {
|
|
55
56
|
...e,
|
|
56
57
|
fulfillment: "pickup"
|
|
57
58
|
} : e;
|
|
58
|
-
}, [
|
|
59
|
-
items:
|
|
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:
|
|
62
|
+
fallbackLanguage: ze,
|
|
62
63
|
products: {
|
|
63
64
|
bikes: g,
|
|
64
|
-
accessories:
|
|
65
|
+
accessories: Be
|
|
65
66
|
},
|
|
66
|
-
priceUnit:
|
|
67
|
-
billableUnitCount:
|
|
67
|
+
priceUnit: z.baseUnit,
|
|
68
|
+
billableUnitCount: gt
|
|
68
69
|
}), [
|
|
69
|
-
|
|
70
|
+
Be,
|
|
70
71
|
g,
|
|
71
|
-
|
|
72
|
+
gt,
|
|
72
73
|
m.language,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
]),
|
|
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
|
-
})), [
|
|
81
|
+
})), [B.lines]), [_t, H] = l([]), [U, W] = l(!1);
|
|
81
82
|
s(() => {
|
|
82
|
-
if (!_ ||
|
|
83
|
-
|
|
83
|
+
if (!_ || V.length === 0) {
|
|
84
|
+
H([]), W(!1);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
if (!
|
|
87
|
-
|
|
87
|
+
if (!R) {
|
|
88
|
+
H([]), W(!1);
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
let e = !1;
|
|
91
|
-
return W(!0),
|
|
92
|
+
return W(!0), H([]), (async () => {
|
|
92
93
|
try {
|
|
93
94
|
let t = await o(oe, {
|
|
94
95
|
storeSlug: _,
|
|
95
|
-
schedule:
|
|
96
|
-
products:
|
|
96
|
+
schedule: R,
|
|
97
|
+
products: V
|
|
97
98
|
}), n = ue.parse(t);
|
|
98
99
|
if (e) return;
|
|
99
|
-
|
|
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),
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
L.endDate,
|
|
112
|
+
L.endTime,
|
|
113
|
+
L.startDate,
|
|
114
|
+
L.startTime,
|
|
115
|
+
R,
|
|
116
|
+
V,
|
|
116
117
|
_
|
|
117
118
|
]);
|
|
118
|
-
let
|
|
119
|
-
...
|
|
120
|
-
lines:
|
|
121
|
-
let t =
|
|
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: !
|
|
125
|
-
availabilityIssue:
|
|
125
|
+
insufficientCapacity: !U && n !== void 0,
|
|
126
|
+
availabilityIssue: U ? void 0 : n
|
|
126
127
|
};
|
|
127
128
|
})
|
|
128
129
|
}), [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]), G = c(() =>
|
|
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
|
-
})), [
|
|
138
|
-
let t =
|
|
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
|
-
}),
|
|
145
|
-
resolver:
|
|
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(_,
|
|
155
|
-
}, [
|
|
156
|
-
!
|
|
157
|
-
}, [
|
|
158
|
-
let
|
|
155
|
+
i(_, L);
|
|
156
|
+
}, [L, _]), s(() => {
|
|
157
|
+
!q && F && ct(!1);
|
|
158
|
+
}, [F, q]);
|
|
159
|
+
let Dt = (t) => {
|
|
159
160
|
let n = {
|
|
160
|
-
...
|
|
161
|
+
...L,
|
|
161
162
|
...t
|
|
162
163
|
}, r = e(v, n);
|
|
163
|
-
r.toString() !== v.toString() && (
|
|
164
|
+
r.toString() !== v.toString() && (Ve(r, { replace: !0 }), i(_, r));
|
|
164
165
|
};
|
|
165
166
|
s(() => {
|
|
166
|
-
if (!_ || G.length === 0 || !
|
|
167
|
-
|
|
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 =
|
|
171
|
-
return
|
|
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:
|
|
176
|
+
schedule: R,
|
|
176
177
|
items: G,
|
|
177
178
|
couponCode: e || void 0,
|
|
178
179
|
includeAutoApply: t,
|
|
179
|
-
insuranceAccepted:
|
|
180
|
+
insuranceAccepted: J
|
|
180
181
|
}), i = be.parse(r);
|
|
181
182
|
if (n) return;
|
|
182
|
-
if (
|
|
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
|
-
|
|
190
|
+
D(null), N(i.message || p("checkout_coupon_invalid"));
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
|
-
|
|
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),
|
|
196
|
+
console.error("Failed to verify checkout coupon", e), D(null), k(null), N(p("checkout_coupon_error"));
|
|
196
197
|
} finally {
|
|
197
|
-
n ||
|
|
198
|
+
n || j(!1);
|
|
198
199
|
}
|
|
199
200
|
})(), () => {
|
|
200
201
|
n = !0;
|
|
201
202
|
};
|
|
202
203
|
}, [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
P,
|
|
205
|
+
L.endDate,
|
|
206
|
+
L.endTime,
|
|
207
|
+
L.startDate,
|
|
208
|
+
L.startTime,
|
|
209
|
+
R,
|
|
209
210
|
G,
|
|
210
|
-
|
|
211
|
+
J,
|
|
211
212
|
_,
|
|
212
|
-
|
|
213
|
+
rt,
|
|
213
214
|
p
|
|
214
215
|
]), s(() => {
|
|
215
|
-
if (!_ ||
|
|
216
|
-
S(null),
|
|
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
|
|
221
|
+
return et(!0), w(null), (async () => {
|
|
221
222
|
try {
|
|
222
223
|
let t = await o(_e, {
|
|
223
224
|
storeSlug: _,
|
|
224
|
-
schedule:
|
|
225
|
-
estimatedTotalMinor:
|
|
226
|
-
insuranceAmountMinor:
|
|
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),
|
|
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),
|
|
237
|
+
console.error("Failed to load checkout payment decision", t), S(null), w(p("checkout_payment_error"));
|
|
237
238
|
} finally {
|
|
238
|
-
e ||
|
|
239
|
+
e || et(!1);
|
|
239
240
|
}
|
|
240
241
|
})(), () => {
|
|
241
242
|
e = !0;
|
|
242
243
|
};
|
|
243
244
|
}, [
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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",
|
|
256
|
-
if (!_ || G.length === 0 || !
|
|
257
|
-
|
|
258
|
-
let t =
|
|
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:
|
|
265
|
-
fulfillment:
|
|
266
|
-
startAddress:
|
|
267
|
-
endAddress:
|
|
268
|
-
couponCode:
|
|
269
|
-
couponAutoApplied: !
|
|
270
|
-
insuranceAccepted:
|
|
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
|
-
|
|
281
|
+
Xe(), a.error(r.message || p("checkout_payment_error"));
|
|
281
282
|
return;
|
|
282
283
|
}
|
|
283
|
-
r.checkout.requiresPayment ?
|
|
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,
|
|
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
|
-
})
|
|
290
|
-
return
|
|
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(
|
|
306
|
-
to:
|
|
344
|
+
children: /* @__PURE__ */ u(Oe, {
|
|
345
|
+
to: Q,
|
|
307
346
|
children: /* @__PURE__ */ d(de, {
|
|
308
347
|
className: "gap-2",
|
|
309
|
-
children: [/* @__PURE__ */ u(
|
|
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__ */
|
|
357
|
+
}) : /* @__PURE__ */ d(he, {
|
|
319
358
|
currentStep: "checkout",
|
|
320
|
-
bookingPath:
|
|
359
|
+
bookingPath: Q,
|
|
321
360
|
checkoutPath: Tt,
|
|
322
|
-
backPath:
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
345
|
-
onValueChange: (e) =>
|
|
346
|
-
pickupAddress:
|
|
347
|
-
deliveryEnabled:
|
|
348
|
-
deliveryDisabledReason:
|
|
349
|
-
startAddress:
|
|
350
|
-
onStartAddressChange: (e) =>
|
|
351
|
-
endAddress:
|
|
352
|
-
onEndAddressChange: (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
|
-
|
|
359
|
-
accepted:
|
|
360
|
-
disabled: y ||
|
|
397
|
+
q ? /* @__PURE__ */ u(Se, {
|
|
398
|
+
accepted: J,
|
|
399
|
+
disabled: y || A,
|
|
361
400
|
dailyAmountLabel: f(xt, $, m.language),
|
|
362
|
-
totalAmountLabel:
|
|
363
|
-
billableDays:
|
|
401
|
+
totalAmountLabel: It,
|
|
402
|
+
billableDays: O?.insuranceBillableDays,
|
|
364
403
|
deductibleLabel: St > 0 ? f(St, $, m.language) : void 0,
|
|
365
|
-
onAcceptedChange:
|
|
404
|
+
onAcceptedChange: ct
|
|
366
405
|
}) : null,
|
|
367
|
-
|
|
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
|
-
|
|
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(
|
|
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:
|
|
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
|
-
|
|
426
|
+
zt();
|
|
388
427
|
},
|
|
389
|
-
disabled: !
|
|
390
|
-
className: "mt-4 w-fit",
|
|
391
|
-
children: /* @__PURE__ */ u("span", { children:
|
|
428
|
+
disabled: !Ut,
|
|
429
|
+
className: "mt-4 hidden w-fit lg:inline-flex",
|
|
430
|
+
children: /* @__PURE__ */ u("span", { children: Bt })
|
|
392
431
|
}),
|
|
393
|
-
|
|
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
|
-
}),
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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:
|
|
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,
|
|
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__ */
|
|
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
|