@sentry/react-native 7.10.0 → 7.12.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 (70) hide show
  1. package/android/libs/replay-stubs.jar +0 -0
  2. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +33 -16
  3. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  4. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +10 -0
  5. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +15 -0
  6. package/dist/js/NativeRNSentry.d.ts +2 -0
  7. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  8. package/dist/js/NativeRNSentry.js.map +1 -1
  9. package/dist/js/client.d.ts.map +1 -1
  10. package/dist/js/client.js +2 -2
  11. package/dist/js/client.js.map +1 -1
  12. package/dist/js/index.d.ts +2 -2
  13. package/dist/js/index.d.ts.map +1 -1
  14. package/dist/js/index.js +1 -1
  15. package/dist/js/index.js.map +1 -1
  16. package/dist/js/integrations/logEnricherIntegration.js +43 -3
  17. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  18. package/dist/js/options.d.ts +18 -10
  19. package/dist/js/options.d.ts.map +1 -1
  20. package/dist/js/options.js.map +1 -1
  21. package/dist/js/scopeSync.d.ts.map +1 -1
  22. package/dist/js/scopeSync.js +27 -0
  23. package/dist/js/scopeSync.js.map +1 -1
  24. package/dist/js/touchevents.d.ts +8 -0
  25. package/dist/js/touchevents.d.ts.map +1 -1
  26. package/dist/js/touchevents.js +33 -1
  27. package/dist/js/touchevents.js.map +1 -1
  28. package/dist/js/tracing/expoRouter.d.ts +25 -0
  29. package/dist/js/tracing/expoRouter.d.ts.map +1 -0
  30. package/dist/js/tracing/expoRouter.js +73 -0
  31. package/dist/js/tracing/expoRouter.js.map +1 -0
  32. package/dist/js/tracing/index.d.ts +2 -0
  33. package/dist/js/tracing/index.d.ts.map +1 -1
  34. package/dist/js/tracing/index.js +1 -0
  35. package/dist/js/tracing/index.js.map +1 -1
  36. package/dist/js/tracing/origin.d.ts +1 -0
  37. package/dist/js/tracing/origin.d.ts.map +1 -1
  38. package/dist/js/tracing/origin.js +1 -0
  39. package/dist/js/tracing/origin.js.map +1 -1
  40. package/dist/js/tracing/reactnavigation.d.ts +9 -1
  41. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  42. package/dist/js/tracing/reactnavigation.js +30 -1
  43. package/dist/js/tracing/reactnavigation.js.map +1 -1
  44. package/dist/js/version.d.ts +1 -1
  45. package/dist/js/version.js +1 -1
  46. package/dist/js/version.js.map +1 -1
  47. package/dist/js/wrapper.d.ts +6 -2
  48. package/dist/js/wrapper.d.ts.map +1 -1
  49. package/dist/js/wrapper.js +38 -4
  50. package/dist/js/wrapper.js.map +1 -1
  51. package/ios/RNSentry.mm +16 -0
  52. package/ios/RNSentryExperimentalOptions.h +8 -0
  53. package/ios/RNSentryExperimentalOptions.m +42 -0
  54. package/ios/RNSentryVersion.m +1 -1
  55. package/ios/SentrySDKWrapper.m +7 -0
  56. package/package.json +9 -9
  57. package/plugin/build/withSentryIOS.js +4 -0
  58. package/scripts/sentry-xcode-debug-files.sh +9 -3
  59. package/scripts/sentry-xcode.sh +8 -3
  60. package/src/js/NativeRNSentry.ts +2 -0
  61. package/ts3.8/dist/js/NativeRNSentry.d.ts +2 -0
  62. package/ts3.8/dist/js/index.d.ts +2 -2
  63. package/ts3.8/dist/js/options.d.ts +18 -10
  64. package/ts3.8/dist/js/touchevents.d.ts +8 -0
  65. package/ts3.8/dist/js/tracing/expoRouter.d.ts +25 -0
  66. package/ts3.8/dist/js/tracing/index.d.ts +2 -0
  67. package/ts3.8/dist/js/tracing/origin.d.ts +1 -0
  68. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +9 -1
  69. package/ts3.8/dist/js/version.d.ts +1 -1
  70. package/ts3.8/dist/js/wrapper.d.ts +6 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "7.10.0",
5
+ "version": "7.12.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -68,21 +68,21 @@
68
68
  "react-native": ">=0.65.0"
69
69
  },
70
70
  "dependencies": {
71
- "@sentry/babel-plugin-component-annotate": "4.7.0",
72
- "@sentry/browser": "10.36.0",
71
+ "@sentry/babel-plugin-component-annotate": "4.9.0",
72
+ "@sentry/browser": "10.38.0",
73
73
  "@sentry/cli": "2.58.4",
74
- "@sentry/core": "10.36.0",
75
- "@sentry/react": "10.36.0",
76
- "@sentry/types": "10.36.0"
74
+ "@sentry/core": "10.38.0",
75
+ "@sentry/react": "10.38.0",
76
+ "@sentry/types": "10.38.0"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@babel/core": "^7.26.7",
80
80
  "@expo/metro-config": "~0.20.0",
81
81
  "@mswjs/interceptors": "^0.25.15",
82
82
  "@react-native/babel-preset": "0.80.0",
83
- "@sentry-internal/eslint-config-sdk": "10.36.0",
84
- "@sentry-internal/eslint-plugin-sdk": "10.36.0",
85
- "@sentry-internal/typescript": "10.36.0",
83
+ "@sentry-internal/eslint-config-sdk": "10.38.0",
84
+ "@sentry-internal/eslint-plugin-sdk": "10.38.0",
85
+ "@sentry-internal/typescript": "10.38.0",
86
86
  "@sentry/wizard": "6.11.0",
87
87
  "@testing-library/react-native": "^13.2.2",
88
88
  "@types/jest": "^29.5.13",
@@ -37,6 +37,10 @@ const withSentryIOS = (config, sentryProperties) => {
37
37
  xcodeProject.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
38
38
  shellPath: '/bin/sh',
39
39
  shellScript: `/bin/sh ${SENTRY_REACT_NATIVE_XCODE_DEBUG_FILES_PATH}`,
40
+ inputPaths: [
41
+ '"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)/Contents/Resources/DWARF/$(PRODUCT_NAME)"',
42
+ '"$(DWARF_DSYM_FOLDER_PATH)/$(DWARF_DSYM_FILE_NAME)"',
43
+ ],
40
44
  });
41
45
  }
42
46
  const bundleReactNativePhase = xcodeProject.pbxItemByComment('Bundle React Native code and images', 'PBXShellScriptBuildPhase');
@@ -70,11 +70,17 @@ else
70
70
  # 'warning:' triggers a warning in Xcode, 'error:' triggers an error
71
71
  set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
72
72
  SENTRY_UPLOAD_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $UPLOAD_DEBUG_FILES" 2>&1)
73
- if [ $? -eq 0 ]; then
73
+ UPLOAD_EXIT_CODE=$?
74
+ if [ $UPLOAD_EXIT_CODE -eq 0 ]; then
74
75
  echo "$SENTRY_UPLOAD_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
75
76
  else
76
- echo "error: sentry-cli - To disable native debug files auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
77
- echo "error: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT"
77
+ if [ "$SENTRY_ALLOW_FAILURE" == true ]; then
78
+ echo "warning: sentry-cli - Debug files upload failed, but continuing build because SENTRY_ALLOW_FAILURE=true"
79
+ echo "warning: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT"
80
+ else
81
+ echo "error: sentry-cli - To disable native debug files auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
82
+ echo "error: sentry-cli - $SENTRY_UPLOAD_COMMAND_OUTPUT"
83
+ fi
78
84
  fi
79
85
  set -x -e # re-enable
80
86
  fi
@@ -56,9 +56,14 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
56
56
  if [ $? -eq 0 ]; then
57
57
  echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
58
58
  else
59
- echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
60
- echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
61
- exitCode=1
59
+ if [ "$SENTRY_ALLOW_FAILURE" == true ]; then
60
+ echo "warning: sentry-cli - Source maps upload failed, but continuing build because SENTRY_ALLOW_FAILURE=true"
61
+ echo "warning: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
62
+ else
63
+ echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
64
+ echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
65
+ exitCode=1
66
+ fi
62
67
  fi
63
68
  set -x -e # re-enable
64
69
  else
@@ -32,6 +32,8 @@ export interface Spec extends TurboModule {
32
32
  setContext(key: string, value: UnsafeObject | null): void;
33
33
  setExtra(key: string, value: string): void;
34
34
  setTag(key: string, value: string): void;
35
+ setAttribute(key: string, value: string): void;
36
+ setAttributes(attributes: UnsafeObject): void;
35
37
  enableNativeFramesTracking(): void;
36
38
  fetchModules(): Promise<string | undefined | null>;
37
39
  fetchViewHierarchy(): Promise<number[] | undefined | null>;
@@ -25,6 +25,8 @@ export interface Spec extends TurboModule {
25
25
  setContext(key: string, value: UnsafeObject | null): void;
26
26
  setExtra(key: string, value: string): void;
27
27
  setTag(key: string, value: string): void;
28
+ setAttribute(key: string, value: string): void;
29
+ setAttributes(attributes: UnsafeObject): void;
28
30
  enableNativeFramesTracking(): void;
29
31
  fetchModules(): Promise<string | undefined | null>;
30
32
  fetchViewHierarchy(): Promise<number[] | undefined | null>;
@@ -9,8 +9,8 @@ export type { ReactNativeOptions } from './options';
9
9
  export { ReactNativeClient } from './client';
10
10
  export { init, wrap, nativeCrash, flush, close, withScope, crashedLastRun } from './sdk';
11
11
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
12
- export { reactNativeTracingIntegration, getCurrentReactNativeTracingIntegration, getReactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions, createTimeToFullDisplay, createTimeToInitialDisplay, } from './tracing';
13
- export type { TimeToDisplayProps } from './tracing';
12
+ export { reactNativeTracingIntegration, getCurrentReactNativeTracingIntegration, getReactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions, createTimeToFullDisplay, createTimeToInitialDisplay, wrapExpoRouter, } from './tracing';
13
+ export type { TimeToDisplayProps, ExpoRouter } from './tracing';
14
14
  export { Mask, Unmask } from './replay/CustomMask';
15
15
  export { FeedbackButton } from './feedback/FeedbackButton';
16
16
  export { FeedbackWidget } from './feedback/FeedbackWidget';
@@ -252,16 +252,25 @@ export interface BaseReactNativeOptions {
252
252
  * @platform ios
253
253
  */
254
254
  enableUnhandledCPPExceptionsV2?: boolean;
255
+ /**
256
+ * Configuration options for UI profiling.
257
+ * It supports two modes: `manual` and `trace`.
258
+ * - In `trace` mode, the profiler runs based on active sampled spans.
259
+ * - In `manual` mode, profiling is controlled via start/stop API calls.
260
+ *
261
+ * @experimental
262
+ */
263
+ profilingOptions?: ProfilingOptions;
255
264
  /**
256
265
  * Configuration options for Android UI profiling.
257
- * UI profiling supports two modes: `manual` and `trace`.
266
+ * It supports two modes: `manual` and `trace`.
258
267
  * - In `trace` mode, the profiler runs based on active sampled spans.
259
268
  * - In `manual` mode, profiling is controlled via start/stop API calls.
260
269
  *
261
270
  * @experimental
262
- * @platform android
271
+ * @deprecated Use `profilingOptions` instead. This option will be removed in the next major version.
263
272
  */
264
- androidProfilingOptions?: AndroidProfilingOptions;
273
+ androidProfilingOptions?: ProfilingOptions;
265
274
  };
266
275
  /**
267
276
  * This options changes the placement of the attached stacktrace of `captureMessage` in the event.
@@ -295,18 +304,17 @@ export interface BaseReactNativeOptions {
295
304
  }
296
305
  export type SentryReplayQuality = 'low' | 'medium' | 'high';
297
306
  /**
298
- * Android UI profiling lifecycle modes.
307
+ * UI profiling lifecycle modes.
299
308
  * - `trace`: Profiler runs based on active sampled spans
300
309
  * - `manual`: Profiler is controlled manually via start/stop API calls
301
310
  */
302
- export type AndroidProfilingLifecycle = 'trace' | 'manual';
311
+ export type ProfilingLifecycle = 'trace' | 'manual';
303
312
  /**
304
- * Configuration options for Android UI profiling.
313
+ * Configuration options for UI profiling.
305
314
  *
306
315
  * @experimental
307
- * @platform android
308
316
  */
309
- export interface AndroidProfilingOptions {
317
+ export interface ProfilingOptions {
310
318
  /**
311
319
  * Sample rate for profiling sessions.
312
320
  * This is evaluated once per session and determines if profiling should be enabled for that session.
@@ -320,9 +328,9 @@ export interface AndroidProfilingOptions {
320
328
  * - `trace`: Profiler runs while there is at least one active sampled span
321
329
  * - `manual`: Profiler is controlled manually via Sentry.profiler.startProfiler/stopProfiler
322
330
  *
323
- * @default 'trace'
331
+ * @default 'manual'
324
332
  */
325
- lifecycle?: AndroidProfilingLifecycle;
333
+ lifecycle?: ProfilingLifecycle;
326
334
  /**
327
335
  * Enable profiling on app start.
328
336
  * - In `trace` mode: The app start profile stops automatically when the app start root span finishes
@@ -1,3 +1,4 @@
1
+ import type { SpanAttributeValue } from '@sentry/core';
1
2
  import * as React from 'react';
2
3
  export type TouchEventBoundaryProps = {
3
4
  /**
@@ -30,6 +31,13 @@ export type TouchEventBoundaryProps = {
30
31
  * Label Name used to identify the touched element.
31
32
  */
32
33
  labelName?: string;
34
+ /**
35
+ * Custom attributes to add to user interaction spans.
36
+ * Accepts an object with string keys and values that are strings, numbers, booleans, or arrays.
37
+ *
38
+ * @experimental This API is experimental and may change in future releases.
39
+ */
40
+ spanAttributes?: Record<string, SpanAttributeValue>;
33
41
  };
34
42
  /**
35
43
  * Boundary to log breadcrumbs for interaction events.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Type definition for Expo Router's router object
3
+ */
4
+ export interface ExpoRouter {
5
+ prefetch?: (href: string | {
6
+ pathname?: string;
7
+ params?: Record<string, unknown>;
8
+ }) => void | Promise<void>;
9
+ push?: (...args: unknown[]) => void;
10
+ replace?: (...args: unknown[]) => void;
11
+ back?: () => void;
12
+ navigate?: (...args: unknown[]) => void;
13
+ }
14
+ /**
15
+ * Wraps Expo Router. It currently only does one thing: extends prefetch() method
16
+ * to add automated performance monitoring.
17
+ *
18
+ * This function instruments the `prefetch` method of an Expo Router instance
19
+ * to create performance spans that measure how long route prefetching takes.
20
+ *
21
+ * @param router - The Expo Router instance from `useRouter()` hook
22
+ * @returns The same router instance with an instrumented prefetch method
23
+ */
24
+ export declare function wrapExpoRouter<T extends ExpoRouter>(router: T): T;
25
+ //# sourceMappingURL=expoRouter.d.ts.map
@@ -2,6 +2,8 @@ export { reactNativeTracingIntegration, INTEGRATION_NAME as REACT_NATIVE_TRACING
2
2
  export type { ReactNativeTracingIntegration } from './reactnativetracing';
3
3
  export { reactNavigationIntegration } from './reactnavigation';
4
4
  export { reactNativeNavigationIntegration } from './reactnativenavigation';
5
+ export { wrapExpoRouter } from './expoRouter';
6
+ export type { ExpoRouter } from './expoRouter';
5
7
  export { startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions } from './span';
6
8
  export type { ReactNavigationCurrentRoute, ReactNavigationRoute } from './types';
7
9
  export { ReactNativeProfiler } from './reactnativeprofiler';
@@ -7,4 +7,5 @@ export declare const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = "auto.naviga
7
7
  export declare const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = "auto.navigation.custom";
8
8
  export declare const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = "auto.ui.time_to_display";
9
9
  export declare const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = "manual.ui.time_to_display";
10
+ export declare const SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH = "auto.expo_router.prefetch";
10
11
  //# sourceMappingURL=origin.d.ts.map
@@ -41,6 +41,14 @@ interface ReactNavigationIntegrationOptions {
41
41
  * @default false
42
42
  */
43
43
  useFullPathsForNavigationRoutes: boolean;
44
+ /**
45
+ * Track performance of route prefetching operations.
46
+ * Creates separate spans for PRELOAD actions to measure prefetch performance.
47
+ * This is useful for Expo Router apps that use the prefetch functionality.
48
+ *
49
+ * @default false
50
+ */
51
+ enablePrefetchTracking: boolean;
44
52
  }
45
53
  /**
46
54
  * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.
@@ -50,7 +58,7 @@ interface ReactNavigationIntegrationOptions {
50
58
  * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
51
59
  * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.
52
60
  */
53
- export declare const reactNavigationIntegration: ({ routeChangeTimeoutMs, enableTimeToInitialDisplay, ignoreEmptyBackNavigationTransactions, enableTimeToInitialDisplayForPreloadedRoutes, useDispatchedActionData, useFullPathsForNavigationRoutes, }?: Partial<ReactNavigationIntegrationOptions>) => Integration & {
61
+ export declare const reactNavigationIntegration: ({ routeChangeTimeoutMs, enableTimeToInitialDisplay, ignoreEmptyBackNavigationTransactions, enableTimeToInitialDisplayForPreloadedRoutes, useDispatchedActionData, useFullPathsForNavigationRoutes, enablePrefetchTracking, }?: Partial<ReactNavigationIntegrationOptions>) => Integration & {
54
62
  /**
55
63
  * Pass the ref to the navigation container to register it to the instrumentation
56
64
  * @param navigationContainerRef Ref to a `NavigationContainer`
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "7.10.0";
3
+ export declare const SDK_VERSION = "7.12.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { Breadcrumb, Envelope, EnvelopeItem, Event, Package, Primitive, SeverityLevel, User } from '@sentry/core';
2
2
  import { Platform } from 'react-native';
3
3
  import type { NativeAppStartResponse, NativeDeviceContextsResponse, NativeFramesResponse, NativeReleaseResponse, NativeStackFrames, Spec } from './NativeRNSentry';
4
- import type { AndroidProfilingOptions, ReactNativeClientOptions } from './options';
4
+ import type { ProfilingOptions, ReactNativeClientOptions } from './options';
5
5
  import type * as Hermes from './profiling/hermes';
6
6
  import type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';
7
7
  import type { MobileReplayOptions } from './replay/mobilereplay';
@@ -21,7 +21,9 @@ export type NativeSdkOptions = Partial<ReactNativeClientOptions> & {
21
21
  ignoreErrorsRegex?: string[] | undefined;
22
22
  } & {
23
23
  mobileReplayOptions: MobileReplayOptions | undefined;
24
- androidProfilingOptions?: AndroidProfilingOptions | undefined;
24
+ profilingOptions?: ProfilingOptions | undefined;
25
+ /** @deprecated Use `profilingOptions` instead. */
26
+ androidProfilingOptions?: ProfilingOptions | undefined;
25
27
  };
26
28
  interface SentryNativeWrapper {
27
29
  enableNative: boolean;
@@ -60,6 +62,8 @@ interface SentryNativeWrapper {
60
62
  setExtra(key: string, extra: unknown): void;
61
63
  setUser(user: User | null): void;
62
64
  setTag(key: string, value?: string): void;
65
+ setAttribute(key: string, value: string | number | boolean): void;
66
+ setAttributes(attributes: Record<string, string | number | boolean>): void;
63
67
  nativeCrash(): void;
64
68
  fetchModules(): Promise<Record<string, string> | null>;
65
69
  fetchViewHierarchy(): PromiseLike<Uint8Array | null>;