@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
|
@@ -16,22 +16,26 @@ var t = e.object({
|
|
|
16
16
|
quantity: e.number().positive(),
|
|
17
17
|
currency: e.string().trim().min(1).optional()
|
|
18
18
|
}), o = e.object({
|
|
19
|
+
enabled: e.boolean(),
|
|
20
|
+
pricePerDayMinor: e.number().int().min(0),
|
|
21
|
+
deductibleAmountMinor: e.number().int().min(0).default(0)
|
|
22
|
+
}), s = e.object({
|
|
19
23
|
kind: e.string().trim().min(1),
|
|
20
24
|
value: e.string().trim().min(1)
|
|
21
|
-
}),
|
|
25
|
+
}), c = e.object({
|
|
22
26
|
key: e.string().trim().min(1),
|
|
23
27
|
label: e.string().trim().min(1).optional(),
|
|
24
28
|
value: e.string().trim().min(1)
|
|
25
|
-
}),
|
|
29
|
+
}), l = e.object({
|
|
26
30
|
id: e.string().trim().min(1),
|
|
27
31
|
computedName: e.string().trim().min(1),
|
|
28
|
-
attributes: e.array(
|
|
29
|
-
identifiers: e.array(
|
|
30
|
-
}),
|
|
32
|
+
attributes: e.array(c).default([]),
|
|
33
|
+
identifiers: e.array(s).default([])
|
|
34
|
+
}), u = e.enum([
|
|
31
35
|
"AVAILABLE",
|
|
32
36
|
"LOW_STOCK",
|
|
33
37
|
"OUT_OF_STOCK"
|
|
34
|
-
]),
|
|
38
|
+
]), d = e.enum(["bike", "e-bike"]), f = e.string().trim().min(1), p = e.enum(["variant_selector", "variants_as_products"]), m = e.object({
|
|
35
39
|
bgMode: e.enum([
|
|
36
40
|
"transparent",
|
|
37
41
|
"solid",
|
|
@@ -41,45 +45,46 @@ var t = e.object({
|
|
|
41
45
|
needsLightBorder: e.boolean().default(!1),
|
|
42
46
|
confidence: e.number().min(0).max(1).optional(),
|
|
43
47
|
analyzerVersion: e.number().int().min(1).optional()
|
|
44
|
-
}).refine((e) => e.bgMode !== "solid" || !!e.bgColor, { message: "bgColor is required when bgMode is solid." }),
|
|
48
|
+
}).refine((e) => e.bgMode !== "solid" || !!e.bgColor, { message: "bgColor is required when bgMode is solid." }), h = e.object({
|
|
45
49
|
id: e.string().trim().min(1),
|
|
46
50
|
checkoutProductId: e.string().trim().min(1).optional(),
|
|
47
51
|
representedVariantId: e.string().trim().min(1).optional(),
|
|
48
|
-
slug:
|
|
49
|
-
kind:
|
|
52
|
+
slug: f,
|
|
53
|
+
kind: d.optional(),
|
|
50
54
|
name: n,
|
|
51
55
|
description: n.optional(),
|
|
52
56
|
warning: n.optional(),
|
|
53
57
|
images: e.array(e.string().trim().min(1)).optional(),
|
|
54
|
-
primaryImageStyle:
|
|
58
|
+
primaryImageStyle: m.optional(),
|
|
55
59
|
prices: e.array(a).optional(),
|
|
60
|
+
insurance: o.optional(),
|
|
56
61
|
features: e.array(n).optional(),
|
|
57
|
-
productVariants: e.array(
|
|
58
|
-
storefrontDisplayMode:
|
|
59
|
-
availabilityStatus:
|
|
60
|
-
}),
|
|
62
|
+
productVariants: e.array(l).min(1),
|
|
63
|
+
storefrontDisplayMode: p.default("variant_selector"),
|
|
64
|
+
availabilityStatus: u.optional()
|
|
65
|
+
}), g = e.object({
|
|
61
66
|
id: e.string().trim().min(1),
|
|
62
67
|
checkoutProductId: e.string().trim().min(1).optional(),
|
|
63
68
|
representedVariantId: e.string().trim().min(1).optional(),
|
|
64
|
-
slug:
|
|
69
|
+
slug: f,
|
|
65
70
|
name: n,
|
|
66
71
|
description: n.optional(),
|
|
67
72
|
warning: n.optional(),
|
|
68
73
|
images: e.array(e.string().trim().min(1)).optional(),
|
|
69
|
-
primaryImageStyle:
|
|
74
|
+
primaryImageStyle: m.optional(),
|
|
70
75
|
prices: e.array(a),
|
|
71
76
|
features: e.array(n).optional(),
|
|
72
|
-
productVariants: e.array(
|
|
73
|
-
storefrontDisplayMode:
|
|
74
|
-
}),
|
|
77
|
+
productVariants: e.array(l).min(1),
|
|
78
|
+
storefrontDisplayMode: p.default("variant_selector")
|
|
79
|
+
}), _ = "/api/public/storefront/products", v = e.object({ storeSlug: e.string().trim().min(1).toLowerCase() }), y = e.discriminatedUnion("success", [e.object({
|
|
75
80
|
success: e.literal(!0),
|
|
76
81
|
products: e.object({
|
|
77
|
-
bikes: e.array(
|
|
78
|
-
accessories: e.array(
|
|
82
|
+
bikes: e.array(h).default([]),
|
|
83
|
+
accessories: e.array(g).default([])
|
|
79
84
|
})
|
|
80
85
|
}), e.object({
|
|
81
86
|
success: e.literal(!1),
|
|
82
87
|
message: e.string().optional()
|
|
83
88
|
})]);
|
|
84
89
|
//#endregion
|
|
85
|
-
export {
|
|
90
|
+
export { _ as ROUTE, v as requestSchema, y as responseSchema, g as storefrontPublicAccessoryProductSchema, u as storefrontPublicBikeAvailabilityStatusSchema, d as storefrontPublicBikeKindSchema, h as storefrontPublicBikeProductSchema, m as storefrontPublicImageStyleSchema, p as storefrontPublicProductDisplayModeSchema, o as storefrontPublicProductInsuranceSchema, a as storefrontPublicProductPriceSchema, f as storefrontPublicProductSlugSchema, c as storefrontPublicProductVariantAttributeSchema, s as storefrontPublicProductVariantIdentifierSchema, l as storefrontPublicProductVariantSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BookingPage.d.ts","sourceRoot":"","sources":["../../src/pages/BookingPage.tsx"],"names":[],"mappings":"AA4QA,MAAM,CAAC,OAAO,UAAU,WAAW,4CA6lBlC"}
|
|
@@ -69,20 +69,20 @@ var D = (e) => String(e).padStart(2, "0"), O = "product_modal", De = (e) => `${e
|
|
|
69
69
|
}
|
|
70
70
|
return Array.from(t.values());
|
|
71
71
|
};
|
|
72
|
-
function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: c }) {
|
|
73
|
-
let { t:
|
|
72
|
+
function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCancel: i, getVariantAvailabilityLabel: a, isVariantOutOfCapacity: c, confirmDisabled: l = !1 }) {
|
|
73
|
+
let { t: u } = Se(), d = e.productVariants ?? [];
|
|
74
74
|
return /* @__PURE__ */ w("div", {
|
|
75
75
|
className: "grid gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3",
|
|
76
76
|
children: [
|
|
77
77
|
/* @__PURE__ */ C("p", {
|
|
78
78
|
className: "text-xs font-medium text-slate-700",
|
|
79
|
-
children: /* @__PURE__ */ C("span", { children:
|
|
79
|
+
children: /* @__PURE__ */ C("span", { children: d.some((e) => !!o(e, "size")) ? u("product_size_label") : u("product_variant_label") })
|
|
80
80
|
}),
|
|
81
81
|
/* @__PURE__ */ C(v, {
|
|
82
82
|
value: t,
|
|
83
83
|
onValueChange: n,
|
|
84
84
|
className: "grid gap-2",
|
|
85
|
-
children:
|
|
85
|
+
children: d.map((n) => {
|
|
86
86
|
let r = `booking-variant-${e.id}-${n.id}`.toLowerCase(), i = `storefront-booking-variant-option-${e.id}-${n.id}`.toLowerCase(), { label: o, description: l } = s(n), u = c(n.id), d = a(n.id);
|
|
87
87
|
return /* @__PURE__ */ w("label", {
|
|
88
88
|
htmlFor: r,
|
|
@@ -121,8 +121,9 @@ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCan
|
|
|
121
121
|
type: "button",
|
|
122
122
|
size: "sm",
|
|
123
123
|
className: "rounded-full gap-2",
|
|
124
|
+
disabled: l,
|
|
124
125
|
onClick: r,
|
|
125
|
-
children: [/* @__PURE__ */ C("span", { children:
|
|
126
|
+
children: [/* @__PURE__ */ C("span", { children: u("add_to_cart") }), /* @__PURE__ */ C(we, {
|
|
126
127
|
className: "h-4 w-4",
|
|
127
128
|
"aria-hidden": "true"
|
|
128
129
|
})]
|
|
@@ -132,21 +133,19 @@ function Pe({ product: e, selectedVariantId: t, onSelect: n, onConfirm: r, onCan
|
|
|
132
133
|
variant: "outline",
|
|
133
134
|
className: "rounded-full",
|
|
134
135
|
onClick: i,
|
|
135
|
-
children: /* @__PURE__ */ C("span", { children:
|
|
136
|
+
children: /* @__PURE__ */ C("span", { children: u("booking_select_variant_cancel") })
|
|
136
137
|
})]
|
|
137
138
|
})
|
|
138
139
|
]
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
142
|
function j() {
|
|
142
|
-
let { t: o, i18n: s } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), j = D.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = ce(), { bikes: M, accessories: N } = se(), [P, F] = xe(), { items: Le, itemCount: I, addItem: Re, clear: ze, removeItem: Be, setQuantity: Ve } = l(), He = x(() => t(D), [D]), L = x(() => r(D), [D]), R = D.settings.fulfillmentModes.includes("delivery"), Ue = D.settings.deliveryDisabledReason.trim(), We = D.shop.address?.trim() ?? "", z = x(() => i(P, v), [P, v]), [B, Ge] = S(() => ke(n(z, L), R));
|
|
143
|
+
let { t: o, i18n: s } = Se(), { storeSlug: v } = be(), y = ye(), { storefrontConfiguration: D } = oe(), j = D.workspace?.workspaceLanguage, { bikes: Fe, accessories: Ie } = ce(), { bikes: M, accessories: N } = se(), [P, F] = xe(), { items: Le, itemCount: I, addItem: Re, clear: ze, removeItem: Be, setQuantity: Ve } = l(), He = x(() => t(D), [D]), L = x(() => r(D), [D]), R = D.settings.fulfillmentModes.includes("delivery"), Ue = D.settings.deliveryDisabledReason.trim(), We = D.shop.address?.trim() ?? "", z = x(() => i(P, v), [P, v]), [B, Ge] = S(() => ke(n(z, L), R)), [Ke, qe] = S(void 0);
|
|
143
144
|
b(() => {
|
|
144
145
|
Ge((e) => {
|
|
145
146
|
let t = {
|
|
146
147
|
...L,
|
|
147
|
-
...e
|
|
148
|
-
start_time: e.start_time.trim() ? e.start_time : L.start_time,
|
|
149
|
-
end_time: e.end_time.trim() ? e.end_time : L.end_time
|
|
148
|
+
...e
|
|
150
149
|
}, r = ke(n(z, t), R);
|
|
151
150
|
return Oe(e, r) ? e : r;
|
|
152
151
|
});
|
|
@@ -164,14 +163,17 @@ function j() {
|
|
|
164
163
|
]), b(() => {
|
|
165
164
|
a(v, B);
|
|
166
165
|
}, [B, v]);
|
|
167
|
-
let V = x(() => Ne([...M, ...N]), [N, M]), [
|
|
166
|
+
let V = x(() => Ne([...M, ...N]), [N, M]), [Je, H] = S([]);
|
|
168
167
|
b(() => {
|
|
169
168
|
if (!v || V.length === 0) {
|
|
170
|
-
|
|
169
|
+
H([]);
|
|
171
170
|
return;
|
|
172
171
|
}
|
|
173
172
|
let e = h(B);
|
|
174
|
-
if (!e)
|
|
173
|
+
if (!e) {
|
|
174
|
+
H([]);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
175
177
|
let t = !1;
|
|
176
178
|
return (async () => {
|
|
177
179
|
try {
|
|
@@ -181,7 +183,7 @@ function j() {
|
|
|
181
183
|
products: V
|
|
182
184
|
}), r = ne.parse(n);
|
|
183
185
|
if (t) return;
|
|
184
|
-
|
|
186
|
+
H(r.success ? r.availability ?? [] : []);
|
|
185
187
|
} catch (e) {
|
|
186
188
|
if (t) return;
|
|
187
189
|
console.error("Failed to load storefront availability", e);
|
|
@@ -197,27 +199,31 @@ function j() {
|
|
|
197
199
|
B.start_time,
|
|
198
200
|
v
|
|
199
201
|
]);
|
|
200
|
-
let
|
|
201
|
-
let t = Ae(e,
|
|
202
|
+
let U = x(() => new Map(Je.map((e) => [p(e.productId, e.productVariantId), e])), [Je]), Ye = x(() => M.map((e) => {
|
|
203
|
+
let t = Ae(e, U);
|
|
202
204
|
return {
|
|
203
205
|
...e,
|
|
204
206
|
availabilityStatus: t ? m(t) : e.availabilityStatus ?? "AVAILABLE"
|
|
205
207
|
};
|
|
206
|
-
}), [
|
|
207
|
-
let n = je(e, t,
|
|
208
|
+
}), [U, M]), Xe = (e, t) => {
|
|
209
|
+
let n = je(e, t, U);
|
|
208
210
|
return n ? te(n) : e.availabilityStatus === "OUT_OF_STOCK";
|
|
209
|
-
},
|
|
210
|
-
let n = je(e, t,
|
|
211
|
+
}, Ze = (e) => (e.productVariants ?? []).length > 0, Qe = (e, t) => {
|
|
212
|
+
let n = je(e, t, U);
|
|
211
213
|
return n ? Me(o, n, m(n)) : e.availabilityStatus === "OUT_OF_STOCK" ? o("availability_out_of_stock") : null;
|
|
212
|
-
},
|
|
214
|
+
}, $e = ge(v), et = x(() => ({
|
|
213
215
|
startDate: o("booking_start_date"),
|
|
214
216
|
pickStartDate: o("booking_start_date"),
|
|
215
217
|
startTime: o("booking_start_time"),
|
|
216
218
|
endDate: o("booking_end_date"),
|
|
217
219
|
pickEndDate: o("booking_end_date"),
|
|
218
220
|
endTime: o("booking_end_time"),
|
|
219
|
-
selectedDaysTooltip: ({ count: e }) => o("booking_selected_days_tooltip", { count: e })
|
|
220
|
-
|
|
221
|
+
selectedDaysTooltip: ({ count: e }) => o("booking_selected_days_tooltip", { count: e }),
|
|
222
|
+
timeSlotsLoading: o("booking_time_slots_loading"),
|
|
223
|
+
timeSlotsUnavailable: o("booking_time_slots_unavailable"),
|
|
224
|
+
timeSlotsLoadError: o("booking_time_slots_load_error"),
|
|
225
|
+
retryTimeSlots: o("booking_time_slots_retry")
|
|
226
|
+
}), [s.language, o]), W = (e) => {
|
|
221
227
|
Ge((t) => {
|
|
222
228
|
let n = {
|
|
223
229
|
...t,
|
|
@@ -225,24 +231,27 @@ function j() {
|
|
|
225
231
|
};
|
|
226
232
|
return Oe(t, n) ? t : n;
|
|
227
233
|
});
|
|
228
|
-
},
|
|
234
|
+
}, tt = `${B.start_date}:${B.end_date}`, nt = {
|
|
229
235
|
startDate: k(B.start_date),
|
|
230
236
|
onStartDateChange: (e) => {
|
|
231
|
-
e &&
|
|
237
|
+
e && W({ start_date: De(e) });
|
|
232
238
|
},
|
|
233
239
|
startTime: B.start_time,
|
|
234
|
-
onStartTimeChange: (e) =>
|
|
240
|
+
onStartTimeChange: (e) => W({ start_time: e }),
|
|
235
241
|
endDate: k(B.end_date) ?? k(B.start_date),
|
|
236
242
|
onEndDateChange: (e) => {
|
|
237
|
-
e &&
|
|
243
|
+
e && W({ end_date: De(e) });
|
|
238
244
|
},
|
|
239
245
|
endTime: B.end_time,
|
|
240
|
-
onEndTimeChange: (e) =>
|
|
246
|
+
onEndTimeChange: (e) => W({ end_time: e }),
|
|
241
247
|
bookingPeriodConfig: He,
|
|
242
|
-
fetchTimeSlots:
|
|
243
|
-
|
|
248
|
+
fetchTimeSlots: $e,
|
|
249
|
+
onTimeSlotsAvailabilityChange: (e) => {
|
|
250
|
+
qe(e ? tt : void 0);
|
|
251
|
+
},
|
|
252
|
+
labels: et,
|
|
244
253
|
localeCode: s.language
|
|
245
|
-
},
|
|
254
|
+
}, G = x(() => d({
|
|
246
255
|
items: Le,
|
|
247
256
|
language: s.language,
|
|
248
257
|
fallbackLanguage: j,
|
|
@@ -256,28 +265,31 @@ function j() {
|
|
|
256
265
|
s.language,
|
|
257
266
|
Le,
|
|
258
267
|
j
|
|
259
|
-
]),
|
|
268
|
+
]), K = x(() => G.lines.map((e) => ({
|
|
260
269
|
productId: e.checkoutProductId,
|
|
261
270
|
productVariantId: e.productVariantId,
|
|
262
271
|
quantity: e.quantity
|
|
263
|
-
})), [
|
|
272
|
+
})), [G.lines]), [rt, q] = S([]);
|
|
264
273
|
b(() => {
|
|
265
|
-
if (!v ||
|
|
266
|
-
|
|
274
|
+
if (!v || K.length === 0) {
|
|
275
|
+
q([]);
|
|
267
276
|
return;
|
|
268
277
|
}
|
|
269
278
|
let e = h(B);
|
|
270
|
-
if (!e)
|
|
279
|
+
if (!e) {
|
|
280
|
+
q([]);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
271
283
|
let t = !1;
|
|
272
284
|
return (async () => {
|
|
273
285
|
try {
|
|
274
286
|
let n = await he(f, {
|
|
275
287
|
storeSlug: v,
|
|
276
288
|
schedule: e,
|
|
277
|
-
products:
|
|
289
|
+
products: K
|
|
278
290
|
}), r = ne.parse(n);
|
|
279
291
|
if (t) return;
|
|
280
|
-
|
|
292
|
+
q(r.success ? r.availability ?? [] : []);
|
|
281
293
|
} catch (e) {
|
|
282
294
|
if (t) return;
|
|
283
295
|
console.error("Failed to load storefront cart availability", e);
|
|
@@ -290,59 +302,59 @@ function j() {
|
|
|
290
302
|
B.end_time,
|
|
291
303
|
B.start_date,
|
|
292
304
|
B.start_time,
|
|
293
|
-
|
|
305
|
+
K,
|
|
294
306
|
v
|
|
295
307
|
]);
|
|
296
|
-
let
|
|
297
|
-
...
|
|
298
|
-
lines:
|
|
299
|
-
let t =
|
|
308
|
+
let it = x(() => new Map(rt.map((e) => [p(e.productId, e.productVariantId), e])), [rt]), at = x(() => ({
|
|
309
|
+
...G,
|
|
310
|
+
lines: G.lines.map((e) => {
|
|
311
|
+
let t = it.get(p(e.checkoutProductId, e.productVariantId)), n = t ? ee(t) : e.availabilityStatus === "OUT_OF_STOCK" ? "unavailable" : void 0;
|
|
300
312
|
return {
|
|
301
313
|
...e,
|
|
302
314
|
insufficientCapacity: n !== void 0,
|
|
303
315
|
availabilityIssue: n
|
|
304
316
|
};
|
|
305
317
|
})
|
|
306
|
-
}), [
|
|
307
|
-
let t =
|
|
318
|
+
}), [it, G]), J = e(new URLSearchParams(), B).toString(), Y = Ke === tt && h(B) !== null, ot = `/${v ?? ""}${J ? `?${J}` : ""}`, st = `/${v ?? ""}/booking${J ? `?${J}` : ""}`, X = `/${v ?? ""}/checkout${J ? `?${J}` : ""}`, ct = { backTo: `${y.pathname}${y.search}${y.hash}` }, [lt, Z] = S(null), [ut, dt] = S({}), ft = (e) => {
|
|
319
|
+
let t = ut[e.id];
|
|
308
320
|
return t && e.productVariants?.some((e) => e.id === t) ? t : A(e);
|
|
309
|
-
},
|
|
321
|
+
}, pt = P.get(O)?.trim() ?? "", Q = pt ? Ye.find((e) => e.id === pt) ?? null : null, mt = (e) => {
|
|
310
322
|
let t = new URLSearchParams(P);
|
|
311
323
|
e?.trim() ? t.set(O, e) : t.delete(O), F(t, { replace: !0 });
|
|
312
|
-
},
|
|
324
|
+
}, ht = (e) => {
|
|
313
325
|
let t = A(e);
|
|
314
|
-
t && (
|
|
326
|
+
t && (dt((n) => n[e.id] ? n : {
|
|
315
327
|
...n,
|
|
316
328
|
[e.id]: t
|
|
317
|
-
}),
|
|
318
|
-
},
|
|
319
|
-
A(e) && (
|
|
329
|
+
}), Z(e.id));
|
|
330
|
+
}, gt = (e) => {
|
|
331
|
+
A(e) && (Z(null), mt(e.id));
|
|
320
332
|
}, $ = (e, t, n = 1) => {
|
|
321
|
-
Re({
|
|
333
|
+
Y && Re({
|
|
322
334
|
kind: e.kind,
|
|
323
335
|
productId: c(e),
|
|
324
336
|
...t ? { productVariantId: t } : {},
|
|
325
337
|
quantity: n
|
|
326
338
|
});
|
|
327
|
-
},
|
|
339
|
+
}, _t = (e) => {
|
|
328
340
|
let t = A(e), n = e.productVariants ?? [];
|
|
329
341
|
if (t && n.length <= 1) {
|
|
330
342
|
$(e, t);
|
|
331
343
|
return;
|
|
332
344
|
}
|
|
333
|
-
|
|
334
|
-
},
|
|
335
|
-
let t = e.productVariants ?? [], n =
|
|
345
|
+
gt(e);
|
|
346
|
+
}, vt = (e) => {
|
|
347
|
+
let t = e.productVariants ?? [], n = ft(e);
|
|
336
348
|
if (n) {
|
|
337
349
|
if (t.length > 1) {
|
|
338
|
-
|
|
350
|
+
ht(e);
|
|
339
351
|
return;
|
|
340
352
|
}
|
|
341
353
|
$(e, n);
|
|
342
354
|
}
|
|
343
|
-
},
|
|
344
|
-
let t =
|
|
345
|
-
t && ($(e, t),
|
|
355
|
+
}, yt = (e) => {
|
|
356
|
+
let t = ft(e);
|
|
357
|
+
t && ($(e, t), Z((t) => t === e.id ? null : t));
|
|
346
358
|
};
|
|
347
359
|
return /* @__PURE__ */ w("div", {
|
|
348
360
|
className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
|
|
@@ -351,22 +363,22 @@ function j() {
|
|
|
351
363
|
children: [
|
|
352
364
|
/* @__PURE__ */ C(ae, {
|
|
353
365
|
currentStep: "booking",
|
|
354
|
-
bookingPath:
|
|
355
|
-
checkoutPath:
|
|
356
|
-
checkoutEnabled: I > 0
|
|
366
|
+
bookingPath: st,
|
|
367
|
+
checkoutPath: X,
|
|
368
|
+
checkoutEnabled: I > 0 && Y
|
|
357
369
|
}),
|
|
358
370
|
/* @__PURE__ */ w("div", {
|
|
359
371
|
className: "flex items-center justify-between gap-3",
|
|
360
372
|
children: [/* @__PURE__ */ w(E, {
|
|
361
|
-
to:
|
|
373
|
+
to: ot,
|
|
362
374
|
className: "inline-flex items-center gap-2 text-sm font-medium text-slate-700 hover:text-slate-950",
|
|
363
375
|
children: [/* @__PURE__ */ C(Ce, {
|
|
364
376
|
className: "h-4 w-4",
|
|
365
377
|
"aria-hidden": "true"
|
|
366
378
|
}), /* @__PURE__ */ C("span", { children: o("back_to_home") })]
|
|
367
379
|
}), /* @__PURE__ */ C(E, {
|
|
368
|
-
to:
|
|
369
|
-
className: T(I > 0 ? "inline-flex" : "hidden"),
|
|
380
|
+
to: X,
|
|
381
|
+
className: T(I > 0 && Y ? "inline-flex" : "hidden"),
|
|
370
382
|
children: /* @__PURE__ */ w(g, {
|
|
371
383
|
size: "sm",
|
|
372
384
|
className: "gap-2",
|
|
@@ -392,21 +404,21 @@ function j() {
|
|
|
392
404
|
title: o("booking_summary_title")
|
|
393
405
|
}),
|
|
394
406
|
/* @__PURE__ */ C(ie, {
|
|
395
|
-
...
|
|
407
|
+
...nt,
|
|
396
408
|
className: "gap-3",
|
|
397
409
|
labelClassName: "text-xs font-medium text-slate-700",
|
|
398
410
|
inputClassName: "h-10"
|
|
399
411
|
}),
|
|
400
412
|
/* @__PURE__ */ C(_e, {
|
|
401
413
|
value: B.fulfillment,
|
|
402
|
-
onValueChange: (e) =>
|
|
414
|
+
onValueChange: (e) => W({ fulfillment: e }),
|
|
403
415
|
pickupAddress: We,
|
|
404
416
|
deliveryEnabled: R,
|
|
405
417
|
deliveryDisabledReason: Ue,
|
|
406
418
|
startAddress: B.start_address,
|
|
407
|
-
onStartAddressChange: (e) =>
|
|
419
|
+
onStartAddressChange: (e) => W({ start_address: e }),
|
|
408
420
|
endAddress: B.end_address,
|
|
409
|
-
onEndAddressChange: (e) =>
|
|
421
|
+
onEndAddressChange: (e) => W({ end_address: e }),
|
|
410
422
|
testIdPrefix: "storefront-booking-fulfillment"
|
|
411
423
|
})
|
|
412
424
|
]
|
|
@@ -424,15 +436,15 @@ function j() {
|
|
|
424
436
|
}),
|
|
425
437
|
/* @__PURE__ */ C("div", {
|
|
426
438
|
className: "grid gap-4 md:grid-cols-2",
|
|
427
|
-
children:
|
|
428
|
-
let t = `/${v ?? ""}/products/${e.slug}`, n = !!A(e) ||
|
|
439
|
+
children: Ye.map((e) => {
|
|
440
|
+
let t = `/${v ?? ""}/products/${e.slug}`, n = !!A(e) || Ze(e);
|
|
429
441
|
return /* @__PURE__ */ C(me, {
|
|
430
442
|
bike: e,
|
|
431
443
|
detailsPath: t,
|
|
432
|
-
productDetailsLinkState:
|
|
444
|
+
productDetailsLinkState: ct,
|
|
433
445
|
actionLabelKey: "add_to_cart",
|
|
434
|
-
onAction: () =>
|
|
435
|
-
actionDisabled: !n,
|
|
446
|
+
onAction: () => _t(e),
|
|
447
|
+
actionDisabled: !n || !Y,
|
|
436
448
|
fallbackLanguage: j,
|
|
437
449
|
variant: "booking",
|
|
438
450
|
testId: `storefront-booking-bike-card-${e.id}`.toLowerCase()
|
|
@@ -452,7 +464,7 @@ function j() {
|
|
|
452
464
|
/* @__PURE__ */ C("div", {
|
|
453
465
|
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
454
466
|
children: N.map((e) => {
|
|
455
|
-
let t = u(e.name, s.language, j), n = u(e.description, s.language, j), r = u(e.warning, s.language, j), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), c = `/${v ?? ""}/products/${e.slug}`, l = A(e), d =
|
|
467
|
+
let t = u(e.name, s.language, j), n = u(e.description, s.language, j), r = u(e.warning, s.language, j), i = typeof e.images?.[0] == "string" ? e.images[0].trim() : "", a = pe(e.primaryImageStyle), c = `/${v ?? ""}/products/${e.slug}`, l = A(e), d = ft(e), f = m(Ae(e, U)) === "OUT_OF_STOCK", p = !!l || Ze(e);
|
|
456
468
|
return /* @__PURE__ */ C(le, {
|
|
457
469
|
className: "h-full border-slate-200 bg-white shadow-sm",
|
|
458
470
|
children: /* @__PURE__ */ w("div", {
|
|
@@ -501,31 +513,32 @@ function j() {
|
|
|
501
513
|
})
|
|
502
514
|
]
|
|
503
515
|
}),
|
|
504
|
-
e.productVariants?.length && e.productVariants.length > 1 &&
|
|
516
|
+
e.productVariants?.length && e.productVariants.length > 1 && lt === e.id && d ? /* @__PURE__ */ C(Pe, {
|
|
505
517
|
product: e,
|
|
506
518
|
selectedVariantId: d,
|
|
507
|
-
onSelect: (t) =>
|
|
519
|
+
onSelect: (t) => dt((n) => ({
|
|
508
520
|
...n,
|
|
509
521
|
[e.id]: t
|
|
510
522
|
})),
|
|
511
|
-
onConfirm: () =>
|
|
512
|
-
onCancel: () =>
|
|
513
|
-
getVariantAvailabilityLabel: (t) =>
|
|
514
|
-
isVariantOutOfCapacity: (t) =>
|
|
523
|
+
onConfirm: () => yt(e),
|
|
524
|
+
onCancel: () => Z((t) => t === e.id ? null : t),
|
|
525
|
+
getVariantAvailabilityLabel: (t) => Qe(e, t),
|
|
526
|
+
isVariantOutOfCapacity: (t) => Xe(e, t),
|
|
527
|
+
confirmDisabled: !Y
|
|
515
528
|
}) : null,
|
|
516
529
|
/* @__PURE__ */ w("div", {
|
|
517
530
|
className: "mt-auto flex items-center gap-2",
|
|
518
531
|
children: [/* @__PURE__ */ C(E, {
|
|
519
532
|
to: c,
|
|
520
|
-
state:
|
|
533
|
+
state: ct,
|
|
521
534
|
className: "text-xs font-medium text-slate-700 hover:text-slate-950",
|
|
522
535
|
children: /* @__PURE__ */ C("span", { children: o("product_details_link") })
|
|
523
536
|
}), /* @__PURE__ */ w(g, {
|
|
524
537
|
type: "button",
|
|
525
538
|
size: "sm",
|
|
526
539
|
className: "ml-auto rounded-full gap-2",
|
|
527
|
-
onClick: () =>
|
|
528
|
-
disabled: !p,
|
|
540
|
+
onClick: () => vt(e),
|
|
541
|
+
disabled: !p || !Y,
|
|
529
542
|
children: [/* @__PURE__ */ C("span", { children: o("add_to_cart") }), /* @__PURE__ */ C(we, {
|
|
530
543
|
className: "h-4 w-4",
|
|
531
544
|
"aria-hidden": "true"
|
|
@@ -542,11 +555,11 @@ function j() {
|
|
|
542
555
|
}), /* @__PURE__ */ C("div", {
|
|
543
556
|
className: "lg:col-span-4",
|
|
544
557
|
children: /* @__PURE__ */ C(de, {
|
|
545
|
-
lines:
|
|
558
|
+
lines: at.lines,
|
|
546
559
|
itemCount: I,
|
|
547
|
-
totalPerDayMinor:
|
|
548
|
-
checkoutPath:
|
|
549
|
-
showCheckoutAction:
|
|
560
|
+
totalPerDayMinor: at.totalPerDayMinor,
|
|
561
|
+
checkoutPath: X,
|
|
562
|
+
showCheckoutAction: Y,
|
|
550
563
|
showClearAction: !0,
|
|
551
564
|
editable: !0,
|
|
552
565
|
stickyTopClassName: "top-32",
|
|
@@ -558,15 +571,16 @@ function j() {
|
|
|
558
571
|
})
|
|
559
572
|
]
|
|
560
573
|
}), /* @__PURE__ */ C(ve, {
|
|
561
|
-
open: !!
|
|
562
|
-
product:
|
|
574
|
+
open: !!Q,
|
|
575
|
+
product: Q,
|
|
563
576
|
onOpenChange: (e) => {
|
|
564
|
-
e ||
|
|
577
|
+
e || mt(null);
|
|
565
578
|
},
|
|
566
|
-
getVariantAvailabilityLabel: (e) =>
|
|
567
|
-
isVariantOutOfCapacity: (e) =>
|
|
579
|
+
getVariantAvailabilityLabel: (e) => Q ? Qe(Q, e) : null,
|
|
580
|
+
isVariantOutOfCapacity: (e) => Q ? Xe(Q, e) : !1,
|
|
581
|
+
addDisabled: !Y,
|
|
568
582
|
onAddVariant: (e, t) => {
|
|
569
|
-
|
|
583
|
+
Q && ($(Q, e, t), mt(null));
|
|
570
584
|
}
|
|
571
585
|
})]
|
|
572
586
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAwGA,MAAM,CAAC,OAAO,UAAU,YAAY,
|
|
1
|
+
{"version":3,"file":"CheckoutPage.d.ts","sourceRoot":"","sources":["../../src/pages/CheckoutPage.tsx"],"names":[],"mappings":"AAwGA,MAAM,CAAC,OAAO,UAAU,YAAY,4CA8lBnC"}
|