@kubesense/kubesense-browser-rum-core 1.8.0 → 2.0.0-beta.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/LICENSE +1 -1
- package/cjs/boot/preStartRum.d.ts +4 -3
- package/cjs/boot/preStartRum.js +229 -204
- package/cjs/boot/preStartRum.js.map +1 -1
- package/cjs/boot/rumPublicApi.d.ts +190 -51
- package/cjs/boot/rumPublicApi.js +267 -164
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRum.d.ts +42 -31
- package/cjs/boot/startRum.js +157 -150
- package/cjs/boot/startRum.js.map +1 -1
- package/cjs/browser/cookieObservable.d.ts +1 -5
- package/cjs/browser/cookieObservable.js +30 -34
- package/cjs/browser/cookieObservable.js.map +1 -1
- package/cjs/browser/domMutationObservable.d.ts +3 -3
- package/cjs/browser/domMutationObservable.js +29 -53
- package/cjs/browser/domMutationObservable.js.map +1 -1
- package/cjs/browser/htmlDomUtils.d.ts +5 -0
- package/cjs/browser/htmlDomUtils.js +38 -28
- package/cjs/browser/htmlDomUtils.js.map +1 -1
- package/cjs/browser/locationChangeObservable.d.ts +1 -2
- package/cjs/browser/locationChangeObservable.js +44 -45
- package/cjs/browser/locationChangeObservable.js.map +1 -1
- package/cjs/browser/performanceObservable.d.ts +4 -4
- package/cjs/browser/performanceObservable.js +50 -114
- package/cjs/browser/performanceObservable.js.map +1 -1
- package/cjs/browser/performanceUtils.d.ts +13 -1
- package/cjs/browser/performanceUtils.js +63 -37
- package/cjs/browser/performanceUtils.js.map +1 -1
- package/cjs/browser/scroll.js +17 -28
- package/cjs/browser/scroll.js.map +1 -1
- package/cjs/browser/viewportObservable.d.ts +2 -3
- package/cjs/browser/viewportObservable.js +29 -31
- package/cjs/browser/viewportObservable.js.map +1 -1
- package/cjs/browser/windowOpenObservable.js +11 -7
- package/cjs/browser/windowOpenObservable.js.map +1 -1
- package/cjs/domain/action/actionCollection.d.ts +11 -12
- package/cjs/domain/action/actionCollection.js +82 -89
- package/cjs/domain/action/actionCollection.js.map +1 -1
- package/cjs/domain/action/actionNameConstants.js +10 -9
- package/cjs/domain/action/actionNameConstants.js.map +1 -1
- package/cjs/domain/action/clickChain.js +51 -54
- package/cjs/domain/action/clickChain.js.map +1 -1
- package/cjs/domain/action/computeFrustration.js +30 -62
- package/cjs/domain/action/computeFrustration.js.map +1 -1
- package/cjs/domain/action/frustrationIgnore.d.ts +9 -0
- package/cjs/domain/action/frustrationIgnore.js +32 -0
- package/cjs/domain/action/frustrationIgnore.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.js +141 -217
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -1
- package/cjs/domain/action/interactionSelectorCache.d.ts +1 -1
- package/cjs/domain/action/interactionSelectorCache.js +17 -18
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -1
- package/cjs/domain/action/isActionChildEvent.d.ts +2 -0
- package/cjs/domain/action/isActionChildEvent.js +8 -0
- package/cjs/domain/action/isActionChildEvent.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +2 -3
- package/cjs/domain/action/listenActionEvents.js +51 -55
- package/cjs/domain/action/listenActionEvents.js.map +1 -1
- package/cjs/domain/action/trackClickActions.d.ts +15 -21
- package/cjs/domain/action/trackClickActions.js +188 -226
- package/cjs/domain/action/trackClickActions.js.map +1 -1
- package/cjs/domain/action/trackManualActions.d.ts +45 -0
- package/cjs/domain/action/trackManualActions.js +48 -0
- package/cjs/domain/action/trackManualActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +1 -2
- package/cjs/domain/assembly.js +80 -95
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +575 -81
- package/cjs/domain/configuration/configuration.js +464 -199
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +1 -0
- package/cjs/domain/configuration/index.js +27 -21
- package/cjs/domain/configuration/jsonPathParser.js +125 -139
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -1
- package/cjs/domain/configuration/remoteConfiguration.d.ts +18 -5
- package/cjs/domain/configuration/remoteConfiguration.js +268 -226
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -1
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +49 -0
- package/cjs/domain/configuration/remoteConfigurationCache.d.ts +42 -0
- package/cjs/domain/configuration/remoteConfigurationCache.js +95 -0
- package/cjs/domain/configuration/remoteConfigurationCache.js.map +1 -0
- package/cjs/domain/configuration/remoteSdkConfiguration.d.ts +11 -2
- package/cjs/domain/configuration/remoteSdkConfiguration.js +185 -117
- package/cjs/domain/configuration/remoteSdkConfiguration.js.map +1 -1
- package/cjs/domain/configuration/sessionReplayRoutes.d.ts +1 -6
- package/cjs/domain/configuration/sessionReplayRoutes.js +20 -63
- package/cjs/domain/configuration/sessionReplayRoutes.js.map +1 -1
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +2 -4
- package/cjs/domain/contexts/ciVisibilityContext.js +36 -32
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -1
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -2
- package/cjs/domain/contexts/connectivityContext.js +10 -9
- package/cjs/domain/contexts/connectivityContext.js.map +1 -1
- package/cjs/domain/contexts/defaultContext.d.ts +3 -3
- package/cjs/domain/contexts/defaultContext.js +28 -32
- package/cjs/domain/contexts/defaultContext.js.map +1 -1
- package/cjs/domain/contexts/displayContext.d.ts +2 -3
- package/cjs/domain/contexts/displayContext.js +22 -26
- package/cjs/domain/contexts/displayContext.js.map +1 -1
- package/cjs/domain/contexts/featureFlagContext.d.ts +2 -2
- package/cjs/domain/contexts/featureFlagContext.js +38 -50
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -1
- package/cjs/domain/contexts/internalContext.d.ts +2 -3
- package/cjs/domain/contexts/internalContext.js +26 -22
- package/cjs/domain/contexts/internalContext.js.map +1 -1
- package/cjs/domain/contexts/pageStateHistory.d.ts +3 -4
- package/cjs/domain/contexts/pageStateHistory.js +76 -96
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -1
- package/cjs/domain/contexts/sessionContext.d.ts +9 -3
- package/cjs/domain/contexts/sessionContext.js +31 -45
- package/cjs/domain/contexts/sessionContext.js.map +1 -1
- package/cjs/domain/contexts/sourceCodeMfeContext.d.ts +10 -0
- package/cjs/domain/contexts/sourceCodeMfeContext.js +35 -0
- package/cjs/domain/contexts/sourceCodeMfeContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -2
- package/cjs/domain/contexts/syntheticsContext.js +19 -23
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -1
- package/cjs/domain/contexts/trackingConsentContext.d.ts +2 -2
- package/cjs/domain/contexts/trackingConsentContext.js +10 -12
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.d.ts +4 -3
- package/cjs/domain/contexts/urlContexts.js +65 -61
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -2
- package/cjs/domain/contexts/userAgentDataContext.js +20 -29
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -1
- package/cjs/domain/contexts/viewHistory.d.ts +5 -2
- package/cjs/domain/contexts/viewHistory.js +41 -45
- package/cjs/domain/contexts/viewHistory.js.map +1 -1
- package/cjs/domain/discardNegativeDuration.d.ts +1 -1
- package/cjs/domain/discardNegativeDuration.js +6 -5
- package/cjs/domain/discardNegativeDuration.js.map +1 -1
- package/cjs/domain/error/errorCollection.d.ts +3 -3
- package/cjs/domain/error/errorCollection.js +67 -68
- package/cjs/domain/error/errorCollection.js.map +1 -1
- package/cjs/domain/error/trackReportError.d.ts +1 -2
- package/cjs/domain/error/trackReportError.js +10 -14
- package/cjs/domain/error/trackReportError.js.map +1 -1
- package/cjs/domain/event/eventCollection.d.ts +2 -1
- package/cjs/domain/event/eventCollection.js +21 -22
- package/cjs/domain/event/eventCollection.js.map +1 -1
- package/cjs/domain/eventTracker.d.ts +37 -0
- package/cjs/domain/eventTracker.js +94 -0
- package/cjs/domain/eventTracker.js.map +1 -0
- package/cjs/domain/extractRegexMatch.d.ts +5 -0
- package/cjs/domain/extractRegexMatch.js +16 -0
- package/cjs/domain/extractRegexMatch.js.map +1 -0
- package/cjs/domain/getComposedPathSelector.d.ts +22 -0
- package/cjs/domain/getComposedPathSelector.js +95 -0
- package/cjs/domain/getComposedPathSelector.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +18 -6
- package/cjs/domain/getSelectorFromElement.js +199 -191
- package/cjs/domain/getSelectorFromElement.js.map +1 -1
- package/cjs/domain/getSessionReplayUrl.d.ts +2 -2
- package/cjs/domain/getSessionReplayUrl.js +17 -30
- package/cjs/domain/getSessionReplayUrl.js.map +1 -1
- package/cjs/domain/hooks.d.ts +26 -17
- package/cjs/domain/hooks.js +12 -5
- package/cjs/domain/hooks.js.map +1 -1
- package/cjs/domain/lifeCycle.d.ts +26 -12
- package/cjs/domain/lifeCycle.js +28 -5
- package/cjs/domain/lifeCycle.js.map +1 -1
- package/cjs/domain/limitModification.d.ts +5 -1
- package/cjs/domain/limitModification.js +32 -36
- package/cjs/domain/limitModification.js.map +1 -1
- package/cjs/domain/longTask/longTaskCollection.d.ts +0 -13
- package/cjs/domain/longTask/longTaskCollection.js +75 -87
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -1
- package/cjs/domain/plugins.d.ts +37 -14
- package/cjs/domain/plugins.js +22 -13
- package/cjs/domain/plugins.js.map +1 -1
- package/cjs/domain/privacy.d.ts +6 -1
- package/cjs/domain/privacy.js +143 -286
- package/cjs/domain/privacy.js.map +1 -1
- package/cjs/domain/privacyConstants.js +43 -34
- package/cjs/domain/privacyConstants.js.map +1 -1
- package/cjs/domain/requestCollection.d.ts +6 -5
- package/cjs/domain/requestCollection.js +82 -105
- package/cjs/domain/requestCollection.js.map +1 -1
- package/cjs/domain/resource/graphql.d.ts +1 -1
- package/cjs/domain/resource/graphql.js +85 -86
- package/cjs/domain/resource/graphql.js.map +1 -1
- package/cjs/domain/resource/requestRegistry.js +30 -38
- package/cjs/domain/resource/requestRegistry.js.map +1 -1
- package/cjs/domain/resource/resourceCollection.d.ts +5 -3
- package/cjs/domain/resource/resourceCollection.js +241 -175
- package/cjs/domain/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/resource/resourceUtils.d.ts +13 -13
- package/cjs/domain/resource/resourceUtils.js +323 -221
- package/cjs/domain/resource/resourceUtils.js.map +1 -1
- package/cjs/domain/resource/trackManualResources.d.ts +55 -0
- package/cjs/domain/resource/trackManualResources.js +53 -0
- package/cjs/domain/resource/trackManualResources.js.map +1 -0
- package/cjs/domain/resource/webSocketCollection.d.ts +46 -0
- package/cjs/domain/resource/webSocketCollection.js +163 -0
- package/cjs/domain/resource/webSocketCollection.js.map +1 -0
- package/cjs/domain/session/session.types.d.ts +4 -0
- package/cjs/domain/sessionReplayState.d.ts +8 -0
- package/cjs/domain/sessionReplayState.js +19 -0
- package/cjs/domain/sessionReplayState.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.js +39 -43
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -1
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +1 -1
- package/cjs/domain/tracing/getDocumentTraceId.js +42 -63
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -1
- package/cjs/domain/tracing/identifier.js +13 -46
- package/cjs/domain/tracing/identifier.js.map +1 -1
- package/cjs/domain/tracing/tracer.d.ts +2 -5
- package/cjs/domain/tracing/tracer.js +110 -150
- package/cjs/domain/tracing/tracer.js.map +1 -1
- package/cjs/domain/trackEventCounts.js +43 -48
- package/cjs/domain/trackEventCounts.js.map +1 -1
- package/cjs/domain/view/bfCacheSupport.d.ts +1 -2
- package/cjs/domain/view/bfCacheSupport.js +10 -11
- package/cjs/domain/view/bfCacheSupport.js.map +1 -1
- package/cjs/domain/view/trackViewEventCounts.js +14 -13
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -1
- package/cjs/domain/view/trackViews.d.ts +8 -2
- package/cjs/domain/view/trackViews.js +221 -270
- package/cjs/domain/view/trackViews.js.map +1 -1
- package/cjs/domain/view/viewCollection.d.ts +4 -3
- package/cjs/domain/view/viewCollection.js +124 -148
- package/cjs/domain/view/viewCollection.js.map +1 -1
- package/cjs/domain/view/viewDiff.d.ts +22 -0
- package/cjs/domain/view/viewDiff.js +62 -0
- package/cjs/domain/view/viewDiff.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +20 -22
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -1
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +35 -33
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +1 -1
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -13
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +4 -2
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +51 -34
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +1 -1
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +106 -122
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +26 -34
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +31 -31
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +1 -3
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +33 -38
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +10 -1
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +202 -144
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +6 -1
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +65 -55
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +2 -1
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +42 -46
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +28 -36
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +3 -4
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +63 -72
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -1
- package/cjs/domain/vital/vitalCollection.d.ts +44 -20
- package/cjs/domain/vital/vitalCollection.js +81 -109
- package/cjs/domain/vital/vitalCollection.js.map +1 -1
- package/cjs/domain/waitPageActivityEnd.d.ts +1 -4
- package/cjs/domain/waitPageActivityEnd.js +99 -119
- package/cjs/domain/waitPageActivityEnd.js.map +1 -1
- package/cjs/domainContext.types.d.ts +21 -13
- package/cjs/index.d.ts +11 -10
- package/cjs/index.js +84 -62
- package/cjs/rawRumEvent.types.d.ts +79 -13
- package/cjs/rawRumEvent.types.js +40 -27
- package/cjs/rawRumEvent.types.js.map +1 -1
- package/cjs/rumEvent.types.d.ts +906 -669
- package/cjs/transport/formDataTransport.js +43 -41
- package/cjs/transport/formDataTransport.js.map +1 -1
- package/cjs/transport/startRumBatch.d.ts +27 -3
- package/cjs/transport/startRumBatch.js +132 -31
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/cjs/transport/startRumEventBridge.js +10 -8
- package/cjs/transport/startRumEventBridge.js.map +1 -1
- package/esm/boot/preStartRum.mjs +233 -0
- package/esm/boot/preStartRum.mjs.map +1 -0
- package/esm/boot/rumPublicApi.mjs +271 -0
- package/esm/boot/rumPublicApi.mjs.map +1 -0
- package/esm/boot/startRum.mjs +159 -0
- package/esm/boot/startRum.mjs.map +1 -0
- package/esm/browser/cookieObservable.mjs +34 -0
- package/esm/browser/cookieObservable.mjs.map +1 -0
- package/esm/browser/domMutationObservable.mjs +33 -0
- package/esm/browser/domMutationObservable.mjs.map +1 -0
- package/esm/browser/htmlDomUtils.mjs +48 -0
- package/esm/browser/htmlDomUtils.mjs.map +1 -0
- package/esm/browser/locationChangeObservable.mjs +50 -0
- package/esm/browser/locationChangeObservable.mjs.map +1 -0
- package/esm/browser/performanceObservable.mjs +60 -0
- package/esm/browser/performanceObservable.mjs.map +1 -0
- package/esm/browser/performanceUtils.mjs +64 -0
- package/esm/browser/performanceUtils.mjs.map +1 -0
- package/esm/browser/scroll.mjs +21 -0
- package/esm/browser/scroll.mjs.map +1 -0
- package/esm/browser/viewportObservable.mjs +33 -0
- package/esm/browser/viewportObservable.mjs.map +1 -0
- package/esm/browser/windowOpenObservable.mjs +14 -0
- package/esm/browser/windowOpenObservable.mjs.map +1 -0
- package/esm/domain/action/actionCollection.mjs +89 -0
- package/esm/domain/action/actionCollection.mjs.map +1 -0
- package/esm/domain/action/actionNameConstants.mjs +11 -0
- package/esm/domain/action/actionNameConstants.mjs.map +1 -0
- package/esm/domain/action/clickChain.mjs +57 -0
- package/esm/domain/action/clickChain.mjs.map +1 -0
- package/esm/domain/action/computeFrustration.mjs +36 -0
- package/esm/domain/action/computeFrustration.mjs.map +1 -0
- package/esm/domain/action/frustrationIgnore.mjs +31 -0
- package/esm/domain/action/frustrationIgnore.mjs.map +1 -0
- package/esm/domain/action/getActionNameFromElement.mjs +163 -0
- package/esm/domain/action/getActionNameFromElement.mjs.map +1 -0
- package/esm/domain/action/interactionSelectorCache.mjs +19 -0
- package/esm/domain/action/interactionSelectorCache.mjs.map +1 -0
- package/esm/domain/action/isActionChildEvent.mjs +8 -0
- package/esm/domain/action/isActionChildEvent.mjs.map +1 -0
- package/esm/domain/action/listenActionEvents.mjs +57 -0
- package/esm/domain/action/listenActionEvents.mjs.map +1 -0
- package/esm/domain/action/trackClickActions.mjs +198 -0
- package/esm/domain/action/trackClickActions.mjs.map +1 -0
- package/esm/domain/action/trackManualActions.mjs +48 -0
- package/esm/domain/action/trackManualActions.mjs.map +1 -0
- package/esm/domain/assembly.mjs +87 -0
- package/esm/domain/assembly.mjs.map +1 -0
- package/esm/domain/configuration/configuration.mjs +474 -0
- package/esm/domain/configuration/configuration.mjs.map +1 -0
- package/esm/domain/configuration/index.mjs +6 -0
- package/esm/domain/configuration/jsonPathParser.mjs +145 -0
- package/esm/domain/configuration/jsonPathParser.mjs.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.mjs +279 -0
- package/esm/domain/configuration/remoteConfiguration.mjs.map +1 -0
- package/esm/domain/configuration/remoteConfigurationCache.mjs +92 -0
- package/esm/domain/configuration/remoteConfigurationCache.mjs.map +1 -0
- package/esm/domain/configuration/remoteSdkConfiguration.mjs +208 -0
- package/esm/domain/configuration/remoteSdkConfiguration.mjs.map +1 -0
- package/esm/domain/configuration/sessionReplayRoutes.mjs +26 -0
- package/esm/domain/configuration/sessionReplayRoutes.mjs.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.mjs +37 -0
- package/esm/domain/contexts/ciVisibilityContext.mjs.map +1 -0
- package/esm/domain/contexts/connectivityContext.mjs +12 -0
- package/esm/domain/contexts/connectivityContext.mjs.map +1 -0
- package/esm/domain/contexts/defaultContext.mjs +30 -0
- package/esm/domain/contexts/defaultContext.mjs.map +1 -0
- package/esm/domain/contexts/displayContext.mjs +24 -0
- package/esm/domain/contexts/displayContext.mjs.map +1 -0
- package/esm/domain/contexts/featureFlagContext.mjs +40 -0
- package/esm/domain/contexts/featureFlagContext.mjs.map +1 -0
- package/esm/domain/contexts/internalContext.mjs +30 -0
- package/esm/domain/contexts/internalContext.mjs.map +1 -0
- package/esm/domain/contexts/pageStateHistory.mjs +82 -0
- package/esm/domain/contexts/pageStateHistory.mjs.map +1 -0
- package/esm/domain/contexts/sessionContext.mjs +33 -0
- package/esm/domain/contexts/sessionContext.mjs.map +1 -0
- package/esm/domain/contexts/sourceCodeMfeContext.mjs +35 -0
- package/esm/domain/contexts/sourceCodeMfeContext.mjs.map +1 -0
- package/esm/domain/contexts/syntheticsContext.mjs +21 -0
- package/esm/domain/contexts/syntheticsContext.mjs.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.mjs +12 -0
- package/esm/domain/contexts/trackingConsentContext.mjs.map +1 -0
- package/esm/domain/contexts/urlContexts.mjs +67 -0
- package/esm/domain/contexts/urlContexts.mjs.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.mjs +22 -0
- package/esm/domain/contexts/userAgentDataContext.mjs.map +1 -0
- package/esm/domain/contexts/viewHistory.mjs +43 -0
- package/esm/domain/contexts/viewHistory.mjs.map +1 -0
- package/esm/domain/discardNegativeDuration.mjs +9 -0
- package/esm/domain/discardNegativeDuration.mjs.map +1 -0
- package/esm/domain/error/errorCollection.mjs +72 -0
- package/esm/domain/error/errorCollection.mjs.map +1 -0
- package/esm/domain/error/trackReportError.mjs +12 -0
- package/esm/domain/error/trackReportError.mjs.map +1 -0
- package/esm/domain/event/eventCollection.mjs +26 -0
- package/esm/domain/event/eventCollection.mjs.map +1 -0
- package/esm/domain/eventTracker.mjs +93 -0
- package/esm/domain/eventTracker.mjs.map +1 -0
- package/esm/domain/extractRegexMatch.mjs +16 -0
- package/esm/domain/extractRegexMatch.mjs.map +1 -0
- package/esm/domain/getComposedPathSelector.mjs +93 -0
- package/esm/domain/getComposedPathSelector.mjs.map +1 -0
- package/esm/domain/getSelectorFromElement.mjs +218 -0
- package/esm/domain/getSelectorFromElement.mjs.map +1 -0
- package/esm/domain/getSessionReplayUrl.mjs +20 -0
- package/esm/domain/getSessionReplayUrl.mjs.map +1 -0
- package/esm/domain/hooks.mjs +13 -0
- package/esm/domain/hooks.mjs.map +1 -0
- package/esm/domain/lifeCycle.mjs +28 -0
- package/esm/domain/lifeCycle.mjs.map +1 -0
- package/esm/domain/limitModification.mjs +42 -0
- package/esm/domain/limitModification.mjs.map +1 -0
- package/esm/domain/longTask/longTaskCollection.mjs +79 -0
- package/esm/domain/longTask/longTaskCollection.mjs.map +1 -0
- package/esm/domain/plugins.mjs +23 -0
- package/esm/domain/plugins.mjs.map +1 -0
- package/esm/domain/privacy.mjs +161 -0
- package/esm/domain/privacy.mjs.map +1 -0
- package/esm/domain/privacyConstants.mjs +36 -0
- package/esm/domain/privacyConstants.mjs.map +1 -0
- package/esm/domain/requestCollection.mjs +86 -0
- package/esm/domain/requestCollection.mjs.map +1 -0
- package/esm/domain/resource/graphql.mjs +93 -0
- package/esm/domain/resource/graphql.mjs.map +1 -0
- package/esm/domain/resource/requestRegistry.mjs +32 -0
- package/esm/domain/resource/requestRegistry.mjs.map +1 -0
- package/esm/domain/resource/resourceCollection.mjs +256 -0
- package/esm/domain/resource/resourceCollection.mjs.map +1 -0
- package/esm/domain/resource/resourceUtils.mjs +349 -0
- package/esm/domain/resource/resourceUtils.mjs.map +1 -0
- package/esm/domain/resource/trackManualResources.mjs +53 -0
- package/esm/domain/resource/trackManualResources.mjs.map +1 -0
- package/esm/domain/resource/webSocketCollection.mjs +160 -0
- package/esm/domain/resource/webSocketCollection.mjs.map +1 -0
- package/esm/domain/sessionReplayState.mjs +18 -0
- package/esm/domain/sessionReplayState.mjs.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.mjs +51 -0
- package/esm/domain/startCustomerDataTelemetry.mjs.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.mjs +50 -0
- package/esm/domain/tracing/getDocumentTraceId.mjs.map +1 -0
- package/esm/domain/tracing/identifier.mjs +20 -0
- package/esm/domain/tracing/identifier.mjs.map +1 -0
- package/esm/domain/tracing/tracer.mjs +120 -0
- package/esm/domain/tracing/tracer.mjs.map +1 -0
- package/esm/domain/trackEventCounts.mjs +45 -0
- package/esm/domain/trackEventCounts.mjs.map +1 -0
- package/esm/domain/view/bfCacheSupport.mjs +12 -0
- package/esm/domain/view/bfCacheSupport.mjs.map +1 -0
- package/esm/domain/view/trackViewEventCounts.mjs +17 -0
- package/esm/domain/view/trackViewEventCounts.mjs.map +1 -0
- package/esm/domain/view/trackViews.mjs +230 -0
- package/esm/domain/view/trackViews.mjs.map +1 -0
- package/esm/domain/view/viewCollection.mjs +129 -0
- package/esm/domain/view/viewCollection.mjs.map +1 -0
- package/esm/domain/view/viewDiff.mjs +61 -0
- package/esm/domain/view/viewDiff.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.mjs +30 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.mjs +45 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.mjs +18 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.mjs +54 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.mjs +117 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.mjs +29 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.mjs +33 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.mjs +36 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.mjs +210 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.mjs +70 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.mjs +46 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.mjs +35 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.mjs +66 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.mjs.map +1 -0
- package/esm/domain/vital/vitalCollection.mjs +85 -0
- package/esm/domain/vital/vitalCollection.mjs.map +1 -0
- package/esm/domain/waitPageActivityEnd.mjs +107 -0
- package/esm/domain/waitPageActivityEnd.mjs.map +1 -0
- package/esm/index.mjs +23 -0
- package/esm/rawRumEvent.types.mjs +42 -0
- package/esm/rawRumEvent.types.mjs.map +1 -0
- package/esm/transport/formDataTransport.mjs +48 -0
- package/esm/transport/formDataTransport.mjs.map +1 -0
- package/esm/transport/startRumBatch.mjs +132 -0
- package/esm/transport/startRumBatch.mjs.map +1 -0
- package/esm/transport/startRumEventBridge.mjs +13 -0
- package/esm/transport/startRumEventBridge.mjs.map +1 -0
- package/package.json +19 -11
- package/src/boot/preStartRum.ts +216 -88
- package/src/boot/rumPublicApi.ts +358 -119
- package/src/boot/startRum.ts +88 -84
- package/src/browser/cookieObservable.ts +19 -28
- package/src/browser/domMutationObservable.ts +7 -12
- package/src/browser/htmlDomUtils.ts +15 -0
- package/src/browser/locationChangeObservable.ts +23 -12
- package/src/browser/performanceObservable.ts +23 -73
- package/src/browser/performanceUtils.ts +52 -4
- package/src/browser/viewportObservable.ts +4 -6
- package/src/domain/action/actionCollection.ts +94 -87
- package/src/domain/action/clickChain.ts +11 -10
- package/src/domain/action/computeFrustration.ts +19 -5
- package/src/domain/action/frustrationIgnore.ts +54 -0
- package/src/domain/action/getActionNameFromElement.ts +27 -61
- package/src/domain/action/interactionSelectorCache.ts +2 -2
- package/src/domain/action/isActionChildEvent.ts +6 -0
- package/src/domain/action/listenActionEvents.ts +2 -11
- package/src/domain/action/trackClickActions.ts +92 -82
- package/src/domain/action/trackManualActions.ts +104 -0
- package/src/domain/assembly.ts +57 -70
- package/src/domain/configuration/configuration.ts +587 -208
- package/src/domain/configuration/index.ts +1 -0
- package/src/domain/configuration/remoteConfiguration.ts +152 -29
- package/src/domain/configuration/remoteConfiguration.types.ts +51 -1
- package/src/domain/configuration/remoteConfigurationCache.ts +153 -0
- package/src/domain/configuration/remoteSdkConfiguration.ts +131 -13
- package/src/domain/configuration/sessionReplayRoutes.ts +2 -47
- package/src/domain/contexts/ciVisibilityContext.ts +23 -12
- package/src/domain/contexts/connectivityContext.ts +7 -10
- package/src/domain/contexts/defaultContext.ts +11 -14
- package/src/domain/contexts/displayContext.ts +8 -12
- package/src/domain/contexts/featureFlagContext.ts +5 -4
- package/src/domain/contexts/internalContext.ts +3 -3
- package/src/domain/contexts/pageStateHistory.ts +20 -31
- package/src/domain/contexts/sessionContext.ts +16 -22
- package/src/domain/contexts/sourceCodeMfeContext.ts +53 -0
- package/src/domain/contexts/syntheticsContext.ts +7 -17
- package/src/domain/contexts/trackingConsentContext.ts +7 -4
- package/src/domain/contexts/urlContexts.ts +13 -9
- package/src/domain/contexts/userAgentDataContext.ts +12 -13
- package/src/domain/contexts/viewHistory.ts +4 -3
- package/src/domain/discardNegativeDuration.ts +1 -1
- package/src/domain/error/errorCollection.ts +12 -22
- package/src/domain/error/trackReportError.ts +4 -7
- package/src/domain/event/eventCollection.ts +4 -2
- package/src/domain/eventTracker.ts +169 -0
- package/src/domain/extractRegexMatch.ts +15 -0
- package/src/domain/getComposedPathSelector.ts +130 -0
- package/src/domain/getSelectorFromElement.ts +125 -31
- package/src/domain/getSessionReplayUrl.ts +4 -13
- package/src/domain/hooks.ts +34 -21
- package/src/domain/lifeCycle.ts +21 -8
- package/src/domain/limitModification.ts +20 -4
- package/src/domain/longTask/longTaskCollection.ts +18 -47
- package/src/domain/plugins.ts +54 -25
- package/src/domain/privacy.ts +16 -24
- package/src/domain/requestCollection.ts +108 -97
- package/src/domain/resource/graphql.ts +71 -25
- package/src/domain/resource/requestRegistry.ts +1 -3
- package/src/domain/resource/resourceCollection.ts +319 -137
- package/src/domain/resource/resourceUtils.ts +24 -26
- package/src/domain/resource/trackManualResources.ts +121 -0
- package/src/domain/resource/webSocketCollection.ts +281 -0
- package/src/domain/session/session.types.ts +5 -0
- package/src/domain/sessionReplayState.ts +36 -0
- package/src/domain/startCustomerDataTelemetry.ts +2 -2
- package/src/domain/tracing/getDocumentTraceId.ts +5 -4
- package/src/domain/tracing/identifier.ts +6 -37
- package/src/domain/tracing/tracer.ts +22 -21
- package/src/domain/tracing/tracer.types.ts +3 -3
- package/src/domain/view/bfCacheSupport.ts +1 -6
- package/src/domain/view/trackViews.ts +40 -37
- package/src/domain/view/viewCollection.ts +29 -23
- package/src/domain/view/viewDiff.ts +115 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +13 -2
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +1 -1
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +27 -6
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +5 -3
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +4 -9
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +2 -8
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +4 -13
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +180 -35
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +47 -6
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +4 -3
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +10 -18
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +23 -37
- package/src/domain/vital/vitalCollection.ts +83 -102
- package/src/domain/waitPageActivityEnd.ts +7 -11
- package/src/domainContext.types.ts +23 -15
- package/src/index.ts +17 -11
- package/src/rawRumEvent.types.ts +80 -26
- package/src/rumEvent.types.ts +730 -505
- package/src/transport/formDataTransport.ts +16 -6
- package/src/transport/startRumBatch.ts +181 -24
- package/cjs/browser/firstInputPolyfill.d.ts +0 -8
- package/cjs/browser/firstInputPolyfill.js +0 -68
- package/cjs/browser/firstInputPolyfill.js.map +0 -1
- package/cjs/domain/configuration/index.js.map +0 -1
- package/cjs/domain/configuration/remoteConfiguration.types.js +0 -7
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +0 -1
- package/cjs/domain/error/trackConsoleError.d.ts +0 -4
- package/cjs/domain/error/trackConsoleError.js +0 -13
- package/cjs/domain/error/trackConsoleError.js.map +0 -1
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +0 -16
- package/cjs/domain/resource/matchRequestResourceEntry.js +0 -49
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +0 -1
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +0 -4
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +0 -24
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +0 -1
- package/cjs/domain/rumSessionManager.d.ts +0 -36
- package/cjs/domain/rumSessionManager.js +0 -77
- package/cjs/domain/rumSessionManager.js.map +0 -1
- package/cjs/domain/sampler/sampler.d.ts +0 -10
- package/cjs/domain/sampler/sampler.js +0 -63
- package/cjs/domain/sampler/sampler.js.map +0 -1
- package/cjs/domain/tracing/sampler.d.ts +0 -10
- package/cjs/domain/tracing/sampler.js +0 -69
- package/cjs/domain/tracing/sampler.js.map +0 -1
- package/cjs/domain/tracing/tracer.types.js +0 -3
- package/cjs/domain/tracing/tracer.types.js.map +0 -1
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +0 -6
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +0 -44
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +0 -1
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +0 -19
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +0 -43
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +0 -1
- package/cjs/domainContext.types.js +0 -6
- package/cjs/domainContext.types.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/rumEvent.types.js +0 -7
- package/cjs/rumEvent.types.js.map +0 -1
- package/esm/boot/preStartRum.d.ts +0 -7
- package/esm/boot/preStartRum.js +0 -205
- package/esm/boot/preStartRum.js.map +0 -1
- package/esm/boot/rumPublicApi.d.ts +0 -409
- package/esm/boot/rumPublicApi.js +0 -165
- package/esm/boot/rumPublicApi.js.map +0 -1
- package/esm/boot/startRum.d.ts +0 -109
- package/esm/boot/startRum.js +0 -149
- package/esm/boot/startRum.js.map +0 -1
- package/esm/browser/cookieObservable.d.ts +0 -8
- package/esm/browser/cookieObservable.js +0 -35
- package/esm/browser/cookieObservable.js.map +0 -1
- package/esm/browser/domMutationObservable.d.ts +0 -27
- package/esm/browser/domMutationObservable.js +0 -54
- package/esm/browser/domMutationObservable.js.map +0 -1
- package/esm/browser/firstInputPolyfill.d.ts +0 -8
- package/esm/browser/firstInputPolyfill.js +0 -65
- package/esm/browser/firstInputPolyfill.js.map +0 -1
- package/esm/browser/htmlDomUtils.d.ts +0 -13
- package/esm/browser/htmlDomUtils.js +0 -36
- package/esm/browser/htmlDomUtils.js.map +0 -1
- package/esm/browser/locationChangeObservable.d.ts +0 -7
- package/esm/browser/locationChangeObservable.js +0 -48
- package/esm/browser/locationChangeObservable.js.map +0 -1
- package/esm/browser/performanceObservable.d.ts +0 -174
- package/esm/browser/performanceObservable.js +0 -121
- package/esm/browser/performanceObservable.js.map +0 -1
- package/esm/browser/performanceUtils.d.ts +0 -7
- package/esm/browser/performanceUtils.js +0 -38
- package/esm/browser/performanceUtils.js.map +0 -1
- package/esm/browser/scroll.d.ts +0 -2
- package/esm/browser/scroll.js +0 -29
- package/esm/browser/scroll.js.map +0 -1
- package/esm/browser/viewportObservable.d.ts +0 -10
- package/esm/browser/viewportObservable.js +0 -32
- package/esm/browser/viewportObservable.js.map +0 -1
- package/esm/browser/windowOpenObservable.d.ts +0 -5
- package/esm/browser/windowOpenObservable.js +0 -7
- package/esm/browser/windowOpenObservable.js.map +0 -1
- package/esm/domain/action/actionCollection.d.ts +0 -21
- package/esm/domain/action/actionCollection.js +0 -93
- package/esm/domain/action/actionCollection.js.map +0 -1
- package/esm/domain/action/actionNameConstants.d.ts +0 -18
- package/esm/domain/action/actionNameConstants.js +0 -8
- package/esm/domain/action/actionNameConstants.js.map +0 -1
- package/esm/domain/action/clickChain.d.ts +0 -8
- package/esm/domain/action/clickChain.js +0 -57
- package/esm/domain/action/clickChain.js.map +0 -1
- package/esm/domain/action/computeFrustration.d.ts +0 -6
- package/esm/domain/action/computeFrustration.js +0 -65
- package/esm/domain/action/computeFrustration.js.map +0 -1
- package/esm/domain/action/getActionNameFromElement.d.ts +0 -4
- package/esm/domain/action/getActionNameFromElement.js +0 -236
- package/esm/domain/action/getActionNameFromElement.js.map +0 -1
- package/esm/domain/action/interactionSelectorCache.d.ts +0 -5
- package/esm/domain/action/interactionSelectorCache.js +0 -18
- package/esm/domain/action/interactionSelectorCache.js.map +0 -1
- package/esm/domain/action/listenActionEvents.d.ts +0 -19
- package/esm/domain/action/listenActionEvents.js +0 -58
- package/esm/domain/action/listenActionEvents.js.map +0 -1
- package/esm/domain/action/trackClickActions.d.ts +0 -81
- package/esm/domain/action/trackClickActions.js +0 -232
- package/esm/domain/action/trackClickActions.js.map +0 -1
- package/esm/domain/assembly.d.ts +0 -5
- package/esm/domain/assembly.js +0 -99
- package/esm/domain/assembly.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -358
- package/esm/domain/configuration/configuration.js +0 -209
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -4
- package/esm/domain/configuration/index.js +0 -5
- package/esm/domain/configuration/index.js.map +0 -1
- package/esm/domain/configuration/jsonPathParser.d.ts +0 -28
- package/esm/domain/configuration/jsonPathParser.js +0 -156
- package/esm/domain/configuration/jsonPathParser.js.map +0 -1
- package/esm/domain/configuration/remoteConfiguration.d.ts +0 -39
- package/esm/domain/configuration/remoteConfiguration.js +0 -236
- package/esm/domain/configuration/remoteConfiguration.js.map +0 -1
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +0 -138
- package/esm/domain/configuration/remoteConfiguration.types.js +0 -6
- package/esm/domain/configuration/remoteConfiguration.types.js.map +0 -1
- package/esm/domain/configuration/remoteSdkConfiguration.d.ts +0 -18
- package/esm/domain/configuration/remoteSdkConfiguration.js +0 -137
- package/esm/domain/configuration/remoteSdkConfiguration.js.map +0 -1
- package/esm/domain/configuration/sessionReplayRoutes.d.ts +0 -35
- package/esm/domain/configuration/sessionReplayRoutes.js +0 -65
- package/esm/domain/configuration/sessionReplayRoutes.js.map +0 -1
- package/esm/domain/contexts/ciVisibilityContext.d.ts +0 -12
- package/esm/domain/contexts/ciVisibilityContext.js +0 -30
- package/esm/domain/contexts/ciVisibilityContext.js.map +0 -1
- package/esm/domain/contexts/connectivityContext.d.ts +0 -2
- package/esm/domain/contexts/connectivityContext.js +0 -8
- package/esm/domain/contexts/connectivityContext.js.map +0 -1
- package/esm/domain/contexts/defaultContext.d.ts +0 -4
- package/esm/domain/contexts/defaultContext.js +0 -31
- package/esm/domain/contexts/defaultContext.js.map +0 -1
- package/esm/domain/contexts/displayContext.d.ts +0 -6
- package/esm/domain/contexts/displayContext.js +0 -25
- package/esm/domain/contexts/displayContext.js.map +0 -1
- package/esm/domain/contexts/featureFlagContext.d.ts +0 -19
- package/esm/domain/contexts/featureFlagContext.js +0 -49
- package/esm/domain/contexts/featureFlagContext.js.map +0 -1
- package/esm/domain/contexts/internalContext.d.ts +0 -12
- package/esm/domain/contexts/internalContext.js +0 -23
- package/esm/domain/contexts/internalContext.js.map +0 -1
- package/esm/domain/contexts/pageStateHistory.d.ts +0 -23
- package/esm/domain/contexts/pageStateHistory.js +0 -100
- package/esm/domain/contexts/pageStateHistory.js.map +0 -1
- package/esm/domain/contexts/sessionContext.d.ts +0 -5
- package/esm/domain/contexts/sessionContext.js +0 -44
- package/esm/domain/contexts/sessionContext.js.map +0 -1
- package/esm/domain/contexts/syntheticsContext.d.ts +0 -2
- package/esm/domain/contexts/syntheticsContext.js +0 -22
- package/esm/domain/contexts/syntheticsContext.js.map +0 -1
- package/esm/domain/contexts/trackingConsentContext.d.ts +0 -3
- package/esm/domain/contexts/trackingConsentContext.js +0 -11
- package/esm/domain/contexts/trackingConsentContext.js.map +0 -1
- package/esm/domain/contexts/urlContexts.d.ts +0 -22
- package/esm/domain/contexts/urlContexts.js +0 -60
- package/esm/domain/contexts/urlContexts.js.map +0 -1
- package/esm/domain/contexts/userAgentDataContext.d.ts +0 -2
- package/esm/domain/contexts/userAgentDataContext.js +0 -28
- package/esm/domain/contexts/userAgentDataContext.js.map +0 -1
- package/esm/domain/contexts/viewHistory.d.ts +0 -17
- package/esm/domain/contexts/viewHistory.js +0 -44
- package/esm/domain/contexts/viewHistory.js.map +0 -1
- package/esm/domain/discardNegativeDuration.d.ts +0 -2
- package/esm/domain/discardNegativeDuration.js +0 -5
- package/esm/domain/discardNegativeDuration.js.map +0 -1
- package/esm/domain/error/errorCollection.d.ts +0 -17
- package/esm/domain/error/errorCollection.js +0 -70
- package/esm/domain/error/errorCollection.js.map +0 -1
- package/esm/domain/error/trackConsoleError.d.ts +0 -4
- package/esm/domain/error/trackConsoleError.js +0 -10
- package/esm/domain/error/trackConsoleError.js.map +0 -1
- package/esm/domain/error/trackReportError.d.ts +0 -5
- package/esm/domain/error/trackReportError.js +0 -13
- package/esm/domain/error/trackReportError.js.map +0 -1
- package/esm/domain/event/eventCollection.d.ts +0 -10
- package/esm/domain/event/eventCollection.js +0 -24
- package/esm/domain/event/eventCollection.js.map +0 -1
- package/esm/domain/getSelectorFromElement.d.ts +0 -64
- package/esm/domain/getSelectorFromElement.js +0 -213
- package/esm/domain/getSelectorFromElement.js.map +0 -1
- package/esm/domain/getSessionReplayUrl.d.ts +0 -9
- package/esm/domain/getSessionReplayUrl.js +0 -30
- package/esm/domain/getSessionReplayUrl.js.map +0 -1
- package/esm/domain/hooks.d.ts +0 -23
- package/esm/domain/hooks.js +0 -3
- package/esm/domain/hooks.js.map +0 -1
- package/esm/domain/lifeCycle.d.ts +0 -73
- package/esm/domain/lifeCycle.js +0 -3
- package/esm/domain/lifeCycle.js.map +0 -1
- package/esm/domain/limitModification.d.ts +0 -8
- package/esm/domain/limitModification.js +0 -43
- package/esm/domain/limitModification.js.map +0 -1
- package/esm/domain/longTask/longTaskCollection.d.ts +0 -18
- package/esm/domain/longTask/longTaskCollection.js +0 -87
- package/esm/domain/longTask/longTaskCollection.js.map +0 -1
- package/esm/domain/plugins.d.ts +0 -40
- package/esm/domain/plugins.js +0 -12
- package/esm/domain/plugins.js.map +0 -1
- package/esm/domain/privacy.d.ts +0 -44
- package/esm/domain/privacy.js +0 -302
- package/esm/domain/privacy.js.map +0 -1
- package/esm/domain/privacyConstants.d.ts +0 -23
- package/esm/domain/privacyConstants.js +0 -35
- package/esm/domain/privacyConstants.js.map +0 -1
- package/esm/domain/requestCollection.d.ts +0 -54
- package/esm/domain/requestCollection.js +0 -106
- package/esm/domain/requestCollection.js.map +0 -1
- package/esm/domain/resource/graphql.d.ts +0 -23
- package/esm/domain/resource/graphql.js +0 -91
- package/esm/domain/resource/graphql.js.map +0 -1
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +0 -16
- package/esm/domain/resource/matchRequestResourceEntry.js +0 -46
- package/esm/domain/resource/matchRequestResourceEntry.js.map +0 -1
- package/esm/domain/resource/requestRegistry.d.ts +0 -9
- package/esm/domain/resource/requestRegistry.js +0 -37
- package/esm/domain/resource/requestRegistry.js.map +0 -1
- package/esm/domain/resource/resourceCollection.d.ts +0 -7
- package/esm/domain/resource/resourceCollection.js +0 -187
- package/esm/domain/resource/resourceCollection.js.map +0 -1
- package/esm/domain/resource/resourceUtils.d.ts +0 -55
- package/esm/domain/resource/resourceUtils.js +0 -244
- package/esm/domain/resource/resourceUtils.js.map +0 -1
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +0 -4
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +0 -21
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +0 -1
- package/esm/domain/rumSessionManager.d.ts +0 -36
- package/esm/domain/rumSessionManager.js +0 -72
- package/esm/domain/rumSessionManager.js.map +0 -1
- package/esm/domain/sampler/sampler.d.ts +0 -10
- package/esm/domain/sampler/sampler.js +0 -58
- package/esm/domain/sampler/sampler.js.map +0 -1
- package/esm/domain/startCustomerDataTelemetry.d.ts +0 -4
- package/esm/domain/startCustomerDataTelemetry.js +0 -52
- package/esm/domain/startCustomerDataTelemetry.js.map +0 -1
- package/esm/domain/tracing/getDocumentTraceId.d.ts +0 -12
- package/esm/domain/tracing/getDocumentTraceId.js +0 -68
- package/esm/domain/tracing/getDocumentTraceId.js.map +0 -1
- package/esm/domain/tracing/identifier.d.ts +0 -13
- package/esm/domain/tracing/identifier.js +0 -50
- package/esm/domain/tracing/identifier.js.map +0 -1
- package/esm/domain/tracing/sampler.d.ts +0 -10
- package/esm/domain/tracing/sampler.js +0 -64
- package/esm/domain/tracing/sampler.js.map +0 -1
- package/esm/domain/tracing/tracer.d.ts +0 -30
- package/esm/domain/tracing/tracer.js +0 -156
- package/esm/domain/tracing/tracer.js.map +0 -1
- package/esm/domain/tracing/tracer.types.d.ts +0 -12
- package/esm/domain/tracing/tracer.types.js +0 -2
- package/esm/domain/tracing/tracer.types.js.map +0 -1
- package/esm/domain/trackEventCounts.d.ts +0 -17
- package/esm/domain/trackEventCounts.js +0 -47
- package/esm/domain/trackEventCounts.js.map +0 -1
- package/esm/domain/view/bfCacheSupport.d.ts +0 -2
- package/esm/domain/view/bfCacheSupport.js +0 -10
- package/esm/domain/view/bfCacheSupport.js.map +0 -1
- package/esm/domain/view/trackViewEventCounts.d.ts +0 -5
- package/esm/domain/view/trackViewEventCounts.js +0 -13
- package/esm/domain/view/trackViewEventCounts.js.map +0 -1
- package/esm/domain/view/trackViews.d.ts +0 -65
- package/esm/domain/view/trackViews.js +0 -278
- package/esm/domain/view/trackViews.js.map +0 -1
- package/esm/domain/view/viewCollection.d.ts +0 -18
- package/esm/domain/view/viewCollection.js +0 -150
- package/esm/domain/view/viewCollection.js.map +0 -1
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +0 -6
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +0 -28
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +0 -1
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +0 -18
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +0 -39
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +0 -1
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +0 -6
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +0 -41
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +0 -8
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +0 -14
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +0 -21
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +0 -34
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +0 -37
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +0 -130
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +0 -13
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +0 -34
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +0 -10
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +0 -30
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +0 -19
- package/esm/domain/view/viewMetrics/trackFirstInput.js +0 -40
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +0 -15
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +0 -38
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +0 -25
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +0 -149
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +0 -18
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +0 -57
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +0 -14
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +0 -47
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +0 -14
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +0 -40
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +0 -25
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +0 -72
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +0 -1
- package/esm/domain/vital/vitalCollection.d.ts +0 -55
- package/esm/domain/vital/vitalCollection.js +0 -107
- package/esm/domain/vital/vitalCollection.js.map +0 -1
- package/esm/domain/waitPageActivityEnd.d.ts +0 -54
- package/esm/domain/waitPageActivityEnd.js +0 -123
- package/esm/domain/waitPageActivityEnd.js.map +0 -1
- package/esm/domainContext.types.d.ts +0 -39
- package/esm/domainContext.types.js +0 -5
- package/esm/domainContext.types.js.map +0 -1
- package/esm/index.d.ts +0 -42
- package/esm/index.js +0 -22
- package/esm/index.js.map +0 -1
- package/esm/rawRumEvent.types.d.ts +0 -326
- package/esm/rawRumEvent.types.js +0 -31
- package/esm/rawRumEvent.types.js.map +0 -1
- package/esm/rumEvent.types.d.ts +0 -2038
- package/esm/rumEvent.types.js +0 -6
- package/esm/rumEvent.types.js.map +0 -1
- package/esm/transport/formDataTransport.d.ts +0 -16
- package/esm/transport/formDataTransport.js +0 -43
- package/esm/transport/formDataTransport.js.map +0 -1
- package/esm/transport/startRumBatch.d.ts +0 -5
- package/esm/transport/startRumBatch.js +0 -30
- package/esm/transport/startRumBatch.js.map +0 -1
- package/esm/transport/startRumEventBridge.d.ts +0 -2
- package/esm/transport/startRumEventBridge.js +0 -8
- package/esm/transport/startRumEventBridge.js.map +0 -1
- package/src/browser/firstInputPolyfill.ts +0 -87
- package/src/domain/error/trackConsoleError.ts +0 -14
- package/src/domain/resource/matchRequestResourceEntry.ts +0 -68
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +0 -27
- package/src/domain/rumSessionManager.ts +0 -134
- package/src/domain/sampler/sampler.ts +0 -63
- package/src/domain/tracing/sampler.ts +0 -69
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +0 -70
- package/src/domain/view/viewMetrics/trackFirstInput.ts +0 -59
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { monitor } from "@kubesense/kubesense-js-core/monitor";
|
|
2
|
+
//#region src/domain/view/viewMetrics/interactionCountPolyfill.ts
|
|
3
|
+
/**
|
|
4
|
+
* performance.interactionCount polyfill
|
|
5
|
+
*
|
|
6
|
+
* The interactionCount is an integer which counts the total number of distinct user interactions,
|
|
7
|
+
* for which there was a unique interactionId.
|
|
8
|
+
*
|
|
9
|
+
* The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213
|
|
10
|
+
* This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.
|
|
11
|
+
* 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.
|
|
12
|
+
*
|
|
13
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts
|
|
14
|
+
*/
|
|
15
|
+
let observer;
|
|
16
|
+
let interactionCountEstimate = 0;
|
|
17
|
+
let minKnownInteractionId = Infinity;
|
|
18
|
+
let maxKnownInteractionId = 0;
|
|
19
|
+
function initInteractionCountPolyfill() {
|
|
20
|
+
if ("interactionCount" in performance || observer) return;
|
|
21
|
+
observer = new window.PerformanceObserver(monitor((entries) => {
|
|
22
|
+
entries.getEntries().forEach((e) => {
|
|
23
|
+
const entry = e;
|
|
24
|
+
if (entry.interactionId) {
|
|
25
|
+
minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId);
|
|
26
|
+
maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId);
|
|
27
|
+
interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}));
|
|
31
|
+
observer.observe({
|
|
32
|
+
type: "event",
|
|
33
|
+
buffered: true,
|
|
34
|
+
durationThreshold: 0
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Returns the `interactionCount` value using the native API (if available)
|
|
39
|
+
* or the polyfill estimate in this module.
|
|
40
|
+
*/
|
|
41
|
+
const getInteractionCount = () => observer ? interactionCountEstimate : window.performance.interactionCount || 0;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { getInteractionCount, initInteractionCountPolyfill };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=interactionCountPolyfill.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionCountPolyfill.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/interactionCountPolyfill.ts"],"sourcesContent":["/**\n * performance.interactionCount polyfill\n *\n * The interactionCount is an integer which counts the total number of distinct user interactions,\n * for which there was a unique interactionId.\n *\n * The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213\n * This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.\n * 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.\n *\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts\n */\n\nimport { monitor } from '@kubesense/kubesense-js-core/monitor'\nimport type {\n BrowserWindow,\n RumPerformanceEventTiming,\n RumPerformanceObserver,\n} from '../../../browser/performanceObservable'\n\nlet observer: RumPerformanceObserver | undefined\n\nlet interactionCountEstimate = 0\nlet minKnownInteractionId = Infinity\nlet maxKnownInteractionId = 0\n\nexport function initInteractionCountPolyfill() {\n if ('interactionCount' in performance || observer) {\n return\n }\n\n observer = new (window as BrowserWindow).PerformanceObserver(\n monitor((entries: PerformanceObserverEntryList) => {\n entries.getEntries().forEach((e) => {\n const entry = e as unknown as RumPerformanceEventTiming\n\n if (entry.interactionId) {\n minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId)\n maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId)\n\n interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1\n }\n })\n })\n )\n\n observer.observe({ type: 'event', buffered: true, durationThreshold: 0 })\n}\n\n/**\n * Returns the `interactionCount` value using the native API (if available)\n * or the polyfill estimate in this module.\n */\nexport const getInteractionCount = () =>\n observer ? interactionCountEstimate : (window as BrowserWindow).performance.interactionCount || 0\n\nexport function resetInteractionCountPolyfill() {\n if (observer) {\n observer.disconnect()\n\n observer = undefined\n interactionCountEstimate = 0\n minKnownInteractionId = Infinity\n maxKnownInteractionId = 0\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,IAAI;AAEJ,IAAI,2BAA2B;AAC/B,IAAI,wBAAwB;AAC5B,IAAI,wBAAwB;AAE5B,SAAgB,+BAA+B;CAC7C,IAAI,sBAAsB,eAAe,UACvC;CAGF,WAAW,IAAK,OAAyB,oBACvC,SAAS,YAA0C;EACjD,QAAQ,WAAW,CAAC,CAAC,SAAS,MAAM;GAClC,MAAM,QAAQ;GAEd,IAAI,MAAM,eAAe;IACvB,wBAAwB,KAAK,IAAI,uBAAuB,MAAM,aAAa;IAC3E,wBAAwB,KAAK,IAAI,uBAAuB,MAAM,aAAa;IAE3E,4BAA4B,wBAAwB,yBAAyB,IAAI;GACnF;EACF,CAAC;CACH,CAAC,CACH;CAEA,SAAS,QAAQ;EAAE,MAAM;EAAS,UAAU;EAAM,mBAAmB;CAAE,CAAC;AAC1E;;;;;AAMA,MAAa,4BACX,WAAW,2BAA4B,OAAyB,YAAY,oBAAoB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { trackRestoredFirstContentfulPaint } from "./trackFirstContentfulPaint.mjs";
|
|
2
|
+
//#region src/domain/view/viewMetrics/trackBfcacheMetrics.ts
|
|
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
|
+
function trackBfcacheMetrics(viewStart, metrics, scheduleViewUpdate) {
|
|
9
|
+
trackRestoredFirstContentfulPaint(viewStart.relative, (paintTime) => {
|
|
10
|
+
metrics.firstContentfulPaint = paintTime;
|
|
11
|
+
metrics.largestContentfulPaint = { value: paintTime };
|
|
12
|
+
scheduleViewUpdate();
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { trackBfcacheMetrics };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=trackBfcacheMetrics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackBfcacheMetrics.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackBfcacheMetrics.ts"],"sourcesContent":["import type { RelativeTime, ClocksState } from '@kubesense/kubesense-js-core/time'\nimport type { InitialViewMetrics } from './trackInitialViewMetrics'\nimport { trackRestoredFirstContentfulPaint } from './trackFirstContentfulPaint'\n\n/**\n * BFCache keeps a full in-memory snapshot of the DOM. When the page is restored, nothing needs to be fetched, so the whole\n * viewport repaints in a single frame. Consequently, LCP almost always equals FCP.\n * (See: https://github.com/GoogleChrome/web-vitals/pull/87)\n */\nexport function trackBfcacheMetrics(\n viewStart: ClocksState,\n metrics: InitialViewMetrics,\n scheduleViewUpdate: () => void\n) {\n trackRestoredFirstContentfulPaint(viewStart.relative, (paintTime) => {\n metrics.firstContentfulPaint = paintTime\n metrics.largestContentfulPaint = { value: paintTime as RelativeTime }\n scheduleViewUpdate()\n })\n}\n"],"mappings":";;;;;;;AASA,SAAgB,oBACd,WACA,SACA,oBACA;CACA,kCAAkC,UAAU,WAAW,cAAc;EACnE,QAAQ,uBAAuB;EAC/B,QAAQ,yBAAyB,EAAE,OAAO,UAA0B;EACpE,mBAAmB;CACrB,CAAC;AACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { trackCumulativeLayoutShift } from "./trackCumulativeLayoutShift.mjs";
|
|
2
|
+
import { trackInteractionToNextPaint } from "./trackInteractionToNextPaint.mjs";
|
|
3
|
+
import { trackLoadingTime } from "./trackLoadingTime.mjs";
|
|
4
|
+
import { trackScrollMetrics } from "./trackScrollMetrics.mjs";
|
|
5
|
+
import { elapsed, timeStampNow } from "@kubesense/kubesense-js-core/time";
|
|
6
|
+
//#region src/domain/view/viewMetrics/trackCommonViewMetrics.ts
|
|
7
|
+
function trackCommonViewMetrics(lifeCycle, domMutationObservable, windowOpenObservable, configuration, scheduleViewUpdate, loadingType, viewStart) {
|
|
8
|
+
const commonViewMetrics = {};
|
|
9
|
+
let hasManualLoadingTime = false;
|
|
10
|
+
let viewEnded = false;
|
|
11
|
+
const { stop: stopLoadingTimeTracking, setLoadEvent } = trackLoadingTime(lifeCycle, domMutationObservable, windowOpenObservable, configuration, loadingType, viewStart, (newLoadingTime) => {
|
|
12
|
+
if (!hasManualLoadingTime) {
|
|
13
|
+
commonViewMetrics.loadingTime = newLoadingTime;
|
|
14
|
+
scheduleViewUpdate();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const { stop: stopScrollMetricsTracking } = trackScrollMetrics(viewStart, (newScrollMetrics) => {
|
|
18
|
+
commonViewMetrics.scroll = newScrollMetrics;
|
|
19
|
+
});
|
|
20
|
+
const { stop: stopCLSTracking } = trackCumulativeLayoutShift(configuration, viewStart.relative, (cumulativeLayoutShift) => {
|
|
21
|
+
commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift;
|
|
22
|
+
scheduleViewUpdate();
|
|
23
|
+
});
|
|
24
|
+
const { stop: stopINPTracking, getInteractionToNextPaint, setViewEnd: setINPViewEnd } = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType);
|
|
25
|
+
return {
|
|
26
|
+
stop: () => {
|
|
27
|
+
stopLoadingTimeTracking();
|
|
28
|
+
stopCLSTracking();
|
|
29
|
+
stopScrollMetricsTracking();
|
|
30
|
+
},
|
|
31
|
+
stopINPTracking,
|
|
32
|
+
setLoadEvent,
|
|
33
|
+
setViewEnd: (viewEndTime) => {
|
|
34
|
+
viewEnded = true;
|
|
35
|
+
setINPViewEnd(viewEndTime);
|
|
36
|
+
},
|
|
37
|
+
getCommonViewMetrics: () => {
|
|
38
|
+
commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();
|
|
39
|
+
return commonViewMetrics;
|
|
40
|
+
},
|
|
41
|
+
setLoadingTime: (callTimestamp) => {
|
|
42
|
+
if (viewEnded) return;
|
|
43
|
+
const loadingTime = elapsed(viewStart.timeStamp, callTimestamp ?? timeStampNow());
|
|
44
|
+
if (!hasManualLoadingTime) stopLoadingTimeTracking();
|
|
45
|
+
hasManualLoadingTime = true;
|
|
46
|
+
commonViewMetrics.loadingTime = loadingTime;
|
|
47
|
+
scheduleViewUpdate();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { trackCommonViewMetrics };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=trackCommonViewMetrics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackCommonViewMetrics.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackCommonViewMetrics.ts"],"sourcesContent":["import type { ClocksState, RelativeTime, Duration, TimeStamp } from '@kubesense/kubesense-js-core/time'\nimport type { Observable } from '@kubesense/kubesense-browser-core'\nimport { elapsed, timeStampNow } from '@kubesense/kubesense-js-core/time'\nimport type { ViewLoadingType } from '../../../rawRumEvent.types'\nimport type { RumConfiguration } from '../../configuration'\nimport type { LifeCycle } from '../../lifeCycle'\nimport type { RumMutationRecord } from '../../../browser/domMutationObservable'\nimport type { CumulativeLayoutShift } from './trackCumulativeLayoutShift'\nimport { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift'\nimport type { InteractionToNextPaint } from './trackInteractionToNextPaint'\nimport { trackInteractionToNextPaint } from './trackInteractionToNextPaint'\nimport { trackLoadingTime } from './trackLoadingTime'\nimport type { ScrollMetrics } from './trackScrollMetrics'\nimport { trackScrollMetrics } from './trackScrollMetrics'\n\nexport interface CommonViewMetrics {\n loadingTime?: Duration\n cumulativeLayoutShift?: CumulativeLayoutShift\n interactionToNextPaint?: InteractionToNextPaint\n scroll?: ScrollMetrics\n}\n\nexport function trackCommonViewMetrics(\n lifeCycle: LifeCycle,\n domMutationObservable: Observable<RumMutationRecord[]>,\n windowOpenObservable: Observable<void>,\n configuration: RumConfiguration,\n scheduleViewUpdate: () => void,\n loadingType: ViewLoadingType,\n viewStart: ClocksState\n) {\n const commonViewMetrics: CommonViewMetrics = {}\n let hasManualLoadingTime = false\n let viewEnded = false\n\n const { stop: stopLoadingTimeTracking, setLoadEvent } = trackLoadingTime(\n lifeCycle,\n domMutationObservable,\n windowOpenObservable,\n configuration,\n loadingType,\n viewStart,\n (newLoadingTime) => {\n if (!hasManualLoadingTime) {\n commonViewMetrics.loadingTime = newLoadingTime\n scheduleViewUpdate()\n }\n }\n )\n\n const { stop: stopScrollMetricsTracking } = trackScrollMetrics(viewStart, (newScrollMetrics) => {\n commonViewMetrics.scroll = newScrollMetrics\n })\n\n const { stop: stopCLSTracking } = trackCumulativeLayoutShift(\n configuration,\n viewStart.relative,\n (cumulativeLayoutShift) => {\n commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift\n scheduleViewUpdate()\n }\n )\n\n const {\n stop: stopINPTracking,\n getInteractionToNextPaint,\n setViewEnd: setINPViewEnd,\n } = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType)\n\n return {\n stop: () => {\n stopLoadingTimeTracking()\n stopCLSTracking()\n stopScrollMetricsTracking()\n },\n stopINPTracking,\n setLoadEvent,\n setViewEnd: (viewEndTime: RelativeTime) => {\n viewEnded = true\n setINPViewEnd(viewEndTime)\n },\n getCommonViewMetrics: () => {\n commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint()\n return commonViewMetrics\n },\n setLoadingTime: (callTimestamp?: TimeStamp) => {\n if (viewEnded) {\n return\n }\n const loadingTime = elapsed(viewStart.timeStamp, callTimestamp ?? timeStampNow())\n if (!hasManualLoadingTime) {\n stopLoadingTimeTracking()\n }\n hasManualLoadingTime = true\n commonViewMetrics.loadingTime = loadingTime\n scheduleViewUpdate()\n },\n }\n}\n"],"mappings":";;;;;;AAsBA,SAAgB,uBACd,WACA,uBACA,sBACA,eACA,oBACA,aACA,WACA;CACA,MAAM,oBAAuC,CAAC;CAC9C,IAAI,uBAAuB;CAC3B,IAAI,YAAY;CAEhB,MAAM,EAAE,MAAM,yBAAyB,iBAAiB,iBACtD,WACA,uBACA,sBACA,eACA,aACA,YACC,mBAAmB;EAClB,IAAI,CAAC,sBAAsB;GACzB,kBAAkB,cAAc;GAChC,mBAAmB;EACrB;CACF,CACF;CAEA,MAAM,EAAE,MAAM,8BAA8B,mBAAmB,YAAY,qBAAqB;EAC9F,kBAAkB,SAAS;CAC7B,CAAC;CAED,MAAM,EAAE,MAAM,oBAAoB,2BAChC,eACA,UAAU,WACT,0BAA0B;EACzB,kBAAkB,wBAAwB;EAC1C,mBAAmB;CACrB,CACF;CAEA,MAAM,EACJ,MAAM,iBACN,2BACA,YAAY,kBACV,4BAA4B,eAAe,UAAU,UAAU,WAAW;CAE9E,OAAO;EACL,YAAY;GACV,wBAAwB;GACxB,gBAAgB;GAChB,0BAA0B;EAC5B;EACA;EACA;EACA,aAAa,gBAA8B;GACzC,YAAY;GACZ,cAAc,WAAW;EAC3B;EACA,4BAA4B;GAC1B,kBAAkB,yBAAyB,0BAA0B;GACrE,OAAO;EACT;EACA,iBAAiB,kBAA8B;GAC7C,IAAI,WACF;GAEF,MAAM,cAAc,QAAQ,UAAU,WAAW,iBAAiB,aAAa,CAAC;GAChF,IAAI,CAAC,sBACH,wBAAwB;GAE1B,uBAAuB;GACvB,kBAAkB,cAAc;GAChC,mBAAmB;EACrB;CACF;AACF"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { isElementNode } from "../../../browser/htmlDomUtils.mjs";
|
|
2
|
+
import { createPerformanceObservable, supportPerformanceTimingEvent } from "../../../browser/performanceObservable.mjs";
|
|
3
|
+
import { getSelectorFromElement } from "../../getSelectorFromElement.mjs";
|
|
4
|
+
import { getClsAttributionImpactedArea } from "./getClsAttributionImpactedArea.mjs";
|
|
5
|
+
import { ONE_SECOND, elapsed } from "@kubesense/kubesense-js-core/time";
|
|
6
|
+
import { noop, round } from "@kubesense/kubesense-browser-core";
|
|
7
|
+
//#region src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts
|
|
8
|
+
/**
|
|
9
|
+
* Track the cumulative layout shifts (CLS).
|
|
10
|
+
* Layout shifts are grouped into session windows.
|
|
11
|
+
* The minimum gap between session windows is 1 second.
|
|
12
|
+
* The maximum duration of a session window is 5 second.
|
|
13
|
+
* The session window layout shift value is the sum of layout shifts inside it.
|
|
14
|
+
* The CLS value is the max of session windows values.
|
|
15
|
+
*
|
|
16
|
+
* This yields a new value whenever the CLS value is updated (a higher session window value is computed).
|
|
17
|
+
*
|
|
18
|
+
* See isLayoutShiftSupported to check for browser support.
|
|
19
|
+
*
|
|
20
|
+
* Documentation:
|
|
21
|
+
* https://web.dev/cls/
|
|
22
|
+
* https://web.dev/evolving-cls/
|
|
23
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts
|
|
24
|
+
*/
|
|
25
|
+
function trackCumulativeLayoutShift(configuration, viewStart, callback) {
|
|
26
|
+
if (!isLayoutShiftSupported()) return { stop: noop };
|
|
27
|
+
let maxClsValue = 0;
|
|
28
|
+
let biggestShift;
|
|
29
|
+
callback({ value: 0 });
|
|
30
|
+
const slidingWindow = slidingSessionWindow();
|
|
31
|
+
const performanceSubscription = createPerformanceObservable({
|
|
32
|
+
type: "layout-shift",
|
|
33
|
+
buffered: true
|
|
34
|
+
}).subscribe((entries) => {
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
if (entry.hadRecentInput || entry.startTime < viewStart) continue;
|
|
37
|
+
const { cumulatedValue, isMaxValue } = slidingWindow.update(entry);
|
|
38
|
+
if (isMaxValue) {
|
|
39
|
+
const attribution = getTopImpactedElement(entry.sources);
|
|
40
|
+
biggestShift = {
|
|
41
|
+
target: attribution?.node ? new WeakRef(attribution.node) : void 0,
|
|
42
|
+
time: elapsed(viewStart, entry.startTime),
|
|
43
|
+
previousRect: attribution?.previousRect,
|
|
44
|
+
currentRect: attribution?.currentRect,
|
|
45
|
+
devicePixelRatio: window.devicePixelRatio
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (cumulatedValue > maxClsValue) {
|
|
49
|
+
maxClsValue = cumulatedValue;
|
|
50
|
+
const target = biggestShift?.target?.deref();
|
|
51
|
+
callback({
|
|
52
|
+
value: round(maxClsValue, 4),
|
|
53
|
+
targetSelector: target && getSelectorFromElement(target, configuration.actionNameAttribute),
|
|
54
|
+
time: biggestShift?.time,
|
|
55
|
+
previousRect: biggestShift?.previousRect ? asRumRect(biggestShift.previousRect) : void 0,
|
|
56
|
+
currentRect: biggestShift?.currentRect ? asRumRect(biggestShift.currentRect) : void 0,
|
|
57
|
+
devicePixelRatio: biggestShift?.devicePixelRatio
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return { stop: () => {
|
|
63
|
+
performanceSubscription.unsubscribe();
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
66
|
+
function getTopImpactedElement(sources) {
|
|
67
|
+
let topImpactedSource;
|
|
68
|
+
for (const source of sources) if (source.node && isElementNode(source.node)) {
|
|
69
|
+
const currentImpactedArea = getClsAttributionImpactedArea(source);
|
|
70
|
+
if (!topImpactedSource || getClsAttributionImpactedArea(topImpactedSource) < currentImpactedArea) topImpactedSource = source;
|
|
71
|
+
}
|
|
72
|
+
return topImpactedSource;
|
|
73
|
+
}
|
|
74
|
+
function asRumRect({ x, y, width, height }) {
|
|
75
|
+
return {
|
|
76
|
+
x,
|
|
77
|
+
y,
|
|
78
|
+
width,
|
|
79
|
+
height
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const MAX_WINDOW_DURATION = 5 * ONE_SECOND;
|
|
83
|
+
const MAX_UPDATE_GAP = ONE_SECOND;
|
|
84
|
+
function slidingSessionWindow() {
|
|
85
|
+
let cumulatedValue = 0;
|
|
86
|
+
let startTime;
|
|
87
|
+
let endTime;
|
|
88
|
+
let maxValue = 0;
|
|
89
|
+
return { update: (entry) => {
|
|
90
|
+
const shouldCreateNewWindow = startTime === void 0 || entry.startTime - endTime >= MAX_UPDATE_GAP || entry.startTime - startTime >= MAX_WINDOW_DURATION;
|
|
91
|
+
let isMaxValue;
|
|
92
|
+
if (shouldCreateNewWindow) {
|
|
93
|
+
startTime = endTime = entry.startTime;
|
|
94
|
+
maxValue = cumulatedValue = entry.value;
|
|
95
|
+
isMaxValue = true;
|
|
96
|
+
} else {
|
|
97
|
+
cumulatedValue += entry.value;
|
|
98
|
+
endTime = entry.startTime;
|
|
99
|
+
isMaxValue = entry.value > maxValue;
|
|
100
|
+
if (isMaxValue) maxValue = entry.value;
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
cumulatedValue,
|
|
104
|
+
isMaxValue
|
|
105
|
+
};
|
|
106
|
+
} };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check whether `layout-shift` is supported by the browser.
|
|
110
|
+
*/
|
|
111
|
+
function isLayoutShiftSupported() {
|
|
112
|
+
return supportPerformanceTimingEvent("layout-shift") && "WeakRef" in window;
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { MAX_WINDOW_DURATION, isLayoutShiftSupported, trackCumulativeLayoutShift };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=trackCumulativeLayoutShift.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackCumulativeLayoutShift.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts"],"sourcesContent":["import { round, noop } from '@kubesense/kubesense-browser-core'\nimport { ONE_SECOND, elapsed } from '@kubesense/kubesense-js-core/time'\nimport type { Duration, RelativeTime } from '@kubesense/kubesense-js-core/time'\nimport type { WeakRef, WeakRefConstructor } from '@kubesense/kubesense-browser-core'\nimport { isElementNode } from '../../../browser/htmlDomUtils'\nimport type { RumLayoutShiftAttribution, RumLayoutShiftTiming } from '../../../browser/performanceObservable'\nimport {\n supportPerformanceTimingEvent,\n RumPerformanceEntryType,\n createPerformanceObservable,\n} from '../../../browser/performanceObservable'\nimport { getSelectorFromElement } from '../../getSelectorFromElement'\nimport type { RumConfiguration } from '../../configuration'\nimport type { RumRect } from '../../../rumEvent.types'\nimport { getClsAttributionImpactedArea } from './getClsAttributionImpactedArea'\n\ndeclare const WeakRef: WeakRefConstructor\n\nexport interface CumulativeLayoutShift {\n value: number\n targetSelector?: string\n time?: Duration\n previousRect?: RumRect\n currentRect?: RumRect\n devicePixelRatio?: number\n}\n\ninterface LayoutShiftInstance {\n target: WeakRef<Element> | undefined\n time: Duration\n previousRect: DOMRectReadOnly | undefined\n currentRect: DOMRectReadOnly | undefined\n devicePixelRatio: number\n}\n\n/**\n * Track the cumulative layout shifts (CLS).\n * Layout shifts are grouped into session windows.\n * The minimum gap between session windows is 1 second.\n * The maximum duration of a session window is 5 second.\n * The session window layout shift value is the sum of layout shifts inside it.\n * The CLS value is the max of session windows values.\n *\n * This yields a new value whenever the CLS value is updated (a higher session window value is computed).\n *\n * See isLayoutShiftSupported to check for browser support.\n *\n * Documentation:\n * https://web.dev/cls/\n * https://web.dev/evolving-cls/\n * Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts\n */\nexport function trackCumulativeLayoutShift(\n configuration: RumConfiguration,\n viewStart: RelativeTime,\n callback: (cumulativeLayoutShift: CumulativeLayoutShift) => void\n) {\n if (!isLayoutShiftSupported()) {\n return {\n stop: noop,\n }\n }\n\n let maxClsValue = 0\n let biggestShift: LayoutShiftInstance | undefined\n\n // if no layout shift happen the value should be reported as 0\n callback({\n value: 0,\n })\n\n const slidingWindow = slidingSessionWindow()\n const performanceSubscription = createPerformanceObservable({\n type: RumPerformanceEntryType.LAYOUT_SHIFT,\n buffered: true,\n }).subscribe((entries) => {\n for (const entry of entries) {\n if (entry.hadRecentInput || entry.startTime < viewStart) {\n continue\n }\n\n const { cumulatedValue, isMaxValue } = slidingWindow.update(entry)\n\n if (isMaxValue) {\n const attribution = getTopImpactedElement(entry.sources)\n biggestShift = {\n target: attribution?.node ? new WeakRef(attribution.node) : undefined,\n time: elapsed(viewStart, entry.startTime),\n previousRect: attribution?.previousRect,\n currentRect: attribution?.currentRect,\n devicePixelRatio: window.devicePixelRatio,\n }\n }\n\n if (cumulatedValue > maxClsValue) {\n maxClsValue = cumulatedValue\n const target = biggestShift?.target?.deref()\n\n callback({\n value: round(maxClsValue, 4),\n targetSelector: target && getSelectorFromElement(target, configuration.actionNameAttribute),\n time: biggestShift?.time,\n previousRect: biggestShift?.previousRect ? asRumRect(biggestShift.previousRect) : undefined,\n currentRect: biggestShift?.currentRect ? asRumRect(biggestShift.currentRect) : undefined,\n devicePixelRatio: biggestShift?.devicePixelRatio,\n })\n }\n }\n })\n\n return {\n stop: () => {\n performanceSubscription.unsubscribe()\n },\n }\n}\n\nfunction getTopImpactedElement(\n sources: RumLayoutShiftAttribution[]\n): (RumLayoutShiftAttribution & { node: Element }) | undefined {\n let topImpactedSource: (RumLayoutShiftAttribution & { node: Element }) | undefined\n for (const source of sources) {\n if (source.node && isElementNode(source.node)) {\n const currentImpactedArea = getClsAttributionImpactedArea(source)\n if (!topImpactedSource || getClsAttributionImpactedArea(topImpactedSource) < currentImpactedArea) {\n topImpactedSource = source as RumLayoutShiftAttribution & { node: Element }\n }\n }\n }\n return topImpactedSource\n}\n\nfunction asRumRect({ x, y, width, height }: DOMRectReadOnly): RumRect {\n return { x, y, width, height }\n}\n\nexport const MAX_WINDOW_DURATION = 5 * ONE_SECOND\nconst MAX_UPDATE_GAP = ONE_SECOND\n\nfunction slidingSessionWindow() {\n let cumulatedValue = 0\n let startTime: RelativeTime\n let endTime: RelativeTime\n let maxValue = 0\n\n return {\n update: (entry: RumLayoutShiftTiming) => {\n const shouldCreateNewWindow =\n startTime === undefined ||\n entry.startTime - endTime >= MAX_UPDATE_GAP ||\n entry.startTime - startTime >= MAX_WINDOW_DURATION\n\n let isMaxValue: boolean\n\n if (shouldCreateNewWindow) {\n startTime = endTime = entry.startTime\n maxValue = cumulatedValue = entry.value\n isMaxValue = true\n } else {\n cumulatedValue += entry.value\n endTime = entry.startTime\n isMaxValue = entry.value > maxValue\n\n if (isMaxValue) {\n maxValue = entry.value\n }\n }\n\n return {\n cumulatedValue,\n isMaxValue,\n }\n },\n }\n}\n\n/**\n * Check whether `layout-shift` is supported by the browser.\n */\nexport function isLayoutShiftSupported() {\n return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoDA,SAAgB,2BACd,eACA,WACA,UACA;CACA,IAAI,CAAC,uBAAuB,GAC1B,OAAO,EACL,MAAM,KACR;CAGF,IAAI,cAAc;CAClB,IAAI;CAGJ,SAAS,EACP,OAAO,EACT,CAAC;CAED,MAAM,gBAAgB,qBAAqB;CAC3C,MAAM,0BAA0B,4BAA4B;EAC1D,MAAA;EACA,UAAU;CACZ,CAAC,CAAC,CAAC,WAAW,YAAY;EACxB,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,MAAM,kBAAkB,MAAM,YAAY,WAC5C;GAGF,MAAM,EAAE,gBAAgB,eAAe,cAAc,OAAO,KAAK;GAEjE,IAAI,YAAY;IACd,MAAM,cAAc,sBAAsB,MAAM,OAAO;IACvD,eAAe;KACb,QAAQ,aAAa,OAAO,IAAI,QAAQ,YAAY,IAAI,IAAI,KAAA;KAC5D,MAAM,QAAQ,WAAW,MAAM,SAAS;KACxC,cAAc,aAAa;KAC3B,aAAa,aAAa;KAC1B,kBAAkB,OAAO;IAC3B;GACF;GAEA,IAAI,iBAAiB,aAAa;IAChC,cAAc;IACd,MAAM,SAAS,cAAc,QAAQ,MAAM;IAE3C,SAAS;KACP,OAAO,MAAM,aAAa,CAAC;KAC3B,gBAAgB,UAAU,uBAAuB,QAAQ,cAAc,mBAAmB;KAC1F,MAAM,cAAc;KACpB,cAAc,cAAc,eAAe,UAAU,aAAa,YAAY,IAAI,KAAA;KAClF,aAAa,cAAc,cAAc,UAAU,aAAa,WAAW,IAAI,KAAA;KAC/E,kBAAkB,cAAc;IAClC,CAAC;GACH;EACF;CACF,CAAC;CAED,OAAO,EACL,YAAY;EACV,wBAAwB,YAAY;CACtC,EACF;AACF;AAEA,SAAS,sBACP,SAC6D;CAC7D,IAAI;CACJ,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,QAAQ,cAAc,OAAO,IAAI,GAAG;EAC7C,MAAM,sBAAsB,8BAA8B,MAAM;EAChE,IAAI,CAAC,qBAAqB,8BAA8B,iBAAiB,IAAI,qBAC3E,oBAAoB;CAExB;CAEF,OAAO;AACT;AAEA,SAAS,UAAU,EAAE,GAAG,GAAG,OAAO,UAAoC;CACpE,OAAO;EAAE;EAAG;EAAG;EAAO;CAAO;AAC/B;AAEA,MAAa,sBAAsB,IAAI;AACvC,MAAM,iBAAiB;AAEvB,SAAS,uBAAuB;CAC9B,IAAI,iBAAiB;CACrB,IAAI;CACJ,IAAI;CACJ,IAAI,WAAW;CAEf,OAAO,EACL,SAAS,UAAgC;EACvC,MAAM,wBACJ,cAAc,KAAA,KACd,MAAM,YAAY,WAAW,kBAC7B,MAAM,YAAY,aAAa;EAEjC,IAAI;EAEJ,IAAI,uBAAuB;GACzB,YAAY,UAAU,MAAM;GAC5B,WAAW,iBAAiB,MAAM;GAClC,aAAa;EACf,OAAO;GACL,kBAAkB,MAAM;GACxB,UAAU,MAAM;GAChB,aAAa,MAAM,QAAQ;GAE3B,IAAI,YACF,WAAW,MAAM;EAErB;EAEA,OAAO;GACL;GACA;EACF;CACF,EACF;AACF;;;;AAKA,SAAgB,yBAAyB;CACvC,OAAO,8BAAA,cAAkE,KAAK,aAAa;AAC7F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createPerformanceObservable } from "../../../browser/performanceObservable.mjs";
|
|
2
|
+
import { ONE_MINUTE, elapsed, relativeNow } from "@kubesense/kubesense-js-core/time";
|
|
3
|
+
//#region src/domain/view/viewMetrics/trackFirstContentfulPaint.ts
|
|
4
|
+
const FCP_MAXIMUM_DELAY = 10 * ONE_MINUTE;
|
|
5
|
+
function trackFirstContentfulPaint(firstHidden, callback) {
|
|
6
|
+
return { stop: createPerformanceObservable({
|
|
7
|
+
type: "paint",
|
|
8
|
+
buffered: true
|
|
9
|
+
}).subscribe((entries) => {
|
|
10
|
+
const fcpEntry = entries.find((entry) => entry.name === "first-contentful-paint" && entry.startTime < firstHidden.timeStamp && entry.startTime < FCP_MAXIMUM_DELAY);
|
|
11
|
+
if (fcpEntry) callback(fcpEntry.startTime);
|
|
12
|
+
}).unsubscribe };
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Measure the First Contentful Paint after a BFCache restoration.
|
|
16
|
+
* The DOM is restored synchronously, so we approximate the FCP with the first frame
|
|
17
|
+
* rendered just after the pageshow event, using two nested requestAnimationFrame calls.
|
|
18
|
+
*/
|
|
19
|
+
function trackRestoredFirstContentfulPaint(viewStartRelative, callback) {
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
requestAnimationFrame(() => {
|
|
22
|
+
callback(elapsed(viewStartRelative, relativeNow()));
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { FCP_MAXIMUM_DELAY, trackFirstContentfulPaint, trackRestoredFirstContentfulPaint };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=trackFirstContentfulPaint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackFirstContentfulPaint.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackFirstContentfulPaint.ts"],"sourcesContent":["import type { RelativeTime, Duration } from '@kubesense/kubesense-js-core/time'\nimport { ONE_MINUTE, elapsed, relativeNow } from '@kubesense/kubesense-js-core/time'\nimport type { RumPerformancePaintTiming } from '../../../browser/performanceObservable'\nimport { createPerformanceObservable, RumPerformanceEntryType } from '../../../browser/performanceObservable'\nimport type { FirstHidden } from './trackFirstHidden'\n\n// Discard FCP timings above a certain delay to avoid incorrect data\n// It happens in some cases like sleep mode or some browser implementations\nexport const FCP_MAXIMUM_DELAY = 10 * ONE_MINUTE\n\nexport function trackFirstContentfulPaint(firstHidden: FirstHidden, callback: (fcpTiming: RelativeTime) => void) {\n const performanceSubscription = createPerformanceObservable({\n type: RumPerformanceEntryType.PAINT,\n buffered: true,\n }).subscribe((entries) => {\n const fcpEntry = entries.find(\n (entry): entry is RumPerformancePaintTiming =>\n entry.name === 'first-contentful-paint' &&\n entry.startTime < firstHidden.timeStamp &&\n entry.startTime < FCP_MAXIMUM_DELAY\n )\n if (fcpEntry) {\n callback(fcpEntry.startTime)\n }\n })\n return {\n stop: performanceSubscription.unsubscribe,\n }\n}\n\n/**\n * Measure the First Contentful Paint after a BFCache restoration.\n * The DOM is restored synchronously, so we approximate the FCP with the first frame\n * rendered just after the pageshow event, using two nested requestAnimationFrame calls.\n */\nexport function trackRestoredFirstContentfulPaint(viewStartRelative: RelativeTime, callback: (fcp: Duration) => void) {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n callback(elapsed(viewStartRelative, relativeNow()))\n })\n })\n}\n"],"mappings":";;;AAQA,MAAa,oBAAoB,KAAK;AAEtC,SAAgB,0BAA0B,aAA0B,UAA6C;CAe/G,OAAO,EACL,MAf8B,4BAA4B;EAC1D,MAAA;EACA,UAAU;CACZ,CAAC,CAAC,CAAC,WAAW,YAAY;EACxB,MAAM,WAAW,QAAQ,MACtB,UACC,MAAM,SAAS,4BACf,MAAM,YAAY,YAAY,aAC9B,MAAM,YAAY,iBACtB;EACA,IAAI,UACF,SAAS,SAAS,SAAS;CAE/B,CAE8B,CAAC,CAAC,YAChC;AACF;;;;;;AAOA,SAAgB,kCAAkC,mBAAiC,UAAmC;CACpH,4BAA4B;EAC1B,4BAA4B;GAC1B,SAAS,QAAQ,mBAAmB,YAAY,CAAC,CAAC;EACpD,CAAC;CACH,CAAC;AACH"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { supportPerformanceTimingEvent } from "../../../browser/performanceObservable.mjs";
|
|
2
|
+
import { DOM_EVENT, addEventListeners, noop } from "@kubesense/kubesense-browser-core";
|
|
3
|
+
//#region src/domain/view/viewMetrics/trackFirstHidden.ts
|
|
4
|
+
function trackFirstHidden(viewStart, eventTarget = window) {
|
|
5
|
+
if (document.visibilityState === "hidden") return {
|
|
6
|
+
timeStamp: 0,
|
|
7
|
+
stop: noop
|
|
8
|
+
};
|
|
9
|
+
if (supportPerformanceTimingEvent("visibility-state")) {
|
|
10
|
+
const firstHiddenEntry = performance.getEntriesByType("visibility-state").filter((entry) => entry.name === "hidden").find((entry) => entry.startTime >= viewStart.relative);
|
|
11
|
+
if (firstHiddenEntry) return {
|
|
12
|
+
timeStamp: firstHiddenEntry.startTime,
|
|
13
|
+
stop: noop
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
let timeStamp = Infinity;
|
|
17
|
+
const { stop } = addEventListeners(eventTarget, [DOM_EVENT.PAGE_HIDE, DOM_EVENT.VISIBILITY_CHANGE], (event) => {
|
|
18
|
+
if (event.type === DOM_EVENT.PAGE_HIDE || document.visibilityState === "hidden") {
|
|
19
|
+
timeStamp = event.timeStamp;
|
|
20
|
+
stop();
|
|
21
|
+
}
|
|
22
|
+
}, { capture: true });
|
|
23
|
+
return {
|
|
24
|
+
get timeStamp() {
|
|
25
|
+
return timeStamp;
|
|
26
|
+
},
|
|
27
|
+
stop
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { trackFirstHidden };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=trackFirstHidden.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackFirstHidden.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackFirstHidden.ts"],"sourcesContent":["import type { ClocksState, RelativeTime } from '@kubesense/kubesense-js-core/time'\nimport { addEventListeners, DOM_EVENT, noop } from '@kubesense/kubesense-browser-core'\nimport { supportPerformanceTimingEvent, RumPerformanceEntryType } from '../../../browser/performanceObservable'\n\nexport type FirstHidden = ReturnType<typeof trackFirstHidden>\n\nexport interface Options {\n viewStart: ClocksState\n}\n\nexport function trackFirstHidden(viewStart: ClocksState, eventTarget: Window = window) {\n if (document.visibilityState === 'hidden') {\n return { timeStamp: 0 as RelativeTime, stop: noop }\n }\n\n if (supportPerformanceTimingEvent(RumPerformanceEntryType.VISIBILITY_STATE)) {\n const firstHiddenEntry = performance\n .getEntriesByType(RumPerformanceEntryType.VISIBILITY_STATE)\n .filter((entry) => entry.name === 'hidden')\n .find((entry) => entry.startTime >= viewStart.relative)\n\n if (firstHiddenEntry) {\n return { timeStamp: firstHiddenEntry.startTime as RelativeTime, stop: noop }\n }\n }\n\n let timeStamp: RelativeTime = Infinity as RelativeTime\n\n const { stop } = addEventListeners(\n eventTarget,\n [DOM_EVENT.PAGE_HIDE, DOM_EVENT.VISIBILITY_CHANGE],\n (event) => {\n if (event.type === DOM_EVENT.PAGE_HIDE || document.visibilityState === 'hidden') {\n timeStamp = event.timeStamp as RelativeTime\n stop()\n }\n },\n { capture: true }\n )\n\n return {\n get timeStamp() {\n return timeStamp\n },\n stop,\n }\n}\n"],"mappings":";;;AAUA,SAAgB,iBAAiB,WAAwB,cAAsB,QAAQ;CACrF,IAAI,SAAS,oBAAoB,UAC/B,OAAO;EAAE,WAAW;EAAmB,MAAM;CAAK;CAGpD,IAAI,8BAAA,kBAAsE,GAAG;EAC3E,MAAM,mBAAmB,YACtB,iBAAA,kBAAyD,CAAC,CAC1D,QAAQ,UAAU,MAAM,SAAS,QAAQ,CAAC,CAC1C,MAAM,UAAU,MAAM,aAAa,UAAU,QAAQ;EAExD,IAAI,kBACF,OAAO;GAAE,WAAW,iBAAiB;GAA2B,MAAM;EAAK;CAE/E;CAEA,IAAI,YAA0B;CAE9B,MAAM,EAAE,SAAS,kBACf,aACA,CAAC,UAAU,WAAW,UAAU,iBAAiB,IAChD,UAAU;EACT,IAAI,MAAM,SAAS,UAAU,aAAa,SAAS,oBAAoB,UAAU;GAC/E,YAAY,MAAM;GAClB,KAAK;EACP;CACF,GACA,EAAE,SAAS,KAAK,CAClB;CAEA,OAAO;EACL,IAAI,YAAY;GACd,OAAO;EACT;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { trackFirstContentfulPaint } from "./trackFirstContentfulPaint.mjs";
|
|
2
|
+
import { trackNavigationTimings } from "./trackNavigationTimings.mjs";
|
|
3
|
+
import { trackLargestContentfulPaint } from "./trackLargestContentfulPaint.mjs";
|
|
4
|
+
import { trackFirstHidden } from "./trackFirstHidden.mjs";
|
|
5
|
+
//#region src/domain/view/viewMetrics/trackInitialViewMetrics.ts
|
|
6
|
+
function trackInitialViewMetrics(configuration, viewStart, setLoadEvent, scheduleViewUpdate) {
|
|
7
|
+
const initialViewMetrics = {};
|
|
8
|
+
const { stop: stopNavigationTracking } = trackNavigationTimings((navigationTimings) => {
|
|
9
|
+
setLoadEvent(navigationTimings.loadEvent);
|
|
10
|
+
initialViewMetrics.navigationTimings = navigationTimings;
|
|
11
|
+
scheduleViewUpdate();
|
|
12
|
+
});
|
|
13
|
+
const firstHidden = trackFirstHidden(viewStart);
|
|
14
|
+
const { stop: stopFCPTracking } = trackFirstContentfulPaint(firstHidden, (firstContentfulPaint) => {
|
|
15
|
+
initialViewMetrics.firstContentfulPaint = firstContentfulPaint;
|
|
16
|
+
scheduleViewUpdate();
|
|
17
|
+
});
|
|
18
|
+
const { stop: stopLCPTracking } = trackLargestContentfulPaint(configuration, firstHidden, window, (largestContentfulPaint) => {
|
|
19
|
+
initialViewMetrics.largestContentfulPaint = largestContentfulPaint;
|
|
20
|
+
scheduleViewUpdate();
|
|
21
|
+
});
|
|
22
|
+
function stop() {
|
|
23
|
+
stopNavigationTracking();
|
|
24
|
+
stopFCPTracking();
|
|
25
|
+
stopLCPTracking();
|
|
26
|
+
firstHidden.stop();
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
stop,
|
|
30
|
+
initialViewMetrics
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { trackInitialViewMetrics };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=trackInitialViewMetrics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackInitialViewMetrics.mjs","names":[],"sources":["../../../../src/domain/view/viewMetrics/trackInitialViewMetrics.ts"],"sourcesContent":["import type { ClocksState, Duration } from '@kubesense/kubesense-js-core/time'\nimport type { RumConfiguration } from '../../configuration'\nimport { trackFirstContentfulPaint } from './trackFirstContentfulPaint'\nimport type { NavigationTimings } from './trackNavigationTimings'\nimport { trackNavigationTimings } from './trackNavigationTimings'\nimport type { LargestContentfulPaint } from './trackLargestContentfulPaint'\nimport { trackLargestContentfulPaint } from './trackLargestContentfulPaint'\nimport { trackFirstHidden } from './trackFirstHidden'\n\nexport interface InitialViewMetrics {\n firstContentfulPaint?: Duration\n navigationTimings?: NavigationTimings\n largestContentfulPaint?: LargestContentfulPaint\n}\n\nexport function trackInitialViewMetrics(\n configuration: RumConfiguration,\n viewStart: ClocksState,\n setLoadEvent: (loadEnd: Duration) => void,\n scheduleViewUpdate: () => void\n) {\n const initialViewMetrics: InitialViewMetrics = {}\n\n const { stop: stopNavigationTracking } = trackNavigationTimings((navigationTimings) => {\n setLoadEvent(navigationTimings.loadEvent)\n initialViewMetrics.navigationTimings = navigationTimings\n scheduleViewUpdate()\n })\n\n const firstHidden = trackFirstHidden(viewStart)\n const { stop: stopFCPTracking } = trackFirstContentfulPaint(firstHidden, (firstContentfulPaint) => {\n initialViewMetrics.firstContentfulPaint = firstContentfulPaint\n scheduleViewUpdate()\n })\n\n const { stop: stopLCPTracking } = trackLargestContentfulPaint(\n configuration,\n firstHidden,\n window,\n (largestContentfulPaint) => {\n initialViewMetrics.largestContentfulPaint = largestContentfulPaint\n scheduleViewUpdate()\n }\n )\n\n function stop() {\n stopNavigationTracking()\n stopFCPTracking()\n stopLCPTracking()\n firstHidden.stop()\n }\n\n return {\n stop,\n initialViewMetrics,\n }\n}\n"],"mappings":";;;;;AAeA,SAAgB,wBACd,eACA,WACA,cACA,oBACA;CACA,MAAM,qBAAyC,CAAC;CAEhD,MAAM,EAAE,MAAM,2BAA2B,wBAAwB,sBAAsB;EACrF,aAAa,kBAAkB,SAAS;EACxC,mBAAmB,oBAAoB;EACvC,mBAAmB;CACrB,CAAC;CAED,MAAM,cAAc,iBAAiB,SAAS;CAC9C,MAAM,EAAE,MAAM,oBAAoB,0BAA0B,cAAc,yBAAyB;EACjG,mBAAmB,uBAAuB;EAC1C,mBAAmB;CACrB,CAAC;CAED,MAAM,EAAE,MAAM,oBAAoB,4BAChC,eACA,aACA,SACC,2BAA2B;EAC1B,mBAAmB,yBAAyB;EAC5C,mBAAmB;CACrB,CACF;CAEA,SAAS,OAAO;EACd,uBAAuB;EACvB,gBAAgB;EAChB,gBAAgB;EAChB,YAAY,KAAK;CACnB;CAEA,OAAO;EACL;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ViewLoadingType } from "../../../rawRumEvent.types.mjs";
|
|
2
|
+
import { isElementNode } from "../../../browser/htmlDomUtils.mjs";
|
|
3
|
+
import { createPerformanceObservable, supportPerformanceTimingEvent } from "../../../browser/performanceObservable.mjs";
|
|
4
|
+
import { getSelectorFromElement } from "../../getSelectorFromElement.mjs";
|
|
5
|
+
import { getInteractionSelector } from "../../action/interactionSelectorCache.mjs";
|
|
6
|
+
import { getInteractionCount, initInteractionCountPolyfill } from "./interactionCountPolyfill.mjs";
|
|
7
|
+
import { ONE_MINUTE, elapsed } from "@kubesense/kubesense-js-core/time";
|
|
8
|
+
import { noop } from "@kubesense/kubesense-browser-core";
|
|
9
|
+
//#region src/domain/view/viewMetrics/trackInteractionToNextPaint.ts
|
|
10
|
+
const MAX_INTERACTION_ENTRIES = 10;
|
|
11
|
+
const MAX_INP_VALUE = 1 * ONE_MINUTE;
|
|
12
|
+
const RENDER_TIME_GROUPING_THRESHOLD = 8;
|
|
13
|
+
/**
|
|
14
|
+
* Track the interaction to next paint (INP).
|
|
15
|
+
* To avoid outliers, return the p98 worst interaction of the view.
|
|
16
|
+
* Documentation: https://web.dev/inp/
|
|
17
|
+
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/onINP.ts
|
|
18
|
+
*/
|
|
19
|
+
function trackInteractionToNextPaint(configuration, viewStart, viewLoadingType) {
|
|
20
|
+
if (!isInteractionToNextPaintSupported()) return {
|
|
21
|
+
getInteractionToNextPaint: () => void 0,
|
|
22
|
+
setViewEnd: noop,
|
|
23
|
+
stop: noop
|
|
24
|
+
};
|
|
25
|
+
let viewEnd = Infinity;
|
|
26
|
+
let currentInp;
|
|
27
|
+
const { getViewInteractionCount, stopViewInteractionCount } = trackViewInteractionCount(viewLoadingType);
|
|
28
|
+
const longestInteractions = trackLongestInteractions(getViewInteractionCount);
|
|
29
|
+
const subPartsTracker = createSubPartsTracker(longestInteractions);
|
|
30
|
+
const firstInputSubscription = createPerformanceObservable({
|
|
31
|
+
type: "first-input",
|
|
32
|
+
buffered: true
|
|
33
|
+
}).subscribe(handleEntries);
|
|
34
|
+
const eventSubscription = createPerformanceObservable({
|
|
35
|
+
type: "event",
|
|
36
|
+
durationThreshold: 40,
|
|
37
|
+
buffered: true
|
|
38
|
+
}).subscribe(handleEntries);
|
|
39
|
+
function handleEntries(entries) {
|
|
40
|
+
for (const entry of entries) if (entry.interactionId && entry.startTime >= viewStart && entry.startTime <= viewEnd) {
|
|
41
|
+
longestInteractions.process(entry);
|
|
42
|
+
subPartsTracker.process(entry);
|
|
43
|
+
}
|
|
44
|
+
subPartsTracker.pruneUntracked();
|
|
45
|
+
const candidate = longestInteractions.estimateP98Interaction();
|
|
46
|
+
if (candidate) updateCurrentInp(candidate);
|
|
47
|
+
}
|
|
48
|
+
function updateCurrentInp(candidate) {
|
|
49
|
+
const newStartTime = elapsed(viewStart, candidate.startTime);
|
|
50
|
+
if (candidate.duration !== currentInp?.duration || newStartTime !== currentInp.startTime) {
|
|
51
|
+
let targetSelector = getInteractionSelector(candidate.startTime);
|
|
52
|
+
if (!targetSelector && candidate.target && isElementNode(candidate.target)) targetSelector = getSelectorFromElement(candidate.target, configuration.actionNameAttribute);
|
|
53
|
+
currentInp = {
|
|
54
|
+
duration: candidate.duration,
|
|
55
|
+
startTime: newStartTime,
|
|
56
|
+
targetSelector
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
currentInp.subParts = subPartsTracker.computeSubParts(candidate, sanitizeInpValue(currentInp.duration));
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
getInteractionToNextPaint: () => {
|
|
63
|
+
if (currentInp) return {
|
|
64
|
+
value: sanitizeInpValue(currentInp.duration),
|
|
65
|
+
targetSelector: currentInp.targetSelector,
|
|
66
|
+
time: currentInp.startTime,
|
|
67
|
+
subParts: currentInp.subParts
|
|
68
|
+
};
|
|
69
|
+
else if (getViewInteractionCount()) return { value: 0 };
|
|
70
|
+
},
|
|
71
|
+
setViewEnd: (viewEndTime) => {
|
|
72
|
+
viewEnd = viewEndTime;
|
|
73
|
+
stopViewInteractionCount();
|
|
74
|
+
},
|
|
75
|
+
stop: () => {
|
|
76
|
+
eventSubscription.unsubscribe();
|
|
77
|
+
firstInputSubscription.unsubscribe();
|
|
78
|
+
subPartsTracker.stop();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Maintains a bounded list of the slowest interactions seen so far, used to estimate the p98
|
|
84
|
+
* interaction duration without keeping every entry in memory.
|
|
85
|
+
*/
|
|
86
|
+
function trackLongestInteractions(getViewInteractionCount) {
|
|
87
|
+
const longestInteractions = [];
|
|
88
|
+
function sortAndTrimLongestInteractions() {
|
|
89
|
+
longestInteractions.sort((a, b) => b.duration - a.duration).splice(MAX_INTERACTION_ENTRIES);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
/**
|
|
93
|
+
* Process the performance entry:
|
|
94
|
+
* - if its duration is long enough, add the performance entry to the list of worst interactions
|
|
95
|
+
* - if an entry with the same interaction id exists and its duration is lower than the new one, then replace it in the list of worst interactions
|
|
96
|
+
*/
|
|
97
|
+
process(entry) {
|
|
98
|
+
const interactionIndex = longestInteractions.findIndex((interaction) => entry.interactionId === interaction.interactionId);
|
|
99
|
+
const minLongestInteraction = longestInteractions[longestInteractions.length - 1];
|
|
100
|
+
if (interactionIndex !== -1) {
|
|
101
|
+
if (entry.duration > longestInteractions[interactionIndex].duration) {
|
|
102
|
+
longestInteractions[interactionIndex] = entry;
|
|
103
|
+
sortAndTrimLongestInteractions();
|
|
104
|
+
}
|
|
105
|
+
} else if (longestInteractions.length < MAX_INTERACTION_ENTRIES || entry.duration > minLongestInteraction.duration) {
|
|
106
|
+
longestInteractions.push(entry);
|
|
107
|
+
sortAndTrimLongestInteractions();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
/**
|
|
111
|
+
* Compute the p98 longest interaction.
|
|
112
|
+
* For better performance the computation is based on 10 longest interactions and the interaction count of the current view.
|
|
113
|
+
*/
|
|
114
|
+
estimateP98Interaction() {
|
|
115
|
+
const interactionIndex = Math.min(longestInteractions.length - 1, Math.floor(getViewInteractionCount() / 50));
|
|
116
|
+
return longestInteractions[interactionIndex];
|
|
117
|
+
},
|
|
118
|
+
isTracked(interactionId) {
|
|
119
|
+
return longestInteractions.some((i) => i.interactionId === interactionId);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Tracks the number of interactions that occurred during the current view. Freezes the count
|
|
125
|
+
* when the view ends so that the p98 estimate remains stable after `setViewEnd` is called.
|
|
126
|
+
*/
|
|
127
|
+
function trackViewInteractionCount(viewLoadingType) {
|
|
128
|
+
initInteractionCountPolyfill();
|
|
129
|
+
const previousInteractionCount = viewLoadingType === ViewLoadingType.INITIAL_LOAD ? 0 : getInteractionCount();
|
|
130
|
+
let state = { stopped: false };
|
|
131
|
+
function computeViewInteractionCount() {
|
|
132
|
+
return getInteractionCount() - previousInteractionCount;
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
getViewInteractionCount: () => {
|
|
136
|
+
if (state.stopped) return state.interactionCount;
|
|
137
|
+
return computeViewInteractionCount();
|
|
138
|
+
},
|
|
139
|
+
stopViewInteractionCount: () => {
|
|
140
|
+
state = {
|
|
141
|
+
stopped: true,
|
|
142
|
+
interactionCount: computeViewInteractionCount()
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Groups performance entries by interaction and render time to compute INP subparts
|
|
149
|
+
* (input delay, processing duration, presentation delay). Entries sharing the same
|
|
150
|
+
* interactionId, or whose render time falls within the 8 ms Event Timing rounding window,
|
|
151
|
+
* are merged into a single group so that subparts always sum to the reported INP duration.
|
|
152
|
+
*/
|
|
153
|
+
function createSubPartsTracker(longestInteractions) {
|
|
154
|
+
const groupsByInteractionId = /* @__PURE__ */ new Map();
|
|
155
|
+
function updateGroupWithEntry(group, entry) {
|
|
156
|
+
group.startTime = Math.min(entry.startTime, group.startTime);
|
|
157
|
+
group.processingStart = Math.min(entry.processingStart, group.processingStart);
|
|
158
|
+
group.processingEnd = Math.max(entry.processingEnd, group.processingEnd);
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
process(entry) {
|
|
162
|
+
if (entry.interactionId === void 0 || !entry.processingStart || !entry.processingEnd) return;
|
|
163
|
+
const renderTime = entry.startTime + entry.duration;
|
|
164
|
+
const existingGroup = groupsByInteractionId.get(entry.interactionId);
|
|
165
|
+
if (existingGroup) {
|
|
166
|
+
updateGroupWithEntry(existingGroup, entry);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
for (const [, group] of groupsByInteractionId.entries()) if (Math.abs(renderTime - group.referenceRenderTime) <= RENDER_TIME_GROUPING_THRESHOLD) {
|
|
170
|
+
updateGroupWithEntry(group, entry);
|
|
171
|
+
groupsByInteractionId.set(entry.interactionId, group);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
groupsByInteractionId.set(entry.interactionId, {
|
|
175
|
+
startTime: entry.startTime,
|
|
176
|
+
processingStart: entry.processingStart,
|
|
177
|
+
processingEnd: entry.processingEnd,
|
|
178
|
+
referenceRenderTime: renderTime
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
pruneUntracked() {
|
|
182
|
+
for (const [interactionId] of groupsByInteractionId) if (!longestInteractions.isTracked(interactionId)) groupsByInteractionId.delete(interactionId);
|
|
183
|
+
},
|
|
184
|
+
computeSubParts(entry, inpDuration) {
|
|
185
|
+
if (!entry.processingStart || !entry.processingEnd || entry.interactionId === void 0) return;
|
|
186
|
+
const group = groupsByInteractionId.get(entry.interactionId);
|
|
187
|
+
if (!group) return;
|
|
188
|
+
const nextPaintTime = Math.max(group.startTime + inpDuration, group.processingStart);
|
|
189
|
+
const processingEnd = Math.min(group.processingEnd, nextPaintTime);
|
|
190
|
+
return {
|
|
191
|
+
inputDelay: elapsed(group.startTime, group.processingStart),
|
|
192
|
+
processingDuration: elapsed(group.processingStart, processingEnd),
|
|
193
|
+
presentationDelay: elapsed(processingEnd, nextPaintTime)
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
stop() {
|
|
197
|
+
groupsByInteractionId.clear();
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function isInteractionToNextPaintSupported() {
|
|
202
|
+
return supportPerformanceTimingEvent("event") && window.PerformanceEventTiming && "interactionId" in PerformanceEventTiming.prototype;
|
|
203
|
+
}
|
|
204
|
+
function sanitizeInpValue(inpValue) {
|
|
205
|
+
return Math.min(inpValue, MAX_INP_VALUE);
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { MAX_INP_VALUE, isInteractionToNextPaintSupported, trackInteractionToNextPaint, trackViewInteractionCount };
|
|
209
|
+
|
|
210
|
+
//# sourceMappingURL=trackInteractionToNextPaint.mjs.map
|