@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
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAuZ/C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoB;IAC3D,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE;QACpC,yCAAyC;QACzC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,oEAAoE;QACpE,OAAO,KAAK,CAAC;KACd;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,yDAAyD;QACzD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { makeFetchTransport } from '@sentry/browser';\nimport type { CaptureContext, ClientOptions, Event, EventHint, Options } from '@sentry/core';\nimport type { BrowserOptions, Profiler } from '@sentry/react';\nimport type * as React from 'react';\nimport { Platform } from 'react-native';\nimport type { TouchEventBoundaryProps } from './touchevents';\nimport { isExpoGo } from './utils/environment';\n\ntype ProfilerProps = React.ComponentProps<typeof Profiler>;\ntype BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];\n\ntype BrowserExperiments = NonNullable<BrowserOptions['_experiments']>;\ntype SharedExperimentsSubset = BrowserExperiments;\n\nexport interface BaseReactNativeOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable NDK on Android\n *\n * @default true\n * @platform android\n */\n enableNdk?: boolean;\n\n /** Enable scope sync from Java to NDK on Android\n * Only has an effect if `enableNdk` is `true`.\n *\n * @platform android\n */\n enableNdkScopeSync?: boolean;\n\n /**\n * When enabled, all the threads are automatically attached to all logged events on Android\n *\n * @platform android\n */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. Renamed from `enableAutoPerformanceTracking` in v5. */\n enableAutoPerformanceTracing?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * Renamed from `enableOutOfMemoryTracking` in v5.\n *\n * @default true\n * @platform ios\n */\n enableWatchdogTerminationTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n\n /**\n * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.\n * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.\n * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections\n *\n * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.\n *\n * @default true\n */\n patchGlobalPromise?: boolean;\n\n /**\n * The max cache items for capping the number of envelopes.\n *\n * @default 30\n */\n maxCacheItems?: number;\n\n /**\n * When enabled, the SDK tracks when the application stops responding for a specific amount of\n * time defined by the `appHangTimeoutInterval` option.\n *\n * iOS only\n *\n * @default true\n * @platform ios\n */\n enableAppHangTracking?: boolean;\n\n /**\n * The minimum amount of time an app should be unresponsive to be classified as an App Hanging.\n * The actual amount may be a little longer.\n * Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.\n * Value should be in seconds.\n *\n * iOS only\n *\n * @default 2\n * @platform ios\n */\n appHangTimeoutInterval?: number;\n\n /**\n * The max queue size for capping the number of envelopes waiting to be sent by Transport.\n */\n maxQueueSize?: number;\n\n /**\n * When enabled and a user experiences an error, Sentry provides the ability to take a screenshot and include it as an attachment.\n *\n * @default false\n */\n attachScreenshot?: boolean;\n\n /**\n * When enabled Sentry includes the current view hierarchy in the error attachments.\n *\n * @default false\n */\n attachViewHierarchy?: boolean;\n\n /**\n * When enabled, Sentry will capture failed XHR/Fetch requests. This option also enabled HTTP Errors on iOS.\n * [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/)\n * is needed to capture HTTP Errors on Android.\n *\n * @default false\n */\n enableCaptureFailedRequests?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n\n /**\n * Sets a callback which is executed before capturing screenshots. Only\n * relevant if `attachScreenshot` is set to true. When false is returned\n * from the function, no screenshot will be attached.\n */\n beforeScreenshot?: (event: Event, hint: EventHint) => boolean;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Requires performance monitoring to be enabled.\n *\n * @default true\n */\n enableAppStartTracking?: boolean;\n\n /**\n * Track the slow and frozen frames in the application. Enabling this options will add\n * slow and frozen frames measurements to all created root spans (transactions).\n *\n * @default true\n */\n enableNativeFramesTracking?: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n *\n * @default true\n */\n enableStallTracking?: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n *\n * @default false\n */\n enableUserInteractionTracing?: boolean;\n\n /**\n * The sample rate for profiling\n * 1.0 will profile all transactions and 0 will profile none.\n */\n profilesSampleRate?: number;\n\n /**\n * The sample rate for session-long replays.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * The sample rate for sessions that has had an error occur.\n * This is independent of `sessionSampleRate`.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause\n * problems for sending events from command line applications. Setting it too\n * high can cause the application to block for users with network connectivity\n * problems.\n */\n shutdownTimeout?: number;\n\n /**\n * Defines the quality of the session replay. The higher the quality, the more accurate the replay\n * will be, but also more data to transfer and more CPU load.\n *\n * @default 'medium'\n */\n replaysSessionQuality?: SentryReplayQuality;\n\n /**\n * Options which are in beta, or otherwise not guaranteed to be stable.\n */\n _experiments?: SharedExperimentsSubset & {\n [key: string]: unknown;\n\n /**\n * @deprecated Use `replaysSessionSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * @deprecated Use `replaysOnErrorSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Experiment: A more reliable way to report unhandled C++ exceptions in iOS.\n *\n * This approach hooks into all instances of the `__cxa_throw` function, which provides a more comprehensive and consistent exception handling across an app's runtime, regardless of the number of C++ modules or how they're linked. It helps in obtaining accurate stack traces.\n *\n * - Note: The mechanism of hooking into `__cxa_throw` could cause issues with symbolication on iOS due to caching of symbol references.\n *\n * @default false\n * @platform ios\n */\n enableUnhandledCPPExceptionsV2?: boolean;\n\n /**\n * Configuration options for Android UI profiling.\n * UI profiling supports two modes: `manual` and `trace`.\n * - In `trace` mode, the profiler runs based on active sampled spans.\n * - In `manual` mode, profiling is controlled via start/stop API calls.\n *\n * @experimental\n * @platform android\n */\n androidProfilingOptions?: AndroidProfilingOptions;\n };\n\n /**\n * This options changes the placement of the attached stacktrace of `captureMessage` in the event.\n *\n * @default false\n * @deprecated This option will be removed in the next major version. Use `beforeSend` instead.\n */\n useThreadsForMessageStack?: boolean;\n\n /**\n * If set to `true`, the SDK propagates the W3C `traceparent` header to any outgoing requests,\n * in addition to the `sentry-trace` and `baggage` headers. Use the {@link CoreOptions.tracePropagationTargets}\n * option to control to which outgoing requests the header will be attached.\n *\n * **Important:** If you set this option to `true`, make sure that you configured your servers'\n * CORS settings to allow the `traceparent` header. Otherwise, requests might get blocked.\n *\n * @see https://www.w3.org/TR/trace-context/\n *\n * @default false\n */\n propagateTraceparent?: boolean;\n\n /**\n * Controls which log origin is captured when `enableLogs` is set to true.\n * 'all' will log all origins.\n * 'js' will capture only JavaScript logs.\n * 'native' will capture only native logs.\n *\n * @default 'all'\n */\n logsOrigin?: 'all' | 'js' | 'native';\n}\n\nexport type SentryReplayQuality = 'low' | 'medium' | 'high';\n\n/**\n * Android UI profiling lifecycle modes.\n * - `trace`: Profiler runs based on active sampled spans\n * - `manual`: Profiler is controlled manually via start/stop API calls\n */\nexport type AndroidProfilingLifecycle = 'trace' | 'manual';\n\n/**\n * Configuration options for Android UI profiling.\n *\n * @experimental\n * @platform android\n */\nexport interface AndroidProfilingOptions {\n /**\n * Sample rate for profiling sessions.\n * This is evaluated once per session and determines if profiling should be enabled for that session.\n * 1.0 will enable profiling for all sessions, 0.0 will disable profiling.\n *\n * @default undefined (profiling disabled)\n */\n profileSessionSampleRate?: number;\n\n /**\n * Profiling lifecycle mode.\n * - `trace`: Profiler runs while there is at least one active sampled span\n * - `manual`: Profiler is controlled manually via Sentry.profiler.startProfiler/stopProfiler\n *\n * @default 'trace'\n */\n lifecycle?: AndroidProfilingLifecycle;\n\n /**\n * Enable profiling on app start.\n * - In `trace` mode: The app start profile stops automatically when the app start root span finishes\n * - In `manual` mode: The app start profile must be stopped through Sentry.profiler.stopProfiler()\n *\n * @default false\n */\n startOnAppStart?: boolean;\n}\n\nexport interface ReactNativeTransportOptions extends BrowserTransportOptions {\n /**\n * @deprecated use `maxQueueSize` in the root of the SDK options.\n */\n bufferSize?: number;\n}\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions\n extends Omit<Options<ReactNativeTransportOptions>, '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeClientOptions\n extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel' | '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: Omit<ProfilerProps, 'updateProps' | 'children' | 'name'>;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n\n/**\n * If the user has not explicitly set `enableNativeNagger`\n * the function enables native nagging based on the current\n * environment.\n */\nexport function shouldEnableNativeNagger(userOptions: unknown): boolean {\n if (typeof userOptions === 'boolean') {\n // User can override the default behavior\n return userOptions;\n }\n\n if (Platform.OS === 'web' || Platform.OS === 'windows') {\n // We don't want to nag on known platforms that don't support native\n return false;\n }\n\n if (isExpoGo()) {\n // If the app is running in Expo Go, we don't want to nag\n return false;\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/js/options.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAga/C;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoB;IAC3D,IAAI,OAAO,WAAW,KAAK,SAAS,EAAE;QACpC,yCAAyC;QACzC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QACtD,oEAAoE;QACpE,OAAO,KAAK,CAAC;KACd;IAED,IAAI,QAAQ,EAAE,EAAE;QACd,yDAAyD;QACzD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { makeFetchTransport } from '@sentry/browser';\nimport type { CaptureContext, ClientOptions, Event, EventHint, Options } from '@sentry/core';\nimport type { BrowserOptions, Profiler } from '@sentry/react';\nimport type * as React from 'react';\nimport { Platform } from 'react-native';\nimport type { TouchEventBoundaryProps } from './touchevents';\nimport { isExpoGo } from './utils/environment';\n\ntype ProfilerProps = React.ComponentProps<typeof Profiler>;\ntype BrowserTransportOptions = Parameters<typeof makeFetchTransport>[0];\n\ntype BrowserExperiments = NonNullable<BrowserOptions['_experiments']>;\ntype SharedExperimentsSubset = BrowserExperiments;\n\nexport interface BaseReactNativeOptions {\n /**\n * Enables native transport + device info + offline caching.\n * Be careful, disabling this also breaks automatic release setting.\n * This means you have to manage setting the release yourself.\n * Defaults to `true`.\n */\n enableNative?: boolean;\n\n /**\n * Enables native crashHandling. This only works if `enableNative` is `true`.\n * Defaults to `true`.\n */\n enableNativeCrashHandling?: boolean;\n\n /**\n * Initializes the native SDK on init.\n * Set this to `false` if you have an existing native SDK and don't want to re-initialize.\n *\n * NOTE: Be careful and only use this if you know what you are doing.\n * If you use this flag, make sure a native SDK is running before the JS Engine initializes or events might not be captured.\n * Also, make sure the DSN on both the React Native side and the native side are the same one.\n * We strongly recommend checking the documentation if you need to use this.\n *\n * @default true\n */\n autoInitializeNativeSdk?: boolean;\n\n /** Should the native nagger alert be shown or not. */\n enableNativeNagger?: boolean;\n\n /** Should sessions be tracked to Sentry Health or not. */\n enableAutoSessionTracking?: boolean;\n\n /** The interval to end a session if the App goes to the background. */\n sessionTrackingIntervalMillis?: number;\n\n /** Enable NDK on Android\n *\n * @default true\n * @platform android\n */\n enableNdk?: boolean;\n\n /** Enable scope sync from Java to NDK on Android\n * Only has an effect if `enableNdk` is `true`.\n *\n * @platform android\n */\n enableNdkScopeSync?: boolean;\n\n /**\n * When enabled, all the threads are automatically attached to all logged events on Android\n *\n * @platform android\n */\n attachThreads?: boolean;\n\n /**\n * When enabled, certain personally identifiable information (PII) is added by active integrations.\n *\n * @default false\n */\n sendDefaultPii?: boolean;\n\n /**\n * Callback that is called after the RN SDK on the JS Layer has made contact with the Native Layer.\n */\n onReady?: (response: {\n /** `true` if the native SDK has been initialized, `false` otherwise. */\n didCallNativeInit: boolean;\n }) => void;\n\n /** Enable auto performance tracking by default. Renamed from `enableAutoPerformanceTracking` in v5. */\n enableAutoPerformanceTracing?: boolean;\n\n /**\n * Enables Out of Memory Tracking for iOS and macCatalyst.\n * See the following link for more information and possible restrictions:\n * https://docs.sentry.io/platforms/apple/guides/ios/configuration/out-of-memory/\n *\n * Renamed from `enableOutOfMemoryTracking` in v5.\n *\n * @default true\n * @platform ios\n */\n enableWatchdogTerminationTracking?: boolean;\n\n /**\n * Set data to the inital scope\n * @deprecated Use `Sentry.configureScope(...)`\n */\n initialScope?: CaptureContext;\n\n /**\n * When enabled, Sentry will overwrite the global Promise instance to ensure that unhandled rejections are correctly tracked.\n * If you run into issues with Promise polyfills such as `core-js`, make sure you polyfill after Sentry is initialized.\n * Read more at https://docs.sentry.io/platforms/react-native/troubleshooting/#unhandled-promise-rejections\n *\n * When disabled, this option will not disable unhandled rejection tracking. Set `onunhandledrejection: false` on the `ReactNativeErrorHandlers` integration instead.\n *\n * @default true\n */\n patchGlobalPromise?: boolean;\n\n /**\n * The max cache items for capping the number of envelopes.\n *\n * @default 30\n */\n maxCacheItems?: number;\n\n /**\n * When enabled, the SDK tracks when the application stops responding for a specific amount of\n * time defined by the `appHangTimeoutInterval` option.\n *\n * iOS only\n *\n * @default true\n * @platform ios\n */\n enableAppHangTracking?: boolean;\n\n /**\n * The minimum amount of time an app should be unresponsive to be classified as an App Hanging.\n * The actual amount may be a little longer.\n * Avoid using values lower than 100ms, which may cause a lot of app hangs events being transmitted.\n * Value should be in seconds.\n *\n * iOS only\n *\n * @default 2\n * @platform ios\n */\n appHangTimeoutInterval?: number;\n\n /**\n * The max queue size for capping the number of envelopes waiting to be sent by Transport.\n */\n maxQueueSize?: number;\n\n /**\n * When enabled and a user experiences an error, Sentry provides the ability to take a screenshot and include it as an attachment.\n *\n * @default false\n */\n attachScreenshot?: boolean;\n\n /**\n * When enabled Sentry includes the current view hierarchy in the error attachments.\n *\n * @default false\n */\n attachViewHierarchy?: boolean;\n\n /**\n * When enabled, Sentry will capture failed XHR/Fetch requests. This option also enabled HTTP Errors on iOS.\n * [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/)\n * is needed to capture HTTP Errors on Android.\n *\n * @default false\n */\n enableCaptureFailedRequests?: boolean;\n\n /**\n * If you use Spotlight by Sentry during development, use\n * this option to forward captured Sentry events to Spotlight.\n *\n * Either set it to true, or provide a specific Spotlight Sidecar URL.\n *\n * More details: https://spotlightjs.com/\n *\n * IMPORTANT: Only set this option to `true` while developing, not in production!\n */\n spotlight?: boolean | string;\n\n /**\n * Sets a callback which is executed before capturing screenshots. Only\n * relevant if `attachScreenshot` is set to true. When false is returned\n * from the function, no screenshot will be attached.\n */\n beforeScreenshot?: (event: Event, hint: EventHint) => boolean;\n\n /**\n * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation\n * an app start transaction will be started.\n *\n * Requires performance monitoring to be enabled.\n *\n * @default true\n */\n enableAppStartTracking?: boolean;\n\n /**\n * Track the slow and frozen frames in the application. Enabling this options will add\n * slow and frozen frames measurements to all created root spans (transactions).\n *\n * @default true\n */\n enableNativeFramesTracking?: boolean;\n\n /**\n * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.\n *\n * @default true\n */\n enableStallTracking?: boolean;\n\n /**\n * Trace User Interaction events like touch and gestures.\n *\n * @default false\n */\n enableUserInteractionTracing?: boolean;\n\n /**\n * The sample rate for profiling\n * 1.0 will profile all transactions and 0 will profile none.\n */\n profilesSampleRate?: number;\n\n /**\n * The sample rate for session-long replays.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * The sample rate for sessions that has had an error occur.\n * This is independent of `sessionSampleRate`.\n * 1.0 will record all sessions and 0 will record none.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause\n * problems for sending events from command line applications. Setting it too\n * high can cause the application to block for users with network connectivity\n * problems.\n */\n shutdownTimeout?: number;\n\n /**\n * Defines the quality of the session replay. The higher the quality, the more accurate the replay\n * will be, but also more data to transfer and more CPU load.\n *\n * @default 'medium'\n */\n replaysSessionQuality?: SentryReplayQuality;\n\n /**\n * Options which are in beta, or otherwise not guaranteed to be stable.\n */\n _experiments?: SharedExperimentsSubset & {\n [key: string]: unknown;\n\n /**\n * @deprecated Use `replaysSessionSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysSessionSampleRate?: number;\n\n /**\n * @deprecated Use `replaysOnErrorSampleRate` in the options root instead.\n *\n * This will be removed in the next major version.\n */\n replaysOnErrorSampleRate?: number;\n\n /**\n * Experiment: A more reliable way to report unhandled C++ exceptions in iOS.\n *\n * This approach hooks into all instances of the `__cxa_throw` function, which provides a more comprehensive and consistent exception handling across an app's runtime, regardless of the number of C++ modules or how they're linked. It helps in obtaining accurate stack traces.\n *\n * - Note: The mechanism of hooking into `__cxa_throw` could cause issues with symbolication on iOS due to caching of symbol references.\n *\n * @default false\n * @platform ios\n */\n enableUnhandledCPPExceptionsV2?: boolean;\n\n /**\n * Configuration options for UI profiling.\n * It supports two modes: `manual` and `trace`.\n * - In `trace` mode, the profiler runs based on active sampled spans.\n * - In `manual` mode, profiling is controlled via start/stop API calls.\n *\n * @experimental\n */\n profilingOptions?: ProfilingOptions;\n\n /**\n * Configuration options for Android UI profiling.\n * It supports two modes: `manual` and `trace`.\n * - In `trace` mode, the profiler runs based on active sampled spans.\n * - In `manual` mode, profiling is controlled via start/stop API calls.\n *\n * @experimental\n * @deprecated Use `profilingOptions` instead. This option will be removed in the next major version.\n */\n androidProfilingOptions?: ProfilingOptions;\n };\n\n /**\n * This options changes the placement of the attached stacktrace of `captureMessage` in the event.\n *\n * @default false\n * @deprecated This option will be removed in the next major version. Use `beforeSend` instead.\n */\n useThreadsForMessageStack?: boolean;\n\n /**\n * If set to `true`, the SDK propagates the W3C `traceparent` header to any outgoing requests,\n * in addition to the `sentry-trace` and `baggage` headers. Use the {@link CoreOptions.tracePropagationTargets}\n * option to control to which outgoing requests the header will be attached.\n *\n * **Important:** If you set this option to `true`, make sure that you configured your servers'\n * CORS settings to allow the `traceparent` header. Otherwise, requests might get blocked.\n *\n * @see https://www.w3.org/TR/trace-context/\n *\n * @default false\n */\n propagateTraceparent?: boolean;\n\n /**\n * Controls which log origin is captured when `enableLogs` is set to true.\n * 'all' will log all origins.\n * 'js' will capture only JavaScript logs.\n * 'native' will capture only native logs.\n *\n * @default 'all'\n */\n logsOrigin?: 'all' | 'js' | 'native';\n}\n\nexport type SentryReplayQuality = 'low' | 'medium' | 'high';\n\n/**\n * UI profiling lifecycle modes.\n * - `trace`: Profiler runs based on active sampled spans\n * - `manual`: Profiler is controlled manually via start/stop API calls\n */\nexport type ProfilingLifecycle = 'trace' | 'manual';\n\n/**\n * Configuration options for UI profiling.\n *\n * @experimental\n */\nexport interface ProfilingOptions {\n /**\n * Sample rate for profiling sessions.\n * This is evaluated once per session and determines if profiling should be enabled for that session.\n * 1.0 will enable profiling for all sessions, 0.0 will disable profiling.\n *\n * @default undefined (profiling disabled)\n */\n profileSessionSampleRate?: number;\n\n /**\n * Profiling lifecycle mode.\n * - `trace`: Profiler runs while there is at least one active sampled span\n * - `manual`: Profiler is controlled manually via Sentry.profiler.startProfiler/stopProfiler\n *\n * @default 'manual'\n */\n lifecycle?: ProfilingLifecycle;\n\n /**\n * Enable profiling on app start.\n * - In `trace` mode: The app start profile stops automatically when the app start root span finishes\n * - In `manual` mode: The app start profile must be stopped through Sentry.profiler.stopProfiler()\n *\n * @default false\n */\n startOnAppStart?: boolean;\n}\n\nexport interface ReactNativeTransportOptions extends BrowserTransportOptions {\n /**\n * @deprecated use `maxQueueSize` in the root of the SDK options.\n */\n bufferSize?: number;\n}\n\n/**\n * Configuration options for the Sentry ReactNative SDK.\n * @see ReactNativeFrontend for more information.\n */\n\nexport interface ReactNativeOptions\n extends Omit<Options<ReactNativeTransportOptions>, '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeClientOptions\n extends Omit<ClientOptions<ReactNativeTransportOptions>, 'tunnel' | '_experiments'>,\n BaseReactNativeOptions {}\n\nexport interface ReactNativeWrapperOptions {\n /** Props for the root React profiler */\n profilerProps?: Omit<ProfilerProps, 'updateProps' | 'children' | 'name'>;\n\n /** Props for the root touch event boundary */\n touchEventBoundaryProps?: TouchEventBoundaryProps;\n}\n\n/**\n * If the user has not explicitly set `enableNativeNagger`\n * the function enables native nagging based on the current\n * environment.\n */\nexport function shouldEnableNativeNagger(userOptions: unknown): boolean {\n if (typeof userOptions === 'boolean') {\n // User can override the default behavior\n return userOptions;\n }\n\n if (Platform.OS === 'web' || Platform.OS === 'windows') {\n // We don't want to nag on known platforms that don't support native\n return false;\n }\n\n if (isExpoGo()) {\n // If the app is running in Expo Go, we don't want to nag\n return false;\n }\n\n return true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AAatD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAiErD"}
1
+ {"version":3,"file":"scopeSync.d.ts","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AActD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA6FrD"}
@@ -1,3 +1,4 @@
1
+ import { debug } from '@sentry/core';
1
2
  import { logger } from '@sentry/react';
2
3
  import { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';
3
4
  import { fillTyped } from './utils/fill';
@@ -62,5 +63,31 @@ export function enableSyncToNative(scope) {
62
63
  NATIVE.setContext(key, context);
63
64
  return original.call(scope, key, context);
64
65
  });
66
+ fillTyped(scope, 'setAttribute', original => (key, value) => {
67
+ debug.warn('This feature is currently not supported.');
68
+ // Only sync primitive types
69
+ // Native layer still not supported
70
+ // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
71
+ // NATIVE.setAttribute(key, value);
72
+ // }
73
+ return original.call(scope, key, value);
74
+ });
75
+ fillTyped(scope, 'setAttributes', original => (attributes) => {
76
+ // Native layer not supported
77
+ debug.warn('This feature is currently not supported.');
78
+ // Filter to only primitive types
79
+ // const primitiveAttrs: Record<string, string | number | boolean> = {};
80
+ // Object.keys(attributes).forEach(key => {
81
+ // const value = attributes[key];
82
+ // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
83
+ // primitiveAttrs[key] = value;
84
+ // }
85
+ // });
86
+ //
87
+ // if (Object.keys(primitiveAttrs).length > 0) {
88
+ // NATIVE.setAttributes(primitiveAttrs);
89
+ // }
90
+ return original.call(scope, attributes);
91
+ });
65
92
  }
66
93
  //# sourceMappingURL=scopeSync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE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e,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAClD,IAAI,eAAe,EAAE;YACnB,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;SACvC;aAAM;YACL,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;SAC3F;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,EAAE,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAU,EAAE;QAC3D,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,8DAA8D;IAC9D,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAW,EAAE,OAAsC,EAAS,EAAE;QACxG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n}\n"]}
1
+ {"version":3,"file":"scopeSync.js","sourceRoot":"","sources":["../../src/js/scopeSync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cA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kC;QAClC,KAAK;QACL,MAAM;QACN,EAAE;QACF,gDAAgD;QAChD,yCAAyC;QACzC,IAAI;QACJ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Breadcrumb, Scope } from '@sentry/core';\nimport { debug } from '@sentry/core';\nimport { logger } from '@sentry/react';\nimport { DEFAULT_BREADCRUMB_LEVEL } from './breadcrumb';\nimport { fillTyped } from './utils/fill';\nimport { convertToNormalizedObject } from './utils/normalize';\nimport { NATIVE } from './wrapper';\n\n/**\n * This WeakMap is used to keep track of which scopes have been synced to the native SDKs.\n * This ensures that we don't double sync the same scope.\n */\nconst syncedToNativeMap = new WeakMap<Scope, true>();\n\n/**\n * Hooks into the scope set methods and sync new data added to the given scope with the native SDKs.\n */\nexport function enableSyncToNative(scope: Scope): void {\n if (syncedToNativeMap.has(scope)) {\n return;\n }\n syncedToNativeMap.set(scope, true);\n\n fillTyped(scope, 'setUser', original => (user): Scope => {\n NATIVE.setUser(user);\n return original.call(scope, user);\n });\n\n fillTyped(scope, 'setTag', original => (key, value): Scope => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(value));\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setTags', original => (tags): Scope => {\n // As native only has setTag, we just loop through each tag key.\n Object.keys(tags).forEach(key => {\n NATIVE.setTag(key, NATIVE.primitiveProcessor(tags[key]));\n });\n return original.call(scope, tags);\n });\n\n fillTyped(scope, 'setExtras', original => (extras): Scope => {\n Object.keys(extras).forEach(key => {\n NATIVE.setExtra(key, extras[key]);\n });\n return original.call(scope, extras);\n });\n\n fillTyped(scope, 'setExtra', original => (key, value): Scope => {\n NATIVE.setExtra(key, value);\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'addBreadcrumb', original => (breadcrumb, maxBreadcrumbs): Scope => {\n const mergedBreadcrumb: Breadcrumb = {\n ...breadcrumb,\n level: breadcrumb.level || DEFAULT_BREADCRUMB_LEVEL,\n data: breadcrumb.data ? convertToNormalizedObject(breadcrumb.data) : undefined,\n };\n\n original.call(scope, mergedBreadcrumb, maxBreadcrumbs);\n\n const finalBreadcrumb = scope.getLastBreadcrumb();\n if (finalBreadcrumb) {\n NATIVE.addBreadcrumb(finalBreadcrumb);\n } else {\n logger.warn('[ScopeSync] Last created breadcrumb is undefined. Skipping sync to native.');\n }\n\n return scope;\n });\n\n fillTyped(scope, 'clearBreadcrumbs', original => (): Scope => {\n NATIVE.clearBreadcrumbs();\n return original.call(scope);\n });\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fillTyped(scope, 'setContext', original => (key: string, context: { [key: string]: any } | null): Scope => {\n NATIVE.setContext(key, context);\n return original.call(scope, key, context);\n });\n\n fillTyped(scope, 'setAttribute', original => (key: string, value: unknown): Scope => {\n debug.warn('This feature is currently not supported.');\n // Only sync primitive types\n // Native layer still not supported\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // NATIVE.setAttribute(key, value);\n // }\n return original.call(scope, key, value);\n });\n\n fillTyped(scope, 'setAttributes', original => (attributes: Record<string, unknown>): Scope => {\n // Native layer not supported\n debug.warn('This feature is currently not supported.');\n // Filter to only primitive types\n // const primitiveAttrs: Record<string, string | number | boolean> = {};\n // Object.keys(attributes).forEach(key => {\n // const value = attributes[key];\n // if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n // primitiveAttrs[key] = value;\n // }\n // });\n //\n // if (Object.keys(primitiveAttrs).length > 0) {\n // NATIVE.setAttributes(primitiveAttrs);\n // }\n return original.call(scope, attributes);\n });\n}\n"]}
@@ -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.
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.d.ts","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7C;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAqCF;;GAEG;AACH,cAAM,kBAAmB,SAAQ,KAAK,CAAC,SAAS,CAAC,uBAAuB,CAAC;IACvE,OAAc,WAAW,EAAE,MAAM,CAAiC;IAClE,OAAc,YAAY,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAK1D;IAEF,SAAgB,IAAI,EAAE,MAAM,CAAwB;IAEpD;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAKhC;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,SAAS;IAYhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;;OAGG;IAEH,OAAO,CAAC,aAAa;IAyCrB;;OAEG;IACH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AC,SAAS;IAYhC;;OAEG;IACH,OAAO,CAAC,cAAc;IAsBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;;OAGG;IAEH,OAAO,CAAC,aAAa;IA+DrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAuB1B;AA8ED;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,mBAEV,MAAM,aAAa,CAAC,GAAG,CAAC,kBACxB,uBAAuB,KACtC,MAAM,iBAUR,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -14,6 +14,7 @@ const DEFAULT_BREADCRUMB_CATEGORY = 'touch';
14
14
  const DEFAULT_BREADCRUMB_TYPE = 'user';
15
15
  const DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;
16
16
  const SENTRY_LABEL_PROP_KEY = 'sentry-label';
17
+ const SENTRY_SPAN_ATTRIBUTES_PROP_KEY = 'sentry-span-attributes';
17
18
  const SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';
18
19
  const SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';
19
20
  const SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';
@@ -85,7 +86,7 @@ class TouchEventBoundary extends React.Component {
85
86
  */
86
87
  // eslint-disable-next-line complexity
87
88
  _onTouchStart(e) {
88
- var _a, _b;
89
+ var _a, _b, _c;
89
90
  if (!e._targetInst) {
90
91
  return;
91
92
  }
@@ -114,6 +115,23 @@ class TouchEventBoundary extends React.Component {
114
115
  });
115
116
  if (span) {
116
117
  span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);
118
+ // Apply custom attributes from sentry-span-attributes prop
119
+ // Traverse the component tree to find custom attributes
120
+ let instForAttributes = e._targetInst;
121
+ let customAttributes;
122
+ while (instForAttributes) {
123
+ if (((_c = instForAttributes.elementType) === null || _c === void 0 ? void 0 : _c.displayName) === TouchEventBoundary.displayName) {
124
+ break;
125
+ }
126
+ customAttributes = getSpanAttributes(instForAttributes);
127
+ if (customAttributes && Object.keys(customAttributes).length > 0) {
128
+ break;
129
+ }
130
+ instForAttributes = instForAttributes.return;
131
+ }
132
+ if (customAttributes && Object.keys(customAttributes).length > 0) {
133
+ span.setAttributes(customAttributes);
134
+ }
117
135
  }
118
136
  }
119
137
  /**
@@ -196,6 +214,20 @@ function getLabelValue(props, labelKey) {
196
214
  ? props[labelKey]
197
215
  : undefined;
198
216
  }
217
+ function getSpanAttributes(currentInst) {
218
+ if (!currentInst.memoizedProps) {
219
+ return undefined;
220
+ }
221
+ const props = currentInst.memoizedProps;
222
+ const attributes = props[SENTRY_SPAN_ATTRIBUTES_PROP_KEY];
223
+ // Validate that it's an object (not null, not array)
224
+ if (typeof attributes === 'object' &&
225
+ attributes !== null &&
226
+ !Array.isArray(attributes)) {
227
+ return attributes;
228
+ }
229
+ return undefined;
230
+ }
199
231
  /**
200
232
  * Convenience Higher-Order-Component for TouchEventBoundary
201
233
  * @param WrappedComponent any React Component
@@ -1 +1 @@
1
- {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AACpH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAmChE,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE;QACX,IAAI,EAAE,CAAC;KACR;CAC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AwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,KAAK,CAAC,EAAE,CAAC,CACzD,oBAAC,kBAAkB,oBAAK,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC;QAC3C,oBAAC,cAAc,oBAAK,KAAK,EAAI,CACV,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import type { SeverityLevel } from '@sentry/core';\nimport { addBreadcrumb, debug, dropUndefinedKeys, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport * as React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\nimport { createIntegration } from './integrations/factory';\nimport { startUserInteractionSpan } from './tracing/integrations/userInteraction';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './tracing/origin';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\nconst SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';\nconst SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';\nconst SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface TouchedComponentInfo {\n name?: string;\n label?: string;\n element?: string;\n file?: string;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getClient();\n client?.addIntegration?.(createIntegration(this.name));\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(touchPath: TouchedComponentInfo[], label?: string): void {\n const level = 'info' as SeverityLevel;\n\n const root = touchPath[0];\n if (!root) {\n debug.warn('[TouchEvents] No root component found in touch path.');\n return;\n }\n\n const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { path: touchPath },\n level: level,\n message: `Touch event within element: ${detail}`,\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n debug.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName)),\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n const touchPath: TouchedComponentInfo[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n touchPath.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName === TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const info = getTouchedComponentInfo(currentInst, this.props.labelName);\n this._pushIfNotIgnored(touchPath, info);\n\n currentInst = currentInst.return;\n }\n\n const label = touchPath.find(info => info.label)?.label;\n if (touchPath.length > 0) {\n this._logTouchEvent(touchPath, label);\n }\n\n const span = startUserInteractionSpan({\n elementId: label,\n op: UI_ACTION_TOUCH,\n });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n }\n }\n\n /**\n * Pushes the name to the componentTreeNames array if it is not ignored.\n */\n private _pushIfNotIgnored(touchPath: TouchedComponentInfo[], value: TouchedComponentInfo | undefined): boolean {\n if (!value) {\n return false;\n }\n\n if (!value.name && !value.label) {\n return false;\n }\n if (value.name && this._isNameIgnored(value.name)) {\n return false;\n }\n if (value.label && this._isNameIgnored(value.label)) {\n return false;\n }\n\n // Deduplicate same subsequent items.\n if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {\n return false;\n }\n\n touchPath.push(value);\n return true;\n }\n}\n\nfunction getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined {\n const displayName = currentInst.elementType?.displayName;\n\n const props = currentInst.memoizedProps;\n if (!props) {\n // Early return if no props are available, as we can't extract any useful information\n if (displayName) {\n return {\n name: displayName,\n };\n }\n return undefined;\n }\n\n return dropUndefinedKeys<TouchedComponentInfo>({\n // provided by @sentry/babel-plugin-component-annotate\n name: getComponentName(props) || displayName,\n element: getElementName(props),\n file: getFileName(props),\n\n // `sentry-label` or user defined label key\n label: getLabelValue(props, labelKey),\n });\n}\n\nfunction getComponentName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&\n props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&\n props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_COMPONENT_PROP_KEY] || undefined;\n}\n\nfunction getElementName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&\n props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&\n props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_ELEMENT_PROP_KEY] || undefined;\n}\n\nfunction getFileName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&\n props[SENTRY_FILE_PROP_KEY].length > 0 &&\n props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&\n props[SENTRY_FILE_PROP_KEY] || undefined;\n}\n\nfunction getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {\n return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0\n ? props[SENTRY_LABEL_PROP_KEY]\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0\n ? props[labelKey] as string\n : undefined;\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps,\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = props => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
1
+ {"version":3,"file":"touchevents.js","sourceRoot":"","sources":["../../src/js/touchevents.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,gCAAgC,EAAE,MAAM,cAAc,CAAC;AACpH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,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S,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;AAC7B,8DAA8D;AAC9D,cAAwC,EACxC,aAAuC,EACd,EAAE;IAC3B,MAAM,gBAAgB,GAA4B,KAAK,CAAC,EAAE,CAAC,CACzD,oBAAC,kBAAkB,oBAAK,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC;QAC3C,oBAAC,cAAc,oBAAK,KAAK,EAAI,CACV,CACtB,CAAC;IAEF,gBAAgB,CAAC,WAAW,GAAG,wBAAwB,CAAC;IAExD,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC","sourcesContent":["import type { SeverityLevel, SpanAttributeValue } from '@sentry/core';\nimport { addBreadcrumb, debug, dropUndefinedKeys, getClient, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';\nimport * as React from 'react';\nimport type { GestureResponderEvent } from 'react-native';\nimport { StyleSheet, View } from 'react-native';\nimport { createIntegration } from './integrations/factory';\nimport { startUserInteractionSpan } from './tracing/integrations/userInteraction';\nimport { UI_ACTION_TOUCH } from './tracing/ops';\nimport { SPAN_ORIGIN_AUTO_INTERACTION } from './tracing/origin';\n\nexport type TouchEventBoundaryProps = {\n /**\n * The category assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbCategory?: string;\n /**\n * The type assigned to the breadcrumb that is logged by the touch event.\n */\n breadcrumbType?: string;\n /**\n * The max number of components to display when logging a touch's component tree.\n */\n maxComponentTreeSize?: number;\n /**\n * Component name(s) to ignore when logging the touch event. This prevents unhelpful logs such as\n * \"Touch event within element: View\" where you still can't tell which View it occurred in.\n */\n ignoreNames?: Array<string | RegExp>;\n /**\n * Deprecated, use ignoreNames instead\n * @deprecated\n */\n ignoredDisplayNames?: Array<string | RegExp>;\n /**\n * React Node wrapped by TouchEventBoundary.\n */\n children?: React.ReactNode;\n /**\n * Label Name used to identify the touched element.\n */\n labelName?: string;\n /**\n * Custom attributes to add to user interaction spans.\n * Accepts an object with string keys and values that are strings, numbers, booleans, or arrays.\n *\n * @experimental This API is experimental and may change in future releases.\n */\n spanAttributes?: Record<string, SpanAttributeValue>;\n};\n\nconst touchEventStyles = StyleSheet.create({\n wrapperView: {\n flex: 1,\n },\n});\n\nconst DEFAULT_BREADCRUMB_CATEGORY = 'touch';\nconst DEFAULT_BREADCRUMB_TYPE = 'user';\nconst DEFAULT_MAX_COMPONENT_TREE_SIZE = 20;\n\nconst SENTRY_LABEL_PROP_KEY = 'sentry-label';\nconst SENTRY_SPAN_ATTRIBUTES_PROP_KEY = 'sentry-span-attributes';\nconst SENTRY_COMPONENT_PROP_KEY = 'data-sentry-component';\nconst SENTRY_ELEMENT_PROP_KEY = 'data-sentry-element';\nconst SENTRY_FILE_PROP_KEY = 'data-sentry-source-file';\n\ninterface ElementInstance {\n elementType?: {\n displayName?: string;\n name?: string;\n };\n memoizedProps?: Record<string, unknown>;\n return?: ElementInstance;\n}\n\ninterface TouchedComponentInfo {\n name?: string;\n label?: string;\n element?: string;\n file?: string;\n}\n\ninterface PrivateGestureResponderEvent extends GestureResponderEvent {\n _targetInst?: ElementInstance;\n}\n\n/**\n * Boundary to log breadcrumbs for interaction events.\n */\nclass TouchEventBoundary extends React.Component<TouchEventBoundaryProps> {\n public static displayName: string = '__Sentry.TouchEventBoundary';\n public static defaultProps: Partial<TouchEventBoundaryProps> = {\n breadcrumbCategory: DEFAULT_BREADCRUMB_CATEGORY,\n breadcrumbType: DEFAULT_BREADCRUMB_TYPE,\n ignoreNames: [],\n maxComponentTreeSize: DEFAULT_MAX_COMPONENT_TREE_SIZE,\n };\n\n public readonly name: string = 'TouchEventBoundary';\n\n /**\n * Registers the TouchEventBoundary as a Sentry Integration.\n */\n public componentDidMount(): void {\n const client = getClient();\n client?.addIntegration?.(createIntegration(this.name));\n }\n\n /**\n *\n */\n public render(): React.ReactNode {\n return (\n <View\n style={touchEventStyles.wrapperView}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onTouchStart={this._onTouchStart.bind(this) as any}\n >\n {this.props.children}\n </View>\n );\n }\n\n /**\n * Logs the touch event given the component tree names and a label.\n */\n private _logTouchEvent(touchPath: TouchedComponentInfo[], label?: string): void {\n const level = 'info' as SeverityLevel;\n\n const root = touchPath[0];\n if (!root) {\n debug.warn('[TouchEvents] No root component found in touch path.');\n return;\n }\n\n const detail = label ? label : `${root.name}${root.file ? ` (${root.file})` : ''}`;\n const crumb = {\n category: this.props.breadcrumbCategory,\n data: { path: touchPath },\n level: level,\n message: `Touch event within element: ${detail}`,\n type: this.props.breadcrumbType,\n };\n addBreadcrumb(crumb);\n\n debug.log(`[TouchEvents] ${crumb.message}`);\n }\n\n /**\n * Checks if the name is supposed to be ignored.\n */\n private _isNameIgnored(name: string): boolean {\n let ignoreNames = this.props.ignoreNames || [];\n // eslint-disable-next-line deprecation/deprecation\n if (this.props.ignoredDisplayNames) {\n // This is to make it compatible with prior version.\n // eslint-disable-next-line deprecation/deprecation\n ignoreNames = [...ignoreNames, ...this.props.ignoredDisplayNames];\n }\n\n return ignoreNames.some(\n (ignoreName: string | RegExp) =>\n (typeof ignoreName === 'string' && name === ignoreName) ||\n (ignoreName instanceof RegExp && name.match(ignoreName)),\n );\n }\n\n // Originally was going to clean the names of any HOCs as well but decided that it might hinder debugging effectively. Will leave here in case\n // private readonly _cleanName = (name: string): string =>\n // name.replace(/.*\\(/g, \"\").replace(/\\)/g, \"\");\n\n /**\n * Traverses through the component tree when a touch happens and logs it.\n * @param e\n */\n // eslint-disable-next-line complexity\n private _onTouchStart(e: PrivateGestureResponderEvent): void {\n if (!e._targetInst) {\n return;\n }\n\n let currentInst: ElementInstance | undefined = e._targetInst;\n const touchPath: TouchedComponentInfo[] = [];\n\n while (\n currentInst &&\n // maxComponentTreeSize will always be defined as we have a defaultProps. But ts needs a check so this is here.\n this.props.maxComponentTreeSize &&\n touchPath.length < this.props.maxComponentTreeSize\n ) {\n if (\n // If the loop gets to the boundary itself, break.\n currentInst.elementType?.displayName === TouchEventBoundary.displayName\n ) {\n break;\n }\n\n const info = getTouchedComponentInfo(currentInst, this.props.labelName);\n this._pushIfNotIgnored(touchPath, info);\n\n currentInst = currentInst.return;\n }\n\n const label = touchPath.find(info => info.label)?.label;\n if (touchPath.length > 0) {\n this._logTouchEvent(touchPath, label);\n }\n\n const span = startUserInteractionSpan({\n elementId: label,\n op: UI_ACTION_TOUCH,\n });\n if (span) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_INTERACTION);\n\n // Apply custom attributes from sentry-span-attributes prop\n // Traverse the component tree to find custom attributes\n let instForAttributes: ElementInstance | undefined = e._targetInst;\n let customAttributes: Record<string, SpanAttributeValue> | undefined;\n\n while (instForAttributes) {\n if (instForAttributes.elementType?.displayName === TouchEventBoundary.displayName) {\n break;\n }\n\n customAttributes = getSpanAttributes(instForAttributes);\n if (customAttributes && Object.keys(customAttributes).length > 0) {\n break;\n }\n\n instForAttributes = instForAttributes.return;\n }\n\n if (customAttributes && Object.keys(customAttributes).length > 0) {\n span.setAttributes(customAttributes);\n }\n }\n }\n\n /**\n * Pushes the name to the componentTreeNames array if it is not ignored.\n */\n private _pushIfNotIgnored(touchPath: TouchedComponentInfo[], value: TouchedComponentInfo | undefined): boolean {\n if (!value) {\n return false;\n }\n\n if (!value.name && !value.label) {\n return false;\n }\n if (value.name && this._isNameIgnored(value.name)) {\n return false;\n }\n if (value.label && this._isNameIgnored(value.label)) {\n return false;\n }\n\n // Deduplicate same subsequent items.\n if (touchPath.length > 0 && JSON.stringify(touchPath[touchPath.length - 1]) === JSON.stringify(value)) {\n return false;\n }\n\n touchPath.push(value);\n return true;\n }\n}\n\nfunction getTouchedComponentInfo(currentInst: ElementInstance, labelKey: string | undefined): TouchedComponentInfo | undefined {\n const displayName = currentInst.elementType?.displayName;\n\n const props = currentInst.memoizedProps;\n if (!props) {\n // Early return if no props are available, as we can't extract any useful information\n if (displayName) {\n return {\n name: displayName,\n };\n }\n return undefined;\n }\n\n return dropUndefinedKeys<TouchedComponentInfo>({\n // provided by @sentry/babel-plugin-component-annotate\n name: getComponentName(props) || displayName,\n element: getElementName(props),\n file: getFileName(props),\n\n // `sentry-label` or user defined label key\n label: getLabelValue(props, labelKey),\n });\n}\n\nfunction getComponentName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_COMPONENT_PROP_KEY] === 'string' &&\n props[SENTRY_COMPONENT_PROP_KEY].length > 0 &&\n props[SENTRY_COMPONENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_COMPONENT_PROP_KEY] || undefined;\n}\n\nfunction getElementName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_ELEMENT_PROP_KEY] === 'string' &&\n props[SENTRY_ELEMENT_PROP_KEY].length > 0 &&\n props[SENTRY_ELEMENT_PROP_KEY] !== 'unknown' &&\n props[SENTRY_ELEMENT_PROP_KEY] || undefined;\n}\n\nfunction getFileName(props: Record<string, unknown>): string | undefined {\n return typeof props[SENTRY_FILE_PROP_KEY] === 'string' &&\n props[SENTRY_FILE_PROP_KEY].length > 0 &&\n props[SENTRY_FILE_PROP_KEY] !== 'unknown' &&\n props[SENTRY_FILE_PROP_KEY] || undefined;\n}\n\nfunction getLabelValue(props: Record<string, unknown>, labelKey: string | undefined): string | undefined {\n return typeof props[SENTRY_LABEL_PROP_KEY] === 'string' && props[SENTRY_LABEL_PROP_KEY].length > 0\n ? props[SENTRY_LABEL_PROP_KEY]\n // For some reason type narrowing doesn't work as expected with indexing when checking it all in one go in\n // the \"check-label\" if sentence, so we have to assign it to a variable here first\n : typeof labelKey === 'string' && typeof props[labelKey] == 'string' && (props[labelKey] as string).length > 0\n ? props[labelKey] as string\n : undefined;\n}\n\nfunction getSpanAttributes(currentInst: ElementInstance): Record<string, SpanAttributeValue> | undefined {\n if (!currentInst.memoizedProps) {\n return undefined;\n }\n\n const props = currentInst.memoizedProps;\n const attributes = props[SENTRY_SPAN_ATTRIBUTES_PROP_KEY];\n\n // Validate that it's an object (not null, not array)\n if (\n typeof attributes === 'object' &&\n attributes !== null &&\n !Array.isArray(attributes)\n ) {\n return attributes as Record<string, SpanAttributeValue>;\n }\n\n return undefined;\n}\n\n/**\n * Convenience Higher-Order-Component for TouchEventBoundary\n * @param WrappedComponent any React Component\n * @param boundaryProps TouchEventBoundaryProps\n */\nconst withTouchEventBoundary = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n InnerComponent: React.ComponentType<any>,\n boundaryProps?: TouchEventBoundaryProps,\n): React.FunctionComponent => {\n const WrappedComponent: React.FunctionComponent = props => (\n <TouchEventBoundary {...(boundaryProps ?? {})}>\n <InnerComponent {...props} />\n </TouchEventBoundary>\n );\n\n WrappedComponent.displayName = 'WithTouchEventBoundary';\n\n return WrappedComponent;\n};\n\nexport { TouchEventBoundary, withTouchEventBoundary };\n"]}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoRouter.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/expoRouter.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5G,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAgEjE"}
@@ -0,0 +1,73 @@
1
+ import { SPAN_STATUS_ERROR, SPAN_STATUS_OK, startInactiveSpan } from '@sentry/core';
2
+ import { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from './origin';
3
+ /**
4
+ * Wraps Expo Router. It currently only does one thing: extends prefetch() method
5
+ * to add automated performance monitoring.
6
+ *
7
+ * This function instruments the `prefetch` method of an Expo Router instance
8
+ * to create performance spans that measure how long route prefetching takes.
9
+ *
10
+ * @param router - The Expo Router instance from `useRouter()` hook
11
+ * @returns The same router instance with an instrumented prefetch method
12
+ */
13
+ export function wrapExpoRouter(router) {
14
+ if (!(router === null || router === void 0 ? void 0 : router.prefetch)) {
15
+ return router;
16
+ }
17
+ // Check if already wrapped to avoid double-wrapping
18
+ if (router.__sentryPrefetchWrapped) {
19
+ return router;
20
+ }
21
+ const originalPrefetch = router.prefetch.bind(router);
22
+ router.prefetch = ((href) => {
23
+ // Extract route name from href for better span naming
24
+ let routeName = 'unknown';
25
+ if (typeof href === 'string') {
26
+ routeName = href;
27
+ }
28
+ else if (href && typeof href === 'object' && 'pathname' in href && href.pathname) {
29
+ routeName = href.pathname;
30
+ }
31
+ const span = startInactiveSpan({
32
+ op: 'navigation.prefetch',
33
+ name: `Prefetch ${routeName}`,
34
+ attributes: {
35
+ 'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,
36
+ 'route.href': typeof href === 'string' ? href : JSON.stringify(href),
37
+ 'route.name': routeName,
38
+ },
39
+ });
40
+ try {
41
+ const result = originalPrefetch(href);
42
+ // Handle both promise and synchronous returns
43
+ if (result && typeof result === 'object' && 'then' in result && typeof result.then === 'function') {
44
+ return result
45
+ .then(res => {
46
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SPAN_STATUS_OK });
47
+ span === null || span === void 0 ? void 0 : span.end();
48
+ return res;
49
+ })
50
+ .catch((error) => {
51
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SPAN_STATUS_ERROR, message: String(error) });
52
+ span === null || span === void 0 ? void 0 : span.end();
53
+ throw error;
54
+ });
55
+ }
56
+ else {
57
+ // Synchronous completion
58
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SPAN_STATUS_OK });
59
+ span === null || span === void 0 ? void 0 : span.end();
60
+ return result;
61
+ }
62
+ }
63
+ catch (error) {
64
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SPAN_STATUS_ERROR, message: String(error) });
65
+ span === null || span === void 0 ? void 0 : span.end();
66
+ throw error;
67
+ }
68
+ });
69
+ // Mark as wrapped to prevent double-wrapping
70
+ router.__sentryPrefetchWrapped = true;
71
+ return router;
72
+ }
73
+ //# sourceMappingURL=expoRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoRouter.js","sourceRoot":"","sources":["../../../src/js/tracing/expoRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,M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SPAN_STATUS_ERROR, SPAN_STATUS_OK, startInactiveSpan } from '@sentry/core';\nimport { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from './origin';\n\n/**\n * Type definition for Expo Router's router object\n */\nexport interface ExpoRouter {\n prefetch?: (href: string | { pathname?: string; params?: Record<string, unknown> }) => void | Promise<void>;\n // Other router methods can be added here if needed\n push?: (...args: unknown[]) => void;\n replace?: (...args: unknown[]) => void;\n back?: () => void;\n navigate?: (...args: unknown[]) => void;\n}\n\n/**\n * Wraps Expo Router. It currently only does one thing: extends prefetch() method\n * to add automated performance monitoring.\n *\n * This function instruments the `prefetch` method of an Expo Router instance\n * to create performance spans that measure how long route prefetching takes.\n *\n * @param router - The Expo Router instance from `useRouter()` hook\n * @returns The same router instance with an instrumented prefetch method\n */\nexport function wrapExpoRouter<T extends ExpoRouter>(router: T): T {\n if (!router?.prefetch) {\n return router;\n }\n\n // Check if already wrapped to avoid double-wrapping\n if ((router as T & { __sentryPrefetchWrapped?: boolean }).__sentryPrefetchWrapped) {\n return router;\n }\n\n const originalPrefetch = router.prefetch.bind(router);\n\n router.prefetch = ((href: Parameters<NonNullable<ExpoRouter['prefetch']>>[0]) => {\n // Extract route name from href for better span naming\n let routeName = 'unknown';\n if (typeof href === 'string') {\n routeName = href;\n } else if (href && typeof href === 'object' && 'pathname' in href && href.pathname) {\n routeName = href.pathname;\n }\n\n const span = startInactiveSpan({\n op: 'navigation.prefetch',\n name: `Prefetch ${routeName}`,\n attributes: {\n 'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,\n 'route.href': typeof href === 'string' ? href : JSON.stringify(href),\n 'route.name': routeName,\n },\n });\n\n try {\n const result = originalPrefetch(href);\n\n // Handle both promise and synchronous returns\n if (result && typeof result === 'object' && 'then' in result && typeof result.then === 'function') {\n return result\n .then(res => {\n span?.setStatus({ code: SPAN_STATUS_OK });\n span?.end();\n return res;\n })\n .catch((error: unknown) => {\n span?.setStatus({ code: SPAN_STATUS_ERROR, message: String(error) });\n span?.end();\n throw error;\n });\n } else {\n // Synchronous completion\n span?.setStatus({ code: SPAN_STATUS_OK });\n span?.end();\n return result;\n }\n } catch (error) {\n span?.setStatus({ code: SPAN_STATUS_ERROR, message: String(error) });\n span?.end();\n throw error;\n }\n }) as NonNullable<T['prefetch']>;\n\n // Mark as wrapped to prevent double-wrapping\n (router as T & { __sentryPrefetchWrapped?: boolean }).__sentryPrefetchWrapped = true;\n\n return router;\n}\n"]}
@@ -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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,IAAI,qCAAqC,EACzD,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,QAAQ,CAAC;AAErG,YAAY,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,cAAc,OAAO,CAAC;AAEtB,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,IAAI,qCAAqC,EACzD,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,QAAQ,CAAC;AAErG,YAAY,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,cAAc,OAAO,CAAC;AAEtB,cAAc,iBAAiB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { reactNativeTracingIntegration, INTEGRATION_NAME as REACT_NATIVE_TRACING_INTEGRATION_NAME, getCurrentReactNativeTracingIntegration, getReactNativeTracingIntegration, } from './reactnativetracing';
2
2
  export { reactNavigationIntegration } from './reactnavigation';
3
3
  export { reactNativeNavigationIntegration } from './reactnativenavigation';
4
+ export { wrapExpoRouter } from './expoRouter';
4
5
  export { startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions } from './span';
5
6
  export { ReactNativeProfiler } from './reactnativeprofiler';
6
7
  export { sentryTraceGesture } from './gesturetracing';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,IAAI,qCAAqC,EACzD,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,QAAQ,CAAC;AAIrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,cAAc,OAAO,CAAC;AAEtB,cAAc,iBAAiB,CAAC","sourcesContent":["export {\n reactNativeTracingIntegration,\n INTEGRATION_NAME as REACT_NATIVE_TRACING_INTEGRATION_NAME,\n getCurrentReactNativeTracingIntegration,\n getReactNativeTracingIntegration,\n} from './reactnativetracing';\nexport type { ReactNativeTracingIntegration } from './reactnativetracing';\n\nexport { reactNavigationIntegration } from './reactnavigation';\nexport { reactNativeNavigationIntegration } from './reactnativenavigation';\n\nexport { startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions } from './span';\n\nexport type { ReactNavigationCurrentRoute, ReactNavigationRoute } from './types';\n\nexport { ReactNativeProfiler } from './reactnativeprofiler';\n\nexport { sentryTraceGesture } from './gesturetracing';\n\nexport * from './ops';\n\nexport * from './timetodisplay';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/tracing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,EAC7B,gBAAgB,IAAI,qCAAqC,EACzD,uCAAuC,EACvC,gCAAgC,GACjC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,mCAAmC,EAAE,MAAM,QAAQ,CAAC;AAIrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,cAAc,OAAO,CAAC;AAEtB,cAAc,iBAAiB,CAAC","sourcesContent":["export {\n reactNativeTracingIntegration,\n INTEGRATION_NAME as REACT_NATIVE_TRACING_INTEGRATION_NAME,\n getCurrentReactNativeTracingIntegration,\n getReactNativeTracingIntegration,\n} from './reactnativetracing';\nexport type { ReactNativeTracingIntegration } from './reactnativetracing';\n\nexport { reactNavigationIntegration } from './reactnavigation';\nexport { reactNativeNavigationIntegration } from './reactnativenavigation';\n\nexport { wrapExpoRouter } from './expoRouter';\nexport type { ExpoRouter } from './expoRouter';\n\nexport { startIdleNavigationSpan, startIdleSpan, getDefaultIdleNavigationSpanOptions } from './span';\n\nexport type { ReactNavigationCurrentRoute, ReactNavigationRoute } from './types';\n\nexport { ReactNativeProfiler } from './reactnativeprofiler';\n\nexport { sentryTraceGesture } from './gesturetracing';\n\nexport * from './ops';\n\nexport * from './timetodisplay';\n"]}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAEnE,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D,eAAO,MAAM,mDAAmD,4CAA4C,CAAC;AAC7G,eAAO,MAAM,4CAA4C,qCAAqC,CAAC;AAC/F,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAE3E,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAC7E,eAAO,MAAM,qCAAqC,8BAA8B,CAAC"}
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AAEnE,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAE3D,eAAO,MAAM,mDAAmD,4CAA4C,CAAC;AAC7G,eAAO,MAAM,4CAA4C,qCAAqC,CAAC;AAC/F,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAE3E,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAC7E,eAAO,MAAM,qCAAqC,8BAA8B,CAAC;AAEjF,eAAO,MAAM,qCAAqC,8BAA8B,CAAC"}
@@ -7,4 +7,5 @@ export const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = 'auto.navigation.rea
7
7
  export const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';
8
8
  export const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';
9
9
  export const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';
10
+ export const SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH = 'auto.expo_router.prefetch';
10
11
  //# sourceMappingURL=origin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"origin.js","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,mDAAmD,GAAG,yCAAyC,CAAC;AAC7G,MAAM,CAAC,MAAM,4CAA4C,GAAG,kCAAkC,CAAC;AAC/F,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CAAC;AAE3E,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;AAC7E,MAAM,CAAC,MAAM,qCAAqC,GAAG,2BAA2B,CAAC","sourcesContent":["export const SPAN_ORIGIN_AUTO_INTERACTION = 'auto.interaction';\nexport const SPAN_ORIGIN_MANUAL_INTERACTION = 'manual.interaction';\n\nexport const SPAN_ORIGIN_MANUAL_APP_START = 'manual.app.start';\nexport const SPAN_ORIGIN_AUTO_APP_START = 'auto.app.start';\n\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION = 'auto.navigation.react_native_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = 'auto.navigation.react_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';\n\nexport const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';\nexport const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';\n"]}
1
+ {"version":3,"file":"origin.js","sourceRoot":"","sources":["../../../src/js/tracing/origin.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,8BAA8B,GAAG,oBAAoB,CAAC;AAEnE,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC/D,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,mDAAmD,GAAG,yCAAyC,CAAC;AAC7G,MAAM,CAAC,MAAM,4CAA4C,GAAG,kCAAkC,CAAC;AAC/F,MAAM,CAAC,MAAM,kCAAkC,GAAG,wBAAwB,CAAC;AAE3E,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;AAC7E,MAAM,CAAC,MAAM,qCAAqC,GAAG,2BAA2B,CAAC;AAEjF,MAAM,CAAC,MAAM,qCAAqC,GAAG,2BAA2B,CAAC","sourcesContent":["export const SPAN_ORIGIN_AUTO_INTERACTION = 'auto.interaction';\nexport const SPAN_ORIGIN_MANUAL_INTERACTION = 'manual.interaction';\n\nexport const SPAN_ORIGIN_MANUAL_APP_START = 'manual.app.start';\nexport const SPAN_ORIGIN_AUTO_APP_START = 'auto.app.start';\n\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NATIVE_NAVIGATION = 'auto.navigation.react_native_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION = 'auto.navigation.react_navigation';\nexport const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';\n\nexport const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';\nexport const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';\n\nexport const SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH = 'auto.expo_router.prefetch';\n"]}
@@ -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 +1 @@
1
- {"version":3,"file":"reactnavigation.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAQ,MAAM,cAAc,CAAC;AA+B9D,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AA4BlD,UAAU,iCAAiC;IACzC;;;;;OAKG;IACH,oBAAoB,EA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AC;IAEtD;;;;OAIG;IACH,uBAAuB,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,+BAA+B,EAAE,OAAO,CAAC;IAEzC;;;;;;OAMG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,kOAQpC,QAAQ,iCAAiC,CAAC;IAC3C;;;OAGG;0DACmD,OAAO,KAAK,IAAI;aAC7D,iCAAiC;CAuW3C,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IAEZ,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,UAAU,eAAe;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAQD;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,GACb,UAAU,CAAC,OAAO,0BAA0B,CAAC,GAAG,SAAS,CAE3D"}
@@ -40,7 +40,7 @@ function getPathFromState(state) {
40
40
  * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
41
41
  * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.
42
42
  */
43
- export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enableTimeToInitialDisplay = false, ignoreEmptyBackNavigationTransactions = true, enableTimeToInitialDisplayForPreloadedRoutes = false, useDispatchedActionData = false, useFullPathsForNavigationRoutes = false, } = {}) => {
43
+ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enableTimeToInitialDisplay = false, ignoreEmptyBackNavigationTransactions = true, enableTimeToInitialDisplayForPreloadedRoutes = false, useDispatchedActionData = false, useFullPathsForNavigationRoutes = false, enablePrefetchTracking = false, } = {}) => {
44
44
  let navigationContainer;
45
45
  let tracing;
46
46
  let idleSpanOptions = defaultIdleOptions;
@@ -147,6 +147,34 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
147
147
  return;
148
148
  }
149
149
  const navigationActionType = useDispatchedActionData ? event === null || event === void 0 ? void 0 : event.data.action.type : undefined;
150
+ // Handle PRELOAD actions separately if prefetch tracking is enabled
151
+ if (enablePrefetchTracking && navigationActionType === 'PRELOAD') {
152
+ const preloadData = event === null || event === void 0 ? void 0 : event.data.action;
153
+ const payload = preloadData === null || preloadData === void 0 ? void 0 : preloadData.payload;
154
+ const targetRoute = payload && typeof payload === 'object' && 'name' in payload && typeof payload.name === 'string'
155
+ ? payload.name
156
+ : 'Unknown Route';
157
+ debug.log(`${INTEGRATION_NAME} Starting prefetch span for route: ${targetRoute}`);
158
+ const prefetchSpan = startInactiveSpan({
159
+ op: 'navigation.prefetch',
160
+ name: `Prefetch ${targetRoute}`,
161
+ attributes: {
162
+ 'route.name': targetRoute,
163
+ },
164
+ });
165
+ // Store prefetch span to end it when state changes or timeout
166
+ navigationProcessingSpan = prefetchSpan;
167
+ // Set timeout to ensure we don't leave hanging spans
168
+ stateChangeTimeout = setTimeout(() => {
169
+ if (navigationProcessingSpan === prefetchSpan) {
170
+ debug.log(`${INTEGRATION_NAME} Prefetch span timed out for route: ${targetRoute}`);
171
+ prefetchSpan === null || prefetchSpan === void 0 ? void 0 : prefetchSpan.setStatus({ code: SPAN_STATUS_OK });
172
+ prefetchSpan === null || prefetchSpan === void 0 ? void 0 : prefetchSpan.end();
173
+ navigationProcessingSpan = undefined;
174
+ }
175
+ }, routeChangeTimeoutMs);
176
+ return;
177
+ }
150
178
  if (useDispatchedActionData &&
151
179
  navigationActionType &&
152
180
  [
@@ -303,6 +331,7 @@ export const reactNavigationIntegration = ({ routeChangeTimeoutMs = 1000, enable
303
331
  enableTimeToInitialDisplayForPreloadedRoutes,
304
332
  useDispatchedActionData,
305
333
  useFullPathsForNavigationRoutes,
334
+ enablePrefetchTracking,
306
335
  },
307
336
  };
308
337
  };