@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
|
@@ -97,7 +97,7 @@ export declare function useStorefrontConfig(): {
|
|
|
97
97
|
startDate: string;
|
|
98
98
|
endDate: string;
|
|
99
99
|
openingHours: {
|
|
100
|
-
day: 0 |
|
|
100
|
+
day: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
101
101
|
openingSlots: {
|
|
102
102
|
start: string;
|
|
103
103
|
end: string;
|
|
@@ -333,7 +333,7 @@ export declare function useStorefrontConfig(): {
|
|
|
333
333
|
startDate: string;
|
|
334
334
|
endDate: string;
|
|
335
335
|
openingHours: {
|
|
336
|
-
day: 0 |
|
|
336
|
+
day: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
337
337
|
openingSlots: {
|
|
338
338
|
start: string;
|
|
339
339
|
end: string;
|
|
@@ -78,7 +78,7 @@ export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderA
|
|
|
78
78
|
startDate: string;
|
|
79
79
|
endDate: string;
|
|
80
80
|
openingHours: {
|
|
81
|
-
day: 0 |
|
|
81
|
+
day: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
82
82
|
openingSlots: {
|
|
83
83
|
start: string;
|
|
84
84
|
end: string;
|
|
@@ -240,7 +240,7 @@ export declare const loader: ({ ctx, params }: import('@rpcbase/client').LoaderA
|
|
|
240
240
|
accessories: import('.').AccessoryProduct[];
|
|
241
241
|
bookingBikes: import('.').BikeProduct[];
|
|
242
242
|
bookingAccessories: import('.').AccessoryProduct[];
|
|
243
|
-
language:
|
|
243
|
+
language: "fr" | "en";
|
|
244
244
|
itineraries: {
|
|
245
245
|
slug: string;
|
|
246
246
|
title: Record<string, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Header/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Header/index.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAMtE,KAAK,WAAW,GAAG;IACjB,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;IACjD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAQD,wBAAgB,MAAM,CAAC,EAAE,uBAAuB,EAAE,YAAY,EAAE,oBAAoB,EAAE,EAAE,WAAW,2CAuPlG"}
|
|
@@ -2,282 +2,274 @@ import { resolveBookingSearchParamsFromSessionStorage as e } from "../../lib/boo
|
|
|
2
2
|
import { getLocalizedValue as t } from "../../localization.js";
|
|
3
3
|
import { useStorefrontCart as n } from "../../lib/cart.js";
|
|
4
4
|
import { buildStorefrontImageUrl as r } from "../../lib/storefrontImage.js";
|
|
5
|
-
import
|
|
6
|
-
import { MISSING_SHOP_EMAIL as
|
|
7
|
-
import { formatStorefrontAddressTagline as
|
|
8
|
-
import { Badge as
|
|
9
|
-
import { Button as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
5
|
+
import ee from "../../chunks/assets/whatsapp-m5e0vjnZ.js";
|
|
6
|
+
import { MISSING_SHOP_EMAIL as te } from "../../lib/storefrontMissingValues.js";
|
|
7
|
+
import { formatStorefrontAddressTagline as i } from "../../lib/storefrontAddress.js";
|
|
8
|
+
import { Badge as a } from "../../ui/badge.js";
|
|
9
|
+
import { Button as o } from "../../ui/button.js";
|
|
10
|
+
import { LanguageSelector as s } from "../LanguageSelector/index.js";
|
|
11
|
+
import { Drawer as ne, DrawerClose as c, DrawerContent as l, DrawerDescription as u, DrawerHeader as d, DrawerTitle as re, DrawerTrigger as ie } from "../../ui/drawer.js";
|
|
12
|
+
import { useOptionalStorefront as ae } from "../../StorefrontContext.js";
|
|
13
|
+
import { useState as oe } from "react";
|
|
14
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
15
|
+
import { useMediaQuery as m, useThrottledMeasure as se } from "@rpcbase/client";
|
|
16
|
+
import { Link as h, useLocation as ce, useParams as le } from "@rpcbase/router";
|
|
17
|
+
import { useTranslation as ue } from "react-i18next";
|
|
18
|
+
import { cn as g, useScrollHideOnDown as de } from "@rpcbase/ui";
|
|
19
|
+
import { ArrowRight as _, Menu as v, ShoppingCart as y } from "lucide-react";
|
|
19
20
|
//#region src/components/Header/index.tsx
|
|
20
|
-
var
|
|
21
|
+
var b = 36, x = (e, t) => {
|
|
21
22
|
let n = e?.trim() ?? "";
|
|
22
23
|
return n ? r(n, t ?? "") : "";
|
|
23
24
|
};
|
|
24
|
-
function
|
|
25
|
-
let { t:
|
|
26
|
-
enabled:
|
|
27
|
-
thresholdPx:
|
|
28
|
-
}),
|
|
29
|
-
let e = C.language.startsWith("fr") ? "en" : "fr";
|
|
30
|
-
C.changeLanguage(e);
|
|
31
|
-
}, L = `/${T ?? ""}`, R = e(new URLSearchParams(E.search), T), z = R.toString(), B = !!(R.get("start_time")?.trim() && R.get("end_time")?.trim()), V = z ? `?${z}` : "", H = `${L}/booking${V}`, pe = `${L}/checkout${V}`, U = r?.shop.name?.trim() ?? "", W = r?.shop.emailAddress?.trim() ?? "", G = r?.workspace?.workspaceLanguage, K = t(r?.content?.tagline, C.language, G).trim(), q = a(r?.shop), J = K || q || "[Missing shop address]", Y = !K && !q, me = t(r?.content?.topBannerMessage, C.language, G).trim() || S("top_bar_message"), X = y(r?.content?.logoWideImageId, T), Z = y(r?.shop.logoImageId ?? r?.content?.logoSquareImageId, T), Q = X.length > 0, $ = Z.length > 0, he = [
|
|
25
|
+
function S({ storefrontConfiguration: r, whatsappHref: S, whatsappPhoneDisplay: C }) {
|
|
26
|
+
let { t: w, i18n: T } = ue(), E = ae(), { storeSlug: D } = le(), fe = ce(), { itemCount: O } = n(), k = m("(max-width: 640px)"), [A, j] = oe(!1), [M, N] = se(), P = N?.height ?? b, F = de({
|
|
27
|
+
enabled: k,
|
|
28
|
+
thresholdPx: P
|
|
29
|
+
}), I = k && F ? `translateY(-${P}px)` : "translateY(0)", L = `/${D ?? ""}`, R = e(new URLSearchParams(fe.search), D), z = R.toString(), B = !!(R.get("start_time")?.trim() && R.get("end_time")?.trim()), V = z ? `?${z}` : "", H = `${L}/booking${V}`, pe = `${L}/checkout${V}`, U = r?.shop.name?.trim() ?? "", W = r?.shop.emailAddress?.trim() ?? "", G = r?.workspace?.workspaceLanguage, K = r?.workspace?.languages, q = t(r?.content?.tagline, T.language, G).trim(), J = i(r?.shop), Y = q || J || "[Missing shop address]", me = !q && !J, he = t(r?.content?.topBannerMessage, T.language, G).trim() || w("top_bar_message"), X = x(r?.content?.logoWideImageId, D), Z = x(r?.shop.logoImageId ?? r?.content?.logoSquareImageId, D), Q = X.length > 0, $ = Z.length > 0, ge = [
|
|
32
30
|
{
|
|
33
|
-
label:
|
|
31
|
+
label: w("nav_categories"),
|
|
34
32
|
to: `${L}${V}#categories`
|
|
35
33
|
},
|
|
36
34
|
{
|
|
37
|
-
label:
|
|
35
|
+
label: w("nav_featured"),
|
|
38
36
|
to: `${L}${V}#featured`
|
|
39
37
|
},
|
|
40
38
|
{
|
|
41
|
-
label:
|
|
39
|
+
label: w("nav_products"),
|
|
42
40
|
to: H
|
|
43
41
|
},
|
|
44
|
-
...(
|
|
45
|
-
label:
|
|
42
|
+
...(E?.itineraries.length ?? 0) > 0 ? [{
|
|
43
|
+
label: w("nav_itineraries"),
|
|
46
44
|
to: `${L}/itineraries`
|
|
47
45
|
}] : [],
|
|
48
46
|
{
|
|
49
|
-
label:
|
|
47
|
+
label: w("nav_contact"),
|
|
50
48
|
to: `${L}${V}#contact`
|
|
51
49
|
}
|
|
52
50
|
];
|
|
53
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ p("div", {
|
|
54
52
|
className: "sticky top-0 z-30",
|
|
55
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ f("div", {
|
|
56
54
|
className: "transition-transform duration-300",
|
|
57
|
-
style: { transform:
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
ref:
|
|
55
|
+
style: { transform: I },
|
|
56
|
+
children: /* @__PURE__ */ f("div", {
|
|
57
|
+
ref: M,
|
|
60
58
|
className: "bg-slate-950 text-white",
|
|
61
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ p("div", {
|
|
62
60
|
className: "mx-auto flex max-w-7xl items-center justify-start gap-3 px-4 py-2 text-left text-xs leading-4 sm:justify-between sm:px-6",
|
|
63
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ f("p", {
|
|
64
62
|
className: "w-full min-w-0 break-words sm:w-auto",
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
}), /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ f("span", { children: he })
|
|
64
|
+
}), /* @__PURE__ */ p("div", {
|
|
67
65
|
className: "hidden items-center gap-4 sm:flex",
|
|
68
|
-
children: [
|
|
66
|
+
children: [S ? /* @__PURE__ */ p("a", {
|
|
69
67
|
className: "inline-flex items-center gap-2 rounded-md px-2 py-1 text-white/90 hover:bg-white/10 hover:text-white",
|
|
70
|
-
href:
|
|
68
|
+
href: S,
|
|
71
69
|
target: "_blank",
|
|
72
70
|
rel: "noreferrer",
|
|
73
|
-
"aria-label": `WhatsApp${
|
|
74
|
-
children: [/* @__PURE__ */
|
|
75
|
-
src:
|
|
71
|
+
"aria-label": `WhatsApp${C ? ` ${C}` : ""}`,
|
|
72
|
+
children: [/* @__PURE__ */ f("img", {
|
|
73
|
+
src: ee,
|
|
76
74
|
className: "h-5 w-5 shrink-0",
|
|
77
75
|
alt: "",
|
|
78
76
|
"aria-hidden": "true"
|
|
79
|
-
}),
|
|
80
|
-
}) : null, W ? /* @__PURE__ */
|
|
77
|
+
}), C ? /* @__PURE__ */ f("span", { children: C }) : null]
|
|
78
|
+
}) : null, W ? /* @__PURE__ */ f("a", {
|
|
81
79
|
className: "inline-flex items-center gap-2 rounded-md px-2 py-1 text-white/90 hover:bg-white/10 hover:text-white",
|
|
82
80
|
href: `mailto:${W}`,
|
|
83
81
|
"aria-label": W,
|
|
84
|
-
children: /* @__PURE__ */
|
|
85
|
-
}) : /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ f("span", { children: W })
|
|
83
|
+
}) : /* @__PURE__ */ f("span", {
|
|
86
84
|
className: "inline-flex items-center rounded-md px-2 py-1 text-destructive",
|
|
87
|
-
children:
|
|
85
|
+
children: te
|
|
88
86
|
})]
|
|
89
87
|
})]
|
|
90
88
|
})
|
|
91
89
|
})
|
|
92
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ f("header", {
|
|
93
91
|
className: "sticky top-0 z-30 border-b bg-white/90 backdrop-blur transition-transform duration-300",
|
|
94
|
-
style: { transform:
|
|
95
|
-
children: /* @__PURE__ */
|
|
92
|
+
style: { transform: I },
|
|
93
|
+
children: /* @__PURE__ */ p("div", {
|
|
96
94
|
className: "mx-auto flex max-w-7xl min-w-0 items-center gap-2 px-4 py-3 sm:gap-4 sm:px-6",
|
|
97
95
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
96
|
+
/* @__PURE__ */ p(h, {
|
|
99
97
|
to: L,
|
|
100
98
|
className: "flex min-w-0 flex-1 items-center gap-2 sm:gap-3",
|
|
101
|
-
children: [$ ? /* @__PURE__ */
|
|
99
|
+
children: [$ ? /* @__PURE__ */ f("span", {
|
|
102
100
|
className: "inline-flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-slate-200 bg-white",
|
|
103
|
-
children: /* @__PURE__ */
|
|
101
|
+
children: /* @__PURE__ */ f("img", {
|
|
104
102
|
src: Z,
|
|
105
103
|
alt: "",
|
|
106
104
|
className: "h-full w-full object-contain",
|
|
107
105
|
"aria-hidden": "true"
|
|
108
106
|
})
|
|
109
|
-
}) : Q ? null : /* @__PURE__ */
|
|
107
|
+
}) : Q ? null : /* @__PURE__ */ f("span", {
|
|
110
108
|
className: "inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border-2 border-dashed border-slate-300 bg-slate-50 text-slate-400",
|
|
111
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ f("span", {
|
|
112
110
|
className: "text-lg font-semibold leading-none",
|
|
113
111
|
"aria-hidden": "true",
|
|
114
112
|
children: "?"
|
|
115
113
|
})
|
|
116
|
-
}), /* @__PURE__ */
|
|
114
|
+
}), /* @__PURE__ */ p("span", {
|
|
117
115
|
className: "flex min-w-0 flex-col leading-tight",
|
|
118
|
-
children: [Q && !$ ? /* @__PURE__ */
|
|
116
|
+
children: [Q && !$ ? /* @__PURE__ */ f("img", {
|
|
119
117
|
src: X,
|
|
120
118
|
alt: U,
|
|
121
119
|
className: "h-8 max-w-[10rem] object-contain object-left sm:max-w-[14rem]"
|
|
122
|
-
}) : /* @__PURE__ */
|
|
120
|
+
}) : /* @__PURE__ */ f("span", {
|
|
123
121
|
className: "truncate text-sm font-semibold",
|
|
124
122
|
children: U
|
|
125
|
-
}), /* @__PURE__ */
|
|
126
|
-
className:
|
|
127
|
-
children:
|
|
123
|
+
}), /* @__PURE__ */ f("span", {
|
|
124
|
+
className: g("truncate text-xs text-slate-600", me && "text-destructive"),
|
|
125
|
+
children: Y
|
|
128
126
|
})]
|
|
129
127
|
})]
|
|
130
128
|
}),
|
|
131
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ p("nav", {
|
|
132
130
|
className: "hidden items-center gap-6 text-sm font-medium text-slate-700 md:flex",
|
|
133
131
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ f(h, {
|
|
135
133
|
className: "hover:text-slate-950",
|
|
136
134
|
to: `${L}${V}#categories`,
|
|
137
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ f("span", { children: w("nav_categories") })
|
|
138
136
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ f(h, {
|
|
140
138
|
className: "hover:text-slate-950",
|
|
141
139
|
to: `${L}${V}#featured`,
|
|
142
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ f("span", { children: w("nav_featured") })
|
|
143
141
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ f(h, {
|
|
145
143
|
className: "hover:text-slate-950",
|
|
146
144
|
to: H,
|
|
147
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ f("span", { children: w("nav_products") })
|
|
148
146
|
}),
|
|
149
|
-
(
|
|
147
|
+
(E?.itineraries.length ?? 0) > 0 ? /* @__PURE__ */ f(h, {
|
|
150
148
|
className: "hover:text-slate-950",
|
|
151
149
|
to: `${L}/itineraries`,
|
|
152
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ f("span", { children: w("nav_itineraries") })
|
|
153
151
|
}) : null,
|
|
154
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ f(h, {
|
|
155
153
|
className: "hover:text-slate-950",
|
|
156
154
|
to: `${L}${V}#contact`,
|
|
157
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ f("span", { children: w("nav_contact") })
|
|
158
156
|
})
|
|
159
157
|
]
|
|
160
158
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ p("div", {
|
|
162
160
|
className: "flex shrink-0 items-center gap-1.5 sm:gap-2",
|
|
163
161
|
children: [
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
className: "hidden sm:inline-flex",
|
|
168
|
-
onClick: I,
|
|
169
|
-
children: /* @__PURE__ */ l("span", { children: S("language_toggle") })
|
|
162
|
+
/* @__PURE__ */ f(s, {
|
|
163
|
+
languages: K,
|
|
164
|
+
className: "hidden sm:inline-flex"
|
|
170
165
|
}),
|
|
171
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ f(o, {
|
|
172
167
|
asChild: !0,
|
|
173
168
|
variant: "outline",
|
|
174
169
|
size: "sm",
|
|
175
|
-
className:
|
|
176
|
-
children: /* @__PURE__ */
|
|
170
|
+
className: g("relative h-9 w-9 gap-2 px-0 sm:w-auto sm:px-3", O > 0 && B ? "inline-flex" : "hidden"),
|
|
171
|
+
children: /* @__PURE__ */ p(h, {
|
|
177
172
|
to: pe,
|
|
178
|
-
"aria-label": `${
|
|
173
|
+
"aria-label": `${w("cart_button")} (${O})`,
|
|
179
174
|
children: [
|
|
180
|
-
/* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ f(y, {
|
|
181
176
|
className: "h-4 w-4",
|
|
182
177
|
"aria-hidden": "true"
|
|
183
178
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ f("span", {
|
|
185
180
|
className: "hidden sm:inline",
|
|
186
|
-
children:
|
|
181
|
+
children: w("cart_button")
|
|
187
182
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ f(a, {
|
|
189
184
|
className: "absolute -right-2 -top-2 h-5 min-w-5 rounded-full px-1.5 text-xs",
|
|
190
|
-
children: /* @__PURE__ */
|
|
185
|
+
children: /* @__PURE__ */ f("span", { children: O })
|
|
191
186
|
})
|
|
192
187
|
]
|
|
193
188
|
})
|
|
194
189
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ f(o, {
|
|
196
191
|
asChild: !0,
|
|
197
192
|
size: "sm",
|
|
198
193
|
className: "h-9 gap-1.5 px-2 sm:gap-2 sm:px-3",
|
|
199
|
-
children: /* @__PURE__ */
|
|
194
|
+
children: /* @__PURE__ */ p(h, {
|
|
200
195
|
to: H,
|
|
201
|
-
"aria-label":
|
|
196
|
+
"aria-label": w("cta_book_now"),
|
|
202
197
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ f("span", {
|
|
204
199
|
className: "sm:hidden",
|
|
205
|
-
children:
|
|
200
|
+
children: w("cta_book_short")
|
|
206
201
|
}),
|
|
207
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ f("span", {
|
|
208
203
|
className: "hidden sm:inline",
|
|
209
|
-
children:
|
|
204
|
+
children: w("cta_book_now")
|
|
210
205
|
}),
|
|
211
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ f(_, {
|
|
212
207
|
className: "h-4 w-4",
|
|
213
208
|
"aria-hidden": "true"
|
|
214
209
|
})
|
|
215
210
|
]
|
|
216
211
|
})
|
|
217
212
|
}),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
open:
|
|
220
|
-
onOpenChange:
|
|
213
|
+
/* @__PURE__ */ p(ne, {
|
|
214
|
+
open: A,
|
|
215
|
+
onOpenChange: j,
|
|
221
216
|
direction: "right",
|
|
222
|
-
children: [/* @__PURE__ */
|
|
217
|
+
children: [/* @__PURE__ */ f(ie, {
|
|
223
218
|
asChild: !0,
|
|
224
|
-
children: /* @__PURE__ */
|
|
219
|
+
children: /* @__PURE__ */ f(o, {
|
|
225
220
|
type: "button",
|
|
226
221
|
variant: "outline",
|
|
227
222
|
size: "icon",
|
|
228
223
|
className: "h-9 w-9 md:hidden",
|
|
229
|
-
"aria-label":
|
|
230
|
-
children: /* @__PURE__ */
|
|
224
|
+
"aria-label": w("mobile_menu_open"),
|
|
225
|
+
children: /* @__PURE__ */ f(v, {
|
|
231
226
|
className: "h-4 w-4",
|
|
232
227
|
"aria-hidden": "true"
|
|
233
228
|
})
|
|
234
229
|
})
|
|
235
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ p(l, {
|
|
236
231
|
className: "w-[min(22rem,calc(100vw-1.5rem))] bg-white",
|
|
237
|
-
"aria-label":
|
|
238
|
-
closeLabel:
|
|
232
|
+
"aria-label": w("mobile_menu_label"),
|
|
233
|
+
closeLabel: w("mobile_menu_close"),
|
|
239
234
|
showCloseButton: !0,
|
|
240
235
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ p(d, {
|
|
242
237
|
className: "border-b border-slate-200 px-5 pb-4 pt-6 text-left",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
238
|
+
children: [/* @__PURE__ */ f(re, { children: U }), /* @__PURE__ */ f(u, {
|
|
244
239
|
className: "break-words",
|
|
245
|
-
children:
|
|
240
|
+
children: Y
|
|
246
241
|
})]
|
|
247
242
|
}),
|
|
248
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ f("nav", {
|
|
249
244
|
className: "grid gap-1 overflow-y-auto p-3",
|
|
250
|
-
"aria-label":
|
|
251
|
-
children:
|
|
245
|
+
"aria-label": w("mobile_menu_label"),
|
|
246
|
+
children: ge.map((e) => /* @__PURE__ */ f(c, {
|
|
252
247
|
asChild: !0,
|
|
253
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ f(h, {
|
|
254
249
|
to: e.to,
|
|
255
250
|
className: "flex min-h-11 items-center rounded-lg px-3 py-2 text-sm font-medium text-slate-700 transition-colors hover:bg-slate-100 hover:text-slate-950",
|
|
256
251
|
children: e.label
|
|
257
252
|
})
|
|
258
253
|
}, `${e.to}-${e.label}`))
|
|
259
254
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ p("div", {
|
|
261
256
|
className: "mt-auto grid gap-3 border-t border-slate-200 p-4",
|
|
262
|
-
children: [/* @__PURE__ */
|
|
257
|
+
children: [/* @__PURE__ */ f(c, {
|
|
263
258
|
asChild: !0,
|
|
264
|
-
children: /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ f(o, {
|
|
265
260
|
asChild: !0,
|
|
266
261
|
className: "w-full gap-2",
|
|
267
|
-
children: /* @__PURE__ */
|
|
262
|
+
children: /* @__PURE__ */ p(h, {
|
|
268
263
|
to: H,
|
|
269
|
-
children: [/* @__PURE__ */
|
|
264
|
+
children: [/* @__PURE__ */ f("span", { children: w("cta_book_now") }), /* @__PURE__ */ f(_, {
|
|
270
265
|
className: "h-4 w-4",
|
|
271
266
|
"aria-hidden": "true"
|
|
272
267
|
})]
|
|
273
268
|
})
|
|
274
269
|
})
|
|
275
|
-
}), /* @__PURE__ */
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
className: "w-full",
|
|
279
|
-
onClick: I,
|
|
280
|
-
children: /* @__PURE__ */ l("span", { children: S("language_toggle") })
|
|
270
|
+
}), /* @__PURE__ */ f(s, {
|
|
271
|
+
languages: K,
|
|
272
|
+
className: "h-10 w-full justify-between"
|
|
281
273
|
})]
|
|
282
274
|
})
|
|
283
275
|
]
|
|
@@ -291,4 +283,4 @@ function b({ storefrontConfiguration: r, whatsappHref: b, whatsappPhoneDisplay:
|
|
|
291
283
|
});
|
|
292
284
|
}
|
|
293
285
|
//#endregion
|
|
294
|
-
export {
|
|
286
|
+
export { S as Header };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type LanguageSelectorProps = {
|
|
2
|
+
languages?: readonly string[] | null;
|
|
3
|
+
className?: string;
|
|
4
|
+
align?: "start" | "center" | "end";
|
|
5
|
+
};
|
|
6
|
+
export declare function LanguageSelector({ languages, className, align, }: LanguageSelectorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LanguageSelector/index.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;CACnC,CAAA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,SAAS,EACT,KAAa,GACd,EAAE,qBAAqB,kDAkEvB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { normalizeStorefrontI18nLanguage as e, resolveStorefrontI18nLanguageOptions as t } from "../../i18n/languages.js";
|
|
2
|
+
import { Button as n } from "../../ui/button.js";
|
|
3
|
+
import { useState as r } from "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { useTranslation as o } from "react-i18next";
|
|
6
|
+
import { cn as s } from "@rpcbase/ui";
|
|
7
|
+
import { ChevronDown as c } from "lucide-react";
|
|
8
|
+
import { Menu as l } from "@base-ui/react/menu";
|
|
9
|
+
//#region src/components/LanguageSelector/index.tsx
|
|
10
|
+
function u({ languages: u, className: d, align: f = "end" }) {
|
|
11
|
+
let { t: p, i18n: m } = o(), [h, g] = r(!1), _ = t(u), v = e(m.resolvedLanguage ?? m.language), y = _.find(({ code: e }) => e === v) ?? _[0];
|
|
12
|
+
return !y || _.length < 2 ? null : /* @__PURE__ */ a(l.Root, {
|
|
13
|
+
open: h,
|
|
14
|
+
onOpenChange: g,
|
|
15
|
+
children: [/* @__PURE__ */ i(l.Trigger, {
|
|
16
|
+
nativeButton: !0,
|
|
17
|
+
render: /* @__PURE__ */ a(n, {
|
|
18
|
+
type: "button",
|
|
19
|
+
variant: "outline",
|
|
20
|
+
size: "sm",
|
|
21
|
+
"aria-label": p("language_selector_label"),
|
|
22
|
+
className: s("h-9 gap-1 rounded-md px-2 uppercase shadow-none focus-visible:ring-2", d),
|
|
23
|
+
"data-testid": "storefront-language-selector-trigger",
|
|
24
|
+
children: [/* @__PURE__ */ a("span", {
|
|
25
|
+
className: "flex items-center gap-1",
|
|
26
|
+
children: [/* @__PURE__ */ i("span", {
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: y.flag
|
|
29
|
+
}), /* @__PURE__ */ i("span", { children: y.code })]
|
|
30
|
+
}), /* @__PURE__ */ i(c, {
|
|
31
|
+
className: "size-3.5",
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
})]
|
|
34
|
+
})
|
|
35
|
+
}), /* @__PURE__ */ i(l.Portal, { children: /* @__PURE__ */ i(l.Positioner, {
|
|
36
|
+
align: f,
|
|
37
|
+
sideOffset: 4,
|
|
38
|
+
positionMethod: "fixed",
|
|
39
|
+
className: "z-[60]",
|
|
40
|
+
collisionPadding: 8,
|
|
41
|
+
collisionAvoidance: {
|
|
42
|
+
side: "flip",
|
|
43
|
+
align: "shift",
|
|
44
|
+
fallbackAxisSide: "none"
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ i(l.Popup, {
|
|
47
|
+
className: "min-w-44 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md transition-opacity duration-75 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",
|
|
48
|
+
children: _.map((e) => /* @__PURE__ */ a(l.Item, {
|
|
49
|
+
onClick: (t) => {
|
|
50
|
+
t.defaultPrevented || (m.changeLanguage(e.code), g(!1));
|
|
51
|
+
},
|
|
52
|
+
className: s("flex cursor-pointer select-none items-center gap-2 whitespace-nowrap rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground", y.code === e.code && "bg-accent"),
|
|
53
|
+
"data-testid": `storefront-language-selector-option-${e.code}`,
|
|
54
|
+
children: [/* @__PURE__ */ i("span", {
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: e.flag
|
|
57
|
+
}), /* @__PURE__ */ a("span", { children: [
|
|
58
|
+
e.name,
|
|
59
|
+
" (",
|
|
60
|
+
e.code.toUpperCase(),
|
|
61
|
+
")"
|
|
62
|
+
] })]
|
|
63
|
+
}, e.code))
|
|
64
|
+
})
|
|
65
|
+
}) })]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { u as LanguageSelector };
|
|
@@ -3,14 +3,8 @@ import { StorefrontCartSummaryLine } from '../../lib/cartSummary';
|
|
|
3
3
|
type StorefrontCartPanelProps = {
|
|
4
4
|
lines: StorefrontCartSummaryLine[];
|
|
5
5
|
itemCount: number;
|
|
6
|
-
totalPerBaseUnitMinor: number;
|
|
7
6
|
baseUnitLabel: string;
|
|
8
|
-
|
|
9
|
-
discountedEstimatedTotalMinor?: number;
|
|
10
|
-
discountAmountMinor?: number;
|
|
11
|
-
lateReturnSurchargeMinor?: number;
|
|
12
|
-
couponCode?: string;
|
|
13
|
-
durationInBaseUnitLabel?: string;
|
|
7
|
+
totalMinor?: number;
|
|
14
8
|
title?: string;
|
|
15
9
|
description?: string;
|
|
16
10
|
checkoutPath?: string;
|
|
@@ -24,6 +18,6 @@ type StorefrontCartPanelProps = {
|
|
|
24
18
|
onRemove?: (key: string) => void;
|
|
25
19
|
onClear?: () => void;
|
|
26
20
|
};
|
|
27
|
-
export declare function StorefrontCartPanel({ lines, itemCount,
|
|
21
|
+
export declare function StorefrontCartPanel({ lines, itemCount, baseUnitLabel, totalMinor, title, description, checkoutPath, showCheckoutAction, showClearAction, editable, summaryAddon, pricingSummary, stickyTopClassName, onQuantityChange, onRemove, onClear, }: StorefrontCartPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
28
22
|
export {};
|
|
29
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StorefrontCartPanel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAQtE,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,yBAAyB,EAAE,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StorefrontCartPanel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAQtE,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,yBAAyB,EAAE,CAAA;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,cAAc,CAAC,EAAE,SAAS,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1D,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,kBAA0B,EAC1B,eAAuB,EACvB,QAAe,EACf,YAAY,EACZ,cAAc,EACd,kBAA6B,EAC7B,gBAAgB,EAChB,QAAQ,EACR,OAAO,GACR,EAAE,wBAAwB,2CAsJ1B"}
|