@lookiero/checkout 0.6.0-beta.3 → 0.6.0-beta.31
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 +6 -10
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +1 -1
- package/dist/infrastructure/ui/routing/Routing.d.ts +8 -0
- package/dist/infrastructure/ui/routing/Routing.js +97 -4
- package/dist/infrastructure/ui/views/App.js +4 -10
- package/dist/shared/logging/SentryDependencies.d.ts +9 -0
- package/dist/shared/logging/SentryDependencies.js +16 -0
- package/dist/shared/logging/SentryDependencies.native.d.ts +8 -0
- package/dist/shared/logging/SentryDependencies.native.js +13 -0
- package/dist/shared/logging/SentryLogger.d.ts +7 -3
- package/dist/shared/logging/SentryLogger.js +88 -21
- package/dist/shared/logging/matchRoutes.d.ts +3 -0
- package/dist/shared/logging/matchRoutes.js +7 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.d.ts +27 -0
- package/dist/shared/logging/reactRouterV6Instrumentation.native.js +39 -0
- package/package.json +2 -3
|
@@ -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,21 +1,17 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
//Routes as ReactRouterRoutes
|
|
5
|
+
useRoutes as reactRouterUseRoutes, } from "react-router-native";
|
|
3
6
|
import { sentryLogger } from "../../shared/logging/SentryLogger";
|
|
4
7
|
import { Routing } from "./routing/Routing";
|
|
5
8
|
const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
6
9
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
7
|
-
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
|
|
10
|
+
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
|
|
8
11
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
9
12
|
return (React.createElement(Messaging, { includeReactQueryDevTools: Platform.OS === "web" },
|
|
10
|
-
React.createElement(Routing, { I18n: I18n, basePath: basePath, customer: customer, getAuthToken: getAuthToken, locale: locale, menu: menu, tabBar: tabBar, useRedirect: useRedirect, onI18nError: development ? undefined : handleOnI18nError, onNotAccessible: onNotAccessible })));
|
|
13
|
+
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 })));
|
|
11
14
|
};
|
|
12
|
-
return sentry
|
|
13
|
-
? sentryLogger({
|
|
14
|
-
publicKey: sentry.publicKey,
|
|
15
|
-
environment: sentry.environment,
|
|
16
|
-
release: sentry.release,
|
|
17
|
-
project: sentry.project,
|
|
18
|
-
})(Root)
|
|
19
|
-
: Root;
|
|
15
|
+
return sentryLogger(sentry)(Root);
|
|
20
16
|
};
|
|
21
17
|
export { root };
|
|
@@ -11,7 +11,7 @@ const CheckoutAccessibilityMiddleware = ({ customerId, onNotAccessible, loader =
|
|
|
11
11
|
if (notAccessible) {
|
|
12
12
|
onNotAccessibleRef.current();
|
|
13
13
|
}
|
|
14
|
-
}, [notAccessible
|
|
14
|
+
}, [notAccessible]);
|
|
15
15
|
return accessible === undefined && [QueryStatus.IDLE, QueryStatus.LOADING].includes(status)
|
|
16
16
|
? loader
|
|
17
17
|
: accessible
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { I18n } from "@lookiero/i18n-react";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
3
4
|
import { Customer } from "../../../projection/shared/customer";
|
|
4
5
|
import { Menu, TabBar } from "../views/navigation/Navigation";
|
|
5
6
|
interface RoutingProps {
|
|
@@ -13,6 +14,13 @@ interface RoutingProps {
|
|
|
13
14
|
readonly onNotAccessible: () => void;
|
|
14
15
|
readonly onI18nError?: (err: Error) => void;
|
|
15
16
|
readonly useRedirect: () => Record<string, string>;
|
|
17
|
+
readonly useRoutes: typeof reactRouterUseRoutes;
|
|
16
18
|
}
|
|
17
19
|
declare const Routing: FC<RoutingProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Provided useRoutes is not stable (when integrated with Sentry) as it's rendering a different component tree.
|
|
22
|
+
*
|
|
23
|
+
* https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/reactrouterv6.tsx#L221
|
|
24
|
+
* (SentryRoutes is a new component after each re-render)
|
|
25
|
+
*/
|
|
18
26
|
export { Routing };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { lazy, Suspense } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
// Routes as ReactRouterRoutes,
|
|
4
|
+
// Route,
|
|
5
|
+
Navigate, Outlet, useRoutes as reactRouterUseRoutes, } from "react-router-native";
|
|
3
6
|
import { Spinner } from "../../../shared/ui/components/atoms/spinner/Spinner";
|
|
4
7
|
import { App } from "../views/App";
|
|
5
8
|
import { CheckoutPaymentModal } from "../views/checkout/components/checkoutPaymentModal/CheckoutPaymentModal";
|
|
@@ -12,8 +15,91 @@ const Item = lazy(() => import("../views/item/Item").then((module) => ({ default
|
|
|
12
15
|
const Summary = lazy(() => import("../views/summary/Summary").then((module) => ({ default: module.Summary })));
|
|
13
16
|
const Checkout = lazy(() => import("../views/checkout/Checkout").then((module) => ({ default: module.Checkout })));
|
|
14
17
|
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
|
-
|
|
18
|
+
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes = reactRouterUseRoutes,
|
|
19
|
+
// rootRoutes: RootRoutes,
|
|
20
|
+
}) => {
|
|
21
|
+
// return (
|
|
22
|
+
// <RootRoutes>
|
|
23
|
+
// <Route
|
|
24
|
+
// path=""
|
|
25
|
+
// element={
|
|
26
|
+
// <BasePathProvider basePath={basePath}>
|
|
27
|
+
// <CheckoutAccessibilityMiddleware customerId={customer?.customerId} onNotAccessible={onNotAccessible}>
|
|
28
|
+
// <I18n loader={<Spinner />} locale={locale} onError={onI18nError}>
|
|
29
|
+
// <CheckoutMiddleware customerId={customer?.customerId as string}>
|
|
30
|
+
// <App customerId={customer?.customerId as string} menu={menu} tabBar={tabBar}>
|
|
31
|
+
// <Outlet />
|
|
32
|
+
// </App>
|
|
33
|
+
// </CheckoutMiddleware>
|
|
34
|
+
// </I18n>
|
|
35
|
+
// </CheckoutAccessibilityMiddleware>
|
|
36
|
+
// </BasePathProvider>
|
|
37
|
+
// }
|
|
38
|
+
// >
|
|
39
|
+
// <Route
|
|
40
|
+
// path={Routes.INTRO}
|
|
41
|
+
// element={
|
|
42
|
+
// <Suspense fallback={<Spinner />}>
|
|
43
|
+
// <Intro customerId={customer?.customerId as string} />
|
|
44
|
+
// </Suspense>
|
|
45
|
+
// }
|
|
46
|
+
// />
|
|
47
|
+
// <Route
|
|
48
|
+
// path={Routes.ITEM}
|
|
49
|
+
// element={
|
|
50
|
+
// <Suspense fallback={<Spinner />}>
|
|
51
|
+
// <Item country={customer?.country as Country} customerId={customer?.customerId as string} />
|
|
52
|
+
// </Suspense>
|
|
53
|
+
// }
|
|
54
|
+
// />
|
|
55
|
+
// <Route
|
|
56
|
+
// path={Routes.ITEM_DETAIL}
|
|
57
|
+
// element={
|
|
58
|
+
// <Suspense fallback={<Spinner />}>
|
|
59
|
+
// <Item country={customer?.country as Country} customerId={customer?.customerId as string} />
|
|
60
|
+
// </Suspense>
|
|
61
|
+
// }
|
|
62
|
+
// />
|
|
63
|
+
// <Route
|
|
64
|
+
// path={Routes.SUMMARY}
|
|
65
|
+
// element={
|
|
66
|
+
// <Suspense fallback={<Spinner />}>
|
|
67
|
+
// <Summary country={customer?.country as Country} customerId={customer?.customerId as string} />
|
|
68
|
+
// </Suspense>
|
|
69
|
+
// }
|
|
70
|
+
// />
|
|
71
|
+
// <Route
|
|
72
|
+
// path={Routes.CHECKOUT}
|
|
73
|
+
// element={
|
|
74
|
+
// <Suspense fallback={<Spinner />}>
|
|
75
|
+
// <Checkout
|
|
76
|
+
// country={customer?.country as Country}
|
|
77
|
+
// customerId={customer?.customerId as string}
|
|
78
|
+
// useRedirect={useRedirect}
|
|
79
|
+
// >
|
|
80
|
+
// <Outlet />
|
|
81
|
+
// </Checkout>
|
|
82
|
+
// </Suspense>
|
|
83
|
+
// }
|
|
84
|
+
// >
|
|
85
|
+
// <Route
|
|
86
|
+
// element={<CheckoutPaymentModal customerId={customer?.customerId as string} getAuthToken={getAuthToken} />}
|
|
87
|
+
// path={Routes.CHECKOUT_PAYMENT}
|
|
88
|
+
// />
|
|
89
|
+
// </Route>
|
|
90
|
+
// <Route
|
|
91
|
+
// path={Routes.FEEDBACK}
|
|
92
|
+
// element={
|
|
93
|
+
// <Suspense fallback={<Spinner />}>
|
|
94
|
+
// <Feedback customerId={customer?.customerId as string} />
|
|
95
|
+
// </Suspense>
|
|
96
|
+
// }
|
|
97
|
+
// />
|
|
98
|
+
// <Route element={<Navigate to={`${Routes.HOME}`} replace />} path="*" />
|
|
99
|
+
// </Route>
|
|
100
|
+
// </RootRoutes>
|
|
101
|
+
// );
|
|
102
|
+
return useRoutes([
|
|
17
103
|
{
|
|
18
104
|
path: "",
|
|
19
105
|
element: (React.createElement(BasePathProvider, { basePath: basePath },
|
|
@@ -67,6 +153,13 @@ const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthT
|
|
|
67
153
|
],
|
|
68
154
|
},
|
|
69
155
|
]);
|
|
70
|
-
return routes;
|
|
71
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* Provided useRoutes is not stable (when integrated with Sentry) as it's rendering a different component tree.
|
|
159
|
+
*
|
|
160
|
+
* https://github.com/getsentry/sentry-javascript/blob/master/packages/react/src/reactrouterv6.tsx#L221
|
|
161
|
+
* (SentryRoutes is a new component after each re-render)
|
|
162
|
+
*/
|
|
163
|
+
// const MemoizedRouting = memo(Routing);
|
|
164
|
+
// export { MemoizedRouting as Routing };
|
|
72
165
|
export { Routing };
|
|
@@ -4,14 +4,8 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
4
4
|
import { Notifications } from "../../../shared/notifications/infrastructure/ui/views/Notifications";
|
|
5
5
|
import { MESSAGING_CONTEXT_ID } from "../../delivery/baseBootstrap";
|
|
6
6
|
import { Navigation } from "./navigation/Navigation";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return (React.createElement(SafeAreaProvider, null,
|
|
13
|
-
React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
|
|
14
|
-
React.createElement(Navigation, { customerId: customerId, menu: menu, tabBar: tabBar },
|
|
15
|
-
React.createElement(PortalProvider, null, children))));
|
|
16
|
-
};
|
|
7
|
+
const App = ({ customerId, menu, tabBar, children }) => (React.createElement(SafeAreaProvider, null,
|
|
8
|
+
React.createElement(Notifications, { contextId: MESSAGING_CONTEXT_ID }),
|
|
9
|
+
React.createElement(Navigation, { customerId: customerId, menu: menu, tabBar: tabBar },
|
|
10
|
+
React.createElement(PortalProvider, null, children))));
|
|
17
11
|
export { App };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BrowserClient, Hub } from "@sentry/browser";
|
|
2
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
3
|
+
import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
|
|
4
|
+
import { Transport, Integration } from "@sentry/types";
|
|
5
|
+
import { ComponentType } from "react";
|
|
6
|
+
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
7
|
+
declare const integrations: Integration[];
|
|
8
|
+
declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
|
|
9
|
+
export { BrowserClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BrowserClient, Hub, makeFetchTransport, defaultIntegrations } from "@sentry/browser";
|
|
2
|
+
import { ErrorBoundary } from "@sentry/react";
|
|
3
|
+
import { reactRouterV6Instrumentation } from "@sentry/react";
|
|
4
|
+
import { BrowserTracing } from "@sentry/tracing";
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { createRoutesFromChildren, useLocation, useNavigationType } from "react-router-native";
|
|
7
|
+
import { matchRoutes } from "./matchRoutes";
|
|
8
|
+
const transport = (options, nativeFetch) => makeFetchTransport(options, nativeFetch);
|
|
9
|
+
const integrations = [
|
|
10
|
+
...defaultIntegrations,
|
|
11
|
+
new BrowserTracing({
|
|
12
|
+
routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes),
|
|
13
|
+
}),
|
|
14
|
+
];
|
|
15
|
+
const wrap = (Component) => Component;
|
|
16
|
+
export { BrowserClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNativeClient, Hub, ErrorBoundary } from "@sentry/react-native";
|
|
2
|
+
import { ReactNativeTransportOptions } from "@sentry/react-native/dist/js/options";
|
|
3
|
+
import { Transport, Integration } from "@sentry/types";
|
|
4
|
+
import { ComponentType } from "react";
|
|
5
|
+
declare const transport: (options: ReactNativeTransportOptions) => Transport;
|
|
6
|
+
declare const integrations: Integration[];
|
|
7
|
+
declare const wrap: <P>(Component: ComponentType<P>) => ComponentType<P>;
|
|
8
|
+
export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { makeFetchTransport } from "@sentry/browser";
|
|
2
|
+
import { ReactNativeClient, Hub, ErrorBoundary, wrap as sentryWrap, ReactNativeTracing } from "@sentry/react-native";
|
|
3
|
+
import { makeReactNativeTransport } from "@sentry/react-native/dist/js/transports/native";
|
|
4
|
+
import { NATIVE } from "@sentry/react-native/dist/js/wrapper";
|
|
5
|
+
import { ReactRouterV6Instrumentation } from "./reactRouterV6Instrumentation.native";
|
|
6
|
+
const transport = (options, nativeFetch) => NATIVE.isNativeTransportAvailable() ? makeReactNativeTransport(options) : makeFetchTransport(options, nativeFetch);
|
|
7
|
+
const integrations = [
|
|
8
|
+
new ReactNativeTracing({
|
|
9
|
+
routingInstrumentation: new ReactRouterV6Instrumentation(),
|
|
10
|
+
}),
|
|
11
|
+
];
|
|
12
|
+
const wrap = (Component) => sentryWrap(Component);
|
|
13
|
+
export { ReactNativeClient as Client, Hub, ErrorBoundary, transport, integrations, wrap };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "@sentry/tracing";
|
|
2
1
|
import { ComponentType } from "react";
|
|
3
2
|
import { Platform } from "react-native";
|
|
4
3
|
interface SentryLoggerFunctionArgs {
|
|
@@ -7,9 +6,14 @@ interface SentryLoggerFunctionArgs {
|
|
|
7
6
|
readonly release: string;
|
|
8
7
|
readonly project: string;
|
|
9
8
|
}
|
|
9
|
+
interface SentryLoggerHOCProps {
|
|
10
|
+
readonly customer: {
|
|
11
|
+
readonly customerId: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
}
|
|
10
14
|
interface SentryLoggerFunction {
|
|
11
|
-
(args: SentryLoggerFunctionArgs): <P>(Component: ComponentType<P>) => ComponentType<P & JSX.IntrinsicAttributes>;
|
|
15
|
+
(args: SentryLoggerFunctionArgs): <P extends SentryLoggerHOCProps>(Component: ComponentType<P>) => ComponentType<P & JSX.IntrinsicAttributes>;
|
|
12
16
|
}
|
|
13
17
|
declare const sentryLogger: SentryLoggerFunction;
|
|
14
|
-
export type { SentryLoggerFunctionArgs };
|
|
18
|
+
export type { SentryLoggerFunctionArgs, SentryLoggerHOCProps };
|
|
15
19
|
export { sentryLogger };
|
|
@@ -1,41 +1,108 @@
|
|
|
1
|
+
import { defaultStackParser } from "@sentry/browser";
|
|
1
2
|
import { makeMain } from "@sentry/core";
|
|
2
|
-
import
|
|
3
|
-
|
|
3
|
+
import {
|
|
4
|
+
// withSentryReactRouterV6Routing,
|
|
5
|
+
wrapUseRoutes, } from "@sentry/react";
|
|
4
6
|
import React, { useEffect } from "react";
|
|
5
7
|
import { Platform } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
// Routes as ReactRouterRoutes,
|
|
10
|
+
useRoutes as reactRouterUseRoutes, } from "react-router-native";
|
|
11
|
+
import { Client, Hub, ErrorBoundary, transport, integrations, wrap } from "./SentryDependencies";
|
|
6
12
|
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
7
13
|
let mainHub;
|
|
8
|
-
|
|
9
|
-
* TS complains about not providing 'transport' and 'stackParser' implementations
|
|
10
|
-
* although 'ReactNativeClient' defaults to its own implementation for those options.
|
|
11
|
-
*/
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
const client = new Sentry.ReactNativeClient({
|
|
14
|
+
const client = new Client({
|
|
15
15
|
environment,
|
|
16
16
|
release,
|
|
17
17
|
dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
|
|
18
|
-
integrations
|
|
18
|
+
integrations,
|
|
19
19
|
tracesSampleRate: 1.0,
|
|
20
20
|
debug: true,
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
21
23
|
enableNative: Platform.OS !== "web",
|
|
24
|
+
autoInitializeNativeSdk: Platform.OS !== "web",
|
|
25
|
+
stackParser: defaultStackParser,
|
|
26
|
+
transport,
|
|
27
|
+
// This configuration is obtained from
|
|
28
|
+
// https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry
|
|
29
|
+
ignoreErrors: [
|
|
30
|
+
// Random plugins/extensions
|
|
31
|
+
"top.GLOBALS",
|
|
32
|
+
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
|
|
33
|
+
"originalCreateNotification",
|
|
34
|
+
"canvas.contentDocument",
|
|
35
|
+
"MyApp_RemoveAllHighlights",
|
|
36
|
+
"http://tt.epicplay.com",
|
|
37
|
+
"Can't find variable: ZiteReader",
|
|
38
|
+
"jigsaw is not defined",
|
|
39
|
+
"ComboSearch is not defined",
|
|
40
|
+
"http://loading.retry.widdit.com/",
|
|
41
|
+
"atomicFindClose",
|
|
42
|
+
// Facebook borked
|
|
43
|
+
"fb_xd_fragment",
|
|
44
|
+
// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
|
|
45
|
+
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
|
|
46
|
+
"bmi_SafeAddOnload",
|
|
47
|
+
"EBCallBackMessageReceived",
|
|
48
|
+
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
|
|
49
|
+
"conduitPage",
|
|
50
|
+
// Generic error code from errors outside the security sandbox
|
|
51
|
+
// You can delete this if using raven.js > 1.0, which ignores these automatically.
|
|
52
|
+
"Script error.",
|
|
53
|
+
// Avast extension error
|
|
54
|
+
"_avast_submit",
|
|
55
|
+
],
|
|
56
|
+
denyUrls: [
|
|
57
|
+
// Google Adsense
|
|
58
|
+
/pagead\/js/i,
|
|
59
|
+
// Facebook flakiness
|
|
60
|
+
/graph\.facebook\.com/i,
|
|
61
|
+
// Facebook blocked
|
|
62
|
+
/connect\.facebook\.net\/en_US\/all\.js/i,
|
|
63
|
+
// Woopra flakiness
|
|
64
|
+
/eatdifferent\.com\.woopra-ns\.com/i,
|
|
65
|
+
/static\.woopra\.com\/js\/woopra\.js/i,
|
|
66
|
+
// Chrome extensions
|
|
67
|
+
/extensions\//i,
|
|
68
|
+
/^chrome:\/\//i,
|
|
69
|
+
// Other plugins
|
|
70
|
+
/127\.0\.0\.1:4001\/isrunning/i,
|
|
71
|
+
/webappstoolbarba\.texthelp\.com\//i,
|
|
72
|
+
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
|
|
73
|
+
],
|
|
74
|
+
beforeSendTransaction: (event, hint) => {
|
|
75
|
+
console.log(event, hint);
|
|
76
|
+
return event;
|
|
77
|
+
},
|
|
22
78
|
});
|
|
23
|
-
const hub = new
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
79
|
+
const hub = new Hub(client);
|
|
80
|
+
const onMount = (customerId) => {
|
|
81
|
+
if (!mainHub) {
|
|
82
|
+
hub.setUser({ id: customerId });
|
|
83
|
+
hub.startSession();
|
|
84
|
+
mainHub = makeMain(hub);
|
|
85
|
+
}
|
|
27
86
|
};
|
|
28
|
-
const
|
|
87
|
+
const onUnMount = () => {
|
|
88
|
+
hub.setUser(null);
|
|
89
|
+
hub.endSession();
|
|
29
90
|
makeMain(mainHub);
|
|
30
91
|
};
|
|
92
|
+
const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
|
|
93
|
+
// const Routes = withSentryReactRouterV6Routing(ReactRouterRoutes);
|
|
31
94
|
return (Component) => {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
95
|
+
const WrappedComponent = wrap(Component);
|
|
96
|
+
const SentryLogger = (props) => {
|
|
97
|
+
const { customer } = props;
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
onMount(customer?.customerId);
|
|
100
|
+
return onUnMount;
|
|
101
|
+
}, [customer?.customerId]);
|
|
102
|
+
return (React.createElement(ErrorBoundary, null,
|
|
103
|
+
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
|
|
38
104
|
};
|
|
105
|
+
return SentryLogger;
|
|
39
106
|
};
|
|
40
107
|
};
|
|
41
108
|
export { sentryLogger };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { matchRoutes as reactRouterMatchRoutes } from "@remix-run/router";
|
|
2
|
+
const matchRoutes = (routes, locationArg) => {
|
|
3
|
+
// Remove the location's first path ("/checkout"). Otherwise it won't match the proper route.
|
|
4
|
+
const location = (typeof locationArg === "string" ? locationArg : locationArg?.pathname || "").replace(/^\/\w+/, "");
|
|
5
|
+
return reactRouterMatchRoutes(routes, location);
|
|
6
|
+
};
|
|
7
|
+
export { matchRoutes };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RoutingInstrumentation } from "@sentry/react-native";
|
|
2
|
+
import { OnConfirmRoute, TransactionCreator } from "@sentry/react-native/dist/js/tracing/routingInstrumentation";
|
|
3
|
+
import { BeforeNavigate } from "@sentry/react-native/dist/js/tracing/types";
|
|
4
|
+
export interface ReactNavigationRoute {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly params: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface ReactNavigationCurrentRoute extends ReactNavigationRoute {
|
|
10
|
+
readonly hasBeenSeen: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare class ReactRouterV6Instrumentation extends RoutingInstrumentation {
|
|
13
|
+
static instrumentationName: string;
|
|
14
|
+
private prevRoute?;
|
|
15
|
+
private recentRouteKeys;
|
|
16
|
+
private latestTransaction?;
|
|
17
|
+
private shouldUpdateLatestTransaction;
|
|
18
|
+
/**
|
|
19
|
+
* Extends by calling _handleInitialState at the end.
|
|
20
|
+
*/
|
|
21
|
+
registerRoutingInstrumentation(listener: TransactionCreator, beforeNavigate: BeforeNavigate, onConfirmRoute: OnConfirmRoute): void;
|
|
22
|
+
/**
|
|
23
|
+
* Starts an idle transaction for the initial state which won't get called by the router listener.
|
|
24
|
+
*/
|
|
25
|
+
private handleInitialState;
|
|
26
|
+
}
|
|
27
|
+
export { ReactRouterV6Instrumentation };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
+
import { RoutingInstrumentation } from "@sentry/react-native";
|
|
4
|
+
class ReactRouterV6Instrumentation extends RoutingInstrumentation {
|
|
5
|
+
static instrumentationName = "react-router-v6";
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
prevRoute;
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
recentRouteKeys = [];
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
latestTransaction;
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
shouldUpdateLatestTransaction = false;
|
|
14
|
+
/**
|
|
15
|
+
* Extends by calling _handleInitialState at the end.
|
|
16
|
+
*/
|
|
17
|
+
registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute) {
|
|
18
|
+
super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);
|
|
19
|
+
// Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.
|
|
20
|
+
this.handleInitialState();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Starts an idle transaction for the initial state which won't get called by the router listener.
|
|
24
|
+
*/
|
|
25
|
+
handleInitialState() {
|
|
26
|
+
this.latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT);
|
|
27
|
+
// We set this to true so when registerAppContainer is called, the transaction gets updated with the actual route data
|
|
28
|
+
this.shouldUpdateLatestTransaction = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const INITIAL_TRANSACTION_CONTEXT = {
|
|
32
|
+
name: "App Launch",
|
|
33
|
+
op: "navigation",
|
|
34
|
+
tags: {
|
|
35
|
+
["routing.instrumentation"]: ReactRouterV6Instrumentation.instrumentationName,
|
|
36
|
+
},
|
|
37
|
+
data: {},
|
|
38
|
+
};
|
|
39
|
+
export { ReactRouterV6Instrumentation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.31",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@lookiero/messaging": "^8.0.0",
|
|
34
34
|
"@lookiero/messaging-react": "^8.0.0",
|
|
35
35
|
"@react-spring/native": "^9.5.5",
|
|
36
|
+
"@sentry/react-native": "^4.13.0",
|
|
36
37
|
"inline-style-prefixer": "6.0.1",
|
|
37
38
|
"react-native-safe-area-context": "^4.4.1",
|
|
38
39
|
"react-native-svg": "^12.1.1",
|
|
@@ -47,7 +48,6 @@
|
|
|
47
48
|
"@lookiero/event": "^0.3",
|
|
48
49
|
"@lookiero/locale": "^0.3",
|
|
49
50
|
"@lookiero/payments-front": "^0.16.5",
|
|
50
|
-
"@sentry/react-native": "^3.2.13",
|
|
51
51
|
"apollo-boost": "0.4.4",
|
|
52
52
|
"graphql": "16.6.0",
|
|
53
53
|
"graphql-tag": "2.12.6",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"@types/react-dom": "~18.0.0",
|
|
81
81
|
"@types/react-native": "~0.69.1",
|
|
82
82
|
"@types/uuid": "^9.0.0",
|
|
83
|
-
"@sentry/react-native": "^3.2.13",
|
|
84
83
|
"apollo-boost": "0.4.4",
|
|
85
84
|
"eslint": "^8.24.0",
|
|
86
85
|
"eslint-config-prettier": "^8.5.0",
|