@atlaskit/react-ufo 1.1.0 → 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 +24 -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 +810 -1
- 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 +736 -0
- 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 +773 -0
- 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 +65 -1
- 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 +65 -1
- 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,522 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { attachAbortListeners } from './attachAbortListeners';
|
|
3
|
+
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
4
|
+
import { Observers } from './observers';
|
|
5
|
+
const abortReason = {
|
|
6
|
+
scroll: 'scroll',
|
|
7
|
+
keypress: 'keypress',
|
|
8
|
+
resize: 'resize',
|
|
9
|
+
error: 'error'
|
|
10
|
+
};
|
|
11
|
+
const UNUSED_SECTOR = 0;
|
|
12
|
+
function filterComponentsLog(log) {
|
|
13
|
+
return Object.fromEntries(Object.entries(log).map(([timestamp, entries]) => [Number(timestamp), entries.map(entry => {
|
|
14
|
+
const {
|
|
15
|
+
__debug__element,
|
|
16
|
+
...rest
|
|
17
|
+
} = entry;
|
|
18
|
+
return rest;
|
|
19
|
+
})]));
|
|
20
|
+
}
|
|
21
|
+
export class VCObserver {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
/* abort logic */
|
|
24
|
+
_defineProperty(this, "abortReason", {
|
|
25
|
+
reason: null,
|
|
26
|
+
info: '',
|
|
27
|
+
timestamp: -1,
|
|
28
|
+
blocking: false
|
|
29
|
+
});
|
|
30
|
+
_defineProperty(this, "outOfBoundaryInfo", '');
|
|
31
|
+
_defineProperty(this, "viewport", {
|
|
32
|
+
w: 0,
|
|
33
|
+
h: 0
|
|
34
|
+
});
|
|
35
|
+
/* heatmap */
|
|
36
|
+
_defineProperty(this, "arraySize", 0);
|
|
37
|
+
_defineProperty(this, "componentsLog", {});
|
|
38
|
+
_defineProperty(this, "vcRatios", {});
|
|
39
|
+
_defineProperty(this, "active", false);
|
|
40
|
+
_defineProperty(this, "totalTime", 0);
|
|
41
|
+
_defineProperty(this, "startTime", 0);
|
|
42
|
+
_defineProperty(this, "_startMeasureTimestamp", -1);
|
|
43
|
+
_defineProperty(this, "ssr", {
|
|
44
|
+
reactRendered: -1
|
|
45
|
+
});
|
|
46
|
+
_defineProperty(this, "unbind", []);
|
|
47
|
+
_defineProperty(this, "getAbortReasonInfo", () => {
|
|
48
|
+
if (this.abortReason.reason === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const info = this.abortReason.info !== '' ? ` ${this.abortReason.info}` : '';
|
|
52
|
+
return `${this.abortReason.reason}${info}`;
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(this, "getVCRawData", () => {
|
|
55
|
+
this.measureStart();
|
|
56
|
+
if (!this.active) {
|
|
57
|
+
this.measureStop();
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
this.stop();
|
|
61
|
+
const abortReasonInfo = this.getAbortReasonInfo();
|
|
62
|
+
this.measureStop();
|
|
63
|
+
return {
|
|
64
|
+
abortReasonInfo,
|
|
65
|
+
abortReason: {
|
|
66
|
+
...this.abortReason
|
|
67
|
+
},
|
|
68
|
+
heatmap: this.ssrInclusiveHeatmap,
|
|
69
|
+
oldHeatmap: this.heatmap,
|
|
70
|
+
outOfBoundaryInfo: this.outOfBoundaryInfo,
|
|
71
|
+
totalTime: Math.round(this.totalTime + this.observers.getTotalTime()),
|
|
72
|
+
componentsLog: {
|
|
73
|
+
...this.componentsLog
|
|
74
|
+
},
|
|
75
|
+
viewport: {
|
|
76
|
+
...this.viewport
|
|
77
|
+
},
|
|
78
|
+
oldDomUpdatesEnabled: this.oldDomUpdatesEnabled,
|
|
79
|
+
devToolsEnabled: this.devToolsEnabled,
|
|
80
|
+
ratios: this.vcRatios
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
_defineProperty(this, "getVCResult", ({
|
|
84
|
+
start,
|
|
85
|
+
stop,
|
|
86
|
+
tti,
|
|
87
|
+
prefix,
|
|
88
|
+
ssr,
|
|
89
|
+
vc
|
|
90
|
+
}) => {
|
|
91
|
+
const startTime = performance.now();
|
|
92
|
+
// add local measurement
|
|
93
|
+
const fullPrefix = prefix !== undefined && prefix !== '' ? `${prefix}:` : '';
|
|
94
|
+
const rawData = vc !== undefined ? vc : this.getVCRawData();
|
|
95
|
+
if (rawData === null) {
|
|
96
|
+
return {};
|
|
97
|
+
}
|
|
98
|
+
const {
|
|
99
|
+
abortReason,
|
|
100
|
+
abortReasonInfo,
|
|
101
|
+
heatmap,
|
|
102
|
+
oldHeatmap,
|
|
103
|
+
outOfBoundaryInfo,
|
|
104
|
+
totalTime,
|
|
105
|
+
componentsLog,
|
|
106
|
+
viewport,
|
|
107
|
+
oldDomUpdatesEnabled,
|
|
108
|
+
devToolsEnabled,
|
|
109
|
+
ratios
|
|
110
|
+
} = rawData;
|
|
111
|
+
if (abortReasonInfo !== null && abortReason.blocking) {
|
|
112
|
+
// exposing data to devtools
|
|
113
|
+
try {
|
|
114
|
+
if (devToolsEnabled && !this.isPostInteraction) {
|
|
115
|
+
window.__vcNotAvailableReason = abortReasonInfo;
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {}
|
|
118
|
+
return {
|
|
119
|
+
[`${fullPrefix}vc:state`]: false,
|
|
120
|
+
[`${fullPrefix}vc:abort:reason`]: abortReasonInfo,
|
|
121
|
+
[`${fullPrefix}vc:abort:timestamp`]: abortReason.timestamp
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const {
|
|
125
|
+
VC,
|
|
126
|
+
VCBox,
|
|
127
|
+
VCEntries,
|
|
128
|
+
totalPainted
|
|
129
|
+
} = VCObserver.calculateVC({
|
|
130
|
+
heatmap,
|
|
131
|
+
ssr,
|
|
132
|
+
componentsLog: {
|
|
133
|
+
...componentsLog
|
|
134
|
+
},
|
|
135
|
+
viewport
|
|
136
|
+
});
|
|
137
|
+
try {
|
|
138
|
+
if (!this.isPostInteraction) {
|
|
139
|
+
VCObserver.VCParts.forEach(key => {
|
|
140
|
+
const duration = VC[key];
|
|
141
|
+
if (duration !== null && duration !== undefined) {
|
|
142
|
+
performance.measure(`VC${key}`, {
|
|
143
|
+
start,
|
|
144
|
+
duration
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
} catch (e) {
|
|
150
|
+
/* empty */
|
|
151
|
+
}
|
|
152
|
+
const ssrVC = VCObserver.calculateVC({
|
|
153
|
+
heatmap: oldHeatmap,
|
|
154
|
+
ssr,
|
|
155
|
+
componentsLog: {
|
|
156
|
+
...componentsLog
|
|
157
|
+
},
|
|
158
|
+
viewport
|
|
159
|
+
});
|
|
160
|
+
const outOfBoundary = outOfBoundaryInfo ? {
|
|
161
|
+
[`${fullPrefix}vc:oob`]: outOfBoundaryInfo
|
|
162
|
+
} : {};
|
|
163
|
+
const oldDomUpdates = oldDomUpdatesEnabled ? {
|
|
164
|
+
[`${fullPrefix}vc:old:dom`]: ssrVC.VCBox
|
|
165
|
+
} : {};
|
|
166
|
+
const stopTime = performance.now();
|
|
167
|
+
|
|
168
|
+
// exposing data to devtools
|
|
169
|
+
try {
|
|
170
|
+
if (!this.isPostInteraction && devToolsEnabled) {
|
|
171
|
+
window.__vc = {
|
|
172
|
+
entries: VCEntries.rel,
|
|
173
|
+
log: componentsLog,
|
|
174
|
+
metrics: {
|
|
175
|
+
'75': VC['75'],
|
|
176
|
+
'80': VC['80'],
|
|
177
|
+
'85': VC['85'],
|
|
178
|
+
'90': VC['90'],
|
|
179
|
+
'95': VC['95'],
|
|
180
|
+
'98': VC['98'],
|
|
181
|
+
'99': VC['99'],
|
|
182
|
+
tti,
|
|
183
|
+
ttai: stop - start
|
|
184
|
+
},
|
|
185
|
+
heatmap,
|
|
186
|
+
ratios
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Emitting a custom event to make it available in the Chrome extension
|
|
190
|
+
window.dispatchEvent(new CustomEvent('vcReady', {
|
|
191
|
+
detail: {
|
|
192
|
+
log: filterComponentsLog(componentsLog),
|
|
193
|
+
entries: VCEntries.rel
|
|
194
|
+
}
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
} catch (e) {
|
|
198
|
+
/* do nothing */
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
'metrics:vc': VC,
|
|
202
|
+
[`${fullPrefix}vc:state`]: true,
|
|
203
|
+
[`${fullPrefix}vc:clean`]: !abortReasonInfo,
|
|
204
|
+
[`${fullPrefix}vc:dom`]: VCBox,
|
|
205
|
+
[`${fullPrefix}vc:updates`]: VCEntries.rel.slice(0, 50),
|
|
206
|
+
// max 50
|
|
207
|
+
[`${fullPrefix}vc:size`]: viewport,
|
|
208
|
+
[`${fullPrefix}vc:time`]: Math.round(totalTime + (stopTime - startTime)),
|
|
209
|
+
[`${fullPrefix}vc:total`]: totalPainted,
|
|
210
|
+
[`${fullPrefix}vc:ratios`]: ratios,
|
|
211
|
+
...outOfBoundary,
|
|
212
|
+
[`${fullPrefix}vc:old`]: ssrVC.VC,
|
|
213
|
+
...oldDomUpdates,
|
|
214
|
+
[`${fullPrefix}vc:ignored`]: this.getIgnoredElements(componentsLog)
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
_defineProperty(this, "handleUpdate", (rawTime, intersectionRect, targetName, element, ignoreReason) => {
|
|
218
|
+
this.measureStart();
|
|
219
|
+
if (this.abortReason.reason === null || this.abortReason.blocking === false) {
|
|
220
|
+
const time = Math.round(rawTime - this.startTime);
|
|
221
|
+
const mappedValues = this.mapPixelsToHeatmap(intersectionRect.left, intersectionRect.top, intersectionRect.width, intersectionRect.height);
|
|
222
|
+
this.vcRatios[targetName] = this.getElementRatio(mappedValues);
|
|
223
|
+
this.applyChangesToHeatMap(mappedValues, time, this.heatmap);
|
|
224
|
+
if (!ignoreReason) {
|
|
225
|
+
this.applyChangesToHeatMap(mappedValues, time, this.ssrInclusiveHeatmap);
|
|
226
|
+
}
|
|
227
|
+
if (!this.componentsLog[time]) {
|
|
228
|
+
this.componentsLog[time] = [];
|
|
229
|
+
}
|
|
230
|
+
this.componentsLog[time].push({
|
|
231
|
+
__debug__element: this.devToolsEnabled ? element : null,
|
|
232
|
+
intersectionRect,
|
|
233
|
+
targetName,
|
|
234
|
+
ignoreReason
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// devtools export
|
|
238
|
+
this.measureStop();
|
|
239
|
+
});
|
|
240
|
+
_defineProperty(this, "mapPixelsToHeatmap", (left, top, width, height) => {
|
|
241
|
+
const {
|
|
242
|
+
w,
|
|
243
|
+
h
|
|
244
|
+
} = this.viewport;
|
|
245
|
+
const l = Math.floor(left / w * this.arraySize);
|
|
246
|
+
const t = Math.floor(top / h * this.arraySize);
|
|
247
|
+
const r = Math.ceil((left + width) / w * this.arraySize);
|
|
248
|
+
const b = Math.ceil((top + height) / h * this.arraySize);
|
|
249
|
+
|
|
250
|
+
// that info is temporary to get info why it goes over boundary
|
|
251
|
+
if (this.outOfBoundaryInfo === '') {
|
|
252
|
+
let outOfBoundaryInfo = '';
|
|
253
|
+
if (r > this.arraySize) {
|
|
254
|
+
outOfBoundaryInfo += ` r ${r} ! ${left} ${width}`;
|
|
255
|
+
}
|
|
256
|
+
if (b > this.arraySize) {
|
|
257
|
+
outOfBoundaryInfo += ` r ${r} ! ${top} ${height}`;
|
|
258
|
+
}
|
|
259
|
+
this.outOfBoundaryInfo = outOfBoundaryInfo;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// correct values to min - 0, max - arraySize
|
|
263
|
+
const result = {
|
|
264
|
+
l: Math.max(0, l),
|
|
265
|
+
t: Math.max(0, t),
|
|
266
|
+
r: Math.min(this.arraySize, r),
|
|
267
|
+
b: Math.min(this.arraySize, b)
|
|
268
|
+
};
|
|
269
|
+
return result;
|
|
270
|
+
});
|
|
271
|
+
_defineProperty(this, "getElementRatio", mappedValues => {
|
|
272
|
+
const {
|
|
273
|
+
r,
|
|
274
|
+
l,
|
|
275
|
+
b,
|
|
276
|
+
t
|
|
277
|
+
} = mappedValues;
|
|
278
|
+
return (r - l) * (b - t) / (this.arraySize * this.arraySize);
|
|
279
|
+
});
|
|
280
|
+
_defineProperty(this, "abortReasonCallback", (key, time) => {
|
|
281
|
+
switch (key) {
|
|
282
|
+
case 'wheel':
|
|
283
|
+
this.setAbortReason(abortReason.scroll, time);
|
|
284
|
+
break;
|
|
285
|
+
case 'keydown':
|
|
286
|
+
this.setAbortReason(abortReason.keypress, time);
|
|
287
|
+
break;
|
|
288
|
+
case 'resize':
|
|
289
|
+
this.setAbortReason(abortReason.resize, time);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
_defineProperty(this, "attachAbortListeners", () => {
|
|
294
|
+
var _window;
|
|
295
|
+
this.detachAbortListeners();
|
|
296
|
+
let unbinds = attachAbortListeners(window, this.viewport, this.abortReasonCallback);
|
|
297
|
+
if ((_window = window) !== null && _window !== void 0 && _window.__SSR_ABORT_LISTENERS__) {
|
|
298
|
+
var _window2;
|
|
299
|
+
Object.entries(window.__SSR_ABORT_LISTENERS__.aborts).forEach(([key, time]) => {
|
|
300
|
+
if (time) {
|
|
301
|
+
this.abortReasonCallback(key, time);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
unbinds = unbinds.concat(window.__SSR_ABORT_LISTENERS__.unbinds);
|
|
305
|
+
(_window2 = window) === null || _window2 === void 0 ? true : delete _window2.__SSR_ABORT_LISTENERS__;
|
|
306
|
+
}
|
|
307
|
+
this.unbind = unbinds;
|
|
308
|
+
});
|
|
309
|
+
this.arraySize = options.heatmapSize || 200;
|
|
310
|
+
this.devToolsEnabled = options.devToolsEnabled || false;
|
|
311
|
+
this.oldDomUpdatesEnabled = options.oldDomUpdates || false;
|
|
312
|
+
this.observers = new Observers({
|
|
313
|
+
selectorConfig: options.selectorConfig || {
|
|
314
|
+
id: false,
|
|
315
|
+
testId: false,
|
|
316
|
+
role: false,
|
|
317
|
+
className: true,
|
|
318
|
+
dataVC: true
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
this.heatmap = this.getCleanHeatmap();
|
|
322
|
+
this.ssrInclusiveHeatmap = this.getCleanHeatmap();
|
|
323
|
+
this.isPostInteraction = options.isPostInteraction || false;
|
|
324
|
+
}
|
|
325
|
+
start({
|
|
326
|
+
startTime
|
|
327
|
+
}) {
|
|
328
|
+
this.active = true;
|
|
329
|
+
if (this.observers.isBrowserSupported()) {
|
|
330
|
+
this.setViewportSize();
|
|
331
|
+
this.resetState();
|
|
332
|
+
this.startTime = startTime;
|
|
333
|
+
this.attachAbortListeners();
|
|
334
|
+
this.observers.subscribeResults(this.handleUpdate);
|
|
335
|
+
this.observers.observe();
|
|
336
|
+
} else {
|
|
337
|
+
this.setAbortReason('not-supported', startTime);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
stop() {
|
|
341
|
+
this.observers.disconnect();
|
|
342
|
+
this.detachAbortListeners();
|
|
343
|
+
}
|
|
344
|
+
getIgnoredElements(componentsLog) {
|
|
345
|
+
return Object.values(componentsLog).flat().filter(({
|
|
346
|
+
ignoreReason
|
|
347
|
+
}) => Boolean(ignoreReason)).map(({
|
|
348
|
+
targetName,
|
|
349
|
+
ignoreReason
|
|
350
|
+
}) => ({
|
|
351
|
+
targetName,
|
|
352
|
+
ignoreReason
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
static calculateVC({
|
|
356
|
+
heatmap,
|
|
357
|
+
ssr = UNUSED_SECTOR,
|
|
358
|
+
componentsLog,
|
|
359
|
+
viewport
|
|
360
|
+
}) {
|
|
361
|
+
const lastUpdate = {};
|
|
362
|
+
let totalPainted = 0;
|
|
363
|
+
if (ssr !== UNUSED_SECTOR) {
|
|
364
|
+
var _window$document;
|
|
365
|
+
const element = {
|
|
366
|
+
__debug__element: (_window$document = window.document) === null || _window$document === void 0 ? void 0 : _window$document.body,
|
|
367
|
+
intersectionRect: {
|
|
368
|
+
top: 0,
|
|
369
|
+
left: 0,
|
|
370
|
+
right: 0,
|
|
371
|
+
bottom: 0,
|
|
372
|
+
x: 0,
|
|
373
|
+
y: 0,
|
|
374
|
+
width: viewport.w,
|
|
375
|
+
height: viewport.h,
|
|
376
|
+
toJSON() {
|
|
377
|
+
return {};
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
targetName: 'SSR'
|
|
381
|
+
};
|
|
382
|
+
if (!componentsLog[ssr]) {
|
|
383
|
+
componentsLog[ssr] = [];
|
|
384
|
+
}
|
|
385
|
+
componentsLog[ssr].push(element);
|
|
386
|
+
}
|
|
387
|
+
heatmap.forEach(line => {
|
|
388
|
+
line.forEach(entry => {
|
|
389
|
+
const rounded = Math.floor(entry === UNUSED_SECTOR && ssr !== UNUSED_SECTOR ? ssr : entry);
|
|
390
|
+
totalPainted += rounded !== UNUSED_SECTOR ? 1 : 0;
|
|
391
|
+
if (rounded !== UNUSED_SECTOR) {
|
|
392
|
+
lastUpdate[rounded] = lastUpdate[rounded] ? lastUpdate[rounded] + 1 : 1;
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
const entries = Object.entries(lastUpdate).map(a => [parseInt(a[0], 10), a[1]]).sort((a, b) => a[0] > b[0] ? 1 : -1);
|
|
397
|
+
const VC = VCObserver.makeVCReturnObj();
|
|
398
|
+
const VCBox = VCObserver.makeVCReturnObj();
|
|
399
|
+
entries.reduce((acc = 0, v) => {
|
|
400
|
+
const VCRatio = v[1] / totalPainted + acc;
|
|
401
|
+
const time = v[0];
|
|
402
|
+
VCObserver.VCParts.forEach(key => {
|
|
403
|
+
const value = parseInt(key, 10);
|
|
404
|
+
if ((VC[key] === null || VC[key] === undefined) && VCRatio >= value / 100) {
|
|
405
|
+
var _componentsLog$time;
|
|
406
|
+
VC[key] = time;
|
|
407
|
+
VCBox[key] = (_componentsLog$time = componentsLog[time]) === null || _componentsLog$time === void 0 ? void 0 : _componentsLog$time.map(v => v.targetName);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
return VCRatio;
|
|
411
|
+
}, 0);
|
|
412
|
+
const VCEntries = entries.reduce((acc, [timestamp, entryPainted], i) => {
|
|
413
|
+
var _acc$abs, _componentsLog$timest;
|
|
414
|
+
const currentlyPainted = entryPainted + (((_acc$abs = acc.abs[i - 1]) === null || _acc$abs === void 0 ? void 0 : _acc$abs[1]) || 0);
|
|
415
|
+
const currentlyPaintedRatio = Math.round(currentlyPainted / totalPainted * 1000) / 10;
|
|
416
|
+
const logEntry = (_componentsLog$timest = componentsLog[timestamp]) === null || _componentsLog$timest === void 0 ? void 0 : _componentsLog$timest.map(v => v.targetName);
|
|
417
|
+
acc.abs.push([timestamp, currentlyPainted]);
|
|
418
|
+
acc.rel.push({
|
|
419
|
+
time: timestamp,
|
|
420
|
+
vc: currentlyPaintedRatio,
|
|
421
|
+
elements: logEntry
|
|
422
|
+
});
|
|
423
|
+
return acc;
|
|
424
|
+
}, {
|
|
425
|
+
abs: [],
|
|
426
|
+
rel: []
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
VC,
|
|
430
|
+
VCBox,
|
|
431
|
+
VCEntries,
|
|
432
|
+
totalPainted
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
setSSRElement(element) {
|
|
436
|
+
this.observers.setReactRootElement(element);
|
|
437
|
+
}
|
|
438
|
+
setReactRootRenderStart(startTime = performance.now()) {
|
|
439
|
+
this.observers.setReactRootRenderStart(startTime);
|
|
440
|
+
}
|
|
441
|
+
setReactRootRenderStop(stopTime = performance.now()) {
|
|
442
|
+
this.observers.setReactRootRenderStop(stopTime);
|
|
443
|
+
}
|
|
444
|
+
setAbortReason(abort, timestamp, info = '') {
|
|
445
|
+
if (this.abortReason.reason === null || this.abortReason.blocking === false) {
|
|
446
|
+
this.abortReason.reason = abort;
|
|
447
|
+
this.abortReason.info = info;
|
|
448
|
+
this.abortReason.timestamp = timestamp;
|
|
449
|
+
this.abortReason.blocking = abort !== abortReason.scroll;
|
|
450
|
+
if (this.abortReason.blocking) {
|
|
451
|
+
this.detachAbortListeners();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
resetState() {
|
|
456
|
+
this.abortReason = {
|
|
457
|
+
reason: null,
|
|
458
|
+
info: '',
|
|
459
|
+
timestamp: -1,
|
|
460
|
+
blocking: false
|
|
461
|
+
};
|
|
462
|
+
this.detachAbortListeners();
|
|
463
|
+
this.heatmap = this.getCleanHeatmap();
|
|
464
|
+
this.ssrInclusiveHeatmap = this.getCleanHeatmap();
|
|
465
|
+
this.totalTime = 0;
|
|
466
|
+
this.componentsLog = {};
|
|
467
|
+
this.vcRatios = {};
|
|
468
|
+
}
|
|
469
|
+
getCleanHeatmap() {
|
|
470
|
+
return Array(this.arraySize).fill('').map(() => Array(this.arraySize).fill(UNUSED_SECTOR));
|
|
471
|
+
}
|
|
472
|
+
setViewportSize() {
|
|
473
|
+
this.viewport.w = getViewportWidth();
|
|
474
|
+
this.viewport.h = getViewportHeight();
|
|
475
|
+
}
|
|
476
|
+
applyChangesToHeatMap(a, time, heatmap) {
|
|
477
|
+
const {
|
|
478
|
+
l,
|
|
479
|
+
t,
|
|
480
|
+
r,
|
|
481
|
+
b
|
|
482
|
+
} = a;
|
|
483
|
+
const localHeatmap = heatmap;
|
|
484
|
+
for (let row = t; row < b; row++) {
|
|
485
|
+
for (let col = l; col < r; col++) {
|
|
486
|
+
if (localHeatmap[row] === undefined) {
|
|
487
|
+
try {
|
|
488
|
+
this.setAbortReason(abortReason.error, time, `index - ${row}`);
|
|
489
|
+
} catch (e) {
|
|
490
|
+
this.setAbortReason(abortReason.error, time, 'row error');
|
|
491
|
+
}
|
|
492
|
+
return;
|
|
493
|
+
} else {
|
|
494
|
+
localHeatmap[row][col] = time;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
static makeVCReturnObj() {
|
|
500
|
+
const vc = {};
|
|
501
|
+
VCObserver.VCParts.forEach(v => {
|
|
502
|
+
vc[v] = null;
|
|
503
|
+
});
|
|
504
|
+
return vc;
|
|
505
|
+
}
|
|
506
|
+
detachAbortListeners() {
|
|
507
|
+
this.unbind.forEach(fn => fn());
|
|
508
|
+
this.unbind = [];
|
|
509
|
+
}
|
|
510
|
+
measureStart() {
|
|
511
|
+
this._startMeasureTimestamp = performance.now();
|
|
512
|
+
}
|
|
513
|
+
measureStop() {
|
|
514
|
+
if (this._startMeasureTimestamp === -1) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
this.totalTime += performance.now() - this._startMeasureTimestamp;
|
|
518
|
+
this._startMeasureTimestamp = -1;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
/** config * */
|
|
522
|
+
_defineProperty(VCObserver, "VCParts", ['25', '50', '75', '80', '85', '90', '95', '98', '99']);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MEDIA_WRAPPER_TAG } from './index';
|
|
2
|
+
export const isContainedWithinMediaWrapper = node => {
|
|
3
|
+
while (node) {
|
|
4
|
+
if (node instanceof Element && node.hasAttribute(MEDIA_WRAPPER_TAG)) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
node = node.parentNode;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
};
|