@sentry/react-native 5.25.0 → 5.26.0-alpha.3
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 +107 -3
- package/RNSentry.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +63 -2
- package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +187 -0
- 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 +4 -0
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +12 -2
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +9 -1
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +2 -1
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +2 -1
- package/dist/js/integrations/exports.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/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/replay/mobilereplay.d.ts +47 -0
- package/dist/js/replay/mobilereplay.d.ts.map +1 -0
- package/dist/js/replay/mobilereplay.js +100 -0
- package/dist/js/replay/mobilereplay.js.map +1 -0
- package/dist/js/replay/networkUtils.d.ts +8 -0
- package/dist/js/replay/networkUtils.d.ts.map +1 -0
- package/dist/js/replay/networkUtils.js +52 -0
- package/dist/js/replay/networkUtils.js.map +1 -0
- package/dist/js/replay/xhrUtils.d.ts +6 -0
- package/dist/js/replay/xhrUtils.d.ts.map +1 -0
- package/dist/js/replay/xhrUtils.js +31 -0
- package/dist/js/replay/xhrUtils.js.map +1 -0
- package/dist/js/tools/enableLogger.d.ts +5 -0
- package/dist/js/tools/enableLogger.d.ts.map +1 -0
- package/dist/js/tools/enableLogger.js +13 -0
- package/dist/js/tools/enableLogger.js.map +1 -0
- package/dist/js/tools/metroconfig.d.ts +19 -4
- package/dist/js/tools/metroconfig.d.ts.map +1 -1
- package/dist/js/tools/metroconfig.js +38 -3
- package/dist/js/tools/metroconfig.js.map +1 -1
- package/dist/js/tools/sentryBabelTransformer.d.ts +4 -0
- package/dist/js/tools/sentryBabelTransformer.d.ts.map +1 -0
- package/dist/js/tools/sentryBabelTransformer.js +28 -0
- package/dist/js/tools/sentryBabelTransformer.js.map +1 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts +18 -0
- package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -0
- package/dist/js/tools/sentryBabelTransformerUtils.js +67 -0
- package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts +35 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.d.ts.map +1 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.js +3 -0
- package/dist/js/tools/vendor/metro/metroBabelTransformer.js.map +1 -0
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +57 -30
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/utils/clientutils.d.ts +10 -0
- package/dist/js/utils/clientutils.d.ts.map +1 -0
- package/dist/js/utils/clientutils.js +9 -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/utils/worldwide.d.ts +6 -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 +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 +33 -1
- package/ios/RNSentryReplay.h +8 -0
- package/ios/RNSentryReplay.m +72 -0
- package/ios/RNSentryReplayBreadcrumbConverter.h +16 -0
- package/ios/RNSentryReplayBreadcrumbConverter.m +168 -0
- package/package.json +2 -1
- 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 +4 -0
- package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
- package/ts3.8/dist/js/integrations/index.d.ts +1 -0
- package/ts3.8/dist/js/options.d.ts +24 -2
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +47 -0
- package/ts3.8/dist/js/replay/networkUtils.d.ts +8 -0
- package/ts3.8/dist/js/replay/xhrUtils.d.ts +6 -0
- package/ts3.8/dist/js/utils/clientutils.d.ts +10 -0
- package/ts3.8/dist/js/utils/environment.d.ts +4 -0
- package/ts3.8/dist/js/utils/worldwide.d.ts +6 -0
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.26.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Redact `react-native-svg` SVGs when `maskAllVectors` ([#3930](https://github.com/getsentry/sentry-react-native/pull/3930))
|
|
8
|
+
- Add `annotateReactComponents` option to `@sentry/react-native/metro` ([#3916](https://github.com/getsentry/sentry-react-native/pull/3916))
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// For Expo
|
|
12
|
+
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
|
|
13
|
+
const config = getSentryExpoConfig(__dirname, { annotateReactComponents: true });
|
|
14
|
+
|
|
15
|
+
// For RN
|
|
16
|
+
const { getDefaultConfig } = require('@react-native/metro-config');
|
|
17
|
+
const { withSentryConfig } = require('@sentry/react-native/metro');
|
|
18
|
+
module.exports = withSentryConfig(getDefaultConfig(__dirname), { annotateReactComponents: true });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Fixes
|
|
22
|
+
|
|
23
|
+
- Add `app.foreground/background` breadcrumbs to iOS Replays ([#3932](https://github.com/getsentry/sentry-react-native/pull/3932))
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
- Bump Android SDK from v7.11.0-alpha.2 to v7.12.0-alpha.4 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
|
|
28
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.12.0-alpha.3/CHANGELOG.md#7120-alpha4)
|
|
29
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/7.11.0-alpha.2...7.12.0-alpha.4)
|
|
30
|
+
- Bump Cocoa SDK from v8.30.0 to v8.30.1 ([#3936](https://github.com/getsentry/sentry-react-native/pull/3936))
|
|
31
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8301)
|
|
32
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.30.0...8.30.1)
|
|
33
|
+
|
|
3
34
|
## 5.25.0
|
|
4
35
|
|
|
5
36
|
### Features
|
|
@@ -23,6 +54,30 @@
|
|
|
23
54
|
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7110)
|
|
24
55
|
- [diff](https://github.com/getsentry/sentry-java/compare/7.10.0...7.11.0)
|
|
25
56
|
|
|
57
|
+
## 5.25.0-alpha.2
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
- Improve touch event component info if annotated with [`@sentry/babel-plugin-component-annotate`](https://www.npmjs.com/package/@sentry/babel-plugin-component-annotate) ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899))
|
|
62
|
+
- Add replay breadcrumbs for touch & navigation events ([#3846](https://github.com/getsentry/sentry-react-native/pull/3846))
|
|
63
|
+
- Add network data to Session Replays ([#3912](https://github.com/getsentry/sentry-react-native/pull/3912))
|
|
64
|
+
- Filter Sentry Event Breadcrumbs from Mobile Replays ([#3925](https://github.com/getsentry/sentry-react-native/pull/3925))
|
|
65
|
+
|
|
66
|
+
### Fixes
|
|
67
|
+
|
|
68
|
+
- `sentry-expo-upload-sourcemaps` no longer requires Sentry url when uploading sourcemaps to `sentry.io` ([#3915](https://github.com/getsentry/sentry-react-native/pull/3915))
|
|
69
|
+
|
|
70
|
+
### Dependencies
|
|
71
|
+
|
|
72
|
+
- Bump Cocoa SDK from v8.25.0-alpha.0 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
|
|
73
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8300)
|
|
74
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.25.0-alpha.0...8.30.0)
|
|
75
|
+
- Bump Android SDK from v7.9.0-alpha.1 to v7.11.0-alpha.2 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
|
|
76
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.11.0-alpha.2/CHANGELOG.md#7110-alpha2)
|
|
77
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/7.9.0-alpha.1...7.11.0-alpha.2)
|
|
78
|
+
|
|
79
|
+
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
|
|
80
|
+
|
|
26
81
|
## 5.24.1
|
|
27
82
|
|
|
28
83
|
### Fixes
|
|
@@ -122,6 +177,14 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
|
|
|
122
177
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8270)
|
|
123
178
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.26.0...8.27.0)
|
|
124
179
|
|
|
180
|
+
## 5.23.0-alpha.1
|
|
181
|
+
|
|
182
|
+
### Fixes
|
|
183
|
+
|
|
184
|
+
- Pass `replaysSessionSampleRate` option to Android ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
|
|
185
|
+
|
|
186
|
+
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
|
|
187
|
+
|
|
125
188
|
## 5.22.3
|
|
126
189
|
|
|
127
190
|
### Fixes
|
|
@@ -155,6 +218,47 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
|
|
|
155
218
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8250)
|
|
156
219
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.24.0...8.25.0)
|
|
157
220
|
|
|
221
|
+
## 5.23.0-alpha.0
|
|
222
|
+
|
|
223
|
+
### Features
|
|
224
|
+
|
|
225
|
+
- Mobile Session Replay Alpha ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
|
|
226
|
+
|
|
227
|
+
To enable Replay for React Native on mobile and web add the following options.
|
|
228
|
+
|
|
229
|
+
```js
|
|
230
|
+
Sentry.init({
|
|
231
|
+
_experiments: {
|
|
232
|
+
replaysSessionSampleRate: 1.0,
|
|
233
|
+
replaysOnErrorSampleRate: 1.0,
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
To change the default Mobile Replay options add the `mobileReplayIntegration`.
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
Sentry.init({
|
|
242
|
+
_experiments: {
|
|
243
|
+
replaysSessionSampleRate: 1.0,
|
|
244
|
+
replaysOnErrorSampleRate: 1.0,
|
|
245
|
+
},
|
|
246
|
+
integration: [
|
|
247
|
+
Sentry.mobileReplayIntegration({
|
|
248
|
+
maskAllText: true,
|
|
249
|
+
maskAllImages: true,
|
|
250
|
+
}),
|
|
251
|
+
],
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Access is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
|
|
256
|
+
|
|
257
|
+
### Dependencies
|
|
258
|
+
|
|
259
|
+
- Bump Cocoa SDK to [8.25.0-alpha.0](https://github.com/getsentry/sentry-cocoa/releases/tag/8.25.0-alpha.0)
|
|
260
|
+
- Bump Android SDK to [7.9.0-alpha.1](https://github.com/getsentry/sentry-java/releases/tag/7.9.0-alpha.1)
|
|
261
|
+
|
|
158
262
|
## 5.22.0
|
|
159
263
|
|
|
160
264
|
### Features
|
|
@@ -433,7 +537,7 @@ see [the Expo guide](https://docs.sentry.io/platforms/react-native/manual-setup/
|
|
|
433
537
|
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
|
|
434
538
|
|
|
435
539
|
// const config = getDefaultConfig(__dirname);
|
|
436
|
-
const config = getSentryExpoConfig(
|
|
540
|
+
const config = getSentryExpoConfig(__dirname);
|
|
437
541
|
```
|
|
438
542
|
|
|
439
543
|
- New `npx sentry-expo-upload-sourcemaps` for simple EAS Update (`npx expo export`) source maps upload ([#3491](https://github.com/getsentry/sentry-react-native/pull/3491), [#3510](https://github.com/getsentry/sentry-react-native/pull/3510), [#3515](https://github.com/getsentry/sentry-react-native/pull/3515), [#3507](https://github.com/getsentry/sentry-react-native/pull/3507))
|
|
@@ -665,7 +769,7 @@ This release is compatible with `expo@50.0.0-preview.6` and newer.
|
|
|
665
769
|
});
|
|
666
770
|
```
|
|
667
771
|
|
|
668
|
-
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
|
|
772
|
+
Read more at <https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690>
|
|
669
773
|
|
|
670
774
|
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
|
|
671
775
|
|
|
@@ -2704,7 +2808,7 @@ We are looking into ways making this more stable and plan to re-enable it again
|
|
|
2704
2808
|
|
|
2705
2809
|
## v0.23.2
|
|
2706
2810
|
|
|
2707
|
-
- Fixed #228 again
|
|
2811
|
+
- Fixed #228 again ¯\\*(ツ)*/¯
|
|
2708
2812
|
|
|
2709
2813
|
## v0.23.1
|
|
2710
2814
|
|
package/RNSentry.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -41,9 +41,11 @@ import java.io.IOException;
|
|
|
41
41
|
import java.io.InputStream;
|
|
42
42
|
import java.nio.charset.Charset;
|
|
43
43
|
import java.util.HashMap;
|
|
44
|
+
import java.util.HashSet;
|
|
44
45
|
import java.util.List;
|
|
45
46
|
import java.util.Map;
|
|
46
47
|
import java.util.Properties;
|
|
48
|
+
import java.util.Set;
|
|
47
49
|
import java.util.concurrent.CountDownLatch;
|
|
48
50
|
|
|
49
51
|
import io.sentry.Breadcrumb;
|
|
@@ -61,6 +63,7 @@ import io.sentry.SentryEvent;
|
|
|
61
63
|
import io.sentry.SentryExecutorService;
|
|
62
64
|
import io.sentry.SentryLevel;
|
|
63
65
|
import io.sentry.SentryOptions;
|
|
66
|
+
import io.sentry.SentryReplayOptions;
|
|
64
67
|
import io.sentry.UncaughtExceptionHandlerIntegration;
|
|
65
68
|
import io.sentry.android.core.AndroidLogger;
|
|
66
69
|
import io.sentry.android.core.AndroidProfiler;
|
|
@@ -79,6 +82,7 @@ import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
|
|
|
79
82
|
import io.sentry.android.core.performance.AppStartMetrics;
|
|
80
83
|
import io.sentry.protocol.SdkVersion;
|
|
81
84
|
import io.sentry.protocol.SentryException;
|
|
85
|
+
import io.sentry.protocol.SentryId;
|
|
82
86
|
import io.sentry.protocol.SentryPackage;
|
|
83
87
|
import io.sentry.protocol.User;
|
|
84
88
|
import io.sentry.protocol.ViewHierarchy;
|
|
@@ -186,7 +190,7 @@ public class RNSentryModuleImpl {
|
|
|
186
190
|
|
|
187
191
|
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
|
|
188
192
|
options.setNativeSdkName(NATIVE_SDK_NAME);
|
|
189
|
-
|
|
193
|
+
options.setSdkVersion(sdkVersion);
|
|
190
194
|
|
|
191
195
|
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
|
|
192
196
|
options.setDebug(true);
|
|
@@ -252,7 +256,10 @@ public class RNSentryModuleImpl {
|
|
|
252
256
|
if (rnOptions.hasKey("enableNdk")) {
|
|
253
257
|
options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
|
|
254
258
|
}
|
|
255
|
-
|
|
259
|
+
if (rnOptions.hasKey("_experiments")) {
|
|
260
|
+
options.getExperimental().setSessionReplay(getReplayOptions(rnOptions));
|
|
261
|
+
options.getReplayController().setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
|
|
262
|
+
}
|
|
256
263
|
options.setBeforeSend((event, hint) -> {
|
|
257
264
|
// React native internally throws a JavascriptException
|
|
258
265
|
// Since we catch it before that, we don't want to send this one
|
|
@@ -293,6 +300,42 @@ public class RNSentryModuleImpl {
|
|
|
293
300
|
promise.resolve(true);
|
|
294
301
|
}
|
|
295
302
|
|
|
303
|
+
private SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptions) {
|
|
304
|
+
@NotNull final SentryReplayOptions androidReplayOptions = new SentryReplayOptions();
|
|
305
|
+
|
|
306
|
+
@Nullable final ReadableMap rnExperimentsOptions = rnOptions.getMap("_experiments");
|
|
307
|
+
if (rnExperimentsOptions == null) {
|
|
308
|
+
return androidReplayOptions;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (!(rnExperimentsOptions.hasKey("replaysSessionSampleRate") || rnExperimentsOptions.hasKey("replaysOnErrorSampleRate"))) {
|
|
312
|
+
return androidReplayOptions;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
androidReplayOptions.setSessionSampleRate(rnExperimentsOptions.hasKey("replaysSessionSampleRate")
|
|
316
|
+
? rnExperimentsOptions.getDouble("replaysSessionSampleRate") : null);
|
|
317
|
+
androidReplayOptions.setErrorSampleRate(rnExperimentsOptions.hasKey("replaysOnErrorSampleRate")
|
|
318
|
+
? rnExperimentsOptions.getDouble("replaysOnErrorSampleRate") : null);
|
|
319
|
+
|
|
320
|
+
if (!rnOptions.hasKey("mobileReplayOptions")) {
|
|
321
|
+
return androidReplayOptions;
|
|
322
|
+
}
|
|
323
|
+
@Nullable final ReadableMap rnMobileReplayOptions = rnOptions.getMap("mobileReplayOptions");
|
|
324
|
+
if (rnMobileReplayOptions == null) {
|
|
325
|
+
return androidReplayOptions;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
androidReplayOptions.setRedactAllText(!rnMobileReplayOptions.hasKey("maskAllText") || rnMobileReplayOptions.getBoolean("maskAllText"));
|
|
329
|
+
androidReplayOptions.setRedactAllImages(!rnMobileReplayOptions.hasKey("maskAllImages") || rnMobileReplayOptions.getBoolean("maskAllImages"));
|
|
330
|
+
|
|
331
|
+
final boolean redactVectors = !rnMobileReplayOptions.hasKey("maskAllVectors") || rnMobileReplayOptions.getBoolean("maskAllVectors");
|
|
332
|
+
if (redactVectors) {
|
|
333
|
+
androidReplayOptions.addClassToRedact("com.horcrux.svg.SvgView"); // react-native-svg
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return androidReplayOptions;
|
|
337
|
+
}
|
|
338
|
+
|
|
296
339
|
public void crash() {
|
|
297
340
|
throw new RuntimeException("TEST - Sentry Client Crash (only works in release mode)");
|
|
298
341
|
}
|
|
@@ -394,6 +437,24 @@ public class RNSentryModuleImpl {
|
|
|
394
437
|
}
|
|
395
438
|
}
|
|
396
439
|
|
|
440
|
+
public void captureReplay(boolean isHardCrash, Promise promise) {
|
|
441
|
+
Sentry.getCurrentHub().getOptions().getReplayController().sendReplay(isHardCrash, null, null);
|
|
442
|
+
promise.resolve(getCurrentReplayId());
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
public @Nullable String getCurrentReplayId() {
|
|
446
|
+
final @Nullable IScope scope = InternalSentrySdk.getCurrentScope();
|
|
447
|
+
if (scope == null) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
final @NotNull SentryId id = scope.getReplayId();
|
|
452
|
+
if (id == SentryId.EMPTY_ID) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
return id.toString();
|
|
456
|
+
}
|
|
457
|
+
|
|
397
458
|
public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
|
|
398
459
|
byte[] bytes = Base64.decode(rawBytes, Base64.DEFAULT);
|
|
399
460
|
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
package io.sentry.react;
|
|
2
|
+
|
|
3
|
+
import io.sentry.Breadcrumb;
|
|
4
|
+
import io.sentry.android.replay.DefaultReplayBreadcrumbConverter;
|
|
5
|
+
import io.sentry.rrweb.RRWebEvent;
|
|
6
|
+
import io.sentry.rrweb.RRWebBreadcrumbEvent;
|
|
7
|
+
import io.sentry.rrweb.RRWebSpanEvent;
|
|
8
|
+
|
|
9
|
+
import java.util.HashMap;
|
|
10
|
+
import org.jetbrains.annotations.NotNull;
|
|
11
|
+
import org.jetbrains.annotations.Nullable;
|
|
12
|
+
import org.jetbrains.annotations.TestOnly;
|
|
13
|
+
|
|
14
|
+
import java.util.List;
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
public final class RNSentryReplayBreadcrumbConverter extends DefaultReplayBreadcrumbConverter {
|
|
18
|
+
public RNSentryReplayBreadcrumbConverter() {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public @Nullable RRWebEvent convert(final @NotNull Breadcrumb breadcrumb) {
|
|
23
|
+
if (breadcrumb.getCategory() == null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Do not add Sentry Event breadcrumbs to replay
|
|
28
|
+
if (breadcrumb.getCategory().equals("sentry.event") ||
|
|
29
|
+
breadcrumb.getCategory().equals("sentry.transaction")) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (breadcrumb.getCategory().equals("http")) {
|
|
33
|
+
// Drop native http breadcrumbs to avoid duplicates
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (breadcrumb.getCategory().equals("touch")) {
|
|
38
|
+
return convertTouchBreadcrumb(breadcrumb);
|
|
39
|
+
}
|
|
40
|
+
if (breadcrumb.getCategory().equals("navigation")) {
|
|
41
|
+
return convertNavigationBreadcrumb(breadcrumb);
|
|
42
|
+
}
|
|
43
|
+
if (breadcrumb.getCategory().equals("xhr")) {
|
|
44
|
+
return convertNetworkBreadcrumb(breadcrumb);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
RRWebEvent nativeBreadcrumb = super.convert(breadcrumb);
|
|
48
|
+
|
|
49
|
+
// ignore native navigation breadcrumbs
|
|
50
|
+
if (nativeBreadcrumb instanceof RRWebBreadcrumbEvent) {
|
|
51
|
+
final RRWebBreadcrumbEvent rrWebBreadcrumb = (RRWebBreadcrumbEvent) nativeBreadcrumb;
|
|
52
|
+
if (rrWebBreadcrumb.getCategory() != null && rrWebBreadcrumb.getCategory().equals("navigation")) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return nativeBreadcrumb;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@TestOnly
|
|
61
|
+
public @NotNull RRWebEvent convertNavigationBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
62
|
+
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
63
|
+
rrWebBreadcrumb.setCategory(breadcrumb.getCategory());
|
|
64
|
+
setRRWebEventDefaultsFrom(rrWebBreadcrumb, breadcrumb);
|
|
65
|
+
return rrWebBreadcrumb;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@TestOnly
|
|
69
|
+
public @NotNull RRWebEvent convertTouchBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
70
|
+
final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
|
|
71
|
+
|
|
72
|
+
rrWebBreadcrumb.setCategory("ui.tap");
|
|
73
|
+
|
|
74
|
+
rrWebBreadcrumb.setMessage(RNSentryReplayBreadcrumbConverter
|
|
75
|
+
.getTouchPathMessage(breadcrumb.getData("path")));
|
|
76
|
+
|
|
77
|
+
setRRWebEventDefaultsFrom(rrWebBreadcrumb, breadcrumb);
|
|
78
|
+
return rrWebBreadcrumb;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@TestOnly
|
|
82
|
+
public static @Nullable String getTouchPathMessage(final @Nullable Object maybePath) {
|
|
83
|
+
if (!(maybePath instanceof List)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
final @NotNull List path = (List) maybePath;
|
|
88
|
+
if (path.size() == 0) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
final @NotNull StringBuilder message = new StringBuilder();
|
|
93
|
+
for (int i = Math.min(3, path.size() - 1); i >= 0; i--) {
|
|
94
|
+
final @Nullable Object maybeItem = path.get(i);
|
|
95
|
+
if (!(maybeItem instanceof Map)) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
final @NotNull Map item = (Map) maybeItem;
|
|
100
|
+
final @Nullable Object maybeName = item.get("name");
|
|
101
|
+
final @Nullable Object maybeLabel = item.get("label");
|
|
102
|
+
boolean hasName = maybeName instanceof String;
|
|
103
|
+
boolean hasLabel = maybeLabel instanceof String;
|
|
104
|
+
if (!hasName && !hasLabel) {
|
|
105
|
+
return null; // This again should never be allowed in JS, but to be safe we check it here
|
|
106
|
+
}
|
|
107
|
+
if (hasLabel) {
|
|
108
|
+
message.append(maybeLabel);
|
|
109
|
+
} else { // hasName is true
|
|
110
|
+
message.append(maybeName);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
final @Nullable Object maybeElement = item.get("element");
|
|
114
|
+
final @Nullable Object maybeFile = item.get("file");
|
|
115
|
+
boolean hasElement = maybeElement instanceof String;
|
|
116
|
+
boolean hasFile = maybeFile instanceof String;
|
|
117
|
+
if (hasElement && hasFile) {
|
|
118
|
+
message.append('(')
|
|
119
|
+
.append(maybeElement)
|
|
120
|
+
.append(", ")
|
|
121
|
+
.append(maybeFile)
|
|
122
|
+
.append(')');
|
|
123
|
+
} else if (hasElement) {
|
|
124
|
+
message.append('(')
|
|
125
|
+
.append(maybeElement)
|
|
126
|
+
.append(')');
|
|
127
|
+
} else if (hasFile) {
|
|
128
|
+
message.append('(')
|
|
129
|
+
.append(maybeFile)
|
|
130
|
+
.append(')');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (i > 0) {
|
|
134
|
+
message.append(" > ");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return message.toString();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@TestOnly
|
|
142
|
+
public @Nullable RRWebEvent convertNetworkBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
|
|
143
|
+
final Double startTimestamp = breadcrumb.getData("start_timestamp") instanceof Number
|
|
144
|
+
? (Double) breadcrumb.getData("start_timestamp") : null;
|
|
145
|
+
final Double endTimestamp = breadcrumb.getData("end_timestamp") instanceof Number
|
|
146
|
+
? (Double) breadcrumb.getData("end_timestamp") : null;
|
|
147
|
+
final String url = breadcrumb.getData("url") instanceof String
|
|
148
|
+
? (String) breadcrumb.getData("url") : null;
|
|
149
|
+
|
|
150
|
+
if (startTimestamp == null || endTimestamp == null || url == null) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
final HashMap<String, Object> data = new HashMap<>();
|
|
155
|
+
if (breadcrumb.getData("method") instanceof String) {
|
|
156
|
+
data.put("method", breadcrumb.getData("method"));
|
|
157
|
+
}
|
|
158
|
+
if (breadcrumb.getData("status_code") instanceof Double) {
|
|
159
|
+
final Double statusCode = (Double) breadcrumb.getData("status_code");
|
|
160
|
+
if (statusCode > 0) {
|
|
161
|
+
data.put("statusCode", statusCode.intValue());
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (breadcrumb.getData("request_body_size") instanceof Double) {
|
|
165
|
+
data.put("requestBodySize", breadcrumb.getData("request_body_size"));
|
|
166
|
+
}
|
|
167
|
+
if (breadcrumb.getData("response_body_size") instanceof Double) {
|
|
168
|
+
data.put("responseBodySize", breadcrumb.getData("response_body_size"));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
final RRWebSpanEvent rrWebSpanEvent = new RRWebSpanEvent();
|
|
172
|
+
rrWebSpanEvent.setOp("resource.http");
|
|
173
|
+
rrWebSpanEvent.setStartTimestamp(startTimestamp / 1000.0);
|
|
174
|
+
rrWebSpanEvent.setEndTimestamp(endTimestamp / 1000.0);
|
|
175
|
+
rrWebSpanEvent.setDescription(url);
|
|
176
|
+
rrWebSpanEvent.setData(data);
|
|
177
|
+
return rrWebSpanEvent;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private void setRRWebEventDefaultsFrom(final @NotNull RRWebBreadcrumbEvent rrWebBreadcrumb, final @NotNull Breadcrumb breadcrumb) {
|
|
181
|
+
rrWebBreadcrumb.setLevel(breadcrumb.getLevel());
|
|
182
|
+
rrWebBreadcrumb.setData(breadcrumb.getData());
|
|
183
|
+
rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime());
|
|
184
|
+
rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0);
|
|
185
|
+
rrWebBreadcrumb.setBreadcrumbType("default");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -158,4 +158,14 @@ public class RNSentryModule extends NativeRNSentrySpec {
|
|
|
158
158
|
// Not used on Android
|
|
159
159
|
return null;
|
|
160
160
|
}
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
public void captureReplay(boolean isHardCrash, Promise promise) {
|
|
164
|
+
this.impl.captureReplay(isHardCrash, promise);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@Override
|
|
168
|
+
public String getCurrentReplayId() {
|
|
169
|
+
return this.impl.getCurrentReplayId();
|
|
170
|
+
}
|
|
161
171
|
}
|
|
@@ -158,4 +158,14 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
158
158
|
// Not used on Android
|
|
159
159
|
return null;
|
|
160
160
|
}
|
|
161
|
+
|
|
162
|
+
@ReactMethod
|
|
163
|
+
public void captureReplay(boolean isHardCrash, Promise promise) {
|
|
164
|
+
this.impl.captureReplay(isHardCrash, promise);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
168
|
+
public String getCurrentReplayId() {
|
|
169
|
+
return this.impl.getCurrentReplayId();
|
|
170
|
+
}
|
|
161
171
|
}
|
|
@@ -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
|
+
captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;
|
|
43
|
+
getCurrentReplayId(): string | undefined | null;
|
|
42
44
|
}
|
|
43
45
|
export type NativeStackFrame = {
|
|
44
46
|
platform: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AA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E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;;AAGF,wBAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"NativeRNSentry.js","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAwJnD,2DAA2D;AAC3D,eAAe,mBAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC","sourcesContent":["import type { Package } from '@sentry/types';\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nimport type { UnsafeObject } from './utils/rnlibrariesinterface';\n\n// There has to be only one interface and it has to be named `Spec`\n// Only extra allowed definitions are types (probably codegen bug)\nexport interface Spec extends TurboModule {\n addListener: (eventType: string) => void;\n removeListeners: (id: number) => void;\n addBreadcrumb(breadcrumb: UnsafeObject): void;\n captureEnvelope(\n bytes: string,\n options: {\n hardCrashed: boolean;\n },\n ): Promise<boolean>;\n captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;\n clearBreadcrumbs(): void;\n crash(): void;\n closeNativeSdk(): Promise<void>;\n disableNativeFramesTracking(): void;\n fetchNativeRelease(): Promise<NativeReleaseResponse>;\n fetchNativeSdkInfo(): Promise<Package | null>;\n fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): Promise<NativeAppStartResponse | null>;\n fetchNativeFrames(): Promise<NativeFramesResponse | null>;\n initNativeSdk(options: UnsafeObject): Promise<boolean>;\n setUser(defaultUserKeys: UnsafeObject | null, otherUserKeys: UnsafeObject | null): void;\n setContext(key: string, value: UnsafeObject | null): void;\n setExtra(key: string, value: string): void;\n setTag(key: string, value: string): void;\n enableNativeFramesTracking(): void;\n fetchModules(): Promise<string | undefined | null>;\n fetchViewHierarchy(): Promise<number[] | undefined | null>;\n startProfiling(): { started?: boolean; error?: string };\n stopProfiling(): {\n profile?: string;\n nativeProfile?: UnsafeObject;\n androidProfile?: UnsafeObject;\n error?: string;\n };\n fetchNativePackageName(): string | undefined | null;\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | undefined | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n captureReplay(isHardCrash: boolean): Promise<string | undefined | null>;\n getCurrentReplayId(): string | undefined | null;\n}\n\nexport type NativeStackFrame = {\n platform: string;\n /**\n * The instruction address of this frame.\n * Formatted as hex with 0x prefix.\n */\n instruction_addr: string;\n package?: string;\n /**\n * The debug image address of this frame.\n * Formatted as hex with 0x prefix.\n */\n image_addr?: string;\n in_app?: boolean;\n /**\n * The symbol name of this frame.\n * If symbolicated locally.\n */\n function?: string;\n /**\n * The symbol address of this frame.\n * If symbolicated locally.\n * Formatted as hex with 0x prefix.\n */\n symbol_addr?: string;\n};\n\nexport type NativeDebugImage = {\n name?: string;\n type?: string;\n uuid?: string;\n debug_id?: string;\n image_addr?: string;\n image_size?: number;\n code_file?: string;\n image_vmaddr?: string;\n};\n\nexport type NativeStackFrames = {\n frames: NativeStackFrame[];\n debugMetaImages?: NativeDebugImage[];\n};\n\nexport type NativeAppStartResponse = {\n type: 'cold' | 'warm' | 'unknown';\n has_fetched: boolean;\n app_start_timestamp_ms?: number;\n spans: {\n description: string;\n start_timestamp_ms: number;\n end_timestamp_ms: number;\n }[];\n};\n\nexport type NativeFramesResponse = {\n totalFrames: number;\n slowFrames: number;\n frozenFrames: number;\n};\n\nexport type NativeReleaseResponse = {\n build: string;\n id: string;\n version: string;\n};\n\n/**\n * This type describes serialized scope from sentry-cocoa and sentry-android\n * https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/SentryScope.m\n * https://github.com/getsentry/sentry-java/blob/a461f7e125b65240004e6162b341f383ce2e1394/sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java#L32\n */\nexport type NativeDeviceContextsResponse = {\n [key: string]: unknown;\n tags?: Record<string, string>;\n extra?: Record<string, unknown>;\n contexts?: Record<string, Record<string, unknown>>;\n user?: {\n userId?: string;\n email?: string;\n username?: string;\n ipAddress?: string;\n segment?: string;\n data?: Record<string, unknown>;\n };\n dist?: string;\n environment?: string;\n fingerprint?: string[];\n level?: string;\n breadcrumbs?: {\n level?: string;\n timestamp?: string;\n category?: string;\n type?: string;\n message?: string;\n data?: Record<string, unknown>;\n }[];\n};\n\nexport type NativeScreenshot = {\n data: number[];\n contentType: string;\n filename: string;\n};\n\n// The export must be here to pass codegen even if not used\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNSentry');\n"]}
|
package/dist/js/client.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export declare class ReactNativeClient extends BaseClient<ReactNativeClientOptio
|
|
|
35
35
|
* Sends user feedback to Sentry.
|
|
36
36
|
*/
|
|
37
37
|
captureUserFeedback(feedback: UserFeedback): void;
|
|
38
|
+
/**
|
|
39
|
+
* @inheritDoc
|
|
40
|
+
*/
|
|
41
|
+
init(): void;
|
|
38
42
|
/**
|
|
39
43
|
* Sets up the integrations
|
|
40
44
|
*/
|
package/dist/js/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,aAAa,EAEb,YAAY,EACb,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAGT,aAAa,EAEb,YAAY,EACb,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAS1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACzE,OAAO,CAAC,eAAe,CAAY;IAEnC;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IASpD;;OAEG;IACI,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,GAAE,SAAc,GAAG,WAAW,CAAC,KAAK,CAAC;IAIvF;;OAEG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC;IAmBrG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;OAEG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IASxD;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;OAEG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAapC;;OAEG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IA+BjD;;OAEG;IACH,OAAO,CAAC,cAAc;IA0BtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -4,6 +4,7 @@ import { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';
|
|
|
4
4
|
import { Alert } from 'react-native';
|
|
5
5
|
import { createIntegration } from './integrations/factory';
|
|
6
6
|
import { defaultSdkInfo } from './integrations/sdkinfo';
|
|
7
|
+
import { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';
|
|
7
8
|
import { ReactNativeTracing } from './tracing';
|
|
8
9
|
import { createUserFeedbackEnvelope, items } from './utils/envelope';
|
|
9
10
|
import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';
|
|
@@ -26,7 +27,6 @@ export class ReactNativeClient extends BaseClient {
|
|
|
26
27
|
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
|
|
27
28
|
super(options);
|
|
28
29
|
this._outcomesBuffer = [];
|
|
29
|
-
this._initNativeSdk();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @inheritDoc
|
|
@@ -79,6 +79,13 @@ export class ReactNativeClient extends BaseClient {
|
|
|
79
79
|
});
|
|
80
80
|
this._sendEnvelope(envelope);
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* @inheritDoc
|
|
84
|
+
*/
|
|
85
|
+
init() {
|
|
86
|
+
super.init();
|
|
87
|
+
this._initNativeSdk();
|
|
88
|
+
}
|
|
82
89
|
/**
|
|
83
90
|
* Sets up the integrations
|
|
84
91
|
*/
|
|
@@ -130,7 +137,10 @@ export class ReactNativeClient extends BaseClient {
|
|
|
130
137
|
* Starts native client with dsn and options
|
|
131
138
|
*/
|
|
132
139
|
_initNativeSdk() {
|
|
133
|
-
NATIVE.initNativeSdk(this._options)
|
|
140
|
+
NATIVE.initNativeSdk(Object.assign(Object.assign({}, this._options), { mobileReplayOptions: this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&
|
|
141
|
+
'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
|
|
142
|
+
? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options
|
|
143
|
+
: undefined }))
|
|
134
144
|
.then((result) => {
|
|
135
145
|
return result;
|
|
136
146
|
}, () => {
|