@kubesense/kubesense-browser-rum-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (689) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/cjs/boot/preStartRum.d.ts +7 -0
  4. package/cjs/boot/preStartRum.js +190 -0
  5. package/cjs/boot/preStartRum.js.map +1 -0
  6. package/cjs/boot/rumPublicApi.d.ts +409 -0
  7. package/cjs/boot/rumPublicApi.js +168 -0
  8. package/cjs/boot/rumPublicApi.js.map +1 -0
  9. package/cjs/boot/startRum.d.ts +109 -0
  10. package/cjs/boot/startRum.js +153 -0
  11. package/cjs/boot/startRum.js.map +1 -0
  12. package/cjs/browser/cookieObservable.d.ts +8 -0
  13. package/cjs/browser/cookieObservable.js +39 -0
  14. package/cjs/browser/cookieObservable.js.map +1 -0
  15. package/cjs/browser/domMutationObservable.d.ts +27 -0
  16. package/cjs/browser/domMutationObservable.js +58 -0
  17. package/cjs/browser/domMutationObservable.js.map +1 -0
  18. package/cjs/browser/firstInputPolyfill.d.ts +8 -0
  19. package/cjs/browser/firstInputPolyfill.js +68 -0
  20. package/cjs/browser/firstInputPolyfill.js.map +1 -0
  21. package/cjs/browser/htmlDomUtils.d.ts +13 -0
  22. package/cjs/browser/htmlDomUtils.js +46 -0
  23. package/cjs/browser/htmlDomUtils.js.map +1 -0
  24. package/cjs/browser/locationChangeObservable.d.ts +7 -0
  25. package/cjs/browser/locationChangeObservable.js +51 -0
  26. package/cjs/browser/locationChangeObservable.js.map +1 -0
  27. package/cjs/browser/performanceObservable.d.ts +174 -0
  28. package/cjs/browser/performanceObservable.js +126 -0
  29. package/cjs/browser/performanceObservable.js.map +1 -0
  30. package/cjs/browser/performanceUtils.d.ts +7 -0
  31. package/cjs/browser/performanceUtils.js +42 -0
  32. package/cjs/browser/performanceUtils.js.map +1 -0
  33. package/cjs/browser/scroll.d.ts +2 -0
  34. package/cjs/browser/scroll.js +33 -0
  35. package/cjs/browser/scroll.js.map +1 -0
  36. package/cjs/browser/viewportObservable.d.ts +10 -0
  37. package/cjs/browser/viewportObservable.js +37 -0
  38. package/cjs/browser/viewportObservable.js.map +1 -0
  39. package/cjs/browser/windowOpenObservable.d.ts +5 -0
  40. package/cjs/browser/windowOpenObservable.js +10 -0
  41. package/cjs/browser/windowOpenObservable.js.map +1 -0
  42. package/cjs/domain/action/actionCollection.d.ts +21 -0
  43. package/cjs/domain/action/actionCollection.js +96 -0
  44. package/cjs/domain/action/actionCollection.js.map +1 -0
  45. package/cjs/domain/action/actionNameConstants.d.ts +18 -0
  46. package/cjs/domain/action/actionNameConstants.js +11 -0
  47. package/cjs/domain/action/actionNameConstants.js.map +1 -0
  48. package/cjs/domain/action/clickChain.d.ts +8 -0
  49. package/cjs/domain/action/clickChain.js +61 -0
  50. package/cjs/domain/action/clickChain.js.map +1 -0
  51. package/cjs/domain/action/computeFrustration.d.ts +6 -0
  52. package/cjs/domain/action/computeFrustration.js +70 -0
  53. package/cjs/domain/action/computeFrustration.js.map +1 -0
  54. package/cjs/domain/action/getActionNameFromElement.d.ts +4 -0
  55. package/cjs/domain/action/getActionNameFromElement.js +239 -0
  56. package/cjs/domain/action/getActionNameFromElement.js.map +1 -0
  57. package/cjs/domain/action/interactionSelectorCache.d.ts +5 -0
  58. package/cjs/domain/action/interactionSelectorCache.js +23 -0
  59. package/cjs/domain/action/interactionSelectorCache.js.map +1 -0
  60. package/cjs/domain/action/listenActionEvents.d.ts +19 -0
  61. package/cjs/domain/action/listenActionEvents.js +61 -0
  62. package/cjs/domain/action/listenActionEvents.js.map +1 -0
  63. package/cjs/domain/action/trackClickActions.d.ts +81 -0
  64. package/cjs/domain/action/trackClickActions.js +237 -0
  65. package/cjs/domain/action/trackClickActions.js.map +1 -0
  66. package/cjs/domain/assembly.d.ts +5 -0
  67. package/cjs/domain/assembly.js +102 -0
  68. package/cjs/domain/assembly.js.map +1 -0
  69. package/cjs/domain/configuration/configuration.d.ts +325 -0
  70. package/cjs/domain/configuration/configuration.js +205 -0
  71. package/cjs/domain/configuration/configuration.js.map +1 -0
  72. package/cjs/domain/configuration/index.d.ts +2 -0
  73. package/cjs/domain/configuration/index.js +19 -0
  74. package/cjs/domain/configuration/index.js.map +1 -0
  75. package/cjs/domain/configuration/jsonPathParser.d.ts +28 -0
  76. package/cjs/domain/configuration/jsonPathParser.js +159 -0
  77. package/cjs/domain/configuration/jsonPathParser.js.map +1 -0
  78. package/cjs/domain/configuration/remoteConfiguration.d.ts +39 -0
  79. package/cjs/domain/configuration/remoteConfiguration.js +243 -0
  80. package/cjs/domain/configuration/remoteConfiguration.js.map +1 -0
  81. package/cjs/domain/configuration/remoteConfiguration.types.d.ts +138 -0
  82. package/cjs/domain/configuration/remoteConfiguration.types.js +7 -0
  83. package/cjs/domain/configuration/remoteConfiguration.types.js.map +1 -0
  84. package/cjs/domain/contexts/ciVisibilityContext.d.ts +12 -0
  85. package/cjs/domain/contexts/ciVisibilityContext.js +34 -0
  86. package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -0
  87. package/cjs/domain/contexts/connectivityContext.d.ts +2 -0
  88. package/cjs/domain/contexts/connectivityContext.js +11 -0
  89. package/cjs/domain/contexts/connectivityContext.js.map +1 -0
  90. package/cjs/domain/contexts/defaultContext.d.ts +4 -0
  91. package/cjs/domain/contexts/defaultContext.js +34 -0
  92. package/cjs/domain/contexts/defaultContext.js.map +1 -0
  93. package/cjs/domain/contexts/displayContext.d.ts +6 -0
  94. package/cjs/domain/contexts/displayContext.js +28 -0
  95. package/cjs/domain/contexts/displayContext.js.map +1 -0
  96. package/cjs/domain/contexts/featureFlagContext.d.ts +19 -0
  97. package/cjs/domain/contexts/featureFlagContext.js +53 -0
  98. package/cjs/domain/contexts/featureFlagContext.js.map +1 -0
  99. package/cjs/domain/contexts/internalContext.d.ts +12 -0
  100. package/cjs/domain/contexts/internalContext.js +26 -0
  101. package/cjs/domain/contexts/internalContext.js.map +1 -0
  102. package/cjs/domain/contexts/pageStateHistory.d.ts +23 -0
  103. package/cjs/domain/contexts/pageStateHistory.js +104 -0
  104. package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
  105. package/cjs/domain/contexts/sessionContext.d.ts +5 -0
  106. package/cjs/domain/contexts/sessionContext.js +47 -0
  107. package/cjs/domain/contexts/sessionContext.js.map +1 -0
  108. package/cjs/domain/contexts/syntheticsContext.d.ts +2 -0
  109. package/cjs/domain/contexts/syntheticsContext.js +25 -0
  110. package/cjs/domain/contexts/syntheticsContext.js.map +1 -0
  111. package/cjs/domain/contexts/trackingConsentContext.d.ts +3 -0
  112. package/cjs/domain/contexts/trackingConsentContext.js +14 -0
  113. package/cjs/domain/contexts/trackingConsentContext.js.map +1 -0
  114. package/cjs/domain/contexts/urlContexts.d.ts +22 -0
  115. package/cjs/domain/contexts/urlContexts.js +64 -0
  116. package/cjs/domain/contexts/urlContexts.js.map +1 -0
  117. package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -0
  118. package/cjs/domain/contexts/userAgentDataContext.js +31 -0
  119. package/cjs/domain/contexts/userAgentDataContext.js.map +1 -0
  120. package/cjs/domain/contexts/viewHistory.d.ts +17 -0
  121. package/cjs/domain/contexts/viewHistory.js +48 -0
  122. package/cjs/domain/contexts/viewHistory.js.map +1 -0
  123. package/cjs/domain/discardNegativeDuration.d.ts +2 -0
  124. package/cjs/domain/discardNegativeDuration.js +8 -0
  125. package/cjs/domain/discardNegativeDuration.js.map +1 -0
  126. package/cjs/domain/error/errorCollection.d.ts +17 -0
  127. package/cjs/domain/error/errorCollection.js +74 -0
  128. package/cjs/domain/error/errorCollection.js.map +1 -0
  129. package/cjs/domain/error/trackConsoleError.d.ts +4 -0
  130. package/cjs/domain/error/trackConsoleError.js +13 -0
  131. package/cjs/domain/error/trackConsoleError.js.map +1 -0
  132. package/cjs/domain/error/trackReportError.d.ts +5 -0
  133. package/cjs/domain/error/trackReportError.js +16 -0
  134. package/cjs/domain/error/trackReportError.js.map +1 -0
  135. package/cjs/domain/event/eventCollection.d.ts +10 -0
  136. package/cjs/domain/event/eventCollection.js +27 -0
  137. package/cjs/domain/event/eventCollection.js.map +1 -0
  138. package/cjs/domain/getSelectorFromElement.d.ts +64 -0
  139. package/cjs/domain/getSelectorFromElement.js +218 -0
  140. package/cjs/domain/getSelectorFromElement.js.map +1 -0
  141. package/cjs/domain/getSessionReplayUrl.d.ts +9 -0
  142. package/cjs/domain/getSessionReplayUrl.js +34 -0
  143. package/cjs/domain/getSessionReplayUrl.js.map +1 -0
  144. package/cjs/domain/hooks.d.ts +23 -0
  145. package/cjs/domain/hooks.js +6 -0
  146. package/cjs/domain/hooks.js.map +1 -0
  147. package/cjs/domain/lifeCycle.d.ts +73 -0
  148. package/cjs/domain/lifeCycle.js +6 -0
  149. package/cjs/domain/lifeCycle.js.map +1 -0
  150. package/cjs/domain/limitModification.d.ts +8 -0
  151. package/cjs/domain/limitModification.js +46 -0
  152. package/cjs/domain/limitModification.js.map +1 -0
  153. package/cjs/domain/longTask/longTaskCollection.d.ts +18 -0
  154. package/cjs/domain/longTask/longTaskCollection.js +91 -0
  155. package/cjs/domain/longTask/longTaskCollection.js.map +1 -0
  156. package/cjs/domain/plugins.d.ts +40 -0
  157. package/cjs/domain/plugins.js +15 -0
  158. package/cjs/domain/plugins.js.map +1 -0
  159. package/cjs/domain/privacy.d.ts +44 -0
  160. package/cjs/domain/privacy.js +313 -0
  161. package/cjs/domain/privacy.js.map +1 -0
  162. package/cjs/domain/privacyConstants.d.ts +23 -0
  163. package/cjs/domain/privacyConstants.js +39 -0
  164. package/cjs/domain/privacyConstants.js.map +1 -0
  165. package/cjs/domain/requestCollection.d.ts +54 -0
  166. package/cjs/domain/requestCollection.js +111 -0
  167. package/cjs/domain/requestCollection.js.map +1 -0
  168. package/cjs/domain/resource/graphql.d.ts +23 -0
  169. package/cjs/domain/resource/graphql.js +97 -0
  170. package/cjs/domain/resource/graphql.js.map +1 -0
  171. package/cjs/domain/resource/matchRequestResourceEntry.d.ts +16 -0
  172. package/cjs/domain/resource/matchRequestResourceEntry.js +49 -0
  173. package/cjs/domain/resource/matchRequestResourceEntry.js.map +1 -0
  174. package/cjs/domain/resource/requestRegistry.d.ts +9 -0
  175. package/cjs/domain/resource/requestRegistry.js +41 -0
  176. package/cjs/domain/resource/requestRegistry.js.map +1 -0
  177. package/cjs/domain/resource/resourceCollection.d.ts +7 -0
  178. package/cjs/domain/resource/resourceCollection.js +190 -0
  179. package/cjs/domain/resource/resourceCollection.js.map +1 -0
  180. package/cjs/domain/resource/resourceUtils.d.ts +55 -0
  181. package/cjs/domain/resource/resourceUtils.js +259 -0
  182. package/cjs/domain/resource/resourceUtils.js.map +1 -0
  183. package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
  184. package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +24 -0
  185. package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
  186. package/cjs/domain/rumSessionManager.d.ts +36 -0
  187. package/cjs/domain/rumSessionManager.js +77 -0
  188. package/cjs/domain/rumSessionManager.js.map +1 -0
  189. package/cjs/domain/sampler/sampler.d.ts +10 -0
  190. package/cjs/domain/sampler/sampler.js +63 -0
  191. package/cjs/domain/sampler/sampler.js.map +1 -0
  192. package/cjs/domain/startCustomerDataTelemetry.d.ts +4 -0
  193. package/cjs/domain/startCustomerDataTelemetry.js +56 -0
  194. package/cjs/domain/startCustomerDataTelemetry.js.map +1 -0
  195. package/cjs/domain/tracing/getDocumentTraceId.d.ts +12 -0
  196. package/cjs/domain/tracing/getDocumentTraceId.js +76 -0
  197. package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
  198. package/cjs/domain/tracing/identifier.d.ts +13 -0
  199. package/cjs/domain/tracing/identifier.js +55 -0
  200. package/cjs/domain/tracing/identifier.js.map +1 -0
  201. package/cjs/domain/tracing/sampler.d.ts +10 -0
  202. package/cjs/domain/tracing/sampler.js +69 -0
  203. package/cjs/domain/tracing/sampler.js.map +1 -0
  204. package/cjs/domain/tracing/tracer.d.ts +30 -0
  205. package/cjs/domain/tracing/tracer.js +161 -0
  206. package/cjs/domain/tracing/tracer.js.map +1 -0
  207. package/cjs/domain/tracing/tracer.types.d.ts +12 -0
  208. package/cjs/domain/tracing/tracer.types.js +3 -0
  209. package/cjs/domain/tracing/tracer.types.js.map +1 -0
  210. package/cjs/domain/trackEventCounts.d.ts +17 -0
  211. package/cjs/domain/trackEventCounts.js +50 -0
  212. package/cjs/domain/trackEventCounts.js.map +1 -0
  213. package/cjs/domain/view/bfCacheSupport.d.ts +2 -0
  214. package/cjs/domain/view/bfCacheSupport.js +13 -0
  215. package/cjs/domain/view/bfCacheSupport.js.map +1 -0
  216. package/cjs/domain/view/trackViewEventCounts.d.ts +5 -0
  217. package/cjs/domain/view/trackViewEventCounts.js +16 -0
  218. package/cjs/domain/view/trackViewEventCounts.js.map +1 -0
  219. package/cjs/domain/view/trackViews.d.ts +65 -0
  220. package/cjs/domain/view/trackViews.js +275 -0
  221. package/cjs/domain/view/trackViews.js.map +1 -0
  222. package/cjs/domain/view/viewCollection.d.ts +18 -0
  223. package/cjs/domain/view/viewCollection.js +153 -0
  224. package/cjs/domain/view/viewCollection.js.map +1 -0
  225. package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
  226. package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +32 -0
  227. package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
  228. package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
  229. package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +44 -0
  230. package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
  231. package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
  232. package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +44 -0
  233. package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
  234. package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
  235. package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +17 -0
  236. package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
  237. package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
  238. package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +37 -0
  239. package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
  240. package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
  241. package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +135 -0
  242. package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
  243. package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
  244. package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +39 -0
  245. package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
  246. package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
  247. package/cjs/domain/view/viewMetrics/trackFirstHidden.js +33 -0
  248. package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
  249. package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
  250. package/cjs/domain/view/viewMetrics/trackFirstInput.js +43 -0
  251. package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
  252. package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
  253. package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +41 -0
  254. package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
  255. package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
  256. package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +155 -0
  257. package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
  258. package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
  259. package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +61 -0
  260. package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
  261. package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
  262. package/cjs/domain/view/viewMetrics/trackLoadingTime.js +50 -0
  263. package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
  264. package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
  265. package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +43 -0
  266. package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
  267. package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
  268. package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +78 -0
  269. package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
  270. package/cjs/domain/vital/vitalCollection.d.ts +55 -0
  271. package/cjs/domain/vital/vitalCollection.js +113 -0
  272. package/cjs/domain/vital/vitalCollection.js.map +1 -0
  273. package/cjs/domain/waitPageActivityEnd.d.ts +54 -0
  274. package/cjs/domain/waitPageActivityEnd.js +129 -0
  275. package/cjs/domain/waitPageActivityEnd.js.map +1 -0
  276. package/cjs/domainContext.types.d.ts +39 -0
  277. package/cjs/domainContext.types.js +6 -0
  278. package/cjs/domainContext.types.js.map +1 -0
  279. package/cjs/index.d.ts +41 -0
  280. package/cjs/index.js +59 -0
  281. package/cjs/index.js.map +1 -0
  282. package/cjs/rawRumEvent.types.d.ts +326 -0
  283. package/cjs/rawRumEvent.types.js +34 -0
  284. package/cjs/rawRumEvent.types.js.map +1 -0
  285. package/cjs/rumEvent.types.d.ts +2026 -0
  286. package/cjs/rumEvent.types.js +7 -0
  287. package/cjs/rumEvent.types.js.map +1 -0
  288. package/cjs/transport/formDataTransport.d.ts +16 -0
  289. package/cjs/transport/formDataTransport.js +46 -0
  290. package/cjs/transport/formDataTransport.js.map +1 -0
  291. package/cjs/transport/startRumBatch.d.ts +5 -0
  292. package/cjs/transport/startRumBatch.js +33 -0
  293. package/cjs/transport/startRumBatch.js.map +1 -0
  294. package/cjs/transport/startRumEventBridge.d.ts +2 -0
  295. package/cjs/transport/startRumEventBridge.js +11 -0
  296. package/cjs/transport/startRumEventBridge.js.map +1 -0
  297. package/esm/boot/preStartRum.d.ts +7 -0
  298. package/esm/boot/preStartRum.js +187 -0
  299. package/esm/boot/preStartRum.js.map +1 -0
  300. package/esm/boot/rumPublicApi.d.ts +409 -0
  301. package/esm/boot/rumPublicApi.js +165 -0
  302. package/esm/boot/rumPublicApi.js.map +1 -0
  303. package/esm/boot/startRum.d.ts +109 -0
  304. package/esm/boot/startRum.js +149 -0
  305. package/esm/boot/startRum.js.map +1 -0
  306. package/esm/browser/cookieObservable.d.ts +8 -0
  307. package/esm/browser/cookieObservable.js +35 -0
  308. package/esm/browser/cookieObservable.js.map +1 -0
  309. package/esm/browser/domMutationObservable.d.ts +27 -0
  310. package/esm/browser/domMutationObservable.js +54 -0
  311. package/esm/browser/domMutationObservable.js.map +1 -0
  312. package/esm/browser/firstInputPolyfill.d.ts +8 -0
  313. package/esm/browser/firstInputPolyfill.js +65 -0
  314. package/esm/browser/firstInputPolyfill.js.map +1 -0
  315. package/esm/browser/htmlDomUtils.d.ts +13 -0
  316. package/esm/browser/htmlDomUtils.js +36 -0
  317. package/esm/browser/htmlDomUtils.js.map +1 -0
  318. package/esm/browser/locationChangeObservable.d.ts +7 -0
  319. package/esm/browser/locationChangeObservable.js +48 -0
  320. package/esm/browser/locationChangeObservable.js.map +1 -0
  321. package/esm/browser/performanceObservable.d.ts +174 -0
  322. package/esm/browser/performanceObservable.js +121 -0
  323. package/esm/browser/performanceObservable.js.map +1 -0
  324. package/esm/browser/performanceUtils.d.ts +7 -0
  325. package/esm/browser/performanceUtils.js +38 -0
  326. package/esm/browser/performanceUtils.js.map +1 -0
  327. package/esm/browser/scroll.d.ts +2 -0
  328. package/esm/browser/scroll.js +29 -0
  329. package/esm/browser/scroll.js.map +1 -0
  330. package/esm/browser/viewportObservable.d.ts +10 -0
  331. package/esm/browser/viewportObservable.js +32 -0
  332. package/esm/browser/viewportObservable.js.map +1 -0
  333. package/esm/browser/windowOpenObservable.d.ts +5 -0
  334. package/esm/browser/windowOpenObservable.js +7 -0
  335. package/esm/browser/windowOpenObservable.js.map +1 -0
  336. package/esm/domain/action/actionCollection.d.ts +21 -0
  337. package/esm/domain/action/actionCollection.js +93 -0
  338. package/esm/domain/action/actionCollection.js.map +1 -0
  339. package/esm/domain/action/actionNameConstants.d.ts +18 -0
  340. package/esm/domain/action/actionNameConstants.js +8 -0
  341. package/esm/domain/action/actionNameConstants.js.map +1 -0
  342. package/esm/domain/action/clickChain.d.ts +8 -0
  343. package/esm/domain/action/clickChain.js +57 -0
  344. package/esm/domain/action/clickChain.js.map +1 -0
  345. package/esm/domain/action/computeFrustration.d.ts +6 -0
  346. package/esm/domain/action/computeFrustration.js +65 -0
  347. package/esm/domain/action/computeFrustration.js.map +1 -0
  348. package/esm/domain/action/getActionNameFromElement.d.ts +4 -0
  349. package/esm/domain/action/getActionNameFromElement.js +236 -0
  350. package/esm/domain/action/getActionNameFromElement.js.map +1 -0
  351. package/esm/domain/action/interactionSelectorCache.d.ts +5 -0
  352. package/esm/domain/action/interactionSelectorCache.js +18 -0
  353. package/esm/domain/action/interactionSelectorCache.js.map +1 -0
  354. package/esm/domain/action/listenActionEvents.d.ts +19 -0
  355. package/esm/domain/action/listenActionEvents.js +58 -0
  356. package/esm/domain/action/listenActionEvents.js.map +1 -0
  357. package/esm/domain/action/trackClickActions.d.ts +81 -0
  358. package/esm/domain/action/trackClickActions.js +232 -0
  359. package/esm/domain/action/trackClickActions.js.map +1 -0
  360. package/esm/domain/assembly.d.ts +5 -0
  361. package/esm/domain/assembly.js +99 -0
  362. package/esm/domain/assembly.js.map +1 -0
  363. package/esm/domain/configuration/configuration.d.ts +325 -0
  364. package/esm/domain/configuration/configuration.js +200 -0
  365. package/esm/domain/configuration/configuration.js.map +1 -0
  366. package/esm/domain/configuration/index.d.ts +2 -0
  367. package/esm/domain/configuration/index.js +3 -0
  368. package/esm/domain/configuration/index.js.map +1 -0
  369. package/esm/domain/configuration/jsonPathParser.d.ts +28 -0
  370. package/esm/domain/configuration/jsonPathParser.js +156 -0
  371. package/esm/domain/configuration/jsonPathParser.js.map +1 -0
  372. package/esm/domain/configuration/remoteConfiguration.d.ts +39 -0
  373. package/esm/domain/configuration/remoteConfiguration.js +236 -0
  374. package/esm/domain/configuration/remoteConfiguration.js.map +1 -0
  375. package/esm/domain/configuration/remoteConfiguration.types.d.ts +138 -0
  376. package/esm/domain/configuration/remoteConfiguration.types.js +6 -0
  377. package/esm/domain/configuration/remoteConfiguration.types.js.map +1 -0
  378. package/esm/domain/contexts/ciVisibilityContext.d.ts +12 -0
  379. package/esm/domain/contexts/ciVisibilityContext.js +30 -0
  380. package/esm/domain/contexts/ciVisibilityContext.js.map +1 -0
  381. package/esm/domain/contexts/connectivityContext.d.ts +2 -0
  382. package/esm/domain/contexts/connectivityContext.js +8 -0
  383. package/esm/domain/contexts/connectivityContext.js.map +1 -0
  384. package/esm/domain/contexts/defaultContext.d.ts +4 -0
  385. package/esm/domain/contexts/defaultContext.js +31 -0
  386. package/esm/domain/contexts/defaultContext.js.map +1 -0
  387. package/esm/domain/contexts/displayContext.d.ts +6 -0
  388. package/esm/domain/contexts/displayContext.js +25 -0
  389. package/esm/domain/contexts/displayContext.js.map +1 -0
  390. package/esm/domain/contexts/featureFlagContext.d.ts +19 -0
  391. package/esm/domain/contexts/featureFlagContext.js +49 -0
  392. package/esm/domain/contexts/featureFlagContext.js.map +1 -0
  393. package/esm/domain/contexts/internalContext.d.ts +12 -0
  394. package/esm/domain/contexts/internalContext.js +23 -0
  395. package/esm/domain/contexts/internalContext.js.map +1 -0
  396. package/esm/domain/contexts/pageStateHistory.d.ts +23 -0
  397. package/esm/domain/contexts/pageStateHistory.js +100 -0
  398. package/esm/domain/contexts/pageStateHistory.js.map +1 -0
  399. package/esm/domain/contexts/sessionContext.d.ts +5 -0
  400. package/esm/domain/contexts/sessionContext.js +44 -0
  401. package/esm/domain/contexts/sessionContext.js.map +1 -0
  402. package/esm/domain/contexts/syntheticsContext.d.ts +2 -0
  403. package/esm/domain/contexts/syntheticsContext.js +22 -0
  404. package/esm/domain/contexts/syntheticsContext.js.map +1 -0
  405. package/esm/domain/contexts/trackingConsentContext.d.ts +3 -0
  406. package/esm/domain/contexts/trackingConsentContext.js +11 -0
  407. package/esm/domain/contexts/trackingConsentContext.js.map +1 -0
  408. package/esm/domain/contexts/urlContexts.d.ts +22 -0
  409. package/esm/domain/contexts/urlContexts.js +60 -0
  410. package/esm/domain/contexts/urlContexts.js.map +1 -0
  411. package/esm/domain/contexts/userAgentDataContext.d.ts +2 -0
  412. package/esm/domain/contexts/userAgentDataContext.js +28 -0
  413. package/esm/domain/contexts/userAgentDataContext.js.map +1 -0
  414. package/esm/domain/contexts/viewHistory.d.ts +17 -0
  415. package/esm/domain/contexts/viewHistory.js +44 -0
  416. package/esm/domain/contexts/viewHistory.js.map +1 -0
  417. package/esm/domain/discardNegativeDuration.d.ts +2 -0
  418. package/esm/domain/discardNegativeDuration.js +5 -0
  419. package/esm/domain/discardNegativeDuration.js.map +1 -0
  420. package/esm/domain/error/errorCollection.d.ts +17 -0
  421. package/esm/domain/error/errorCollection.js +70 -0
  422. package/esm/domain/error/errorCollection.js.map +1 -0
  423. package/esm/domain/error/trackConsoleError.d.ts +4 -0
  424. package/esm/domain/error/trackConsoleError.js +10 -0
  425. package/esm/domain/error/trackConsoleError.js.map +1 -0
  426. package/esm/domain/error/trackReportError.d.ts +5 -0
  427. package/esm/domain/error/trackReportError.js +13 -0
  428. package/esm/domain/error/trackReportError.js.map +1 -0
  429. package/esm/domain/event/eventCollection.d.ts +10 -0
  430. package/esm/domain/event/eventCollection.js +24 -0
  431. package/esm/domain/event/eventCollection.js.map +1 -0
  432. package/esm/domain/getSelectorFromElement.d.ts +64 -0
  433. package/esm/domain/getSelectorFromElement.js +213 -0
  434. package/esm/domain/getSelectorFromElement.js.map +1 -0
  435. package/esm/domain/getSessionReplayUrl.d.ts +9 -0
  436. package/esm/domain/getSessionReplayUrl.js +30 -0
  437. package/esm/domain/getSessionReplayUrl.js.map +1 -0
  438. package/esm/domain/hooks.d.ts +23 -0
  439. package/esm/domain/hooks.js +3 -0
  440. package/esm/domain/hooks.js.map +1 -0
  441. package/esm/domain/lifeCycle.d.ts +73 -0
  442. package/esm/domain/lifeCycle.js +3 -0
  443. package/esm/domain/lifeCycle.js.map +1 -0
  444. package/esm/domain/limitModification.d.ts +8 -0
  445. package/esm/domain/limitModification.js +43 -0
  446. package/esm/domain/limitModification.js.map +1 -0
  447. package/esm/domain/longTask/longTaskCollection.d.ts +18 -0
  448. package/esm/domain/longTask/longTaskCollection.js +87 -0
  449. package/esm/domain/longTask/longTaskCollection.js.map +1 -0
  450. package/esm/domain/plugins.d.ts +40 -0
  451. package/esm/domain/plugins.js +12 -0
  452. package/esm/domain/plugins.js.map +1 -0
  453. package/esm/domain/privacy.d.ts +44 -0
  454. package/esm/domain/privacy.js +302 -0
  455. package/esm/domain/privacy.js.map +1 -0
  456. package/esm/domain/privacyConstants.d.ts +23 -0
  457. package/esm/domain/privacyConstants.js +35 -0
  458. package/esm/domain/privacyConstants.js.map +1 -0
  459. package/esm/domain/requestCollection.d.ts +54 -0
  460. package/esm/domain/requestCollection.js +106 -0
  461. package/esm/domain/requestCollection.js.map +1 -0
  462. package/esm/domain/resource/graphql.d.ts +23 -0
  463. package/esm/domain/resource/graphql.js +91 -0
  464. package/esm/domain/resource/graphql.js.map +1 -0
  465. package/esm/domain/resource/matchRequestResourceEntry.d.ts +16 -0
  466. package/esm/domain/resource/matchRequestResourceEntry.js +46 -0
  467. package/esm/domain/resource/matchRequestResourceEntry.js.map +1 -0
  468. package/esm/domain/resource/requestRegistry.d.ts +9 -0
  469. package/esm/domain/resource/requestRegistry.js +37 -0
  470. package/esm/domain/resource/requestRegistry.js.map +1 -0
  471. package/esm/domain/resource/resourceCollection.d.ts +7 -0
  472. package/esm/domain/resource/resourceCollection.js +187 -0
  473. package/esm/domain/resource/resourceCollection.js.map +1 -0
  474. package/esm/domain/resource/resourceUtils.d.ts +55 -0
  475. package/esm/domain/resource/resourceUtils.js +244 -0
  476. package/esm/domain/resource/resourceUtils.js.map +1 -0
  477. package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
  478. package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +21 -0
  479. package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
  480. package/esm/domain/rumSessionManager.d.ts +36 -0
  481. package/esm/domain/rumSessionManager.js +72 -0
  482. package/esm/domain/rumSessionManager.js.map +1 -0
  483. package/esm/domain/sampler/sampler.d.ts +10 -0
  484. package/esm/domain/sampler/sampler.js +58 -0
  485. package/esm/domain/sampler/sampler.js.map +1 -0
  486. package/esm/domain/startCustomerDataTelemetry.d.ts +4 -0
  487. package/esm/domain/startCustomerDataTelemetry.js +52 -0
  488. package/esm/domain/startCustomerDataTelemetry.js.map +1 -0
  489. package/esm/domain/tracing/getDocumentTraceId.d.ts +12 -0
  490. package/esm/domain/tracing/getDocumentTraceId.js +68 -0
  491. package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
  492. package/esm/domain/tracing/identifier.d.ts +13 -0
  493. package/esm/domain/tracing/identifier.js +50 -0
  494. package/esm/domain/tracing/identifier.js.map +1 -0
  495. package/esm/domain/tracing/sampler.d.ts +10 -0
  496. package/esm/domain/tracing/sampler.js +64 -0
  497. package/esm/domain/tracing/sampler.js.map +1 -0
  498. package/esm/domain/tracing/tracer.d.ts +30 -0
  499. package/esm/domain/tracing/tracer.js +156 -0
  500. package/esm/domain/tracing/tracer.js.map +1 -0
  501. package/esm/domain/tracing/tracer.types.d.ts +12 -0
  502. package/esm/domain/tracing/tracer.types.js +2 -0
  503. package/esm/domain/tracing/tracer.types.js.map +1 -0
  504. package/esm/domain/trackEventCounts.d.ts +17 -0
  505. package/esm/domain/trackEventCounts.js +47 -0
  506. package/esm/domain/trackEventCounts.js.map +1 -0
  507. package/esm/domain/view/bfCacheSupport.d.ts +2 -0
  508. package/esm/domain/view/bfCacheSupport.js +10 -0
  509. package/esm/domain/view/bfCacheSupport.js.map +1 -0
  510. package/esm/domain/view/trackViewEventCounts.d.ts +5 -0
  511. package/esm/domain/view/trackViewEventCounts.js +13 -0
  512. package/esm/domain/view/trackViewEventCounts.js.map +1 -0
  513. package/esm/domain/view/trackViews.d.ts +65 -0
  514. package/esm/domain/view/trackViews.js +271 -0
  515. package/esm/domain/view/trackViews.js.map +1 -0
  516. package/esm/domain/view/viewCollection.d.ts +18 -0
  517. package/esm/domain/view/viewCollection.js +150 -0
  518. package/esm/domain/view/viewCollection.js.map +1 -0
  519. package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
  520. package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +28 -0
  521. package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
  522. package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
  523. package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +39 -0
  524. package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
  525. package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
  526. package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +41 -0
  527. package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
  528. package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
  529. package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -0
  530. package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
  531. package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
  532. package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +34 -0
  533. package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
  534. package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
  535. package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +130 -0
  536. package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
  537. package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
  538. package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +34 -0
  539. package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
  540. package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
  541. package/esm/domain/view/viewMetrics/trackFirstHidden.js +30 -0
  542. package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
  543. package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
  544. package/esm/domain/view/viewMetrics/trackFirstInput.js +40 -0
  545. package/esm/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
  546. package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
  547. package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +38 -0
  548. package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
  549. package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
  550. package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +149 -0
  551. package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
  552. package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
  553. package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +57 -0
  554. package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
  555. package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
  556. package/esm/domain/view/viewMetrics/trackLoadingTime.js +47 -0
  557. package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
  558. package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
  559. package/esm/domain/view/viewMetrics/trackNavigationTimings.js +40 -0
  560. package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
  561. package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
  562. package/esm/domain/view/viewMetrics/trackScrollMetrics.js +72 -0
  563. package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
  564. package/esm/domain/vital/vitalCollection.d.ts +55 -0
  565. package/esm/domain/vital/vitalCollection.js +107 -0
  566. package/esm/domain/vital/vitalCollection.js.map +1 -0
  567. package/esm/domain/waitPageActivityEnd.d.ts +54 -0
  568. package/esm/domain/waitPageActivityEnd.js +123 -0
  569. package/esm/domain/waitPageActivityEnd.js.map +1 -0
  570. package/esm/domainContext.types.d.ts +39 -0
  571. package/esm/domainContext.types.js +5 -0
  572. package/esm/domainContext.types.js.map +1 -0
  573. package/esm/index.d.ts +41 -0
  574. package/esm/index.js +21 -0
  575. package/esm/index.js.map +1 -0
  576. package/esm/rawRumEvent.types.d.ts +326 -0
  577. package/esm/rawRumEvent.types.js +31 -0
  578. package/esm/rawRumEvent.types.js.map +1 -0
  579. package/esm/rumEvent.types.d.ts +2026 -0
  580. package/esm/rumEvent.types.js +6 -0
  581. package/esm/rumEvent.types.js.map +1 -0
  582. package/esm/transport/formDataTransport.d.ts +16 -0
  583. package/esm/transport/formDataTransport.js +43 -0
  584. package/esm/transport/formDataTransport.js.map +1 -0
  585. package/esm/transport/startRumBatch.d.ts +5 -0
  586. package/esm/transport/startRumBatch.js +30 -0
  587. package/esm/transport/startRumBatch.js.map +1 -0
  588. package/esm/transport/startRumEventBridge.d.ts +2 -0
  589. package/esm/transport/startRumEventBridge.js +8 -0
  590. package/esm/transport/startRumEventBridge.js.map +1 -0
  591. package/package.json +29 -0
  592. package/src/boot/preStartRum.ts +298 -0
  593. package/src/boot/rumPublicApi.ts +830 -0
  594. package/src/boot/startRum.ts +280 -0
  595. package/src/browser/cookieObservable.ts +63 -0
  596. package/src/browser/domMutationObservable.ts +98 -0
  597. package/src/browser/firstInputPolyfill.ts +87 -0
  598. package/src/browser/htmlDomUtils.ts +45 -0
  599. package/src/browser/locationChangeObservable.ts +69 -0
  600. package/src/browser/performanceObservable.ts +324 -0
  601. package/src/browser/performanceUtils.ts +50 -0
  602. package/src/browser/scroll.ts +25 -0
  603. package/src/browser/viewportObservable.ts +44 -0
  604. package/src/browser/windowOpenObservable.ts +7 -0
  605. package/src/domain/action/actionCollection.ts +146 -0
  606. package/src/domain/action/actionNameConstants.ts +20 -0
  607. package/src/domain/action/clickChain.ts +83 -0
  608. package/src/domain/action/computeFrustration.ts +77 -0
  609. package/src/domain/action/getActionNameFromElement.ts +337 -0
  610. package/src/domain/action/interactionSelectorCache.ts +21 -0
  611. package/src/domain/action/listenActionEvents.ts +119 -0
  612. package/src/domain/action/trackClickActions.ts +388 -0
  613. package/src/domain/assembly.ts +141 -0
  614. package/src/domain/configuration/configuration.ts +548 -0
  615. package/src/domain/configuration/index.ts +2 -0
  616. package/src/domain/configuration/jsonPathParser.ts +214 -0
  617. package/src/domain/configuration/remoteConfiguration.ts +304 -0
  618. package/src/domain/configuration/remoteConfiguration.types.ts +147 -0
  619. package/src/domain/contexts/ciVisibilityContext.ts +50 -0
  620. package/src/domain/contexts/connectivityContext.ts +12 -0
  621. package/src/domain/contexts/defaultContext.ts +43 -0
  622. package/src/domain/contexts/displayContext.ts +38 -0
  623. package/src/domain/contexts/featureFlagContext.ts +71 -0
  624. package/src/domain/contexts/internalContext.ts +34 -0
  625. package/src/domain/contexts/pageStateHistory.ts +171 -0
  626. package/src/domain/contexts/sessionContext.ts +59 -0
  627. package/src/domain/contexts/syntheticsContext.ts +33 -0
  628. package/src/domain/contexts/trackingConsentContext.ts +15 -0
  629. package/src/domain/contexts/urlContexts.ts +97 -0
  630. package/src/domain/contexts/userAgentDataContext.ts +36 -0
  631. package/src/domain/contexts/viewHistory.ts +70 -0
  632. package/src/domain/discardNegativeDuration.ts +6 -0
  633. package/src/domain/error/errorCollection.ts +107 -0
  634. package/src/domain/error/trackConsoleError.ts +14 -0
  635. package/src/domain/error/trackReportError.ts +16 -0
  636. package/src/domain/event/eventCollection.ts +53 -0
  637. package/src/domain/getSelectorFromElement.ts +268 -0
  638. package/src/domain/getSessionReplayUrl.ts +47 -0
  639. package/src/domain/hooks.ts +31 -0
  640. package/src/domain/lifeCycle.ts +103 -0
  641. package/src/domain/limitModification.ts +66 -0
  642. package/src/domain/longTask/longTaskCollection.ts +133 -0
  643. package/src/domain/plugins.ts +59 -0
  644. package/src/domain/privacy.ts +355 -0
  645. package/src/domain/privacyConstants.ts +43 -0
  646. package/src/domain/requestCollection.ts +179 -0
  647. package/src/domain/resource/graphql.ts +135 -0
  648. package/src/domain/resource/matchRequestResourceEntry.ts +68 -0
  649. package/src/domain/resource/requestRegistry.ts +52 -0
  650. package/src/domain/resource/resourceCollection.ts +273 -0
  651. package/src/domain/resource/resourceUtils.ts +355 -0
  652. package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +27 -0
  653. package/src/domain/rumSessionManager.ts +134 -0
  654. package/src/domain/sampler/sampler.ts +63 -0
  655. package/src/domain/startCustomerDataTelemetry.ts +83 -0
  656. package/src/domain/tracing/getDocumentTraceId.ts +90 -0
  657. package/src/domain/tracing/identifier.ts +69 -0
  658. package/src/domain/tracing/sampler.ts +69 -0
  659. package/src/domain/tracing/tracer.ts +248 -0
  660. package/src/domain/tracing/tracer.types.ts +13 -0
  661. package/src/domain/trackEventCounts.ts +67 -0
  662. package/src/domain/view/bfCacheSupport.ts +20 -0
  663. package/src/domain/view/trackViewEventCounts.ts +15 -0
  664. package/src/domain/view/trackViews.ts +431 -0
  665. package/src/domain/view/viewCollection.ts +203 -0
  666. package/src/domain/view/viewMetrics/getClsAttributionImpactedArea.ts +34 -0
  667. package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +55 -0
  668. package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +70 -0
  669. package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +20 -0
  670. package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +78 -0
  671. package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +180 -0
  672. package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +47 -0
  673. package/src/domain/view/viewMetrics/trackFirstHidden.ts +53 -0
  674. package/src/domain/view/viewMetrics/trackFirstInput.ts +59 -0
  675. package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +66 -0
  676. package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +193 -0
  677. package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +87 -0
  678. package/src/domain/view/viewMetrics/trackLoadingTime.ts +69 -0
  679. package/src/domain/view/viewMetrics/trackNavigationTimings.ts +66 -0
  680. package/src/domain/view/viewMetrics/trackScrollMetrics.ts +119 -0
  681. package/src/domain/vital/vitalCollection.ts +207 -0
  682. package/src/domain/waitPageActivityEnd.ts +189 -0
  683. package/src/domainContext.types.ts +61 -0
  684. package/src/index.ts +76 -0
  685. package/src/rawRumEvent.types.ts +409 -0
  686. package/src/rumEvent.types.ts +2151 -0
  687. package/src/transport/formDataTransport.ts +85 -0
  688. package/src/transport/startRumBatch.ts +46 -0
  689. package/src/transport/startRumEventBridge.ts +12 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * performance.interactionCount polyfill
3
+ *
4
+ * The interactionCount is an integer which counts the total number of distinct user interactions,
5
+ * for which there was a unique interactionId.
6
+ *
7
+ * The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213
8
+ * This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.
9
+ * Hopefully when/if other browsers will support INP, they will also implement performance.interactionCount at the same time, so we won't need that polyfill.
10
+ *
11
+ * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts
12
+ */
13
+
14
+ import { monitor } from '@kubesense/kubesense-browser-core'
15
+ import type {
16
+ BrowserWindow,
17
+ RumPerformanceEventTiming,
18
+ RumPerformanceObserver,
19
+ } from '../../../browser/performanceObservable'
20
+
21
+ let observer: RumPerformanceObserver | undefined
22
+
23
+ let interactionCountEstimate = 0
24
+ let minKnownInteractionId = Infinity
25
+ let maxKnownInteractionId = 0
26
+
27
+ export function initInteractionCountPolyfill() {
28
+ if ('interactionCount' in performance || observer) {
29
+ return
30
+ }
31
+
32
+ observer = new (window as BrowserWindow).PerformanceObserver(
33
+ monitor((entries: PerformanceObserverEntryList) => {
34
+ entries.getEntries().forEach((e) => {
35
+ const entry = e as unknown as RumPerformanceEventTiming
36
+
37
+ if (entry.interactionId) {
38
+ minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId)
39
+ maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId)
40
+
41
+ interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1
42
+ }
43
+ })
44
+ })
45
+ )
46
+
47
+ observer.observe({ type: 'event', buffered: true, durationThreshold: 0 })
48
+ }
49
+
50
+ /**
51
+ * Returns the `interactionCount` value using the native API (if available)
52
+ * or the polyfill estimate in this module.
53
+ */
54
+ export const getInteractionCount = () =>
55
+ observer ? interactionCountEstimate : (window as BrowserWindow).performance.interactionCount! || 0
@@ -0,0 +1,70 @@
1
+ import type { Context, Telemetry } from '@kubesense/kubesense-browser-core'
2
+ import { addTelemetryMetrics, noop, TelemetryMetrics } from '@kubesense/kubesense-browser-core'
3
+ import type { LifeCycle } from '../../lifeCycle'
4
+ import { LifeCycleEventType } from '../../lifeCycle'
5
+ import type { LargestContentfulPaint } from './trackLargestContentfulPaint'
6
+ import type { NavigationTimings } from './trackNavigationTimings'
7
+
8
+ interface CoreInitialViewMetrics extends Context {
9
+ lcp: {
10
+ value: number
11
+ }
12
+ navigation: {
13
+ domComplete: number
14
+ domContentLoaded: number
15
+ domInteractive: number
16
+ firstByte: number | undefined
17
+ loadEvent: number
18
+ }
19
+ }
20
+
21
+ export function startInitialViewMetricsTelemetry(lifeCycle: LifeCycle, telemetry: Telemetry) {
22
+ if (!telemetry.metricsEnabled) {
23
+ return { stop: noop }
24
+ }
25
+
26
+ const { unsubscribe } = lifeCycle.subscribe(LifeCycleEventType.VIEW_UPDATED, ({ initialViewMetrics }) => {
27
+ if (!initialViewMetrics.largestContentfulPaint || !initialViewMetrics.navigationTimings) {
28
+ return
29
+ }
30
+
31
+ // The navigation timings become available shortly after the load event fires, so
32
+ // we're snapshotting the LCP value available at that point. However, more LCP values
33
+ // can be emitted until the page is scrolled or interacted with, so it's possible that
34
+ // the final LCP value may differ. These metrics are intended to help diagnose
35
+ // performance issues early in the page load process, and using LCP-at-page-load is a
36
+ // good fit for that use case, but it's important to be aware that this is not
37
+ // necessarily equivalent to the normal LCP metric.
38
+ // monitor-until: 2026-07-01
39
+ addTelemetryMetrics(TelemetryMetrics.INITIAL_VIEW_METRICS_TELEMETRY_NAME, {
40
+ metrics: createCoreInitialViewMetrics(
41
+ initialViewMetrics.largestContentfulPaint,
42
+ initialViewMetrics.navigationTimings
43
+ ),
44
+ })
45
+
46
+ unsubscribe()
47
+ })
48
+
49
+ return {
50
+ stop: unsubscribe,
51
+ }
52
+ }
53
+
54
+ function createCoreInitialViewMetrics(
55
+ lcp: LargestContentfulPaint,
56
+ navigation: NavigationTimings
57
+ ): CoreInitialViewMetrics {
58
+ return {
59
+ lcp: {
60
+ value: lcp.value,
61
+ },
62
+ navigation: {
63
+ domComplete: navigation.domComplete,
64
+ domContentLoaded: navigation.domContentLoaded,
65
+ domInteractive: navigation.domInteractive,
66
+ firstByte: navigation.firstByte,
67
+ loadEvent: navigation.loadEvent,
68
+ },
69
+ }
70
+ }
@@ -0,0 +1,20 @@
1
+ import type { RelativeTime, ClocksState } from '@kubesense/kubesense-browser-core'
2
+ import type { InitialViewMetrics } from './trackInitialViewMetrics'
3
+ import { trackRestoredFirstContentfulPaint } from './trackFirstContentfulPaint'
4
+
5
+ /**
6
+ * BFCache keeps a full in-memory snapshot of the DOM. When the page is restored, nothing needs to be fetched, so the whole
7
+ * viewport repaints in a single frame. Consequently, LCP almost always equals FCP.
8
+ * (See: https://github.com/GoogleChrome/web-vitals/pull/87)
9
+ */
10
+ export function trackBfcacheMetrics(
11
+ viewStart: ClocksState,
12
+ metrics: InitialViewMetrics,
13
+ scheduleViewUpdate: () => void
14
+ ) {
15
+ trackRestoredFirstContentfulPaint(viewStart.relative, (paintTime) => {
16
+ metrics.firstContentfulPaint = paintTime
17
+ metrics.largestContentfulPaint = { value: paintTime as RelativeTime }
18
+ scheduleViewUpdate()
19
+ })
20
+ }
@@ -0,0 +1,78 @@
1
+ import type { ClocksState, Duration, Observable } from '@kubesense/kubesense-browser-core'
2
+ import type { ViewLoadingType } from '../../../rawRumEvent.types'
3
+ import type { RumConfiguration } from '../../configuration'
4
+ import type { LifeCycle } from '../../lifeCycle'
5
+ import type { RumMutationRecord } from '../../../browser/domMutationObservable'
6
+ import type { CumulativeLayoutShift } from './trackCumulativeLayoutShift'
7
+ import { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift'
8
+ import type { InteractionToNextPaint } from './trackInteractionToNextPaint'
9
+ import { trackInteractionToNextPaint } from './trackInteractionToNextPaint'
10
+ import { trackLoadingTime } from './trackLoadingTime'
11
+ import type { ScrollMetrics } from './trackScrollMetrics'
12
+ import { trackScrollMetrics } from './trackScrollMetrics'
13
+
14
+ export interface CommonViewMetrics {
15
+ loadingTime?: Duration
16
+ cumulativeLayoutShift?: CumulativeLayoutShift
17
+ interactionToNextPaint?: InteractionToNextPaint
18
+ scroll?: ScrollMetrics
19
+ }
20
+
21
+ export function trackCommonViewMetrics(
22
+ lifeCycle: LifeCycle,
23
+ domMutationObservable: Observable<RumMutationRecord[]>,
24
+ windowOpenObservable: Observable<void>,
25
+ configuration: RumConfiguration,
26
+ scheduleViewUpdate: () => void,
27
+ loadingType: ViewLoadingType,
28
+ viewStart: ClocksState
29
+ ) {
30
+ const commonViewMetrics: CommonViewMetrics = {}
31
+
32
+ const { stop: stopLoadingTimeTracking, setLoadEvent } = trackLoadingTime(
33
+ lifeCycle,
34
+ domMutationObservable,
35
+ windowOpenObservable,
36
+ configuration,
37
+ loadingType,
38
+ viewStart,
39
+ (newLoadingTime) => {
40
+ commonViewMetrics.loadingTime = newLoadingTime
41
+ scheduleViewUpdate()
42
+ }
43
+ )
44
+
45
+ const { stop: stopScrollMetricsTracking } = trackScrollMetrics(configuration, viewStart, (newScrollMetrics) => {
46
+ commonViewMetrics.scroll = newScrollMetrics
47
+ })
48
+
49
+ const { stop: stopCLSTracking } = trackCumulativeLayoutShift(
50
+ configuration,
51
+ viewStart.relative,
52
+ (cumulativeLayoutShift) => {
53
+ commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift
54
+ scheduleViewUpdate()
55
+ }
56
+ )
57
+
58
+ const {
59
+ stop: stopINPTracking,
60
+ getInteractionToNextPaint,
61
+ setViewEnd,
62
+ } = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType)
63
+
64
+ return {
65
+ stop: () => {
66
+ stopLoadingTimeTracking()
67
+ stopCLSTracking()
68
+ stopScrollMetricsTracking()
69
+ },
70
+ stopINPTracking,
71
+ setLoadEvent,
72
+ setViewEnd,
73
+ getCommonViewMetrics: () => {
74
+ commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint()
75
+ return commonViewMetrics
76
+ },
77
+ }
78
+ }
@@ -0,0 +1,180 @@
1
+ import { round, ONE_SECOND, noop, elapsed } from '@kubesense/kubesense-browser-core'
2
+ import type { Duration, RelativeTime, WeakRef, WeakRefConstructor } from '@kubesense/kubesense-browser-core'
3
+ import { isElementNode } from '../../../browser/htmlDomUtils'
4
+ import type { RumLayoutShiftAttribution, RumLayoutShiftTiming } from '../../../browser/performanceObservable'
5
+ import {
6
+ supportPerformanceTimingEvent,
7
+ RumPerformanceEntryType,
8
+ createPerformanceObservable,
9
+ } from '../../../browser/performanceObservable'
10
+ import { getSelectorFromElement } from '../../getSelectorFromElement'
11
+ import type { RumConfiguration } from '../../configuration'
12
+ import type { RumRect } from '../../../rumEvent.types'
13
+ import { getClsAttributionImpactedArea } from './getClsAttributionImpactedArea'
14
+
15
+ declare const WeakRef: WeakRefConstructor
16
+
17
+ export interface CumulativeLayoutShift {
18
+ value: number
19
+ targetSelector?: string
20
+ time?: Duration
21
+ previousRect?: RumRect
22
+ currentRect?: RumRect
23
+ devicePixelRatio?: number
24
+ }
25
+
26
+ interface LayoutShiftInstance {
27
+ target: WeakRef<Element> | undefined
28
+ time: Duration
29
+ previousRect: DOMRectReadOnly | undefined
30
+ currentRect: DOMRectReadOnly | undefined
31
+ devicePixelRatio: number
32
+ }
33
+
34
+ /**
35
+ * Track the cumulative layout shifts (CLS).
36
+ * Layout shifts are grouped into session windows.
37
+ * The minimum gap between session windows is 1 second.
38
+ * The maximum duration of a session window is 5 second.
39
+ * The session window layout shift value is the sum of layout shifts inside it.
40
+ * The CLS value is the max of session windows values.
41
+ *
42
+ * This yields a new value whenever the CLS value is updated (a higher session window value is computed).
43
+ *
44
+ * See isLayoutShiftSupported to check for browser support.
45
+ *
46
+ * Documentation:
47
+ * https://web.dev/cls/
48
+ * https://web.dev/evolving-cls/
49
+ * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts
50
+ */
51
+ export function trackCumulativeLayoutShift(
52
+ configuration: RumConfiguration,
53
+ viewStart: RelativeTime,
54
+ callback: (cumulativeLayoutShift: CumulativeLayoutShift) => void
55
+ ) {
56
+ if (!isLayoutShiftSupported()) {
57
+ return {
58
+ stop: noop,
59
+ }
60
+ }
61
+
62
+ let maxClsValue = 0
63
+ let biggestShift: LayoutShiftInstance | undefined
64
+
65
+ // if no layout shift happen the value should be reported as 0
66
+ callback({
67
+ value: 0,
68
+ })
69
+
70
+ const slidingWindow = slidingSessionWindow()
71
+ const performanceSubscription = createPerformanceObservable(configuration, {
72
+ type: RumPerformanceEntryType.LAYOUT_SHIFT,
73
+ buffered: true,
74
+ }).subscribe((entries) => {
75
+ for (const entry of entries) {
76
+ if (entry.hadRecentInput || entry.startTime < viewStart) {
77
+ continue
78
+ }
79
+
80
+ const { cumulatedValue, isMaxValue } = slidingWindow.update(entry)
81
+
82
+ if (isMaxValue) {
83
+ const attribution = getTopImpactedElement(entry.sources)
84
+ biggestShift = {
85
+ target: attribution?.node ? new WeakRef(attribution.node) : undefined,
86
+ time: elapsed(viewStart, entry.startTime),
87
+ previousRect: attribution?.previousRect,
88
+ currentRect: attribution?.currentRect,
89
+ devicePixelRatio: window.devicePixelRatio,
90
+ }
91
+ }
92
+
93
+ if (cumulatedValue > maxClsValue) {
94
+ maxClsValue = cumulatedValue
95
+ const target = biggestShift?.target?.deref()
96
+
97
+ callback({
98
+ value: round(maxClsValue, 4),
99
+ targetSelector: target && getSelectorFromElement(target, configuration.actionNameAttribute),
100
+ time: biggestShift?.time,
101
+ previousRect: biggestShift?.previousRect ? asRumRect(biggestShift.previousRect) : undefined,
102
+ currentRect: biggestShift?.currentRect ? asRumRect(biggestShift.currentRect) : undefined,
103
+ devicePixelRatio: biggestShift?.devicePixelRatio,
104
+ })
105
+ }
106
+ }
107
+ })
108
+
109
+ return {
110
+ stop: () => {
111
+ performanceSubscription.unsubscribe()
112
+ },
113
+ }
114
+ }
115
+
116
+ function getTopImpactedElement(
117
+ sources: RumLayoutShiftAttribution[]
118
+ ): (RumLayoutShiftAttribution & { node: Element }) | undefined {
119
+ let topImpactedSource: (RumLayoutShiftAttribution & { node: Element }) | undefined
120
+ for (const source of sources) {
121
+ if (source.node && isElementNode(source.node)) {
122
+ const currentImpactedArea = getClsAttributionImpactedArea(source)
123
+ if (!topImpactedSource || getClsAttributionImpactedArea(topImpactedSource) < currentImpactedArea) {
124
+ topImpactedSource = source as RumLayoutShiftAttribution & { node: Element }
125
+ }
126
+ }
127
+ }
128
+ return topImpactedSource
129
+ }
130
+
131
+ function asRumRect({ x, y, width, height }: DOMRectReadOnly): RumRect {
132
+ return { x, y, width, height }
133
+ }
134
+
135
+ export const MAX_WINDOW_DURATION = 5 * ONE_SECOND
136
+ const MAX_UPDATE_GAP = ONE_SECOND
137
+
138
+ function slidingSessionWindow() {
139
+ let cumulatedValue = 0
140
+ let startTime: RelativeTime
141
+ let endTime: RelativeTime
142
+ let maxValue = 0
143
+
144
+ return {
145
+ update: (entry: RumLayoutShiftTiming) => {
146
+ const shouldCreateNewWindow =
147
+ startTime === undefined ||
148
+ entry.startTime - endTime >= MAX_UPDATE_GAP ||
149
+ entry.startTime - startTime >= MAX_WINDOW_DURATION
150
+
151
+ let isMaxValue: boolean
152
+
153
+ if (shouldCreateNewWindow) {
154
+ startTime = endTime = entry.startTime
155
+ maxValue = cumulatedValue = entry.value
156
+ isMaxValue = true
157
+ } else {
158
+ cumulatedValue += entry.value
159
+ endTime = entry.startTime
160
+ isMaxValue = entry.value > maxValue
161
+
162
+ if (isMaxValue) {
163
+ maxValue = entry.value
164
+ }
165
+ }
166
+
167
+ return {
168
+ cumulatedValue,
169
+ isMaxValue,
170
+ }
171
+ },
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Check whether `layout-shift` is supported by the browser.
177
+ */
178
+ export function isLayoutShiftSupported() {
179
+ return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window
180
+ }
@@ -0,0 +1,47 @@
1
+ import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core'
2
+ import { ONE_MINUTE, elapsed, relativeNow } from '@kubesense/kubesense-browser-core'
3
+ import type { RumPerformancePaintTiming } from '../../../browser/performanceObservable'
4
+ import { createPerformanceObservable, RumPerformanceEntryType } from '../../../browser/performanceObservable'
5
+ import type { RumConfiguration } from '../../configuration'
6
+ import type { FirstHidden } from './trackFirstHidden'
7
+
8
+ // Discard FCP timings above a certain delay to avoid incorrect data
9
+ // It happens in some cases like sleep mode or some browser implementations
10
+ export const FCP_MAXIMUM_DELAY = 10 * ONE_MINUTE
11
+
12
+ export function trackFirstContentfulPaint(
13
+ configuration: RumConfiguration,
14
+ firstHidden: FirstHidden,
15
+ callback: (fcpTiming: RelativeTime) => void
16
+ ) {
17
+ const performanceSubscription = createPerformanceObservable(configuration, {
18
+ type: RumPerformanceEntryType.PAINT,
19
+ buffered: true,
20
+ }).subscribe((entries) => {
21
+ const fcpEntry = entries.find(
22
+ (entry): entry is RumPerformancePaintTiming =>
23
+ entry.name === 'first-contentful-paint' &&
24
+ entry.startTime < firstHidden.timeStamp &&
25
+ entry.startTime < FCP_MAXIMUM_DELAY
26
+ )
27
+ if (fcpEntry) {
28
+ callback(fcpEntry.startTime)
29
+ }
30
+ })
31
+ return {
32
+ stop: performanceSubscription.unsubscribe,
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Measure the First Contentful Paint after a BFCache restoration.
38
+ * The DOM is restored synchronously, so we approximate the FCP with the first frame
39
+ * rendered just after the pageshow event, using two nested requestAnimationFrame calls.
40
+ */
41
+ export function trackRestoredFirstContentfulPaint(viewStartRelative: RelativeTime, callback: (fcp: Duration) => void) {
42
+ requestAnimationFrame(() => {
43
+ requestAnimationFrame(() => {
44
+ callback(elapsed(viewStartRelative, relativeNow()))
45
+ })
46
+ })
47
+ }
@@ -0,0 +1,53 @@
1
+ import type { ClocksState, RelativeTime } from '@kubesense/kubesense-browser-core'
2
+ import { addEventListeners, DOM_EVENT, noop } from '@kubesense/kubesense-browser-core'
3
+ import type { RumConfiguration } from '../../configuration'
4
+ import { supportPerformanceTimingEvent, RumPerformanceEntryType } from '../../../browser/performanceObservable'
5
+
6
+ export type FirstHidden = ReturnType<typeof trackFirstHidden>
7
+
8
+ export interface Options {
9
+ viewStart: ClocksState
10
+ }
11
+
12
+ export function trackFirstHidden(
13
+ configuration: RumConfiguration,
14
+ viewStart: ClocksState,
15
+ eventTarget: Window = window
16
+ ) {
17
+ if (document.visibilityState === 'hidden') {
18
+ return { timeStamp: 0 as RelativeTime, stop: noop }
19
+ }
20
+
21
+ if (supportPerformanceTimingEvent(RumPerformanceEntryType.VISIBILITY_STATE)) {
22
+ const firstHiddenEntry = performance
23
+ .getEntriesByType(RumPerformanceEntryType.VISIBILITY_STATE)
24
+ .filter((entry) => entry.name === 'hidden')
25
+ .find((entry) => entry.startTime >= viewStart.relative)
26
+
27
+ if (firstHiddenEntry) {
28
+ return { timeStamp: firstHiddenEntry.startTime as RelativeTime, stop: noop }
29
+ }
30
+ }
31
+
32
+ let timeStamp: RelativeTime = Infinity as RelativeTime
33
+
34
+ const { stop } = addEventListeners(
35
+ configuration,
36
+ eventTarget,
37
+ [DOM_EVENT.PAGE_HIDE, DOM_EVENT.VISIBILITY_CHANGE],
38
+ (event) => {
39
+ if (event.type === DOM_EVENT.PAGE_HIDE || document.visibilityState === 'hidden') {
40
+ timeStamp = event.timeStamp as RelativeTime
41
+ stop()
42
+ }
43
+ },
44
+ { capture: true }
45
+ )
46
+
47
+ return {
48
+ get timeStamp() {
49
+ return timeStamp
50
+ },
51
+ stop,
52
+ }
53
+ }
@@ -0,0 +1,59 @@
1
+ import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core'
2
+ import { elapsed } from '@kubesense/kubesense-browser-core'
3
+ import { isElementNode } from '../../../browser/htmlDomUtils'
4
+ import type { RumConfiguration } from '../../configuration'
5
+ import { createPerformanceObservable, RumPerformanceEntryType } from '../../../browser/performanceObservable'
6
+ import type { RumFirstInputTiming } from '../../../browser/performanceObservable'
7
+ import { getSelectorFromElement } from '../../getSelectorFromElement'
8
+ import type { FirstHidden } from './trackFirstHidden'
9
+
10
+ export interface FirstInput {
11
+ delay: Duration
12
+ time: RelativeTime
13
+ targetSelector?: string
14
+ }
15
+
16
+ /**
17
+ * Track the first input occurring during the initial View to return:
18
+ * - First Input Delay
19
+ * - First Input Time
20
+ * Callback is called at most one time.
21
+ * Documentation: https://web.dev/fid/
22
+ * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getFID.ts
23
+ */
24
+ export function trackFirstInput(
25
+ configuration: RumConfiguration,
26
+ firstHidden: FirstHidden,
27
+ callback: (firstInput: FirstInput) => void
28
+ ) {
29
+ const performanceFirstInputSubscription = createPerformanceObservable(configuration, {
30
+ type: RumPerformanceEntryType.FIRST_INPUT,
31
+ buffered: true,
32
+ }).subscribe((entries) => {
33
+ const firstInputEntry = entries.find(
34
+ (entry): entry is RumFirstInputTiming => entry.startTime < firstHidden.timeStamp
35
+ )
36
+ if (firstInputEntry) {
37
+ const firstInputDelay = elapsed(firstInputEntry.startTime, firstInputEntry.processingStart)
38
+ let firstInputTargetSelector
39
+
40
+ if (firstInputEntry.target && isElementNode(firstInputEntry.target)) {
41
+ firstInputTargetSelector = getSelectorFromElement(firstInputEntry.target, configuration.actionNameAttribute)
42
+ }
43
+
44
+ callback({
45
+ // Ensure firstInputDelay to be positive, see
46
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1185815
47
+ delay: firstInputDelay >= 0 ? firstInputDelay : (0 as Duration),
48
+ time: firstInputEntry.startTime,
49
+ targetSelector: firstInputTargetSelector,
50
+ })
51
+ }
52
+ })
53
+
54
+ return {
55
+ stop: () => {
56
+ performanceFirstInputSubscription.unsubscribe()
57
+ },
58
+ }
59
+ }
@@ -0,0 +1,66 @@
1
+ import type { ClocksState, Duration } from '@kubesense/kubesense-browser-core'
2
+ import type { RumConfiguration } from '../../configuration'
3
+ import { trackFirstContentfulPaint } from './trackFirstContentfulPaint'
4
+ import type { FirstInput } from './trackFirstInput'
5
+ import { trackFirstInput } from './trackFirstInput'
6
+ import type { NavigationTimings } from './trackNavigationTimings'
7
+ import { trackNavigationTimings } from './trackNavigationTimings'
8
+ import type { LargestContentfulPaint } from './trackLargestContentfulPaint'
9
+ import { trackLargestContentfulPaint } from './trackLargestContentfulPaint'
10
+ import { trackFirstHidden } from './trackFirstHidden'
11
+
12
+ export interface InitialViewMetrics {
13
+ firstContentfulPaint?: Duration
14
+ navigationTimings?: NavigationTimings
15
+ largestContentfulPaint?: LargestContentfulPaint
16
+ firstInput?: FirstInput
17
+ }
18
+
19
+ export function trackInitialViewMetrics(
20
+ configuration: RumConfiguration,
21
+ viewStart: ClocksState,
22
+ setLoadEvent: (loadEnd: Duration) => void,
23
+ scheduleViewUpdate: () => void
24
+ ) {
25
+ const initialViewMetrics: InitialViewMetrics = {}
26
+
27
+ const { stop: stopNavigationTracking } = trackNavigationTimings(configuration, (navigationTimings) => {
28
+ setLoadEvent(navigationTimings.loadEvent)
29
+ initialViewMetrics.navigationTimings = navigationTimings
30
+ scheduleViewUpdate()
31
+ })
32
+
33
+ const firstHidden = trackFirstHidden(configuration, viewStart)
34
+ const { stop: stopFCPTracking } = trackFirstContentfulPaint(configuration, firstHidden, (firstContentfulPaint) => {
35
+ initialViewMetrics.firstContentfulPaint = firstContentfulPaint
36
+ scheduleViewUpdate()
37
+ })
38
+
39
+ const { stop: stopLCPTracking } = trackLargestContentfulPaint(
40
+ configuration,
41
+ firstHidden,
42
+ window,
43
+ (largestContentfulPaint) => {
44
+ initialViewMetrics.largestContentfulPaint = largestContentfulPaint
45
+ scheduleViewUpdate()
46
+ }
47
+ )
48
+
49
+ const { stop: stopFIDTracking } = trackFirstInput(configuration, firstHidden, (firstInput) => {
50
+ initialViewMetrics.firstInput = firstInput
51
+ scheduleViewUpdate()
52
+ })
53
+
54
+ function stop() {
55
+ stopNavigationTracking()
56
+ stopFCPTracking()
57
+ stopLCPTracking()
58
+ stopFIDTracking()
59
+ firstHidden.stop()
60
+ }
61
+
62
+ return {
63
+ stop,
64
+ initialViewMetrics,
65
+ }
66
+ }