@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,200 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
import { REACT_UFO_VERSION } from '../common/constants';
|
|
6
|
+
import { getConfig } from '../config';
|
|
7
|
+
import { isSegmentLabel, sanitizeUfoName } from '../create-payload/common/utils';
|
|
8
|
+
import { getPageVisibilityState } from '../hidden-timing';
|
|
9
|
+
function getParentStack(labelStack) {
|
|
10
|
+
if (!labelStack || labelStack.length <= 1) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return labelStack.slice(0, labelStack.length - 1);
|
|
14
|
+
}
|
|
15
|
+
function getSegmentId(labelStack) {
|
|
16
|
+
if (!labelStack) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
var leafLabelStack = labelStack[labelStack.length - 1];
|
|
20
|
+
if (isSegmentLabel(leafLabelStack)) {
|
|
21
|
+
return leafLabelStack.segmentId;
|
|
22
|
+
}
|
|
23
|
+
var parentStack = getParentStack(labelStack);
|
|
24
|
+
if (!parentStack) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return getSegmentId(parentStack);
|
|
28
|
+
}
|
|
29
|
+
function getParentSegmentId(labelStack) {
|
|
30
|
+
return getSegmentId(getParentStack(labelStack));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whenever a render happen, all parent segment have timing reported
|
|
35
|
+
* This method tries to reduce that noise
|
|
36
|
+
*/
|
|
37
|
+
function removeCascadingParentTimingReport(reactProfilerTimings) {
|
|
38
|
+
var timingIndex = new Map();
|
|
39
|
+
reactProfilerTimings.forEach(function (timing) {
|
|
40
|
+
var segmentId = getSegmentId(timing.labelStack);
|
|
41
|
+
if (segmentId) {
|
|
42
|
+
var _timingIndex$get;
|
|
43
|
+
var timingArray = (_timingIndex$get = timingIndex.get(segmentId)) !== null && _timingIndex$get !== void 0 ? _timingIndex$get : [];
|
|
44
|
+
timingIndex.set(segmentId, timingArray);
|
|
45
|
+
timingArray.push(timing);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
reactProfilerTimings.forEach(function (timing) {
|
|
49
|
+
var parentSegmentId = getParentSegmentId(timing.labelStack);
|
|
50
|
+
if (parentSegmentId) {
|
|
51
|
+
var parentTimings = timingIndex.get(parentSegmentId);
|
|
52
|
+
var filteredParentTimings = parentTimings === null || parentTimings === void 0 ? void 0 : parentTimings.filter(function (parentTiming) {
|
|
53
|
+
if (parentTiming.startTime === timing.startTime && parentTiming.actualDuration === timing.actualDuration) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
if (filteredParentTimings) {
|
|
59
|
+
timingIndex.set(parentSegmentId, filteredParentTimings);
|
|
60
|
+
} else {
|
|
61
|
+
timingIndex.delete(parentSegmentId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return _toConsumableArray(timingIndex.values()).flatMap(function (v) {
|
|
66
|
+
return v;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function transformReactProfilerTimings(reactProfilerTimings) {
|
|
70
|
+
var filtered = removeCascadingParentTimingReport(reactProfilerTimings !== null && reactProfilerTimings !== void 0 ? reactProfilerTimings : []);
|
|
71
|
+
var reactProfilerTimingsMap = filtered.reduce(function (result, _ref) {
|
|
72
|
+
var labelStack = _ref.labelStack,
|
|
73
|
+
startTime = _ref.startTime,
|
|
74
|
+
commitTime = _ref.commitTime,
|
|
75
|
+
actualDuration = _ref.actualDuration,
|
|
76
|
+
type = _ref.type;
|
|
77
|
+
if (labelStack && type !== 'nested-update') {
|
|
78
|
+
var label = labelStack.map(function (ls) {
|
|
79
|
+
return ls.name;
|
|
80
|
+
}).join('/');
|
|
81
|
+
var start = Math.round(startTime);
|
|
82
|
+
var end = Math.round(commitTime);
|
|
83
|
+
var timing = result.get(label) || {
|
|
84
|
+
labelStack: label,
|
|
85
|
+
startTime: start,
|
|
86
|
+
endTime: end,
|
|
87
|
+
mountCount: 0,
|
|
88
|
+
rerenderCount: 1,
|
|
89
|
+
renderDuration: 0
|
|
90
|
+
};
|
|
91
|
+
if (start < timing.startTime) {
|
|
92
|
+
timing.startTime = Math.round(start);
|
|
93
|
+
}
|
|
94
|
+
if (end > timing.endTime) {
|
|
95
|
+
timing.endTime = Math.round(end);
|
|
96
|
+
}
|
|
97
|
+
if (type === 'mount') {
|
|
98
|
+
timing.mountCount += 1;
|
|
99
|
+
}
|
|
100
|
+
if (type === 'update') {
|
|
101
|
+
timing.rerenderCount += 1;
|
|
102
|
+
}
|
|
103
|
+
timing.renderDuration += Math.round(actualDuration);
|
|
104
|
+
result.set(label, timing);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}, new Map());
|
|
108
|
+
return _toConsumableArray(reactProfilerTimingsMap.values());
|
|
109
|
+
}
|
|
110
|
+
export default function createPostInteractionLogPayload(_ref2) {
|
|
111
|
+
var _window$location;
|
|
112
|
+
var lastInteractionFinish = _ref2.lastInteractionFinish,
|
|
113
|
+
reactProfilerTimings = _ref2.reactProfilerTimings,
|
|
114
|
+
lastInteractionFinishVCResult = _ref2.lastInteractionFinishVCResult,
|
|
115
|
+
postInteractionFinishVCResult = _ref2.postInteractionFinishVCResult;
|
|
116
|
+
var config = getConfig();
|
|
117
|
+
if (!config) {
|
|
118
|
+
throw Error('UFO Configuration not provided');
|
|
119
|
+
}
|
|
120
|
+
var ufoName = sanitizeUfoName(lastInteractionFinish.ufoName);
|
|
121
|
+
var pageVisibilityState = getPageVisibilityState(lastInteractionFinish.start, lastInteractionFinish.end);
|
|
122
|
+
if (pageVisibilityState !== 'visible') {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
var maxEndTimeFromProfiler = reactProfilerTimings ? Math.max.apply(Math, _toConsumableArray(reactProfilerTimings.map(function (t) {
|
|
126
|
+
return t.commitTime;
|
|
127
|
+
}))) : lastInteractionFinish.end;
|
|
128
|
+
var revisedEndTime = Math.round(maxEndTimeFromProfiler);
|
|
129
|
+
var revisedTtai = Math.round(maxEndTimeFromProfiler - lastInteractionFinish.start);
|
|
130
|
+
var lastInteractionFinishStart = Math.round(lastInteractionFinish.start);
|
|
131
|
+
var lastInteractionFinishEnd = Math.round(lastInteractionFinish.end);
|
|
132
|
+
var lastInteractionFinishTTAI = Math.round(lastInteractionFinish.end - lastInteractionFinish.start);
|
|
133
|
+
var lastInteractionFinishVC90 = null;
|
|
134
|
+
if (lastInteractionFinishVCResult !== null && lastInteractionFinishVCResult !== void 0 && lastInteractionFinishVCResult['ufo:vc:state']) {
|
|
135
|
+
var _lastInteractionFinis;
|
|
136
|
+
var lastInteractionFinishVCMetrics = lastInteractionFinishVCResult === null || lastInteractionFinishVCResult === void 0 ? void 0 : lastInteractionFinishVCResult['metrics:vc'];
|
|
137
|
+
lastInteractionFinishVC90 = (_lastInteractionFinis = lastInteractionFinishVCMetrics[90]) !== null && _lastInteractionFinis !== void 0 ? _lastInteractionFinis : null;
|
|
138
|
+
}
|
|
139
|
+
var postInteractionFinishVCRatios = {};
|
|
140
|
+
var revisedVC90 = null;
|
|
141
|
+
var postInteractionFinishVCUpdates = [];
|
|
142
|
+
if (postInteractionFinishVCResult !== null && postInteractionFinishVCResult !== void 0 && postInteractionFinishVCResult['ufo:vc:state']) {
|
|
143
|
+
postInteractionFinishVCRatios = postInteractionFinishVCResult === null || postInteractionFinishVCResult === void 0 ? void 0 : postInteractionFinishVCResult['ufo:vc:ratios'];
|
|
144
|
+
postInteractionFinishVCUpdates = postInteractionFinishVCResult === null || postInteractionFinishVCResult === void 0 ? void 0 : postInteractionFinishVCResult['ufo:vc:updates'];
|
|
145
|
+
var postInteractionFinishVCMetrics = postInteractionFinishVCResult === null || postInteractionFinishVCResult === void 0 ? void 0 : postInteractionFinishVCResult['metrics:vc'];
|
|
146
|
+
if (typeof lastInteractionFinishVC90 === 'number') {
|
|
147
|
+
var _postInteractionFinis;
|
|
148
|
+
revisedVC90 = (_postInteractionFinis = postInteractionFinishVCMetrics[90]) !== null && _postInteractionFinis !== void 0 ? _postInteractionFinis : null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
var lateMutations = postInteractionFinishVCUpdates.filter(function (entry) {
|
|
152
|
+
return entry.time > lastInteractionFinish.end;
|
|
153
|
+
}).flatMap(function (_ref3) {
|
|
154
|
+
var time = _ref3.time,
|
|
155
|
+
elements = _ref3.elements;
|
|
156
|
+
return Array.from(new Set(elements)).map(function (element) {
|
|
157
|
+
return {
|
|
158
|
+
time: time,
|
|
159
|
+
element: element,
|
|
160
|
+
viewportHeatmapPercentage: postInteractionFinishVCRatios[element]
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
return {
|
|
165
|
+
actionSubject: 'experience',
|
|
166
|
+
action: 'measured',
|
|
167
|
+
eventType: 'operational',
|
|
168
|
+
source: 'measured',
|
|
169
|
+
tags: ['observability'],
|
|
170
|
+
attributes: {
|
|
171
|
+
properties: {
|
|
172
|
+
// basic
|
|
173
|
+
'event:hostname': ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.hostname) || 'unknown',
|
|
174
|
+
'event:product': config.product,
|
|
175
|
+
'event:schema': '1.0.0',
|
|
176
|
+
'event:source': {
|
|
177
|
+
name: 'react-ufo/web',
|
|
178
|
+
version: REACT_UFO_VERSION,
|
|
179
|
+
payloadSource: 'platform'
|
|
180
|
+
},
|
|
181
|
+
'event:region': config.region || 'unknown',
|
|
182
|
+
'experience:key': 'custom.post-interaction-logs',
|
|
183
|
+
postInteractionLog: {
|
|
184
|
+
lastInteractionFinish: _objectSpread(_objectSpread({}, lastInteractionFinish), {}, {
|
|
185
|
+
ufoName: ufoName,
|
|
186
|
+
start: lastInteractionFinishStart,
|
|
187
|
+
end: lastInteractionFinishEnd,
|
|
188
|
+
ttai: lastInteractionFinishTTAI,
|
|
189
|
+
vc90: lastInteractionFinishVC90
|
|
190
|
+
}),
|
|
191
|
+
revisedEndTime: revisedEndTime,
|
|
192
|
+
revisedTtai: revisedTtai,
|
|
193
|
+
revisedVC90: revisedVC90,
|
|
194
|
+
lateMutations: lateMutations,
|
|
195
|
+
reactProfilerTimings: transformReactProfilerTimings(reactProfilerTimings)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import UFOInteractionContext from '../interaction-context';
|
|
3
|
+
import { getInteractionId } from '../interaction-id-context';
|
|
4
|
+
import { addCustomData } from '../interaction-metrics';
|
|
5
|
+
export default function UFOCustomData(_ref) {
|
|
6
|
+
var data = _ref.data;
|
|
7
|
+
var interactionContext = useContext(UFOInteractionContext);
|
|
8
|
+
useMemo(function () {
|
|
9
|
+
if (!interactionContext) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
interactionContext.addCustomData(data);
|
|
13
|
+
}, [data, interactionContext]);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
export function addUFOCustomData(data) {
|
|
17
|
+
var interactionId = getInteractionId();
|
|
18
|
+
var currentInteractionId = interactionId.current;
|
|
19
|
+
if (!currentInteractionId) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
addCustomData(currentInteractionId, [], data);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import UFOInteractionContext from '../interaction-context';
|
|
3
|
+
import { getInteractionId } from '../interaction-id-context';
|
|
4
|
+
import { addMark } from '../interaction-metrics';
|
|
5
|
+
export default function UFOCustomMark(_ref) {
|
|
6
|
+
var name = _ref.name,
|
|
7
|
+
timestamp = _ref.timestamp;
|
|
8
|
+
var interactionContext = useContext(UFOInteractionContext);
|
|
9
|
+
useMemo(function () {
|
|
10
|
+
if (interactionContext != null) {
|
|
11
|
+
interactionContext.addMark(name, timestamp);
|
|
12
|
+
}
|
|
13
|
+
}, [interactionContext, name, timestamp]);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
export function UFOCustomMarks(_ref2) {
|
|
17
|
+
var data = _ref2.data;
|
|
18
|
+
var interactionContext = useContext(UFOInteractionContext);
|
|
19
|
+
useMemo(function () {
|
|
20
|
+
if (interactionContext != null && data != null) {
|
|
21
|
+
Object.keys(data).forEach(function (i) {
|
|
22
|
+
interactionContext.addMark(i, data[i]);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}, [data, interactionContext]);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
export function addUFOCustomMark(name, timestamp) {
|
|
29
|
+
var interactionId = getInteractionId();
|
|
30
|
+
var currentInteractionId = interactionId.current;
|
|
31
|
+
if (!currentInteractionId) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
var time = timestamp || performance.now();
|
|
35
|
+
addMark(currentInteractionId, 'custom', name, [], time);
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { addSpanToAll } from '../interaction-metrics';
|
|
2
|
+
export function addCustomSpans(name, start) {
|
|
3
|
+
var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : performance.now();
|
|
4
|
+
var size = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
5
|
+
addSpanToAll('custom', name, [{
|
|
6
|
+
name: 'custom'
|
|
7
|
+
}], start, end, size);
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import UFOInteractionContext from '../interaction-context';
|
|
3
|
+
import { getInteractionId } from '../interaction-id-context';
|
|
4
|
+
import { addCustomTiming, getCurrentInteractionType } from '../interaction-metrics';
|
|
5
|
+
export function getBm3Timings(marks, timingConfigs) {
|
|
6
|
+
var bm3Timings = {};
|
|
7
|
+
if (!marks || !timingConfigs) {
|
|
8
|
+
return bm3Timings;
|
|
9
|
+
}
|
|
10
|
+
timingConfigs.forEach(function (item) {
|
|
11
|
+
if (!item.startMark || !item.endMark) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
var startTime = marks[item.startMark];
|
|
15
|
+
if (!startTime) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var endTime = marks[item.endMark];
|
|
19
|
+
if (!endTime) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
bm3Timings[item.key] = {
|
|
23
|
+
startTime: startTime,
|
|
24
|
+
endTime: endTime
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
return bm3Timings;
|
|
28
|
+
}
|
|
29
|
+
export function UFOBM3TimingsToUFO(_ref) {
|
|
30
|
+
var marks = _ref.marks,
|
|
31
|
+
timings = _ref.timings;
|
|
32
|
+
var interactionContext = useContext(UFOInteractionContext);
|
|
33
|
+
var interactionId = getInteractionId().current;
|
|
34
|
+
useMemo(function () {
|
|
35
|
+
if (interactionContext != null && interactionId != null && marks != null && timings != null) {
|
|
36
|
+
var interactionType = getCurrentInteractionType(interactionId);
|
|
37
|
+
if (interactionType === 'press') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
var bm3Timings = getBm3Timings(marks, timings);
|
|
41
|
+
interactionContext.addCustomTimings(bm3Timings);
|
|
42
|
+
}
|
|
43
|
+
}, [interactionContext, interactionId, marks, timings]);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
export function addBM3TimingsToUFO(marks, timingsConfig) {
|
|
47
|
+
var interactionId = getInteractionId().current;
|
|
48
|
+
if (interactionId) {
|
|
49
|
+
var interactionType = getCurrentInteractionType(interactionId);
|
|
50
|
+
if (interactionType === 'press') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var bm3Timings = getBm3Timings(marks, timingsConfig);
|
|
54
|
+
addCustomTiming(interactionId, [], bm3Timings);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { makeTraceHttpRequestHeaders } from './utils/make-trace-http-request-headers';
|
|
2
|
+
var state = {
|
|
3
|
+
context: null
|
|
4
|
+
};
|
|
5
|
+
export var generateSpanId = function generateSpanId() {
|
|
6
|
+
return Array.from(new Array(16), function () {
|
|
7
|
+
return Math.floor(Math.random() * 16).toString(16);
|
|
8
|
+
}).join('');
|
|
9
|
+
};
|
|
10
|
+
export var setInteractionActiveTrace = function setInteractionActiveTrace(interactionId, experienceType) {
|
|
11
|
+
setActiveTrace(interactionId.replace(/-/g, ''), generateSpanId(), experienceType);
|
|
12
|
+
};
|
|
13
|
+
export var setActiveTrace = function setActiveTrace(traceId, spanId, type) {
|
|
14
|
+
state.context = {
|
|
15
|
+
traceId: traceId,
|
|
16
|
+
spanId: spanId,
|
|
17
|
+
type: type
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export var getActiveTrace = function getActiveTrace() {
|
|
21
|
+
return state.context || undefined;
|
|
22
|
+
};
|
|
23
|
+
export var clearActiveTrace = function clearActiveTrace() {
|
|
24
|
+
state.context = null;
|
|
25
|
+
};
|
|
26
|
+
export var getActiveTraceHttpRequestHeaders = function getActiveTraceHttpRequestHeaders(_url) {
|
|
27
|
+
if (state.context === null) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
var _state$context = state.context,
|
|
31
|
+
traceId = _state$context.traceId,
|
|
32
|
+
spanId = _state$context.spanId;
|
|
33
|
+
return makeTraceHttpRequestHeaders(traceId, spanId);
|
|
34
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var NON_BOOLEAN_VALUE = 'non_boolean';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import { NON_BOOLEAN_VALUE } from '../constants';
|
|
3
|
+
var startsAsObject = function startsAsObject(value) {
|
|
4
|
+
try {
|
|
5
|
+
if (value.charAt(0) === '{') {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
} catch (e) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
13
|
+
var isObject = function isObject(value) {
|
|
14
|
+
return value && _typeof(value) === 'object' && value.constructor === Object;
|
|
15
|
+
};
|
|
16
|
+
var isString = function isString(input) {
|
|
17
|
+
var result;
|
|
18
|
+
try {
|
|
19
|
+
result = typeof input === 'string' || input instanceof String;
|
|
20
|
+
} catch (err) {
|
|
21
|
+
// swallow any errors
|
|
22
|
+
result = false;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
export var shouldRedactValue = function shouldRedactValue(value) {
|
|
27
|
+
return isString(value) && startsAsObject(value) || isObject(value);
|
|
28
|
+
};
|
|
29
|
+
export var redactValue = function redactValue(featureFlagValue) {
|
|
30
|
+
return shouldRedactValue(featureFlagValue) ? NON_BOOLEAN_VALUE : featureFlagValue;
|
|
31
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { redactValue } from './common/utils';
|
|
2
|
+
export { redactValue } from './common/utils';
|
|
3
|
+
export var allFeatureFlagsAccessed = new Map();
|
|
4
|
+
export var currentFeatureFlagsAccessed = new Map();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Used for tracking accessed feature flags in "@atlassian/jira-feature-flagging".
|
|
8
|
+
* */
|
|
9
|
+
export var addFeatureFlagAccessed = function addFeatureFlagAccessed(featureFlagName, featureFlagValue) {
|
|
10
|
+
try {
|
|
11
|
+
// Inform Criterion about FF being accessed
|
|
12
|
+
if (globalThis.__CRITERION__ && typeof globalThis.__CRITERION__.addFeatureFlagAccessed === 'function') {
|
|
13
|
+
globalThis.__CRITERION__.addFeatureFlagAccessed(featureFlagName, featureFlagValue);
|
|
14
|
+
}
|
|
15
|
+
} catch (_e) {
|
|
16
|
+
// ignore the criterion error
|
|
17
|
+
}
|
|
18
|
+
var value = redactValue(featureFlagValue);
|
|
19
|
+
allFeatureFlagsAccessed.set(featureFlagName, value);
|
|
20
|
+
currentFeatureFlagsAccessed.set(featureFlagName, value);
|
|
21
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import { bind } from 'bind-event-listener';
|
|
3
|
+
var shouldInitilizeGlobalErrorHandler = true;
|
|
4
|
+
var errors = [];
|
|
5
|
+
var push = function push(name, labelStack, errorType, errorMessage, errorStack) {
|
|
6
|
+
errors.push({
|
|
7
|
+
name: name,
|
|
8
|
+
labelStack: labelStack,
|
|
9
|
+
errorType: errorType,
|
|
10
|
+
errorMessage: errorMessage,
|
|
11
|
+
errorStack: errorStack
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export var sinkErrorHandler = function sinkErrorHandler(sinkFunc) {
|
|
15
|
+
push = sinkFunc;
|
|
16
|
+
errors.forEach(function (e) {
|
|
17
|
+
sinkFunc(e.name, e.labelStack, e.errorType, e.errorMessage, e.errorStack);
|
|
18
|
+
});
|
|
19
|
+
errors.length = 0;
|
|
20
|
+
};
|
|
21
|
+
var handleError = function handleError(e) {
|
|
22
|
+
var _e$error;
|
|
23
|
+
if (((_e$error = e.error) === null || _e$error === void 0 ? void 0 : _e$error.UFOhasCaught) === undefined) {
|
|
24
|
+
try {
|
|
25
|
+
if (e.error instanceof Error) {
|
|
26
|
+
push('GlobalErrorHandler', null, e.error.name, e.error.message, e.error.stack);
|
|
27
|
+
} else if (e.error) {
|
|
28
|
+
var hint = JSON.stringify(e.error).slice(0, 50);
|
|
29
|
+
push('GlobalErrorHandler', null, '', "Non error object thrown: ".concat(hint), undefined);
|
|
30
|
+
} else if (e.message !== undefined) {
|
|
31
|
+
var _hint = e.message.slice(0, 50);
|
|
32
|
+
push('GlobalErrorHandler', null, '', "Non error object thrown: ".concat(_hint), undefined);
|
|
33
|
+
}
|
|
34
|
+
if (e.error && _typeof(e.error) === 'object') {
|
|
35
|
+
e.error.UFOhasCaught = true;
|
|
36
|
+
}
|
|
37
|
+
// eslint-disable-next-line no-empty
|
|
38
|
+
} catch (e) {}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var handlePromiseRejection = function handlePromiseRejection(e) {
|
|
42
|
+
if (e.reason instanceof Error) {
|
|
43
|
+
push('GlobalErrorHandler', null, e.reason.name, e.reason.message, e.reason.stack);
|
|
44
|
+
} else if (e.reason) {
|
|
45
|
+
try {
|
|
46
|
+
var hint = JSON.stringify(e.reason).slice(0, 50);
|
|
47
|
+
push('GlobalErrorHandler', null, '', "Non error object thrown: ".concat(hint), undefined);
|
|
48
|
+
// eslint-disable-next-line no-empty
|
|
49
|
+
} catch (e) {}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var setupUFOGlobalErrorHandler = function setupUFOGlobalErrorHandler() {
|
|
53
|
+
if (shouldInitilizeGlobalErrorHandler) {
|
|
54
|
+
bind(window, {
|
|
55
|
+
type: 'error',
|
|
56
|
+
listener: function listener(e) {
|
|
57
|
+
return handleError(e);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
bind(window, {
|
|
61
|
+
type: 'unhandledrejection',
|
|
62
|
+
listener: handlePromiseRejection
|
|
63
|
+
});
|
|
64
|
+
shouldInitilizeGlobalErrorHandler = false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export default setupUFOGlobalErrorHandler;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { bind } from 'bind-event-listener';
|
|
2
|
+
var timings = [];
|
|
3
|
+
var wasHiddenFlag;
|
|
4
|
+
var setupFlag = false;
|
|
5
|
+
function isPageHidden() {
|
|
6
|
+
if ('visibilityState' in document) {
|
|
7
|
+
return document.visibilityState === 'hidden';
|
|
8
|
+
} else {
|
|
9
|
+
// @ts-expect-error - Property 'hidden' does not exist on type 'never'.
|
|
10
|
+
return document.hidden;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
var SIZE = 50;
|
|
14
|
+
var insertIndex = 0;
|
|
15
|
+
function pushHidden(isPageHiddenFlag, time) {
|
|
16
|
+
timings[insertIndex] = {
|
|
17
|
+
time: time !== null && time !== void 0 ? time : performance.now(),
|
|
18
|
+
hidden: isPageHiddenFlag
|
|
19
|
+
};
|
|
20
|
+
insertIndex = (insertIndex + 1) % SIZE;
|
|
21
|
+
wasHiddenFlag = isPageHiddenFlag;
|
|
22
|
+
}
|
|
23
|
+
function handleChange() {
|
|
24
|
+
var isPageHiddenFlag = isPageHidden();
|
|
25
|
+
if (isPageHiddenFlag) {
|
|
26
|
+
if (!wasHiddenFlag) {
|
|
27
|
+
pushHidden(isPageHiddenFlag);
|
|
28
|
+
}
|
|
29
|
+
wasHiddenFlag = true;
|
|
30
|
+
} else {
|
|
31
|
+
if (wasHiddenFlag) {
|
|
32
|
+
pushHidden(isPageHiddenFlag);
|
|
33
|
+
}
|
|
34
|
+
wasHiddenFlag = false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function setup() {
|
|
38
|
+
bind(window, {
|
|
39
|
+
type: 'pageshow',
|
|
40
|
+
listener: handleChange
|
|
41
|
+
});
|
|
42
|
+
bind(window, {
|
|
43
|
+
type: 'pagehide',
|
|
44
|
+
listener: handleChange
|
|
45
|
+
});
|
|
46
|
+
bind(document, {
|
|
47
|
+
type: 'visibilitychange',
|
|
48
|
+
listener: handleChange
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export function setupHiddenTimingCapture() {
|
|
52
|
+
if (!setupFlag) {
|
|
53
|
+
var isPageHiddenFlag = isPageHidden();
|
|
54
|
+
pushHidden(isPageHiddenFlag, 0);
|
|
55
|
+
setup();
|
|
56
|
+
setupFlag = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function getPageVisibilityState(start, end) {
|
|
60
|
+
// Desirable default value is visible
|
|
61
|
+
if (timings.length === 0) {
|
|
62
|
+
return 'visible';
|
|
63
|
+
}
|
|
64
|
+
var currentSize = timings.length;
|
|
65
|
+
var hiddenState = 'mixed';
|
|
66
|
+
var startIdx = insertIndex;
|
|
67
|
+
var endIdx = insertIndex;
|
|
68
|
+
|
|
69
|
+
// currentSize is capped at SIZE.
|
|
70
|
+
for (var i = 0; i < currentSize; i++) {
|
|
71
|
+
var tmpIdx = (insertIndex + i) % currentSize;
|
|
72
|
+
if (timings[tmpIdx].time <= end) {
|
|
73
|
+
endIdx = tmpIdx;
|
|
74
|
+
if (timings[tmpIdx].time <= start) {
|
|
75
|
+
startIdx = tmpIdx;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (endIdx - startIdx === 0) {
|
|
80
|
+
if (timings[startIdx].hidden) {
|
|
81
|
+
hiddenState = 'hidden';
|
|
82
|
+
} else {
|
|
83
|
+
hiddenState = 'visible';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return hiddenState;
|
|
87
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var timings = [];
|
|
2
|
+
export function addTimingFromPerformanceMark(name, startMark, stopMark) {
|
|
3
|
+
var cleanStart = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
4
|
+
var cleanStop = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
5
|
+
timings.push({
|
|
6
|
+
name: name,
|
|
7
|
+
startMark: startMark,
|
|
8
|
+
stopMark: stopMark,
|
|
9
|
+
cleanStart: cleanStart,
|
|
10
|
+
cleanStop: cleanStop
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export function getTimings() {
|
|
14
|
+
var reportedTimingsObj = {};
|
|
15
|
+
timings.forEach(function (_ref) {
|
|
16
|
+
var name = _ref.name,
|
|
17
|
+
startMark = _ref.startMark,
|
|
18
|
+
stopMark = _ref.stopMark,
|
|
19
|
+
cleanStart = _ref.cleanStart,
|
|
20
|
+
cleanStop = _ref.cleanStop;
|
|
21
|
+
var startEntryList = performance.getEntriesByName(startMark);
|
|
22
|
+
var stopEntryList = performance.getEntriesByName(stopMark);
|
|
23
|
+
if ((startEntryList === null || startEntryList === void 0 ? void 0 : startEntryList.length) > 0 && (stopEntryList === null || stopEntryList === void 0 ? void 0 : stopEntryList.length) > 0) {
|
|
24
|
+
var startEntry = startEntryList[startEntryList.length - 1];
|
|
25
|
+
var stopEntry = stopEntryList[stopEntryList.length - 1];
|
|
26
|
+
var startTime = startEntry.startTime;
|
|
27
|
+
var duration = stopEntry.startTime - startTime;
|
|
28
|
+
var timing = {
|
|
29
|
+
startTime: Math.round(startTime),
|
|
30
|
+
duration: Math.round(duration)
|
|
31
|
+
};
|
|
32
|
+
reportedTimingsObj[name] = timing;
|
|
33
|
+
}
|
|
34
|
+
if (cleanStart) {
|
|
35
|
+
performance.clearMarks(startMark);
|
|
36
|
+
}
|
|
37
|
+
if (cleanStop) {
|
|
38
|
+
performance.clearMarks(stopMark);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return reportedTimingsObj;
|
|
42
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
|
|
3
|
+
// Same structure as react's useRef.
|
|
4
|
+
// This allows modals to use a ref to scope their value
|
|
5
|
+
// const id = useRef(null);
|
|
6
|
+
// <InteractionIDContext.Provider value={id}>...<
|
|
7
|
+
|
|
8
|
+
// The default InteractionID object is a global singleton
|
|
9
|
+
// It's the one that holds the root value used in routing,
|
|
10
|
+
// and is overwritten when we have new interactions start.
|
|
11
|
+
export var DefaultInteractionID = {
|
|
12
|
+
current: null
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// We use a context to allow modals to have their own lifecycle
|
|
16
|
+
export default /*#__PURE__*/createContext(DefaultInteractionID);
|
|
17
|
+
export var getInteractionId = function getInteractionId() {
|
|
18
|
+
return DefaultInteractionID;
|
|
19
|
+
};
|
|
20
|
+
export var useInteractionId = function useInteractionId() {
|
|
21
|
+
return DefaultInteractionID;
|
|
22
|
+
};
|