@atlaskit/react-ufo 3.4.14 → 3.5.1

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 (405) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/additional-payload/utils/cache-hit-ratio/index.js +5 -4
  3. package/dist/cjs/additional-payload/utils/lighthouse-metrics/cls/index.js +3 -2
  4. package/dist/cjs/additional-payload/utils/lighthouse-metrics/index.js +6 -6
  5. package/dist/cjs/additional-payload/utils/lighthouse-metrics/tbt/index.js +3 -2
  6. package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +3 -0
  7. package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +9 -7
  8. package/dist/cjs/assets/index.js +17 -14
  9. package/dist/cjs/assets/utils.js +9 -8
  10. package/dist/cjs/bundle-eval-timing/index.js +8 -8
  11. package/dist/cjs/coinflip/index.js +5 -3
  12. package/dist/cjs/common/constants.js +3 -2
  13. package/dist/cjs/common/react-ufo-payload-schema.js +5 -0
  14. package/dist/cjs/config/index.js +30 -42
  15. package/dist/cjs/create-experimental-interaction-metrics-payload/index.js +29 -39
  16. package/dist/cjs/create-payload/common/utils/index.js +16 -20
  17. package/dist/cjs/create-payload/index.js +150 -140
  18. package/dist/cjs/create-payload/utils/get-interaction-status.js +5 -3
  19. package/dist/cjs/create-payload/utils/get-page-visibility-up-to-ttai.js +5 -3
  20. package/dist/cjs/create-payload/utils/get-ssr-done-time-value.js +5 -3
  21. package/dist/cjs/create-payload/utils/get-vc-metrics.js +10 -8
  22. package/dist/cjs/create-post-interaction-log-payload/index.js +15 -13
  23. package/dist/cjs/custom-data/index.js +4 -3
  24. package/dist/cjs/custom-mark/index.js +4 -3
  25. package/dist/cjs/custom-spans/index.js +4 -3
  26. package/dist/cjs/custom-timings/index.js +6 -6
  27. package/dist/cjs/experience-trace-id-context/index.js +15 -14
  28. package/dist/cjs/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +3 -2
  29. package/dist/cjs/feature-flags-accessed/common/utils/index.js +11 -10
  30. package/dist/cjs/feature-flags-accessed/index.js +3 -2
  31. package/dist/cjs/generate-id/index.js +5 -3
  32. package/dist/cjs/global-error-handler/index.js +14 -13
  33. package/dist/cjs/initial-page-load-extra-timing/index.js +6 -6
  34. package/dist/cjs/interaction-metrics/index.js +110 -145
  35. package/dist/cjs/interaction-metrics/post-interaction-log.js +10 -0
  36. package/dist/cjs/interaction-metrics-init/index.js +17 -10
  37. package/dist/cjs/interaction-metrics-init/schedule-idle-callback.js +8 -4
  38. package/dist/cjs/resource-timing/common/utils/config.js +10 -10
  39. package/dist/cjs/resource-timing/common/utils/resource-timing-buffer.js +13 -12
  40. package/dist/cjs/resource-timing/main.js +27 -20
  41. package/dist/cjs/resource-timing/utils.js +4 -3
  42. package/dist/cjs/round-number/index.js +3 -2
  43. package/dist/cjs/route-name/index.js +5 -3
  44. package/dist/cjs/segment/schedule-on-paint.js +8 -5
  45. package/dist/cjs/segment/segment.js +9 -5
  46. package/dist/cjs/self-measurements/index.js +261 -0
  47. package/dist/cjs/set-interaction-error/index.js +4 -3
  48. package/dist/cjs/short-id/index.js +5 -3
  49. package/dist/cjs/ssr/index.js +18 -21
  50. package/dist/cjs/trace-interaction/index.js +7 -5
  51. package/dist/cjs/trace-pageload/index.js +7 -6
  52. package/dist/cjs/trace-press/index.js +5 -3
  53. package/dist/cjs/trace-redirect/index.js +5 -3
  54. package/dist/cjs/trace-transition/index.js +6 -4
  55. package/dist/cjs/trace-transition/utils/generate-span-id/index.js +3 -2
  56. package/dist/cjs/trace-transition/utils/set-interaction-active-trace/index.js +3 -2
  57. package/dist/cjs/vc/index.js +17 -6
  58. package/dist/cjs/vc/vc-observer/attachAbortListeners.js +3 -2
  59. package/dist/cjs/vc/vc-observer/getVCRevisionsData.js +41 -26
  60. package/dist/cjs/vc/vc-observer/getViewport.js +6 -6
  61. package/dist/cjs/vc/vc-observer/heatmap/heatmap.js +28 -12
  62. package/dist/cjs/vc/vc-observer/index.js +170 -133
  63. package/dist/cjs/vc/vc-observer/media-wrapper/vc-utils.js +3 -2
  64. package/dist/cjs/vc/vc-observer/observers/editor-lnv/index.js +17 -0
  65. package/dist/cjs/vc/vc-observer/observers/index.js +82 -25
  66. package/dist/cjs/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +5 -8
  67. package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +17 -2
  68. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +7 -7
  69. package/dist/cjs/vc/vc-observer/revisions/fy25_02.js +2 -0
  70. package/dist/cjs/vc/vc-observer/revisions/revisions.js +3 -2
  71. package/dist/cjs/vc/vc-observer-new/entries-timeline/index.js +9 -0
  72. package/dist/cjs/vc/vc-observer-new/get-element-name.js +5 -3
  73. package/dist/cjs/vc/vc-observer-new/get-unique-element-name.js +13 -11
  74. package/dist/cjs/vc/vc-observer-new/index.js +9 -0
  75. package/dist/cjs/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +2 -0
  76. package/dist/cjs/vc/vc-observer-new/metric-calculator/fy25_03/index.js +6 -1
  77. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +20 -12
  78. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +27 -26
  79. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +18 -6
  80. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +27 -14
  81. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +10 -8
  82. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +50 -40
  83. package/dist/cjs/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +10 -8
  84. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +5 -3
  85. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +5 -3
  86. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +5 -3
  87. package/dist/cjs/vc/vc-observer-new/metric-calculator/utils/task-yield.js +10 -8
  88. package/dist/cjs/vc/vc-observer-new/viewport-observer/index.js +15 -7
  89. package/dist/cjs/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +15 -12
  90. package/dist/cjs/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +16 -13
  91. package/dist/cjs/vc/vc-observer-new/viewport-observer/performance-observer/index.js +11 -9
  92. package/dist/cjs/vc/vc-observer-new/window-event-observer/index.js +7 -1
  93. package/dist/es2019/additional-payload/utils/cache-hit-ratio/index.js +6 -5
  94. package/dist/es2019/additional-payload/utils/lighthouse-metrics/cls/index.js +3 -2
  95. package/dist/es2019/additional-payload/utils/lighthouse-metrics/index.js +6 -5
  96. package/dist/es2019/additional-payload/utils/lighthouse-metrics/tbt/index.js +16 -13
  97. package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +3 -0
  98. package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +9 -7
  99. package/dist/es2019/assets/index.js +19 -14
  100. package/dist/es2019/assets/utils.js +11 -9
  101. package/dist/es2019/bundle-eval-timing/index.js +7 -6
  102. package/dist/es2019/coinflip/index.js +5 -2
  103. package/dist/es2019/common/constants.js +3 -2
  104. package/dist/es2019/common/react-ufo-payload-schema.js +1 -0
  105. package/dist/es2019/config/index.js +29 -28
  106. package/dist/es2019/create-experimental-interaction-metrics-payload/index.js +18 -15
  107. package/dist/es2019/create-payload/common/utils/index.js +15 -14
  108. package/dist/es2019/create-payload/index.js +87 -71
  109. package/dist/es2019/create-payload/utils/get-interaction-status.js +5 -2
  110. package/dist/es2019/create-payload/utils/get-page-visibility-up-to-ttai.js +4 -2
  111. package/dist/es2019/create-payload/utils/get-ssr-done-time-value.js +4 -2
  112. package/dist/es2019/create-payload/utils/get-vc-metrics.js +4 -2
  113. package/dist/es2019/create-post-interaction-log-payload/index.js +14 -12
  114. package/dist/es2019/custom-data/index.js +3 -2
  115. package/dist/es2019/custom-mark/index.js +3 -2
  116. package/dist/es2019/custom-spans/index.js +3 -2
  117. package/dist/es2019/custom-timings/index.js +5 -4
  118. package/dist/es2019/experience-trace-id-context/index.js +16 -13
  119. package/dist/es2019/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +6 -3
  120. package/dist/es2019/feature-flags-accessed/common/utils/index.js +14 -7
  121. package/dist/es2019/feature-flags-accessed/index.js +3 -2
  122. package/dist/es2019/generate-id/index.js +4 -2
  123. package/dist/es2019/global-error-handler/index.js +15 -12
  124. package/dist/es2019/initial-page-load-extra-timing/index.js +5 -4
  125. package/dist/es2019/interaction-metrics/index.js +109 -108
  126. package/dist/es2019/interaction-metrics/post-interaction-log.js +10 -0
  127. package/dist/es2019/interaction-metrics-init/index.js +17 -10
  128. package/dist/es2019/interaction-metrics-init/schedule-idle-callback.js +7 -3
  129. package/dist/es2019/resource-timing/common/utils/config.js +10 -7
  130. package/dist/es2019/resource-timing/common/utils/resource-timing-buffer.js +14 -11
  131. package/dist/es2019/resource-timing/main.js +33 -18
  132. package/dist/es2019/resource-timing/utils.js +3 -2
  133. package/dist/es2019/round-number/index.js +3 -2
  134. package/dist/es2019/route-name/index.js +4 -2
  135. package/dist/es2019/segment/schedule-on-paint.js +7 -4
  136. package/dist/es2019/segment/segment.js +9 -5
  137. package/dist/es2019/self-measurements/index.js +213 -0
  138. package/dist/es2019/set-interaction-error/index.js +3 -2
  139. package/dist/es2019/short-id/index.js +4 -2
  140. package/dist/es2019/ssr/index.js +21 -16
  141. package/dist/es2019/trace-interaction/index.js +6 -4
  142. package/dist/es2019/trace-pageload/index.js +6 -4
  143. package/dist/es2019/trace-press/index.js +4 -2
  144. package/dist/es2019/trace-redirect/index.js +4 -2
  145. package/dist/es2019/trace-transition/index.js +5 -3
  146. package/dist/es2019/trace-transition/utils/generate-span-id/index.js +4 -1
  147. package/dist/es2019/trace-transition/utils/set-interaction-active-trace/index.js +3 -2
  148. package/dist/es2019/vc/index.js +16 -4
  149. package/dist/es2019/vc/vc-observer/attachAbortListeners.js +3 -2
  150. package/dist/es2019/vc/vc-observer/getVCRevisionsData.js +41 -25
  151. package/dist/es2019/vc/vc-observer/getViewport.js +5 -4
  152. package/dist/es2019/vc/vc-observer/heatmap/heatmap.js +28 -10
  153. package/dist/es2019/vc/vc-observer/index.js +158 -116
  154. package/dist/es2019/vc/vc-observer/media-wrapper/vc-utils.js +3 -2
  155. package/dist/es2019/vc/vc-observer/observers/editor-lnv/index.js +17 -0
  156. package/dist/es2019/vc/vc-observer/observers/index.js +80 -25
  157. package/dist/es2019/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +4 -7
  158. package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +17 -2
  159. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +7 -7
  160. package/dist/es2019/vc/vc-observer/revisions/fy25_02.js +2 -0
  161. package/dist/es2019/vc/vc-observer/revisions/revisions.js +3 -2
  162. package/dist/es2019/vc/vc-observer-new/entries-timeline/index.js +9 -0
  163. package/dist/es2019/vc/vc-observer-new/get-element-name.js +4 -2
  164. package/dist/es2019/vc/vc-observer-new/get-unique-element-name.js +12 -10
  165. package/dist/es2019/vc/vc-observer-new/index.js +9 -0
  166. package/dist/es2019/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +2 -0
  167. package/dist/es2019/vc/vc-observer-new/metric-calculator/fy25_03/index.js +3 -0
  168. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +14 -4
  169. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +6 -4
  170. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +18 -6
  171. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +21 -8
  172. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +4 -2
  173. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +10 -8
  174. package/dist/es2019/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +4 -2
  175. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +4 -2
  176. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +4 -2
  177. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +4 -2
  178. package/dist/es2019/vc/vc-observer-new/metric-calculator/utils/task-yield.js +5 -2
  179. package/dist/es2019/vc/vc-observer-new/viewport-observer/index.js +15 -7
  180. package/dist/es2019/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +15 -12
  181. package/dist/es2019/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +15 -13
  182. package/dist/es2019/vc/vc-observer-new/viewport-observer/performance-observer/index.js +11 -9
  183. package/dist/es2019/vc/vc-observer-new/window-event-observer/index.js +7 -1
  184. package/dist/esm/additional-payload/utils/cache-hit-ratio/index.js +5 -4
  185. package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/index.js +3 -2
  186. package/dist/esm/additional-payload/utils/lighthouse-metrics/index.js +5 -4
  187. package/dist/esm/additional-payload/utils/lighthouse-metrics/tbt/index.js +3 -2
  188. package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +3 -0
  189. package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +9 -7
  190. package/dist/esm/assets/index.js +17 -14
  191. package/dist/esm/assets/utils.js +10 -8
  192. package/dist/esm/bundle-eval-timing/index.js +7 -6
  193. package/dist/esm/coinflip/index.js +5 -2
  194. package/dist/esm/common/constants.js +3 -2
  195. package/dist/esm/common/react-ufo-payload-schema.js +1 -0
  196. package/dist/esm/config/index.js +29 -28
  197. package/dist/esm/create-experimental-interaction-metrics-payload/index.js +28 -35
  198. package/dist/esm/create-payload/common/utils/index.js +15 -14
  199. package/dist/esm/create-payload/index.js +149 -139
  200. package/dist/esm/create-payload/utils/get-interaction-status.js +5 -2
  201. package/dist/esm/create-payload/utils/get-page-visibility-up-to-ttai.js +4 -2
  202. package/dist/esm/create-payload/utils/get-ssr-done-time-value.js +4 -2
  203. package/dist/esm/create-payload/utils/get-vc-metrics.js +9 -7
  204. package/dist/esm/create-post-interaction-log-payload/index.js +14 -12
  205. package/dist/esm/custom-data/index.js +3 -2
  206. package/dist/esm/custom-mark/index.js +3 -2
  207. package/dist/esm/custom-spans/index.js +3 -2
  208. package/dist/esm/custom-timings/index.js +5 -4
  209. package/dist/esm/experience-trace-id-context/index.js +15 -14
  210. package/dist/esm/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +3 -2
  211. package/dist/esm/feature-flags-accessed/common/utils/index.js +11 -10
  212. package/dist/esm/feature-flags-accessed/index.js +3 -2
  213. package/dist/esm/generate-id/index.js +4 -2
  214. package/dist/esm/global-error-handler/index.js +14 -13
  215. package/dist/esm/initial-page-load-extra-timing/index.js +5 -4
  216. package/dist/esm/interaction-metrics/index.js +109 -108
  217. package/dist/esm/interaction-metrics/post-interaction-log.js +10 -0
  218. package/dist/esm/interaction-metrics-init/index.js +17 -10
  219. package/dist/esm/interaction-metrics-init/schedule-idle-callback.js +7 -3
  220. package/dist/esm/resource-timing/common/utils/config.js +9 -8
  221. package/dist/esm/resource-timing/common/utils/resource-timing-buffer.js +13 -12
  222. package/dist/esm/resource-timing/main.js +27 -20
  223. package/dist/esm/resource-timing/utils.js +3 -2
  224. package/dist/esm/round-number/index.js +3 -2
  225. package/dist/esm/route-name/index.js +4 -2
  226. package/dist/esm/segment/schedule-on-paint.js +7 -4
  227. package/dist/esm/segment/segment.js +9 -5
  228. package/dist/esm/self-measurements/index.js +246 -0
  229. package/dist/esm/set-interaction-error/index.js +3 -2
  230. package/dist/esm/short-id/index.js +4 -2
  231. package/dist/esm/ssr/index.js +17 -16
  232. package/dist/esm/trace-interaction/index.js +6 -4
  233. package/dist/esm/trace-pageload/index.js +6 -4
  234. package/dist/esm/trace-press/index.js +4 -2
  235. package/dist/esm/trace-redirect/index.js +4 -2
  236. package/dist/esm/trace-transition/index.js +5 -3
  237. package/dist/esm/trace-transition/utils/generate-span-id/index.js +3 -2
  238. package/dist/esm/trace-transition/utils/set-interaction-active-trace/index.js +3 -2
  239. package/dist/esm/vc/index.js +16 -4
  240. package/dist/esm/vc/vc-observer/attachAbortListeners.js +3 -2
  241. package/dist/esm/vc/vc-observer/getVCRevisionsData.js +40 -25
  242. package/dist/esm/vc/vc-observer/getViewport.js +5 -4
  243. package/dist/esm/vc/vc-observer/heatmap/heatmap.js +28 -12
  244. package/dist/esm/vc/vc-observer/index.js +170 -133
  245. package/dist/esm/vc/vc-observer/media-wrapper/vc-utils.js +3 -2
  246. package/dist/esm/vc/vc-observer/observers/editor-lnv/index.js +17 -0
  247. package/dist/esm/vc/vc-observer/observers/index.js +82 -25
  248. package/dist/esm/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.js +4 -7
  249. package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +17 -2
  250. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +7 -7
  251. package/dist/esm/vc/vc-observer/revisions/fy25_02.js +2 -0
  252. package/dist/esm/vc/vc-observer/revisions/revisions.js +3 -2
  253. package/dist/esm/vc/vc-observer-new/entries-timeline/index.js +9 -0
  254. package/dist/esm/vc/vc-observer-new/get-element-name.js +4 -2
  255. package/dist/esm/vc/vc-observer-new/get-unique-element-name.js +12 -10
  256. package/dist/esm/vc/vc-observer-new/index.js +9 -0
  257. package/dist/esm/vc/vc-observer-new/metric-calculator/abstract-base-vc-calculator.js +2 -0
  258. package/dist/esm/vc/vc-observer-new/metric-calculator/fy25_03/index.js +6 -1
  259. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.js +19 -9
  260. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.js +26 -24
  261. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/heatmap.js +18 -6
  262. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.js +26 -13
  263. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/index.js +9 -7
  264. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.js +49 -39
  265. package/dist/esm/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.js +9 -7
  266. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.js +4 -2
  267. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.js +4 -2
  268. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.js +4 -2
  269. package/dist/esm/vc/vc-observer-new/metric-calculator/utils/task-yield.js +10 -7
  270. package/dist/esm/vc/vc-observer-new/viewport-observer/index.js +15 -7
  271. package/dist/esm/vc/vc-observer-new/viewport-observer/intersection-observer/index.js +15 -12
  272. package/dist/esm/vc/vc-observer-new/viewport-observer/mutation-observer/index.js +15 -12
  273. package/dist/esm/vc/vc-observer-new/viewport-observer/performance-observer/index.js +11 -7
  274. package/dist/esm/vc/vc-observer-new/window-event-observer/index.js +7 -1
  275. package/dist/types/additional-payload/utils/cache-hit-ratio/index.d.ts +1 -1
  276. package/dist/types/additional-payload/utils/lighthouse-metrics/index.d.ts +2 -2
  277. package/dist/types/assets/index.d.ts +3 -1
  278. package/dist/types/assets/utils.d.ts +1 -1
  279. package/dist/types/bundle-eval-timing/index.d.ts +2 -2
  280. package/dist/types/coinflip/index.d.ts +2 -1
  281. package/dist/types/common/index.d.ts +2 -1
  282. package/dist/types/common/react-ufo-payload-schema.d.ts +175 -0
  283. package/dist/types/common/vc/types.d.ts +20 -10
  284. package/dist/types/config/index.d.ts +14 -16
  285. package/dist/types/create-experimental-interaction-metrics-payload/index.d.ts +4 -3
  286. package/dist/types/create-payload/common/utils/index.d.ts +6 -7
  287. package/dist/types/create-payload/index.d.ts +1250 -1537
  288. package/dist/types/create-payload/utils/get-interaction-status.d.ts +2 -1
  289. package/dist/types/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -1
  290. package/dist/types/create-payload/utils/get-ssr-done-time-value.d.ts +2 -1
  291. package/dist/types/create-payload/utils/get-vc-metrics.d.ts +3 -2
  292. package/dist/types/create-post-interaction-log-payload/index.d.ts +3 -2
  293. package/dist/types/custom-data/index.d.ts +1 -1
  294. package/dist/types/custom-mark/index.d.ts +1 -1
  295. package/dist/types/custom-spans/index.d.ts +1 -1
  296. package/dist/types/custom-timings/index.d.ts +2 -2
  297. package/dist/types/generate-id/index.d.ts +2 -1
  298. package/dist/types/hidden-timing/index.d.ts +1 -1
  299. package/dist/types/initial-page-load-extra-timing/index.d.ts +2 -2
  300. package/dist/types/interaction-context/index.d.ts +3 -3
  301. package/dist/types/interaction-metrics/index.d.ts +42 -42
  302. package/dist/types/interaction-metrics/post-interaction-log.d.ts +1 -0
  303. package/dist/types/interaction-metrics-init/schedule-idle-callback.d.ts +2 -1
  304. package/dist/types/resource-timing/common/utils/config.d.ts +1 -1
  305. package/dist/types/resource-timing/utils.d.ts +1 -1
  306. package/dist/types/round-number/index.d.ts +1 -1
  307. package/dist/types/route-name/index.d.ts +4 -3
  308. package/dist/types/segment/schedule-on-paint.d.ts +2 -1
  309. package/dist/types/self-measurements/index.d.ts +57 -0
  310. package/dist/types/set-interaction-error/index.d.ts +1 -1
  311. package/dist/types/short-id/index.d.ts +2 -1
  312. package/dist/types/ssr/index.d.ts +5 -5
  313. package/dist/types/trace-interaction/index.d.ts +2 -1
  314. package/dist/types/trace-pageload/index.d.ts +3 -2
  315. package/dist/types/trace-press/index.d.ts +2 -1
  316. package/dist/types/trace-redirect/index.d.ts +2 -1
  317. package/dist/types/trace-transition/index.d.ts +2 -1
  318. package/dist/types/vc/index.d.ts +2 -2
  319. package/dist/types/vc/vc-observer/getVCRevisionsData.d.ts +7 -7
  320. package/dist/types/vc/vc-observer/getViewport.d.ts +2 -2
  321. package/dist/types/vc/vc-observer/heatmap/heatmap.d.ts +7 -4
  322. package/dist/types/vc/vc-observer/index.d.ts +4 -4
  323. package/dist/types/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +5 -4
  324. package/dist/types/vc/vc-observer/observers/types.d.ts +1 -1
  325. package/dist/types/vc/vc-observer-new/get-element-name.d.ts +2 -1
  326. package/dist/types/vc/vc-observer-new/get-unique-element-name.d.ts +2 -1
  327. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +2 -3
  328. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +3 -2
  329. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +3 -2
  330. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +2 -1
  331. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +2 -1
  332. package/dist/types/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +3 -2
  333. package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +2 -1
  334. package/dist/types/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +2 -1
  335. package/dist/types/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +2 -1
  336. package/dist/types/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +2 -1
  337. package/dist/types/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
  338. package/dist/types/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +2 -1
  339. package/dist/types/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +3 -3
  340. package/dist/types-ts4.5/additional-payload/utils/cache-hit-ratio/index.d.ts +1 -1
  341. package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/index.d.ts +2 -2
  342. package/dist/types-ts4.5/assets/index.d.ts +3 -1
  343. package/dist/types-ts4.5/assets/utils.d.ts +1 -1
  344. package/dist/types-ts4.5/bundle-eval-timing/index.d.ts +2 -2
  345. package/dist/types-ts4.5/coinflip/index.d.ts +2 -1
  346. package/dist/types-ts4.5/common/index.d.ts +2 -1
  347. package/dist/types-ts4.5/common/react-ufo-payload-schema.d.ts +177 -0
  348. package/dist/types-ts4.5/common/vc/types.d.ts +20 -10
  349. package/dist/types-ts4.5/config/index.d.ts +14 -20
  350. package/dist/types-ts4.5/create-experimental-interaction-metrics-payload/index.d.ts +4 -3
  351. package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +6 -7
  352. package/dist/types-ts4.5/create-payload/index.d.ts +1250 -1537
  353. package/dist/types-ts4.5/create-payload/utils/get-interaction-status.d.ts +2 -1
  354. package/dist/types-ts4.5/create-payload/utils/get-page-visibility-up-to-ttai.d.ts +2 -1
  355. package/dist/types-ts4.5/create-payload/utils/get-ssr-done-time-value.d.ts +2 -1
  356. package/dist/types-ts4.5/create-payload/utils/get-vc-metrics.d.ts +3 -2
  357. package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +3 -2
  358. package/dist/types-ts4.5/custom-data/index.d.ts +1 -1
  359. package/dist/types-ts4.5/custom-mark/index.d.ts +1 -1
  360. package/dist/types-ts4.5/custom-spans/index.d.ts +1 -1
  361. package/dist/types-ts4.5/custom-timings/index.d.ts +2 -2
  362. package/dist/types-ts4.5/generate-id/index.d.ts +2 -1
  363. package/dist/types-ts4.5/hidden-timing/index.d.ts +1 -1
  364. package/dist/types-ts4.5/initial-page-load-extra-timing/index.d.ts +2 -2
  365. package/dist/types-ts4.5/interaction-context/index.d.ts +3 -3
  366. package/dist/types-ts4.5/interaction-metrics/index.d.ts +42 -42
  367. package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +1 -0
  368. package/dist/types-ts4.5/interaction-metrics-init/schedule-idle-callback.d.ts +2 -1
  369. package/dist/types-ts4.5/resource-timing/common/utils/config.d.ts +1 -1
  370. package/dist/types-ts4.5/resource-timing/utils.d.ts +1 -1
  371. package/dist/types-ts4.5/round-number/index.d.ts +1 -1
  372. package/dist/types-ts4.5/route-name/index.d.ts +4 -3
  373. package/dist/types-ts4.5/segment/schedule-on-paint.d.ts +2 -1
  374. package/dist/types-ts4.5/self-measurements/index.d.ts +57 -0
  375. package/dist/types-ts4.5/set-interaction-error/index.d.ts +1 -1
  376. package/dist/types-ts4.5/short-id/index.d.ts +2 -1
  377. package/dist/types-ts4.5/ssr/index.d.ts +5 -5
  378. package/dist/types-ts4.5/trace-interaction/index.d.ts +2 -1
  379. package/dist/types-ts4.5/trace-pageload/index.d.ts +3 -2
  380. package/dist/types-ts4.5/trace-press/index.d.ts +2 -1
  381. package/dist/types-ts4.5/trace-redirect/index.d.ts +2 -1
  382. package/dist/types-ts4.5/trace-transition/index.d.ts +2 -1
  383. package/dist/types-ts4.5/vc/index.d.ts +2 -2
  384. package/dist/types-ts4.5/vc/vc-observer/getVCRevisionsData.d.ts +7 -7
  385. package/dist/types-ts4.5/vc/vc-observer/getViewport.d.ts +2 -2
  386. package/dist/types-ts4.5/vc/vc-observer/heatmap/heatmap.d.ts +7 -4
  387. package/dist/types-ts4.5/vc/vc-observer/index.d.ts +4 -4
  388. package/dist/types-ts4.5/vc/vc-observer/observers/non-visual-styles/is-non-visual-style-mutation.d.ts +5 -4
  389. package/dist/types-ts4.5/vc/vc-observer/observers/types.d.ts +1 -1
  390. package/dist/types-ts4.5/vc/vc-observer-new/get-element-name.d.ts +2 -1
  391. package/dist/types-ts4.5/vc/vc-observer-new/get-unique-element-name.d.ts +2 -1
  392. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/canvas-pixel.d.ts +2 -3
  393. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/canvas-heatmap/index.d.ts +3 -2
  394. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/heatmap/index.d.ts +3 -2
  395. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/index.d.ts +2 -1
  396. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/calc-union-area.d.ts +2 -1
  397. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/percentile-calc/rect-sweeping-line/index.d.ts +3 -2
  398. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-height.d.ts +2 -1
  399. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/get-viewport-width.d.ts +2 -1
  400. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/is-viewport-entry-data.d.ts +2 -1
  401. package/dist/types-ts4.5/vc/vc-observer-new/metric-calculator/utils/task-yield.d.ts +2 -1
  402. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/index.d.ts +1 -1
  403. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/mutation-observer/index.d.ts +2 -1
  404. package/dist/types-ts4.5/vc/vc-observer-new/viewport-observer/performance-observer/index.d.ts +3 -3
  405. package/package.json +12 -12
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../self-measurements';
3
3
  const ANCESTOR_LOOKUP_LIMIT = 10;
4
4
  export class SSRPlaceholderHandlers {
5
5
  constructor() {
@@ -7,7 +7,7 @@ export class SSRPlaceholderHandlers {
7
7
  _defineProperty(this, "callbacks", new Map());
8
8
  _defineProperty(this, "getSizeCallbacks", new Map());
9
9
  _defineProperty(this, "reactValidateCallbacks", new Map());
10
- _defineProperty(this, "EQUALITY_THRESHOLD", fg('platform_ufo_ssr_placeholder_round_rect_size_check') ? 1 : 0.1);
10
+ _defineProperty(this, "EQUALITY_THRESHOLD", 1);
11
11
  _defineProperty(this, "intersectionObserverCallback", ({
12
12
  target,
13
13
  boundingClientRect
@@ -60,6 +60,7 @@ export class SSRPlaceholderHandlers {
60
60
  this.reactValidateCallbacks.delete(staticKey);
61
61
  }
62
62
  });
63
+ const operationTimer = markProfilingStart('SSRPlaceholderHandlers constructor');
63
64
  if (typeof IntersectionObserver === 'function') {
64
65
  // Only instantiate the IntersectionObserver if it's supported
65
66
  this.intersectionObserver = new IntersectionObserver(entries => entries.filter(entry => entry.intersectionRatio > 0).forEach(this.intersectionObserverCallback));
@@ -95,6 +96,20 @@ export class SSRPlaceholderHandlers {
95
96
  delete window.__SSR_PLACEHOLDERS_DIMENSIONS__;
96
97
  }
97
98
  }
99
+ this.clear = withProfiling(this.clear.bind(this), ['vc']);
100
+ this.isPlaceholder = withProfiling(this.isPlaceholder.bind(this), ['vc']);
101
+ this.isPlaceholderReplacement = withProfiling(this.isPlaceholderReplacement.bind(this), ['vc']);
102
+ this.isPlaceholderIgnored = withProfiling(this.isPlaceholderIgnored.bind(this), ['vc']);
103
+ this.findNearestPlaceholderContainerIfIgnored = withProfiling(this.findNearestPlaceholderContainerIfIgnored.bind(this), ['vc']);
104
+ this.checkIfExistedAndSizeMatching = withProfiling(this.checkIfExistedAndSizeMatching.bind(this), ['vc']);
105
+ this.getSize = withProfiling(this.getSize.bind(this), ['vc']);
106
+ this.validateReactComponentMatchToPlaceholder = withProfiling(this.validateReactComponentMatchToPlaceholder.bind(this), ['vc']);
107
+ this.hasSameSizePosition = withProfiling(this.hasSameSizePosition.bind(this), ['vc']);
108
+ this.isDummyRect = withProfiling(this.isDummyRect.bind(this), ['vc']);
109
+ this.intersectionObserverCallback = withProfiling(this.intersectionObserverCallback.bind(this), ['vc']);
110
+ markProfilingEnd(operationTimer, {
111
+ tags: ['vc']
112
+ });
98
113
  }
99
114
  clear() {
100
115
  this.staticPlaceholders = new Map();
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { withProfiling } from '../../../self-measurements';
3
3
  import { ViewportUpdateClassifier } from './ViewportUpdateClassifier';
4
4
  const legacyIgnoreReasons = ['image', 'ssr-hydration', 'editor-lazy-node-view', 'editor-container-mutation'];
5
5
  export class FY25_01Classifier extends ViewportUpdateClassifier {
@@ -14,12 +14,11 @@ export class FY25_01Classifier extends ViewportUpdateClassifier {
14
14
  entries.reduce((acc = 0, v) => {
15
15
  let VCRatio = v[1] / totalPainted + acc;
16
16
  const time = v[0];
17
- if (fg('platform_ufo_fix_vc_observer_rounding_error')) {
18
- // @todo apply fix to include small changes into accumulator
19
- const preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
20
- const preciseAccRatio = Math.round(acc * 100);
21
- VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
22
- }
17
+
18
+ // @todo apply fix to include small changes into accumulator
19
+ const preciseCurrRatio = Math.round(100 * (v[1] / totalPainted));
20
+ const preciseAccRatio = Math.round(acc * 100);
21
+ VCRatio = (preciseCurrRatio + preciseAccRatio) / 100;
23
22
  VCParts.forEach(value => {
24
23
  if ((VC[value] === null || VC[value] === undefined) && VCRatio >= value / 100) {
25
24
  var _componentsLog$time;
@@ -52,6 +51,7 @@ export class FY25_01Classifier extends ViewportUpdateClassifier {
52
51
  }
53
52
  }]);
54
53
  this.mergeConfig();
54
+ this.VCCalculationMethod = withProfiling(this.VCCalculationMethod.bind(this), ['vc']);
55
55
  }
56
56
  }
57
57
  export const revFY25_01Classifier = new FY25_01Classifier();
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { withProfiling } from '../../../self-measurements';
2
3
  import { FY25_01Classifier } from './fy25_01';
3
4
  export class FY25_02Classifier extends FY25_01Classifier {
4
5
  // @todo remove it once fixed as described: https://product-fabric.atlassian.net/browse/AFO-3443
@@ -30,6 +31,7 @@ export class FY25_02Classifier extends FY25_01Classifier {
30
31
  }]);
31
32
  _defineProperty(this, "removedFilters", []);
32
33
  this.mergeConfig();
34
+ this.filterComponentsLog = withProfiling(this.filterComponentsLog.bind(this), ['vc']);
33
35
  }
34
36
  }
35
37
  export const revFY25_02Classifier = new FY25_02Classifier();
@@ -1,7 +1,8 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { withProfiling } from '../../../self-measurements';
2
3
  import { revFY25_01Classifier } from './fy25_01';
3
4
  import { revFY25_02Classifier } from './fy25_02';
4
- export const getRevisions = () => {
5
+ export const getRevisions = withProfiling(function getRevisions() {
5
6
  if (fg('platform_ufo_disable_ttvc_v1')) {
6
7
  return [{
7
8
  name: 'fy25.02',
@@ -15,4 +16,4 @@ export const getRevisions = () => {
15
16
  name: 'fy25.02',
16
17
  classifier: revFY25_02Classifier
17
18
  }];
18
- };
19
+ }, ['vc']);
@@ -1,9 +1,18 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../self-measurements';
2
3
  export default class EntriesTimeline {
3
4
  constructor() {
4
5
  _defineProperty(this, "unorderedEntries", []);
5
6
  _defineProperty(this, "sortedEntriesCache", new Map());
7
+ const operationTimer = markProfilingStart('EntriesTimeline constructor');
6
8
  this.unorderedEntries = [];
9
+ this.push = withProfiling(this.push.bind(this), ['vc']);
10
+ this.getCacheKey = withProfiling(this.getCacheKey.bind(this), ['vc']);
11
+ this.getOrderedEntries = withProfiling(this.getOrderedEntries.bind(this), ['vc']);
12
+ this.clear = withProfiling(this.clear.bind(this), ['vc']);
13
+ markProfilingEnd(operationTimer, {
14
+ tags: ['vc']
15
+ });
7
16
  }
8
17
  push(entry) {
9
18
  this.unorderedEntries.push(entry);
@@ -1,5 +1,6 @@
1
+ import { withProfiling } from '../../self-measurements';
1
2
  const nameCache = new WeakMap();
2
- export default function getElementName(selectorConfig, element) {
3
+ const getElementName = withProfiling(function getElementName(selectorConfig, element) {
3
4
  if (!(element instanceof HTMLElement)) {
4
5
  return 'error';
5
6
  }
@@ -64,4 +65,5 @@ export default function getElementName(selectorConfig, element) {
64
65
  const name = `${tagName}${attributes || classList}`;
65
66
  nameCache.set(element, name);
66
67
  return name;
67
- }
68
+ }, ['vc']);
69
+ export default getElementName;
@@ -1,23 +1,24 @@
1
+ import { withProfiling } from '../../self-measurements';
1
2
  const nameCache = new WeakMap();
2
- function getAttributeSelector(element, attributeName) {
3
+ const getAttributeSelector = withProfiling(function getAttributeSelector(element, attributeName) {
3
4
  const attrValue = element.getAttribute(attributeName);
4
5
  if (!attrValue) {
5
6
  return '';
6
7
  }
7
8
  return `[${attributeName}="${attrValue}"]`;
8
- }
9
- function isValidSelector(selector) {
9
+ }, ['vc']);
10
+ const isValidSelector = withProfiling(function isValidSelector(selector) {
10
11
  try {
11
12
  document.querySelector(selector);
12
13
  return true;
13
14
  } catch (err) {
14
15
  return false;
15
16
  }
16
- }
17
- function isSelectorUnique(selector) {
17
+ }, ['vc']);
18
+ const isSelectorUnique = withProfiling(function isSelectorUnique(selector) {
18
19
  return document.querySelectorAll(selector).length === 1;
19
- }
20
- function getUniqueSelector(selectorConfig, element) {
20
+ }, ['vc']);
21
+ const getUniqueSelector = withProfiling(function getUniqueSelector(selectorConfig, element) {
21
22
  let currentElement = element;
22
23
  const parts = [];
23
24
  const MAX_DEPTH = 3;
@@ -59,8 +60,8 @@ function getUniqueSelector(selectorConfig, element) {
59
60
  }
60
61
  }
61
62
  return potentialSelector;
62
- }
63
- export default function getElementName(selectorConfig, element) {
63
+ }, ['vc']);
64
+ const getElementName = withProfiling(function getElementName(selectorConfig, element) {
64
65
  if (!(element instanceof HTMLElement)) {
65
66
  return 'error';
66
67
  }
@@ -71,4 +72,5 @@ export default function getElementName(selectorConfig, element) {
71
72
  const uniqueSelector = getUniqueSelector(selectorConfig, element);
72
73
  nameCache.set(element, uniqueSelector);
73
74
  return uniqueSelector;
74
- }
75
+ }, ['vc']);
76
+ export default getElementName;
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../self-measurements';
2
3
  import EntriesTimeline from './entries-timeline';
3
4
  import getElementName from './get-element-name';
4
5
  import VCCalculator_FY25_03 from './metric-calculator/fy25_03';
@@ -16,6 +17,7 @@ export default class VCObserverNew {
16
17
  var _config$selectorConfi;
17
18
  _defineProperty(this, "viewportObserver", null);
18
19
  _defineProperty(this, "windowEventObserver", null);
20
+ const operationTimer = markProfilingStart('VCObserverNew constructor');
19
21
  this.entriesTimeline = new EntriesTimeline();
20
22
  this.selectorConfig = (_config$selectorConfi = config.selectorConfig) !== null && _config$selectorConfi !== void 0 ? _config$selectorConfi : DEFAULT_SELECTOR_CONFIG;
21
23
  this.viewportObserver = new ViewportObserver({
@@ -61,6 +63,13 @@ export default class VCObserverNew {
61
63
  });
62
64
  }
63
65
  });
66
+ this.start = withProfiling(this.start.bind(this), ['vc']);
67
+ this.stop = withProfiling(this.stop.bind(this), ['vc']);
68
+ this.getVCResult = withProfiling(this.getVCResult.bind(this), ['vc']);
69
+ this.getElementName = withProfiling(this.getElementName.bind(this), ['vc']);
70
+ markProfilingEnd(operationTimer, {
71
+ tags: ['vc']
72
+ });
64
73
  }
65
74
  start({
66
75
  startTime
@@ -1,9 +1,11 @@
1
+ import { withProfiling } from '../../../self-measurements';
1
2
  import calculateTTVCPercentiles from './percentile-calc';
2
3
  import getViewportHeight from './utils/get-viewport-height';
3
4
  import getViewportWidth from './utils/get-viewport-width';
4
5
  export default class AbstractVCCalculatorBase {
5
6
  constructor(revisionNo) {
6
7
  this.revisionNo = revisionNo;
8
+ this.calculate = withProfiling(this.calculate.bind(this), ['vc']);
7
9
  }
8
10
  async calculate({
9
11
  startTime,
@@ -1,3 +1,4 @@
1
+ import { withProfiling } from '../../../../self-measurements';
1
2
  import AbstractVCCalculatorBase from '../abstract-base-vc-calculator';
2
3
  import isViewportEntryData from '../utils/is-viewport-entry-data';
3
4
  const ABORTING_WINDOW_EVENT = ['wheel', 'scroll', 'keydown', 'resize'];
@@ -11,6 +12,8 @@ export const KNOWN_ATTRIBUTES_THAT_DOES_NOT_CAUSE_LAYOUT_SHIFTS = ['data-drop-ta
11
12
  export default class VCCalculator_FY25_03 extends AbstractVCCalculatorBase {
12
13
  constructor() {
13
14
  super(REVISION_NO);
15
+ this.isEntryIncluded = withProfiling(this.isEntryIncluded.bind(this), ['vc']);
16
+ this.isVCClean = withProfiling(this.isVCClean.bind(this), ['vc']);
14
17
  }
15
18
  isEntryIncluded(entry) {
16
19
  if (!CONSIDERED_ENTRY_TYPE.includes(entry.type)) {
@@ -1,3 +1,4 @@
1
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
1
2
  import taskYield from '../../utils/task-yield';
2
3
 
3
4
  // 24-bit color value
@@ -25,6 +26,7 @@ export class ViewportCanvas {
25
26
  * @throws {Error} If canvas context cannot be obtained
26
27
  */
27
28
  constructor(viewport, scaleFactor = 1) {
29
+ const operationTimer = markProfilingStart('ViewportCanvas constructor');
28
30
  this.scaleFactor = scaleFactor;
29
31
  this.colorCounter = 1;
30
32
  this.colorTimeMap = new Map();
@@ -54,6 +56,14 @@ export class ViewportCanvas {
54
56
  this.ctx = ctx;
55
57
  this.ctx.globalCompositeOperation = 'source-over';
56
58
  this.clear();
59
+ this.getScaledDimensions = withProfiling(this.getScaledDimensions.bind(this), ['vc']);
60
+ this.clear = withProfiling(this.clear.bind(this), ['vc']);
61
+ this.generateColor = withProfiling(this.generateColor.bind(this), ['vc']);
62
+ this.drawRect = withProfiling(this.drawRect.bind(this), ['vc']);
63
+ this.getPixelCounts = withProfiling(this.getPixelCounts.bind(this), ['vc']);
64
+ markProfilingEnd(operationTimer, {
65
+ tags: ['vc']
66
+ });
57
67
  }
58
68
  getScaledDimensions() {
59
69
  return {
@@ -148,7 +158,7 @@ export class ViewportCanvas {
148
158
  * @param number - The input number to be split into RGB components.
149
159
  * @returns The RGB color string in the format "rgb(r, g, b)".
150
160
  */
151
- export function getRGBComponents(n) {
161
+ export const getRGBComponents = withProfiling(function getRGBComponents(n) {
152
162
  // Ensure the input is within the valid range for a 24-bit color
153
163
  if (n < 0 || n > 0xffffff) {
154
164
  throw new Error('Input number must be between 0 and 16777215 (inclusive).');
@@ -163,7 +173,7 @@ export function getRGBComponents(n) {
163
173
  // Extract red component (bits 16-23)
164
174
  const red = n >> 16 & 0xff;
165
175
  return `rgb(${red}, ${green}, ${blue})`;
166
- }
176
+ }, ['vc']);
167
177
 
168
178
  /**
169
179
  * Calculates the number of pixels drawn for each color in the image data.
@@ -172,7 +182,7 @@ export function getRGBComponents(n) {
172
182
  * @param arraySize - The amount of timestamps that were drawn in the viewport
173
183
  * @returns A Map containing color to pixel count mappings.
174
184
  */
175
- export async function calculateDrawnPixelsRaw(imageData, scaleFactor, arraySize) {
185
+ export const calculateDrawnPixelsRaw = withProfiling(async function calculateDrawnPixelsRaw(imageData, scaleFactor, arraySize) {
176
186
  const data = imageData.data;
177
187
  const arr = new Uint32Array(arraySize);
178
188
  for (let i = 0; i < data.length; i += 4) {
@@ -192,4 +202,4 @@ export async function calculateDrawnPixelsRaw(imageData, scaleFactor, arraySize)
192
202
  }
193
203
  }
194
204
  return arr;
195
- }
205
+ }, ['vc']);
@@ -1,6 +1,7 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
+ import { withProfiling } from '../../../../../self-measurements';
2
3
  import { ViewportCanvas } from './canvas-pixel';
3
- export default async function calculateTTVCPercentiles({
4
+ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPercentiles({
4
5
  viewport,
5
6
  orderedEntries,
6
7
  percentiles,
@@ -26,8 +27,9 @@ export default async function calculateTTVCPercentiles({
26
27
  const canvasDimenstions = canvas.getScaledDimensions();
27
28
  const totalPixels = canvasDimenstions.width * canvasDimenstions.height;
28
29
  return calculatePercentiles(timePixelCounts, elementMap, percentiles, totalPixels, startTime);
29
- }
30
- export function calculatePercentiles(timePixelCounts, elementMap, unorderedPercentiles, totalPixels, startTime) {
30
+ }, ['vc']);
31
+ export default calculateTTVCPercentiles;
32
+ export const calculatePercentiles = withProfiling(function calculatePercentiles(timePixelCounts, elementMap, unorderedPercentiles, totalPixels, startTime) {
31
33
  const results = {};
32
34
  let cumulativePixels = 0;
33
35
  const percentiles = unorderedPercentiles.sort((a, b) => a - b);
@@ -69,4 +71,4 @@ export function calculatePercentiles(timePixelCounts, elementMap, unorderedPerce
69
71
  previousResult = results[`${percentile}`];
70
72
  }
71
73
  return results;
72
- }
74
+ }, ['vc']);
@@ -1,27 +1,28 @@
1
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
1
2
  import isViewportEntryData from '../../utils/is-viewport-entry-data';
2
3
  import taskYield from '../../utils/task-yield';
3
4
  const MAX_HEATMAP_SIZE = 1000;
4
- function createEmptyHeatmapEntry() {
5
+ const createEmptyHeatmapEntry = withProfiling(function createEmptyHeatmapEntry() {
5
6
  return {
6
7
  head: null,
7
8
  previousEntries: []
8
9
  };
9
- }
10
- function createEmptyMap(heatmapWidth, heatmapHeight) {
10
+ }, ['vc']);
11
+ const createEmptyMap = withProfiling(function createEmptyMap(heatmapWidth, heatmapHeight) {
11
12
  return Array.from({
12
13
  length: heatmapHeight
13
14
  }).map(() => Array.from({
14
15
  length: heatmapWidth
15
16
  }).map(createEmptyHeatmapEntry));
16
- }
17
- function isRectInside(a, b) {
17
+ }, ['vc']);
18
+ const isRectInside = withProfiling(function isRectInside(a, b) {
18
19
  if (!a || !b) {
19
20
  return false;
20
21
  }
21
22
 
22
23
  // Check if all corners of rectangle a are within the bounds of rectangle b
23
24
  return a.left >= b.left && a.right <= b.right && a.top >= b.top && a.bottom <= b.bottom;
24
- }
25
+ }, ['vc']);
25
26
  export default class Heatmap {
26
27
  /**
27
28
  * Heatmap Width
@@ -39,6 +40,8 @@ export default class Heatmap {
39
40
  viewport,
40
41
  heatmapSize
41
42
  }) {
43
+ const operationTimer = markProfilingStart('Heatmap constructor');
44
+
42
45
  // TODO timeOrigin? do we need? for SSR??
43
46
  this.viewport = viewport;
44
47
  const safeSize = Math.min(heatmapSize, MAX_HEATMAP_SIZE);
@@ -65,6 +68,15 @@ export default class Heatmap {
65
68
  this.scaleY = this.height / viewport.height;
66
69
  this.heatmapAreaSize = this.width * this.height;
67
70
  this.map = createEmptyMap(this.width, this.height);
71
+ this.getHeatmap = withProfiling(this.getHeatmap.bind(this), ['vc']);
72
+ this.getCell = withProfiling(this.getCell.bind(this), ['vc']);
73
+ this.mapDOMRectToHeatmap = withProfiling(this.mapDOMRectToHeatmap.bind(this), ['vc']);
74
+ this.getRatio = withProfiling(this.getRatio.bind(this), ['vc']);
75
+ this.applyEntriesToHeatmap = withProfiling(this.applyEntriesToHeatmap.bind(this), ['vc']);
76
+ this.getVCPercentMetrics = withProfiling(this.getVCPercentMetrics.bind(this), ['vc']);
77
+ markProfilingEnd(operationTimer, {
78
+ tags: ['vc']
79
+ });
68
80
  }
69
81
  getHeatmap() {
70
82
  return this.map;
@@ -1,27 +1,28 @@
1
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../../../self-measurements';
1
2
  import isViewportEntryData from '../../utils/is-viewport-entry-data';
2
3
  import taskYield from '../../utils/task-yield';
3
4
  const MAX_HEATMAP_SIZE = 1000;
4
- function createEmptyHeatmapEntry() {
5
+ const createEmptyHeatmapEntry = withProfiling(function createEmptyHeatmapEntry() {
5
6
  return {
6
7
  head: null,
7
8
  previousEntries: []
8
9
  };
9
- }
10
- function createEmptyMap(heatmapWidth, heatmapHeight) {
10
+ }, ['vc']);
11
+ const createEmptyMap = withProfiling(function createEmptyMap(heatmapWidth, heatmapHeight) {
11
12
  return Array.from({
12
13
  length: heatmapHeight
13
14
  }).map(() => Array.from({
14
15
  length: heatmapWidth
15
16
  }).map(createEmptyHeatmapEntry));
16
- }
17
- function isRectInside(a, b) {
17
+ }, ['vc']);
18
+ const isRectInside = withProfiling(function isRectInside(a, b) {
18
19
  if (!a || !b) {
19
20
  return false;
20
21
  }
21
22
 
22
23
  // Check if all corners of rectangle a are within the bounds of rectangle b
23
24
  return a.left >= b.left && a.right <= b.right && a.top >= b.top && a.bottom <= b.bottom;
24
- }
25
+ }, ['vc']);
25
26
  class Heatmap {
26
27
  /**
27
28
  * Heatmap Width
@@ -39,6 +40,8 @@ class Heatmap {
39
40
  viewport,
40
41
  heatmapSize
41
42
  }) {
43
+ const operationTimer = markProfilingStart('Heatmap constructor');
44
+
42
45
  // TODO timeOrigin? do we need? for SSR??
43
46
  this.viewport = viewport;
44
47
  const safeSize = Math.min(heatmapSize, MAX_HEATMAP_SIZE);
@@ -65,6 +68,15 @@ class Heatmap {
65
68
  this.scaleY = this.height / viewport.height;
66
69
  this.heatmapAreaSize = this.width * this.height;
67
70
  this.map = createEmptyMap(this.width, this.height);
71
+ this.getHeatmap = withProfiling(this.getHeatmap.bind(this), ['vc']);
72
+ this.getCell = withProfiling(this.getCell.bind(this), ['vc']);
73
+ this.mapDOMRectToHeatmap = withProfiling(this.mapDOMRectToHeatmap.bind(this), ['vc']);
74
+ this.getRatio = withProfiling(this.getRatio.bind(this), ['vc']);
75
+ this.applyEntriesToHeatmap = withProfiling(this.applyEntriesToHeatmap.bind(this), ['vc']);
76
+ this.getVCPercentMetrics = withProfiling(this.getVCPercentMetrics.bind(this), ['vc']);
77
+ markProfilingEnd(operationTimer, {
78
+ tags: ['vc']
79
+ });
68
80
  }
69
81
  getHeatmap() {
70
82
  return this.map;
@@ -246,7 +258,7 @@ class Heatmap {
246
258
  return result;
247
259
  }
248
260
  }
249
- export default async function calculateTTVCPercentiles({
261
+ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPercentiles({
250
262
  orderedEntries,
251
263
  viewport,
252
264
  percentiles,
@@ -259,4 +271,5 @@ export default async function calculateTTVCPercentiles({
259
271
  await heatmap.applyEntriesToHeatmap(orderedEntries);
260
272
  const vcDetails = await heatmap.getVCPercentMetrics(percentiles, startTime);
261
273
  return vcDetails;
262
- }
274
+ }, ['vc']);
275
+ export default calculateTTVCPercentiles;
@@ -1,7 +1,8 @@
1
+ import { withProfiling } from '../../../../self-measurements';
1
2
  import calcUsingCanvas from './canvas-heatmap';
2
3
  import caclUsingOldHeatmap from './heatmap';
3
4
  import calcUsingRectSweepingLine from './rect-sweeping-line';
4
- export default async function calculateTTVCPercentiles(arg) {
5
+ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPercentiles(arg) {
5
6
  const algo = 'canvas_heatmap';
6
7
  if (algo === 'canvas_heatmap') {
7
8
  const vcDetails = await calcUsingCanvas(arg);
@@ -16,4 +17,5 @@ export default async function calculateTTVCPercentiles(arg) {
16
17
  return vcDetails;
17
18
  }
18
19
  throw new Error('unexpected Error algo not chosen correctly');
19
- }
20
+ }, ['vc']);
21
+ export default calculateTTVCPercentiles;
@@ -1,3 +1,4 @@
1
+ import { withProfiling } from '../../../../../self-measurements';
1
2
  /**
2
3
  * Calculate the union areas of all rectangles using Sweep Line Algorithm
3
4
  *
@@ -8,7 +9,7 @@
8
9
  * @param rectangles
9
10
  * @returns
10
11
  */
11
- export default function calculateUnionArea(rectangles) {
12
+ const calculateUnionArea = withProfiling(function calculateUnionArea(rectangles) {
12
13
  // Step 1: Create sweep line events
13
14
  const events = createSweepLineEvents(rectangles);
14
15
 
@@ -27,8 +28,9 @@ export default function calculateUnionArea(rectangles) {
27
28
  updateActiveIntervals(activeIntervals, event);
28
29
  }
29
30
  return totalArea;
30
- }
31
- function createSweepLineEvents(rectangles) {
31
+ }, ['vc']);
32
+ export default calculateUnionArea;
33
+ const createSweepLineEvents = withProfiling(function createSweepLineEvents(rectangles) {
32
34
  const events = [];
33
35
  for (const rect of rectangles) {
34
36
  // Create start and end events for each rectangle
@@ -47,8 +49,8 @@ function createSweepLineEvents(rectangles) {
47
49
  }
48
50
  // Sort events by x-coordinate (and type as tiebreaker)
49
51
  return events.sort((a, b) => a.x === b.x ? a.type === 'end' ? 1 : -1 : a.x - b.x);
50
- }
51
- function calculateActiveHeight(intervals) {
52
+ }, ['vc']);
53
+ const calculateActiveHeight = withProfiling(function calculateActiveHeight(intervals) {
52
54
  if (intervals.size === 0) {
53
55
  return 0;
54
56
  }
@@ -82,8 +84,8 @@ function calculateActiveHeight(intervals) {
82
84
  }
83
85
  }
84
86
  return totalHeight;
85
- }
86
- function updateActiveIntervals(intervals, event) {
87
+ }, ['vc']);
88
+ const updateActiveIntervals = withProfiling(function updateActiveIntervals(intervals, event) {
87
89
  const key = `${event.top},${event.bottom}`;
88
90
  if (event.type === 'start') {
89
91
  intervals.set(key, (intervals.get(key) || 0) + 1);
@@ -95,4 +97,4 @@ function updateActiveIntervals(intervals, event) {
95
97
  intervals.delete(key);
96
98
  }
97
99
  }
98
- }
100
+ }, ['vc']);
@@ -1,7 +1,8 @@
1
+ import { withProfiling } from '../../../../../self-measurements';
1
2
  import isViewportEntryData from '../../utils/is-viewport-entry-data';
2
3
  import taskYield from '../../utils/task-yield';
3
4
  import calculateUnionArea from './calc-union-area';
4
- export default async function calculateTTVCPercentiles({
5
+ const calculateTTVCPercentiles = withProfiling(async function calculateTTVCPercentiles({
5
6
  orderedEntries,
6
7
  viewport,
7
8
  percentiles,
@@ -56,4 +57,5 @@ export default async function calculateTTVCPercentiles({
56
57
  }
57
58
  }
58
59
  return checkpoints;
59
- }
60
+ }, ['vc']);
61
+ export default calculateTTVCPercentiles;
@@ -1,4 +1,5 @@
1
- export default function getViewportHeight(document = window.document) {
1
+ import { withProfiling } from '../../../../self-measurements';
2
+ const getViewportHeight = withProfiling(function getViewportHeight(document = window.document) {
2
3
  let documentHeight;
3
4
  try {
4
5
  documentHeight = document.documentElement.clientHeight || 0;
@@ -6,4 +7,5 @@ export default function getViewportHeight(document = window.document) {
6
7
  documentHeight = 0;
7
8
  }
8
9
  return Math.max(documentHeight, window.innerHeight || 0);
9
- }
10
+ }, ['vc']);
11
+ export default getViewportHeight;
@@ -1,4 +1,5 @@
1
- export default function getViewportWidth(document = window.document) {
1
+ import { withProfiling } from '../../../../self-measurements';
2
+ const getViewportWidth = withProfiling(function getViewportWidth(document = window.document) {
2
3
  let documentWidth;
3
4
  try {
4
5
  documentWidth = document.documentElement.clientWidth || 0;
@@ -6,4 +7,5 @@ export default function getViewportWidth(document = window.document) {
6
7
  documentWidth = 0;
7
8
  }
8
9
  return Math.max(documentWidth, window.innerWidth || 0);
9
- }
10
+ }, ['vc']);
11
+ export default getViewportWidth;
@@ -1,4 +1,5 @@
1
- export default function isViewportEntryData(data) {
1
+ import { withProfiling } from '../../../../self-measurements';
2
+ const isViewportEntryData = withProfiling(function isViewportEntryData(data) {
2
3
  if (data) {
3
4
  const hasElementName = typeof data.elementName === 'string';
4
5
  const hasRect = typeof data.rect !== 'undefined';
@@ -7,4 +8,5 @@ export default function isViewportEntryData(data) {
7
8
  }
8
9
  }
9
10
  return false;
10
- }
11
+ }, ['vc']);
12
+ export default isViewportEntryData;
@@ -1,5 +1,7 @@
1
+ import { withProfiling } from '../../../../self-measurements';
2
+
1
3
  // See https://developer.mozilla.org/en-US/docs/Web/API/Prioritized_Task_Scheduling_API
2
- export default async function taskYield() {
4
+ const taskYield = withProfiling(async function taskYield() {
3
5
  // This is using globalThis to allow the yield task to be used outside of a browser env
4
6
  if ('scheduler' in globalThis &&
5
7
  // @ts-ignore
@@ -14,4 +16,5 @@ export default async function taskYield() {
14
16
  });
15
17
  setTimeout(resolve, 0);
16
18
  await p;
17
- }
19
+ }, ['vc']);
20
+ export default taskYield;