@sentry/react-native 7.0.0-rc.1 → 7.0.0
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/RNSentry.podspec +3 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +50 -5
- package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +5 -0
- package/dist/js/NativeRNSentry.d.ts +1 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +2 -2
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +8 -8
- package/dist/js/client.js.map +1 -1
- package/dist/js/feedback/FeedbackWidget.js +12 -12
- package/dist/js/feedback/FeedbackWidget.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetManager.js +2 -2
- package/dist/js/feedback/FeedbackWidgetManager.js.map +1 -1
- package/dist/js/feedback/FeedbackWidgetProvider.js +3 -3
- package/dist/js/feedback/FeedbackWidgetProvider.js.map +1 -1
- package/dist/js/integrations/appRegistry.js +2 -2
- package/dist/js/integrations/appRegistry.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +3 -3
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/debugsymbolicatorutils.js +3 -3
- package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +4 -1
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/devicecontext.js +2 -2
- package/dist/js/integrations/devicecontext.js.map +1 -1
- package/dist/js/integrations/expocontext.d.ts.map +1 -1
- package/dist/js/integrations/expocontext.js +2 -2
- package/dist/js/integrations/expocontext.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +1 -0
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +1 -0
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/logEnricherIntegration.d.ts +3 -0
- package/dist/js/integrations/logEnricherIntegration.d.ts.map +1 -0
- package/dist/js/integrations/logEnricherIntegration.js +65 -0
- package/dist/js/integrations/logEnricherIntegration.js.map +1 -0
- package/dist/js/integrations/modulesloader.js +2 -2
- package/dist/js/integrations/modulesloader.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlers.js +12 -12
- package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
- package/dist/js/integrations/reactnativeerrorhandlersutils.js +6 -6
- package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
- package/dist/js/integrations/sdkinfo.js +3 -3
- package/dist/js/integrations/sdkinfo.js.map +1 -1
- package/dist/js/integrations/spotlight.js +4 -4
- package/dist/js/integrations/spotlight.js.map +1 -1
- package/dist/js/integrations/viewhierarchy.js +2 -2
- package/dist/js/integrations/viewhierarchy.js.map +1 -1
- package/dist/js/options.d.ts +1 -1
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/playground/modal.js +3 -3
- package/dist/js/playground/modal.js.map +1 -1
- package/dist/js/profiling/convertHermesProfile.js +5 -5
- package/dist/js/profiling/convertHermesProfile.js.map +1 -1
- package/dist/js/profiling/debugid.d.ts.map +1 -1
- package/dist/js/profiling/debugid.js +2 -2
- package/dist/js/profiling/debugid.js.map +1 -1
- package/dist/js/profiling/integration.js +13 -13
- package/dist/js/profiling/integration.js.map +1 -1
- package/dist/js/profiling/utils.js +3 -3
- package/dist/js/profiling/utils.js.map +1 -1
- package/dist/js/replay/CustomMask.js +3 -3
- package/dist/js/replay/CustomMask.js.map +1 -1
- package/dist/js/replay/mobilereplay.js +5 -5
- package/dist/js/replay/mobilereplay.js.map +1 -1
- package/dist/js/sdk.js +7 -7
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tools/ModulesCollector.js +12 -12
- package/dist/js/tools/ModulesCollector.js.map +1 -1
- package/dist/js/tools/enableLogger.js +1 -1
- package/dist/js/tools/enableLogger.js.map +1 -1
- package/dist/js/tools/metroMiddleware.js +6 -6
- package/dist/js/tools/metroMiddleware.js.map +1 -1
- package/dist/js/tools/metroconfig.js +2 -2
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
- package/dist/js/tools/sentryBabelTransformerUtils.js +6 -6
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
- package/dist/js/tools/utils.d.ts.map +1 -1
- package/dist/js/tools/utils.js +39 -10
- package/dist/js/tools/utils.js.map +1 -1
- package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
- package/dist/js/tools/vendor/metro/utils.js +28 -6
- package/dist/js/tools/vendor/metro/utils.js.map +1 -1
- package/dist/js/touchevents.js +3 -3
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/tracing/gesturetracing.js +5 -5
- package/dist/js/tracing/gesturetracing.js.map +1 -1
- package/dist/js/tracing/integrations/appStart.js +34 -34
- package/dist/js/tracing/integrations/appStart.js.map +1 -1
- package/dist/js/tracing/integrations/nativeFrames.js +14 -14
- package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
- package/dist/js/tracing/integrations/stalltracking.js +7 -7
- package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js +11 -11
- package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
- package/dist/js/tracing/integrations/userInteraction.js +8 -8
- package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
- package/dist/js/tracing/onSpanEndUtils.js +10 -10
- package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
- package/dist/js/tracing/reactnativeprofiler.js +2 -2
- package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
- package/dist/js/tracing/reactnavigation.js +14 -14
- package/dist/js/tracing/reactnavigation.js.map +1 -1
- package/dist/js/tracing/span.js +6 -6
- package/dist/js/tracing/span.js.map +1 -1
- package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
- package/dist/js/tracing/timetodisplay.js +20 -30
- package/dist/js/tracing/timetodisplay.js.map +1 -1
- package/dist/js/tracing/utils.js +2 -2
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +2 -1
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/safe.js +3 -3
- package/dist/js/utils/safe.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +1 -0
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -0
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +40 -26
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry+fetchNativeStack.m +101 -0
- package/ios/RNSentry.h +5 -0
- package/ios/RNSentry.mm +67 -77
- package/ios/RNSentryVersion.m +1 -1
- package/package.json +15 -14
- package/plugin/build/withSentryAndroid.js +7 -7
- package/plugin/build/withSentryAndroidGradlePlugin.d.ts +3 -2
- package/plugin/build/withSentryAndroidGradlePlugin.js +11 -22
- package/scripts/expo-upload-sourcemaps.js +1 -1
- package/scripts/sentry_utils.rb +4 -0
- package/src/js/NativeRNSentry.ts +1 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
- package/ts3.8/dist/js/client.d.ts +2 -2
- package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
- package/ts3.8/dist/js/integrations/logEnricherIntegration.d.ts +3 -0
- package/ts3.8/dist/js/options.d.ts +1 -1
- package/ts3.8/dist/js/utils/worldwide.d.ts +1 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { debug } from '@sentry/core';
|
|
11
|
+
import { NATIVE } from '../wrapper';
|
|
12
|
+
const INTEGRATION_NAME = 'LogEnricher';
|
|
13
|
+
export const logEnricherIntegration = () => {
|
|
14
|
+
return {
|
|
15
|
+
name: INTEGRATION_NAME,
|
|
16
|
+
setup(client) {
|
|
17
|
+
client.on('afterInit', () => {
|
|
18
|
+
cacheLogContext().then(() => {
|
|
19
|
+
client.on('beforeCaptureLog', (log) => {
|
|
20
|
+
processLog(log);
|
|
21
|
+
});
|
|
22
|
+
}, reason => {
|
|
23
|
+
debug.log(reason);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
let NativeCache = undefined;
|
|
30
|
+
function cacheLogContext() {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f;
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
try {
|
|
34
|
+
const response = yield NATIVE.fetchNativeLogAttributes();
|
|
35
|
+
NativeCache = Object.assign(Object.assign(Object.assign({}, (((_a = response === null || response === void 0 ? void 0 : response.contexts) === null || _a === void 0 ? void 0 : _a.device) && {
|
|
36
|
+
brand: (_b = response.contexts.device) === null || _b === void 0 ? void 0 : _b.brand,
|
|
37
|
+
model: (_c = response.contexts.device) === null || _c === void 0 ? void 0 : _c.model,
|
|
38
|
+
family: (_d = response.contexts.device) === null || _d === void 0 ? void 0 : _d.family,
|
|
39
|
+
})), (((_e = response === null || response === void 0 ? void 0 : response.contexts) === null || _e === void 0 ? void 0 : _e.os) && {
|
|
40
|
+
os: response.contexts.os.name,
|
|
41
|
+
version: response.contexts.os.version,
|
|
42
|
+
})), (((_f = response === null || response === void 0 ? void 0 : response.contexts) === null || _f === void 0 ? void 0 : _f.release) && {
|
|
43
|
+
release: response.contexts.release,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
return Promise.reject(`[LOGS]: Failed to prepare attributes from Native Layer: ${e}`);
|
|
48
|
+
}
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function processLog(log) {
|
|
53
|
+
var _a;
|
|
54
|
+
if (NativeCache === undefined) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
log.attributes = (_a = log.attributes) !== null && _a !== void 0 ? _a : {};
|
|
58
|
+
NativeCache.brand && (log.attributes['device.brand'] = NativeCache.brand);
|
|
59
|
+
NativeCache.model && (log.attributes['device.model'] = NativeCache.model);
|
|
60
|
+
NativeCache.family && (log.attributes['device.family'] = NativeCache.family);
|
|
61
|
+
NativeCache.os && (log.attributes['os.name'] = NativeCache.os);
|
|
62
|
+
NativeCache.version && (log.attributes['os.version'] = NativeCache.version);
|
|
63
|
+
NativeCache.release && (log.attributes['sentry.release'] = NativeCache.release);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=logEnricherIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logEnricherIntegration.js","sourceRoot":"","sources":["../../../src/js/integrations/logEnricherIntegration.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,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port type { Integration, Log } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport type { ReactNativeClient } from '../client';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'LogEnricher';\n\nexport const logEnricherIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setup(client: ReactNativeClient) {\n client.on('afterInit', () => {\n cacheLogContext().then(\n () => {\n client.on('beforeCaptureLog', (log: Log) => {\n processLog(log);\n });\n },\n reason => {\n debug.log(reason);\n },\n );\n });\n },\n };\n};\n\nlet NativeCache: Record<string, unknown> | undefined = undefined;\n\nasync function cacheLogContext(): Promise<void> {\n try {\n const response = await NATIVE.fetchNativeLogAttributes();\n\n NativeCache = {\n ...(response?.contexts?.device && {\n brand: response.contexts.device?.brand,\n model: response.contexts.device?.model,\n family: response.contexts.device?.family,\n }),\n ...(response?.contexts?.os && {\n os: response.contexts.os.name,\n version: response.contexts.os.version,\n }),\n ...(response?.contexts?.release && {\n release: response.contexts.release,\n }),\n };\n } catch (e) {\n return Promise.reject(`[LOGS]: Failed to prepare attributes from Native Layer: ${e}`);\n }\n return Promise.resolve();\n}\n\nfunction processLog(log: Log): void {\n if (NativeCache === undefined) {\n return;\n }\n\n log.attributes = log.attributes ?? {};\n NativeCache.brand && (log.attributes['device.brand'] = NativeCache.brand);\n NativeCache.model && (log.attributes['device.model'] = NativeCache.model);\n NativeCache.family && (log.attributes['device.family'] = NativeCache.family);\n NativeCache.os && (log.attributes['os.name'] = NativeCache.os);\n NativeCache.version && (log.attributes['os.version'] = NativeCache.version);\n NativeCache.release && (log.attributes['sentry.release'] = NativeCache.release);\n}\n"]}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { debug } from '@sentry/core';
|
|
11
11
|
import { NATIVE } from '../wrapper';
|
|
12
12
|
const INTEGRATION_NAME = 'ModulesLoader';
|
|
13
13
|
/** Loads runtime JS modules from prepared file. */
|
|
@@ -29,7 +29,7 @@ function createProcessEvent() {
|
|
|
29
29
|
modules = yield NATIVE.fetchModules();
|
|
30
30
|
}
|
|
31
31
|
catch (e) {
|
|
32
|
-
|
|
32
|
+
debug.log(`Failed to get modules from native: ${e}`);
|
|
33
33
|
}
|
|
34
34
|
isSetup = true;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modulesloader.js","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"modulesloader.js","sourceRoot":"","sources":["../../../src/js/integrations/modulesloader.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC,mDAAmD;AACnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAgB,EAAE;IACxD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;QACD,YAAY,EAAE,kBAAkB,EAAE;KACnC,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,kBAAkB;IACzB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,OAAO,GAAkC,IAAI,CAAC;IAElD,OAAO,CAAO,KAAY,EAAE,EAAE;QAC5B,IAAI,CAAC,OAAO,EAAE;YACZ,IAAI;gBACF,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;aACvC;YAAC,OAAO,CAAC,EAAE;gBACV,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAC;aACtD;YACD,OAAO,GAAG,IAAI,CAAC;SAChB;QACD,IAAI,OAAO,EAAE;YACX,KAAK,CAAC,OAAO,mCACR,OAAO,GACP,KAAK,CAAC,OAAO,CACjB,CAAC;SACH;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAA,CAAC;AACJ,CAAC","sourcesContent":["import type { Event, Integration } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'ModulesLoader';\n\n/** Loads runtime JS modules from prepared file. */\nexport const modulesLoaderIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent: createProcessEvent(),\n };\n};\n\nfunction createProcessEvent(): (event: Event) => Promise<Event> {\n let isSetup = false;\n let modules: Record<string, string> | null = null;\n\n return async (event: Event) => {\n if (!isSetup) {\n try {\n modules = await NATIVE.fetchModules();\n } catch (e) {\n debug.log(`Failed to get modules from native: ${e}`);\n }\n isSetup = true;\n }\n if (modules) {\n event.modules = {\n ...modules,\n ...event.modules,\n };\n }\n return event;\n };\n}\n"]}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { addExceptionMechanism, addGlobalUnhandledRejectionInstrumentationHandler, captureException, getClient, getCurrentScope,
|
|
10
|
+
import { addExceptionMechanism, addGlobalUnhandledRejectionInstrumentationHandler, captureException, debug, getClient, getCurrentScope, } from '@sentry/core';
|
|
11
11
|
import { isHermesEnabled, isWeb } from '../utils/environment';
|
|
12
12
|
import { createSyntheticError, isErrorLike } from '../utils/error';
|
|
13
13
|
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
@@ -33,16 +33,16 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise) {
|
|
|
33
33
|
if (isHermesEnabled() &&
|
|
34
34
|
((_a = RN_GLOBAL_OBJ.HermesInternal) === null || _a === void 0 ? void 0 : _a.enablePromiseRejectionTracker) &&
|
|
35
35
|
((_c = (_b = RN_GLOBAL_OBJ === null || RN_GLOBAL_OBJ === void 0 ? void 0 : RN_GLOBAL_OBJ.HermesInternal) === null || _b === void 0 ? void 0 : _b.hasPromise) === null || _c === void 0 ? void 0 : _c.call(_b))) {
|
|
36
|
-
|
|
36
|
+
debug.log('Using Hermes native promise rejection tracking');
|
|
37
37
|
RN_GLOBAL_OBJ.HermesInternal.enablePromiseRejectionTracker({
|
|
38
38
|
allRejections: true,
|
|
39
39
|
onUnhandled: promiseRejectionTrackingOptions.onUnhandled,
|
|
40
40
|
onHandled: promiseRejectionTrackingOptions.onHandled,
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
debug.log('Unhandled promise rejections will be caught by Sentry.');
|
|
43
43
|
}
|
|
44
44
|
else if (isWeb()) {
|
|
45
|
-
|
|
45
|
+
debug.log('Using Browser JS promise rejection tracking for React Native Web');
|
|
46
46
|
// Use Sentry's built-in global unhandled rejection handler
|
|
47
47
|
addGlobalUnhandledRejectionInstrumentationHandler((error) => {
|
|
48
48
|
captureException(error, {
|
|
@@ -60,11 +60,11 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise) {
|
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
// For JSC and other environments, patching was disabled by user configuration
|
|
63
|
-
|
|
63
|
+
debug.log('Unhandled promise rejections will not be caught by Sentry.');
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
catch (e) {
|
|
67
|
-
|
|
67
|
+
debug.warn('Failed to set up promise rejection tracking. ' +
|
|
68
68
|
'Unhandled promise rejections will not be caught by Sentry.' +
|
|
69
69
|
'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.');
|
|
70
70
|
}
|
|
@@ -72,7 +72,7 @@ function setupUnhandledRejectionsTracking(patchGlobalPromise) {
|
|
|
72
72
|
const promiseRejectionTrackingOptions = {
|
|
73
73
|
onUnhandled: (id, error, rejection = {}) => {
|
|
74
74
|
if (__DEV__) {
|
|
75
|
-
|
|
75
|
+
debug.warn(`Possible Unhandled Promise Rejection (id: ${id}):\n${rejection}`);
|
|
76
76
|
}
|
|
77
77
|
// Marking the rejection as handled to avoid breaking crash rate calculations.
|
|
78
78
|
// See: https://github.com/getsentry/sentry-react-native/issues/4141
|
|
@@ -85,7 +85,7 @@ const promiseRejectionTrackingOptions = {
|
|
|
85
85
|
},
|
|
86
86
|
onHandled: id => {
|
|
87
87
|
if (__DEV__) {
|
|
88
|
-
|
|
88
|
+
debug.warn(`Promise Rejection Handled (id: ${id})\n` +
|
|
89
89
|
'This means you can ignore any previous messages of the form ' +
|
|
90
90
|
`"Possible Unhandled Promise Rejection (id: ${id}):"`);
|
|
91
91
|
}
|
|
@@ -104,7 +104,7 @@ function setupErrorUtilsGlobalHandler() {
|
|
|
104
104
|
let handlingFatal = false;
|
|
105
105
|
const errorUtils = RN_GLOBAL_OBJ.ErrorUtils;
|
|
106
106
|
if (!errorUtils) {
|
|
107
|
-
|
|
107
|
+
debug.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.');
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
const defaultHandler = (_a = errorUtils.getGlobalHandler) === null || _a === void 0 ? void 0 : _a.call(errorUtils);
|
|
@@ -114,14 +114,14 @@ function setupErrorUtilsGlobalHandler() {
|
|
|
114
114
|
const shouldHandleFatal = isFatal && !__DEV__;
|
|
115
115
|
if (shouldHandleFatal) {
|
|
116
116
|
if (handlingFatal) {
|
|
117
|
-
|
|
117
|
+
debug.log('Encountered multiple fatals in a row. The latest:', error);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
handlingFatal = true;
|
|
121
121
|
}
|
|
122
122
|
const client = getClient();
|
|
123
123
|
if (!client) {
|
|
124
|
-
|
|
124
|
+
debug.error('Sentry client is missing, the error event might be lost.', error);
|
|
125
125
|
// If there is no client something is fishy, anyway we call the default handler
|
|
126
126
|
defaultHandler(error, isFatal);
|
|
127
127
|
return;
|
|
@@ -155,7 +155,7 @@ function setupErrorUtilsGlobalHandler() {
|
|
|
155
155
|
void client.flush(client.getOptions().shutdownTimeout || 2000).then(() => {
|
|
156
156
|
defaultHandler(error, isFatal);
|
|
157
157
|
}, (reason) => {
|
|
158
|
-
|
|
158
|
+
debug.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason);
|
|
159
159
|
});
|
|
160
160
|
}));
|
|
161
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EACL,qBAAqB,EACrB,iDAAiD,EACjD,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEjH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAcpD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,UAAoD,EAAE,EACzC,EAAE;IACf,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE,CACd,KAAK,iBACH,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,EACV;KACL,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,KAAK,CAAC,OAAwC;IACrD,OAAO,CAAC,oBAAoB,IAAI,gCAAgC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IA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AAI,OAAO,EAAE;YACX,gFAAgF;YAChF,mCAAmC;YACnC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC/B,OAAO;SACR;QAED,KAAK,MAAM,CAAC,KAAK,CAAE,MAAM,CAAC,UAAU,EAA+B,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAC/F,GAAG,EAAE;YACH,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjC,CAAC,EACD,CAAC,MAAe,EAAE,EAAE;YAClB,MAAM,CAAC,KAAK,CAAC,uFAAuF,EAAE,MAAM,CAAC,CAAC;QAChH,CAAC,CACF,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { EventHint, Integration, SeverityLevel } from '@sentry/core';\nimport {\n addExceptionMechanism,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureException,\n getClient,\n getCurrentScope,\n logger,\n} from '@sentry/core';\nimport type { ReactNativeClientOptions } from '../options';\nimport { isHermesEnabled, isWeb } from '../utils/environment';\nimport { createSyntheticError, isErrorLike } from '../utils/error';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { checkPromiseAndWarn, polyfillPromise, requireRejectionTracking } from './reactnativeerrorhandlersutils';\n\nconst INTEGRATION_NAME = 'ReactNativeErrorHandlers';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n/** ReactNativeErrorHandlers Integration */\nexport const reactNativeErrorHandlersIntegration = (\n options: Partial<ReactNativeErrorHandlersOptions> = {},\n): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () =>\n setup({\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n }),\n };\n};\n\nfunction setup(options: ReactNativeErrorHandlersOptions): void {\n options.onunhandledrejection && setupUnhandledRejectionsTracking(options.patchGlobalPromise);\n options.onerror && setupErrorUtilsGlobalHandler();\n}\n\n/**\n * Setup unhandled promise rejection tracking\n */\nfunction setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void {\n try {\n if (\n isHermesEnabled() &&\n RN_GLOBAL_OBJ.HermesInternal?.enablePromiseRejectionTracker &&\n RN_GLOBAL_OBJ?.HermesInternal?.hasPromise?.()\n ) {\n logger.log('Using Hermes native promise rejection tracking');\n\n RN_GLOBAL_OBJ.HermesInternal.enablePromiseRejectionTracker({\n allRejections: true,\n onUnhandled: promiseRejectionTrackingOptions.onUnhandled,\n onHandled: promiseRejectionTrackingOptions.onHandled,\n });\n\n logger.log('Unhandled promise rejections will be caught by Sentry.');\n } else if (isWeb()) {\n logger.log('Using Browser JS promise rejection tracking for React Native Web');\n\n // Use Sentry's built-in global unhandled rejection handler\n addGlobalUnhandledRejectionInstrumentationHandler((error: unknown) => {\n captureException(error, {\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\n mechanism: { handled: false, type: 'onunhandledrejection' },\n });\n });\n } else if (patchGlobalPromise) {\n // For JSC and other environments, use the existing approach\n polyfillPromise();\n attachUnhandledRejectionHandler();\n checkPromiseAndWarn();\n } else {\n // For JSC and other environments, patching was disabled by user configuration\n logger.log('Unhandled promise rejections will not be caught by Sentry.');\n }\n } catch (e) {\n logger.warn(\n 'Failed to set up promise rejection tracking. ' +\n 'Unhandled promise rejections will not be caught by Sentry.' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n}\n\nconst promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, error: unknown, rejection = {}) => {\n if (__DEV__) {\n logger.warn(`Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`);\n }\n\n // Marking the rejection as handled to avoid breaking crash rate calculations.\n // See: https://github.com/getsentry/sentry-react-native/issues/4141\n captureException(error, {\n data: { id },\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\n mechanism: { handled: true, type: 'onunhandledrejection' },\n });\n },\n onHandled: id => {\n if (__DEV__) {\n logger.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`,\n );\n }\n },\n};\n\nfunction attachUnhandledRejectionHandler(): void {\n const tracking = requireRejectionTracking();\n\n tracking.enable({\n allRejections: true,\n onUnhandled: promiseRejectionTrackingOptions.onUnhandled,\n onHandled: promiseRejectionTrackingOptions.onHandled,\n });\n}\n\nfunction setupErrorUtilsGlobalHandler(): void {\n let handlingFatal = false;\n\n const errorUtils = RN_GLOBAL_OBJ.ErrorUtils;\n if (!errorUtils) {\n logger.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.');\n return;\n }\n\n const defaultHandler = errorUtils.getGlobalHandler?.();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n errorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n logger.log('Encountered multiple fatals in a row. The latest:', error);\n return;\n }\n handlingFatal = true;\n }\n\n const client = getClient();\n\n if (!client) {\n logger.error('Sentry client is missing, the error event might be lost.', error);\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const hint: EventHint = {\n originalException: error,\n attachments: getCurrentScope().getScopeData().attachments,\n };\n const event = await client.eventFromException(error, hint);\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n } else {\n event.level = 'error';\n\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n }\n\n client.captureEvent(event, hint);\n\n if (__DEV__) {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n return;\n }\n\n void client.flush((client.getOptions() as ReactNativeClientOptions).shutdownTimeout || 2000).then(\n () => {\n defaultHandler(error, isFatal);\n },\n (reason: unknown) => {\n logger.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason);\n },\n );\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlers.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlers.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EACL,qBAAqB,EACrB,iDAAiD,EACjD,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEjH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAcpD,2CAA2C;AAC3C,MAAM,CAAC,MAAM,mCAAmC,GAAG,CACjD,UAAoD,EAAE,EACzC,EAAE;IACf,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE,CACd,KAAK,iBACH,OAAO,EAAE,IAAI,EACb,oBAAoB,EAAE,IAAI,EAC1B,kBAAkB,EAAE,IAAI,IACrB,OAAO,EACV;KACL,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,KAAK,CAAC,OAAwC;IACrD,OAAO,CAAC,oBAAoB,IAAI,gCAAgC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7F,OAAO,CAAC,OAAO,IAAI,4BAA4B,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAS,gCAAgC,CAA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B,OAAO;SACR;QAED,KAAK,MAAM,CAAC,KAAK,CAAE,MAAM,CAAC,UAAU,EAA+B,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,IAAI,CAC/F,GAAG,EAAE;YACH,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjC,CAAC,EACD,CAAC,MAAe,EAAE,EAAE;YAClB,KAAK,CAAC,KAAK,CAAC,uFAAuF,EAAE,MAAM,CAAC,CAAC;QAC/G,CAAC,CACF,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { EventHint, Integration, SeverityLevel } from '@sentry/core';\nimport {\n addExceptionMechanism,\n addGlobalUnhandledRejectionInstrumentationHandler,\n captureException,\n debug,\n getClient,\n getCurrentScope,\n} from '@sentry/core';\nimport type { ReactNativeClientOptions } from '../options';\nimport { isHermesEnabled, isWeb } from '../utils/environment';\nimport { createSyntheticError, isErrorLike } from '../utils/error';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { checkPromiseAndWarn, polyfillPromise, requireRejectionTracking } from './reactnativeerrorhandlersutils';\n\nconst INTEGRATION_NAME = 'ReactNativeErrorHandlers';\n\n/** ReactNativeErrorHandlers Options */\ninterface ReactNativeErrorHandlersOptions {\n onerror: boolean;\n onunhandledrejection: boolean;\n patchGlobalPromise: boolean;\n}\n\ninterface PromiseRejectionTrackingOptions {\n onUnhandled: (id: string, error: unknown) => void;\n onHandled: (id: string) => void;\n}\n\n/** ReactNativeErrorHandlers Integration */\nexport const reactNativeErrorHandlersIntegration = (\n options: Partial<ReactNativeErrorHandlersOptions> = {},\n): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () =>\n setup({\n onerror: true,\n onunhandledrejection: true,\n patchGlobalPromise: true,\n ...options,\n }),\n };\n};\n\nfunction setup(options: ReactNativeErrorHandlersOptions): void {\n options.onunhandledrejection && setupUnhandledRejectionsTracking(options.patchGlobalPromise);\n options.onerror && setupErrorUtilsGlobalHandler();\n}\n\n/**\n * Setup unhandled promise rejection tracking\n */\nfunction setupUnhandledRejectionsTracking(patchGlobalPromise: boolean): void {\n try {\n if (\n isHermesEnabled() &&\n RN_GLOBAL_OBJ.HermesInternal?.enablePromiseRejectionTracker &&\n RN_GLOBAL_OBJ?.HermesInternal?.hasPromise?.()\n ) {\n debug.log('Using Hermes native promise rejection tracking');\n\n RN_GLOBAL_OBJ.HermesInternal.enablePromiseRejectionTracker({\n allRejections: true,\n onUnhandled: promiseRejectionTrackingOptions.onUnhandled,\n onHandled: promiseRejectionTrackingOptions.onHandled,\n });\n\n debug.log('Unhandled promise rejections will be caught by Sentry.');\n } else if (isWeb()) {\n debug.log('Using Browser JS promise rejection tracking for React Native Web');\n\n // Use Sentry's built-in global unhandled rejection handler\n addGlobalUnhandledRejectionInstrumentationHandler((error: unknown) => {\n captureException(error, {\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\n mechanism: { handled: false, type: 'onunhandledrejection' },\n });\n });\n } else if (patchGlobalPromise) {\n // For JSC and other environments, use the existing approach\n polyfillPromise();\n attachUnhandledRejectionHandler();\n checkPromiseAndWarn();\n } else {\n // For JSC and other environments, patching was disabled by user configuration\n debug.log('Unhandled promise rejections will not be caught by Sentry.');\n }\n } catch (e) {\n debug.warn(\n 'Failed to set up promise rejection tracking. ' +\n 'Unhandled promise rejections will not be caught by Sentry.' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n}\n\nconst promiseRejectionTrackingOptions: PromiseRejectionTrackingOptions = {\n onUnhandled: (id, error: unknown, rejection = {}) => {\n if (__DEV__) {\n debug.warn(`Possible Unhandled Promise Rejection (id: ${id}):\\n${rejection}`);\n }\n\n // Marking the rejection as handled to avoid breaking crash rate calculations.\n // See: https://github.com/getsentry/sentry-react-native/issues/4141\n captureException(error, {\n data: { id },\n originalException: error,\n syntheticException: isErrorLike(error) ? undefined : createSyntheticError(),\n mechanism: { handled: true, type: 'onunhandledrejection' },\n });\n },\n onHandled: id => {\n if (__DEV__) {\n debug.warn(\n `Promise Rejection Handled (id: ${id})\\n` +\n 'This means you can ignore any previous messages of the form ' +\n `\"Possible Unhandled Promise Rejection (id: ${id}):\"`,\n );\n }\n },\n};\n\nfunction attachUnhandledRejectionHandler(): void {\n const tracking = requireRejectionTracking();\n\n tracking.enable({\n allRejections: true,\n onUnhandled: promiseRejectionTrackingOptions.onUnhandled,\n onHandled: promiseRejectionTrackingOptions.onHandled,\n });\n}\n\nfunction setupErrorUtilsGlobalHandler(): void {\n let handlingFatal = false;\n\n const errorUtils = RN_GLOBAL_OBJ.ErrorUtils;\n if (!errorUtils) {\n debug.warn('ErrorUtils not found. Can be caused by different environment for example react-native-web.');\n return;\n }\n\n const defaultHandler = errorUtils.getGlobalHandler?.();\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n errorUtils.setGlobalHandler(async (error: any, isFatal?: boolean) => {\n // We want to handle fatals, but only in production mode.\n const shouldHandleFatal = isFatal && !__DEV__;\n if (shouldHandleFatal) {\n if (handlingFatal) {\n debug.log('Encountered multiple fatals in a row. The latest:', error);\n return;\n }\n handlingFatal = true;\n }\n\n const client = getClient();\n\n if (!client) {\n debug.error('Sentry client is missing, the error event might be lost.', error);\n\n // If there is no client something is fishy, anyway we call the default handler\n defaultHandler(error, isFatal);\n\n return;\n }\n\n const hint: EventHint = {\n originalException: error,\n attachments: getCurrentScope().getScopeData().attachments,\n };\n const event = await client.eventFromException(error, hint);\n\n if (isFatal) {\n event.level = 'fatal' as SeverityLevel;\n\n addExceptionMechanism(event, {\n handled: false,\n type: 'onerror',\n });\n } else {\n event.level = 'error';\n\n addExceptionMechanism(event, {\n handled: true,\n type: 'generic',\n });\n }\n\n client.captureEvent(event, hint);\n\n if (__DEV__) {\n // If in dev, we call the default handler anyway and hope the error will be sent\n // Just for a better dev experience\n defaultHandler(error, isFatal);\n return;\n }\n\n void client.flush((client.getOptions() as ReactNativeClientOptions).shutdownTimeout || 2000).then(\n () => {\n defaultHandler(error, isFatal);\n },\n (reason: unknown) => {\n debug.error('[ReactNativeErrorHandlers] Error while flushing the event cache after uncaught error.', reason);\n },\n );\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debug } from '@sentry/core';
|
|
2
2
|
import { ReactNativeLibraries } from '../utils/rnlibraries';
|
|
3
3
|
import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
4
4
|
/**
|
|
@@ -12,7 +12,7 @@ import { RN_GLOBAL_OBJ } from '../utils/worldwide';
|
|
|
12
12
|
*/
|
|
13
13
|
export function polyfillPromise() {
|
|
14
14
|
if (!ReactNativeLibraries.Utilities) {
|
|
15
|
-
|
|
15
|
+
debug.warn('Could not polyfill Promise. React Native Libraries Utilities not found.');
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
const Promise = getPromisePolyfill();
|
|
@@ -54,23 +54,23 @@ export function checkPromiseAndWarn() {
|
|
|
54
54
|
const PromisePackagePromise = require('promise/setimmediate/es6-extensions');
|
|
55
55
|
const UsedPromisePolyfill = getPromisePolyfill();
|
|
56
56
|
if (ReactNativePromise !== PromisePackagePromise) {
|
|
57
|
-
|
|
57
|
+
debug.warn('You appear to have multiple versions of the "promise" package installed. ' +
|
|
58
58
|
'This may cause unexpected behavior like undefined `Promise.allSettled`. ' +
|
|
59
59
|
'Please install the `promise` package manually using the exact version as the React Native package. ' +
|
|
60
60
|
'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.');
|
|
61
61
|
}
|
|
62
62
|
// This only make sense if the user disabled the integration Polyfill
|
|
63
63
|
if (UsedPromisePolyfill !== RN_GLOBAL_OBJ.Promise) {
|
|
64
|
-
|
|
64
|
+
debug.warn('Unhandled promise rejections will not be caught by Sentry. ' +
|
|
65
65
|
'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.');
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
|
-
|
|
68
|
+
debug.log('Unhandled promise rejections will be caught by Sentry.');
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
catch (e) {
|
|
72
72
|
// Do Nothing
|
|
73
|
-
|
|
73
|
+
debug.warn('Unhandled promise rejections will not be caught by Sentry. ' +
|
|
74
74
|
'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.');
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactnativeerrorhandlersutils.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlersutils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"reactnativeerrorhandlersutils.js","sourceRoot":"","sources":["../../../src/js/integrations/reactnativeerrorhandlersutils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE;QACnC,KAAK,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;QACtF,OAAO;KACR;IAED,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IAErC,+CAA+C;IAC/C,6DAA6D;IAC7D,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACrC,6DAA6D;IAC7D,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAExC,oBAAoB,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,yFAAyF;IACzF,2GAA2G;IAC3G,OAAO,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB;IAItC,gGAAgG;IAChG,OAAO,OAAO,CAAC,yCAAyC,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,IAAI;QACF,uFAAuF;QACvF,gFAAgF;QAChF,+CAA+C;QAC/C,+GAA+G;QAC/G,0FAA0F;QAC1F,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,CAAC;QACxD,gGAAgG;QAChG,MAAM,qBAAqB,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;QAC7E,MAAM,mBAAmB,GAAG,kBAAkB,EAAE,CAAC;QAEjD,IAAI,kBAAkB,KAAK,qBAAqB,EAAE;YAChD,KAAK,CAAC,IAAI,CACR,2EAA2E;gBACzE,0EAA0E;gBAC1E,qGAAqG;gBACrG,sFAAsF,CACzF,CAAC;SACH;QAED,qEAAqE;QACrE,IAAI,mBAAmB,KAAK,aAAa,CAAC,OAAO,EAAE;YACjD,KAAK,CAAC,IAAI,CACR,6DAA6D;gBAC3D,sFAAsF,CACzF,CAAC;SACH;aAAM;YACL,KAAK,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;SACrE;KACF;IAAC,OAAO,CAAC,EAAE;QACV,aAAa;QACb,KAAK,CAAC,IAAI,CACR,6DAA6D;YAC3D,sFAAsF,CACzF,CAAC;KACH;AACH,CAAC","sourcesContent":["import { debug } from '@sentry/core';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\n\n/**\n * Polyfill the global promise instance with one we can be sure that we can attach the tracking to.\n *\n * In newer RN versions >=0.63, the global promise is not the same reference as the one imported from the promise library.\n * This is due to a version mismatch between promise versions.\n * Originally we tried a solution where we would have you put a package resolution to ensure the promise instances match. However,\n * - Using a package resolution requires the you to manually troubleshoot.\n * - The package resolution fix no longer works with 0.67 on iOS Hermes.\n */\nexport function polyfillPromise(): void {\n if (!ReactNativeLibraries.Utilities) {\n debug.warn('Could not polyfill Promise. React Native Libraries Utilities not found.');\n return;\n }\n\n const Promise = getPromisePolyfill();\n\n // As of RN 0.67 only done and finally are used\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/done');\n // eslint-disable-next-line import/no-extraneous-dependencies\n require('promise/setimmediate/finally');\n\n ReactNativeLibraries.Utilities.polyfillGlobal('Promise', () => Promise);\n}\n\n/**\n * Single source of truth for the Promise implementation we want to use.\n * This is important for verifying that the rejected promise tracing will work as expected.\n */\nexport function getPromisePolyfill(): unknown {\n /* eslint-disable import/no-extraneous-dependencies,@typescript-eslint/no-var-requires */\n // Below, we follow the exact way React Native initializes its promise library, and we globally replace it.\n return require('promise/setimmediate/es6-extensions');\n}\n\n/**\n * Lazy require the rejection tracking module\n */\nexport function requireRejectionTracking(): {\n disable: () => void;\n enable: (arg: unknown) => void;\n} {\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n return require('promise/setimmediate/rejection-tracking');\n}\n\n/**\n * Checks if the promise is the same one or not, if not it will warn the user\n */\nexport function checkPromiseAndWarn(): void {\n try {\n // `promise` package is a dependency of react-native, therefore it is always available.\n // but it is possible that the user has installed a different version of promise\n // or dependency that uses a different version.\n // We have to check if the React Native Promise and the `promise` package Promise are using the same reference.\n // If they are not, likely there are multiple versions of the `promise` package installed.\n const ReactNativePromise = ReactNativeLibraries.Promise;\n // eslint-disable-next-line @typescript-eslint/no-var-requires,import/no-extraneous-dependencies\n const PromisePackagePromise = require('promise/setimmediate/es6-extensions');\n const UsedPromisePolyfill = getPromisePolyfill();\n\n if (ReactNativePromise !== PromisePackagePromise) {\n debug.warn(\n 'You appear to have multiple versions of the \"promise\" package installed. ' +\n 'This may cause unexpected behavior like undefined `Promise.allSettled`. ' +\n 'Please install the `promise` package manually using the exact version as the React Native package. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n\n // This only make sense if the user disabled the integration Polyfill\n if (UsedPromisePolyfill !== RN_GLOBAL_OBJ.Promise) {\n debug.warn(\n 'Unhandled promise rejections will not be caught by Sentry. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n } else {\n debug.log('Unhandled promise rejections will be caught by Sentry.');\n }\n } catch (e) {\n // Do Nothing\n debug.warn(\n 'Unhandled promise rejections will not be caught by Sentry. ' +\n 'See https://docs.sentry.io/platforms/react-native/troubleshooting/ for more details.',\n );\n }\n}\n"]}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { debug } from '@sentry/core';
|
|
11
11
|
import { isExpoGo, notWeb } from '../utils/environment';
|
|
12
12
|
import { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../version';
|
|
13
13
|
import { NATIVE } from '../wrapper';
|
|
@@ -41,7 +41,7 @@ function processEvent(event, fetchNativeSdkInfo) {
|
|
|
41
41
|
event.sdk.name = event.sdk.name || defaultSdkInfo.name;
|
|
42
42
|
event.sdk.version = event.sdk.version || defaultSdkInfo.version;
|
|
43
43
|
event.sdk.packages = [
|
|
44
|
-
// default packages are added by
|
|
44
|
+
// default packages are added by js client and should not be added here
|
|
45
45
|
...(event.sdk.packages || []),
|
|
46
46
|
...((nativeSdkPackage && [nativeSdkPackage]) || []),
|
|
47
47
|
];
|
|
@@ -65,7 +65,7 @@ function createCachedFetchNativeSdkInfo() {
|
|
|
65
65
|
isCached = true;
|
|
66
66
|
}
|
|
67
67
|
catch (e) {
|
|
68
|
-
|
|
68
|
+
debug.warn('Could not fetch native sdk info.', e);
|
|
69
69
|
}
|
|
70
70
|
return nativeSdkPackageCache;
|
|
71
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkinfo.js","sourceRoot":"","sources":["../../../src/js/integrations/sdkinfo.ts"],"names":[],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AC,IAAI,CAAC;QACvD,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC;QAChE,KAAK,CAAC,GAAG,CAAC,QAAQ,GAAG;YACnB,uEAAuE;YACvE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;YAC7B,GAAG,CAAC,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAC;SACpD,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;CAAA;AAED,SAAS,8BAA8B;IACrC,IAAI,CAAC,MAAM,EAAE,IAAI,QAAQ,EAAE,EAAE;QAC3B,OAAO,GAAG,EAAE;YACV,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;KACH;IAED,IAAI,QAAQ,GAAY,KAAK,CAAC;IAC9B,IAAI,qBAAqB,GAAmB,IAAI,CAAC;IAEjD,OAAO,GAAS,EAAE;QAChB,IAAI,QAAQ,EAAE;YACZ,OAAO,qBAAqB,CAAC;SAC9B;QAED,IAAI;YACF,qBAAqB,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC1D,QAAQ,GAAG,IAAI,CAAC;SACjB;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC;SACnD;QAED,OAAO,qBAAqB,CAAC;IAC/B,CAAC,CAAA,CAAC;AACJ,CAAC","sourcesContent":["import type { Event, Integration, Package, SdkInfo as SdkInfoType } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { isExpoGo, notWeb } from '../utils/environment';\nimport { SDK_NAME, SDK_PACKAGE_NAME, SDK_VERSION } from '../version';\nimport { NATIVE } from '../wrapper';\n\nconst INTEGRATION_NAME = 'SdkInfo';\n\ntype DefaultSdkInfo = Pick<Required<SdkInfoType>, 'name' | 'packages' | 'version'>;\n\nexport const defaultSdkInfo: DefaultSdkInfo = {\n name: SDK_NAME,\n packages: [\n {\n name: SDK_PACKAGE_NAME,\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n};\n\n/** Default SdkInfo instrumentation */\nexport const sdkInfoIntegration = (): Integration => {\n const fetchNativeSdkInfo = createCachedFetchNativeSdkInfo();\n\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent: (event: Event) => processEvent(event, fetchNativeSdkInfo),\n };\n};\n\nasync function processEvent(event: Event, fetchNativeSdkInfo: () => Promise<Package | null>): Promise<Event> {\n const nativeSdkPackage = await fetchNativeSdkInfo();\n\n event.platform = event.platform || 'javascript';\n event.sdk = event.sdk || {};\n event.sdk.name = event.sdk.name || defaultSdkInfo.name;\n event.sdk.version = event.sdk.version || defaultSdkInfo.version;\n event.sdk.packages = [\n // default packages are added by js client and should not be added here\n ...(event.sdk.packages || []),\n ...((nativeSdkPackage && [nativeSdkPackage]) || []),\n ];\n\n return event;\n}\n\nfunction createCachedFetchNativeSdkInfo(): () => Promise<Package | null> {\n if (!notWeb() || isExpoGo()) {\n return () => {\n return Promise.resolve(null);\n };\n }\n\n let isCached: boolean = false;\n let nativeSdkPackageCache: Package | null = null;\n\n return async () => {\n if (isCached) {\n return nativeSdkPackageCache;\n }\n\n try {\n nativeSdkPackageCache = await NATIVE.fetchNativeSdkInfo();\n isCached = true;\n } catch (e) {\n debug.warn('Could not fetch native sdk info.', e);\n }\n\n return nativeSdkPackageCache;\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { debug, serializeEnvelope } from '@sentry/core';
|
|
2
2
|
import { ReactNativeLibraries } from '../utils/rnlibraries';
|
|
3
3
|
import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';
|
|
4
4
|
/**
|
|
@@ -7,7 +7,7 @@ import { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';
|
|
|
7
7
|
* Learn more about spotlight at https://spotlightjs.com
|
|
8
8
|
*/
|
|
9
9
|
export function spotlightIntegration({ sidecarUrl = getDefaultSidecarUrl(), } = {}) {
|
|
10
|
-
|
|
10
|
+
debug.log('[Spotlight] Using Sidecar URL', sidecarUrl);
|
|
11
11
|
return {
|
|
12
12
|
name: 'Spotlight',
|
|
13
13
|
setupOnce() {
|
|
@@ -32,7 +32,7 @@ function sendEnvelopesToSidecar(client, sidecarUrl) {
|
|
|
32
32
|
spotlightEnvelope[1] = envelopeItems;
|
|
33
33
|
const xhr = createStealthXhr();
|
|
34
34
|
if (!xhr) {
|
|
35
|
-
|
|
35
|
+
debug.error('[Spotlight] Sentry SDK can not create XHR object');
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
xhr.open('POST', sidecarUrl, true);
|
|
@@ -45,7 +45,7 @@ function sendEnvelopesToSidecar(client, sidecarUrl) {
|
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
// Handle the error
|
|
48
|
-
|
|
48
|
+
debug.error("[Spotlight] Sentry SDK can't connect to Spotlight is it running? See https://spotlightjs.com to download it.", new Error(xhr.statusText));
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotlight.js","sourceRoot":"","sources":["../../../src/js/integrations/spotlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"spotlight.js","sourceRoot":"","sources":["../../../src/js/integrations/spotlight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAYrE;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,UAAU,GAAG,oBAA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ent":["import type { BaseTransportOptions, Client, ClientOptions, Envelope, Integration } from '@sentry/core';\nimport { debug, serializeEnvelope } from '@sentry/core';\nimport { ReactNativeLibraries } from '../utils/rnlibraries';\nimport { createStealthXhr, XHR_READYSTATE_DONE } from '../utils/xhr';\n\ntype SpotlightReactNativeIntegrationOptions = {\n /**\n * The URL of the Sidecar instance to connect and forward events to.\n * If not set, Spotlight will try to connect to the Sidecar running on localhost:8969.\n *\n * @default \"http://localhost:8969/stream\"\n */\n sidecarUrl?: string;\n};\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport function spotlightIntegration({\n sidecarUrl = getDefaultSidecarUrl(),\n}: SpotlightReactNativeIntegrationOptions = {}): Integration {\n debug.log('[Spotlight] Using Sidecar URL', sidecarUrl);\n\n return {\n name: 'Spotlight',\n\n setupOnce(): void {\n // nothing to do here\n },\n\n setup(client: Client<ClientOptions<BaseTransportOptions>>): void {\n setup(client, sidecarUrl);\n },\n };\n}\n\nfunction setup(client: Client, sidecarUrl: string): void {\n sendEnvelopesToSidecar(client, sidecarUrl);\n}\n\nfunction sendEnvelopesToSidecar(client: Client, sidecarUrl: string): void {\n if (!client.on) {\n return;\n }\n\n client.on('beforeEnvelope', (originalEnvelope: Envelope) => {\n // TODO: This is a workaround for spotlight/sidecar not supporting images\n const spotlightEnvelope: Envelope = [...originalEnvelope];\n const envelopeItems = [...originalEnvelope[1]].filter(\n item => typeof item[0].content_type !== 'string' || !item[0].content_type.startsWith('image'),\n );\n\n spotlightEnvelope[1] = envelopeItems as Envelope[1];\n\n const xhr = createStealthXhr();\n if (!xhr) {\n debug.error('[Spotlight] Sentry SDK can not create XHR object');\n return;\n }\n\n xhr.open('POST', sidecarUrl, true);\n xhr.setRequestHeader('Content-Type', 'application/x-sentry-envelope');\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XHR_READYSTATE_DONE) {\n const status = xhr.status;\n if (status === 0 || (status >= 200 && status < 400)) {\n // The request has been completed successfully\n } else {\n // Handle the error\n debug.error(\n \"[Spotlight] Sentry SDK can't connect to Spotlight is it running? See https://spotlightjs.com to download it.\",\n new Error(xhr.statusText),\n );\n }\n }\n };\n\n xhr.send(serializeEnvelope(spotlightEnvelope));\n });\n}\n\nconst DEFAULT_SIDECAR_URL = 'http://localhost:8969/stream';\n\n/**\n * Gets the default Spotlight sidecar URL.\n */\nexport function getDefaultSidecarUrl(): string {\n try {\n const { url } = ReactNativeLibraries.Devtools?.getDevServer() ?? {};\n if (!url) {\n return DEFAULT_SIDECAR_URL;\n }\n\n return `http://${getHostnameFromString(url)}:8969/stream`;\n } catch (_oO) {\n // We can't load devserver URL\n }\n return DEFAULT_SIDECAR_URL;\n}\n\n/**\n * React Native implementation of the URL class is missing the `hostname` property.\n */\nfunction getHostnameFromString(urlString: string): string | null {\n const regex = /^(?:\\w+:)?\\/\\/([^/:]+)(:\\d+)?(.*)$/;\n const matches = urlString.match(regex);\n\n if (matches?.[1]) {\n return matches[1];\n } else {\n // Invalid URL format\n return null;\n }\n}\n"]}
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { debug } from '@sentry/core';
|
|
11
11
|
import { NATIVE } from '../wrapper';
|
|
12
12
|
const filename = 'view-hierarchy.json';
|
|
13
13
|
const contentType = 'application/json';
|
|
@@ -35,7 +35,7 @@ function processEvent(event, hint) {
|
|
|
35
35
|
viewHierarchy = yield NATIVE.fetchViewHierarchy();
|
|
36
36
|
}
|
|
37
37
|
catch (e) {
|
|
38
|
-
|
|
38
|
+
debug.error('Failed to get view hierarchy from native.', e);
|
|
39
39
|
}
|
|
40
40
|
if (viewHierarchy) {
|
|
41
41
|
hint.attachments = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewhierarchy.js","sourceRoot":"","sources":["../../../src/js/integrations/viewhierarchy.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"viewhierarchy.js","sourceRoot":"","sources":["../../../src/js/integrations/viewhierarchy.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,MAAM,QAAQ,GAAW,qBAAqB,CAAC;AAC/C,MAAM,WAAW,GAAW,kBAAkB,CAAC;AAC/C,MAAM,cAAc,GAAG,sBAAsD,CAAC;AAE9E,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC,yCAAyC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAgB,EAAE;IACxD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,GAAG,EAAE;YACd,OAAO;QACT,CAAC;QACD,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAEF,SAAe,YAAY,CAAC,KAAY,EAAE,IAAe;;;QACvD,MAAM,YAAY,GAAG,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM,KAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAClF,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;QAED,IAAI,aAAa,GAAsB,IAAI,CAAC;QAC5C,IAAI;YACF,aAAa,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;SACnD;QAAC,OAAO,CAAC,EAAE;YACV,KAAK,CAAC,KAAK,CAAC,2CAA2C,EAAE,CAAC,CAAC,CAAC;SAC7D;QAED,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,WAAW,GAAG;gBACjB;oBACE,QAAQ;oBACR,WAAW;oBACX,cAAc;oBACd,IAAI,EAAE,aAAa;iBACpB;gBACD,GAAG,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC;aAC7B,CAAC;SACH;QAED,OAAO,KAAK,CAAC;;CACd","sourcesContent":["import type { Attachment, Event, EventHint, Integration } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { NATIVE } from '../wrapper';\n\nconst filename: string = 'view-hierarchy.json';\nconst contentType: string = 'application/json';\nconst attachmentType = 'event.view_hierarchy' as Attachment['attachmentType'];\n\nconst INTEGRATION_NAME = 'ViewHierarchy';\n\n/** Adds ViewHierarchy to error events */\nexport const viewHierarchyIntegration = (): Integration => {\n return {\n name: INTEGRATION_NAME,\n setupOnce: () => {\n // noop\n },\n processEvent,\n };\n};\n\nasync function processEvent(event: Event, hint: EventHint): Promise<Event> {\n const hasException = event.exception?.values && event.exception.values.length > 0;\n if (!hasException) {\n return event;\n }\n\n let viewHierarchy: Uint8Array | null = null;\n try {\n viewHierarchy = await NATIVE.fetchViewHierarchy();\n } catch (e) {\n debug.error('Failed to get view hierarchy from native.', e);\n }\n\n if (viewHierarchy) {\n hint.attachments = [\n {\n filename,\n contentType,\n attachmentType,\n data: viewHierarchy,\n },\n ...(hint?.attachments || []),\n ];\n }\n\n return event;\n}\n"]}
|
package/dist/js/options.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { TouchEventBoundaryProps } from './touchevents';
|
|
|
6
6
|
type ProfilerProps = React.ComponentProps<typeof Profiler>;
|
|
7
7
|
type BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];
|
|
8
8
|
type BrowserExperiments = NonNullable<BrowserOptions['_experiments']>;
|
|
9
|
-
type SharedExperimentsSubset =
|
|
9
|
+
type SharedExperimentsSubset = BrowserExperiments;
|
|
10
10
|
export interface BaseReactNativeOptions {
|
|
11
11
|
/**
|
|
12
12
|
* Enables native transport + device info + offline caching.
|
package/dist/js/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceR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D,MAAM,WAAW,2BAA4B,SAAQ,uBAAuB;IAC1E;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AAEH,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,OAAO,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC,EAChE,sBAAsB;CAAG;AAE7B,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,aAAa,CAAC,2BAA2B,CAAC,EAAE,QAAQ,GAAG,cAAc,CAAC,EACjF,sBAAsB;CAAG;AAE7B,MAAM,WAAW,yBAAyB;IACxC,wCAAwC;IACxC,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;IAEzE,8CAA8C;IAC9C,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,CAiBtE"}
|
package/dist/js/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA+T/C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoB;IAC3D,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE;QACpC,yCAAyC;QACzC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,oEAAoE;QACpE,OAAO,KAAK,CAAC;KACd;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,yDAAyD;QACzD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { makeFetchTransport } from '@sentry/browser';\nimport type { CaptureContext, ClientOptions, Event, EventHint, Options } from '@sentry/core';\nimport type { BrowserOptions, Profiler } from '@sentry/react';\nimport type * as React from 'react';\nimport { Platform } from 'react-native';\nimport type { TouchEventBoundaryProps } from './touchevents';\nimport { isExpoGo } from './utils/environment';\n\ntype ProfilerProps = React.ComponentProps<typeof Profiler>;\ntype BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];\n\ntype BrowserExperiments = NonNullable<BrowserOptions['_experiments']>;\ntype SharedExperimentsSubset = Pick<BrowserExperiments, 'enableLogs' | 'beforeSendLog'>;\n\nexport interface BaseReactNativeOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable NDK on Android\n *\n * @default true\n */\n enableNdk?: boolean;\n\n /** Enable scope sync from Java to NDK on Android\n * Only has an effect if `enableNdk` is `true`.\n */\n enableNdkScopeSync?: boolean;\n\n /** When enabled, all the threads are automatically attached to all logged events on Android */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. Renamed from `enableAutoPerformanceTracking` in v5. */\n enableAutoPerformanceTracing?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * Renamed from `enableOutOfMemoryTracking` in v5.\n *\n * @default true\n */\n enableWatchdogTerminationTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n\n /**\n * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.\n * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.\n * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections\n *\n * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.\n *\n * @default true\n */\n patchGlobalPromise?: boolean;\n\n /**\n * The max cache items for capping the number of envelopes.\n *\n * @default 30\n */\n maxCacheItems?: number;\n\n /**\n * When enabled, the SDK tracks when the application stops responding for a specific amount of\n * time defined by the `appHangTimeoutInterval` option.\n *\n * iOS only\n *\n * @default true\n */\n enableAppHangTracking?: boolean;\n\n /**\n * The minimum amount of time an app should be unresponsive to be classified as an App Hanging.\n * The actual amount may be a little longer.\n * Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.\n * Value should be in seconds.\n *\n * iOS only\n *\n * @default 2\n */\n appHangTimeoutInterval?: number;\n\n /**\n * The max queue size for capping the number of envelopes waiting to be sent by Transport.\n */\n maxQueueSize?: number;\n\n /**\n * When enabled and a user experiences an error, Sentry provides the ability to take a screenshot and include it as an attachment.\n *\n * @default false\n */\n attachScreenshot?: boolean;\n\n /**\n * When enabled Sentry includes the current view hierarchy in the error attachments.\n *\n * @default false\n */\n attachViewHierarchy?: boolean;\n\n /**\n * When enabled, Sentry will capture failed XHR/Fetch requests. This option also enabled HTTP Errors on iOS.\n * [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/)\n * is needed to capture HTTP Errors on Android.\n *\n * @default false\n */\n enableCaptureFailedRequests?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n\n /**\n * Sets a callback which is executed before capturing screenshots. Only\n * relevant if `attachScreenshot` is set to true. When false is returned\n * from the function, no screenshot will be attached.\n */\n beforeScreenshot?: (event: Event, hint: EventHint) => boolean;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Requires performance monitoring to be enabled.\n *\n * @default true\n */\n enableAppStartTracking?: boolean;\n\n /**\n * Track the slow and frozen frames in the application. Enabling this options will add\n * slow and frozen frames measurements to all created root spans (transactions).\n *\n * @default true\n */\n enableNativeFramesTracking?: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n *\n * @default true\n */\n enableStallTracking?: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n *\n * @default false\n */\n enableUserInteractionTracing?: boolean;\n\n /**\n * The sample rate for profiling\n * 1.0 will profile all transactions and 0 will profile none.\n */\n profilesSampleRate?: number;\n\n /**\n * The sample rate for session-long replays.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * The sample rate for sessions that has had an error occur.\n * This is independent of `sessionSampleRate`.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause\n * problems for sending events from command line applications. Setting it too\n * high can cause the application to block for users with network connectivity\n * problems.\n */\n shutdownTimeout?: number;\n\n /**\n * Defines the quality of the session replay. The higher the quality, the more accurate the replay\n * will be, but also more data to transfer and more CPU load.\n *\n * @default 'medium'\n */\n replaysSessionQuality?: SentryReplayQuality;\n\n /**\n * Options which are in beta, or otherwise not guaranteed to be stable.\n */\n _experiments?: SharedExperimentsSubset & {\n [key: string]: unknown;\n\n /**\n * @deprecated Use `replaysSessionSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * @deprecated Use `replaysOnErrorSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Experiment: A more reliable way to report unhandled C++ exceptions in iOS.\n *\n * This approach hooks into all instances of the `__cxa_throw` function, which provides a more comprehensive and consistent exception handling across an app’s runtime, regardless of the number of C++ modules or how they’re linked. It helps in obtaining accurate stack traces.\n *\n * - Note: The mechanism of hooking into `__cxa_throw` could cause issues with symbolication on iOS due to caching of symbol references.\n *\n * @default false\n */\n enableUnhandledCPPExceptionsV2?: boolean;\n };\n\n /**\n * This options changes the placement of the attached stacktrace of `captureMessage` in the event.\n *\n * @default false\n * @deprecated This option will be removed in the next major version. Use `beforeSend` instead.\n */\n useThreadsForMessageStack?: boolean;\n}\n\nexport type SentryReplayQuality = 'low' | 'medium' | 'high';\n\nexport interface ReactNativeTransportOptions extends BrowserTransportOptions {\n /**\n * @deprecated use `maxQueueSize` in the root of the SDK options.\n */\n bufferSize?: number;\n}\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions\n extends Omit<Options<ReactNativeTransportOptions>, '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeClientOptions\n extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel' | '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: Omit<ProfilerProps, 'updateProps' | 'children' | 'name'>;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n\n/**\n * If the user has not explicitly set `enableNativeNagger`\n * the function enables native nagging based on the current\n * environment.\n */\nexport function shouldEnableNativeNagger(userOptions: unknown): boolean {\n if (typeof userOptions === 'boolean') {\n // User can override the default behavior\n return userOptions;\n }\n\n if (Platform.OS === 'web' || Platform.OS === 'windows') {\n // We don't want to nag on known platforms that don't support native\n return false;\n }\n\n if (isExpoGo()) {\n // If the app is running in Expo Go, we don't want to nag\n return false;\n }\n\n return true;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA+T/C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoB;IAC3D,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE;QACpC,yCAAyC;QACzC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,oEAAoE;QACpE,OAAO,KAAK,CAAC;KACd;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,yDAAyD;QACzD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { makeFetchTransport } from '@sentry/browser';\nimport type { CaptureContext, ClientOptions, Event, EventHint, Options } from '@sentry/core';\nimport type { BrowserOptions, Profiler } from '@sentry/react';\nimport type * as React from 'react';\nimport { Platform } from 'react-native';\nimport type { TouchEventBoundaryProps } from './touchevents';\nimport { isExpoGo } from './utils/environment';\n\ntype ProfilerProps = React.ComponentProps<typeof Profiler>;\ntype BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];\n\ntype BrowserExperiments = NonNullable<BrowserOptions['_experiments']>;\ntype SharedExperimentsSubset = BrowserExperiments;\n\nexport interface BaseReactNativeOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable NDK on Android\n *\n * @default true\n */\n enableNdk?: boolean;\n\n /** Enable scope sync from Java to NDK on Android\n * Only has an effect if `enableNdk` is `true`.\n */\n enableNdkScopeSync?: boolean;\n\n /** When enabled, all the threads are automatically attached to all logged events on Android */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. Renamed from `enableAutoPerformanceTracking` in v5. */\n enableAutoPerformanceTracing?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * Renamed from `enableOutOfMemoryTracking` in v5.\n *\n * @default true\n */\n enableWatchdogTerminationTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n\n /**\n * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.\n * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.\n * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections\n *\n * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.\n *\n * @default true\n */\n patchGlobalPromise?: boolean;\n\n /**\n * The max cache items for capping the number of envelopes.\n *\n * @default 30\n */\n maxCacheItems?: number;\n\n /**\n * When enabled, the SDK tracks when the application stops responding for a specific amount of\n * time defined by the `appHangTimeoutInterval` option.\n *\n * iOS only\n *\n * @default true\n */\n enableAppHangTracking?: boolean;\n\n /**\n * The minimum amount of time an app should be unresponsive to be classified as an App Hanging.\n * The actual amount may be a little longer.\n * Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.\n * Value should be in seconds.\n *\n * iOS only\n *\n * @default 2\n */\n appHangTimeoutInterval?: number;\n\n /**\n * The max queue size for capping the number of envelopes waiting to be sent by Transport.\n */\n maxQueueSize?: number;\n\n /**\n * When enabled and a user experiences an error, Sentry provides the ability to take a screenshot and include it as an attachment.\n *\n * @default false\n */\n attachScreenshot?: boolean;\n\n /**\n * When enabled Sentry includes the current view hierarchy in the error attachments.\n *\n * @default false\n */\n attachViewHierarchy?: boolean;\n\n /**\n * When enabled, Sentry will capture failed XHR/Fetch requests. This option also enabled HTTP Errors on iOS.\n * [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/)\n * is needed to capture HTTP Errors on Android.\n *\n * @default false\n */\n enableCaptureFailedRequests?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n\n /**\n * Sets a callback which is executed before capturing screenshots. Only\n * relevant if `attachScreenshot` is set to true. When false is returned\n * from the function, no screenshot will be attached.\n */\n beforeScreenshot?: (event: Event, hint: EventHint) => boolean;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Requires performance monitoring to be enabled.\n *\n * @default true\n */\n enableAppStartTracking?: boolean;\n\n /**\n * Track the slow and frozen frames in the application. Enabling this options will add\n * slow and frozen frames measurements to all created root spans (transactions).\n *\n * @default true\n */\n enableNativeFramesTracking?: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n *\n * @default true\n */\n enableStallTracking?: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n *\n * @default false\n */\n enableUserInteractionTracing?: boolean;\n\n /**\n * The sample rate for profiling\n * 1.0 will profile all transactions and 0 will profile none.\n */\n profilesSampleRate?: number;\n\n /**\n * The sample rate for session-long replays.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * The sample rate for sessions that has had an error occur.\n * This is independent of `sessionSampleRate`.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause\n * problems for sending events from command line applications. Setting it too\n * high can cause the application to block for users with network connectivity\n * problems.\n */\n shutdownTimeout?: number;\n\n /**\n * Defines the quality of the session replay. The higher the quality, the more accurate the replay\n * will be, but also more data to transfer and more CPU load.\n *\n * @default 'medium'\n */\n replaysSessionQuality?: SentryReplayQuality;\n\n /**\n * Options which are in beta, or otherwise not guaranteed to be stable.\n */\n _experiments?: SharedExperimentsSubset & {\n [key: string]: unknown;\n\n /**\n * @deprecated Use `replaysSessionSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * @deprecated Use `replaysOnErrorSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Experiment: A more reliable way to report unhandled C++ exceptions in iOS.\n *\n * This approach hooks into all instances of the `__cxa_throw` function, which provides a more comprehensive and consistent exception handling across an app’s runtime, regardless of the number of C++ modules or how they’re linked. It helps in obtaining accurate stack traces.\n *\n * - Note: The mechanism of hooking into `__cxa_throw` could cause issues with symbolication on iOS due to caching of symbol references.\n *\n * @default false\n */\n enableUnhandledCPPExceptionsV2?: boolean;\n };\n\n /**\n * This options changes the placement of the attached stacktrace of `captureMessage` in the event.\n *\n * @default false\n * @deprecated This option will be removed in the next major version. Use `beforeSend` instead.\n */\n useThreadsForMessageStack?: boolean;\n}\n\nexport type SentryReplayQuality = 'low' | 'medium' | 'high';\n\nexport interface ReactNativeTransportOptions extends BrowserTransportOptions {\n /**\n * @deprecated use `maxQueueSize` in the root of the SDK options.\n */\n bufferSize?: number;\n}\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions\n extends Omit<Options<ReactNativeTransportOptions>, '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeClientOptions\n extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel' | '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: Omit<ProfilerProps, 'updateProps' | 'children' | 'name'>;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n\n/**\n * If the user has not explicitly set `enableNativeNagger`\n * the function enables native nagging based on the current\n * environment.\n */\nexport function shouldEnableNativeNagger(userOptions: unknown): boolean {\n if (typeof userOptions === 'boolean') {\n // User can override the default behavior\n return userOptions;\n }\n\n if (Platform.OS === 'web' || Platform.OS === 'windows') {\n // We don't want to nag on known platforms that don't support native\n return false;\n }\n\n if (isExpoGo()) {\n // If the app is running in Expo Go, we don't want to nag\n return false;\n }\n\n return true;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
|
-
import {
|
|
2
|
+
import { debug } from '@sentry/core';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Animated, Image, Modal, Platform, Pressable, SafeAreaView, StyleSheet, Text, useColorScheme, View, } from 'react-native';
|
|
5
5
|
import { getDevServer } from '../integrations/debugsymbolicatorutils';
|
|
@@ -249,11 +249,11 @@ function openURLInBrowser(url) {
|
|
|
249
249
|
method: 'POST',
|
|
250
250
|
body: JSON.stringify({ url }),
|
|
251
251
|
}).catch(e => {
|
|
252
|
-
|
|
252
|
+
debug.error('Error opening URL:', e);
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
else {
|
|
256
|
-
|
|
256
|
+
debug.error('Dev server URL not available');
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
//# sourceMappingURL=modal.js.map
|