@sentry/react-native 5.25.0-alpha.2 → 5.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -63
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/sentry/react/RNSentryBreadcrumb.java +87 -0
- package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +7 -102
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +0 -10
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +0 -10
- package/dist/js/NativeRNSentry.d.ts +1 -3
- package/dist/js/NativeRNSentry.d.ts.map +1 -1
- package/dist/js/NativeRNSentry.js.map +1 -1
- package/dist/js/client.d.ts +0 -4
- package/dist/js/client.d.ts.map +1 -1
- package/dist/js/client.js +2 -12
- package/dist/js/client.js.map +1 -1
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +26 -7
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/default.d.ts.map +1 -1
- package/dist/js/integrations/default.js +1 -9
- package/dist/js/integrations/default.js.map +1 -1
- package/dist/js/integrations/exports.d.ts +1 -2
- package/dist/js/integrations/exports.d.ts.map +1 -1
- package/dist/js/integrations/exports.js +1 -2
- package/dist/js/integrations/exports.js.map +1 -1
- package/dist/js/integrations/index.d.ts +0 -1
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +0 -1
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/misc.d.ts +2 -0
- package/dist/js/misc.d.ts.map +1 -1
- package/dist/js/misc.js +4 -2
- package/dist/js/misc.js.map +1 -1
- package/dist/js/options.d.ts +2 -24
- package/dist/js/options.d.ts.map +1 -1
- package/dist/js/options.js.map +1 -1
- package/dist/js/touchevents.d.ts.map +1 -1
- package/dist/js/touchevents.js +30 -57
- package/dist/js/touchevents.js.map +1 -1
- package/dist/js/utils/environment.d.ts +0 -4
- package/dist/js/utils/environment.d.ts.map +1 -1
- package/dist/js/utils/environment.js +0 -8
- package/dist/js/utils/environment.js.map +1 -1
- package/dist/js/utils/error.d.ts +1 -0
- package/dist/js/utils/error.d.ts.map +1 -1
- package/dist/js/utils/error.js.map +1 -1
- package/dist/js/utils/worldwide.d.ts +0 -6
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +1 -7
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +1 -25
- package/dist/js/wrapper.js.map +1 -1
- package/ios/RNSentry.mm +9 -34
- package/ios/RNSentryBreadcrumb.h +4 -0
- package/ios/RNSentryBreadcrumb.m +19 -0
- package/package.json +1 -1
- package/sentry.gradle +1 -1
- package/src/js/NativeRNSentry.ts +1 -3
- package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -3
- package/ts3.8/dist/js/client.d.ts +0 -4
- package/ts3.8/dist/js/integrations/exports.d.ts +1 -2
- package/ts3.8/dist/js/integrations/index.d.ts +0 -1
- package/ts3.8/dist/js/misc.d.ts +2 -0
- package/ts3.8/dist/js/options.d.ts +2 -24
- package/ts3.8/dist/js/utils/environment.d.ts +0 -4
- package/ts3.8/dist/js/utils/error.d.ts +1 -0
- package/ts3.8/dist/js/utils/worldwide.d.ts +0 -6
- package/ts3.8/dist/js/version.d.ts +1 -1
- package/ts3.8/dist/js/wrapper.d.ts +1 -7
- package/android/src/main/java/io/sentry/react/RNSentryReplayBreadcrumbConverter.java +0 -178
- package/dist/js/replay/mobilereplay.d.ts +0 -36
- package/dist/js/replay/mobilereplay.d.ts.map +0 -1
- package/dist/js/replay/mobilereplay.js +0 -99
- package/dist/js/replay/mobilereplay.js.map +0 -1
- package/dist/js/replay/networkUtils.d.ts +0 -8
- package/dist/js/replay/networkUtils.d.ts.map +0 -1
- package/dist/js/replay/networkUtils.js +0 -52
- package/dist/js/replay/networkUtils.js.map +0 -1
- package/dist/js/replay/xhrUtils.d.ts +0 -6
- package/dist/js/replay/xhrUtils.d.ts.map +0 -1
- package/dist/js/replay/xhrUtils.js +0 -31
- package/dist/js/replay/xhrUtils.js.map +0 -1
- package/dist/js/utils/clientutils.d.ts +0 -10
- package/dist/js/utils/clientutils.d.ts.map +0 -1
- package/dist/js/utils/clientutils.js +0 -9
- package/dist/js/utils/clientutils.js.map +0 -1
- package/ios/RNSentryReplay.h +0 -8
- package/ios/RNSentryReplay.m +0 -60
- package/ios/RNSentryReplayBreadcrumbConverter.h +0 -16
- package/ios/RNSentryReplayBreadcrumbConverter.m +0 -172
- package/ts3.8/dist/js/replay/mobilereplay.d.ts +0 -36
- package/ts3.8/dist/js/replay/networkUtils.d.ts +0 -8
- package/ts3.8/dist/js/replay/xhrUtils.d.ts +0 -6
- package/ts3.8/dist/js/utils/clientutils.d.ts +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 5.25.0
|
|
3
|
+
## 5.25.0
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
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))
|
|
7
|
+
- Improved Touch Event Breadcrumb components structure ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899))
|
|
8
|
+
- Set `currentScreen` on native scope ([#3927](https://github.com/getsentry/sentry-react-native/pull/3927))
|
|
11
9
|
|
|
12
10
|
### Fixes
|
|
13
11
|
|
|
12
|
+
- `error.cause` chain is locally symbolicated in development builds ([#3920](https://github.com/getsentry/sentry-react-native/pull/3920))
|
|
14
13
|
- `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))
|
|
14
|
+
- Flavor aware Android builds use `SENTRY_AUTH_TOKEN` env as fallback when token not found in `sentry-flavor-type.properties`. ([#3917](https://github.com/getsentry/sentry-react-native/pull/3917))
|
|
15
|
+
- `mechanism.handled:false` should crash current session ([#3900](https://github.com/getsentry/sentry-react-native/pull/3900))
|
|
15
16
|
|
|
16
17
|
### Dependencies
|
|
17
18
|
|
|
18
|
-
- Bump Cocoa SDK from v8.
|
|
19
|
+
- Bump Cocoa SDK from v8.29.1 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
|
|
19
20
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8300)
|
|
20
|
-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.
|
|
21
|
-
- Bump Android SDK from v7.
|
|
22
|
-
- [changelog](https://github.com/getsentry/sentry-java/blob/
|
|
23
|
-
- [diff](https://github.com/getsentry/sentry-java/compare/7.
|
|
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/)
|
|
21
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.29.1...8.30.0)
|
|
22
|
+
- Bump Android SDK from v7.10.0 to v7.11.0 ([#3926](https://github.com/getsentry/sentry-react-native/pull/3926))
|
|
23
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7110)
|
|
24
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/7.10.0...7.11.0)
|
|
26
25
|
|
|
27
26
|
## 5.24.1
|
|
28
27
|
|
|
@@ -123,14 +122,6 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
|
|
|
123
122
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8270)
|
|
124
123
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.26.0...8.27.0)
|
|
125
124
|
|
|
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
|
-
|
|
134
125
|
## 5.22.3
|
|
135
126
|
|
|
136
127
|
### Fixes
|
|
@@ -164,47 +155,6 @@ Access to Mobile Replay is limited to early access orgs on Sentry. If you're int
|
|
|
164
155
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8250)
|
|
165
156
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.24.0...8.25.0)
|
|
166
157
|
|
|
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
|
-
|
|
208
158
|
## 5.22.0
|
|
209
159
|
|
|
210
160
|
### Features
|
|
@@ -715,7 +665,7 @@ This release is compatible with `expo@50.0.0-preview.6` and newer.
|
|
|
715
665
|
});
|
|
716
666
|
```
|
|
717
667
|
|
|
718
|
-
Read more at
|
|
668
|
+
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
|
|
719
669
|
|
|
720
670
|
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
|
|
721
671
|
|
|
@@ -2754,7 +2704,7 @@ We are looking into ways making this more stable and plan to re-enable it again
|
|
|
2754
2704
|
|
|
2755
2705
|
## v0.23.2
|
|
2756
2706
|
|
|
2757
|
-
- Fixed #228 again
|
|
2707
|
+
- Fixed #228 again ¯\\_(ツ)_/¯
|
|
2758
2708
|
|
|
2759
2709
|
## v0.23.1
|
|
2760
2710
|
|
package/android/build.gradle
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
package io.sentry.react;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
4
|
+
|
|
5
|
+
import org.jetbrains.annotations.NotNull;
|
|
6
|
+
import org.jetbrains.annotations.Nullable;
|
|
7
|
+
|
|
8
|
+
import java.util.Map;
|
|
9
|
+
|
|
10
|
+
import io.sentry.Breadcrumb;
|
|
11
|
+
import io.sentry.SentryLevel;
|
|
12
|
+
|
|
13
|
+
public class RNSentryBreadcrumb {
|
|
14
|
+
|
|
15
|
+
@Nullable
|
|
16
|
+
public static String getCurrentScreenFrom(ReadableMap from) {
|
|
17
|
+
final @Nullable String maybeCategory = from.hasKey("category") ? from.getString("category") : null;
|
|
18
|
+
if (maybeCategory == null || !maybeCategory.equals("navigation")) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
final @Nullable ReadableMap maybeData = from.hasKey("data") ? from.getMap("data") : null;
|
|
23
|
+
if (maybeData == null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// getString might throw if cast to string fails (data.to is not enforced by TS to be a string)
|
|
29
|
+
return maybeData.hasKey("to") ? maybeData.getString("to") : null;
|
|
30
|
+
} catch (Throwable exception) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@NotNull
|
|
36
|
+
public static Breadcrumb fromMap(ReadableMap from) {
|
|
37
|
+
final @NotNull Breadcrumb breadcrumb = new Breadcrumb();
|
|
38
|
+
|
|
39
|
+
if (from.hasKey("message")) {
|
|
40
|
+
breadcrumb.setMessage(from.getString("message"));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (from.hasKey("type")) {
|
|
44
|
+
breadcrumb.setType(from.getString("type"));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (from.hasKey("category")) {
|
|
48
|
+
breadcrumb.setCategory(from.getString("category"));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (from.hasKey("level")) {
|
|
52
|
+
switch (from.getString("level")) {
|
|
53
|
+
case "fatal":
|
|
54
|
+
breadcrumb.setLevel(SentryLevel.FATAL);
|
|
55
|
+
break;
|
|
56
|
+
case "warning":
|
|
57
|
+
breadcrumb.setLevel(SentryLevel.WARNING);
|
|
58
|
+
break;
|
|
59
|
+
case "debug":
|
|
60
|
+
breadcrumb.setLevel(SentryLevel.DEBUG);
|
|
61
|
+
break;
|
|
62
|
+
case "error":
|
|
63
|
+
breadcrumb.setLevel(SentryLevel.ERROR);
|
|
64
|
+
break;
|
|
65
|
+
case "info":
|
|
66
|
+
default:
|
|
67
|
+
breadcrumb.setLevel(SentryLevel.INFO);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
if (from.hasKey("data")) {
|
|
74
|
+
final ReadableMap data = from.getMap("data");
|
|
75
|
+
for (final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
76
|
+
final Object value = entry.getValue();
|
|
77
|
+
// data is ConcurrentHashMap and can't have null values
|
|
78
|
+
if (value != null) {
|
|
79
|
+
breadcrumb.setData(entry.getKey(), entry.getValue());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return breadcrumb;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
@@ -61,7 +61,6 @@ 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;
|
|
65
64
|
import io.sentry.UncaughtExceptionHandlerIntegration;
|
|
66
65
|
import io.sentry.android.core.AndroidLogger;
|
|
67
66
|
import io.sentry.android.core.AndroidProfiler;
|
|
@@ -80,7 +79,6 @@ import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
|
|
|
80
79
|
import io.sentry.android.core.performance.AppStartMetrics;
|
|
81
80
|
import io.sentry.protocol.SdkVersion;
|
|
82
81
|
import io.sentry.protocol.SentryException;
|
|
83
|
-
import io.sentry.protocol.SentryId;
|
|
84
82
|
import io.sentry.protocol.SentryPackage;
|
|
85
83
|
import io.sentry.protocol.User;
|
|
86
84
|
import io.sentry.protocol.ViewHierarchy;
|
|
@@ -188,7 +186,7 @@ public class RNSentryModuleImpl {
|
|
|
188
186
|
|
|
189
187
|
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
|
|
190
188
|
options.setNativeSdkName(NATIVE_SDK_NAME);
|
|
191
|
-
|
|
189
|
+
options.setSdkVersion(sdkVersion);
|
|
192
190
|
|
|
193
191
|
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
|
|
194
192
|
options.setDebug(true);
|
|
@@ -254,10 +252,7 @@ public class RNSentryModuleImpl {
|
|
|
254
252
|
if (rnOptions.hasKey("enableNdk")) {
|
|
255
253
|
options.setEnableNdk(rnOptions.getBoolean("enableNdk"));
|
|
256
254
|
}
|
|
257
|
-
|
|
258
|
-
options.getExperimental().setSessionReplay(getReplayOptions(rnOptions));
|
|
259
|
-
options.getReplayController().setBreadcrumbConverter(new RNSentryReplayBreadcrumbConverter());
|
|
260
|
-
}
|
|
255
|
+
|
|
261
256
|
options.setBeforeSend((event, hint) -> {
|
|
262
257
|
// React native internally throws a JavascriptException
|
|
263
258
|
// Since we catch it before that, we don't want to send this one
|
|
@@ -298,37 +293,6 @@ public class RNSentryModuleImpl {
|
|
|
298
293
|
promise.resolve(true);
|
|
299
294
|
}
|
|
300
295
|
|
|
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
|
-
|
|
332
296
|
public void crash() {
|
|
333
297
|
throw new RuntimeException("TEST - Sentry Client Crash (only works in release mode)");
|
|
334
298
|
}
|
|
@@ -430,29 +394,11 @@ public class RNSentryModuleImpl {
|
|
|
430
394
|
}
|
|
431
395
|
}
|
|
432
396
|
|
|
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
|
-
|
|
451
397
|
public void captureEnvelope(String rawBytes, ReadableMap options, Promise promise) {
|
|
452
398
|
byte[] bytes = Base64.decode(rawBytes, Base64.DEFAULT);
|
|
453
399
|
|
|
454
400
|
try {
|
|
455
|
-
InternalSentrySdk.captureEnvelope(bytes);
|
|
401
|
+
InternalSentrySdk.captureEnvelope(bytes, !options.hasKey("hardCrashed") || !options.getBoolean("hardCrashed"));
|
|
456
402
|
} catch (Throwable e) {
|
|
457
403
|
logger.log(SentryLevel.ERROR, "Error while capturing envelope");
|
|
458
404
|
promise.resolve(false);
|
|
@@ -605,53 +551,12 @@ public class RNSentryModuleImpl {
|
|
|
605
551
|
|
|
606
552
|
public void addBreadcrumb(final ReadableMap breadcrumb) {
|
|
607
553
|
Sentry.configureScope(scope -> {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if (breadcrumb.hasKey("message")) {
|
|
611
|
-
breadcrumbInstance.setMessage(breadcrumb.getString("message"));
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
if (breadcrumb.hasKey("type")) {
|
|
615
|
-
breadcrumbInstance.setType(breadcrumb.getString("type"));
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
if (breadcrumb.hasKey("category")) {
|
|
619
|
-
breadcrumbInstance.setCategory(breadcrumb.getString("category"));
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (breadcrumb.hasKey("level")) {
|
|
623
|
-
switch (breadcrumb.getString("level")) {
|
|
624
|
-
case "fatal":
|
|
625
|
-
breadcrumbInstance.setLevel(SentryLevel.FATAL);
|
|
626
|
-
break;
|
|
627
|
-
case "warning":
|
|
628
|
-
breadcrumbInstance.setLevel(SentryLevel.WARNING);
|
|
629
|
-
break;
|
|
630
|
-
case "debug":
|
|
631
|
-
breadcrumbInstance.setLevel(SentryLevel.DEBUG);
|
|
632
|
-
break;
|
|
633
|
-
case "error":
|
|
634
|
-
breadcrumbInstance.setLevel(SentryLevel.ERROR);
|
|
635
|
-
break;
|
|
636
|
-
case "info":
|
|
637
|
-
default:
|
|
638
|
-
breadcrumbInstance.setLevel(SentryLevel.INFO);
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
554
|
+
scope.addBreadcrumb(RNSentryBreadcrumb.fromMap(breadcrumb));
|
|
642
555
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
final Object value = entry.getValue();
|
|
647
|
-
// data is ConcurrentHashMap and can't have null values
|
|
648
|
-
if (value != null) {
|
|
649
|
-
breadcrumbInstance.setData(entry.getKey(), entry.getValue());
|
|
650
|
-
}
|
|
651
|
-
}
|
|
556
|
+
final @Nullable String screen = RNSentryBreadcrumb.getCurrentScreenFrom(breadcrumb);
|
|
557
|
+
if (screen != null) {
|
|
558
|
+
scope.setScreen(screen);
|
|
652
559
|
}
|
|
653
|
-
|
|
654
|
-
scope.addBreadcrumb(breadcrumbInstance);
|
|
655
560
|
});
|
|
656
561
|
}
|
|
657
562
|
|
|
@@ -158,14 +158,4 @@ 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
|
-
}
|
|
171
161
|
}
|
|
@@ -158,14 +158,4 @@ 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
|
-
}
|
|
171
161
|
}
|
|
@@ -6,7 +6,7 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
removeListeners: (id: number) => void;
|
|
7
7
|
addBreadcrumb(breadcrumb: UnsafeObject): void;
|
|
8
8
|
captureEnvelope(bytes: string, options: {
|
|
9
|
-
|
|
9
|
+
hardCrashed: boolean;
|
|
10
10
|
}): Promise<boolean>;
|
|
11
11
|
captureScreenshot(): Promise<NativeScreenshot[] | undefined | null>;
|
|
12
12
|
clearBreadcrumbs(): void;
|
|
@@ -39,8 +39,6 @@ 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;
|
|
44
42
|
}
|
|
45
43
|
export type NativeStackFrame = {
|
|
46
44
|
platform: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeRNSentry.d.ts","sourceRoot":"","sources":["../../src/js/NativeRNSentry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAIjE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,WAAW,EAAE,CAAC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,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;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 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}\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,10 +35,6 @@ 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;
|
|
42
38
|
/**
|
|
43
39
|
* Sets up the integrations
|
|
44
40
|
*/
|
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;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,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;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;IAmBtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
|
package/dist/js/client.js
CHANGED
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
import { ReactNativeTracing } from './tracing';
|
|
9
8
|
import { createUserFeedbackEnvelope, items } from './utils/envelope';
|
|
10
9
|
import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';
|
|
@@ -27,6 +26,7 @@ export class ReactNativeClient extends BaseClient {
|
|
|
27
26
|
options._metadata.sdk = options._metadata.sdk || defaultSdkInfo;
|
|
28
27
|
super(options);
|
|
29
28
|
this._outcomesBuffer = [];
|
|
29
|
+
this._initNativeSdk();
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @inheritDoc
|
|
@@ -79,13 +79,6 @@ 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
|
-
}
|
|
89
82
|
/**
|
|
90
83
|
* Sets up the integrations
|
|
91
84
|
*/
|
|
@@ -137,10 +130,7 @@ export class ReactNativeClient extends BaseClient {
|
|
|
137
130
|
* Starts native client with dsn and options
|
|
138
131
|
*/
|
|
139
132
|
_initNativeSdk() {
|
|
140
|
-
NATIVE.initNativeSdk(
|
|
141
|
-
'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
|
|
142
|
-
? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options
|
|
143
|
-
: undefined }))
|
|
133
|
+
NATIVE.initNativeSdk(this._options)
|
|
144
134
|
.then((result) => {
|
|
145
135
|
return result;
|
|
146
136
|
}, () => {
|
package/dist/js/client.js.map
CHANGED
|
@@ -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,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AAwB;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
|
+
{"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;QA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,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 { 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"debugsymbolicator.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/debugsymbolicator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAavB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,QAAO,mBAQ/C,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,iBAAiB,+BAGI,CAAC"}
|