@kubesense/kubesense-browser-rum-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/preStartRum.d.ts +7 -0
- package/cjs/boot/preStartRum.js +190 -0
- package/cjs/boot/preStartRum.js.map +1 -0
- package/cjs/boot/rumPublicApi.d.ts +409 -0
- package/cjs/boot/rumPublicApi.js +168 -0
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/startRum.d.ts +109 -0
- package/cjs/boot/startRum.js +153 -0
- package/cjs/boot/startRum.js.map +1 -0
- package/cjs/browser/cookieObservable.d.ts +8 -0
- package/cjs/browser/cookieObservable.js +39 -0
- package/cjs/browser/cookieObservable.js.map +1 -0
- package/cjs/browser/domMutationObservable.d.ts +27 -0
- package/cjs/browser/domMutationObservable.js +58 -0
- package/cjs/browser/domMutationObservable.js.map +1 -0
- package/cjs/browser/firstInputPolyfill.d.ts +8 -0
- package/cjs/browser/firstInputPolyfill.js +68 -0
- package/cjs/browser/firstInputPolyfill.js.map +1 -0
- package/cjs/browser/htmlDomUtils.d.ts +13 -0
- package/cjs/browser/htmlDomUtils.js +46 -0
- package/cjs/browser/htmlDomUtils.js.map +1 -0
- package/cjs/browser/locationChangeObservable.d.ts +7 -0
- package/cjs/browser/locationChangeObservable.js +51 -0
- package/cjs/browser/locationChangeObservable.js.map +1 -0
- package/cjs/browser/performanceObservable.d.ts +174 -0
- package/cjs/browser/performanceObservable.js +126 -0
- package/cjs/browser/performanceObservable.js.map +1 -0
- package/cjs/browser/performanceUtils.d.ts +7 -0
- package/cjs/browser/performanceUtils.js +42 -0
- package/cjs/browser/performanceUtils.js.map +1 -0
- package/cjs/browser/scroll.d.ts +2 -0
- package/cjs/browser/scroll.js +33 -0
- package/cjs/browser/scroll.js.map +1 -0
- package/cjs/browser/viewportObservable.d.ts +10 -0
- package/cjs/browser/viewportObservable.js +37 -0
- package/cjs/browser/viewportObservable.js.map +1 -0
- package/cjs/browser/windowOpenObservable.d.ts +5 -0
- package/cjs/browser/windowOpenObservable.js +10 -0
- package/cjs/browser/windowOpenObservable.js.map +1 -0
- package/cjs/domain/action/actionCollection.d.ts +21 -0
- package/cjs/domain/action/actionCollection.js +96 -0
- package/cjs/domain/action/actionCollection.js.map +1 -0
- package/cjs/domain/action/actionNameConstants.d.ts +18 -0
- package/cjs/domain/action/actionNameConstants.js +11 -0
- package/cjs/domain/action/actionNameConstants.js.map +1 -0
- package/cjs/domain/action/clickChain.d.ts +8 -0
- package/cjs/domain/action/clickChain.js +61 -0
- package/cjs/domain/action/clickChain.js.map +1 -0
- package/cjs/domain/action/computeFrustration.d.ts +6 -0
- package/cjs/domain/action/computeFrustration.js +70 -0
- package/cjs/domain/action/computeFrustration.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.d.ts +4 -0
- package/cjs/domain/action/getActionNameFromElement.js +239 -0
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/action/interactionSelectorCache.d.ts +5 -0
- package/cjs/domain/action/interactionSelectorCache.js +23 -0
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +19 -0
- package/cjs/domain/action/listenActionEvents.js +61 -0
- package/cjs/domain/action/listenActionEvents.js.map +1 -0
- package/cjs/domain/action/trackClickActions.d.ts +81 -0
- package/cjs/domain/action/trackClickActions.js +237 -0
- package/cjs/domain/action/trackClickActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +5 -0
- package/cjs/domain/assembly.js +102 -0
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +325 -0
- package/cjs/domain/configuration/configuration.js +205 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +2 -0
- package/cjs/domain/configuration/index.js +19 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/jsonPathParser.d.ts +28 -0
- package/cjs/domain/configuration/jsonPathParser.js +159 -0
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/cjs/domain/configuration/remoteConfiguration.js +243 -0
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js +7 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/cjs/domain/contexts/ciVisibilityContext.js +34 -0
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -0
- package/cjs/domain/contexts/connectivityContext.js +11 -0
- package/cjs/domain/contexts/connectivityContext.js.map +1 -0
- package/cjs/domain/contexts/defaultContext.d.ts +4 -0
- package/cjs/domain/contexts/defaultContext.js +34 -0
- package/cjs/domain/contexts/defaultContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.d.ts +6 -0
- package/cjs/domain/contexts/displayContext.js +28 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/featureFlagContext.d.ts +19 -0
- package/cjs/domain/contexts/featureFlagContext.js +53 -0
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -0
- package/cjs/domain/contexts/internalContext.d.ts +12 -0
- package/cjs/domain/contexts/internalContext.js +26 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.d.ts +23 -0
- package/cjs/domain/contexts/pageStateHistory.js +104 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/sessionContext.d.ts +5 -0
- package/cjs/domain/contexts/sessionContext.js +47 -0
- package/cjs/domain/contexts/sessionContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -0
- package/cjs/domain/contexts/syntheticsContext.js +25 -0
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -0
- package/cjs/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/cjs/domain/contexts/trackingConsentContext.js +14 -0
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.d.ts +22 -0
- package/cjs/domain/contexts/urlContexts.js +64 -0
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/cjs/domain/contexts/userAgentDataContext.js +31 -0
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -0
- package/cjs/domain/contexts/viewHistory.d.ts +17 -0
- package/cjs/domain/contexts/viewHistory.js +48 -0
- package/cjs/domain/contexts/viewHistory.js.map +1 -0
- package/cjs/domain/discardNegativeDuration.d.ts +2 -0
- package/cjs/domain/discardNegativeDuration.js +8 -0
- package/cjs/domain/discardNegativeDuration.js.map +1 -0
- package/cjs/domain/error/errorCollection.d.ts +17 -0
- package/cjs/domain/error/errorCollection.js +74 -0
- package/cjs/domain/error/errorCollection.js.map +1 -0
- package/cjs/domain/error/trackConsoleError.d.ts +4 -0
- package/cjs/domain/error/trackConsoleError.js +13 -0
- package/cjs/domain/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/error/trackReportError.d.ts +5 -0
- package/cjs/domain/error/trackReportError.js +16 -0
- package/cjs/domain/error/trackReportError.js.map +1 -0
- package/cjs/domain/event/eventCollection.d.ts +10 -0
- package/cjs/domain/event/eventCollection.js +27 -0
- package/cjs/domain/event/eventCollection.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +64 -0
- package/cjs/domain/getSelectorFromElement.js +218 -0
- package/cjs/domain/getSelectorFromElement.js.map +1 -0
- package/cjs/domain/getSessionReplayUrl.d.ts +9 -0
- package/cjs/domain/getSessionReplayUrl.js +34 -0
- package/cjs/domain/getSessionReplayUrl.js.map +1 -0
- package/cjs/domain/hooks.d.ts +23 -0
- package/cjs/domain/hooks.js +6 -0
- package/cjs/domain/hooks.js.map +1 -0
- package/cjs/domain/lifeCycle.d.ts +73 -0
- package/cjs/domain/lifeCycle.js +6 -0
- package/cjs/domain/lifeCycle.js.map +1 -0
- package/cjs/domain/limitModification.d.ts +8 -0
- package/cjs/domain/limitModification.js +46 -0
- package/cjs/domain/limitModification.js.map +1 -0
- package/cjs/domain/longTask/longTaskCollection.d.ts +18 -0
- package/cjs/domain/longTask/longTaskCollection.js +91 -0
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/plugins.d.ts +40 -0
- package/cjs/domain/plugins.js +15 -0
- package/cjs/domain/plugins.js.map +1 -0
- package/cjs/domain/privacy.d.ts +44 -0
- package/cjs/domain/privacy.js +313 -0
- package/cjs/domain/privacy.js.map +1 -0
- package/cjs/domain/privacyConstants.d.ts +23 -0
- package/cjs/domain/privacyConstants.js +39 -0
- package/cjs/domain/privacyConstants.js.map +1 -0
- package/cjs/domain/requestCollection.d.ts +54 -0
- package/cjs/domain/requestCollection.js +111 -0
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/resource/graphql.d.ts +23 -0
- package/cjs/domain/resource/graphql.js +97 -0
- package/cjs/domain/resource/graphql.js.map +1 -0
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js +49 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/cjs/domain/resource/requestRegistry.d.ts +9 -0
- package/cjs/domain/resource/requestRegistry.js +41 -0
- package/cjs/domain/resource/requestRegistry.js.map +1 -0
- package/cjs/domain/resource/resourceCollection.d.ts +7 -0
- package/cjs/domain/resource/resourceCollection.js +190 -0
- package/cjs/domain/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/resource/resourceUtils.d.ts +55 -0
- package/cjs/domain/resource/resourceUtils.js +259 -0
- package/cjs/domain/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +24 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/cjs/domain/rumSessionManager.d.ts +36 -0
- package/cjs/domain/rumSessionManager.js +77 -0
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/sampler/sampler.d.ts +10 -0
- package/cjs/domain/sampler/sampler.js +63 -0
- package/cjs/domain/sampler/sampler.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/cjs/domain/startCustomerDataTelemetry.js +56 -0
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +76 -0
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/identifier.d.ts +13 -0
- package/cjs/domain/tracing/identifier.js +55 -0
- package/cjs/domain/tracing/identifier.js.map +1 -0
- package/cjs/domain/tracing/sampler.d.ts +10 -0
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/tracer.d.ts +30 -0
- package/cjs/domain/tracing/tracer.js +161 -0
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/tracer.types.d.ts +12 -0
- package/cjs/domain/tracing/tracer.types.js +3 -0
- package/cjs/domain/tracing/tracer.types.js.map +1 -0
- package/cjs/domain/trackEventCounts.d.ts +17 -0
- package/cjs/domain/trackEventCounts.js +50 -0
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/view/bfCacheSupport.d.ts +2 -0
- package/cjs/domain/view/bfCacheSupport.js +13 -0
- package/cjs/domain/view/bfCacheSupport.js.map +1 -0
- package/cjs/domain/view/trackViewEventCounts.d.ts +5 -0
- package/cjs/domain/view/trackViewEventCounts.js +16 -0
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/view/trackViews.d.ts +65 -0
- package/cjs/domain/view/trackViews.js +275 -0
- package/cjs/domain/view/trackViews.js.map +1 -0
- package/cjs/domain/view/viewCollection.d.ts +18 -0
- package/cjs/domain/view/viewCollection.js +153 -0
- package/cjs/domain/view/viewCollection.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +32 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +44 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +44 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +17 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +37 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +135 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +39 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +33 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +43 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +41 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +155 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +61 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +50 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +43 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +78 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/vital/vitalCollection.d.ts +55 -0
- package/cjs/domain/vital/vitalCollection.js +113 -0
- package/cjs/domain/vital/vitalCollection.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.d.ts +54 -0
- package/cjs/domain/waitPageActivityEnd.js +129 -0
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/domainContext.types.d.ts +39 -0
- package/cjs/domainContext.types.js +6 -0
- package/cjs/domainContext.types.js.map +1 -0
- package/cjs/index.d.ts +41 -0
- package/cjs/index.js +59 -0
- package/cjs/index.js.map +1 -0
- package/cjs/rawRumEvent.types.d.ts +326 -0
- package/cjs/rawRumEvent.types.js +34 -0
- package/cjs/rawRumEvent.types.js.map +1 -0
- package/cjs/rumEvent.types.d.ts +2026 -0
- package/cjs/rumEvent.types.js +7 -0
- package/cjs/rumEvent.types.js.map +1 -0
- package/cjs/transport/formDataTransport.d.ts +16 -0
- package/cjs/transport/formDataTransport.js +46 -0
- package/cjs/transport/formDataTransport.js.map +1 -0
- package/cjs/transport/startRumBatch.d.ts +5 -0
- package/cjs/transport/startRumBatch.js +33 -0
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.d.ts +2 -0
- package/cjs/transport/startRumEventBridge.js +11 -0
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/esm/boot/preStartRum.d.ts +7 -0
- package/esm/boot/preStartRum.js +187 -0
- package/esm/boot/preStartRum.js.map +1 -0
- package/esm/boot/rumPublicApi.d.ts +409 -0
- package/esm/boot/rumPublicApi.js +165 -0
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/startRum.d.ts +109 -0
- package/esm/boot/startRum.js +149 -0
- package/esm/boot/startRum.js.map +1 -0
- package/esm/browser/cookieObservable.d.ts +8 -0
- package/esm/browser/cookieObservable.js +35 -0
- package/esm/browser/cookieObservable.js.map +1 -0
- package/esm/browser/domMutationObservable.d.ts +27 -0
- package/esm/browser/domMutationObservable.js +54 -0
- package/esm/browser/domMutationObservable.js.map +1 -0
- package/esm/browser/firstInputPolyfill.d.ts +8 -0
- package/esm/browser/firstInputPolyfill.js +65 -0
- package/esm/browser/firstInputPolyfill.js.map +1 -0
- package/esm/browser/htmlDomUtils.d.ts +13 -0
- package/esm/browser/htmlDomUtils.js +36 -0
- package/esm/browser/htmlDomUtils.js.map +1 -0
- package/esm/browser/locationChangeObservable.d.ts +7 -0
- package/esm/browser/locationChangeObservable.js +48 -0
- package/esm/browser/locationChangeObservable.js.map +1 -0
- package/esm/browser/performanceObservable.d.ts +174 -0
- package/esm/browser/performanceObservable.js +121 -0
- package/esm/browser/performanceObservable.js.map +1 -0
- package/esm/browser/performanceUtils.d.ts +7 -0
- package/esm/browser/performanceUtils.js +38 -0
- package/esm/browser/performanceUtils.js.map +1 -0
- package/esm/browser/scroll.d.ts +2 -0
- package/esm/browser/scroll.js +29 -0
- package/esm/browser/scroll.js.map +1 -0
- package/esm/browser/viewportObservable.d.ts +10 -0
- package/esm/browser/viewportObservable.js +32 -0
- package/esm/browser/viewportObservable.js.map +1 -0
- package/esm/browser/windowOpenObservable.d.ts +5 -0
- package/esm/browser/windowOpenObservable.js +7 -0
- package/esm/browser/windowOpenObservable.js.map +1 -0
- package/esm/domain/action/actionCollection.d.ts +21 -0
- package/esm/domain/action/actionCollection.js +93 -0
- package/esm/domain/action/actionCollection.js.map +1 -0
- package/esm/domain/action/actionNameConstants.d.ts +18 -0
- package/esm/domain/action/actionNameConstants.js +8 -0
- package/esm/domain/action/actionNameConstants.js.map +1 -0
- package/esm/domain/action/clickChain.d.ts +8 -0
- package/esm/domain/action/clickChain.js +57 -0
- package/esm/domain/action/clickChain.js.map +1 -0
- package/esm/domain/action/computeFrustration.d.ts +6 -0
- package/esm/domain/action/computeFrustration.js +65 -0
- package/esm/domain/action/computeFrustration.js.map +1 -0
- package/esm/domain/action/getActionNameFromElement.d.ts +4 -0
- package/esm/domain/action/getActionNameFromElement.js +236 -0
- package/esm/domain/action/getActionNameFromElement.js.map +1 -0
- package/esm/domain/action/interactionSelectorCache.d.ts +5 -0
- package/esm/domain/action/interactionSelectorCache.js +18 -0
- package/esm/domain/action/interactionSelectorCache.js.map +1 -0
- package/esm/domain/action/listenActionEvents.d.ts +19 -0
- package/esm/domain/action/listenActionEvents.js +58 -0
- package/esm/domain/action/listenActionEvents.js.map +1 -0
- package/esm/domain/action/trackClickActions.d.ts +81 -0
- package/esm/domain/action/trackClickActions.js +232 -0
- package/esm/domain/action/trackClickActions.js.map +1 -0
- package/esm/domain/assembly.d.ts +5 -0
- package/esm/domain/assembly.js +99 -0
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +325 -0
- package/esm/domain/configuration/configuration.js +200 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +2 -0
- package/esm/domain/configuration/index.js +3 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/jsonPathParser.d.ts +28 -0
- package/esm/domain/configuration/jsonPathParser.js +156 -0
- package/esm/domain/configuration/jsonPathParser.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/esm/domain/configuration/remoteConfiguration.js +236 -0
- package/esm/domain/configuration/remoteConfiguration.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/esm/domain/configuration/remoteConfiguration.types.js +6 -0
- package/esm/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/esm/domain/contexts/ciVisibilityContext.js +30 -0
- package/esm/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/esm/domain/contexts/connectivityContext.d.ts +2 -0
- package/esm/domain/contexts/connectivityContext.js +8 -0
- package/esm/domain/contexts/connectivityContext.js.map +1 -0
- package/esm/domain/contexts/defaultContext.d.ts +4 -0
- package/esm/domain/contexts/defaultContext.js +31 -0
- package/esm/domain/contexts/defaultContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.d.ts +6 -0
- package/esm/domain/contexts/displayContext.js +25 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/featureFlagContext.d.ts +19 -0
- package/esm/domain/contexts/featureFlagContext.js +49 -0
- package/esm/domain/contexts/featureFlagContext.js.map +1 -0
- package/esm/domain/contexts/internalContext.d.ts +12 -0
- package/esm/domain/contexts/internalContext.js +23 -0
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.d.ts +23 -0
- package/esm/domain/contexts/pageStateHistory.js +100 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/sessionContext.d.ts +5 -0
- package/esm/domain/contexts/sessionContext.js +44 -0
- package/esm/domain/contexts/sessionContext.js.map +1 -0
- package/esm/domain/contexts/syntheticsContext.d.ts +2 -0
- package/esm/domain/contexts/syntheticsContext.js +22 -0
- package/esm/domain/contexts/syntheticsContext.js.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/esm/domain/contexts/trackingConsentContext.js +11 -0
- package/esm/domain/contexts/trackingConsentContext.js.map +1 -0
- package/esm/domain/contexts/urlContexts.d.ts +22 -0
- package/esm/domain/contexts/urlContexts.js +60 -0
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/esm/domain/contexts/userAgentDataContext.js +28 -0
- package/esm/domain/contexts/userAgentDataContext.js.map +1 -0
- package/esm/domain/contexts/viewHistory.d.ts +17 -0
- package/esm/domain/contexts/viewHistory.js +44 -0
- package/esm/domain/contexts/viewHistory.js.map +1 -0
- package/esm/domain/discardNegativeDuration.d.ts +2 -0
- package/esm/domain/discardNegativeDuration.js +5 -0
- package/esm/domain/discardNegativeDuration.js.map +1 -0
- package/esm/domain/error/errorCollection.d.ts +17 -0
- package/esm/domain/error/errorCollection.js +70 -0
- package/esm/domain/error/errorCollection.js.map +1 -0
- package/esm/domain/error/trackConsoleError.d.ts +4 -0
- package/esm/domain/error/trackConsoleError.js +10 -0
- package/esm/domain/error/trackConsoleError.js.map +1 -0
- package/esm/domain/error/trackReportError.d.ts +5 -0
- package/esm/domain/error/trackReportError.js +13 -0
- package/esm/domain/error/trackReportError.js.map +1 -0
- package/esm/domain/event/eventCollection.d.ts +10 -0
- package/esm/domain/event/eventCollection.js +24 -0
- package/esm/domain/event/eventCollection.js.map +1 -0
- package/esm/domain/getSelectorFromElement.d.ts +64 -0
- package/esm/domain/getSelectorFromElement.js +213 -0
- package/esm/domain/getSelectorFromElement.js.map +1 -0
- package/esm/domain/getSessionReplayUrl.d.ts +9 -0
- package/esm/domain/getSessionReplayUrl.js +30 -0
- package/esm/domain/getSessionReplayUrl.js.map +1 -0
- package/esm/domain/hooks.d.ts +23 -0
- package/esm/domain/hooks.js +3 -0
- package/esm/domain/hooks.js.map +1 -0
- package/esm/domain/lifeCycle.d.ts +73 -0
- package/esm/domain/lifeCycle.js +3 -0
- package/esm/domain/lifeCycle.js.map +1 -0
- package/esm/domain/limitModification.d.ts +8 -0
- package/esm/domain/limitModification.js +43 -0
- package/esm/domain/limitModification.js.map +1 -0
- package/esm/domain/longTask/longTaskCollection.d.ts +18 -0
- package/esm/domain/longTask/longTaskCollection.js +87 -0
- package/esm/domain/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/plugins.d.ts +40 -0
- package/esm/domain/plugins.js +12 -0
- package/esm/domain/plugins.js.map +1 -0
- package/esm/domain/privacy.d.ts +44 -0
- package/esm/domain/privacy.js +302 -0
- package/esm/domain/privacy.js.map +1 -0
- package/esm/domain/privacyConstants.d.ts +23 -0
- package/esm/domain/privacyConstants.js +35 -0
- package/esm/domain/privacyConstants.js.map +1 -0
- package/esm/domain/requestCollection.d.ts +54 -0
- package/esm/domain/requestCollection.js +106 -0
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/resource/graphql.d.ts +23 -0
- package/esm/domain/resource/graphql.js +91 -0
- package/esm/domain/resource/graphql.js.map +1 -0
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/esm/domain/resource/matchRequestResourceEntry.js +46 -0
- package/esm/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/esm/domain/resource/requestRegistry.d.ts +9 -0
- package/esm/domain/resource/requestRegistry.js +37 -0
- package/esm/domain/resource/requestRegistry.js.map +1 -0
- package/esm/domain/resource/resourceCollection.d.ts +7 -0
- package/esm/domain/resource/resourceCollection.js +187 -0
- package/esm/domain/resource/resourceCollection.js.map +1 -0
- package/esm/domain/resource/resourceUtils.d.ts +55 -0
- package/esm/domain/resource/resourceUtils.js +244 -0
- package/esm/domain/resource/resourceUtils.js.map +1 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +21 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/esm/domain/rumSessionManager.d.ts +36 -0
- package/esm/domain/rumSessionManager.js +72 -0
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/sampler/sampler.d.ts +10 -0
- package/esm/domain/sampler/sampler.js +58 -0
- package/esm/domain/sampler/sampler.js.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/esm/domain/startCustomerDataTelemetry.js +52 -0
- package/esm/domain/startCustomerDataTelemetry.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/esm/domain/tracing/getDocumentTraceId.js +68 -0
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/identifier.d.ts +13 -0
- package/esm/domain/tracing/identifier.js +50 -0
- package/esm/domain/tracing/identifier.js.map +1 -0
- package/esm/domain/tracing/sampler.d.ts +10 -0
- package/esm/domain/tracing/sampler.js +64 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/tracer.d.ts +30 -0
- package/esm/domain/tracing/tracer.js +156 -0
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/tracer.types.d.ts +12 -0
- package/esm/domain/tracing/tracer.types.js +2 -0
- package/esm/domain/tracing/tracer.types.js.map +1 -0
- package/esm/domain/trackEventCounts.d.ts +17 -0
- package/esm/domain/trackEventCounts.js +47 -0
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/view/bfCacheSupport.d.ts +2 -0
- package/esm/domain/view/bfCacheSupport.js +10 -0
- package/esm/domain/view/bfCacheSupport.js.map +1 -0
- package/esm/domain/view/trackViewEventCounts.d.ts +5 -0
- package/esm/domain/view/trackViewEventCounts.js +13 -0
- package/esm/domain/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/view/trackViews.d.ts +65 -0
- package/esm/domain/view/trackViews.js +271 -0
- package/esm/domain/view/trackViews.js.map +1 -0
- package/esm/domain/view/viewCollection.d.ts +18 -0
- package/esm/domain/view/viewCollection.js +150 -0
- package/esm/domain/view/viewCollection.js.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +28 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +39 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +41 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +34 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +130 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +34 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +30 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js +40 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +38 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +149 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +57 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +47 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +40 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +72 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/esm/domain/vital/vitalCollection.d.ts +55 -0
- package/esm/domain/vital/vitalCollection.js +107 -0
- package/esm/domain/vital/vitalCollection.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.d.ts +54 -0
- package/esm/domain/waitPageActivityEnd.js +123 -0
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/domainContext.types.d.ts +39 -0
- package/esm/domainContext.types.js +5 -0
- package/esm/domainContext.types.js.map +1 -0
- package/esm/index.d.ts +41 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/rawRumEvent.types.d.ts +326 -0
- package/esm/rawRumEvent.types.js +31 -0
- package/esm/rawRumEvent.types.js.map +1 -0
- package/esm/rumEvent.types.d.ts +2026 -0
- package/esm/rumEvent.types.js +6 -0
- package/esm/rumEvent.types.js.map +1 -0
- package/esm/transport/formDataTransport.d.ts +16 -0
- package/esm/transport/formDataTransport.js +43 -0
- package/esm/transport/formDataTransport.js.map +1 -0
- package/esm/transport/startRumBatch.d.ts +5 -0
- package/esm/transport/startRumBatch.js +30 -0
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.d.ts +2 -0
- package/esm/transport/startRumEventBridge.js +8 -0
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/package.json +29 -0
- package/src/boot/preStartRum.ts +298 -0
- package/src/boot/rumPublicApi.ts +830 -0
- package/src/boot/startRum.ts +280 -0
- package/src/browser/cookieObservable.ts +63 -0
- package/src/browser/domMutationObservable.ts +98 -0
- package/src/browser/firstInputPolyfill.ts +87 -0
- package/src/browser/htmlDomUtils.ts +45 -0
- package/src/browser/locationChangeObservable.ts +69 -0
- package/src/browser/performanceObservable.ts +324 -0
- package/src/browser/performanceUtils.ts +50 -0
- package/src/browser/scroll.ts +25 -0
- package/src/browser/viewportObservable.ts +44 -0
- package/src/browser/windowOpenObservable.ts +7 -0
- package/src/domain/action/actionCollection.ts +146 -0
- package/src/domain/action/actionNameConstants.ts +20 -0
- package/src/domain/action/clickChain.ts +83 -0
- package/src/domain/action/computeFrustration.ts +77 -0
- package/src/domain/action/getActionNameFromElement.ts +337 -0
- package/src/domain/action/interactionSelectorCache.ts +21 -0
- package/src/domain/action/listenActionEvents.ts +119 -0
- package/src/domain/action/trackClickActions.ts +388 -0
- package/src/domain/assembly.ts +141 -0
- package/src/domain/configuration/configuration.ts +548 -0
- package/src/domain/configuration/index.ts +2 -0
- package/src/domain/configuration/jsonPathParser.ts +214 -0
- package/src/domain/configuration/remoteConfiguration.ts +304 -0
- package/src/domain/configuration/remoteConfiguration.types.ts +147 -0
- package/src/domain/contexts/ciVisibilityContext.ts +50 -0
- package/src/domain/contexts/connectivityContext.ts +12 -0
- package/src/domain/contexts/defaultContext.ts +43 -0
- package/src/domain/contexts/displayContext.ts +38 -0
- package/src/domain/contexts/featureFlagContext.ts +71 -0
- package/src/domain/contexts/internalContext.ts +34 -0
- package/src/domain/contexts/pageStateHistory.ts +171 -0
- package/src/domain/contexts/sessionContext.ts +59 -0
- package/src/domain/contexts/syntheticsContext.ts +33 -0
- package/src/domain/contexts/trackingConsentContext.ts +15 -0
- package/src/domain/contexts/urlContexts.ts +97 -0
- package/src/domain/contexts/userAgentDataContext.ts +36 -0
- package/src/domain/contexts/viewHistory.ts +70 -0
- package/src/domain/discardNegativeDuration.ts +6 -0
- package/src/domain/error/errorCollection.ts +107 -0
- package/src/domain/error/trackConsoleError.ts +14 -0
- package/src/domain/error/trackReportError.ts +16 -0
- package/src/domain/event/eventCollection.ts +53 -0
- package/src/domain/getSelectorFromElement.ts +268 -0
- package/src/domain/getSessionReplayUrl.ts +47 -0
- package/src/domain/hooks.ts +31 -0
- package/src/domain/lifeCycle.ts +103 -0
- package/src/domain/limitModification.ts +66 -0
- package/src/domain/longTask/longTaskCollection.ts +133 -0
- package/src/domain/plugins.ts +59 -0
- package/src/domain/privacy.ts +355 -0
- package/src/domain/privacyConstants.ts +43 -0
- package/src/domain/requestCollection.ts +179 -0
- package/src/domain/resource/graphql.ts +135 -0
- package/src/domain/resource/matchRequestResourceEntry.ts +68 -0
- package/src/domain/resource/requestRegistry.ts +52 -0
- package/src/domain/resource/resourceCollection.ts +273 -0
- package/src/domain/resource/resourceUtils.ts +355 -0
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +27 -0
- package/src/domain/rumSessionManager.ts +134 -0
- package/src/domain/sampler/sampler.ts +63 -0
- package/src/domain/startCustomerDataTelemetry.ts +83 -0
- package/src/domain/tracing/getDocumentTraceId.ts +90 -0
- package/src/domain/tracing/identifier.ts +69 -0
- package/src/domain/tracing/sampler.ts +69 -0
- package/src/domain/tracing/tracer.ts +248 -0
- package/src/domain/tracing/tracer.types.ts +13 -0
- package/src/domain/trackEventCounts.ts +67 -0
- package/src/domain/view/bfCacheSupport.ts +20 -0
- package/src/domain/view/trackViewEventCounts.ts +15 -0
- package/src/domain/view/trackViews.ts +431 -0
- package/src/domain/view/viewCollection.ts +203 -0
- package/src/domain/view/viewMetrics/getClsAttributionImpactedArea.ts +34 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +55 -0
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +70 -0
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +20 -0
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +78 -0
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +180 -0
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +47 -0
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +53 -0
- package/src/domain/view/viewMetrics/trackFirstInput.ts +59 -0
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +66 -0
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +193 -0
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +87 -0
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +69 -0
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +66 -0
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +119 -0
- package/src/domain/vital/vitalCollection.ts +207 -0
- package/src/domain/waitPageActivityEnd.ts +189 -0
- package/src/domainContext.types.ts +61 -0
- package/src/index.ts +76 -0
- package/src/rawRumEvent.types.ts +409 -0
- package/src/rumEvent.types.ts +2151 -0
- package/src/transport/formDataTransport.ts +85 -0
- package/src/transport/startRumBatch.ts +46 -0
- package/src/transport/startRumEventBridge.ts +12 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* performance.interactionCount polyfill
|
|
4
|
+
*
|
|
5
|
+
* The interactionCount is an integer which counts the total number of distinct user interactions,
|
|
6
|
+
* for which there was a unique interactionId.
|
|
7
|
+
*
|
|
8
|
+
* The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213
|
|
9
|
+
* This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.
|
|
10
|
+
* Hopefully when/if other browsers will support INP, they will also implement performance.interactionCount at the same time, so we won't need that polyfill.
|
|
11
|
+
*
|
|
12
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getInteractionCount = void 0;
|
|
16
|
+
exports.initInteractionCountPolyfill = initInteractionCountPolyfill;
|
|
17
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
18
|
+
let observer;
|
|
19
|
+
let interactionCountEstimate = 0;
|
|
20
|
+
let minKnownInteractionId = Infinity;
|
|
21
|
+
let maxKnownInteractionId = 0;
|
|
22
|
+
function initInteractionCountPolyfill() {
|
|
23
|
+
if ('interactionCount' in performance || observer) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
observer = new window.PerformanceObserver((0, kubesense_browser_core_1.monitor)((entries) => {
|
|
27
|
+
entries.getEntries().forEach((e) => {
|
|
28
|
+
const entry = e;
|
|
29
|
+
if (entry.interactionId) {
|
|
30
|
+
minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId);
|
|
31
|
+
maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId);
|
|
32
|
+
interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}));
|
|
36
|
+
observer.observe({ type: 'event', buffered: true, durationThreshold: 0 });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the `interactionCount` value using the native API (if available)
|
|
40
|
+
* or the polyfill estimate in this module.
|
|
41
|
+
*/
|
|
42
|
+
const getInteractionCount = () => observer ? interactionCountEstimate : window.performance.interactionCount || 0;
|
|
43
|
+
exports.getInteractionCount = getInteractionCount;
|
|
44
|
+
//# sourceMappingURL=interactionCountPolyfill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionCountPolyfill.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/interactionCountPolyfill.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAeH,oEAqBC;AAlCD,8EAA2D;AAO3D,IAAI,QAA4C,CAAA;AAEhD,IAAI,wBAAwB,GAAG,CAAC,CAAA;AAChC,IAAI,qBAAqB,GAAG,QAAQ,CAAA;AACpC,IAAI,qBAAqB,GAAG,CAAC,CAAA;AAE7B,SAAgB,4BAA4B;IAC1C,IAAI,kBAAkB,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;QAClD,OAAM;IACR,CAAC;IAED,QAAQ,GAAG,IAAK,MAAwB,CAAC,mBAAmB,CAC1D,IAAA,gCAAO,EAAC,CAAC,OAAqC,EAAE,EAAE;QAChD,OAAO,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACjC,MAAM,KAAK,GAAG,CAAyC,CAAA;YAEvD,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;gBACxB,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;gBAC5E,qBAAqB,GAAG,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAA;gBAE5E,wBAAwB,GAAG,CAAC,qBAAqB,GAAG,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACpF,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;IAED,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAA;AAC3E,CAAC;AAED;;;GAGG;AACI,MAAM,mBAAmB,GAAG,GAAG,EAAE,CACtC,QAAQ,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAE,MAAwB,CAAC,WAAW,CAAC,gBAAiB,IAAI,CAAC,CAAA;AADvF,QAAA,mBAAmB,uBACoE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Telemetry } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import { noop } from '@kubesense/kubesense-browser-core';
|
|
3
|
+
import type { LifeCycle } from '../../lifeCycle';
|
|
4
|
+
export declare function startInitialViewMetricsTelemetry(lifeCycle: LifeCycle, telemetry: Telemetry): {
|
|
5
|
+
stop: typeof noop;
|
|
6
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startInitialViewMetricsTelemetry = startInitialViewMetricsTelemetry;
|
|
4
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
5
|
+
function startInitialViewMetricsTelemetry(lifeCycle, telemetry) {
|
|
6
|
+
if (!telemetry.metricsEnabled) {
|
|
7
|
+
return { stop: kubesense_browser_core_1.noop };
|
|
8
|
+
}
|
|
9
|
+
const { unsubscribe } = lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_UPDATED */, ({ initialViewMetrics }) => {
|
|
10
|
+
if (!initialViewMetrics.largestContentfulPaint || !initialViewMetrics.navigationTimings) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// The navigation timings become available shortly after the load event fires, so
|
|
14
|
+
// we're snapshotting the LCP value available at that point. However, more LCP values
|
|
15
|
+
// can be emitted until the page is scrolled or interacted with, so it's possible that
|
|
16
|
+
// the final LCP value may differ. These metrics are intended to help diagnose
|
|
17
|
+
// performance issues early in the page load process, and using LCP-at-page-load is a
|
|
18
|
+
// good fit for that use case, but it's important to be aware that this is not
|
|
19
|
+
// necessarily equivalent to the normal LCP metric.
|
|
20
|
+
// monitor-until: 2026-07-01
|
|
21
|
+
(0, kubesense_browser_core_1.addTelemetryMetrics)("Initial view metrics" /* TelemetryMetrics.INITIAL_VIEW_METRICS_TELEMETRY_NAME */, {
|
|
22
|
+
metrics: createCoreInitialViewMetrics(initialViewMetrics.largestContentfulPaint, initialViewMetrics.navigationTimings),
|
|
23
|
+
});
|
|
24
|
+
unsubscribe();
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
stop: unsubscribe,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function createCoreInitialViewMetrics(lcp, navigation) {
|
|
31
|
+
return {
|
|
32
|
+
lcp: {
|
|
33
|
+
value: lcp.value,
|
|
34
|
+
},
|
|
35
|
+
navigation: {
|
|
36
|
+
domComplete: navigation.domComplete,
|
|
37
|
+
domContentLoaded: navigation.domContentLoaded,
|
|
38
|
+
domInteractive: navigation.domInteractive,
|
|
39
|
+
firstByte: navigation.firstByte,
|
|
40
|
+
loadEvent: navigation.loadEvent,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=startInitialViewMetricsTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startInitialViewMetricsTelemetry.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts"],"names":[],"mappings":";;AAoBA,4EA+BC;AAlDD,8EAA+F;AAmB/F,SAAgB,gCAAgC,CAAC,SAAoB,EAAE,SAAoB;IACzF,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,6BAAI,EAAE,CAAA;IACvB,CAAC;IAED,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC,SAAS,0CAAkC,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE;QACtG,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,CAAC;YACxF,OAAM;QACR,CAAC;QAED,iFAAiF;QACjF,qFAAqF;QACrF,sFAAsF;QACtF,8EAA8E;QAC9E,qFAAqF;QACrF,8EAA8E;QAC9E,mDAAmD;QACnD,4BAA4B;QAC5B,IAAA,4CAAmB,qFAAuD;YACxE,OAAO,EAAE,4BAA4B,CACnC,kBAAkB,CAAC,sBAAsB,EACzC,kBAAkB,CAAC,iBAAiB,CACrC;SACF,CAAC,CAAA;QAEF,WAAW,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,WAAW;KAClB,CAAA;AACH,CAAC;AAED,SAAS,4BAA4B,CACnC,GAA2B,EAC3B,UAA6B;IAE7B,OAAO;QACL,GAAG,EAAE;YACH,KAAK,EAAE,GAAG,CAAC,KAAK;SACjB;QACD,UAAU,EAAE;YACV,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;YAC7C,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;SAChC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClocksState } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { InitialViewMetrics } from './trackInitialViewMetrics';
|
|
3
|
+
/**
|
|
4
|
+
* BFCache keeps a full in-memory snapshot of the DOM. When the page is restored, nothing needs to be fetched, so the whole
|
|
5
|
+
* viewport repaints in a single frame. Consequently, LCP almost always equals FCP.
|
|
6
|
+
* (See: https://github.com/GoogleChrome/web-vitals/pull/87)
|
|
7
|
+
*/
|
|
8
|
+
export declare function trackBfcacheMetrics(viewStart: ClocksState, metrics: InitialViewMetrics, scheduleViewUpdate: () => void): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackBfcacheMetrics = trackBfcacheMetrics;
|
|
4
|
+
const trackFirstContentfulPaint_1 = require("./trackFirstContentfulPaint");
|
|
5
|
+
/**
|
|
6
|
+
* BFCache keeps a full in-memory snapshot of the DOM. When the page is restored, nothing needs to be fetched, so the whole
|
|
7
|
+
* viewport repaints in a single frame. Consequently, LCP almost always equals FCP.
|
|
8
|
+
* (See: https://github.com/GoogleChrome/web-vitals/pull/87)
|
|
9
|
+
*/
|
|
10
|
+
function trackBfcacheMetrics(viewStart, metrics, scheduleViewUpdate) {
|
|
11
|
+
(0, trackFirstContentfulPaint_1.trackRestoredFirstContentfulPaint)(viewStart.relative, (paintTime) => {
|
|
12
|
+
metrics.firstContentfulPaint = paintTime;
|
|
13
|
+
metrics.largestContentfulPaint = { value: paintTime };
|
|
14
|
+
scheduleViewUpdate();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=trackBfcacheMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackBfcacheMetrics.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackBfcacheMetrics.ts"],"names":[],"mappings":";;AASA,kDAUC;AAjBD,2EAA+E;AAE/E;;;;GAIG;AACH,SAAgB,mBAAmB,CACjC,SAAsB,EACtB,OAA2B,EAC3B,kBAA8B;IAE9B,IAAA,6DAAiC,EAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE;QAClE,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAA;QACxC,OAAO,CAAC,sBAAsB,GAAG,EAAE,KAAK,EAAE,SAAyB,EAAE,CAAA;QACrE,kBAAkB,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ClocksState, Duration, Observable } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { ViewLoadingType } from '../../../rawRumEvent.types';
|
|
3
|
+
import type { RumConfiguration } from '../../configuration';
|
|
4
|
+
import type { LifeCycle } from '../../lifeCycle';
|
|
5
|
+
import type { RumMutationRecord } from '../../../browser/domMutationObservable';
|
|
6
|
+
import type { CumulativeLayoutShift } from './trackCumulativeLayoutShift';
|
|
7
|
+
import type { InteractionToNextPaint } from './trackInteractionToNextPaint';
|
|
8
|
+
import type { ScrollMetrics } from './trackScrollMetrics';
|
|
9
|
+
export interface CommonViewMetrics {
|
|
10
|
+
loadingTime?: Duration;
|
|
11
|
+
cumulativeLayoutShift?: CumulativeLayoutShift;
|
|
12
|
+
interactionToNextPaint?: InteractionToNextPaint;
|
|
13
|
+
scroll?: ScrollMetrics;
|
|
14
|
+
}
|
|
15
|
+
export declare function trackCommonViewMetrics(lifeCycle: LifeCycle, domMutationObservable: Observable<RumMutationRecord[]>, windowOpenObservable: Observable<void>, configuration: RumConfiguration, scheduleViewUpdate: () => void, loadingType: ViewLoadingType, viewStart: ClocksState): {
|
|
16
|
+
stop: () => void;
|
|
17
|
+
stopINPTracking: () => void;
|
|
18
|
+
setLoadEvent: (loadEvent: Duration) => void;
|
|
19
|
+
setViewEnd: (viewEndTime: import("@kubesense/kubesense-browser-core").RelativeTime) => void;
|
|
20
|
+
getCommonViewMetrics: () => CommonViewMetrics;
|
|
21
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackCommonViewMetrics = trackCommonViewMetrics;
|
|
4
|
+
const trackCumulativeLayoutShift_1 = require("./trackCumulativeLayoutShift");
|
|
5
|
+
const trackInteractionToNextPaint_1 = require("./trackInteractionToNextPaint");
|
|
6
|
+
const trackLoadingTime_1 = require("./trackLoadingTime");
|
|
7
|
+
const trackScrollMetrics_1 = require("./trackScrollMetrics");
|
|
8
|
+
function trackCommonViewMetrics(lifeCycle, domMutationObservable, windowOpenObservable, configuration, scheduleViewUpdate, loadingType, viewStart) {
|
|
9
|
+
const commonViewMetrics = {};
|
|
10
|
+
const { stop: stopLoadingTimeTracking, setLoadEvent } = (0, trackLoadingTime_1.trackLoadingTime)(lifeCycle, domMutationObservable, windowOpenObservable, configuration, loadingType, viewStart, (newLoadingTime) => {
|
|
11
|
+
commonViewMetrics.loadingTime = newLoadingTime;
|
|
12
|
+
scheduleViewUpdate();
|
|
13
|
+
});
|
|
14
|
+
const { stop: stopScrollMetricsTracking } = (0, trackScrollMetrics_1.trackScrollMetrics)(configuration, viewStart, (newScrollMetrics) => {
|
|
15
|
+
commonViewMetrics.scroll = newScrollMetrics;
|
|
16
|
+
});
|
|
17
|
+
const { stop: stopCLSTracking } = (0, trackCumulativeLayoutShift_1.trackCumulativeLayoutShift)(configuration, viewStart.relative, (cumulativeLayoutShift) => {
|
|
18
|
+
commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift;
|
|
19
|
+
scheduleViewUpdate();
|
|
20
|
+
});
|
|
21
|
+
const { stop: stopINPTracking, getInteractionToNextPaint, setViewEnd, } = (0, trackInteractionToNextPaint_1.trackInteractionToNextPaint)(configuration, viewStart.relative, loadingType);
|
|
22
|
+
return {
|
|
23
|
+
stop: () => {
|
|
24
|
+
stopLoadingTimeTracking();
|
|
25
|
+
stopCLSTracking();
|
|
26
|
+
stopScrollMetricsTracking();
|
|
27
|
+
},
|
|
28
|
+
stopINPTracking,
|
|
29
|
+
setLoadEvent,
|
|
30
|
+
setViewEnd,
|
|
31
|
+
getCommonViewMetrics: () => {
|
|
32
|
+
commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();
|
|
33
|
+
return commonViewMetrics;
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=trackCommonViewMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackCommonViewMetrics.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackCommonViewMetrics.ts"],"names":[],"mappings":";;AAoBA,wDAyDC;AAvED,6EAAyE;AAEzE,+EAA2E;AAC3E,yDAAqD;AAErD,6DAAyD;AASzD,SAAgB,sBAAsB,CACpC,SAAoB,EACpB,qBAAsD,EACtD,oBAAsC,EACtC,aAA+B,EAC/B,kBAA8B,EAC9B,WAA4B,EAC5B,SAAsB;IAEtB,MAAM,iBAAiB,GAAsB,EAAE,CAAA;IAE/C,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,YAAY,EAAE,GAAG,IAAA,mCAAgB,EACtE,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,SAAS,EACT,CAAC,cAAc,EAAE,EAAE;QACjB,iBAAiB,CAAC,WAAW,GAAG,cAAc,CAAA;QAC9C,kBAAkB,EAAE,CAAA;IACtB,CAAC,CACF,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,IAAA,uCAAkB,EAAC,aAAa,EAAE,SAAS,EAAE,CAAC,gBAAgB,EAAE,EAAE;QAC5G,iBAAiB,CAAC,MAAM,GAAG,gBAAgB,CAAA;IAC7C,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,IAAA,uDAA0B,EAC1D,aAAa,EACb,SAAS,CAAC,QAAQ,EAClB,CAAC,qBAAqB,EAAE,EAAE;QACxB,iBAAiB,CAAC,qBAAqB,GAAG,qBAAqB,CAAA;QAC/D,kBAAkB,EAAE,CAAA;IACtB,CAAC,CACF,CAAA;IAED,MAAM,EACJ,IAAI,EAAE,eAAe,EACrB,yBAAyB,EACzB,UAAU,GACX,GAAG,IAAA,yDAA2B,EAAC,aAAa,EAAE,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;IAE/E,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,uBAAuB,EAAE,CAAA;YACzB,eAAe,EAAE,CAAA;YACjB,yBAAyB,EAAE,CAAA;QAC7B,CAAC;QACD,eAAe;QACf,YAAY;QACZ,UAAU;QACV,oBAAoB,EAAE,GAAG,EAAE;YACzB,iBAAiB,CAAC,sBAAsB,GAAG,yBAAyB,EAAE,CAAA;YACtE,OAAO,iBAAiB,CAAA;QAC1B,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { noop } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core';
|
|
3
|
+
import type { RumConfiguration } from '../../configuration';
|
|
4
|
+
import type { RumRect } from '../../../rumEvent.types';
|
|
5
|
+
export interface CumulativeLayoutShift {
|
|
6
|
+
value: number;
|
|
7
|
+
targetSelector?: string;
|
|
8
|
+
time?: Duration;
|
|
9
|
+
previousRect?: RumRect;
|
|
10
|
+
currentRect?: RumRect;
|
|
11
|
+
devicePixelRatio?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Track the cumulative layout shifts (CLS).
|
|
15
|
+
* Layout shifts are grouped into session windows.
|
|
16
|
+
* The minimum gap between session windows is 1 second.
|
|
17
|
+
* The maximum duration of a session window is 5 second.
|
|
18
|
+
* The session window layout shift value is the sum of layout shifts inside it.
|
|
19
|
+
* The CLS value is the max of session windows values.
|
|
20
|
+
*
|
|
21
|
+
* This yields a new value whenever the CLS value is updated (a higher session window value is computed).
|
|
22
|
+
*
|
|
23
|
+
* See isLayoutShiftSupported to check for browser support.
|
|
24
|
+
*
|
|
25
|
+
* Documentation:
|
|
26
|
+
* https://web.dev/cls/
|
|
27
|
+
* https://web.dev/evolving-cls/
|
|
28
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts
|
|
29
|
+
*/
|
|
30
|
+
export declare function trackCumulativeLayoutShift(configuration: RumConfiguration, viewStart: RelativeTime, callback: (cumulativeLayoutShift: CumulativeLayoutShift) => void): {
|
|
31
|
+
stop: typeof noop;
|
|
32
|
+
};
|
|
33
|
+
export declare const MAX_WINDOW_DURATION: number;
|
|
34
|
+
/**
|
|
35
|
+
* Check whether `layout-shift` is supported by the browser.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isLayoutShiftSupported(): boolean;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_WINDOW_DURATION = void 0;
|
|
4
|
+
exports.trackCumulativeLayoutShift = trackCumulativeLayoutShift;
|
|
5
|
+
exports.isLayoutShiftSupported = isLayoutShiftSupported;
|
|
6
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
7
|
+
const htmlDomUtils_1 = require("../../../browser/htmlDomUtils");
|
|
8
|
+
const performanceObservable_1 = require("../../../browser/performanceObservable");
|
|
9
|
+
const getSelectorFromElement_1 = require("../../getSelectorFromElement");
|
|
10
|
+
const getClsAttributionImpactedArea_1 = require("./getClsAttributionImpactedArea");
|
|
11
|
+
/**
|
|
12
|
+
* Track the cumulative layout shifts (CLS).
|
|
13
|
+
* Layout shifts are grouped into session windows.
|
|
14
|
+
* The minimum gap between session windows is 1 second.
|
|
15
|
+
* The maximum duration of a session window is 5 second.
|
|
16
|
+
* The session window layout shift value is the sum of layout shifts inside it.
|
|
17
|
+
* The CLS value is the max of session windows values.
|
|
18
|
+
*
|
|
19
|
+
* This yields a new value whenever the CLS value is updated (a higher session window value is computed).
|
|
20
|
+
*
|
|
21
|
+
* See isLayoutShiftSupported to check for browser support.
|
|
22
|
+
*
|
|
23
|
+
* Documentation:
|
|
24
|
+
* https://web.dev/cls/
|
|
25
|
+
* https://web.dev/evolving-cls/
|
|
26
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts
|
|
27
|
+
*/
|
|
28
|
+
function trackCumulativeLayoutShift(configuration, viewStart, callback) {
|
|
29
|
+
if (!isLayoutShiftSupported()) {
|
|
30
|
+
return {
|
|
31
|
+
stop: kubesense_browser_core_1.noop,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let maxClsValue = 0;
|
|
35
|
+
let biggestShift;
|
|
36
|
+
// if no layout shift happen the value should be reported as 0
|
|
37
|
+
callback({
|
|
38
|
+
value: 0,
|
|
39
|
+
});
|
|
40
|
+
const slidingWindow = slidingSessionWindow();
|
|
41
|
+
const performanceSubscription = (0, performanceObservable_1.createPerformanceObservable)(configuration, {
|
|
42
|
+
type: performanceObservable_1.RumPerformanceEntryType.LAYOUT_SHIFT,
|
|
43
|
+
buffered: true,
|
|
44
|
+
}).subscribe((entries) => {
|
|
45
|
+
var _a;
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
if (entry.hadRecentInput || entry.startTime < viewStart) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
const { cumulatedValue, isMaxValue } = slidingWindow.update(entry);
|
|
51
|
+
if (isMaxValue) {
|
|
52
|
+
const attribution = getTopImpactedElement(entry.sources);
|
|
53
|
+
biggestShift = {
|
|
54
|
+
target: (attribution === null || attribution === void 0 ? void 0 : attribution.node) ? new WeakRef(attribution.node) : undefined,
|
|
55
|
+
time: (0, kubesense_browser_core_1.elapsed)(viewStart, entry.startTime),
|
|
56
|
+
previousRect: attribution === null || attribution === void 0 ? void 0 : attribution.previousRect,
|
|
57
|
+
currentRect: attribution === null || attribution === void 0 ? void 0 : attribution.currentRect,
|
|
58
|
+
devicePixelRatio: window.devicePixelRatio,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (cumulatedValue > maxClsValue) {
|
|
62
|
+
maxClsValue = cumulatedValue;
|
|
63
|
+
const target = (_a = biggestShift === null || biggestShift === void 0 ? void 0 : biggestShift.target) === null || _a === void 0 ? void 0 : _a.deref();
|
|
64
|
+
callback({
|
|
65
|
+
value: (0, kubesense_browser_core_1.round)(maxClsValue, 4),
|
|
66
|
+
targetSelector: target && (0, getSelectorFromElement_1.getSelectorFromElement)(target, configuration.actionNameAttribute),
|
|
67
|
+
time: biggestShift === null || biggestShift === void 0 ? void 0 : biggestShift.time,
|
|
68
|
+
previousRect: (biggestShift === null || biggestShift === void 0 ? void 0 : biggestShift.previousRect) ? asRumRect(biggestShift.previousRect) : undefined,
|
|
69
|
+
currentRect: (biggestShift === null || biggestShift === void 0 ? void 0 : biggestShift.currentRect) ? asRumRect(biggestShift.currentRect) : undefined,
|
|
70
|
+
devicePixelRatio: biggestShift === null || biggestShift === void 0 ? void 0 : biggestShift.devicePixelRatio,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
stop: () => {
|
|
77
|
+
performanceSubscription.unsubscribe();
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function getTopImpactedElement(sources) {
|
|
82
|
+
let topImpactedSource;
|
|
83
|
+
for (const source of sources) {
|
|
84
|
+
if (source.node && (0, htmlDomUtils_1.isElementNode)(source.node)) {
|
|
85
|
+
const currentImpactedArea = (0, getClsAttributionImpactedArea_1.getClsAttributionImpactedArea)(source);
|
|
86
|
+
if (!topImpactedSource || (0, getClsAttributionImpactedArea_1.getClsAttributionImpactedArea)(topImpactedSource) < currentImpactedArea) {
|
|
87
|
+
topImpactedSource = source;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return topImpactedSource;
|
|
92
|
+
}
|
|
93
|
+
function asRumRect({ x, y, width, height }) {
|
|
94
|
+
return { x, y, width, height };
|
|
95
|
+
}
|
|
96
|
+
exports.MAX_WINDOW_DURATION = 5 * kubesense_browser_core_1.ONE_SECOND;
|
|
97
|
+
const MAX_UPDATE_GAP = kubesense_browser_core_1.ONE_SECOND;
|
|
98
|
+
function slidingSessionWindow() {
|
|
99
|
+
let cumulatedValue = 0;
|
|
100
|
+
let startTime;
|
|
101
|
+
let endTime;
|
|
102
|
+
let maxValue = 0;
|
|
103
|
+
return {
|
|
104
|
+
update: (entry) => {
|
|
105
|
+
const shouldCreateNewWindow = startTime === undefined ||
|
|
106
|
+
entry.startTime - endTime >= MAX_UPDATE_GAP ||
|
|
107
|
+
entry.startTime - startTime >= exports.MAX_WINDOW_DURATION;
|
|
108
|
+
let isMaxValue;
|
|
109
|
+
if (shouldCreateNewWindow) {
|
|
110
|
+
startTime = endTime = entry.startTime;
|
|
111
|
+
maxValue = cumulatedValue = entry.value;
|
|
112
|
+
isMaxValue = true;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
cumulatedValue += entry.value;
|
|
116
|
+
endTime = entry.startTime;
|
|
117
|
+
isMaxValue = entry.value > maxValue;
|
|
118
|
+
if (isMaxValue) {
|
|
119
|
+
maxValue = entry.value;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
cumulatedValue,
|
|
124
|
+
isMaxValue,
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check whether `layout-shift` is supported by the browser.
|
|
131
|
+
*/
|
|
132
|
+
function isLayoutShiftSupported() {
|
|
133
|
+
return (0, performanceObservable_1.supportPerformanceTimingEvent)(performanceObservable_1.RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=trackCumulativeLayoutShift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackCumulativeLayoutShift.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts"],"names":[],"mappings":";;;AAkDA,gEA+DC;AAgED,wDAEC;AAnLD,8EAAoF;AAEpF,gEAA6D;AAE7D,kFAI+C;AAC/C,yEAAqE;AAGrE,mFAA+E;AAqB/E;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,0BAA0B,CACxC,aAA+B,EAC/B,SAAuB,EACvB,QAAgE;IAEhE,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC;QAC9B,OAAO;YACL,IAAI,EAAE,6BAAI;SACX,CAAA;IACH,CAAC;IAED,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,YAA6C,CAAA;IAEjD,8DAA8D;IAC9D,QAAQ,CAAC;QACP,KAAK,EAAE,CAAC;KACT,CAAC,CAAA;IAEF,MAAM,aAAa,GAAG,oBAAoB,EAAE,CAAA;IAC5C,MAAM,uBAAuB,GAAG,IAAA,mDAA2B,EAAC,aAAa,EAAE;QACzE,IAAI,EAAE,+CAAuB,CAAC,YAAY;QAC1C,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;;QACvB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;gBACxD,SAAQ;YACV,CAAC;YAED,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAElE,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,WAAW,GAAG,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBACxD,YAAY,GAAG;oBACb,MAAM,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAC,CAAC,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;oBACrE,IAAI,EAAE,IAAA,gCAAO,EAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;oBACzC,YAAY,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,YAAY;oBACvC,WAAW,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW;oBACrC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;iBAC1C,CAAA;YACH,CAAC;YAED,IAAI,cAAc,GAAG,WAAW,EAAE,CAAC;gBACjC,WAAW,GAAG,cAAc,CAAA;gBAC5B,MAAM,MAAM,GAAG,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,0CAAE,KAAK,EAAE,CAAA;gBAE5C,QAAQ,CAAC;oBACP,KAAK,EAAE,IAAA,8BAAK,EAAC,WAAW,EAAE,CAAC,CAAC;oBAC5B,cAAc,EAAE,MAAM,IAAI,IAAA,+CAAsB,EAAC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC;oBAC3F,IAAI,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI;oBACxB,YAAY,EAAE,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,EAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;oBAC3F,WAAW,EAAE,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,WAAW,EAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;oBACxF,gBAAgB,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,gBAAgB;iBACjD,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,uBAAuB,CAAC,WAAW,EAAE,CAAA;QACvC,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAS,qBAAqB,CAC5B,OAAoC;IAEpC,IAAI,iBAA8E,CAAA;IAClF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,IAAI,IAAI,IAAA,4BAAa,EAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,mBAAmB,GAAG,IAAA,6DAA6B,EAAC,MAAM,CAAC,CAAA;YACjE,IAAI,CAAC,iBAAiB,IAAI,IAAA,6DAA6B,EAAC,iBAAiB,CAAC,GAAG,mBAAmB,EAAE,CAAC;gBACjG,iBAAiB,GAAG,MAAuD,CAAA;YAC7E,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAmB;IACzD,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;AAChC,CAAC;AAEY,QAAA,mBAAmB,GAAG,CAAC,GAAG,mCAAU,CAAA;AACjD,MAAM,cAAc,GAAG,mCAAU,CAAA;AAEjC,SAAS,oBAAoB;IAC3B,IAAI,cAAc,GAAG,CAAC,CAAA;IACtB,IAAI,SAAuB,CAAA;IAC3B,IAAI,OAAqB,CAAA;IACzB,IAAI,QAAQ,GAAG,CAAC,CAAA;IAEhB,OAAO;QACL,MAAM,EAAE,CAAC,KAA2B,EAAE,EAAE;YACtC,MAAM,qBAAqB,GACzB,SAAS,KAAK,SAAS;gBACvB,KAAK,CAAC,SAAS,GAAG,OAAO,IAAI,cAAc;gBAC3C,KAAK,CAAC,SAAS,GAAG,SAAS,IAAI,2BAAmB,CAAA;YAEpD,IAAI,UAAmB,CAAA;YAEvB,IAAI,qBAAqB,EAAE,CAAC;gBAC1B,SAAS,GAAG,OAAO,GAAG,KAAK,CAAC,SAAS,CAAA;gBACrC,QAAQ,GAAG,cAAc,GAAG,KAAK,CAAC,KAAK,CAAA;gBACvC,UAAU,GAAG,IAAI,CAAA;YACnB,CAAC;iBAAM,CAAC;gBACN,cAAc,IAAI,KAAK,CAAC,KAAK,CAAA;gBAC7B,OAAO,GAAG,KAAK,CAAC,SAAS,CAAA;gBACzB,UAAU,GAAG,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAA;gBAEnC,IAAI,UAAU,EAAE,CAAC;oBACf,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAA;gBACxB,CAAC;YACH,CAAC;YAED,OAAO;gBACL,cAAc;gBACd,UAAU;aACX,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,sBAAsB;IACpC,OAAO,IAAA,qDAA6B,EAAC,+CAAuB,CAAC,YAAY,CAAC,IAAI,SAAS,IAAI,MAAM,CAAA;AACnG,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { RumConfiguration } from '../../configuration';
|
|
3
|
+
import type { FirstHidden } from './trackFirstHidden';
|
|
4
|
+
export declare const FCP_MAXIMUM_DELAY: number;
|
|
5
|
+
export declare function trackFirstContentfulPaint(configuration: RumConfiguration, firstHidden: FirstHidden, callback: (fcpTiming: RelativeTime) => void): {
|
|
6
|
+
stop: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Measure the First Contentful Paint after a BFCache restoration.
|
|
10
|
+
* The DOM is restored synchronously, so we approximate the FCP with the first frame
|
|
11
|
+
* rendered just after the pageshow event, using two nested requestAnimationFrame calls.
|
|
12
|
+
*/
|
|
13
|
+
export declare function trackRestoredFirstContentfulPaint(viewStartRelative: RelativeTime, callback: (fcp: Duration) => void): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FCP_MAXIMUM_DELAY = void 0;
|
|
4
|
+
exports.trackFirstContentfulPaint = trackFirstContentfulPaint;
|
|
5
|
+
exports.trackRestoredFirstContentfulPaint = trackRestoredFirstContentfulPaint;
|
|
6
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
7
|
+
const performanceObservable_1 = require("../../../browser/performanceObservable");
|
|
8
|
+
// Discard FCP timings above a certain delay to avoid incorrect data
|
|
9
|
+
// It happens in some cases like sleep mode or some browser implementations
|
|
10
|
+
exports.FCP_MAXIMUM_DELAY = 10 * kubesense_browser_core_1.ONE_MINUTE;
|
|
11
|
+
function trackFirstContentfulPaint(configuration, firstHidden, callback) {
|
|
12
|
+
const performanceSubscription = (0, performanceObservable_1.createPerformanceObservable)(configuration, {
|
|
13
|
+
type: performanceObservable_1.RumPerformanceEntryType.PAINT,
|
|
14
|
+
buffered: true,
|
|
15
|
+
}).subscribe((entries) => {
|
|
16
|
+
const fcpEntry = entries.find((entry) => entry.name === 'first-contentful-paint' &&
|
|
17
|
+
entry.startTime < firstHidden.timeStamp &&
|
|
18
|
+
entry.startTime < exports.FCP_MAXIMUM_DELAY);
|
|
19
|
+
if (fcpEntry) {
|
|
20
|
+
callback(fcpEntry.startTime);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
stop: performanceSubscription.unsubscribe,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Measure the First Contentful Paint after a BFCache restoration.
|
|
29
|
+
* The DOM is restored synchronously, so we approximate the FCP with the first frame
|
|
30
|
+
* rendered just after the pageshow event, using two nested requestAnimationFrame calls.
|
|
31
|
+
*/
|
|
32
|
+
function trackRestoredFirstContentfulPaint(viewStartRelative, callback) {
|
|
33
|
+
requestAnimationFrame(() => {
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
callback((0, kubesense_browser_core_1.elapsed)(viewStartRelative, (0, kubesense_browser_core_1.relativeNow)()));
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=trackFirstContentfulPaint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackFirstContentfulPaint.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackFirstContentfulPaint.ts"],"names":[],"mappings":";;;AAWA,8DAsBC;AAOD,8EAMC;AA7CD,8EAAoF;AAEpF,kFAA6G;AAI7G,oEAAoE;AACpE,2EAA2E;AAC9D,QAAA,iBAAiB,GAAG,EAAE,GAAG,mCAAU,CAAA;AAEhD,SAAgB,yBAAyB,CACvC,aAA+B,EAC/B,WAAwB,EACxB,QAA2C;IAE3C,MAAM,uBAAuB,GAAG,IAAA,mDAA2B,EAAC,aAAa,EAAE;QACzE,IAAI,EAAE,+CAAuB,CAAC,KAAK;QACnC,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,KAAK,EAAsC,EAAE,CAC5C,KAAK,CAAC,IAAI,KAAK,wBAAwB;YACvC,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS;YACvC,KAAK,CAAC,SAAS,GAAG,yBAAiB,CACtC,CAAA;QACD,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO;QACL,IAAI,EAAE,uBAAuB,CAAC,WAAW;KAC1C,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,iCAAiC,CAAC,iBAA+B,EAAE,QAAiC;IAClH,qBAAqB,CAAC,GAAG,EAAE;QACzB,qBAAqB,CAAC,GAAG,EAAE;YACzB,QAAQ,CAAC,IAAA,gCAAO,EAAC,iBAAiB,EAAE,IAAA,oCAAW,GAAE,CAAC,CAAC,CAAA;QACrD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClocksState, RelativeTime } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { RumConfiguration } from '../../configuration';
|
|
3
|
+
export type FirstHidden = ReturnType<typeof trackFirstHidden>;
|
|
4
|
+
export interface Options {
|
|
5
|
+
viewStart: ClocksState;
|
|
6
|
+
}
|
|
7
|
+
export declare function trackFirstHidden(configuration: RumConfiguration, viewStart: ClocksState, eventTarget?: Window): {
|
|
8
|
+
readonly timeStamp: RelativeTime;
|
|
9
|
+
stop: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackFirstHidden = trackFirstHidden;
|
|
4
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
5
|
+
const performanceObservable_1 = require("../../../browser/performanceObservable");
|
|
6
|
+
function trackFirstHidden(configuration, viewStart, eventTarget = window) {
|
|
7
|
+
if (document.visibilityState === 'hidden') {
|
|
8
|
+
return { timeStamp: 0, stop: kubesense_browser_core_1.noop };
|
|
9
|
+
}
|
|
10
|
+
if ((0, performanceObservable_1.supportPerformanceTimingEvent)(performanceObservable_1.RumPerformanceEntryType.VISIBILITY_STATE)) {
|
|
11
|
+
const firstHiddenEntry = performance
|
|
12
|
+
.getEntriesByType(performanceObservable_1.RumPerformanceEntryType.VISIBILITY_STATE)
|
|
13
|
+
.filter((entry) => entry.name === 'hidden')
|
|
14
|
+
.find((entry) => entry.startTime >= viewStart.relative);
|
|
15
|
+
if (firstHiddenEntry) {
|
|
16
|
+
return { timeStamp: firstHiddenEntry.startTime, stop: kubesense_browser_core_1.noop };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
let timeStamp = Infinity;
|
|
20
|
+
const { stop } = (0, kubesense_browser_core_1.addEventListeners)(configuration, eventTarget, ["pagehide" /* DOM_EVENT.PAGE_HIDE */, "visibilitychange" /* DOM_EVENT.VISIBILITY_CHANGE */], (event) => {
|
|
21
|
+
if (event.type === "pagehide" /* DOM_EVENT.PAGE_HIDE */ || document.visibilityState === 'hidden') {
|
|
22
|
+
timeStamp = event.timeStamp;
|
|
23
|
+
stop();
|
|
24
|
+
}
|
|
25
|
+
}, { capture: true });
|
|
26
|
+
return {
|
|
27
|
+
get timeStamp() {
|
|
28
|
+
return timeStamp;
|
|
29
|
+
},
|
|
30
|
+
stop,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=trackFirstHidden.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackFirstHidden.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackFirstHidden.ts"],"names":[],"mappings":";;AAWA,4CAyCC;AAnDD,8EAAsF;AAEtF,kFAA+G;AAQ/G,SAAgB,gBAAgB,CAC9B,aAA+B,EAC/B,SAAsB,EACtB,cAAsB,MAAM;IAE5B,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,EAAE,SAAS,EAAE,CAAiB,EAAE,IAAI,EAAE,6BAAI,EAAE,CAAA;IACrD,CAAC;IAED,IAAI,IAAA,qDAA6B,EAAC,+CAAuB,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC5E,MAAM,gBAAgB,GAAG,WAAW;aACjC,gBAAgB,CAAC,+CAAuB,CAAC,gBAAgB,CAAC;aAC1D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;aAC1C,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAA;QAEzD,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,SAAyB,EAAE,IAAI,EAAE,6BAAI,EAAE,CAAA;QAC9E,CAAC;IACH,CAAC;IAED,IAAI,SAAS,GAAiB,QAAwB,CAAA;IAEtD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,0CAAiB,EAChC,aAAa,EACb,WAAW,EACX,4FAAkD,EAClD,CAAC,KAAK,EAAE,EAAE;QACR,IAAI,KAAK,CAAC,IAAI,yCAAwB,IAAI,QAAQ,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;YAChF,SAAS,GAAG,KAAK,CAAC,SAAyB,CAAA;YAC3C,IAAI,EAAE,CAAA;QACR,CAAC;IACH,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAA;IAED,OAAO;QACL,IAAI,SAAS;YACX,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,IAAI;KACL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { RumConfiguration } from '../../configuration';
|
|
3
|
+
import type { FirstHidden } from './trackFirstHidden';
|
|
4
|
+
export interface FirstInput {
|
|
5
|
+
delay: Duration;
|
|
6
|
+
time: RelativeTime;
|
|
7
|
+
targetSelector?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Track the first input occurring during the initial View to return:
|
|
11
|
+
* - First Input Delay
|
|
12
|
+
* - First Input Time
|
|
13
|
+
* Callback is called at most one time.
|
|
14
|
+
* Documentation: https://web.dev/fid/
|
|
15
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getFID.ts
|
|
16
|
+
*/
|
|
17
|
+
export declare function trackFirstInput(configuration: RumConfiguration, firstHidden: FirstHidden, callback: (firstInput: FirstInput) => void): {
|
|
18
|
+
stop: () => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackFirstInput = trackFirstInput;
|
|
4
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
5
|
+
const htmlDomUtils_1 = require("../../../browser/htmlDomUtils");
|
|
6
|
+
const performanceObservable_1 = require("../../../browser/performanceObservable");
|
|
7
|
+
const getSelectorFromElement_1 = require("../../getSelectorFromElement");
|
|
8
|
+
/**
|
|
9
|
+
* Track the first input occurring during the initial View to return:
|
|
10
|
+
* - First Input Delay
|
|
11
|
+
* - First Input Time
|
|
12
|
+
* Callback is called at most one time.
|
|
13
|
+
* Documentation: https://web.dev/fid/
|
|
14
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getFID.ts
|
|
15
|
+
*/
|
|
16
|
+
function trackFirstInput(configuration, firstHidden, callback) {
|
|
17
|
+
const performanceFirstInputSubscription = (0, performanceObservable_1.createPerformanceObservable)(configuration, {
|
|
18
|
+
type: performanceObservable_1.RumPerformanceEntryType.FIRST_INPUT,
|
|
19
|
+
buffered: true,
|
|
20
|
+
}).subscribe((entries) => {
|
|
21
|
+
const firstInputEntry = entries.find((entry) => entry.startTime < firstHidden.timeStamp);
|
|
22
|
+
if (firstInputEntry) {
|
|
23
|
+
const firstInputDelay = (0, kubesense_browser_core_1.elapsed)(firstInputEntry.startTime, firstInputEntry.processingStart);
|
|
24
|
+
let firstInputTargetSelector;
|
|
25
|
+
if (firstInputEntry.target && (0, htmlDomUtils_1.isElementNode)(firstInputEntry.target)) {
|
|
26
|
+
firstInputTargetSelector = (0, getSelectorFromElement_1.getSelectorFromElement)(firstInputEntry.target, configuration.actionNameAttribute);
|
|
27
|
+
}
|
|
28
|
+
callback({
|
|
29
|
+
// Ensure firstInputDelay to be positive, see
|
|
30
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1185815
|
|
31
|
+
delay: firstInputDelay >= 0 ? firstInputDelay : 0,
|
|
32
|
+
time: firstInputEntry.startTime,
|
|
33
|
+
targetSelector: firstInputTargetSelector,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
stop: () => {
|
|
39
|
+
performanceFirstInputSubscription.unsubscribe();
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=trackFirstInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackFirstInput.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackFirstInput.ts"],"names":[],"mappings":";;AAuBA,0CAmCC;AAzDD,8EAA2D;AAC3D,gEAA6D;AAE7D,kFAA6G;AAE7G,yEAAqE;AASrE;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,aAA+B,EAC/B,WAAwB,EACxB,QAA0C;IAE1C,MAAM,iCAAiC,GAAG,IAAA,mDAA2B,EAAC,aAAa,EAAE;QACnF,IAAI,EAAE,+CAAuB,CAAC,WAAW;QACzC,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;QACvB,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAClC,CAAC,KAAK,EAAgC,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CACjF,CAAA;QACD,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,eAAe,GAAG,IAAA,gCAAO,EAAC,eAAe,CAAC,SAAS,EAAE,eAAe,CAAC,eAAe,CAAC,CAAA;YAC3F,IAAI,wBAAwB,CAAA;YAE5B,IAAI,eAAe,CAAC,MAAM,IAAI,IAAA,4BAAa,EAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;gBACpE,wBAAwB,GAAG,IAAA,+CAAsB,EAAC,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAA;YAC9G,CAAC;YAED,QAAQ,CAAC;gBACP,6CAA6C;gBAC7C,gEAAgE;gBAChE,KAAK,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAE,CAAc;gBAC/D,IAAI,EAAE,eAAe,CAAC,SAAS;gBAC/B,cAAc,EAAE,wBAAwB;aACzC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,iCAAiC,CAAC,WAAW,EAAE,CAAA;QACjD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ClocksState, Duration } from '@kubesense/kubesense-browser-core';
|
|
2
|
+
import type { RumConfiguration } from '../../configuration';
|
|
3
|
+
import type { FirstInput } from './trackFirstInput';
|
|
4
|
+
import type { NavigationTimings } from './trackNavigationTimings';
|
|
5
|
+
import type { LargestContentfulPaint } from './trackLargestContentfulPaint';
|
|
6
|
+
export interface InitialViewMetrics {
|
|
7
|
+
firstContentfulPaint?: Duration;
|
|
8
|
+
navigationTimings?: NavigationTimings;
|
|
9
|
+
largestContentfulPaint?: LargestContentfulPaint;
|
|
10
|
+
firstInput?: FirstInput;
|
|
11
|
+
}
|
|
12
|
+
export declare function trackInitialViewMetrics(configuration: RumConfiguration, viewStart: ClocksState, setLoadEvent: (loadEnd: Duration) => void, scheduleViewUpdate: () => void): {
|
|
13
|
+
stop: () => void;
|
|
14
|
+
initialViewMetrics: InitialViewMetrics;
|
|
15
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackInitialViewMetrics = trackInitialViewMetrics;
|
|
4
|
+
const trackFirstContentfulPaint_1 = require("./trackFirstContentfulPaint");
|
|
5
|
+
const trackFirstInput_1 = require("./trackFirstInput");
|
|
6
|
+
const trackNavigationTimings_1 = require("./trackNavigationTimings");
|
|
7
|
+
const trackLargestContentfulPaint_1 = require("./trackLargestContentfulPaint");
|
|
8
|
+
const trackFirstHidden_1 = require("./trackFirstHidden");
|
|
9
|
+
function trackInitialViewMetrics(configuration, viewStart, setLoadEvent, scheduleViewUpdate) {
|
|
10
|
+
const initialViewMetrics = {};
|
|
11
|
+
const { stop: stopNavigationTracking } = (0, trackNavigationTimings_1.trackNavigationTimings)(configuration, (navigationTimings) => {
|
|
12
|
+
setLoadEvent(navigationTimings.loadEvent);
|
|
13
|
+
initialViewMetrics.navigationTimings = navigationTimings;
|
|
14
|
+
scheduleViewUpdate();
|
|
15
|
+
});
|
|
16
|
+
const firstHidden = (0, trackFirstHidden_1.trackFirstHidden)(configuration, viewStart);
|
|
17
|
+
const { stop: stopFCPTracking } = (0, trackFirstContentfulPaint_1.trackFirstContentfulPaint)(configuration, firstHidden, (firstContentfulPaint) => {
|
|
18
|
+
initialViewMetrics.firstContentfulPaint = firstContentfulPaint;
|
|
19
|
+
scheduleViewUpdate();
|
|
20
|
+
});
|
|
21
|
+
const { stop: stopLCPTracking } = (0, trackLargestContentfulPaint_1.trackLargestContentfulPaint)(configuration, firstHidden, window, (largestContentfulPaint) => {
|
|
22
|
+
initialViewMetrics.largestContentfulPaint = largestContentfulPaint;
|
|
23
|
+
scheduleViewUpdate();
|
|
24
|
+
});
|
|
25
|
+
const { stop: stopFIDTracking } = (0, trackFirstInput_1.trackFirstInput)(configuration, firstHidden, (firstInput) => {
|
|
26
|
+
initialViewMetrics.firstInput = firstInput;
|
|
27
|
+
scheduleViewUpdate();
|
|
28
|
+
});
|
|
29
|
+
function stop() {
|
|
30
|
+
stopNavigationTracking();
|
|
31
|
+
stopFCPTracking();
|
|
32
|
+
stopLCPTracking();
|
|
33
|
+
stopFIDTracking();
|
|
34
|
+
firstHidden.stop();
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
stop,
|
|
38
|
+
initialViewMetrics,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=trackInitialViewMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackInitialViewMetrics.js","sourceRoot":"","sources":["../../../../src/domain/view/viewMetrics/trackInitialViewMetrics.ts"],"names":[],"mappings":";;AAkBA,0DA+CC;AA/DD,2EAAuE;AAEvE,uDAAmD;AAEnD,qEAAiE;AAEjE,+EAA2E;AAC3E,yDAAqD;AASrD,SAAgB,uBAAuB,CACrC,aAA+B,EAC/B,SAAsB,EACtB,YAAyC,EACzC,kBAA8B;IAE9B,MAAM,kBAAkB,GAAuB,EAAE,CAAA;IAEjD,MAAM,EAAE,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAA,+CAAsB,EAAC,aAAa,EAAE,CAAC,iBAAiB,EAAE,EAAE;QACnG,YAAY,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACzC,kBAAkB,CAAC,iBAAiB,GAAG,iBAAiB,CAAA;QACxD,kBAAkB,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,IAAA,mCAAgB,EAAC,aAAa,EAAE,SAAS,CAAC,CAAA;IAC9D,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,IAAA,qDAAyB,EAAC,aAAa,EAAE,WAAW,EAAE,CAAC,oBAAoB,EAAE,EAAE;QAC/G,kBAAkB,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;QAC9D,kBAAkB,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,IAAA,yDAA2B,EAC3D,aAAa,EACb,WAAW,EACX,MAAM,EACN,CAAC,sBAAsB,EAAE,EAAE;QACzB,kBAAkB,CAAC,sBAAsB,GAAG,sBAAsB,CAAA;QAClE,kBAAkB,EAAE,CAAA;IACtB,CAAC,CACF,CAAA;IAED,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,IAAA,iCAAe,EAAC,aAAa,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,EAAE;QAC3F,kBAAkB,CAAC,UAAU,GAAG,UAAU,CAAA;QAC1C,kBAAkB,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,SAAS,IAAI;QACX,sBAAsB,EAAE,CAAA;QACxB,eAAe,EAAE,CAAA;QACjB,eAAe,EAAE,CAAA;QACjB,eAAe,EAAE,CAAA;QACjB,WAAW,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED,OAAO;QACL,IAAI;QACJ,kBAAkB;KACnB,CAAA;AACH,CAAC"}
|