@sentry/react-native 8.1.0 → 8.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +2 -1
  2. package/RNSentry.podspec +1 -1
  3. package/android/AGENTS.md +51 -0
  4. package/android/build.gradle +2 -2
  5. package/android/libs/replay-stubs.jar +0 -0
  6. package/android/replay-stubs/build.gradle +1 -1
  7. package/android/src/main/java/io/sentry/react/RNSentryLogger.java +96 -0
  8. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +14 -4
  9. package/android/src/main/java/io/sentry/react/RNSentryStart.java +11 -9
  10. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  11. package/dist/js/NativeLogListener.d.ts +16 -0
  12. package/dist/js/NativeLogListener.d.ts.map +1 -0
  13. package/dist/js/NativeLogListener.js +72 -0
  14. package/dist/js/NativeLogListener.js.map +1 -0
  15. package/dist/js/client.d.ts +1 -0
  16. package/dist/js/client.d.ts.map +1 -1
  17. package/dist/js/client.js +14 -3
  18. package/dist/js/client.js.map +1 -1
  19. package/dist/js/index.d.ts +2 -2
  20. package/dist/js/index.d.ts.map +1 -1
  21. package/dist/js/index.js +1 -1
  22. package/dist/js/index.js.map +1 -1
  23. package/dist/js/integrations/default.d.ts.map +1 -1
  24. package/dist/js/integrations/default.js +2 -1
  25. package/dist/js/integrations/default.js.map +1 -1
  26. package/dist/js/integrations/expoconstants.d.ts +24 -0
  27. package/dist/js/integrations/expoconstants.d.ts.map +1 -0
  28. package/dist/js/integrations/expoconstants.js +77 -0
  29. package/dist/js/integrations/expoconstants.js.map +1 -0
  30. package/dist/js/integrations/exports.d.ts +1 -0
  31. package/dist/js/integrations/exports.d.ts.map +1 -1
  32. package/dist/js/integrations/exports.js +1 -0
  33. package/dist/js/integrations/exports.js.map +1 -1
  34. package/dist/js/options.d.ts +26 -0
  35. package/dist/js/options.d.ts.map +1 -1
  36. package/dist/js/options.js.map +1 -1
  37. package/dist/js/tools/easBuildHooks.d.ts +48 -0
  38. package/dist/js/tools/easBuildHooks.d.ts.map +1 -0
  39. package/dist/js/tools/easBuildHooks.js +228 -0
  40. package/dist/js/tools/easBuildHooks.js.map +1 -0
  41. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  42. package/dist/js/tracing/integrations/appStart.js +4 -1
  43. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  44. package/dist/js/tracing/onSpanEndUtils.d.ts +7 -0
  45. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  46. package/dist/js/tracing/onSpanEndUtils.js +45 -6
  47. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  48. package/dist/js/tracing/reactnavigation.d.ts +15 -0
  49. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  50. package/dist/js/tracing/reactnavigation.js +41 -13
  51. package/dist/js/tracing/reactnavigation.js.map +1 -1
  52. package/dist/js/tracing/span.d.ts +6 -6
  53. package/dist/js/tracing/span.d.ts.map +1 -1
  54. package/dist/js/tracing/span.js +3 -3
  55. package/dist/js/tracing/span.js.map +1 -1
  56. package/dist/js/utils/expoglobalobject.d.ts +47 -7
  57. package/dist/js/utils/expoglobalobject.d.ts.map +1 -1
  58. package/dist/js/utils/expoglobalobject.js.map +1 -1
  59. package/dist/js/version.d.ts +1 -1
  60. package/dist/js/version.js +6 -3
  61. package/dist/js/version.js.map +1 -1
  62. package/dist/js/wrapper.d.ts.map +1 -1
  63. package/dist/js/wrapper.js +1 -1
  64. package/dist/js/wrapper.js.map +1 -1
  65. package/ios/AGENTS.md +60 -0
  66. package/ios/RNSentry.mm +4 -1
  67. package/ios/RNSentryEvents.h +1 -0
  68. package/ios/RNSentryEvents.m +1 -0
  69. package/ios/RNSentryNativeLogsForwarder.h +20 -0
  70. package/ios/RNSentryNativeLogsForwarder.m +145 -0
  71. package/ios/RNSentryVersion.m +1 -1
  72. package/package.json +14 -11
  73. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  74. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  75. package/scripts/eas-build-hook.js +234 -0
  76. package/scripts/sentry-xcode.sh +9 -2
  77. package/sentry.gradle +13 -5
  78. package/ts3.8/dist/js/NativeLogListener.d.ts +16 -0
  79. package/ts3.8/dist/js/client.d.ts +1 -0
  80. package/ts3.8/dist/js/index.d.ts +2 -2
  81. package/ts3.8/dist/js/integrations/expoconstants.d.ts +24 -0
  82. package/ts3.8/dist/js/integrations/exports.d.ts +1 -0
  83. package/ts3.8/dist/js/options.d.ts +26 -0
  84. package/ts3.8/dist/js/tracing/onSpanEndUtils.d.ts +7 -0
  85. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +15 -0
  86. package/ts3.8/dist/js/tracing/span.d.ts +6 -6
  87. package/ts3.8/dist/js/utils/expoglobalobject.d.ts +47 -7
  88. package/ts3.8/dist/js/version.d.ts +1 -1
package/README.md CHANGED
@@ -24,6 +24,8 @@ This repo uses the following ways to release SDK updates:
24
24
  - `Latest`: We continuously release major/minor/hotfix versions from the `main` branch. These releases go through all our internal quality gates and are very safe to use and intended to be the default for most teams.
25
25
  - `Stable`: We promote releases from `Latest` when they have been used in the field for some time and in scale, considering time since release, adoption, and other quality and stability metrics. These releases will be indicated on [the releases page](https://github.com/getsentry/sentry-react-native/releases/) with the `Stable` suffix.
26
26
 
27
+ For a list of which SDK versions are bundled with each release, see [SDK-VERSIONS.md](SDK-VERSIONS.md).
28
+
27
29
  ## Requirements
28
30
 
29
31
  - `react-native >= 0.65.0`
@@ -93,6 +95,5 @@ If you are coming from `react-native-sentry` which was our SDK `< 1.0` you shoul
93
95
  - [![Documentation](https://img.shields.io/badge/documentation-sentry.io-green.svg)](https://docs.sentry.io/platforms/react-native/)
94
96
  - [![Discussions](https://img.shields.io/github/discussions/getsentry/sentry-react-native.svg)](https://github.com/getsentry/sentry-react-native/discussions)
95
97
  - [![Discord Chat](https://img.shields.io/discord/621778831602221064?logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/PXa5Apfe7K)
96
- - [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-sentry-green.svg)](http://stackoverflow.com/questions/tagged/sentry)
97
98
  - [![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-sentry-green.svg)](https://github.com/getsentry/.github/blob/main/CODE_OF_CONDUCT.md)
98
99
  - [![X Follow](https://img.shields.io/twitter/follow/sentry?label=sentry&style=social)](https://x.com/intent/follow?screen_name=sentry)
package/RNSentry.podspec CHANGED
@@ -51,7 +51,7 @@ Pod::Spec.new do |s|
51
51
  'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"'
52
52
  }
53
53
 
54
- s.dependency 'Sentry', '9.4.1'
54
+ s.dependency 'Sentry', '9.6.0'
55
55
 
56
56
  if defined? install_modules_dependencies
57
57
  # Default React Native dependencies for 0.71 and above (new and legacy architecture)
@@ -0,0 +1,51 @@
1
+ # packages/core/android — Java & Kotlin
2
+
3
+ ## Formatting & Linting
4
+
5
+ | Task | Command |
6
+ |------|---------|
7
+ | Java format (Google Java Format) | `yarn fix:android` |
8
+ | Kotlin format (ktlint) | `yarn fix:kotlin` |
9
+ | Java lint check | `yarn lint:android` |
10
+ | Kotlin lint check | `yarn lint:kotlin` |
11
+ | PMD static analysis | `yarn java:pmd` |
12
+
13
+ ## Code Conventions
14
+
15
+ ### Java
16
+
17
+ - Use **Google Java Format** (enforced by CI)
18
+ - Package structure: `io.sentry.react.*`
19
+ - Null safety: Use `@Nullable` and `@NonNull` annotations
20
+
21
+ ### Kotlin
22
+
23
+ - Use **ktlint** formatting (enforced by CI)
24
+ - Prefer Kotlin idioms (data classes, extension functions, etc.)
25
+
26
+ ## Architecture Variants
27
+
28
+ Android native code supports both old and new React Native architectures:
29
+ - `src/oldarch/` — Legacy bridge implementation
30
+ - `src/newarch/` — TurboModule / Fabric implementation
31
+ - `src/main/` — Shared code
32
+
33
+ ## Native Bridge Pattern (Java)
34
+
35
+ ```java
36
+ @ReactMethod
37
+ public void nativeOperation(String param, Promise promise) {
38
+ try {
39
+ boolean result = performOperation(param);
40
+ promise.resolve(result);
41
+ } catch (Exception e) {
42
+ promise.reject("OPERATION_FAILED", "Operation failed: " + e.getMessage(), e);
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Working with Local sentry-java
48
+
49
+ 1. Build sentry-java: `cd sentry-java && make dryRelease`
50
+ 2. Add `mavenLocal()` to sample's `android/build.gradle`
51
+ 3. Update version to locally published version
@@ -55,6 +55,6 @@ android {
55
55
  dependencies {
56
56
  compileOnly files('libs/replay-stubs.jar')
57
57
  implementation 'com.facebook.react:react-native:+'
58
- api 'io.sentry:sentry-android:8.32.0'
59
- debugImplementation 'io.sentry:sentry-spotlight:8.32.0'
58
+ api 'io.sentry:sentry-android:8.33.0'
59
+ debugImplementation 'io.sentry:sentry-spotlight:8.33.0'
60
60
  }
Binary file
@@ -18,5 +18,5 @@ tasks.named('jar', Jar) {
18
18
  }
19
19
 
20
20
  dependencies {
21
- compileOnly 'io.sentry:sentry:8.32.0'
21
+ compileOnly 'io.sentry:sentry:8.33.0'
22
22
  }
@@ -0,0 +1,96 @@
1
+ package io.sentry.react;
2
+
3
+ import com.facebook.react.bridge.Arguments;
4
+ import com.facebook.react.bridge.ReactApplicationContext;
5
+ import com.facebook.react.bridge.WritableMap;
6
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
7
+ import io.sentry.ILogger;
8
+ import io.sentry.SentryLevel;
9
+ import io.sentry.android.core.AndroidLogger;
10
+ import java.lang.ref.WeakReference;
11
+ import org.jetbrains.annotations.NotNull;
12
+ import org.jetbrains.annotations.Nullable;
13
+
14
+ /**
15
+ * Custom ILogger implementation that wraps AndroidLogger and forwards log messages to React Native.
16
+ * This allows native SDK logs to appear in the Metro console when debug mode is enabled.
17
+ */
18
+ public class RNSentryLogger implements ILogger {
19
+ private static final String TAG = "RNSentry";
20
+ private static final String EVENT_NAME = "SentryNativeLog";
21
+
22
+ private final AndroidLogger androidLogger;
23
+ private WeakReference<ReactApplicationContext> reactContextRef;
24
+
25
+ public RNSentryLogger() {
26
+ this.androidLogger = new AndroidLogger(TAG);
27
+ }
28
+
29
+ public void setReactContext(@Nullable ReactApplicationContext context) {
30
+ this.reactContextRef = context != null ? new WeakReference<>(context) : null;
31
+ }
32
+
33
+ @Override
34
+ public void log(@NotNull SentryLevel level, @NotNull String message, @Nullable Object... args) {
35
+ // Always log to Logcat (default behavior)
36
+ androidLogger.log(level, message, args);
37
+
38
+ // Forward to JS
39
+ String formattedMessage =
40
+ (args == null || args.length == 0) ? message : String.format(message, args);
41
+ forwardToJS(level, formattedMessage);
42
+ }
43
+
44
+ @Override
45
+ public void log(
46
+ @NotNull SentryLevel level, @NotNull String message, @Nullable Throwable throwable) {
47
+ androidLogger.log(level, message, throwable);
48
+
49
+ String fullMessage = throwable != null ? message + ": " + throwable.getMessage() : message;
50
+ forwardToJS(level, fullMessage);
51
+ }
52
+
53
+ @Override
54
+ public void log(
55
+ @NotNull SentryLevel level,
56
+ @Nullable Throwable throwable,
57
+ @NotNull String message,
58
+ @Nullable Object... args) {
59
+ androidLogger.log(level, throwable, message, args);
60
+
61
+ String formattedMessage =
62
+ (args == null || args.length == 0) ? message : String.format(message, args);
63
+ if (throwable != null) {
64
+ formattedMessage += ": " + throwable.getMessage();
65
+ }
66
+ forwardToJS(level, formattedMessage);
67
+ }
68
+
69
+ @Override
70
+ public boolean isEnabled(@Nullable SentryLevel level) {
71
+ return androidLogger.isEnabled(level);
72
+ }
73
+
74
+ private void forwardToJS(@NotNull SentryLevel level, @NotNull String message) {
75
+ ReactApplicationContext context = reactContextRef != null ? reactContextRef.get() : null;
76
+ if (context == null || !context.hasActiveReactInstance()) {
77
+ return;
78
+ }
79
+
80
+ try {
81
+ WritableMap params = Arguments.createMap();
82
+ params.putString("level", level.name().toLowerCase());
83
+ params.putString("component", "Sentry");
84
+ params.putString("message", message);
85
+
86
+ context
87
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
88
+ .emit(EVENT_NAME, params);
89
+ } catch (Exception e) {
90
+ // Silently ignore - don't cause issues if JS bridge isn't ready
91
+ // We intentionally swallow this exception to avoid disrupting the app
92
+ // when the React Native bridge is not yet initialized or has been torn down
93
+ androidLogger.log(SentryLevel.DEBUG, "Failed to forward log to JS: " + e.getMessage());
94
+ }
95
+ }
96
+ }
@@ -40,7 +40,6 @@ import io.sentry.SentryDateProvider;
40
40
  import io.sentry.SentryExecutorService;
41
41
  import io.sentry.SentryLevel;
42
42
  import io.sentry.SentryOptions;
43
- import io.sentry.android.core.AndroidLogger;
44
43
  import io.sentry.android.core.AndroidProfiler;
45
44
  import io.sentry.android.core.BuildInfoProvider;
46
45
  import io.sentry.android.core.InternalSentrySdk;
@@ -87,7 +86,8 @@ public class RNSentryModuleImpl {
87
86
 
88
87
  public static final String NAME = "RNSentry";
89
88
 
90
- private static final ILogger logger = new AndroidLogger(NAME);
89
+ private static final RNSentryLogger rnLogger = new RNSentryLogger();
90
+ private static final ILogger logger = rnLogger;
91
91
  private static final BuildInfoProvider buildInfo = new BuildInfoProvider(logger);
92
92
  private static final String modulesPath = "modules.json";
93
93
  private static final Charset UTF_8 = Charset.forName("UTF-8"); // NOPMD - Allow using UTF-8
@@ -170,8 +170,18 @@ public class RNSentryModuleImpl {
170
170
  }
171
171
 
172
172
  public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
173
+ // Set the React context for the logger so it can forward logs to JS
174
+ rnLogger.setReactContext(this.reactApplicationContext);
175
+
173
176
  RNSentryStart.startWithOptions(
174
- getApplicationContext(), rnOptions, getCurrentActivity(), logger);
177
+ getApplicationContext(),
178
+ rnOptions,
179
+ getCurrentActivity(),
180
+ options -> {
181
+ // Use our custom logger that forwards to JS
182
+ options.setLogger(rnLogger);
183
+ },
184
+ logger);
175
185
 
176
186
  promise.resolve(true);
177
187
  }
@@ -667,7 +677,7 @@ public class RNSentryModuleImpl {
667
677
  tracesFilesDirPath,
668
678
  (int) SECONDS.toMicros(1) / profilingTracesHz,
669
679
  new SentryFrameMetricsCollector(reactApplicationContext, logger, buildInfo),
670
- executorService,
680
+ () -> executorService,
671
681
  logger);
672
682
  }
673
683
 
@@ -49,14 +49,7 @@ final class RNSentryStart {
49
49
  @NotNull final ReadableMap rnOptions,
50
50
  @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration,
51
51
  @NotNull ILogger logger) {
52
- Sentry.OptionsConfiguration<SentryAndroidOptions> defaults =
53
- options -> updateWithReactDefaults(options, null);
54
- Sentry.OptionsConfiguration<SentryAndroidOptions> rnConfigurationOptions =
55
- options -> getSentryAndroidOptions(options, rnOptions, logger);
56
- RNSentryCompositeOptionsConfiguration compositeConfiguration =
57
- new RNSentryCompositeOptionsConfiguration(
58
- rnConfigurationOptions, defaults, configuration, RNSentryStart::updateWithReactFinals);
59
- SentryAndroid.init(context, compositeConfiguration);
52
+ startWithOptions(context, rnOptions, null, configuration, logger);
60
53
  }
61
54
 
62
55
  static void startWithOptions(
@@ -64,13 +57,22 @@ final class RNSentryStart {
64
57
  @NotNull final ReadableMap rnOptions,
65
58
  @Nullable Activity currentActivity,
66
59
  @NotNull ILogger logger) {
60
+ startWithOptions(context, rnOptions, currentActivity, options -> {}, logger);
61
+ }
62
+
63
+ static void startWithOptions(
64
+ @NotNull final Context context,
65
+ @NotNull final ReadableMap rnOptions,
66
+ @Nullable Activity currentActivity,
67
+ @NotNull Sentry.OptionsConfiguration<SentryAndroidOptions> configuration,
68
+ @NotNull ILogger logger) {
67
69
  Sentry.OptionsConfiguration<SentryAndroidOptions> defaults =
68
70
  options -> updateWithReactDefaults(options, currentActivity);
69
71
  Sentry.OptionsConfiguration<SentryAndroidOptions> rnConfigurationOptions =
70
72
  options -> getSentryAndroidOptions(options, rnOptions, logger);
71
73
  RNSentryCompositeOptionsConfiguration compositeConfiguration =
72
74
  new RNSentryCompositeOptionsConfiguration(
73
- rnConfigurationOptions, defaults, RNSentryStart::updateWithReactFinals);
75
+ rnConfigurationOptions, defaults, configuration, RNSentryStart::updateWithReactFinals);
74
76
  SentryAndroid.init(context, compositeConfiguration);
75
77
  }
76
78
 
@@ -2,7 +2,7 @@ package io.sentry.react;
2
2
 
3
3
  class RNSentryVersion {
4
4
  static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5
- static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "8.1.0";
5
+ static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "8.3.0";
6
6
  static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
7
7
  static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
8
8
  static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";
@@ -0,0 +1,16 @@
1
+ import type { NativeLogEntry } from './options';
2
+ /**
3
+ * Sets up the native log listener that forwards logs from the native SDK to JS.
4
+ * This only works when `debug: true` is set in Sentry options.
5
+ *
6
+ * @param callback - The callback to invoke when a native log is received.
7
+ * @returns A function to remove the listener, or undefined if setup failed.
8
+ */
9
+ export declare function setupNativeLogListener(callback: (log: NativeLogEntry) => void): (() => void) | undefined;
10
+ /**
11
+ * Default handler for native logs that uses Sentry's debug logger.
12
+ * This avoids interference with captureConsoleIntegration which would
13
+ * otherwise capture these logs as breadcrumbs or events.
14
+ */
15
+ export declare function defaultNativeLogHandler(log: NativeLogEntry): void;
16
+ //# sourceMappingURL=NativeLogListener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeLogListener.d.ts","sourceRoot":"","sources":["../../src/js/NativeLogListener.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKhD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CA4CxG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAiBjE"}
@@ -0,0 +1,72 @@
1
+ import { debug } from '@sentry/core';
2
+ import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
3
+ import { isExpoGo } from './utils/environment';
4
+ const NATIVE_LOG_EVENT_NAME = 'SentryNativeLog';
5
+ /**
6
+ * Sets up the native log listener that forwards logs from the native SDK to JS.
7
+ * This only works when `debug: true` is set in Sentry options.
8
+ *
9
+ * @param callback - The callback to invoke when a native log is received.
10
+ * @returns A function to remove the listener, or undefined if setup failed.
11
+ */
12
+ export function setupNativeLogListener(callback) {
13
+ if (Platform.OS !== 'ios' && Platform.OS !== 'android') {
14
+ debug.log('Native log listener is only supported on iOS and Android.');
15
+ return undefined;
16
+ }
17
+ if (isExpoGo()) {
18
+ return undefined;
19
+ }
20
+ if (!NativeModules.RNSentry) {
21
+ debug.warn('Could not set up native log listener: RNSentry module not found.');
22
+ return undefined;
23
+ }
24
+ try {
25
+ const eventEmitter = new NativeEventEmitter(NativeModules.RNSentry);
26
+ const listener = eventEmitter.addListener(NATIVE_LOG_EVENT_NAME, (event) => {
27
+ var _a, _b, _c;
28
+ const logEntry = {
29
+ level: (_a = event.level) !== null && _a !== void 0 ? _a : 'info',
30
+ component: (_b = event.component) !== null && _b !== void 0 ? _b : 'Sentry',
31
+ message: (_c = event.message) !== null && _c !== void 0 ? _c : '',
32
+ };
33
+ callback(logEntry);
34
+ });
35
+ debug.log('Native log listener set up successfully.');
36
+ let removed = false;
37
+ return () => {
38
+ if (!removed) {
39
+ listener.remove();
40
+ removed = true;
41
+ debug.log('Native log listener removed.');
42
+ }
43
+ };
44
+ }
45
+ catch (error) {
46
+ debug.warn('Failed to set up native log listener:', error);
47
+ return undefined;
48
+ }
49
+ }
50
+ /**
51
+ * Default handler for native logs that uses Sentry's debug logger.
52
+ * This avoids interference with captureConsoleIntegration which would
53
+ * otherwise capture these logs as breadcrumbs or events.
54
+ */
55
+ export function defaultNativeLogHandler(log) {
56
+ const message = `[Native] [${log.component}] ${log.message}`;
57
+ switch (log.level.toLowerCase()) {
58
+ case 'fatal':
59
+ case 'error':
60
+ debug.error(message);
61
+ break;
62
+ case 'warning':
63
+ debug.warn(message);
64
+ break;
65
+ case 'info':
66
+ case 'debug':
67
+ default:
68
+ debug.log(message);
69
+ break;
70
+ }
71
+ }
72
+ //# sourceMappingURL=NativeLogListener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeLogListener.js","sourceRoot":"","sources":["../../src/js/NativeLogListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAuC;IAC5E,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,KAAK,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACvE,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE;QAC3B,KAAK,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;QAC/E,OAAO,SAAS,CAAC;KAClB;IAED,IAAI;QACF,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAEpE,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CACvC,qBAAqB,EACrB,CAAC,KAA+D,EAAE,EAAE;;YAClE,MAAM,QAAQ,GAAmB;gBAC/B,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,MAAM;gBAC5B,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,QAAQ;gBACtC,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,EAAE;aAC7B,CAAC;YACF,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC,CACF,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QAEtD,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,OAAO,EAAE;gBACZ,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClB,OAAO,GAAG,IAAI,CAAC;gBACf,KAAK,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;aAC3C;QACH,CAAC,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,KAAK,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,SAAS,CAAC;KAClB;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAmB;IACzD,MAAM,OAAO,GAAG,aAAa,GAAG,CAAC,SAAS,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;IAE7D,QAAQ,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE;QAC/B,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,SAAS;YACZ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpB,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb;YACE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACnB,MAAM;KACT;AACH,CAAC","sourcesContent":["import { debug } from '@sentry/core';\nimport { NativeEventEmitter, NativeModules, Platform } from 'react-native';\nimport type { NativeLogEntry } from './options';\nimport { isExpoGo } from './utils/environment';\n\nconst NATIVE_LOG_EVENT_NAME = 'SentryNativeLog';\n\n/**\n * Sets up the native log listener that forwards logs from the native SDK to JS.\n * This only works when `debug: true` is set in Sentry options.\n *\n * @param callback - The callback to invoke when a native log is received.\n * @returns A function to remove the listener, or undefined if setup failed.\n */\nexport function setupNativeLogListener(callback: (log: NativeLogEntry) => void): (() => void) | undefined {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n debug.log('Native log listener is only supported on iOS and Android.');\n return undefined;\n }\n\n if (isExpoGo()) {\n return undefined;\n }\n\n if (!NativeModules.RNSentry) {\n debug.warn('Could not set up native log listener: RNSentry module not found.');\n return undefined;\n }\n\n try {\n const eventEmitter = new NativeEventEmitter(NativeModules.RNSentry);\n\n const listener = eventEmitter.addListener(\n NATIVE_LOG_EVENT_NAME,\n (event: { level?: string; component?: string; message?: string }) => {\n const logEntry: NativeLogEntry = {\n level: event.level ?? 'info',\n component: event.component ?? 'Sentry',\n message: event.message ?? '',\n };\n callback(logEntry);\n },\n );\n\n debug.log('Native log listener set up successfully.');\n\n let removed = false;\n return () => {\n if (!removed) {\n listener.remove();\n removed = true;\n debug.log('Native log listener removed.');\n }\n };\n } catch (error) {\n debug.warn('Failed to set up native log listener:', error);\n return undefined;\n }\n}\n\n/**\n * Default handler for native logs that uses Sentry's debug logger.\n * This avoids interference with captureConsoleIntegration which would\n * otherwise capture these logs as breadcrumbs or events.\n */\nexport function defaultNativeLogHandler(log: NativeLogEntry): void {\n const message = `[Native] [${log.component}] ${log.message}`;\n\n switch (log.level.toLowerCase()) {\n case 'fatal':\n case 'error':\n debug.error(message);\n break;\n case 'warning':\n debug.warn(message);\n break;\n case 'info':\n case 'debug':\n default:\n debug.log(message);\n break;\n }\n}\n"]}
@@ -10,6 +10,7 @@ import type { ReactNativeClientOptions } from './options';
10
10
  export declare class ReactNativeClient extends Client<ReactNativeClientOptions> {
11
11
  private _outcomesBuffer;
12
12
  private _logFlushIdleTimeout;
13
+ private _removeNativeLogListener;
13
14
  /**
14
15
  * Creates a new React Native SDK instance.
15
16
  * @param options Configuration options for this SDK.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/js/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,QAAQ,EACR,KAAK,EACL,SAAS,EAET,aAAa,EACb,4BAA4B,EAC5B,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAGL,MAAM,EAIP,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAW1D;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,wBAAwB,CAAC;IACrE,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,oBAAoB,CAA4C;IAExE;;;OAGG;gBACgB,OAAO,EAAE,wBAAwB;IAsDpD;;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;IAIrG;;;OAGG;IACI,WAAW,IAAI,IAAI;IAI1B;;OAEG;IACI,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC;IAOpC;;;OAGG;IACI,mBAAmB,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAUxD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC,4BAA4B,CAAC;IAiClF;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;;;OAIG;IACI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,IAAI;IAKtD;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,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AAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,IAAI;IAKtD;;;;OAIG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAKnD;;OAEG;IACH,OAAO,CAAC,cAAc;IAqCtB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAShC;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAa9B"}
package/dist/js/client.js CHANGED
@@ -4,6 +4,7 @@ import { Alert } from 'react-native';
4
4
  import { getDevServer } from './integrations/debugsymbolicatorutils';
5
5
  import { defaultSdkInfo } from './integrations/sdkinfo';
6
6
  import { getDefaultSidecarUrl } from './integrations/spotlight';
7
+ import { defaultNativeLogHandler, setupNativeLogListener } from './NativeLogListener';
7
8
  import { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';
8
9
  import { createUserFeedbackEnvelope, items } from './utils/envelope';
9
10
  import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';
@@ -82,6 +83,11 @@ export class ReactNativeClient extends Client {
82
83
  * @inheritDoc
83
84
  */
84
85
  close() {
86
+ // Clean up native log listener
87
+ if (this._removeNativeLogListener) {
88
+ this._removeNativeLogListener();
89
+ this._removeNativeLogListener = undefined;
90
+ }
85
91
  // As super.close() flushes queued events, we wait for that to finish before closing the native SDK.
86
92
  return super.close().then((result) => {
87
93
  return NATIVE.closeNativeSdk().then(() => result);
@@ -161,11 +167,16 @@ export class ReactNativeClient extends Client {
161
167
  * Starts native client with dsn and options
162
168
  */
163
169
  _initNativeSdk() {
164
- var _a, _b, _c, _d;
165
- NATIVE.initNativeSdk(Object.assign(Object.assign({}, this._options), { defaultSidecarUrl: getDefaultSidecarUrl(), devServerUrl: ((_a = getDevServer()) === null || _a === void 0 ? void 0 : _a.url) || '', mobileReplayOptions: this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&
170
+ var _a, _b, _c, _d, _e;
171
+ // Set up native log listener if debug is enabled
172
+ if (this._options.debug) {
173
+ const logHandler = (_a = this._options.onNativeLog) !== null && _a !== void 0 ? _a : defaultNativeLogHandler;
174
+ this._removeNativeLogListener = setupNativeLogListener(logHandler);
175
+ }
176
+ NATIVE.initNativeSdk(Object.assign(Object.assign({}, this._options), { defaultSidecarUrl: getDefaultSidecarUrl(), devServerUrl: ((_b = getDevServer()) === null || _b === void 0 ? void 0 : _b.url) || '', mobileReplayOptions: this._integrations[MOBILE_REPLAY_INTEGRATION_NAME] &&
166
177
  'options' in this._integrations[MOBILE_REPLAY_INTEGRATION_NAME]
167
178
  ? this._integrations[MOBILE_REPLAY_INTEGRATION_NAME].options
168
- : undefined, profilingOptions: (_c = (_b = this._options._experiments) === null || _b === void 0 ? void 0 : _b.profilingOptions) !== null && _c !== void 0 ? _c : (_d = this._options._experiments) === null || _d === void 0 ? void 0 : _d.androidProfilingOptions }))
179
+ : undefined, profilingOptions: (_d = (_c = this._options._experiments) === null || _c === void 0 ? void 0 : _c.profilingOptions) !== null && _d !== void 0 ? _d : (_e = this._options._experiments) === null || _e === void 0 ? void 0 : _e.androidProfilingOptions }))
169
180
  .then((result) => {
170
181
  return result;
171
182
  }, () => {
@@ -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;AAYvE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,EACN,sBAAsB,EACtB,KAAK,EACL,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,8BAA8B,EAAE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AAgB,EACd,MAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,0CAAE,gBAAgB,mCAAI,MAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,0CAAE,uBAAuB,IACrG;aACC,IAAI,CACH,CAAC,MAAe,EAAE,EAAE;YAClB,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,GAAG,EAAE;YACH,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC,CACF;aACA,IAAI,CAAC,CAAC,iBAA0B,EAAE,EAAE;;YACnC,MAAA,MAAA,IAAI,CAAC,QAAQ,EAAC,OAAO,mDAAG,EAAE,iBAAiB,EAAE,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzB,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE;YACvB,KAAK,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,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 type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\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 Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\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(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = {\n ...options._metadata,\n sdk: {\n ...(options._metadata?.sdk || defaultSdkInfo),\n settings: {\n // Only allow IP inferral by Relay if sendDefaultPii is true\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata?.sdk?.settings,\n },\n },\n };\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n\n // enableLogs must be disabled before calling super() to avoid logs being captured.\n // This makes a copy of the user defined value, so we can restore it later for the native usaege.\n const originalEnableLogs = options.enableLogs;\n if (options.enableLogs && options.logsOrigin === 'native') {\n debug.log('disabling Sentry logs on JavaScript due to rule set by logsOrigin');\n options.enableLogs = false;\n }\n\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n // Restore original settings for enabling Native options.\n options.enableLogs = originalEnableLogs;\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);\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);\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\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 debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\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 profilingOptions:\n this._options._experiments?.profilingOptions ?? this._options._experiments?.androidProfilingOptions,\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 this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.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;AAYvE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,MAAM,EACN,sBAAsB,EACtB,KAAK,EACL,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,E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NAA6N,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 type {\n ClientReportEnvelope,\n ClientReportItem,\n Envelope,\n Event,\n EventHint,\n Outcome,\n SeverityLevel,\n TransportMakeRequestResponse,\n UserFeedback,\n} from '@sentry/core';\nimport {\n _INTERNAL_flushLogsBuffer,\n addAutoIpAddressToSession,\n Client,\n dateTimestampInSeconds,\n debug,\n SentryError,\n} from '@sentry/core';\nimport { Alert } from 'react-native';\nimport { getDevServer } from './integrations/debugsymbolicatorutils';\nimport { defaultSdkInfo } from './integrations/sdkinfo';\nimport { getDefaultSidecarUrl } from './integrations/spotlight';\nimport { defaultNativeLogHandler, setupNativeLogListener } from './NativeLogListener';\nimport type { ReactNativeClientOptions } from './options';\nimport type { mobileReplayIntegration } from './replay/mobilereplay';\nimport { MOBILE_REPLAY_INTEGRATION_NAME } from './replay/mobilereplay';\nimport { createUserFeedbackEnvelope, items } from './utils/envelope';\nimport { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';\nimport { mergeOutcomes } from './utils/outcome';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { NATIVE } from './wrapper';\n\nconst DEFAULT_FLUSH_INTERVAL = 5000;\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 Client<ReactNativeClientOptions> {\n private _outcomesBuffer: Outcome[];\n private _logFlushIdleTimeout: ReturnType<typeof setTimeout> | undefined;\n private _removeNativeLogListener: (() => void) | undefined;\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(ReactNativeLibraries.ReactNativeVersion?.version);\n options._metadata = {\n ...options._metadata,\n sdk: {\n ...(options._metadata?.sdk || defaultSdkInfo),\n settings: {\n // Only allow IP inferral by Relay if sendDefaultPii is true\n infer_ip: options.sendDefaultPii ? 'auto' : 'never',\n ...options._metadata?.sdk?.settings,\n },\n },\n };\n\n // We default this to true, as it is the safer scenario\n options.parentSpanIsAlwaysRootSpan =\n options.parentSpanIsAlwaysRootSpan === undefined ? true : options.parentSpanIsAlwaysRootSpan;\n\n // enableLogs must be disabled before calling super() to avoid logs being captured.\n // This makes a copy of the user defined value, so we can restore it later for the native usaege.\n const originalEnableLogs = options.enableLogs;\n if (options.enableLogs && options.logsOrigin === 'native') {\n debug.log('disabling Sentry logs on JavaScript due to rule set by logsOrigin');\n options.enableLogs = false;\n }\n\n super(options);\n\n this._outcomesBuffer = [];\n\n if (options.sendDefaultPii === true) {\n this.on('beforeSendSession', addAutoIpAddressToSession);\n }\n\n if (options.enableLogs) {\n this.on('flush', () => {\n _INTERNAL_flushLogsBuffer(this);\n });\n\n this.on('afterCaptureLog', () => {\n if (this._logFlushIdleTimeout) {\n clearTimeout(this._logFlushIdleTimeout);\n }\n\n this._logFlushIdleTimeout = setTimeout(() => {\n _INTERNAL_flushLogsBuffer(this);\n }, DEFAULT_FLUSH_INTERVAL);\n });\n }\n\n // Restore original settings for enabling Native options.\n options.enableLogs = originalEnableLogs;\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);\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 // Clean up native log listener\n if (this._removeNativeLogListener) {\n this._removeNativeLogListener();\n this._removeNativeLogListener = undefined;\n }\n\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);\n });\n }\n\n /**\n * Sends user feedback to Sentry.\n * @deprecated Use `Sentry.captureFeedback` instead.\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 // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.sendEnvelope(envelope);\n }\n\n /**\n * @inheritdoc\n */\n public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {\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 debug.error('SentryError while sending event, keeping outcomes buffer:', reason);\n } else {\n debug.error('Error while sending event:', reason);\n }\n });\n } else {\n debug.error('Transport disabled');\n }\n\n if (shouldClearOutcomesBuffer) {\n this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact\n }\n\n return Promise.resolve({});\n }\n\n /**\n * @inheritDoc\n */\n public init(): void {\n super.init();\n this._initNativeSdk();\n }\n\n /**\n * Register a hook on this client.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public on(hook: string, callback: unknown): () => void {\n // @ts-expect-error on from the base class doesn't support generic types\n return super.on(hook, callback);\n }\n\n /**\n * Emit a hook that was previously registered via `on()`.\n *\n * (Generic method signature to allow for custom React Native Client events.)\n */\n public emit(hook: string, ...rest: unknown[]): void {\n // @ts-expect-error emit from the base class doesn't support generic types\n super.emit(hook, ...rest);\n }\n\n /**\n * Starts native client with dsn and options\n */\n private _initNativeSdk(): void {\n // Set up native log listener if debug is enabled\n if (this._options.debug) {\n const logHandler = this._options.onNativeLog ?? defaultNativeLogHandler;\n this._removeNativeLogListener = setupNativeLogListener(logHandler);\n }\n\n NATIVE.initNativeSdk({\n ...this._options,\n defaultSidecarUrl: getDefaultSidecarUrl(),\n devServerUrl: getDevServer()?.url || '',\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 profilingOptions:\n this._options._experiments?.profilingOptions ?? this._options._experiments?.androidProfilingOptions,\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 this.emit('afterInit');\n })\n .then(undefined, error => {\n debug.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,10 +1,10 @@
1
1
  export type { Breadcrumb, SdkInfo, Event, Exception, SendFeedbackParams, SeverityLevel, Span, StackFrame, Stacktrace, Thread, User, UserFeedback, ErrorEvent, TransactionEvent, Metric, } from '@sentry/core';
2
- export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
2
+ export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, consoleSandbox, } from '@sentry/core';
3
3
  export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
4
4
  export { logger, consoleLoggingIntegration, featureFlagsIntegration, type FeatureFlagsIntegration, metrics, } from '@sentry/browser';
5
5
  export * from './integrations/exports';
6
6
  export { SDK_NAME, SDK_VERSION } from './version';
7
- export type { ReactNativeOptions } from './options';
7
+ export type { ReactNativeOptions, NativeLogEntry } from './options';
8
8
  export { ReactNativeClient } from './client';
9
9
  export { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';
10
10
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,MAAM,EACN,yBAAyB,EACzB,uBAAuB,EACvB,KAAK,uBAAuB,EAC5B,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE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AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE9G,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
package/dist/js/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, } from '@sentry/core';
1
+ export { addBreadcrumb, addIntegration, captureException, captureEvent, captureFeedback, captureMessage, Scope, setContext, setExtra, setExtras, setTag, setTags, setUser, startInactiveSpan, startSpan, startSpanManual, getActiveSpan, getRootSpan, withActiveSpan, suppressTracing, spanToJSON, spanIsSampled, setMeasurement, getCurrentScope, getGlobalScope, getIsolationScope, getClient, setCurrentClient, addEventProcessor, lastEventId, consoleSandbox, } from '@sentry/core';
2
2
  export { ErrorBoundary, withErrorBoundary, createReduxEnhancer, Profiler, useProfiler, withProfiler, } from '@sentry/react';
3
3
  export { logger, consoleLoggingIntegration, featureFlagsIntegration, metrics, } from '@sentry/browser';
4
4
  export * from './integrations/exports';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb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b,\n SdkInfo,\n Event,\n Exception,\n SendFeedbackParams,\n SeverityLevel,\n Span,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n ErrorEvent,\n TransactionEvent,\n Metric,\n} from '@sentry/core';\n\nexport {\n addBreadcrumb,\n addIntegration,\n captureException,\n captureEvent,\n captureFeedback,\n captureMessage,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n getRootSpan,\n withActiveSpan,\n suppressTracing,\n spanToJSON,\n spanIsSampled,\n setMeasurement,\n getCurrentScope,\n getGlobalScope,\n getIsolationScope,\n getClient,\n setCurrentClient,\n addEventProcessor,\n lastEventId,\n} from '@sentry/core';\n\nexport {\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport {\n logger,\n consoleLoggingIntegration,\n featureFlagsIntegration,\n type FeatureFlagsIntegration,\n metrics,\n} from '@sentry/browser';\n\nexport * from './integrations/exports';\n\nexport { SDK_NAME, SDK_VERSION } from './version';\nexport type { ReactNativeOptions } from './options';\nexport { ReactNativeClient } from './client';\n\nexport { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n reactNativeTracingIntegration,\n getCurrentReactNativeTracingIntegration,\n getReactNativeTracingIntegration,\n reactNavigationIntegration,\n reactNativeNavigationIntegration,\n sentryTraceGesture,\n TimeToInitialDisplay,\n TimeToFullDisplay,\n startTimeToInitialDisplaySpan,\n startTimeToFullDisplaySpan,\n startIdleNavigationSpan,\n startIdleSpan,\n getDefaultIdleNavigationSpanOptions,\n createTimeToFullDisplay,\n createTimeToInitialDisplay,\n wrapExpoRouter,\n} from './tracing';\n\nexport type { TimeToDisplayProps, ExpoRouter } from './tracing';\n\nexport { Mask, Unmask } from './replay/CustomMask';\n\nexport { FeedbackButton } from './feedback/FeedbackButton';\nexport { FeedbackWidget } from './feedback/FeedbackWidget';\nexport { showFeedbackWidget, showFeedbackButton, hideFeedbackButton } from './feedback/FeedbackWidgetManager';\n\nexport { getDataFromUri } from './wrapper';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/js/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,MAAM,EACN,yBAAyB,EACzB,uBAAuB,EAEvB,OAAO,GACR,MAAM,iBAAiB,CAAC;AAEzB,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EACL,6BAA6B,EAC7B,uCAAuC,EACvC,gCAAgC,EAChC,0BAA0B,EAC1B,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,EAC7B,0BAA0B,EAC1B,uBAAuB,EACvB,aAAa,EACb,mCAAmC,EACnC,uBAAuB,EACvB,0BAA0B,EAC1B,cAAc,GACf,MAAM,WAAW,CAAC;AAInB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE9G,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export type {\n Breadcrumb,\n SdkInfo,\n Event,\n Exception,\n SendFeedbackParams,\n SeverityLevel,\n Span,\n StackFrame,\n Stacktrace,\n Thread,\n User,\n UserFeedback,\n ErrorEvent,\n TransactionEvent,\n Metric,\n} from '@sentry/core';\n\nexport {\n addBreadcrumb,\n addIntegration,\n captureException,\n captureEvent,\n captureFeedback,\n captureMessage,\n Scope,\n setContext,\n setExtra,\n setExtras,\n setTag,\n setTags,\n setUser,\n startInactiveSpan,\n startSpan,\n startSpanManual,\n getActiveSpan,\n getRootSpan,\n withActiveSpan,\n suppressTracing,\n spanToJSON,\n spanIsSampled,\n setMeasurement,\n getCurrentScope,\n getGlobalScope,\n getIsolationScope,\n getClient,\n setCurrentClient,\n addEventProcessor,\n lastEventId,\n consoleSandbox,\n} from '@sentry/core';\n\nexport {\n ErrorBoundary,\n withErrorBoundary,\n createReduxEnhancer,\n Profiler,\n useProfiler,\n withProfiler,\n} from '@sentry/react';\n\nexport {\n logger,\n consoleLoggingIntegration,\n featureFlagsIntegration,\n type FeatureFlagsIntegration,\n metrics,\n} from '@sentry/browser';\n\nexport * from './integrations/exports';\n\nexport { SDK_NAME, SDK_VERSION } from './version';\nexport type { ReactNativeOptions, NativeLogEntry } from './options';\nexport { ReactNativeClient } from './client';\n\nexport { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';\nexport { TouchEventBoundary, withTouchEventBoundary } from './touchevents';\n\nexport {\n reactNativeTracingIntegration,\n getCurrentReactNativeTracingIntegration,\n getReactNativeTracingIntegration,\n reactNavigationIntegration,\n reactNativeNavigationIntegration,\n sentryTraceGesture,\n TimeToInitialDisplay,\n TimeToFullDisplay,\n startTimeToInitialDisplaySpan,\n startTimeToFullDisplaySpan,\n startIdleNavigationSpan,\n startIdleSpan,\n getDefaultIdleNavigationSpanOptions,\n createTimeToFullDisplay,\n createTimeToInitialDisplay,\n wrapExpoRouter,\n} from './tracing';\n\nexport type { TimeToDisplayProps, ExpoRouter } from './tracing';\n\nexport { Mask, Unmask } from './replay/CustomMask';\n\nexport { FeedbackButton } from './feedback/FeedbackButton';\nexport { FeedbackWidget } from './feedback/FeedbackWidget';\nexport { showFeedbackWidget, showFeedbackButton, hideFeedbackButton } from './feedback/FeedbackWidgetManager';\n\nexport { getDataFromUri } from './wrapper';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAuC3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAmHvF"}
1
+ {"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/js/integrations/default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAwC3D;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,EAAE,CAoHvF"}
@@ -2,7 +2,7 @@
2
2
  import { browserSessionIntegration, consoleLoggingIntegration } from '@sentry/browser';
3
3
  import { reactNativeTracingIntegration } from '../tracing';
4
4
  import { notWeb } from '../utils/environment';
5
- import { appRegistryIntegration, appStartIntegration, breadcrumbsIntegration, browserApiErrorsIntegration, browserGlobalHandlersIntegration, browserLinkedErrorsIntegration, createNativeFramesIntegrations, createReactNativeRewriteFrames, debugSymbolicatorIntegration, dedupeIntegration, deviceContextIntegration, eventOriginIntegration, expoContextIntegration, functionToStringIntegration, hermesProfilingIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, logEnricherIntegration, mobileReplayIntegration, modulesLoaderIntegration, nativeLinkedErrorsIntegration, nativeReleaseIntegration, primitiveTagIntegration, reactNativeErrorHandlersIntegration, reactNativeInfoIntegration, screenshotIntegration, sdkInfoIntegration, spotlightIntegration, stallTrackingIntegration, timeToDisplayIntegration, userInteractionIntegration, viewHierarchyIntegration, } from './exports';
5
+ import { appRegistryIntegration, appStartIntegration, breadcrumbsIntegration, browserApiErrorsIntegration, browserGlobalHandlersIntegration, browserLinkedErrorsIntegration, createNativeFramesIntegrations, createReactNativeRewriteFrames, debugSymbolicatorIntegration, dedupeIntegration, deviceContextIntegration, eventOriginIntegration, expoConstantsIntegration, expoContextIntegration, functionToStringIntegration, hermesProfilingIntegration, httpClientIntegration, httpContextIntegration, inboundFiltersIntegration, logEnricherIntegration, mobileReplayIntegration, modulesLoaderIntegration, nativeLinkedErrorsIntegration, nativeReleaseIntegration, primitiveTagIntegration, reactNativeErrorHandlersIntegration, reactNativeInfoIntegration, screenshotIntegration, sdkInfoIntegration, spotlightIntegration, stallTrackingIntegration, timeToDisplayIntegration, userInteractionIntegration, viewHierarchyIntegration, } from './exports';
6
6
  /**
7
7
  * Returns the default ReactNative integrations based on the current environment.
8
8
  *
@@ -84,6 +84,7 @@ export function getDefaultIntegrations(options) {
84
84
  integrations.push(httpClientIntegration());
85
85
  }
86
86
  integrations.push(expoContextIntegration());
87
+ integrations.push(expoConstantsIntegration());
87
88
  if (options.spotlight && __DEV__) {
88
89
  const sidecarUrl = typeof options.spotlight === 'string' ? options.spotlight : undefined;
89
90
  integrations.push(spotlightIntegration({ sidecarUrl }));