@lookiero/checkout 0.6.0-beta.35 → 0.6.0-beta.36
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.
|
@@ -4,81 +4,95 @@ import React, { useEffect } from "react";
|
|
|
4
4
|
import { Platform } from "react-native";
|
|
5
5
|
import { useRoutes as reactRouterUseRoutes } from "react-router-native";
|
|
6
6
|
import { Client, Hub, ErrorBoundary, transport, integrations, wrapComponent, wrapUseRoutes, } from "./SentryDependencies";
|
|
7
|
+
// This configuration is obtained from
|
|
8
|
+
// https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry
|
|
9
|
+
const IGNORED_ERRORS = [
|
|
10
|
+
// Random plugins/extensions
|
|
11
|
+
"top.GLOBALS",
|
|
12
|
+
// See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html
|
|
13
|
+
"originalCreateNotification",
|
|
14
|
+
"canvas.contentDocument",
|
|
15
|
+
"MyApp_RemoveAllHighlights",
|
|
16
|
+
"http://tt.epicplay.com",
|
|
17
|
+
"Can't find variable: ZiteReader",
|
|
18
|
+
"jigsaw is not defined",
|
|
19
|
+
"ComboSearch is not defined",
|
|
20
|
+
"http://loading.retry.widdit.com/",
|
|
21
|
+
"atomicFindClose",
|
|
22
|
+
// Facebook borked
|
|
23
|
+
"fb_xd_fragment",
|
|
24
|
+
// ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha)
|
|
25
|
+
// See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy
|
|
26
|
+
"bmi_SafeAddOnload",
|
|
27
|
+
"EBCallBackMessageReceived",
|
|
28
|
+
// See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx
|
|
29
|
+
"conduitPage",
|
|
30
|
+
// Generic error code from errors outside the security sandbox
|
|
31
|
+
// You can delete this if using raven.js > 1.0, which ignores these automatically.
|
|
32
|
+
"Script error.",
|
|
33
|
+
// Avast extension error
|
|
34
|
+
"_avast_submit",
|
|
35
|
+
];
|
|
36
|
+
const DENIED_URLS = [
|
|
37
|
+
// Google Adsense
|
|
38
|
+
/pagead\/js/i,
|
|
39
|
+
// Facebook flakiness
|
|
40
|
+
/graph\.facebook\.com/i,
|
|
41
|
+
// Facebook blocked
|
|
42
|
+
/connect\.facebook\.net\/en_US\/all\.js/i,
|
|
43
|
+
// Woopra flakiness
|
|
44
|
+
/eatdifferent\.com\.woopra-ns\.com/i,
|
|
45
|
+
/static\.woopra\.com\/js\/woopra\.js/i,
|
|
46
|
+
// Chrome extensions
|
|
47
|
+
/extensions\//i,
|
|
48
|
+
/^chrome:\/\//i,
|
|
49
|
+
// Other plugins
|
|
50
|
+
/127\.0\.0\.1:4001\/isrunning/i,
|
|
51
|
+
/webappstoolbarba\.texthelp\.com\//i,
|
|
52
|
+
/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,
|
|
53
|
+
];
|
|
7
54
|
const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
});
|
|
70
|
-
const hub = new Hub(client);
|
|
55
|
+
let globalHub;
|
|
56
|
+
let currentHub;
|
|
57
|
+
const initHub = () => {
|
|
58
|
+
const client = new Client({
|
|
59
|
+
environment,
|
|
60
|
+
release,
|
|
61
|
+
dsn: `https://${publicKey}@o179049.ingest.sentry.io/${project}`,
|
|
62
|
+
integrations: integrations(),
|
|
63
|
+
tracesSampleRate: 1.0,
|
|
64
|
+
debug: true,
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
enableNative: Platform.OS !== "web",
|
|
68
|
+
autoInitializeNativeSdk: Platform.OS !== "web",
|
|
69
|
+
stackParser: defaultStackParser,
|
|
70
|
+
transport,
|
|
71
|
+
ignoreErrors: IGNORED_ERRORS,
|
|
72
|
+
denyUrls: DENIED_URLS,
|
|
73
|
+
});
|
|
74
|
+
return new Hub(client);
|
|
75
|
+
};
|
|
71
76
|
const onMount = (customerId) => {
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
if (!currentHub) {
|
|
78
|
+
currentHub = initHub();
|
|
79
|
+
currentHub.setUser({ id: customerId });
|
|
80
|
+
currentHub.startSession();
|
|
81
|
+
}
|
|
82
|
+
if (!globalHub) {
|
|
83
|
+
globalHub = makeMain(currentHub);
|
|
76
84
|
}
|
|
77
85
|
};
|
|
78
86
|
const onUnMount = () => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
if (currentHub) {
|
|
88
|
+
currentHub.setUser(null);
|
|
89
|
+
currentHub.endSession();
|
|
90
|
+
currentHub = null;
|
|
91
|
+
}
|
|
92
|
+
if (globalHub) {
|
|
93
|
+
makeMain(globalHub);
|
|
94
|
+
globalHub = null;
|
|
95
|
+
}
|
|
82
96
|
};
|
|
83
97
|
const useRoutes = wrapUseRoutes(reactRouterUseRoutes);
|
|
84
98
|
return (Component) => {
|
|
@@ -88,7 +102,8 @@ const sentryLogger = ({ publicKey, environment, release, project }) => {
|
|
|
88
102
|
useEffect(() => {
|
|
89
103
|
onMount(customer?.customerId);
|
|
90
104
|
return onUnMount;
|
|
91
|
-
|
|
105
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
+
}, []);
|
|
92
107
|
return (React.createElement(ErrorBoundary, null,
|
|
93
108
|
React.createElement(WrappedComponent, { ...props, useRoutes: useRoutes })));
|
|
94
109
|
};
|