@safaricom-mxl/web-sdk 0.1.2 → 0.1.4

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 (664) hide show
  1. package/README.md +18 -14
  2. package/UPGRADING.md +47 -0
  3. package/dist/api-logs/manager/types.d.cts +6 -1
  4. package/dist/api-logs/manager/types.d.cts.map +1 -1
  5. package/dist/api-logs/manager/types.d.ts +6 -1
  6. package/dist/api-logs/manager/types.d.ts.map +1 -1
  7. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.cjs +12 -1
  8. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.cjs.map +1 -1
  9. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.d.cts +2 -0
  10. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.d.cts.map +1 -1
  11. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.d.ts +2 -0
  12. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.d.ts.map +1 -1
  13. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.js +12 -1
  14. package/dist/api-page/manager/ProxyPageManager/ProxyPageManager.js.map +1 -1
  15. package/dist/api-page/manager/types.d.cts +2 -1
  16. package/dist/api-page/manager/types.d.cts.map +1 -1
  17. package/dist/api-page/manager/types.d.ts +2 -1
  18. package/dist/api-page/manager/types.d.ts.map +1 -1
  19. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.cjs +6 -1
  20. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.cjs.map +1 -1
  21. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.d.cts +4 -2
  22. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.d.cts.map +1 -1
  23. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.d.ts +4 -2
  24. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.d.ts.map +1 -1
  25. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.js +6 -1
  26. package/dist/api-sessions/manager/NoOpUserSessionManager/NoOpUserSessionManager.js.map +1 -1
  27. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.cjs +8 -2
  28. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.cjs.map +1 -1
  29. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.d.cts +4 -2
  30. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.d.cts.map +1 -1
  31. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.d.ts +4 -2
  32. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.d.ts.map +1 -1
  33. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.js +8 -2
  34. package/dist/api-sessions/manager/ProxyUserSessionManager/ProxyUserSessionManager.js.map +1 -1
  35. package/dist/constants/attributes.cjs +12 -0
  36. package/dist/constants/attributes.cjs.map +1 -1
  37. package/dist/constants/attributes.d.cts +7 -1
  38. package/dist/constants/attributes.d.cts.map +1 -1
  39. package/dist/constants/attributes.d.ts +7 -1
  40. package/dist/constants/attributes.d.ts.map +1 -1
  41. package/dist/constants/attributes.js +7 -1
  42. package/dist/constants/attributes.js.map +1 -1
  43. package/dist/exporters/BaseFetchExporter/BaseFetchExporter.d.ts +1 -1
  44. package/dist/index.cjs +2 -0
  45. package/dist/index.d.cts +3 -2
  46. package/dist/index.d.ts +3 -2
  47. package/dist/index.js +2 -1
  48. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.cjs +1 -2
  49. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.cjs.map +1 -1
  50. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.d.cts +3 -4
  51. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.d.cts.map +1 -1
  52. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.d.ts +1 -2
  53. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.d.ts.map +1 -1
  54. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.js +1 -2
  55. package/dist/instrumentations/InstrumentationAbstract/InstrumentationAbstract.js.map +1 -1
  56. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.cjs +12 -2
  57. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.cjs.map +1 -1
  58. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.d.cts +5 -2
  59. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.d.cts.map +1 -1
  60. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.d.ts +5 -2
  61. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.d.ts.map +1 -1
  62. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.js +12 -2
  63. package/dist/instrumentations/MXLInstrumentationBase/MXLInstrumentationBase.js.map +1 -1
  64. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.cjs +1 -2
  65. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.cjs.map +1 -1
  66. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.d.cts.map +1 -1
  67. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.d.ts.map +1 -1
  68. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.js +1 -2
  69. package/dist/instrumentations/clicks/ClicksInstrumentation/ClicksInstrumentation.js.map +1 -1
  70. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs +29 -33
  71. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.cjs.map +1 -1
  72. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.cts +4 -2
  73. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.cts.map +1 -1
  74. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.ts +4 -2
  75. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.d.ts.map +1 -1
  76. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js +29 -33
  77. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/DocumentLoadInstrumentation.js.map +1 -1
  78. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs +14 -12
  79. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.cjs.map +1 -1
  80. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts +3 -2
  81. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.cts.map +1 -1
  82. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts +3 -2
  83. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.d.ts.map +1 -1
  84. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js +14 -12
  85. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/networkEvents.js.map +1 -1
  86. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/types.d.cts +1 -2
  87. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/types.d.cts.map +1 -1
  88. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/types.d.ts +1 -2
  89. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/types.d.ts.map +1 -1
  90. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs +1 -1
  91. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.cjs.map +1 -1
  92. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js +1 -1
  93. package/dist/instrumentations/document-load/DocumentLoadInstrumentation/utils.js.map +1 -1
  94. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.cjs +3 -5
  95. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.cjs.map +1 -1
  96. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.d.cts.map +1 -1
  97. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.d.ts.map +1 -1
  98. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.js +3 -5
  99. package/dist/instrumentations/element-timing/ElementTimingInstrumentation/ElementTimingInstrumentation.js.map +1 -1
  100. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.cjs +7 -3
  101. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.cjs.map +1 -1
  102. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.d.cts +1 -0
  103. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.d.cts.map +1 -1
  104. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.d.ts +1 -0
  105. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.d.ts.map +1 -1
  106. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.js +7 -3
  107. package/dist/instrumentations/empty-root/EmptyRootInstrumentation/EmptyRootInstrumentation.js.map +1 -1
  108. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.cjs +2 -3
  109. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.cjs.map +1 -1
  110. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.d.cts.map +1 -1
  111. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.d.ts.map +1 -1
  112. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.js +2 -3
  113. package/dist/instrumentations/exceptions/GlobalExceptionInstrumentation/GlobalExceptionInstrumentation.js.map +1 -1
  114. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.cjs +4 -5
  115. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.cjs.map +1 -1
  116. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.d.cts.map +1 -1
  117. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.d.ts.map +1 -1
  118. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.js +3 -4
  119. package/dist/instrumentations/first-interaction/FirstInteractionInstrumentation/FirstInteractionInstrumentation.js.map +1 -1
  120. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.cjs +172 -0
  121. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.cjs.map +1 -0
  122. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.d.cts +38 -0
  123. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.d.cts.map +1 -0
  124. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.d.ts +38 -0
  125. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.d.ts.map +1 -0
  126. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.js +170 -0
  127. package/dist/instrumentations/js-profiler/JsProfilerInstrumentation.js.map +1 -0
  128. package/dist/instrumentations/js-profiler/constants.cjs +21 -0
  129. package/dist/instrumentations/js-profiler/constants.cjs.map +1 -0
  130. package/dist/instrumentations/js-profiler/constants.d.cts +13 -0
  131. package/dist/instrumentations/js-profiler/constants.d.cts.map +1 -0
  132. package/dist/instrumentations/js-profiler/constants.d.ts +13 -0
  133. package/dist/instrumentations/js-profiler/constants.d.ts.map +1 -0
  134. package/dist/instrumentations/js-profiler/constants.js +13 -0
  135. package/dist/instrumentations/js-profiler/constants.js.map +1 -0
  136. package/dist/instrumentations/js-profiler/fixture.cjs +54 -0
  137. package/dist/instrumentations/js-profiler/fixture.cjs.map +1 -0
  138. package/dist/instrumentations/js-profiler/fixture.d.cts +7 -0
  139. package/dist/instrumentations/js-profiler/fixture.d.cts.map +1 -0
  140. package/dist/instrumentations/js-profiler/fixture.d.ts +7 -0
  141. package/dist/instrumentations/js-profiler/fixture.d.ts.map +1 -0
  142. package/dist/instrumentations/js-profiler/fixture.js +53 -0
  143. package/dist/instrumentations/js-profiler/fixture.js.map +1 -0
  144. package/dist/instrumentations/js-profiler/reduceProfilerTrace.cjs +63 -0
  145. package/dist/instrumentations/js-profiler/reduceProfilerTrace.cjs.map +1 -0
  146. package/dist/instrumentations/js-profiler/reduceProfilerTrace.d.cts +7 -0
  147. package/dist/instrumentations/js-profiler/reduceProfilerTrace.d.cts.map +1 -0
  148. package/dist/instrumentations/js-profiler/reduceProfilerTrace.d.ts +7 -0
  149. package/dist/instrumentations/js-profiler/reduceProfilerTrace.d.ts.map +1 -0
  150. package/dist/instrumentations/js-profiler/reduceProfilerTrace.js +62 -0
  151. package/dist/instrumentations/js-profiler/reduceProfilerTrace.js.map +1 -0
  152. package/dist/instrumentations/js-profiler/types.cjs +0 -0
  153. package/dist/instrumentations/js-profiler/types.d.cts +51 -0
  154. package/dist/instrumentations/js-profiler/types.d.cts.map +1 -0
  155. package/dist/instrumentations/js-profiler/types.d.ts +51 -0
  156. package/dist/instrumentations/js-profiler/types.d.ts.map +1 -0
  157. package/dist/instrumentations/js-profiler/types.js +0 -0
  158. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.cjs +3 -5
  159. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.cjs.map +1 -1
  160. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.d.cts.map +1 -1
  161. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.d.ts.map +1 -1
  162. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.js +1 -3
  163. package/dist/instrumentations/loaf/LoafInstrumentation/LoafInstrumentation.js.map +1 -1
  164. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.cjs +2 -3
  165. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.cjs.map +1 -1
  166. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.d.cts.map +1 -1
  167. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.d.ts.map +1 -1
  168. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.js +1 -2
  169. package/dist/instrumentations/max-scroll-depth/MaxScrollDepthInstrumentation/MaxScrollDepthInstrumentation.js.map +1 -1
  170. package/dist/instrumentations/memory/MemoryInstrumentation.cjs +216 -0
  171. package/dist/instrumentations/memory/MemoryInstrumentation.cjs.map +1 -0
  172. package/dist/instrumentations/memory/MemoryInstrumentation.d.cts +55 -0
  173. package/dist/instrumentations/memory/MemoryInstrumentation.d.cts.map +1 -0
  174. package/dist/instrumentations/memory/MemoryInstrumentation.d.ts +55 -0
  175. package/dist/instrumentations/memory/MemoryInstrumentation.d.ts.map +1 -0
  176. package/dist/instrumentations/memory/MemoryInstrumentation.js +215 -0
  177. package/dist/instrumentations/memory/MemoryInstrumentation.js.map +1 -0
  178. package/dist/instrumentations/memory/browserFamily.cjs +13 -0
  179. package/dist/instrumentations/memory/browserFamily.cjs.map +1 -0
  180. package/dist/instrumentations/memory/browserFamily.d.cts +5 -0
  181. package/dist/instrumentations/memory/browserFamily.d.cts.map +1 -0
  182. package/dist/instrumentations/memory/browserFamily.d.ts +5 -0
  183. package/dist/instrumentations/memory/browserFamily.d.ts.map +1 -0
  184. package/dist/instrumentations/memory/browserFamily.js +12 -0
  185. package/dist/instrumentations/memory/browserFamily.js.map +1 -0
  186. package/dist/instrumentations/memory/constants.cjs +25 -0
  187. package/dist/instrumentations/memory/constants.cjs.map +1 -0
  188. package/dist/instrumentations/memory/constants.d.cts +13 -0
  189. package/dist/instrumentations/memory/constants.d.cts.map +1 -0
  190. package/dist/instrumentations/memory/constants.d.ts +13 -0
  191. package/dist/instrumentations/memory/constants.d.ts.map +1 -0
  192. package/dist/instrumentations/memory/constants.js +22 -0
  193. package/dist/instrumentations/memory/constants.js.map +1 -0
  194. package/dist/instrumentations/memory/resource.cjs +30 -0
  195. package/dist/instrumentations/memory/resource.cjs.map +1 -0
  196. package/dist/instrumentations/memory/resource.d.cts +16 -0
  197. package/dist/instrumentations/memory/resource.d.cts.map +1 -0
  198. package/dist/instrumentations/memory/resource.d.ts +16 -0
  199. package/dist/instrumentations/memory/resource.d.ts.map +1 -0
  200. package/dist/instrumentations/memory/resource.js +27 -0
  201. package/dist/instrumentations/memory/resource.js.map +1 -0
  202. package/dist/instrumentations/memory/startMemoryMeterProvider.cjs +27 -0
  203. package/dist/instrumentations/memory/startMemoryMeterProvider.cjs.map +1 -0
  204. package/dist/instrumentations/memory/startMemoryMeterProvider.d.cts +7 -0
  205. package/dist/instrumentations/memory/startMemoryMeterProvider.d.cts.map +1 -0
  206. package/dist/instrumentations/memory/startMemoryMeterProvider.d.ts +7 -0
  207. package/dist/instrumentations/memory/startMemoryMeterProvider.d.ts.map +1 -0
  208. package/dist/instrumentations/memory/startMemoryMeterProvider.js +25 -0
  209. package/dist/instrumentations/memory/startMemoryMeterProvider.js.map +1 -0
  210. package/dist/instrumentations/memory/types.cjs +0 -0
  211. package/dist/instrumentations/memory/types.d.cts +47 -0
  212. package/dist/instrumentations/memory/types.d.cts.map +1 -0
  213. package/dist/instrumentations/memory/types.d.ts +47 -0
  214. package/dist/instrumentations/memory/types.d.ts.map +1 -0
  215. package/dist/instrumentations/memory/types.js +0 -0
  216. package/dist/instrumentations/memory/visibility.cjs +25 -0
  217. package/dist/instrumentations/memory/visibility.cjs.map +1 -0
  218. package/dist/instrumentations/memory/visibility.d.cts +14 -0
  219. package/dist/instrumentations/memory/visibility.d.cts.map +1 -0
  220. package/dist/instrumentations/memory/visibility.d.ts +14 -0
  221. package/dist/instrumentations/memory/visibility.d.ts.map +1 -0
  222. package/dist/instrumentations/memory/visibility.js +24 -0
  223. package/dist/instrumentations/memory/visibility.js.map +1 -0
  224. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.cjs +62 -55
  225. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.cjs.map +1 -1
  226. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.d.cts +16 -5
  227. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.d.cts.map +1 -1
  228. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.d.ts +16 -5
  229. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.d.ts.map +1 -1
  230. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.js +62 -55
  231. package/dist/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.js.map +1 -1
  232. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.cjs +3 -3
  233. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.cjs.map +1 -1
  234. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.d.cts.map +1 -1
  235. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.d.ts.map +1 -1
  236. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.js +3 -3
  237. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.js.map +1 -1
  238. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.cjs +10 -13
  239. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.cjs.map +1 -1
  240. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.d.cts.map +1 -1
  241. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.d.ts.map +1 -1
  242. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.js +10 -13
  243. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.js.map +1 -1
  244. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.cjs +8 -4
  245. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.cjs.map +1 -1
  246. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.d.cts.map +1 -1
  247. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.d.ts.map +1 -1
  248. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.js +8 -4
  249. package/dist/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.js.map +1 -1
  250. package/dist/instrumentations/navigation/NavigationInstrumentation/types.d.cts +2 -0
  251. package/dist/instrumentations/navigation/NavigationInstrumentation/types.d.cts.map +1 -1
  252. package/dist/instrumentations/navigation/NavigationInstrumentation/types.d.ts +2 -0
  253. package/dist/instrumentations/navigation/NavigationInstrumentation/types.d.ts.map +1 -1
  254. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.cjs +14 -13
  255. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.cjs.map +1 -1
  256. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.d.cts +1 -0
  257. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.d.cts.map +1 -1
  258. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.d.ts +1 -0
  259. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.d.ts.map +1 -1
  260. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.js +13 -12
  261. package/dist/instrumentations/rage-click/RageClickInstrumentation/RageClickInstrumentation.js.map +1 -1
  262. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.cjs +0 -2
  263. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.cjs.map +1 -1
  264. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.d.cts.map +1 -1
  265. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.d.ts.map +1 -1
  266. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.js +0 -2
  267. package/dist/instrumentations/replay/ReplayInstrumentation/ReplayInstrumentation.js.map +1 -1
  268. package/dist/instrumentations/replay/ReplayInstrumentation/types.d.cts +1 -1
  269. package/dist/instrumentations/replay/ReplayInstrumentation/types.d.ts +1 -1
  270. package/dist/instrumentations/replay/events/startEventCapture.cjs +2 -1
  271. package/dist/instrumentations/replay/events/startEventCapture.cjs.map +1 -1
  272. package/dist/instrumentations/replay/events/startEventCapture.d.cts +2 -0
  273. package/dist/instrumentations/replay/events/startEventCapture.d.cts.map +1 -1
  274. package/dist/instrumentations/replay/events/startEventCapture.d.ts +2 -0
  275. package/dist/instrumentations/replay/events/startEventCapture.d.ts.map +1 -1
  276. package/dist/instrumentations/replay/events/startEventCapture.js +2 -1
  277. package/dist/instrumentations/replay/events/startEventCapture.js.map +1 -1
  278. package/dist/instrumentations/replay/recorder/startRecording.cjs +2 -4
  279. package/dist/instrumentations/replay/recorder/startRecording.cjs.map +1 -1
  280. package/dist/instrumentations/replay/recorder/startRecording.d.cts +2 -0
  281. package/dist/instrumentations/replay/recorder/startRecording.d.cts.map +1 -1
  282. package/dist/instrumentations/replay/recorder/startRecording.d.ts +2 -0
  283. package/dist/instrumentations/replay/recorder/startRecording.d.ts.map +1 -1
  284. package/dist/instrumentations/replay/recorder/startRecording.js +2 -4
  285. package/dist/instrumentations/replay/recorder/startRecording.js.map +1 -1
  286. package/dist/instrumentations/replay/recorder/types.d.cts +0 -1
  287. package/dist/instrumentations/replay/recorder/types.d.cts.map +1 -1
  288. package/dist/instrumentations/replay/recorder/types.d.ts +0 -1
  289. package/dist/instrumentations/replay/recorder/types.d.ts.map +1 -1
  290. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.cjs +2 -2
  291. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.cjs.map +1 -1
  292. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.d.cts.map +1 -1
  293. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.d.ts.map +1 -1
  294. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.js +2 -2
  295. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.esm.js.map +1 -1
  296. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.iife.cjs +1 -1
  297. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.iife.cjs.map +1 -1
  298. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.iife.js +1 -1
  299. package/dist/instrumentations/replay/rrwebLoader/loadRrwebModule.iife.js.map +1 -1
  300. package/dist/instrumentations/replay/rrwebLoader/types.d.cts +4 -2
  301. package/dist/instrumentations/replay/rrwebLoader/types.d.cts.map +1 -1
  302. package/dist/instrumentations/replay/rrwebLoader/types.d.ts +4 -2
  303. package/dist/instrumentations/replay/rrwebLoader/types.d.ts.map +1 -1
  304. package/dist/instrumentations/replay/session-recording/SessionRecording.cjs +16 -1
  305. package/dist/instrumentations/replay/session-recording/SessionRecording.cjs.map +1 -1
  306. package/dist/instrumentations/replay/session-recording/SessionRecording.d.cts +2 -0
  307. package/dist/instrumentations/replay/session-recording/SessionRecording.d.cts.map +1 -1
  308. package/dist/instrumentations/replay/session-recording/SessionRecording.d.ts +2 -0
  309. package/dist/instrumentations/replay/session-recording/SessionRecording.d.ts.map +1 -1
  310. package/dist/instrumentations/replay/session-recording/SessionRecording.js +16 -1
  311. package/dist/instrumentations/replay/session-recording/SessionRecording.js.map +1 -1
  312. package/dist/instrumentations/replay/session-recording/lifecycle.cjs +6 -4
  313. package/dist/instrumentations/replay/session-recording/lifecycle.cjs.map +1 -1
  314. package/dist/instrumentations/replay/session-recording/lifecycle.d.cts +4 -3
  315. package/dist/instrumentations/replay/session-recording/lifecycle.d.cts.map +1 -1
  316. package/dist/instrumentations/replay/session-recording/lifecycle.d.ts +4 -3
  317. package/dist/instrumentations/replay/session-recording/lifecycle.d.ts.map +1 -1
  318. package/dist/instrumentations/replay/session-recording/lifecycle.js +6 -4
  319. package/dist/instrumentations/replay/session-recording/lifecycle.js.map +1 -1
  320. package/dist/instrumentations/replay/transport/idleFlushTimer.cjs.map +1 -1
  321. package/dist/instrumentations/replay/transport/idleFlushTimer.d.cts.map +1 -1
  322. package/dist/instrumentations/replay/transport/idleFlushTimer.d.ts.map +1 -1
  323. package/dist/instrumentations/replay/transport/idleFlushTimer.js.map +1 -1
  324. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.cjs +4 -18
  325. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.cjs.map +1 -1
  326. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.d.cts +0 -2
  327. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.d.cts.map +1 -1
  328. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.d.ts +0 -2
  329. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.d.ts.map +1 -1
  330. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.js +3 -17
  331. package/dist/instrumentations/server-timing/ServerTimingInstrumentation/ServerTimingInstrumentation.js.map +1 -1
  332. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.cjs +8 -11
  333. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.cjs.map +1 -1
  334. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.d.cts.map +1 -1
  335. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.d.ts.map +1 -1
  336. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.js +8 -11
  337. package/dist/instrumentations/soft-navigation-performance/SoftNavigationPerformanceInstrumentation/SoftNavigationPerformanceInstrumentation.js.map +1 -1
  338. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.cjs +7 -10
  339. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.cjs.map +1 -1
  340. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.d.cts.map +1 -1
  341. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.d.ts.map +1 -1
  342. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.js +6 -9
  343. package/dist/instrumentations/user-timing/UserTimingInstrumentation/UserTimingInstrumentation.js.map +1 -1
  344. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.cjs +24 -16
  345. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.cjs.map +1 -1
  346. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.cts +3 -2
  347. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.cts.map +1 -1
  348. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.ts +3 -2
  349. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.d.ts.map +1 -1
  350. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.js +24 -16
  351. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/WebVitalsInstrumentation.js.map +1 -1
  352. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.cjs +11 -63
  353. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.cjs.map +1 -1
  354. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.d.cts +4 -56
  355. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.d.cts.map +1 -1
  356. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.d.ts +4 -56
  357. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.d.ts.map +1 -1
  358. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.js +11 -62
  359. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/constants.js.map +1 -1
  360. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/types.d.cts +1 -2
  361. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/types.d.cts.map +1 -1
  362. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/types.d.ts +1 -2
  363. package/dist/instrumentations/web-vitals/WebVitalsInstrumentation/types.d.ts.map +1 -1
  364. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.cjs +5 -5
  365. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.cjs.map +1 -1
  366. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.d.cts.map +1 -1
  367. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.d.ts.map +1 -1
  368. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.js +4 -4
  369. package/dist/managers/MXLAnalyticsManager/MXLAnalyticsManager.js.map +1 -1
  370. package/dist/managers/MXLAnalyticsManager/types.d.cts +1 -2
  371. package/dist/managers/MXLAnalyticsManager/types.d.cts.map +1 -1
  372. package/dist/managers/MXLAnalyticsManager/types.d.ts +1 -2
  373. package/dist/managers/MXLAnalyticsManager/types.d.ts.map +1 -1
  374. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.cjs +14 -0
  375. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.cjs.map +1 -1
  376. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.cts +4 -1
  377. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.cts.map +1 -1
  378. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.ts +4 -1
  379. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.d.ts.map +1 -1
  380. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.js +14 -0
  381. package/dist/managers/MXLConfigManager/MXLDynamicConfigManager.js.map +1 -1
  382. package/dist/managers/MXLConfigManager/performanceDefaults.cjs +21 -0
  383. package/dist/managers/MXLConfigManager/performanceDefaults.cjs.map +1 -0
  384. package/dist/managers/MXLConfigManager/performanceDefaults.d.cts +12 -0
  385. package/dist/managers/MXLConfigManager/performanceDefaults.d.cts.map +1 -0
  386. package/dist/managers/MXLConfigManager/performanceDefaults.d.ts +12 -0
  387. package/dist/managers/MXLConfigManager/performanceDefaults.d.ts.map +1 -0
  388. package/dist/managers/MXLConfigManager/performanceDefaults.js +13 -0
  389. package/dist/managers/MXLConfigManager/performanceDefaults.js.map +1 -0
  390. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.cjs +29 -0
  391. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.cjs.map +1 -0
  392. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.d.cts +40 -0
  393. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.d.cts.map +1 -0
  394. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.d.ts +40 -0
  395. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.d.ts.map +1 -0
  396. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.js +27 -0
  397. package/dist/managers/MXLConfigManager/resolveEffectivePerformance.js.map +1 -0
  398. package/dist/managers/MXLConfigManager/types.d.cts +18 -1
  399. package/dist/managers/MXLConfigManager/types.d.cts.map +1 -1
  400. package/dist/managers/MXLConfigManager/types.d.ts +18 -1
  401. package/dist/managers/MXLConfigManager/types.d.ts.map +1 -1
  402. package/dist/managers/MXLConfigManager/utils.cjs +37 -0
  403. package/dist/managers/MXLConfigManager/utils.cjs.map +1 -1
  404. package/dist/managers/MXLConfigManager/utils.d.cts.map +1 -1
  405. package/dist/managers/MXLConfigManager/utils.d.ts.map +1 -1
  406. package/dist/managers/MXLConfigManager/utils.js +37 -0
  407. package/dist/managers/MXLConfigManager/utils.js.map +1 -1
  408. package/dist/managers/MXLLogManager/MXLLogManager.cjs +9 -8
  409. package/dist/managers/MXLLogManager/MXLLogManager.cjs.map +1 -1
  410. package/dist/managers/MXLLogManager/MXLLogManager.d.cts +2 -1
  411. package/dist/managers/MXLLogManager/MXLLogManager.d.cts.map +1 -1
  412. package/dist/managers/MXLLogManager/MXLLogManager.d.ts +2 -1
  413. package/dist/managers/MXLLogManager/MXLLogManager.d.ts.map +1 -1
  414. package/dist/managers/MXLLogManager/MXLLogManager.js +5 -4
  415. package/dist/managers/MXLLogManager/MXLLogManager.js.map +1 -1
  416. package/dist/managers/MXLLogManager/MXLLoggerProvider.cjs +46 -0
  417. package/dist/managers/MXLLogManager/MXLLoggerProvider.cjs.map +1 -0
  418. package/dist/managers/MXLLogManager/MXLLoggerProvider.d.cts +22 -0
  419. package/dist/managers/MXLLogManager/MXLLoggerProvider.d.cts.map +1 -0
  420. package/dist/managers/MXLLogManager/MXLLoggerProvider.d.ts +22 -0
  421. package/dist/managers/MXLLogManager/MXLLoggerProvider.d.ts.map +1 -0
  422. package/dist/managers/MXLLogManager/MXLLoggerProvider.js +44 -0
  423. package/dist/managers/MXLLogManager/MXLLoggerProvider.js.map +1 -0
  424. package/dist/managers/MXLLogManager/types.d.cts +9 -3
  425. package/dist/managers/MXLLogManager/types.d.cts.map +1 -1
  426. package/dist/managers/MXLLogManager/types.d.ts +9 -3
  427. package/dist/managers/MXLLogManager/types.d.ts.map +1 -1
  428. package/dist/managers/MXLPageManager/MXLPageManager.cjs +7 -6
  429. package/dist/managers/MXLPageManager/MXLPageManager.cjs.map +1 -1
  430. package/dist/managers/MXLPageManager/MXLPageManager.d.cts.map +1 -1
  431. package/dist/managers/MXLPageManager/MXLPageManager.d.ts.map +1 -1
  432. package/dist/managers/MXLPageManager/MXLPageManager.js +7 -6
  433. package/dist/managers/MXLPageManager/MXLPageManager.js.map +1 -1
  434. package/dist/managers/MXLTraceManager/MXLExtendedSpan.cjs +56 -9
  435. package/dist/managers/MXLTraceManager/MXLExtendedSpan.cjs.map +1 -1
  436. package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.cts +21 -5
  437. package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.cts.map +1 -1
  438. package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.ts +21 -5
  439. package/dist/managers/MXLTraceManager/MXLExtendedSpan.d.ts.map +1 -1
  440. package/dist/managers/MXLTraceManager/MXLExtendedSpan.js +56 -10
  441. package/dist/managers/MXLTraceManager/MXLExtendedSpan.js.map +1 -1
  442. package/dist/managers/MXLTraceManager/MXLTraceManager.cjs +2 -2
  443. package/dist/managers/MXLTraceManager/MXLTraceManager.cjs.map +1 -1
  444. package/dist/managers/MXLTraceManager/MXLTraceManager.js +2 -2
  445. package/dist/managers/MXLTraceManager/MXLTraceManager.js.map +1 -1
  446. package/dist/managers/MXLTraceManager/MXLTracerProvider.cjs +42 -0
  447. package/dist/managers/MXLTraceManager/MXLTracerProvider.cjs.map +1 -0
  448. package/dist/managers/MXLTraceManager/MXLTracerProvider.d.cts +22 -0
  449. package/dist/managers/MXLTraceManager/MXLTracerProvider.d.cts.map +1 -0
  450. package/dist/managers/MXLTraceManager/MXLTracerProvider.d.ts +22 -0
  451. package/dist/managers/MXLTraceManager/MXLTracerProvider.d.ts.map +1 -0
  452. package/dist/managers/MXLTraceManager/MXLTracerProvider.js +40 -0
  453. package/dist/managers/MXLTraceManager/MXLTracerProvider.js.map +1 -0
  454. package/dist/managers/MXLTraceManager/types.cjs +0 -0
  455. package/dist/managers/MXLTraceManager/types.d.cts +10 -0
  456. package/dist/managers/MXLTraceManager/types.d.cts.map +1 -0
  457. package/dist/managers/MXLTraceManager/types.d.ts +10 -0
  458. package/dist/managers/MXLTraceManager/types.d.ts.map +1 -0
  459. package/dist/managers/MXLTraceManager/types.js +0 -0
  460. package/dist/managers/MXLUserManager/MXLUserManager.cjs +1 -1
  461. package/dist/managers/MXLUserManager/MXLUserManager.js +1 -1
  462. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.cjs +45 -21
  463. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.cjs.map +1 -1
  464. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.d.cts +5 -3
  465. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.d.cts.map +1 -1
  466. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.d.ts +5 -3
  467. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.d.ts.map +1 -1
  468. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.js +45 -21
  469. package/dist/managers/MXLUserSessionManager/MXLUserSessionManager.js.map +1 -1
  470. package/dist/managers/MXLUserSessionManager/constants.cjs +1 -1
  471. package/dist/managers/MXLUserSessionManager/constants.cjs.map +1 -1
  472. package/dist/managers/MXLUserSessionManager/constants.d.cts +1 -1
  473. package/dist/managers/MXLUserSessionManager/constants.d.ts +1 -1
  474. package/dist/managers/MXLUserSessionManager/constants.js +1 -1
  475. package/dist/managers/MXLUserSessionManager/constants.js.map +1 -1
  476. package/dist/managers/MXLUserSessionManager/types.d.cts +19 -2
  477. package/dist/managers/MXLUserSessionManager/types.d.cts.map +1 -1
  478. package/dist/managers/MXLUserSessionManager/types.d.ts +19 -2
  479. package/dist/managers/MXLUserSessionManager/types.d.ts.map +1 -1
  480. package/dist/managers/MXLUserSessionManager/utils/state.cjs +19 -6
  481. package/dist/managers/MXLUserSessionManager/utils/state.cjs.map +1 -1
  482. package/dist/managers/MXLUserSessionManager/utils/state.d.cts +3 -2
  483. package/dist/managers/MXLUserSessionManager/utils/state.d.cts.map +1 -1
  484. package/dist/managers/MXLUserSessionManager/utils/state.d.ts +3 -2
  485. package/dist/managers/MXLUserSessionManager/utils/state.d.ts.map +1 -1
  486. package/dist/managers/MXLUserSessionManager/utils/state.js +19 -7
  487. package/dist/managers/MXLUserSessionManager/utils/state.js.map +1 -1
  488. package/dist/managers/MXLUserSessionManager/utils/tabTracking.cjs +1 -1
  489. package/dist/managers/MXLUserSessionManager/utils/tabTracking.js +1 -1
  490. package/dist/mxl-web-sdk.js +12 -2
  491. package/dist/mxl-web-sdk.js.map +1 -1
  492. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.cjs.map +1 -1
  493. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.d.cts +2 -2
  494. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.d.cts.map +1 -1
  495. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.d.ts +2 -2
  496. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.d.ts.map +1 -1
  497. package/dist/processors/BrowserLogRecordProcessor/BrowserLogRecordProcessor.js.map +1 -1
  498. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.cjs.map +1 -1
  499. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.d.cts +2 -2
  500. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.d.cts.map +1 -1
  501. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.d.ts +2 -2
  502. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.d.ts.map +1 -1
  503. package/dist/processors/LogRecordScrubProcessor/LogRecordScrubProcessor.js.map +1 -1
  504. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.cjs.map +1 -1
  505. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.d.cts +2 -2
  506. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.d.cts.map +1 -1
  507. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.d.ts +2 -2
  508. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.d.ts.map +1 -1
  509. package/dist/processors/MXLLogRecordProcessor/MXLLogRecordProcessor.js.map +1 -1
  510. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.cjs +1 -1
  511. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.cjs.map +1 -1
  512. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.d.cts +2 -2
  513. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.d.cts.map +1 -1
  514. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.d.ts +2 -2
  515. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.d.ts.map +1 -1
  516. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.js +1 -1
  517. package/dist/processors/PageLogRecordProcessor/PageLogRecordProcessor.js.map +1 -1
  518. package/dist/processors/PageSpanProcessor/PageSpanProcessor.cjs +1 -1
  519. package/dist/processors/PageSpanProcessor/PageSpanProcessor.cjs.map +1 -1
  520. package/dist/processors/PageSpanProcessor/PageSpanProcessor.d.cts.map +1 -1
  521. package/dist/processors/PageSpanProcessor/PageSpanProcessor.d.ts.map +1 -1
  522. package/dist/processors/PageSpanProcessor/PageSpanProcessor.js +1 -1
  523. package/dist/processors/PageSpanProcessor/PageSpanProcessor.js.map +1 -1
  524. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.cjs +26 -0
  525. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.cjs.map +1 -0
  526. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.d.cts +20 -0
  527. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.d.cts.map +1 -0
  528. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.d.ts +20 -0
  529. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.d.ts.map +1 -0
  530. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.js +25 -0
  531. package/dist/processors/PerfClockLagLogRecordProcessor/PerfClockLagLogRecordProcessor.js.map +1 -0
  532. package/dist/processors/PerfClockLagLogRecordProcessor/types.cjs +0 -0
  533. package/dist/processors/PerfClockLagLogRecordProcessor/types.d.cts +9 -0
  534. package/dist/processors/PerfClockLagLogRecordProcessor/types.d.cts.map +1 -0
  535. package/dist/processors/PerfClockLagLogRecordProcessor/types.d.ts +9 -0
  536. package/dist/processors/PerfClockLagLogRecordProcessor/types.d.ts.map +1 -0
  537. package/dist/processors/PerfClockLagLogRecordProcessor/types.js +0 -0
  538. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.cjs +27 -0
  539. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.cjs.map +1 -0
  540. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.d.cts +21 -0
  541. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.d.cts.map +1 -0
  542. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.d.ts +21 -0
  543. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.d.ts.map +1 -0
  544. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.js +26 -0
  545. package/dist/processors/PerfClockLagSpanProcessor/PerfClockLagSpanProcessor.js.map +1 -0
  546. package/dist/processors/PerfClockLagSpanProcessor/types.cjs +0 -0
  547. package/dist/processors/PerfClockLagSpanProcessor/types.d.cts +9 -0
  548. package/dist/processors/PerfClockLagSpanProcessor/types.d.cts.map +1 -0
  549. package/dist/processors/PerfClockLagSpanProcessor/types.d.ts +9 -0
  550. package/dist/processors/PerfClockLagSpanProcessor/types.d.ts.map +1 -0
  551. package/dist/processors/PerfClockLagSpanProcessor/types.js +0 -0
  552. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.cjs +1 -1
  553. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.cjs.map +1 -1
  554. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.d.cts +2 -2
  555. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.d.cts.map +1 -1
  556. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.d.ts +2 -2
  557. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.d.ts.map +1 -1
  558. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.js +1 -1
  559. package/dist/processors/SignalCorrelationLogRecordProcessor/SignalCorrelationLogRecordProcessor.js.map +1 -1
  560. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.cjs.map +1 -1
  561. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.d.cts +2 -2
  562. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.d.cts.map +1 -1
  563. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.d.ts +2 -2
  564. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.d.ts.map +1 -1
  565. package/dist/processors/UserLogRecordProcessor/UserLogRecordProcessor.js.map +1 -1
  566. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.cjs +1 -1
  567. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.cjs.map +1 -1
  568. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.d.cts +2 -2
  569. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.d.cts.map +1 -1
  570. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.d.ts +2 -2
  571. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.d.ts.map +1 -1
  572. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.js +1 -1
  573. package/dist/processors/UserSessionLogRecordProcessor/UserSessionLogRecordProcessor.js.map +1 -1
  574. package/dist/resources/sdkConstants.cjs +1 -1
  575. package/dist/resources/sdkConstants.cjs.map +1 -1
  576. package/dist/resources/sdkConstants.d.cts +1 -1
  577. package/dist/resources/sdkConstants.d.ts +1 -1
  578. package/dist/resources/sdkConstants.js +1 -1
  579. package/dist/resources/sdkConstants.js.map +1 -1
  580. package/dist/sdk/endpoints.cjs +2 -2
  581. package/dist/sdk/endpoints.cjs.map +1 -1
  582. package/dist/sdk/endpoints.d.cts +1 -1
  583. package/dist/sdk/endpoints.d.ts +1 -1
  584. package/dist/sdk/endpoints.js +2 -2
  585. package/dist/sdk/endpoints.js.map +1 -1
  586. package/dist/sdk/initSDK.cjs +42 -11
  587. package/dist/sdk/initSDK.cjs.map +1 -1
  588. package/dist/sdk/initSDK.js +45 -14
  589. package/dist/sdk/initSDK.js.map +1 -1
  590. package/dist/sdk/networkInstrumentations.cjs +1 -1
  591. package/dist/sdk/networkInstrumentations.cjs.map +1 -1
  592. package/dist/sdk/networkInstrumentations.d.cts.map +1 -1
  593. package/dist/sdk/networkInstrumentations.d.ts.map +1 -1
  594. package/dist/sdk/networkInstrumentations.js +1 -1
  595. package/dist/sdk/networkInstrumentations.js.map +1 -1
  596. package/dist/sdk/resolveInitConfig.cjs +2 -1
  597. package/dist/sdk/resolveInitConfig.cjs.map +1 -1
  598. package/dist/sdk/resolveInitConfig.d.cts +4 -0
  599. package/dist/sdk/resolveInitConfig.d.cts.map +1 -1
  600. package/dist/sdk/resolveInitConfig.d.ts +4 -0
  601. package/dist/sdk/resolveInitConfig.d.ts.map +1 -1
  602. package/dist/sdk/resolveInitConfig.js +2 -1
  603. package/dist/sdk/resolveInitConfig.js.map +1 -1
  604. package/dist/sdk/responseSpanContext.cjs +34 -0
  605. package/dist/sdk/responseSpanContext.cjs.map +1 -0
  606. package/dist/sdk/responseSpanContext.d.cts +16 -0
  607. package/dist/sdk/responseSpanContext.d.cts.map +1 -0
  608. package/dist/sdk/responseSpanContext.d.ts +16 -0
  609. package/dist/sdk/responseSpanContext.d.ts.map +1 -0
  610. package/dist/sdk/responseSpanContext.js +31 -0
  611. package/dist/sdk/responseSpanContext.js.map +1 -0
  612. package/dist/sdk/setupDefaultInstrumentations.cjs +17 -1
  613. package/dist/sdk/setupDefaultInstrumentations.cjs.map +1 -1
  614. package/dist/sdk/setupDefaultInstrumentations.d.cts +2 -1
  615. package/dist/sdk/setupDefaultInstrumentations.d.cts.map +1 -1
  616. package/dist/sdk/setupDefaultInstrumentations.d.ts +2 -1
  617. package/dist/sdk/setupDefaultInstrumentations.d.ts.map +1 -1
  618. package/dist/sdk/setupDefaultInstrumentations.js +17 -1
  619. package/dist/sdk/setupDefaultInstrumentations.js.map +1 -1
  620. package/dist/sdk/types.d.cts +42 -2
  621. package/dist/sdk/types.d.cts.map +1 -1
  622. package/dist/sdk/types.d.ts +42 -2
  623. package/dist/sdk/types.d.ts.map +1 -1
  624. package/dist/transport/RetryingTransport/RetryingTransport.cjs +2 -2
  625. package/dist/transport/RetryingTransport/RetryingTransport.cjs.map +1 -1
  626. package/dist/transport/RetryingTransport/RetryingTransport.js +2 -2
  627. package/dist/transport/RetryingTransport/RetryingTransport.js.map +1 -1
  628. package/dist/utils/InMemoryStorage/InMemoryStorage.cjs +27 -0
  629. package/dist/utils/InMemoryStorage/InMemoryStorage.cjs.map +1 -0
  630. package/dist/utils/InMemoryStorage/InMemoryStorage.d.cts +13 -0
  631. package/dist/utils/InMemoryStorage/InMemoryStorage.d.cts.map +1 -0
  632. package/dist/utils/InMemoryStorage/InMemoryStorage.d.ts +13 -0
  633. package/dist/utils/InMemoryStorage/InMemoryStorage.d.ts.map +1 -0
  634. package/dist/utils/InMemoryStorage/InMemoryStorage.js +26 -0
  635. package/dist/utils/InMemoryStorage/InMemoryStorage.js.map +1 -0
  636. package/dist/utils/PerformanceManager/OTelPerformanceManager.cjs +71 -24
  637. package/dist/utils/PerformanceManager/OTelPerformanceManager.cjs.map +1 -1
  638. package/dist/utils/PerformanceManager/OTelPerformanceManager.d.cts +18 -19
  639. package/dist/utils/PerformanceManager/OTelPerformanceManager.d.cts.map +1 -1
  640. package/dist/utils/PerformanceManager/OTelPerformanceManager.d.ts +18 -19
  641. package/dist/utils/PerformanceManager/OTelPerformanceManager.d.ts.map +1 -1
  642. package/dist/utils/PerformanceManager/OTelPerformanceManager.js +70 -22
  643. package/dist/utils/PerformanceManager/OTelPerformanceManager.js.map +1 -1
  644. package/dist/utils/PerformanceManager/types.d.cts +28 -12
  645. package/dist/utils/PerformanceManager/types.d.cts.map +1 -1
  646. package/dist/utils/PerformanceManager/types.d.ts +28 -12
  647. package/dist/utils/PerformanceManager/types.d.ts.map +1 -1
  648. package/dist/utils/getWindowStorageOrInMemory.cjs +24 -0
  649. package/dist/utils/getWindowStorageOrInMemory.cjs.map +1 -0
  650. package/dist/utils/getWindowStorageOrInMemory.d.cts +13 -0
  651. package/dist/utils/getWindowStorageOrInMemory.d.cts.map +1 -0
  652. package/dist/utils/getWindowStorageOrInMemory.d.ts +13 -0
  653. package/dist/utils/getWindowStorageOrInMemory.d.ts.map +1 -0
  654. package/dist/utils/getWindowStorageOrInMemory.js +23 -0
  655. package/dist/utils/getWindowStorageOrInMemory.js.map +1 -0
  656. package/dist/utils/sdkLoadOriginOffset.cjs +12 -0
  657. package/dist/utils/sdkLoadOriginOffset.cjs.map +1 -0
  658. package/dist/utils/sdkLoadOriginOffset.d.cts +10 -0
  659. package/dist/utils/sdkLoadOriginOffset.d.cts.map +1 -0
  660. package/dist/utils/sdkLoadOriginOffset.d.ts +10 -0
  661. package/dist/utils/sdkLoadOriginOffset.d.ts.map +1 -0
  662. package/dist/utils/sdkLoadOriginOffset.js +11 -0
  663. package/dist/utils/sdkLoadOriginOffset.js.map +1 -0
  664. package/package.json +20 -22
@@ -6,11 +6,13 @@ import { MXLInstrumentationBase } from "../../MXLInstrumentationBase/MXLInstrume
6
6
  const PATH_OPTIONS_RE = /\([^()]+\)/g;
7
7
  var NavigationInstrumentation = class extends MXLInstrumentationBase {
8
8
  _shouldCleanupPathOptionsFromRouteName = true;
9
+ _pageManager;
9
10
  _currentRouteSpan = null;
11
+ _currentRouteSpanUrl = null;
12
+ _currentRouteSpanPath = void 0;
10
13
  _instrumentationType = "manual";
11
- _removeSessionStartedFn = null;
12
- _removeSessionEndedFn = null;
13
- constructor({ diag, shouldCleanupPathOptionsFromRouteName = true }) {
14
+ _removeRouteChangedListener = null;
15
+ constructor({ diag, shouldCleanupPathOptionsFromRouteName = true, pageManager }) {
14
16
  super({
15
17
  config: {},
16
18
  diag,
@@ -18,83 +20,88 @@ var NavigationInstrumentation = class extends MXLInstrumentationBase {
18
20
  instrumentationVersion: "1.0.0"
19
21
  });
20
22
  this._shouldCleanupPathOptionsFromRouteName = shouldCleanupPathOptionsFromRouteName;
21
- if (this._config.enabled) this.enable();
23
+ this._pageManager = pageManager ?? page.getPageManager();
22
24
  }
23
25
  setInstrumentationType = (instrumentationType) => {
24
26
  this._instrumentationType = instrumentationType;
25
27
  };
28
+ /**
29
+ * Compatibility entry point for callers that historically drove spans
30
+ * through the instrumentation. Prefer `page.setCurrentRoute` — this just
31
+ * forwards there so the page-manager listener opens/renames the span.
32
+ */
26
33
  setCurrentRoute = (route) => {
27
- if (!this._config.enabled) return;
28
- const currentRoute = page.getCurrentRoute();
29
- const urlChanged = route.url !== currentRoute?.url;
30
- page.setCurrentRoute(route);
31
- if (urlChanged) {
32
- this._endRouteSpan(currentRoute);
33
- this._startRouteSpan(route);
34
- analytics.screenView();
35
- return;
36
- }
37
- if (!this._currentRouteSpan) {
38
- this._startRouteSpan(route);
39
- return;
40
- }
41
- if (currentRoute?.path !== route.path) {
42
- this._endRouteSpan(currentRoute);
43
- this._startRouteSpan(route);
44
- }
34
+ this._pageManager.setCurrentRoute(route);
45
35
  };
46
- _setupSessionListeners = () => {
47
- if (!this._removeSessionStartedFn) this._removeSessionStartedFn = this.userSessionManager.addSessionPartStartedListener(({ reason }) => {
48
- if (reason === "web_soft_navigation") return;
49
- const currentRoute = page.getCurrentRoute();
50
- if (currentRoute && !this._currentRouteSpan) {
51
- this._diag.debug("Session started, starting route span.");
52
- this._startRouteSpan(currentRoute);
53
- }
54
- });
55
- if (!this._removeSessionEndedFn) this._removeSessionEndedFn = this.userSessionManager.addSessionPartEndedListener(() => {
56
- if (this._currentRouteSpan) {
57
- this._diag.debug("Session ended, ending route span.");
58
- this._endRouteSpan(page.getCurrentRoute());
59
- }
60
- });
61
- };
62
- _cleanUpSessionListeners = () => {
63
- if (this._removeSessionStartedFn) {
64
- this._removeSessionStartedFn();
65
- this._removeSessionStartedFn = null;
66
- }
67
- if (this._removeSessionEndedFn) {
68
- this._removeSessionEndedFn();
69
- this._removeSessionEndedFn = null;
36
+ _onRouteChanged = (route) => {
37
+ if (!this._isEnabled) return;
38
+ if (this._currentRouteSpan && this._currentRouteSpanUrl === route.url) {
39
+ if (route.path && this._currentRouteSpanPath !== route.path) this._renameCurrentRouteSpan(route);
40
+ return;
70
41
  }
42
+ const previousUrl = this._currentRouteSpanUrl;
43
+ this._endRouteSpan();
44
+ this._startRouteSpan(route);
45
+ if (previousUrl !== null && previousUrl !== route.url) analytics.screenView();
71
46
  };
72
47
  _startRouteSpan = (route) => {
73
48
  this._diag.debug(`Starting route span for url: ${route.url}`);
74
- this._setupSessionListeners();
75
- const pathName = this._shouldCleanupPathOptionsFromRouteName ? route.path.replace(PATH_OPTIONS_RE, "") : route.path;
49
+ const pathName = this._resolveRouteName(route);
76
50
  this._currentRouteSpan = this.tracer.startSpan(pathName, { attributes: {
77
51
  [KEY_MXL_TYPE]: "ux.surface",
78
- [KEY_MXL_PAGE_PATH]: pathName,
79
- [KEY_MXL_PAGE_ID]: page.getCurrentPageId() || void 0
52
+ [KEY_MXL_PAGE_PATH]: route.path ? pathName : void 0,
53
+ [KEY_MXL_PAGE_ID]: this._pageManager.getCurrentPageId() || void 0
80
54
  } });
55
+ this._currentRouteSpanUrl = route.url;
56
+ this._currentRouteSpanPath = route.path;
81
57
  this._currentRouteSpan.setAttribute(KEY_MXL_INSTRUMENTATION, this._instrumentationType);
82
58
  return this._currentRouteSpan;
83
59
  };
84
- _endRouteSpan = (currentRoute) => {
60
+ _endRouteSpan = () => {
85
61
  if (this._currentRouteSpan) {
86
- if (currentRoute) this._diag.debug(`Ending route span for url: ${currentRoute.url}`);
62
+ this._diag.debug(`Ending route span for url: ${this._currentRouteSpanUrl ?? "unknown"}`);
87
63
  this._currentRouteSpan.end();
88
64
  this._currentRouteSpan = null;
65
+ this._currentRouteSpanUrl = null;
66
+ this._currentRouteSpanPath = void 0;
67
+ }
68
+ };
69
+ _renameCurrentRouteSpan = (route) => {
70
+ const pathName = this._resolveRouteName(route);
71
+ this._diag.debug(`Resolved route span path to: ${pathName}`);
72
+ this._currentRouteSpan?.updateName(pathName);
73
+ this._currentRouteSpan?.setAttribute(KEY_MXL_PAGE_PATH, pathName);
74
+ this._currentRouteSpanPath = route.path;
75
+ };
76
+ _resolveRouteName = (route) => {
77
+ const pathName = route.path ?? route.url;
78
+ return this._shouldCleanupPathOptionsFromRouteName ? pathName.replace(PATH_OPTIONS_RE, "") : pathName;
79
+ };
80
+ _onSessionPartEnded = () => {
81
+ if (this._currentRouteSpan) {
82
+ this._diag.debug("Session ended, ending route span.");
83
+ this._endRouteSpan();
89
84
  }
90
85
  };
86
+ _onSessionPartStarted = ({ reason }) => {
87
+ if (reason === "web_soft_navigation") return;
88
+ const currentRoute = this._pageManager.getCurrentRoute();
89
+ if (currentRoute) this._onRouteChanged(currentRoute);
90
+ };
91
91
  onEnable() {
92
- this.setConfig({ enabled: true });
92
+ this._removeRouteChangedListener = this._pageManager.addRouteChangedListener(this._onRouteChanged);
93
+ this.setSessionPartListeners({
94
+ end: this._onSessionPartEnded,
95
+ start: this._onSessionPartStarted
96
+ });
97
+ const currentRoute = this._pageManager.getCurrentRoute();
98
+ if (currentRoute) this._onRouteChanged(currentRoute);
93
99
  this._diag.debug("NavigationInstrumentation enabled, listening for navigation events.");
94
100
  }
95
101
  onDisable() {
96
- this._cleanUpSessionListeners();
97
- this.setConfig({ enabled: false });
102
+ this._removeRouteChangedListener?.();
103
+ this._removeRouteChangedListener = null;
104
+ this._endRouteSpan();
98
105
  this._diag.debug("NavigationInstrumentation disabled, stopped listening for navigation events.");
99
106
  }
100
107
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { analytics } from '../../../api-analytics/analyticsAPI';\nimport type { Route } from '../../../api-page/manager/types';\nimport { page } from '../../../api-page/pageAPI';\nimport type { SessionPartStartedEvent } from '../../../api-sessions/manager/types';\nimport {\n KEY_MXL_INSTRUMENTATION,\n KEY_MXL_PAGE_ID,\n KEY_MXL_PAGE_PATH,\n KEY_MXL_TYPE,\n MXL_NAVIGATION_INSTRUMENTATIONS,\n MXL_TYPES,\n} from '../../../constants/attributes';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase/MXLInstrumentationBase';\nimport type { NavigationInstrumentationArgs } from './types';\n\n// Regular expression to match path options in the format \"(option)\"\n// Used to clean up paths that are like \"/order/:orderState(pending|shipped|delivered)/type:(sale|normal)\" to \"/order/:orderState/:type\"\n// Could be simplified but done this way to prevent: https://javascript.info/regexp-catastrophic-backtracking\nconst PATH_OPTIONS_RE = /\\([^()]+\\)/g;\n\nexport class NavigationInstrumentation extends MXLInstrumentationBase {\n private readonly _shouldCleanupPathOptionsFromRouteName: boolean = true;\n private _currentRouteSpan: Span | null = null;\n private _instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS =\n MXL_NAVIGATION_INSTRUMENTATIONS.Manual;\n private _removeSessionStartedFn: (() => void) | null = null;\n private _removeSessionEndedFn: (() => void) | null = null;\n\n public constructor({\n diag,\n shouldCleanupPathOptionsFromRouteName = true,\n }: NavigationInstrumentationArgs) {\n super({\n config: {},\n diag,\n instrumentationName: 'NavigationInstrumentation',\n instrumentationVersion: '1.0.0',\n });\n\n this._shouldCleanupPathOptionsFromRouteName =\n shouldCleanupPathOptionsFromRouteName;\n\n if (this._config.enabled) {\n this.enable();\n }\n }\n\n public setInstrumentationType = (\n instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS,\n ) => {\n this._instrumentationType = instrumentationType;\n };\n\n public setCurrentRoute = (route: Route) => {\n if (!this._config.enabled) {\n return;\n }\n\n const currentRoute = page.getCurrentRoute();\n const urlChanged = route.url !== currentRoute?.url;\n\n page.setCurrentRoute(route);\n\n if (urlChanged) {\n this._endRouteSpan(currentRoute);\n this._startRouteSpan(route);\n analytics.screenView();\n return;\n }\n\n if (!this._currentRouteSpan) {\n this._startRouteSpan(route);\n return;\n }\n\n if (currentRoute?.path !== route.path) {\n this._endRouteSpan(currentRoute);\n this._startRouteSpan(route);\n }\n };\n\n private readonly _setupSessionListeners = () => {\n if (!this._removeSessionStartedFn) {\n this._removeSessionStartedFn =\n this.userSessionManager.addSessionPartStartedListener(\n ({ reason }: SessionPartStartedEvent) => {\n if (reason === 'web_soft_navigation') {\n return;\n }\n\n const currentRoute = page.getCurrentRoute();\n\n if (currentRoute && !this._currentRouteSpan) {\n this._diag.debug('Session started, starting route span.');\n\n this._startRouteSpan(currentRoute);\n }\n },\n );\n }\n\n if (!this._removeSessionEndedFn) {\n this._removeSessionEndedFn =\n this.userSessionManager.addSessionPartEndedListener(() => {\n if (this._currentRouteSpan) {\n this._diag.debug('Session ended, ending route span.');\n\n this._endRouteSpan(page.getCurrentRoute());\n }\n });\n }\n };\n\n private readonly _cleanUpSessionListeners = () => {\n if (this._removeSessionStartedFn) {\n this._removeSessionStartedFn();\n this._removeSessionStartedFn = null;\n }\n\n if (this._removeSessionEndedFn) {\n this._removeSessionEndedFn();\n this._removeSessionEndedFn = null;\n }\n };\n\n private readonly _startRouteSpan = (route: Route): Span => {\n this._diag.debug(`Starting route span for url: ${route.url}`);\n this._setupSessionListeners();\n\n const pathName = this._shouldCleanupPathOptionsFromRouteName\n ? route.path.replace(PATH_OPTIONS_RE, '')\n : route.path;\n this._currentRouteSpan = this.tracer.startSpan(pathName, {\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.Surface,\n [KEY_MXL_PAGE_PATH]: pathName,\n [KEY_MXL_PAGE_ID]: page.getCurrentPageId() || undefined,\n },\n });\n\n this._currentRouteSpan.setAttribute(\n KEY_MXL_INSTRUMENTATION,\n this._instrumentationType,\n );\n\n return this._currentRouteSpan;\n };\n\n private readonly _endRouteSpan = (currentRoute: Route | null) => {\n if (this._currentRouteSpan) {\n if (currentRoute) {\n this._diag.debug(`Ending route span for url: ${currentRoute.url}`);\n }\n\n this._currentRouteSpan.end();\n this._currentRouteSpan = null;\n }\n };\n\n protected override onEnable(): void {\n this.setConfig({\n enabled: true,\n });\n this._diag.debug(\n 'NavigationInstrumentation enabled, listening for navigation events.',\n );\n }\n\n protected override onDisable(): void {\n this._cleanUpSessionListeners();\n this.setConfig({\n enabled: false,\n });\n this._diag.debug(\n 'NavigationInstrumentation disabled, stopped listening for navigation events.',\n );\n }\n}\n"],"mappings":";;;;;AAmBA,MAAM,kBAAkB;AAExB,IAAa,4BAAb,cAA+C,uBAAuB;CACpE,yCAAmE;CACnE,oBAAyC;CACzC,uBAAQ;CAER,0BAAuD;CACvD,wBAAqD;CAErD,YAAmB,EACjB,MACA,wCAAwC,QACR;AAChC,QAAM;GACJ,QAAQ,EAAE;GACV;GACA,qBAAqB;GACrB,wBAAwB;GACzB,CAAC;AAEF,OAAK,yCACH;AAEF,MAAI,KAAK,QAAQ,QACf,MAAK,QAAQ;;CAIjB,0BACE,wBACG;AACH,OAAK,uBAAuB;;CAG9B,mBAA0B,UAAiB;AACzC,MAAI,CAAC,KAAK,QAAQ,QAChB;EAGF,MAAM,eAAe,KAAK,iBAAiB;EAC3C,MAAM,aAAa,MAAM,QAAQ,cAAc;AAE/C,OAAK,gBAAgB,MAAM;AAE3B,MAAI,YAAY;AACd,QAAK,cAAc,aAAa;AAChC,QAAK,gBAAgB,MAAM;AAC3B,aAAU,YAAY;AACtB;;AAGF,MAAI,CAAC,KAAK,mBAAmB;AAC3B,QAAK,gBAAgB,MAAM;AAC3B;;AAGF,MAAI,cAAc,SAAS,MAAM,MAAM;AACrC,QAAK,cAAc,aAAa;AAChC,QAAK,gBAAgB,MAAM;;;CAI/B,+BAAgD;AAC9C,MAAI,CAAC,KAAK,wBACR,MAAK,0BACH,KAAK,mBAAmB,+BACrB,EAAE,aAAsC;AACvC,OAAI,WAAW,sBACb;GAGF,MAAM,eAAe,KAAK,iBAAiB;AAE3C,OAAI,gBAAgB,CAAC,KAAK,mBAAmB;AAC3C,SAAK,MAAM,MAAM,wCAAwC;AAEzD,SAAK,gBAAgB,aAAa;;IAGvC;AAGL,MAAI,CAAC,KAAK,sBACR,MAAK,wBACH,KAAK,mBAAmB,kCAAkC;AACxD,OAAI,KAAK,mBAAmB;AAC1B,SAAK,MAAM,MAAM,oCAAoC;AAErD,SAAK,cAAc,KAAK,iBAAiB,CAAC;;IAE5C;;CAIR,iCAAkD;AAChD,MAAI,KAAK,yBAAyB;AAChC,QAAK,yBAAyB;AAC9B,QAAK,0BAA0B;;AAGjC,MAAI,KAAK,uBAAuB;AAC9B,QAAK,uBAAuB;AAC5B,QAAK,wBAAwB;;;CAIjC,mBAAoC,UAAuB;AACzD,OAAK,MAAM,MAAM,gCAAgC,MAAM,MAAM;AAC7D,OAAK,wBAAwB;EAE7B,MAAM,WAAW,KAAK,yCAClB,MAAM,KAAK,QAAQ,iBAAiB,GAAG,GACvC,MAAM;AACV,OAAK,oBAAoB,KAAK,OAAO,UAAU,UAAU,EACvD,YAAY;IACT,eAAA;IACA,oBAAoB;IACpB,kBAAkB,KAAK,kBAAkB,IAAI,KAAA;GAC/C,EACF,CAAC;AAEF,OAAK,kBAAkB,aACrB,yBACA,KAAK,qBACN;AAED,SAAO,KAAK;;CAGd,iBAAkC,iBAA+B;AAC/D,MAAI,KAAK,mBAAmB;AAC1B,OAAI,aACF,MAAK,MAAM,MAAM,8BAA8B,aAAa,MAAM;AAGpE,QAAK,kBAAkB,KAAK;AAC5B,QAAK,oBAAoB;;;CAI7B,WAAoC;AAClC,OAAK,UAAU,EACb,SAAS,MACV,CAAC;AACF,OAAK,MAAM,MACT,sEACD;;CAGH,YAAqC;AACnC,OAAK,0BAA0B;AAC/B,OAAK,UAAU,EACb,SAAS,OACV,CAAC;AACF,OAAK,MAAM,MACT,+EACD"}
1
+ {"version":3,"file":"NavigationInstrumentation.js","names":[],"sources":["../../../../src/instrumentations/navigation/NavigationInstrumentation/NavigationInstrumentation.ts"],"sourcesContent":["import type { Span } from '@opentelemetry/api';\nimport { analytics } from '../../../api-analytics/analyticsAPI';\nimport type { PageManager, Route } from '../../../api-page/manager/types';\nimport { page } from '../../../api-page/pageAPI';\nimport type { SessionPartStartedEvent } from '../../../api-sessions/manager/types';\nimport {\n KEY_MXL_INSTRUMENTATION,\n KEY_MXL_PAGE_ID,\n KEY_MXL_PAGE_PATH,\n KEY_MXL_TYPE,\n MXL_NAVIGATION_INSTRUMENTATIONS,\n MXL_TYPES,\n} from '../../../constants/attributes';\nimport { MXLInstrumentationBase } from '../../MXLInstrumentationBase/MXLInstrumentationBase';\nimport type { NavigationInstrumentationArgs } from './types';\n\n// Regular expression to match path options in the format \"(option)\"\n// Used to clean up paths that are like \"/order/:orderState(pending|shipped|delivered)/type:(sale|normal)\" to \"/order/:orderState/:type\"\n// Could be simplified but done this way to prevent: https://javascript.info/regexp-catastrophic-backtracking\nconst PATH_OPTIONS_RE = /\\([^()]+\\)/g;\n\nexport class NavigationInstrumentation extends MXLInstrumentationBase {\n private readonly _shouldCleanupPathOptionsFromRouteName: boolean = true;\n private readonly _pageManager: PageManager;\n private _currentRouteSpan: Span | null = null;\n private _currentRouteSpanUrl: string | null = null;\n private _currentRouteSpanPath: string | undefined = undefined;\n private _instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS =\n MXL_NAVIGATION_INSTRUMENTATIONS.Manual;\n private _removeRouteChangedListener: (() => void) | null = null;\n\n public constructor({\n diag,\n shouldCleanupPathOptionsFromRouteName = true,\n pageManager,\n }: NavigationInstrumentationArgs) {\n super({\n config: {},\n diag,\n instrumentationName: 'NavigationInstrumentation',\n instrumentationVersion: '1.0.0',\n });\n\n this._shouldCleanupPathOptionsFromRouteName =\n shouldCleanupPathOptionsFromRouteName;\n this._pageManager = pageManager ?? page.getPageManager();\n }\n\n public setInstrumentationType = (\n instrumentationType: MXL_NAVIGATION_INSTRUMENTATIONS,\n ) => {\n this._instrumentationType = instrumentationType;\n };\n\n /**\n * Compatibility entry point for callers that historically drove spans\n * through the instrumentation. Prefer `page.setCurrentRoute` — this just\n * forwards there so the page-manager listener opens/renames the span.\n */\n public setCurrentRoute = (route: Route) => {\n this._pageManager.setCurrentRoute(route);\n };\n\n private readonly _onRouteChanged = (route: Route): void => {\n if (!this._isEnabled) {\n return;\n }\n\n if (this._currentRouteSpan && this._currentRouteSpanUrl === route.url) {\n // Same url as the currently open span: either the templated path just\n // resolved/changed (rename in place), or a redundant replay — no-op if\n // there's no new path to apply (path still unknown, or unchanged).\n if (route.path && this._currentRouteSpanPath !== route.path) {\n this._renameCurrentRouteSpan(route);\n }\n return;\n }\n\n const previousUrl = this._currentRouteSpanUrl;\n this._endRouteSpan();\n this._startRouteSpan(route);\n\n // Soft navigations already emit screenView from MXLPageManager. This covers\n // React-driven route changes in browsers without the Navigation API.\n if (previousUrl !== null && previousUrl !== route.url) {\n analytics.screenView();\n }\n };\n\n private readonly _startRouteSpan = (route: Route): Span => {\n this._diag.debug(`Starting route span for url: ${route.url}`);\n\n const pathName = this._resolveRouteName(route);\n this._currentRouteSpan = this.tracer.startSpan(pathName, {\n attributes: {\n [KEY_MXL_TYPE]: MXL_TYPES.Surface,\n [KEY_MXL_PAGE_PATH]: route.path ? pathName : undefined,\n [KEY_MXL_PAGE_ID]: this._pageManager.getCurrentPageId() || undefined,\n },\n });\n this._currentRouteSpanUrl = route.url;\n this._currentRouteSpanPath = route.path;\n\n this._currentRouteSpan.setAttribute(\n KEY_MXL_INSTRUMENTATION,\n this._instrumentationType,\n );\n\n return this._currentRouteSpan;\n };\n\n private readonly _endRouteSpan = (): void => {\n if (this._currentRouteSpan) {\n this._diag.debug(\n `Ending route span for url: ${this._currentRouteSpanUrl ?? 'unknown'}`,\n );\n\n this._currentRouteSpan.end();\n this._currentRouteSpan = null;\n this._currentRouteSpanUrl = null;\n this._currentRouteSpanPath = undefined;\n }\n };\n\n private readonly _renameCurrentRouteSpan = (route: Route): void => {\n const pathName = this._resolveRouteName(route);\n this._diag.debug(`Resolved route span path to: ${pathName}`);\n\n this._currentRouteSpan?.updateName(pathName);\n this._currentRouteSpan?.setAttribute(KEY_MXL_PAGE_PATH, pathName);\n this._currentRouteSpanPath = route.path;\n };\n\n private readonly _resolveRouteName = (route: Route): string => {\n const pathName = route.path ?? route.url;\n\n return this._shouldCleanupPathOptionsFromRouteName\n ? pathName.replace(PATH_OPTIONS_RE, '')\n : pathName;\n };\n\n // A route span must not outlive the session part it started in — e.g. the\n // tab backgrounds, or the session ends, with no further navigation to\n // trigger _onRouteChanged.\n private readonly _onSessionPartEnded = (): void => {\n if (this._currentRouteSpan) {\n this._diag.debug('Session ended, ending route span.');\n this._endRouteSpan();\n }\n };\n\n // Only needed when a session part starts with no route change (e.g.\n // resuming after background/inactivity). Skipped for soft-nav rollovers,\n // since the real new route is reported right after (see\n // MXLPageManager._onSoftNavigation).\n private readonly _onSessionPartStarted = ({\n reason,\n }: SessionPartStartedEvent): void => {\n if (reason === 'web_soft_navigation') {\n return;\n }\n\n const currentRoute = this._pageManager.getCurrentRoute();\n if (currentRoute) {\n this._onRouteChanged(currentRoute);\n }\n };\n\n protected override onEnable(): void {\n this._removeRouteChangedListener =\n this._pageManager.addRouteChangedListener(this._onRouteChanged);\n this.setSessionPartListeners({\n end: this._onSessionPartEnded,\n start: this._onSessionPartStarted,\n });\n\n // No route listener exists while disabled, so a route set before enabling\n // is replayed here to open its span.\n const currentRoute = this._pageManager.getCurrentRoute();\n if (currentRoute) {\n this._onRouteChanged(currentRoute);\n }\n\n this._diag.debug(\n 'NavigationInstrumentation enabled, listening for navigation events.',\n );\n }\n\n protected override onDisable(): void {\n this._removeRouteChangedListener?.();\n this._removeRouteChangedListener = null;\n this._endRouteSpan();\n this._diag.debug(\n 'NavigationInstrumentation disabled, stopped listening for navigation events.',\n );\n }\n}\n"],"mappings":";;;;;AAmBA,MAAM,kBAAkB;AAExB,IAAa,4BAAb,cAA+C,uBAAuB;CACpE,yCAAmE;CACnE;CACA,oBAAyC;CACzC,uBAA8C;CAC9C,wBAAoD,KAAA;CACpD,uBAAQ;CAER,8BAA2D;CAE3D,YAAmB,EACjB,MACA,wCAAwC,MACxC,eACgC;AAChC,QAAM;GACJ,QAAQ,EAAE;GACV;GACA,qBAAqB;GACrB,wBAAwB;GACzB,CAAC;AAEF,OAAK,yCACH;AACF,OAAK,eAAe,eAAe,KAAK,gBAAgB;;CAG1D,0BACE,wBACG;AACH,OAAK,uBAAuB;;;;;;;CAQ9B,mBAA0B,UAAiB;AACzC,OAAK,aAAa,gBAAgB,MAAM;;CAG1C,mBAAoC,UAAuB;AACzD,MAAI,CAAC,KAAK,WACR;AAGF,MAAI,KAAK,qBAAqB,KAAK,yBAAyB,MAAM,KAAK;AAIrE,OAAI,MAAM,QAAQ,KAAK,0BAA0B,MAAM,KACrD,MAAK,wBAAwB,MAAM;AAErC;;EAGF,MAAM,cAAc,KAAK;AACzB,OAAK,eAAe;AACpB,OAAK,gBAAgB,MAAM;AAI3B,MAAI,gBAAgB,QAAQ,gBAAgB,MAAM,IAChD,WAAU,YAAY;;CAI1B,mBAAoC,UAAuB;AACzD,OAAK,MAAM,MAAM,gCAAgC,MAAM,MAAM;EAE7D,MAAM,WAAW,KAAK,kBAAkB,MAAM;AAC9C,OAAK,oBAAoB,KAAK,OAAO,UAAU,UAAU,EACvD,YAAY;IACT,eAAA;IACA,oBAAoB,MAAM,OAAO,WAAW,KAAA;IAC5C,kBAAkB,KAAK,aAAa,kBAAkB,IAAI,KAAA;GAC5D,EACF,CAAC;AACF,OAAK,uBAAuB,MAAM;AAClC,OAAK,wBAAwB,MAAM;AAEnC,OAAK,kBAAkB,aACrB,yBACA,KAAK,qBACN;AAED,SAAO,KAAK;;CAGd,sBAA6C;AAC3C,MAAI,KAAK,mBAAmB;AAC1B,QAAK,MAAM,MACT,8BAA8B,KAAK,wBAAwB,YAC5D;AAED,QAAK,kBAAkB,KAAK;AAC5B,QAAK,oBAAoB;AACzB,QAAK,uBAAuB;AAC5B,QAAK,wBAAwB,KAAA;;;CAIjC,2BAA4C,UAAuB;EACjE,MAAM,WAAW,KAAK,kBAAkB,MAAM;AAC9C,OAAK,MAAM,MAAM,gCAAgC,WAAW;AAE5D,OAAK,mBAAmB,WAAW,SAAS;AAC5C,OAAK,mBAAmB,aAAa,mBAAmB,SAAS;AACjE,OAAK,wBAAwB,MAAM;;CAGrC,qBAAsC,UAAyB;EAC7D,MAAM,WAAW,MAAM,QAAQ,MAAM;AAErC,SAAO,KAAK,yCACR,SAAS,QAAQ,iBAAiB,GAAG,GACrC;;CAMN,4BAAmD;AACjD,MAAI,KAAK,mBAAmB;AAC1B,QAAK,MAAM,MAAM,oCAAoC;AACrD,QAAK,eAAe;;;CAQxB,yBAA0C,EACxC,aACmC;AACnC,MAAI,WAAW,sBACb;EAGF,MAAM,eAAe,KAAK,aAAa,iBAAiB;AACxD,MAAI,aACF,MAAK,gBAAgB,aAAa;;CAItC,WAAoC;AAClC,OAAK,8BACH,KAAK,aAAa,wBAAwB,KAAK,gBAAgB;AACjE,OAAK,wBAAwB;GAC3B,KAAK,KAAK;GACV,OAAO,KAAK;GACb,CAAC;EAIF,MAAM,eAAe,KAAK,aAAa,iBAAiB;AACxD,MAAI,aACF,MAAK,gBAAgB,aAAa;AAGpC,OAAK,MAAM,MACT,sEACD;;CAGH,YAAqC;AACnC,OAAK,+BAA+B;AACpC,OAAK,8BAA8B;AACnC,OAAK,eAAe;AACpB,OAAK,MAAM,MACT,+EACD"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
3
+ const require_api_page_pageAPI = require("../../../../../api-page/pageAPI.cjs");
3
4
  require("../../../../../constants/attributes.cjs");
4
5
  const require_instrumentations_navigation_NavigationInstrumentation_instance = require("../../instance.cjs");
5
6
  const require_hoist_non_react_statics_cjs$1 = require("../../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.cjs");
@@ -8,12 +9,11 @@ react = require_runtime.__toESM(react, 1);
8
9
  //#region src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts
9
10
  var import_hoist_non_react_statics_cjs = /* @__PURE__ */ require_runtime.__toESM(require_hoist_non_react_statics_cjs$1.default, 1);
10
11
  const withMXLRoutingLegacy = (WrappedComponent) => {
11
- const navigationInstrumentation = require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation();
12
- navigationInstrumentation.setInstrumentationType("react_router_declarative_legacy");
12
+ require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation().setInstrumentationType("react_router_declarative_legacy");
13
13
  const RouteWithMXLRoutingLegacy = (props) => {
14
14
  if (props.path) {
15
15
  const routeProps = props;
16
- if (routeProps.computedMatch) navigationInstrumentation.setCurrentRoute({
16
+ if (routeProps.computedMatch) require_api_page_pageAPI.page.setCurrentRoute({
17
17
  path: routeProps.computedMatch.path,
18
18
  url: routeProps.computedMatch.url
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRoutingLegacy.cjs","names":["getNavigationInstrumentation","React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/remix-run/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n navigationInstrumentation.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,wBACX,qBACG;CACH,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,2BAA0B,gBAAgB;IACxC,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOC,MAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,EAAA,GAAA,mCAAA,SAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
1
+ {"version":3,"file":"withMXLRoutingLegacy.cjs","names":["getNavigationInstrumentation","React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/reactjs/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n page.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;;;;;;AAOA,MAAa,wBACX,qBACG;AAC+BA,wEAAAA,8BACT,CAAC,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,0BAAA,KAAK,gBAAgB;IACnB,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOC,MAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,EAAA,GAAA,mCAAA,SAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRoutingLegacy.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAMa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"withMXLRoutingLegacy.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAOa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRoutingLegacy.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAMa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"withMXLRoutingLegacy.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"mappings":";;;;cAOa,oBAAA,aAAkC,mBAAA,EAC7C,gBAAA,EAAkB,OAAA,CAAM,aAAA,CAAc,CAAA,MAAE,OAAA,CAAA,EAAA,CAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { __toESM } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { page } from "../../../../../api-page/pageAPI.js";
2
3
  import "../../../../../constants/attributes.js";
3
4
  import { getNavigationInstrumentation } from "../../instance.js";
4
5
  import { require_hoist_non_react_statics_cjs } from "../../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js";
@@ -6,12 +7,11 @@ import * as React$1 from "react";
6
7
  //#region src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts
7
8
  var import_hoist_non_react_statics_cjs = /* @__PURE__ */ __toESM(require_hoist_non_react_statics_cjs(), 1);
8
9
  const withMXLRoutingLegacy = (WrappedComponent) => {
9
- const navigationInstrumentation = getNavigationInstrumentation();
10
- navigationInstrumentation.setInstrumentationType("react_router_declarative_legacy");
10
+ getNavigationInstrumentation().setInstrumentationType("react_router_declarative_legacy");
11
11
  const RouteWithMXLRoutingLegacy = (props) => {
12
12
  if (props.path) {
13
13
  const routeProps = props;
14
- if (routeProps.computedMatch) navigationInstrumentation.setCurrentRoute({
14
+ if (routeProps.computedMatch) page.setCurrentRoute({
15
15
  path: routeProps.computedMatch.path,
16
16
  url: routeProps.computedMatch.url
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRoutingLegacy.js","names":["React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/remix-run/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n navigationInstrumentation.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;;;AAMA,MAAa,wBACX,qBACG;CACH,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,2BAA0B,gBAAgB;IACxC,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOA,QAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,EAAA,GAAA,mCAAA,SAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
1
+ {"version":3,"file":"withMXLRoutingLegacy.js","names":["React"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV5/withMXLRoutingLegacy.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RouteComponentProps, SwitchedRouteComponentProps } from './types';\n\nexport const withMXLRoutingLegacy = <P extends RouteComponentProps>(\n WrappedComponent: React.ComponentType<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.DeclarativeLegacy,\n );\n\n const RouteWithMXLRoutingLegacy: React.FC<P> = (props: P) => {\n // Make sure this is Route component\n if (props.path) {\n // Routes get injected with computedMatch when they are children of a <Switch> but the types do not reflect that\n // Manually setting the type here.\n const routeProps = props as SwitchedRouteComponentProps;\n\n // Depends on this internal behaviour\n // https://github.com/reactjs/react-router/blob/v5.3.4/packages/react-router/modules/Switch.js#L40\n // It shouldn't change as this version is legacy, and it's not being actively worked on\n if (routeProps.computedMatch) {\n page.setCurrentRoute({\n path: routeProps.computedMatch.path,\n url: routeProps.computedMatch.url,\n });\n }\n }\n\n return React.createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RouteWithMXLRoutingLegacy.displayName = `withMXLRoutingLegacy(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RouteWithMXLRoutingLegacy, WrappedComponent);\n\n return RouteWithMXLRoutingLegacy;\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,wBACX,qBACG;AAC+B,+BACT,CAAC,uBAAA,kCAEzB;CAED,MAAM,6BAA0C,UAAa;AAE3D,MAAI,MAAM,MAAM;GAGd,MAAM,aAAa;AAKnB,OAAI,WAAW,cACb,MAAK,gBAAgB;IACnB,MAAM,WAAW,cAAc;IAC/B,KAAK,WAAW,cAAc;IAC/B,CAAC;;AAIN,SAAOA,QAAM,cAAiB,kBAAkB,MAAM;;AAIxD,2BAA0B,cAAc,wBAAwB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AACrI,EAAA,GAAA,mCAAA,SAAqB,2BAA2B,iBAAiB;AAEjE,QAAO"}
@@ -1,35 +1,32 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_api_page_pageAPI = require("../../../../../api-page/pageAPI.cjs");
2
3
  require("../../../../../constants/attributes.cjs");
3
4
  const require_instrumentations_navigation_NavigationInstrumentation_instance = require("../../instance.cjs");
4
5
  //#region src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts
5
6
  /**
6
- * GetRouteFromMatches goes through all the matches routes to build the full path
7
- * nested routes contain only the partial match, so we need to go through all of them
8
- * in order to build the full path.
9
- *
10
- * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.
7
+ * matchRoutes already scopes `matches` to the given pathname, ordered from
8
+ * the root route to the deepest one, so the full pattern is built by
9
+ * reducing over all of them. Pathless layout and index routes contribute no
10
+ * `route.path` of their own, so they're skipped.
11
11
  */
12
12
  const getRouteFromMatches = (matches, currentPathname) => {
13
- const currentMatchIndex = matches.findIndex((match) => match.pathname === currentPathname);
14
- if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) return null;
15
- return matches.slice(0, currentMatchIndex + 1).reduce((acc, match) => {
13
+ return matches.reduce((acc, match) => {
16
14
  const routePath = match.route.path;
17
15
  if (!routePath) return acc;
18
16
  return {
19
17
  path: routePath.startsWith("/") ? routePath : `${acc?.path ?? ""}/${routePath}`,
20
- url: matches[currentMatchIndex].pathname
18
+ url: currentPathname
21
19
  };
22
20
  }, null);
23
21
  };
24
22
  const listenToRouterChanges = ({ router, routesMatcher, config: { pathnameDocument = window.location } = {} }) => {
25
- const navigationInstrumentation = require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation();
26
- navigationInstrumentation.setInstrumentationType("react_router_data");
23
+ require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation().setInstrumentationType("react_router_data");
27
24
  const initialMatches = routesMatcher(router.routes, { pathname: pathnameDocument.pathname });
28
25
  const initialRoute = initialMatches ? getRouteFromMatches(initialMatches, pathnameDocument.pathname) : null;
29
- if (initialRoute) navigationInstrumentation.setCurrentRoute(initialRoute);
26
+ if (initialRoute) require_api_page_pageAPI.page.setCurrentRoute(initialRoute);
30
27
  return router.subscribe((state) => {
31
28
  const currentRoute = getRouteFromMatches(state.matches, state.location.pathname);
32
- if (currentRoute) navigationInstrumentation.setCurrentRoute(currentRoute);
29
+ if (currentRoute) require_api_page_pageAPI.page.setCurrentRoute(currentRoute);
33
30
  });
34
31
  };
35
32
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"listenToRouterChanges.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page/manager/types';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * GetRouteFromMatches goes through all the matches routes to build the full path\n * nested routes contain only the partial match, so we need to go through all of them\n * in order to build the full path.\n *\n * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n const currentMatchIndex = matches.findIndex(\n (match) => match.pathname === currentPathname,\n );\n\n if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) {\n return null;\n }\n\n // Build full absolute path by reducing all matches up to the current one.\n // Absolute child paths reset the accumulation; relative paths are appended.\n return matches\n .slice(0, currentMatchIndex + 1)\n .reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: matches[currentMatchIndex].pathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n navigationInstrumentation.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n navigationInstrumentation.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;CACjB,MAAM,oBAAoB,QAAQ,WAC/B,UAAU,MAAM,aAAa,gBAC/B;AAED,KAAI,sBAAsB,MAAM,CAAC,QAAQ,mBAAmB,MAAM,KAChE,QAAO;AAKT,QAAO,QACJ,MAAM,GAAG,oBAAoB,EAAE,CAC/B,QAAsB,KAAK,UAAU;EACpC,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK,QAAQ,mBAAmB;GAAU;IACxD,KAAK;;AAGZ,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;CAC/B,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,2BAA0B,gBAAgB,aAAa;AAGzD,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,2BAA0B,gBAAgB,aAAa;GAEzD"}
1
+ {"version":3,"file":"listenToRouterChanges.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page/manager/types';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * matchRoutes already scopes `matches` to the given pathname, ordered from\n * the root route to the deepest one, so the full pattern is built by\n * reducing over all of them. Pathless layout and index routes contribute no\n * `route.path` of their own, so they're skipped.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n return matches.reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: currentPathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n page.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n page.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;AACjB,QAAO,QAAQ,QAAsB,KAAK,UAAU;EAClD,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK;GAAiB;IACpC,KAAK;;AAGV,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;AACGA,wEAAAA,8BACT,CAAC,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,0BAAA,KAAK,gBAAgB,aAAa;AAGpC,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,0BAAA,KAAK,gBAAgB,aAAa;GAEpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"listenToRouterChanges.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"mappings":";;;cA6Ca,qBAAA;EAAyB,MAAA;EAAA,aAAA;EAAA,MAAA;IAAA;EAAA;AAAA,GAInC,yBAAA"}
1
+ {"version":3,"file":"listenToRouterChanges.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"mappings":";;;cAiCa,qBAAA;EAAyB,MAAA;EAAA,aAAA;EAAA,MAAA;IAAA;EAAA;AAAA,GAInC,yBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listenToRouterChanges.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"mappings":";;;cA6Ca,qBAAA;EAAyB,MAAA;EAAA,aAAA;EAAA,MAAA;IAAA;EAAA;AAAA,GAInC,yBAAA"}
1
+ {"version":3,"file":"listenToRouterChanges.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"mappings":";;;cAiCa,qBAAA;EAAyB,MAAA;EAAA,aAAA;EAAA,MAAA;IAAA;EAAA;AAAA,GAInC,yBAAA"}
@@ -1,34 +1,31 @@
1
+ import { page } from "../../../../../api-page/pageAPI.js";
1
2
  import "../../../../../constants/attributes.js";
2
3
  import { getNavigationInstrumentation } from "../../instance.js";
3
4
  //#region src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts
4
5
  /**
5
- * GetRouteFromMatches goes through all the matches routes to build the full path
6
- * nested routes contain only the partial match, so we need to go through all of them
7
- * in order to build the full path.
8
- *
9
- * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.
6
+ * matchRoutes already scopes `matches` to the given pathname, ordered from
7
+ * the root route to the deepest one, so the full pattern is built by
8
+ * reducing over all of them. Pathless layout and index routes contribute no
9
+ * `route.path` of their own, so they're skipped.
10
10
  */
11
11
  const getRouteFromMatches = (matches, currentPathname) => {
12
- const currentMatchIndex = matches.findIndex((match) => match.pathname === currentPathname);
13
- if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) return null;
14
- return matches.slice(0, currentMatchIndex + 1).reduce((acc, match) => {
12
+ return matches.reduce((acc, match) => {
15
13
  const routePath = match.route.path;
16
14
  if (!routePath) return acc;
17
15
  return {
18
16
  path: routePath.startsWith("/") ? routePath : `${acc?.path ?? ""}/${routePath}`,
19
- url: matches[currentMatchIndex].pathname
17
+ url: currentPathname
20
18
  };
21
19
  }, null);
22
20
  };
23
21
  const listenToRouterChanges = ({ router, routesMatcher, config: { pathnameDocument = window.location } = {} }) => {
24
- const navigationInstrumentation = getNavigationInstrumentation();
25
- navigationInstrumentation.setInstrumentationType("react_router_data");
22
+ getNavigationInstrumentation().setInstrumentationType("react_router_data");
26
23
  const initialMatches = routesMatcher(router.routes, { pathname: pathnameDocument.pathname });
27
24
  const initialRoute = initialMatches ? getRouteFromMatches(initialMatches, pathnameDocument.pathname) : null;
28
- if (initialRoute) navigationInstrumentation.setCurrentRoute(initialRoute);
25
+ if (initialRoute) page.setCurrentRoute(initialRoute);
29
26
  return router.subscribe((state) => {
30
27
  const currentRoute = getRouteFromMatches(state.matches, state.location.pathname);
31
- if (currentRoute) navigationInstrumentation.setCurrentRoute(currentRoute);
28
+ if (currentRoute) page.setCurrentRoute(currentRoute);
32
29
  });
33
30
  };
34
31
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"listenToRouterChanges.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page/manager/types';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * GetRouteFromMatches goes through all the matches routes to build the full path\n * nested routes contain only the partial match, so we need to go through all of them\n * in order to build the full path.\n *\n * Filtering by currentPathname ensures that we only consider routes that are relevant to the current URL.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n const currentMatchIndex = matches.findIndex(\n (match) => match.pathname === currentPathname,\n );\n\n if (currentMatchIndex === -1 || !matches[currentMatchIndex].route.path) {\n return null;\n }\n\n // Build full absolute path by reducing all matches up to the current one.\n // Absolute child paths reset the accumulation; relative paths are appended.\n return matches\n .slice(0, currentMatchIndex + 1)\n .reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: matches[currentMatchIndex].pathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n navigationInstrumentation.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n navigationInstrumentation.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;CACjB,MAAM,oBAAoB,QAAQ,WAC/B,UAAU,MAAM,aAAa,gBAC/B;AAED,KAAI,sBAAsB,MAAM,CAAC,QAAQ,mBAAmB,MAAM,KAChE,QAAO;AAKT,QAAO,QACJ,MAAM,GAAG,oBAAoB,EAAE,CAC/B,QAAsB,KAAK,UAAU;EACpC,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK,QAAQ,mBAAmB;GAAU;IACxD,KAAK;;AAGZ,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;CAC/B,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,2BAA0B,gBAAgB,aAAa;AAGzD,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,2BAA0B,gBAAgB,aAAa;GAEzD"}
1
+ {"version":3,"file":"listenToRouterChanges.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Data/listenToRouterChanges.ts"],"sourcesContent":["import type { Route } from '../../../../../api-page/manager/types';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { ListenToRouterChangesArgs, Match } from './types';\n\n/**\n * matchRoutes already scopes `matches` to the given pathname, ordered from\n * the root route to the deepest one, so the full pattern is built by\n * reducing over all of them. Pathless layout and index routes contribute no\n * `route.path` of their own, so they're skipped.\n */\nconst getRouteFromMatches = (\n matches: Match[],\n currentPathname: string,\n): Route | null => {\n return matches.reduce<Route | null>((acc, match) => {\n const routePath = match.route.path;\n\n if (!routePath) {\n return acc;\n }\n\n // If the route path starts with '/', it's an absolute path and should reset the accumulated path.\n // Otherwise, it's a relative path and should be appended to the accumulated path.\n const path = routePath.startsWith('/')\n ? routePath\n : `${acc?.path ?? ''}/${routePath}`;\n\n return { path, url: currentPathname };\n }, null);\n};\n\nexport const listenToRouterChanges = ({\n router,\n routesMatcher,\n config: { pathnameDocument = window.location } = {},\n}: ListenToRouterChangesArgs) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Data,\n );\n\n const initialMatches = routesMatcher(router.routes, {\n pathname: pathnameDocument.pathname,\n });\n\n const initialRoute = initialMatches\n ? getRouteFromMatches(initialMatches, pathnameDocument.pathname)\n : null;\n\n if (initialRoute) {\n page.setCurrentRoute(initialRoute);\n }\n\n return router.subscribe((state) => {\n // State has a list of already matched routes\n // https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/router/router.ts#L954\n const currentRoute = getRouteFromMatches(\n state.matches,\n state.location.pathname,\n );\n\n if (currentRoute) {\n page.setCurrentRoute(currentRoute);\n }\n });\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,uBACJ,SACA,oBACiB;AACjB,QAAO,QAAQ,QAAsB,KAAK,UAAU;EAClD,MAAM,YAAY,MAAM,MAAM;AAE9B,MAAI,CAAC,UACH,QAAO;AAST,SAAO;GAAE,MAJI,UAAU,WAAW,IAAI,GAClC,YACA,GAAG,KAAK,QAAQ,GAAG,GAAG;GAEX,KAAK;GAAiB;IACpC,KAAK;;AAGV,MAAa,yBAAyB,EACpC,QACA,eACA,QAAQ,EAAE,mBAAmB,OAAO,aAAa,EAAE,OACpB;AACG,+BACT,CAAC,uBAAA,oBAEzB;CAED,MAAM,iBAAiB,cAAc,OAAO,QAAQ,EAClD,UAAU,iBAAiB,UAC5B,CAAC;CAEF,MAAM,eAAe,iBACjB,oBAAoB,gBAAgB,iBAAiB,SAAS,GAC9D;AAEJ,KAAI,aACF,MAAK,gBAAgB,aAAa;AAGpC,QAAO,OAAO,WAAW,UAAU;EAGjC,MAAM,eAAe,oBACnB,MAAM,SACN,MAAM,SAAS,SAChB;AAED,MAAI,aACF,MAAK,gBAAgB,aAAa;GAEpC"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
3
+ const require_api_page_pageAPI = require("../../../../../api-page/pageAPI.cjs");
3
4
  require("../../../../../constants/attributes.cjs");
4
5
  const require_instrumentations_navigation_NavigationInstrumentation_instance = require("../../instance.cjs");
5
6
  const require_hoist_non_react_statics_cjs$1 = require("../../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.cjs");
@@ -9,7 +10,11 @@ var import_hoist_non_react_statics_cjs = /* @__PURE__ */ require_runtime.__toESM
9
10
  const getLastRoute = (matchedComponent, lastRoute) => {
10
11
  if (!matchedComponent.props.match?.route) return null;
11
12
  const childPath = matchedComponent.props.match.route.path;
12
- const path = lastRoute && !childPath.startsWith("/") ? `${lastRoute.path}/${childPath}` : childPath;
13
+ if (!childPath) {
14
+ if (matchedComponent.props.routeContext?.outlet) return getLastRoute(matchedComponent.props.routeContext.outlet, lastRoute);
15
+ return lastRoute;
16
+ }
17
+ const path = lastRoute?.path && !childPath.startsWith("/") ? `${lastRoute.path}/${childPath}` : childPath;
13
18
  if (matchedComponent.props.routeContext?.outlet) return getLastRoute(matchedComponent.props.routeContext.outlet, {
14
19
  path,
15
20
  url: matchedComponent.props.match.pathname
@@ -20,8 +25,7 @@ const getLastRoute = (matchedComponent, lastRoute) => {
20
25
  };
21
26
  };
22
27
  const withMXLRouting = (WrappedComponent) => {
23
- const navigationInstrumentation = require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation();
24
- navigationInstrumentation.setInstrumentationType("react_router_declarative");
28
+ require_instrumentations_navigation_NavigationInstrumentation_instance.getNavigationInstrumentation().setInstrumentationType("react_router_declarative");
25
29
  const RoutesWithMXLRouting = (props) => {
26
30
  /**
27
31
  * React-router v6+ implementation is very different from v5
@@ -37,7 +41,7 @@ const withMXLRouting = (WrappedComponent) => {
37
41
  const matchedComponent = WrappedComponent(props);
38
42
  if (matchedComponent.props.match?.route) {
39
43
  const lastRoute = getLastRoute(matchedComponent, null);
40
- if (lastRoute) navigationInstrumentation.setCurrentRoute(lastRoute);
44
+ if (lastRoute) require_api_page_pageAPI.page.setCurrentRoute(lastRoute);
41
45
  }
42
46
  return (0, react.createElement)(WrappedComponent, props);
43
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRouting.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page/manager/types';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n const path =\n lastRoute && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n navigationInstrumentation.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;;;;AASA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;CACrD,MAAM,OACJ,aAAa,CAAC,UAAU,WAAW,IAAI,GACnC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;CACH,MAAM,4BAA4BA,uEAAAA,8BAA8B;AAChE,2BAA0B,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,2BAA0B,gBAAgB,UAAU;;AAIxD,UAAA,GAAA,MAAA,eAAwB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,EAAA,GAAA,mCAAA,SAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}
1
+ {"version":3,"file":"withMXLRouting.cjs","names":["getNavigationInstrumentation"],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page/manager/types';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n if (!childPath) {\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(\n matchedComponent.props.routeContext.outlet,\n lastRoute,\n );\n }\n return lastRoute;\n }\n\n const path =\n lastRoute?.path && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n page.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;AACrD,KAAI,CAAC,WAAW;AACd,MAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aACL,iBAAiB,MAAM,aAAa,QACpC,UACD;AAEH,SAAO;;CAGT,MAAM,OACJ,WAAW,QAAQ,CAAC,UAAU,WAAW,IAAI,GACzC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;AAC+BA,wEAAAA,8BACT,CAAC,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,0BAAA,KAAK,gBAAgB,UAAU;;AAInC,UAAA,GAAA,MAAA,eAAwB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,EAAA,GAAA,mCAAA,SAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRouting.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"mappings":";;;cAoCa,cAAA,qBACX,gBAAA,EAAkB,KAAA,CAAM,iBAAA,CAAkB,CAAA,MAAE,KAAA,CAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"withMXLRouting.d.cts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"mappings":";;;cA+Ca,cAAA,qBACX,gBAAA,EAAkB,KAAA,CAAM,iBAAA,CAAkB,CAAA,MAAE,KAAA,CAAA,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRouting.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"mappings":";;;cAoCa,cAAA,qBACX,gBAAA,EAAkB,KAAA,CAAM,iBAAA,CAAkB,CAAA,MAAE,KAAA,CAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"withMXLRouting.d.ts","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"mappings":";;;cA+Ca,cAAA,qBACX,gBAAA,EAAkB,KAAA,CAAM,iBAAA,CAAkB,CAAA,MAAE,KAAA,CAAA,EAAA,CAAA,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { __toESM } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ import { page } from "../../../../../api-page/pageAPI.js";
2
3
  import "../../../../../constants/attributes.js";
3
4
  import { getNavigationInstrumentation } from "../../instance.js";
4
5
  import { require_hoist_non_react_statics_cjs } from "../../../../../node_modules/.pnpm/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js";
@@ -8,7 +9,11 @@ var import_hoist_non_react_statics_cjs = /* @__PURE__ */ __toESM(require_hoist_n
8
9
  const getLastRoute = (matchedComponent, lastRoute) => {
9
10
  if (!matchedComponent.props.match?.route) return null;
10
11
  const childPath = matchedComponent.props.match.route.path;
11
- const path = lastRoute && !childPath.startsWith("/") ? `${lastRoute.path}/${childPath}` : childPath;
12
+ if (!childPath) {
13
+ if (matchedComponent.props.routeContext?.outlet) return getLastRoute(matchedComponent.props.routeContext.outlet, lastRoute);
14
+ return lastRoute;
15
+ }
16
+ const path = lastRoute?.path && !childPath.startsWith("/") ? `${lastRoute.path}/${childPath}` : childPath;
12
17
  if (matchedComponent.props.routeContext?.outlet) return getLastRoute(matchedComponent.props.routeContext.outlet, {
13
18
  path,
14
19
  url: matchedComponent.props.match.pathname
@@ -19,8 +24,7 @@ const getLastRoute = (matchedComponent, lastRoute) => {
19
24
  };
20
25
  };
21
26
  const withMXLRouting = (WrappedComponent) => {
22
- const navigationInstrumentation = getNavigationInstrumentation();
23
- navigationInstrumentation.setInstrumentationType("react_router_declarative");
27
+ getNavigationInstrumentation().setInstrumentationType("react_router_declarative");
24
28
  const RoutesWithMXLRouting = (props) => {
25
29
  /**
26
30
  * React-router v6+ implementation is very different from v5
@@ -36,7 +40,7 @@ const withMXLRouting = (WrappedComponent) => {
36
40
  const matchedComponent = WrappedComponent(props);
37
41
  if (matchedComponent.props.match?.route) {
38
42
  const lastRoute = getLastRoute(matchedComponent, null);
39
- if (lastRoute) navigationInstrumentation.setCurrentRoute(lastRoute);
43
+ if (lastRoute) page.setCurrentRoute(lastRoute);
40
44
  }
41
45
  return createElement(WrappedComponent, props);
42
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withMXLRouting.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page/manager/types';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n const path =\n lastRoute && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n navigationInstrumentation.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;;;AASA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;CACrD,MAAM,OACJ,aAAa,CAAC,UAAU,WAAW,IAAI,GACnC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;CACH,MAAM,4BAA4B,8BAA8B;AAChE,2BAA0B,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,2BAA0B,gBAAgB,UAAU;;AAIxD,SAAO,cAAiB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,EAAA,GAAA,mCAAA,SAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}
1
+ {"version":3,"file":"withMXLRouting.js","names":[],"sources":["../../../../../../src/instrumentations/navigation/NavigationInstrumentation/react/reactRouterV6Declarative/withMXLRouting.ts"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport type React from 'react';\nimport { createElement } from 'react';\nimport type { Route } from '../../../../../api-page/manager/types';\nimport { page } from '../../../../../api-page/pageAPI';\nimport { MXL_NAVIGATION_INSTRUMENTATIONS } from '../../../../../constants/attributes';\nimport { getNavigationInstrumentation } from '../../instance';\nimport type { RoutesFunctionalComponentReturn } from './types';\n\n// Routes can be nested, we need to traverse the routeContext to find the last route\nconst getLastRoute = (\n matchedComponent: RoutesFunctionalComponentReturn,\n lastRoute: Route | null,\n): Route | null => {\n if (!matchedComponent.props.match?.route) {\n return null;\n }\n\n const childPath = matchedComponent.props.match.route.path;\n if (!childPath) {\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(\n matchedComponent.props.routeContext.outlet,\n lastRoute,\n );\n }\n return lastRoute;\n }\n\n const path =\n lastRoute?.path && !childPath.startsWith('/')\n ? `${lastRoute.path}/${childPath}`\n : childPath;\n\n if (matchedComponent.props.routeContext?.outlet) {\n return getLastRoute(matchedComponent.props.routeContext.outlet, {\n path,\n url: matchedComponent.props.match.pathname,\n });\n }\n\n return {\n path,\n url: matchedComponent.props.match.pathname,\n };\n};\n\nexport const withMXLRouting = <P extends object>(\n WrappedComponent: React.FunctionComponent<P>,\n) => {\n const navigationInstrumentation = getNavigationInstrumentation();\n navigationInstrumentation.setInstrumentationType(\n MXL_NAVIGATION_INSTRUMENTATIONS.Declarative,\n );\n\n const RoutesWithMXLRouting: React.FC<P> = (props: P) => {\n /**\n * React-router v6+ implementation is very different from v5\n * It doesn't have a <Switch> component that injects props into <Route>\n * Instead, it has <Routes> which internally calculates the matched route\n * and returns it as a children, <Route> cannot be wrapped since it requires all children to be a <Route> component\n * here we rely on that matching to get the current route.\n * It's not ideal to rely on internal implementation details, but it's the easier way of getting the current route\n * without having to manually match it or using hooks on each children component\n *\n * See: https://github.com/remix-run/react-router/blob/main/packages/react-router/lib/hooks.tsx#L553\n */\n const matchedComponent = WrappedComponent(\n props,\n ) as unknown as RoutesFunctionalComponentReturn;\n\n if (matchedComponent.props.match?.route) {\n const lastRoute = getLastRoute(matchedComponent, null);\n if (lastRoute) {\n page.setCurrentRoute(lastRoute);\n }\n }\n\n return createElement<P>(WrappedComponent, props);\n };\n\n // Keep wrapped component metadata\n RoutesWithMXLRouting.displayName = `withMXLRouting(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;\n hoistNonReactStatics(RoutesWithMXLRouting, WrappedComponent);\n\n return RoutesWithMXLRouting;\n};\n"],"mappings":";;;;;;;;AAUA,MAAM,gBACJ,kBACA,cACiB;AACjB,KAAI,CAAC,iBAAiB,MAAM,OAAO,MACjC,QAAO;CAGT,MAAM,YAAY,iBAAiB,MAAM,MAAM,MAAM;AACrD,KAAI,CAAC,WAAW;AACd,MAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aACL,iBAAiB,MAAM,aAAa,QACpC,UACD;AAEH,SAAO;;CAGT,MAAM,OACJ,WAAW,QAAQ,CAAC,UAAU,WAAW,IAAI,GACzC,GAAG,UAAU,KAAK,GAAG,cACrB;AAEN,KAAI,iBAAiB,MAAM,cAAc,OACvC,QAAO,aAAa,iBAAiB,MAAM,aAAa,QAAQ;EAC9D;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC,CAAC;AAGJ,QAAO;EACL;EACA,KAAK,iBAAiB,MAAM,MAAM;EACnC;;AAGH,MAAa,kBACX,qBACG;AAC+B,+BACT,CAAC,uBAAA,2BAEzB;CAED,MAAM,wBAAqC,UAAa;;;;;;;;;;;;EAYtD,MAAM,mBAAmB,iBACvB,MACD;AAED,MAAI,iBAAiB,MAAM,OAAO,OAAO;GACvC,MAAM,YAAY,aAAa,kBAAkB,KAAK;AACtD,OAAI,UACF,MAAK,gBAAgB,UAAU;;AAInC,SAAO,cAAiB,kBAAkB,MAAM;;AAIlD,sBAAqB,cAAc,kBAAkB,iBAAiB,eAAe,iBAAiB,QAAQ,YAAY;AAC1H,EAAA,GAAA,mCAAA,SAAqB,sBAAsB,iBAAiB;AAE5D,QAAO"}