@lookiero/checkout 14.0.1 → 14.0.3
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/public/public/assets/adaptive-icon.png +0 -0
- package/dist/public/public/assets/favicon.png +0 -0
- package/dist/public/public/assets/icon.png +0 -0
- package/dist/public/public/assets/splash.png +0 -0
- package/dist/public/public/images/not-found.png +0 -0
- package/dist/src/infrastructure/ui/Root.js +3 -18
- package/dist/src/infrastructure/ui/i18n/i18n.d.ts +10 -1
- package/dist/src/infrastructure/ui/i18n/i18n.js +21 -1
- package/dist/src/projection/order/order.d.ts +6 -0
- package/dist/src/projection/order/order.js +1 -0
- package/dist/src/projection/subscription/subscription.d.ts +2 -0
- package/dist/src/projection/subscription/subscription.js +1 -0
- package/dist/src/version.d.ts +2 -2
- package/dist/src/version.js +2 -2
- package/package.json +1 -1
- package/src/infrastructure/ui/Root.tsx +3 -21
- package/src/infrastructure/ui/i18n/i18n.ts +37 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,34 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useCallback, useMemo } from "react";
|
|
1
|
+
import React, { useCallback } from "react";
|
|
3
2
|
import { Platform } from "react-native";
|
|
4
3
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
5
|
-
import { i18n } from "@lookiero/i18n-react";
|
|
6
|
-
import { fetchTranslations, translationEndpoints } from "@lookiero/sty-psp-i18n";
|
|
7
4
|
import { sentryLogger, sentryLoggerHOC } from "@lookiero/sty-psp-logging";
|
|
8
5
|
import { QueryBusProvider } from "./hooks/useQueryBus";
|
|
9
|
-
import {
|
|
6
|
+
import { i18n } from "./i18n/i18n";
|
|
10
7
|
import { Routing } from "./routing/Routing";
|
|
11
8
|
const root = ({ Messaging, queryBus, getAuthToken, development, sentry, kameleoon: kameleoonConfig }) => {
|
|
12
9
|
const logger = sentryLogger(sentry);
|
|
13
10
|
const kameleoon = kameleoonConfig();
|
|
14
11
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
15
12
|
const Root = ({ basePath, locale, customer, layout, tradename, onNotAccessible, onCheckoutFlowSuccess, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
|
|
16
|
-
const I18n = useMemo(() => {
|
|
17
|
-
const translations = [
|
|
18
|
-
(locale) => translationEndpoints({
|
|
19
|
-
projects: ["checkout", "inventory-catalog"],
|
|
20
|
-
tradename,
|
|
21
|
-
})(locale),
|
|
22
|
-
];
|
|
23
|
-
return i18n({
|
|
24
|
-
fetchTranslation: fetchTranslations({ translations }),
|
|
25
|
-
domain: DOMAIN,
|
|
26
|
-
});
|
|
27
|
-
}, [tradename]);
|
|
28
13
|
const handleOnI18nError = useCallback((error) => logger.captureException(error), []);
|
|
29
14
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
30
15
|
React.createElement(QueryBusProvider, { queryBus: queryBus },
|
|
31
|
-
React.createElement(Routing, { I18n:
|
|
16
|
+
React.createElement(Routing, { I18n: i18n({ tradename }), basePath: basePath, customer: customer, getAuthToken: getAuthToken, kameleoon: kameleoon, layout: layout, locale: locale, tradename: tradename, useRedirect: useRedirect, useRoutes: useRoutes, onCheckoutFlowSuccess: onCheckoutFlowSuccess, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible }))));
|
|
32
17
|
};
|
|
33
18
|
const hoc = sentryLoggerHOC({ logger });
|
|
34
19
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { I18n as I18nReact } from "@lookiero/i18n-react";
|
|
2
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
1
3
|
declare const DOMAIN = "CheckoutI18n";
|
|
2
4
|
declare const COLOR_I18N_PREFIX = "catalog.color.";
|
|
3
5
|
declare enum I18nMessages {
|
|
@@ -56,4 +58,11 @@ declare enum I18nMessages {
|
|
|
56
58
|
FEEDBACK_BUTTON = "feedback.button",
|
|
57
59
|
CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired"
|
|
58
60
|
}
|
|
59
|
-
|
|
61
|
+
interface I18nFunctionArgs {
|
|
62
|
+
readonly tradename: Tradename;
|
|
63
|
+
}
|
|
64
|
+
interface I18nFunction {
|
|
65
|
+
(args: I18nFunctionArgs): I18nReact;
|
|
66
|
+
}
|
|
67
|
+
declare const i18n: I18nFunction;
|
|
68
|
+
export { DOMAIN, I18nMessages, COLOR_I18N_PREFIX, i18n };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { i18n as i18nFn } from "@lookiero/i18n-react";
|
|
2
|
+
import { fetchTranslations, translationEndpoints } from "@lookiero/sty-psp-i18n";
|
|
1
3
|
const DOMAIN = "CheckoutI18n";
|
|
2
4
|
// TODO: deprecated?
|
|
3
5
|
const COLOR_I18N_PREFIX = "catalog.color.";
|
|
@@ -58,4 +60,22 @@ var I18nMessages;
|
|
|
58
60
|
I18nMessages["FEEDBACK_BUTTON"] = "feedback.button";
|
|
59
61
|
I18nMessages["CHECKOUT_TOAST_BOOKING_EXPIRED"] = "checkout.toast_booking_expired";
|
|
60
62
|
})(I18nMessages || (I18nMessages = {}));
|
|
61
|
-
|
|
63
|
+
const cache = new Map();
|
|
64
|
+
const i18n = ({ tradename }) => {
|
|
65
|
+
if (cache.has(tradename)) {
|
|
66
|
+
return cache.get(tradename);
|
|
67
|
+
}
|
|
68
|
+
const translations = [
|
|
69
|
+
(locale) => translationEndpoints({
|
|
70
|
+
projects: ["checkout", "inventory-catalog"],
|
|
71
|
+
tradename,
|
|
72
|
+
})(locale),
|
|
73
|
+
];
|
|
74
|
+
const component = i18nFn({
|
|
75
|
+
fetchTranslation: fetchTranslations({ translations }),
|
|
76
|
+
domain: DOMAIN,
|
|
77
|
+
});
|
|
78
|
+
cache.set(tradename, component);
|
|
79
|
+
return component;
|
|
80
|
+
};
|
|
81
|
+
export { DOMAIN, I18nMessages, COLOR_I18N_PREFIX, i18n };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "14.0.
|
|
2
|
-
export declare const RELEASE = "checkout@14.0.
|
|
1
|
+
export declare const VERSION = "14.0.3";
|
|
2
|
+
export declare const RELEASE = "checkout@14.0.3";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "14.0.
|
|
2
|
-
export const RELEASE = "checkout@14.0.
|
|
1
|
+
export const VERSION = "14.0.3";
|
|
2
|
+
export const RELEASE = "checkout@14.0.3";
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { ComponentType, useCallback, useMemo } from "react";
|
|
1
|
+
import React, { ComponentType, useCallback } from "react";
|
|
3
2
|
import { Platform } from "react-native";
|
|
4
3
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
5
|
-
import { i18n } from "@lookiero/i18n-react";
|
|
6
4
|
import { QueryBus } from "@lookiero/messaging";
|
|
7
5
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
8
|
-
import { EndpointFunction, fetchTranslations, translationEndpoints } from "@lookiero/sty-psp-i18n";
|
|
9
6
|
import { Locale } from "@lookiero/sty-psp-locale";
|
|
10
7
|
import { SentryEnvironment, SentryLoggerFunctionArgs, sentryLogger, sentryLoggerHOC } from "@lookiero/sty-psp-logging";
|
|
11
8
|
import { Layout } from "@lookiero/sty-psp-ui";
|
|
@@ -14,7 +11,7 @@ import { Customer } from "../../projection/customer/customer";
|
|
|
14
11
|
import { KameleoonEnvironment } from "../ab-testing/kameleoonEnvironment";
|
|
15
12
|
import { OnSuccessFunction as OnCheckoutFlowSuccessFunction } from "./hooks/useCheckoutFlow";
|
|
16
13
|
import { QueryBusProvider } from "./hooks/useQueryBus";
|
|
17
|
-
import {
|
|
14
|
+
import { i18n } from "./i18n/i18n";
|
|
18
15
|
import { Routing } from "./routing/Routing";
|
|
19
16
|
|
|
20
17
|
interface RootFunctionArgs {
|
|
@@ -58,28 +55,13 @@ const root: RootFunction = ({ Messaging, queryBus, getAuthToken, development, se
|
|
|
58
55
|
useRedirect,
|
|
59
56
|
useRoutes = reactRouterUseRoutes,
|
|
60
57
|
}: RootProps) => {
|
|
61
|
-
const I18n = useMemo(() => {
|
|
62
|
-
const translations: EndpointFunction[] = [
|
|
63
|
-
(locale) =>
|
|
64
|
-
translationEndpoints({
|
|
65
|
-
projects: ["checkout", "inventory-catalog"],
|
|
66
|
-
tradename,
|
|
67
|
-
})(locale),
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
return i18n({
|
|
71
|
-
fetchTranslation: fetchTranslations({ translations }),
|
|
72
|
-
domain: DOMAIN,
|
|
73
|
-
});
|
|
74
|
-
}, [tradename]);
|
|
75
|
-
|
|
76
58
|
const handleOnI18nError = useCallback((error: Error) => logger.captureException(error), []);
|
|
77
59
|
|
|
78
60
|
return (
|
|
79
61
|
<Messaging includeReactQueryDevTools={Platform.OS === "web"}>
|
|
80
62
|
<QueryBusProvider queryBus={queryBus}>
|
|
81
63
|
<Routing
|
|
82
|
-
I18n={
|
|
64
|
+
I18n={i18n({ tradename })}
|
|
83
65
|
basePath={basePath}
|
|
84
66
|
customer={customer}
|
|
85
67
|
getAuthToken={getAuthToken}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { i18n as i18nFn, I18n as I18nReact } from "@lookiero/i18n-react";
|
|
2
|
+
import { EndpointFunction, fetchTranslations, translationEndpoints } from "@lookiero/sty-psp-i18n";
|
|
3
|
+
import { Tradename } from "@lookiero/sty-sp-tradename";
|
|
4
|
+
|
|
1
5
|
const DOMAIN = "CheckoutI18n";
|
|
2
6
|
|
|
3
7
|
// TODO: deprecated?
|
|
@@ -60,4 +64,36 @@ enum I18nMessages {
|
|
|
60
64
|
CHECKOUT_TOAST_BOOKING_EXPIRED = "checkout.toast_booking_expired",
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
const cache = new Map<Tradename, I18nReact>();
|
|
68
|
+
|
|
69
|
+
interface I18nFunctionArgs {
|
|
70
|
+
readonly tradename: Tradename;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface I18nFunction {
|
|
74
|
+
(args: I18nFunctionArgs): I18nReact;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const i18n: I18nFunction = ({ tradename }) => {
|
|
78
|
+
if (cache.has(tradename)) {
|
|
79
|
+
return cache.get(tradename)!;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const translations: EndpointFunction[] = [
|
|
83
|
+
(locale) =>
|
|
84
|
+
translationEndpoints({
|
|
85
|
+
projects: ["checkout", "inventory-catalog"],
|
|
86
|
+
tradename,
|
|
87
|
+
})(locale),
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const component = i18nFn({
|
|
91
|
+
fetchTranslation: fetchTranslations({ translations }),
|
|
92
|
+
domain: DOMAIN,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
cache.set(tradename, component);
|
|
96
|
+
return component;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { DOMAIN, I18nMessages, COLOR_I18N_PREFIX, i18n };
|