@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
@@ -3,12 +3,13 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
3
3
  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; } }
4
4
  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; }
5
5
  import { getConfig as getConfigUFO } from '../../../config';
6
+ import { withProfiling } from '../../../self-measurements';
6
7
  var defaultAllowedParams = ['operationName', 'operation', 'q'];
7
- var getAllowedParams = function getAllowedParams() {
8
+ var getAllowedParams = withProfiling(function getAllowedParams() {
8
9
  var config = getConfigUFO();
9
10
  return (config === null || config === void 0 ? void 0 : config.allowedResourcesParams) || defaultAllowedParams;
10
- };
11
- var handleQueryParams = function handleQueryParams(urlString) {
11
+ });
12
+ var handleQueryParams = withProfiling(function handleQueryParams(urlString) {
12
13
  try {
13
14
  if (typeof urlString !== 'string') {
14
15
  return urlString;
@@ -35,7 +36,7 @@ var handleQueryParams = function handleQueryParams(urlString) {
35
36
  } catch (e) {
36
37
  return urlString;
37
38
  }
38
- };
39
+ });
39
40
  var config = {
40
41
  mapResources: function mapResources(url) {
41
42
  return url;
@@ -44,7 +45,7 @@ var config = {
44
45
  return handleQueryParams(url);
45
46
  }
46
47
  };
47
- export function configure(resourceTimingConfig) {
48
+ export var configure = withProfiling(function configure(resourceTimingConfig) {
48
49
  var newConfig = {
49
50
  mapResources: resourceTimingConfig.mapResources,
50
51
  sanitiseEndpoints: function sanitiseEndpoints(url) {
@@ -56,7 +57,7 @@ export function configure(resourceTimingConfig) {
56
57
  }
57
58
  };
58
59
  config = newConfig;
59
- }
60
- export var getConfig = function getConfig() {
60
+ });
61
+ export var getConfig = withProfiling(function getConfig() {
61
62
  return config;
62
- };
63
+ });
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { roundEpsilon } from '../../../round-number';
3
+ import { withProfiling } from '../../../self-measurements';
3
4
  var getPerformanceObject = function getPerformanceObject() {
4
5
  var _window;
5
6
  return ((_window = window) !== null && _window !== void 0 ? _window : {}).performance;
@@ -12,7 +13,7 @@ export var resourceTimingBuffer = {
12
13
  timings: [],
13
14
  maxSize: 1000,
14
15
  observer: null,
15
- transformResource: function transformResource(entry) {
16
+ transformResource: withProfiling(function transformResource(entry) {
16
17
  var _entry$serverTiming, _entry$serverTiming2;
17
18
  var duration = roundEpsilon(entry.duration);
18
19
 
@@ -41,8 +42,8 @@ export var resourceTimingBuffer = {
41
42
  encodedSize: roundEpsilon(entry.encodedBodySize),
42
43
  decodedSize: roundEpsilon(entry.decodedBodySize)
43
44
  };
44
- },
45
- start: function start() {
45
+ }),
46
+ start: withProfiling(function start() {
46
47
  var _performance$getEntri;
47
48
  var performance = getPerformanceObject();
48
49
  var PerformanceObserver = getPerformanceObserverObject();
@@ -62,15 +63,15 @@ export var resourceTimingBuffer = {
62
63
  resourceTimingBuffer.observer.observe({
63
64
  entryTypes: ['resource']
64
65
  });
65
- },
66
- stop: function stop() {
66
+ }),
67
+ stop: withProfiling(function stop() {
67
68
  if (resourceTimingBuffer.observer) {
68
69
  resourceTimingBuffer.observer.disconnect();
69
70
  resourceTimingBuffer.observer = null;
70
71
  }
71
72
  resourceTimingBuffer.timings = [];
72
- },
73
- addTimings: function addTimings(list) {
73
+ }),
74
+ addTimings: withProfiling(function addTimings(list) {
74
75
  var _resourceTimingBuffer;
75
76
  var entries = list.getEntries().map(function (entry) {
76
77
  return resourceTimingBuffer.transformResource(entry);
@@ -81,12 +82,12 @@ export var resourceTimingBuffer = {
81
82
  resourceTimingBuffer.timings.splice(0, fieldsToRemove);
82
83
  }
83
84
  (_resourceTimingBuffer = resourceTimingBuffer.timings).push.apply(_resourceTimingBuffer, _toConsumableArray(entries));
84
- }
85
+ })
85
86
  };
86
- var isValidTiming = function isValidTiming(timing, startTime, endTime) {
87
+ var isValidTiming = withProfiling(function isValidTiming(timing, startTime, endTime) {
87
88
  return timing.startTime >= startTime && timing.startTime + timing.duration <= endTime;
88
- };
89
- export var filterResourceTimings = function filterResourceTimings(startTime, endTime) {
89
+ });
90
+ export var filterResourceTimings = withProfiling(function filterResourceTimings(startTime, endTime) {
90
91
  var performance = getPerformanceObject();
91
92
  var PerformanceObserver = getPerformanceObserverObject();
92
93
  if (!PerformanceObserver || !resourceTimingBuffer.observer) {
@@ -101,4 +102,4 @@ export var filterResourceTimings = function filterResourceTimings(startTime, end
101
102
  return resourceTimingBuffer.timings.filter(function (timing) {
102
103
  return isValidTiming(timing, startTime, endTime);
103
104
  });
104
- };
105
+ });
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { fg } from '@atlaskit/platform-feature-flags';
5
5
  import { getConfig as getConfigUFO } from '../config';
6
6
  import { roundEpsilon } from '../round-number';
7
+ import { withProfiling } from '../self-measurements';
7
8
  import { getConfig } from './common/utils/config';
8
9
  import { filterResourceTimings } from './common/utils/resource-timing-buffer';
9
10
  var alwaysCacheableTypes = ['script', 'link'];
@@ -11,18 +12,20 @@ var resourceTypes = ['fetch', 'xmlhttprequest'];
11
12
  var CACHE_NETWORK = 'network';
12
13
  var CACHE_MEMORY = 'memory';
13
14
  var CACHE_DISK = 'disk';
14
- var isCacheableType = function isCacheableType(url, type) {
15
+ var isCacheableType = withProfiling(function isCacheableType(url, type) {
15
16
  if (alwaysCacheableTypes.includes(type)) {
16
17
  return true;
17
18
  }
19
+
20
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
18
21
  if (type === 'other' && url.includes('.js') && fg('ufo_support_other_resource_type_js')) {
19
22
  return true;
20
23
  }
21
24
  return false;
22
- };
25
+ });
23
26
 
24
27
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
25
- var calculateTransferType = function calculateTransferType(name, type, duration, size) {
28
+ var calculateTransferType = withProfiling(function calculateTransferType(name, type, duration, size) {
26
29
  if (!isCacheableType(name, type)) {
27
30
  return CACHE_NETWORK;
28
31
  }
@@ -36,16 +39,17 @@ var calculateTransferType = function calculateTransferType(name, type, duration,
36
39
  return null;
37
40
  }
38
41
  return CACHE_NETWORK;
39
- };
40
- var getWindowObject = function getWindowObject() {
42
+ });
43
+ var getWindowObject = withProfiling(function getWindowObject() {
41
44
  return typeof window !== 'undefined' && !!window ? window : undefined;
42
- };
43
- var hasAccessToResourceSize = function hasAccessToResourceSize(url, type, entry, hasTimingHeaders) {
45
+ });
46
+ var hasAccessToResourceSize = withProfiling(function hasAccessToResourceSize(url, type, entry, hasTimingHeaders) {
44
47
  return !isCacheableType(url, type) || url.includes('localhost') || !!getWindowObject() && url.includes(window.location.hostname) || hasTimingHeaders(url, entry);
45
- };
46
- var getReportedInitiatorTypes = function getReportedInitiatorTypes(xhrEnabled) {
48
+ });
49
+ var getReportedInitiatorTypes = withProfiling(function getReportedInitiatorTypes(xhrEnabled) {
47
50
  var ufoConfig = getConfigUFO();
48
51
  if (!(ufoConfig !== null && ufoConfig !== void 0 && ufoConfig.allowedResources)) {
52
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
49
53
  if (fg('ufo_support_other_resource_type_js')) {
50
54
  if (xhrEnabled) {
51
55
  return ['script', 'link', 'fetch', 'other', 'xmlhttprequest'];
@@ -59,18 +63,18 @@ var getReportedInitiatorTypes = function getReportedInitiatorTypes(xhrEnabled) {
59
63
  }
60
64
  }
61
65
  return ufoConfig.allowedResources;
62
- };
63
- var evaluateAccessToResourceTimings = function evaluateAccessToResourceTimings(url, entry) {
66
+ });
67
+ var evaluateAccessToResourceTimings = withProfiling(function evaluateAccessToResourceTimings(url, entry) {
64
68
  return !(entry.responseStart === 0 && entry.startTime > entry.responseStart);
65
- };
69
+ });
66
70
 
67
71
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
68
- var getSizeObject = function getSizeObject(size) {
72
+ var getSizeObject = withProfiling(function getSizeObject(size) {
69
73
  return size !== undefined ? {
70
74
  size: size
71
75
  } : null;
72
- };
73
- var getNetworkData = function getNetworkData(item, eventStart) {
76
+ });
77
+ var getNetworkData = withProfiling(function getNetworkData(item, eventStart) {
74
78
  var hasTimingHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : evaluateAccessToResourceTimings;
75
79
  var name = item.name,
76
80
  duration = item.duration,
@@ -103,8 +107,8 @@ var getNetworkData = function getNetworkData(item, eventStart) {
103
107
  networkTime: networkTime,
104
108
  requestStart: requestStart
105
109
  }, getSizeObject(transferSize));
106
- };
107
- export var getResourceTimings = function getResourceTimings(interactionStart, interactionEnd) {
110
+ });
111
+ export var getResourceTimings = withProfiling(function getResourceTimings(interactionStart, interactionEnd) {
108
112
  var resourceTiming = {};
109
113
  if (interactionStart === null) {
110
114
  return resourceTiming;
@@ -135,7 +139,9 @@ export var getResourceTimings = function getResourceTimings(interactionStart, in
135
139
  if (initiatorType === 'xmlhttprequest' && (xhrFilter === undefined || xhrFilter(name) === false)) {
136
140
  return;
137
141
  }
138
- if (initiatorType === 'other' && !name.includes('.js') && fg('ufo_support_other_resource_type_js')) {
142
+ if (initiatorType === 'other' && !name.includes('.js') &&
143
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
144
+ fg('ufo_support_other_resource_type_js')) {
139
145
  return;
140
146
  }
141
147
  var url = resourceTypes.includes(initiatorType) ? sanitiseEndpoints(name) : mapResources(name);
@@ -155,4 +161,4 @@ export var getResourceTimings = function getResourceTimings(interactionStart, in
155
161
  }, getNetworkData(item, interactionStart, hasTimingHeaders));
156
162
  });
157
163
  return resourceTiming;
158
- };
164
+ });
@@ -1,4 +1,5 @@
1
+ import { withProfiling } from '../self-measurements';
1
2
  import { resourceTimingBuffer } from './common/utils/resource-timing-buffer';
2
- export function startResourceTimingBuffer() {
3
+ export var startResourceTimingBuffer = withProfiling(function startResourceTimingBuffer() {
3
4
  resourceTimingBuffer.start();
4
- }
5
+ });
@@ -1,5 +1,6 @@
1
- export var roundEpsilon = function roundEpsilon(num) {
1
+ import { withProfiling } from '../self-measurements';
2
+ export var roundEpsilon = withProfiling(function roundEpsilon(num) {
2
3
  var places = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
3
4
  var factor = Math.pow(10, places);
4
5
  return Math.round((num + Number.EPSILON) * factor) / factor;
5
- };
6
+ });
@@ -1,6 +1,8 @@
1
- export default function getUFORouteName(route) {
1
+ import { withProfiling } from '../self-measurements';
2
+ var getUFORouteName = withProfiling(function getUFORouteName(route) {
2
3
  if (route.ufoName != null) {
3
4
  return route.ufoName;
4
5
  }
5
6
  return route.name;
6
- }
7
+ });
8
+ export default getUFORouteName;
@@ -1,5 +1,7 @@
1
- export default function scheduleOnPaint(callback) {
1
+ import { withProfiling } from '../self-measurements';
2
+ var scheduleOnPaint = withProfiling(function scheduleOnPaint(_callback) {
2
3
  var _document;
4
+ var callback = withProfiling(_callback);
3
5
  if (((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) !== 'visible') {
4
6
  // last resort fallback
5
7
  setTimeout(callback, 100);
@@ -26,4 +28,5 @@ export default function scheduleOnPaint(callback) {
26
28
  });
27
29
  });
28
30
  }
29
- }
31
+ });
32
+ export default scheduleOnPaint;
@@ -13,6 +13,7 @@ import UFOInteractionContext from '../interaction-context';
13
13
  import UFOInteractionIDContext from '../interaction-id-context';
14
14
  import { abortByNewInteraction, addApdex as _addApdex, addCustomData as _addCustomData, addCustomTiming, addHold, addHoldByID, addMark as _addMark, addNewInteraction, addProfilerTimings, addRequestInfo, addSegment, addSpan, removeHoldByID, removeSegment, tryComplete } from '../interaction-metrics';
15
15
  import UFORouteName from '../route-name-context';
16
+ import { withProfiling } from '../self-measurements';
16
17
  import generateId from '../short-id';
17
18
  import scheduleOnPaint from './schedule-on-paint';
18
19
  var tryCompleteHandle;
@@ -25,6 +26,7 @@ var AsyncSegmentHighlight = /*#__PURE__*/lazy(function () {
25
26
  });
26
27
  var noopIdMap = new Map();
27
28
 
29
+ // KARL TODO: finish self profiling
28
30
  /** A portion of the page we apply measurement to */
29
31
  export default function UFOSegment(_ref) {
30
32
  var _getConfig2;
@@ -68,11 +70,12 @@ export default function UFOSegment(_ref) {
68
70
  }, [parentContext, segmentName, segmentId]);
69
71
  var interactionId = useContext(UFOInteractionIDContext);
70
72
  var interactionContext = useMemo(function () {
73
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
71
74
  if (!fg('platform-ufo-add-segment-use-effect')) {
72
75
  addSegment(labelStack);
73
76
  }
74
77
  var lastCompleteEndTime = 0;
75
- function complete() {
78
+ var complete = withProfiling(function complete() {
76
79
  var endTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : performance.now();
77
80
  if (interactionId.current) {
78
81
  if (parentContext) {
@@ -86,7 +89,7 @@ export default function UFOSegment(_ref) {
86
89
  var _cancelAnimationFrame;
87
90
  (_cancelAnimationFrame = cancelAnimationFrame) === null || _cancelAnimationFrame === void 0 || _cancelAnimationFrame(tryCompleteHandle);
88
91
  }
89
- scheduleCallback(NormalPriority, function () {
92
+ var onComplete = withProfiling(function onComplete() {
90
93
  if (capturedInteractionId === interactionId.current) {
91
94
  var _document;
92
95
  var isPageVisible = ((_document = document) === null || _document === void 0 ? void 0 : _document.visibilityState) === 'visible';
@@ -104,9 +107,10 @@ export default function UFOSegment(_ref) {
104
107
  }
105
108
  }
106
109
  });
110
+ scheduleCallback(NormalPriority, onComplete);
107
111
  }
108
112
  }
109
- }
113
+ });
110
114
  function _internalHold(labelStack, name) {
111
115
  var experimental = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
112
116
  if (interactionId.current != null) {
@@ -0,0 +1,246 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
+ 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; } } }; }
7
+ 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; } }
8
+ 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; }
9
+ import { fg } from '@atlaskit/platform-feature-flags';
10
+ globalThis.__ufo_self_measurements = globalThis.__ufo_self_measurements || {
11
+ __internalState: {
12
+ functionStack: []
13
+ },
14
+ runtime: {
15
+ total: 0,
16
+ async: 0,
17
+ error: 0,
18
+ byFunction: {},
19
+ custom: {}
20
+ }
21
+ };
22
+ export function resetProfilerMeasurements() {
23
+ globalThis.__ufo_self_measurements = {
24
+ __internalState: {
25
+ functionStack: []
26
+ },
27
+ runtime: {
28
+ total: 0,
29
+ async: 0,
30
+ error: 0,
31
+ byFunction: {},
32
+ custom: {}
33
+ }
34
+ };
35
+ }
36
+ function trackFunctionTimingStart(fnName) {
37
+ var _globalThis$__ufo_sel;
38
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
39
+ resetProfilerMeasurements();
40
+ }
41
+ globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel === void 0 || (_globalThis$__ufo_sel = _globalThis$__ufo_sel.__internalState) === null || _globalThis$__ufo_sel === void 0 || (_globalThis$__ufo_sel = _globalThis$__ufo_sel.functionStack) === null || _globalThis$__ufo_sel === void 0 || _globalThis$__ufo_sel.push(fnName);
42
+ }
43
+ function trackFunctionTimingEnd() {
44
+ var _globalThis$__ufo_sel2;
45
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
46
+ resetProfilerMeasurements();
47
+ }
48
+ globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel2 = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel2 === void 0 || (_globalThis$__ufo_sel2 = _globalThis$__ufo_sel2.__internalState) === null || _globalThis$__ufo_sel2 === void 0 || (_globalThis$__ufo_sel2 = _globalThis$__ufo_sel2.functionStack) === null || _globalThis$__ufo_sel2 === void 0 || _globalThis$__ufo_sel2.pop();
49
+ }
50
+ function shouldRecordProfilerMeasurement() {
51
+ var _globalThis$__ufo_sel3;
52
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
53
+ resetProfilerMeasurements();
54
+ }
55
+ return (globalThis === null || globalThis === void 0 || (_globalThis$__ufo_sel3 = globalThis.__ufo_self_measurements) === null || _globalThis$__ufo_sel3 === void 0 || (_globalThis$__ufo_sel3 = _globalThis$__ufo_sel3.__internalState) === null || _globalThis$__ufo_sel3 === void 0 || (_globalThis$__ufo_sel3 = _globalThis$__ufo_sel3.functionStack) === null || _globalThis$__ufo_sel3 === void 0 ? void 0 : _globalThis$__ufo_sel3.length) === 0;
56
+ }
57
+ function recordProfilerMeasurement(functionName, duration, isAsync, isError) {
58
+ var tags = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
59
+ // discard measurements that are not significant
60
+ if (duration <= 0) {
61
+ return;
62
+ }
63
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.__ufo_self_measurements)) {
64
+ resetProfilerMeasurements();
65
+ }
66
+ globalThis.__ufo_self_measurements.runtime.total += duration;
67
+ if (isAsync) {
68
+ globalThis.__ufo_self_measurements.runtime.async += duration;
69
+ }
70
+ if (isError) {
71
+ globalThis.__ufo_self_measurements.runtime.error += duration;
72
+ }
73
+ if (functionName in globalThis.__ufo_self_measurements.runtime.byFunction) {
74
+ globalThis.__ufo_self_measurements.runtime.byFunction[functionName] += duration;
75
+ } else {
76
+ globalThis.__ufo_self_measurements.runtime.byFunction[functionName] = duration;
77
+ }
78
+ var _iterator = _createForOfIteratorHelper(tags),
79
+ _step;
80
+ try {
81
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
82
+ var tag = _step.value;
83
+ if (tag in globalThis.__ufo_self_measurements.runtime.custom) {
84
+ globalThis.__ufo_self_measurements.runtime.custom[tag] += duration;
85
+ } else {
86
+ globalThis.__ufo_self_measurements.runtime.custom[tag] = duration;
87
+ }
88
+ }
89
+ } catch (err) {
90
+ _iterator.e(err);
91
+ } finally {
92
+ _iterator.f();
93
+ }
94
+ }
95
+ function isPromise(value) {
96
+ return value && typeof value.then === 'function';
97
+ }
98
+ export function withProfiling(fn) {
99
+ var tags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
100
+ try {
101
+ if (!fg('platform_ufo_self_timings')) {
102
+ return fn; // this is a NOOP wrapper if feature gate is disabled
103
+ }
104
+ } catch (_unused) {
105
+ return fn;
106
+ }
107
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
108
+ return fn;
109
+ }
110
+ if (fn.constructor.name === 'AsyncFunction') {
111
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
+ var _fn$name;
113
+ var startTime,
114
+ result,
115
+ endTime,
116
+ _endTime,
117
+ _args = arguments;
118
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
119
+ while (1) switch (_context.prev = _context.next) {
120
+ case 0:
121
+ startTime = performance.now();
122
+ trackFunctionTimingStart((_fn$name = fn.name) !== null && _fn$name !== void 0 ? _fn$name : 'anonymous');
123
+ _context.prev = 2;
124
+ _context.next = 5;
125
+ return fn.apply(void 0, _args);
126
+ case 5:
127
+ result = _context.sent;
128
+ endTime = performance.now();
129
+ trackFunctionTimingEnd();
130
+ if (shouldRecordProfilerMeasurement()) {
131
+ recordProfilerMeasurement(fn.name, endTime - startTime, true, false, tags);
132
+ }
133
+ return _context.abrupt("return", result);
134
+ case 12:
135
+ _context.prev = 12;
136
+ _context.t0 = _context["catch"](2);
137
+ _endTime = performance.now();
138
+ trackFunctionTimingEnd();
139
+ if (shouldRecordProfilerMeasurement()) {
140
+ recordProfilerMeasurement(fn.name, _endTime - startTime, true, true, tags);
141
+ }
142
+ throw _context.t0;
143
+ case 18:
144
+ case "end":
145
+ return _context.stop();
146
+ }
147
+ }, _callee, null, [[2, 12]]);
148
+ }));
149
+ }
150
+ return function () {
151
+ var _fn$name2;
152
+ var startTime = performance.now();
153
+ trackFunctionTimingStart((_fn$name2 = fn.name) !== null && _fn$name2 !== void 0 ? _fn$name2 : 'anonymous');
154
+ try {
155
+ var result = fn.apply(void 0, arguments);
156
+ if (isPromise(result)) {
157
+ result.then(function (value) {
158
+ var endTime = performance.now();
159
+ trackFunctionTimingEnd();
160
+ if (shouldRecordProfilerMeasurement()) {
161
+ recordProfilerMeasurement(fn.name, endTime - startTime, true, false, tags);
162
+ }
163
+ return value;
164
+ }).catch(function (value) {
165
+ var endTime = performance.now();
166
+ trackFunctionTimingEnd();
167
+ if (shouldRecordProfilerMeasurement()) {
168
+ recordProfilerMeasurement(fn.name, endTime - startTime, true, true, tags);
169
+ }
170
+ return value;
171
+ });
172
+ } else {
173
+ var endTime = performance.now();
174
+ trackFunctionTimingEnd();
175
+ if (shouldRecordProfilerMeasurement()) {
176
+ recordProfilerMeasurement(fn.name, endTime - startTime, false, false, tags);
177
+ }
178
+ }
179
+ return result;
180
+ } catch (error) {
181
+ var _endTime2 = performance.now();
182
+ trackFunctionTimingEnd();
183
+ if (shouldRecordProfilerMeasurement()) {
184
+ recordProfilerMeasurement(fn.name, _endTime2 - startTime, false, true, tags);
185
+ }
186
+ throw error;
187
+ }
188
+ };
189
+ }
190
+ export function markProfilingStart(name) {
191
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
192
+ return {
193
+ name: name,
194
+ startTime: -1
195
+ };
196
+ }
197
+ trackFunctionTimingStart(name);
198
+ return {
199
+ name: name,
200
+ startTime: performance.now()
201
+ };
202
+ }
203
+ export function markProfilingEnd(_ref2) {
204
+ var name = _ref2.name,
205
+ startTime = _ref2.startTime;
206
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
207
+ isAsync = _ref3.isAsync,
208
+ isError = _ref3.isError,
209
+ tags = _ref3.tags;
210
+ if (!(globalThis !== null && globalThis !== void 0 && globalThis.performance)) {
211
+ return;
212
+ }
213
+ trackFunctionTimingEnd();
214
+ if (!fg('platform_ufo_self_timings')) {
215
+ return;
216
+ }
217
+ var endTime = performance.now();
218
+ recordProfilerMeasurement(name, endTime - startTime, isAsync, isError, tags);
219
+ }
220
+ export function getProfilerData() {
221
+ return _objectSpread({}, globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime);
222
+ }
223
+ export function getProfilerTotalRuntime() {
224
+ if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.total) === 'number') {
225
+ return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.total);
226
+ }
227
+ return null;
228
+ }
229
+ export function getProfilerAsyncRuntime() {
230
+ if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.async) === 'number') {
231
+ return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.async);
232
+ }
233
+ return null;
234
+ }
235
+ export function getProfilerRuntimeByFunction(functionName) {
236
+ if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.byFunction[functionName]) === 'number') {
237
+ return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.byFunction[functionName]);
238
+ }
239
+ return null;
240
+ }
241
+ export function getProfilerRuntimeByTag(tag) {
242
+ if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.custom[tag]) === 'number') {
243
+ return Math.round(globalThis === null || globalThis === void 0 ? void 0 : globalThis.__ufo_self_measurements.runtime.custom[tag]);
244
+ }
245
+ return null;
246
+ }
@@ -1,5 +1,6 @@
1
1
  import { addError, getActiveInteraction } from '../interaction-metrics';
2
- export function setInteractionError(interactionName, error) {
2
+ import { withProfiling } from '../self-measurements';
3
+ export var setInteractionError = withProfiling(function setInteractionError(interactionName, error) {
3
4
  var interaction = getActiveInteraction();
4
5
  if (!interaction) {
5
6
  return;
@@ -8,4 +9,4 @@ export function setInteractionError(interactionName, error) {
8
9
  return;
9
10
  }
10
11
  addError(interaction.id, error.name, null, 'Manual interaction error', error.errorMessage, undefined, true);
11
- }
12
+ });
@@ -1,4 +1,5 @@
1
- export default function generateId() {
1
+ import { withProfiling } from '../self-measurements';
2
+ var generateId = withProfiling(function generateId() {
2
3
  var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
3
4
  var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
4
5
  var result = '';
@@ -6,4 +7,5 @@ export default function generateId() {
6
7
  result += characters.charAt(Math.floor(Math.random() * characters.length));
7
8
  }
8
9
  return result;
9
- }
10
+ });
11
+ export default generateId;
@@ -1,26 +1,27 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
+ import { withProfiling } from '../self-measurements';
2
3
  var NESTED_METRIC_SEPARATOR = '/';
3
- var filterEntry = function filterEntry(entry) {
4
+ var filterEntry = withProfiling(function filterEntry(entry) {
4
5
  return !(!entry || _typeof(entry) !== 'object' || entry.startTime < 0 || entry.duration < 0);
5
- };
6
- var mapEntry = function mapEntry(entry) {
6
+ });
7
+ var mapEntry = withProfiling(function mapEntry(entry) {
7
8
  return {
8
9
  startTime: Math.round(entry.startTime),
9
10
  duration: Math.round(entry.duration)
10
11
  };
11
- };
12
+ });
12
13
  var SSR_PREFIX = 'ssr';
13
- var mapKey = function mapKey(key) {
14
+ var mapKey = withProfiling(function mapKey(key) {
14
15
  if (key === 'total') {
15
16
  return SSR_PREFIX;
16
17
  }
17
18
  return "".concat(SSR_PREFIX).concat(NESTED_METRIC_SEPARATOR).concat(key);
18
- };
19
+ });
19
20
  var config;
20
- export function configure(ssrConfig) {
21
+ export var configure = withProfiling(function configure(ssrConfig) {
21
22
  config = ssrConfig;
22
- }
23
- export function getSSRTimings() {
23
+ });
24
+ export var getSSRTimings = withProfiling(function getSSRTimings() {
24
25
  var _config;
25
26
  if (!((_config = config) !== null && _config !== void 0 && _config.getTimings)) {
26
27
  return {};
@@ -36,16 +37,16 @@ export function getSSRTimings() {
36
37
  return acc;
37
38
  }, {});
38
39
  return ssrTimings;
39
- }
40
- export function getSSRSuccess() {
40
+ });
41
+ export var getSSRSuccess = withProfiling(function getSSRSuccess() {
41
42
  var _config2;
42
43
  return !!((_config2 = config) !== null && _config2 !== void 0 && _config2.getDoneMark());
43
- }
44
- export function getSSRDoneTime() {
44
+ });
45
+ export var getSSRDoneTime = withProfiling(function getSSRDoneTime() {
45
46
  var _config$getDoneMark, _config3;
46
47
  return (_config$getDoneMark = (_config3 = config) === null || _config3 === void 0 ? void 0 : _config3.getDoneMark()) !== null && _config$getDoneMark !== void 0 ? _config$getDoneMark : undefined;
47
- }
48
- export function getSSRFeatureFlags() {
48
+ });
49
+ export var getSSRFeatureFlags = withProfiling(function getSSRFeatureFlags() {
49
50
  var _config4;
50
51
  if (!((_config4 = config) !== null && _config4 !== void 0 && _config4.getFeatureFlags)) {
51
52
  return undefined;
@@ -56,4 +57,4 @@ export function getSSRFeatureFlags() {
56
57
  // eslint-disable-next-line no-empty
57
58
  } catch (e) {}
58
59
  return undefined;
59
- }
60
+ });