@sentry/react-native 7.5.0 → 7.7.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.
Files changed (56) hide show
  1. package/README.md +2 -1
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/libs/replay-stubs.jar +0 -0
  5. package/android/replay-stubs/build.gradle +1 -1
  6. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +3 -0
  7. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  8. package/dist/js/client.d.ts.map +1 -1
  9. package/dist/js/client.js +9 -0
  10. package/dist/js/client.js.map +1 -1
  11. package/dist/js/integrations/default.js +1 -1
  12. package/dist/js/integrations/default.js.map +1 -1
  13. package/dist/js/options.d.ts +9 -0
  14. package/dist/js/options.d.ts.map +1 -1
  15. package/dist/js/options.js.map +1 -1
  16. package/dist/js/replay/mobilereplay.d.ts +12 -2
  17. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  18. package/dist/js/replay/mobilereplay.js +14 -1
  19. package/dist/js/replay/mobilereplay.js.map +1 -1
  20. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  21. package/dist/js/tools/sentryMetroSerializer.js +18 -10
  22. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  23. package/dist/js/tracing/onSpanEndUtils.d.ts +9 -0
  24. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  25. package/dist/js/tracing/onSpanEndUtils.js +52 -12
  26. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  27. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  28. package/dist/js/tracing/reactnativenavigation.js +4 -1
  29. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  30. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  31. package/dist/js/tracing/reactnavigation.js +10 -4
  32. package/dist/js/tracing/reactnavigation.js.map +1 -1
  33. package/dist/js/tracing/span.d.ts +18 -1
  34. package/dist/js/tracing/span.d.ts.map +1 -1
  35. package/dist/js/tracing/span.js +9 -2
  36. package/dist/js/tracing/span.js.map +1 -1
  37. package/dist/js/version.d.ts +1 -1
  38. package/dist/js/version.js +1 -1
  39. package/dist/js/version.js.map +1 -1
  40. package/dist/js/wrapper.d.ts.map +1 -1
  41. package/dist/js/wrapper.js +4 -2
  42. package/dist/js/wrapper.js.map +1 -1
  43. package/ios/RNSentry+fetchNativeStack.m +0 -8
  44. package/ios/RNSentry.h +1 -2
  45. package/ios/RNSentry.mm +58 -154
  46. package/ios/RNSentryVersion.m +1 -1
  47. package/ios/SentrySDKWrapper.h +16 -0
  48. package/ios/SentrySDKWrapper.m +135 -0
  49. package/package.json +11 -11
  50. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  51. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  52. package/ts3.8/dist/js/options.d.ts +9 -0
  53. package/ts3.8/dist/js/replay/mobilereplay.d.ts +12 -2
  54. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +9 -0
  55. package/ts3.8/dist/js/tracing/span.d.ts +18 -1
  56. package/ts3.8/dist/js/version.d.ts +1 -1
@@ -1,4 +1,6 @@
1
1
  #import "SentrySDKWrapper.h"
2
+ #import "RNSentryExperimentalOptions.h"
3
+ #import "RNSentryVersion.h"
2
4
  @import Sentry;
3
5
 
4
6
  @implementation SentrySDKWrapper
@@ -28,4 +30,137 @@
28
30
  [SentrySDK configureScope:callback];
29
31
  }
30
32
 
33
+ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
34
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
35
+ error:(NSError *__autoreleasing *)errorPointer
36
+ {
37
+ NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
38
+ SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:options
39
+ didFailWithError:errorPointer];
40
+ if (*errorPointer != nil) {
41
+ return nil;
42
+ }
43
+
44
+ // Exclude Dev Server and Sentry Dsn request from Breadcrumbs
45
+ NSString *devServerUrl = [options valueForKey:@"devServerUrl"];
46
+ sentryOptions.beforeBreadcrumb
47
+ = ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb)
48
+ {
49
+ NSString *url = breadcrumb.data[@"url"] ?: @"";
50
+
51
+ if ([@"http" isEqualToString:breadcrumb.type]
52
+ && ((dsn != nil && [url hasPrefix:dsn])
53
+ || (devServerUrl != nil && [url hasPrefix:devServerUrl]))) {
54
+ return nil;
55
+ }
56
+ return breadcrumb;
57
+ };
58
+
59
+ if ([options valueForKey:@"enableNativeCrashHandling"] != nil) {
60
+ BOOL enableNativeCrashHandling = [options[@"enableNativeCrashHandling"] boolValue];
61
+
62
+ if (!enableNativeCrashHandling) {
63
+ sentryOptions.enableCrashHandler = NO;
64
+ }
65
+ }
66
+
67
+ // Set spotlight option
68
+ if ([options valueForKey:@"spotlight"] != nil) {
69
+ id spotlightValue = [options valueForKey:@"spotlight"];
70
+ if ([spotlightValue isKindOfClass:[NSString class]]) {
71
+ NSLog(@"Using Spotlight on address: %@", spotlightValue);
72
+ sentryOptions.enableSpotlight = true;
73
+ sentryOptions.spotlightUrl = spotlightValue;
74
+ } else if ([spotlightValue isKindOfClass:[NSNumber class]]) {
75
+ sentryOptions.enableSpotlight = [spotlightValue boolValue];
76
+ id defaultSpotlightUrl = [options valueForKey:@"defaultSidecarUrl"];
77
+ if (defaultSpotlightUrl != nil) {
78
+ sentryOptions.spotlightUrl = defaultSpotlightUrl;
79
+ }
80
+ }
81
+ }
82
+
83
+ if ([options valueForKey:@"enableLogs"] != nil) {
84
+ id enableLogsValue = [options valueForKey:@"enableLogs"];
85
+ if ([enableLogsValue isKindOfClass:[NSNumber class]]) {
86
+ [RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue]
87
+ sentryOptions:sentryOptions];
88
+ }
89
+ }
90
+
91
+ // Enable the App start and Frames tracking measurements
92
+ if ([options valueForKey:@"enableAutoPerformanceTracing"] != nil) {
93
+ BOOL enableAutoPerformanceTracing = [options[@"enableAutoPerformanceTracing"] boolValue];
94
+ PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing;
95
+ #if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
96
+ PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing;
97
+ #endif
98
+ }
99
+
100
+ // Failed requests can only be enabled in one SDK to avoid duplicates
101
+ sentryOptions.enableCaptureFailedRequests = NO;
102
+
103
+ NSDictionary *experiments = options[@"_experiments"];
104
+ if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
105
+ BOOL enableUnhandledCPPExceptions =
106
+ [experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
107
+ [RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
108
+ sentryOptions:sentryOptions];
109
+ }
110
+
111
+ if (isSessionReplayEnabled) {
112
+ [RNSentryExperimentalOptions setEnableSessionReplayInUnreliableEnvironment:YES
113
+ sentryOptions:sentryOptions];
114
+ }
115
+ return sentryOptions;
116
+ }
117
+
118
+ + (NSString *_Nullable)getURLFromDSN:(NSString *)dsn
119
+ {
120
+ NSURL *url = [NSURL URLWithString:dsn];
121
+ if (!url) {
122
+ return nil;
123
+ }
124
+ return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host];
125
+ }
126
+
127
+ + (void)setupWithDictionary:(NSDictionary *_Nonnull)options
128
+ isSessionReplayEnabled:(BOOL)isSessionReplayEnabled
129
+ error:(NSError *_Nonnull *_Nonnull)errorPointer
130
+ {
131
+ SentryOptions *sentryOptions = [self createOptionsWithDictionary:options
132
+ isSessionReplayEnabled:isSessionReplayEnabled
133
+ error:errorPointer];
134
+ if (!options) {
135
+ return;
136
+ }
137
+
138
+ NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
139
+ [PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
140
+ [PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
141
+ version:REACT_NATIVE_SDK_PACKAGE_VERSION];
142
+
143
+ [SentrySDKWrapper startWithOptions:sentryOptions];
144
+ }
145
+
146
+ + (BOOL)debug
147
+ {
148
+ return PrivateSentrySDKOnly.options.debug;
149
+ }
150
+
151
+ + (NSString *)releaseName
152
+ {
153
+ return PrivateSentrySDKOnly.options.releaseName;
154
+ }
155
+
156
+ + (BOOL)enableAutoSessionTracking
157
+ {
158
+ return PrivateSentrySDKOnly.options.enableAutoSessionTracking;
159
+ }
160
+
161
+ + (BOOL)enableWatchdogTerminationTracking
162
+ {
163
+ return PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking;
164
+ }
165
+
31
166
  @end
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "7.5.0",
5
+ "version": "7.7.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -68,22 +68,22 @@
68
68
  "react-native": ">=0.65.0"
69
69
  },
70
70
  "dependencies": {
71
- "@sentry/babel-plugin-component-annotate": "4.6.0",
72
- "@sentry/browser": "10.22.0",
73
- "@sentry/cli": "2.57.0",
74
- "@sentry/core": "10.22.0",
75
- "@sentry/react": "10.22.0",
76
- "@sentry/types": "10.22.0"
71
+ "@sentry/babel-plugin-component-annotate": "4.6.1",
72
+ "@sentry/browser": "10.26.0",
73
+ "@sentry/cli": "2.58.2",
74
+ "@sentry/core": "10.26.0",
75
+ "@sentry/react": "10.26.0",
76
+ "@sentry/types": "10.26.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@babel/core": "^7.26.7",
80
80
  "@expo/metro-config": "~0.20.0",
81
81
  "@mswjs/interceptors": "^0.25.15",
82
82
  "@react-native/babel-preset": "0.80.0",
83
- "@sentry-internal/eslint-config-sdk": "10.22.0",
84
- "@sentry-internal/eslint-plugin-sdk": "10.22.0",
85
- "@sentry-internal/typescript": "10.22.0",
86
- "@sentry/wizard": "6.6.0",
83
+ "@sentry-internal/eslint-config-sdk": "10.26.0",
84
+ "@sentry-internal/eslint-plugin-sdk": "10.26.0",
85
+ "@sentry-internal/typescript": "10.26.0",
86
+ "@sentry/wizard": "6.7.0",
87
87
  "@testing-library/react-native": "^13.2.2",
88
88
  "@types/jest": "^29.5.13",
89
89
  "@types/node": "^20.9.3",
@@ -9,7 +9,7 @@ export interface SentryAndroidGradlePluginOptions {
9
9
  includeNativeSources?: boolean;
10
10
  includeSourceContext?: boolean;
11
11
  }
12
- export declare const sentryAndroidGradlePluginVersion = "5.12.1";
12
+ export declare const sentryAndroidGradlePluginVersion = "5.12.2";
13
13
  /**
14
14
  * Adds the Sentry Android Gradle Plugin to the project.
15
15
  * https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withSentryAndroidGradlePlugin = exports.sentryAndroidGradlePluginVersion = void 0;
4
4
  const config_plugins_1 = require("@expo/config-plugins");
5
5
  const utils_1 = require("./utils");
6
- exports.sentryAndroidGradlePluginVersion = '5.12.1';
6
+ exports.sentryAndroidGradlePluginVersion = '5.12.2';
7
7
  /**
8
8
  * Adds the Sentry Android Gradle Plugin to the project.
9
9
  * https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#enable-sentry-agp
@@ -273,6 +273,15 @@ export interface BaseReactNativeOptions {
273
273
  * @default false
274
274
  */
275
275
  propagateTraceparent?: boolean;
276
+ /**
277
+ * Controls which log origin is captured when `enableLogs` is set to true.
278
+ * 'all' will log all origins.
279
+ * 'js' will capture only JavaScript logs.
280
+ * 'native' will capture only native logs.
281
+ *
282
+ * @default 'all'
283
+ */
284
+ logsOrigin?: 'all' | 'js' | 'native';
276
285
  }
277
286
  export type SentryReplayQuality = 'low' | 'medium' | 'high';
278
287
  export interface ReactNativeTransportOptions extends BrowserTransportOptions {
@@ -1,4 +1,4 @@
1
- import type { Integration } from '@sentry/core';
1
+ import type { Event, EventHint, Integration } from '@sentry/core';
2
2
  export declare const MOBILE_REPLAY_INTEGRATION_NAME = "MobileReplay";
3
3
  /**
4
4
  * Screenshot strategy type for Android Session Replay.
@@ -78,9 +78,19 @@ export interface MobileReplayOptions {
78
78
  * @platform android
79
79
  */
80
80
  screenshotStrategy?: ScreenshotStrategy;
81
+ /**
82
+ * Callback to determine if a replay should be captured for a specific error.
83
+ * When this callback returns `false`, no replay will be captured for the error.
84
+ * This callback is only called when an error occurs and `replaysOnErrorSampleRate` is set.
85
+ *
86
+ * @param event The error event
87
+ * @param hint Additional event information
88
+ * @returns `false` to skip capturing a replay for this error, `true` or `undefined` to proceed with sampling
89
+ */
90
+ beforeErrorSampling?: (event: Event, hint: EventHint) => boolean;
81
91
  }
82
92
  type MobileReplayIntegration = Integration & {
83
- options: Required<MobileReplayOptions>;
93
+ options: MobileReplayOptions;
84
94
  getReplayId: () => string | null;
85
95
  };
86
96
  /**
@@ -5,6 +5,15 @@ import type { Client, Span } from '@sentry/core';
5
5
  export declare function onThisSpanEnd(client: Client, span: Span, callback: (span: Span) => void): void;
6
6
  export declare const adjustTransactionDuration: (client: Client, span: Span, maxDurationMs: number) => void;
7
7
  export declare const ignoreEmptyBackNavigation: (client: Client | undefined, span: Span | undefined) => void;
8
+ /**
9
+ * Discards empty "Route Change" transactions that never received route information.
10
+ * This happens when navigation library emits a route change event but getCurrentRoute() returns undefined.
11
+ * Such transactions don't contain any useful information and should not be sent to Sentry.
12
+ *
13
+ * This function must be called with a reference tracker function that can check if the span
14
+ * was cleared from the integration's tracking (indicating it went through the state listener).
15
+ */
16
+ export declare const ignoreEmptyRouteChangeTransactions: (client: Client | undefined, span: Span | undefined, defaultNavigationSpanName: string, isSpanStillTracked: () => boolean) => void;
8
17
  /**
9
18
  * Idle Transaction callback to only sample transactions with child spans.
10
19
  * To avoid side effects of other callbacks this should be hooked as the last callback.
@@ -16,7 +16,24 @@ export declare const defaultIdleOptions: {
16
16
  */
17
17
  idleTimeout: number;
18
18
  };
19
- export declare const startIdleNavigationSpan: (startSpanOption: StartSpanOptions, { finalTimeout, idleTimeout, }?: Partial<typeof defaultIdleOptions>) => Span | undefined;
19
+ export declare const startIdleNavigationSpan: (startSpanOption: StartSpanOptions, { finalTimeout, idleTimeout, isAppRestart, }?: Partial<{
20
+ /**
21
+ * The time that has to pass without any span being created.
22
+ * If this time is exceeded, the idle span will finish.
23
+ *
24
+ * @default 1_000 (ms)
25
+ */
26
+ finalTimeout: number;
27
+ /**
28
+ * The max. time an idle span may run.
29
+ * If this time is exceeded, the idle span will finish no matter what.
30
+ *
31
+ * @default 60_0000 (ms)
32
+ */
33
+ idleTimeout: number;
34
+ }> & {
35
+ isAppRestart?: boolean | undefined;
36
+ }) => Span | undefined;
20
37
  /**
21
38
  * Starts an idle span from `@sentry/core` with React Native application
22
39
  * context awareness.
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "7.5.0";
3
+ export declare const SDK_VERSION = "7.7.0";
4
4
  //# sourceMappingURL=version.d.ts.map