@sentry/react-native 8.6.0 → 8.7.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 (349) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/expo-handler/build.gradle +1 -1
  3. package/android/libs/replay-stubs.jar +0 -0
  4. package/android/replay-stubs/build.gradle +1 -1
  5. package/android/src/main/java/io/sentry/react/RNSentryFrameDelayCollector.java +128 -0
  6. package/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java +48 -0
  7. package/android/src/main/java/io/sentry/react/RNSentryVersion.java +1 -1
  8. package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +6 -0
  9. package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +6 -0
  10. package/dist/js/NativeLogListener.d.ts.map +1 -1
  11. package/dist/js/NativeLogListener.js.map +1 -1
  12. package/dist/js/NativeRNSentry.d.ts +1 -0
  13. package/dist/js/NativeRNSentry.d.ts.map +1 -1
  14. package/dist/js/NativeRNSentry.js.map +1 -1
  15. package/dist/js/RNSentryReplayMaskNativeComponent.d.ts.map +1 -1
  16. package/dist/js/RNSentryReplayMaskNativeComponent.js +1 -2
  17. package/dist/js/RNSentryReplayMaskNativeComponent.js.map +1 -1
  18. package/dist/js/RNSentryReplayUnmaskNativeComponent.d.ts.map +1 -1
  19. package/dist/js/RNSentryReplayUnmaskNativeComponent.js +1 -2
  20. package/dist/js/RNSentryReplayUnmaskNativeComponent.js.map +1 -1
  21. package/dist/js/breadcrumb.d.ts.map +1 -1
  22. package/dist/js/breadcrumb.js.map +1 -1
  23. package/dist/js/client.d.ts.map +1 -1
  24. package/dist/js/client.js +1 -1
  25. package/dist/js/client.js.map +1 -1
  26. package/dist/js/feedback/FeedbackButton.d.ts +2 -1
  27. package/dist/js/feedback/FeedbackButton.d.ts.map +1 -1
  28. package/dist/js/feedback/FeedbackButton.js +5 -4
  29. package/dist/js/feedback/FeedbackButton.js.map +1 -1
  30. package/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
  31. package/dist/js/feedback/FeedbackForm.d.ts.map +1 -0
  32. package/dist/js/feedback/{FeedbackWidget.js → FeedbackForm.js} +26 -24
  33. package/dist/js/feedback/FeedbackForm.js.map +1 -0
  34. package/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
  35. package/dist/js/feedback/FeedbackForm.styles.d.ts.map +1 -0
  36. package/dist/js/feedback/{FeedbackWidget.styles.js → FeedbackForm.styles.js} +1 -1
  37. package/dist/js/feedback/FeedbackForm.styles.js.map +1 -0
  38. package/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
  39. package/dist/js/feedback/FeedbackForm.theme.d.ts.map +1 -0
  40. package/dist/js/feedback/{FeedbackWidget.theme.js → FeedbackForm.theme.js} +1 -1
  41. package/dist/js/feedback/FeedbackForm.theme.js.map +1 -0
  42. package/{ts3.8/dist/js/feedback/FeedbackWidget.types.d.ts → dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
  43. package/dist/js/feedback/FeedbackForm.types.d.ts.map +1 -0
  44. package/dist/js/feedback/FeedbackForm.types.js +2 -0
  45. package/dist/js/feedback/FeedbackForm.types.js.map +1 -0
  46. package/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
  47. package/dist/js/feedback/FeedbackFormManager.d.ts.map +1 -0
  48. package/dist/js/feedback/{FeedbackWidgetManager.js → FeedbackFormManager.js} +22 -13
  49. package/dist/js/feedback/FeedbackFormManager.js.map +1 -0
  50. package/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
  51. package/dist/js/feedback/FeedbackFormProvider.d.ts.map +1 -0
  52. package/dist/js/feedback/{FeedbackWidgetProvider.js → FeedbackFormProvider.js} +18 -15
  53. package/dist/js/feedback/FeedbackFormProvider.js.map +1 -0
  54. package/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  55. package/dist/js/feedback/ScreenshotButton.d.ts.map +1 -1
  56. package/dist/js/feedback/ScreenshotButton.js +6 -5
  57. package/dist/js/feedback/ScreenshotButton.js.map +1 -1
  58. package/dist/js/feedback/ShakeToReportBug.d.ts.map +1 -1
  59. package/dist/js/feedback/ShakeToReportBug.js.map +1 -1
  60. package/dist/js/feedback/defaults.d.ts +2 -2
  61. package/dist/js/feedback/defaults.d.ts.map +1 -1
  62. package/dist/js/feedback/defaults.js.map +1 -1
  63. package/dist/js/feedback/integration.d.ts +11 -11
  64. package/dist/js/feedback/integration.d.ts.map +1 -1
  65. package/dist/js/feedback/integration.js.map +1 -1
  66. package/dist/js/feedback/lazy.d.ts +5 -0
  67. package/dist/js/feedback/lazy.d.ts.map +1 -1
  68. package/dist/js/feedback/lazy.js +12 -0
  69. package/dist/js/feedback/lazy.js.map +1 -1
  70. package/dist/js/feedback/utils.d.ts.map +1 -1
  71. package/dist/js/feedback/utils.js +1 -0
  72. package/dist/js/feedback/utils.js.map +1 -1
  73. package/dist/js/index.d.ts +12 -3
  74. package/dist/js/index.d.ts.map +1 -1
  75. package/dist/js/index.js +12 -3
  76. package/dist/js/index.js.map +1 -1
  77. package/dist/js/integrations/appRegistry.d.ts.map +1 -1
  78. package/dist/js/integrations/appRegistry.js.map +1 -1
  79. package/dist/js/integrations/breadcrumbs.d.ts.map +1 -1
  80. package/dist/js/integrations/breadcrumbs.js +1 -1
  81. package/dist/js/integrations/breadcrumbs.js.map +1 -1
  82. package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
  83. package/dist/js/integrations/debugsymbolicator.js +1 -2
  84. package/dist/js/integrations/debugsymbolicator.js.map +1 -1
  85. package/dist/js/integrations/debugsymbolicatorutils.d.ts.map +1 -1
  86. package/dist/js/integrations/debugsymbolicatorutils.js.map +1 -1
  87. package/dist/js/integrations/default.d.ts.map +1 -1
  88. package/dist/js/integrations/default.js +0 -1
  89. package/dist/js/integrations/default.js.map +1 -1
  90. package/dist/js/integrations/devicecontext.d.ts.map +1 -1
  91. package/dist/js/integrations/devicecontext.js.map +1 -1
  92. package/dist/js/integrations/expoconstants.d.ts.map +1 -1
  93. package/dist/js/integrations/expoconstants.js.map +1 -1
  94. package/dist/js/integrations/expocontext.d.ts.map +1 -1
  95. package/dist/js/integrations/expocontext.js.map +1 -1
  96. package/dist/js/integrations/expoupdateslistener.d.ts.map +1 -1
  97. package/dist/js/integrations/expoupdateslistener.js +0 -1
  98. package/dist/js/integrations/expoupdateslistener.js.map +1 -1
  99. package/dist/js/integrations/graphql.d.ts.map +1 -1
  100. package/dist/js/integrations/graphql.js.map +1 -1
  101. package/dist/js/integrations/logEnricherIntegration.d.ts.map +1 -1
  102. package/dist/js/integrations/logEnricherIntegration.js.map +1 -1
  103. package/dist/js/integrations/modulesloader.d.ts.map +1 -1
  104. package/dist/js/integrations/modulesloader.js.map +1 -1
  105. package/dist/js/integrations/nativelinkederrors.d.ts.map +1 -1
  106. package/dist/js/integrations/nativelinkederrors.js +1 -1
  107. package/dist/js/integrations/nativelinkederrors.js.map +1 -1
  108. package/dist/js/integrations/primitiveTagIntegration.d.ts.map +1 -1
  109. package/dist/js/integrations/primitiveTagIntegration.js.map +1 -1
  110. package/dist/js/integrations/reactnativeerrorhandlers.d.ts.map +1 -1
  111. package/dist/js/integrations/reactnativeerrorhandlers.js +2 -1
  112. package/dist/js/integrations/reactnativeerrorhandlers.js.map +1 -1
  113. package/dist/js/integrations/reactnativeerrorhandlersutils.d.ts.map +1 -1
  114. package/dist/js/integrations/reactnativeerrorhandlersutils.js +0 -5
  115. package/dist/js/integrations/reactnativeerrorhandlersutils.js.map +1 -1
  116. package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -1
  117. package/dist/js/integrations/reactnativeinfo.js.map +1 -1
  118. package/dist/js/integrations/release.d.ts.map +1 -1
  119. package/dist/js/integrations/release.js.map +1 -1
  120. package/dist/js/integrations/rewriteframes.d.ts.map +1 -1
  121. package/dist/js/integrations/rewriteframes.js.map +1 -1
  122. package/dist/js/integrations/screenshot.d.ts.map +1 -1
  123. package/dist/js/integrations/screenshot.js.map +1 -1
  124. package/dist/js/integrations/sdkinfo.d.ts.map +1 -1
  125. package/dist/js/integrations/sdkinfo.js.map +1 -1
  126. package/dist/js/integrations/spotlight.d.ts.map +1 -1
  127. package/dist/js/integrations/spotlight.js.map +1 -1
  128. package/dist/js/integrations/supabase.d.ts.map +1 -1
  129. package/dist/js/integrations/supabase.js.map +1 -1
  130. package/dist/js/integrations/viewhierarchy.d.ts.map +1 -1
  131. package/dist/js/integrations/viewhierarchy.js.map +1 -1
  132. package/dist/js/options.d.ts.map +1 -1
  133. package/dist/js/options.js.map +1 -1
  134. package/dist/js/playground/examples.d.ts.map +1 -1
  135. package/dist/js/playground/examples.js.map +1 -1
  136. package/dist/js/playground/modal.d.ts.map +1 -1
  137. package/dist/js/playground/modal.js +4 -102
  138. package/dist/js/playground/modal.js.map +1 -1
  139. package/dist/js/playground/modal.styles.d.ts +100 -0
  140. package/dist/js/playground/modal.styles.d.ts.map +1 -0
  141. package/dist/js/playground/modal.styles.js +98 -0
  142. package/dist/js/playground/modal.styles.js.map +1 -0
  143. package/dist/js/profiling/cache.js +2 -2
  144. package/dist/js/profiling/cache.js.map +1 -1
  145. package/dist/js/profiling/convertHermesProfile.d.ts.map +1 -1
  146. package/dist/js/profiling/convertHermesProfile.js.map +1 -1
  147. package/dist/js/profiling/debugid.d.ts.map +1 -1
  148. package/dist/js/profiling/debugid.js.map +1 -1
  149. package/dist/js/profiling/hermes.d.ts.map +1 -1
  150. package/dist/js/profiling/hermes.js.map +1 -1
  151. package/dist/js/profiling/integration.d.ts.map +1 -1
  152. package/dist/js/profiling/integration.js.map +1 -1
  153. package/dist/js/profiling/types.d.ts.map +1 -1
  154. package/dist/js/profiling/types.js.map +1 -1
  155. package/dist/js/profiling/utils.d.ts.map +1 -1
  156. package/dist/js/profiling/utils.js +1 -1
  157. package/dist/js/profiling/utils.js.map +1 -1
  158. package/dist/js/replay/CustomMask.d.ts +1 -1
  159. package/dist/js/replay/CustomMask.d.ts.map +1 -1
  160. package/dist/js/replay/CustomMask.js +1 -1
  161. package/dist/js/replay/CustomMask.js.map +1 -1
  162. package/dist/js/replay/CustomMask.web.d.ts +1 -1
  163. package/dist/js/replay/CustomMask.web.d.ts.map +1 -1
  164. package/dist/js/replay/CustomMask.web.js +2 -2
  165. package/dist/js/replay/CustomMask.web.js.map +1 -1
  166. package/dist/js/replay/browserReplay.d.ts.map +1 -1
  167. package/dist/js/replay/browserReplay.js +0 -2
  168. package/dist/js/replay/browserReplay.js.map +1 -1
  169. package/dist/js/replay/mobilereplay.d.ts.map +1 -1
  170. package/dist/js/replay/mobilereplay.js.map +1 -1
  171. package/dist/js/replay/xhrUtils.d.ts.map +1 -1
  172. package/dist/js/replay/xhrUtils.js.map +1 -1
  173. package/dist/js/scopeSync.d.ts.map +1 -1
  174. package/dist/js/scopeSync.js +1 -1
  175. package/dist/js/scopeSync.js.map +1 -1
  176. package/dist/js/sdk.d.ts +21 -0
  177. package/dist/js/sdk.d.ts.map +1 -1
  178. package/dist/js/sdk.js +38 -16
  179. package/dist/js/sdk.js.map +1 -1
  180. package/dist/js/tools/ModulesCollector.js +1 -1
  181. package/dist/js/tools/ModulesCollector.js.map +1 -1
  182. package/dist/js/tools/collectModules.js +0 -1
  183. package/dist/js/tools/collectModules.js.map +1 -1
  184. package/dist/js/tools/easBuildHooks.d.ts.map +1 -1
  185. package/dist/js/tools/easBuildHooks.js.map +1 -1
  186. package/dist/js/tools/metroMiddleware.d.ts.map +1 -1
  187. package/dist/js/tools/metroMiddleware.js.map +1 -1
  188. package/dist/js/tools/metroconfig.d.ts.map +1 -1
  189. package/dist/js/tools/metroconfig.js +4 -5
  190. package/dist/js/tools/metroconfig.js.map +1 -1
  191. package/dist/js/tools/sentryBabelTransformerUtils.d.ts.map +1 -1
  192. package/dist/js/tools/sentryBabelTransformerUtils.js +2 -3
  193. package/dist/js/tools/sentryBabelTransformerUtils.js.map +1 -1
  194. package/dist/js/tools/sentryMetroSerializer.d.ts.map +1 -1
  195. package/dist/js/tools/sentryMetroSerializer.js +4 -5
  196. package/dist/js/tools/sentryMetroSerializer.js.map +1 -1
  197. package/dist/js/tools/sentryOptionsSerializer.d.ts.map +1 -1
  198. package/dist/js/tools/sentryOptionsSerializer.js +2 -3
  199. package/dist/js/tools/sentryOptionsSerializer.js.map +1 -1
  200. package/dist/js/tools/sentryReleaseInjector.d.ts.map +1 -1
  201. package/dist/js/tools/sentryReleaseInjector.js.map +1 -1
  202. package/dist/js/tools/utils.d.ts.map +1 -1
  203. package/dist/js/tools/utils.js +0 -3
  204. package/dist/js/tools/utils.js.map +1 -1
  205. package/dist/js/tools/vendor/metro/utils.d.ts.map +1 -1
  206. package/dist/js/tools/vendor/metro/utils.js +5 -5
  207. package/dist/js/tools/vendor/metro/utils.js.map +1 -1
  208. package/dist/js/touchevents.d.ts.map +1 -1
  209. package/dist/js/touchevents.js +19 -21
  210. package/dist/js/touchevents.js.map +1 -1
  211. package/dist/js/tracing/expoImage.d.ts.map +1 -1
  212. package/dist/js/tracing/expoImage.js +1 -1
  213. package/dist/js/tracing/expoImage.js.map +1 -1
  214. package/dist/js/tracing/expoRouter.d.ts.map +1 -1
  215. package/dist/js/tracing/expoRouter.js.map +1 -1
  216. package/dist/js/tracing/gesturetracing.d.ts.map +1 -1
  217. package/dist/js/tracing/gesturetracing.js.map +1 -1
  218. package/dist/js/tracing/integrations/appStart.d.ts +18 -0
  219. package/dist/js/tracing/integrations/appStart.d.ts.map +1 -1
  220. package/dist/js/tracing/integrations/appStart.js +141 -6
  221. package/dist/js/tracing/integrations/appStart.js.map +1 -1
  222. package/dist/js/tracing/integrations/nativeFrames.d.ts.map +1 -1
  223. package/dist/js/tracing/integrations/nativeFrames.js +43 -0
  224. package/dist/js/tracing/integrations/nativeFrames.js.map +1 -1
  225. package/dist/js/tracing/integrations/stalltracking.d.ts.map +1 -1
  226. package/dist/js/tracing/integrations/stalltracking.js +0 -1
  227. package/dist/js/tracing/integrations/stalltracking.js.map +1 -1
  228. package/dist/js/tracing/integrations/timeToDisplayIntegration.d.ts.map +1 -1
  229. package/dist/js/tracing/integrations/timeToDisplayIntegration.js +1 -1
  230. package/dist/js/tracing/integrations/timeToDisplayIntegration.js.map +1 -1
  231. package/dist/js/tracing/integrations/userInteraction.d.ts.map +1 -1
  232. package/dist/js/tracing/integrations/userInteraction.js.map +1 -1
  233. package/dist/js/tracing/onSpanEndUtils.d.ts.map +1 -1
  234. package/dist/js/tracing/onSpanEndUtils.js +23 -1
  235. package/dist/js/tracing/onSpanEndUtils.js.map +1 -1
  236. package/dist/js/tracing/reactnativenavigation.d.ts.map +1 -1
  237. package/dist/js/tracing/reactnativenavigation.js.map +1 -1
  238. package/dist/js/tracing/reactnativeprofiler.d.ts.map +1 -1
  239. package/dist/js/tracing/reactnativeprofiler.js +2 -2
  240. package/dist/js/tracing/reactnativeprofiler.js.map +1 -1
  241. package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
  242. package/dist/js/tracing/reactnativetracing.js +0 -1
  243. package/dist/js/tracing/reactnativetracing.js.map +1 -1
  244. package/dist/js/tracing/reactnavigation.d.ts.map +1 -1
  245. package/dist/js/tracing/reactnavigation.js +2 -2
  246. package/dist/js/tracing/reactnavigation.js.map +1 -1
  247. package/dist/js/tracing/span.d.ts.map +1 -1
  248. package/dist/js/tracing/span.js +1 -1
  249. package/dist/js/tracing/span.js.map +1 -1
  250. package/dist/js/tracing/timetodisplay.d.ts.map +1 -1
  251. package/dist/js/tracing/timetodisplay.js +42 -19
  252. package/dist/js/tracing/timetodisplay.js.map +1 -1
  253. package/dist/js/tracing/timetodisplaynative.d.ts +1 -1
  254. package/dist/js/tracing/timetodisplaynative.d.ts.map +1 -1
  255. package/dist/js/tracing/timetodisplaynative.js +5 -4
  256. package/dist/js/tracing/timetodisplaynative.js.map +1 -1
  257. package/dist/js/tracing/types.js.map +1 -1
  258. package/dist/js/tracing/utils.d.ts.map +1 -1
  259. package/dist/js/tracing/utils.js.map +1 -1
  260. package/dist/js/transports/native.d.ts.map +1 -1
  261. package/dist/js/transports/native.js.map +1 -1
  262. package/dist/js/utils/envelope.d.ts.map +1 -1
  263. package/dist/js/utils/envelope.js.map +1 -1
  264. package/dist/js/utils/environment.d.ts.map +1 -1
  265. package/dist/js/utils/environment.js.map +1 -1
  266. package/dist/js/utils/expomodules.d.ts.map +1 -1
  267. package/dist/js/utils/expomodules.js.map +1 -1
  268. package/dist/js/utils/fill.js +1 -1
  269. package/dist/js/utils/fill.js.map +1 -1
  270. package/dist/js/utils/normalize.js +2 -2
  271. package/dist/js/utils/normalize.js.map +1 -1
  272. package/dist/js/utils/rnlibraries.d.ts.map +1 -1
  273. package/dist/js/utils/rnlibraries.js +1 -7
  274. package/dist/js/utils/rnlibraries.js.map +1 -1
  275. package/dist/js/utils/safe.d.ts.map +1 -1
  276. package/dist/js/utils/safe.js.map +1 -1
  277. package/dist/js/utils/span.d.ts.map +1 -1
  278. package/dist/js/utils/span.js.map +1 -1
  279. package/dist/js/utils/worldwide.d.ts.map +1 -1
  280. package/dist/js/utils/worldwide.js.map +1 -1
  281. package/dist/js/vendor/base64-js/fromByteArray.js +1 -1
  282. package/dist/js/vendor/base64-js/fromByteArray.js.map +1 -1
  283. package/dist/js/vendor/buffer/utf8ToBytes.js +1 -1
  284. package/dist/js/vendor/buffer/utf8ToBytes.js.map +1 -1
  285. package/dist/js/vendor/react-native/index.d.ts.map +1 -1
  286. package/dist/js/vendor/react-native/index.js.map +1 -1
  287. package/dist/js/version.d.ts +1 -1
  288. package/dist/js/version.js +1 -1
  289. package/dist/js/version.js.map +1 -1
  290. package/dist/js/wrapper.d.ts +1 -0
  291. package/dist/js/wrapper.d.ts.map +1 -1
  292. package/dist/js/wrapper.js +16 -4
  293. package/dist/js/wrapper.js.map +1 -1
  294. package/ios/RNSentry.mm +18 -1
  295. package/ios/RNSentryReplay.mm +1 -1
  296. package/ios/RNSentrySDK.m +1 -1
  297. package/ios/RNSentryTimeToDisplay.m +48 -32
  298. package/ios/RNSentryVersion.m +1 -1
  299. package/ios/SentryScreenFramesWrapper.h +2 -0
  300. package/ios/SentryScreenFramesWrapper.m +35 -0
  301. package/package.json +17 -21
  302. package/plugin/build/logger.js +1 -1
  303. package/plugin/build/utils.js +2 -0
  304. package/plugin/build/withSentry.js +1 -2
  305. package/plugin/build/withSentryAndroid.js +2 -0
  306. package/plugin/build/withSentryAndroidGradlePlugin.d.ts +1 -1
  307. package/plugin/build/withSentryAndroidGradlePlugin.js +1 -1
  308. package/plugin/build/withSentryIOS.js +1 -3
  309. package/scripts/eas-build-hook.js +0 -2
  310. package/scripts/expo-upload-sourcemaps.js +0 -1
  311. package/src/js/NativeRNSentry.ts +3 -0
  312. package/src/js/RNSentryReplayMaskNativeComponent.ts +2 -3
  313. package/src/js/RNSentryReplayUnmaskNativeComponent.ts +2 -3
  314. package/ts3.8/dist/js/NativeRNSentry.d.ts +1 -0
  315. package/ts3.8/dist/js/feedback/FeedbackButton.d.ts +2 -1
  316. package/ts3.8/dist/js/feedback/{FeedbackWidget.d.ts → FeedbackForm.d.ts} +5 -5
  317. package/ts3.8/dist/js/feedback/FeedbackForm.styles.d.ts +11 -0
  318. package/ts3.8/dist/js/feedback/{FeedbackWidget.theme.d.ts → FeedbackForm.theme.d.ts} +7 -5
  319. package/{dist/js/feedback/FeedbackWidget.types.d.ts → ts3.8/dist/js/feedback/FeedbackForm.types.d.ts} +305 -299
  320. package/ts3.8/dist/js/feedback/{FeedbackWidgetManager.d.ts → FeedbackFormManager.d.ts} +12 -4
  321. package/ts3.8/dist/js/feedback/{FeedbackWidgetProvider.d.ts → FeedbackFormProvider.d.ts} +10 -10
  322. package/ts3.8/dist/js/feedback/ScreenshotButton.d.ts +1 -1
  323. package/ts3.8/dist/js/feedback/defaults.d.ts +2 -2
  324. package/ts3.8/dist/js/feedback/integration.d.ts +11 -11
  325. package/ts3.8/dist/js/feedback/lazy.d.ts +5 -0
  326. package/ts3.8/dist/js/index.d.ts +12 -3
  327. package/ts3.8/dist/js/playground/modal.styles.d.ts +100 -0
  328. package/ts3.8/dist/js/replay/CustomMask.d.ts +1 -1
  329. package/ts3.8/dist/js/replay/CustomMask.web.d.ts +1 -1
  330. package/ts3.8/dist/js/sdk.d.ts +21 -0
  331. package/ts3.8/dist/js/tracing/integrations/appStart.d.ts +18 -0
  332. package/ts3.8/dist/js/tracing/timetodisplaynative.d.ts +1 -1
  333. package/ts3.8/dist/js/version.d.ts +1 -1
  334. package/ts3.8/dist/js/wrapper.d.ts +1 -0
  335. package/dist/js/feedback/FeedbackWidget.d.ts.map +0 -1
  336. package/dist/js/feedback/FeedbackWidget.js.map +0 -1
  337. package/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
  338. package/dist/js/feedback/FeedbackWidget.styles.d.ts.map +0 -1
  339. package/dist/js/feedback/FeedbackWidget.styles.js.map +0 -1
  340. package/dist/js/feedback/FeedbackWidget.theme.d.ts.map +0 -1
  341. package/dist/js/feedback/FeedbackWidget.theme.js.map +0 -1
  342. package/dist/js/feedback/FeedbackWidget.types.d.ts.map +0 -1
  343. package/dist/js/feedback/FeedbackWidget.types.js +0 -2
  344. package/dist/js/feedback/FeedbackWidget.types.js.map +0 -1
  345. package/dist/js/feedback/FeedbackWidgetManager.d.ts.map +0 -1
  346. package/dist/js/feedback/FeedbackWidgetManager.js.map +0 -1
  347. package/dist/js/feedback/FeedbackWidgetProvider.d.ts.map +0 -1
  348. package/dist/js/feedback/FeedbackWidgetProvider.js.map +0 -1
  349. package/ts3.8/dist/js/feedback/FeedbackWidget.styles.d.ts +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,KAAK,EACL,SAAS,EACT,aAAa,EACb,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,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A2B,CAAC,CAAC;QAChG,CAAC;IACH,CAAC,CAAC;IAEF,wEAAwE;IACxE,MAAM,yBAAyB,GAAG,GAAS,EAAE;QAC3C,IAAI,oBAAoB,EAAE,CAAC;YACzB,IAAI,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC;gBACvC,oBAAoB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;YAC3C,CAAC;YACD,qCAAqC;YACrC,oBAAoB,CAAC,GAAG,EAAE,CAAC;YAC3B,oBAAoB,GAAG,SAAS,CAAC;QACnC,CAAC;QACD,IAAI,wBAAwB,EAAE,CAAC;YAC7B,wBAAwB,GAAG,SAAS,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,GAAS,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE,CAAC;YAC9C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;QAC3B,OAAO,EAAE;YACP,oBAAoB;YACpB,0BAA0B;YAC1B,qCAAqC;YACrC,4CAA4C;YAC5C,uBAAuB;YACvB,+BAA+B;YAC/B,sBAAsB;SACvB;KACF,CAAC;AACJ,CAAC,CAAC;AAqBF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAc;IAEd,OAAO,MAAM,CAAC,oBAAoB,CAAgD,gBAAgB,CAAC,CAAC;AACtG,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Client, Integration, Span } from '@sentry/core';\nimport {\n addBreadcrumb,\n debug,\n getClient,\n isPlainObject,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\nimport { getAppRegistryIntegration } from '../integrations/appRegistry';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport type { UnsafeAction } from '../vendor/react-navigation/types';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation, ignoreEmptyRouteChangeTransactions } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { addTimeToInitialDisplayFallback } from './timeToDisplayFallback';\n\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\n/**\n * Extracts dynamic route parameters from a route name and its params.\n * Matches Expo Router style dynamic segments like `[id]` and `[...slug]`.\n *\n * Only params whose keys appear as dynamic segments in the route name are returned,\n * filtering out non-structural params (query params, etc.) that may contain PII.\n *\n * Note: dynamic segment values (e.g. the `123` in `profile/[id]`) may be user-identifiable.\n * This function only extracts params — callers are responsible for checking `sendDefaultPii`\n * before including the result in span attributes.\n *\n * Previous route params are intentionally not captured — only the current route's\n * structural params are needed for trace attribution.\n */\nexport function extractDynamicRouteParams(\n routeName: string,\n params?: Record<string, unknown>,\n): Record<string, string> | undefined {\n if (!params) {\n return undefined;\n }\n\n const dynamicKeys = new Set<string>();\n const pattern = /\\[(?:\\.\\.\\.)?(\\w+)\\]/g;\n let match: RegExpExecArray | null;\n while ((match = pattern.exec(routeName)) !== null) {\n if (match[1]) {\n dynamicKeys.add(match[1]);\n }\n }\n\n if (dynamicKeys.size === 0) {\n return undefined;\n }\n\n const result: Record<string, string> = {};\n for (const key of dynamicKeys) {\n if (key in params) {\n const value = params[key];\n result[`route.params.${key}`] = Array.isArray(value) ? value.join('/') : String(value ?? '');\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Builds a full path from the navigation state by traversing nested navigators.\n * For example, with nested navigators: \"Home/Settings/Profile\"\n */\nfunction getPathFromState(state?: NavigationState): string | undefined {\n if (!state) {\n return undefined;\n }\n\n const routeNames: string[] = [];\n let currentState: NavigationState | undefined = state;\n\n while (currentState) {\n const index: number = currentState.index ?? 0;\n const route: NavigationRoute | undefined = currentState.routes[index];\n if (route?.name) {\n routeNames.push(route.name);\n }\n currentState = route?.state;\n }\n\n return routeNames.length > 0 ? routeNames.join('/') : undefined;\n}\n\ninterface ReactNavigationIntegrationOptions {\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 *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * Note: Enabling this adds native bridge calls on every navigation\n * which may cause noticeable overhead on low-end devices.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * Enabled measuring Time to Initial Display for routes that are already loaded in memory.\n * (a.k.a., Routes that the navigation integration has already seen.)\n *\n * @default false\n */\n enableTimeToInitialDisplayForPreloadedRoutes: boolean;\n\n /**\n * Whether to use the dispatched action data to populate the transaction metadata.\n *\n * @default false\n */\n useDispatchedActionData: boolean;\n\n /**\n * Whether to use the full paths for navigation routes.\n *\n * @default false\n */\n useFullPathsForNavigationRoutes: boolean;\n\n /**\n * Track performance of route prefetching operations.\n * Creates separate spans for PRELOAD actions to measure prefetch performance.\n * This is useful for Expo Router apps that use the prefetch functionality.\n *\n * @default false\n */\n enablePrefetchTracking: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n enableTimeToInitialDisplayForPreloadedRoutes = false,\n useDispatchedActionData = false,\n useFullPathsForNavigationRoutes = false,\n enablePrefetchTracking = false,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n options: ReactNavigationIntegrationOptions;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let isSetupComplete: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n debug.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n // This assumes that the Sentry.init() call is made before the first route mounts.\n // If this is not the case, the first transaction will be nameless 'Route Changed'\n return undefined;\n }\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (initialStateHandled) {\n // To avoid conflict with the initial transaction we check if it was already handled.\n // This ensures runApplication calls after the initial start are correctly traced.\n // This is used for example when Activity is (re)started on Android.\n debug.log('[ReactNavigationIntegration] Starting new idle navigation span based on runApplication call.');\n startIdleNavigationSpan(undefined, true);\n }\n });\n\n isSetupComplete = true;\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, create and populate initial span\n startIdleNavigationSpan();\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (maybeNewNavigationContainer: unknown): void => {\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n debug.log(`${INTEGRATION_NAME} Instrumentation already exists, but registering again...`);\n // In the past we have not allowed re-registering the navigation container to avoid unexpected behavior.\n // But this doesn't work for Android and re-recreating application main activity.\n // Where new navigation container is created and the old one is discarded. We need to re-register to\n // trace the new navigation container navigation.\n }\n\n let newNavigationContainer: NavigationContainer | undefined;\n if (isPlainObject(maybeNewNavigationContainer) && 'current' in maybeNewNavigationContainer) {\n newNavigationContainer = maybeNewNavigationContainer.current as NavigationContainer;\n } else {\n newNavigationContainer = maybeNewNavigationContainer as NavigationContainer;\n }\n\n if (navigationContainer === newNavigationContainer) {\n debug.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`);\n return;\n }\n navigationContainer = newNavigationContainer;\n\n if (!navigationContainer) {\n debug.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n if (!isSetupComplete) {\n debug.log(\n `${INTEGRATION_NAME} Navigation container registered before integration setup. Initial span will be created when setup completes.`,\n );\n return undefined;\n }\n startIdleNavigationSpan();\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n *\n * @param unknownEvent - The event object that contains navigation action data\n * @param isAppRestart - Whether this span is being started due to an app restart rather than a normal navigation action\n */\n // eslint-disable-next-line complexity\n const startIdleNavigationSpan = (unknownEvent?: unknown, isAppRestart = false): void => {\n const event = unknownEvent as UnsafeAction | undefined;\n if (useDispatchedActionData && event?.data.noop) {\n debug.log(`${INTEGRATION_NAME} Navigation action is a noop, not starting navigation span.`);\n return;\n }\n\n const navigationActionType = useDispatchedActionData ? event?.data.action.type : undefined;\n\n // Handle PRELOAD actions separately if prefetch tracking is enabled\n if (enablePrefetchTracking && navigationActionType === 'PRELOAD') {\n const preloadData = event?.data.action;\n const payload = preloadData?.payload;\n const targetRoute =\n payload && typeof payload === 'object' && 'name' in payload && typeof payload.name === 'string'\n ? payload.name\n : 'Unknown Route';\n\n debug.log(`${INTEGRATION_NAME} Starting prefetch span for route: ${targetRoute}`);\n\n const prefetchSpan = startInactiveSpan({\n op: 'navigation.prefetch',\n name: `Prefetch ${targetRoute}`,\n attributes: {\n 'route.name': targetRoute,\n },\n });\n\n // Store prefetch span to end it when state changes or timeout\n navigationProcessingSpan = prefetchSpan;\n\n // Set timeout to ensure we don't leave hanging spans\n stateChangeTimeout = setTimeout(() => {\n if (navigationProcessingSpan === prefetchSpan) {\n debug.log(`${INTEGRATION_NAME} Prefetch span timed out for route: ${targetRoute}`);\n prefetchSpan?.setStatus({ code: SPAN_STATUS_OK });\n prefetchSpan?.end();\n navigationProcessingSpan = undefined;\n }\n }, routeChangeTimeoutMs);\n\n return;\n }\n\n if (\n useDispatchedActionData &&\n navigationActionType &&\n [\n // Process common actions\n 'PRELOAD', // Still filter PRELOAD when enablePrefetchTracking is false\n 'SET_PARAMS',\n // Drawer actions\n 'OPEN_DRAWER',\n 'CLOSE_DRAWER',\n 'TOGGLE_DRAWER',\n ].includes(navigationActionType)\n ) {\n debug.log(`${INTEGRATION_NAME} Navigation action is ${navigationActionType}, not starting navigation span.`);\n return;\n }\n\n if (latestNavigationSpan) {\n debug.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing?.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n { ...idleSpanOptions, isAppRestart },\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, navigationActionType);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n // Always discard transactions that never receive route information\n const spanToCheck = latestNavigationSpan;\n ignoreEmptyRouteChangeTransactions(\n getClient(),\n spanToCheck,\n DEFAULT_NAVIGATION_SPAN_NAME,\n () => latestNavigationSpan === spanToCheck,\n );\n\n if (enableTimeToInitialDisplay && latestNavigationSpan) {\n NATIVE.setActiveSpanId(latestNavigationSpan.spanContext().spanId);\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation dispatch to navigation cancelled or screen mounted',\n startTime: spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n // eslint-disable-next-line complexity\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n debug.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n debug.log(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n if (enableTimeToInitialDisplay) {\n addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());\n }\n\n if (previousRoute?.key === route.key) {\n debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n\n // Get the full navigation path for nested navigators\n let routeName = route.name;\n if (useFullPathsForNavigationRoutes) {\n const navigationState = navigationContainer.getState();\n routeName = getPathFromState(navigationState) || route.name;\n }\n\n navigationProcessingSpan?.updateName(`Navigation dispatch to screen ${routeName} mounted`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(routeName);\n }\n const sendDefaultPii = getClient()?.getOptions()?.sendDefaultPii ?? false;\n latestNavigationSpan.setAttributes({\n 'route.name': routeName,\n 'route.key': route.key,\n ...(sendDefaultPii ? extractDynamicRouteParams(routeName, route.params) : undefined),\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${routeName}`,\n data: {\n from: previousRoute?.name,\n to: routeName,\n },\n });\n\n tracing?.setCurrentRoute(routeName);\n\n pushRecentRouteKey(route.key);\n if (useFullPathsForNavigationRoutes) {\n latestRoute = { ...route, name: routeName };\n } else {\n latestRoute = route;\n }\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n options: {\n routeChangeTimeoutMs,\n enableTimeToInitialDisplay,\n ignoreEmptyBackNavigationTransactions,\n enableTimeToInitialDisplayForPreloadedRoutes,\n useDispatchedActionData,\n useFullPathsForNavigationRoutes,\n enablePrefetchTracking,\n },\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n params?: Record<string, any>;\n state?: NavigationState;\n}\n\ninterface NavigationState {\n index?: number;\n routes: NavigationRoute[];\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: (event?: unknown) => void) => void;\n getCurrentRoute: () => NavigationRoute;\n getState: () => NavigationState | undefined;\n}\n\n/**\n * Returns React Navigation integration of the given client.\n */\nexport function getReactNavigationIntegration(\n client: Client,\n): ReturnType<typeof reactNavigationIntegration> | undefined {\n return client.getIntegrationByName<ReturnType<typeof reactNavigationIntegration>>(INTEGRATION_NAME);\n}\n"]}
1
+ {"version":3,"file":"reactnavigation.js","sourceRoot":"","sources":["../../../src/js/tracing/reactnavigation.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EACb,KAAK,EACL,SAAS,EACT,aAAa,EACb,4BAA4B,EAC5B,gCAAgC,EAChC,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAKtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,kCAAkC,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,4CAA4C,EAAE,MAAM,UAAU,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AC;QACnC,CAAC;QACD,IAAI,wBAAwB,EAAE,CAAC;YAC7B,wBAAwB,GAAG,SAAS,CAAC;QACvC,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,GAAS,EAAE;QACzC,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE,CAAC;YAC9C,YAAY,CAAC,kBAAkB,CAAC,CAAC;YACjC,kBAAkB,GAAG,SAAS,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,aAAa;QACb,2BAA2B;QAC3B,OAAO,EAAE;YACP,oBAAoB;YACpB,0BAA0B;YAC1B,qCAAqC;YACrC,4CAA4C;YAC5C,uBAAuB;YACvB,+BAA+B;YAC/B,sBAAsB;SACvB;KACF,CAAC;AACJ,CAAC,CAAC;AAqBF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC3C,MAAc;IAEd,OAAO,MAAM,CAAC,oBAAoB,CAAgD,gBAAgB,CAAC,CAAC;AACtG,CAAC","sourcesContent":["/* oxlint-disable eslint(max-lines) */\nimport type { Client, Integration, Span } from '@sentry/core';\n\nimport {\n addBreadcrumb,\n debug,\n getClient,\n isPlainObject,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n timestampInSeconds,\n} from '@sentry/core';\n\nimport type { UnsafeAction } from '../vendor/react-navigation/types';\nimport type { ReactNativeTracingIntegration } from './reactnativetracing';\n\nimport { getAppRegistryIntegration } from '../integrations/appRegistry';\nimport { isSentrySpan } from '../utils/span';\nimport { RN_GLOBAL_OBJ } from '../utils/worldwide';\nimport { NATIVE } from '../wrapper';\nimport { ignoreEmptyBackNavigation, ignoreEmptyRouteChangeTransactions } from './onSpanEndUtils';\nimport { SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION } from './origin';\nimport { getReactNativeTracingIntegration } from './reactnativetracing';\nimport { SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from './semanticAttributes';\nimport {\n DEFAULT_NAVIGATION_SPAN_NAME,\n defaultIdleOptions,\n getDefaultIdleNavigationSpanOptions,\n startIdleNavigationSpan as startGenericIdleNavigationSpan,\n} from './span';\nimport { addTimeToInitialDisplayFallback } from './timeToDisplayFallback';\n\nexport const INTEGRATION_NAME = 'ReactNavigation';\n\nconst NAVIGATION_HISTORY_MAX_SIZE = 200;\n\n/**\n * Extracts dynamic route parameters from a route name and its params.\n * Matches Expo Router style dynamic segments like `[id]` and `[...slug]`.\n *\n * Only params whose keys appear as dynamic segments in the route name are returned,\n * filtering out non-structural params (query params, etc.) that may contain PII.\n *\n * Note: dynamic segment values (e.g. the `123` in `profile/[id]`) may be user-identifiable.\n * This function only extracts params — callers are responsible for checking `sendDefaultPii`\n * before including the result in span attributes.\n *\n * Previous route params are intentionally not captured — only the current route's\n * structural params are needed for trace attribution.\n */\nexport function extractDynamicRouteParams(\n routeName: string,\n params?: Record<string, unknown>,\n): Record<string, string> | undefined {\n if (!params) {\n return undefined;\n }\n\n const dynamicKeys = new Set<string>();\n const pattern = /\\[(?:\\.\\.\\.)?(\\w+)\\]/g;\n let match: RegExpExecArray | null;\n while ((match = pattern.exec(routeName)) !== null) {\n if (match[1]) {\n dynamicKeys.add(match[1]);\n }\n }\n\n if (dynamicKeys.size === 0) {\n return undefined;\n }\n\n const result: Record<string, string> = {};\n for (const key of dynamicKeys) {\n if (key in params) {\n const value = params[key];\n result[`route.params.${key}`] = Array.isArray(value) ? value.join('/') : String(value ?? '');\n }\n }\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Builds a full path from the navigation state by traversing nested navigators.\n * For example, with nested navigators: \"Home/Settings/Profile\"\n */\nfunction getPathFromState(state?: NavigationState): string | undefined {\n if (!state) {\n return undefined;\n }\n\n const routeNames: string[] = [];\n let currentState: NavigationState | undefined = state;\n\n while (currentState) {\n const index: number = currentState.index ?? 0;\n const route: NavigationRoute | undefined = currentState.routes[index];\n if (route?.name) {\n routeNames.push(route.name);\n }\n currentState = route?.state;\n }\n\n return routeNames.length > 0 ? routeNames.join('/') : undefined;\n}\n\ninterface ReactNavigationIntegrationOptions {\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 *\n * @default 1_000 (ms)\n */\n routeChangeTimeoutMs: number;\n\n /**\n * Time to initial display measures the time it takes from\n * navigation dispatch to the render of the first frame of the new screen.\n *\n * Note: Enabling this adds native bridge calls on every navigation\n * which may cause noticeable overhead on low-end devices.\n *\n * @default false\n */\n enableTimeToInitialDisplay: boolean;\n\n /**\n * Does not sample transactions that are from routes that have been seen any more and don't have any spans.\n * This removes a lot of the clutter as most back navigation transactions are now ignored.\n *\n * @default true\n */\n ignoreEmptyBackNavigationTransactions: boolean;\n\n /**\n * Enabled measuring Time to Initial Display for routes that are already loaded in memory.\n * (a.k.a., Routes that the navigation integration has already seen.)\n *\n * @default false\n */\n enableTimeToInitialDisplayForPreloadedRoutes: boolean;\n\n /**\n * Whether to use the dispatched action data to populate the transaction metadata.\n *\n * @default false\n */\n useDispatchedActionData: boolean;\n\n /**\n * Whether to use the full paths for navigation routes.\n *\n * @default false\n */\n useFullPathsForNavigationRoutes: boolean;\n\n /**\n * Track performance of route prefetching operations.\n * Creates separate spans for PRELOAD actions to measure prefetch performance.\n * This is useful for Expo Router apps that use the prefetch functionality.\n *\n * @default false\n */\n enablePrefetchTracking: boolean;\n}\n\n/**\n * Instrumentation for React-Navigation V5 and above. See docs or sample app for usage.\n *\n * How this works:\n * - `_onDispatch` is called every time a dispatch happens and sets an IdleTransaction on the scope without any route context.\n * - `_onStateChange` is then called AFTER the state change happens due to a dispatch and sets the route context onto the active transaction.\n * - If `_onStateChange` isn't called within `STATE_CHANGE_TIMEOUT_DURATION` of the dispatch, then the transaction is not sampled and finished.\n */\nexport const reactNavigationIntegration = ({\n routeChangeTimeoutMs = 1_000,\n enableTimeToInitialDisplay = false,\n ignoreEmptyBackNavigationTransactions = true,\n enableTimeToInitialDisplayForPreloadedRoutes = false,\n useDispatchedActionData = false,\n useFullPathsForNavigationRoutes = false,\n enablePrefetchTracking = false,\n}: Partial<ReactNavigationIntegrationOptions> = {}): Integration & {\n /**\n * Pass the ref to the navigation container to register it to the instrumentation\n * @param navigationContainerRef Ref to a `NavigationContainer`\n */\n registerNavigationContainer: (navigationContainerRef: unknown) => void;\n options: ReactNavigationIntegrationOptions;\n} => {\n let navigationContainer: NavigationContainer | undefined;\n\n let tracing: ReactNativeTracingIntegration | undefined;\n let idleSpanOptions: Parameters<typeof startGenericIdleNavigationSpan>[1] = defaultIdleOptions;\n let latestRoute: NavigationRoute | undefined;\n\n let latestNavigationSpan: Span | undefined;\n let navigationProcessingSpan: Span | undefined;\n\n let initialStateHandled: boolean = false;\n let isSetupComplete: boolean = false;\n let stateChangeTimeout: ReturnType<typeof setTimeout> | undefined;\n let recentRouteKeys: string[] = [];\n\n if (enableTimeToInitialDisplay) {\n NATIVE.initNativeReactNavigationNewFrameTracking().catch((reason: unknown) => {\n debug.error(`${INTEGRATION_NAME} Failed to initialize native new frame tracking: ${reason}`);\n });\n }\n\n /**\n * Set the initial state and start initial navigation span for the current screen.\n */\n const afterAllSetup = (client: Client): void => {\n tracing = getReactNativeTracingIntegration(client);\n if (tracing) {\n idleSpanOptions = {\n finalTimeout: tracing.options.finalTimeoutMs,\n idleTimeout: tracing.options.idleTimeoutMs,\n };\n }\n\n if (initialStateHandled) {\n // We create an initial state here to ensure a transaction gets created before the first route mounts.\n // This assumes that the Sentry.init() call is made before the first route mounts.\n // If this is not the case, the first transaction will be nameless 'Route Changed'\n return undefined;\n }\n\n getAppRegistryIntegration(client)?.onRunApplication(() => {\n if (initialStateHandled) {\n // To avoid conflict with the initial transaction we check if it was already handled.\n // This ensures runApplication calls after the initial start are correctly traced.\n // This is used for example when Activity is (re)started on Android.\n debug.log('[ReactNavigationIntegration] Starting new idle navigation span based on runApplication call.');\n startIdleNavigationSpan(undefined, true);\n }\n });\n\n isSetupComplete = true;\n\n if (!navigationContainer) {\n // This is expected as navigation container is registered after the root component is mounted.\n return undefined;\n }\n\n // Navigation container already registered, create and populate initial span\n startIdleNavigationSpan();\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n const registerNavigationContainer = (maybeNewNavigationContainer: unknown): void => {\n if (RN_GLOBAL_OBJ.__sentry_rn_v5_registered) {\n debug.log(`${INTEGRATION_NAME} Instrumentation already exists, but registering again...`);\n // In the past we have not allowed re-registering the navigation container to avoid unexpected behavior.\n // But this doesn't work for Android and re-recreating application main activity.\n // Where new navigation container is created and the old one is discarded. We need to re-register to\n // trace the new navigation container navigation.\n }\n\n let newNavigationContainer: NavigationContainer | undefined;\n if (isPlainObject(maybeNewNavigationContainer) && 'current' in maybeNewNavigationContainer) {\n newNavigationContainer = maybeNewNavigationContainer.current as NavigationContainer;\n } else {\n newNavigationContainer = maybeNewNavigationContainer as NavigationContainer;\n }\n\n if (navigationContainer === newNavigationContainer) {\n debug.log(`${INTEGRATION_NAME} Navigation container ref is the same as the one already registered.`);\n return;\n }\n navigationContainer = newNavigationContainer;\n\n if (!navigationContainer) {\n debug.warn(`${INTEGRATION_NAME} Received invalid navigation container ref!`);\n return undefined;\n }\n\n // This action is emitted on every dispatch\n navigationContainer.addListener('__unsafe_action__', startIdleNavigationSpan);\n navigationContainer.addListener('state', updateLatestNavigationSpanWithCurrentRoute);\n RN_GLOBAL_OBJ.__sentry_rn_v5_registered = true;\n\n if (initialStateHandled) {\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n if (!isSetupComplete) {\n debug.log(\n `${INTEGRATION_NAME} Navigation container registered before integration setup. Initial span will be created when setup completes.`,\n );\n return undefined;\n }\n startIdleNavigationSpan();\n }\n\n // Navigation Container is registered after the first navigation\n // Initial navigation span was started, after integration setup,\n // so now we populate it with the current route.\n updateLatestNavigationSpanWithCurrentRoute();\n initialStateHandled = true;\n };\n\n /**\n * To be called on every React-Navigation action dispatch.\n * It does not name the transaction or populate it with route information. Instead, it waits for the state to fully change\n * and gets the route information from there, @see updateLatestNavigationSpanWithCurrentRoute\n *\n * @param unknownEvent - The event object that contains navigation action data\n * @param isAppRestart - Whether this span is being started due to an app restart rather than a normal navigation action\n */\n // oxlint-disable-next-line eslint(complexity)\n const startIdleNavigationSpan = (unknownEvent?: unknown, isAppRestart = false): void => {\n const event = unknownEvent as UnsafeAction | undefined;\n if (useDispatchedActionData && event?.data.noop) {\n debug.log(`${INTEGRATION_NAME} Navigation action is a noop, not starting navigation span.`);\n return;\n }\n\n const navigationActionType = useDispatchedActionData ? event?.data.action.type : undefined;\n\n // Handle PRELOAD actions separately if prefetch tracking is enabled\n if (enablePrefetchTracking && navigationActionType === 'PRELOAD') {\n const preloadData = event?.data.action;\n const payload = preloadData?.payload;\n const targetRoute =\n payload && typeof payload === 'object' && 'name' in payload && typeof payload.name === 'string'\n ? payload.name\n : 'Unknown Route';\n\n debug.log(`${INTEGRATION_NAME} Starting prefetch span for route: ${targetRoute}`);\n\n const prefetchSpan = startInactiveSpan({\n op: 'navigation.prefetch',\n name: `Prefetch ${targetRoute}`,\n attributes: {\n 'route.name': targetRoute,\n },\n });\n\n // Store prefetch span to end it when state changes or timeout\n navigationProcessingSpan = prefetchSpan;\n\n // Set timeout to ensure we don't leave hanging spans\n stateChangeTimeout = setTimeout(() => {\n if (navigationProcessingSpan === prefetchSpan) {\n debug.log(`${INTEGRATION_NAME} Prefetch span timed out for route: ${targetRoute}`);\n prefetchSpan?.setStatus({ code: SPAN_STATUS_OK });\n prefetchSpan?.end();\n navigationProcessingSpan = undefined;\n }\n }, routeChangeTimeoutMs);\n\n return;\n }\n\n if (\n useDispatchedActionData &&\n navigationActionType &&\n [\n // Process common actions\n 'PRELOAD', // Still filter PRELOAD when enablePrefetchTracking is false\n 'SET_PARAMS',\n // Drawer actions\n 'OPEN_DRAWER',\n 'CLOSE_DRAWER',\n 'TOGGLE_DRAWER',\n ].includes(navigationActionType)\n ) {\n debug.log(`${INTEGRATION_NAME} Navigation action is ${navigationActionType}, not starting navigation span.`);\n return;\n }\n\n if (latestNavigationSpan) {\n debug.log(`${INTEGRATION_NAME} A transaction was detected that turned out to be a noop, discarding.`);\n _discardLatestTransaction();\n clearStateChangeTimeout();\n }\n\n latestNavigationSpan = startGenericIdleNavigationSpan(\n tracing?.options.beforeStartSpan\n ? tracing.options.beforeStartSpan(getDefaultIdleNavigationSpanOptions())\n : getDefaultIdleNavigationSpanOptions(),\n { ...idleSpanOptions, isAppRestart },\n );\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION);\n latestNavigationSpan?.setAttribute(SEMANTIC_ATTRIBUTE_NAVIGATION_ACTION_TYPE, navigationActionType);\n if (ignoreEmptyBackNavigationTransactions) {\n ignoreEmptyBackNavigation(getClient(), latestNavigationSpan);\n }\n // Always discard transactions that never receive route information\n const spanToCheck = latestNavigationSpan;\n ignoreEmptyRouteChangeTransactions(\n getClient(),\n spanToCheck,\n DEFAULT_NAVIGATION_SPAN_NAME,\n () => latestNavigationSpan === spanToCheck,\n );\n\n if (enableTimeToInitialDisplay && latestNavigationSpan) {\n NATIVE.setActiveSpanId(latestNavigationSpan.spanContext().spanId);\n navigationProcessingSpan = startInactiveSpan({\n op: 'navigation.processing',\n name: 'Navigation dispatch to navigation cancelled or screen mounted',\n startTime: spanToJSON(latestNavigationSpan).start_timestamp,\n });\n navigationProcessingSpan.setAttribute(\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_ORIGIN_AUTO_NAVIGATION_REACT_NAVIGATION,\n );\n }\n\n stateChangeTimeout = setTimeout(_discardLatestTransaction, routeChangeTimeoutMs);\n };\n\n /**\n * To be called AFTER the state has been changed to populate the transaction with the current route.\n */\n // oxlint-disable-next-line eslint(complexity)\n const updateLatestNavigationSpanWithCurrentRoute = (): void => {\n const stateChangedTimestamp = timestampInSeconds();\n const previousRoute = latestRoute;\n\n if (!navigationContainer) {\n debug.warn(`${INTEGRATION_NAME} Missing navigation container ref. Route transactions will not be sent.`);\n return undefined;\n }\n\n const route = navigationContainer.getCurrentRoute();\n if (!route) {\n debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but no route is rendered.`);\n return undefined;\n }\n\n if (!latestNavigationSpan) {\n debug.log(\n `[${INTEGRATION_NAME}] Navigation state changed, but navigation transaction was not started on dispatch.`,\n );\n return undefined;\n }\n\n if (enableTimeToInitialDisplay) {\n addTimeToInitialDisplayFallback(latestNavigationSpan.spanContext().spanId, NATIVE.getNewScreenTimeToDisplay());\n }\n\n if (previousRoute?.key === route.key) {\n debug.log(`[${INTEGRATION_NAME}] Navigation state changed, but route is the same as previous.`);\n pushRecentRouteKey(route.key);\n latestRoute = route;\n\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n return undefined;\n }\n\n const routeHasBeenSeen = recentRouteKeys.includes(route.key);\n\n // Get the full navigation path for nested navigators\n let routeName = route.name;\n if (useFullPathsForNavigationRoutes) {\n const navigationState = navigationContainer.getState();\n routeName = getPathFromState(navigationState) || route.name;\n }\n\n navigationProcessingSpan?.updateName(`Navigation dispatch to screen ${routeName} mounted`);\n navigationProcessingSpan?.setStatus({ code: SPAN_STATUS_OK });\n navigationProcessingSpan?.end(stateChangedTimestamp);\n navigationProcessingSpan = undefined;\n\n if (spanToJSON(latestNavigationSpan).description === DEFAULT_NAVIGATION_SPAN_NAME) {\n latestNavigationSpan.updateName(routeName);\n }\n const sendDefaultPii = getClient()?.getOptions()?.sendDefaultPii ?? false;\n latestNavigationSpan.setAttributes({\n 'route.name': routeName,\n 'route.key': route.key,\n ...(sendDefaultPii ? extractDynamicRouteParams(routeName, route.params) : undefined),\n 'route.has_been_seen': routeHasBeenSeen,\n 'previous_route.name': previousRoute?.name,\n 'previous_route.key': previousRoute?.key,\n [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'navigation',\n });\n\n // Clear the timeout so the transaction does not get cancelled.\n clearStateChangeTimeout();\n\n addBreadcrumb({\n category: 'navigation',\n type: 'navigation',\n message: `Navigation to ${routeName}`,\n data: {\n from: previousRoute?.name,\n to: routeName,\n },\n });\n\n tracing?.setCurrentRoute(routeName);\n\n pushRecentRouteKey(route.key);\n if (useFullPathsForNavigationRoutes) {\n latestRoute = { ...route, name: routeName };\n } else {\n latestRoute = route;\n }\n // Clear the latest transaction as it has been handled.\n latestNavigationSpan = undefined;\n };\n\n /** Pushes a recent route key, and removes earlier routes when there is greater than the max length */\n const pushRecentRouteKey = (key: string): void => {\n recentRouteKeys.push(key);\n\n if (recentRouteKeys.length > NAVIGATION_HISTORY_MAX_SIZE) {\n recentRouteKeys = recentRouteKeys.slice(recentRouteKeys.length - NAVIGATION_HISTORY_MAX_SIZE);\n }\n };\n\n /** Cancels the latest transaction so it does not get sent to Sentry. */\n const _discardLatestTransaction = (): void => {\n if (latestNavigationSpan) {\n if (isSentrySpan(latestNavigationSpan)) {\n latestNavigationSpan['_sampled'] = false;\n }\n // TODO: What if it's not SentrySpan?\n latestNavigationSpan.end();\n latestNavigationSpan = undefined;\n }\n if (navigationProcessingSpan) {\n navigationProcessingSpan = undefined;\n }\n };\n\n const clearStateChangeTimeout = (): void => {\n if (typeof stateChangeTimeout !== 'undefined') {\n clearTimeout(stateChangeTimeout);\n stateChangeTimeout = undefined;\n }\n };\n\n return {\n name: INTEGRATION_NAME,\n afterAllSetup,\n registerNavigationContainer,\n options: {\n routeChangeTimeoutMs,\n enableTimeToInitialDisplay,\n ignoreEmptyBackNavigationTransactions,\n enableTimeToInitialDisplayForPreloadedRoutes,\n useDispatchedActionData,\n useFullPathsForNavigationRoutes,\n enablePrefetchTracking,\n },\n };\n};\n\nexport interface NavigationRoute {\n name: string;\n key: string;\n // oxlint-disable-next-line typescript-eslint(no-explicit-any)\n params?: Record<string, any>;\n state?: NavigationState;\n}\n\ninterface NavigationState {\n index?: number;\n routes: NavigationRoute[];\n}\n\ninterface NavigationContainer {\n addListener: (type: string, listener: (event?: unknown) => void) => void;\n getCurrentRoute: () => NavigationRoute;\n getState: () => NavigationState | undefined;\n}\n\n/**\n * Returns React Navigation integration of the given client.\n */\nexport function getReactNavigationIntegration(\n client: Client,\n): ReturnType<typeof reactNavigationIntegration> | undefined {\n return client.getIntegrationByName<ReturnType<typeof reactNavigationIntegration>>(INTEGRATION_NAME);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"span.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/span.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAuBpF,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,EAAE;IAC/B;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;CAItB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,iBAAiB,gBAAgB,EACjC,+CAIG,OAAO,CAAC,OAAO,kBAAkB,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,KACtE,IAAI,GAAG,SA+CT,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GACxB,iBAAiB,gBAAgB,EACjC,+BAA+B;IAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KACnG,IAoBF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,gBAAgB,CAOtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GA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,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KACnG,IAoBF,CAAC;AAEF;;GAEG;AACH,wBAAgB,mCAAmC,IAAI,gBAAgB,CAOtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE3D;AAED,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG;IACvC,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAGxE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAM5D;AAED,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAI9D"}
@@ -80,7 +80,7 @@ export const SCOPE_SPAN_FIELD = '_sentrySpan';
80
80
  * Removes the active span from the scope.
81
81
  */
82
82
  export function clearActiveSpanFromScope(scope) {
83
- // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
83
+ // oxlint-disable-next-line typescript-eslint(no-dynamic-delete)
84
84
  delete scope[SCOPE_SPAN_FIELD];
85
85
  }
86
86
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/js/tracing/span.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,4BAA4B,EAC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,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC;AAExD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,IAAU,EAAE,EAAE;;QACpC,IAAI,CAAC,CAAA,MAAA,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,0CAAG,gBAAgB,CAAC,CAAA,EAAE,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,qBAAqB,CAAC;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { Client, Scope, Span, SpanJSON, StartSpanOptions } from '@sentry/core';\nimport {\n debug,\n generateTraceId,\n getActiveSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startIdleSpan as coreStartIdleSpan,\n} from '@sentry/core';\nimport { AppState, Platform } from 'react-native';\nimport { isRootSpan } from '../utils/span';\nimport { adjustTransactionDuration, cancelInBackground } from './onSpanEndUtils';\nimport {\n SPAN_ORIGIN_AUTO_INTERACTION,\n SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM,\n SPAN_ORIGIN_MANUAL_INTERACTION,\n} from './origin';\n\nexport const DEFAULT_NAVIGATION_SPAN_NAME = 'Route Change';\n\nexport const defaultIdleOptions: {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n idleTimeout: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 600_000 (ms)\n */\n finalTimeout: number;\n} = {\n idleTimeout: 1_000,\n finalTimeout: 600_000,\n};\n\nexport const startIdleNavigationSpan = (\n startSpanOption: StartSpanOptions,\n {\n finalTimeout = defaultIdleOptions.finalTimeout,\n idleTimeout = defaultIdleOptions.idleTimeout,\n isAppRestart = false,\n }: Partial<typeof defaultIdleOptions> & { isAppRestart?: boolean } = {},\n): Span | undefined => {\n const client = getClient();\n if (!client) {\n debug.warn(\"[startIdleNavigationSpan] Can't create route change span, missing client.\");\n return undefined;\n }\n\n const activeSpan = getActiveSpan();\n const isActiveSpanInteraction = activeSpan && isRootSpan(activeSpan) && isSentryInteractionSpan(activeSpan);\n\n clearActiveSpanFromScope(getCurrentScope());\n\n // Don't cancel user interaction spans when starting from runApplication (app restart/reload).\n // This preserves the span context for error capture and replay recording.\n if (isActiveSpanInteraction && isAppRestart) {\n debug.log(\n `[startIdleNavigationSpan] Not canceling ${\n spanToJSON(activeSpan).op\n } transaction because navigation is from app restart - preserving error context.`,\n );\n // Don't end the span - it will timeout naturally and remains available for error/replay processing\n } else if (isActiveSpanInteraction) {\n debug.log(\n `[startIdleNavigationSpan] Canceling ${\n spanToJSON(activeSpan).op\n } transaction because of a new navigation root span.`,\n );\n activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });\n activeSpan.end();\n }\n\n const finalStartSpanOptions = {\n ...getDefaultIdleNavigationSpanOptions(),\n ...startSpanOption,\n };\n\n const idleSpan = startIdleSpan(finalStartSpanOptions, { finalTimeout, idleTimeout });\n debug.log(\n `[startIdleNavigationSpan] Starting ${finalStartSpanOptions.op || 'unknown op'} transaction \"${\n finalStartSpanOptions.name\n }\" on scope`,\n );\n\n adjustTransactionDuration(client, idleSpan, finalTimeout);\n\n idleSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM);\n return idleSpan;\n};\n\n/**\n * Starts an idle span from `@sentry/core` with React Native application\n * context awareness.\n *\n * - Span will be started with new propagation context.\n * - Span will be canceled if the app goes to background.\n */\nexport const startIdleSpan = (\n startSpanOption: StartSpanOptions,\n { finalTimeout, idleTimeout }: { finalTimeout: number | undefined; idleTimeout: number | undefined },\n): Span => {\n const client = getClient();\n if (!client) {\n debug.warn(\"[startIdleSpan] Can't create idle span, missing client.\");\n return new SentryNonRecordingSpan();\n }\n\n const currentAppState = AppState.currentState;\n if (currentAppState === 'background' || (Platform.OS === 'ios' && currentAppState === 'inactive')) {\n debug.log(\n `[startIdleSpan] App is already in '${currentAppState}' state, not starting span for ${startSpanOption.name}`,\n );\n return new SentryNonRecordingSpan();\n }\n\n getCurrentScope().setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() });\n\n const span = coreStartIdleSpan(startSpanOption, { finalTimeout, idleTimeout });\n cancelInBackground(client, span);\n return span;\n};\n\n/**\n * Returns the default options for the idle navigation span.\n */\nexport function getDefaultIdleNavigationSpanOptions(): StartSpanOptions {\n return {\n name: DEFAULT_NAVIGATION_SPAN_NAME,\n op: 'navigation',\n forceTransaction: true,\n scope: getCurrentScope(),\n };\n}\n\n/**\n * Checks if the span is a Sentry User Interaction span.\n */\nexport function isSentryInteractionSpan(span: Span): boolean {\n return [SPAN_ORIGIN_AUTO_INTERACTION, SPAN_ORIGIN_MANUAL_INTERACTION].includes(spanToJSON(span).origin || '');\n}\n\nexport const SCOPE_SPAN_FIELD = '_sentrySpan';\n\nexport type ScopeWithMaybeSpan = Scope & {\n [SCOPE_SPAN_FIELD]?: Span;\n};\n\n/**\n * Removes the active span from the scope.\n */\nexport function clearActiveSpanFromScope(scope: ScopeWithMaybeSpan): void {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scope[SCOPE_SPAN_FIELD];\n}\n\n/**\n * Ensures that all created spans have an operation name.\n */\nexport function addDefaultOpForSpanFrom(client: Client): void {\n client.on('spanStart', (span: Span) => {\n if (!spanToJSON(span).op) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'default');\n }\n });\n}\n\nexport const SPAN_THREAD_NAME = 'thread.name';\nexport const SPAN_THREAD_NAME_MAIN = 'main';\nexport const SPAN_THREAD_NAME_JAVASCRIPT = 'javascript';\n\n/**\n * Adds Javascript thread info to spans.\n * Ref: https://reactnative.dev/architecture/threading-model\n */\nexport function addThreadInfoToSpan(client: Client): void {\n client.on('spanStart', (span: Span) => {\n if (!spanToJSON(span).data?.[SPAN_THREAD_NAME]) {\n span.setAttribute(SPAN_THREAD_NAME, SPAN_THREAD_NAME_JAVASCRIPT);\n }\n });\n}\n\n/**\n * Sets the Main thread info to the span.\n */\nexport function setMainThreadInfo(spanJSON: SpanJSON): SpanJSON {\n spanJSON.data = spanJSON.data || {};\n spanJSON.data[SPAN_THREAD_NAME] = SPAN_THREAD_NAME_MAIN;\n return spanJSON;\n}\n"]}
1
+ {"version":3,"file":"span.js","sourceRoot":"","sources":["../../../src/js/tracing/span.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,4BAA4B,EAC5B,gCAAgC,EAChC,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,aAAa,IAAI,iBAAiB,GACnC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,8BAA8B,GAC/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C,CAAC,IAAI,0CAAG,gBAAgB,CAAC,CAAA,EAAE,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,qBAAqB,CAAC;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { Client, Scope, Span, SpanJSON, StartSpanOptions } from '@sentry/core';\n\nimport {\n debug,\n generateTraceId,\n getActiveSpan,\n getClient,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startIdleSpan as coreStartIdleSpan,\n} from '@sentry/core';\nimport { AppState, Platform } from 'react-native';\n\nimport { isRootSpan } from '../utils/span';\nimport { adjustTransactionDuration, cancelInBackground } from './onSpanEndUtils';\nimport {\n SPAN_ORIGIN_AUTO_INTERACTION,\n SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM,\n SPAN_ORIGIN_MANUAL_INTERACTION,\n} from './origin';\n\nexport const DEFAULT_NAVIGATION_SPAN_NAME = 'Route Change';\n\nexport const defaultIdleOptions: {\n /**\n * The time that has to pass without any span being created.\n * If this time is exceeded, the idle span will finish.\n *\n * @default 1_000 (ms)\n */\n idleTimeout: number;\n\n /**\n * The max. time an idle span may run.\n * If this time is exceeded, the idle span will finish no matter what.\n *\n * @default 600_000 (ms)\n */\n finalTimeout: number;\n} = {\n idleTimeout: 1_000,\n finalTimeout: 600_000,\n};\n\nexport const startIdleNavigationSpan = (\n startSpanOption: StartSpanOptions,\n {\n finalTimeout = defaultIdleOptions.finalTimeout,\n idleTimeout = defaultIdleOptions.idleTimeout,\n isAppRestart = false,\n }: Partial<typeof defaultIdleOptions> & { isAppRestart?: boolean } = {},\n): Span | undefined => {\n const client = getClient();\n if (!client) {\n debug.warn(\"[startIdleNavigationSpan] Can't create route change span, missing client.\");\n return undefined;\n }\n\n const activeSpan = getActiveSpan();\n const isActiveSpanInteraction = activeSpan && isRootSpan(activeSpan) && isSentryInteractionSpan(activeSpan);\n\n clearActiveSpanFromScope(getCurrentScope());\n\n // Don't cancel user interaction spans when starting from runApplication (app restart/reload).\n // This preserves the span context for error capture and replay recording.\n if (isActiveSpanInteraction && isAppRestart) {\n debug.log(\n `[startIdleNavigationSpan] Not canceling ${\n spanToJSON(activeSpan).op\n } transaction because navigation is from app restart - preserving error context.`,\n );\n // Don't end the span - it will timeout naturally and remains available for error/replay processing\n } else if (isActiveSpanInteraction) {\n debug.log(\n `[startIdleNavigationSpan] Canceling ${\n spanToJSON(activeSpan).op\n } transaction because of a new navigation root span.`,\n );\n activeSpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'cancelled' });\n activeSpan.end();\n }\n\n const finalStartSpanOptions = {\n ...getDefaultIdleNavigationSpanOptions(),\n ...startSpanOption,\n };\n\n const idleSpan = startIdleSpan(finalStartSpanOptions, { finalTimeout, idleTimeout });\n debug.log(\n `[startIdleNavigationSpan] Starting ${finalStartSpanOptions.op || 'unknown op'} transaction \"${\n finalStartSpanOptions.name\n }\" on scope`,\n );\n\n adjustTransactionDuration(client, idleSpan, finalTimeout);\n\n idleSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM);\n return idleSpan;\n};\n\n/**\n * Starts an idle span from `@sentry/core` with React Native application\n * context awareness.\n *\n * - Span will be started with new propagation context.\n * - Span will be canceled if the app goes to background.\n */\nexport const startIdleSpan = (\n startSpanOption: StartSpanOptions,\n { finalTimeout, idleTimeout }: { finalTimeout: number | undefined; idleTimeout: number | undefined },\n): Span => {\n const client = getClient();\n if (!client) {\n debug.warn(\"[startIdleSpan] Can't create idle span, missing client.\");\n return new SentryNonRecordingSpan();\n }\n\n const currentAppState = AppState.currentState;\n if (currentAppState === 'background' || (Platform.OS === 'ios' && currentAppState === 'inactive')) {\n debug.log(\n `[startIdleSpan] App is already in '${currentAppState}' state, not starting span for ${startSpanOption.name}`,\n );\n return new SentryNonRecordingSpan();\n }\n\n getCurrentScope().setPropagationContext({ traceId: generateTraceId(), sampleRand: Math.random() });\n\n const span = coreStartIdleSpan(startSpanOption, { finalTimeout, idleTimeout });\n cancelInBackground(client, span);\n return span;\n};\n\n/**\n * Returns the default options for the idle navigation span.\n */\nexport function getDefaultIdleNavigationSpanOptions(): StartSpanOptions {\n return {\n name: DEFAULT_NAVIGATION_SPAN_NAME,\n op: 'navigation',\n forceTransaction: true,\n scope: getCurrentScope(),\n };\n}\n\n/**\n * Checks if the span is a Sentry User Interaction span.\n */\nexport function isSentryInteractionSpan(span: Span): boolean {\n return [SPAN_ORIGIN_AUTO_INTERACTION, SPAN_ORIGIN_MANUAL_INTERACTION].includes(spanToJSON(span).origin || '');\n}\n\nexport const SCOPE_SPAN_FIELD = '_sentrySpan';\n\nexport type ScopeWithMaybeSpan = Scope & {\n [SCOPE_SPAN_FIELD]?: Span;\n};\n\n/**\n * Removes the active span from the scope.\n */\nexport function clearActiveSpanFromScope(scope: ScopeWithMaybeSpan): void {\n // oxlint-disable-next-line typescript-eslint(no-dynamic-delete)\n delete scope[SCOPE_SPAN_FIELD];\n}\n\n/**\n * Ensures that all created spans have an operation name.\n */\nexport function addDefaultOpForSpanFrom(client: Client): void {\n client.on('spanStart', (span: Span) => {\n if (!spanToJSON(span).op) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'default');\n }\n });\n}\n\nexport const SPAN_THREAD_NAME = 'thread.name';\nexport const SPAN_THREAD_NAME_MAIN = 'main';\nexport const SPAN_THREAD_NAME_JAVASCRIPT = 'javascript';\n\n/**\n * Adds Javascript thread info to spans.\n * Ref: https://reactnative.dev/architecture/threading-model\n */\nexport function addThreadInfoToSpan(client: Client): void {\n client.on('spanStart', (span: Span) => {\n if (!spanToJSON(span).data?.[SPAN_THREAD_NAME]) {\n span.setAttribute(SPAN_THREAD_NAME, SPAN_THREAD_NAME_JAVASCRIPT);\n }\n });\n}\n\n/**\n * Sets the Main thread info to the span.\n */\nexport function setMainThreadInfo(spanJSON: SpanJSON): SpanJSON {\n spanJSON.data = spanJSON.data || {};\n spanJSON.data[SPAN_THREAD_NAME] = SPAN_THREAD_NAME_MAIN;\n return spanJSON;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplay.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B;;GAEG;AACH,eAAO,MAAM,yBAAyB,qBAA4B,CAAC;AAqBnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAQlF;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAI/E;AAoBD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,GACA,IAAI,GAAG,SAAS,CAoClB;AA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I,KAAK,IAAI,CAAC;CAChD,GAAG,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAE1C"}
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { debug, fill, getActiveSpan, getSpanDescendants, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';
10
+ import { debug, fill, getActiveSpan, getSpanDescendants, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan, } from '@sentry/core';
11
11
  import * as React from 'react';
12
12
  import { useState } from 'react';
13
13
  import { NATIVE } from '../wrapper';
@@ -51,7 +51,7 @@ export function TimeToInitialDisplay(props) {
51
51
  manualInitialDisplaySpans.set(activeSpan, true);
52
52
  }
53
53
  const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;
54
- return React.createElement(TimeToDisplay, { initialDisplay: props.record, parentSpanId: parentSpanId }, props.children);
54
+ return (React.createElement(TimeToDisplay, { initialDisplay: props.record, parentSpanId: parentSpanId }, props.children));
55
55
  }
56
56
  /**
57
57
  * Component to measure time to full display.
@@ -63,7 +63,7 @@ export function TimeToInitialDisplay(props) {
63
63
  export function TimeToFullDisplay(props) {
64
64
  const activeSpan = getActiveSpan();
65
65
  const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;
66
- return React.createElement(TimeToDisplay, { fullDisplay: props.record, parentSpanId: parentSpanId }, props.children);
66
+ return (React.createElement(TimeToDisplay, { fullDisplay: props.record, parentSpanId: parentSpanId }, props.children));
67
67
  }
68
68
  function TimeToDisplay(props) {
69
69
  const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();
@@ -84,7 +84,7 @@ export function startTimeToInitialDisplaySpan(options) {
84
84
  debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.');
85
85
  return undefined;
86
86
  }
87
- const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');
87
+ const existingSpan = getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display');
88
88
  if (existingSpan) {
89
89
  debug.log('[TimeToDisplay] Found existing ui.load.initial_display span.');
90
90
  return existingSpan;
@@ -93,7 +93,7 @@ export function startTimeToInitialDisplaySpan(options) {
93
93
  if (!initialDisplaySpan) {
94
94
  return undefined;
95
95
  }
96
- captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch((error) => {
96
+ captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch(error => {
97
97
  debug.log(`[TimeToDisplay] Failed to capture start frames for initial display span (${initialDisplaySpan.spanContext().spanId}).`, error);
98
98
  });
99
99
  if (options === null || options === void 0 ? void 0 : options.isAutoInstrumented) {
@@ -121,12 +121,12 @@ export function startTimeToFullDisplaySpan(options = {
121
121
  return undefined;
122
122
  }
123
123
  const descendantSpans = getSpanDescendants(activeSpan);
124
- const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');
124
+ const initialDisplaySpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.initial_display');
125
125
  if (!initialDisplaySpan) {
126
126
  debug.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.');
127
127
  return undefined;
128
128
  }
129
- const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');
129
+ const existingSpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.full_display');
130
130
  if (existingSpan) {
131
131
  debug.log('[TimeToDisplay] Found existing ui.load.full_display span.');
132
132
  return existingSpan;
@@ -135,7 +135,7 @@ export function startTimeToFullDisplaySpan(options = {
135
135
  if (!fullDisplaySpan) {
136
136
  return undefined;
137
137
  }
138
- captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch((error) => {
138
+ captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch(error => {
139
139
  debug.log(`[TimeToDisplay] Failed to capture start frames for full display span (${fullDisplaySpan.spanContext().spanId}).`, error);
140
140
  });
141
141
  const timeout = setTimeout(() => {
@@ -143,11 +143,14 @@ export function startTimeToFullDisplaySpan(options = {
143
143
  return;
144
144
  }
145
145
  fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });
146
- captureEndFramesAndAttachToSpan(fullDisplaySpan).then(() => {
146
+ const fullDisplayEndTimestamp = spanToJSON(initialDisplaySpan).timestamp;
147
+ captureEndFramesAndAttachToSpan(fullDisplaySpan, fullDisplayEndTimestamp)
148
+ .then(() => {
147
149
  debug.log(`[TimeToDisplay] span ${fullDisplaySpan.spanContext().spanId} updated with frame data.`);
148
- fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);
150
+ fullDisplaySpan.end(fullDisplayEndTimestamp);
149
151
  setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);
150
- }).catch(() => {
152
+ })
153
+ .catch(() => {
151
154
  debug.warn(`[TimeToDisplay] Failed to capture end frames for full display span (${fullDisplaySpan.spanContext().spanId}).`);
152
155
  fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);
153
156
  setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);
@@ -186,7 +189,8 @@ export function updateInitialDisplaySpan(frameTimestampSeconds, { activeSpan = g
186
189
  debug.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);
187
190
  return;
188
191
  }
189
- captureEndFramesAndAttachToSpan(span).then(() => {
192
+ captureEndFramesAndAttachToSpan(span, frameTimestampSeconds)
193
+ .then(() => {
190
194
  span.end(frameTimestampSeconds);
191
195
  span.setStatus({ code: SPAN_STATUS_OK });
192
196
  debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp and frame data.`);
@@ -196,7 +200,8 @@ export function updateInitialDisplaySpan(frameTimestampSeconds, { activeSpan = g
196
200
  updateFullDisplaySpan(frameTimestampSeconds, span);
197
201
  }
198
202
  setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);
199
- }).catch((error) => {
203
+ })
204
+ .catch(error => {
200
205
  debug.log('[TimeToDisplay] Failed to capture frame data for initial display span.', error);
201
206
  span.end(frameTimestampSeconds);
202
207
  span.setStatus({ code: SPAN_STATUS_OK });
@@ -214,8 +219,8 @@ function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan)
214
219
  debug.warn('[TimeToDisplay] No active span found to update ui.load.full_display in.');
215
220
  return;
216
221
  }
217
- const existingInitialDisplaySpan = passedInitialDisplaySpan
218
- || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');
222
+ const existingInitialDisplaySpan = passedInitialDisplaySpan ||
223
+ getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display');
219
224
  const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;
220
225
  if (!initialDisplayEndTimestamp) {
221
226
  fullDisplayBeforeInitialDisplay.set(activeSpan, true);
@@ -234,8 +239,9 @@ function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan)
234
239
  debug.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);
235
240
  return;
236
241
  }
237
- captureEndFramesAndAttachToSpan(span).then(() => {
238
- const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;
242
+ const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;
243
+ captureEndFramesAndAttachToSpan(span, endTimestamp)
244
+ .then(() => {
239
245
  if (initialDisplayEndTimestamp > frameTimestampSeconds) {
240
246
  debug.warn('[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.');
241
247
  }
@@ -243,7 +249,8 @@ function updateFullDisplaySpan(frameTimestampSeconds, passedInitialDisplaySpan)
243
249
  span.setStatus({ code: SPAN_STATUS_OK });
244
250
  debug.log(`[TimeToDisplay] span ${spanJSON.description} (${spanJSON.span_id}) updated with end timestamp and frame data.`);
245
251
  setSpanDurationAsMeasurement('time_to_full_display', span);
246
- }).catch((error) => {
252
+ })
253
+ .catch(error => {
247
254
  debug.log('[TimeToDisplay] Failed to capture frame data for full display span.', error);
248
255
  const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;
249
256
  span.end(endTimestamp);
@@ -341,7 +348,7 @@ function captureStartFramesForSpan(spanId) {
341
348
  /**
342
349
  * Captures end frames and attaches frame data to span
343
350
  */
344
- function captureEndFramesAndAttachToSpan(span) {
351
+ function captureEndFramesAndAttachToSpan(span, spanEndTimestampSeconds) {
345
352
  return __awaiter(this, void 0, void 0, function* () {
346
353
  if (!NATIVE.enableNative) {
347
354
  return;
@@ -356,6 +363,22 @@ function captureEndFramesAndAttachToSpan(span) {
356
363
  const endFrames = yield fetchNativeFramesWithTimeout();
357
364
  frameData.endFrames = endFrames;
358
365
  attachFrameDataToSpan(span, frameData.startFrames, endFrames);
366
+ const spanStartTimestamp = spanToJSON(span).start_timestamp;
367
+ if (spanStartTimestamp) {
368
+ try {
369
+ const endTimestamp = spanEndTimestampSeconds || spanToJSON(span).timestamp || Date.now() / 1000;
370
+ const framesDelay = yield Promise.race([
371
+ NATIVE.fetchNativeFramesDelay(spanStartTimestamp, endTimestamp),
372
+ new Promise(resolve => setTimeout(() => resolve(null), FETCH_FRAMES_TIMEOUT_MS)),
373
+ ]);
374
+ if (framesDelay != null) {
375
+ span.setAttribute('frames.delay', framesDelay);
376
+ }
377
+ }
378
+ catch (delayError) {
379
+ debug.log(`[TimeToDisplay] Failed to fetch frames delay for span ${spanId}.`, delayError);
380
+ }
381
+ }
359
382
  debug.log(`[TimeToDisplay] Captured and attached end frames for span ${spanId}.`, endFrames);
360
383
  }
361
384
  catch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AC,KAAc,EAAE,EAAE;YAClC,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable max-lines */\nimport type { Span, StartSpanOptions } from '@sentry/core';\nimport { debug, fill, getActiveSpan, getSpanDescendants, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_STATUS_ERROR, SPAN_STATUS_OK, spanToJSON, startInactiveSpan } from '@sentry/core';\nimport * as React from 'react';\nimport { useState } from 'react';\nimport type { NativeFramesResponse } from '../NativeRNSentry';\nimport { NATIVE } from '../wrapper';\nimport { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';\nimport { getRNSentryOnDrawReporter } from './timetodisplaynative';\nimport { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils';\n\n/**\n * Timeout for fetching native frames\n */\nconst FETCH_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * Maximum time to keep frame data in memory before cleaning up.\n * Prevents memory leaks for spans that never complete.\n */\nconst FRAME_DATA_CLEANUP_TIMEOUT_MS = 60_000;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\ninterface FrameDataForSpan {\n startFrames: NativeFramesResponse | null;\n endFrames: NativeFramesResponse | null;\n cleanupTimeout?: ReturnType<typeof setTimeout>;\n}\n\n/**\n * Stores frame data for in-flight TTID/TTFD spans.\n * Entries are automatically cleaned up when spans end (in captureEndFramesAndAttachToSpan finally block).\n * As a safety mechanism, entries are also cleaned up after FRAME_DATA_CLEANUP_TIMEOUT_MS\n * to prevent memory leaks for spans that never complete.\n */\nconst spanFrameDataMap = new Map<string, FrameDataForSpan>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return <TimeToDisplay initialDisplay={props.record} parentSpanId={parentSpanId}>{props.children}</TimeToDisplay>;\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return <TimeToDisplay fullDisplay={props.record} parentSpanId={parentSpanId}>{props.children}</TimeToDisplay>;\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n parentSpanId?: string;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n return (\n <>\n <RNSentryOnDrawReporter\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay}\n parentSpanId={props.parentSpanId} />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.');\n return undefined;\n }\n\n const existingSpan = getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n debug.log('[TimeToDisplay] Found existing ui.load.initial_display span.');\n return existingSpan\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTime: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return undefined;\n }\n\n captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch((error) => {\n debug.log(`[TimeToDisplay] Failed to capture start frames for initial display span (${initialDisplaySpan.spanContext().spanId}).`, error);\n });\n\n if (options?.isAutoInstrumented) {\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n manualInitialDisplaySpans.set(activeSpan, true);\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string,\n timeoutMs?: number,\n isAutoInstrumented?: boolean\n } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.full_display to.');\n return undefined;\n }\n\n const descendantSpans = getSpanDescendants(activeSpan);\n\n const initialDisplaySpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n debug.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.');\n return undefined;\n }\n\n const existingSpan = descendantSpans.find((span) => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n debug.log('[TimeToDisplay] Found existing ui.load.full_display span.');\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTime: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return undefined;\n }\n\n captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch((error) => {\n debug.log(`[TimeToDisplay] Failed to capture start frames for full display span (${fullDisplaySpan.spanContext().spanId}).`, error);\n });\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });\n\n captureEndFramesAndAttachToSpan(fullDisplaySpan).then(() => {\n debug.log(`[TimeToDisplay] span ${fullDisplaySpan.spanContext().spanId} updated with frame data.`);\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n }).catch(() => {\n debug.warn(`[TimeToDisplay] Failed to capture end frames for full display span (${fullDisplaySpan.spanContext().spanId}).`);\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n });\n\n debug.warn('[TimeToDisplay] Full display span deadline_exceeded.');\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters<Span['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n if (options?.isAutoInstrumented) {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return fullDisplaySpan;\n}\n\n/**\n *\n */\nexport function updateInitialDisplaySpan(\n frameTimestampSeconds: number,\n {\n activeSpan = getActiveSpan(),\n span = startTimeToInitialDisplaySpan(),\n }: {\n activeSpan?: Span;\n /**\n * Time to initial display span to update.\n */\n span?: Span;\n } = {}): void {\n if (!span) {\n debug.warn('[TimeToDisplay] No span found or created, possibly performance is disabled.');\n return;\n }\n\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.');\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n debug.warn('[TimeToDisplay] Initial display span is not a child of current active span.');\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n debug.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n captureEndFramesAndAttachToSpan(span).then(() => {\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp and frame data.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);\n }).catch((error) => {\n debug.log('[TimeToDisplay] Failed to capture frame data for initial display span.', error);\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);\n });\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to update ui.load.full_display in.');\n return;\n }\n\n const existingInitialDisplaySpan = passedInitialDisplaySpan\n || getSpanDescendants(activeSpan).find((span) => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n debug.warn(`[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`);\n return;\n }\n\n const span = startTimeToFullDisplaySpan({\n isAutoInstrumented: true,\n });\n if (!span) {\n debug.warn('[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.');\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n debug.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n captureEndFramesAndAttachToSpan(span).then(() => {\n const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;\n\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n debug.warn('[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.');\n }\n\n span.end(endTimestamp);\n span.setStatus({ code: SPAN_STATUS_OK });\n debug.log(`[TimeToDisplay] span ${spanJSON.description} (${spanJSON.span_id}) updated with end timestamp and frame data.`);\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n }).catch((error) => {\n debug.log('[TimeToDisplay] Failed to capture frame data for full display span.', error);\n const endTimestamp = initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;\n\n span.end(endTimestamp);\n span.setStatus({ code: SPAN_STATUS_OK });\n setSpanDurationAsMeasurement('time_to_full_display', span);\n });\n}\n\n/**\n * Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.\n */\nexport function createTimeToFullDisplay({\n useFocusEffect,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToFullDisplay });\n}\n\n/**\n * Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.\n */\nexport function createTimeToInitialDisplay({\n useFocusEffect,\n}: {\n useFocusEffect: (callback: () => void) => void\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToInitialDisplay });\n}\n\nfunction createTimeToDisplay({\n useFocusEffect,\n Component,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void;\n Component: typeof TimeToFullDisplay | typeof TimeToInitialDisplay;\n}): React.ComponentType<TimeToDisplayProps> {\n const TimeToDisplayWrapper = (props: TimeToDisplayProps): React.ReactElement => {\n const [focused, setFocused] = useState(false);\n\n useFocusEffect(() => {\n setFocused(true);\n return () => {\n setFocused(false);\n };\n });\n\n return <Component {...props} record={focused && props.record} />;\n };\n\n TimeToDisplayWrapper.displayName = 'TimeToDisplayWrapper';\n return TimeToDisplayWrapper;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: Span, startFrames: NativeFramesResponse, endFrames: NativeFramesResponse): void {\n const totalFrames = endFrames.totalFrames - startFrames.totalFrames;\n const slowFrames = endFrames.slowFrames - startFrames.slowFrames;\n const frozenFrames = endFrames.frozenFrames - startFrames.frozenFrames;\n\n if (totalFrames <= 0 && slowFrames <= 0 && frozenFrames <= 0) {\n debug.warn(`[TimeToDisplay] Detected zero slow or frozen frames. Not adding measurements to span (${span.spanContext().spanId}).`);\n return;\n }\n span.setAttribute('frames.total', totalFrames);\n span.setAttribute('frames.slow', slowFrames);\n span.setAttribute('frames.frozen', frozenFrames);\n\n debug.log('[TimeToDisplay] Attached frame data to span.', {\n spanId: span.spanContext().spanId,\n frameData: {\n total: totalFrames,\n slow: slowFrames,\n frozen: frozenFrames,\n },\n });\n}\n\n/**\n * Captures start frames for a time-to-display span\n */\nasync function captureStartFramesForSpan(spanId: string): Promise<void> {\n if (!NATIVE.enableNative) {\n return;\n }\n\n try {\n const startFrames = await fetchNativeFramesWithTimeout();\n\n // Set up automatic cleanup as a safety mechanism for spans that never complete\n const cleanupTimeout = setTimeout(() => {\n const entry = spanFrameDataMap.get(spanId);\n if (entry) {\n spanFrameDataMap.delete(spanId);\n debug.log(`[TimeToDisplay] Cleaned up stale frame data for span ${spanId} after timeout.`);\n }\n }, FRAME_DATA_CLEANUP_TIMEOUT_MS);\n\n if (!spanFrameDataMap.has(spanId)) {\n spanFrameDataMap.set(spanId, { startFrames: null, endFrames: null, cleanupTimeout });\n }\n\n // Re-check after async operations - entry might have been deleted by captureEndFramesAndAttachToSpan\n const frameData = spanFrameDataMap.get(spanId);\n if (!frameData) {\n // Span already ended and cleaned up, cancel the cleanup timeout\n clearTimeout(cleanupTimeout);\n debug.log(`[TimeToDisplay] Span ${spanId} already ended, discarding start frames.`);\n return;\n }\n\n frameData.startFrames = startFrames;\n frameData.cleanupTimeout = cleanupTimeout;\n debug.log(`[TimeToDisplay] Captured start frames for span ${spanId}.`, startFrames);\n } catch (error) {\n debug.log(`[TimeToDisplay] Failed to capture start frames for span ${spanId}.`, error);\n }\n}\n\n/**\n * Captures end frames and attaches frame data to span\n */\nasync function captureEndFramesAndAttachToSpan(span: Span): Promise<void> {\n if (!NATIVE.enableNative) {\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const frameData = spanFrameDataMap.get(spanId);\n\n if (!frameData?.startFrames) {\n debug.log(`[TimeToDisplay] No start frames found for span ${spanId}, skipping frame data collection.`);\n return;\n }\n\n try {\n const endFrames = await fetchNativeFramesWithTimeout();\n frameData.endFrames = endFrames;\n\n attachFrameDataToSpan(span, frameData.startFrames, endFrames);\n\n debug.log(`[TimeToDisplay] Captured and attached end frames for span ${spanId}.`, endFrames);\n } catch (error) {\n debug.log(`[TimeToDisplay] Failed to capture end frames for span ${spanId}.`, error);\n } finally {\n // Clear the cleanup timeout since we're cleaning up now\n if (frameData.cleanupTimeout) {\n clearTimeout(frameData.cleanupTimeout);\n }\n spanFrameDataMap.delete(spanId);\n }\n}\n\n/**\n * Fetches native frames with a timeout\n */\nfunction fetchNativeFramesWithTimeout(): Promise<NativeFramesResponse> {\n return new Promise<NativeFramesResponse>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = setTimeout(() => {\n if (!settled) {\n settled = true;\n reject('Fetching native frames took too long. Dropping frames.');\n }\n }, FETCH_FRAMES_TIMEOUT_MS);\n\n NATIVE.fetchNativeFrames()\n .then(value => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n\n if (!value) {\n reject('Native frames response is null.');\n return;\n }\n resolve(value);\n })\n .then(undefined, (error: unknown) => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n reject(error);\n });\n });\n}\n"]}
1
+ {"version":3,"file":"timetodisplay.js","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplay.tsx"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EACL,KAAK,EACL,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,gCAAgC,EAChC,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIjC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC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;YACxB,OAAO,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,iCAAiC,CAAC,CAAC;gBAC1C,OAAO;YACT,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC;aACD,IAAI,CAAC,SAAS,EAAE,CAAC,KAAc,EAAE,EAAE;YAClC,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,GAAG,IAAI,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* oxlint-disable eslint(max-lines) */\nimport type { Span, StartSpanOptions } from '@sentry/core';\n\nimport {\n debug,\n fill,\n getActiveSpan,\n getSpanDescendants,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n SPAN_STATUS_OK,\n spanToJSON,\n startInactiveSpan,\n} from '@sentry/core';\nimport * as React from 'react';\nimport { useState } from 'react';\n\nimport type { NativeFramesResponse } from '../NativeRNSentry';\n\nimport { NATIVE } from '../wrapper';\nimport { SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY } from './origin';\nimport { getRNSentryOnDrawReporter } from './timetodisplaynative';\nimport { setSpanDurationAsMeasurement, setSpanDurationAsMeasurementOnSpan } from './utils';\n\n/**\n * Timeout for fetching native frames\n */\nconst FETCH_FRAMES_TIMEOUT_MS = 2_000;\n\n/**\n * Maximum time to keep frame data in memory before cleaning up.\n * Prevents memory leaks for spans that never complete.\n */\nconst FRAME_DATA_CLEANUP_TIMEOUT_MS = 60_000;\n\n/**\n * Flags of active spans with manual initial display.\n */\nexport const manualInitialDisplaySpans = new WeakMap<Span, true>();\n\n/**\n * Flag full display called before initial display for an active span.\n */\nconst fullDisplayBeforeInitialDisplay = new WeakMap<Span, true>();\n\ninterface FrameDataForSpan {\n startFrames: NativeFramesResponse | null;\n endFrames: NativeFramesResponse | null;\n cleanupTimeout?: ReturnType<typeof setTimeout>;\n}\n\n/**\n * Stores frame data for in-flight TTID/TTFD spans.\n * Entries are automatically cleaned up when spans end (in captureEndFramesAndAttachToSpan finally block).\n * As a safety mechanism, entries are also cleaned up after FRAME_DATA_CLEANUP_TIMEOUT_MS\n * to prevent memory leaks for spans that never complete.\n */\nconst spanFrameDataMap = new Map<string, FrameDataForSpan>();\n\nexport type TimeToDisplayProps = {\n children?: React.ReactNode;\n record?: boolean;\n};\n\n/**\n * Component to measure time to initial display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToInitialDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n manualInitialDisplaySpans.set(activeSpan, true);\n }\n\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return (\n <TimeToDisplay initialDisplay={props.record} parentSpanId={parentSpanId}>\n {props.children}\n </TimeToDisplay>\n );\n}\n\n/**\n * Component to measure time to full display.\n *\n * The initial display is recorded when the component prop `record` is true.\n *\n * <TimeToInitialDisplay record />\n */\nexport function TimeToFullDisplay(props: TimeToDisplayProps): React.ReactElement {\n const activeSpan = getActiveSpan();\n const parentSpanId = activeSpan && spanToJSON(activeSpan).span_id;\n return (\n <TimeToDisplay fullDisplay={props.record} parentSpanId={parentSpanId}>\n {props.children}\n </TimeToDisplay>\n );\n}\n\nfunction TimeToDisplay(props: {\n children?: React.ReactNode;\n initialDisplay?: boolean;\n fullDisplay?: boolean;\n parentSpanId?: string;\n}): React.ReactElement {\n const RNSentryOnDrawReporter = getRNSentryOnDrawReporter();\n return (\n <>\n <RNSentryOnDrawReporter\n initialDisplay={props.initialDisplay}\n fullDisplay={props.fullDisplay}\n parentSpanId={props.parentSpanId}\n />\n {props.children}\n </>\n );\n}\n\n/**\n * Starts a new span for the initial display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToInitialDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToInitialDisplaySpan(\n options?: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n isAutoInstrumented?: boolean;\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.');\n return undefined;\n }\n\n const existingSpan = getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display');\n if (existingSpan) {\n debug.log('[TimeToDisplay] Found existing ui.load.initial_display span.');\n return existingSpan;\n }\n\n const initialDisplaySpan = startInactiveSpan({\n op: 'ui.load.initial_display',\n name: 'Time To Initial Display',\n startTime: spanToJSON(activeSpan).start_timestamp,\n ...options,\n });\n\n if (!initialDisplaySpan) {\n return undefined;\n }\n\n captureStartFramesForSpan(initialDisplaySpan.spanContext().spanId).catch(error => {\n debug.log(\n `[TimeToDisplay] Failed to capture start frames for initial display span (${initialDisplaySpan.spanContext().spanId}).`,\n error,\n );\n });\n\n if (options?.isAutoInstrumented) {\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n manualInitialDisplaySpans.set(activeSpan, true);\n initialDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return initialDisplaySpan;\n}\n\n/**\n * Starts a new span for the full display.\n *\n * Returns current span if already exists in the currently active span.\n *\n * @deprecated Use `<TimeToFullDisplay record={boolean}/>` component instead.\n */\nexport function startTimeToFullDisplaySpan(\n options: Omit<StartSpanOptions, 'op' | 'name'> & {\n name?: string;\n timeoutMs?: number;\n isAutoInstrumented?: boolean;\n } = {\n timeoutMs: 30_000,\n },\n): Span | undefined {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.full_display to.');\n return undefined;\n }\n\n const descendantSpans = getSpanDescendants(activeSpan);\n\n const initialDisplaySpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.initial_display');\n if (!initialDisplaySpan) {\n debug.warn('[TimeToDisplay] No initial display span found to attach ui.load.full_display to.');\n return undefined;\n }\n\n const existingSpan = descendantSpans.find(span => spanToJSON(span).op === 'ui.load.full_display');\n if (existingSpan) {\n debug.log('[TimeToDisplay] Found existing ui.load.full_display span.');\n return existingSpan;\n }\n\n const fullDisplaySpan = startInactiveSpan({\n op: 'ui.load.full_display',\n name: 'Time To Full Display',\n startTime: spanToJSON(initialDisplaySpan).start_timestamp,\n ...options,\n });\n if (!fullDisplaySpan) {\n return undefined;\n }\n\n captureStartFramesForSpan(fullDisplaySpan.spanContext().spanId).catch(error => {\n debug.log(\n `[TimeToDisplay] Failed to capture start frames for full display span (${fullDisplaySpan.spanContext().spanId}).`,\n error,\n );\n });\n\n const timeout = setTimeout(() => {\n if (spanToJSON(fullDisplaySpan).timestamp) {\n return;\n }\n fullDisplaySpan.setStatus({ code: SPAN_STATUS_ERROR, message: 'deadline_exceeded' });\n\n const fullDisplayEndTimestamp = spanToJSON(initialDisplaySpan).timestamp;\n captureEndFramesAndAttachToSpan(fullDisplaySpan, fullDisplayEndTimestamp)\n .then(() => {\n debug.log(`[TimeToDisplay] span ${fullDisplaySpan.spanContext().spanId} updated with frame data.`);\n fullDisplaySpan.end(fullDisplayEndTimestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n })\n .catch(() => {\n debug.warn(\n `[TimeToDisplay] Failed to capture end frames for full display span (${fullDisplaySpan.spanContext().spanId}).`,\n );\n fullDisplaySpan.end(spanToJSON(initialDisplaySpan).timestamp);\n setSpanDurationAsMeasurement('time_to_full_display', fullDisplaySpan);\n });\n\n debug.warn('[TimeToDisplay] Full display span deadline_exceeded.');\n }, options.timeoutMs);\n\n fill(fullDisplaySpan, 'end', (originalEnd: Span['end']) => (endTimestamp?: Parameters<Span['end']>[0]) => {\n clearTimeout(timeout);\n originalEnd.call(fullDisplaySpan, endTimestamp);\n });\n\n if (options?.isAutoInstrumented) {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY);\n } else {\n fullDisplaySpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY);\n }\n\n return fullDisplaySpan;\n}\n\n/**\n *\n */\nexport function updateInitialDisplaySpan(\n frameTimestampSeconds: number,\n {\n activeSpan = getActiveSpan(),\n span = startTimeToInitialDisplaySpan(),\n }: {\n activeSpan?: Span;\n /**\n * Time to initial display span to update.\n */\n span?: Span;\n } = {},\n): void {\n if (!span) {\n debug.warn('[TimeToDisplay] No span found or created, possibly performance is disabled.');\n return;\n }\n\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to attach ui.load.initial_display to.');\n return;\n }\n\n if (spanToJSON(span).parent_span_id !== spanToJSON(activeSpan).span_id) {\n debug.warn('[TimeToDisplay] Initial display span is not a child of current active span.');\n return;\n }\n\n if (spanToJSON(span).timestamp) {\n debug.warn(`[TimeToDisplay] ${spanToJSON(span).description} span already ended.`);\n return;\n }\n\n captureEndFramesAndAttachToSpan(span, frameTimestampSeconds)\n .then(() => {\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n debug.log(`[TimeToDisplay] ${spanToJSON(span).description} span updated with end timestamp and frame data.`);\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);\n })\n .catch(error => {\n debug.log('[TimeToDisplay] Failed to capture frame data for initial display span.', error);\n span.end(frameTimestampSeconds);\n span.setStatus({ code: SPAN_STATUS_OK });\n\n if (fullDisplayBeforeInitialDisplay.has(activeSpan)) {\n fullDisplayBeforeInitialDisplay.delete(activeSpan);\n debug.log(`[TimeToDisplay] Updating full display with initial display (${span.spanContext().spanId}) end.`);\n updateFullDisplaySpan(frameTimestampSeconds, span);\n }\n\n setSpanDurationAsMeasurementOnSpan('time_to_initial_display', span, activeSpan);\n });\n}\n\nfunction updateFullDisplaySpan(frameTimestampSeconds: number, passedInitialDisplaySpan?: Span): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n debug.warn('[TimeToDisplay] No active span found to update ui.load.full_display in.');\n return;\n }\n\n const existingInitialDisplaySpan =\n passedInitialDisplaySpan ||\n getSpanDescendants(activeSpan).find(span => spanToJSON(span).op === 'ui.load.initial_display');\n const initialDisplayEndTimestamp = existingInitialDisplaySpan && spanToJSON(existingInitialDisplaySpan).timestamp;\n if (!initialDisplayEndTimestamp) {\n fullDisplayBeforeInitialDisplay.set(activeSpan, true);\n debug.warn(\n `[TimeToDisplay] Full display called before initial display for active span (${activeSpan.spanContext().spanId}).`,\n );\n return;\n }\n\n const span = startTimeToFullDisplaySpan({\n isAutoInstrumented: true,\n });\n if (!span) {\n debug.warn('[TimeToDisplay] No TimeToFullDisplay span found or created, possibly performance is disabled.');\n return;\n }\n\n const spanJSON = spanToJSON(span);\n if (spanJSON.timestamp) {\n debug.warn(`[TimeToDisplay] ${spanJSON.description} (${spanJSON.span_id}) span already ended.`);\n return;\n }\n\n const endTimestamp =\n initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;\n captureEndFramesAndAttachToSpan(span, endTimestamp)\n .then(() => {\n if (initialDisplayEndTimestamp > frameTimestampSeconds) {\n debug.warn(\n '[TimeToDisplay] Using initial display end. Full display end frame timestamp is before initial display end.',\n );\n }\n\n span.end(endTimestamp);\n span.setStatus({ code: SPAN_STATUS_OK });\n debug.log(\n `[TimeToDisplay] span ${spanJSON.description} (${spanJSON.span_id}) updated with end timestamp and frame data.`,\n );\n\n setSpanDurationAsMeasurement('time_to_full_display', span);\n })\n .catch(error => {\n debug.log('[TimeToDisplay] Failed to capture frame data for full display span.', error);\n const endTimestamp =\n initialDisplayEndTimestamp > frameTimestampSeconds ? initialDisplayEndTimestamp : frameTimestampSeconds;\n\n span.end(endTimestamp);\n span.setStatus({ code: SPAN_STATUS_OK });\n setSpanDurationAsMeasurement('time_to_full_display', span);\n });\n}\n\n/**\n * Creates a new TimeToFullDisplay component which triggers the full display recording every time the component is focused.\n */\nexport function createTimeToFullDisplay({\n useFocusEffect,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void;\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToFullDisplay });\n}\n\n/**\n * Creates a new TimeToInitialDisplay component which triggers the initial display recording every time the component is focused.\n */\nexport function createTimeToInitialDisplay({\n useFocusEffect,\n}: {\n useFocusEffect: (callback: () => void) => void;\n}): React.ComponentType<TimeToDisplayProps> {\n return createTimeToDisplay({ useFocusEffect, Component: TimeToInitialDisplay });\n}\n\nfunction createTimeToDisplay({\n useFocusEffect,\n Component,\n}: {\n /**\n * `@react-navigation/native` useFocusEffect hook.\n */\n useFocusEffect: (callback: () => void) => void;\n Component: typeof TimeToFullDisplay | typeof TimeToInitialDisplay;\n}): React.ComponentType<TimeToDisplayProps> {\n const TimeToDisplayWrapper = (props: TimeToDisplayProps): React.ReactElement => {\n const [focused, setFocused] = useState(false);\n\n useFocusEffect(() => {\n setFocused(true);\n return () => {\n setFocused(false);\n };\n });\n\n return <Component {...props} record={focused && props.record} />;\n };\n\n TimeToDisplayWrapper.displayName = 'TimeToDisplayWrapper';\n return TimeToDisplayWrapper;\n}\n\n/**\n * Attaches frame data to a span's data object.\n */\nfunction attachFrameDataToSpan(span: Span, startFrames: NativeFramesResponse, endFrames: NativeFramesResponse): void {\n const totalFrames = endFrames.totalFrames - startFrames.totalFrames;\n const slowFrames = endFrames.slowFrames - startFrames.slowFrames;\n const frozenFrames = endFrames.frozenFrames - startFrames.frozenFrames;\n\n if (totalFrames <= 0 && slowFrames <= 0 && frozenFrames <= 0) {\n debug.warn(\n `[TimeToDisplay] Detected zero slow or frozen frames. Not adding measurements to span (${span.spanContext().spanId}).`,\n );\n return;\n }\n span.setAttribute('frames.total', totalFrames);\n span.setAttribute('frames.slow', slowFrames);\n span.setAttribute('frames.frozen', frozenFrames);\n\n debug.log('[TimeToDisplay] Attached frame data to span.', {\n spanId: span.spanContext().spanId,\n frameData: {\n total: totalFrames,\n slow: slowFrames,\n frozen: frozenFrames,\n },\n });\n}\n\n/**\n * Captures start frames for a time-to-display span\n */\nasync function captureStartFramesForSpan(spanId: string): Promise<void> {\n if (!NATIVE.enableNative) {\n return;\n }\n\n try {\n const startFrames = await fetchNativeFramesWithTimeout();\n\n // Set up automatic cleanup as a safety mechanism for spans that never complete\n const cleanupTimeout = setTimeout(() => {\n const entry = spanFrameDataMap.get(spanId);\n if (entry) {\n spanFrameDataMap.delete(spanId);\n debug.log(`[TimeToDisplay] Cleaned up stale frame data for span ${spanId} after timeout.`);\n }\n }, FRAME_DATA_CLEANUP_TIMEOUT_MS);\n\n if (!spanFrameDataMap.has(spanId)) {\n spanFrameDataMap.set(spanId, { startFrames: null, endFrames: null, cleanupTimeout });\n }\n\n // Re-check after async operations - entry might have been deleted by captureEndFramesAndAttachToSpan\n const frameData = spanFrameDataMap.get(spanId);\n if (!frameData) {\n // Span already ended and cleaned up, cancel the cleanup timeout\n clearTimeout(cleanupTimeout);\n debug.log(`[TimeToDisplay] Span ${spanId} already ended, discarding start frames.`);\n return;\n }\n\n frameData.startFrames = startFrames;\n frameData.cleanupTimeout = cleanupTimeout;\n debug.log(`[TimeToDisplay] Captured start frames for span ${spanId}.`, startFrames);\n } catch (error) {\n debug.log(`[TimeToDisplay] Failed to capture start frames for span ${spanId}.`, error);\n }\n}\n\n/**\n * Captures end frames and attaches frame data to span\n */\nasync function captureEndFramesAndAttachToSpan(span: Span, spanEndTimestampSeconds?: number): Promise<void> {\n if (!NATIVE.enableNative) {\n return;\n }\n\n const spanId = span.spanContext().spanId;\n const frameData = spanFrameDataMap.get(spanId);\n\n if (!frameData?.startFrames) {\n debug.log(`[TimeToDisplay] No start frames found for span ${spanId}, skipping frame data collection.`);\n return;\n }\n\n try {\n const endFrames = await fetchNativeFramesWithTimeout();\n frameData.endFrames = endFrames;\n\n attachFrameDataToSpan(span, frameData.startFrames, endFrames);\n\n const spanStartTimestamp = spanToJSON(span).start_timestamp;\n if (spanStartTimestamp) {\n try {\n const endTimestamp = spanEndTimestampSeconds || spanToJSON(span).timestamp || Date.now() / 1000;\n const framesDelay = await Promise.race([\n NATIVE.fetchNativeFramesDelay(spanStartTimestamp, endTimestamp),\n new Promise<null>(resolve => setTimeout(() => resolve(null), FETCH_FRAMES_TIMEOUT_MS)),\n ]);\n if (framesDelay != null) {\n span.setAttribute('frames.delay', framesDelay);\n }\n } catch (delayError) {\n debug.log(`[TimeToDisplay] Failed to fetch frames delay for span ${spanId}.`, delayError);\n }\n }\n\n debug.log(`[TimeToDisplay] Captured and attached end frames for span ${spanId}.`, endFrames);\n } catch (error) {\n debug.log(`[TimeToDisplay] Failed to capture end frames for span ${spanId}.`, error);\n } finally {\n // Clear the cleanup timeout since we're cleaning up now\n if (frameData.cleanupTimeout) {\n clearTimeout(frameData.cleanupTimeout);\n }\n spanFrameDataMap.delete(spanId);\n }\n}\n\n/**\n * Fetches native frames with a timeout\n */\nfunction fetchNativeFramesWithTimeout(): Promise<NativeFramesResponse> {\n return new Promise<NativeFramesResponse>((resolve, reject) => {\n let settled = false;\n\n const timeoutId = setTimeout(() => {\n if (!settled) {\n settled = true;\n reject('Fetching native frames took too long. Dropping frames.');\n }\n }, FETCH_FRAMES_TIMEOUT_MS);\n\n NATIVE.fetchNativeFrames()\n .then(value => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n\n if (!value) {\n reject('Native frames response is null.');\n return;\n }\n resolve(value);\n })\n .then(undefined, (error: unknown) => {\n if (settled) {\n return;\n }\n clearTimeout(timeoutId);\n settled = true;\n reject(error);\n });\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
- import * as React from 'react';
2
1
  import type { HostComponent } from 'react-native';
2
+ import * as React from 'react';
3
3
  import type { RNSentryOnDrawReporterProps } from './timetodisplaynative.types';
4
4
  export declare const nativeComponentExists: boolean;
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAKjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,OAAO,sBAOnD,CAAA"}
1
+ {"version":3,"file":"timetodisplaynative.d.ts","sourceRoot":"","sources":["../../../src/js/tracing/timetodisplaynative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAO/E,eAAO,MAAM,qBAAqB,SAEzB,CAAC;AAEV;;GAEG;AACH,cAAM,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,CAAC;IAC5E,MAAM,IAAI,KAAK,CAAC,SAAS;CAGjC;AAED,QAAA,IAAI,sBAAsB,EAAE,aAAa,CAAC,2BAA2B,CAAC,GAAG,OAAO,0BAA0B,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,OAAO,sBAQnD,CAAC"}