@atlaskit/react-ufo 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +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,49 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { v4 as createUUID } from 'uuid';
|
|
3
|
+
import coinflip from '../coinflip';
|
|
4
|
+
import { getDoNotAbortActivePressInteractionOnTransition, getInteractionRate } from '../config';
|
|
5
|
+
import { getActiveTrace } from '../experience-trace-id-context';
|
|
6
|
+
import UFOInteractionIDContext, { DefaultInteractionID } from '../interaction-id-context';
|
|
7
|
+
import { abortAll, addNewInteraction, addOnCancelCallback, getActiveInteraction, tryComplete } from '../interaction-metrics';
|
|
8
|
+
import UFORouteName from '../route-name-context';
|
|
9
|
+
import { setInteractionActiveTrace } from './utils/set-interaction-active-trace';
|
|
10
|
+
export default function traceUFOTransition(ufoName) {
|
|
11
|
+
var routeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ufoName;
|
|
12
|
+
var pressInteractionsList = getDoNotAbortActivePressInteractionOnTransition();
|
|
13
|
+
var interaction = getActiveInteraction();
|
|
14
|
+
if (pressInteractionsList && interaction) {
|
|
15
|
+
if (pressInteractionsList.includes(interaction.ufoName)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
abortAll('transition', ufoName !== null && ufoName !== void 0 ? ufoName : undefined);
|
|
20
|
+
if (ufoName) {
|
|
21
|
+
UFORouteName.current = ufoName;
|
|
22
|
+
var rate = getInteractionRate(ufoName, 'transition');
|
|
23
|
+
if (coinflip(rate)) {
|
|
24
|
+
var newId = createUUID();
|
|
25
|
+
setInteractionActiveTrace(newId);
|
|
26
|
+
DefaultInteractionID.current = newId;
|
|
27
|
+
addNewInteraction(newId, ufoName, 'transition', performance.now(), rate, null, routeName, getActiveTrace());
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function useUFOTransitionCompleter() {
|
|
32
|
+
var interactionId = useContext(UFOInteractionIDContext);
|
|
33
|
+
var capturedInteractionId = interactionId.current;
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
// If we have a current interaction set...
|
|
36
|
+
if (capturedInteractionId != null) {
|
|
37
|
+
var cancel = requestAnimationFrame(function () {
|
|
38
|
+
cancel = requestAnimationFrame(function () {
|
|
39
|
+
if (capturedInteractionId === interactionId.current) {
|
|
40
|
+
tryComplete(capturedInteractionId);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
addOnCancelCallback(capturedInteractionId, function () {
|
|
45
|
+
cancelAnimationFrame(cancel);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}, [capturedInteractionId, interactionId]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { setActiveTrace } from '../../../experience-trace-id-context';
|
|
2
|
+
import { generateSpanId } from '../generate-span-id';
|
|
3
|
+
export var setInteractionActiveTrace = function setInteractionActiveTrace(newId) {
|
|
4
|
+
setActiveTrace(newId.replace(/-/g, ''), generateSpanId(), 'transition');
|
|
5
|
+
};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { unstable_IdlePriority as idlePriority, unstable_scheduleCallback as scheduleCallback } from 'scheduler';
|
|
3
|
+
import { v4 as createUUID } from 'uuid';
|
|
4
|
+
import coinflip from '../coinflip';
|
|
5
|
+
import { getInteractionRate, getTypingPerformanceTracingMethod } from '../config';
|
|
6
|
+
import { addMetadata, addNewInteraction, tryComplete } from '../interaction-metrics';
|
|
7
|
+
var getTypingMetadata = function getTypingMetadata(times, computeStartTime, typingPerformanceTracingMethod) {
|
|
8
|
+
var min = 0;
|
|
9
|
+
var max = 0;
|
|
10
|
+
var avg = 0;
|
|
11
|
+
var index = 0;
|
|
12
|
+
var below50count = 0;
|
|
13
|
+
times.forEach(function (time) {
|
|
14
|
+
if (time !== 0) {
|
|
15
|
+
avg = (avg * index + time) / ++index;
|
|
16
|
+
if (time > max) {
|
|
17
|
+
max = time;
|
|
18
|
+
}
|
|
19
|
+
if (min === 0 || time < min) {
|
|
20
|
+
min = time;
|
|
21
|
+
}
|
|
22
|
+
if (time < 50) {
|
|
23
|
+
below50count++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
typing: {
|
|
29
|
+
min: min,
|
|
30
|
+
max: max,
|
|
31
|
+
avg: avg,
|
|
32
|
+
count: index,
|
|
33
|
+
below50count: below50count,
|
|
34
|
+
compute: performance.now() - computeStartTime,
|
|
35
|
+
typeTracingMethod: typingPerformanceTracingMethod
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
function typingPerformanceTracingTimeout(element, name, rate) {
|
|
40
|
+
var tsubmit;
|
|
41
|
+
var times = [];
|
|
42
|
+
var isInteractionInitialised = false;
|
|
43
|
+
var id;
|
|
44
|
+
var start = function start() {
|
|
45
|
+
id = createUUID();
|
|
46
|
+
addNewInteraction(id, name, 'typing', performance.now(), rate, null, null);
|
|
47
|
+
isInteractionInitialised = true;
|
|
48
|
+
};
|
|
49
|
+
var end = function end() {
|
|
50
|
+
isInteractionInitialised = false;
|
|
51
|
+
var timesCopy = times;
|
|
52
|
+
times = [];
|
|
53
|
+
scheduleCallback(idlePriority, function () {
|
|
54
|
+
var computeStartTime = performance.now();
|
|
55
|
+
var data = getTypingMetadata(timesCopy, computeStartTime, 'timeout');
|
|
56
|
+
addMetadata(id, data);
|
|
57
|
+
tryComplete(id);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var onKeyPressHandler = function onKeyPressHandler(event) {
|
|
61
|
+
if (!isInteractionInitialised) {
|
|
62
|
+
start();
|
|
63
|
+
}
|
|
64
|
+
var startTime = event.timeStamp;
|
|
65
|
+
setTimeout(function () {
|
|
66
|
+
var endTime = performance.now();
|
|
67
|
+
var time = endTime - startTime;
|
|
68
|
+
times.push(time);
|
|
69
|
+
clearTimeout(tsubmit);
|
|
70
|
+
tsubmit = setTimeout(end, 2000); // debounce
|
|
71
|
+
}, 0);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
75
|
+
element.addEventListener('keypress', onKeyPressHandler);
|
|
76
|
+
return function () {
|
|
77
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
78
|
+
element.removeEventListener('keypress', onKeyPressHandler);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function typingPerformanceTracingTimeoutNoAlloc(element, name, rate) {
|
|
82
|
+
var tsubmit;
|
|
83
|
+
var isInteractionInitialised = false;
|
|
84
|
+
var min = 0;
|
|
85
|
+
var max = 0;
|
|
86
|
+
var below50count = 0;
|
|
87
|
+
var avg = 0;
|
|
88
|
+
var count = 0;
|
|
89
|
+
var id;
|
|
90
|
+
var resetStats = function resetStats() {
|
|
91
|
+
min = 0;
|
|
92
|
+
max = 0;
|
|
93
|
+
below50count = 0;
|
|
94
|
+
avg = 0;
|
|
95
|
+
count = 0;
|
|
96
|
+
};
|
|
97
|
+
var start = function start() {
|
|
98
|
+
id = createUUID();
|
|
99
|
+
addNewInteraction(id, name, 'typing', performance.now(), rate, null, null);
|
|
100
|
+
isInteractionInitialised = true;
|
|
101
|
+
};
|
|
102
|
+
var end = function end() {
|
|
103
|
+
isInteractionInitialised = false;
|
|
104
|
+
var typingMetaData = {
|
|
105
|
+
typing: {
|
|
106
|
+
min: min,
|
|
107
|
+
max: max,
|
|
108
|
+
avg: avg,
|
|
109
|
+
count: count,
|
|
110
|
+
below50count: below50count,
|
|
111
|
+
typeTracingMethod: 'timeoutNoAlloc'
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
resetStats();
|
|
115
|
+
scheduleCallback(idlePriority, function () {
|
|
116
|
+
addMetadata(id, typingMetaData);
|
|
117
|
+
tryComplete(id);
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
var onKeyPressHandler = function onKeyPressHandler(event) {
|
|
121
|
+
if (!isInteractionInitialised) {
|
|
122
|
+
start();
|
|
123
|
+
}
|
|
124
|
+
var startTime = event.timeStamp;
|
|
125
|
+
setTimeout(function () {
|
|
126
|
+
var endTime = performance.now();
|
|
127
|
+
var time = endTime - startTime;
|
|
128
|
+
if (time !== 0) {
|
|
129
|
+
avg = (avg * count + time) / ++count;
|
|
130
|
+
if (time > max) {
|
|
131
|
+
max = time;
|
|
132
|
+
}
|
|
133
|
+
if (min === 0 || time < min) {
|
|
134
|
+
min = time;
|
|
135
|
+
}
|
|
136
|
+
if (time < 50) {
|
|
137
|
+
below50count++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
clearTimeout(tsubmit);
|
|
141
|
+
tsubmit = setTimeout(end, 2000); // debounce
|
|
142
|
+
}, 0);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
146
|
+
element.addEventListener('keypress', onKeyPressHandler);
|
|
147
|
+
return function () {
|
|
148
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
149
|
+
element.removeEventListener('keypress', onKeyPressHandler);
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function typingPerformanceTracingMutationObserver(element, name, rate) {
|
|
153
|
+
var eventTime = -1;
|
|
154
|
+
var isInteractionInitialised = false;
|
|
155
|
+
var count = 0;
|
|
156
|
+
var id;
|
|
157
|
+
var tsubmit;
|
|
158
|
+
var keyLimit = 20;
|
|
159
|
+
var times = new Float64Array(keyLimit);
|
|
160
|
+
var resetTimesArray = function resetTimesArray() {
|
|
161
|
+
times.fill(0);
|
|
162
|
+
};
|
|
163
|
+
var resetEventTime = function resetEventTime() {
|
|
164
|
+
eventTime = -1;
|
|
165
|
+
};
|
|
166
|
+
var start = function start() {
|
|
167
|
+
id = createUUID();
|
|
168
|
+
addNewInteraction(id, name, 'typing', performance.now(), rate, null, null);
|
|
169
|
+
isInteractionInitialised = true;
|
|
170
|
+
};
|
|
171
|
+
var end = function end() {
|
|
172
|
+
isInteractionInitialised = false;
|
|
173
|
+
if (count === 0) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
var timesCopy = new Float64Array(times);
|
|
177
|
+
var countCopy = count;
|
|
178
|
+
resetTimesArray();
|
|
179
|
+
resetEventTime();
|
|
180
|
+
count = 0;
|
|
181
|
+
scheduleCallback(idlePriority, function () {
|
|
182
|
+
var computeStartTime = performance.now();
|
|
183
|
+
var timesSubarray = timesCopy.subarray(0, countCopy);
|
|
184
|
+
var data = getTypingMetadata(timesSubarray, computeStartTime, 'mutationObserver');
|
|
185
|
+
addMetadata(id, data);
|
|
186
|
+
tryComplete(id);
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var onKeyPressHandler = function onKeyPressHandler(event) {
|
|
190
|
+
if (!isInteractionInitialised) {
|
|
191
|
+
start();
|
|
192
|
+
}
|
|
193
|
+
eventTime = event.timeStamp;
|
|
194
|
+
setTimeout(function () {
|
|
195
|
+
clearTimeout(tsubmit);
|
|
196
|
+
tsubmit = setTimeout(end, 2000); // debounce
|
|
197
|
+
}, 0);
|
|
198
|
+
};
|
|
199
|
+
var mo = new MutationObserver(function (events) {
|
|
200
|
+
var moTime = performance.now();
|
|
201
|
+
if (eventTime === -1) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (count > keyLimit - 1) {
|
|
205
|
+
end();
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
var startTime = eventTime;
|
|
209
|
+
resetEventTime();
|
|
210
|
+
events.forEach(function () {
|
|
211
|
+
requestAnimationFrame(function (firstFrameTime) {
|
|
212
|
+
if (firstFrameTime < moTime) {
|
|
213
|
+
requestAnimationFrame(function (secondFrameTime) {
|
|
214
|
+
times[count] = secondFrameTime - startTime;
|
|
215
|
+
count++;
|
|
216
|
+
});
|
|
217
|
+
} else {
|
|
218
|
+
times[count] = firstFrameTime - startTime;
|
|
219
|
+
count++;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
mo.observe(element, {
|
|
225
|
+
attributeFilter: ['value'],
|
|
226
|
+
attributes: true,
|
|
227
|
+
characterData: true,
|
|
228
|
+
childList: true,
|
|
229
|
+
subtree: true
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
233
|
+
element.addEventListener('keypress', onKeyPressHandler);
|
|
234
|
+
return function () {
|
|
235
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
236
|
+
element.removeEventListener('keypress', onKeyPressHandler);
|
|
237
|
+
mo.disconnect();
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
var typingPerformanceTracingMethods = {
|
|
241
|
+
timeout: typingPerformanceTracingTimeout,
|
|
242
|
+
timeoutNoAlloc: typingPerformanceTracingTimeoutNoAlloc,
|
|
243
|
+
mutationObserver: typingPerformanceTracingMutationObserver
|
|
244
|
+
};
|
|
245
|
+
export default function useUFOTypingPerformanceTracing(name) {
|
|
246
|
+
var ref = useRef(null);
|
|
247
|
+
useEffect(function () {
|
|
248
|
+
var rate = getInteractionRate(name, 'typing');
|
|
249
|
+
if (coinflip(rate) && ref.current != null) {
|
|
250
|
+
var method = getTypingPerformanceTracingMethod();
|
|
251
|
+
return typingPerformanceTracingMethods[method](ref.current, name, rate);
|
|
252
|
+
}
|
|
253
|
+
}, [name]);
|
|
254
|
+
return ref;
|
|
255
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCallback, useContext } from 'react';
|
|
2
|
+
import InteractionContext from '@atlaskit/interaction-context';
|
|
3
|
+
export default function usePressTracing(name) {
|
|
4
|
+
var context = useContext(InteractionContext);
|
|
5
|
+
var handleClick = useCallback(function (timeStamp) {
|
|
6
|
+
if (context) {
|
|
7
|
+
var time = timeStamp || performance.now();
|
|
8
|
+
context.tracePress(name, time);
|
|
9
|
+
}
|
|
10
|
+
}, [context, name]);
|
|
11
|
+
return handleClick;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VCObserver } from './vc-observer';
|
|
2
|
+
var instance = null;
|
|
3
|
+
export var getVCObserver = function getVCObserver() {
|
|
4
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5
|
+
if (instance === null) {
|
|
6
|
+
instance = new VCObserver(opts);
|
|
7
|
+
}
|
|
8
|
+
return instance;
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { bind } from 'bind-event-listener';
|
|
2
|
+
import { AbortEvent } from '../../common/vc/types';
|
|
3
|
+
import { getViewportHeight, getViewportWidth } from './getViewport';
|
|
4
|
+
export var attachAbortListeners = function attachAbortListeners(window, initialViewPort, callback) {
|
|
5
|
+
var unbindWheel = bind(window, {
|
|
6
|
+
type: AbortEvent.wheel,
|
|
7
|
+
listener: function listener(e) {
|
|
8
|
+
callback(AbortEvent.wheel, e.timeStamp);
|
|
9
|
+
},
|
|
10
|
+
options: {
|
|
11
|
+
passive: true,
|
|
12
|
+
once: true
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var unbindKeydown = bind(window, {
|
|
16
|
+
type: AbortEvent.keydown,
|
|
17
|
+
listener: function listener(e) {
|
|
18
|
+
callback(AbortEvent.keydown, e.timeStamp);
|
|
19
|
+
},
|
|
20
|
+
options: {
|
|
21
|
+
once: true
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var unbindResize = bind(window, {
|
|
25
|
+
type: AbortEvent.resize,
|
|
26
|
+
listener: function listener(e) {
|
|
27
|
+
if (getViewportWidth() !== initialViewPort.w || getViewportHeight() !== initialViewPort.h) {
|
|
28
|
+
callback(AbortEvent.resize, e.timeStamp);
|
|
29
|
+
unbindResize();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return [unbindWheel, unbindKeydown, unbindResize];
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function getViewportWidth() {
|
|
2
|
+
var document = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.document;
|
|
3
|
+
var documentWidth;
|
|
4
|
+
try {
|
|
5
|
+
documentWidth = document.documentElement.clientWidth || 0;
|
|
6
|
+
} catch (e) {
|
|
7
|
+
documentWidth = 0;
|
|
8
|
+
}
|
|
9
|
+
return Math.max(documentWidth, window.innerWidth || 0);
|
|
10
|
+
}
|
|
11
|
+
export function getViewportHeight() {
|
|
12
|
+
var document = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.document;
|
|
13
|
+
var documentHeight;
|
|
14
|
+
try {
|
|
15
|
+
documentHeight = document.documentElement.clientHeight || 0;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
documentHeight = 0;
|
|
18
|
+
}
|
|
19
|
+
return Math.max(documentHeight, window.innerHeight || 0);
|
|
20
|
+
}
|