@loczer/storefront-sdk 0.230.0 → 0.231.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 +0 -2
- package/dist/StorefrontContext.d.ts.map +1 -1
- package/dist/StorefrontProvider.d.ts +0 -1
- package/dist/StorefrontProvider.d.ts.map +1 -1
- package/dist/chunks/pkg/booking-engine/dist/schemas/{base-booking-C9kJFMIu.js → base-booking-BJXFzDM5.js} +0 -2
- package/dist/chunks/pkg/booking-engine/dist/schemas/{cart-inputs-epi7FXIk.js → cart-inputs-3lBblkB0.js} +0 -10
- package/dist/chunks/pkg/booking-engine/dist/{schemas-DW5gdDYz.js → schemas-JjiUWFIv.js} +2 -2
- package/dist/components/BookingBikeQuickAddCard/index.d.ts +3 -1
- package/dist/components/BookingBikeQuickAddCard/index.d.ts.map +1 -1
- package/dist/components/BookingBikeQuickAddCard/index.js +97 -85
- package/dist/components/BookingBikeVariantDialog/index.d.ts.map +1 -1
- package/dist/components/BookingBikeVariantDialog/index.js +9 -7
- package/dist/components/Footer/businessHoursStatus.js +1 -1
- package/dist/components/LanguageSelector/index.js +1 -1
- package/dist/components/StorefrontCartPanel/index.js +1 -1
- package/dist/i18n/en.d.ts +0 -4
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +0 -4
- package/dist/i18n/fr.d.ts +0 -4
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +1 -5
- package/dist/index.d.ts +12 -35
- package/dist/index.js +3 -3
- package/dist/lib/booking-period.js +1 -1
- package/dist/lib/booking.d.ts +6 -6
- package/dist/lib/booking.d.ts.map +1 -1
- package/dist/lib/booking.js +21 -21
- package/dist/lib/checkoutSubmit.d.ts +2 -6
- package/dist/lib/checkoutSubmit.d.ts.map +1 -1
- package/dist/lib/checkoutSubmit.js +3 -11
- package/dist/lib/pricing.js +1 -1
- package/dist/lib/storefrontAvailability.d.ts +12 -8
- package/dist/lib/storefrontAvailability.d.ts.map +1 -1
- package/dist/lib/storefrontAvailability.js +17 -7
- package/dist/pages/BookingPage.d.ts.map +1 -1
- package/dist/pages/BookingPage.js +202 -204
- package/dist/pages/CheckoutPage.d.ts.map +1 -1
- package/dist/pages/CheckoutPage.js +23 -25
- package/dist/pages/HomePage.js +8 -8
- package/dist/pages/ProductPage.d.ts.map +1 -1
- package/dist/pages/ProductPage.js +187 -181
- package/dist/pages/checkout/components/CheckoutDetailsCard.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutDetailsCard.js +4 -17
- package/dist/pages/checkout/types.d.ts +1 -2
- package/dist/pages/checkout/types.d.ts.map +1 -1
- package/dist/pages/checkout/types.js +1 -2
- package/dist/storefrontSchemas.d.ts +0 -2
- package/dist/storefrontSchemas.d.ts.map +1 -1
- package/dist/storefrontSchemas.js +1 -2
- package/package.json +1 -1
|
@@ -1,293 +1,299 @@
|
|
|
1
1
|
import { getBookingParamsFromSearch as e, pickBookingSearchParams as t, resolveBookingSearchParamsFromSessionStorage as n, writeBookingSearchParamsToSessionStorage as r } from "../lib/booking.js";
|
|
2
2
|
import { getProductVariantAttributeValue as i, getStorefrontProductVariantDisplay as ee } from "../lib/productVariants.js";
|
|
3
3
|
import { getLocalizedValue as a } from "../localization.js";
|
|
4
|
-
import { findStorefrontProductBySlug as
|
|
5
|
-
import { useStorefrontCart as
|
|
6
|
-
import { getAvailabilityVariant as
|
|
7
|
-
import { ROUTE as
|
|
8
|
-
import { Badge as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useStorefront as
|
|
11
|
-
import { toast as
|
|
12
|
-
import { Input as
|
|
13
|
-
import { Card as
|
|
14
|
-
import { ProductWarningNotice as
|
|
15
|
-
import { ProductPriceBadge as
|
|
16
|
-
import { resolveProductImageContainerStyle as
|
|
17
|
-
import { apiPost as
|
|
18
|
-
import { RadioGroup as
|
|
19
|
-
import { useEffect as
|
|
20
|
-
import { jsx as
|
|
21
|
-
import { Link as
|
|
22
|
-
import { useTranslation as
|
|
4
|
+
import { findStorefrontProductBySlug as te, getStorefrontCheckoutProductId as o, getStorefrontProductSelectionDisplayName as ne } from "../lib/products.js";
|
|
5
|
+
import { useStorefrontCart as re } from "../lib/cart.js";
|
|
6
|
+
import { getAvailabilityVariant as ie } from "../lib/utils.js";
|
|
7
|
+
import { ROUTE as ae, buildStorefrontAvailabilityKey as s, getStorefrontAvailabilityIssue as oe, getStorefrontAvailabilityStatus as se, getStorefrontProductAvailabilityStatus as ce, getValidStorefrontAvailabilitySchedule as le, isStorefrontAvailabilityInsufficient as c, responseSchema as ue } from "../lib/storefrontAvailability.js";
|
|
8
|
+
import { Badge as l } from "../ui/badge.js";
|
|
9
|
+
import { Button as u } from "../ui/button.js";
|
|
10
|
+
import { useStorefront as de, useStorefrontProducts as fe } from "../StorefrontContext.js";
|
|
11
|
+
import { toast as pe } from "../lib/toast.js";
|
|
12
|
+
import { Input as me } from "../ui/input.js";
|
|
13
|
+
import { Card as he } from "../ui/card.js";
|
|
14
|
+
import { ProductWarningNotice as ge } from "../components/ProductWarningNotice/index.js";
|
|
15
|
+
import { ProductPriceBadge as _e } from "../components/ProductPriceBadge/index.js";
|
|
16
|
+
import { resolveProductImageContainerStyle as ve } from "../lib/productImageStyles.js";
|
|
17
|
+
import { apiPost as ye } from "../lib/apiCall.js";
|
|
18
|
+
import { RadioGroup as be, RadioGroupItem as xe } from "../ui/radio-group.js";
|
|
19
|
+
import { useEffect as d, useMemo as f, useState as p } from "react";
|
|
20
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
21
|
+
import { Link as g, useLocation as Se, useNavigate as Ce, useParams as we, useSearchParams as Te } from "@rpcbase/router";
|
|
22
|
+
import { useTranslation as Ee } from "react-i18next";
|
|
23
23
|
import { cn as _ } from "@rpcbase/ui";
|
|
24
|
-
import { ArrowLeft as v, ArrowRight as y, Bike as
|
|
24
|
+
import { ArrowLeft as v, ArrowRight as y, Bike as De, CheckCircle2 as Oe, Plus as ke } from "lucide-react";
|
|
25
25
|
//#region src/pages/ProductPage.tsx
|
|
26
26
|
var b = (e, t = () => !0) => {
|
|
27
27
|
if (!e) return null;
|
|
28
28
|
if (e.representedVariantId?.trim()) return e.representedVariantId.trim();
|
|
29
29
|
let n = e.productVariants ?? [];
|
|
30
30
|
return n.find((e) => t(e.id))?.id ?? n[0]?.id ?? null;
|
|
31
|
-
},
|
|
31
|
+
}, Ae = (e, t) => {
|
|
32
32
|
if (!e) return [];
|
|
33
|
-
let n =
|
|
34
|
-
r.set(
|
|
33
|
+
let n = o(e), r = /* @__PURE__ */ new Map();
|
|
34
|
+
r.set(s(n), {
|
|
35
35
|
productId: n,
|
|
36
36
|
quantity: t
|
|
37
37
|
});
|
|
38
|
-
for (let i of e.productVariants ?? []) r.set(
|
|
38
|
+
for (let i of e.productVariants ?? []) r.set(s(n, i.id), {
|
|
39
39
|
productId: n,
|
|
40
40
|
productVariantId: i.id,
|
|
41
41
|
quantity: t
|
|
42
42
|
});
|
|
43
43
|
let i = e.representedVariantId?.trim();
|
|
44
|
-
return i && r.set(
|
|
44
|
+
return i && r.set(s(n, i), {
|
|
45
45
|
productId: n,
|
|
46
46
|
productVariantId: i,
|
|
47
47
|
quantity: t
|
|
48
48
|
}), Array.from(r.values());
|
|
49
|
-
},
|
|
50
|
-
let n =
|
|
49
|
+
}, je = (e, t) => {
|
|
50
|
+
let n = o(e), r = e.representedVariantId?.trim();
|
|
51
51
|
if (r) {
|
|
52
|
-
let e = t.get(
|
|
52
|
+
let e = t.get(s(n, r));
|
|
53
53
|
if (e) return e;
|
|
54
54
|
}
|
|
55
|
-
return t.get(
|
|
56
|
-
},
|
|
57
|
-
let r =
|
|
58
|
-
return r === "
|
|
55
|
+
return t.get(s(n));
|
|
56
|
+
}, x = (e, t, n) => n.get(s(o(e), t)), S = (e, t, n) => {
|
|
57
|
+
let r = oe(t);
|
|
58
|
+
return r === "quantityUnavailable" ? 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 });
|
|
59
59
|
}, Me = (e) => "availabilityStatus" in e ? e.availabilityStatus ?? "AVAILABLE" : "AVAILABLE";
|
|
60
|
-
function
|
|
61
|
-
let { t:
|
|
62
|
-
bikes:
|
|
63
|
-
accessories:
|
|
60
|
+
function C() {
|
|
61
|
+
let { t: C, i18n: w } = Ee(), { storeSlug: T, productSlug: E } = we(), [Ne] = Te(), Pe = Se(), Fe = Ce(), { addItem: Ie, itemCount: D } = re(), { storefrontConfiguration: Le } = de(), O = Le.workspace?.workspaceLanguage, { bikes: k, accessories: A } = fe(), j = f(() => E ? te(E, {
|
|
62
|
+
bikes: k,
|
|
63
|
+
accessories: A
|
|
64
64
|
}) : null, [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
]),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}), [
|
|
72
|
-
|
|
73
|
-
if (
|
|
74
|
-
|
|
65
|
+
A,
|
|
66
|
+
k,
|
|
67
|
+
E
|
|
68
|
+
]), M = t(Ne).toString(), N = f(() => n(new URLSearchParams(M), T), [M, T]), P = f(() => e(N, {
|
|
69
|
+
startTime: "",
|
|
70
|
+
endTime: ""
|
|
71
|
+
}), [N]), F = f(() => le(P), [P]), I = N.toString(), L = `/${T ?? ""}/checkout${I ? `?${I}` : ""}`, R = `/${T ?? ""}`, Re = R, z = Pe.state, ze = typeof z?.backTo == "string" && z.backTo.startsWith(R) ? z.backTo : Re, [B, V] = p(1), [H, U] = p(() => b(j)), W = Number.isFinite(B) ? Math.max(1, Math.min(99, Math.floor(B))) : 1, G = f(() => Ae(j, W), [W, j]), [Be, K] = p([]), [Ve, q] = p(!1);
|
|
72
|
+
d(() => {
|
|
73
|
+
if (V(1), !j) {
|
|
74
|
+
U(null);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
r(
|
|
80
|
-
}, [
|
|
81
|
-
if (!
|
|
82
|
-
|
|
77
|
+
U(b(j));
|
|
78
|
+
}, [E, j]), d(() => {
|
|
79
|
+
r(T, N);
|
|
80
|
+
}, [N, T]), d(() => {
|
|
81
|
+
if (!T || G.length === 0) {
|
|
82
|
+
K([]), q(!1);
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (!
|
|
86
|
-
|
|
85
|
+
if (!F) {
|
|
86
|
+
K([]), q(!1);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
let e = !1;
|
|
90
|
-
return
|
|
90
|
+
return q(!0), K([]), (async () => {
|
|
91
91
|
try {
|
|
92
|
-
let t = await
|
|
93
|
-
storeSlug:
|
|
94
|
-
schedule:
|
|
95
|
-
products:
|
|
96
|
-
}), n =
|
|
92
|
+
let t = await ye(ae, {
|
|
93
|
+
storeSlug: T,
|
|
94
|
+
schedule: F,
|
|
95
|
+
products: G
|
|
96
|
+
}), n = ue.parse(t);
|
|
97
97
|
if (e) return;
|
|
98
|
-
|
|
98
|
+
K(n.success ? n.availability ?? [] : []);
|
|
99
99
|
} catch (t) {
|
|
100
100
|
if (e) return;
|
|
101
|
-
console.error("Failed to load storefront product availability", t),
|
|
101
|
+
console.error("Failed to load storefront product availability", t), K([]);
|
|
102
102
|
} finally {
|
|
103
|
-
e ||
|
|
103
|
+
e || q(!1);
|
|
104
104
|
}
|
|
105
105
|
})(), () => {
|
|
106
106
|
e = !0;
|
|
107
107
|
};
|
|
108
108
|
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
G,
|
|
110
|
+
F,
|
|
111
|
+
P.endDate,
|
|
112
|
+
P.endTime,
|
|
113
|
+
P.startDate,
|
|
114
|
+
P.startTime,
|
|
115
|
+
T
|
|
116
116
|
]);
|
|
117
|
-
let
|
|
117
|
+
let J = f(() => new Map(Be.map((e) => [s(e.productId, e.productVariantId), e])), [Be]), He = () => {
|
|
118
118
|
Fe(ze);
|
|
119
119
|
};
|
|
120
|
-
if (!
|
|
120
|
+
if (!j) return /* @__PURE__ */ m("div", {
|
|
121
121
|
className: "mx-auto max-w-3xl px-4 py-10 sm:px-6",
|
|
122
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ h("div", {
|
|
123
123
|
className: "rounded-xl border border-slate-200 bg-white p-4 shadow-sm",
|
|
124
124
|
children: [
|
|
125
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ m("h1", {
|
|
126
126
|
className: "text-xl font-semibold tracking-tight text-slate-950",
|
|
127
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ m("span", { children: C("product_not_found_title") })
|
|
128
128
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ m("p", {
|
|
130
130
|
className: "mt-2 text-sm text-slate-600",
|
|
131
|
-
children: /* @__PURE__ */
|
|
131
|
+
children: /* @__PURE__ */ m("span", { children: C("product_not_found_description") })
|
|
132
132
|
}),
|
|
133
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ m("div", {
|
|
134
134
|
className: "mt-6",
|
|
135
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ h(u, {
|
|
136
136
|
type: "button",
|
|
137
137
|
className: "gap-2",
|
|
138
|
-
onClick:
|
|
139
|
-
children: [/* @__PURE__ */
|
|
138
|
+
onClick: He,
|
|
139
|
+
children: [/* @__PURE__ */ m(v, {
|
|
140
140
|
className: "h-4 w-4",
|
|
141
141
|
"aria-hidden": "true"
|
|
142
|
-
}), /* @__PURE__ */
|
|
142
|
+
}), /* @__PURE__ */ m("span", { children: C("go_back") })]
|
|
143
143
|
})
|
|
144
144
|
})
|
|
145
145
|
]
|
|
146
146
|
})
|
|
147
147
|
});
|
|
148
|
-
let
|
|
149
|
-
|
|
148
|
+
let Ue = a(j.name, w.language, O), We = a(j.description, w.language, O), Ge = a(j.warning, w.language, O), Ke = typeof j.images?.[0] == "string" ? j.images[0].trim() : "", qe = ve(j.primaryImageStyle), Y = j.productVariants ?? [], X = je(j, J), Z = ce({
|
|
149
|
+
availabilityByKey: J,
|
|
150
|
+
fallbackStatus: Me(j),
|
|
151
|
+
productId: o(j),
|
|
152
|
+
productVariantIds: Y.map((e) => e.id),
|
|
153
|
+
representedVariantId: j.representedVariantId
|
|
154
|
+
}), Je = X ? se(X) === Z : !1, Ye = Z === "OUT_OF_STOCK" ? Y.map((e) => x(j, e.id, J)).find((e) => oe(e) === "quantityUnavailable") : void 0, Xe = ie(Z), Ze = Ve ? C("availability_checking") : S(C, Je ? X : Ye, Z), Q = Z === "OUT_OF_STOCK", Qe = Y.some((e) => !!i(e, "size")) ? C("product_size_label") : C("product_variant_label"), $e = H ? x(j, H, J) : void 0, $ = $e ? c($e) : Q, et = !!H && F !== null && !$;
|
|
155
|
+
return /* @__PURE__ */ m("div", {
|
|
150
156
|
className: "mx-auto max-w-7xl px-4 py-8 sm:px-6",
|
|
151
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ h("div", {
|
|
152
158
|
className: "flex flex-col gap-6",
|
|
153
|
-
children: [/* @__PURE__ */
|
|
159
|
+
children: [/* @__PURE__ */ h("div", {
|
|
154
160
|
className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",
|
|
155
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ h(u, {
|
|
156
162
|
type: "button",
|
|
157
163
|
variant: "ghost",
|
|
158
164
|
className: "h-auto justify-start gap-2 self-start px-0 text-sm font-medium text-slate-700 hover:bg-transparent hover:text-slate-950",
|
|
159
|
-
onClick:
|
|
160
|
-
children: [/* @__PURE__ */
|
|
165
|
+
onClick: He,
|
|
166
|
+
children: [/* @__PURE__ */ m(v, {
|
|
161
167
|
className: "h-4 w-4",
|
|
162
168
|
"aria-hidden": "true"
|
|
163
|
-
}), /* @__PURE__ */
|
|
164
|
-
}), /* @__PURE__ */
|
|
165
|
-
to:
|
|
166
|
-
className: _(
|
|
167
|
-
children: /* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ m("span", { children: C("go_back") })]
|
|
170
|
+
}), /* @__PURE__ */ m(g, {
|
|
171
|
+
to: L,
|
|
172
|
+
className: _(D > 0 && F ? "inline-flex" : "hidden"),
|
|
173
|
+
children: /* @__PURE__ */ h(u, {
|
|
168
174
|
size: "sm",
|
|
169
175
|
className: "gap-2",
|
|
170
|
-
children: [/* @__PURE__ */
|
|
176
|
+
children: [/* @__PURE__ */ m("span", { children: C("checkout_button") }), /* @__PURE__ */ m(y, {
|
|
171
177
|
className: "h-4 w-4",
|
|
172
178
|
"aria-hidden": "true"
|
|
173
179
|
})]
|
|
174
180
|
})
|
|
175
181
|
})]
|
|
176
|
-
}), /* @__PURE__ */
|
|
182
|
+
}), /* @__PURE__ */ h("div", {
|
|
177
183
|
className: "grid gap-6 lg:grid-cols-12",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
184
|
+
children: [/* @__PURE__ */ h("div", {
|
|
179
185
|
className: "lg:col-span-7",
|
|
180
|
-
children: [/* @__PURE__ */
|
|
181
|
-
className: _("relative aspect-[1618/1000] overflow-hidden rounded-2xl",
|
|
182
|
-
style:
|
|
183
|
-
children:
|
|
184
|
-
src:
|
|
185
|
-
alt:
|
|
186
|
+
children: [/* @__PURE__ */ m("div", {
|
|
187
|
+
className: _("relative aspect-[1618/1000] overflow-hidden rounded-2xl", qe.className),
|
|
188
|
+
style: qe.style,
|
|
189
|
+
children: Ke ? /* @__PURE__ */ m("img", {
|
|
190
|
+
src: Ke,
|
|
191
|
+
alt: Ue,
|
|
186
192
|
className: "absolute inset-0 h-full w-full object-contain p-2",
|
|
187
193
|
loading: "lazy"
|
|
188
|
-
}) : /* @__PURE__ */
|
|
194
|
+
}) : /* @__PURE__ */ m("div", {
|
|
189
195
|
className: "absolute inset-0 flex items-center justify-center text-slate-400",
|
|
190
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ m(De, {
|
|
191
197
|
className: "h-12 w-12",
|
|
192
198
|
"aria-hidden": "true"
|
|
193
199
|
})
|
|
194
200
|
})
|
|
195
|
-
}), /* @__PURE__ */
|
|
201
|
+
}), /* @__PURE__ */ h("div", {
|
|
196
202
|
className: "mt-5 flex flex-col gap-3",
|
|
197
203
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ h("div", {
|
|
199
205
|
className: "flex flex-wrap items-center gap-2",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
201
|
-
variant:
|
|
202
|
-
children: /* @__PURE__ */
|
|
203
|
-
}), /* @__PURE__ */
|
|
204
|
-
prices:
|
|
205
|
-
openOnHover:
|
|
206
|
+
children: [/* @__PURE__ */ m(l, {
|
|
207
|
+
variant: Xe.variant,
|
|
208
|
+
children: /* @__PURE__ */ m("span", { children: Ze })
|
|
209
|
+
}), /* @__PURE__ */ m(_e, {
|
|
210
|
+
prices: j.prices,
|
|
211
|
+
openOnHover: j.kind !== "accessory"
|
|
206
212
|
})]
|
|
207
213
|
}),
|
|
208
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ m("h1", {
|
|
209
215
|
className: "text-2xl font-semibold tracking-tight text-slate-950",
|
|
210
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ m("span", { children: Ue })
|
|
211
217
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ m("p", {
|
|
213
219
|
className: "text-sm text-slate-600",
|
|
214
|
-
children: /* @__PURE__ */
|
|
220
|
+
children: /* @__PURE__ */ m("span", { children: We })
|
|
215
221
|
}),
|
|
216
|
-
|
|
222
|
+
j.features?.length ? /* @__PURE__ */ h("div", {
|
|
217
223
|
className: "mt-2 space-y-2",
|
|
218
|
-
children: [/* @__PURE__ */
|
|
224
|
+
children: [/* @__PURE__ */ m("p", {
|
|
219
225
|
className: "text-sm font-semibold text-slate-950",
|
|
220
|
-
children: /* @__PURE__ */
|
|
221
|
-
}), /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ m("span", { children: C("product_features_title") })
|
|
227
|
+
}), /* @__PURE__ */ m("ul", {
|
|
222
228
|
className: "grid gap-1 text-sm text-slate-700",
|
|
223
|
-
children:
|
|
229
|
+
children: j.features.map((e, t) => /* @__PURE__ */ h("li", {
|
|
224
230
|
className: "inline-flex items-start gap-2",
|
|
225
|
-
children: [/* @__PURE__ */
|
|
231
|
+
children: [/* @__PURE__ */ m(Oe, {
|
|
226
232
|
className: "mt-0.5 h-4 w-4 text-success",
|
|
227
233
|
"aria-hidden": "true"
|
|
228
|
-
}), /* @__PURE__ */
|
|
229
|
-
}, `${
|
|
234
|
+
}), /* @__PURE__ */ m("span", { children: a(e, w.language, O) })]
|
|
235
|
+
}, `${j.id}-${t}`))
|
|
230
236
|
})]
|
|
231
237
|
}) : null,
|
|
232
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ m(ge, { warning: Ge })
|
|
233
239
|
]
|
|
234
240
|
})]
|
|
235
|
-
}), /* @__PURE__ */
|
|
241
|
+
}), /* @__PURE__ */ m("div", {
|
|
236
242
|
className: "lg:col-span-5",
|
|
237
|
-
children: /* @__PURE__ */
|
|
243
|
+
children: /* @__PURE__ */ h(he, {
|
|
238
244
|
className: "border-slate-200 bg-white shadow-sm",
|
|
239
|
-
children: [/* @__PURE__ */
|
|
245
|
+
children: [/* @__PURE__ */ h("div", {
|
|
240
246
|
className: "border-b border-slate-200 px-4 py-4",
|
|
241
|
-
children: [/* @__PURE__ */
|
|
247
|
+
children: [/* @__PURE__ */ m("p", {
|
|
242
248
|
className: "text-sm font-semibold text-slate-950",
|
|
243
|
-
children: /* @__PURE__ */
|
|
244
|
-
}), /* @__PURE__ */
|
|
249
|
+
children: /* @__PURE__ */ m("span", { children: C("add_to_cart_title") })
|
|
250
|
+
}), /* @__PURE__ */ m("p", {
|
|
245
251
|
className: "mt-1 text-xs text-slate-600",
|
|
246
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ m("span", { children: C("add_to_cart_description") })
|
|
247
253
|
})]
|
|
248
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ h("div", {
|
|
249
255
|
className: "grid gap-4 px-4 py-4",
|
|
250
256
|
children: [
|
|
251
|
-
|
|
257
|
+
F ? null : /* @__PURE__ */ m("p", {
|
|
252
258
|
role: "alert",
|
|
253
259
|
className: "text-sm text-destructive",
|
|
254
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ m("span", { children: C("booking_time_slots_required") })
|
|
255
261
|
}),
|
|
256
|
-
|
|
262
|
+
Y.length > 1 ? /* @__PURE__ */ h("div", {
|
|
257
263
|
className: "grid gap-2",
|
|
258
|
-
children: [/* @__PURE__ */
|
|
264
|
+
children: [/* @__PURE__ */ m("p", {
|
|
259
265
|
className: "text-xs font-medium text-slate-700",
|
|
260
|
-
children: /* @__PURE__ */
|
|
261
|
-
}), /* @__PURE__ */
|
|
262
|
-
value:
|
|
263
|
-
onValueChange:
|
|
266
|
+
children: /* @__PURE__ */ m("span", { children: Qe })
|
|
267
|
+
}), /* @__PURE__ */ m(be, {
|
|
268
|
+
value: H ?? "",
|
|
269
|
+
onValueChange: U,
|
|
264
270
|
className: "grid gap-2",
|
|
265
|
-
children:
|
|
266
|
-
let t = `variant-${
|
|
267
|
-
return /* @__PURE__ */
|
|
271
|
+
children: Y.map((e) => {
|
|
272
|
+
let t = `variant-${j.id}-${e.id}`.toLowerCase(), n = `storefront-product-variant-option-${j.id}-${e.id}`.toLowerCase(), { label: r, description: i } = ee(e), a = x(j, e.id, J), te = a ? c(a) : Q, o = a ? S(C, a, se(a)) : Q ? C("availability_out_of_stock") : null;
|
|
273
|
+
return /* @__PURE__ */ h("label", {
|
|
268
274
|
htmlFor: t,
|
|
269
275
|
"data-testid": n,
|
|
270
|
-
className: _("flex items-start gap-3 rounded-xl border p-3 transition",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
276
|
+
className: _("flex items-start gap-3 rounded-xl border p-3 transition", H === e.id ? "border-slate-900 bg-slate-50" : "border-slate-200 bg-white"),
|
|
277
|
+
children: [/* @__PURE__ */ m(xe, {
|
|
272
278
|
id: t,
|
|
273
279
|
value: e.id,
|
|
274
280
|
className: "mt-1"
|
|
275
|
-
}), /* @__PURE__ */
|
|
281
|
+
}), /* @__PURE__ */ h("span", {
|
|
276
282
|
className: "flex flex-1 flex-col gap-0.5",
|
|
277
283
|
children: [
|
|
278
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ m("span", {
|
|
279
285
|
className: "text-sm font-medium text-slate-950",
|
|
280
286
|
children: r
|
|
281
287
|
}),
|
|
282
|
-
i ? /* @__PURE__ */
|
|
288
|
+
i ? /* @__PURE__ */ m("span", {
|
|
283
289
|
className: "text-xs text-slate-600",
|
|
284
290
|
children: i
|
|
285
291
|
}) : null,
|
|
286
|
-
|
|
292
|
+
o ? /* @__PURE__ */ m("span", {
|
|
287
293
|
className: "pt-1",
|
|
288
|
-
children: /* @__PURE__ */
|
|
289
|
-
variant:
|
|
290
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ m(l, {
|
|
295
|
+
variant: te ? "destructive" : "outline",
|
|
296
|
+
children: /* @__PURE__ */ m("span", { children: o })
|
|
291
297
|
})
|
|
292
298
|
}) : null
|
|
293
299
|
]
|
|
@@ -296,50 +302,50 @@ function S() {
|
|
|
296
302
|
})
|
|
297
303
|
})]
|
|
298
304
|
}) : null,
|
|
299
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ h("div", {
|
|
300
306
|
className: "grid gap-2",
|
|
301
|
-
children: [/* @__PURE__ */
|
|
307
|
+
children: [/* @__PURE__ */ m("p", {
|
|
302
308
|
className: "text-xs font-medium text-slate-700",
|
|
303
|
-
children: /* @__PURE__ */
|
|
304
|
-
}), /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ m("span", { children: C("quantity_label") })
|
|
310
|
+
}), /* @__PURE__ */ m(me, {
|
|
305
311
|
type: "number",
|
|
306
312
|
min: 1,
|
|
307
313
|
max: 99,
|
|
308
|
-
value:
|
|
309
|
-
onChange: (e) =>
|
|
314
|
+
value: B,
|
|
315
|
+
onChange: (e) => V(Number(e.target.value))
|
|
310
316
|
})]
|
|
311
317
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ h(u, {
|
|
313
319
|
className: "h-11 rounded-xl text-sm font-semibold gap-2",
|
|
314
320
|
onClick: () => {
|
|
315
|
-
!
|
|
316
|
-
kind:
|
|
317
|
-
productId:
|
|
318
|
-
...
|
|
319
|
-
quantity:
|
|
320
|
-
}),
|
|
321
|
-
quantity:
|
|
322
|
-
productName:
|
|
323
|
-
product:
|
|
324
|
-
productVariantId:
|
|
325
|
-
language:
|
|
326
|
-
fallbackLanguage:
|
|
321
|
+
!H || !F || $ || (Ie({
|
|
322
|
+
kind: j.kind,
|
|
323
|
+
productId: o(j),
|
|
324
|
+
...H ? { productVariantId: H } : {},
|
|
325
|
+
quantity: W
|
|
326
|
+
}), pe.success(C("product_added_to_cart_successfully", {
|
|
327
|
+
quantity: W,
|
|
328
|
+
productName: ne({
|
|
329
|
+
product: j,
|
|
330
|
+
productVariantId: H,
|
|
331
|
+
language: w.language,
|
|
332
|
+
fallbackLanguage: O
|
|
327
333
|
})
|
|
328
334
|
})));
|
|
329
335
|
},
|
|
330
|
-
disabled: !
|
|
331
|
-
children: [/* @__PURE__ */
|
|
336
|
+
disabled: !et,
|
|
337
|
+
children: [/* @__PURE__ */ m("span", { children: C("add_to_cart") }), /* @__PURE__ */ m(ke, {
|
|
332
338
|
className: "h-4 w-4",
|
|
333
339
|
"aria-hidden": "true"
|
|
334
340
|
})]
|
|
335
341
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
to:
|
|
338
|
-
className: _(
|
|
339
|
-
children: /* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ m(g, {
|
|
343
|
+
to: L,
|
|
344
|
+
className: _(D > 0 && F ? "block" : "hidden"),
|
|
345
|
+
children: /* @__PURE__ */ h(u, {
|
|
340
346
|
variant: "outline",
|
|
341
347
|
className: "h-11 w-full rounded-xl gap-2",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
348
|
+
children: [/* @__PURE__ */ m("span", { children: C("go_to_checkout") }), /* @__PURE__ */ m(y, {
|
|
343
349
|
className: "h-4 w-4",
|
|
344
350
|
"aria-hidden": "true"
|
|
345
351
|
})]
|
|
@@ -354,4 +360,4 @@ function S() {
|
|
|
354
360
|
});
|
|
355
361
|
}
|
|
356
362
|
//#endregion
|
|
357
|
-
export {
|
|
363
|
+
export { C as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutDetailsCard.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutDetailsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAK5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAOlD,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAElE,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAOD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"CheckoutDetailsCard.d.ts","sourceRoot":"","sources":["../../../../src/pages/checkout/components/CheckoutDetailsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAA;AAK5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAOlD,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAElE,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAOD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,2CAwGrE"}
|
|
@@ -30,26 +30,13 @@ function h({ form: h }) {
|
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ l(r, {
|
|
32
32
|
control: h.control,
|
|
33
|
-
name: "
|
|
33
|
+
name: "fullName",
|
|
34
34
|
render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
|
|
35
|
-
/* @__PURE__ */ l(a, { children: g("
|
|
35
|
+
/* @__PURE__ */ l(a, { children: g("checkout_full_name_label") }),
|
|
36
36
|
/* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
|
|
37
37
|
...t,
|
|
38
|
-
autoComplete: "
|
|
39
|
-
placeholder: g("
|
|
40
|
-
}) }),
|
|
41
|
-
/* @__PURE__ */ l(o, {})
|
|
42
|
-
] })
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ l(r, {
|
|
45
|
-
control: h.control,
|
|
46
|
-
name: "last_name",
|
|
47
|
-
render: ({ field: t }) => /* @__PURE__ */ u(i, { children: [
|
|
48
|
-
/* @__PURE__ */ l(a, { children: g("checkout_last_name_label") }),
|
|
49
|
-
/* @__PURE__ */ l(n, { children: /* @__PURE__ */ l(e, {
|
|
50
|
-
...t,
|
|
51
|
-
autoComplete: "family-name",
|
|
52
|
-
placeholder: g("checkout_last_name_placeholder")
|
|
38
|
+
autoComplete: "name",
|
|
39
|
+
placeholder: g("checkout_full_name_placeholder")
|
|
53
40
|
}) }),
|
|
54
41
|
/* @__PURE__ */ l(o, {})
|
|
55
42
|
] })
|
|
@@ -2,8 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { ResponsePayload as CheckoutPaymentSessionResponse } from '../../lib/checkoutPaymentSession';
|
|
3
3
|
import { ResponsePayload as CheckoutPaymentDecisionResponse } from '../../lib/checkoutPaymentDecision';
|
|
4
4
|
export declare const checkoutFormSchema: z.ZodObject<{
|
|
5
|
-
|
|
6
|
-
last_name: z.ZodString;
|
|
5
|
+
fullName: z.ZodString;
|
|
7
6
|
email: z.ZodString;
|
|
8
7
|
phone: z.ZodString;
|
|
9
8
|
notes: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/pages/checkout/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,eAAe,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACzG,OAAO,KAAK,EAAE,eAAe,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AAG3G,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/pages/checkout/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,eAAe,IAAI,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACzG,OAAO,KAAK,EAAE,eAAe,IAAI,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AAG3G,eAAO,MAAM,kBAAkB;;;;;iBAK7B,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AACnE,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,+BAA+B,CAAC,UAAU,CAAC,CAAC,CAAA;AAC9F,MAAM,MAAM,sBAAsB,GAAG,8BAA8B,CAAA;AACnE,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
//#region src/pages/checkout/types.ts
|
|
3
3
|
var t = e.object({
|
|
4
|
-
|
|
5
|
-
last_name: e.string().trim().min(1),
|
|
4
|
+
fullName: e.string().trim().min(2),
|
|
6
5
|
email: e.string().trim().email(),
|
|
7
6
|
phone: e.string().trim().min(6),
|
|
8
7
|
notes: e.string().trim().max(2e3).optional().or(e.literal(""))
|
|
@@ -69,7 +69,6 @@ export declare const storefrontSettingsSchema: z.ZodObject<{
|
|
|
69
69
|
}>;
|
|
70
70
|
defaultFewRemainingThreshold: z.ZodOptional<z.ZodNumber>;
|
|
71
71
|
}, z.core.$strip>;
|
|
72
|
-
enabled: z.ZodBoolean;
|
|
73
72
|
fulfillmentModes: z.ZodArray<z.ZodEnum<{
|
|
74
73
|
pickup: "pickup";
|
|
75
74
|
delivery: "delivery";
|
|
@@ -349,7 +348,6 @@ export declare const storefrontConfigurationSchema: z.ZodObject<{
|
|
|
349
348
|
}>;
|
|
350
349
|
defaultFewRemainingThreshold: z.ZodOptional<z.ZodNumber>;
|
|
351
350
|
}, z.core.$strip>;
|
|
352
|
-
enabled: z.ZodBoolean;
|
|
353
351
|
fulfillmentModes: z.ZodArray<z.ZodEnum<{
|
|
354
352
|
pickup: "pickup";
|
|
355
353
|
delivery: "delivery";
|