@atlaskit/react-ufo 3.4.14 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/CHANGELOG.md +8 -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 +25 -19
  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 +6 -3
  45. package/dist/cjs/segment/segment.js +7 -3
  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 -22
  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 +172 -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 -3
  67. package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +16 -0
  68. package/dist/cjs/vc/vc-observer/revisions/fy25_01.js +2 -0
  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 +31 -17
  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 +5 -2
  136. package/dist/es2019/segment/segment.js +7 -3
  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 -21
  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 +160 -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 -2
  158. package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +16 -0
  159. package/dist/es2019/vc/vc-observer/revisions/fy25_01.js +2 -0
  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 +25 -19
  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 +5 -2
  227. package/dist/esm/segment/segment.js +7 -3
  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 -21
  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 +172 -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 -2
  249. package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +16 -0
  250. package/dist/esm/vc/vc-observer/revisions/fy25_01.js +2 -0
  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 +10 -1
@@ -1,13 +1,15 @@
1
- function isValidEntry(entry) {
1
+ import { withProfiling } from '../../../../self-measurements';
2
+ const isValidEntry = withProfiling(function isValidEntry(entry) {
2
3
  return entry.isIntersecting && entry.intersectionRect.width > 0 && entry.intersectionRect.height > 0;
3
- }
4
+ }, ['vc']);
4
5
  export function createIntersectionObserver(args) {
5
6
  if (!window || typeof window.IntersectionObserver !== 'function') {
6
7
  return null;
7
8
  }
9
+ const onEntry = withProfiling(args.onEntry, ['vc']);
10
+ const onObserved = typeof args.onObserved === 'function' ? withProfiling(args.onObserved, ['vc']) : undefined;
8
11
  const callbacksPerElement = new WeakMap();
9
- const observer = new IntersectionObserver(entries => {
10
- var _args$onObserved;
12
+ const intersectionObserverCallback = withProfiling(function intersectionObserverCallback(entries) {
11
13
  const validEntries = [];
12
14
  const startTime = performance.now();
13
15
  entries.forEach(entry => {
@@ -34,7 +36,7 @@ export function createIntersectionObserver(args) {
34
36
  } else if (typeof tagOrCallback === 'string') {
35
37
  mutationTag = tagOrCallback;
36
38
  }
37
- args.onEntry({
39
+ onEntry({
38
40
  target: entry.target,
39
41
  rect: entry.intersectionRect,
40
42
  time: entry.time,
@@ -45,21 +47,22 @@ export function createIntersectionObserver(args) {
45
47
  callbacksPerElement.delete(entry.target);
46
48
  observer.unobserve(entry.target);
47
49
  });
48
- (_args$onObserved = args.onObserved) === null || _args$onObserved === void 0 ? void 0 : _args$onObserved.call(args, {
50
+ onObserved === null || onObserved === void 0 ? void 0 : onObserved({
49
51
  time: startTime,
50
52
  elements: validEntries
51
53
  });
52
54
  });
55
+ const observer = new IntersectionObserver(intersectionObserverCallback);
53
56
  return {
54
- disconnect: () => {
57
+ disconnect: withProfiling(function disconnect() {
55
58
  observer.disconnect();
56
- },
57
- unobserve: target => {
59
+ }, ['vc']),
60
+ unobserve: withProfiling(function unobserve(target) {
58
61
  observer.unobserve(target);
59
- },
60
- watchAndTag: (target, tagOrCallback) => {
62
+ }, ['vc']),
63
+ watchAndTag: withProfiling(function watchAndTag(target, tagOrCallback) {
61
64
  callbacksPerElement.set(target, tagOrCallback);
62
65
  observer.observe(target);
63
- }
66
+ }, ['vc'])
64
67
  };
65
68
  }
@@ -1,13 +1,13 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- export default function createMutationObserver({
3
- onAttributeMutation,
4
- onChildListMutation,
5
- onMutationFinished
6
- }) {
2
+ import { withProfiling } from '../../../../self-measurements';
3
+ const createMutationObserver = withProfiling(function createMutationObserver(props) {
7
4
  if (!window || typeof window.IntersectionObserver !== 'function') {
8
5
  return null;
9
6
  }
10
- const observer = new MutationObserver(mutations => {
7
+ const onAttributeMutation = withProfiling(props.onAttributeMutation, ['vc']);
8
+ const onChildListMutation = withProfiling(props.onChildListMutation, ['vc']);
9
+ const onMutationFinished = typeof props.onMutationFinished === 'function' ? withProfiling(props.onMutationFinished, ['vc']) : undefined;
10
+ const mutationObserverCallback = withProfiling(function mutationObserverCallback(mutations) {
11
11
  const addedNodes = [];
12
12
  const removedNodes = [];
13
13
  const targets = [];
@@ -19,12 +19,12 @@ export default function createMutationObserver({
19
19
  if (fg('platform_ufo_vc_ignore_same_value_mutation')) {
20
20
  var _mut$oldValue;
21
21
  /*
22
- "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
23
- I think it might have been something along the lines that for consistency every setAttribute call should create a record.
24
- Conceptually there is after all a mutation: there is an old value replaced with a new one,
25
- and whether or not they are the same doesn't really matter.
26
- And Custom elements should work the same way as MutationObserver."
27
- https://github.com/whatwg/dom/issues/520#issuecomment-336574796
22
+ "MutationObserver was explicitly designed to work that way, but I can't now recall the reasoning.
23
+ I think it might have been something along the lines that for consistency every setAttribute call should create a record.
24
+ Conceptually there is after all a mutation: there is an old value replaced with a new one,
25
+ and whether or not they are the same doesn't really matter.
26
+ And Custom elements should work the same way as MutationObserver."
27
+ https://github.com/whatwg/dom/issues/520#issuecomment-336574796
28
28
  */
29
29
  const oldValue = (_mut$oldValue = mut.oldValue) !== null && _mut$oldValue !== void 0 ? _mut$oldValue : undefined;
30
30
  const newValue = mut.attributeName ? mut.target.getAttribute(mut.attributeName) : undefined;
@@ -66,5 +66,7 @@ export default function createMutationObserver({
66
66
  targets
67
67
  });
68
68
  });
69
+ const observer = new MutationObserver(mutationObserverCallback);
69
70
  return observer;
70
- }
71
+ }, ['vc']);
72
+ export default createMutationObserver;
@@ -1,5 +1,7 @@
1
+ import { withProfiling } from '../../../../self-measurements';
2
+
1
3
  // The LayoutShiftAttribution API is returning the numbers on physical dimension
2
- export function convertPhysicalToLogicalResolution(rect) {
4
+ export const convertPhysicalToLogicalResolution = withProfiling(function convertPhysicalToLogicalResolution(rect) {
3
5
  if (typeof window.devicePixelRatio !== 'number') {
4
6
  return rect;
5
7
  }
@@ -9,15 +11,13 @@ export function convertPhysicalToLogicalResolution(rect) {
9
11
 
10
12
  // eslint-disable-next-line compat/compat
11
13
  return new DOMRect(rect.x / window.devicePixelRatio, rect.y / window.devicePixelRatio, rect.width / window.devicePixelRatio, rect.height / window.devicePixelRatio);
12
- }
13
- export default function createPerformanceObserver(args) {
14
+ }, ['vc']);
15
+ const createPerformanceObserver = withProfiling(function createPerformanceObserver(args) {
14
16
  if (!window || typeof window.PerformanceObserver !== 'function') {
15
17
  return null;
16
18
  }
17
- const {
18
- onLayoutShift
19
- } = args;
20
- const observer = new PerformanceObserver(entries => {
19
+ const onLayoutShift = withProfiling(args.onLayoutShift, ['vc']);
20
+ const performanceObserverCallback = withProfiling(function performanceObserverCallback(entries) {
21
21
  for (const entry of entries.getEntries()) {
22
22
  if (entry.entryType === 'layout-shift') {
23
23
  // Ignored via go/ees005
@@ -36,6 +36,8 @@ export default function createPerformanceObserver(args) {
36
36
  });
37
37
  }
38
38
  }
39
- });
39
+ }, ['vc']);
40
+ const observer = new PerformanceObserver(performanceObserverCallback);
40
41
  return observer;
41
- }
42
+ }, ['vc']);
43
+ export default createPerformanceObserver;
@@ -1,9 +1,15 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { bind } from 'bind-event-listener';
3
+ import { markProfilingEnd, markProfilingStart, withProfiling } from '../../../self-measurements';
3
4
  export default class WindowEventObserver {
4
5
  constructor(opts) {
5
6
  _defineProperty(this, "unbindFns", []);
6
- this.onEvent = opts.onEvent;
7
+ const operationTimer = markProfilingStart('WindowEventObserver constructor');
8
+ this.onEvent = withProfiling(opts.onEvent, ['vc']);
9
+ this.bindEvent = withProfiling(this.bindEvent.bind(this), ['vc']);
10
+ this.start = withProfiling(this.start.bind(this), ['vc']);
11
+ this.stop = withProfiling(this.stop.bind(this), ['vc']);
12
+ markProfilingEnd(operationTimer);
7
13
  }
8
14
  bindEvent(type) {
9
15
  const unbindCallback = bind(window, {
@@ -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
  var cacheableTypes = ['script', 'link'];
3
4
  var CACHE_NETWORK = 'network';
4
5
  var CACHE_MEMORY = 'memory';
5
6
  var CACHE_DISK = 'disk';
6
- var calculateTransferType = function calculateTransferType(type, duration, size) {
7
+ var calculateTransferType = withProfiling(function calculateTransferType(type, duration, size) {
7
8
  if (!cacheableTypes.includes(type)) {
8
9
  return CACHE_NETWORK;
9
10
  }
@@ -17,8 +18,8 @@ var calculateTransferType = function calculateTransferType(type, duration, size)
17
18
  return null;
18
19
  }
19
20
  return CACHE_NETWORK;
20
- };
21
- export var getCacheHitRatio = function getCacheHitRatio(_ref) {
21
+ });
22
+ export var getCacheHitRatio = withProfiling(function getCacheHitRatio(_ref) {
22
23
  var start = _ref.start;
23
24
  var fromCache = 0;
24
25
  var preloadFromCache = 0;
@@ -60,4 +61,4 @@ export var getCacheHitRatio = function getCacheHitRatio(_ref) {
60
61
  } catch (e) {
61
62
  return {};
62
63
  }
63
- };
64
+ });
@@ -1,7 +1,8 @@
1
1
  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; } } }; }
2
2
  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; } }
3
3
  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; }
4
- export var getCLS = function getCLS(start, stop, buffer) {
4
+ import { withProfiling } from '../../../../self-measurements';
5
+ export var getCLS = withProfiling(function getCLS(start, stop, buffer) {
5
6
  var layoutShifts = buffer.getAll().filter(function (entry) {
6
7
  return entry.startTime >= start && entry.startTime <= stop;
7
8
  });
@@ -44,4 +45,4 @@ export var getCLS = function getCLS(start, stop, buffer) {
44
45
 
45
46
  // Return score of largest burst as CLS metric
46
47
  return Math.round(maxScore * 10000) / 10000;
47
- };
48
+ });
@@ -1,13 +1,14 @@
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 var startLighthouseObserver = withProfiling(function startLighthouseObserver() {
7
8
  startLSObserver();
8
9
  startLTObserver();
9
- }
10
- export var getLighthouseMetrics = function getLighthouseMetrics(_ref) {
10
+ });
11
+ export var getLighthouseMetrics = withProfiling(function getLighthouseMetrics(_ref) {
11
12
  var start = _ref.start,
12
13
  stop = _ref.stop;
13
14
  var tbt = getTBT(start, stop, EntriesBuffer[PerformanceObserverEntryTypes.LongTask]);
@@ -19,4 +20,4 @@ export var getLighthouseMetrics = function getLighthouseMetrics(_ref) {
19
20
  'metric:tbt:observed': Math.round(tbt.observed),
20
21
  'metric:cls': cls
21
22
  };
22
- };
23
+ });
@@ -1,5 +1,6 @@
1
+ import { withProfiling } from '../../../../self-measurements';
1
2
  var MAX_ACCEPTABLE_TASK_DURATION = 50;
2
- export var getTBT = function getTBT(start, stop, buffer) {
3
+ export var getTBT = withProfiling(function getTBT(start, stop, buffer) {
3
4
  return buffer.getAll().filter(function (entry) {
4
5
  return 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);
5
6
  }).reduce(function (tbt, entry) {
@@ -16,4 +17,4 @@ export var getTBT = function getTBT(start, stop, buffer) {
16
17
  total: 0,
17
18
  observed: 0
18
19
  });
19
- };
20
+ });
@@ -1,6 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { withProfiling } from '../../../../../self-measurements';
4
5
  import { PerformanceObserverEntryTypes } from '../../const';
5
6
  export var BufferWithMaxLength = /*#__PURE__*/function () {
6
7
  function BufferWithMaxLength() {
@@ -9,6 +10,8 @@ export var BufferWithMaxLength = /*#__PURE__*/function () {
9
10
  _defineProperty(this, "buffer", []);
10
11
  _defineProperty(this, "full", false);
11
12
  this.maxLength = maxLength;
13
+ this.push = withProfiling(this.push.bind(this));
14
+ this.getAll = withProfiling(this.getAll.bind(this));
12
15
  }
13
16
  return _createClass(BufferWithMaxLength, [{
14
17
  key: "push",
@@ -1,7 +1,8 @@
1
+ import { withProfiling } from '../../../../../self-measurements';
1
2
  import { PerformanceObserverEntryTypes } from '../../const';
2
3
  import { EntriesBuffer } from '../buffer';
3
4
  var pe = null;
4
- var getObserver = function getObserver() {
5
+ var 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 @@ var getObserver = function getObserver() {
9
10
  if (pe !== null) {
10
11
  return pe;
11
12
  }
12
- pe = new PerformanceObserver(function (list) {
13
+ var performanceObserverCallback = withProfiling(function performanceObserverCallback(list) {
13
14
  list.getEntries().forEach(function (entry) {
14
15
  if (entry.entryType === PerformanceObserverEntryTypes.LayoutShift) {
15
16
  EntriesBuffer[PerformanceObserverEntryTypes.LayoutShift].push(entry);
@@ -19,19 +20,20 @@ var getObserver = function getObserver() {
19
20
  }
20
21
  });
21
22
  });
23
+ pe = new PerformanceObserver(performanceObserverCallback);
22
24
  return pe;
23
- };
24
- export var startLSObserver = function startLSObserver() {
25
+ });
26
+ export var startLSObserver = withProfiling(function startLSObserver() {
25
27
  var _getObserver;
26
28
  (_getObserver = getObserver()) === null || _getObserver === void 0 || _getObserver.observe({
27
29
  type: PerformanceObserverEntryTypes.LayoutShift,
28
30
  buffered: true
29
31
  });
30
- };
31
- export var startLTObserver = function startLTObserver() {
32
+ });
33
+ export var startLTObserver = withProfiling(function startLTObserver() {
32
34
  var _getObserver2;
33
35
  (_getObserver2 = getObserver()) === null || _getObserver2 === void 0 || _getObserver2.observe({
34
36
  type: PerformanceObserverEntryTypes.LongTask,
35
37
  buffered: true
36
38
  });
37
- };
39
+ });
@@ -1,6 +1,8 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _CHRSummary;
5
+ import { withProfiling } from '../self-measurements';
4
6
  import { calculateTransferType, checkIfTimingsAvailable, DISK_KEY, getTypeOfRequest, MEMORY_KEY, NETWORK_KEY, round } from './utils';
5
7
  export var CHRSummary = /*#__PURE__*/function () {
6
8
  function CHRSummary() {
@@ -9,6 +11,7 @@ export var CHRSummary = /*#__PURE__*/function () {
9
11
  _defineProperty(this, "bundlesCount", 0);
10
12
  _defineProperty(this, "size", _defineProperty(_defineProperty(_defineProperty({}, MEMORY_KEY, 0), DISK_KEY, 0), NETWORK_KEY, 0));
11
13
  _defineProperty(this, "sizeTotal", 0);
14
+ this.add = withProfiling(this.add.bind(this));
12
15
  }
13
16
  return _createClass(CHRSummary, [{
14
17
  key: "add",
@@ -23,22 +26,21 @@ export var CHRSummary = /*#__PURE__*/function () {
23
26
  this.size[type] += encodedSize;
24
27
  this.sizeTotal += encodedSize;
25
28
  }
26
- }], [{
27
- key: "makePayload",
28
- value: function makePayload(summary) {
29
- var size = summary.size,
30
- bundlesCount = summary.bundlesCount,
31
- sizeTotal = summary.sizeTotal;
32
- var cachedSize = size[MEMORY_KEY] + size[DISK_KEY];
33
- var sizeRatio = round(cachedSize / summary.sizeTotal);
34
- return {
35
- size: sizeTotal,
36
- chr: sizeRatio,
37
- count: bundlesCount
38
- };
39
- }
40
29
  }]);
41
30
  }();
31
+ _CHRSummary = CHRSummary;
32
+ _defineProperty(CHRSummary, "makePayload", withProfiling(function makePayload(summary) {
33
+ var size = summary.size,
34
+ bundlesCount = summary.bundlesCount,
35
+ sizeTotal = summary.sizeTotal;
36
+ var cachedSize = size[MEMORY_KEY] + size[DISK_KEY];
37
+ var sizeRatio = round(cachedSize / summary.sizeTotal);
38
+ return {
39
+ size: sizeTotal,
40
+ chr: sizeRatio,
41
+ count: bundlesCount
42
+ };
43
+ }));
42
44
  export var CHRReporter = /*#__PURE__*/function () {
43
45
  function CHRReporter() {
44
46
  _classCallCheck(this, CHRReporter);
@@ -46,6 +48,7 @@ export var CHRReporter = /*#__PURE__*/function () {
46
48
  _defineProperty(this, "allAtlassian", new CHRSummary());
47
49
  _defineProperty(this, "preloaded", new CHRSummary());
48
50
  _defineProperty(this, "defaultAllowedTypes", ['js']);
51
+ this.get = withProfiling(this.get.bind(this));
49
52
  }
50
53
  return _createClass(CHRReporter, [{
51
54
  key: "get",
@@ -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 var cacheableTypes = ['script', 'link', 'other'];
3
5
  export var MEMORY_KEY = 'mem';
4
6
  export var DISK_KEY = 'disk';
5
7
  export var NETWORK_KEY = 'net';
6
- export var calculateTransferType = function calculateTransferType(name, type, duration, size) {
8
+ export var 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,8 +19,8 @@ export var calculateTransferType = function calculateTransferType(name, type, du
17
19
  return null;
18
20
  }
19
21
  return NETWORK_KEY;
20
- };
21
- export var getTypeOfRequest = function getTypeOfRequest(_ref) {
22
+ });
23
+ export var getTypeOfRequest = withProfiling(function getTypeOfRequest(_ref) {
22
24
  var name = _ref.name,
23
25
  type = _ref.initiatorType;
24
26
  var category = 'other';
@@ -54,16 +56,16 @@ export var getTypeOfRequest = function getTypeOfRequest(_ref) {
54
56
  break;
55
57
  }
56
58
  return category;
57
- };
58
- export var checkIfTimingsAvailable = function checkIfTimingsAvailable(entry) {
59
+ });
60
+ export var checkIfTimingsAvailable = withProfiling(function checkIfTimingsAvailable(entry) {
59
61
  if (entry.decodedSize === 0 && entry.encodedSize === 0 && entry.requestStart === 0 && entry.responseStart === 0) {
60
62
  return false;
61
63
  }
62
64
  return true;
63
- };
64
- export var round = function round(n) {
65
+ });
66
+ export var round = withProfiling(function round(n) {
65
67
  if (isNaN(n)) {
66
68
  return 0;
67
69
  }
68
70
  return Math.round(n * 10000) / 10000;
69
- };
71
+ });
@@ -1,13 +1,14 @@
1
1
  import { roundEpsilon } from '../round-number';
2
+ import { withProfiling } from '../self-measurements';
2
3
  var config = null;
3
- export function configure(bundleEvalTimingConfiguration) {
4
+ export var configure = withProfiling(function configure(bundleEvalTimingConfiguration) {
4
5
  config = bundleEvalTimingConfiguration;
5
- }
6
- var getPerformanceObject = function getPerformanceObject() {
6
+ });
7
+ var 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 var getBundleEvalTimings = withProfiling(function getBundleEvalTimings(interactionStartTime) {
11
12
  if (config == null) {
12
13
  return {};
13
14
  }
@@ -38,4 +39,4 @@ export function getBundleEvalTimings(interactionStartTime) {
38
39
  return {};
39
40
  }
40
41
  return timings;
41
- }
42
+ });
@@ -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
+ var 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 var getReactUFOVersion = function getReactUFOVersion(interactionType) {
2
+ import { withProfiling } from '../self-measurements';
3
+ export var 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 var getReactUFOVersion = function getReactUFOVersion(interactionType) {
9
10
  return '1.0.1';
10
11
  }
11
12
  return '2.0.0';
12
- };
13
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,15 +1,16 @@
1
+ import { withProfiling } from '../self-measurements';
1
2
  var config;
2
3
 
3
4
  // Defensively typed, since this is directly user-editable
4
5
  // and they could delete empty members
5
6
 
6
- export function setUFOConfig(newConfig) {
7
+ export var setUFOConfig = withProfiling(function setUFOConfig(newConfig) {
7
8
  config = newConfig;
8
- }
9
- export function getConfig() {
9
+ });
10
+ export var getConfig = withProfiling(function getConfig() {
10
11
  return config;
11
- }
12
- export function getInteractionRate(name, interactionKind) {
12
+ });
13
+ export var getInteractionRate = withProfiling(function getInteractionRate(name, interactionKind) {
13
14
  try {
14
15
  if (!config) {
15
16
  return 0;
@@ -63,8 +64,8 @@ export function getInteractionRate(name, interactionKind) {
63
64
  // Fallback
64
65
  return 0;
65
66
  }
66
- }
67
- export function getExperimentalInteractionRate(name, interactionType) {
67
+ });
68
+ export var getExperimentalInteractionRate = withProfiling(function getExperimentalInteractionRate(name, interactionType) {
68
69
  try {
69
70
  if (!config) {
70
71
  return 0;
@@ -84,8 +85,8 @@ export function getExperimentalInteractionRate(name, interactionType) {
84
85
  } catch (e) {
85
86
  return 0;
86
87
  }
87
- }
88
- export function getPostInteractionRate(name, interactionType) {
88
+ });
89
+ export var getPostInteractionRate = withProfiling(function getPostInteractionRate(name, interactionType) {
89
90
  try {
90
91
  if (!config) {
91
92
  return 0;
@@ -105,8 +106,8 @@ export function getPostInteractionRate(name, interactionType) {
105
106
  } catch (e) {
106
107
  return 0;
107
108
  }
108
- }
109
- export function getCapabilityRate(capability) {
109
+ });
110
+ export var getCapabilityRate = withProfiling(function getCapabilityRate(capability) {
110
111
  try {
111
112
  if (!config) {
112
113
  return 0;
@@ -123,9 +124,9 @@ export function getCapabilityRate(capability) {
123
124
  } catch (_unused) {
124
125
  return 0;
125
126
  }
126
- }
127
+ });
127
128
  var validTypingMethods = ['timeout', 'timeoutNoAlloc', 'mutationObserver'];
128
- export function getTypingPerformanceTracingMethod() {
129
+ export var getTypingPerformanceTracingMethod = withProfiling(function getTypingPerformanceTracingMethod() {
129
130
  var defaultMethod = 'timeout';
130
131
  try {
131
132
  if (!config) {
@@ -143,10 +144,10 @@ export function getTypingPerformanceTracingMethod() {
143
144
  } catch (e) {
144
145
  return defaultMethod;
145
146
  }
146
- }
147
+ });
147
148
 
148
149
  // Will ask UFO to wait for BM3 TTI for all events on this list
149
- export function getAwaitBM3TTIList() {
150
+ export var getAwaitBM3TTIList = withProfiling(function getAwaitBM3TTIList() {
150
151
  try {
151
152
  if (!config) {
152
153
  return [];
@@ -161,10 +162,10 @@ export function getAwaitBM3TTIList() {
161
162
  } catch (e) {
162
163
  return [];
163
164
  }
164
- }
165
+ });
165
166
 
166
167
  // Flag to remove ufo segments prefixes
167
- export function getRemovePageSegmentsUFOPrefixes() {
168
+ export var getRemovePageSegmentsUFOPrefixes = withProfiling(function getRemovePageSegmentsUFOPrefixes() {
168
169
  try {
169
170
  if (!config) {
170
171
  return false;
@@ -179,10 +180,10 @@ export function getRemovePageSegmentsUFOPrefixes() {
179
180
  } catch (e) {
180
181
  return false;
181
182
  }
182
- }
183
+ });
183
184
 
184
185
  // Flag to remove ufo segments prefixes
185
- export function getRemoveInteractionsUFOPrefixes() {
186
+ export var getRemoveInteractionsUFOPrefixes = withProfiling(function getRemoveInteractionsUFOPrefixes() {
186
187
  try {
187
188
  if (!config) {
188
189
  return false;
@@ -197,13 +198,13 @@ export function getRemoveInteractionsUFOPrefixes() {
197
198
  } catch (e) {
198
199
  return false;
199
200
  }
200
- }
201
+ });
201
202
 
202
203
  // Will ask UFO to override ufoName => experienceKey to the apdex key
203
204
  // This is to cover use cases where one rUFO route is split into multiple BM3 keys (1:N)
204
205
  // This workaround should only be used as last resource,
205
206
  // when we find router limitations preventing teams from splliting these routes
206
- export function getUfoNameOverrides() {
207
+ export var getUfoNameOverrides = withProfiling(function getUfoNameOverrides() {
207
208
  try {
208
209
  if (!config) {
209
210
  return undefined;
@@ -217,10 +218,10 @@ export function getUfoNameOverrides() {
217
218
  } catch (e) {
218
219
  return undefined;
219
220
  }
220
- }
221
+ });
221
222
 
222
223
  // Contains the list of interactions that do not abort existing known interactions
223
- export function getDoNotAbortActivePressInteraction() {
224
+ export var getDoNotAbortActivePressInteraction = withProfiling(function getDoNotAbortActivePressInteraction() {
224
225
  try {
225
226
  if (!config) {
226
227
  return undefined;
@@ -231,10 +232,10 @@ export function getDoNotAbortActivePressInteraction() {
231
232
  } catch (e) {
232
233
  return undefined;
233
234
  }
234
- }
235
+ });
235
236
 
236
237
  // Contains the list of interactions that do not abort on transitions
237
- export function getDoNotAbortActivePressInteractionOnTransition() {
238
+ export var getDoNotAbortActivePressInteractionOnTransition = withProfiling(function getDoNotAbortActivePressInteractionOnTransition() {
238
239
  try {
239
240
  if (!config) {
240
241
  return undefined;
@@ -245,12 +246,12 @@ export function getDoNotAbortActivePressInteractionOnTransition() {
245
246
  } catch (e) {
246
247
  return undefined;
247
248
  }
248
- }
249
- export function shouldHandleEditorLnv() {
249
+ });
250
+ export var shouldHandleEditorLnv = withProfiling(function shouldHandleEditorLnv() {
250
251
  try {
251
252
  var _config$enableEditorL, _config12;
252
253
  return (_config$enableEditorL = (_config12 = config) === null || _config12 === void 0 ? void 0 : _config12.enableEditorLnvHandler) !== null && _config$enableEditorL !== void 0 ? _config$enableEditorL : false;
253
254
  } catch (e) {
254
255
  return false;
255
256
  }
256
- }
257
+ });