@atlaskit/react-ufo 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +5 -0
- package/additional-payload/package.json +15 -0
- package/bundle-eval-timing/package.json +15 -0
- package/coinflip/package.json +15 -0
- package/common/package.json +5 -5
- package/config/package.json +15 -0
- package/create-payload/package.json +15 -0
- package/create-post-interaction-log-payload/package.json +15 -0
- package/custom-data/package.json +15 -0
- package/custom-mark/package.json +15 -0
- package/custom-spans/package.json +15 -0
- package/custom-timings/package.json +15 -0
- package/dist/cjs/additional-payload/index.js +25 -0
- package/dist/cjs/additional-payload/utils/cache-hit-ratio/index.js +69 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/cls/index.js +53 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/const.js +10 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/index.js +29 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/tbt/index.js +25 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +38 -0
- package/dist/cjs/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +37 -0
- package/dist/cjs/bundle-eval-timing/index.js +48 -0
- package/dist/cjs/coinflip/index.js +22 -0
- package/dist/cjs/common/common/types.js +5 -0
- package/dist/cjs/common/constants.js +7 -0
- package/dist/cjs/common/index.js +1 -0
- package/dist/cjs/common/vc/types.js +11 -0
- package/dist/cjs/config/index.js +222 -0
- package/dist/cjs/create-payload/common/types.js +1 -0
- package/dist/cjs/create-payload/common/utils/index.js +15 -0
- package/dist/cjs/create-payload/index.js +784 -0
- package/dist/cjs/create-post-interaction-log-payload/index.js +207 -0
- package/dist/cjs/custom-data/index.js +31 -0
- package/dist/cjs/custom-data/types.js +5 -0
- package/dist/cjs/custom-mark/index.js +45 -0
- package/dist/cjs/custom-spans/index.js +14 -0
- package/dist/cjs/custom-timings/index.js +65 -0
- package/dist/cjs/experience-trace-id-context/index.js +40 -0
- package/dist/cjs/experience-trace-id-context/types.js +1 -0
- package/dist/cjs/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +12 -0
- package/dist/cjs/feature-flags-accessed/common/constants.js +7 -0
- package/dist/cjs/feature-flags-accessed/common/types.js +5 -0
- package/dist/cjs/feature-flags-accessed/common/utils/index.js +38 -0
- package/dist/cjs/feature-flags-accessed/index.js +32 -0
- package/dist/cjs/generate-id/index.js +12 -0
- package/dist/cjs/global-error-handler/index.js +74 -0
- package/dist/cjs/hidden-timing/index.js +94 -0
- package/dist/cjs/initial-page-load-extra-timing/index.js +49 -0
- package/dist/cjs/interaction-context/index.js +14 -0
- package/dist/cjs/interaction-id-context/index.js +27 -0
- package/dist/cjs/interaction-metrics/common/constants.js +8 -0
- package/dist/cjs/interaction-metrics/index.js +815 -4
- package/dist/cjs/interaction-metrics/post-interaction-log.js +190 -0
- package/dist/cjs/interaction-metrics-init/index.js +89 -0
- package/dist/cjs/label/UFOLabel.js +45 -0
- package/dist/cjs/label/index.js +9 -0
- package/dist/cjs/load-hold/UFOLoadHold.js +76 -0
- package/dist/cjs/load-hold/index.js +9 -0
- package/dist/cjs/placeholder/Placeholder.js +34 -0
- package/dist/cjs/placeholder/index.js +9 -0
- package/dist/cjs/placeholder/loosely-lazy/index.js +19 -0
- package/dist/cjs/placeholder/loosely-lazy/lazy-suspense.js +80 -0
- package/dist/cjs/placeholder/loosely-lazy/types.js +5 -0
- package/dist/cjs/placeholder/loosely-lazy/wait-context.js +15 -0
- package/dist/cjs/resource-timing/common/types.js +1 -0
- package/dist/cjs/resource-timing/common/utils/config.js +70 -0
- package/dist/cjs/resource-timing/common/utils/resource-timing-buffer.js +111 -0
- package/dist/cjs/resource-timing/index.js +26 -0
- package/dist/cjs/resource-timing/main.js +141 -0
- package/dist/cjs/resource-timing/utils.js +10 -0
- package/dist/cjs/round-number/index.js +11 -0
- package/dist/cjs/route-name/index.js +12 -0
- package/dist/cjs/route-name-context/index.js +11 -0
- package/dist/cjs/segment/index.js +9 -0
- package/dist/cjs/segment/segment-highlight.js +40 -0
- package/dist/cjs/segment/segment.js +247 -0
- package/dist/cjs/set-interaction-error/index.js +17 -0
- package/dist/cjs/short-id/index.js +15 -0
- package/dist/cjs/ssr/index.js +70 -0
- package/dist/cjs/trace-interaction/index.js +48 -0
- package/dist/cjs/trace-pageload/index.js +58 -0
- package/dist/cjs/trace-press/index.js +34 -0
- package/dist/cjs/trace-redirect/index.js +17 -0
- package/dist/cjs/trace-transition/index.js +60 -0
- package/dist/cjs/trace-transition/utils/generate-span-id/index.js +11 -0
- package/dist/cjs/trace-transition/utils/set-interaction-active-trace/index.js +11 -0
- package/dist/cjs/typing-performance-tracing/index.js +262 -0
- package/dist/cjs/use-press-tracing/index.js +19 -0
- package/dist/cjs/vc/index.js +15 -0
- package/dist/cjs/vc/vc-observer/attachAbortListeners.js +40 -0
- package/dist/cjs/vc/vc-observer/getViewport.js +27 -0
- package/dist/cjs/vc/vc-observer/index.js +562 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/index.js +15 -0
- package/dist/cjs/vc/vc-observer/media-wrapper/vc-utils.js +16 -0
- package/dist/cjs/vc/vc-observer/observers/index.js +270 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/index.js +183 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +22 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +20 -0
- package/dist/cjs/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +19 -0
- package/dist/cjs/vc/vc-observer/observers/types.js +5 -0
- package/dist/es2019/additional-payload/index.js +2 -0
- package/dist/es2019/additional-payload/utils/cache-hit-ratio/index.js +63 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/cls/index.js +33 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/const.js +4 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/index.js +23 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/tbt/index.js +15 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +23 -0
- package/dist/es2019/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +31 -0
- package/dist/es2019/bundle-eval-timing/index.js +43 -0
- package/dist/es2019/coinflip/index.js +16 -0
- package/dist/es2019/common/common/types.js +1 -0
- package/dist/es2019/common/constants.js +1 -0
- package/dist/es2019/common/vc/types.js +5 -0
- package/dist/es2019/config/index.js +215 -0
- package/dist/es2019/create-payload/common/types.js +0 -0
- package/dist/es2019/create-payload/common/utils/index.js +8 -0
- package/dist/es2019/create-payload/index.js +792 -0
- package/dist/es2019/create-post-interaction-log-payload/index.js +188 -0
- package/dist/es2019/custom-data/index.js +24 -0
- package/dist/es2019/custom-data/types.js +1 -0
- package/dist/es2019/custom-mark/index.js +38 -0
- package/dist/es2019/custom-spans/index.js +6 -0
- package/dist/es2019/custom-timings/index.js +57 -0
- package/dist/es2019/experience-trace-id-context/index.js +31 -0
- package/dist/es2019/experience-trace-id-context/types.js +0 -0
- package/dist/es2019/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +4 -0
- package/dist/es2019/feature-flags-accessed/common/constants.js +1 -0
- package/dist/es2019/feature-flags-accessed/common/types.js +1 -0
- package/dist/es2019/feature-flags-accessed/common/utils/index.js +24 -0
- package/dist/es2019/feature-flags-accessed/index.js +21 -0
- package/dist/es2019/generate-id/index.js +6 -0
- package/dist/es2019/global-error-handler/index.js +64 -0
- package/dist/es2019/hidden-timing/index.js +87 -0
- package/dist/es2019/initial-page-load-extra-timing/index.js +43 -0
- package/dist/es2019/interaction-context/index.js +6 -0
- package/dist/es2019/interaction-id-context/index.js +18 -0
- package/dist/es2019/interaction-metrics/common/constants.js +2 -0
- package/dist/es2019/interaction-metrics/index.js +741 -4
- package/dist/es2019/interaction-metrics/post-interaction-log.js +158 -0
- package/dist/es2019/interaction-metrics-init/index.js +72 -0
- package/dist/es2019/label/UFOLabel.js +34 -0
- package/dist/es2019/label/index.js +2 -0
- package/dist/es2019/load-hold/UFOLoadHold.js +66 -0
- package/dist/es2019/load-hold/index.js +2 -0
- package/dist/es2019/placeholder/Placeholder.js +25 -0
- package/dist/es2019/placeholder/index.js +2 -0
- package/dist/es2019/placeholder/loosely-lazy/index.js +2 -0
- package/dist/es2019/placeholder/loosely-lazy/lazy-suspense.js +63 -0
- package/dist/es2019/placeholder/loosely-lazy/types.js +1 -0
- package/dist/es2019/placeholder/loosely-lazy/wait-context.js +5 -0
- package/dist/es2019/resource-timing/common/types.js +0 -0
- package/dist/es2019/resource-timing/common/utils/config.js +44 -0
- package/dist/es2019/resource-timing/common/utils/resource-timing-buffer.js +88 -0
- package/dist/es2019/resource-timing/index.js +3 -0
- package/dist/es2019/resource-timing/main.js +130 -0
- package/dist/es2019/resource-timing/utils.js +4 -0
- package/dist/es2019/round-number/index.js +4 -0
- package/dist/es2019/route-name/index.js +6 -0
- package/dist/es2019/route-name-context/index.js +5 -0
- package/dist/es2019/segment/index.js +2 -0
- package/dist/es2019/segment/segment-highlight.js +27 -0
- package/dist/es2019/segment/segment.js +218 -0
- package/dist/es2019/set-interaction-error/index.js +11 -0
- package/dist/es2019/short-id/index.js +8 -0
- package/dist/es2019/ssr/index.js +54 -0
- package/dist/es2019/trace-interaction/index.js +41 -0
- package/dist/es2019/trace-pageload/index.js +48 -0
- package/dist/es2019/trace-press/index.js +27 -0
- package/dist/es2019/trace-redirect/index.js +10 -0
- package/dist/es2019/trace-transition/index.js +48 -0
- package/dist/es2019/trace-transition/utils/generate-span-id/index.js +1 -0
- package/dist/es2019/trace-transition/utils/set-interaction-active-trace/index.js +5 -0
- package/dist/es2019/typing-performance-tracing/index.js +255 -0
- package/dist/es2019/use-press-tracing/index.js +12 -0
- package/dist/es2019/vc/index.js +8 -0
- package/dist/es2019/vc/vc-observer/attachAbortListeners.js +34 -0
- package/dist/es2019/vc/vc-observer/getViewport.js +18 -0
- package/dist/es2019/vc/vc-observer/index.js +522 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/index.js +9 -0
- package/dist/es2019/vc/vc-observer/media-wrapper/vc-utils.js +10 -0
- package/dist/es2019/vc/vc-observer/observers/index.js +231 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/index.js +146 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +16 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +14 -0
- package/dist/es2019/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +2 -0
- package/dist/es2019/vc/vc-observer/observers/types.js +1 -0
- package/dist/esm/additional-payload/index.js +2 -0
- package/dist/esm/additional-payload/utils/cache-hit-ratio/index.js +63 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/index.js +47 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/cls/types.js +0 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/const.js +4 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/index.js +22 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/tbt/index.js +19 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/buffer/index.js +31 -0
- package/dist/esm/additional-payload/utils/lighthouse-metrics/utils/observer/index.js +31 -0
- package/dist/esm/bundle-eval-timing/index.js +41 -0
- package/dist/esm/coinflip/index.js +16 -0
- package/dist/esm/common/common/types.js +1 -0
- package/dist/esm/common/constants.js +1 -0
- package/dist/esm/common/index.js +0 -0
- package/dist/esm/common/vc/types.js +5 -0
- package/dist/esm/config/index.js +206 -0
- package/dist/esm/create-payload/common/types.js +0 -0
- package/dist/esm/create-payload/common/utils/index.js +8 -0
- package/dist/esm/create-payload/index.js +774 -0
- package/dist/esm/create-post-interaction-log-payload/index.js +200 -0
- package/dist/esm/custom-data/index.js +23 -0
- package/dist/esm/custom-data/types.js +1 -0
- package/dist/esm/custom-mark/index.js +36 -0
- package/dist/esm/custom-spans/index.js +8 -0
- package/dist/esm/custom-timings/index.js +56 -0
- package/dist/esm/experience-trace-id-context/index.js +34 -0
- package/dist/esm/experience-trace-id-context/types.js +0 -0
- package/dist/esm/experience-trace-id-context/utils/make-trace-http-request-headers/index.js +6 -0
- package/dist/esm/feature-flags-accessed/common/constants.js +1 -0
- package/dist/esm/feature-flags-accessed/common/types.js +1 -0
- package/dist/esm/feature-flags-accessed/common/utils/index.js +31 -0
- package/dist/esm/feature-flags-accessed/index.js +21 -0
- package/dist/esm/generate-id/index.js +6 -0
- package/dist/esm/global-error-handler/index.js +67 -0
- package/dist/esm/hidden-timing/index.js +87 -0
- package/dist/esm/initial-page-load-extra-timing/index.js +42 -0
- package/dist/esm/interaction-context/index.js +6 -0
- package/dist/esm/interaction-id-context/index.js +22 -0
- package/dist/esm/interaction-metrics/common/constants.js +2 -0
- package/dist/esm/interaction-metrics/index.js +778 -3
- package/dist/esm/interaction-metrics/post-interaction-log.js +184 -0
- package/dist/esm/interaction-metrics-init/index.js +77 -0
- package/dist/esm/label/UFOLabel.js +36 -0
- package/dist/esm/label/index.js +2 -0
- package/dist/esm/load-hold/UFOLoadHold.js +66 -0
- package/dist/esm/load-hold/index.js +2 -0
- package/dist/esm/placeholder/Placeholder.js +25 -0
- package/dist/esm/placeholder/index.js +2 -0
- package/dist/esm/placeholder/loosely-lazy/index.js +2 -0
- package/dist/esm/placeholder/loosely-lazy/lazy-suspense.js +70 -0
- package/dist/esm/placeholder/loosely-lazy/types.js +1 -0
- package/dist/esm/placeholder/loosely-lazy/wait-context.js +9 -0
- package/dist/esm/resource-timing/common/types.js +0 -0
- package/dist/esm/resource-timing/common/utils/config.js +62 -0
- package/dist/esm/resource-timing/common/utils/resource-timing-buffer.js +104 -0
- package/dist/esm/resource-timing/index.js +3 -0
- package/dist/esm/resource-timing/main.js +134 -0
- package/dist/esm/resource-timing/utils.js +4 -0
- package/dist/esm/round-number/index.js +5 -0
- package/dist/esm/route-name/index.js +6 -0
- package/dist/esm/route-name-context/index.js +5 -0
- package/dist/esm/segment/index.js +2 -0
- package/dist/esm/segment/segment-highlight.js +30 -0
- package/dist/esm/segment/segment.js +235 -0
- package/dist/esm/set-interaction-error/index.js +11 -0
- package/dist/esm/short-id/index.js +9 -0
- package/dist/esm/ssr/index.js +59 -0
- package/dist/esm/trace-interaction/index.js +41 -0
- package/dist/esm/trace-pageload/index.js +50 -0
- package/dist/esm/trace-press/index.js +27 -0
- package/dist/esm/trace-redirect/index.js +10 -0
- package/dist/esm/trace-transition/index.js +49 -0
- package/dist/esm/trace-transition/utils/generate-span-id/index.js +5 -0
- package/dist/esm/trace-transition/utils/set-interaction-active-trace/index.js +5 -0
- package/dist/esm/typing-performance-tracing/index.js +255 -0
- package/dist/esm/use-press-tracing/index.js +12 -0
- package/dist/esm/vc/index.js +9 -0
- package/dist/esm/vc/vc-observer/attachAbortListeners.js +34 -0
- package/dist/esm/vc/vc-observer/getViewport.js +20 -0
- package/dist/esm/vc/vc-observer/index.js +555 -0
- package/dist/esm/vc/vc-observer/media-wrapper/index.js +7 -0
- package/dist/esm/vc/vc-observer/media-wrapper/vc-utils.js +10 -0
- package/dist/esm/vc/vc-observer/observers/index.js +263 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/index.js +176 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.js +16 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.js +14 -0
- package/dist/esm/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.js +2 -0
- package/dist/esm/vc/vc-observer/observers/types.js +1 -0
- package/dist/types/additional-payload/index.d.ts +2 -0
- package/dist/types/additional-payload/utils/cache-hit-ratio/index.d.ts +8 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +2 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/cls/types.d.ts +3 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/const.d.ts +5 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/index.d.ts +7 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +5 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/utils/buffer/index.d.ts +13 -0
- package/dist/types/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -0
- package/dist/types/bundle-eval-timing/index.d.ts +16 -0
- package/dist/types/coinflip/index.d.ts +8 -0
- package/dist/types/common/common/types.d.ts +201 -0
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types/common/index.d.ts +5 -0
- package/dist/types/common/vc/types.d.ts +91 -0
- package/dist/types/config/index.d.ts +91 -0
- package/dist/types/create-payload/common/types.d.ts +4 -0
- package/dist/types/create-payload/common/utils/index.d.ts +3 -0
- package/dist/types/create-payload/index.d.ts +2969 -0
- package/dist/types/create-post-interaction-log-payload/index.d.ts +45 -0
- package/dist/types/custom-data/index.d.ts +5 -0
- package/dist/types/custom-data/types.d.ts +4 -0
- package/dist/types/custom-mark/index.d.ts +10 -0
- package/dist/types/custom-spans/index.d.ts +1 -0
- package/dist/types/custom-timings/index.d.ts +19 -0
- package/dist/types/experience-trace-id-context/index.d.ts +10 -0
- package/dist/types/experience-trace-id-context/types.d.ts +8 -0
- package/dist/types/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +4 -0
- package/dist/types/feature-flags-accessed/common/constants.d.ts +1 -0
- package/dist/types/feature-flags-accessed/common/types.d.ts +2 -0
- package/dist/types/feature-flags-accessed/common/utils/index.d.ts +3 -0
- package/dist/types/feature-flags-accessed/index.d.ts +14 -0
- package/dist/types/generate-id/index.d.ts +2 -0
- package/dist/types/global-error-handler/index.d.ts +3 -0
- package/dist/types/hidden-timing/index.d.ts +7 -0
- package/dist/types/initial-page-load-extra-timing/index.d.ts +9 -0
- package/dist/types/interaction-context/index.d.ts +33 -0
- package/dist/types/interaction-id-context/index.d.ts +9 -0
- package/dist/types/interaction-metrics/common/constants.d.ts +3 -0
- package/dist/types/interaction-metrics/index.d.ts +66 -2
- package/dist/types/interaction-metrics/post-interaction-log.d.ts +69 -0
- package/dist/types/interaction-metrics-init/index.d.ts +11 -0
- package/dist/types/label/UFOLabel.d.ts +13 -0
- package/dist/types/label/index.d.ts +2 -0
- package/dist/types/load-hold/UFOLoadHold.d.ts +53 -0
- package/dist/types/load-hold/index.d.ts +2 -0
- package/dist/types/placeholder/Placeholder.d.ts +13 -0
- package/dist/types/placeholder/index.d.ts +2 -0
- package/dist/types/placeholder/loosely-lazy/index.d.ts +3 -0
- package/dist/types/placeholder/loosely-lazy/lazy-suspense.d.ts +6 -0
- package/dist/types/placeholder/loosely-lazy/types.d.ts +20 -0
- package/dist/types/placeholder/loosely-lazy/wait-context.d.ts +3 -0
- package/dist/types/resource-timing/common/types.d.ts +41 -0
- package/dist/types/resource-timing/common/utils/config.d.ts +3 -0
- package/dist/types/resource-timing/common/utils/resource-timing-buffer.d.ts +11 -0
- package/dist/types/resource-timing/index.d.ts +4 -0
- package/dist/types/resource-timing/main.d.ts +2 -0
- package/dist/types/resource-timing/utils.d.ts +1 -0
- package/dist/types/round-number/index.d.ts +1 -0
- package/dist/types/route-name/index.d.ts +4 -0
- package/dist/types/route-name-context/index.d.ts +5 -0
- package/dist/types/segment/index.d.ts +2 -0
- package/dist/types/segment/segment-highlight.d.ts +6 -0
- package/dist/types/segment/segment.d.ts +8 -0
- package/dist/types/set-interaction-error/index.d.ts +4 -0
- package/dist/types/short-id/index.d.ts +1 -0
- package/dist/types/ssr/index.d.ts +21 -0
- package/dist/types/trace-interaction/index.d.ts +2 -0
- package/dist/types/trace-pageload/index.d.ts +2 -0
- package/dist/types/trace-press/index.d.ts +1 -0
- package/dist/types/trace-redirect/index.d.ts +1 -0
- package/dist/types/trace-transition/index.d.ts +2 -0
- package/dist/types/trace-transition/utils/generate-span-id/index.d.ts +1 -0
- package/dist/types/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -0
- package/dist/types/typing-performance-tracing/index.d.ts +2 -0
- package/dist/types/use-press-tracing/index.d.ts +1 -0
- package/dist/types/vc/index.d.ts +2 -0
- package/dist/types/vc/vc-observer/attachAbortListeners.d.ts +6 -0
- package/dist/types/vc/vc-observer/getViewport.d.ts +2 -0
- package/dist/types/vc/vc-observer/index.d.ts +98 -0
- package/dist/types/vc/vc-observer/media-wrapper/index.d.ts +7 -0
- package/dist/types/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/index.d.ts +39 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/index.d.ts +23 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.d.ts +1 -0
- package/dist/types/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.d.ts +2 -0
- package/dist/types/vc/vc-observer/observers/types.d.ts +11 -0
- package/dist/types-ts4.5/additional-payload/index.d.ts +2 -0
- package/dist/types-ts4.5/additional-payload/utils/cache-hit-ratio/index.d.ts +8 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/index.d.ts +2 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/cls/types.d.ts +3 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/const.d.ts +5 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/index.d.ts +7 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/tbt/index.d.ts +5 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/buffer/index.d.ts +13 -0
- package/dist/types-ts4.5/additional-payload/utils/lighthouse-metrics/utils/observer/index.d.ts +2 -0
- package/dist/types-ts4.5/bundle-eval-timing/index.d.ts +16 -0
- package/dist/types-ts4.5/coinflip/index.d.ts +8 -0
- package/dist/types-ts4.5/common/common/types.d.ts +201 -0
- package/dist/types-ts4.5/common/constants.d.ts +1 -0
- package/dist/types-ts4.5/common/index.d.ts +5 -0
- package/dist/types-ts4.5/common/vc/types.d.ts +91 -0
- package/dist/types-ts4.5/config/index.d.ts +95 -0
- package/dist/types-ts4.5/create-payload/common/types.d.ts +4 -0
- package/dist/types-ts4.5/create-payload/common/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/create-payload/index.d.ts +2969 -0
- package/dist/types-ts4.5/create-post-interaction-log-payload/index.d.ts +45 -0
- package/dist/types-ts4.5/custom-data/index.d.ts +5 -0
- package/dist/types-ts4.5/custom-data/types.d.ts +4 -0
- package/dist/types-ts4.5/custom-mark/index.d.ts +10 -0
- package/dist/types-ts4.5/custom-spans/index.d.ts +1 -0
- package/dist/types-ts4.5/custom-timings/index.d.ts +19 -0
- package/dist/types-ts4.5/experience-trace-id-context/index.d.ts +10 -0
- package/dist/types-ts4.5/experience-trace-id-context/types.d.ts +8 -0
- package/dist/types-ts4.5/experience-trace-id-context/utils/make-trace-http-request-headers/index.d.ts +4 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/constants.d.ts +1 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/types.d.ts +2 -0
- package/dist/types-ts4.5/feature-flags-accessed/common/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/feature-flags-accessed/index.d.ts +14 -0
- package/dist/types-ts4.5/generate-id/index.d.ts +2 -0
- package/dist/types-ts4.5/global-error-handler/index.d.ts +3 -0
- package/dist/types-ts4.5/hidden-timing/index.d.ts +7 -0
- package/dist/types-ts4.5/initial-page-load-extra-timing/index.d.ts +9 -0
- package/dist/types-ts4.5/interaction-context/index.d.ts +33 -0
- package/dist/types-ts4.5/interaction-id-context/index.d.ts +9 -0
- package/dist/types-ts4.5/interaction-metrics/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/interaction-metrics/index.d.ts +66 -2
- package/dist/types-ts4.5/interaction-metrics/post-interaction-log.d.ts +69 -0
- package/dist/types-ts4.5/interaction-metrics-init/index.d.ts +11 -0
- package/dist/types-ts4.5/label/UFOLabel.d.ts +13 -0
- package/dist/types-ts4.5/label/index.d.ts +2 -0
- package/dist/types-ts4.5/load-hold/UFOLoadHold.d.ts +53 -0
- package/dist/types-ts4.5/load-hold/index.d.ts +2 -0
- package/dist/types-ts4.5/placeholder/Placeholder.d.ts +13 -0
- package/dist/types-ts4.5/placeholder/index.d.ts +2 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/index.d.ts +3 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/lazy-suspense.d.ts +6 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/types.d.ts +20 -0
- package/dist/types-ts4.5/placeholder/loosely-lazy/wait-context.d.ts +3 -0
- package/dist/types-ts4.5/resource-timing/common/types.d.ts +41 -0
- package/dist/types-ts4.5/resource-timing/common/utils/config.d.ts +3 -0
- package/dist/types-ts4.5/resource-timing/common/utils/resource-timing-buffer.d.ts +11 -0
- package/dist/types-ts4.5/resource-timing/index.d.ts +4 -0
- package/dist/types-ts4.5/resource-timing/main.d.ts +2 -0
- package/dist/types-ts4.5/resource-timing/utils.d.ts +1 -0
- package/dist/types-ts4.5/round-number/index.d.ts +1 -0
- package/dist/types-ts4.5/route-name/index.d.ts +4 -0
- package/dist/types-ts4.5/route-name-context/index.d.ts +5 -0
- package/dist/types-ts4.5/segment/index.d.ts +2 -0
- package/dist/types-ts4.5/segment/segment-highlight.d.ts +6 -0
- package/dist/types-ts4.5/segment/segment.d.ts +8 -0
- package/dist/types-ts4.5/set-interaction-error/index.d.ts +4 -0
- package/dist/types-ts4.5/short-id/index.d.ts +1 -0
- package/dist/types-ts4.5/ssr/index.d.ts +21 -0
- package/dist/types-ts4.5/trace-interaction/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-pageload/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-press/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-redirect/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-transition/index.d.ts +2 -0
- package/dist/types-ts4.5/trace-transition/utils/generate-span-id/index.d.ts +1 -0
- package/dist/types-ts4.5/trace-transition/utils/set-interaction-active-trace/index.d.ts +1 -0
- package/dist/types-ts4.5/typing-performance-tracing/index.d.ts +2 -0
- package/dist/types-ts4.5/use-press-tracing/index.d.ts +1 -0
- package/dist/types-ts4.5/vc/index.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/attachAbortListeners.d.ts +6 -0
- package/dist/types-ts4.5/vc/vc-observer/getViewport.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/index.d.ts +98 -0
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/index.d.ts +7 -0
- package/dist/types-ts4.5/vc/vc-observer/media-wrapper/vc-utils.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/index.d.ts +39 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/index.d.ts +23 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/bindAbortListeners.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/collectSSRPlaceholderDimensions.d.ts +1 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/ssr-placeholders/ssr-scripts/index.d.ts +2 -0
- package/dist/types-ts4.5/vc/vc-observer/observers/types.d.ts +11 -0
- package/experience-trace-id-context/package.json +15 -0
- package/feature-flags-accessed/package.json +15 -0
- package/generate-id/package.json +15 -0
- package/global-error-handler/package.json +15 -0
- package/hidden-timing/package.json +15 -0
- package/initial-page-load-extra-timing/package.json +15 -0
- package/interaction-context/package.json +15 -0
- package/interaction-id-context/package.json +15 -0
- package/interaction-metrics-init/package.json +15 -0
- package/label/package.json +15 -0
- package/load-hold/package.json +15 -0
- package/package.json +55 -3
- package/placeholder/package.json +15 -0
- package/resource-timing/package.json +15 -0
- package/round-number/package.json +15 -0
- package/route-name/package.json +15 -0
- package/route-name-context/package.json +15 -0
- package/segment/package.json +15 -0
- package/set-interaction-error/package.json +15 -0
- package/short-id/package.json +15 -0
- package/ssr/package.json +15 -0
- package/ssr-scripts/package.json +15 -0
- package/trace-interaction/package.json +15 -0
- package/trace-pageload/package.json +15 -0
- package/trace-press/package.json +15 -0
- package/trace-redirect/package.json +15 -0
- package/trace-transition/package.json +15 -0
- package/typing-performance-tracing/package.json +15 -0
- package/use-press-tracing/package.json +15 -0
- package/vc/media/package.json +15 -0
- package/vc/package.json +15 -0
- package/dist/types/common/types.d.ts +0 -17
- package/dist/types-ts4.5/common/types.d.ts +0 -17
- /package/dist/cjs/{common → additional-payload/utils/lighthouse-metrics/cls}/types.js +0 -0
- /package/dist/es2019/{common → additional-payload/utils/lighthouse-metrics/cls}/types.js +0 -0
- /package/dist/{esm/common/types.js → es2019/common/index.js} +0 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import Bowser from 'bowser-ultralight';
|
|
2
|
+
import { getLighthouseMetrics } from '../additional-payload';
|
|
3
|
+
import * as bundleEvalTiming from '../bundle-eval-timing';
|
|
4
|
+
import { REACT_UFO_VERSION } from '../common/constants';
|
|
5
|
+
import { getConfig, getUfoNameOverrides } from '../config';
|
|
6
|
+
import { getBm3Timings } from '../custom-timings';
|
|
7
|
+
import { getPageVisibilityState } from '../hidden-timing';
|
|
8
|
+
import * as initialPageLoadExtraTiming from '../initial-page-load-extra-timing';
|
|
9
|
+
import { interactionSpans as atlaskitInteractionSpans, postInteractionLog } from '../interaction-metrics';
|
|
10
|
+
import * as resourceTiming from '../resource-timing';
|
|
11
|
+
import { roundEpsilon } from '../round-number';
|
|
12
|
+
import * as ssr from '../ssr';
|
|
13
|
+
import { getVCObserver } from '../vc';
|
|
14
|
+
import { isSegmentLabel, sanitizeUfoName } from './common/utils';
|
|
15
|
+
function getUfoNameOverride(interaction) {
|
|
16
|
+
const {
|
|
17
|
+
ufoName,
|
|
18
|
+
apdex
|
|
19
|
+
} = interaction;
|
|
20
|
+
try {
|
|
21
|
+
const ufoNameOverrides = getUfoNameOverrides();
|
|
22
|
+
if (ufoNameOverrides != null) {
|
|
23
|
+
const metricKey = apdex.length > 0 ? apdex[0].key : '';
|
|
24
|
+
if (ufoNameOverrides[ufoName][metricKey]) {
|
|
25
|
+
return ufoNameOverrides[ufoName][metricKey];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return ufoName;
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return ufoName;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function stringifyLabelStackFully(labelStack) {
|
|
35
|
+
return labelStack.map(l => {
|
|
36
|
+
if (isSegmentLabel(l)) {
|
|
37
|
+
return `${l.name}:${l.segmentId}`;
|
|
38
|
+
}
|
|
39
|
+
return l.name;
|
|
40
|
+
}).join('/');
|
|
41
|
+
}
|
|
42
|
+
function labelStackStartWith(labelStack, startWith) {
|
|
43
|
+
return stringifyLabelStackFully(labelStack).startsWith(stringifyLabelStackFully(startWith));
|
|
44
|
+
}
|
|
45
|
+
function getEarliestLegacyStopTime(interaction, labelStack) {
|
|
46
|
+
let earliestLegacyStopTime = null;
|
|
47
|
+
interaction.apdex.forEach(a => {
|
|
48
|
+
var _a$labelStack, _earliestLegacyStopTi;
|
|
49
|
+
if (!(a !== null && a !== void 0 && a.stopTime)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!labelStackStartWith((_a$labelStack = a.labelStack) !== null && _a$labelStack !== void 0 ? _a$labelStack : [], labelStack)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (a.stopTime > interaction.start && ((_earliestLegacyStopTi = earliestLegacyStopTime) !== null && _earliestLegacyStopTi !== void 0 ? _earliestLegacyStopTi : a.stopTime) >= a.stopTime) {
|
|
56
|
+
earliestLegacyStopTime = a.stopTime;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return earliestLegacyStopTime;
|
|
60
|
+
}
|
|
61
|
+
function getBm3EndTimeOrFallbackValue(interaction, labelStack = [], fallbackValue = interaction.end) {
|
|
62
|
+
var _getEarliestLegacySto;
|
|
63
|
+
if (interaction.type === 'press') {
|
|
64
|
+
return fallbackValue;
|
|
65
|
+
}
|
|
66
|
+
return (_getEarliestLegacySto = getEarliestLegacyStopTime(interaction, labelStack)) !== null && _getEarliestLegacySto !== void 0 ? _getEarliestLegacySto : fallbackValue;
|
|
67
|
+
}
|
|
68
|
+
const getPageVisibilityUpToTTI = interaction => {
|
|
69
|
+
const {
|
|
70
|
+
start
|
|
71
|
+
} = interaction;
|
|
72
|
+
const bm3EndTimeOrInteractionEndTime = getBm3EndTimeOrFallbackValue(interaction);
|
|
73
|
+
return getPageVisibilityState(start, bm3EndTimeOrInteractionEndTime);
|
|
74
|
+
};
|
|
75
|
+
const getPageVisibilityUpToTTAI = interaction => {
|
|
76
|
+
const {
|
|
77
|
+
start,
|
|
78
|
+
end
|
|
79
|
+
} = interaction;
|
|
80
|
+
return getPageVisibilityState(start, end);
|
|
81
|
+
};
|
|
82
|
+
const getVisibilityStateFromPerformance = stop => {
|
|
83
|
+
try {
|
|
84
|
+
const results = performance.getEntriesByType('visibility-state');
|
|
85
|
+
if (!results || results.length === 0) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return results.reduce((acc = null, {
|
|
89
|
+
name,
|
|
90
|
+
startTime
|
|
91
|
+
}) => {
|
|
92
|
+
if (startTime > stop) {
|
|
93
|
+
return acc;
|
|
94
|
+
}
|
|
95
|
+
if (acc === null && name === null) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (acc === null) {
|
|
99
|
+
return name;
|
|
100
|
+
}
|
|
101
|
+
if (acc !== name) {
|
|
102
|
+
return 'mixed';
|
|
103
|
+
}
|
|
104
|
+
return acc;
|
|
105
|
+
}, null);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const getMoreAccuratePageVisibilityUpToTTI = interaction => {
|
|
111
|
+
const old = getPageVisibilityUpToTTI(interaction);
|
|
112
|
+
const tti = getEarliestLegacyStopTime(interaction, []);
|
|
113
|
+
if (!tti) {
|
|
114
|
+
return old;
|
|
115
|
+
}
|
|
116
|
+
const buffered = getVisibilityStateFromPerformance(tti);
|
|
117
|
+
if (!buffered) {
|
|
118
|
+
return old;
|
|
119
|
+
}
|
|
120
|
+
if (buffered !== old) {
|
|
121
|
+
return 'mixed';
|
|
122
|
+
}
|
|
123
|
+
return old;
|
|
124
|
+
};
|
|
125
|
+
const getMoreAccuratePageVisibilityUpToTTAI = interaction => {
|
|
126
|
+
const old = getPageVisibilityUpToTTAI(interaction);
|
|
127
|
+
const buffered = getVisibilityStateFromPerformance(interaction.end);
|
|
128
|
+
if (!buffered) {
|
|
129
|
+
return old;
|
|
130
|
+
}
|
|
131
|
+
if (buffered !== old) {
|
|
132
|
+
return 'mixed';
|
|
133
|
+
}
|
|
134
|
+
return old;
|
|
135
|
+
};
|
|
136
|
+
const getInteractionStatus = interaction => {
|
|
137
|
+
const originalInteractionStatus = interaction.abortReason ? 'ABORTED' : 'SUCCEEDED';
|
|
138
|
+
const hasBm3TTI = interaction.apdex.length > 0;
|
|
139
|
+
const overrideStatus = hasBm3TTI ? 'SUCCEEDED' : originalInteractionStatus;
|
|
140
|
+
return {
|
|
141
|
+
originalInteractionStatus,
|
|
142
|
+
overrideStatus
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
const getResourceTimings = (start, end) => {
|
|
146
|
+
var _resourceTiming$getRe;
|
|
147
|
+
return (_resourceTiming$getRe = resourceTiming.getResourceTimings(start, end)) !== null && _resourceTiming$getRe !== void 0 ? _resourceTiming$getRe : undefined;
|
|
148
|
+
};
|
|
149
|
+
const getBundleEvalTimings = start => bundleEvalTiming.getBundleEvalTimings(start);
|
|
150
|
+
const getSSRSuccess = type => type === 'page_load' ? ssr.getSSRSuccess() : undefined;
|
|
151
|
+
const getSSRFeatureFlags = type => type === 'page_load' ? ssr.getSSRFeatureFlags() : undefined;
|
|
152
|
+
const getPaintMetrics = type => {
|
|
153
|
+
if (type !== 'page_load') {
|
|
154
|
+
return {};
|
|
155
|
+
}
|
|
156
|
+
const metrics = {};
|
|
157
|
+
performance.getEntriesByType('paint').forEach(entry => {
|
|
158
|
+
if (entry.name === 'first-paint') {
|
|
159
|
+
metrics['metric:fp'] = Math.round(entry.startTime);
|
|
160
|
+
}
|
|
161
|
+
if (entry.name === 'first-contentful-paint') {
|
|
162
|
+
metrics['metric:fcp'] = Math.round(entry.startTime);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return metrics;
|
|
166
|
+
};
|
|
167
|
+
const getVCMetrics = interaction => {
|
|
168
|
+
var _config$vc, _config$vc2, _interaction$apdex, _interaction$apdex$;
|
|
169
|
+
const config = getConfig();
|
|
170
|
+
if (!(config !== null && config !== void 0 && (_config$vc = config.vc) !== null && _config$vc !== void 0 && _config$vc.enabled)) {
|
|
171
|
+
return {};
|
|
172
|
+
}
|
|
173
|
+
if (interaction.type !== 'page_load' && interaction.type !== 'transition') {
|
|
174
|
+
return {};
|
|
175
|
+
}
|
|
176
|
+
const ssr = interaction.type === 'page_load' && config !== null && config !== void 0 && (_config$vc2 = config.vc) !== null && _config$vc2 !== void 0 && _config$vc2.ssr ? {
|
|
177
|
+
ssr: getSSRDoneTimeValue(config)
|
|
178
|
+
} : null;
|
|
179
|
+
postInteractionLog.setVCObserverSSRConfig(ssr);
|
|
180
|
+
const tti = (_interaction$apdex = interaction.apdex) === null || _interaction$apdex === void 0 ? void 0 : (_interaction$apdex$ = _interaction$apdex[0]) === null || _interaction$apdex$ === void 0 ? void 0 : _interaction$apdex$.stopTime;
|
|
181
|
+
const prefix = 'ufo';
|
|
182
|
+
const result = getVCObserver().getVCResult({
|
|
183
|
+
start: interaction.start,
|
|
184
|
+
stop: interaction.end,
|
|
185
|
+
tti,
|
|
186
|
+
prefix,
|
|
187
|
+
vc: interaction.vc,
|
|
188
|
+
...ssr
|
|
189
|
+
});
|
|
190
|
+
postInteractionLog.setLastInteractionFinishVCResult(result);
|
|
191
|
+
const VC = result === null || result === void 0 ? void 0 : result['metrics:vc'];
|
|
192
|
+
if (!VC || !(result !== null && result !== void 0 && result[`${prefix}:vc:clean`])) {
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
const interactionStatus = getInteractionStatus(interaction);
|
|
196
|
+
const pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
197
|
+
if (interactionStatus.originalInteractionStatus !== 'SUCCEEDED' || pageVisibilityUpToTTAI !== 'visible') {
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
...result,
|
|
202
|
+
'metric:vc90': VC['90']
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
const getNavigationMetrics = type => {
|
|
206
|
+
if (type !== 'page_load') {
|
|
207
|
+
return {};
|
|
208
|
+
}
|
|
209
|
+
const entries = performance.getEntriesByType('navigation');
|
|
210
|
+
if (entries.length === 0) {
|
|
211
|
+
return {};
|
|
212
|
+
}
|
|
213
|
+
const navigation = entries[0];
|
|
214
|
+
const metrics = {
|
|
215
|
+
// From https://www.w3.org/TR/resource-timing/
|
|
216
|
+
redirectStart: Math.round(navigation.redirectStart),
|
|
217
|
+
redirectEnd: Math.round(navigation.redirectEnd),
|
|
218
|
+
fetchStart: Math.round(navigation.fetchStart),
|
|
219
|
+
domainLookupStart: Math.round(navigation.domainLookupStart),
|
|
220
|
+
domainLookupEnd: Math.round(navigation.domainLookupEnd),
|
|
221
|
+
connectStart: Math.round(navigation.connectStart),
|
|
222
|
+
connectEnd: Math.round(navigation.connectEnd),
|
|
223
|
+
secureConnectionStart: Math.round(navigation.secureConnectionStart),
|
|
224
|
+
requestStart: Math.round(navigation.requestStart),
|
|
225
|
+
responseStart: Math.round(navigation.responseStart),
|
|
226
|
+
responseEnd: Math.round(navigation.responseEnd),
|
|
227
|
+
encodedBodySize: Math.round(navigation.encodedBodySize),
|
|
228
|
+
decodedBodySize: Math.round(navigation.decodedBodySize),
|
|
229
|
+
transferSize: Math.round(navigation.transferSize),
|
|
230
|
+
// From https://www.w3.org/TR/navigation-timing-2/
|
|
231
|
+
redirectCount: navigation.redirectCount,
|
|
232
|
+
type: navigation.type,
|
|
233
|
+
unloadEventEnd: Math.round(navigation.unloadEventEnd),
|
|
234
|
+
unloadEventStart: Math.round(navigation.unloadEventStart),
|
|
235
|
+
workerStart: Math.round(navigation.workerStart),
|
|
236
|
+
nextHopProtocol: navigation.nextHopProtocol
|
|
237
|
+
|
|
238
|
+
// The following properties are ignored because they provided limited value on a modern stack (e.g. the content
|
|
239
|
+
// is usually rendered and interactive before the dom is fully parsed, dont't play well with streamed content...)
|
|
240
|
+
// * domComplete
|
|
241
|
+
// * domContentLoadedEventEnd
|
|
242
|
+
// * domContentLoadedEventStart
|
|
243
|
+
// * domInteractive
|
|
244
|
+
// * loadEventEnd
|
|
245
|
+
// * loadEventStart
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
'metrics:navigation': metrics
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
const getPPSMetrics = interaction => {
|
|
252
|
+
var _interaction$apdex2, _interaction$apdex2$;
|
|
253
|
+
const {
|
|
254
|
+
start,
|
|
255
|
+
end
|
|
256
|
+
} = interaction;
|
|
257
|
+
const config = getConfig();
|
|
258
|
+
const interactionStatus = getInteractionStatus(interaction);
|
|
259
|
+
const pageVisibilityUpToTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
260
|
+
const tti = (_interaction$apdex2 = interaction.apdex) === null || _interaction$apdex2 === void 0 ? void 0 : (_interaction$apdex2$ = _interaction$apdex2[0]) === null || _interaction$apdex2$ === void 0 ? void 0 : _interaction$apdex2$.stopTime;
|
|
261
|
+
const ttai = interactionStatus.originalInteractionStatus === 'SUCCEEDED' && pageVisibilityUpToTTAI === 'visible' ? Math.round(end - start) : undefined;
|
|
262
|
+
const PPSMetricsAtTTI = tti !== undefined ? getLighthouseMetrics({
|
|
263
|
+
start,
|
|
264
|
+
stop: tti
|
|
265
|
+
}) : null;
|
|
266
|
+
const PPSMetricsAtTTAI = ttai !== undefined ? getLighthouseMetrics({
|
|
267
|
+
start,
|
|
268
|
+
stop: interaction.end
|
|
269
|
+
}) : null;
|
|
270
|
+
if (config !== null && config !== void 0 && config.shouldCalculateLighthouseMetricsFromTTAI && PPSMetricsAtTTAI !== null) {
|
|
271
|
+
return PPSMetricsAtTTAI;
|
|
272
|
+
}
|
|
273
|
+
if (PPSMetricsAtTTI !== null) {
|
|
274
|
+
return {
|
|
275
|
+
...PPSMetricsAtTTI,
|
|
276
|
+
'metrics@ttai': PPSMetricsAtTTAI
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return {};
|
|
280
|
+
};
|
|
281
|
+
function getSSRProperties(type) {
|
|
282
|
+
return {
|
|
283
|
+
'ssr:success': getSSRSuccess(type),
|
|
284
|
+
'ssr:featureFlags': getSSRFeatureFlags(type)
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
const getBrowserMetadata = () => {
|
|
288
|
+
const data = {};
|
|
289
|
+
const now = new Date();
|
|
290
|
+
data['event:localHour'] = now.getHours(); // returns the hours for this date according to local time
|
|
291
|
+
data['event:localDayOfWeek'] = now.getDay(); // Sunday - Saturday : 0 - 6
|
|
292
|
+
data['event:localTimezoneOffset'] = now.getTimezoneOffset(); // A number representing the difference, in minutes, between the date as evaluated in the UTC time zone and as evaluated in the local time zone.
|
|
293
|
+
|
|
294
|
+
if (navigator.userAgent != null) {
|
|
295
|
+
const browser = Bowser.getParser(navigator.userAgent);
|
|
296
|
+
data['event:browser:name'] = browser.getBrowserName();
|
|
297
|
+
data['event:browser:version'] = browser.getBrowserVersion();
|
|
298
|
+
}
|
|
299
|
+
if (navigator.hardwareConcurrency != null) {
|
|
300
|
+
data['event:cpus'] = navigator.hardwareConcurrency;
|
|
301
|
+
}
|
|
302
|
+
if (navigator.deviceMemory != null) {
|
|
303
|
+
data['event:memory'] = navigator.deviceMemory;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// eslint-disable-next-line compat/compat
|
|
307
|
+
if (navigator.connection != null) {
|
|
308
|
+
data['event:network:effectiveType'] = navigator.connection.effectiveType;
|
|
309
|
+
data['event:network:rtt'] = navigator.connection.rtt;
|
|
310
|
+
data['event:network:downlink'] = navigator.connection.downlink;
|
|
311
|
+
}
|
|
312
|
+
return data;
|
|
313
|
+
};
|
|
314
|
+
const getTracingContextData = interaction => {
|
|
315
|
+
const {
|
|
316
|
+
trace,
|
|
317
|
+
start
|
|
318
|
+
} = interaction;
|
|
319
|
+
let tracingContextData = {};
|
|
320
|
+
if (trace) {
|
|
321
|
+
tracingContextData = {
|
|
322
|
+
'ufo:tracingContext': {
|
|
323
|
+
'X-B3-TraceId': trace.traceId,
|
|
324
|
+
'X-B3-SpanId': trace.spanId,
|
|
325
|
+
// eslint-disable-next-line compat/compat
|
|
326
|
+
browserTimeOrigin: +(performance.timeOrigin + start).toFixed(2)
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return tracingContextData;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
// interaction metric
|
|
334
|
+
|
|
335
|
+
function optimizeLabelStack(labelStack) {
|
|
336
|
+
return labelStack.map(ls => ({
|
|
337
|
+
n: ls.name,
|
|
338
|
+
...(ls.segmentId ? {
|
|
339
|
+
s: ls.segmentId
|
|
340
|
+
} : {})
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
function optimizeCustomData(interaction) {
|
|
344
|
+
const {
|
|
345
|
+
customData,
|
|
346
|
+
legacyMetrics
|
|
347
|
+
} = interaction;
|
|
348
|
+
const customDataMap = customData.reduce((result, {
|
|
349
|
+
labelStack,
|
|
350
|
+
data
|
|
351
|
+
}) => {
|
|
352
|
+
var _result$get$data, _result$get;
|
|
353
|
+
const label = stringifyLabelStackFully(labelStack);
|
|
354
|
+
const value = (_result$get$data = (_result$get = result.get(label)) === null || _result$get === void 0 ? void 0 : _result$get.data) !== null && _result$get$data !== void 0 ? _result$get$data : {};
|
|
355
|
+
result.set(label, {
|
|
356
|
+
labelStack: optimizeLabelStack(labelStack),
|
|
357
|
+
data: Object.assign(value, data)
|
|
358
|
+
});
|
|
359
|
+
return result;
|
|
360
|
+
}, new Map());
|
|
361
|
+
if (legacyMetrics) {
|
|
362
|
+
const legacyMetricsFiltered = legacyMetrics.filter(item => item.type === 'PAGE_LOAD').reduce((result, currentValue) => {
|
|
363
|
+
for (const [key, value] of Object.entries(currentValue.custom || {})) {
|
|
364
|
+
var _result$get$data2, _result$get2;
|
|
365
|
+
const label = stringifyLabelStackFully([]);
|
|
366
|
+
const labelValue = (_result$get$data2 = (_result$get2 = result.get(label)) === null || _result$get2 === void 0 ? void 0 : _result$get2.data) !== null && _result$get$data2 !== void 0 ? _result$get$data2 : {};
|
|
367
|
+
result.set(label, {
|
|
368
|
+
labelStack: optimizeLabelStack([]),
|
|
369
|
+
data: Object.assign(labelValue, {
|
|
370
|
+
[key]: value
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
return result;
|
|
375
|
+
}, new Map());
|
|
376
|
+
return [...customDataMap.values(), ...legacyMetricsFiltered.values()];
|
|
377
|
+
}
|
|
378
|
+
return [...customDataMap.values()];
|
|
379
|
+
}
|
|
380
|
+
function optimizeReactProfilerTimings(reactProfilerTimings, interactionStart) {
|
|
381
|
+
const reactProfilerTimingsMap = reactProfilerTimings.reduce((result, {
|
|
382
|
+
labelStack,
|
|
383
|
+
startTime,
|
|
384
|
+
commitTime,
|
|
385
|
+
actualDuration,
|
|
386
|
+
type
|
|
387
|
+
}) => {
|
|
388
|
+
if (labelStack && startTime >= interactionStart) {
|
|
389
|
+
const label = stringifyLabelStackFully(labelStack);
|
|
390
|
+
const start = Math.round(startTime);
|
|
391
|
+
const end = Math.round(commitTime);
|
|
392
|
+
const timing = result.get(label) || {
|
|
393
|
+
labelStack: optimizeLabelStack(labelStack),
|
|
394
|
+
startTime: start,
|
|
395
|
+
endTime: end,
|
|
396
|
+
mountCount: 0,
|
|
397
|
+
rerenderCount: 0,
|
|
398
|
+
renderDuration: 0
|
|
399
|
+
};
|
|
400
|
+
if (start < timing.startTime) {
|
|
401
|
+
timing.startTime = start;
|
|
402
|
+
}
|
|
403
|
+
if (end > timing.endTime) {
|
|
404
|
+
timing.endTime = end;
|
|
405
|
+
}
|
|
406
|
+
if (type === 'mount') {
|
|
407
|
+
timing.mountCount += 1;
|
|
408
|
+
}
|
|
409
|
+
if (type === 'update') {
|
|
410
|
+
timing.rerenderCount += 1;
|
|
411
|
+
}
|
|
412
|
+
timing.renderDuration += Math.round(actualDuration);
|
|
413
|
+
result.set(label, timing);
|
|
414
|
+
}
|
|
415
|
+
return result;
|
|
416
|
+
}, new Map());
|
|
417
|
+
return [...reactProfilerTimingsMap.values()];
|
|
418
|
+
}
|
|
419
|
+
function optimizeRedirects(redirects, interactionStart) {
|
|
420
|
+
let lastRedirectTime = interactionStart;
|
|
421
|
+
const updatedRedirects = redirects.sort((a, b) => a.time - b.time).reduce((result, redirect) => {
|
|
422
|
+
const {
|
|
423
|
+
fromInteractionName,
|
|
424
|
+
time
|
|
425
|
+
} = redirect;
|
|
426
|
+
if (lastRedirectTime >= interactionStart) {
|
|
427
|
+
result.push({
|
|
428
|
+
labelStack: [{
|
|
429
|
+
n: fromInteractionName
|
|
430
|
+
}],
|
|
431
|
+
startTime: Math.round(lastRedirectTime),
|
|
432
|
+
endTime: Math.round(time)
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
lastRedirectTime = time;
|
|
436
|
+
return result;
|
|
437
|
+
}, []);
|
|
438
|
+
return updatedRedirects;
|
|
439
|
+
}
|
|
440
|
+
function optimizeHoldInfo(holdInfo, interactionStart) {
|
|
441
|
+
const holdInfoMap = holdInfo.reduce((result, hold) => {
|
|
442
|
+
const {
|
|
443
|
+
labelStack,
|
|
444
|
+
name,
|
|
445
|
+
start,
|
|
446
|
+
end,
|
|
447
|
+
ignoreOnSubmit
|
|
448
|
+
} = hold;
|
|
449
|
+
if (labelStack && !ignoreOnSubmit && start >= interactionStart) {
|
|
450
|
+
const label = stringifyLabelStackFully([...labelStack, {
|
|
451
|
+
name
|
|
452
|
+
}]);
|
|
453
|
+
const startTime = Math.round(start);
|
|
454
|
+
const endTime = Math.round(end);
|
|
455
|
+
const timing = result.get(label) || {
|
|
456
|
+
labelStack: optimizeLabelStack([...labelStack, {
|
|
457
|
+
name
|
|
458
|
+
}]),
|
|
459
|
+
startTime,
|
|
460
|
+
endTime
|
|
461
|
+
};
|
|
462
|
+
if (startTime < timing.startTime) {
|
|
463
|
+
timing.startTime = startTime;
|
|
464
|
+
}
|
|
465
|
+
if (endTime > timing.endTime) {
|
|
466
|
+
timing.endTime = endTime;
|
|
467
|
+
}
|
|
468
|
+
result.set(label, timing);
|
|
469
|
+
}
|
|
470
|
+
return result;
|
|
471
|
+
}, new Map());
|
|
472
|
+
return [...holdInfoMap.values()];
|
|
473
|
+
}
|
|
474
|
+
function optimizeSpans(spans, interactionStart) {
|
|
475
|
+
const updatedSpans = spans.reduce((result, span) => {
|
|
476
|
+
const {
|
|
477
|
+
labelStack,
|
|
478
|
+
type,
|
|
479
|
+
name,
|
|
480
|
+
start,
|
|
481
|
+
end
|
|
482
|
+
} = span;
|
|
483
|
+
if (labelStack && start >= interactionStart) {
|
|
484
|
+
result.push({
|
|
485
|
+
labelStack: optimizeLabelStack([...labelStack, {
|
|
486
|
+
name
|
|
487
|
+
}]),
|
|
488
|
+
startTime: Math.round(start),
|
|
489
|
+
endTime: Math.round(end),
|
|
490
|
+
type
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
return result;
|
|
494
|
+
}, []);
|
|
495
|
+
return updatedSpans;
|
|
496
|
+
}
|
|
497
|
+
function optimizeRequestInfo(requestInfo, interactionStart) {
|
|
498
|
+
const updatedRequestInfo = requestInfo.reduce((result, reqInfo) => {
|
|
499
|
+
const {
|
|
500
|
+
labelStack,
|
|
501
|
+
name,
|
|
502
|
+
start,
|
|
503
|
+
end,
|
|
504
|
+
networkStart,
|
|
505
|
+
networkComplete
|
|
506
|
+
} = reqInfo;
|
|
507
|
+
const startTime = networkStart !== null && networkStart !== void 0 ? networkStart : start;
|
|
508
|
+
const endTime = networkComplete !== null && networkComplete !== void 0 ? networkComplete : end;
|
|
509
|
+
if (labelStack && start >= interactionStart && endTime) {
|
|
510
|
+
result.push({
|
|
511
|
+
labelStack: optimizeLabelStack([...labelStack, {
|
|
512
|
+
name
|
|
513
|
+
}]),
|
|
514
|
+
startTime: Math.round(startTime),
|
|
515
|
+
endTime: Math.round(endTime)
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
return result;
|
|
519
|
+
}, []);
|
|
520
|
+
return updatedRequestInfo;
|
|
521
|
+
}
|
|
522
|
+
function optimizeCustomTimings(customTimings, interactionStart) {
|
|
523
|
+
const updatedCustomTimings = customTimings.reduce((result, item) => {
|
|
524
|
+
Object.keys(item.data).forEach(key => {
|
|
525
|
+
if (item.data[key].startTime >= interactionStart) {
|
|
526
|
+
result.push({
|
|
527
|
+
labelStack: [{
|
|
528
|
+
n: key
|
|
529
|
+
}],
|
|
530
|
+
startTime: Math.round(item.data[key].startTime),
|
|
531
|
+
endTime: Math.round(item.data[key].endTime)
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
return result;
|
|
536
|
+
}, []);
|
|
537
|
+
return updatedCustomTimings;
|
|
538
|
+
}
|
|
539
|
+
function optimizeMarks(marks) {
|
|
540
|
+
return marks.map(({
|
|
541
|
+
labelStack,
|
|
542
|
+
time,
|
|
543
|
+
...others
|
|
544
|
+
}) => ({
|
|
545
|
+
...others,
|
|
546
|
+
labelStack: labelStack && optimizeLabelStack(labelStack),
|
|
547
|
+
time: Math.round(time)
|
|
548
|
+
}));
|
|
549
|
+
}
|
|
550
|
+
function optimizeApdex(apdex) {
|
|
551
|
+
return apdex.map(({
|
|
552
|
+
stopTime,
|
|
553
|
+
labelStack,
|
|
554
|
+
...others
|
|
555
|
+
}) => ({
|
|
556
|
+
...others,
|
|
557
|
+
stopTime: Math.round(stopTime),
|
|
558
|
+
...(labelStack ? {
|
|
559
|
+
labelStack: optimizeLabelStack(labelStack)
|
|
560
|
+
} : {})
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
565
|
+
function objectToArray(obj = {}) {
|
|
566
|
+
return Object.keys(obj).reduce((result, key) => {
|
|
567
|
+
result.push({
|
|
568
|
+
label: key,
|
|
569
|
+
data: obj[key]
|
|
570
|
+
});
|
|
571
|
+
return result;
|
|
572
|
+
},
|
|
573
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
574
|
+
[]);
|
|
575
|
+
}
|
|
576
|
+
function getBM3SubmetricsTimings(submetrics) {
|
|
577
|
+
if (!submetrics) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
const submetricsTimings = submetrics.filter(item => {
|
|
581
|
+
return typeof item.stop === 'number' && !!item.key && typeof item.start === 'number';
|
|
582
|
+
}).map(item => {
|
|
583
|
+
let childSubmetrics;
|
|
584
|
+
const newKey = `include/${item.key}`;
|
|
585
|
+
if (item.submetrics) {
|
|
586
|
+
childSubmetrics = getBM3SubmetricsTimings(item.submetrics);
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
[newKey]: {
|
|
590
|
+
endTime: item.stop - item.start,
|
|
591
|
+
startTime: item.start
|
|
592
|
+
},
|
|
593
|
+
...(childSubmetrics ? childSubmetrics : {})
|
|
594
|
+
};
|
|
595
|
+
});
|
|
596
|
+
return submetricsTimings;
|
|
597
|
+
}
|
|
598
|
+
function getBm3TrackerTimings(interaction) {
|
|
599
|
+
const interactionLegacyMetrics = interaction.legacyMetrics;
|
|
600
|
+
if (!interactionLegacyMetrics) {
|
|
601
|
+
return {};
|
|
602
|
+
}
|
|
603
|
+
const legacyMetrics = interactionLegacyMetrics.map(item => {
|
|
604
|
+
var _item$config, _item$config2, _item$marks;
|
|
605
|
+
return {
|
|
606
|
+
key: item.key,
|
|
607
|
+
startTime: item.start,
|
|
608
|
+
stopTime: item.stop,
|
|
609
|
+
type: (_item$config = item.config) === null || _item$config === void 0 ? void 0 : _item$config.type,
|
|
610
|
+
reactUFOName: (_item$config2 = item.config) === null || _item$config2 === void 0 ? void 0 : _item$config2.reactUFOName,
|
|
611
|
+
fmp: ((_item$marks = item.marks) === null || _item$marks === void 0 ? void 0 : _item$marks['fmp']) || item.stop,
|
|
612
|
+
source: 'bm3',
|
|
613
|
+
timings: getBm3Timings(item.marks, item.config.timings),
|
|
614
|
+
submetrics: getBM3SubmetricsTimings(item.submetrics),
|
|
615
|
+
pageVisibleState: item.pageVisibleState
|
|
616
|
+
};
|
|
617
|
+
}).filter(item => !!item.type);
|
|
618
|
+
return {
|
|
619
|
+
legacyMetrics
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
function getSSRDoneTimeValue(config) {
|
|
623
|
+
var _config$ssr, _config$ssr2;
|
|
624
|
+
return config !== null && config !== void 0 && (_config$ssr = config.ssr) !== null && _config$ssr !== void 0 && _config$ssr.getSSRDoneTime ? config === null || config === void 0 ? void 0 : (_config$ssr2 = config.ssr) === null || _config$ssr2 === void 0 ? void 0 : _config$ssr2.getSSRDoneTime() : ssr.getSSRDoneTime();
|
|
625
|
+
}
|
|
626
|
+
function createInteractionMetricsPayload(interaction, interactionId) {
|
|
627
|
+
var _window$location, _config$additionalPay;
|
|
628
|
+
const interactionPayloadStart = performance.now();
|
|
629
|
+
const config = getConfig();
|
|
630
|
+
if (!config) {
|
|
631
|
+
throw Error('UFO Configuration not provided');
|
|
632
|
+
}
|
|
633
|
+
const {
|
|
634
|
+
end,
|
|
635
|
+
start,
|
|
636
|
+
ufoName,
|
|
637
|
+
knownSegments,
|
|
638
|
+
rate,
|
|
639
|
+
type,
|
|
640
|
+
abortReason,
|
|
641
|
+
routeName,
|
|
642
|
+
featureFlags,
|
|
643
|
+
previousInteractionName,
|
|
644
|
+
isPreviousInteractionAborted,
|
|
645
|
+
abortedByInteractionName
|
|
646
|
+
} = interaction;
|
|
647
|
+
const pageVisibilityAtTTI = getPageVisibilityUpToTTI(interaction);
|
|
648
|
+
const pageVisibilityAtTTAI = getPageVisibilityUpToTTAI(interaction);
|
|
649
|
+
const segments = config.killswitchNestedSegments ? [] : knownSegments;
|
|
650
|
+
const isDetailedPayload = pageVisibilityAtTTAI === 'visible';
|
|
651
|
+
const isPageLoad = type === 'page_load';
|
|
652
|
+
const calculatePageVisibilityFromTheStartOfPageLoad = config.enableBetterPageVisibilityApi && isPageLoad;
|
|
653
|
+
const moreAccuratePageVisibilityAtTTI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTI(interaction) : null;
|
|
654
|
+
const moreAccuratePageVisibilityAtTTAI = calculatePageVisibilityFromTheStartOfPageLoad ? getMoreAccuratePageVisibilityUpToTTAI(interaction) : null;
|
|
655
|
+
const labelStack = interaction.labelStack ? {
|
|
656
|
+
labelStack: optimizeLabelStack(interaction.labelStack)
|
|
657
|
+
} : {};
|
|
658
|
+
// Page Load
|
|
659
|
+
const getPageLoadInteractionMetrics = () => {
|
|
660
|
+
var _config$ssr3;
|
|
661
|
+
if (!isPageLoad) {
|
|
662
|
+
return {};
|
|
663
|
+
}
|
|
664
|
+
const config = getConfig();
|
|
665
|
+
const SSRDoneTimeValue = getSSRDoneTimeValue(config);
|
|
666
|
+
const SSRDoneTime = SSRDoneTimeValue !== undefined ? {
|
|
667
|
+
SSRDoneTime: Math.round(SSRDoneTimeValue)
|
|
668
|
+
} : {};
|
|
669
|
+
return {
|
|
670
|
+
...SSRDoneTime,
|
|
671
|
+
isBM3ConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp,
|
|
672
|
+
isUFOConfigSSRDoneAsFmp: interaction.metaData.__legacy__bm3ConfigSSRDoneAsFmp || !!(config !== null && config !== void 0 && (_config$ssr3 = config.ssr) !== null && _config$ssr3 !== void 0 && _config$ssr3.getSSRDoneTime)
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
// Detailed payload. Page visibility = visible
|
|
676
|
+
const getDetailedInteractionMetrics = () => {
|
|
677
|
+
if (window.__UFO_COMPACT_PAYLOAD__ || !isDetailedPayload) {
|
|
678
|
+
return {};
|
|
679
|
+
}
|
|
680
|
+
const spans = [...interaction.spans, ...atlaskitInteractionSpans];
|
|
681
|
+
atlaskitInteractionSpans.length = 0;
|
|
682
|
+
return {
|
|
683
|
+
errors: interaction.errors.map(({
|
|
684
|
+
labelStack,
|
|
685
|
+
...others
|
|
686
|
+
}) => ({
|
|
687
|
+
...others,
|
|
688
|
+
labelStack: labelStack && optimizeLabelStack(labelStack)
|
|
689
|
+
})),
|
|
690
|
+
holdActive: [...interaction.holdActive.values()],
|
|
691
|
+
redirects: optimizeRedirects(interaction.redirects, start),
|
|
692
|
+
holdInfo: optimizeHoldInfo(interaction.holdInfo, start),
|
|
693
|
+
spans: optimizeSpans(spans, start),
|
|
694
|
+
requestInfo: optimizeRequestInfo(interaction.requestInfo, start),
|
|
695
|
+
customTimings: optimizeCustomTimings(interaction.customTimings, start),
|
|
696
|
+
bundleEvalTimings: objectToArray(getBundleEvalTimings(start)),
|
|
697
|
+
resourceTimings: objectToArray(getResourceTimings(start, end))
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
// Page load & detailed payload
|
|
701
|
+
const getPageLoadDetailedInteractionMetrics = () => {
|
|
702
|
+
var _config$ssr4;
|
|
703
|
+
if (!isPageLoad || !isDetailedPayload) {
|
|
704
|
+
return {};
|
|
705
|
+
}
|
|
706
|
+
const config = getConfig();
|
|
707
|
+
return {
|
|
708
|
+
initialPageLoadExtraTimings: objectToArray(initialPageLoadExtraTiming.getTimings()),
|
|
709
|
+
SSRTimings: config !== null && config !== void 0 && (_config$ssr4 = config.ssr) !== null && _config$ssr4 !== void 0 && _config$ssr4.getSSRTimings ? config.ssr.getSSRTimings() : objectToArray(ssr.getSSRTimings())
|
|
710
|
+
};
|
|
711
|
+
};
|
|
712
|
+
const newUFOName = sanitizeUfoName(ufoName);
|
|
713
|
+
return {
|
|
714
|
+
actionSubject: 'experience',
|
|
715
|
+
action: 'measured',
|
|
716
|
+
eventType: 'operational',
|
|
717
|
+
source: 'measured',
|
|
718
|
+
tags: ['observability'],
|
|
719
|
+
attributes: {
|
|
720
|
+
properties: {
|
|
721
|
+
// basic
|
|
722
|
+
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
723
|
+
'event:product': config.product,
|
|
724
|
+
'event:schema': '1.0.0',
|
|
725
|
+
'event:source': {
|
|
726
|
+
name: 'react-ufo/web',
|
|
727
|
+
version: REACT_UFO_VERSION,
|
|
728
|
+
payloadSource: 'platform'
|
|
729
|
+
},
|
|
730
|
+
'event:region': config.region || 'unknown',
|
|
731
|
+
'experience:key': 'custom.interaction-metrics',
|
|
732
|
+
'experience:name': newUFOName,
|
|
733
|
+
// root
|
|
734
|
+
...getBrowserMetadata(),
|
|
735
|
+
...getSSRProperties(type),
|
|
736
|
+
...getPPSMetrics(interaction),
|
|
737
|
+
...getPaintMetrics(type),
|
|
738
|
+
...getNavigationMetrics(type),
|
|
739
|
+
...getVCMetrics(interaction),
|
|
740
|
+
...((_config$additionalPay = config.additionalPayloadData) === null || _config$additionalPay === void 0 ? void 0 : _config$additionalPay.call(config, interaction)),
|
|
741
|
+
...getTracingContextData(interaction),
|
|
742
|
+
interactionMetrics: {
|
|
743
|
+
namePrefix: config.namePrefix || '',
|
|
744
|
+
segmentPrefix: config.segmentPrefix || '',
|
|
745
|
+
interactionId,
|
|
746
|
+
pageVisibilityAtTTI,
|
|
747
|
+
pageVisibilityAtTTAI,
|
|
748
|
+
experimental__pageVisibilityAtTTI: moreAccuratePageVisibilityAtTTI,
|
|
749
|
+
experimental__pageVisibilityAtTTAI: moreAccuratePageVisibilityAtTTAI,
|
|
750
|
+
// raw interaction metrics
|
|
751
|
+
rate,
|
|
752
|
+
routeName,
|
|
753
|
+
type,
|
|
754
|
+
abortReason,
|
|
755
|
+
featureFlags,
|
|
756
|
+
previousInteractionName,
|
|
757
|
+
isPreviousInteractionAborted,
|
|
758
|
+
abortedByInteractionName,
|
|
759
|
+
// performance
|
|
760
|
+
apdex: optimizeApdex(interaction.apdex),
|
|
761
|
+
end: Math.round(end),
|
|
762
|
+
start: Math.round(start),
|
|
763
|
+
segments: segments.map(({
|
|
764
|
+
labelStack,
|
|
765
|
+
...others
|
|
766
|
+
}) => ({
|
|
767
|
+
...others,
|
|
768
|
+
labelStack: optimizeLabelStack(labelStack)
|
|
769
|
+
})),
|
|
770
|
+
marks: optimizeMarks(interaction.marks),
|
|
771
|
+
customData: optimizeCustomData(interaction),
|
|
772
|
+
reactProfilerTimings: optimizeReactProfilerTimings(interaction.reactProfilerTimings, start),
|
|
773
|
+
...labelStack,
|
|
774
|
+
...getPageLoadInteractionMetrics(),
|
|
775
|
+
...getDetailedInteractionMetrics(),
|
|
776
|
+
...getPageLoadDetailedInteractionMetrics(),
|
|
777
|
+
...getBm3TrackerTimings(interaction)
|
|
778
|
+
},
|
|
779
|
+
'ufo:payloadTime': roundEpsilon(performance.now() - interactionPayloadStart)
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
export function createPayloads(interactionId, interaction) {
|
|
785
|
+
const ufoNameOverride = getUfoNameOverride(interaction);
|
|
786
|
+
const modifiedInteraction = {
|
|
787
|
+
...interaction,
|
|
788
|
+
ufoName: ufoNameOverride
|
|
789
|
+
};
|
|
790
|
+
const interactionMetricsPayload = createInteractionMetricsPayload(modifiedInteraction, interactionId);
|
|
791
|
+
return [interactionMetricsPayload];
|
|
792
|
+
}
|