@loczer/storefront-sdk 0.209.0 → 0.210.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/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/index-DAbcklF5.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/date/mini-CSEBo1ZP.js +60 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/index--u3Qf-qy.js +4 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tz/index-CEcibV-H.js +1 -0
- package/dist/chunks/pkg/booking-engine/dist/node_modules/@date-fns/tz/tzOffset/index-COlDDdap.js +22 -0
- package/dist/chunks/pkg/booking-engine/dist/pricing-BJaynUu_.js +3 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/schedule-ssRov9xe.js +39 -0
- package/dist/chunks/pkg/booking-engine/dist/utils/timezone-B6XIbBPz.js +79 -0
- package/dist/components/ProductPriceBadge/index.d.ts.map +1 -1
- package/dist/components/ProductPriceBadge/index.js +86 -80
- package/dist/components/StorefrontCartPanel/index.d.ts +4 -4
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +10 -9
- package/dist/i18n/en.d.ts +11 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +13 -8
- package/dist/i18n/fr.d.ts +11 -6
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +13 -8
- package/dist/index.d.ts +54 -36
- package/dist/index.js +66 -66
- package/dist/lib/booking.d.ts +0 -6
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +51 -65
- package/dist/lib/cartSummary.d.ts +5 -3
- package/dist/lib/cartSummary.d.ts.map +1 -1
- package/dist/lib/cartSummary.js +7 -7
- package/dist/lib/pricing.d.ts +18 -6
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/pricing.js +45 -29
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +205 -201
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +277 -274
- 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 +4 -4
- package/package.json +1 -1
|
@@ -2,59 +2,60 @@ import { applyBookingParamsToSearch as e, createBookingPeriodConfigFromStorefron
|
|
|
2
2
|
import { getLocalizedValue as o } from "../localization.js";
|
|
3
3
|
import { getStorefrontCheckoutProductId as s, getStorefrontProductSelectionDisplayName as ee } from "../lib/products.js";
|
|
4
4
|
import { useStorefrontCart as te } from "../lib/cart.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { getPricingUnitLabel as ne } from "../lib/pricing.js";
|
|
6
|
+
import { buildStorefrontCartSummary as re } from "../lib/cartSummary.js";
|
|
7
|
+
import { ROUTE as ie, buildStorefrontAvailabilityKey as c, getStorefrontAvailabilityIssue as ae, getStorefrontAvailabilityStatus as l, getValidStorefrontAvailabilitySchedule as u, isStorefrontAvailabilityInsufficient as oe, responseSchema as se } from "../lib/storefrontAvailability.js";
|
|
8
|
+
import { Badge as ce } from "../ui/badge.js";
|
|
9
|
+
import { Button as le } from "../ui/button.js";
|
|
10
|
+
import { useStorefront as ue, useStorefrontBookingProducts as de, useStorefrontProducts as fe } from "../StorefrontContext.js";
|
|
11
|
+
import { toast as pe } from "../lib/toast.js";
|
|
12
|
+
import { BookingPeriodSelector as me } from "../components/BookingPeriodSelector/index.js";
|
|
13
|
+
import { BookingFlowSteps as he } from "../components/BookingFlowSteps/index.js";
|
|
13
14
|
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 { BookingBikeQuickAddCard as
|
|
23
|
-
import { BookingBikeVariantDialog as
|
|
24
|
-
import { useEffect as f, useLayoutEffect as
|
|
15
|
+
import { Card as ge } from "../ui/card.js";
|
|
16
|
+
import { ProductWarningNotice as _e } from "../components/ProductWarningNotice/index.js";
|
|
17
|
+
import { StorefrontCartPanel as ve } from "../components/StorefrontCartPanel/index.js";
|
|
18
|
+
import { ProductPriceBadge as ye } from "../components/ProductPriceBadge/index.js";
|
|
19
|
+
import { resolveProductImageContainerStyle as be } from "../lib/productImageStyles.js";
|
|
20
|
+
import { apiPost as xe } from "../lib/apiCall.js";
|
|
21
|
+
import { createStorefrontTimeSlotsFetcher as Se } from "../lib/fetchStorefrontTimeSlots.js";
|
|
22
|
+
import { FulfillmentSection as Ce } from "../components/FulfillmentSection/index.js";
|
|
23
|
+
import { BookingBikeQuickAddCard as we } from "../components/BookingBikeQuickAddCard/index.js";
|
|
24
|
+
import { BookingBikeVariantDialog as Te } from "../components/BookingBikeVariantDialog/index.js";
|
|
25
|
+
import { useEffect as f, useLayoutEffect as Ee, useMemo as p, useRef as De, useState as m } from "react";
|
|
25
26
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
26
|
-
import { Link as _, useLocation as
|
|
27
|
-
import { useTranslation as
|
|
28
|
-
import { cn as
|
|
29
|
-
import { ArrowLeft as
|
|
27
|
+
import { Link as _, useLocation as Oe, useParams as ke, useSearchParams as Ae } from "@rpcbase/router";
|
|
28
|
+
import { useTranslation as je } from "react-i18next";
|
|
29
|
+
import { cn as Me } from "@rpcbase/ui";
|
|
30
|
+
import { ArrowLeft as Ne, Bike as Pe, Plus as Fe, ShoppingCart as Ie } from "lucide-react";
|
|
30
31
|
//#region src/pages/BookingPage.tsx
|
|
31
|
-
var v = (e) => String(e).padStart(2, "0"), y = "product_modal",
|
|
32
|
+
var v = (e) => String(e).padStart(2, "0"), y = "product_modal", Le = (e, t) => {
|
|
32
33
|
let n = t - e;
|
|
33
34
|
return e >= 0 && (n === 1 || n === 2) ? n : null;
|
|
34
|
-
},
|
|
35
|
+
}, Re = (e) => `${e.getFullYear()}-${v(e.getMonth() + 1)}-${v(e.getDate())}`, b = (e) => {
|
|
35
36
|
if (!e) return;
|
|
36
37
|
let t = e.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
37
38
|
if (!t) return;
|
|
38
39
|
let n = Number(t[1]), r = Number(t[2]), i = Number(t[3]), a = new Date(n, r - 1, i);
|
|
39
40
|
if (!(Number.isNaN(a.getTime()) || a.getFullYear() !== n || a.getMonth() !== r - 1 || a.getDate() !== i)) return a;
|
|
40
|
-
},
|
|
41
|
+
}, ze = (e, t) => e.fulfillment === t.fulfillment && e.start_date === t.start_date && e.start_time === t.start_time && e.end_date === t.end_date && e.end_time === t.end_time && e.start_address === t.start_address && e.end_address === t.end_address, x = (e, t = () => !0) => {
|
|
41
42
|
if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
|
|
42
43
|
let n = e.productVariants ?? [], r = n.find((e) => t(e.id))?.id ?? n[0]?.id;
|
|
43
44
|
return typeof r == "string" && r.trim().length > 0 ? r : null;
|
|
44
|
-
},
|
|
45
|
+
}, Be = (e, t) => e.fulfillment === "delivery" && !t ? {
|
|
45
46
|
...e,
|
|
46
47
|
fulfillment: "pickup"
|
|
47
|
-
} : e,
|
|
48
|
+
} : e, Ve = (e, t) => {
|
|
48
49
|
let n = s(e), r = e.representedVariantId?.trim();
|
|
49
50
|
if (r) {
|
|
50
51
|
let e = t.get(c(n, r));
|
|
51
52
|
if (e) return e;
|
|
52
53
|
}
|
|
53
54
|
return t.get(c(n));
|
|
54
|
-
},
|
|
55
|
-
let r =
|
|
55
|
+
}, He = (e, t, n) => n.get(c(s(e), t)), Ue = (e, t, n) => {
|
|
56
|
+
let r = ae(t);
|
|
56
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 });
|
|
57
|
-
},
|
|
58
|
+
}, We = (e) => {
|
|
58
59
|
let t = /* @__PURE__ */ new Map();
|
|
59
60
|
for (let n of e) {
|
|
60
61
|
let e = s(n);
|
|
@@ -72,76 +73,76 @@ var v = (e) => String(e).padStart(2, "0"), y = "product_modal", Ie = (e, t) => {
|
|
|
72
73
|
return Array.from(t.values());
|
|
73
74
|
};
|
|
74
75
|
function S() {
|
|
75
|
-
let { t: v, i18n: S } =
|
|
76
|
-
|
|
77
|
-
w.hash === "#booking-products" &&
|
|
76
|
+
let { t: v, i18n: S } = je(), { storeSlug: C } = ke(), w = Oe(), Ge = De(null), { storefrontConfiguration: T } = ue(), E = T.workspace?.workspaceLanguage, { bikes: Ke, accessories: qe } = fe(), { bikes: D, accessories: O } = de(), [k, A] = Ae(), { items: Je, itemCount: j, addItem: Ye, removeItem: Xe, setQuantity: Ze } = te();
|
|
77
|
+
Ee(() => {
|
|
78
|
+
w.hash === "#booking-products" && Ge.current?.scrollIntoView({ block: "start" });
|
|
78
79
|
}, [w.hash]);
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
].join(":"),
|
|
80
|
+
let Qe = p(() => t(T), [T]), M = p(() => r(T), [T]), N = T.settings.fulfillmentModes.includes("delivery"), $e = T.settings.deliveryDisabledReason.trim(), et = T.shop.address?.trim() ?? "", P = T.bookingEngine.pricing.baseUnit, tt = ne(P, v), F = p(() => i(k, C), [k, C]), [I, nt] = m(() => Be(n(F, M), N)), [rt, it] = m(void 0), at = [
|
|
81
|
+
I.start_date,
|
|
82
|
+
I.start_time,
|
|
83
|
+
I.end_date,
|
|
84
|
+
I.end_time
|
|
85
|
+
].join(":"), L = rt === at, R = L ? I.start_time : "", z = L ? I.end_time : "", ot = !L && k.get("start_date") === I.start_date && k.get("start_time") === I.start_time && k.get("end_date") === I.end_date && k.get("end_time") === I.end_time;
|
|
85
86
|
f(() => {
|
|
86
|
-
|
|
87
|
+
nt((e) => {
|
|
87
88
|
let t = {
|
|
88
89
|
...M,
|
|
89
90
|
...e
|
|
90
|
-
}, r =
|
|
91
|
-
return
|
|
91
|
+
}, r = Be(n(F, t), N);
|
|
92
|
+
return ze(e, r) ? e : r;
|
|
92
93
|
});
|
|
93
94
|
}, [
|
|
94
|
-
|
|
95
|
+
F,
|
|
95
96
|
M,
|
|
96
97
|
N
|
|
97
98
|
]), f(() => {
|
|
98
|
-
if (
|
|
99
|
+
if (ot) return;
|
|
99
100
|
let t = e(k, {
|
|
100
|
-
...
|
|
101
|
-
start_time:
|
|
102
|
-
end_time:
|
|
101
|
+
...I,
|
|
102
|
+
start_time: R,
|
|
103
|
+
end_time: z
|
|
103
104
|
});
|
|
104
105
|
t.toString() !== k.toString() && A(t, { replace: !0 });
|
|
105
106
|
}, [
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
I,
|
|
108
|
+
ot,
|
|
109
|
+
z,
|
|
108
110
|
R,
|
|
109
|
-
L,
|
|
110
111
|
k,
|
|
111
112
|
A
|
|
112
113
|
]), f(() => {
|
|
113
114
|
a(C, {
|
|
114
|
-
...
|
|
115
|
-
start_time:
|
|
116
|
-
end_time:
|
|
115
|
+
...I,
|
|
116
|
+
start_time: R,
|
|
117
|
+
end_time: z
|
|
117
118
|
});
|
|
118
119
|
}, [
|
|
119
|
-
|
|
120
|
+
I,
|
|
121
|
+
z,
|
|
120
122
|
R,
|
|
121
|
-
L,
|
|
122
123
|
C
|
|
123
124
|
]);
|
|
124
|
-
let
|
|
125
|
+
let B = p(() => We([...D, ...O]), [O, D]), [st, V] = m([]);
|
|
125
126
|
f(() => {
|
|
126
|
-
if (!C ||
|
|
127
|
-
|
|
127
|
+
if (!C || B.length === 0) {
|
|
128
|
+
V([]);
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
let e =
|
|
131
|
+
let e = L ? u(I) : null;
|
|
131
132
|
if (!e) {
|
|
132
|
-
|
|
133
|
+
V([]);
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
let t = !1;
|
|
136
137
|
return (async () => {
|
|
137
138
|
try {
|
|
138
|
-
let n = await
|
|
139
|
+
let n = await xe(ie, {
|
|
139
140
|
storeSlug: C,
|
|
140
141
|
schedule: e,
|
|
141
|
-
products:
|
|
142
|
-
}), r =
|
|
142
|
+
products: B
|
|
143
|
+
}), r = se.parse(n);
|
|
143
144
|
if (t) return;
|
|
144
|
-
|
|
145
|
+
V(r.success ? r.availability ?? [] : []);
|
|
145
146
|
} catch (e) {
|
|
146
147
|
if (t) return;
|
|
147
148
|
console.error("Failed to load storefront availability", e);
|
|
@@ -150,33 +151,33 @@ function S() {
|
|
|
150
151
|
t = !0;
|
|
151
152
|
};
|
|
152
153
|
}, [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
B,
|
|
155
|
+
I.end_date,
|
|
156
|
+
I.end_time,
|
|
157
|
+
I.start_date,
|
|
158
|
+
I.start_time,
|
|
159
|
+
L,
|
|
159
160
|
C
|
|
160
161
|
]);
|
|
161
|
-
let
|
|
162
|
-
let t =
|
|
162
|
+
let H = p(() => new Map(st.map((e) => [c(e.productId, e.productVariantId), e])), [st]), U = p(() => D.map((e) => {
|
|
163
|
+
let t = Ve(e, H);
|
|
163
164
|
return {
|
|
164
165
|
...e,
|
|
165
166
|
availabilityStatus: t ? l(t) : e.availabilityStatus ?? "AVAILABLE"
|
|
166
167
|
};
|
|
167
|
-
}), [
|
|
168
|
-
let t =
|
|
168
|
+
}), [H, D]), ct = p(() => O.map((e) => {
|
|
169
|
+
let t = Ve(e, H);
|
|
169
170
|
return {
|
|
170
171
|
...e,
|
|
171
172
|
availabilityStatus: t ? l(t) : "AVAILABLE"
|
|
172
173
|
};
|
|
173
|
-
}), [O,
|
|
174
|
-
let n =
|
|
175
|
-
return n ?
|
|
176
|
-
},
|
|
177
|
-
let n =
|
|
178
|
-
return n ?
|
|
179
|
-
},
|
|
174
|
+
}), [O, H]), lt = (e, t) => {
|
|
175
|
+
let n = He(e, t, H);
|
|
176
|
+
return n ? oe(n) : e.availabilityStatus === "OUT_OF_STOCK";
|
|
177
|
+
}, ut = (e) => (e.productVariants ?? []).length > 0, dt = (e, t) => {
|
|
178
|
+
let n = He(e, t, H);
|
|
179
|
+
return n ? Ue(v, n, l(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? v("availability_out_of_stock") : null;
|
|
180
|
+
}, ft = Se(C), pt = p(() => ({
|
|
180
181
|
startDate: v("booking_start_date"),
|
|
181
182
|
pickStartDate: v("booking_start_date"),
|
|
182
183
|
startTime: v("booking_start_time"),
|
|
@@ -188,73 +189,75 @@ function S() {
|
|
|
188
189
|
timeSlotsUnavailable: v("booking_time_slots_unavailable"),
|
|
189
190
|
timeSlotsLoadError: v("booking_time_slots_load_error"),
|
|
190
191
|
retryTimeSlots: v("booking_time_slots_retry")
|
|
191
|
-
}), [S.language, v]),
|
|
192
|
-
|
|
192
|
+
}), [S.language, v]), W = (e) => {
|
|
193
|
+
nt((t) => {
|
|
193
194
|
let n = {
|
|
194
195
|
...t,
|
|
195
196
|
...e
|
|
196
197
|
};
|
|
197
|
-
return
|
|
198
|
+
return ze(t, n) ? t : n;
|
|
198
199
|
});
|
|
199
|
-
},
|
|
200
|
-
startDate: b(
|
|
200
|
+
}, mt = {
|
|
201
|
+
startDate: b(I.start_date),
|
|
201
202
|
onStartDateChange: (e) => {
|
|
202
|
-
e &&
|
|
203
|
+
e && W({ start_date: Re(e) });
|
|
203
204
|
},
|
|
204
|
-
startTime:
|
|
205
|
-
onStartTimeChange: (e) =>
|
|
206
|
-
endDate: b(
|
|
205
|
+
startTime: I.start_time,
|
|
206
|
+
onStartTimeChange: (e) => W({ start_time: e }),
|
|
207
|
+
endDate: b(I.end_date) ?? b(I.start_date),
|
|
207
208
|
onEndDateChange: (e) => {
|
|
208
|
-
e &&
|
|
209
|
+
e && W({ end_date: Re(e) });
|
|
209
210
|
},
|
|
210
|
-
endTime:
|
|
211
|
-
onEndTimeChange: (e) =>
|
|
212
|
-
bookingPeriodConfig:
|
|
213
|
-
fetchTimeSlots:
|
|
211
|
+
endTime: I.end_time,
|
|
212
|
+
onEndTimeChange: (e) => W({ end_time: e }),
|
|
213
|
+
bookingPeriodConfig: Qe,
|
|
214
|
+
fetchTimeSlots: ft,
|
|
214
215
|
onTimeSlotsConfirmationChange: (e) => {
|
|
215
|
-
|
|
216
|
+
it(e ? at : void 0);
|
|
216
217
|
},
|
|
217
|
-
labels:
|
|
218
|
+
labels: pt,
|
|
218
219
|
localeCode: S.language
|
|
219
|
-
},
|
|
220
|
-
items:
|
|
220
|
+
}, G = p(() => re({
|
|
221
|
+
items: Je,
|
|
221
222
|
language: S.language,
|
|
222
223
|
fallbackLanguage: E,
|
|
223
224
|
products: {
|
|
224
|
-
bikes:
|
|
225
|
-
accessories:
|
|
226
|
-
}
|
|
225
|
+
bikes: Ke,
|
|
226
|
+
accessories: qe
|
|
227
|
+
},
|
|
228
|
+
priceUnit: P
|
|
227
229
|
}), [
|
|
230
|
+
qe,
|
|
228
231
|
Ke,
|
|
229
|
-
Ge,
|
|
230
232
|
S.language,
|
|
231
|
-
|
|
233
|
+
Je,
|
|
234
|
+
P,
|
|
232
235
|
E
|
|
233
|
-
]),
|
|
236
|
+
]), K = p(() => G.lines.map((e) => ({
|
|
234
237
|
productId: e.checkoutProductId,
|
|
235
238
|
productVariantId: e.productVariantId,
|
|
236
239
|
quantity: e.quantity
|
|
237
|
-
})), [
|
|
240
|
+
})), [G.lines]), [ht, q] = m([]);
|
|
238
241
|
f(() => {
|
|
239
|
-
if (!C ||
|
|
240
|
-
|
|
242
|
+
if (!C || K.length === 0) {
|
|
243
|
+
q([]);
|
|
241
244
|
return;
|
|
242
245
|
}
|
|
243
|
-
let e =
|
|
246
|
+
let e = L ? u(I) : null;
|
|
244
247
|
if (!e) {
|
|
245
|
-
|
|
248
|
+
q([]);
|
|
246
249
|
return;
|
|
247
250
|
}
|
|
248
251
|
let t = !1;
|
|
249
252
|
return (async () => {
|
|
250
253
|
try {
|
|
251
|
-
let n = await
|
|
254
|
+
let n = await xe(ie, {
|
|
252
255
|
storeSlug: C,
|
|
253
256
|
schedule: e,
|
|
254
|
-
products:
|
|
255
|
-
}), r =
|
|
257
|
+
products: K
|
|
258
|
+
}), r = se.parse(n);
|
|
256
259
|
if (t) return;
|
|
257
|
-
|
|
260
|
+
q(r.success ? r.availability ?? [] : []);
|
|
258
261
|
} catch (e) {
|
|
259
262
|
if (t) return;
|
|
260
263
|
console.error("Failed to load storefront cart availability", e);
|
|
@@ -263,42 +266,42 @@ function S() {
|
|
|
263
266
|
t = !0;
|
|
264
267
|
};
|
|
265
268
|
}, [
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
I.end_date,
|
|
270
|
+
I.end_time,
|
|
271
|
+
I.start_date,
|
|
272
|
+
I.start_time,
|
|
273
|
+
L,
|
|
274
|
+
K,
|
|
272
275
|
C
|
|
273
276
|
]);
|
|
274
|
-
let
|
|
275
|
-
...
|
|
276
|
-
lines:
|
|
277
|
-
let t =
|
|
277
|
+
let gt = p(() => new Map(ht.map((e) => [c(e.productId, e.productVariantId), e])), [ht]), _t = p(() => ({
|
|
278
|
+
...G,
|
|
279
|
+
lines: G.lines.map((e) => {
|
|
280
|
+
let t = gt.get(c(e.checkoutProductId, e.productVariantId)), n = t ? ae(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
278
281
|
return {
|
|
279
282
|
...e,
|
|
280
283
|
insufficientCapacity: n !== void 0,
|
|
281
284
|
availabilityIssue: n
|
|
282
285
|
};
|
|
283
286
|
})
|
|
284
|
-
}), [
|
|
285
|
-
...
|
|
286
|
-
start_time:
|
|
287
|
-
end_time:
|
|
288
|
-
}).toString(),
|
|
287
|
+
}), [gt, G]), J = e(new URLSearchParams(), {
|
|
288
|
+
...I,
|
|
289
|
+
start_time: R,
|
|
290
|
+
end_time: z
|
|
291
|
+
}).toString(), Y = L && u(I) !== null, vt = `/${C ?? ""}${J ? `?${J}` : ""}`, yt = `/${C ?? ""}/booking${J ? `?${J}` : ""}`, X = `/${C ?? ""}/checkout${J ? `?${J}` : ""}`, bt = { backTo: `${w.pathname}${w.search}${w.hash}` }, [xt, St] = m(null), Ct = U.findIndex((e) => e.id === xt), Z = k.get(y)?.trim() ?? "", Q = Z ? U.find((e) => e.id === Z) ?? ct.find((e) => e.id === Z) ?? null : null, $ = (e) => {
|
|
289
292
|
let t = new URLSearchParams(k);
|
|
290
293
|
e?.trim() ? t.set(y, e) : t.delete(y), A(t, { replace: !0 });
|
|
291
|
-
},
|
|
292
|
-
x(e) &&
|
|
293
|
-
},
|
|
294
|
-
if (!
|
|
294
|
+
}, wt = (e) => {
|
|
295
|
+
x(e) && $(e.id);
|
|
296
|
+
}, Tt = (e, t, n = 1) => {
|
|
297
|
+
if (!Y) return;
|
|
295
298
|
let r = Math.max(1, Math.floor(n));
|
|
296
|
-
|
|
299
|
+
Ye({
|
|
297
300
|
kind: e.kind,
|
|
298
301
|
productId: s(e),
|
|
299
302
|
...t ? { productVariantId: t } : {},
|
|
300
303
|
quantity: r
|
|
301
|
-
}),
|
|
304
|
+
}), pe.success(v("product_added_to_cart_successfully", {
|
|
302
305
|
quantity: r,
|
|
303
306
|
productName: ee({
|
|
304
307
|
product: e,
|
|
@@ -307,16 +310,16 @@ function S() {
|
|
|
307
310
|
fallbackLanguage: E
|
|
308
311
|
})
|
|
309
312
|
}));
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
+
}, Et = (e) => {
|
|
314
|
+
wt(e);
|
|
315
|
+
}, Dt = (e) => {
|
|
313
316
|
let t = e.productVariants ?? [], n = x(e);
|
|
314
317
|
if (n) {
|
|
315
318
|
if (t.length > 1) {
|
|
316
|
-
|
|
319
|
+
wt(e);
|
|
317
320
|
return;
|
|
318
321
|
}
|
|
319
|
-
|
|
322
|
+
Tt(e, n);
|
|
320
323
|
}
|
|
321
324
|
};
|
|
322
325
|
return /* @__PURE__ */ g("div", {
|
|
@@ -324,28 +327,28 @@ function S() {
|
|
|
324
327
|
children: [/* @__PURE__ */ g("div", {
|
|
325
328
|
className: "flex flex-col gap-4",
|
|
326
329
|
children: [
|
|
327
|
-
/* @__PURE__ */ h(
|
|
330
|
+
/* @__PURE__ */ h(he, {
|
|
328
331
|
currentStep: "booking",
|
|
329
|
-
bookingPath:
|
|
330
|
-
checkoutPath:
|
|
331
|
-
checkoutEnabled: j > 0 &&
|
|
332
|
+
bookingPath: yt,
|
|
333
|
+
checkoutPath: X,
|
|
334
|
+
checkoutEnabled: j > 0 && Y
|
|
332
335
|
}),
|
|
333
336
|
/* @__PURE__ */ g("div", {
|
|
334
337
|
className: "flex items-center justify-between gap-3",
|
|
335
338
|
children: [/* @__PURE__ */ g(_, {
|
|
336
|
-
to:
|
|
339
|
+
to: vt,
|
|
337
340
|
className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
|
|
338
|
-
children: [/* @__PURE__ */ h(
|
|
341
|
+
children: [/* @__PURE__ */ h(Ne, {
|
|
339
342
|
className: "h-4 w-4",
|
|
340
343
|
"aria-hidden": "true"
|
|
341
344
|
}), /* @__PURE__ */ h("span", { children: v("back_to_home") })]
|
|
342
345
|
}), /* @__PURE__ */ h(_, {
|
|
343
|
-
to:
|
|
344
|
-
className:
|
|
345
|
-
children: /* @__PURE__ */ g(
|
|
346
|
+
to: X,
|
|
347
|
+
className: Me(j > 0 && Y ? "inline-flex" : "hidden"),
|
|
348
|
+
children: /* @__PURE__ */ g(le, {
|
|
346
349
|
size: "sm",
|
|
347
350
|
className: "gap-2",
|
|
348
|
-
children: [/* @__PURE__ */ h(
|
|
351
|
+
children: [/* @__PURE__ */ h(Ie, {
|
|
349
352
|
className: "h-4 w-4",
|
|
350
353
|
"aria-hidden": "true"
|
|
351
354
|
}), /* @__PURE__ */ h("span", { children: v("checkout_button") })]
|
|
@@ -366,28 +369,28 @@ function S() {
|
|
|
366
369
|
stepNumber: 1,
|
|
367
370
|
title: v("booking_summary_title")
|
|
368
371
|
}),
|
|
369
|
-
/* @__PURE__ */ h(
|
|
370
|
-
...
|
|
372
|
+
/* @__PURE__ */ h(me, {
|
|
373
|
+
...mt,
|
|
371
374
|
className: "gap-3",
|
|
372
375
|
labelClassName: "text-xs font-medium text-slate-700",
|
|
373
376
|
inputClassName: "h-10"
|
|
374
377
|
}),
|
|
375
|
-
/* @__PURE__ */ h(
|
|
376
|
-
value:
|
|
377
|
-
onValueChange: (e) =>
|
|
378
|
-
pickupAddress:
|
|
378
|
+
/* @__PURE__ */ h(Ce, {
|
|
379
|
+
value: I.fulfillment,
|
|
380
|
+
onValueChange: (e) => W({ fulfillment: e }),
|
|
381
|
+
pickupAddress: et,
|
|
379
382
|
deliveryEnabled: N,
|
|
380
|
-
deliveryDisabledReason:
|
|
381
|
-
startAddress:
|
|
382
|
-
onStartAddressChange: (e) =>
|
|
383
|
-
endAddress:
|
|
384
|
-
onEndAddressChange: (e) =>
|
|
383
|
+
deliveryDisabledReason: $e,
|
|
384
|
+
startAddress: I.start_address,
|
|
385
|
+
onStartAddressChange: (e) => W({ start_address: e }),
|
|
386
|
+
endAddress: I.end_address,
|
|
387
|
+
onEndAddressChange: (e) => W({ end_address: e }),
|
|
385
388
|
testIdPrefix: "storefront-booking-fulfillment"
|
|
386
389
|
})
|
|
387
390
|
]
|
|
388
391
|
}),
|
|
389
392
|
/* @__PURE__ */ g("div", {
|
|
390
|
-
ref:
|
|
393
|
+
ref: Ge,
|
|
391
394
|
id: "booking-products",
|
|
392
395
|
className: "space-y-2 scroll-mt-32",
|
|
393
396
|
children: [/* @__PURE__ */ h(d, {
|
|
@@ -400,20 +403,20 @@ function S() {
|
|
|
400
403
|
}),
|
|
401
404
|
/* @__PURE__ */ h("div", {
|
|
402
405
|
className: "grid gap-4 md:grid-cols-2",
|
|
403
|
-
children:
|
|
404
|
-
let n = `/${C ?? ""}/products/${e.slug}`, r = !!x(e) ||
|
|
405
|
-
return /* @__PURE__ */ h(
|
|
406
|
+
children: U.map((e, t) => {
|
|
407
|
+
let n = `/${C ?? ""}/products/${e.slug}`, r = !!x(e) || ut(e);
|
|
408
|
+
return /* @__PURE__ */ h(we, {
|
|
406
409
|
bike: e,
|
|
407
410
|
detailsPath: n,
|
|
408
|
-
productDetailsLinkState:
|
|
409
|
-
onAction: () =>
|
|
410
|
-
actionDisabled: !r || !
|
|
411
|
+
productDetailsLinkState: bt,
|
|
412
|
+
onAction: () => Et(e),
|
|
413
|
+
actionDisabled: !r || !Y,
|
|
411
414
|
fallbackLanguage: E,
|
|
412
|
-
dimOnColumnCount:
|
|
413
|
-
onQuickAdd: (t, n) =>
|
|
414
|
-
onHoverStart: () =>
|
|
415
|
+
dimOnColumnCount: Le(Ct, t),
|
|
416
|
+
onQuickAdd: (t, n) => Tt(e, t, n),
|
|
417
|
+
onHoverStart: () => St(e.id),
|
|
415
418
|
onHoverEnd: () => {
|
|
416
|
-
|
|
419
|
+
St((t) => t === e.id ? null : t);
|
|
417
420
|
},
|
|
418
421
|
testId: `storefront-booking-bike-card-${e.id}`.toLowerCase()
|
|
419
422
|
}, e.id);
|
|
@@ -431,16 +434,16 @@ function S() {
|
|
|
431
434
|
}),
|
|
432
435
|
/* @__PURE__ */ h("div", {
|
|
433
436
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
434
|
-
children:
|
|
435
|
-
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 =
|
|
436
|
-
return /* @__PURE__ */ h(
|
|
437
|
+
children: ct.map((e) => {
|
|
438
|
+
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 = be(e.primaryImageStyle), s = `/${C ?? ""}/products/${e.slug}`, ee = x(e), te = e.availabilityStatus === "OUT_OF_STOCK", ne = !!ee || ut(e);
|
|
439
|
+
return /* @__PURE__ */ h(ge, {
|
|
437
440
|
"data-testid": `storefront-booking-accessory-card-${e.id}`.toLowerCase(),
|
|
438
441
|
className: "h-full border-slate-200 bg-white shadow-sm transition-[border-color,box-shadow] duration-200 hover:border-primary/20 hover:shadow-md",
|
|
439
442
|
children: /* @__PURE__ */ g("div", {
|
|
440
443
|
className: "flex h-full flex-col gap-2 p-3",
|
|
441
444
|
children: [
|
|
442
445
|
/* @__PURE__ */ g("div", {
|
|
443
|
-
className:
|
|
446
|
+
className: Me("relative aspect-[1618/1000] overflow-hidden rounded-xl", a.className),
|
|
444
447
|
style: a.style,
|
|
445
448
|
children: [i ? /* @__PURE__ */ h("img", {
|
|
446
449
|
src: i,
|
|
@@ -449,11 +452,11 @@ function S() {
|
|
|
449
452
|
loading: "lazy"
|
|
450
453
|
}) : /* @__PURE__ */ h("div", {
|
|
451
454
|
className: "absolute inset-0 flex items-center justify-center text-slate-400",
|
|
452
|
-
children: /* @__PURE__ */ h(
|
|
455
|
+
children: /* @__PURE__ */ h(Pe, {
|
|
453
456
|
className: "h-8 w-8",
|
|
454
457
|
"aria-hidden": "true"
|
|
455
458
|
})
|
|
456
|
-
}), te ? /* @__PURE__ */ h(
|
|
459
|
+
}), te ? /* @__PURE__ */ h(ce, {
|
|
457
460
|
variant: "destructive",
|
|
458
461
|
className: "pointer-events-none absolute right-2 top-2 shadow-sm",
|
|
459
462
|
children: /* @__PURE__ */ h("span", { children: v("availability_out_of_stock") })
|
|
@@ -467,7 +470,7 @@ function S() {
|
|
|
467
470
|
children: [/* @__PURE__ */ h("p", {
|
|
468
471
|
className: "min-w-0 text-sm font-semibold text-slate-950",
|
|
469
472
|
children: /* @__PURE__ */ h("span", { children: t })
|
|
470
|
-
}), /* @__PURE__ */ h(
|
|
473
|
+
}), /* @__PURE__ */ h(ye, {
|
|
471
474
|
prices: e.prices,
|
|
472
475
|
className: "shrink-0",
|
|
473
476
|
openOnHover: !1
|
|
@@ -477,7 +480,7 @@ function S() {
|
|
|
477
480
|
className: "line-clamp-2 text-xs text-slate-600",
|
|
478
481
|
children: /* @__PURE__ */ h("span", { children: n })
|
|
479
482
|
}),
|
|
480
|
-
/* @__PURE__ */ h(
|
|
483
|
+
/* @__PURE__ */ h(_e, {
|
|
481
484
|
warning: r,
|
|
482
485
|
className: "mt-1"
|
|
483
486
|
})
|
|
@@ -487,16 +490,16 @@ function S() {
|
|
|
487
490
|
className: "mt-auto flex items-center gap-2",
|
|
488
491
|
children: [/* @__PURE__ */ h(_, {
|
|
489
492
|
to: s,
|
|
490
|
-
state:
|
|
493
|
+
state: bt,
|
|
491
494
|
className: "text-xs font-medium text-slate-700 hover:text-slate-950",
|
|
492
495
|
children: /* @__PURE__ */ h("span", { children: v("product_details_link") })
|
|
493
|
-
}), /* @__PURE__ */ g(
|
|
496
|
+
}), /* @__PURE__ */ g(le, {
|
|
494
497
|
type: "button",
|
|
495
498
|
size: "sm",
|
|
496
499
|
className: "ml-auto gap-2",
|
|
497
|
-
onClick: () =>
|
|
498
|
-
disabled: !ne || !
|
|
499
|
-
children: [/* @__PURE__ */ h("span", { children: v("add_to_cart") }), /* @__PURE__ */ h(
|
|
500
|
+
onClick: () => Dt(e),
|
|
501
|
+
disabled: !ne || !Y,
|
|
502
|
+
children: [/* @__PURE__ */ h("span", { children: v("add_to_cart") }), /* @__PURE__ */ h(Fe, {
|
|
500
503
|
className: "h-4 w-4",
|
|
501
504
|
"aria-hidden": "true"
|
|
502
505
|
})]
|
|
@@ -511,31 +514,32 @@ function S() {
|
|
|
511
514
|
})
|
|
512
515
|
}), /* @__PURE__ */ h("div", {
|
|
513
516
|
className: "lg:col-span-4",
|
|
514
|
-
children: /* @__PURE__ */ h(
|
|
515
|
-
lines:
|
|
517
|
+
children: /* @__PURE__ */ h(ve, {
|
|
518
|
+
lines: _t.lines,
|
|
516
519
|
itemCount: j,
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
+
totalPerBaseUnitMinor: _t.totalPerBaseUnitMinor,
|
|
521
|
+
baseUnitLabel: tt,
|
|
522
|
+
checkoutPath: X,
|
|
523
|
+
showCheckoutAction: Y,
|
|
520
524
|
editable: !0,
|
|
521
525
|
stickyTopClassName: "top-32",
|
|
522
|
-
onQuantityChange:
|
|
523
|
-
onRemove:
|
|
526
|
+
onQuantityChange: Ze,
|
|
527
|
+
onRemove: Xe
|
|
524
528
|
})
|
|
525
529
|
})]
|
|
526
530
|
})
|
|
527
531
|
]
|
|
528
|
-
}), /* @__PURE__ */ h(
|
|
529
|
-
open: !!
|
|
530
|
-
product:
|
|
532
|
+
}), /* @__PURE__ */ h(Te, {
|
|
533
|
+
open: !!Q,
|
|
534
|
+
product: Q,
|
|
531
535
|
onOpenChange: (e) => {
|
|
532
|
-
e ||
|
|
536
|
+
e || $(null);
|
|
533
537
|
},
|
|
534
|
-
getVariantAvailabilityLabel: (e) =>
|
|
535
|
-
isVariantOutOfCapacity: (e) =>
|
|
536
|
-
addDisabled: !
|
|
538
|
+
getVariantAvailabilityLabel: (e) => Q ? dt(Q, e) : null,
|
|
539
|
+
isVariantOutOfCapacity: (e) => Q ? lt(Q, e) : !1,
|
|
540
|
+
addDisabled: !Y,
|
|
537
541
|
onAddVariant: (e, t) => {
|
|
538
|
-
|
|
542
|
+
Q && (Tt(Q, e, t), $(null));
|
|
539
543
|
}
|
|
540
544
|
})]
|
|
541
545
|
});
|