@sentry/react-native 5.22.0 → 5.23.0-alpha.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/CHANGELOG.md +37 -0
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +54 -1
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +10 -0
- package/dist/js/NativeRNSentry.d.ts +2 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +8 -0
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +19 -3
- package/dist/js/client.js.map +1 -1
- package/dist/js/index.d.ts +1 -0
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +11 -1
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/index.d.ts +1 -0
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +1 -0
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/integrations/mobilereplay.d.ts +36 -0
- package/dist/js/integrations/mobilereplay.d.ts.map +1 -0
- package/dist/js/integrations/mobilereplay.js +97 -0
- package/dist/js/integrations/mobilereplay.js.map +1 -0
- package/dist/js/options.d.ts +24 -2
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/utils/clientutils.d.ts +8 -0
- package/dist/js/utils/clientutils.d.ts.map +1 -0
- package/dist/js/utils/clientutils.js +7 -0
- package/dist/js/utils/clientutils.js.map +1 -0
- package/dist/js/utils/environment.d.ts +4 -0
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +8 -0
- package/dist/js/utils/environment.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 +7 -1
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +24 -0
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +47 -1
- package/package.json +4 -2
- package/src/js/NativeRNSentry.ts +2 -0
- package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
- package/ts3.8/dist/js/client.d.ts +8 -0
- package/ts3.8/dist/js/index.d.ts +1 -0
- package/ts3.8/dist/js/integrations/index.d.ts +1 -0
- package/ts3.8/dist/js/integrations/mobilereplay.d.ts +36 -0
- package/ts3.8/dist/js/options.d.ts +24 -2
- package/ts3.8/dist/js/utils/clientutils.d.ts +8 -0
- package/ts3.8/dist/js/utils/environment.d.ts +4 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +7 -1
package/ios/RNSentry.mm
CHANGED
|
@@ -113,7 +113,6 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
|
|
|
113
113
|
// Because we sent it already before the app crashed.
|
|
114
114
|
if (nil != event.exceptions.firstObject.type &&
|
|
115
115
|
[event.exceptions.firstObject.type rangeOfString:@"Unhandled JS Exception"].location != NSNotFound) {
|
|
116
|
-
NSLog(@"Unhandled JS Exception");
|
|
117
116
|
return nil;
|
|
118
117
|
}
|
|
119
118
|
|
|
@@ -132,6 +131,28 @@ RCT_EXPORT_METHOD(initNativeSdk:(NSDictionary *_Nonnull)options
|
|
|
132
131
|
[mutableOptions removeObjectForKey:@"tracesSampler"];
|
|
133
132
|
[mutableOptions removeObjectForKey:@"enableTracing"];
|
|
134
133
|
|
|
134
|
+
if ([mutableOptions valueForKey:@"_experiments"] != nil) {
|
|
135
|
+
NSDictionary *experiments = mutableOptions[@"_experiments"];
|
|
136
|
+
if (experiments[@"replaysSessionSampleRate"] != nil || experiments[@"replaysOnErrorSampleRate"] != nil) {
|
|
137
|
+
[mutableOptions setValue:@{
|
|
138
|
+
@"sessionReplay": @{
|
|
139
|
+
@"sessionSampleRate": experiments[@"replaysSessionSampleRate"] ?: [NSNull null],
|
|
140
|
+
@"errorSampleRate": experiments[@"replaysOnErrorSampleRate"] ?: [NSNull null],
|
|
141
|
+
@"redactAllImages": mutableOptions[@"mobileReplayOptions"] != nil &&
|
|
142
|
+
mutableOptions[@"mobileReplayOptions"][@"maskAllImages"] != nil
|
|
143
|
+
? mutableOptions[@"mobileReplayOptions"][@"maskAllImages"]
|
|
144
|
+
: [NSNull null],
|
|
145
|
+
@"redactAllText": mutableOptions[@"mobileReplayOptions"] != nil &&
|
|
146
|
+
mutableOptions[@"mobileReplayOptions"][@"maskAllText"] != nil
|
|
147
|
+
? mutableOptions[@"mobileReplayOptions"][@"maskAllText"]
|
|
148
|
+
: [NSNull null],
|
|
149
|
+
}
|
|
150
|
+
} forKey:@"experimental"];
|
|
151
|
+
[self addReplayRNRedactClasses: mutableOptions[@"mobileReplayOptions"]];
|
|
152
|
+
}
|
|
153
|
+
[mutableOptions removeObjectForKey:@"_experiments"];
|
|
154
|
+
}
|
|
155
|
+
|
|
135
156
|
SentryOptions *sentryOptions = [[SentryOptions alloc] initWithDict:mutableOptions didFailWithError:errorPointer];
|
|
136
157
|
if (*errorPointer != nil) {
|
|
137
158
|
return nil;
|
|
@@ -633,6 +654,31 @@ RCT_EXPORT_METHOD(enableNativeFramesTracking)
|
|
|
633
654
|
// the 'tracesSampleRate' or 'tracesSampler' option.
|
|
634
655
|
}
|
|
635
656
|
|
|
657
|
+
RCT_EXPORT_METHOD(startReplay: (BOOL)isHardCrash
|
|
658
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
659
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
660
|
+
{
|
|
661
|
+
[PrivateSentrySDKOnly captureReplay];
|
|
662
|
+
resolve([PrivateSentrySDKOnly getReplayId]);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getCurrentReplayId)
|
|
666
|
+
{
|
|
667
|
+
return [PrivateSentrySDKOnly getReplayId];
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
- (void) addReplayRNRedactClasses: (NSDictionary *_Nullable)replayOptions
|
|
671
|
+
{
|
|
672
|
+
NSMutableArray *_Nonnull classesToRedact = [[NSMutableArray alloc] init];
|
|
673
|
+
if ([replayOptions[@"maskAllImages"] boolValue] == YES) {
|
|
674
|
+
[classesToRedact addObject: NSClassFromString(@"RCTImageView")];
|
|
675
|
+
}
|
|
676
|
+
if ([replayOptions[@"maskAllText"] boolValue] == YES) {
|
|
677
|
+
[classesToRedact addObject: NSClassFromString(@"RCTTextView")];
|
|
678
|
+
}
|
|
679
|
+
[PrivateSentrySDKOnly addReplayRedactClasses: classesToRedact];
|
|
680
|
+
}
|
|
681
|
+
|
|
636
682
|
static NSString* const enabledProfilingMessage = @"Enable Hermes to use Sentry Profiling.";
|
|
637
683
|
static SentryId* nativeProfileTraceId = nil;
|
|
638
684
|
static uint64_t nativeProfileStartTime = 0;
|
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": "5.
|
|
5
|
+
"version": "5.23.0-alpha.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",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"test:watch": "jest --watch",
|
|
41
41
|
"run-ios": "cd samples/react-native && yarn react-native run-ios",
|
|
42
42
|
"run-android": "cd samples/react-native && yarn react-native run-android",
|
|
43
|
-
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/hub @sentry/integrations @sentry/react @sentry/types @sentry/utils"
|
|
43
|
+
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/hub @sentry/integrations @sentry/react @sentry/types @sentry/utils",
|
|
44
|
+
"set-version-samples": "bash scripts/set-version-samples.sh"
|
|
44
45
|
},
|
|
45
46
|
"bin": {
|
|
46
47
|
"sentry-expo-upload-sourcemaps": "scripts/expo-upload-sourcemaps.js"
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
"prettier": "^2.0.5",
|
|
107
108
|
"react": "18.2.0",
|
|
108
109
|
"react-native": "0.73.2",
|
|
110
|
+
"react-native-version": "^4.0.0",
|
|
109
111
|
"react-test-renderer": "^18.2.0",
|
|
110
112
|
"replace-in-file": "^7.0.1",
|
|
111
113
|
"rimraf": "^4.1.1",
|
package/src/js/NativeRNSentry.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface Spec extends TurboModule {
|
|
|
44
44
|
fetchNativePackageName(): string | undefined | null;
|
|
45
45
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
46
46
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
47
|
+
startReplay(isHardCrash: boolean): Promise<string | undefined | null>;
|
|
48
|
+
getCurrentReplayId(): string | undefined | null;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
export type NativeStackFrame = {
|
|
@@ -39,6 +39,8 @@ export interface Spec extends TurboModule {
|
|
|
39
39
|
fetchNativePackageName(): string | undefined | null;
|
|
40
40
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;
|
|
41
41
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
42
|
+
startReplay(isHardCrash: boolean): Promise<string | undefined | null>;
|
|
43
|
+
getCurrentReplayId(): string | undefined | null;
|
|
42
44
|
}
|
|
43
45
|
export type NativeStackFrame = {
|
|
44
46
|
platform: string;
|
|
@@ -39,6 +39,14 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
|
|
|
39
39
|
* Sets up the integrations
|
|
40
40
|
*/
|
|
41
41
|
setupIntegrations(): void;
|
|
42
|
+
/**
|
|
43
|
+
* @inheritDoc
|
|
44
|
+
*/
|
|
45
|
+
init(): void;
|
|
46
|
+
/**
|
|
47
|
+
* @inheritdoc
|
|
48
|
+
*/
|
|
49
|
+
protected _setupIntegrations(): void;
|
|
42
50
|
/**
|
|
43
51
|
* @inheritdoc
|
|
44
52
|
*/
|
package/ts3.8/dist/js/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent,
|
|
|
3
3
|
export { Integrations as BrowserIntegrations, ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
|
|
4
4
|
export { lastEventId } from '@sentry/browser';
|
|
5
5
|
import * as Integrations from './integrations';
|
|
6
|
+
export { mobileReplayIntegration } from './integrations';
|
|
6
7
|
import { SDK_NAME, SDK_VERSION } from './version';
|
|
7
8
|
export type { ReactNativeOptions } from './options';
|
|
8
9
|
export { ReactNativeClient } from './client';
|
|
@@ -8,4 +8,5 @@ export { ReactNativeInfo } from './reactnativeinfo';
|
|
|
8
8
|
export { ModulesLoader } from './modulesloader';
|
|
9
9
|
export { HermesProfiling } from '../profiling/integration';
|
|
10
10
|
export { Spotlight } from './spotlight';
|
|
11
|
+
export { mobileReplayIntegration } from './mobilereplay';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IntegrationFnResult } from '@sentry/types';
|
|
2
|
+
export declare const MOBILE_REPLAY_INTEGRATION_NAME = "MobileReplay";
|
|
3
|
+
export interface MobileReplayOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Mask all text in recordings
|
|
6
|
+
*/
|
|
7
|
+
maskAllText?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Mask all text in recordings
|
|
10
|
+
*/
|
|
11
|
+
maskAllImages?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type MobileReplayIntegration = IntegrationFnResult & {
|
|
14
|
+
options: Required<MobileReplayOptions>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The Mobile Replay Integration, let's you adjust the default mobile replay options.
|
|
18
|
+
* To be passed to `Sentry.init` with `replaysOnErrorSampleRate` or `replaysSessionSampleRate`.
|
|
19
|
+
*
|
|
20
|
+
* ```javascript
|
|
21
|
+
* Sentry.init({
|
|
22
|
+
* _experiments: {
|
|
23
|
+
* replaysOnErrorSampleRate: 1.0,
|
|
24
|
+
* replaysSessionSampleRate: 1.0,
|
|
25
|
+
* },
|
|
26
|
+
* integrations: [mobileReplayIntegration({
|
|
27
|
+
* // Adjust the default options
|
|
28
|
+
* })],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @experimental
|
|
33
|
+
*/
|
|
34
|
+
export declare const mobileReplayIntegration: (initOptions?: MobileReplayOptions) => MobileReplayIntegration;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=mobilereplay.d.ts.map
|
|
@@ -159,6 +159,28 @@ export interface BaseReactNativeOptions {
|
|
|
159
159
|
* from the function, no screenshot will be attached.
|
|
160
160
|
*/
|
|
161
161
|
beforeScreenshot?: (event: Event, hint: EventHint) => boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Options which are in beta, or otherwise not guaranteed to be stable.
|
|
164
|
+
*/
|
|
165
|
+
_experiments?: {
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
/**
|
|
168
|
+
* The sample rate for profiling
|
|
169
|
+
* 1.0 will profile all transactions and 0 will profile none.
|
|
170
|
+
*/
|
|
171
|
+
profilesSampleRate?: number;
|
|
172
|
+
/**
|
|
173
|
+
* The sample rate for session-long replays.
|
|
174
|
+
* 1.0 will record all sessions and 0 will record none.
|
|
175
|
+
*/
|
|
176
|
+
replaysSessionSampleRate?: number;
|
|
177
|
+
/**
|
|
178
|
+
* The sample rate for sessions that has had an error occur.
|
|
179
|
+
* This is independent of `sessionSampleRate`.
|
|
180
|
+
* 1.0 will record all sessions and 0 will record none.
|
|
181
|
+
*/
|
|
182
|
+
replaysOnErrorSampleRate?: number;
|
|
183
|
+
};
|
|
162
184
|
}
|
|
163
185
|
export interface ReactNativeTransportOptions extends BrowserTransportOptions {
|
|
164
186
|
/**
|
|
@@ -170,9 +192,9 @@ export interface ReactNativeTransportOptions extends BrowserTransportOptions {
|
|
|
170
192
|
* Configuration options for the Sentry ReactNative SDK.
|
|
171
193
|
* @see ReactNativeFrontend for more information.
|
|
172
194
|
*/
|
|
173
|
-
export interface ReactNativeOptions extends Options<ReactNativeTransportOptions>, BaseReactNativeOptions {
|
|
195
|
+
export interface ReactNativeOptions extends Omit<Options<ReactNativeTransportOptions>, '_experiments'>, BaseReactNativeOptions {
|
|
174
196
|
}
|
|
175
|
-
export interface ReactNativeClientOptions extends ClientOptions<ReactNativeTransportOptions>, BaseReactNativeOptions {
|
|
197
|
+
export interface ReactNativeClientOptions extends Omit<ClientOptions<ReactNativeTransportOptions>, '_experiments'>, BaseReactNativeOptions {
|
|
176
198
|
}
|
|
177
199
|
export interface ReactNativeWrapperOptions {
|
|
178
200
|
/** Props for the root React profiler */
|
|
@@ -16,6 +16,10 @@ export declare function getExpoGoVersion(): string | undefined;
|
|
|
16
16
|
export declare function getExpoSdkVersion(): string | undefined;
|
|
17
17
|
/** Checks if the current platform is not web */
|
|
18
18
|
export declare function notWeb(): boolean;
|
|
19
|
+
/** Checks if the current platform is supported mobile platform (iOS or Android) */
|
|
20
|
+
export declare function isMobileOs(): boolean;
|
|
21
|
+
/** Checks if the current platform is not supported mobile platform (iOS or Android) */
|
|
22
|
+
export declare function notMobileOs(): boolean;
|
|
19
23
|
/** Returns Hermes Version if hermes is present in the runtime */
|
|
20
24
|
export declare function getHermesVersion(): string | undefined;
|
|
21
25
|
/** Returns default environment based on __DEV__ */
|
|
@@ -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 = "5.
|
|
3
|
+
export declare const SDK_VERSION = "5.23.0-alpha.0";
|
|
4
4
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Breadcrumb, Envelope, EnvelopeItem, Event, Package, SeverityLevel, User } from '@sentry/types';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
|
+
import type { MobileReplayOptions } from './integrations/mobilereplay';
|
|
3
4
|
import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFramesResponse, NativeReleaseResponse, NativeStackFrames, Spec } from './NativeRNSentry';
|
|
4
5
|
import type { ReactNativeClientOptions } from './options';
|
|
5
6
|
import type * as Hermes from './profiling/hermes';
|
|
@@ -13,6 +14,9 @@ export interface Screenshot {
|
|
|
13
14
|
contentType: string;
|
|
14
15
|
filename: string;
|
|
15
16
|
}
|
|
17
|
+
export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
|
|
18
|
+
mobileReplayOptions: MobileReplayOptions | undefined;
|
|
19
|
+
};
|
|
16
20
|
interface SentryNativeWrapper {
|
|
17
21
|
enableNative: boolean;
|
|
18
22
|
nativeIsReady: boolean;
|
|
@@ -29,7 +33,7 @@ interface SentryNativeWrapper {
|
|
|
29
33
|
};
|
|
30
34
|
_isModuleLoaded(module: Spec | undefined): module is Spec;
|
|
31
35
|
isNativeAvailable(): boolean;
|
|
32
|
-
initNativeSdk(options:
|
|
36
|
+
initNativeSdk(options: NativeSdkOptions): PromiseLike<boolean>;
|
|
33
37
|
closeNativeSdk(): PromiseLike<void>;
|
|
34
38
|
sendEnvelope(envelope: Envelope): Promise<void>;
|
|
35
39
|
captureScreenshot(): Promise<Screenshot[] | null>;
|
|
@@ -63,6 +67,8 @@ interface SentryNativeWrapper {
|
|
|
63
67
|
*/
|
|
64
68
|
fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;
|
|
65
69
|
initNativeReactNavigationNewFrameTracking(): Promise<void>;
|
|
70
|
+
startReplay(isHardCrash: boolean): Promise<string | null>;
|
|
71
|
+
getCurrentReplayId(): string | null;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
68
74
|
* Our internal interface for calling native functions
|