@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
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _selfMeasurements = require("../../../self-measurements");
10
11
  var _vcUtils = require("../../vc-observer/media-wrapper/vc-utils");
11
12
  var _isNonVisualStyleMutation = _interopRequireDefault(require("../../vc-observer/observers/non-visual-styles/is-non-visual-style-mutation"));
12
13
  var _intersectionObserver = require("./intersection-observer");
@@ -15,7 +16,7 @@ var _performanceObserver = _interopRequireDefault(require("./performance-observe
15
16
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
16
17
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
18
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
18
- function isElementVisible(element) {
19
+ var isElementVisible = (0, _selfMeasurements.withProfiling)(function isElementVisible(element) {
19
20
  if (!(element instanceof HTMLElement)) {
20
21
  return true;
21
22
  }
@@ -31,24 +32,26 @@ function isElementVisible(element) {
31
32
  // there is no support for checkVisibility
32
33
  return true;
33
34
  }
34
- }
35
- function sameRectSize(a, b) {
35
+ }, ['vc']);
36
+ var sameRectSize = (0, _selfMeasurements.withProfiling)(function sameRectSize(a, b) {
36
37
  if (!a || !b) {
37
38
  return false;
38
39
  }
39
40
  return a.width === b.width && a.height === b.height;
40
- }
41
- function sameRectDimensions(a, b) {
41
+ }, ['vc']);
42
+ var sameRectDimensions = (0, _selfMeasurements.withProfiling)(function sameRectDimensions(a, b) {
42
43
  if (!a || !b) {
43
44
  return false;
44
45
  }
45
46
  return a.width === b.width && a.height === b.height && a.x === b.x && a.y === b.y;
46
- }
47
+ }, ['vc']);
47
48
  var ViewportObserver = exports.default = /*#__PURE__*/function () {
48
49
  function ViewportObserver(_ref) {
49
50
  var _this = this;
50
- var onChange = _ref.onChange;
51
+ var _onChange = _ref.onChange;
51
52
  (0, _classCallCheck2.default)(this, ViewportObserver);
53
+ var onChange = (0, _selfMeasurements.withProfiling)(_onChange, ['vc']);
54
+ var operationTimer = (0, _selfMeasurements.markProfilingStart)('ViewportObserver constructor');
52
55
  this.mapVisibleNodeRects = new WeakMap();
53
56
  this.intersectionObserver = (0, _intersectionObserver.createIntersectionObserver)({
54
57
  onEntry: function onEntry(_ref2) {
@@ -186,6 +189,11 @@ var ViewportObserver = exports.default = /*#__PURE__*/function () {
186
189
  }
187
190
  }
188
191
  });
192
+ this.start = (0, _selfMeasurements.withProfiling)(this.start.bind(this), ['vc']);
193
+ this.stop = (0, _selfMeasurements.withProfiling)(this.stop.bind(this), ['vc']);
194
+ (0, _selfMeasurements.markProfilingEnd)(operationTimer, {
195
+ tags: ['vc']
196
+ });
189
197
  }
190
198
  return (0, _createClass2.default)(ViewportObserver, [{
191
199
  key: "start",
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createIntersectionObserver = createIntersectionObserver;
7
- function isValidEntry(entry) {
7
+ var _selfMeasurements = require("../../../../self-measurements");
8
+ var isValidEntry = (0, _selfMeasurements.withProfiling)(function isValidEntry(entry) {
8
9
  return entry.isIntersecting && entry.intersectionRect.width > 0 && entry.intersectionRect.height > 0;
9
- }
10
+ }, ['vc']);
10
11
  function createIntersectionObserver(args) {
11
12
  if (!window || typeof window.IntersectionObserver !== 'function') {
12
13
  return null;
13
14
  }
15
+ var onEntry = (0, _selfMeasurements.withProfiling)(args.onEntry, ['vc']);
16
+ var onObserved = typeof args.onObserved === 'function' ? (0, _selfMeasurements.withProfiling)(args.onObserved, ['vc']) : undefined;
14
17
  var callbacksPerElement = new WeakMap();
15
- var observer = new IntersectionObserver(function (entries) {
16
- var _args$onObserved;
18
+ var intersectionObserverCallback = (0, _selfMeasurements.withProfiling)(function intersectionObserverCallback(entries) {
17
19
  var validEntries = [];
18
20
  var startTime = performance.now();
19
21
  entries.forEach(function (entry) {
@@ -39,7 +41,7 @@ function createIntersectionObserver(args) {
39
41
  } else if (typeof tagOrCallback === 'string') {
40
42
  mutationTag = tagOrCallback;
41
43
  }
42
- args.onEntry({
44
+ onEntry({
43
45
  target: entry.target,
44
46
  rect: entry.intersectionRect,
45
47
  time: entry.time,
@@ -50,21 +52,22 @@ function createIntersectionObserver(args) {
50
52
  callbacksPerElement.delete(entry.target);
51
53
  observer.unobserve(entry.target);
52
54
  });
53
- (_args$onObserved = args.onObserved) === null || _args$onObserved === void 0 || _args$onObserved.call(args, {
55
+ onObserved === null || onObserved === void 0 || onObserved({
54
56
  time: startTime,
55
57
  elements: validEntries
56
58
  });
57
59
  });
60
+ var observer = new IntersectionObserver(intersectionObserverCallback);
58
61
  return {
59
- disconnect: function disconnect() {
62
+ disconnect: (0, _selfMeasurements.withProfiling)(function disconnect() {
60
63
  observer.disconnect();
61
- },
62
- unobserve: function unobserve(target) {
64
+ }, ['vc']),
65
+ unobserve: (0, _selfMeasurements.withProfiling)(function unobserve(target) {
63
66
  observer.unobserve(target);
64
- },
65
- watchAndTag: function watchAndTag(target, tagOrCallback) {
67
+ }, ['vc']),
68
+ watchAndTag: (0, _selfMeasurements.withProfiling)(function watchAndTag(target, tagOrCallback) {
66
69
  callbacksPerElement.set(target, tagOrCallback);
67
70
  observer.observe(target);
68
- }
71
+ }, ['vc'])
69
72
  };
70
73
  }
@@ -3,19 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = createMutationObserver;
6
+ exports.default = void 0;
7
7
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
+ var _selfMeasurements = require("../../../../self-measurements");
8
9
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
9
10
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
11
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- function createMutationObserver(_ref) {
12
- var onAttributeMutation = _ref.onAttributeMutation,
13
- onChildListMutation = _ref.onChildListMutation,
14
- onMutationFinished = _ref.onMutationFinished;
12
+ var createMutationObserver = (0, _selfMeasurements.withProfiling)(function createMutationObserver(props) {
15
13
  if (!window || typeof window.IntersectionObserver !== 'function') {
16
14
  return null;
17
15
  }
18
- var observer = new MutationObserver(function (mutations) {
16
+ var onAttributeMutation = (0, _selfMeasurements.withProfiling)(props.onAttributeMutation, ['vc']);
17
+ var onChildListMutation = (0, _selfMeasurements.withProfiling)(props.onChildListMutation, ['vc']);
18
+ var onMutationFinished = typeof props.onMutationFinished === 'function' ? (0, _selfMeasurements.withProfiling)(props.onMutationFinished, ['vc']) : undefined;
19
+ var mutationObserverCallback = (0, _selfMeasurements.withProfiling)(function mutationObserverCallback(mutations) {
19
20
  var addedNodes = [];
20
21
  var removedNodes = [];
21
22
  var targets = [];
@@ -31,12 +32,12 @@ function createMutationObserver(_ref) {
31
32
  if ((0, _platformFeatureFlags.fg)('platform_ufo_vc_ignore_same_value_mutation')) {
32
33
  var _mut$oldValue;
33
34
  /*
34
- "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
35
- I think it might have been something along the lines that for consistency every setAttribute call should create a record.
36
- Conceptually there is after all a mutation: there is an old value replaced with a new one,
37
- and whether or not they are the same doesn't really matter.
38
- And Custom elements should work the same way as MutationObserver."
39
- https://github.com/whatwg/dom/issues/520#issuecomment-336574796
35
+ "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
36
+ I think it might have been something along the lines that for consistency every setAttribute call should create a record.
37
+ Conceptually there is after all a mutation: there is an old value replaced with a new one,
38
+ and whether or not they are the same doesn't really matter.
39
+ And Custom elements should work the same way as MutationObserver."
40
+ https://github.com/whatwg/dom/issues/520#issuecomment-336574796
40
41
  */
41
42
  var oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
42
43
  var newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
@@ -83,5 +84,7 @@ function createMutationObserver(_ref) {
83
84
  targets: targets
84
85
  });
85
86
  });
87
+ var observer = new MutationObserver(mutationObserverCallback);
86
88
  return observer;
87
- }
89
+ }, ['vc']);
90
+ var _default = exports.default = createMutationObserver;
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.convertPhysicalToLogicalResolution = convertPhysicalToLogicalResolution;
7
- exports.default = createPerformanceObserver;
6
+ exports.default = exports.convertPhysicalToLogicalResolution = void 0;
7
+ var _selfMeasurements = require("../../../../self-measurements");
8
8
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
9
9
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
10
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
11
  // The LayoutShiftAttribution API is returning the numbers on physical dimension
12
- function convertPhysicalToLogicalResolution(rect) {
12
+ var convertPhysicalToLogicalResolution = exports.convertPhysicalToLogicalResolution = (0, _selfMeasurements.withProfiling)(function convertPhysicalToLogicalResolution(rect) {
13
13
  if (typeof window.devicePixelRatio !== 'number') {
14
14
  return rect;
15
15
  }
@@ -19,13 +19,13 @@ function convertPhysicalToLogicalResolution(rect) {
19
19
 
20
20
  // eslint-disable-next-line compat/compat
21
21
  return new DOMRect(rect.x / window.devicePixelRatio, rect.y / window.devicePixelRatio, rect.width / window.devicePixelRatio, rect.height / window.devicePixelRatio);
22
- }
23
- function createPerformanceObserver(args) {
22
+ }, ['vc']);
23
+ var createPerformanceObserver = (0, _selfMeasurements.withProfiling)(function createPerformanceObserver(args) {
24
24
  if (!window || typeof window.PerformanceObserver !== 'function') {
25
25
  return null;
26
26
  }
27
- var onLayoutShift = args.onLayoutShift;
28
- var observer = new PerformanceObserver(function (entries) {
27
+ var onLayoutShift = (0, _selfMeasurements.withProfiling)(args.onLayoutShift, ['vc']);
28
+ var performanceObserverCallback = (0, _selfMeasurements.withProfiling)(function performanceObserverCallback(entries) {
29
29
  var _iterator = _createForOfIteratorHelper(entries.getEntries()),
30
30
  _step;
31
31
  try {
@@ -53,6 +53,8 @@ function createPerformanceObserver(args) {
53
53
  } finally {
54
54
  _iterator.f();
55
55
  }
56
- });
56
+ }, ['vc']);
57
+ var observer = new PerformanceObserver(performanceObserverCallback);
57
58
  return observer;
58
- }
59
+ }, ['vc']);
60
+ var _default = exports.default = createPerformanceObserver;
@@ -9,11 +9,17 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _bindEventListener = require("bind-event-listener");
12
+ var _selfMeasurements = require("../../../self-measurements");
12
13
  var WindowEventObserver = exports.default = /*#__PURE__*/function () {
13
14
  function WindowEventObserver(opts) {
14
15
  (0, _classCallCheck2.default)(this, WindowEventObserver);
15
16
  (0, _defineProperty2.default)(this, "unbindFns", []);
16
- this.onEvent = opts.onEvent;
17
+ var operationTimer = (0, _selfMeasurements.markProfilingStart)('WindowEventObserver constructor');
18
+ this.onEvent = (0, _selfMeasurements.withProfiling)(opts.onEvent, ['vc']);
19
+ this.bindEvent = (0, _selfMeasurements.withProfiling)(this.bindEvent.bind(this), ['vc']);
20
+ this.start = (0, _selfMeasurements.withProfiling)(this.start.bind(this), ['vc']);
21
+ this.stop = (0, _selfMeasurements.withProfiling)(this.stop.bind(this), ['vc']);
22
+ (0, _selfMeasurements.markProfilingEnd)(operationTimer);
17
23
  }
18
24
  return (0, _createClass2.default)(WindowEventObserver, [{
19
25
  key: "bindEvent",
@@ -1,9 +1,10 @@
1
+ import { withProfiling } from '../../../self-measurements';
1
2
  /* Borrowed from https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/performance/browser-metrics/src/plugins/timings/resource.ts */
2
3
  const cacheableTypes = ['script', 'link'];
3
4
  const CACHE_NETWORK = 'network';
4
5
  const CACHE_MEMORY = 'memory';
5
6
  const CACHE_DISK = 'disk';
6
- const calculateTransferType = (type, duration, size) => {
7
+ const calculateTransferType = withProfiling(function calculateTransferType(type, duration, size) {
7
8
  if (!cacheableTypes.includes(type)) {
8
9
  return CACHE_NETWORK;
9
10
  }
@@ -17,10 +18,10 @@ const calculateTransferType = (type, duration, size) => {
17
18
  return null;
18
19
  }
19
20
  return CACHE_NETWORK;
20
- };
21
- export const getCacheHitRatio = ({
21
+ });
22
+ export const getCacheHitRatio = withProfiling(function getCacheHitRatio({
22
23
  start
23
- }) => {
24
+ }) {
24
25
  let fromCache = 0;
25
26
  let preloadFromCache = 0;
26
27
  let total = 0;
@@ -60,4 +61,4 @@ export const getCacheHitRatio = ({
60
61
  } catch (e) {
61
62
  return {};
62
63
  }
63
- };
64
+ });
@@ -1,4 +1,5 @@
1
- export const getCLS = (start, stop, buffer) => {
1
+ import { withProfiling } from '../../../../self-measurements';
2
+ export const getCLS = withProfiling(function getCLS(start, stop, buffer) {
2
3
  const layoutShifts = buffer.getAll().filter(entry => entry.startTime >= start && entry.startTime <= stop);
3
4
  const sessionWindows = [];
4
5
  let currentWindow = null;
@@ -30,4 +31,4 @@ export const getCLS = (start, stop, buffer) => {
30
31
 
31
32
  // Return score of largest burst as CLS metric
32
33
  return Math.round(maxScore * 10000) / 10000;
33
- };
34
+ });
@@ -1,16 +1,17 @@
1
+ import { withProfiling } from '../../../self-measurements';
1
2
  import { getCLS } from './cls';
2
3
  import { PerformanceObserverEntryTypes } from './const';
3
4
  import { getTBT } from './tbt';
4
5
  import { EntriesBuffer } from './utils/buffer';
5
6
  import { startLSObserver, startLTObserver } from './utils/observer';
6
- export function startLighthouseObserver() {
7
+ export const startLighthouseObserver = withProfiling(function startLighthouseObserver() {
7
8
  startLSObserver();
8
9
  startLTObserver();
9
- }
10
- export const getLighthouseMetrics = ({
10
+ });
11
+ export const getLighthouseMetrics = withProfiling(function getLighthouseMetrics({
11
12
  start,
12
13
  stop
13
- }) => {
14
+ }) {
14
15
  const tbt = getTBT(start, stop, EntriesBuffer[PerformanceObserverEntryTypes.LongTask]);
15
16
 
16
17
  // no round as CLS is usually 0-1
@@ -20,4 +21,4 @@ export const getLighthouseMetrics = ({
20
21
  'metric:tbt:observed': Math.round(tbt.observed),
21
22
  'metric:cls': cls
22
23
  };
23
- };
24
+ });
@@ -1,15 +1,18 @@
1
+ import { withProfiling } from '../../../../self-measurements';
1
2
  const MAX_ACCEPTABLE_TASK_DURATION = 50;
2
- export const getTBT = (start, stop, buffer) => buffer.getAll().filter(entry => entry.startTime <= stop && entry.duration > MAX_ACCEPTABLE_TASK_DURATION && (entry.startTime >= start || entry.startTime + entry.duration >= start || entry.startTime <= start && entry.startTime + entry.duration >= stop)).reduce((tbt, entry) => {
3
- const longTaskStop = entry.startTime + entry.duration;
4
- const intersectStart = Math.max(entry.startTime + MAX_ACCEPTABLE_TASK_DURATION, start);
5
- const intersectStop = Math.min(longTaskStop, stop);
6
- const longTaskIncluded = Math.max(intersectStop - intersectStart, 0);
7
- // eslint-disable-next-line no-param-reassign
8
- tbt.observed += entry.duration - MAX_ACCEPTABLE_TASK_DURATION;
9
- // eslint-disable-next-line no-param-reassign
10
- tbt.total += longTaskIncluded;
11
- return tbt;
12
- }, {
13
- total: 0,
14
- observed: 0
3
+ export const getTBT = withProfiling(function getTBT(start, stop, buffer) {
4
+ return buffer.getAll().filter(entry => entry.startTime <= stop && entry.duration > MAX_ACCEPTABLE_TASK_DURATION && (entry.startTime >= start || entry.startTime + entry.duration >= start || entry.startTime <= start && entry.startTime + entry.duration >= stop)).reduce((tbt, entry) => {
5
+ const longTaskStop = entry.startTime + entry.duration;
6
+ const intersectStart = Math.max(entry.startTime + MAX_ACCEPTABLE_TASK_DURATION, start);
7
+ const intersectStop = Math.min(longTaskStop, stop);
8
+ const longTaskIncluded = Math.max(intersectStop - intersectStart, 0);
9
+ // eslint-disable-next-line no-param-reassign
10
+ tbt.observed += entry.duration - MAX_ACCEPTABLE_TASK_DURATION;
11
+ // eslint-disable-next-line no-param-reassign
12
+ tbt.total += longTaskIncluded;
13
+ return tbt;
14
+ }, {
15
+ total: 0,
16
+ observed: 0
17
+ });
15
18
  });
@@ -1,10 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { withProfiling } from '../../../../../self-measurements';
2
3
  import { PerformanceObserverEntryTypes } from '../../const';
3
4
  export class BufferWithMaxLength {
4
5
  constructor(maxLength = 1000) {
5
6
  _defineProperty(this, "buffer", []);
6
7
  _defineProperty(this, "full", false);
7
8
  this.maxLength = maxLength;
9
+ this.push = withProfiling(this.push.bind(this));
10
+ this.getAll = withProfiling(this.getAll.bind(this));
8
11
  }
9
12
  push(item) {
10
13
  if (this.full || this.maxLength === this.buffer.length) {
@@ -1,7 +1,8 @@
1
+ import { withProfiling } from '../../../../../self-measurements';
1
2
  import { PerformanceObserverEntryTypes } from '../../const';
2
3
  import { EntriesBuffer } from '../buffer';
3
4
  let pe = null;
4
- const getObserver = () => {
5
+ const getObserver = withProfiling(function getObserver() {
5
6
  if (typeof PerformanceObserver !== 'function') {
6
7
  // Only instantiate the IntersectionObserver if it's supported
7
8
  return null;
@@ -9,7 +10,7 @@ const getObserver = () => {
9
10
  if (pe !== null) {
10
11
  return pe;
11
12
  }
12
- pe = new PerformanceObserver(list => {
13
+ const performanceObserverCallback = withProfiling(function performanceObserverCallback(list) {
13
14
  list.getEntries().forEach(entry => {
14
15
  if (entry.entryType === PerformanceObserverEntryTypes.LayoutShift) {
15
16
  EntriesBuffer[PerformanceObserverEntryTypes.LayoutShift].push(entry);
@@ -19,19 +20,20 @@ const getObserver = () => {
19
20
  }
20
21
  });
21
22
  });
23
+ pe = new PerformanceObserver(performanceObserverCallback);
22
24
  return pe;
23
- };
24
- export const startLSObserver = () => {
25
+ });
26
+ export const startLSObserver = withProfiling(function startLSObserver() {
25
27
  var _getObserver;
26
28
  (_getObserver = getObserver()) === null || _getObserver === void 0 ? void 0 : _getObserver.observe({
27
29
  type: PerformanceObserverEntryTypes.LayoutShift,
28
30
  buffered: true
29
31
  });
30
- };
31
- export const startLTObserver = () => {
32
+ });
33
+ export const startLTObserver = withProfiling(function startLTObserver() {
32
34
  var _getObserver2;
33
35
  (_getObserver2 = getObserver()) === null || _getObserver2 === void 0 ? void 0 : _getObserver2.observe({
34
36
  type: PerformanceObserverEntryTypes.LongTask,
35
37
  buffered: true
36
38
  });
37
- };
39
+ });
@@ -1,4 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ var _CHRSummary;
3
+ import { withProfiling } from '../self-measurements';
2
4
  import { calculateTransferType, checkIfTimingsAvailable, DISK_KEY, getTypeOfRequest, MEMORY_KEY, NETWORK_KEY, round } from './utils';
3
5
  export class CHRSummary {
4
6
  constructor() {
@@ -14,6 +16,7 @@ export class CHRSummary {
14
16
  [NETWORK_KEY]: 0
15
17
  });
16
18
  _defineProperty(this, "sizeTotal", 0);
19
+ this.add = withProfiling(this.add.bind(this));
17
20
  }
18
21
  add(asset) {
19
22
  const encodedSize = asset.encodedSize || 0;
@@ -26,27 +29,29 @@ export class CHRSummary {
26
29
  this.size[type] += encodedSize;
27
30
  this.sizeTotal += encodedSize;
28
31
  }
29
- static makePayload(summary) {
30
- const {
31
- size,
32
- bundlesCount,
33
- sizeTotal
34
- } = summary;
35
- const cachedSize = size[MEMORY_KEY] + size[DISK_KEY];
36
- const sizeRatio = round(cachedSize / summary.sizeTotal);
37
- return {
38
- size: sizeTotal,
39
- chr: sizeRatio,
40
- count: bundlesCount
41
- };
42
- }
43
32
  }
33
+ _CHRSummary = CHRSummary;
34
+ _defineProperty(CHRSummary, "makePayload", withProfiling(function makePayload(summary) {
35
+ const {
36
+ size,
37
+ bundlesCount,
38
+ sizeTotal
39
+ } = summary;
40
+ const cachedSize = size[MEMORY_KEY] + size[DISK_KEY];
41
+ const sizeRatio = round(cachedSize / summary.sizeTotal);
42
+ return {
43
+ size: sizeTotal,
44
+ chr: sizeRatio,
45
+ count: bundlesCount
46
+ };
47
+ }));
44
48
  export class CHRReporter {
45
49
  constructor() {
46
50
  _defineProperty(this, "all", new CHRSummary());
47
51
  _defineProperty(this, "allAtlassian", new CHRSummary());
48
52
  _defineProperty(this, "preloaded", new CHRSummary());
49
53
  _defineProperty(this, "defaultAllowedTypes", ['js']);
54
+ this.get = withProfiling(this.get.bind(this));
50
55
  }
51
56
  get(resourceTimings, assetsConfig, SSRDoneTime) {
52
57
  try {
@@ -1,9 +1,11 @@
1
+ import { withProfiling } from '../self-measurements';
2
+
1
3
  /* Borrowed from https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/performance/browser-metrics/src/plugins/timings/resource.ts */
2
4
  export const cacheableTypes = ['script', 'link', 'other'];
3
5
  export const MEMORY_KEY = 'mem';
4
6
  export const DISK_KEY = 'disk';
5
7
  export const NETWORK_KEY = 'net';
6
- export const calculateTransferType = (name, type, duration, size) => {
8
+ export const calculateTransferType = withProfiling(function calculateTransferType(name, type, duration, size) {
7
9
  if (!cacheableTypes.includes(type) && !(type === 'other' && name.includes('.js'))) {
8
10
  return null;
9
11
  }
@@ -17,11 +19,11 @@ export const calculateTransferType = (name, type, duration, size) => {
17
19
  return null;
18
20
  }
19
21
  return NETWORK_KEY;
20
- };
21
- export const getTypeOfRequest = ({
22
+ });
23
+ export const getTypeOfRequest = withProfiling(function getTypeOfRequest({
22
24
  name,
23
25
  initiatorType: type
24
- }) => {
26
+ }) {
25
27
  let category = 'other';
26
28
  const urlWithoutQuery = name.split('?')[0];
27
29
  switch (type) {
@@ -55,16 +57,16 @@ export const getTypeOfRequest = ({
55
57
  break;
56
58
  }
57
59
  return category;
58
- };
59
- export const checkIfTimingsAvailable = entry => {
60
+ });
61
+ export const checkIfTimingsAvailable = withProfiling(function checkIfTimingsAvailable(entry) {
60
62
  if (entry.decodedSize === 0 && entry.encodedSize === 0 && entry.requestStart === 0 && entry.responseStart === 0) {
61
63
  return false;
62
64
  }
63
65
  return true;
64
- };
65
- export const round = n => {
66
+ });
67
+ export const round = withProfiling(function round(n) {
66
68
  if (isNaN(n)) {
67
69
  return 0;
68
70
  }
69
71
  return Math.round(n * 10000) / 10000;
70
- };
72
+ });
@@ -1,13 +1,14 @@
1
1
  import { roundEpsilon } from '../round-number';
2
+ import { withProfiling } from '../self-measurements';
2
3
  let config = null;
3
- export function configure(bundleEvalTimingConfiguration) {
4
+ export const configure = withProfiling(function configure(bundleEvalTimingConfiguration) {
4
5
  config = bundleEvalTimingConfiguration;
5
- }
6
- const getPerformanceObject = () => {
6
+ });
7
+ const getPerformanceObject = withProfiling(function getPerformanceObject() {
7
8
  var _window;
8
9
  return ((_window = window) !== null && _window !== void 0 ? _window : {}).performance;
9
- };
10
- export function getBundleEvalTimings(interactionStartTime) {
10
+ });
11
+ export const getBundleEvalTimings = withProfiling(function getBundleEvalTimings(interactionStartTime) {
11
12
  if (config == null) {
12
13
  return {};
13
14
  }
@@ -40,4 +41,4 @@ export function getBundleEvalTimings(interactionStartTime) {
40
41
  return {};
41
42
  }
42
43
  return timings;
43
- }
44
+ });
@@ -1,3 +1,5 @@
1
+ import { withProfiling } from '../self-measurements';
2
+
1
3
  /**
2
4
  * A random function that passes one in rate times.
3
5
  * E.g. coinflip(2) is the same as if you flipped a coin.
@@ -5,7 +7,7 @@
5
7
  * @param rate The change that it will pass (1 in <rate> times)
6
8
  * @returns bool, if it passes or not
7
9
  */
8
- export default function coinflip(rate) {
10
+ const coinflip = withProfiling(function coinflip(rate) {
9
11
  if (rate === 0) {
10
12
  return false;
11
13
  } else if (rate === 1) {
@@ -13,4 +15,5 @@ export default function coinflip(rate) {
13
15
  } else {
14
16
  return Math.random() * rate <= 1;
15
17
  }
16
- }
18
+ });
19
+ export default coinflip;
@@ -1,5 +1,6 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- export const getReactUFOVersion = interactionType => {
2
+ import { withProfiling } from '../self-measurements';
3
+ export const getReactUFOVersion = withProfiling(function getReactUFOVersion(interactionType) {
3
4
  if (interactionType !== 'page_load' && interactionType !== 'transition') {
4
5
  return '1.0.1';
5
6
  }
@@ -9,4 +10,4 @@ export const getReactUFOVersion = interactionType => {
9
10
  return '1.0.1';
10
11
  }
11
12
  return '2.0.0';
12
- };
13
+ });
@@ -0,0 +1 @@
1
+ export {};