@lookiero/checkout 0.6.0-beta.19 → 0.6.0-beta.20
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/infrastructure/ui/Root.d.ts +3 -1
- package/dist/infrastructure/ui/Root.js +9 -12
- package/dist/infrastructure/ui/routing/Routing.d.ts +3 -4
- package/dist/infrastructure/ui/routing/Routing.js +3 -4
- package/dist/shared/logging/SentryLogger.d.ts +1 -1
- package/dist/shared/logging/SentryLogger.js +4 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
2
|
import { MessagingRoot } from "@lookiero/messaging-react/bootstrap";
|
|
3
3
|
import { ComponentType } from "react";
|
|
4
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
4
5
|
import { Customer } from "../../projection/shared/customer";
|
|
5
6
|
import { SentryLoggerFunctionArgs } from "../../shared/logging/SentryLogger";
|
|
6
7
|
import { Menu, TabBar } from "./views/navigation/Navigation";
|
|
@@ -8,7 +9,7 @@ interface RootFunctionArgs {
|
|
|
8
9
|
readonly Messaging: MessagingRoot;
|
|
9
10
|
readonly I18n: I18n;
|
|
10
11
|
readonly development?: boolean;
|
|
11
|
-
readonly sentry
|
|
12
|
+
readonly sentry: SentryLoggerFunctionArgs;
|
|
12
13
|
readonly getAuthToken: () => Promise<string>;
|
|
13
14
|
}
|
|
14
15
|
interface RootFunction {
|
|
@@ -22,6 +23,7 @@ interface RootProps {
|
|
|
22
23
|
readonly tabBar: TabBar;
|
|
23
24
|
readonly onNotAccessible: () => void;
|
|
24
25
|
readonly useRedirect: () => Record<string, string>;
|
|
26
|
+
readonly useRoutes?: typeof reactRouterUseRoutes;
|
|
25
27
|
}
|
|
26
28
|
declare const root: RootFunction;
|
|
27
29
|
export type { RootProps };
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { wrapUseRoutes as sentryWrapUseRoutes } from "@sentry/react";
|
|
2
1
|
import React, { useCallback } from "react";
|
|
3
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
4
4
|
import { sentryLogger } from "../../shared/logging/SentryLogger";
|
|
5
5
|
import { Routing } from "./routing/Routing";
|
|
6
6
|
const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
7
|
-
const wrapUseRoutes = sentry ? sentryWrapUseRoutes : undefined;
|
|
8
7
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
9
|
-
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
|
|
8
|
+
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
|
|
10
9
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
11
10
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
12
|
-
React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect,
|
|
11
|
+
React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, useRoutes: useRoutes, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
13
12
|
};
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})(Root)
|
|
21
|
-
: Root;
|
|
13
|
+
return sentryLogger({
|
|
14
|
+
publicKey: sentry.publicKey,
|
|
15
|
+
environment: sentry.environment,
|
|
16
|
+
release: sentry.release,
|
|
17
|
+
project: sentry.project,
|
|
18
|
+
})(Root);
|
|
22
19
|
};
|
|
23
20
|
export { root };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
4
4
|
import { Customer } from "../../../projection/shared/customer";
|
|
5
5
|
import { Menu, TabBar } from "../views/navigation/Navigation";
|
|
6
|
-
type UseRoutes = (routes: RouteObject[], locationArg?: Partial<Location> | string) => React.ReactElement | null;
|
|
7
6
|
interface RoutingProps {
|
|
8
7
|
readonly basePath?: string;
|
|
9
8
|
readonly customer: Customer | undefined;
|
|
@@ -15,7 +14,7 @@ interface RoutingProps {
|
|
|
15
14
|
readonly onNotAccessible: () => void;
|
|
16
15
|
readonly onI18nError?: (err: Error) => void;
|
|
17
16
|
readonly useRedirect: () => Record<string, string>;
|
|
18
|
-
readonly
|
|
17
|
+
readonly useRoutes: typeof reactRouterUseRoutes;
|
|
19
18
|
}
|
|
20
19
|
declare const Routing: FC<RoutingProps>;
|
|
21
20
|
export { Routing };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { lazy, Suspense
|
|
2
|
-
import { Navigate, Outlet
|
|
1
|
+
import React, { lazy, Suspense } from "react";
|
|
2
|
+
import { Navigate, Outlet } from "react-router-native";
|
|
3
3
|
import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
|
|
4
4
|
import { App } from "../views/App";
|
|
5
5
|
import { CheckoutPaymentModal } from "../views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal";
|
|
@@ -12,8 +12,7 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
|
|
|
12
12
|
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
13
13
|
const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
|
|
14
14
|
const Feedback = lazy(() => import("../views/feedback/Feedback").then((module) => ({ default: module.Feedback })));
|
|
15
|
-
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect,
|
|
16
|
-
const useRoutes = useMemo(() => wrapUseRoutes(reactRouterUseRoutes), [wrapUseRoutes]);
|
|
15
|
+
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes, }) => {
|
|
17
16
|
const routes = useRoutes([
|
|
18
17
|
{
|
|
19
18
|
path: "",
|
|
@@ -15,5 +15,5 @@ interface SentryLoggerFunction {
|
|
|
15
15
|
(args: SentryLoggerFunctionArgs): <P extends SentryLoggerHOCProps>(Component: ComponentType<P>) => ComponentType<P & JSX.IntrinsicAttributes>;
|
|
16
16
|
}
|
|
17
17
|
declare const sentryLogger: SentryLoggerFunction;
|
|
18
|
-
export type { SentryLoggerFunctionArgs };
|
|
18
|
+
export type { SentryLoggerFunctionArgs, SentryLoggerHOCProps };
|
|
19
19
|
export { sentryLogger };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { defaultStackParser } from "@sentry/browser";
|
|
2
2
|
import { makeMain } from "@sentry/core";
|
|
3
|
+
import { wrapUseRoutes } from "@sentry/react";
|
|
3
4
|
import React, { useEffect } from "react";
|
|
4
5
|
import { Platform } from "react-native";
|
|
6
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
5
7
|
import { Client, Hub, ErrorBoundary, transport, integrations, wrap } from "./SentryDependencies";
|
|
6
8
|
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
7
9
|
let mainHub;
|
|
@@ -88,6 +90,7 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
|
88
90
|
};
|
|
89
91
|
return (Component) => {
|
|
90
92
|
const WrappedComponent = wrap(Component);
|
|
93
|
+
const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
|
|
91
94
|
const SentryLogger = (props) => {
|
|
92
95
|
const { customer } = props;
|
|
93
96
|
useEffect(() => {
|
|
@@ -95,7 +98,7 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
|
95
98
|
return onUnMount;
|
|
96
99
|
}, [customer?.customerId]);
|
|
97
100
|
return (React.createElement(ErrorBoundary, null,
|
|
98
|
-
React.createElement(WrappedComponent, { ...props })));
|
|
101
|
+
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
|
|
99
102
|
};
|
|
100
103
|
return SentryLogger;
|
|
101
104
|
};
|