@loczer/storefront-sdk 0.221.0 → 0.222.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 +2 -2
- package/dist/StorefrontProvider.d.ts +2 -2
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +118 -126
- package/dist/components/LanguageSelector/index.d.ts +7 -0
- package/dist/components/LanguageSelector/index.d.ts.map +1 -0
- package/dist/components/LanguageSelector/index.js +69 -0
- package/dist/components/StorefrontCartPanel/index.d.ts +2 -8
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +65 -107
- package/dist/i18n/I18nProvider.d.ts +3 -2
- package/dist/i18n/I18nProvider.d.ts.map +1 -1
- package/dist/i18n/I18nProvider.js +61 -64
- package/dist/i18n/en.d.ts +2 -2
- package/dist/i18n/en.js +2 -2
- package/dist/i18n/fr.d.ts +2 -2
- package/dist/i18n/fr.js +2 -2
- package/dist/i18n/languages.d.ts +15 -0
- package/dist/i18n/languages.d.ts.map +1 -0
- package/dist/i18n/languages.js +26 -0
- package/dist/index.d.ts +33 -24
- package/dist/index.js +50 -49
- package/dist/lib/cartSummary.d.ts +2 -5
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +5 -11
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +150 -148
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +1 -2
- package/dist/pages/ContractSaleDocumentPage.d.ts +2 -3
- package/dist/pages/ContractSaleDocumentPage.d.ts.map +1 -1
- package/dist/pages/ContractSaleDocumentPage.js +18 -17
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +2 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +14 -15
- package/dist/storefront.css +1 -1
- package/dist/storefrontSchemas.d.ts +2 -2
- package/dist/storefrontSchemas.d.ts.map +1 -1
- package/dist/storefrontSchemas.js +95 -94
- package/package.json +1 -1
|
@@ -2,37 +2,37 @@ import { applyBookingParamsToSearch as e, createBookingPeriodConfigFromStorefron
|
|
|
2
2
|
import { getLocalizedValue as o } from "../localization.js";
|
|
3
3
|
import { getStorefrontCheckoutProductId as s, getStorefrontProductSelectionDisplayName as te } from "../lib/products.js";
|
|
4
4
|
import { useStorefrontCart as ne } from "../lib/cart.js";
|
|
5
|
-
import {
|
|
6
|
-
import { buildStorefrontCartSummary as
|
|
7
|
-
import { ROUTE as
|
|
8
|
-
import { Badge as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useStorefront as
|
|
11
|
-
import { toast as
|
|
12
|
-
import { BookingPeriodSelector as
|
|
5
|
+
import { calculateBookingRentalUnitSummary as re, getPricingUnitLabel as ie } from "../lib/pricing.js";
|
|
6
|
+
import { buildStorefrontCartSummary as ae } from "../lib/cartSummary.js";
|
|
7
|
+
import { ROUTE as oe, buildStorefrontAvailabilityKey as c, getStorefrontAvailabilityIssue as se, getStorefrontAvailabilityStatus as l, getValidStorefrontAvailabilitySchedule as u, isStorefrontAvailabilityInsufficient as ce, responseSchema as le } from "../lib/storefrontAvailability.js";
|
|
8
|
+
import { Badge as ue } from "../ui/badge.js";
|
|
9
|
+
import { Button as de } from "../ui/button.js";
|
|
10
|
+
import { useStorefront as fe, useStorefrontBookingProducts as pe, useStorefrontProducts as me } from "../StorefrontContext.js";
|
|
11
|
+
import { toast as he } from "../lib/toast.js";
|
|
12
|
+
import { BookingPeriodSelector as ge } from "../components/BookingPeriodSelector/index.js";
|
|
13
13
|
import { StepSectionTitle as d } from "../components/StepSectionTitle/index.js";
|
|
14
|
-
import { Card as
|
|
15
|
-
import { ProductWarningNotice as
|
|
16
|
-
import { StorefrontCartPanel as
|
|
17
|
-
import { ProductPriceBadge as
|
|
18
|
-
import { resolveProductImageContainerStyle as
|
|
19
|
-
import { apiPost as
|
|
20
|
-
import { createStorefrontTimeSlotsFetcher as
|
|
21
|
-
import { FulfillmentSection as
|
|
22
|
-
import { BookingFlowPageLayout as
|
|
23
|
-
import { BookingBikeQuickAddCard as
|
|
24
|
-
import { BookingBikeVariantDialog as
|
|
25
|
-
import { useEffect as f, useLayoutEffect as
|
|
26
|
-
import { Fragment as
|
|
27
|
-
import { Link as
|
|
28
|
-
import { useTranslation as
|
|
29
|
-
import { cn as
|
|
30
|
-
import { Bike as
|
|
14
|
+
import { Card as _e } from "../ui/card.js";
|
|
15
|
+
import { ProductWarningNotice as ve } from "../components/ProductWarningNotice/index.js";
|
|
16
|
+
import { StorefrontCartPanel as ye } from "../components/StorefrontCartPanel/index.js";
|
|
17
|
+
import { ProductPriceBadge as be } from "../components/ProductPriceBadge/index.js";
|
|
18
|
+
import { resolveProductImageContainerStyle as xe } from "../lib/productImageStyles.js";
|
|
19
|
+
import { apiPost as Se } from "../lib/apiCall.js";
|
|
20
|
+
import { createStorefrontTimeSlotsFetcher as Ce } from "../lib/fetchStorefrontTimeSlots.js";
|
|
21
|
+
import { FulfillmentSection as we } from "../components/FulfillmentSection/index.js";
|
|
22
|
+
import { BookingFlowPageLayout as Te } from "../components/BookingFlowPageLayout/index.js";
|
|
23
|
+
import { BookingBikeQuickAddCard as Ee } from "../components/BookingBikeQuickAddCard/index.js";
|
|
24
|
+
import { BookingBikeVariantDialog as De } from "../components/BookingBikeVariantDialog/index.js";
|
|
25
|
+
import { useEffect as f, useLayoutEffect as Oe, useMemo as p, useRef as m, useState as h } from "react";
|
|
26
|
+
import { Fragment as ke, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
27
|
+
import { Link as Ae, useLocation as je, useParams as Me, useSearchParams as Ne } from "@rpcbase/router";
|
|
28
|
+
import { useTranslation as Pe } from "react-i18next";
|
|
29
|
+
import { cn as Fe } from "@rpcbase/ui";
|
|
30
|
+
import { Bike as Ie, Plus as Le } from "lucide-react";
|
|
31
31
|
//#region src/pages/BookingPage.tsx
|
|
32
|
-
var v = (e) => String(e).padStart(2, "0"), y = "product_modal",
|
|
32
|
+
var v = (e) => String(e).padStart(2, "0"), y = "product_modal", Re = (e, t) => {
|
|
33
33
|
let n = t - e;
|
|
34
34
|
return e >= 0 && (n === 1 || n === 2) ? n : null;
|
|
35
|
-
},
|
|
35
|
+
}, ze = (e) => `${e.getFullYear()}-${v(e.getMonth() + 1)}-${v(e.getDate())}`, Be = (e) => {
|
|
36
36
|
if (!e) return;
|
|
37
37
|
let t = e.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
38
38
|
if (!t) return;
|
|
@@ -42,20 +42,20 @@ var v = (e) => String(e).padStart(2, "0"), y = "product_modal", Le = (e, t) => {
|
|
|
42
42
|
if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
|
|
43
43
|
let n = e.productVariants ?? [], r = n.find((e) => t(e.id))?.id ?? n[0]?.id;
|
|
44
44
|
return typeof r == "string" && r.trim().length > 0 ? r : null;
|
|
45
|
-
},
|
|
45
|
+
}, Ve = (e, t) => e.fulfillment === "delivery" && !t ? {
|
|
46
46
|
...e,
|
|
47
47
|
fulfillment: "pickup"
|
|
48
|
-
} : e,
|
|
48
|
+
} : e, He = (e, t) => {
|
|
49
49
|
let n = s(e), r = e.representedVariantId?.trim();
|
|
50
50
|
if (r) {
|
|
51
51
|
let e = t.get(c(n, r));
|
|
52
52
|
if (e) return e;
|
|
53
53
|
}
|
|
54
54
|
return t.get(c(n));
|
|
55
|
-
},
|
|
56
|
-
let r =
|
|
55
|
+
}, Ue = (e, t, n) => n.get(c(s(e), t)), We = (e, t, n) => {
|
|
56
|
+
let r = se(t);
|
|
57
57
|
return r === "quantity_unavailable" ? e("availability_quantity_unavailable") : r === "unavailable" || n === "OUT_OF_STOCK" ? e("availability_out_of_stock") : t?.remaining === void 0 ? t?.fewRemaining || n === "LOW_STOCK" ? e("availability_low_stock") : e("availability_in_stock") : e("availability_remaining_count", { count: t.remaining });
|
|
58
|
-
},
|
|
58
|
+
}, Ge = (e) => {
|
|
59
59
|
let t = /* @__PURE__ */ new Map();
|
|
60
60
|
for (let n of e) {
|
|
61
61
|
let e = s(n);
|
|
@@ -73,28 +73,28 @@ var v = (e) => String(e).padStart(2, "0"), y = "product_modal", Le = (e, t) => {
|
|
|
73
73
|
return Array.from(t.values());
|
|
74
74
|
};
|
|
75
75
|
function S() {
|
|
76
|
-
let { t: v, i18n: S } =
|
|
77
|
-
|
|
78
|
-
w.hash === "#booking-products" &&
|
|
76
|
+
let { t: v, i18n: S } = Pe(), { storeSlug: C } = Me(), w = je(), Ke = m(null), { storefrontConfiguration: T } = fe(), E = T.workspace?.workspaceLanguage, { bikes: qe, accessories: Je } = me(), { bikes: D, accessories: O } = pe(), [k, A] = Ne(), { items: Ye, itemCount: Xe, addItem: Ze, removeItem: Qe, setQuantity: $e } = ne();
|
|
77
|
+
Oe(() => {
|
|
78
|
+
w.hash === "#booking-products" && Ke.current?.scrollIntoView({ block: "start" });
|
|
79
79
|
}, [w.hash]);
|
|
80
|
-
let
|
|
81
|
-
booking:
|
|
80
|
+
let et = p(() => t(T), [T]), j = p(() => r(T), [T]), M = T.settings.fulfillmentModes.includes("delivery"), tt = T.settings.deliveryDisabledReason.trim(), nt = T.shop.address?.trim() ?? "", N = T.bookingEngine.pricing.baseUnit, rt = ie(N, v), it = i(k).toString(), P = p(() => a(new URLSearchParams(it), C), [it, C]), [F, I] = h(() => ({
|
|
81
|
+
booking: Ve(n(P, j), M),
|
|
82
82
|
shouldWriteToUrl: !0
|
|
83
|
-
})), L = F.booking, R = p(() =>
|
|
83
|
+
})), L = F.booking, R = p(() => Be(L.start_date), [L.start_date]), at = p(() => Be(L.end_date) ?? R, [L.end_date, R]), [ot, st] = h(void 0), ct = m(void 0), lt = m(""), ut = [
|
|
84
84
|
L.start_date,
|
|
85
85
|
L.start_time,
|
|
86
86
|
L.end_date,
|
|
87
87
|
L.end_time
|
|
88
88
|
].join(":");
|
|
89
|
-
|
|
90
|
-
let z =
|
|
89
|
+
lt.current = ut;
|
|
90
|
+
let z = ot === ut, B = z ? L.start_time : "", V = z ? L.end_time : "", H = !z && k.get("start_date") === L.start_date && k.get("start_time") === L.start_time && k.get("end_date") === L.end_date && k.get("end_time") === L.end_time;
|
|
91
91
|
f(() => {
|
|
92
92
|
I((e) => {
|
|
93
93
|
if (e.shouldWriteToUrl) return e;
|
|
94
94
|
let t = {
|
|
95
95
|
...j,
|
|
96
96
|
...e.booking
|
|
97
|
-
}, r =
|
|
97
|
+
}, r = Ve(n(P, t), M);
|
|
98
98
|
return {
|
|
99
99
|
booking: b(e.booking, r) ? e.booking : r,
|
|
100
100
|
shouldWriteToUrl: !0
|
|
@@ -139,7 +139,7 @@ function S() {
|
|
|
139
139
|
B,
|
|
140
140
|
C
|
|
141
141
|
]);
|
|
142
|
-
let U = p(() =>
|
|
142
|
+
let U = p(() => Ge([...D, ...O]), [O, D]), [dt, W] = h([]);
|
|
143
143
|
f(() => {
|
|
144
144
|
if (!C || U.length === 0) {
|
|
145
145
|
W([]);
|
|
@@ -153,11 +153,11 @@ function S() {
|
|
|
153
153
|
let t = !1;
|
|
154
154
|
return (async () => {
|
|
155
155
|
try {
|
|
156
|
-
let n = await
|
|
156
|
+
let n = await Se(oe, {
|
|
157
157
|
storeSlug: C,
|
|
158
158
|
schedule: e,
|
|
159
159
|
products: U
|
|
160
|
-
}), r =
|
|
160
|
+
}), r = le.parse(n);
|
|
161
161
|
if (t) return;
|
|
162
162
|
W(r.success ? r.availability ?? [] : []);
|
|
163
163
|
} catch (e) {
|
|
@@ -176,25 +176,25 @@ function S() {
|
|
|
176
176
|
z,
|
|
177
177
|
C
|
|
178
178
|
]);
|
|
179
|
-
let G = p(() => new Map(
|
|
180
|
-
let t =
|
|
179
|
+
let G = p(() => new Map(dt.map((e) => [c(e.productId, e.productVariantId), e])), [dt]), K = p(() => D.map((e) => {
|
|
180
|
+
let t = He(e, G);
|
|
181
181
|
return {
|
|
182
182
|
...e,
|
|
183
183
|
availabilityStatus: t ? l(t) : e.availabilityStatus ?? "AVAILABLE"
|
|
184
184
|
};
|
|
185
|
-
}), [G, D]),
|
|
186
|
-
let t =
|
|
185
|
+
}), [G, D]), ft = p(() => O.map((e) => {
|
|
186
|
+
let t = He(e, G);
|
|
187
187
|
return {
|
|
188
188
|
...e,
|
|
189
189
|
availabilityStatus: t ? l(t) : "AVAILABLE"
|
|
190
190
|
};
|
|
191
|
-
}), [O, G]),
|
|
192
|
-
let n =
|
|
193
|
-
return n ?
|
|
194
|
-
},
|
|
195
|
-
let n =
|
|
196
|
-
return n ?
|
|
197
|
-
},
|
|
191
|
+
}), [O, G]), pt = (e, t) => {
|
|
192
|
+
let n = Ue(e, t, G);
|
|
193
|
+
return n ? ce(n) : e.availabilityStatus === "OUT_OF_STOCK";
|
|
194
|
+
}, mt = (e) => (e.productVariants ?? []).length > 0, ht = (e, t) => {
|
|
195
|
+
let n = Ue(e, t, G);
|
|
196
|
+
return n ? We(v, n, l(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? v("availability_out_of_stock") : null;
|
|
197
|
+
}, gt = Ce(C), _t = p(() => ({
|
|
198
198
|
startDate: v("booking_start_date"),
|
|
199
199
|
pickStartDate: v("booking_start_date"),
|
|
200
200
|
startTime: v("booking_start_time"),
|
|
@@ -224,72 +224,74 @@ function S() {
|
|
|
224
224
|
shouldWriteToUrl: !0
|
|
225
225
|
};
|
|
226
226
|
});
|
|
227
|
-
},
|
|
227
|
+
}, vt = {
|
|
228
228
|
startDate: R,
|
|
229
229
|
onStartDateChange: (e) => {
|
|
230
|
-
e && q({ start_date:
|
|
230
|
+
e && q({ start_date: ze(e) });
|
|
231
231
|
},
|
|
232
232
|
startTime: L.start_time,
|
|
233
233
|
onStartTimeChange: (e) => q({ start_time: e }),
|
|
234
|
-
endDate:
|
|
234
|
+
endDate: at,
|
|
235
235
|
onEndDateChange: (e) => {
|
|
236
|
-
e && q({ end_date:
|
|
236
|
+
e && q({ end_date: ze(e) });
|
|
237
237
|
},
|
|
238
238
|
endTime: L.end_time,
|
|
239
239
|
onEndTimeChange: (e) => q({ end_time: e }),
|
|
240
|
-
bookingPeriodConfig:
|
|
240
|
+
bookingPeriodConfig: et,
|
|
241
241
|
withMobileDateDrawer: !0,
|
|
242
|
-
fetchTimeSlots:
|
|
242
|
+
fetchTimeSlots: gt,
|
|
243
243
|
onTimeSlotsConfirmationChange: (e) => {
|
|
244
|
-
let t = e ?
|
|
245
|
-
|
|
244
|
+
let t = e ? lt.current : void 0;
|
|
245
|
+
ct.current !== t && (ct.current = t, I((e) => e.shouldWriteToUrl ? e : {
|
|
246
246
|
...e,
|
|
247
247
|
shouldWriteToUrl: !0
|
|
248
|
-
}),
|
|
248
|
+
}), st(t));
|
|
249
249
|
},
|
|
250
|
-
labels:
|
|
250
|
+
labels: _t,
|
|
251
251
|
localeCode: S.language
|
|
252
|
-
}, J = p(() =>
|
|
253
|
-
items:
|
|
252
|
+
}, yt = re(L, T.bookingEngine.pricing, T.bookingEngine.shop.timeZone)?.billableUnitCount, J = p(() => ae({
|
|
253
|
+
items: Ye,
|
|
254
254
|
language: S.language,
|
|
255
255
|
fallbackLanguage: E,
|
|
256
256
|
products: {
|
|
257
|
-
bikes:
|
|
258
|
-
accessories:
|
|
257
|
+
bikes: qe,
|
|
258
|
+
accessories: Je
|
|
259
259
|
},
|
|
260
|
-
priceUnit: N
|
|
260
|
+
priceUnit: N,
|
|
261
|
+
billableUnitCount: yt
|
|
261
262
|
}), [
|
|
263
|
+
yt,
|
|
264
|
+
Je,
|
|
262
265
|
qe,
|
|
263
|
-
Ke,
|
|
264
266
|
S.language,
|
|
265
|
-
|
|
267
|
+
Ye,
|
|
266
268
|
N,
|
|
267
269
|
E
|
|
268
|
-
]),
|
|
270
|
+
]), Y = p(() => J.lines.map((e) => ({
|
|
269
271
|
productId: e.checkoutProductId,
|
|
270
272
|
productVariantId: e.productVariantId,
|
|
271
273
|
quantity: e.quantity
|
|
272
|
-
})), [J.lines]), [
|
|
274
|
+
})), [J.lines]), [bt, xt] = h([]);
|
|
273
275
|
f(() => {
|
|
274
|
-
if (!C ||
|
|
275
|
-
|
|
276
|
+
if (!C || Y.length === 0) {
|
|
277
|
+
xt([]);
|
|
276
278
|
return;
|
|
277
279
|
}
|
|
278
280
|
let e = z ? u(L) : null;
|
|
279
281
|
if (!e) {
|
|
280
|
-
|
|
282
|
+
xt([]);
|
|
281
283
|
return;
|
|
282
284
|
}
|
|
283
285
|
let t = !1;
|
|
284
286
|
return (async () => {
|
|
285
287
|
try {
|
|
286
|
-
let n = await
|
|
288
|
+
let n = await Se(oe, {
|
|
287
289
|
storeSlug: C,
|
|
288
290
|
schedule: e,
|
|
289
|
-
products:
|
|
290
|
-
}), r =
|
|
291
|
+
products: Y
|
|
292
|
+
}), r = le.parse(n);
|
|
291
293
|
if (t) return;
|
|
292
|
-
|
|
294
|
+
xt(r.success ? r.availability ?? [] : []);
|
|
293
295
|
} catch (e) {
|
|
294
296
|
if (t) return;
|
|
295
297
|
console.error("Failed to load storefront cart availability", e);
|
|
@@ -303,37 +305,37 @@ function S() {
|
|
|
303
305
|
L.start_date,
|
|
304
306
|
L.start_time,
|
|
305
307
|
z,
|
|
306
|
-
|
|
308
|
+
Y,
|
|
307
309
|
C
|
|
308
310
|
]);
|
|
309
|
-
let
|
|
311
|
+
let St = p(() => new Map(bt.map((e) => [c(e.productId, e.productVariantId), e])), [bt]), Ct = p(() => ({
|
|
310
312
|
...J,
|
|
311
313
|
lines: J.lines.map((e) => {
|
|
312
|
-
let t =
|
|
314
|
+
let t = St.get(c(e.checkoutProductId, e.productVariantId)), n = t ? se(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
313
315
|
return {
|
|
314
316
|
...e,
|
|
315
317
|
insufficientCapacity: n !== void 0,
|
|
316
318
|
availabilityIssue: n
|
|
317
319
|
};
|
|
318
320
|
})
|
|
319
|
-
}), [
|
|
321
|
+
}), [St, J]), X = e(new URLSearchParams(), {
|
|
320
322
|
...L,
|
|
321
323
|
start_time: B,
|
|
322
324
|
end_time: V
|
|
323
|
-
}).toString(),
|
|
325
|
+
}).toString(), Z = z && u(L) !== null, wt = `/${C ?? ""}${X ? `?${X}` : ""}`, Tt = `/${C ?? ""}/booking${X ? `?${X}` : ""}`, Et = `/${C ?? ""}/checkout${X ? `?${X}` : ""}`, Dt = { backTo: `${w.pathname}${w.search}${w.hash}` }, [Ot, kt] = h(null), At = K.findIndex((e) => e.id === Ot), jt = k.get(y)?.trim() ?? "", Q = jt ? K.find((e) => e.id === jt) ?? ft.find((e) => e.id === jt) ?? null : null, $ = (e) => {
|
|
324
326
|
let t = new URLSearchParams(k);
|
|
325
327
|
e?.trim() ? t.set(y, e) : t.delete(y), A(t, { replace: !0 });
|
|
326
|
-
},
|
|
327
|
-
x(e) &&
|
|
328
|
-
},
|
|
329
|
-
if (!
|
|
328
|
+
}, Mt = (e) => {
|
|
329
|
+
x(e) && $(e.id);
|
|
330
|
+
}, Nt = (e, t, n = 1) => {
|
|
331
|
+
if (!Z) return;
|
|
330
332
|
let r = Math.max(1, Math.floor(n));
|
|
331
|
-
|
|
333
|
+
Ze({
|
|
332
334
|
kind: e.kind,
|
|
333
335
|
productId: s(e),
|
|
334
336
|
...t ? { productVariantId: t } : {},
|
|
335
337
|
quantity: r
|
|
336
|
-
}),
|
|
338
|
+
}), he.success(v("product_added_to_cart_successfully", {
|
|
337
339
|
quantity: r,
|
|
338
340
|
productName: te({
|
|
339
341
|
product: e,
|
|
@@ -342,24 +344,24 @@ function S() {
|
|
|
342
344
|
fallbackLanguage: E
|
|
343
345
|
})
|
|
344
346
|
}));
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
},
|
|
347
|
+
}, Pt = (e) => {
|
|
348
|
+
Mt(e);
|
|
349
|
+
}, Ft = (e) => {
|
|
348
350
|
let t = e.productVariants ?? [], n = x(e);
|
|
349
351
|
if (n) {
|
|
350
352
|
if (t.length > 1) {
|
|
351
|
-
|
|
353
|
+
Mt(e);
|
|
352
354
|
return;
|
|
353
355
|
}
|
|
354
|
-
|
|
356
|
+
Nt(e, n);
|
|
355
357
|
}
|
|
356
358
|
};
|
|
357
|
-
return /* @__PURE__ */ _(
|
|
359
|
+
return /* @__PURE__ */ _(ke, { children: [/* @__PURE__ */ g(Te, {
|
|
358
360
|
currentStep: "booking",
|
|
359
|
-
bookingPath:
|
|
360
|
-
checkoutPath:
|
|
361
|
-
checkoutEnabled:
|
|
362
|
-
backPath:
|
|
361
|
+
bookingPath: Tt,
|
|
362
|
+
checkoutPath: Et,
|
|
363
|
+
checkoutEnabled: Xe > 0 && Z,
|
|
364
|
+
backPath: wt,
|
|
363
365
|
backLabel: v("back_to_home"),
|
|
364
366
|
children: /* @__PURE__ */ _("div", {
|
|
365
367
|
className: "grid gap-6 lg:grid-cols-12",
|
|
@@ -375,18 +377,18 @@ function S() {
|
|
|
375
377
|
stepNumber: 1,
|
|
376
378
|
title: v("booking_summary_title")
|
|
377
379
|
}),
|
|
378
|
-
/* @__PURE__ */ g(
|
|
379
|
-
...
|
|
380
|
+
/* @__PURE__ */ g(ge, {
|
|
381
|
+
...vt,
|
|
380
382
|
className: "gap-3",
|
|
381
383
|
labelClassName: "text-xs font-medium text-slate-700",
|
|
382
384
|
inputClassName: "h-10"
|
|
383
385
|
}),
|
|
384
|
-
/* @__PURE__ */ g(
|
|
386
|
+
/* @__PURE__ */ g(we, {
|
|
385
387
|
value: L.fulfillment,
|
|
386
388
|
onValueChange: (e) => q({ fulfillment: e }),
|
|
387
|
-
pickupAddress:
|
|
389
|
+
pickupAddress: nt,
|
|
388
390
|
deliveryEnabled: M,
|
|
389
|
-
deliveryDisabledReason:
|
|
391
|
+
deliveryDisabledReason: tt,
|
|
390
392
|
startAddress: L.start_address,
|
|
391
393
|
onStartAddressChange: (e) => q({ start_address: e }),
|
|
392
394
|
endAddress: L.end_address,
|
|
@@ -397,7 +399,7 @@ function S() {
|
|
|
397
399
|
]
|
|
398
400
|
}),
|
|
399
401
|
/* @__PURE__ */ _("div", {
|
|
400
|
-
ref:
|
|
402
|
+
ref: Ke,
|
|
401
403
|
id: "booking-products",
|
|
402
404
|
className: "space-y-2 scroll-mt-32",
|
|
403
405
|
children: [/* @__PURE__ */ g(d, {
|
|
@@ -411,19 +413,19 @@ function S() {
|
|
|
411
413
|
/* @__PURE__ */ g("div", {
|
|
412
414
|
className: "grid gap-4 md:grid-cols-2",
|
|
413
415
|
children: K.map((e, t) => {
|
|
414
|
-
let n = `/${C ?? ""}/products/${e.slug}`, r = !!x(e) ||
|
|
415
|
-
return /* @__PURE__ */ g(
|
|
416
|
+
let n = `/${C ?? ""}/products/${e.slug}`, r = !!x(e) || mt(e);
|
|
417
|
+
return /* @__PURE__ */ g(Ee, {
|
|
416
418
|
bike: e,
|
|
417
419
|
detailsPath: n,
|
|
418
|
-
productDetailsLinkState:
|
|
419
|
-
onAction: () =>
|
|
420
|
-
actionDisabled: !r || !
|
|
420
|
+
productDetailsLinkState: Dt,
|
|
421
|
+
onAction: () => Pt(e),
|
|
422
|
+
actionDisabled: !r || !Z,
|
|
421
423
|
fallbackLanguage: E,
|
|
422
|
-
dimOnColumnCount:
|
|
423
|
-
onQuickAdd: (t, n) =>
|
|
424
|
-
onHoverStart: () =>
|
|
424
|
+
dimOnColumnCount: Re(At, t),
|
|
425
|
+
onQuickAdd: (t, n) => Nt(e, t, n),
|
|
426
|
+
onHoverStart: () => kt(e.id),
|
|
425
427
|
onHoverEnd: () => {
|
|
426
|
-
|
|
428
|
+
kt((t) => t === e.id ? null : t);
|
|
427
429
|
},
|
|
428
430
|
testId: `storefront-booking-bike-card-${e.id}`.toLowerCase()
|
|
429
431
|
}, e.id);
|
|
@@ -441,16 +443,16 @@ function S() {
|
|
|
441
443
|
}),
|
|
442
444
|
/* @__PURE__ */ g("div", {
|
|
443
445
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
444
|
-
children:
|
|
445
|
-
let t = o(e.name, S.language, E), n = o(e.description, S.language, E), r = o(e.warning, S.language, E), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a =
|
|
446
|
-
return /* @__PURE__ */ g(
|
|
446
|
+
children: ft.map((e) => {
|
|
447
|
+
let t = o(e.name, S.language, E), n = o(e.description, S.language, E), r = o(e.warning, S.language, E), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = xe(e.primaryImageStyle), ee = `/${C ?? ""}/products/${e.slug}`, s = x(e), te = e.availabilityStatus === "OUT_OF_STOCK", ne = !!s || mt(e);
|
|
448
|
+
return /* @__PURE__ */ g(_e, {
|
|
447
449
|
"data-testid": `storefront-booking-accessory-card-${e.id}`.toLowerCase(),
|
|
448
450
|
className: "h-full border-slate-200 bg-white shadow-sm transition-[border-color,box-shadow] duration-200 hover:border-primary/20 hover:shadow-md",
|
|
449
451
|
children: /* @__PURE__ */ _("div", {
|
|
450
452
|
className: "flex h-full flex-col gap-2 p-3",
|
|
451
453
|
children: [
|
|
452
454
|
/* @__PURE__ */ _("div", {
|
|
453
|
-
className:
|
|
455
|
+
className: Fe("relative aspect-[1618/1000] overflow-hidden rounded-xl", a.className),
|
|
454
456
|
style: a.style,
|
|
455
457
|
children: [i ? /* @__PURE__ */ g("img", {
|
|
456
458
|
src: i,
|
|
@@ -459,11 +461,11 @@ function S() {
|
|
|
459
461
|
loading: "lazy"
|
|
460
462
|
}) : /* @__PURE__ */ g("div", {
|
|
461
463
|
className: "absolute inset-0 flex items-center justify-center text-slate-400",
|
|
462
|
-
children: /* @__PURE__ */ g(
|
|
464
|
+
children: /* @__PURE__ */ g(Ie, {
|
|
463
465
|
className: "h-8 w-8",
|
|
464
466
|
"aria-hidden": "true"
|
|
465
467
|
})
|
|
466
|
-
}), te ? /* @__PURE__ */ g(
|
|
468
|
+
}), te ? /* @__PURE__ */ g(ue, {
|
|
467
469
|
variant: "destructive",
|
|
468
470
|
className: "pointer-events-none absolute right-2 top-2 shadow-sm",
|
|
469
471
|
children: /* @__PURE__ */ g("span", { children: v("availability_out_of_stock") })
|
|
@@ -477,7 +479,7 @@ function S() {
|
|
|
477
479
|
children: [/* @__PURE__ */ g("p", {
|
|
478
480
|
className: "min-w-0 text-sm font-semibold text-slate-950",
|
|
479
481
|
children: /* @__PURE__ */ g("span", { children: t })
|
|
480
|
-
}), /* @__PURE__ */ g(
|
|
482
|
+
}), /* @__PURE__ */ g(be, {
|
|
481
483
|
prices: e.prices,
|
|
482
484
|
className: "shrink-0",
|
|
483
485
|
openOnHover: !1
|
|
@@ -487,7 +489,7 @@ function S() {
|
|
|
487
489
|
className: "line-clamp-2 text-xs text-slate-600",
|
|
488
490
|
children: /* @__PURE__ */ g("span", { children: n })
|
|
489
491
|
}),
|
|
490
|
-
/* @__PURE__ */ g(
|
|
492
|
+
/* @__PURE__ */ g(ve, {
|
|
491
493
|
warning: r,
|
|
492
494
|
className: "mt-1"
|
|
493
495
|
})
|
|
@@ -495,18 +497,18 @@ function S() {
|
|
|
495
497
|
}),
|
|
496
498
|
/* @__PURE__ */ _("div", {
|
|
497
499
|
className: "mt-auto flex items-center gap-2",
|
|
498
|
-
children: [/* @__PURE__ */ g(
|
|
500
|
+
children: [/* @__PURE__ */ g(Ae, {
|
|
499
501
|
to: ee,
|
|
500
|
-
state:
|
|
502
|
+
state: Dt,
|
|
501
503
|
className: "text-xs font-medium text-slate-700 hover:text-slate-950",
|
|
502
504
|
children: /* @__PURE__ */ g("span", { children: v("product_details_link") })
|
|
503
|
-
}), /* @__PURE__ */ _(
|
|
505
|
+
}), /* @__PURE__ */ _(de, {
|
|
504
506
|
type: "button",
|
|
505
507
|
size: "sm",
|
|
506
508
|
className: "ml-auto gap-2",
|
|
507
|
-
onClick: () =>
|
|
508
|
-
disabled: !ne || !
|
|
509
|
-
children: [/* @__PURE__ */ g("span", { children: v("add_to_cart") }), /* @__PURE__ */ g(
|
|
509
|
+
onClick: () => Ft(e),
|
|
510
|
+
disabled: !ne || !Z,
|
|
511
|
+
children: [/* @__PURE__ */ g("span", { children: v("add_to_cart") }), /* @__PURE__ */ g(Le, {
|
|
510
512
|
className: "h-4 w-4",
|
|
511
513
|
"aria-hidden": "true"
|
|
512
514
|
})]
|
|
@@ -521,31 +523,31 @@ function S() {
|
|
|
521
523
|
})
|
|
522
524
|
}), /* @__PURE__ */ g("div", {
|
|
523
525
|
className: "min-w-0 lg:col-span-4",
|
|
524
|
-
children: /* @__PURE__ */ g(
|
|
525
|
-
lines:
|
|
526
|
-
itemCount:
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
checkoutPath:
|
|
530
|
-
showCheckoutAction:
|
|
526
|
+
children: /* @__PURE__ */ g(ye, {
|
|
527
|
+
lines: Ct.lines,
|
|
528
|
+
itemCount: Xe,
|
|
529
|
+
baseUnitLabel: rt,
|
|
530
|
+
totalMinor: Ct.totalMinor,
|
|
531
|
+
checkoutPath: Et,
|
|
532
|
+
showCheckoutAction: Z,
|
|
531
533
|
editable: !0,
|
|
532
534
|
stickyTopClassName: "top-32",
|
|
533
|
-
onQuantityChange:
|
|
534
|
-
onRemove:
|
|
535
|
+
onQuantityChange: $e,
|
|
536
|
+
onRemove: Qe
|
|
535
537
|
})
|
|
536
538
|
})]
|
|
537
539
|
})
|
|
538
|
-
}), /* @__PURE__ */ g(
|
|
539
|
-
open: !!
|
|
540
|
-
product:
|
|
540
|
+
}), /* @__PURE__ */ g(De, {
|
|
541
|
+
open: !!Q,
|
|
542
|
+
product: Q,
|
|
541
543
|
onOpenChange: (e) => {
|
|
542
|
-
e ||
|
|
544
|
+
e || $(null);
|
|
543
545
|
},
|
|
544
|
-
getVariantAvailabilityLabel: (e) =>
|
|
545
|
-
isVariantOutOfCapacity: (e) =>
|
|
546
|
-
addDisabled: !
|
|
546
|
+
getVariantAvailabilityLabel: (e) => Q ? ht(Q, e) : null,
|
|
547
|
+
isVariantOutOfCapacity: (e) => Q ? pt(Q, e) : !1,
|
|
548
|
+
addDisabled: !Z,
|
|
547
549
|
onAddVariant: (e, t) => {
|
|
548
|
-
|
|
550
|
+
Q && (Nt(Q, e, t), $(null));
|
|
549
551
|
}
|
|
550
552
|
})] });
|
|
551
553
|
}
|
|
@@ -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,4CAooBnC"}
|
|
@@ -140,7 +140,7 @@ function p() {
|
|
|
140
140
|
pricePerDayMinor: t.insurance.pricePerDayMinor,
|
|
141
141
|
deductibleAmountMinor: t.insurance.deductibleAmountMinor
|
|
142
142
|
}] : [];
|
|
143
|
-
}), K = h.modules?.insurance?.enabled === !0 && G.length > 0, q = K && P, yt = G.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), bt = G.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), xt = z.
|
|
143
|
+
}), K = h.modules?.insurance?.enabled === !0 && G.length > 0, q = K && P, yt = G.reduce((e, t) => e + t.pricePerDayMinor * t.quantity, 0), bt = G.reduce((e, t) => Math.max(e, t.deductibleAmountMinor), 0), xt = z.totalMinor ?? 0, J = D?.totalMinor ?? xt, St = T?.discountAmountMinor ?? 0, Y = e(new URLSearchParams(), I).toString(), X = `/${g ?? ""}/booking${Y ? `?${Y}` : ""}`, Ct = `/${g ?? ""}/checkout${Y ? `?${Y}` : ""}`, wt = Ne({
|
|
144
144
|
resolver: Pe(we),
|
|
145
145
|
defaultValues: {
|
|
146
146
|
first_name: "",
|
|
@@ -399,7 +399,6 @@ function p() {
|
|
|
399
399
|
}), /* @__PURE__ */ u(Ce, {
|
|
400
400
|
lines: _t.lines,
|
|
401
401
|
itemCount: Ue,
|
|
402
|
-
totalPerBaseUnitMinor: _t.totalPerBaseUnitMinor,
|
|
403
402
|
baseUnitLabel: pt,
|
|
404
403
|
bookingSubtotalLabel: At,
|
|
405
404
|
vatAmountLabel: jt,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Loader } from '@rpcbase/client';
|
|
2
|
-
import { StorefrontI18nLanguage } from '../i18n/I18nProvider';
|
|
3
2
|
export declare const resolveContractSaleDocumentBackLink: (search: string) => string | null;
|
|
4
3
|
type ContractSaleDocumentLoaderArgs = Parameters<Loader>[0] & {
|
|
5
4
|
request?: {
|
|
@@ -11,7 +10,7 @@ export declare const loader: ({ ctx, params, request }: ContractSaleDocumentLoad
|
|
|
11
10
|
referenceId: string;
|
|
12
11
|
saleDocumentId: string;
|
|
13
12
|
pdfMode: boolean;
|
|
14
|
-
documentLanguage:
|
|
13
|
+
documentLanguage: "fr" | "en" | null;
|
|
15
14
|
document: null;
|
|
16
15
|
error: string | null;
|
|
17
16
|
} | {
|
|
@@ -19,7 +18,7 @@ export declare const loader: ({ ctx, params, request }: ContractSaleDocumentLoad
|
|
|
19
18
|
referenceId: string;
|
|
20
19
|
saleDocumentId: string;
|
|
21
20
|
pdfMode: boolean;
|
|
22
|
-
documentLanguage:
|
|
21
|
+
documentLanguage: "fr" | "en" | null;
|
|
23
22
|
document: {
|
|
24
23
|
id: string;
|
|
25
24
|
kind: "quote" | "invoice" | "credit_note";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"ContractSaleDocumentPage.d.ts","sourceRoot":"","sources":["../../src/pages/ContractSaleDocumentPage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAmC7C,eAAO,MAAM,mCAAmC,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAe7E,CAAA;AA0KD,KAAK,8BAA8B,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;IAC5D,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,MAAM,6BAAqC,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEnE,CAAA;AAYnB,MAAM,CAAC,OAAO,UAAU,wBAAwB,4CA8P/C"}
|