@sentry/react-native 5.31.1 → 5.33.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 (75) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +18 -11
  3. package/android/src/main/java/io/sentry/react/RNSentryOnDrawReporterManager.java +18 -1
  4. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +2 -2
  5. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +2 -2
  6. package/dist/js/NativeRNSentry.d.ts +1 -1
  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 +1 -1
  13. package/dist/js/index.d.ts.map +1 -1
  14. package/dist/js/index.js +1 -3
  15. package/dist/js/index.js.map +1 -1
  16. package/dist/js/integrations/default.d.ts.map +1 -1
  17. package/dist/js/integrations/default.js +2 -1
  18. package/dist/js/integrations/default.js.map +1 -1
  19. package/dist/js/options.d.ts +34 -2
  20. package/dist/js/options.d.ts.map +1 -1
  21. package/dist/js/options.js.map +1 -1
  22. package/dist/js/profiling/integration.d.ts +11 -3
  23. package/dist/js/profiling/integration.d.ts.map +1 -1
  24. package/dist/js/profiling/integration.js +15 -7
  25. package/dist/js/profiling/integration.js.map +1 -1
  26. package/dist/js/tools/metroconfig.d.ts +10 -1
  27. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  28. package/dist/js/tools/metroconfig.js +42 -2
  29. package/dist/js/tools/metroconfig.js.map +1 -1
  30. package/dist/js/tracing/index.d.ts +3 -3
  31. package/dist/js/tracing/index.d.ts.map +1 -1
  32. package/dist/js/tracing/index.js +3 -3
  33. package/dist/js/tracing/index.js.map +1 -1
  34. package/dist/js/tracing/reactnativenavigation.d.ts +6 -0
  35. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  36. package/dist/js/tracing/reactnativenavigation.js +6 -0
  37. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  38. package/dist/js/tracing/reactnativetracing.d.ts +6 -8
  39. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  40. package/dist/js/tracing/reactnativetracing.js +23 -15
  41. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  42. package/dist/js/tracing/reactnavigation.d.ts +4 -0
  43. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  44. package/dist/js/tracing/reactnavigation.js +6 -0
  45. package/dist/js/tracing/reactnavigation.js.map +1 -1
  46. package/dist/js/tracing/reactnavigationv4.d.ts +2 -0
  47. package/dist/js/tracing/reactnavigationv4.d.ts.map +1 -1
  48. package/dist/js/tracing/reactnavigationv4.js +2 -0
  49. package/dist/js/tracing/reactnavigationv4.js.map +1 -1
  50. package/dist/js/tracing/routingInstrumentation.d.ts +8 -2
  51. package/dist/js/tracing/routingInstrumentation.d.ts.map +1 -1
  52. package/dist/js/tracing/routingInstrumentation.js +3 -2
  53. package/dist/js/tracing/routingInstrumentation.js.map +1 -1
  54. package/dist/js/version.d.ts +1 -1
  55. package/dist/js/version.js +1 -1
  56. package/dist/js/version.js.map +1 -1
  57. package/dist/js/wrapper.d.ts +1 -1
  58. package/dist/js/wrapper.d.ts.map +1 -1
  59. package/dist/js/wrapper.js +2 -2
  60. package/dist/js/wrapper.js.map +1 -1
  61. package/ios/RNSentry.mm +7 -3
  62. package/package.json +2 -2
  63. package/src/js/NativeRNSentry.ts +1 -1
  64. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -1
  65. package/ts3.8/dist/js/index.d.ts +1 -1
  66. package/ts3.8/dist/js/options.d.ts +34 -2
  67. package/ts3.8/dist/js/profiling/integration.d.ts +11 -3
  68. package/ts3.8/dist/js/tracing/index.d.ts +3 -3
  69. package/ts3.8/dist/js/tracing/reactnativenavigation.d.ts +6 -0
  70. package/ts3.8/dist/js/tracing/reactnativetracing.d.ts +6 -8
  71. package/ts3.8/dist/js/tracing/reactnavigation.d.ts +4 -0
  72. package/ts3.8/dist/js/tracing/reactnavigationv4.d.ts +2 -0
  73. package/ts3.8/dist/js/tracing/routingInstrumentation.d.ts +8 -2
  74. package/ts3.8/dist/js/version.d.ts +1 -1
  75. package/ts3.8/dist/js/wrapper.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigationv4.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAyC5E,MAAM,cAAc,GAA6B;IAC/C,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,gCAAiC,SAAQ,8BAA8B;IAkB3E,YAAmB,UAA6C,EAAE;QAChE,KAAK,EAAE,CAAC;QAhBM,SAAI,GAAW,gCAAgC,CAAC,mBAAmB,CAAC;QAE5E,kBAAa,GAAgC,IAAI,CAAC;QAEzC,uBAAkB,GAAW,GAAG,CAAC;QAG1C,qBAAgB,GAAa,EAAE,CAAC;QAGhC,yBAAoB,GAAY,KAAK,CAAC;QA+O9C,sGAAsG;QAC9F,wBAAmB,GAAG,CAAC,GAAW,EAAQ,EAAE;YAClD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE;gBAC1D,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM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S;aACtC;YACD,IAAI;SACL,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,yBAAyB,CAAC,KAAwB;QACxD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE9C,IACE,OAAO,IAAI,WAAW;YACtB,QAAQ,IAAI,WAAW;YACvB,OAAO,WAAW,CAAC,KAAK,KAAK,QAAQ;YACrC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EACjC;YACA,OAAO,IAAI,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;SACpD;QAED,OAAO,WAAgC,CAAC;IAC1C,CAAC;IAkBD,wEAAwE;IAChE,yBAAyB;QAC/B,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;SACrC;IACH,CAAC;;AAlRa,oDAAmB,GAAW,qBAAqB,CAAC;AAqRpE,MAAM,8BAA8B,GAAuB;IACzD,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;KAChF;IACD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Transaction, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource } from './utils';\n\nexport interface NavigationRouteV4 {\n routeName: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\nexport interface NavigationStateV4 {\n index: number;\n key: string;\n isTransitioning: boolean;\n routeName?: string;\n routes: (NavigationRouteV4 | NavigationStateV4)[];\n}\n\nexport interface AppContainerInstance {\n _navigation: {\n state: NavigationStateV4;\n router: {\n getStateForAction: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: any,\n state: NavigationStateV4,\n ) => NavigationStateV4;\n };\n };\n}\n\ninterface ReactNavigationV4Options {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNavigationV4Options = {\n routeChangeTimeoutMs: 1000,\n};\n\n/**\n * Instrumentation for React-Navigation V4.\n * Register the app container with `registerAppContainer` to use, or see docs for more details.\n */\nclass ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v4';\n\n public readonly name: string = ReactNavigationV4Instrumentation.instrumentationName;\n\n private _appContainer: AppContainerInstance | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _prevRoute?: NavigationRouteV4;\n private _recentRouteKeys: string[] = [];\n\n private _latestTransaction?: Transaction;\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n\n private _options: ReactNavigationV4Options;\n\n public constructor(options: Partial<ReactNavigationV4Options> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.\n if (!this._initialStateHandled) {\n this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);\n if (this._appContainer) {\n this._updateLatestTransaction();\n\n this._initialStateHandled = true;\n } else {\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n }\n }\n\n /**\n * Pass the ref to the app container to register it to the instrumentation\n * @param appContainerRef Ref to an `AppContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerAppContainer(appContainerRef: any): void {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (!RN_GLOBAL_OBJ.__sentry_rn_v4_registered) {\n if ('current' in appContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._appContainer = appContainerRef.current;\n } else {\n this._appContainer = appContainerRef;\n }\n\n if (this._appContainer) {\n this._patchRouter();\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n this._updateLatestTransaction();\n } else {\n logger.log(\n '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.',\n );\n }\n this._initialStateHandled = true;\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;\n } else {\n logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');\n }\n }\n }\n\n /**\n * Updates the latest transaction with the current state and calls beforeNavigate.\n */\n private _updateLatestTransaction(): void {\n // We can assume the ref is present as this is called from registerAppContainer\n if (this._appContainer && this._latestTransaction) {\n const state = this._appContainer._navigation.state;\n\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n\n this._onStateChange(state, true);\n }\n }\n\n /**\n * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the\n * new screen is mounted.\n */\n private _patchRouter(): void {\n if (this._appContainer) {\n const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;\n\n this._appContainer._navigation.router.getStateForAction = (action, state) => {\n const newState = originalGetStateForAction(action, state);\n\n this._onStateChange(newState);\n\n return newState;\n };\n }\n }\n\n /**\n * To be called on navigation state changes and creates the transaction.\n */\n private _onStateChange(state: NavigationStateV4 | undefined, updateLatestTransaction: boolean = false): void {\n // it's not guaranteed that a state is always produced.\n // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301\n if (!state || state === undefined) {\n logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');\n\n return;\n }\n\n const currentRoute = this._getCurrentRouteFromState(state);\n\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {\n const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);\n\n let mergedContext = originalContext;\n if (updateLatestTransaction && this._latestTransaction) {\n mergedContext = {\n ...this._latestTransaction.toContext(),\n ...originalContext,\n };\n }\n\n const finalContext = this._prepareFinalContext(mergedContext);\n\n if (updateLatestTransaction && this._latestTransaction) {\n // Update the latest transaction instead of calling onRouteWillChange\n this._latestTransaction.updateWithContext(finalContext);\n const isCustomName = mergedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n } else {\n this._latestTransaction = this.onRouteWillChange(finalContext);\n }\n\n this._onConfirmRoute?.(finalContext);\n\n this._pushRecentRouteKey(currentRoute.key);\n this._prevRoute = currentRoute;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(mergedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...mergedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...mergedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n this._onBeforeNavigateNotSampled(finalContext.name);\n }\n\n return finalContext;\n }\n\n /**\n * Gets the transaction context for a `NavigationRouteV4`\n */\n private _getTransactionContext(\n route: NavigationRouteV4,\n previousRoute?: NavigationRouteV4,\n ): ReactNavigationTransactionContext {\n const data: RouteChangeContextData = {\n route: {\n name: route.routeName, // Include name here too for use in `beforeNavigate`\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: this._recentRouteKeys.includes(route.key),\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.routeName,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n return {\n name: route.routeName,\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n 'routing.route.name': route.routeName,\n },\n data,\n };\n }\n\n /**\n * Gets the current route given a navigation state\n */\n private _getCurrentRouteFromState(state: NavigationStateV4): NavigationRouteV4 {\n const parentRoute = state.routes[state.index];\n\n if (\n 'index' in parentRoute &&\n 'routes' in parentRoute &&\n typeof parentRoute.index === 'number' &&\n Array.isArray(parentRoute.routes)\n ) {\n return this._getCurrentRouteFromState(parentRoute);\n }\n\n return parentRoute as NavigationRouteV4;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Helper to log a transaction that was not sampled due to beforeNavigate */\n private _onBeforeNavigateNotSampled = (transactionName: string): void => {\n logger.log(\n `[ReactNavigationV4Instrumentation] Will not send transaction \"${transactionName}\" due to beforeNavigate.`,\n );\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n }\n}\n\nconst INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext = {\n name: 'App Launch',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n },\n data: {},\n metadata: {\n source: 'view',\n },\n};\n\nexport { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };\n"]}
1
+ {"version":3,"file":"reactnavigationv4.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigationv4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAyC5E,MAAM,cAAc,GAA6B;IAC/C,oBAAoB,EAAE,IAAI;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,gCAAiC,SAAQ,8BAA8B;IAkB3E,YAAmB,UAA6C,EAAE;QAChE,KAAK,EAAE,CAAC;QAhBM,SAAI,GAAW,gCAAgC,CAAC,mBAAmB,CAAC;QAE5E,kBAAa,GAAgC,IAAI,CAAC;QAEzC,uBAAkB,GAAW,GAAG,CAAC;QAG1C,qBAAgB,GAAa,EAAE,CAAC;QAGhC,yBAAoB,GAAY,KAAK,CAAC;QA+O9C,sGAAsG;QAC9F,wBAAmB,GAAG,CAAC,GAAW,EAAQ,EAAE;YAClD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE;gBAC1D,IAAI,CAAC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E;gBACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;gBAC/E,oBAAoB,EAAE,KAAK,CAAC,SAAS;aACtC;YACD,IAAI;SACL,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,yBAAyB,CAAC,KAAwB;QACxD,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE9C,IACE,OAAO,IAAI,WAAW;YACtB,QAAQ,IAAI,WAAW;YACvB,OAAO,WAAW,CAAC,KAAK,KAAK,QAAQ;YACrC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EACjC;YACA,OAAO,IAAI,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;SACpD;QAED,OAAO,WAAgC,CAAC;IAC1C,CAAC;IAkBD,wEAAwE;IAChE,yBAAyB;QAC/B,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;YACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;SACrC;IACH,CAAC;;AAlRa,oDAAmB,GAAW,qBAAqB,CAAC;AAqRpE,MAAM,8BAA8B,GAAuB;IACzD,IAAI,EAAE,YAAY;IAClB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE;QACJ,yBAAyB,EAAE,gCAAgC,CAAC,mBAAmB;KAChF;IACD,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Transaction, TransactionContext } from '@sentry/types';\nimport { logger } from '@sentry/utils';\n\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { OnConfirmRoute, TransactionCreator } from './routingInstrumentation';\nimport { InternalRoutingInstrumentation } from './routingInstrumentation';\nimport type { BeforeNavigate, ReactNavigationTransactionContext, RouteChangeContextData } from './types';\nimport { customTransactionSource, defaultTransactionSource } from './utils';\n\nexport interface NavigationRouteV4 {\n routeName: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n}\n\nexport interface NavigationStateV4 {\n index: number;\n key: string;\n isTransitioning: boolean;\n routeName?: string;\n routes: (NavigationRouteV4 | NavigationStateV4)[];\n}\n\nexport interface AppContainerInstance {\n _navigation: {\n state: NavigationStateV4;\n router: {\n getStateForAction: (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n action: any,\n state: NavigationStateV4,\n ) => NavigationStateV4;\n };\n };\n}\n\ninterface ReactNavigationV4Options {\n /**\n * How long the instrumentation will wait for the route to mount after a change has been initiated,\n * before the transaction is discarded.\n * Time is in ms.\n *\n * Default: 1000\n */\n routeChangeTimeoutMs: number;\n}\n\nconst defaultOptions: ReactNavigationV4Options = {\n routeChangeTimeoutMs: 1000,\n};\n\n/**\n * Instrumentation for React-Navigation V4.\n * Register the app container with `registerAppContainer` to use, or see docs for more details.\n *\n * @deprecated Support for `react-navigation@4` and older will be removed in the next major version of the SDK. Please upgrade to `react-navigation@5` or newer.\n */\nclass ReactNavigationV4Instrumentation extends InternalRoutingInstrumentation {\n public static instrumentationName: string = 'react-navigation-v4';\n\n public readonly name: string = ReactNavigationV4Instrumentation.instrumentationName;\n\n private _appContainer: AppContainerInstance | null = null;\n\n private readonly _maxRecentRouteLen: number = 200;\n\n private _prevRoute?: NavigationRouteV4;\n private _recentRouteKeys: string[] = [];\n\n private _latestTransaction?: Transaction;\n private _initialStateHandled: boolean = false;\n private _stateChangeTimeout?: number | undefined;\n\n private _options: ReactNavigationV4Options;\n\n public constructor(options: Partial<ReactNavigationV4Options> = {}) {\n super();\n\n this._options = {\n ...defaultOptions,\n ...options,\n };\n }\n\n /**\n * Extends by calling _handleInitialState at the end.\n */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n super.registerRoutingInstrumentation(listener, beforeNavigate, onConfirmRoute);\n\n // Need to handle the initial state as the router patch will only attach transactions on subsequent route changes.\n if (!this._initialStateHandled) {\n this._latestTransaction = this.onRouteWillChange(INITIAL_TRANSACTION_CONTEXT_V4);\n if (this._appContainer) {\n this._updateLatestTransaction();\n\n this._initialStateHandled = true;\n } else {\n this._stateChangeTimeout = setTimeout(\n this._discardLatestTransaction.bind(this),\n this._options.routeChangeTimeoutMs,\n );\n }\n }\n }\n\n /**\n * Pass the ref to the app container to register it to the instrumentation\n * @param appContainerRef Ref to an `AppContainer`\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n public registerAppContainer(appContainerRef: any): void {\n /* We prevent duplicate routing instrumentation to be initialized on fast refreshes\n\n Explanation: If the user triggers a fast refresh on the file that the instrumentation is\n initialized in, it will initialize a new instance and will cause undefined behavior.\n */\n if (!RN_GLOBAL_OBJ.__sentry_rn_v4_registered) {\n if ('current' in appContainerRef) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n this._appContainer = appContainerRef.current;\n } else {\n this._appContainer = appContainerRef;\n }\n\n if (this._appContainer) {\n this._patchRouter();\n\n if (!this._initialStateHandled) {\n if (this._latestTransaction) {\n this._updateLatestTransaction();\n } else {\n logger.log(\n '[ReactNavigationV4Instrumentation] App container registered, but integration has not been setup yet.',\n );\n }\n this._initialStateHandled = true;\n }\n\n RN_GLOBAL_OBJ.__sentry_rn_v4_registered = true;\n } else {\n logger.warn('[ReactNavigationV4Instrumentation] Received invalid app container ref!');\n }\n }\n }\n\n /**\n * Updates the latest transaction with the current state and calls beforeNavigate.\n */\n private _updateLatestTransaction(): void {\n // We can assume the ref is present as this is called from registerAppContainer\n if (this._appContainer && this._latestTransaction) {\n const state = this._appContainer._navigation.state;\n\n if (typeof this._stateChangeTimeout !== 'undefined') {\n clearTimeout(this._stateChangeTimeout);\n this._stateChangeTimeout = undefined;\n }\n\n this._onStateChange(state, true);\n }\n }\n\n /**\n * Patches the react navigation router so we can listen to the route changes and attach the `IdleTransaction` before the\n * new screen is mounted.\n */\n private _patchRouter(): void {\n if (this._appContainer) {\n const originalGetStateForAction = this._appContainer._navigation.router.getStateForAction;\n\n this._appContainer._navigation.router.getStateForAction = (action, state) => {\n const newState = originalGetStateForAction(action, state);\n\n this._onStateChange(newState);\n\n return newState;\n };\n }\n }\n\n /**\n * To be called on navigation state changes and creates the transaction.\n */\n private _onStateChange(state: NavigationStateV4 | undefined, updateLatestTransaction: boolean = false): void {\n // it's not guaranteed that a state is always produced.\n // see: https://github.com/react-navigation/react-navigation/blob/45d419be93c34e900e8734ce98321ae875ac4997/packages/core/src/routers/SwitchRouter.js?rgh-link-date=2021-09-25T12%3A43%3A36Z#L301\n if (!state || state === undefined) {\n logger.warn('[ReactNavigationV4Instrumentation] onStateChange called without a valid state.');\n\n return;\n }\n\n const currentRoute = this._getCurrentRouteFromState(state);\n\n // If the route is a different key, this is so we ignore actions that pertain to the same screen.\n if (!this._prevRoute || currentRoute.key !== this._prevRoute.key) {\n const originalContext = this._getTransactionContext(currentRoute, this._prevRoute);\n\n let mergedContext = originalContext;\n if (updateLatestTransaction && this._latestTransaction) {\n mergedContext = {\n ...this._latestTransaction.toContext(),\n ...originalContext,\n };\n }\n\n const finalContext = this._prepareFinalContext(mergedContext);\n\n if (updateLatestTransaction && this._latestTransaction) {\n // Update the latest transaction instead of calling onRouteWillChange\n this._latestTransaction.updateWithContext(finalContext);\n const isCustomName = mergedContext.name !== finalContext.name;\n this._latestTransaction.setName(\n finalContext.name,\n isCustomName ? customTransactionSource : defaultTransactionSource,\n );\n } else {\n this._latestTransaction = this.onRouteWillChange(finalContext);\n }\n\n this._onConfirmRoute?.(finalContext);\n\n this._pushRecentRouteKey(currentRoute.key);\n this._prevRoute = currentRoute;\n }\n }\n\n /** Creates final transaction context before confirmation */\n private _prepareFinalContext(mergedContext: TransactionContext): TransactionContext {\n let finalContext = this._beforeNavigate?.({ ...mergedContext });\n\n // This block is to catch users not returning a transaction context\n if (!finalContext) {\n logger.error(\n `[ReactNavigationV4Instrumentation] beforeNavigate returned ${finalContext}, return context.sampled = false to not send transaction.`,\n );\n\n finalContext = {\n ...mergedContext,\n sampled: false,\n };\n }\n\n if (finalContext.sampled === false) {\n this._onBeforeNavigateNotSampled(finalContext.name);\n }\n\n return finalContext;\n }\n\n /**\n * Gets the transaction context for a `NavigationRouteV4`\n */\n private _getTransactionContext(\n route: NavigationRouteV4,\n previousRoute?: NavigationRouteV4,\n ): ReactNavigationTransactionContext {\n const data: RouteChangeContextData = {\n route: {\n name: route.routeName, // Include name here too for use in `beforeNavigate`\n key: route.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n hasBeenSeen: this._recentRouteKeys.includes(route.key),\n },\n previousRoute: previousRoute\n ? {\n name: previousRoute.routeName,\n key: previousRoute.key,\n // TODO: filter PII params instead of dropping them all\n params: {},\n }\n : null,\n };\n\n return {\n name: route.routeName,\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n 'routing.route.name': route.routeName,\n },\n data,\n };\n }\n\n /**\n * Gets the current route given a navigation state\n */\n private _getCurrentRouteFromState(state: NavigationStateV4): NavigationRouteV4 {\n const parentRoute = state.routes[state.index];\n\n if (\n 'index' in parentRoute &&\n 'routes' in parentRoute &&\n typeof parentRoute.index === 'number' &&\n Array.isArray(parentRoute.routes)\n ) {\n return this._getCurrentRouteFromState(parentRoute);\n }\n\n return parentRoute as NavigationRouteV4;\n }\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n private _pushRecentRouteKey = (key: string): void => {\n this._recentRouteKeys.push(key);\n\n if (this._recentRouteKeys.length > this._maxRecentRouteLen) {\n this._recentRouteKeys = this._recentRouteKeys.slice(this._recentRouteKeys.length - this._maxRecentRouteLen);\n }\n };\n\n /** Helper to log a transaction that was not sampled due to beforeNavigate */\n private _onBeforeNavigateNotSampled = (transactionName: string): void => {\n logger.log(\n `[ReactNavigationV4Instrumentation] Will not send transaction \"${transactionName}\" due to beforeNavigate.`,\n );\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n private _discardLatestTransaction(): void {\n if (this._latestTransaction) {\n this._latestTransaction.sampled = false;\n this._latestTransaction.finish();\n this._latestTransaction = undefined;\n }\n }\n}\n\nconst INITIAL_TRANSACTION_CONTEXT_V4: TransactionContext = {\n name: 'App Launch',\n op: 'navigation',\n tags: {\n 'routing.instrumentation': ReactNavigationV4Instrumentation.instrumentationName,\n },\n data: {},\n metadata: {\n source: 'view',\n },\n};\n\nexport { ReactNavigationV4Instrumentation, INITIAL_TRANSACTION_CONTEXT_V4 };\n"]}
@@ -3,6 +3,11 @@ import type { Transaction, TransactionContext } from '@sentry/types';
3
3
  import type { BeforeNavigate } from './types';
4
4
  export type TransactionCreator = (context: TransactionContext) => Transaction | undefined;
5
5
  export type OnConfirmRoute = (context: TransactionContext) => void;
6
+ /**
7
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
8
+ *
9
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
10
+ */
6
11
  export interface RoutingInstrumentationInstance {
7
12
  /**
8
13
  * Name of the routing instrumentation
@@ -27,8 +32,9 @@ export interface RoutingInstrumentationInstance {
27
32
  onRouteWillChange(context: TransactionContext): Transaction | undefined;
28
33
  }
29
34
  /**
30
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
31
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
35
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
36
+ *
37
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
32
38
  */
33
39
  export declare class RoutingInstrumentation implements RoutingInstrumentationInstance {
34
40
  static instrumentationName: string;
@@ -1 +1 @@
1
- {"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,CAAC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC;IAEhD,kBAAkB;IACX,8BAA8B,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAC7B,IAAI;IAMP,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAS/E;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,SAAS;CAG/E"}
@@ -1,6 +1,7 @@
1
1
  /**
2
- * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.
3
- * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.
2
+ * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.
3
+ *
4
+ * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.
4
5
  */
5
6
  export class RoutingInstrumentation {
6
7
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"routingInstrumentation.js","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AAqCA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAGkB,SAAI,GAAW,sBAAsB,CAAC,mBAAmB,CAAC;IA4B5E,CAAC;IArBC,kBAAkB;IACX,8BAA8B,CACnC,QAA4B,EAC5B,cAA8B,EAC9B,cAA8B;QAE9B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;QAErD,IAAI,WAAW,EAAE;YACf,MAAA,IAAI,CAAC,eAAe,qDAAG,OAAO,CAAC,CAAC;SACjC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA7Ba,0CAAmB,GAAW,8BAA8B,CAAC;AAgC7E;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,OAAO,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { Hub } from '@sentry/core';\nimport type { Transaction, TransactionContext } from '@sentry/types';\n\nimport type { BeforeNavigate } from './types';\n\nexport type TransactionCreator = (context: TransactionContext) => Transaction | undefined;\n\nexport type OnConfirmRoute = (context: TransactionContext) => void;\n\nexport interface RoutingInstrumentationInstance {\n /**\n * Name of the routing instrumentation\n */\n readonly name: string;\n /**\n * Registers a listener that's called on every route change with a `TransactionContext`.\n *\n * Do not overwrite this unless you know what you are doing.\n *\n * @param listener A `RouteListener`\n * @param beforeNavigate BeforeNavigate\n * @param inConfirmRoute OnConfirmRoute\n */\n registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void;\n /**\n * To be called when the route changes, BEFORE the new route mounts.\n * If this is called after a route mounts the child spans will not be correctly attached.\n *\n * @param context A `TransactionContext` used to initialize the transaction.\n */\n onRouteWillChange(context: TransactionContext): Transaction | undefined;\n}\n\n/**\n * Base Routing Instrumentation. Can be used by users to manually instrument custom routers.\n * Pass this to the tracing integration, and call `onRouteWillChange` every time before a route changes.\n */\nexport class RoutingInstrumentation implements RoutingInstrumentationInstance {\n public static instrumentationName: string = 'base-routing-instrumentation';\n\n public readonly name: string = RoutingInstrumentation.instrumentationName;\n\n protected _getCurrentHub?: () => Hub;\n protected _beforeNavigate?: BeforeNavigate;\n protected _onConfirmRoute?: OnConfirmRoute;\n protected _tracingListener?: TransactionCreator;\n\n /** @inheritdoc */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n this._tracingListener = listener;\n this._beforeNavigate = beforeNavigate;\n this._onConfirmRoute = onConfirmRoute;\n }\n\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n const transaction = this._tracingListener?.(context);\n\n if (transaction) {\n this._onConfirmRoute?.(context);\n }\n\n return transaction;\n }\n}\n\n/**\n * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange\n */\nexport class InternalRoutingInstrumentation extends RoutingInstrumentation {\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n return this._tracingListener?.(context);\n }\n}\n"]}
1
+ {"version":3,"file":"routingInstrumentation.js","sourceRoot":"","sources":["../../../src/js/tracing/routingInstrumentation.ts"],"names":[],"mappings":"AA0CA;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAGkB,SAAI,GAAW,sBAAsB,CAAC,mBAAmB,CAAC;IA4B5E,CAAC;IArBC,kBAAkB;IACX,8BAA8B,CACnC,QAA4B,EAC5B,cAA8B,EAC9B,cAA8B;QAE9B,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;QAErD,IAAI,WAAW,EAAE;YACf,MAAA,IAAI,CAAC,eAAe,qDAAG,OAAO,CAAC,CAAC;SACjC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;;AA7Ba,0CAAmB,GAAW,8BAA8B,CAAC;AAgC7E;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,sBAAsB;IACxE,kBAAkB;IACX,iBAAiB,CAAC,OAA2B;;QAClD,OAAO,MAAA,IAAI,CAAC,gBAAgB,qDAAG,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type { Hub } from '@sentry/core';\nimport type { Transaction, TransactionContext } from '@sentry/types';\n\nimport type { BeforeNavigate } from './types';\n\nexport type TransactionCreator = (context: TransactionContext) => Transaction | undefined;\n\nexport type OnConfirmRoute = (context: TransactionContext) => void;\n\n/**\n * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.\n *\n * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.\n */\nexport interface RoutingInstrumentationInstance {\n /**\n * Name of the routing instrumentation\n */\n readonly name: string;\n /**\n * Registers a listener that's called on every route change with a `TransactionContext`.\n *\n * Do not overwrite this unless you know what you are doing.\n *\n * @param listener A `RouteListener`\n * @param beforeNavigate BeforeNavigate\n * @param inConfirmRoute OnConfirmRoute\n */\n registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void;\n /**\n * To be called when the route changes, BEFORE the new route mounts.\n * If this is called after a route mounts the child spans will not be correctly attached.\n *\n * @param context A `TransactionContext` used to initialize the transaction.\n */\n onRouteWillChange(context: TransactionContext): Transaction | undefined;\n}\n\n/**\n * @deprecated Use `Integration` from `@sentry/types` and `startIdleTransaction` from `@sentry/core` instead.\n *\n * Or use `startIdleNavigationSpan` from `@sentry/react-native@^6`.\n */\nexport class RoutingInstrumentation implements RoutingInstrumentationInstance {\n public static instrumentationName: string = 'base-routing-instrumentation';\n\n public readonly name: string = RoutingInstrumentation.instrumentationName;\n\n protected _getCurrentHub?: () => Hub;\n protected _beforeNavigate?: BeforeNavigate;\n protected _onConfirmRoute?: OnConfirmRoute;\n protected _tracingListener?: TransactionCreator;\n\n /** @inheritdoc */\n public registerRoutingInstrumentation(\n listener: TransactionCreator,\n beforeNavigate: BeforeNavigate,\n onConfirmRoute: OnConfirmRoute,\n ): void {\n this._tracingListener = listener;\n this._beforeNavigate = beforeNavigate;\n this._onConfirmRoute = onConfirmRoute;\n }\n\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n const transaction = this._tracingListener?.(context);\n\n if (transaction) {\n this._onConfirmRoute?.(context);\n }\n\n return transaction;\n }\n}\n\n/**\n * Internal base routing instrumentation where `_onConfirmRoute` is not called in onRouteWillChange\n */\nexport class InternalRoutingInstrumentation extends RoutingInstrumentation {\n /** @inheritdoc */\n public onRouteWillChange(context: TransactionContext): Transaction | undefined {\n return this._tracingListener?.(context);\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export declare const SDK_PACKAGE_NAME = "npm:@sentry/react-native";
2
2
  export declare const SDK_NAME = "sentry.javascript.react-native";
3
- export declare const SDK_VERSION = "5.31.1";
3
+ export declare const SDK_VERSION = "5.33.0";
4
4
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
2
2
  export const SDK_NAME = 'sentry.javascript.react-native';
3
- export const SDK_VERSION = '5.31.1';
3
+ export const SDK_VERSION = '5.33.0';
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.31.1';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/js/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';\nexport const SDK_NAME = 'sentry.javascript.react-native';\nexport const SDK_VERSION = '5.33.0';\n"]}
@@ -55,7 +55,7 @@ interface SentryNativeWrapper {
55
55
  nativeCrash(): void;
56
56
  fetchModules(): Promise<Record<string, string> | null>;
57
57
  fetchViewHierarchy(): PromiseLike<Uint8Array | null>;
58
- startProfiling(): boolean;
58
+ startProfiling(platformProfilers: boolean): boolean;
59
59
  stopProfiling(): {
60
60
  hermesProfile: Hermes.Profile;
61
61
  nativeProfile?: NativeProfileEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,aAAa,EACb,IAAI,EACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,EAErB,iBAAiB,EACjB,IAAI,EACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAMjE;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,GAAG,SAAS,CAIpD;AAID,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC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AC3C;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,mBA6mBpB,CAAC"}
@@ -383,14 +383,14 @@ export const NATIVE = {
383
383
  return raw ? new Uint8Array(raw) : null;
384
384
  });
385
385
  },
386
- startProfiling() {
386
+ startProfiling(platformProfilers) {
387
387
  if (!this.enableNative) {
388
388
  throw this._DisabledNativeError;
389
389
  }
390
390
  if (!this._isModuleLoaded(RNSentry)) {
391
391
  throw this._NativeClientError;
392
392
  }
393
- const { started, error } = RNSentry.startProfiling();
393
+ const { started, error } = RNSentry.startProfiling(platformProfilers);
394
394
  if (started) {
395
395
  logger.log('[NATIVE] Start Profiling');
396
396
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAerC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,oBAAoB,EAAE;QAC3B,CAAC,CAAC,oBAAoB,CAAC,mBAAmB,IAAI,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,CAAO,UAAU,CAAC;QAC5G,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC;AAC7B,CAAC;AAED,MAAM,QAAQ,GAAqB,iBAAiB,EAAE,CAAC;AA4EvD,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAwB;I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,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;;OAIG;IAEH,cAAc,CAAC,KAAY;;QACzB,MAAM,SAAS,mCACV,KAAK,KACR,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAChE,WAAW,EAAE,MAAA,KAAK,CAAC,WAAW,0CAAE,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,iCAC7C,UAAU,KACb,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,IAC1E,CAAC,GACJ,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;OAIG;IAEH,aAAa,CAAC,KAAoB;QAChC,IAAI,KAAK,IAAK,KAAuB,EAAE;YACrC,OAAO,OAAwB,CAAC;SACjC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAwB;QACtC,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;IAED,oBAAoB,EAAE,IAAI,WAAW,CAAC,oBAAoB,CAAC;IAE3D,kBAAkB,EAAE,IAAI,WAAW,CAAC,wDAAwD,CAAC;IAE7F,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ,CAAC,EAAE;CACtB,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type {\n BaseEnvelopeItemHeaders,\n Breadcrumb,\n Envelope,\n EnvelopeItem,\n Event,\n Package,\n SeverityLevel,\n User,\n} from '@sentry/types';\nimport { logger, normalize, SentryError } from '@sentry/utils';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { isHardCrash } from './misc';\nimport type {\n NativeAppStartResponse,\n NativeDeviceContextsResponse,\n NativeFramesResponse,\n NativeReleaseResponse,\n NativeScreenshot,\n NativeStackFrames,\n Spec,\n} from './NativeRNSentry';\nimport type { ReactNativeClientOptions } from './options';\nimport type * as Hermes from './profiling/hermes';\nimport type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';\nimport type { MobileReplayOptions } from './replay/mobilereplay';\nimport type { RequiredKeysUser } from './user';\nimport { isTurboModuleEnabled } from './utils/environment';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { base64StringFromByteArray, utf8ToBytes } from './vendor';\n\n/**\n * Returns the RNSentry module. Dynamically resolves if NativeModule or TurboModule is used.\n */\nexport function getRNSentryModule(): Spec | undefined {\n return isTurboModuleEnabled()\n ? ReactNativeLibraries.TurboModuleRegistry && ReactNativeLibraries.TurboModuleRegistry.get<Spec>('RNSentry')\n : NativeModules.RNSentry;\n}\n\nconst RNSentry: Spec | undefined = getRNSentryModule();\n\nexport interface Screenshot {\n data: Uint8Array;\n contentType: string;\n filename: string;\n}\n\nexport type NativeSdkOptions = Partial<ReactNativeClientOptions> & {\n mobileReplayOptions: MobileReplayOptions | undefined;\n};\n\ninterface SentryNativeWrapper {\n enableNative: boolean;\n nativeIsReady: boolean;\n platform: typeof Platform.OS;\n\n _NativeClientError: Error;\n _DisabledNativeError: Error;\n\n _processItem(envelopeItem: EnvelopeItem): EnvelopeItem;\n _processLevels(event: Event): Event;\n _processLevel(level: SeverityLevel): SeverityLevel;\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string };\n _isModuleLoaded(module: Spec | undefined): module is Spec;\n\n isNativeAvailable(): boolean;\n\n initNativeSdk(options: NativeSdkOptions): PromiseLike<boolean>;\n closeNativeSdk(): PromiseLike<void>;\n\n sendEnvelope(envelope: Envelope): Promise<void>;\n captureScreenshot(): Promise<Screenshot[] | null>;\n\n fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;\n fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;\n fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;\n fetchNativeSdkInfo(): PromiseLike<Package | null>;\n\n disableNativeFramesTracking(): void;\n enableNativeFramesTracking(): void;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n setContext(key: string, context: { [key: string]: unknown } | null): void;\n clearBreadcrumbs(): void;\n setExtra(key: string, extra: unknown): void;\n setUser(user: User | null): void;\n setTag(key: string, value: string): void;\n\n nativeCrash(): void;\n\n fetchModules(): Promise<Record<string, string> | null>;\n fetchViewHierarchy(): PromiseLike<Uint8Array | null>;\n\n startProfiling(): boolean;\n stopProfiling(): {\n hermesProfile: Hermes.Profile;\n nativeProfile?: NativeProfileEvent;\n androidProfile?: NativeAndroidProfileEvent;\n } | null;\n\n fetchNativePackageName(): string | null;\n\n /**\n * Fetches native stack frames and debug images for the instructions addresses.\n */\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n\n captureReplay(isHardCrash: boolean): Promise<string | null>;\n getCurrentReplayId(): string | null;\n\n crashedLastRun(): Promise<boolean | null>;\n}\n\nconst EOL = utf8ToBytes('\\n');\n\n/**\n * Our internal interface for calling native functions\n */\nexport const NATIVE: SentryNativeWrapper = {\n async fetchModules(): Promise<Record<string, string> | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const raw = await RNSentry.fetchModules();\n if (raw) {\n return JSON.parse(raw);\n }\n return null;\n },\n /**\n * Sending the envelope over the bridge to native\n * @param envelope Envelope\n */\n async sendEnvelope(envelope: Envelope): Promise<void> {\n if (!this.enableNative) {\n logger.warn('Event was skipped as native SDK is not enabled.');\n return;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const [envelopeHeader, envelopeItems] = envelope;\n\n const headerString = JSON.stringify(envelopeHeader);\n const headerBytes = utf8ToBytes(headerString);\n let envelopeBytes: Uint8Array = new Uint8Array(headerBytes.length + EOL.length);\n envelopeBytes.set(headerBytes);\n envelopeBytes.set(EOL, headerBytes.length);\n\n let hardCrashed: boolean = false;\n for (const rawItem of envelopeItems) {\n const [itemHeader, itemPayload] = this._processItem(rawItem);\n\n let bytesContentType: string;\n let bytesPayload: number[] | Uint8Array | undefined;\n if (typeof itemPayload === 'string') {\n bytesContentType = 'text/plain';\n bytesPayload = utf8ToBytes(itemPayload);\n } else if (itemPayload instanceof Uint8Array) {\n bytesContentType =\n typeof itemHeader.content_type === 'string' ? itemHeader.content_type : 'application/octet-stream';\n bytesPayload = itemPayload;\n } else {\n bytesContentType = 'application/json';\n bytesPayload = utf8ToBytes(JSON.stringify(itemPayload));\n if (!hardCrashed) {\n hardCrashed = isHardCrash(itemPayload);\n }\n }\n\n // Content type is not inside BaseEnvelopeItemHeaders.\n (itemHeader as BaseEnvelopeItemHeaders).content_type = bytesContentType;\n (itemHeader as BaseEnvelopeItemHeaders).length = bytesPayload.length;\n const serializedItemHeader = JSON.stringify(itemHeader);\n\n const bytesItemHeader = utf8ToBytes(serializedItemHeader);\n const newBytes = new Uint8Array(\n envelopeBytes.length + bytesItemHeader.length + EOL.length + bytesPayload.length + EOL.length,\n );\n newBytes.set(envelopeBytes);\n newBytes.set(bytesItemHeader, envelopeBytes.length);\n newBytes.set(EOL, envelopeBytes.length + bytesItemHeader.length);\n newBytes.set(bytesPayload, envelopeBytes.length + bytesItemHeader.length + EOL.length);\n newBytes.set(EOL, envelopeBytes.length + bytesItemHeader.length + EOL.length + bytesPayload.length);\n envelopeBytes = newBytes;\n }\n\n await RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed });\n },\n\n /**\n * Starts native with the provided options.\n * @param options ReactNativeClientOptions\n */\n async initNativeSdk(originalOptions: NativeSdkOptions): Promise<boolean> {\n const options: NativeSdkOptions = {\n enableNative: true,\n autoInitializeNativeSdk: true,\n ...originalOptions,\n };\n\n if (!options.enableNative) {\n if (options.enableNativeNagger) {\n logger.warn('Note: Native Sentry SDK is disabled.');\n }\n this.enableNative = false;\n return false;\n }\n if (!options.autoInitializeNativeSdk) {\n if (options.enableNativeNagger) {\n logger.warn(\n 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false',\n );\n }\n this.enableNative = true;\n return false;\n }\n\n if (!options.dsn) {\n logger.warn(\n 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.',\n );\n this.enableNative = false;\n return false;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // filter out all the options that would crash native.\n /* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const { beforeSend, beforeBreadcrumb, beforeSendTransaction, integrations, ...filteredOptions } = options;\n /* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const nativeIsReady = await RNSentry.initNativeSdk(filteredOptions);\n\n this.nativeIsReady = nativeIsReady;\n this.enableNative = true;\n\n return nativeIsReady;\n },\n\n /**\n * Fetches the release from native\n */\n async fetchNativeRelease(): Promise<NativeReleaseResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeRelease();\n },\n\n /**\n * Fetches the Sdk info for the native sdk.\n */\n async fetchNativeSdkInfo(): Promise<Package | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeSdkInfo();\n },\n\n /**\n * Fetches the device contexts. Not used on Android.\n */\n async fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeDeviceContexts();\n },\n\n async fetchNativeAppStart(): Promise<NativeAppStartResponse | null> {\n if (!this.enableNative) {\n logger.warn(this._DisabledNativeError);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.error(this._NativeClientError);\n return null;\n }\n\n return RNSentry.fetchNativeAppStart();\n },\n\n async fetchNativeFrames(): Promise<NativeFramesResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeFrames();\n },\n\n /**\n * Triggers a native crash.\n * Use this only for testing purposes.\n */\n nativeCrash(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.crash();\n },\n\n /**\n * Sets the user in the native scope.\n * Passing null clears the user.\n */\n setUser(user: User | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // separate and serialize all non-default user keys.\n let userKeys = null;\n let userDataKeys = null;\n if (user) {\n const { id, ip_address, email, username, segment, ...otherKeys } = user;\n const requiredUser: RequiredKeysUser = {\n id,\n ip_address,\n email,\n username,\n segment,\n };\n userKeys = this._serializeObject(requiredUser);\n userDataKeys = this._serializeObject(otherKeys);\n }\n\n RNSentry.setUser(userKeys, userDataKeys);\n },\n\n /**\n * Sets a tag in the native module.\n * @param key string\n * @param value string\n */\n setTag(key: string, value: string): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const stringifiedValue = typeof value === 'string' ? value : JSON.stringify(value);\n\n RNSentry.setTag(key, stringifiedValue);\n },\n\n /**\n * Sets an extra in the native scope, will stringify\n * extra value if it isn't already a string.\n * @param key string\n * @param extra any\n */\n setExtra(key: string, extra: unknown): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // we stringify the extra as native only takes in strings.\n const stringifiedExtra = typeof extra === 'string' ? extra : JSON.stringify(extra);\n\n RNSentry.setExtra(key, stringifiedExtra);\n },\n\n /**\n * Adds breadcrumb to the native scope.\n * @param breadcrumb Breadcrumb\n */\n addBreadcrumb(breadcrumb: Breadcrumb): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.addBreadcrumb({\n ...breadcrumb,\n // Process and convert deprecated levels\n level: breadcrumb.level ? this._processLevel(breadcrumb.level) : undefined,\n });\n },\n\n /**\n * Clears breadcrumbs on the native scope.\n */\n clearBreadcrumbs(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.clearBreadcrumbs();\n },\n\n /**\n * Sets context on the native scope. Not implemented in Android yet.\n * @param key string\n * @param context key-value map\n */\n setContext(key: string, context: { [key: string]: unknown } | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.setContext(key, context !== null ? normalize(context) : null);\n },\n\n /**\n * Closes the Native Layer SDK\n */\n async closeNativeSdk(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.closeNativeSdk().then(() => {\n this.enableNative = false;\n });\n },\n\n disableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.disableNativeFramesTracking();\n },\n\n enableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.enableNativeFramesTracking();\n },\n\n isNativeAvailable(): boolean {\n return this._isModuleLoaded(RNSentry);\n },\n\n async captureScreenshot(): Promise<Screenshot[] | null> {\n if (!this.enableNative) {\n logger.warn(this._DisabledNativeError);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.error(this._NativeClientError);\n return null;\n }\n\n let raw: NativeScreenshot[] | null | undefined;\n try {\n raw = await RNSentry.captureScreenshot();\n } catch (e) {\n logger.warn('Failed to capture screenshot', e);\n }\n\n if (raw) {\n return raw.map((item: NativeScreenshot) => ({\n ...item,\n data: new Uint8Array(item.data),\n }));\n } else {\n return null;\n }\n },\n\n async fetchViewHierarchy(): Promise<Uint8Array | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const raw = await RNSentry.fetchViewHierarchy();\n return raw ? new Uint8Array(raw) : null;\n },\n\n startProfiling(): boolean {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const { started, error } = RNSentry.startProfiling();\n if (started) {\n logger.log('[NATIVE] Start Profiling');\n } else {\n logger.error('[NATIVE] Start Profiling Failed', error);\n }\n\n return !!started;\n },\n\n stopProfiling(): {\n hermesProfile: Hermes.Profile;\n nativeProfile?: NativeProfileEvent;\n androidProfile?: NativeAndroidProfileEvent;\n } | null {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const { profile, nativeProfile, androidProfile, error } = RNSentry.stopProfiling();\n if (!profile || error) {\n logger.error('[NATIVE] Stop Profiling Failed', error);\n return null;\n }\n if (Platform.OS === 'ios' && !nativeProfile) {\n logger.warn('[NATIVE] Stop Profiling Failed: No Native Profile');\n }\n if (Platform.OS === 'android' && !androidProfile) {\n logger.warn('[NATIVE] Stop Profiling Failed: No Android Profile');\n }\n\n try {\n return {\n hermesProfile: JSON.parse(profile) as Hermes.Profile,\n nativeProfile: nativeProfile as NativeProfileEvent | undefined,\n androidProfile: androidProfile as NativeAndroidProfileEvent | undefined,\n };\n } catch (e) {\n logger.error('[NATIVE] Failed to parse Hermes Profile JSON', e);\n return null;\n }\n },\n\n fetchNativePackageName(): string | null {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n return RNSentry.fetchNativePackageName() || null;\n },\n\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n return RNSentry.fetchNativeStackFramesBy(instructionsAddr) || null;\n },\n\n async initNativeReactNavigationNewFrameTracking(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.initNativeReactNavigationNewFrameTracking();\n },\n\n async captureReplay(isHardCrash: boolean): Promise<string | null> {\n if (!this.enableNative) {\n logger.warn(`[NATIVE] \\`${this.captureReplay.name}\\` is not available when native is disabled.`);\n return Promise.resolve(null);\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.warn(`[NATIVE] \\`${this.captureReplay.name}\\` is not available when native is not available.`);\n return Promise.resolve(null);\n }\n\n return (await RNSentry.captureReplay(isHardCrash)) || null;\n },\n\n getCurrentReplayId(): string | null {\n if (!this.enableNative) {\n logger.warn(`[NATIVE] \\`${this.getCurrentReplayId.name}\\` is not available when native is disabled.`);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.warn(`[NATIVE] \\`${this.getCurrentReplayId.name}\\` is not available when native is not available.`);\n return null;\n }\n\n return RNSentry.getCurrentReplayId() || null;\n },\n\n async crashedLastRun(): Promise<boolean | null> {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n const result = RNSentry.crashedLastRun();\n return typeof result === 'boolean' ? result : null;\n },\n\n /**\n * Gets the event from envelopeItem and applies the level filter to the selected event.\n * @param data An envelope item containing the event.\n * @returns The event from envelopeItem or undefined.\n */\n _processItem(item: EnvelopeItem): EnvelopeItem {\n const [itemHeader, itemPayload] = item;\n\n if (itemHeader.type == 'event' || itemHeader.type == 'transaction') {\n const event = this._processLevels(itemPayload as Event);\n\n if (NATIVE.platform === 'android') {\n if ('message' in event) {\n // @ts-expect-error Android still uses the old message object, without this the serialization of events will break.\n event.message = { message: event.message };\n }\n }\n\n return [itemHeader, event];\n }\n\n return item;\n },\n\n /**\n * Serializes all values of root-level keys into strings.\n * @param data key-value map.\n * @returns An object where all root-level values are strings.\n */\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string } {\n const serialized: { [key: string]: string } = {};\n\n Object.keys(data).forEach(dataKey => {\n const value = data[dataKey];\n serialized[dataKey] = typeof value === 'string' ? value : JSON.stringify(value);\n });\n\n return serialized;\n },\n\n /**\n * Convert js severity level in event.level and event.breadcrumbs to more widely supported levels.\n * @param event\n * @returns Event with more widely supported Severity level strings\n */\n\n _processLevels(event: Event): Event {\n const processed: Event = {\n ...event,\n level: event.level ? this._processLevel(event.level) : undefined,\n breadcrumbs: event.breadcrumbs?.map(breadcrumb => ({\n ...breadcrumb,\n level: breadcrumb.level ? this._processLevel(breadcrumb.level) : undefined,\n })),\n };\n\n return processed;\n },\n\n /**\n * Convert js severity level which has critical and log to more widely supported levels.\n * @param level\n * @returns More widely supported Severity level strings\n */\n\n _processLevel(level: SeverityLevel): SeverityLevel {\n if (level == ('log' as SeverityLevel)) {\n return 'debug' as SeverityLevel;\n }\n return level;\n },\n\n /**\n * Checks whether the RNSentry module is loaded.\n */\n _isModuleLoaded(module: Spec | undefined): module is Spec {\n return !!module;\n },\n\n _DisabledNativeError: new SentryError('Native is disabled'),\n\n _NativeClientError: new SentryError(\"Native Client is not available, can't start on native.\"),\n\n enableNative: true,\n nativeIsReady: false,\n platform: Platform.OS,\n};\n"]}
1
+ {"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../src/js/wrapper.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,MAAM,EAAE,SAAS,EA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CAAC;IACnB,CAAC;IAED;;;;OAIG;IAEH,aAAa,CAAC,KAAoB;QAChC,IAAI,KAAK,IAAK,KAAuB,EAAE;YACrC,OAAO,OAAwB,CAAC;SACjC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAwB;QACtC,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;IAED,oBAAoB,EAAE,IAAI,WAAW,CAAC,oBAAoB,CAAC;IAE3D,kBAAkB,EAAE,IAAI,WAAW,CAAC,wDAAwD,CAAC;IAE7F,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ,CAAC,EAAE;CACtB,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type {\n BaseEnvelopeItemHeaders,\n Breadcrumb,\n Envelope,\n EnvelopeItem,\n Event,\n Package,\n SeverityLevel,\n User,\n} from '@sentry/types';\nimport { logger, normalize, SentryError } from '@sentry/utils';\nimport { NativeModules, Platform } from 'react-native';\n\nimport { isHardCrash } from './misc';\nimport type {\n NativeAppStartResponse,\n NativeDeviceContextsResponse,\n NativeFramesResponse,\n NativeReleaseResponse,\n NativeScreenshot,\n NativeStackFrames,\n Spec,\n} from './NativeRNSentry';\nimport type { ReactNativeClientOptions } from './options';\nimport type * as Hermes from './profiling/hermes';\nimport type { NativeAndroidProfileEvent, NativeProfileEvent } from './profiling/nativeTypes';\nimport type { MobileReplayOptions } from './replay/mobilereplay';\nimport type { RequiredKeysUser } from './user';\nimport { isTurboModuleEnabled } from './utils/environment';\nimport { ReactNativeLibraries } from './utils/rnlibraries';\nimport { base64StringFromByteArray, utf8ToBytes } from './vendor';\n\n/**\n * Returns the RNSentry module. Dynamically resolves if NativeModule or TurboModule is used.\n */\nexport function getRNSentryModule(): Spec | undefined {\n return isTurboModuleEnabled()\n ? ReactNativeLibraries.TurboModuleRegistry && ReactNativeLibraries.TurboModuleRegistry.get<Spec>('RNSentry')\n : NativeModules.RNSentry;\n}\n\nconst RNSentry: Spec | undefined = getRNSentryModule();\n\nexport interface Screenshot {\n data: Uint8Array;\n contentType: string;\n filename: string;\n}\n\nexport type NativeSdkOptions = Partial<ReactNativeClientOptions> & {\n mobileReplayOptions: MobileReplayOptions | undefined;\n};\n\ninterface SentryNativeWrapper {\n enableNative: boolean;\n nativeIsReady: boolean;\n platform: typeof Platform.OS;\n\n _NativeClientError: Error;\n _DisabledNativeError: Error;\n\n _processItem(envelopeItem: EnvelopeItem): EnvelopeItem;\n _processLevels(event: Event): Event;\n _processLevel(level: SeverityLevel): SeverityLevel;\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string };\n _isModuleLoaded(module: Spec | undefined): module is Spec;\n\n isNativeAvailable(): boolean;\n\n initNativeSdk(options: NativeSdkOptions): PromiseLike<boolean>;\n closeNativeSdk(): PromiseLike<void>;\n\n sendEnvelope(envelope: Envelope): Promise<void>;\n captureScreenshot(): Promise<Screenshot[] | null>;\n\n fetchNativeRelease(): PromiseLike<NativeReleaseResponse>;\n fetchNativeDeviceContexts(): PromiseLike<NativeDeviceContextsResponse | null>;\n fetchNativeAppStart(): PromiseLike<NativeAppStartResponse | null>;\n fetchNativeFrames(): PromiseLike<NativeFramesResponse | null>;\n fetchNativeSdkInfo(): PromiseLike<Package | null>;\n\n disableNativeFramesTracking(): void;\n enableNativeFramesTracking(): void;\n\n addBreadcrumb(breadcrumb: Breadcrumb): void;\n setContext(key: string, context: { [key: string]: unknown } | null): void;\n clearBreadcrumbs(): void;\n setExtra(key: string, extra: unknown): void;\n setUser(user: User | null): void;\n setTag(key: string, value: string): void;\n\n nativeCrash(): void;\n\n fetchModules(): Promise<Record<string, string> | null>;\n fetchViewHierarchy(): PromiseLike<Uint8Array | null>;\n\n startProfiling(platformProfilers: boolean): boolean;\n stopProfiling(): {\n hermesProfile: Hermes.Profile;\n nativeProfile?: NativeProfileEvent;\n androidProfile?: NativeAndroidProfileEvent;\n } | null;\n\n fetchNativePackageName(): string | null;\n\n /**\n * Fetches native stack frames and debug images for the instructions addresses.\n */\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null;\n initNativeReactNavigationNewFrameTracking(): Promise<void>;\n\n captureReplay(isHardCrash: boolean): Promise<string | null>;\n getCurrentReplayId(): string | null;\n\n crashedLastRun(): Promise<boolean | null>;\n}\n\nconst EOL = utf8ToBytes('\\n');\n\n/**\n * Our internal interface for calling native functions\n */\nexport const NATIVE: SentryNativeWrapper = {\n async fetchModules(): Promise<Record<string, string> | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const raw = await RNSentry.fetchModules();\n if (raw) {\n return JSON.parse(raw);\n }\n return null;\n },\n /**\n * Sending the envelope over the bridge to native\n * @param envelope Envelope\n */\n async sendEnvelope(envelope: Envelope): Promise<void> {\n if (!this.enableNative) {\n logger.warn('Event was skipped as native SDK is not enabled.');\n return;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const [envelopeHeader, envelopeItems] = envelope;\n\n const headerString = JSON.stringify(envelopeHeader);\n const headerBytes = utf8ToBytes(headerString);\n let envelopeBytes: Uint8Array = new Uint8Array(headerBytes.length + EOL.length);\n envelopeBytes.set(headerBytes);\n envelopeBytes.set(EOL, headerBytes.length);\n\n let hardCrashed: boolean = false;\n for (const rawItem of envelopeItems) {\n const [itemHeader, itemPayload] = this._processItem(rawItem);\n\n let bytesContentType: string;\n let bytesPayload: number[] | Uint8Array | undefined;\n if (typeof itemPayload === 'string') {\n bytesContentType = 'text/plain';\n bytesPayload = utf8ToBytes(itemPayload);\n } else if (itemPayload instanceof Uint8Array) {\n bytesContentType =\n typeof itemHeader.content_type === 'string' ? itemHeader.content_type : 'application/octet-stream';\n bytesPayload = itemPayload;\n } else {\n bytesContentType = 'application/json';\n bytesPayload = utf8ToBytes(JSON.stringify(itemPayload));\n if (!hardCrashed) {\n hardCrashed = isHardCrash(itemPayload);\n }\n }\n\n // Content type is not inside BaseEnvelopeItemHeaders.\n (itemHeader as BaseEnvelopeItemHeaders).content_type = bytesContentType;\n (itemHeader as BaseEnvelopeItemHeaders).length = bytesPayload.length;\n const serializedItemHeader = JSON.stringify(itemHeader);\n\n const bytesItemHeader = utf8ToBytes(serializedItemHeader);\n const newBytes = new Uint8Array(\n envelopeBytes.length + bytesItemHeader.length + EOL.length + bytesPayload.length + EOL.length,\n );\n newBytes.set(envelopeBytes);\n newBytes.set(bytesItemHeader, envelopeBytes.length);\n newBytes.set(EOL, envelopeBytes.length + bytesItemHeader.length);\n newBytes.set(bytesPayload, envelopeBytes.length + bytesItemHeader.length + EOL.length);\n newBytes.set(EOL, envelopeBytes.length + bytesItemHeader.length + EOL.length + bytesPayload.length);\n envelopeBytes = newBytes;\n }\n\n await RNSentry.captureEnvelope(base64StringFromByteArray(envelopeBytes), { hardCrashed });\n },\n\n /**\n * Starts native with the provided options.\n * @param options ReactNativeClientOptions\n */\n async initNativeSdk(originalOptions: NativeSdkOptions): Promise<boolean> {\n const options: NativeSdkOptions = {\n enableNative: true,\n autoInitializeNativeSdk: true,\n ...originalOptions,\n };\n\n if (!options.enableNative) {\n if (options.enableNativeNagger) {\n logger.warn('Note: Native Sentry SDK is disabled.');\n }\n this.enableNative = false;\n return false;\n }\n if (!options.autoInitializeNativeSdk) {\n if (options.enableNativeNagger) {\n logger.warn(\n 'Note: Native Sentry SDK was not initialized automatically, you will need to initialize it manually. If you wish to disable the native SDK and get rid of this warning, pass enableNative: false',\n );\n }\n this.enableNative = true;\n return false;\n }\n\n if (!options.dsn) {\n logger.warn(\n 'Warning: No DSN was provided. The Sentry SDK will be disabled. Native SDK will also not be initalized.',\n );\n this.enableNative = false;\n return false;\n }\n\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // filter out all the options that would crash native.\n /* eslint-disable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const { beforeSend, beforeBreadcrumb, beforeSendTransaction, integrations, ...filteredOptions } = options;\n /* eslint-enable @typescript-eslint/unbound-method,@typescript-eslint/no-unused-vars */\n const nativeIsReady = await RNSentry.initNativeSdk(filteredOptions);\n\n this.nativeIsReady = nativeIsReady;\n this.enableNative = true;\n\n return nativeIsReady;\n },\n\n /**\n * Fetches the release from native\n */\n async fetchNativeRelease(): Promise<NativeReleaseResponse> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeRelease();\n },\n\n /**\n * Fetches the Sdk info for the native sdk.\n */\n async fetchNativeSdkInfo(): Promise<Package | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeSdkInfo();\n },\n\n /**\n * Fetches the device contexts. Not used on Android.\n */\n async fetchNativeDeviceContexts(): Promise<NativeDeviceContextsResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeDeviceContexts();\n },\n\n async fetchNativeAppStart(): Promise<NativeAppStartResponse | null> {\n if (!this.enableNative) {\n logger.warn(this._DisabledNativeError);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.error(this._NativeClientError);\n return null;\n }\n\n return RNSentry.fetchNativeAppStart();\n },\n\n async fetchNativeFrames(): Promise<NativeFramesResponse | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n return RNSentry.fetchNativeFrames();\n },\n\n /**\n * Triggers a native crash.\n * Use this only for testing purposes.\n */\n nativeCrash(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.crash();\n },\n\n /**\n * Sets the user in the native scope.\n * Passing null clears the user.\n */\n setUser(user: User | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // separate and serialize all non-default user keys.\n let userKeys = null;\n let userDataKeys = null;\n if (user) {\n const { id, ip_address, email, username, segment, ...otherKeys } = user;\n const requiredUser: RequiredKeysUser = {\n id,\n ip_address,\n email,\n username,\n segment,\n };\n userKeys = this._serializeObject(requiredUser);\n userDataKeys = this._serializeObject(otherKeys);\n }\n\n RNSentry.setUser(userKeys, userDataKeys);\n },\n\n /**\n * Sets a tag in the native module.\n * @param key string\n * @param value string\n */\n setTag(key: string, value: string): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const stringifiedValue = typeof value === 'string' ? value : JSON.stringify(value);\n\n RNSentry.setTag(key, stringifiedValue);\n },\n\n /**\n * Sets an extra in the native scope, will stringify\n * extra value if it isn't already a string.\n * @param key string\n * @param extra any\n */\n setExtra(key: string, extra: unknown): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n // we stringify the extra as native only takes in strings.\n const stringifiedExtra = typeof extra === 'string' ? extra : JSON.stringify(extra);\n\n RNSentry.setExtra(key, stringifiedExtra);\n },\n\n /**\n * Adds breadcrumb to the native scope.\n * @param breadcrumb Breadcrumb\n */\n addBreadcrumb(breadcrumb: Breadcrumb): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.addBreadcrumb({\n ...breadcrumb,\n // Process and convert deprecated levels\n level: breadcrumb.level ? this._processLevel(breadcrumb.level) : undefined,\n });\n },\n\n /**\n * Clears breadcrumbs on the native scope.\n */\n clearBreadcrumbs(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.clearBreadcrumbs();\n },\n\n /**\n * Sets context on the native scope. Not implemented in Android yet.\n * @param key string\n * @param context key-value map\n */\n setContext(key: string, context: { [key: string]: unknown } | null): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n RNSentry.setContext(key, context !== null ? normalize(context) : null);\n },\n\n /**\n * Closes the Native Layer SDK\n */\n async closeNativeSdk(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.closeNativeSdk().then(() => {\n this.enableNative = false;\n });\n },\n\n disableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.disableNativeFramesTracking();\n },\n\n enableNativeFramesTracking(): void {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n RNSentry.enableNativeFramesTracking();\n },\n\n isNativeAvailable(): boolean {\n return this._isModuleLoaded(RNSentry);\n },\n\n async captureScreenshot(): Promise<Screenshot[] | null> {\n if (!this.enableNative) {\n logger.warn(this._DisabledNativeError);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.error(this._NativeClientError);\n return null;\n }\n\n let raw: NativeScreenshot[] | null | undefined;\n try {\n raw = await RNSentry.captureScreenshot();\n } catch (e) {\n logger.warn('Failed to capture screenshot', e);\n }\n\n if (raw) {\n return raw.map((item: NativeScreenshot) => ({\n ...item,\n data: new Uint8Array(item.data),\n }));\n } else {\n return null;\n }\n },\n\n async fetchViewHierarchy(): Promise<Uint8Array | null> {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const raw = await RNSentry.fetchViewHierarchy();\n return raw ? new Uint8Array(raw) : null;\n },\n\n startProfiling(platformProfilers: boolean): boolean {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const { started, error } = RNSentry.startProfiling(platformProfilers);\n if (started) {\n logger.log('[NATIVE] Start Profiling');\n } else {\n logger.error('[NATIVE] Start Profiling Failed', error);\n }\n\n return !!started;\n },\n\n stopProfiling(): {\n hermesProfile: Hermes.Profile;\n nativeProfile?: NativeProfileEvent;\n androidProfile?: NativeAndroidProfileEvent;\n } | null {\n if (!this.enableNative) {\n throw this._DisabledNativeError;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n throw this._NativeClientError;\n }\n\n const { profile, nativeProfile, androidProfile, error } = RNSentry.stopProfiling();\n if (!profile || error) {\n logger.error('[NATIVE] Stop Profiling Failed', error);\n return null;\n }\n if (Platform.OS === 'ios' && !nativeProfile) {\n logger.warn('[NATIVE] Stop Profiling Failed: No Native Profile');\n }\n if (Platform.OS === 'android' && !androidProfile) {\n logger.warn('[NATIVE] Stop Profiling Failed: No Android Profile');\n }\n\n try {\n return {\n hermesProfile: JSON.parse(profile) as Hermes.Profile,\n nativeProfile: nativeProfile as NativeProfileEvent | undefined,\n androidProfile: androidProfile as NativeAndroidProfileEvent | undefined,\n };\n } catch (e) {\n logger.error('[NATIVE] Failed to parse Hermes Profile JSON', e);\n return null;\n }\n },\n\n fetchNativePackageName(): string | null {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n return RNSentry.fetchNativePackageName() || null;\n },\n\n fetchNativeStackFramesBy(instructionsAddr: number[]): NativeStackFrames | null {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n return RNSentry.fetchNativeStackFramesBy(instructionsAddr) || null;\n },\n\n async initNativeReactNavigationNewFrameTracking(): Promise<void> {\n if (!this.enableNative) {\n return;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return;\n }\n\n return RNSentry.initNativeReactNavigationNewFrameTracking();\n },\n\n async captureReplay(isHardCrash: boolean): Promise<string | null> {\n if (!this.enableNative) {\n logger.warn(`[NATIVE] \\`${this.captureReplay.name}\\` is not available when native is disabled.`);\n return Promise.resolve(null);\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.warn(`[NATIVE] \\`${this.captureReplay.name}\\` is not available when native is not available.`);\n return Promise.resolve(null);\n }\n\n return (await RNSentry.captureReplay(isHardCrash)) || null;\n },\n\n getCurrentReplayId(): string | null {\n if (!this.enableNative) {\n logger.warn(`[NATIVE] \\`${this.getCurrentReplayId.name}\\` is not available when native is disabled.`);\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n logger.warn(`[NATIVE] \\`${this.getCurrentReplayId.name}\\` is not available when native is not available.`);\n return null;\n }\n\n return RNSentry.getCurrentReplayId() || null;\n },\n\n async crashedLastRun(): Promise<boolean | null> {\n if (!this.enableNative) {\n return null;\n }\n if (!this._isModuleLoaded(RNSentry)) {\n return null;\n }\n\n const result = RNSentry.crashedLastRun();\n return typeof result === 'boolean' ? result : null;\n },\n\n /**\n * Gets the event from envelopeItem and applies the level filter to the selected event.\n * @param data An envelope item containing the event.\n * @returns The event from envelopeItem or undefined.\n */\n _processItem(item: EnvelopeItem): EnvelopeItem {\n const [itemHeader, itemPayload] = item;\n\n if (itemHeader.type == 'event' || itemHeader.type == 'transaction') {\n const event = this._processLevels(itemPayload as Event);\n\n if (NATIVE.platform === 'android') {\n if ('message' in event) {\n // @ts-expect-error Android still uses the old message object, without this the serialization of events will break.\n event.message = { message: event.message };\n }\n }\n\n return [itemHeader, event];\n }\n\n return item;\n },\n\n /**\n * Serializes all values of root-level keys into strings.\n * @param data key-value map.\n * @returns An object where all root-level values are strings.\n */\n _serializeObject(data: { [key: string]: unknown }): { [key: string]: string } {\n const serialized: { [key: string]: string } = {};\n\n Object.keys(data).forEach(dataKey => {\n const value = data[dataKey];\n serialized[dataKey] = typeof value === 'string' ? value : JSON.stringify(value);\n });\n\n return serialized;\n },\n\n /**\n * Convert js severity level in event.level and event.breadcrumbs to more widely supported levels.\n * @param event\n * @returns Event with more widely supported Severity level strings\n */\n\n _processLevels(event: Event): Event {\n const processed: Event = {\n ...event,\n level: event.level ? this._processLevel(event.level) : undefined,\n breadcrumbs: event.breadcrumbs?.map(breadcrumb => ({\n ...breadcrumb,\n level: breadcrumb.level ? this._processLevel(breadcrumb.level) : undefined,\n })),\n };\n\n return processed;\n },\n\n /**\n * Convert js severity level which has critical and log to more widely supported levels.\n * @param level\n * @returns More widely supported Severity level strings\n */\n\n _processLevel(level: SeverityLevel): SeverityLevel {\n if (level == ('log' as SeverityLevel)) {\n return 'debug' as SeverityLevel;\n }\n return level;\n },\n\n /**\n * Checks whether the RNSentry module is loaded.\n */\n _isModuleLoaded(module: Spec | undefined): module is Spec {\n return !!module;\n },\n\n _DisabledNativeError: new SentryError('Native is disabled'),\n\n _NativeClientError: new SentryError(\"Native Client is not available, can't start on native.\"),\n\n enableNative: true,\n nativeIsReady: false,\n platform: Platform.OS,\n};\n"]}
package/ios/RNSentry.mm CHANGED
@@ -649,18 +649,22 @@ static NSString* const enabledProfilingMessage = @"Enable Hermes to use Sentry P
649
649
  static SentryId* nativeProfileTraceId = nil;
650
650
  static uint64_t nativeProfileStartTime = 0;
651
651
 
652
- RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, startProfiling)
652
+ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, startProfiling: (BOOL)platformProfilers)
653
653
  {
654
654
  #if SENTRY_PROFILING_ENABLED
655
655
  try {
656
656
  facebook::hermes::HermesRuntime::enableSamplingProfiler();
657
- if (nativeProfileTraceId == nil && nativeProfileStartTime == 0) {
657
+ if (nativeProfileTraceId == nil && nativeProfileStartTime == 0 && platformProfilers) {
658
658
  #if SENTRY_TARGET_PROFILING_SUPPORTED
659
659
  nativeProfileTraceId = [RNSentryId newId];
660
660
  nativeProfileStartTime = [PrivateSentrySDKOnly startProfilerForTrace: nativeProfileTraceId];
661
661
  #endif
662
662
  } else {
663
- NSLog(@"Native profiling already in progress. Currently existing trace: %@", nativeProfileTraceId);
663
+ if (!platformProfilers) {
664
+ NSLog(@"Native profiling is disabled. Only starting Hermes profiling.");
665
+ } else {
666
+ NSLog(@"Native profiling already in progress. Currently existing trace: %@", nativeProfileTraceId);
667
+ }
664
668
  }
665
669
  return @{ @"started": @YES };
666
670
  } catch (const std::exception& ex) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@sentry/react-native",
3
3
  "homepage": "https://github.com/getsentry/sentry-react-native",
4
4
  "repository": "https://github.com/getsentry/sentry-react-native",
5
- "version": "5.31.1",
5
+ "version": "5.33.0",
6
6
  "description": "Official Sentry SDK for react-native",
7
7
  "typings": "dist/js/index.d.ts",
8
8
  "types": "dist/js/index.d.ts",
@@ -69,7 +69,7 @@
69
69
  "dependencies": {
70
70
  "@sentry/babel-plugin-component-annotate": "2.20.1",
71
71
  "@sentry/browser": "7.119.0",
72
- "@sentry/cli": "2.34.0",
72
+ "@sentry/cli": "2.36.1",
73
73
  "@sentry/core": "7.119.0",
74
74
  "@sentry/hub": "7.119.0",
75
75
  "@sentry/integrations": "7.119.0",
@@ -34,7 +34,7 @@ export interface Spec extends TurboModule {
34
34
  enableNativeFramesTracking(): void;
35
35
  fetchModules(): Promise<string | undefined | null>;
36
36
  fetchViewHierarchy(): Promise<number[] | undefined | null>;
37
- startProfiling(): { started?: boolean; error?: string };
37
+ startProfiling(platformProfilers: boolean): { started?: boolean; error?: string };
38
38
  stopProfiling(): {
39
39
  profile?: string;
40
40
  nativeProfile?: UnsafeObject;
@@ -26,7 +26,7 @@ export interface Spec extends TurboModule {
26
26
  enableNativeFramesTracking(): void;
27
27
  fetchModules(): Promise<string | undefined | null>;
28
28
  fetchViewHierarchy(): Promise<number[] | undefined | null>;
29
- startProfiling(): {
29
+ startProfiling(platformProfilers: boolean): {
30
30
  started?: boolean;
31
31
  error?: string;
32
32
  };
@@ -9,7 +9,7 @@ export type { ReactNativeOptions } from './options';
9
9
  export { ReactNativeClient } from './client';
10
10
  export { init, wrap, setDist, setRelease, nativeCrash, flush, close, captureUserFeedback, withScope, configureScope, crashedLastRun, } from './sdk';
11
11
  export { TouchEventBoundary, withTouchEventBoundary } from './touchevents';
12
- export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, } from './tracing';
12
+ export { ReactNativeTracing, ReactNavigationV4Instrumentation, ReactNavigationV5Instrumentation, ReactNavigationInstrumentation, ReactNativeNavigationInstrumentation, RoutingInstrumentation, reactNativeTracingIntegration, reactNavigationIntegration, reactNativeNavigationIntegration, sentryTraceGesture, TimeToInitialDisplay, TimeToFullDisplay, startTimeToInitialDisplaySpan, startTimeToFullDisplaySpan, } from './tracing';
13
13
  export type { ReactNavigationTransactionContext, TimeToDisplayProps } from './tracing';
14
14
  export {
15
15
  /** @deprecated Import the integration function directly, e.g. `screenshotIntegration()` instead of `new Integrations.Screenshot(). */
@@ -174,14 +174,46 @@ export interface BaseReactNativeOptions {
174
174
  * from the function, no screenshot will be attached.
175
175
  */
176
176
  beforeScreenshot?: (event: Event, hint: EventHint) => boolean;
177
+ /**
178
+ * The sample rate for profiling
179
+ * 1.0 will profile all transactions and 0 will profile none.
180
+ */
181
+ profilesSampleRate?: number;
182
+ /**
183
+ * Track the app start time by adding measurements to the first route transaction. If there is no routing instrumentation
184
+ * an app start transaction will be started.
185
+ *
186
+ * Requires performance monitoring to be enabled.
187
+ *
188
+ * @default true
189
+ */
190
+ enableAppStartTracking?: boolean;
191
+ /**
192
+ * Track the slow and frozen frames in the application. Enabling this options will add
193
+ * slow and frozen frames measurements to all created root spans (transactions).
194
+ *
195
+ * @default true
196
+ */
197
+ enableNativeFramesTracking?: boolean;
198
+ /**
199
+ * Track when and how long the JS event loop stalls for. Adds stalls as measurements to all transactions.
200
+ *
201
+ * @default true
202
+ */
203
+ enableStallTracking?: boolean;
204
+ /**
205
+ * Trace User Interaction events like touch and gestures.
206
+ *
207
+ * @default false
208
+ */
209
+ enableUserInteractionTracing?: boolean;
177
210
  /**
178
211
  * Options which are in beta, or otherwise not guaranteed to be stable.
179
212
  */
180
213
  _experiments?: {
181
214
  [key: string]: unknown;
182
215
  /**
183
- * The sample rate for profiling
184
- * 1.0 will profile all transactions and 0 will profile none.
216
+ * @deprecated Use `profilesSampleRate` in the options root instead.
185
217
  */
186
218
  profilesSampleRate?: number;
187
219
  /**
@@ -1,12 +1,20 @@
1
- import type { Integration, IntegrationClass, IntegrationFn, ThreadCpuProfile } from '@sentry/types';
1
+ import type { Integration, IntegrationClass, IntegrationFnResult, ThreadCpuProfile } from '@sentry/types';
2
2
  import type { NativeAndroidProfileEvent, NativeProfileEvent } from './nativeTypes';
3
3
  import type { AndroidCombinedProfileEvent, CombinedProfileEvent, HermesProfileEvent } from './types';
4
+ export interface HermesProfilingOptions {
5
+ /**
6
+ * Enable or disable profiling of native (iOS and Android) threads
7
+ *
8
+ * @default true
9
+ */
10
+ platformProfilers?: boolean;
11
+ }
4
12
  /**
5
13
  * Profiling integration creates a profile for each transaction and adds it to the event envelope.
6
14
  *
7
15
  * @experimental
8
16
  */
9
- export declare const hermesProfilingIntegration: IntegrationFn;
17
+ export declare const hermesProfilingIntegration: (initOptions?: HermesProfilingOptions) => IntegrationFnResult;
10
18
  /**
11
19
  * Profiling integration creates a profile for each transaction and adds it to the event envelope.
12
20
  *
@@ -16,7 +24,7 @@ export declare const HermesProfiling: IntegrationClass<Integration>;
16
24
  /**
17
25
  * Starts Profilers and returns the timestamp when profiling started in nanoseconds.
18
26
  */
19
- export declare function startProfiling(): number | null;
27
+ export declare function startProfiling(platformProfilers: boolean): number | null;
20
28
  /**
21
29
  * Stops Profilers and returns collected combined profile.
22
30
  */
@@ -1,9 +1,9 @@
1
- export { ReactNativeTracing } from './reactnativetracing';
1
+ export { ReactNativeTracing, reactNativeTracingIntegration } from './reactnativetracing';
2
2
  export type { RoutingInstrumentationInstance } from './routingInstrumentation';
3
3
  export { RoutingInstrumentation } from './routingInstrumentation';
4
- export { ReactNavigationInstrumentation, ReactNavigationV5Instrumentation, } from './reactnavigation';
4
+ export { ReactNavigationInstrumentation, reactNavigationIntegration, ReactNavigationV5Instrumentation, } from './reactnavigation';
5
5
  export { ReactNavigationV4Instrumentation } from './reactnavigationv4';
6
- export { ReactNativeNavigationInstrumentation } from './reactnativenavigation';
6
+ export { ReactNativeNavigationInstrumentation, reactNativeNavigationIntegration } from './reactnativenavigation';
7
7
  export type { ReactNavigationCurrentRoute, ReactNavigationRoute, ReactNavigationTransactionContext } from './types';
8
8
  export { ReactNativeProfiler } from './reactnativeprofiler';
9
9
  export { sentryTraceGesture } from './gesturetracing';
@@ -50,6 +50,12 @@ export interface NavigationDelegate {
50
50
  * - `_onComponentWillAppear` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.
51
51
  * - If `_onComponentWillAppear` isn't called within `options.routeChangeTimeoutMs` of the dispatch, then the transaction is not sampled and finished.
52
52
  */
53
+ export declare const reactNativeNavigationIntegration: (options: Partial<ReactNativeNavigationOptions> & {
54
+ navigation: NavigationDelegate;
55
+ }) => ReactNativeNavigationInstrumentation;
56
+ /**
57
+ * @deprecated Use `Sentry.reactNativeNavigationIntegration({ navigation })` instead.
58
+ */
53
59
  export declare class ReactNativeNavigationInstrumentation extends InternalRoutingInstrumentation {
54
60
  static instrumentationName: string;
55
61
  readonly name: string;