@loczer/storefront-sdk 0.220.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 +3 -8
- package/dist/components/StorefrontCartPanel/index.d.ts.map +1 -1
- package/dist/components/StorefrontCartPanel/index.js +65 -108
- 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 +3 -2
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +6 -5
- package/dist/i18n/fr.d.ts +3 -2
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +6 -5
- 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 +36 -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 +236 -272
- 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/CheckoutDetailsCard.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutDetailsCard.js +38 -25
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts +6 -2
- package/dist/pages/checkout/components/CheckoutSummaryColumn.d.ts.map +1 -1
- package/dist/pages/checkout/components/CheckoutSummaryColumn.js +48 -19
- 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
- package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.d.ts +0 -24
- package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.d.ts.map +0 -1
- package/dist/pages/checkout/components/CheckoutPaymentSummaryCard.js +0 -158
|
@@ -4,97 +4,97 @@ import { Button as n } from "../../ui/button.js";
|
|
|
4
4
|
import { Input as r } from "../../ui/input.js";
|
|
5
5
|
import { Card as i } from "../../ui/card.js";
|
|
6
6
|
import { ProductWarningNotice as a } from "../ProductWarningNotice/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import { Link as
|
|
9
|
-
import { useTranslation as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { ArrowRight as
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
import { Link as c } from "@rpcbase/router";
|
|
9
|
+
import { useTranslation as l } from "react-i18next";
|
|
10
|
+
import { cn as u } from "@rpcbase/ui";
|
|
11
|
+
import { ArrowRight as d, Trash2 as f } from "lucide-react";
|
|
12
12
|
//#region src/components/StorefrontCartPanel/index.tsx
|
|
13
|
-
function
|
|
14
|
-
let { t:
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
children: [/* @__PURE__ */
|
|
13
|
+
function p({ lines: p, itemCount: m, baseUnitLabel: h, totalMinor: g, title: _, description: v, checkoutPath: y, showCheckoutAction: b = !1, showClearAction: x = !1, editable: S = !0, summaryAddon: C, pricingSummary: w, stickyTopClassName: T = "top-24", onQuantityChange: E, onRemove: D, onClear: O }) {
|
|
14
|
+
let { t: k, i18n: A } = l();
|
|
15
|
+
return /* @__PURE__ */ s(i, {
|
|
16
|
+
className: u("sticky border-slate-200 bg-white shadow-sm", T),
|
|
17
|
+
children: [/* @__PURE__ */ s("div", {
|
|
18
18
|
className: "border-b border-slate-200 px-4 py-4",
|
|
19
|
-
children: [/* @__PURE__ */
|
|
19
|
+
children: [/* @__PURE__ */ s("div", {
|
|
20
20
|
className: "flex items-center justify-between gap-3",
|
|
21
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ o("p", {
|
|
22
22
|
className: "text-sm font-semibold text-slate-950",
|
|
23
|
-
children: /* @__PURE__ */
|
|
24
|
-
}), /* @__PURE__ */
|
|
23
|
+
children: /* @__PURE__ */ o("span", { children: _ ?? k("cart_title") })
|
|
24
|
+
}), /* @__PURE__ */ o(t, {
|
|
25
25
|
variant: "outline",
|
|
26
26
|
className: "border-slate-200 bg-white text-slate-700",
|
|
27
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ o("span", { children: k("cart_items_count", { count: m }) })
|
|
28
28
|
})]
|
|
29
|
-
}),
|
|
29
|
+
}), v ? /* @__PURE__ */ o("p", {
|
|
30
30
|
className: "mt-1 text-xs text-slate-600",
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ o("span", { children: v })
|
|
32
32
|
}) : null]
|
|
33
|
-
}), /* @__PURE__ */
|
|
33
|
+
}), /* @__PURE__ */ s("div", {
|
|
34
34
|
className: "grid gap-3 p-4",
|
|
35
35
|
children: [
|
|
36
|
-
|
|
36
|
+
p.length === 0 ? /* @__PURE__ */ o("p", {
|
|
37
37
|
className: "text-sm text-slate-600",
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
}) : /* @__PURE__ */
|
|
38
|
+
children: /* @__PURE__ */ o("span", { children: k("cart_empty") })
|
|
39
|
+
}) : /* @__PURE__ */ o("ul", {
|
|
40
40
|
className: "divide-y divide-slate-200",
|
|
41
|
-
children:
|
|
42
|
-
let
|
|
43
|
-
return /* @__PURE__ */
|
|
41
|
+
children: p.map((i) => {
|
|
42
|
+
let c = e(i.unitPriceMinor, A.language), l = i.insufficientCapacity === !0, u = i.availabilityIssue === "quantity_unavailable" ? k("availability_quantity_unavailable") : k("availability_out_of_stock");
|
|
43
|
+
return /* @__PURE__ */ s("li", {
|
|
44
44
|
className: "flex items-start justify-between gap-3 py-4 first:pt-0 last:pb-0",
|
|
45
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ s("div", {
|
|
46
46
|
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ o("p", {
|
|
49
49
|
className: "truncate text-sm font-medium text-slate-950",
|
|
50
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ o("span", { children: i.productName })
|
|
51
51
|
}),
|
|
52
|
-
i.productVariantLabel ? /* @__PURE__ */
|
|
52
|
+
i.productVariantLabel ? /* @__PURE__ */ o("p", {
|
|
53
53
|
className: "text-xs text-slate-600",
|
|
54
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ o("span", { children: `${k(i.productVariantIsSize ? "product_size_label" : "product_variant_label")}: ${i.productVariantLabel}` })
|
|
55
55
|
}) : null,
|
|
56
|
-
i.productVariantDescription ? /* @__PURE__ */
|
|
56
|
+
i.productVariantDescription ? /* @__PURE__ */ o("p", {
|
|
57
57
|
className: "text-xs text-slate-500",
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ o("span", { children: i.productVariantDescription })
|
|
59
59
|
}) : null,
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ o(a, { warning: i.productWarning }),
|
|
61
|
+
/* @__PURE__ */ o("p", {
|
|
62
62
|
className: "text-xs text-slate-600",
|
|
63
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ o("span", { children: k("cart_line_meta", {
|
|
64
64
|
quantity: i.quantity,
|
|
65
|
-
price:
|
|
66
|
-
unit:
|
|
65
|
+
price: c,
|
|
66
|
+
unit: h
|
|
67
67
|
}) })
|
|
68
68
|
}),
|
|
69
|
-
l ? /* @__PURE__ */
|
|
69
|
+
l ? /* @__PURE__ */ o("div", {
|
|
70
70
|
className: "flex flex-col items-start gap-1 pt-1",
|
|
71
|
-
children: /* @__PURE__ */
|
|
71
|
+
children: /* @__PURE__ */ o(t, {
|
|
72
72
|
variant: "destructive",
|
|
73
|
-
children: /* @__PURE__ */
|
|
73
|
+
children: /* @__PURE__ */ o("span", { children: u })
|
|
74
74
|
})
|
|
75
75
|
}) : null
|
|
76
76
|
]
|
|
77
|
-
}),
|
|
77
|
+
}), S ? /* @__PURE__ */ s("div", {
|
|
78
78
|
className: "flex items-center gap-2",
|
|
79
|
-
children: [
|
|
79
|
+
children: [E ? /* @__PURE__ */ o(r, {
|
|
80
80
|
type: "number",
|
|
81
81
|
min: 1,
|
|
82
82
|
max: 99,
|
|
83
83
|
value: i.quantity,
|
|
84
84
|
onChange: (e) => {
|
|
85
85
|
let t = Number(e.target.value);
|
|
86
|
-
|
|
86
|
+
E(i.key, Number.isFinite(t) ? t : 0);
|
|
87
87
|
},
|
|
88
88
|
className: "h-9 w-16",
|
|
89
|
-
"aria-label":
|
|
90
|
-
}) : null,
|
|
89
|
+
"aria-label": k("quantity_label")
|
|
90
|
+
}) : null, D ? /* @__PURE__ */ o(n, {
|
|
91
91
|
type: "button",
|
|
92
92
|
variant: "ghost",
|
|
93
93
|
size: "icon",
|
|
94
94
|
className: "h-8 w-8 text-slate-500 hover:bg-slate-50 hover:text-slate-700",
|
|
95
|
-
onClick: () =>
|
|
96
|
-
"aria-label":
|
|
97
|
-
children: /* @__PURE__ */
|
|
95
|
+
onClick: () => D(i.key),
|
|
96
|
+
"aria-label": k("remove_from_cart"),
|
|
97
|
+
children: /* @__PURE__ */ o(f, {
|
|
98
98
|
className: "h-4 w-4",
|
|
99
99
|
"aria-hidden": "true"
|
|
100
100
|
})
|
|
@@ -103,78 +103,35 @@ function m({ lines: m, itemCount: h, totalPerBaseUnitMinor: g, baseUnitLabel: _,
|
|
|
103
103
|
}, i.key);
|
|
104
104
|
})
|
|
105
105
|
}),
|
|
106
|
-
|
|
107
|
-
/* @__PURE__ */
|
|
106
|
+
C,
|
|
107
|
+
w ?? (typeof g == "number" ? /* @__PURE__ */ s("div", {
|
|
108
108
|
className: "flex items-center justify-between gap-3 border-t border-slate-200 pt-3 text-sm",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ o("p", {
|
|
110
110
|
className: "text-slate-700",
|
|
111
|
-
children: /* @__PURE__ */
|
|
112
|
-
}), /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ o("span", { children: k("cart_total") })
|
|
112
|
+
}), /* @__PURE__ */ o("p", {
|
|
113
113
|
className: "font-semibold text-slate-950",
|
|
114
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ o("span", { children: e(g, A.language) })
|
|
115
115
|
})]
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
C ? /* @__PURE__ */ c("div", {
|
|
119
|
-
className: "flex items-center justify-between gap-3 text-sm",
|
|
120
|
-
children: [/* @__PURE__ */ s("p", {
|
|
121
|
-
className: "text-slate-700",
|
|
122
|
-
children: /* @__PURE__ */ s("span", { children: F("checkout_estimated_duration") })
|
|
123
|
-
}), /* @__PURE__ */ s(t, {
|
|
124
|
-
variant: "outline",
|
|
125
|
-
className: "border-slate-200 bg-white text-slate-700",
|
|
126
|
-
children: /* @__PURE__ */ s("span", { children: C })
|
|
127
|
-
})]
|
|
128
|
-
}) : null,
|
|
129
|
-
typeof b == "number" && b > 0 ? /* @__PURE__ */ c("div", {
|
|
130
|
-
className: "flex items-center justify-between gap-3 text-sm",
|
|
131
|
-
children: [/* @__PURE__ */ s("p", {
|
|
132
|
-
className: "text-success",
|
|
133
|
-
children: /* @__PURE__ */ s("span", { children: F("checkout_coupon_discount", { code: S ?? "" }) })
|
|
134
|
-
}), /* @__PURE__ */ s("p", {
|
|
135
|
-
className: "font-semibold text-success",
|
|
136
|
-
children: /* @__PURE__ */ s("span", { children: `-${e(b, I.language)}` })
|
|
137
|
-
})]
|
|
138
|
-
}) : null,
|
|
139
|
-
typeof x == "number" && x > 0 ? /* @__PURE__ */ c("div", {
|
|
140
|
-
className: "flex items-center justify-between gap-3 text-sm",
|
|
141
|
-
children: [/* @__PURE__ */ s("p", {
|
|
142
|
-
className: "text-slate-700",
|
|
143
|
-
children: /* @__PURE__ */ s("span", { children: F("checkout_late_return_fee") })
|
|
144
|
-
}), /* @__PURE__ */ s("p", {
|
|
145
|
-
className: "font-semibold text-slate-950",
|
|
146
|
-
children: /* @__PURE__ */ s("span", { children: `+${e(x, I.language)}` })
|
|
147
|
-
})]
|
|
148
|
-
}) : null,
|
|
149
|
-
/* @__PURE__ */ c("div", {
|
|
150
|
-
className: "flex items-center justify-between gap-3 text-sm",
|
|
151
|
-
children: [/* @__PURE__ */ s("p", {
|
|
152
|
-
className: "text-slate-700",
|
|
153
|
-
children: /* @__PURE__ */ s("span", { children: F("checkout_estimated_total") })
|
|
154
|
-
}), /* @__PURE__ */ s("p", {
|
|
155
|
-
className: "font-semibold text-slate-950",
|
|
156
|
-
children: /* @__PURE__ */ s("span", { children: e(y ?? v, I.language) })
|
|
157
|
-
})]
|
|
158
|
-
})
|
|
159
|
-
] }) : null,
|
|
160
|
-
/* @__PURE__ */ c("div", {
|
|
116
|
+
}) : null),
|
|
117
|
+
/* @__PURE__ */ s("div", {
|
|
161
118
|
className: "grid gap-2",
|
|
162
|
-
children: [
|
|
163
|
-
to:
|
|
164
|
-
className:
|
|
165
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: [b && y ? /* @__PURE__ */ o(c, {
|
|
120
|
+
to: y,
|
|
121
|
+
className: u(p.length > 0 ? "block" : "hidden"),
|
|
122
|
+
children: /* @__PURE__ */ s(n, {
|
|
166
123
|
className: "w-full gap-2",
|
|
167
|
-
children: [/* @__PURE__ */
|
|
124
|
+
children: [/* @__PURE__ */ o("span", { children: k("checkout_button") }), /* @__PURE__ */ o(d, {
|
|
168
125
|
className: "h-4 w-4",
|
|
169
126
|
"aria-hidden": "true"
|
|
170
127
|
})]
|
|
171
128
|
})
|
|
172
|
-
}) : null,
|
|
129
|
+
}) : null, x && O ? /* @__PURE__ */ o(n, {
|
|
173
130
|
type: "button",
|
|
174
131
|
variant: "outline",
|
|
175
|
-
className:
|
|
176
|
-
onClick:
|
|
177
|
-
children: /* @__PURE__ */
|
|
132
|
+
className: u(p.length > 0 ? "w-full gap-2" : "hidden"),
|
|
133
|
+
onClick: O,
|
|
134
|
+
children: /* @__PURE__ */ o("span", { children: k("cart_clear") })
|
|
178
135
|
}) : null]
|
|
179
136
|
})
|
|
180
137
|
]
|
|
@@ -182,4 +139,4 @@ function m({ lines: m, itemCount: h, totalPerBaseUnitMinor: g, baseUnitLabel: _,
|
|
|
182
139
|
});
|
|
183
140
|
}
|
|
184
141
|
//#endregion
|
|
185
|
-
export {
|
|
142
|
+
export { p as StorefrontCartPanel };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { StorefrontI18nLanguage } from './languages';
|
|
2
|
+
export { normalizeStorefrontI18nLanguage } from './languages';
|
|
3
|
+
export type { StorefrontI18nLanguage } from './languages';
|
|
3
4
|
export declare const resolveStorefrontI18nRequestLanguage: ({ cookieHeader, acceptLanguageHeader, configuredLanguages, configuredFallbackLanguage, }: {
|
|
4
5
|
cookieHeader?: unknown;
|
|
5
6
|
acceptLanguageHeader?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/I18nProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/I18nProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AA+EzD,eAAO,MAAM,oCAAoC,GAAI,0FAKlD;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IAC9C,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3C,KAAG,sBAGmF,CAAA;AA6BvF,eAAO,MAAM,4BAA4B,GACvC,sBAAsB,SAAS,MAAM,EAAE,GAAG,IAAI,EAC9C,6BAA6B,MAAM,GAAG,IAAI,KACzC,sBAUF,CAAA;AAgED,wBAAgB,YAAY,CAAC,EAC3B,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,QAAQ,GACT,EAAE;IACD,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IAC9C,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,2CA+BA"}
|
|
@@ -1,101 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { storefront as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { STOREFRONT_I18N_LANGUAGE_CODES as e, normalizeStorefrontI18nLanguage as t } from "./languages.js";
|
|
2
|
+
import { storefront as n } from "./en.js";
|
|
3
|
+
import { storefront as r } from "./fr.js";
|
|
4
|
+
import { useEffect as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
6
|
+
import { I18nextProvider as c } from "react-i18next";
|
|
7
|
+
import { createInstance as l } from "i18next";
|
|
7
8
|
//#region src/i18n/I18nProvider.tsx
|
|
8
|
-
var
|
|
9
|
-
en: { [
|
|
10
|
-
fr: { [
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let n = h(t);
|
|
17
|
-
if (n) return n;
|
|
18
|
-
for (let t of e ?? []) {
|
|
19
|
-
let e = h(t);
|
|
9
|
+
var u = "storefront", d = "loczer_storefront_lng", f = "loczer_storefront_lng", p = 3600 * 24 * 365, m = [...e], h = "en", g = {
|
|
10
|
+
en: { [u]: n },
|
|
11
|
+
fr: { [u]: r }
|
|
12
|
+
}, _ = (e, n) => {
|
|
13
|
+
let r = t(n);
|
|
14
|
+
if (r) return r;
|
|
15
|
+
for (let n of e ?? []) {
|
|
16
|
+
let e = t(n);
|
|
20
17
|
if (e) return e;
|
|
21
18
|
}
|
|
22
|
-
return
|
|
23
|
-
},
|
|
24
|
-
let
|
|
25
|
-
for (let e of
|
|
26
|
-
let [
|
|
27
|
-
if (
|
|
28
|
-
let
|
|
19
|
+
return h;
|
|
20
|
+
}, v = (e) => {
|
|
21
|
+
let n = Array.isArray(e) ? e.join(";") : typeof e == "string" ? e : "";
|
|
22
|
+
for (let e of n.split(";")) {
|
|
23
|
+
let [n, ...r] = e.trim().split("=");
|
|
24
|
+
if (n !== f || r.length === 0) continue;
|
|
25
|
+
let i = r.join("=");
|
|
29
26
|
try {
|
|
30
|
-
return
|
|
27
|
+
return t(decodeURIComponent(i));
|
|
31
28
|
} catch {
|
|
32
|
-
return
|
|
29
|
+
return t(i);
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
return null;
|
|
36
|
-
},
|
|
37
|
-
let [
|
|
33
|
+
}, y = (e) => (Array.isArray(e) ? e.join(",") : typeof e == "string" ? e : "").split(",").map((e) => {
|
|
34
|
+
let [n, ...r] = e.trim().split(";"), i = r.find((e) => e.trim().startsWith("q=")), a = i ? Number(i.trim().slice(2)) : 1;
|
|
38
35
|
return {
|
|
39
|
-
language:
|
|
40
|
-
quality: Number.isFinite(
|
|
36
|
+
language: t(n),
|
|
37
|
+
quality: Number.isFinite(a) ? a : 1
|
|
41
38
|
};
|
|
42
|
-
}).filter((e) => !!e.language && e.quality > 0).sort((e, t) => t.quality - e.quality)[0]?.language ?? null,
|
|
39
|
+
}).filter((e) => !!e.language && e.quality > 0).sort((e, t) => t.quality - e.quality)[0]?.language ?? null, b = ({ cookieHeader: e, acceptLanguageHeader: t, configuredLanguages: n, configuredFallbackLanguage: r }) => v(e) ?? y(t) ?? _(n, r), x = () => {
|
|
43
40
|
if (typeof window > "u") return null;
|
|
44
41
|
try {
|
|
45
|
-
return
|
|
42
|
+
return t(window.localStorage.getItem(d));
|
|
46
43
|
} catch {
|
|
47
44
|
return null;
|
|
48
45
|
}
|
|
49
|
-
},
|
|
46
|
+
}, S = () => typeof document > "u" ? null : t(document.documentElement.lang), C = () => {
|
|
50
47
|
if (typeof navigator > "u") return null;
|
|
51
48
|
for (let e of navigator.languages ?? []) {
|
|
52
|
-
let
|
|
53
|
-
if (
|
|
49
|
+
let n = t(e);
|
|
50
|
+
if (n) return n;
|
|
54
51
|
}
|
|
55
|
-
return
|
|
56
|
-
},
|
|
52
|
+
return t(navigator.language);
|
|
53
|
+
}, w = (e, t) => typeof window > "u" ? _(e, t) : v(document.cookie) ?? S() ?? x() ?? C() ?? _(e, t), T = (e) => {
|
|
57
54
|
if (!(typeof window > "u")) {
|
|
58
55
|
try {
|
|
59
|
-
window.localStorage.setItem(
|
|
56
|
+
window.localStorage.setItem(d, e);
|
|
60
57
|
} catch {}
|
|
61
|
-
document.cookie = `${
|
|
58
|
+
document.cookie = `${f}=${encodeURIComponent(e)}; Path=/; Max-Age=${p}; SameSite=Lax`;
|
|
62
59
|
}
|
|
63
|
-
},
|
|
64
|
-
let n =
|
|
60
|
+
}, E = (e, t) => {
|
|
61
|
+
let n = l();
|
|
65
62
|
return n.init({
|
|
66
|
-
resources:
|
|
63
|
+
resources: g,
|
|
67
64
|
lng: e,
|
|
68
65
|
fallbackLng: t,
|
|
69
|
-
supportedLngs:
|
|
66
|
+
supportedLngs: m,
|
|
70
67
|
nonExplicitSupportedLngs: !0,
|
|
71
68
|
load: "languageOnly",
|
|
72
|
-
ns: [
|
|
73
|
-
defaultNS:
|
|
69
|
+
ns: [u],
|
|
70
|
+
defaultNS: u,
|
|
74
71
|
interpolation: { escapeValue: !1 },
|
|
75
72
|
react: { useSuspense: !1 },
|
|
76
73
|
initAsync: !1
|
|
77
74
|
}), n;
|
|
78
|
-
},
|
|
79
|
-
if (
|
|
80
|
-
let
|
|
81
|
-
return
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
}),
|
|
75
|
+
}, D = null, O = null, k = (e, n) => {
|
|
76
|
+
if (D && O === n) return D;
|
|
77
|
+
let r = E(e, n);
|
|
78
|
+
return r.on("languageChanged", (e) => {
|
|
79
|
+
let i = t(e) ?? n;
|
|
80
|
+
T(i), i !== e && r.changeLanguage(i);
|
|
81
|
+
}), D = r, O = n, r;
|
|
85
82
|
};
|
|
86
|
-
function
|
|
87
|
-
let
|
|
88
|
-
if (typeof window > "u") return
|
|
89
|
-
let e =
|
|
90
|
-
return
|
|
83
|
+
function A({ initialLanguage: e, configuredLanguages: n, configuredFallbackLanguage: r, children: l }) {
|
|
84
|
+
let d = t(e), f = _(n, r), p = d ?? w(n, f), m = a(d), [h] = o(() => {
|
|
85
|
+
if (typeof window > "u") return E(p, f);
|
|
86
|
+
let e = k(p, f);
|
|
87
|
+
return t(e.language) !== p && e.changeLanguage(p), e;
|
|
91
88
|
});
|
|
92
|
-
return
|
|
93
|
-
!
|
|
94
|
-
}, [
|
|
95
|
-
i18n:
|
|
96
|
-
defaultNS:
|
|
89
|
+
return i(() => {
|
|
90
|
+
!d || m.current === d || (m.current = d, t(h.language) !== d && h.changeLanguage(d));
|
|
91
|
+
}, [h, d]), /* @__PURE__ */ s(c, {
|
|
92
|
+
i18n: h,
|
|
93
|
+
defaultNS: u,
|
|
97
94
|
children: l
|
|
98
95
|
});
|
|
99
96
|
}
|
|
100
97
|
//#endregion
|
|
101
|
-
export {
|
|
98
|
+
export { A as I18nProvider, w as detectStorefrontI18nLanguage, t as normalizeStorefrontI18nLanguage, b as resolveStorefrontI18nRequestLanguage };
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const storefront: {
|
|
|
9
9
|
nav_products: string;
|
|
10
10
|
nav_itineraries: string;
|
|
11
11
|
nav_contact: string;
|
|
12
|
-
|
|
12
|
+
language_selector_label: string;
|
|
13
13
|
cta_book_now: string;
|
|
14
14
|
cta_book_short: string;
|
|
15
15
|
mobile_menu_open: string;
|
|
@@ -185,7 +185,7 @@ export declare const storefront: {
|
|
|
185
185
|
cart_empty_description: string;
|
|
186
186
|
cart_line_meta: string;
|
|
187
187
|
remove_from_cart: string;
|
|
188
|
-
|
|
188
|
+
cart_total: string;
|
|
189
189
|
cart_clear: string;
|
|
190
190
|
booking_select_variant_cancel: string;
|
|
191
191
|
close_modal: string;
|
|
@@ -207,6 +207,7 @@ export declare const storefront: {
|
|
|
207
207
|
checkout_subtitle: string;
|
|
208
208
|
checkout_summary_title: string;
|
|
209
209
|
checkout_summary_description: string;
|
|
210
|
+
checkout_booking_subtotal: string;
|
|
210
211
|
checkout_estimated_duration: string;
|
|
211
212
|
checkout_estimated_total: string;
|
|
212
213
|
checkout_form_title: string;
|
package/dist/i18n/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/i18n/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAogBtB,CAAA"}
|
package/dist/i18n/en.js
CHANGED
|
@@ -10,7 +10,7 @@ var e = {
|
|
|
10
10
|
nav_products: "Bikes",
|
|
11
11
|
nav_itineraries: "Routes",
|
|
12
12
|
nav_contact: "Contact",
|
|
13
|
-
|
|
13
|
+
language_selector_label: "Change language",
|
|
14
14
|
cta_book_now: "Book now",
|
|
15
15
|
cta_book_short: "Book",
|
|
16
16
|
mobile_menu_open: "Open navigation menu",
|
|
@@ -186,7 +186,7 @@ var e = {
|
|
|
186
186
|
cart_empty_description: "Add a bike (and accessories) to continue.",
|
|
187
187
|
cart_line_meta: "Qty {{quantity}} · {{price}} / {{unit}}",
|
|
188
188
|
remove_from_cart: "Remove from cart",
|
|
189
|
-
|
|
189
|
+
cart_total: "Total",
|
|
190
190
|
cart_clear: "Clear cart",
|
|
191
191
|
booking_select_variant_cancel: "Cancel",
|
|
192
192
|
close_modal: "Close",
|
|
@@ -208,8 +208,9 @@ var e = {
|
|
|
208
208
|
checkout_subtitle: "Confirm your details and payment · {{duration}}",
|
|
209
209
|
checkout_summary_title: "Summary",
|
|
210
210
|
checkout_summary_description: "Cart and pricing recap.",
|
|
211
|
+
checkout_booking_subtotal: "Subtotal",
|
|
211
212
|
checkout_estimated_duration: "Estimated duration",
|
|
212
|
-
checkout_estimated_total: "
|
|
213
|
+
checkout_estimated_total: "Total",
|
|
213
214
|
checkout_form_title: "Your details",
|
|
214
215
|
checkout_form_description: "Enter your details for this booking, and add any useful information in the notes.",
|
|
215
216
|
checkout_first_name_label: "First name",
|
|
@@ -222,7 +223,7 @@ var e = {
|
|
|
222
223
|
checkout_email_placeholder: "jane@example.com",
|
|
223
224
|
checkout_phone_label: "Phone",
|
|
224
225
|
checkout_phone_placeholder: "+1 555 555 5555",
|
|
225
|
-
checkout_notes_label: "Notes
|
|
226
|
+
checkout_notes_label: "Notes",
|
|
226
227
|
checkout_notes_placeholder: "Any details about your booking…",
|
|
227
228
|
checkout_continue_to_payment: "Continue to payment",
|
|
228
229
|
checkout_payment_title: "Card payment",
|
|
@@ -269,7 +270,7 @@ var e = {
|
|
|
269
270
|
checkout_payment_loading: "Checking payment options…",
|
|
270
271
|
checkout_payment_error: "Unable to check payment options. Please contact the shop directly.",
|
|
271
272
|
checkout_payment_enable_hint: "Enter your full name to enable the payment method.",
|
|
272
|
-
checkout_submit: "
|
|
273
|
+
checkout_submit: "Send booking request",
|
|
273
274
|
checkout_success_toast: "Request sent.",
|
|
274
275
|
checkout_success_title: "Request received",
|
|
275
276
|
checkout_success_description: "Thanks, your booking request was sent.",
|
package/dist/i18n/fr.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const storefront: {
|
|
|
9
9
|
nav_products: string;
|
|
10
10
|
nav_itineraries: string;
|
|
11
11
|
nav_contact: string;
|
|
12
|
-
|
|
12
|
+
language_selector_label: string;
|
|
13
13
|
cta_book_now: string;
|
|
14
14
|
cta_book_short: string;
|
|
15
15
|
mobile_menu_open: string;
|
|
@@ -186,7 +186,7 @@ export declare const storefront: {
|
|
|
186
186
|
cart_empty_description: string;
|
|
187
187
|
cart_line_meta: string;
|
|
188
188
|
remove_from_cart: string;
|
|
189
|
-
|
|
189
|
+
cart_total: string;
|
|
190
190
|
cart_clear: string;
|
|
191
191
|
booking_select_variant_cancel: string;
|
|
192
192
|
close_modal: string;
|
|
@@ -208,6 +208,7 @@ export declare const storefront: {
|
|
|
208
208
|
checkout_subtitle: string;
|
|
209
209
|
checkout_summary_title: string;
|
|
210
210
|
checkout_summary_description: string;
|
|
211
|
+
checkout_booking_subtotal: string;
|
|
211
212
|
checkout_estimated_duration: string;
|
|
212
213
|
checkout_estimated_total: string;
|
|
213
214
|
checkout_form_title: string;
|
package/dist/i18n/fr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/i18n/fr.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/i18n/fr.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqgBtB,CAAA"}
|
package/dist/i18n/fr.js
CHANGED
|
@@ -10,7 +10,7 @@ var e = {
|
|
|
10
10
|
nav_products: "Vélos",
|
|
11
11
|
nav_itineraries: "Itinéraires",
|
|
12
12
|
nav_contact: "Contact",
|
|
13
|
-
|
|
13
|
+
language_selector_label: "Changer de langue",
|
|
14
14
|
cta_book_now: "Réserver",
|
|
15
15
|
cta_book_short: "Réserver",
|
|
16
16
|
mobile_menu_open: "Ouvrir le menu de navigation",
|
|
@@ -187,7 +187,7 @@ var e = {
|
|
|
187
187
|
cart_empty_description: "Ajoutez un vélo (et des accessoires) pour continuer.",
|
|
188
188
|
cart_line_meta: "Qté {{quantity}} · {{price}} / {{unit}}",
|
|
189
189
|
remove_from_cart: "Retirer du panier",
|
|
190
|
-
|
|
190
|
+
cart_total: "Total",
|
|
191
191
|
cart_clear: "Vider le panier",
|
|
192
192
|
booking_select_variant_cancel: "Annuler",
|
|
193
193
|
close_modal: "Fermer",
|
|
@@ -209,8 +209,9 @@ var e = {
|
|
|
209
209
|
checkout_subtitle: "Confirmez vos informations et le paiement · {{duration}}",
|
|
210
210
|
checkout_summary_title: "Récapitulatif",
|
|
211
211
|
checkout_summary_description: "Panier et récap des montants.",
|
|
212
|
+
checkout_booking_subtotal: "Sous-total",
|
|
212
213
|
checkout_estimated_duration: "Durée estimée",
|
|
213
|
-
checkout_estimated_total: "Total
|
|
214
|
+
checkout_estimated_total: "Total",
|
|
214
215
|
checkout_form_title: "Vos informations",
|
|
215
216
|
checkout_form_description: "Renseignez vos coordonnées pour votre réservation. N'hésitez pas à ajouter toute information utile dans les notes.",
|
|
216
217
|
checkout_first_name_label: "Prénom",
|
|
@@ -223,7 +224,7 @@ var e = {
|
|
|
223
224
|
checkout_email_placeholder: "jean@example.com",
|
|
224
225
|
checkout_phone_label: "Téléphone",
|
|
225
226
|
checkout_phone_placeholder: "+33 6 00 00 00 00",
|
|
226
|
-
checkout_notes_label: "Notes
|
|
227
|
+
checkout_notes_label: "Notes",
|
|
227
228
|
checkout_notes_placeholder: "Précisions pour votre réservation…",
|
|
228
229
|
checkout_continue_to_payment: "Continuer vers le paiement",
|
|
229
230
|
checkout_payment_title: "Paiement par carte",
|
|
@@ -270,7 +271,7 @@ var e = {
|
|
|
270
271
|
checkout_payment_loading: "Vérification des options de paiement…",
|
|
271
272
|
checkout_payment_error: "Impossible de vérifier les options de paiement. Veuillez contacter directement la boutique.",
|
|
272
273
|
checkout_payment_enable_hint: "Renseignez votre nom complet pour activer le moyen de paiement.",
|
|
273
|
-
checkout_submit: "Envoyer la demande",
|
|
274
|
+
checkout_submit: "Envoyer la demande de réservation",
|
|
274
275
|
checkout_success_toast: "Demande envoyée.",
|
|
275
276
|
checkout_success_title: "Demande reçue",
|
|
276
277
|
checkout_success_description: "Merci, votre demande de réservation a bien été envoyée.",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const STOREFRONT_I18N_LANGUAGES: readonly [{
|
|
2
|
+
readonly code: "fr";
|
|
3
|
+
readonly name: "Français";
|
|
4
|
+
readonly flag: "🇫🇷";
|
|
5
|
+
}, {
|
|
6
|
+
readonly code: "en";
|
|
7
|
+
readonly name: "English";
|
|
8
|
+
readonly flag: "🇬🇧";
|
|
9
|
+
}];
|
|
10
|
+
export type StorefrontI18nLanguage = (typeof STOREFRONT_I18N_LANGUAGES)[number]["code"];
|
|
11
|
+
export type StorefrontI18nLanguageOption = (typeof STOREFRONT_I18N_LANGUAGES)[number];
|
|
12
|
+
export declare const STOREFRONT_I18N_LANGUAGE_CODES: readonly StorefrontI18nLanguage[];
|
|
13
|
+
export declare const normalizeStorefrontI18nLanguage: (language: unknown) => StorefrontI18nLanguage | null;
|
|
14
|
+
export declare const resolveStorefrontI18nLanguageOptions: (configuredLanguages?: readonly string[] | null) => StorefrontI18nLanguageOption[];
|
|
15
|
+
//# sourceMappingURL=languages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/i18n/languages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB;;;;;;;;EAG5B,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AACvF,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAA;AAErF,eAAO,MAAM,8BAA8B,EAAE,SAAS,sBAAsB,EACzB,CAAA;AAEnD,eAAO,MAAM,+BAA+B,GAAI,UAAU,OAAO,KAAG,sBAAsB,GAAG,IAM5F,CAAA;AAED,eAAO,MAAM,oCAAoC,GAC/C,sBAAsB,SAAS,MAAM,EAAE,GAAG,IAAI,KAC7C,4BAA4B,EAkB9B,CAAA"}
|