@loczer/storefront-sdk 0.187.0 → 0.189.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/chunks/booking-engine/dist/models/{Product.shared-CTuk4fiR.js → Product.shared-IYOeC3N7.js} +12 -10
- package/dist/chunks/booking-engine/dist/schemas/{base-asset-B_Dm8_Vk.js → base-asset-zsUj5_3O.js} +1 -1
- package/dist/chunks/booking-engine/dist/schemas/{base-booking-DW8AEPKo.js → base-booking-TzCge_mR.js} +2 -2
- package/dist/chunks/booking-engine/dist/schemas/{base-product-1H8l2aUv.js → base-product-DvFFzAcg.js} +1 -1
- package/dist/chunks/booking-engine/dist/schemas/{booking-engine-configuration-D02MRF9U.js → booking-engine-configuration-LnrhShqm.js} +4 -1
- package/dist/chunks/booking-engine/dist/schemas/{cart-inputs-j1yWfJxO.js → cart-inputs-B0HpcFe5.js} +1 -1
- package/dist/chunks/booking-engine/dist/schemas/{public-booking-engine-configuration-BnJ_H-p1.js → public-booking-engine-configuration-CEM9mexX.js} +1 -1
- package/dist/chunks/booking-engine/dist/schemas-BNUzqsci.js +13 -0
- package/dist/chunks/ui/dist/Map/{MapContent-QPkuTBvK.js → MapContent-PK-ptOx6.js} +126 -94
- package/dist/chunks/ui/dist/Map/mapboxError-oRn0l3EE.js +25 -0
- package/dist/chunks/ui/dist/{Map-BXmRf5Ep.js → Map-BwXj49kV.js} +1 -1
- package/dist/components/BookingBikeVariantDialog/index.d.ts +2 -1
- package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
- package/dist/components/BookingBikeVariantDialog/index.js +39 -38
- package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingEndTimeField.js +32 -30
- package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingMobileDateDrawer.js +127 -122
- package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/components/BookingStartTimeField.js +32 -30
- package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts +7 -0
- package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.d.ts.map +1 -0
- package/dist/components/BookingPeriodSelector/components/BookingTimeSlotsStatus.js +29 -0
- package/dist/components/BookingPeriodSelector/index.d.ts +2 -1
- package/dist/components/BookingPeriodSelector/index.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/index.js +15 -14
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts +11 -0
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.d.ts.map +1 -1
- package/dist/components/BookingPeriodSelector/useBookingPeriodController.js +280 -216
- package/dist/components/ContactSection/index.d.ts.map +1 -1
- package/dist/components/ContactSection/index.js +120 -116
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +35 -35
- package/dist/components/Map/index.js +1 -1
- package/dist/components/StorefrontCancellationPolicyNotice/index.d.ts.map +1 -1
- package/dist/components/StorefrontCancellationPolicyNotice/index.js +51 -48
- package/dist/components/StorefrontInsuranceNotice/index.d.ts +9 -0
- package/dist/components/StorefrontInsuranceNotice/index.d.ts.map +1 -0
- package/dist/components/StorefrontInsuranceNotice/index.js +191 -0
- package/dist/i18n/en.d.ts +24 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +26 -2
- package/dist/i18n/fr.d.ts +24 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +26 -2
- package/dist/index.d.ts +91 -0
- package/dist/index.js +69 -68
- package/dist/lib/booking.js +2 -2
- package/dist/lib/checkoutSubmit.js +3 -3
- package/dist/lib/fetchStorefrontTimeSlots.d.ts.map +1 -1
- package/dist/lib/fetchStorefrontTimeSlots.js +2 -1
- package/dist/lib/storefrontProducts.d.ts +16 -0
- package/dist/lib/storefrontProducts.d.ts.map +1 -1
- package/dist/lib/storefrontProducts.js +27 -22
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +109 -95
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +229 -231
- package/dist/pages/HomePage.d.ts.map +1 -1
- package/dist/pages/HomePage.js +339 -314
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +60 -52
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/booking-engine/dist/schemas-DftrSnTE.js +0 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { applyBookingParamsToSearch as e, getBookingDurationLabel as t, getBookingDurationMinutes as n, getBookingParamsFromSearch as r, resolveBookingSearchParamsFromSessionStorage as i, writeBookingSearchParamsToSessionStorage as
|
|
2
|
-
import { useStorefrontCart as
|
|
3
|
-
import { buildStorefrontCartSummary as
|
|
4
|
-
import { ROUTE as
|
|
5
|
-
import { ROUTE as
|
|
6
|
-
import { ROUTE as
|
|
7
|
-
import { Button as
|
|
1
|
+
import { applyBookingParamsToSearch as e, getBookingDurationLabel as t, getBookingDurationMinutes as n, getBookingParamsFromSearch as r, resolveBookingSearchParamsFromSessionStorage as i, writeBookingSearchParamsToSessionStorage as a } from "../lib/booking.js";
|
|
2
|
+
import { useStorefrontCart as ee } from "../lib/cart.js";
|
|
3
|
+
import { buildStorefrontCartSummary as te } from "../lib/cartSummary.js";
|
|
4
|
+
import { ROUTE as ne, responseSchema as re } from "../lib/checkoutPaymentDecision.js";
|
|
5
|
+
import { ROUTE as ie, responseSchema as ae } from "../lib/checkoutSubmit.js";
|
|
6
|
+
import { ROUTE as oe, buildStorefrontAvailabilityKey as se, getStorefrontAvailabilityIssue as ce, getValidStorefrontAvailabilitySchedule as le, responseSchema as ue } from "../lib/storefrontAvailability.js";
|
|
7
|
+
import { Button as de } from "../ui/button.js";
|
|
8
8
|
import { BookingFlowSteps as fe } from "../components/BookingFlowSteps/index.js";
|
|
9
9
|
import { useStorefront as pe, useStorefrontProducts as me } from "../StorefrontProvider.js";
|
|
10
10
|
import { apiPost as o } from "../lib/apiCall.js";
|
|
@@ -55,90 +55,93 @@ var Ae = .2, je = (e) => e <= 0 ? 1 : Math.max(1, Math.ceil(e / 1440)), p = (e,
|
|
|
55
55
|
return new Intl.DateTimeFormat(t, r).format(e);
|
|
56
56
|
};
|
|
57
57
|
function m() {
|
|
58
|
-
let { t: m, i18n: h } = Ee(), { storefrontConfiguration: g } = pe(),
|
|
59
|
-
let e = r(
|
|
60
|
-
|
|
58
|
+
let { t: m, i18n: h } = Ee(), { storefrontConfiguration: g } = pe(), Pe = g.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = me(), { storeSlug: _ } = we(), [v, Le] = Te(), Re = Ce(), { items: ze, itemCount: Be, setQuantity: Ve, removeItem: He, clear: Ue } = ee(), [y, We] = l(!1), [b, x] = l(null), [Ge, S] = l(!1), [Ke, C] = l(null), qe = v.get("coupon") ?? v.get("code") ?? "", [Je, w] = l(qe), [Ye, Xe] = l(qe.trim()), [T, E] = l(null), [Ze, D] = l(null), [Qe, O] = l(!1), [$e, k] = l(null), [et, A] = l(null), [j, tt] = l(!1), M = c(() => i(v, _), [v, _]), N = g.settings.fulfillmentModes.includes("delivery"), P = g.settings.deliveryDisabledReason.trim(), nt = N || P.length > 0, rt = g.shop.address?.trim() ?? "", F = c(() => {
|
|
59
|
+
let e = r(M, {
|
|
60
|
+
start_time: "",
|
|
61
|
+
end_time: ""
|
|
62
|
+
});
|
|
63
|
+
return e.fulfillment === "delivery" && !N ? {
|
|
61
64
|
...e,
|
|
62
65
|
fulfillment: "pickup"
|
|
63
66
|
} : e;
|
|
64
|
-
}, [
|
|
65
|
-
items:
|
|
67
|
+
}, [M, N]), I = c(() => le(F), [F]), it = c(() => t(F), [F]), at = c(() => n(F), [F]), ot = c(() => je(at), [at]), L = c(() => te({
|
|
68
|
+
items: ze,
|
|
66
69
|
language: h.language,
|
|
67
|
-
fallbackLanguage:
|
|
70
|
+
fallbackLanguage: Pe,
|
|
68
71
|
products: {
|
|
69
|
-
bikes:
|
|
70
|
-
accessories:
|
|
72
|
+
bikes: Fe,
|
|
73
|
+
accessories: Ie
|
|
71
74
|
},
|
|
72
|
-
estimatedDays:
|
|
75
|
+
estimatedDays: ot
|
|
73
76
|
}), [
|
|
74
|
-
y,
|
|
75
|
-
v,
|
|
76
|
-
it,
|
|
77
|
-
h.language,
|
|
78
77
|
Ie,
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
Fe,
|
|
79
|
+
ot,
|
|
80
|
+
h.language,
|
|
81
|
+
ze,
|
|
82
|
+
Pe
|
|
83
|
+
]), R = c(() => L.lines.map((e) => ({
|
|
81
84
|
productId: e.checkoutProductId,
|
|
82
85
|
productVariantId: e.productVariantId,
|
|
83
86
|
quantity: e.quantity
|
|
84
|
-
})), [
|
|
87
|
+
})), [L.lines]), [st, z] = l([]), [B, V] = l(!1);
|
|
85
88
|
s(() => {
|
|
86
|
-
if (!
|
|
87
|
-
|
|
89
|
+
if (!_ || R.length === 0) {
|
|
90
|
+
z([]), V(!1);
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
H(!1);
|
|
93
|
+
if (!I) {
|
|
94
|
+
z([]), V(!1);
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
95
|
-
let
|
|
96
|
-
return
|
|
97
|
+
let e = !1;
|
|
98
|
+
return V(!0), z([]), (async () => {
|
|
97
99
|
try {
|
|
98
|
-
let
|
|
99
|
-
storeSlug:
|
|
100
|
-
schedule:
|
|
101
|
-
products:
|
|
102
|
-
}),
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
} catch (
|
|
106
|
-
if (
|
|
107
|
-
console.error("Failed to load checkout cart availability",
|
|
100
|
+
let t = await o(oe, {
|
|
101
|
+
storeSlug: _,
|
|
102
|
+
schedule: I,
|
|
103
|
+
products: R
|
|
104
|
+
}), n = ue.parse(t);
|
|
105
|
+
if (e) return;
|
|
106
|
+
z(n.success ? n.availability ?? [] : []);
|
|
107
|
+
} catch (t) {
|
|
108
|
+
if (e) return;
|
|
109
|
+
console.error("Failed to load checkout cart availability", t), z([]);
|
|
108
110
|
} finally {
|
|
109
|
-
|
|
111
|
+
e || V(!1);
|
|
110
112
|
}
|
|
111
113
|
})(), () => {
|
|
112
|
-
|
|
114
|
+
e = !0;
|
|
113
115
|
};
|
|
114
116
|
}, [
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
F.end_date,
|
|
118
|
+
F.end_time,
|
|
119
|
+
F.start_date,
|
|
120
|
+
F.start_time,
|
|
121
|
+
I,
|
|
122
|
+
R,
|
|
123
|
+
_
|
|
121
124
|
]);
|
|
122
|
-
let
|
|
123
|
-
...
|
|
124
|
-
lines:
|
|
125
|
-
let t =
|
|
125
|
+
let ct = c(() => new Map(st.map((e) => [se(e.productId, e.productVariantId), e])), [st]), H = c(() => ({
|
|
126
|
+
...L,
|
|
127
|
+
lines: L.lines.map((e) => {
|
|
128
|
+
let t = ct.get(se(e.checkoutProductId, e.productVariantId)), n = t ? ce(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
126
129
|
return {
|
|
127
130
|
...e,
|
|
128
|
-
insufficientCapacity: !
|
|
129
|
-
availabilityIssue:
|
|
131
|
+
insufficientCapacity: !B && n !== void 0,
|
|
132
|
+
availabilityIssue: B ? void 0 : n
|
|
130
133
|
};
|
|
131
134
|
})
|
|
132
135
|
}), [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
]),
|
|
136
|
+
ct,
|
|
137
|
+
B,
|
|
138
|
+
L
|
|
139
|
+
]), U = c(() => L.lines.map((e) => ({
|
|
137
140
|
kind: e.kind,
|
|
138
141
|
productId: e.checkoutProductId,
|
|
139
142
|
productVariantId: e.productVariantId,
|
|
140
143
|
quantity: e.quantity
|
|
141
|
-
})), [
|
|
144
|
+
})), [L.lines]), lt = L.estimatedTotalMinor ?? L.totalPerDayMinor, W = Ze?.totalMinor ?? lt, G = T?.discountAmountMinor ?? 0, K = e(new URLSearchParams(), F).toString(), q = `/${_ ?? ""}/booking${K ? `?${K}` : ""}`, ut = `/${_ ?? ""}/checkout${K ? `?${K}` : ""}`, dt = Oe({
|
|
142
145
|
resolver: ke(xe),
|
|
143
146
|
defaultValues: {
|
|
144
147
|
full_name: "",
|
|
@@ -148,162 +151,149 @@ function m() {
|
|
|
148
151
|
}
|
|
149
152
|
});
|
|
150
153
|
s(() => {
|
|
151
|
-
|
|
152
|
-
}, [
|
|
153
|
-
let
|
|
154
|
+
a(_, F);
|
|
155
|
+
}, [F, _]);
|
|
156
|
+
let J = (t) => {
|
|
154
157
|
let n = {
|
|
155
|
-
...
|
|
158
|
+
...F,
|
|
156
159
|
...t
|
|
157
|
-
}, r = e(
|
|
158
|
-
|
|
160
|
+
}, r = e(v, n);
|
|
161
|
+
Le(r, { replace: !0 }), a(_, r);
|
|
159
162
|
};
|
|
160
163
|
s(() => {
|
|
161
|
-
if (!
|
|
162
|
-
|
|
164
|
+
if (!_ || U.length === 0 || !I) {
|
|
165
|
+
E(null), D(null), O(!1), k(null), A(null);
|
|
163
166
|
return;
|
|
164
167
|
}
|
|
165
|
-
let e =
|
|
166
|
-
return
|
|
168
|
+
let e = Ye.trim(), t = e.length === 0 && !j, n = !1;
|
|
169
|
+
return O(!0), A(null), k(null), (async () => {
|
|
167
170
|
try {
|
|
168
171
|
let r = await o(ge, {
|
|
169
|
-
storeSlug:
|
|
170
|
-
schedule:
|
|
171
|
-
|
|
172
|
-
endDate: L.end_date,
|
|
173
|
-
startTime: L.start_time,
|
|
174
|
-
endTime: L.end_time
|
|
175
|
-
},
|
|
176
|
-
items: W,
|
|
172
|
+
storeSlug: _,
|
|
173
|
+
schedule: I,
|
|
174
|
+
items: U,
|
|
177
175
|
couponCode: e || void 0,
|
|
178
176
|
includeAutoApply: t
|
|
179
177
|
}), i = _e.parse(r);
|
|
180
178
|
if (n) return;
|
|
181
|
-
if (
|
|
179
|
+
if (D(typeof i.subtotalMinor == "number" && typeof i.totalMinor == "number" ? {
|
|
182
180
|
subtotalMinor: i.subtotalMinor,
|
|
183
181
|
totalMinor: i.totalMinor,
|
|
184
182
|
lateReturnSurchargeMinor: i.lateReturnSurchargeMinor
|
|
185
183
|
} : null), !i.success) {
|
|
186
|
-
|
|
184
|
+
E(null), A(i.message || m("checkout_coupon_invalid"));
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
|
-
|
|
187
|
+
E(i.coupon ?? null), i.coupon && (i.coupon.autoApplied && e.length === 0 ? (w(i.coupon.code), k(m("checkout_coupon_auto_applied", { code: i.coupon.code }))) : k(m("checkout_coupon_manual_applied")));
|
|
190
188
|
} catch (e) {
|
|
191
189
|
if (n) return;
|
|
192
|
-
console.error("Failed to verify checkout coupon", e),
|
|
190
|
+
console.error("Failed to verify checkout coupon", e), E(null), D(null), A(m("checkout_coupon_error"));
|
|
193
191
|
} finally {
|
|
194
|
-
n ||
|
|
192
|
+
n || O(!1);
|
|
195
193
|
}
|
|
196
194
|
})(), () => {
|
|
197
195
|
n = !0;
|
|
198
196
|
};
|
|
199
197
|
}, [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
198
|
+
j,
|
|
199
|
+
F.end_date,
|
|
200
|
+
F.end_time,
|
|
201
|
+
F.start_date,
|
|
202
|
+
F.start_time,
|
|
203
|
+
I,
|
|
204
|
+
U,
|
|
205
|
+
_,
|
|
206
|
+
Ye,
|
|
208
207
|
m
|
|
209
208
|
]), s(() => {
|
|
210
|
-
if (!
|
|
211
|
-
|
|
209
|
+
if (!_ || L.lines.length === 0 || !I) {
|
|
210
|
+
x(null), C(null), S(!1);
|
|
212
211
|
return;
|
|
213
212
|
}
|
|
214
213
|
let e = !1;
|
|
215
|
-
return
|
|
214
|
+
return S(!0), C(null), (async () => {
|
|
216
215
|
try {
|
|
217
|
-
let t = await o(
|
|
218
|
-
storeSlug:
|
|
219
|
-
schedule:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
startTime: L.start_time,
|
|
223
|
-
endTime: L.end_time
|
|
224
|
-
},
|
|
225
|
-
estimatedTotalMinor: G
|
|
226
|
-
}), n = ie.parse(t);
|
|
216
|
+
let t = await o(ne, {
|
|
217
|
+
storeSlug: _,
|
|
218
|
+
schedule: I,
|
|
219
|
+
estimatedTotalMinor: W
|
|
220
|
+
}), n = re.parse(t);
|
|
227
221
|
if (e) return;
|
|
228
222
|
if (!n.success || !n.decision) {
|
|
229
|
-
|
|
223
|
+
x(null), C(n.errorCode === "online_payment_provider_missing" ? m("checkout_payment_error") : n.message || m("checkout_payment_error"));
|
|
230
224
|
return;
|
|
231
225
|
}
|
|
232
|
-
|
|
226
|
+
x(n.decision);
|
|
233
227
|
} catch (t) {
|
|
234
228
|
if (e) return;
|
|
235
|
-
console.error("Failed to load checkout payment decision", t),
|
|
229
|
+
console.error("Failed to load checkout payment decision", t), x(null), C(m("checkout_payment_error"));
|
|
236
230
|
} finally {
|
|
237
|
-
e ||
|
|
231
|
+
e || S(!1);
|
|
238
232
|
}
|
|
239
233
|
})(), () => {
|
|
240
234
|
e = !0;
|
|
241
235
|
};
|
|
242
236
|
}, [
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
237
|
+
F.end_date,
|
|
238
|
+
F.end_time,
|
|
239
|
+
F.start_date,
|
|
240
|
+
F.start_time,
|
|
241
|
+
I,
|
|
242
|
+
W,
|
|
243
|
+
L.lines.length,
|
|
244
|
+
_,
|
|
250
245
|
m
|
|
251
246
|
]);
|
|
252
|
-
let
|
|
253
|
-
if (!
|
|
254
|
-
let e = new Date(
|
|
255
|
-
return Number.isNaN(e.getTime()) ? null : Ne(e, h.language,
|
|
247
|
+
let Y = b?.currency ?? "EUR", ft = p(W, Y, h.language), pt = G > 0 ? `-${p(G, Y, h.language)}` : null, mt = Math.round(W / 1.2), ht = Math.max(0, W - mt), gt = p(mt, Y, h.language), _t = p(ht, Y, h.language), vt = Me(Ae, h.language), X = b?.amountToCollectMinor ?? 0, yt = p(X, Y, h.language), bt = b?.paymentMode === "deposit" && X > 0 ? p(X, Y, h.language) : null, xt = b?.shouldCollectOnlinePayment === !0 && X > 0, Z = g.shop.timeZone?.trim() || void 0, Q = c(() => b ? Me(Math.max(0, Math.min(1, b.bookingDepositPercentage)), h.language) : null, [h.language, b]), $ = c(() => {
|
|
248
|
+
if (!b?.depositRefundableUntilIso) return null;
|
|
249
|
+
let e = new Date(b.depositRefundableUntilIso);
|
|
250
|
+
return Number.isNaN(e.getTime()) ? null : Ne(e, h.language, Z);
|
|
256
251
|
}, [
|
|
257
252
|
h.language,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
]),
|
|
253
|
+
b?.depositRefundableUntilIso,
|
|
254
|
+
Z
|
|
255
|
+
]), St = c(() => b ? b.paymentMode === "deposit" && X > 0 && Q ? $ ? m("checkout_payment_due_now_helper_deposit_refundable_until", {
|
|
261
256
|
percent: Q,
|
|
262
257
|
date: $
|
|
263
|
-
}) : m("checkout_payment_due_now_helper_deposit", { percent: Q }) :
|
|
264
|
-
|
|
258
|
+
}) : m("checkout_payment_due_now_helper_deposit", { percent: Q }) : b.paymentMode === "none" || X <= 0 ? m("checkout_payment_due_now_helper_none") : null : null, [
|
|
259
|
+
X,
|
|
265
260
|
Q,
|
|
266
261
|
$,
|
|
267
|
-
|
|
262
|
+
b,
|
|
268
263
|
m
|
|
269
|
-
]),
|
|
270
|
-
if (!(!
|
|
271
|
-
|
|
264
|
+
]), Ct = dt.handleSubmit(async (e) => {
|
|
265
|
+
if (!(!_ || U.length === 0 || !I)) {
|
|
266
|
+
We(!0);
|
|
272
267
|
try {
|
|
273
|
-
let t = await o(
|
|
274
|
-
storeSlug:
|
|
275
|
-
schedule:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
fulfillment: L.fulfillment,
|
|
282
|
-
startAddress: L.fulfillment === "delivery" ? L.start_address : void 0,
|
|
283
|
-
endAddress: L.fulfillment === "delivery" ? L.end_address : void 0,
|
|
284
|
-
couponCode: k?.code,
|
|
285
|
-
couponAutoApplied: !F && k?.autoApplied,
|
|
268
|
+
let t = await o(ie, {
|
|
269
|
+
storeSlug: _,
|
|
270
|
+
schedule: I,
|
|
271
|
+
fulfillment: F.fulfillment,
|
|
272
|
+
startAddress: F.fulfillment === "delivery" ? F.start_address : void 0,
|
|
273
|
+
endAddress: F.fulfillment === "delivery" ? F.end_address : void 0,
|
|
274
|
+
couponCode: T?.code,
|
|
275
|
+
couponAutoApplied: !j && T?.autoApplied,
|
|
286
276
|
customer: {
|
|
287
277
|
fullName: e.full_name,
|
|
288
278
|
email: e.email,
|
|
289
279
|
phone: e.phone,
|
|
290
280
|
notes: e.notes
|
|
291
281
|
},
|
|
292
|
-
items:
|
|
293
|
-
}), n =
|
|
282
|
+
items: U
|
|
283
|
+
}), n = ae.parse(t);
|
|
294
284
|
if (!n.success || !n.checkout) {
|
|
295
285
|
f.error(n.errorCode === "online_payment_provider_missing" ? m("checkout_payment_error") : n.message || m("checkout_payment_error"));
|
|
296
286
|
return;
|
|
297
287
|
}
|
|
298
|
-
n.checkout.requiresPayment || f.success(m("checkout_success_toast")), await
|
|
288
|
+
n.checkout.requiresPayment || f.success(m("checkout_success_toast")), await Re(n.checkout.nextPath), Ue();
|
|
299
289
|
} catch (e) {
|
|
300
290
|
console.error("Failed to submit storefront checkout", e), f.error(m("checkout_payment_error"));
|
|
301
291
|
} finally {
|
|
302
|
-
|
|
292
|
+
We(!1);
|
|
303
293
|
}
|
|
304
294
|
}
|
|
305
|
-
}),
|
|
306
|
-
return
|
|
295
|
+
}), wt = m(xt ? "checkout_continue_to_payment" : "checkout_submit"), Tt = F.fulfillment === "delivery" && F.start_address.trim().length === 0, Et = !y && !Ge && !Ke && !Qe && !et && !!b && !!I && !Tt && U.length > 0;
|
|
296
|
+
return L.lines.length === 0 ? /* @__PURE__ */ u("div", {
|
|
307
297
|
className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
|
|
308
298
|
children: /* @__PURE__ */ d("div", {
|
|
309
299
|
className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
|
|
@@ -319,8 +309,8 @@ function m() {
|
|
|
319
309
|
/* @__PURE__ */ u("div", {
|
|
320
310
|
className: "mt-6",
|
|
321
311
|
children: /* @__PURE__ */ u(Se, {
|
|
322
|
-
to:
|
|
323
|
-
children: /* @__PURE__ */ d(
|
|
312
|
+
to: q,
|
|
313
|
+
children: /* @__PURE__ */ d(de, {
|
|
324
314
|
className: "gap-2",
|
|
325
315
|
children: [/* @__PURE__ */ u(De, {
|
|
326
316
|
className: "h-4 w-4",
|
|
@@ -338,11 +328,11 @@ function m() {
|
|
|
338
328
|
children: [
|
|
339
329
|
/* @__PURE__ */ u(fe, {
|
|
340
330
|
currentStep: "checkout",
|
|
341
|
-
bookingPath:
|
|
342
|
-
checkoutPath:
|
|
331
|
+
bookingPath: q,
|
|
332
|
+
checkoutPath: ut
|
|
343
333
|
}),
|
|
344
334
|
/* @__PURE__ */ d(Se, {
|
|
345
|
-
to:
|
|
335
|
+
to: q,
|
|
346
336
|
className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
|
|
347
337
|
children: [/* @__PURE__ */ u(De, {
|
|
348
338
|
className: "h-4 w-4",
|
|
@@ -353,93 +343,101 @@ function m() {
|
|
|
353
343
|
className: "grid gap-6 lg:grid-cols-12",
|
|
354
344
|
children: [/* @__PURE__ */ d("div", {
|
|
355
345
|
className: "lg:col-span-7",
|
|
356
|
-
children: [
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
346
|
+
children: [
|
|
347
|
+
/* @__PURE__ */ u("h1", {
|
|
348
|
+
className: "text-xl font-semibold tracking-tight text-slate-950",
|
|
349
|
+
children: /* @__PURE__ */ u("span", { children: m("checkout_title") })
|
|
350
|
+
}),
|
|
351
|
+
I ? null : /* @__PURE__ */ u("p", {
|
|
352
|
+
role: "alert",
|
|
353
|
+
className: "mt-3 text-sm text-destructive",
|
|
354
|
+
children: /* @__PURE__ */ u("span", { children: m("booking_time_slots_required") })
|
|
355
|
+
}),
|
|
356
|
+
/* @__PURE__ */ d("div", {
|
|
357
|
+
className: "mt-5 grid gap-4",
|
|
358
|
+
children: [
|
|
359
|
+
nt ? /* @__PURE__ */ u("div", {
|
|
360
|
+
className: "rounded-xl border border-slate-200 bg-white p-3 shadow-sm",
|
|
361
|
+
children: /* @__PURE__ */ u(he, {
|
|
362
|
+
value: F.fulfillment,
|
|
363
|
+
onValueChange: (e) => J({ fulfillment: e }),
|
|
364
|
+
pickupAddress: rt,
|
|
365
|
+
deliveryEnabled: N,
|
|
366
|
+
deliveryDisabledReason: P,
|
|
367
|
+
startAddress: F.start_address,
|
|
368
|
+
onStartAddressChange: (e) => J({ start_address: e }),
|
|
369
|
+
endAddress: F.end_address,
|
|
370
|
+
onEndAddressChange: (e) => J({ end_address: e }),
|
|
371
|
+
showPickupAddressWhenPickupOnly: !1,
|
|
372
|
+
testIdPrefix: "storefront-checkout-fulfillment"
|
|
373
|
+
})
|
|
374
|
+
}) : null,
|
|
375
|
+
/* @__PURE__ */ u(ve, { form: dt }),
|
|
376
|
+
/* @__PURE__ */ u(ye, {
|
|
377
|
+
estimatedTotalLabel: ft,
|
|
378
|
+
couponCode: T?.code,
|
|
379
|
+
discountAmountLabel: pt,
|
|
380
|
+
totalExcludingTaxLabel: gt,
|
|
381
|
+
vatAmountLabel: _t,
|
|
382
|
+
vatRateLabel: vt,
|
|
383
|
+
depositAmountLabel: bt,
|
|
384
|
+
amountToCollectMinor: X,
|
|
385
|
+
amountToCollectLabel: yt,
|
|
386
|
+
paymentSummaryHelper: St,
|
|
387
|
+
paymentDecisionLoading: Ge,
|
|
388
|
+
paymentDecisionError: Ke,
|
|
389
|
+
canChoosePaymentMethod: !1,
|
|
390
|
+
showAmountDueNowRow: !0,
|
|
391
|
+
selectedPaymentMethod: "card",
|
|
392
|
+
submitting: y,
|
|
393
|
+
onSelectPaymentMethod: () => {}
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ u(de, {
|
|
396
|
+
type: "button",
|
|
397
|
+
size: "lg",
|
|
398
|
+
onClick: () => {
|
|
399
|
+
Ct();
|
|
400
|
+
},
|
|
401
|
+
disabled: !Et,
|
|
402
|
+
className: "mt-4 w-fit",
|
|
403
|
+
children: /* @__PURE__ */ u("span", { children: wt })
|
|
404
|
+
}),
|
|
405
|
+
Tt ? /* @__PURE__ */ u("p", {
|
|
406
|
+
className: "text-sm text-slate-600",
|
|
407
|
+
children: /* @__PURE__ */ u("span", { children: m("checkout_delivery_address_required") })
|
|
408
|
+
}) : null
|
|
409
|
+
]
|
|
410
|
+
})
|
|
411
|
+
]
|
|
414
412
|
}), /* @__PURE__ */ u(be, {
|
|
415
|
-
lines:
|
|
416
|
-
itemCount:
|
|
417
|
-
totalPerDayMinor:
|
|
418
|
-
estimatedDays:
|
|
419
|
-
estimatedTotalMinor:
|
|
420
|
-
discountedEstimatedTotalMinor:
|
|
421
|
-
discountAmountMinor:
|
|
422
|
-
lateReturnSurchargeMinor:
|
|
423
|
-
couponCode:
|
|
424
|
-
durationLabel:
|
|
425
|
-
onQuantityChange:
|
|
426
|
-
onRemove:
|
|
413
|
+
lines: H.lines,
|
|
414
|
+
itemCount: Be,
|
|
415
|
+
totalPerDayMinor: H.totalPerDayMinor,
|
|
416
|
+
estimatedDays: H.estimatedDays,
|
|
417
|
+
estimatedTotalMinor: H.estimatedTotalMinor,
|
|
418
|
+
discountedEstimatedTotalMinor: W,
|
|
419
|
+
discountAmountMinor: G,
|
|
420
|
+
lateReturnSurchargeMinor: Ze?.lateReturnSurchargeMinor,
|
|
421
|
+
couponCode: T?.code,
|
|
422
|
+
durationLabel: it.label,
|
|
423
|
+
onQuantityChange: Ve,
|
|
424
|
+
onRemove: He,
|
|
427
425
|
coupon: {
|
|
428
|
-
code:
|
|
429
|
-
appliedCode:
|
|
430
|
-
discountLabel:
|
|
431
|
-
message:
|
|
432
|
-
error:
|
|
433
|
-
loading:
|
|
434
|
-
disabled:
|
|
426
|
+
code: Je,
|
|
427
|
+
appliedCode: T?.code,
|
|
428
|
+
discountLabel: T && G > 0 ? p(G, Y, h.language) : null,
|
|
429
|
+
message: $e,
|
|
430
|
+
error: et,
|
|
431
|
+
loading: Qe,
|
|
432
|
+
disabled: y,
|
|
435
433
|
onCodeChange: (e) => {
|
|
436
|
-
|
|
434
|
+
w(e), A(null), k(null);
|
|
437
435
|
},
|
|
438
436
|
onApply: () => {
|
|
439
|
-
|
|
437
|
+
tt(!1), Xe(Je.trim());
|
|
440
438
|
},
|
|
441
439
|
onRemove: () => {
|
|
442
|
-
|
|
440
|
+
w(""), Xe(""), E(null), D(null), A(null), k(null), tt(!0);
|
|
443
441
|
}
|
|
444
442
|
}
|
|
445
443
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../src/pages/HomePage.tsx"],"names":[],"mappings":"AA2IA,MAAM,CAAC,OAAO,UAAU,QAAQ,4CAstB/B"}
|