@sentry/react-native 5.24.0 → 5.25.0-alpha.2

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 (88) hide show
  1. package/CHANGELOG.md +88 -2
  2. package/RNSentry.podspec +1 -1
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +56 -7
  5. package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +178 -0
  6. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  7. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +10 -0
  8. package/dist/js/NativeRNSentry.d.ts +2 -0
  9. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  10. package/dist/js/NativeRNSentry.js.map +1 -1
  11. package/dist/js/client.d.ts +4 -0
  12. package/dist/js/client.d.ts.map +1 -1
  13. package/dist/js/client.js +12 -2
  14. package/dist/js/client.js.map +1 -1
  15. package/dist/js/integrations/default.d.ts.map +1 -1
  16. package/dist/js/integrations/default.js +9 -1
  17. package/dist/js/integrations/default.js.map +1 -1
  18. package/dist/js/integrations/exports.d.ts +2 -1
  19. package/dist/js/integrations/exports.d.ts.map +1 -1
  20. package/dist/js/integrations/exports.js +2 -1
  21. package/dist/js/integrations/exports.js.map +1 -1
  22. package/dist/js/integrations/index.d.ts +1 -0
  23. package/dist/js/integrations/index.d.ts.map +1 -1
  24. package/dist/js/integrations/index.js +1 -0
  25. package/dist/js/integrations/index.js.map +1 -1
  26. package/dist/js/options.d.ts +24 -2
  27. package/dist/js/options.d.ts.map +1 -1
  28. package/dist/js/options.js.map +1 -1
  29. package/dist/js/replay/mobilereplay.d.ts +36 -0
  30. package/dist/js/replay/mobilereplay.d.ts.map +1 -0
  31. package/dist/js/replay/mobilereplay.js +99 -0
  32. package/dist/js/replay/mobilereplay.js.map +1 -0
  33. package/dist/js/replay/networkUtils.d.ts +8 -0
  34. package/dist/js/replay/networkUtils.d.ts.map +1 -0
  35. package/dist/js/replay/networkUtils.js +52 -0
  36. package/dist/js/replay/networkUtils.js.map +1 -0
  37. package/dist/js/replay/xhrUtils.d.ts +6 -0
  38. package/dist/js/replay/xhrUtils.d.ts.map +1 -0
  39. package/dist/js/replay/xhrUtils.js +31 -0
  40. package/dist/js/replay/xhrUtils.js.map +1 -0
  41. package/dist/js/touchevents.d.ts +4 -0
  42. package/dist/js/touchevents.d.ts.map +1 -1
  43. package/dist/js/touchevents.js +93 -53
  44. package/dist/js/touchevents.js.map +1 -1
  45. package/dist/js/tracing/nativeframes.d.ts.map +1 -1
  46. package/dist/js/tracing/nativeframes.js +6 -0
  47. package/dist/js/tracing/nativeframes.js.map +1 -1
  48. package/dist/js/utils/clientutils.d.ts +10 -0
  49. package/dist/js/utils/clientutils.d.ts.map +1 -0
  50. package/dist/js/utils/clientutils.js +9 -0
  51. package/dist/js/utils/clientutils.js.map +1 -0
  52. package/dist/js/utils/environment.d.ts +4 -0
  53. package/dist/js/utils/environment.d.ts.map +1 -1
  54. package/dist/js/utils/environment.js +8 -0
  55. package/dist/js/utils/environment.js.map +1 -1
  56. package/dist/js/utils/worldwide.d.ts +6 -0
  57. package/dist/js/utils/worldwide.d.ts.map +1 -1
  58. package/dist/js/utils/worldwide.js.map +1 -1
  59. package/dist/js/version.d.ts +1 -1
  60. package/dist/js/version.d.ts.map +1 -1
  61. package/dist/js/version.js +1 -1
  62. package/dist/js/version.js.map +1 -1
  63. package/dist/js/wrapper.d.ts +7 -1
  64. package/dist/js/wrapper.d.ts.map +1 -1
  65. package/dist/js/wrapper.js +24 -0
  66. package/dist/js/wrapper.js.map +1 -1
  67. package/ios/RNSentry.mm +33 -7
  68. package/ios/RNSentryReplay.h +8 -0
  69. package/ios/RNSentryReplay.m +60 -0
  70. package/ios/RNSentryReplayBreadcrumbConverter.h +16 -0
  71. package/ios/RNSentryReplayBreadcrumbConverter.m +172 -0
  72. package/package.json +1 -1
  73. package/scripts/expo-upload-sourcemaps.js +10 -10
  74. package/src/js/NativeRNSentry.ts +2 -0
  75. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  76. package/ts3.8/dist/js/client.d.ts +4 -0
  77. package/ts3.8/dist/js/integrations/exports.d.ts +2 -1
  78. package/ts3.8/dist/js/integrations/index.d.ts +1 -0
  79. package/ts3.8/dist/js/options.d.ts +24 -2
  80. package/ts3.8/dist/js/replay/mobilereplay.d.ts +36 -0
  81. package/ts3.8/dist/js/replay/networkUtils.d.ts +8 -0
  82. package/ts3.8/dist/js/replay/xhrUtils.d.ts +6 -0
  83. package/ts3.8/dist/js/touchevents.d.ts +4 -0
  84. package/ts3.8/dist/js/utils/clientutils.d.ts +10 -0
  85. package/ts3.8/dist/js/utils/environment.d.ts +4 -0
  86. package/ts3.8/dist/js/utils/worldwide.d.ts +6 -0
  87. package/ts3.8/dist/js/version.d.ts +1 -1
  88. package/ts3.8/dist/js/wrapper.d.ts +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.25.0-alpha.2
4
+
5
+ ### Features
6
+
7
+ - 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))
8
+ - Add replay breadcrumbs for touch & navigation events ([#3846](https://github.com/getsentry/sentry-react-native/pull/3846))
9
+ - Add network data to Session Replays ([#3912](https://github.com/getsentry/sentry-react-native/pull/3912))
10
+ - Filter Sentry Event Breadcrumbs from Mobile Replays ([#3925](https://github.com/getsentry/sentry-react-native/pull/3925))
11
+
12
+ ### Fixes
13
+
14
+ - `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))
15
+
16
+ ### Dependencies
17
+
18
+ - Bump Cocoa SDK from v8.25.0-alpha.0 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
19
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8300)
20
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.25.0-alpha.0...8.30.0)
21
+ - 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))
22
+ - [changelog](https://github.com/getsentry/sentry-java/blob/7.11.0-alpha.2/CHANGELOG.md#7110-alpha2)
23
+ - [diff](https://github.com/getsentry/sentry-java/compare/7.9.0-alpha.1...7.11.0-alpha.2)
24
+
25
+ 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/)
26
+
27
+ ## 5.24.1
28
+
29
+ ### Fixes
30
+
31
+ - App Start Native Frames can start with zeroed values ([#3881](https://github.com/getsentry/sentry-react-native/pull/3881))
32
+
33
+ ### Dependencies
34
+
35
+ - Bump Cocoa SDK from v8.28.0 to v8.29.1 ([#3890](https://github.com/getsentry/sentry-react-native/pull/3890))
36
+ - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8291)
37
+ - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.28.0...8.29.1)
38
+
3
39
  ## 5.24.0
4
40
 
5
41
  ### Features
@@ -87,6 +123,14 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
87
123
  - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8270)
88
124
  - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.26.0...8.27.0)
89
125
 
126
+ ## 5.23.0-alpha.1
127
+
128
+ ### Fixes
129
+
130
+ - Pass `replaysSessionSampleRate` option to Android ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
131
+
132
+ 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/)
133
+
90
134
  ## 5.22.3
91
135
 
92
136
  ### Fixes
@@ -120,6 +164,47 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
120
164
  - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8250)
121
165
  - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.24.0...8.25.0)
122
166
 
167
+ ## 5.23.0-alpha.0
168
+
169
+ ### Features
170
+
171
+ - Mobile Session Replay Alpha ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
172
+
173
+ To enable Replay for React Native on mobile and web add the following options.
174
+
175
+ ```js
176
+ Sentry.init({
177
+ _experiments: {
178
+ replaysSessionSampleRate: 1.0,
179
+ replaysOnErrorSampleRate: 1.0,
180
+ },
181
+ });
182
+ ```
183
+
184
+ To change the default Mobile Replay options add the `mobileReplayIntegration`.
185
+
186
+ ```js
187
+ Sentry.init({
188
+ _experiments: {
189
+ replaysSessionSampleRate: 1.0,
190
+ replaysOnErrorSampleRate: 1.0,
191
+ },
192
+ integration: [
193
+ Sentry.mobileReplayIntegration({
194
+ maskAllText: true,
195
+ maskAllImages: true,
196
+ }),
197
+ ],
198
+ });
199
+ ```
200
+
201
+ 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/)
202
+
203
+ ### Dependencies
204
+
205
+ - Bump Cocoa SDK to [8.25.0-alpha.0](https://github.com/getsentry/sentry-cocoa/releases/tag/8.25.0-alpha.0)
206
+ - Bump Android SDK to [7.9.0-alpha.1](https://github.com/getsentry/sentry-java/releases/tag/7.9.0-alpha.1)
207
+
123
208
  ## 5.22.0
124
209
 
125
210
  ### Features
@@ -630,7 +715,7 @@ This release is compatible with `expo@50.0.0-preview.6` and newer.
630
715
  });
631
716
  ```
632
717
 
633
- Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
718
+ Read more at <https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690>
634
719
 
635
720
  - Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
636
721
 
@@ -1021,6 +1106,7 @@ This has been fixed in [version `5.9.1`](https://github.com/getsentry/sentry-rea
1021
1106
  ## 5.4.0
1022
1107
 
1023
1108
  ### Features
1109
+
1024
1110
  - Add TS 4.1 typings ([#2995](https://github.com/getsentry/sentry-react-native/pull/2995))
1025
1111
  - TS 3.8 are present and work automatically with older projects
1026
1112
  - Add CPU Info to Device Context ([#2984](https://github.com/getsentry/sentry-react-native/pull/2984))
@@ -2668,7 +2754,7 @@ We are looking into ways making this more stable and plan to re-enable it again
2668
2754
 
2669
2755
  ## v0.23.2
2670
2756
 
2671
- - Fixed #228 again ¯\\_(ツ)_/¯
2757
+ - Fixed #228 again ¯\\*(ツ)*/¯
2672
2758
 
2673
2759
  ## v0.23.1
2674
2760
 
package/RNSentry.podspec CHANGED
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
33
33
  s.preserve_paths = '*.js'
34
34
 
35
35
  s.dependency 'React-Core'
36
- s.dependency 'Sentry/HybridSDK', '8.28.0'
36
+ s.dependency 'Sentry/HybridSDK', '8.30.0'
37
37
 
38
38
  s.source_files = 'ios/**/*.{h,m,mm}'
39
39
  s.public_header_files = 'ios/RNSentry.h'
@@ -54,5 +54,5 @@ android {
54
54
 
55
55
  dependencies {
56
56
  implementation 'com.facebook.react:react-native:+'
57
- api 'io.sentry:sentry-android:7.10.0'
57
+ api 'io.sentry:sentry-android:7.11.0-alpha.2'
58
58
  }
@@ -61,6 +61,7 @@ import io.sentry.SentryEvent;
61
61
  import io.sentry.SentryExecutorService;
62
62
  import io.sentry.SentryLevel;
63
63
  import io.sentry.SentryOptions;
64
+ import io.sentry.SentryReplayOptions;
64
65
  import io.sentry.UncaughtExceptionHandlerIntegration;
65
66
  import io.sentry.android.core.AndroidLogger;
66
67
  import io.sentry.android.core.AndroidProfiler;
@@ -79,6 +80,7 @@ import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
79
80
  import io.sentry.android.core.performance.AppStartMetrics;
80
81
  import io.sentry.protocol.SdkVersion;
81
82
  import io.sentry.protocol.SentryException;
83
+ import io.sentry.protocol.SentryId;
82
84
  import io.sentry.protocol.SentryPackage;
83
85
  import io.sentry.protocol.User;
84
86
  import io.sentry.protocol.ViewHierarchy;
@@ -186,7 +188,7 @@ public class RNSentryModuleImpl {
186
188
 
187
189
  options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
188
190
  options.setNativeSdkName(NATIVE_SDK_NAME);
189
- options.setSdkVersion(sdkVersion);
191
+ options.setSdkVersion(sdkVersion);
190
192
 
191
193
  if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
192
194
  options.setDebug(true);
@@ -252,7 +254,10 @@ public class RNSentryModuleImpl {
252
254
  if (rnOptions.hasKey("enableNdk")) {
253
255
  options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
254
256
  }
255
-
257
+ if (rnOptions.hasKey("_experiments")) {
258
+ options.getExperimental().setSessionReplay(getReplayOptions(rnOptions));
259
+ options.getReplayController().setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
260
+ }
256
261
  options.setBeforeSend((event, hint) -> {
257
262
  // React native internally throws a JavascriptException
258
263
  // Since we catch it before that, we don't want to send this one
@@ -293,6 +298,37 @@ public class RNSentryModuleImpl {
293
298
  promise.resolve(true);
294
299
  }
295
300
 
301
+ private SentryReplayOptions getReplayOptions(@NotNull ReadableMap rnOptions) {
302
+ @NotNull final SentryReplayOptions androidReplayOptions = new SentryReplayOptions();
303
+
304
+ @Nullable final ReadableMap rnExperimentsOptions = rnOptions.getMap("_experiments");
305
+ if (rnExperimentsOptions == null) {
306
+ return androidReplayOptions;
307
+ }
308
+
309
+ if (!(rnExperimentsOptions.hasKey("replaysSessionSampleRate") || rnExperimentsOptions.hasKey("replaysOnErrorSampleRate"))) {
310
+ return androidReplayOptions;
311
+ }
312
+
313
+ androidReplayOptions.setSessionSampleRate(rnExperimentsOptions.hasKey("replaysSessionSampleRate")
314
+ ? rnExperimentsOptions.getDouble("replaysSessionSampleRate") : null);
315
+ androidReplayOptions.setErrorSampleRate(rnExperimentsOptions.hasKey("replaysOnErrorSampleRate")
316
+ ? rnExperimentsOptions.getDouble("replaysOnErrorSampleRate") : null);
317
+
318
+ if (!rnOptions.hasKey("mobileReplayOptions")) {
319
+ return androidReplayOptions;
320
+ }
321
+ @Nullable final ReadableMap rnMobileReplayOptions = rnOptions.getMap("mobileReplayOptions");
322
+ if (rnMobileReplayOptions == null) {
323
+ return androidReplayOptions;
324
+ }
325
+
326
+ androidReplayOptions.setRedactAllText(!rnMobileReplayOptions.hasKey("maskAllText") || rnMobileReplayOptions.getBoolean("maskAllText"));
327
+ androidReplayOptions.setRedactAllImages(!rnMobileReplayOptions.hasKey("maskAllImages") || rnMobileReplayOptions.getBoolean("maskAllImages"));
328
+
329
+ return androidReplayOptions;
330
+ }
331
+
296
332
  public void crash() {
297
333
  throw new RuntimeException("TEST - Sentry Client Crash (only works in release mode)");
298
334
  }
@@ -381,11 +417,6 @@ public class RNSentryModuleImpl {
381
417
  }
382
418
  }
383
419
 
384
- if (totalFrames == 0 && slowFrames == 0 && frozenFrames == 0) {
385
- promise.resolve(null);
386
- return;
387
- }
388
-
389
420
  WritableMap map = Arguments.createMap();
390
421
  map.putInt("totalFrames", totalFrames);
391
422
  map.putInt("slowFrames", slowFrames);
@@ -399,6 +430,24 @@ public class RNSentryModuleImpl {
399
430
  }
400
431
  }
401
432
 
433
+ public void captureReplay(boolean isHardCrash, Promise promise) {
434
+ Sentry.getCurrentHub().getOptions().getReplayController().sendReplay(isHardCrash, null, null);
435
+ promise.resolve(getCurrentReplayId());
436
+ }
437
+
438
+ public @Nullable String getCurrentReplayId() {
439
+ final @Nullable IScope scope = InternalSentrySdk.getCurrentScope();
440
+ if (scope == null) {
441
+ return null;
442
+ }
443
+
444
+ final @NotNull SentryId id = scope.getReplayId();
445
+ if (id == SentryId.EMPTY_ID) {
446
+ return null;
447
+ }
448
+ return id.toString();
449
+ }
450
+
402
451
  public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
403
452
  byte[] bytes = Base64.decode(rawBytes, Base64.DEFAULT);
404
453
 
@@ -0,0 +1,178 @@
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
+
33
+ if (breadcrumb.getCategory().equals("touch")) {
34
+ return convertTouchBreadcrumb(breadcrumb);
35
+ }
36
+ if (breadcrumb.getCategory().equals("navigation")) {
37
+ final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
38
+ rrWebBreadcrumb.setCategory(breadcrumb.getCategory());
39
+ rrWebBreadcrumb.setData(breadcrumb.getData());
40
+ return rrWebBreadcrumb;
41
+ }
42
+ if (breadcrumb.getCategory().equals("xhr")) {
43
+ return convertNetworkBreadcrumb(breadcrumb);
44
+ }
45
+ if (breadcrumb.getCategory().equals("http")) {
46
+ // Drop native http breadcrumbs to avoid duplicates
47
+ return null;
48
+ }
49
+
50
+ RRWebEvent nativeBreadcrumb = super.convert(breadcrumb);
51
+
52
+ // ignore native navigation breadcrumbs
53
+ if (nativeBreadcrumb instanceof RRWebBreadcrumbEvent) {
54
+ final RRWebBreadcrumbEvent rrWebBreadcrumb = (RRWebBreadcrumbEvent) nativeBreadcrumb;
55
+ if (rrWebBreadcrumb.getCategory() != null && rrWebBreadcrumb.getCategory().equals("navigation")) {
56
+ return null;
57
+ }
58
+ }
59
+
60
+ return nativeBreadcrumb;
61
+ }
62
+
63
+ @TestOnly
64
+ public @NotNull RRWebEvent convertTouchBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
65
+ final RRWebBreadcrumbEvent rrWebBreadcrumb = new RRWebBreadcrumbEvent();
66
+
67
+ rrWebBreadcrumb.setCategory("ui.tap");
68
+
69
+ rrWebBreadcrumb.setMessage(RNSentryReplayBreadcrumbConverter
70
+ .getTouchPathMessage(breadcrumb.getData("path")));
71
+
72
+ rrWebBreadcrumb.setLevel(breadcrumb.getLevel());
73
+ rrWebBreadcrumb.setData(breadcrumb.getData());
74
+ rrWebBreadcrumb.setTimestamp(breadcrumb.getTimestamp().getTime());
75
+ rrWebBreadcrumb.setBreadcrumbTimestamp(breadcrumb.getTimestamp().getTime() / 1000.0);
76
+ rrWebBreadcrumb.setBreadcrumbType("default");
77
+ return rrWebBreadcrumb;
78
+ }
79
+
80
+ @TestOnly
81
+ public static @Nullable String getTouchPathMessage(final @Nullable Object maybePath) {
82
+ if (!(maybePath instanceof List)) {
83
+ return null;
84
+ }
85
+
86
+ final @NotNull List path = (List) maybePath;
87
+ if (path.size() == 0) {
88
+ return null;
89
+ }
90
+
91
+ final @NotNull StringBuilder message = new StringBuilder();
92
+ for (int i = Math.min(3, path.size() - 1); i >= 0; i--) {
93
+ final @Nullable Object maybeItem = path.get(i);
94
+ if (!(maybeItem instanceof Map)) {
95
+ return null;
96
+ }
97
+
98
+ final @NotNull Map item = (Map) maybeItem;
99
+ final @Nullable Object maybeName = item.get("name");
100
+ final @Nullable Object maybeLabel = item.get("label");
101
+ boolean hasName = maybeName instanceof String;
102
+ boolean hasLabel = maybeLabel instanceof String;
103
+ if (!hasName && !hasLabel) {
104
+ return null; // This again should never be allowed in JS, but to be safe we check it here
105
+ }
106
+ if (hasLabel) {
107
+ message.append(maybeLabel);
108
+ } else { // hasName is true
109
+ message.append(maybeName);
110
+ }
111
+
112
+ final @Nullable Object maybeElement = item.get("element");
113
+ final @Nullable Object maybeFile = item.get("file");
114
+ boolean hasElement = maybeElement instanceof String;
115
+ boolean hasFile = maybeFile instanceof String;
116
+ if (hasElement && hasFile) {
117
+ message.append('(')
118
+ .append(maybeElement)
119
+ .append(", ")
120
+ .append(maybeFile)
121
+ .append(')');
122
+ } else if (hasElement) {
123
+ message.append('(')
124
+ .append(maybeElement)
125
+ .append(')');
126
+ } else if (hasFile) {
127
+ message.append('(')
128
+ .append(maybeFile)
129
+ .append(')');
130
+ }
131
+
132
+ if (i > 0) {
133
+ message.append(" > ");
134
+ }
135
+ }
136
+
137
+ return message.toString();
138
+ }
139
+
140
+ @TestOnly
141
+ public @Nullable RRWebEvent convertNetworkBreadcrumb(final @NotNull Breadcrumb breadcrumb) {
142
+ final Double startTimestamp = breadcrumb.getData("start_timestamp") instanceof Number
143
+ ? (Double) breadcrumb.getData("start_timestamp") : null;
144
+ final Double endTimestamp = breadcrumb.getData("end_timestamp") instanceof Number
145
+ ? (Double) breadcrumb.getData("end_timestamp") : null;
146
+ final String url = breadcrumb.getData("url") instanceof String
147
+ ? (String) breadcrumb.getData("url") : null;
148
+
149
+ if (startTimestamp == null || endTimestamp == null || url == null) {
150
+ return null;
151
+ }
152
+
153
+ final HashMap<String, Object> data = new HashMap<>();
154
+ if (breadcrumb.getData("method") instanceof String) {
155
+ data.put("method", breadcrumb.getData("method"));
156
+ }
157
+ if (breadcrumb.getData("status_code") instanceof Double) {
158
+ final Double statusCode = (Double) breadcrumb.getData("status_code");
159
+ if (statusCode > 0) {
160
+ data.put("statusCode", statusCode.intValue());
161
+ }
162
+ }
163
+ if (breadcrumb.getData("request_body_size") instanceof Double) {
164
+ data.put("requestBodySize", breadcrumb.getData("request_body_size"));
165
+ }
166
+ if (breadcrumb.getData("response_body_size") instanceof Double) {
167
+ data.put("responseBodySize", breadcrumb.getData("response_body_size"));
168
+ }
169
+
170
+ final RRWebSpanEvent rrWebSpanEvent = new RRWebSpanEvent();
171
+ rrWebSpanEvent.setOp("resource.http");
172
+ rrWebSpanEvent.setStartTimestamp(startTimestamp / 1000.0);
173
+ rrWebSpanEvent.setEndTimestamp(endTimestamp / 1000.0);
174
+ rrWebSpanEvent.setDescription(url);
175
+ rrWebSpanEvent.setData(data);
176
+ return rrWebSpanEvent;
177
+ }
178
+ }
@@ -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;
@@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ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAsJnD,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 store: 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}\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"]}
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 store: 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"]}
@@ -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
  */
@@ -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;AAO1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,wBAAwB,CAAC;IACzE,OAAO,CAAC,eAAe,CAAY;IAEnC;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAUpD;;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,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,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
  }, () => {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAoC;IAGzE;;;OAGG;IACH,YAAmB,OAAiC;QAClD,sBAAsB,EAAE,CAAC;QACzB,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,cAAc,CAAC;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,C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AED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport { BaseClient } from '@sentry/core';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Exception,\n Outcome,\n SeverityLevel,\n Thread,\n UserFeedback,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';\nimport { Alert } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport type { ReactNativeClientOptions } from './options';\nimport { ReactNativeTracing } from './tracing';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs();\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n super(options);\n\n this._outcomesBuffer = [];\n this._initNativeSdk();\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace).then(\n (event: Event) => {\n // TMP! Remove this function once JS SDK uses threads for messages\n if (!event.exception?.values || event.exception.values.length <= 0) {\n return event;\n }\n const values = event.exception.values.map(\n (exception: Exception): Thread => ({\n stacktrace: exception.stacktrace,\n }),\n );\n (event as { threads?: { values: Thread[] } }).threads = { values };\n delete event.exception;\n return event;\n },\n );\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n this._sendEnvelope(envelope);\n }\n\n /**\n * Sets up the integrations\n */\n protected _setupIntegrations(): void {\n super._setupIntegrations();\n const tracing = this.getIntegration(ReactNativeTracing);\n const routingName = tracing?.options.routingInstrumentation?.name;\n if (routingName) {\n this.addIntegration(createIntegration(routingName));\n }\n const enableUserInteractionTracing = tracing?.options.enableUserInteractionTracing;\n if (enableUserInteractionTracing) {\n this.addIntegration(createIntegration('ReactNativeUserInteractionTracing'));\n }\n }\n\n /**\n * @inheritdoc\n */\n protected _sendEnvelope(envelope: Envelope): void {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk(this._options)\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n })\n .then(undefined, error => {\n logger.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAoC;IAGzE;;;OAGG;IACH,YAAmB,OAAiC;QAClD,sBAAsB,EAAE,CAAC;QACzB,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,cAAc,CAAC;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,kBAAkB,CAAC,SAAkB,EAAE,OAAkB,EAAE;QAChE,OAAO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A,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACjD,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACK,wBAAwB;QAC9B,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE;YAC/C,KAAK,CAAC,KAAK,CACT,QAAQ,EACR,6NAA6N,CAC9N,CAAC;SACH;IACH,CAAC;IAED;;OAEG;IACK,qBAAqB,CAAC,QAAmB,EAAE,QAA8B;QAC/E,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;YACvB,MAAM,gBAAgB,GAAqB;gBACzC,EAAE,IAAI,EAAE,eAAe,EAAE;gBACzB;oBACE,SAAS,EAAE,sBAAsB,EAAE;oBACnC,gBAAgB,EAAE,QAAQ;iBAC3B;aACF,CAAC;YAEF,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;SACxC;IACH,CAAC;CACF","sourcesContent":["import { eventFromException, eventFromMessage } from '@sentry/browser';\nimport { BaseClient } from '@sentry/core';\nimport type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Exception,\n Outcome,\n SeverityLevel,\n Thread,\n UserFeedback,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';\nimport { Alert } from 'react-native';\n\nimport { createIntegration } from './integrations/factory';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { ReactNativeTracing } from './tracing';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { NATIVE } from './wrapper';\n\n/**\n * The Sentry React Native SDK Client.\n *\n * @see ReactNativeClientOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n\n /**\n * Creates a new React Native SDK instance.\n * @param options Configuration options for this SDK.\n */\n public constructor(options: ReactNativeClientOptions) {\n ignoreRequireCycleLogs();\n options._metadata = options._metadata || {};\n options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;\n super(options);\n\n this._outcomesBuffer = [];\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: unknown, hint: EventHint = {}): PromiseLike<Event> {\n return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {\n return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace).then(\n (event: Event) => {\n // TMP! Remove this function once JS SDK uses threads for messages\n if (!event.exception?.values || event.exception.values.length <= 0) {\n return event;\n }\n const values = event.exception.values.map(\n (exception: Exception): Thread => ({\n stacktrace: exception.stacktrace,\n }),\n );\n (event as { threads?: { values: Thread[] } }).threads = { values };\n delete event.exception;\n return event;\n },\n );\n }\n\n /**\n * If native client is available it will trigger a native crash.\n * Use this only for testing purposes.\n */\n public nativeCrash(): void {\n NATIVE.nativeCrash();\n }\n\n /**\n * @inheritDoc\n */\n public close(): PromiseLike<boolean> {\n // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.\n return super.close().then((result: boolean) => {\n return NATIVE.closeNativeSdk().then(() => result) as PromiseLike<boolean>;\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n */\n public captureUserFeedback(feedback: UserFeedback): void {\n const envelope = createUserFeedbackEnvelope(feedback, {\n metadata: this._options._metadata,\n dsn: this.getDsn(),\n tunnel: undefined,\n });\n this._sendEnvelope(envelope);\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Sets up the integrations\n */\n protected _setupIntegrations(): void {\n super._setupIntegrations();\n const tracing = this.getIntegration(ReactNativeTracing);\n const routingName = tracing?.options.routingInstrumentation?.name;\n if (routingName) {\n this.addIntegration(createIntegration(routingName));\n }\n const enableUserInteractionTracing = tracing?.options.enableUserInteractionTracing;\n if (enableUserInteractionTracing) {\n this.addIntegration(createIntegration('ReactNativeUserInteractionTracing'));\n }\n }\n\n /**\n * @inheritdoc\n */\n protected _sendEnvelope(envelope: Envelope): void {\n const outcomes = this._clearOutcomes();\n this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);\n\n if (this._options.sendClientReports) {\n this._attachClientReportTo(this._outcomesBuffer, envelope as ClientReportEnvelope);\n }\n\n let shouldClearOutcomesBuffer = true;\n if (this._isEnabled() && this._transport && this._dsn) {\n this.emit('beforeEnvelope', envelope);\n\n this._transport.send(envelope).then(null, reason => {\n if (reason instanceof SentryError) {\n // SentryError is thrown by SyncPromise\n shouldClearOutcomesBuffer = false;\n // If this is called asynchronously we want the _outcomesBuffer to be cleared\n logger.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n logger.error('Error while sending event:', reason);\n }\n });\n } else {\n logger.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n mobileReplayOptions:\n this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&\n 'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]\n ? (this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] as ReturnType<typeof mobileReplayIntegration>).options\n : undefined,\n })\n .then(\n (result: boolean) => {\n return result;\n },\n () => {\n this._showCannotConnectDialog();\n return false;\n },\n )\n .then((didCallNativeInit: boolean) => {\n this._options.onReady?.({ didCallNativeInit });\n })\n .then(undefined, error => {\n logger.error('The OnReady callback threw an error: ', error);\n });\n }\n\n /**\n * If the user is in development mode, and the native nagger is enabled then it will show an alert.\n */\n private _showCannotConnectDialog(): void {\n if (__DEV__ && this._options.enableNativeNagger) {\n Alert.alert(\n 'Sentry',\n 'Warning, could not connect to Sentry native SDK.\\nIf you do not want to use the native component please pass `enableNative: false` in the options.\\nVisit: https://docs.sentry.io/platforms/react-native/ for more details.',\n );\n }\n }\n\n /**\n * Attaches a client report from outcomes to the envelope.\n */\n private _attachClientReportTo(outcomes: Outcome[], envelope: ClientReportEnvelope): void {\n if (outcomes.length > 0) {\n const clientReportItem: ClientReportItem = [\n { type: 'client_report' },\n {\n timestamp: dateTimestampInSeconds(),\n discarded_events: outcomes,\n },\n ];\n\n envelope[items].push(clientReportItem);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AA8B3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CA4EvF"}
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAgC3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAuFvF"}