@lookiero/checkout 0.6.0-beta.2 → 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 -10
- package/dist/infrastructure/ui/routing/Routing.d.ts +2 -0
- package/dist/infrastructure/ui/routing/Routing.js +2 -2
- package/dist/infrastructure/ui/views/App.js +4 -10
- package/dist/shared/logging/SentryDependencies.d.ts +9 -0
- package/dist/shared/logging/SentryDependencies.js +22 -0
- package/dist/shared/logging/SentryDependencies.native.d.ts +8 -0
- package/dist/shared/logging/SentryDependencies.native.js +8 -0
- package/dist/shared/logging/SentryLogger.d.ts +7 -3
- package/dist/shared/logging/SentryLogger.js +86 -21
- package/package.json +2 -2
|
@@ -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,20 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { Platform } from "react-native";
|
|
3
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
3
4
|
import { sentryLogger } from "../../shared/logging/SentryLogger";
|
|
4
5
|
import { Routing } from "./routing/Routing";
|
|
5
6
|
const root = ({ Messaging, I18n, getAuthToken, development, sentry }) => {
|
|
6
7
|
// eslint-disable-next-line react/display-name, react/prop-types
|
|
7
|
-
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect }) => {
|
|
8
|
+
const Root = ({ basePath, locale = "en", customer, menu, tabBar, onNotAccessible, useRedirect, useRoutes = reactRouterUseRoutes, }) => {
|
|
8
9
|
const handleOnI18nError = useCallback(() => void 0, []);
|
|
9
10
|
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 })));
|
|
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 })));
|
|
11
12
|
};
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})(Root)
|
|
19
|
-
: Root;
|
|
13
|
+
return sentryLogger({
|
|
14
|
+
publicKey: sentry.publicKey,
|
|
15
|
+
environment: sentry.environment,
|
|
16
|
+
release: sentry.release,
|
|
17
|
+
project: sentry.project,
|
|
18
|
+
})(Root);
|
|
20
19
|
};
|
|
21
20
|
export { root };
|
|
@@ -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,7 @@ 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>;
|
|
18
20
|
export { Routing };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { lazy, Suspense } from "react";
|
|
2
|
-
import { Navigate, Outlet
|
|
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,7 +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, }) => {
|
|
15
|
+
const Routing = ({ basePath = "", customer, locale, I18n, menu, tabBar, getAuthToken, onI18nError, onNotAccessible, useRedirect, useRoutes, }) => {
|
|
16
16
|
const routes = useRoutes([
|
|
17
17
|
{
|
|
18
18
|
path: "",
|
|
@@ -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,22 @@
|
|
|
1
|
+
import { BrowserClient, Hub, makeFetchTransport, defaultIntegrations } from "@sentry/browser";
|
|
2
|
+
import { ErrorBoundary, reactRouterV6Instrumentation } from "@sentry/react";
|
|
3
|
+
import { BrowserTracing } from "@sentry/tracing";
|
|
4
|
+
import { useEffect } from "react";
|
|
5
|
+
import { createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-native";
|
|
6
|
+
const transport = (options, nativeFetch) => makeFetchTransport(options, nativeFetch);
|
|
7
|
+
const integrations = [
|
|
8
|
+
...defaultIntegrations,
|
|
9
|
+
new BrowserTracing({
|
|
10
|
+
routingInstrumentation: reactRouterV6Instrumentation(useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes),
|
|
11
|
+
beforeNavigate: (context) => {
|
|
12
|
+
console.log("beforeNavigate", context);
|
|
13
|
+
return context;
|
|
14
|
+
},
|
|
15
|
+
shouldCreateSpanForRequest: (url) => {
|
|
16
|
+
console.log(url);
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
];
|
|
21
|
+
const wrap = (Component) => Component;
|
|
22
|
+
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,8 @@
|
|
|
1
|
+
import { makeFetchTransport } from "@sentry/browser";
|
|
2
|
+
import { ReactNativeClient, Hub, ErrorBoundary, wrap as sentryWrap } 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
|
+
const transport = (options, nativeFetch) => NATIVE.isNativeTransportAvailable() ? makeReactNativeTransport(options) : makeFetchTransport(options, nativeFetch);
|
|
6
|
+
const integrations = [];
|
|
7
|
+
const wrap = (Component) => sentryWrap(Component);
|
|
8
|
+
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,106 @@
|
|
|
1
|
+
import { defaultStackParser } from "@sentry/browser";
|
|
1
2
|
import { makeMain } from "@sentry/core";
|
|
2
|
-
import
|
|
3
|
-
import "@sentry/tracing";
|
|
3
|
+
import { wrapUseRoutes } from "@sentry/react";
|
|
4
4
|
import React, { useEffect } from "react";
|
|
5
5
|
import { Platform } from "react-native";
|
|
6
|
+
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
7
|
+
import { Client, Hub, ErrorBoundary, transport, integrations, wrap } from "./SentryDependencies";
|
|
6
8
|
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
7
9
|
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({
|
|
10
|
+
const client = new Client({
|
|
15
11
|
environment,
|
|
16
12
|
release,
|
|
17
13
|
dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
|
|
18
|
-
integrations
|
|
14
|
+
integrations,
|
|
19
15
|
tracesSampleRate: 1.0,
|
|
20
16
|
debug: true,
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
+
// @ts-ignore
|
|
21
19
|
enableNative: Platform.OS !== "web",
|
|
20
|
+
stackParser: defaultStackParser,
|
|
21
|
+
transport,
|
|
22
|
+
// This configuration is obtained from
|
|
23
|
+
// https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry
|
|
24
|
+
ignoreErrors: [
|
|
25
|
+
// Random plugins/extensions
|
|
26
|
+
"top.GLOBALS",
|
|
27
|
+
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
|
|
28
|
+
"originalCreateNotification",
|
|
29
|
+
"canvas.contentDocument",
|
|
30
|
+
"MyApp_RemoveAllHighlights",
|
|
31
|
+
"http://tt.epicplay.com",
|
|
32
|
+
"Can't find variable: ZiteReader",
|
|
33
|
+
"jigsaw is not defined",
|
|
34
|
+
"ComboSearch is not defined",
|
|
35
|
+
"http://loading.retry.widdit.com/",
|
|
36
|
+
"atomicFindClose",
|
|
37
|
+
// Facebook borked
|
|
38
|
+
"fb_xd_fragment",
|
|
39
|
+
// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
|
|
40
|
+
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
|
|
41
|
+
"bmi_SafeAddOnload",
|
|
42
|
+
"EBCallBackMessageReceived",
|
|
43
|
+
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
|
|
44
|
+
"conduitPage",
|
|
45
|
+
// Generic error code from errors outside the security sandbox
|
|
46
|
+
// You can delete this if using raven.js > 1.0, which ignores these automatically.
|
|
47
|
+
"Script error.",
|
|
48
|
+
// Avast extension error
|
|
49
|
+
"_avast_submit",
|
|
50
|
+
],
|
|
51
|
+
denyUrls: [
|
|
52
|
+
// Google Adsense
|
|
53
|
+
/pagead\/js/i,
|
|
54
|
+
// Facebook flakiness
|
|
55
|
+
/graph\.facebook\.com/i,
|
|
56
|
+
// Facebook blocked
|
|
57
|
+
/connect\.facebook\.net\/en_US\/all\.js/i,
|
|
58
|
+
// Woopra flakiness
|
|
59
|
+
/eatdifferent\.com\.woopra-ns\.com/i,
|
|
60
|
+
/static\.woopra\.com\/js\/woopra\.js/i,
|
|
61
|
+
// Chrome extensions
|
|
62
|
+
/extensions\//i,
|
|
63
|
+
/^chrome:\/\//i,
|
|
64
|
+
// Other plugins
|
|
65
|
+
/127\.0\.0\.1:4001\/isrunning/i,
|
|
66
|
+
/webappstoolbarba\.texthelp\.com\//i,
|
|
67
|
+
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
|
|
68
|
+
],
|
|
69
|
+
beforeSend: (event) => {
|
|
70
|
+
console.log(event);
|
|
71
|
+
return event;
|
|
72
|
+
},
|
|
73
|
+
beforeSendTransaction: (event) => {
|
|
74
|
+
console.log(event);
|
|
75
|
+
return event;
|
|
76
|
+
},
|
|
22
77
|
});
|
|
23
|
-
const hub = new
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
78
|
+
const hub = new Hub(client);
|
|
79
|
+
const onMount = (customerId) => {
|
|
80
|
+
if (!mainHub) {
|
|
81
|
+
hub.setUser({ id: customerId });
|
|
82
|
+
hub.startSession();
|
|
83
|
+
mainHub = makeMain(hub);
|
|
84
|
+
}
|
|
27
85
|
};
|
|
28
|
-
const
|
|
86
|
+
const onUnMount = () => {
|
|
87
|
+
hub.setUser(null);
|
|
88
|
+
hub.endSession();
|
|
29
89
|
makeMain(mainHub);
|
|
30
90
|
};
|
|
31
91
|
return (Component) => {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
useEffect(() =>
|
|
37
|
-
|
|
92
|
+
const WrappedComponent = wrap(Component);
|
|
93
|
+
const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
|
|
94
|
+
const SentryLogger = (props) => {
|
|
95
|
+
const { customer } = props;
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
onMount(customer?.customerId);
|
|
98
|
+
return onUnMount;
|
|
99
|
+
}, [customer?.customerId]);
|
|
100
|
+
return (React.createElement(ErrorBoundary, null,
|
|
101
|
+
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
|
|
38
102
|
};
|
|
103
|
+
return SentryLogger;
|
|
39
104
|
};
|
|
40
105
|
};
|
|
41
106
|
export { sentryLogger };
|
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.20",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -33,7 +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.
|
|
36
|
+
"@sentry/react-native": "^4.13.0",
|
|
37
37
|
"inline-style-prefixer": "6.0.1",
|
|
38
38
|
"react-native-safe-area-context": "^4.4.1",
|
|
39
39
|
"react-native-svg": "^12.1.1",
|