@lookiero/checkout 0.2.2 → 0.2.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.
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
-
import { Spinner } from "./components/atoms/spinner/Spinner";
|
|
4
3
|
import { Router } from "./routing/router/Router";
|
|
5
4
|
import { Routing } from "./routing/Routing";
|
|
6
|
-
const root = ({ Messaging, I18n }) =>
|
|
5
|
+
const root = ({ Messaging, I18n, development }) =>
|
|
7
6
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
8
7
|
({ locale = "en", customerId, onNotAccessible }) => {
|
|
9
8
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
10
|
-
return (React.createElement(
|
|
11
|
-
React.createElement(
|
|
12
|
-
React.createElement(
|
|
13
|
-
React.createElement(Routing, { customerId: customerId, onNotAccessible: onNotAccessible })))));
|
|
9
|
+
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
10
|
+
React.createElement(Router, null,
|
|
11
|
+
React.createElement(Routing, { onNotAccessible: onNotAccessible, customerId: customerId, locale: locale, I18n: I18n, onI18nError: development ? undefined : handleOnI18nError }))));
|
|
14
12
|
};
|
|
15
13
|
export { root };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { I18n } from "@lookiero/i18n-react";
|
|
1
2
|
import { FC } from "react";
|
|
2
3
|
interface RoutingProps {
|
|
3
|
-
readonly customerId: string | undefined;
|
|
4
4
|
readonly onNotAccessible: () => void;
|
|
5
|
+
readonly customerId: string | undefined;
|
|
6
|
+
readonly locale: string;
|
|
7
|
+
readonly I18n: I18n;
|
|
8
|
+
readonly onI18nError?: (err: Error) => void;
|
|
5
9
|
}
|
|
6
10
|
declare const Routing: FC<RoutingProps>;
|
|
7
11
|
export { Routing };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { lazy, Suspense } from "react";
|
|
2
|
-
import { Navigate, useRoutes } from "react-router-native";
|
|
2
|
+
import { Navigate, Outlet, useRoutes } from "react-router-native";
|
|
3
3
|
import { Spinner } from "../components/atoms/spinner/Spinner";
|
|
4
4
|
import { CheckoutAccessibilityMiddleware } from "./CheckoutAccessibilityMiddleware";
|
|
5
5
|
import { CheckoutMiddleware } from "./CheckoutMiddleware";
|
|
@@ -7,30 +7,35 @@ import { Routes } from "./routes";
|
|
|
7
7
|
const Intro = lazy(() => import("../views/intro/Intro").then((module) => ({ default: module.Intro })));
|
|
8
8
|
const Item = lazy(() => import("../views/item/Item").then((module) => ({ default: module.Item })));
|
|
9
9
|
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
10
|
-
const Routing = ({ customerId,
|
|
10
|
+
const Routing = ({ onNotAccessible, customerId, locale, I18n, onI18nError }) => {
|
|
11
11
|
const routes = useRoutes([
|
|
12
12
|
{
|
|
13
13
|
path: Routes.CHECKOUT,
|
|
14
14
|
element: React.createElement(CheckoutAccessibilityMiddleware, { customerId: customerId, onNotAccessible: onNotAccessible }),
|
|
15
15
|
children: [
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
element: (React.createElement(I18n, { locale: locale, loader: React.createElement(Spinner, null), onError: onI18nError },
|
|
18
|
+
React.createElement(Outlet, null))),
|
|
19
19
|
children: [
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
element: React.createElement(CheckoutMiddleware, { customerId: customerId }),
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
path: Routes.INTRO,
|
|
25
|
+
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
26
|
+
React.createElement(Intro, null))),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
path: Routes.ITEM,
|
|
30
|
+
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
31
|
+
React.createElement(Item, null))),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
path: Routes.SUMMARY,
|
|
35
|
+
element: (React.createElement(Suspense, { fallback: React.createElement(Spinner, null) },
|
|
36
|
+
React.createElement(Summary, null))),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
34
39
|
},
|
|
35
40
|
],
|
|
36
41
|
},
|