@loczer/storefront-sdk 0.222.0 → 0.223.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/i18n/en.js +1 -1
- package/dist/i18n/fr.js +1 -1
- package/dist/lib/checkoutPaymentDecision.d.ts +1 -0
- package/dist/lib/checkoutPaymentDecision.d.ts.map +1 -1
- package/dist/lib/checkoutPaymentDecision.js +1 -0
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +156 -154
- package/package.json +1 -1
package/dist/i18n/en.js
CHANGED
|
@@ -63,7 +63,7 @@ var e = {
|
|
|
63
63
|
cancellation_policy_modal_title: "Cancellation policy",
|
|
64
64
|
cancellation_policy_modal_description: "Refunds depend on how far in advance you cancel.",
|
|
65
65
|
cancellation_policy_modal_tier_deadline: "Up to {{duration}} in advance",
|
|
66
|
-
cancellation_policy_modal_tier_refund: "Refund of {{percentage}} of the total amount",
|
|
66
|
+
cancellation_policy_modal_tier_refund: "Refund of {{percentage}} of the total booking amount",
|
|
67
67
|
cancellation_policy_modal_disclaimer: "These are the standard cancellation conditions. Depending on your reservation, different conditions may be offered.",
|
|
68
68
|
cancellation_policy_duration_hours_one: "{{count}} hour",
|
|
69
69
|
cancellation_policy_duration_hours_other: "{{count}} hours",
|
package/dist/i18n/fr.js
CHANGED
|
@@ -63,7 +63,7 @@ var e = {
|
|
|
63
63
|
cancellation_policy_modal_title: "Conditions d'annulation",
|
|
64
64
|
cancellation_policy_modal_description: "Le remboursement dépend du délai entre l'annulation et le début de la réservation.",
|
|
65
65
|
cancellation_policy_modal_tier_deadline: "Jusqu'à {{duration}} à l'avance",
|
|
66
|
-
cancellation_policy_modal_tier_refund: "Remboursement de {{percentage}} du montant total",
|
|
66
|
+
cancellation_policy_modal_tier_refund: "Remboursement de {{percentage}} du montant total de la réservation",
|
|
67
67
|
cancellation_policy_modal_disclaimer: "Il s'agit des conditions d'annulation de base. Selon votre réservation, des conditions différentes pourront vous être proposées.",
|
|
68
68
|
cancellation_policy_duration_hours_one: "{{count}} heure",
|
|
69
69
|
cancellation_policy_duration_hours_other: "{{count}} heures",
|
|
@@ -15,6 +15,7 @@ export declare const requestSchema: z.ZodObject<{
|
|
|
15
15
|
endTime: z.ZodString;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
estimatedTotalMinor: z.ZodNumber;
|
|
18
|
+
insuranceAmountMinor: z.ZodOptional<z.ZodNumber>;
|
|
18
19
|
nowIso: z.ZodOptional<z.ZodString>;
|
|
19
20
|
}, z.core.$strip>;
|
|
20
21
|
export type RequestPayload = z.infer<typeof requestSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"checkoutPaymentDecision.d.ts","sourceRoot":"","sources":["../../src/lib/checkoutPaymentDecision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,KAAK,qDAAqD,CAAA;AAEvE,eAAO,MAAM,yBAAyB;;;;EAAsC,CAAA;AAC5E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;iBAaxB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAE1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;iBAuBzB,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA"}
|
|
@@ -13,6 +13,7 @@ var t = "/api/public/storefront/checkout/payment-decision", n = e.enum([
|
|
|
13
13
|
endTime: e.string().regex(/^\d{2}:\d{2}$/)
|
|
14
14
|
}),
|
|
15
15
|
estimatedTotalMinor: e.number().int().min(0),
|
|
16
|
+
insuranceAmountMinor: e.number().int().min(0).optional(),
|
|
16
17
|
nowIso: e.string().datetime({ offset: !0 }).optional()
|
|
17
18
|
}), i = e.object({
|
|
18
19
|
success: e.boolean(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAoFA,MAAM,CAAC,OAAO,UAAU,YAAY,
|
|
1
|
+
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAoFA,MAAM,CAAC,OAAO,UAAU,YAAY,4CAsoBnC"}
|
|
@@ -45,102 +45,102 @@ var Fe = .2, f = (e, t, n) => {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
function p() {
|
|
48
|
-
let { t: p, i18n: m } = Ae(), { storefrontConfiguration: h } = fe(), Le = h.workspace?.workspaceLanguage, { bikes:
|
|
49
|
-
let e = t(
|
|
48
|
+
let { t: p, i18n: m } = Ae(), { storefrontConfiguration: h } = fe(), Le = h.workspace?.workspaceLanguage, { bikes: g, accessories: Re } = pe(), { storeSlug: _ } = Oe(), [v, ze] = ke(), Be = De(), { items: Ve, itemCount: He, setQuantity: Ue, removeItem: We, beginCheckoutSubmission: Ge, confirmCheckoutPaymentSession: Ke, clearCheckoutSession: qe, clear: Je } = ee(), [y, Ye] = l(!1), b = Te(!1), [x, S] = l(null), [Xe, C] = l(!1), [w, T] = l(null), Ze = v.get("coupon") ?? v.get("code") ?? "", [Qe, E] = l(Ze), [$e, et] = l(Ze.trim()), [D, O] = l(null), [k, A] = l(null), [j, M] = l(!1), [tt, N] = l(null), [nt, P] = l(null), [F, rt] = l(!1), [I, it] = l(!1), at = n(v).toString(), ot = c(() => r(new URLSearchParams(at), _), [at, _]), L = h.settings.fulfillmentModes.includes("delivery"), st = h.settings.deliveryDisabledReason.trim(), ct = L || st.length > 0, lt = h.shop.address?.trim() ?? "", R = c(() => {
|
|
49
|
+
let e = t(ot, {
|
|
50
50
|
start_time: "",
|
|
51
51
|
end_time: ""
|
|
52
52
|
});
|
|
53
|
-
return e.fulfillment === "delivery" && !
|
|
53
|
+
return e.fulfillment === "delivery" && !L ? {
|
|
54
54
|
...e,
|
|
55
55
|
fulfillment: "pickup"
|
|
56
56
|
} : e;
|
|
57
|
-
}, [
|
|
58
|
-
items:
|
|
57
|
+
}, [ot, L]), z = c(() => le(R), [R]), B = h.bookingEngine.pricing, ut = te(R, B, h.bookingEngine.shop.timeZone), dt = ne(B.baseUnit, p), ft = ut?.billableUnitCount, V = c(() => re({
|
|
58
|
+
items: Ve,
|
|
59
59
|
language: m.language,
|
|
60
60
|
fallbackLanguage: Le,
|
|
61
61
|
products: {
|
|
62
|
-
bikes:
|
|
63
|
-
accessories:
|
|
62
|
+
bikes: g,
|
|
63
|
+
accessories: Re
|
|
64
64
|
},
|
|
65
|
-
priceUnit:
|
|
66
|
-
billableUnitCount:
|
|
65
|
+
priceUnit: B.baseUnit,
|
|
66
|
+
billableUnitCount: ft
|
|
67
67
|
}), [
|
|
68
|
-
ze,
|
|
69
68
|
Re,
|
|
70
|
-
|
|
69
|
+
g,
|
|
70
|
+
ft,
|
|
71
71
|
m.language,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
Ve,
|
|
73
|
+
B.baseUnit,
|
|
74
74
|
Le
|
|
75
|
-
]),
|
|
75
|
+
]), H = c(() => V.lines.map((e) => ({
|
|
76
76
|
productId: e.checkoutProductId,
|
|
77
77
|
productVariantId: e.productVariantId,
|
|
78
78
|
quantity: e.quantity
|
|
79
|
-
})), [
|
|
79
|
+
})), [V.lines]), [pt, U] = l([]), [W, G] = l(!1);
|
|
80
80
|
s(() => {
|
|
81
|
-
if (!
|
|
82
|
-
|
|
81
|
+
if (!_ || H.length === 0) {
|
|
82
|
+
U([]), G(!1);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (!
|
|
86
|
-
|
|
85
|
+
if (!z) {
|
|
86
|
+
U([]), G(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
let e = !1;
|
|
90
|
-
return
|
|
90
|
+
return G(!0), U([]), (async () => {
|
|
91
91
|
try {
|
|
92
92
|
let t = await o(oe, {
|
|
93
|
-
storeSlug:
|
|
94
|
-
schedule:
|
|
95
|
-
products:
|
|
93
|
+
storeSlug: _,
|
|
94
|
+
schedule: z,
|
|
95
|
+
products: H
|
|
96
96
|
}), n = ue.parse(t);
|
|
97
97
|
if (e) return;
|
|
98
|
-
|
|
98
|
+
U(n.success ? n.availability ?? [] : []);
|
|
99
99
|
} catch (t) {
|
|
100
100
|
if (e) return;
|
|
101
|
-
console.error("Failed to load checkout cart availability", t),
|
|
101
|
+
console.error("Failed to load checkout cart availability", t), U([]);
|
|
102
102
|
} finally {
|
|
103
|
-
e ||
|
|
103
|
+
e || G(!1);
|
|
104
104
|
}
|
|
105
105
|
})(), () => {
|
|
106
106
|
e = !0;
|
|
107
107
|
};
|
|
108
108
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
R.end_date,
|
|
110
|
+
R.end_time,
|
|
111
|
+
R.start_date,
|
|
112
|
+
R.start_time,
|
|
113
|
+
z,
|
|
114
|
+
H,
|
|
115
|
+
_
|
|
116
116
|
]);
|
|
117
|
-
let
|
|
118
|
-
...
|
|
119
|
-
lines:
|
|
120
|
-
let t =
|
|
117
|
+
let mt = c(() => new Map(pt.map((e) => [se(e.productId, e.productVariantId), e])), [pt]), ht = c(() => ({
|
|
118
|
+
...V,
|
|
119
|
+
lines: V.lines.map((e) => {
|
|
120
|
+
let t = mt.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
121
121
|
return {
|
|
122
122
|
...e,
|
|
123
|
-
insufficientCapacity: !
|
|
124
|
-
availabilityIssue:
|
|
123
|
+
insufficientCapacity: !W && n !== void 0,
|
|
124
|
+
availabilityIssue: W ? void 0 : n
|
|
125
125
|
};
|
|
126
126
|
})
|
|
127
127
|
}), [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]),
|
|
128
|
+
mt,
|
|
129
|
+
W,
|
|
130
|
+
V
|
|
131
|
+
]), K = c(() => V.lines.map((e) => ({
|
|
132
132
|
kind: e.kind,
|
|
133
133
|
productId: e.checkoutProductId,
|
|
134
134
|
productVariantId: e.productVariantId,
|
|
135
135
|
quantity: e.quantity
|
|
136
|
-
})), [
|
|
137
|
-
let t =
|
|
136
|
+
})), [V.lines]), gt = new Map(g.map((e) => [e.checkoutProductId?.trim() || e.id, e])), q = V.lines.flatMap((e) => {
|
|
137
|
+
let t = gt.get(e.checkoutProductId);
|
|
138
138
|
return t?.insurance?.enabled ? [{
|
|
139
139
|
quantity: e.quantity,
|
|
140
140
|
pricePerDayMinor: t.insurance.pricePerDayMinor,
|
|
141
141
|
deductibleAmountMinor: t.insurance.deductibleAmountMinor
|
|
142
142
|
}] : [];
|
|
143
|
-
}),
|
|
143
|
+
}), J = h.modules?.insurance?.enabled === !0 && q.length > 0, Y = J && I, _t = q.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), vt = q.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), yt = V.totalMinor ?? 0, X = k?.totalMinor ?? yt, Z = k?.insuranceSubtotalMinor ?? 0, bt = D?.discountAmountMinor ?? 0, Q = e(new URLSearchParams(), R).toString(), xt = `/${_ ?? ""}/booking${Q ? `?${Q}` : ""}`, St = `/${_ ?? ""}/checkout${Q ? `?${Q}` : ""}`, Ct = Ne({
|
|
144
144
|
resolver: Pe(we),
|
|
145
145
|
defaultValues: {
|
|
146
146
|
first_name: "",
|
|
@@ -151,121 +151,123 @@ function p() {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
s(() => {
|
|
154
|
-
i(
|
|
155
|
-
}, [
|
|
156
|
-
!
|
|
157
|
-
}, [
|
|
158
|
-
let
|
|
154
|
+
i(_, R);
|
|
155
|
+
}, [R, _]), s(() => {
|
|
156
|
+
!J && I && it(!1);
|
|
157
|
+
}, [I, J]);
|
|
158
|
+
let wt = (t) => {
|
|
159
159
|
let n = {
|
|
160
|
-
...
|
|
160
|
+
...R,
|
|
161
161
|
...t
|
|
162
|
-
}, r = e(
|
|
163
|
-
r.toString() !==
|
|
162
|
+
}, r = e(v, n);
|
|
163
|
+
r.toString() !== v.toString() && (ze(r, { replace: !0 }), i(_, r));
|
|
164
164
|
};
|
|
165
165
|
s(() => {
|
|
166
|
-
if (!
|
|
167
|
-
|
|
166
|
+
if (!_ || K.length === 0 || !z) {
|
|
167
|
+
O(null), A(null), M(!1), N(null), P(null);
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
let e =
|
|
171
|
-
return
|
|
170
|
+
let e = $e.trim(), t = e.length === 0 && !F, n = !1;
|
|
171
|
+
return M(!0), P(null), N(null), (async () => {
|
|
172
172
|
try {
|
|
173
173
|
let r = await o(ye, {
|
|
174
|
-
storeSlug:
|
|
175
|
-
schedule:
|
|
176
|
-
items:
|
|
174
|
+
storeSlug: _,
|
|
175
|
+
schedule: z,
|
|
176
|
+
items: K,
|
|
177
177
|
couponCode: e || void 0,
|
|
178
178
|
includeAutoApply: t,
|
|
179
|
-
insuranceAccepted:
|
|
179
|
+
insuranceAccepted: Y
|
|
180
180
|
}), i = be.parse(r);
|
|
181
181
|
if (n) return;
|
|
182
|
-
if (
|
|
182
|
+
if (A(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
|
|
183
183
|
subtotalMinor: i.subtotalMinor,
|
|
184
184
|
totalMinor: i.totalMinor,
|
|
185
185
|
lateReturnSurchargeMinor: i.lateReturnSurchargeMinor,
|
|
186
186
|
insuranceSubtotalMinor: i.insuranceSubtotalMinor,
|
|
187
187
|
insuranceBillableDays: i.insuranceBillableDays
|
|
188
188
|
} : null), !i.success) {
|
|
189
|
-
|
|
189
|
+
O(null), P(i.message || p("checkout_coupon_invalid"));
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
O(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (E(i.coupon.code), N(p("checkout_coupon_auto_applied", { code: i.coupon.code }))) : N(p("checkout_coupon_manual_applied")));
|
|
193
193
|
} catch (e) {
|
|
194
194
|
if (n) return;
|
|
195
|
-
console.error("Failed to verify checkout coupon", e),
|
|
195
|
+
console.error("Failed to verify checkout coupon", e), O(null), A(null), P(p("checkout_coupon_error"));
|
|
196
196
|
} finally {
|
|
197
|
-
n ||
|
|
197
|
+
n || M(!1);
|
|
198
198
|
}
|
|
199
199
|
})(), () => {
|
|
200
200
|
n = !0;
|
|
201
201
|
};
|
|
202
202
|
}, [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
203
|
+
F,
|
|
204
|
+
R.end_date,
|
|
205
|
+
R.end_time,
|
|
206
|
+
R.start_date,
|
|
207
|
+
R.start_time,
|
|
208
|
+
z,
|
|
209
|
+
K,
|
|
210
|
+
Y,
|
|
211
|
+
_,
|
|
212
|
+
$e,
|
|
213
213
|
p
|
|
214
214
|
]), s(() => {
|
|
215
|
-
if (!
|
|
216
|
-
|
|
215
|
+
if (!_ || V.lines.length === 0 || !z) {
|
|
216
|
+
S(null), T(null), C(!1);
|
|
217
217
|
return;
|
|
218
218
|
}
|
|
219
219
|
let e = !1;
|
|
220
|
-
return
|
|
220
|
+
return C(!0), T(null), (async () => {
|
|
221
221
|
try {
|
|
222
222
|
let t = await o(_e, {
|
|
223
|
-
storeSlug:
|
|
224
|
-
schedule:
|
|
225
|
-
estimatedTotalMinor:
|
|
223
|
+
storeSlug: _,
|
|
224
|
+
schedule: z,
|
|
225
|
+
estimatedTotalMinor: X,
|
|
226
|
+
insuranceAmountMinor: Z
|
|
226
227
|
}), n = ve.parse(t);
|
|
227
228
|
if (e) return;
|
|
228
229
|
if (!n.success || !n.decision) {
|
|
229
|
-
|
|
230
|
+
S(null), T(n.message || p("checkout_payment_error"));
|
|
230
231
|
return;
|
|
231
232
|
}
|
|
232
|
-
|
|
233
|
+
S(n.decision);
|
|
233
234
|
} catch (t) {
|
|
234
235
|
if (e) return;
|
|
235
|
-
console.error("Failed to load checkout payment decision", t),
|
|
236
|
+
console.error("Failed to load checkout payment decision", t), S(null), T(p("checkout_payment_error"));
|
|
236
237
|
} finally {
|
|
237
|
-
e ||
|
|
238
|
+
e || C(!1);
|
|
238
239
|
}
|
|
239
240
|
})(), () => {
|
|
240
241
|
e = !0;
|
|
241
242
|
};
|
|
242
243
|
}, [
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
R.end_date,
|
|
245
|
+
R.end_time,
|
|
246
|
+
R.start_date,
|
|
247
|
+
R.start_time,
|
|
248
|
+
z,
|
|
249
|
+
X,
|
|
250
|
+
V.lines.length,
|
|
251
|
+
Z,
|
|
252
|
+
_,
|
|
251
253
|
p
|
|
252
254
|
]);
|
|
253
|
-
let
|
|
254
|
-
if (!
|
|
255
|
-
|
|
256
|
-
let t =
|
|
255
|
+
let $ = x?.currency ?? "EUR", Tt = f(X, $, m.language), Et = Math.max(0, X - Z), Dt = Math.round(Et / 1.2), Ot = Dt + Z, kt = Math.max(0, Et - Dt), At = f(Ot, $, m.language), jt = f(kt, $, m.language), Mt = Ie(Fe, m.language), Nt = Z > 0 ? f(Z, $, m.language) : void 0, Pt = x?.amountToCollectMinor ?? 0, Ft = x?.shouldCollectOnlinePayment === !0 && Pt > 0, It = Ct.handleSubmit(async (e) => {
|
|
256
|
+
if (!_ || K.length === 0 || !z || b.current) return;
|
|
257
|
+
Ye(!0), b.current = !0;
|
|
258
|
+
let t = Ge();
|
|
257
259
|
try {
|
|
258
260
|
let n = await o(ie, {
|
|
259
|
-
storeSlug:
|
|
261
|
+
storeSlug: _,
|
|
260
262
|
checkoutSessionId: t.checkoutSessionId,
|
|
261
263
|
replacesCheckoutSessionId: t.replacesCheckoutSessionId,
|
|
262
|
-
schedule:
|
|
263
|
-
fulfillment:
|
|
264
|
-
startAddress:
|
|
265
|
-
endAddress:
|
|
266
|
-
couponCode:
|
|
267
|
-
couponAutoApplied: !
|
|
268
|
-
insuranceAccepted:
|
|
264
|
+
schedule: z,
|
|
265
|
+
fulfillment: R.fulfillment,
|
|
266
|
+
startAddress: R.fulfillment === "delivery" ? R.start_address : void 0,
|
|
267
|
+
endAddress: R.fulfillment === "delivery" ? R.end_address : void 0,
|
|
268
|
+
couponCode: D?.code,
|
|
269
|
+
couponAutoApplied: !F && D?.autoApplied,
|
|
270
|
+
insuranceAccepted: Y,
|
|
269
271
|
customer: {
|
|
270
272
|
firstName: e.first_name,
|
|
271
273
|
lastName: e.last_name,
|
|
@@ -273,20 +275,20 @@ function p() {
|
|
|
273
275
|
phone: e.phone,
|
|
274
276
|
notes: e.notes
|
|
275
277
|
},
|
|
276
|
-
items:
|
|
278
|
+
items: K
|
|
277
279
|
}), r = ae.parse(n);
|
|
278
280
|
if (!r.success || !r.checkout) {
|
|
279
|
-
|
|
281
|
+
qe(), a.error(r.message || p("checkout_payment_error"));
|
|
280
282
|
return;
|
|
281
283
|
}
|
|
282
|
-
r.checkout.requiresPayment ?
|
|
284
|
+
r.checkout.requiresPayment ? Ke(r.checkout.checkoutSessionId ?? t.checkoutSessionId) : a.success(p("checkout_success_toast")), await Be(r.checkout.nextPath), r.checkout.requiresPayment || Je();
|
|
283
285
|
} catch (e) {
|
|
284
286
|
console.error("Failed to submit storefront checkout", e), a.error(p("checkout_payment_error"));
|
|
285
287
|
} finally {
|
|
286
|
-
|
|
288
|
+
b.current = !1, Ye(!1);
|
|
287
289
|
}
|
|
288
|
-
}), Lt = p(Ft ? "checkout_continue_to_payment" : "checkout_submit"), Rt =
|
|
289
|
-
return
|
|
290
|
+
}), Lt = p(Ft ? "checkout_continue_to_payment" : "checkout_submit"), Rt = R.fulfillment === "delivery" && R.start_address.trim().length === 0, zt = !y && !Xe && !w && !j && !nt && !!x && !!z && !Rt && K.length > 0;
|
|
291
|
+
return V.lines.length === 0 ? /* @__PURE__ */ u("div", {
|
|
290
292
|
className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
|
|
291
293
|
children: /* @__PURE__ */ d("div", {
|
|
292
294
|
className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
|
|
@@ -302,7 +304,7 @@ function p() {
|
|
|
302
304
|
/* @__PURE__ */ u("div", {
|
|
303
305
|
className: "mt-6",
|
|
304
306
|
children: /* @__PURE__ */ u(Ee, {
|
|
305
|
-
to:
|
|
307
|
+
to: xt,
|
|
306
308
|
children: /* @__PURE__ */ d(de, {
|
|
307
309
|
className: "gap-2",
|
|
308
310
|
children: [/* @__PURE__ */ u(Me, {
|
|
@@ -316,9 +318,9 @@ function p() {
|
|
|
316
318
|
})
|
|
317
319
|
}) : /* @__PURE__ */ u(he, {
|
|
318
320
|
currentStep: "checkout",
|
|
319
|
-
bookingPath:
|
|
320
|
-
checkoutPath:
|
|
321
|
-
backPath:
|
|
321
|
+
bookingPath: xt,
|
|
322
|
+
checkoutPath: St,
|
|
323
|
+
backPath: xt,
|
|
322
324
|
backLabel: p("back_to_booking"),
|
|
323
325
|
children: /* @__PURE__ */ d("div", {
|
|
324
326
|
className: "grid gap-6 lg:grid-cols-12",
|
|
@@ -329,7 +331,7 @@ function p() {
|
|
|
329
331
|
className: "text-xl font-semibold tracking-tight text-slate-950",
|
|
330
332
|
children: /* @__PURE__ */ u("span", { children: p("checkout_title") })
|
|
331
333
|
}),
|
|
332
|
-
|
|
334
|
+
z ? null : /* @__PURE__ */ u("p", {
|
|
333
335
|
role: "alert",
|
|
334
336
|
className: "mt-3 text-sm text-destructive",
|
|
335
337
|
children: /* @__PURE__ */ u("span", { children: p("booking_time_slots_required") })
|
|
@@ -337,33 +339,33 @@ function p() {
|
|
|
337
339
|
/* @__PURE__ */ d("div", {
|
|
338
340
|
className: "mt-5 grid gap-4",
|
|
339
341
|
children: [
|
|
340
|
-
|
|
342
|
+
ct ? /* @__PURE__ */ u("div", {
|
|
341
343
|
className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
|
|
342
344
|
children: /* @__PURE__ */ u(me, {
|
|
343
|
-
value:
|
|
344
|
-
onValueChange: (e) =>
|
|
345
|
-
pickupAddress:
|
|
346
|
-
deliveryEnabled:
|
|
347
|
-
deliveryDisabledReason:
|
|
348
|
-
startAddress:
|
|
349
|
-
onStartAddressChange: (e) =>
|
|
350
|
-
endAddress:
|
|
351
|
-
onEndAddressChange: (e) =>
|
|
345
|
+
value: R.fulfillment,
|
|
346
|
+
onValueChange: (e) => wt({ fulfillment: e }),
|
|
347
|
+
pickupAddress: lt,
|
|
348
|
+
deliveryEnabled: L,
|
|
349
|
+
deliveryDisabledReason: st,
|
|
350
|
+
startAddress: R.start_address,
|
|
351
|
+
onStartAddressChange: (e) => wt({ start_address: e }),
|
|
352
|
+
endAddress: R.end_address,
|
|
353
|
+
onEndAddressChange: (e) => wt({ end_address: e }),
|
|
352
354
|
showPickupAddressWhenPickupOnly: !1,
|
|
353
355
|
testIdPrefix: "storefront-checkout-fulfillment"
|
|
354
356
|
})
|
|
355
357
|
}) : null,
|
|
356
|
-
/* @__PURE__ */ u(xe, { form:
|
|
357
|
-
|
|
358
|
-
accepted:
|
|
359
|
-
disabled:
|
|
360
|
-
dailyAmountLabel: f(
|
|
358
|
+
/* @__PURE__ */ u(xe, { form: Ct }),
|
|
359
|
+
J ? /* @__PURE__ */ u(Se, {
|
|
360
|
+
accepted: Y,
|
|
361
|
+
disabled: y || j,
|
|
362
|
+
dailyAmountLabel: f(_t, $, m.language),
|
|
361
363
|
totalAmountLabel: Nt,
|
|
362
|
-
billableDays:
|
|
363
|
-
deductibleLabel:
|
|
364
|
-
onAcceptedChange:
|
|
364
|
+
billableDays: k?.insuranceBillableDays,
|
|
365
|
+
deductibleLabel: vt > 0 ? f(vt, $, m.language) : void 0,
|
|
366
|
+
onAcceptedChange: it
|
|
365
367
|
}) : null,
|
|
366
|
-
|
|
368
|
+
Xe ? /* @__PURE__ */ d("div", {
|
|
367
369
|
className: "flex items-center gap-2 text-sm text-slate-600",
|
|
368
370
|
role: "status",
|
|
369
371
|
children: [/* @__PURE__ */ u(ge, {
|
|
@@ -371,13 +373,13 @@ function p() {
|
|
|
371
373
|
"aria-hidden": "true"
|
|
372
374
|
}), /* @__PURE__ */ u("span", { children: p("checkout_payment_loading") })]
|
|
373
375
|
}) : null,
|
|
374
|
-
|
|
376
|
+
w ? /* @__PURE__ */ d("div", {
|
|
375
377
|
className: "flex items-start gap-2 rounded-md bg-destructive p-3 text-sm text-destructive-foreground shadow-sm",
|
|
376
378
|
role: "alert",
|
|
377
379
|
children: [/* @__PURE__ */ u(je, {
|
|
378
380
|
className: "mt-0.5 h-4 w-4",
|
|
379
381
|
"aria-hidden": "true"
|
|
380
|
-
}), /* @__PURE__ */ u("span", { children:
|
|
382
|
+
}), /* @__PURE__ */ u("span", { children: w })]
|
|
381
383
|
}) : null,
|
|
382
384
|
/* @__PURE__ */ u(de, {
|
|
383
385
|
type: "button",
|
|
@@ -397,31 +399,31 @@ function p() {
|
|
|
397
399
|
})
|
|
398
400
|
]
|
|
399
401
|
}), /* @__PURE__ */ u(Ce, {
|
|
400
|
-
lines:
|
|
401
|
-
itemCount:
|
|
402
|
-
baseUnitLabel:
|
|
402
|
+
lines: ht.lines,
|
|
403
|
+
itemCount: He,
|
|
404
|
+
baseUnitLabel: dt,
|
|
403
405
|
bookingSubtotalLabel: At,
|
|
404
406
|
vatAmountLabel: jt,
|
|
405
407
|
vatRateLabel: Mt,
|
|
406
408
|
bookingTotalLabel: Tt,
|
|
407
|
-
onQuantityChange:
|
|
408
|
-
onRemove:
|
|
409
|
+
onQuantityChange: Ue,
|
|
410
|
+
onRemove: We,
|
|
409
411
|
coupon: {
|
|
410
|
-
code:
|
|
411
|
-
appliedCode:
|
|
412
|
-
discountLabel:
|
|
413
|
-
message:
|
|
414
|
-
error:
|
|
415
|
-
loading:
|
|
416
|
-
disabled:
|
|
412
|
+
code: Qe,
|
|
413
|
+
appliedCode: D?.code,
|
|
414
|
+
discountLabel: D && bt > 0 ? f(bt, $, m.language) : null,
|
|
415
|
+
message: tt,
|
|
416
|
+
error: nt,
|
|
417
|
+
loading: j,
|
|
418
|
+
disabled: y,
|
|
417
419
|
onCodeChange: (e) => {
|
|
418
|
-
|
|
420
|
+
E(e), P(null), N(null);
|
|
419
421
|
},
|
|
420
422
|
onApply: () => {
|
|
421
|
-
|
|
423
|
+
rt(!1), et(Qe.trim());
|
|
422
424
|
},
|
|
423
425
|
onRemove: () => {
|
|
424
|
-
|
|
426
|
+
E(""), et(""), O(null), A(null), P(null), N(null), rt(!0);
|
|
425
427
|
}
|
|
426
428
|
}
|
|
427
429
|
})]
|