@kubesense/kubesense-browser-rum-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/preStartRum.d.ts +7 -0
- package/cjs/boot/preStartRum.js +190 -0
- package/cjs/boot/preStartRum.js.map +1 -0
- package/cjs/boot/rumPublicApi.d.ts +409 -0
- package/cjs/boot/rumPublicApi.js +168 -0
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/startRum.d.ts +109 -0
- package/cjs/boot/startRum.js +153 -0
- package/cjs/boot/startRum.js.map +1 -0
- package/cjs/browser/cookieObservable.d.ts +8 -0
- package/cjs/browser/cookieObservable.js +39 -0
- package/cjs/browser/cookieObservable.js.map +1 -0
- package/cjs/browser/domMutationObservable.d.ts +27 -0
- package/cjs/browser/domMutationObservable.js +58 -0
- package/cjs/browser/domMutationObservable.js.map +1 -0
- package/cjs/browser/firstInputPolyfill.d.ts +8 -0
- package/cjs/browser/firstInputPolyfill.js +68 -0
- package/cjs/browser/firstInputPolyfill.js.map +1 -0
- package/cjs/browser/htmlDomUtils.d.ts +13 -0
- package/cjs/browser/htmlDomUtils.js +46 -0
- package/cjs/browser/htmlDomUtils.js.map +1 -0
- package/cjs/browser/locationChangeObservable.d.ts +7 -0
- package/cjs/browser/locationChangeObservable.js +51 -0
- package/cjs/browser/locationChangeObservable.js.map +1 -0
- package/cjs/browser/performanceObservable.d.ts +174 -0
- package/cjs/browser/performanceObservable.js +126 -0
- package/cjs/browser/performanceObservable.js.map +1 -0
- package/cjs/browser/performanceUtils.d.ts +7 -0
- package/cjs/browser/performanceUtils.js +42 -0
- package/cjs/browser/performanceUtils.js.map +1 -0
- package/cjs/browser/scroll.d.ts +2 -0
- package/cjs/browser/scroll.js +33 -0
- package/cjs/browser/scroll.js.map +1 -0
- package/cjs/browser/viewportObservable.d.ts +10 -0
- package/cjs/browser/viewportObservable.js +37 -0
- package/cjs/browser/viewportObservable.js.map +1 -0
- package/cjs/browser/windowOpenObservable.d.ts +5 -0
- package/cjs/browser/windowOpenObservable.js +10 -0
- package/cjs/browser/windowOpenObservable.js.map +1 -0
- package/cjs/domain/action/actionCollection.d.ts +21 -0
- package/cjs/domain/action/actionCollection.js +96 -0
- package/cjs/domain/action/actionCollection.js.map +1 -0
- package/cjs/domain/action/actionNameConstants.d.ts +18 -0
- package/cjs/domain/action/actionNameConstants.js +11 -0
- package/cjs/domain/action/actionNameConstants.js.map +1 -0
- package/cjs/domain/action/clickChain.d.ts +8 -0
- package/cjs/domain/action/clickChain.js +61 -0
- package/cjs/domain/action/clickChain.js.map +1 -0
- package/cjs/domain/action/computeFrustration.d.ts +6 -0
- package/cjs/domain/action/computeFrustration.js +70 -0
- package/cjs/domain/action/computeFrustration.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.d.ts +4 -0
- package/cjs/domain/action/getActionNameFromElement.js +239 -0
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/action/interactionSelectorCache.d.ts +5 -0
- package/cjs/domain/action/interactionSelectorCache.js +23 -0
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +19 -0
- package/cjs/domain/action/listenActionEvents.js +61 -0
- package/cjs/domain/action/listenActionEvents.js.map +1 -0
- package/cjs/domain/action/trackClickActions.d.ts +81 -0
- package/cjs/domain/action/trackClickActions.js +237 -0
- package/cjs/domain/action/trackClickActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +5 -0
- package/cjs/domain/assembly.js +102 -0
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +325 -0
- package/cjs/domain/configuration/configuration.js +205 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +2 -0
- package/cjs/domain/configuration/index.js +19 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/jsonPathParser.d.ts +28 -0
- package/cjs/domain/configuration/jsonPathParser.js +159 -0
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/cjs/domain/configuration/remoteConfiguration.js +243 -0
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js +7 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/cjs/domain/contexts/ciVisibilityContext.js +34 -0
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -0
- package/cjs/domain/contexts/connectivityContext.js +11 -0
- package/cjs/domain/contexts/connectivityContext.js.map +1 -0
- package/cjs/domain/contexts/defaultContext.d.ts +4 -0
- package/cjs/domain/contexts/defaultContext.js +34 -0
- package/cjs/domain/contexts/defaultContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.d.ts +6 -0
- package/cjs/domain/contexts/displayContext.js +28 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/featureFlagContext.d.ts +19 -0
- package/cjs/domain/contexts/featureFlagContext.js +53 -0
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -0
- package/cjs/domain/contexts/internalContext.d.ts +12 -0
- package/cjs/domain/contexts/internalContext.js +26 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.d.ts +23 -0
- package/cjs/domain/contexts/pageStateHistory.js +104 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/sessionContext.d.ts +5 -0
- package/cjs/domain/contexts/sessionContext.js +47 -0
- package/cjs/domain/contexts/sessionContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -0
- package/cjs/domain/contexts/syntheticsContext.js +25 -0
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -0
- package/cjs/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/cjs/domain/contexts/trackingConsentContext.js +14 -0
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.d.ts +22 -0
- package/cjs/domain/contexts/urlContexts.js +64 -0
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/cjs/domain/contexts/userAgentDataContext.js +31 -0
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -0
- package/cjs/domain/contexts/viewHistory.d.ts +17 -0
- package/cjs/domain/contexts/viewHistory.js +48 -0
- package/cjs/domain/contexts/viewHistory.js.map +1 -0
- package/cjs/domain/discardNegativeDuration.d.ts +2 -0
- package/cjs/domain/discardNegativeDuration.js +8 -0
- package/cjs/domain/discardNegativeDuration.js.map +1 -0
- package/cjs/domain/error/errorCollection.d.ts +17 -0
- package/cjs/domain/error/errorCollection.js +74 -0
- package/cjs/domain/error/errorCollection.js.map +1 -0
- package/cjs/domain/error/trackConsoleError.d.ts +4 -0
- package/cjs/domain/error/trackConsoleError.js +13 -0
- package/cjs/domain/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/error/trackReportError.d.ts +5 -0
- package/cjs/domain/error/trackReportError.js +16 -0
- package/cjs/domain/error/trackReportError.js.map +1 -0
- package/cjs/domain/event/eventCollection.d.ts +10 -0
- package/cjs/domain/event/eventCollection.js +27 -0
- package/cjs/domain/event/eventCollection.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +64 -0
- package/cjs/domain/getSelectorFromElement.js +218 -0
- package/cjs/domain/getSelectorFromElement.js.map +1 -0
- package/cjs/domain/getSessionReplayUrl.d.ts +9 -0
- package/cjs/domain/getSessionReplayUrl.js +34 -0
- package/cjs/domain/getSessionReplayUrl.js.map +1 -0
- package/cjs/domain/hooks.d.ts +23 -0
- package/cjs/domain/hooks.js +6 -0
- package/cjs/domain/hooks.js.map +1 -0
- package/cjs/domain/lifeCycle.d.ts +73 -0
- package/cjs/domain/lifeCycle.js +6 -0
- package/cjs/domain/lifeCycle.js.map +1 -0
- package/cjs/domain/limitModification.d.ts +8 -0
- package/cjs/domain/limitModification.js +46 -0
- package/cjs/domain/limitModification.js.map +1 -0
- package/cjs/domain/longTask/longTaskCollection.d.ts +18 -0
- package/cjs/domain/longTask/longTaskCollection.js +91 -0
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/plugins.d.ts +40 -0
- package/cjs/domain/plugins.js +15 -0
- package/cjs/domain/plugins.js.map +1 -0
- package/cjs/domain/privacy.d.ts +44 -0
- package/cjs/domain/privacy.js +313 -0
- package/cjs/domain/privacy.js.map +1 -0
- package/cjs/domain/privacyConstants.d.ts +23 -0
- package/cjs/domain/privacyConstants.js +39 -0
- package/cjs/domain/privacyConstants.js.map +1 -0
- package/cjs/domain/requestCollection.d.ts +54 -0
- package/cjs/domain/requestCollection.js +111 -0
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/resource/graphql.d.ts +23 -0
- package/cjs/domain/resource/graphql.js +97 -0
- package/cjs/domain/resource/graphql.js.map +1 -0
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js +49 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/cjs/domain/resource/requestRegistry.d.ts +9 -0
- package/cjs/domain/resource/requestRegistry.js +41 -0
- package/cjs/domain/resource/requestRegistry.js.map +1 -0
- package/cjs/domain/resource/resourceCollection.d.ts +7 -0
- package/cjs/domain/resource/resourceCollection.js +190 -0
- package/cjs/domain/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/resource/resourceUtils.d.ts +55 -0
- package/cjs/domain/resource/resourceUtils.js +259 -0
- package/cjs/domain/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +24 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/cjs/domain/rumSessionManager.d.ts +36 -0
- package/cjs/domain/rumSessionManager.js +77 -0
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/sampler/sampler.d.ts +10 -0
- package/cjs/domain/sampler/sampler.js +63 -0
- package/cjs/domain/sampler/sampler.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/cjs/domain/startCustomerDataTelemetry.js +56 -0
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +76 -0
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/identifier.d.ts +13 -0
- package/cjs/domain/tracing/identifier.js +55 -0
- package/cjs/domain/tracing/identifier.js.map +1 -0
- package/cjs/domain/tracing/sampler.d.ts +10 -0
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/tracer.d.ts +30 -0
- package/cjs/domain/tracing/tracer.js +161 -0
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/tracer.types.d.ts +12 -0
- package/cjs/domain/tracing/tracer.types.js +3 -0
- package/cjs/domain/tracing/tracer.types.js.map +1 -0
- package/cjs/domain/trackEventCounts.d.ts +17 -0
- package/cjs/domain/trackEventCounts.js +50 -0
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/view/bfCacheSupport.d.ts +2 -0
- package/cjs/domain/view/bfCacheSupport.js +13 -0
- package/cjs/domain/view/bfCacheSupport.js.map +1 -0
- package/cjs/domain/view/trackViewEventCounts.d.ts +5 -0
- package/cjs/domain/view/trackViewEventCounts.js +16 -0
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/view/trackViews.d.ts +65 -0
- package/cjs/domain/view/trackViews.js +275 -0
- package/cjs/domain/view/trackViews.js.map +1 -0
- package/cjs/domain/view/viewCollection.d.ts +18 -0
- package/cjs/domain/view/viewCollection.js +153 -0
- package/cjs/domain/view/viewCollection.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +32 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +44 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +44 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +17 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +37 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +135 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +39 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +33 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +43 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +41 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +155 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +61 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +50 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +43 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +78 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/vital/vitalCollection.d.ts +55 -0
- package/cjs/domain/vital/vitalCollection.js +113 -0
- package/cjs/domain/vital/vitalCollection.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.d.ts +54 -0
- package/cjs/domain/waitPageActivityEnd.js +129 -0
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/domainContext.types.d.ts +39 -0
- package/cjs/domainContext.types.js +6 -0
- package/cjs/domainContext.types.js.map +1 -0
- package/cjs/index.d.ts +41 -0
- package/cjs/index.js +59 -0
- package/cjs/index.js.map +1 -0
- package/cjs/rawRumEvent.types.d.ts +326 -0
- package/cjs/rawRumEvent.types.js +34 -0
- package/cjs/rawRumEvent.types.js.map +1 -0
- package/cjs/rumEvent.types.d.ts +2026 -0
- package/cjs/rumEvent.types.js +7 -0
- package/cjs/rumEvent.types.js.map +1 -0
- package/cjs/transport/formDataTransport.d.ts +16 -0
- package/cjs/transport/formDataTransport.js +46 -0
- package/cjs/transport/formDataTransport.js.map +1 -0
- package/cjs/transport/startRumBatch.d.ts +5 -0
- package/cjs/transport/startRumBatch.js +33 -0
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.d.ts +2 -0
- package/cjs/transport/startRumEventBridge.js +11 -0
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/esm/boot/preStartRum.d.ts +7 -0
- package/esm/boot/preStartRum.js +187 -0
- package/esm/boot/preStartRum.js.map +1 -0
- package/esm/boot/rumPublicApi.d.ts +409 -0
- package/esm/boot/rumPublicApi.js +165 -0
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/startRum.d.ts +109 -0
- package/esm/boot/startRum.js +149 -0
- package/esm/boot/startRum.js.map +1 -0
- package/esm/browser/cookieObservable.d.ts +8 -0
- package/esm/browser/cookieObservable.js +35 -0
- package/esm/browser/cookieObservable.js.map +1 -0
- package/esm/browser/domMutationObservable.d.ts +27 -0
- package/esm/browser/domMutationObservable.js +54 -0
- package/esm/browser/domMutationObservable.js.map +1 -0
- package/esm/browser/firstInputPolyfill.d.ts +8 -0
- package/esm/browser/firstInputPolyfill.js +65 -0
- package/esm/browser/firstInputPolyfill.js.map +1 -0
- package/esm/browser/htmlDomUtils.d.ts +13 -0
- package/esm/browser/htmlDomUtils.js +36 -0
- package/esm/browser/htmlDomUtils.js.map +1 -0
- package/esm/browser/locationChangeObservable.d.ts +7 -0
- package/esm/browser/locationChangeObservable.js +48 -0
- package/esm/browser/locationChangeObservable.js.map +1 -0
- package/esm/browser/performanceObservable.d.ts +174 -0
- package/esm/browser/performanceObservable.js +121 -0
- package/esm/browser/performanceObservable.js.map +1 -0
- package/esm/browser/performanceUtils.d.ts +7 -0
- package/esm/browser/performanceUtils.js +38 -0
- package/esm/browser/performanceUtils.js.map +1 -0
- package/esm/browser/scroll.d.ts +2 -0
- package/esm/browser/scroll.js +29 -0
- package/esm/browser/scroll.js.map +1 -0
- package/esm/browser/viewportObservable.d.ts +10 -0
- package/esm/browser/viewportObservable.js +32 -0
- package/esm/browser/viewportObservable.js.map +1 -0
- package/esm/browser/windowOpenObservable.d.ts +5 -0
- package/esm/browser/windowOpenObservable.js +7 -0
- package/esm/browser/windowOpenObservable.js.map +1 -0
- package/esm/domain/action/actionCollection.d.ts +21 -0
- package/esm/domain/action/actionCollection.js +93 -0
- package/esm/domain/action/actionCollection.js.map +1 -0
- package/esm/domain/action/actionNameConstants.d.ts +18 -0
- package/esm/domain/action/actionNameConstants.js +8 -0
- package/esm/domain/action/actionNameConstants.js.map +1 -0
- package/esm/domain/action/clickChain.d.ts +8 -0
- package/esm/domain/action/clickChain.js +57 -0
- package/esm/domain/action/clickChain.js.map +1 -0
- package/esm/domain/action/computeFrustration.d.ts +6 -0
- package/esm/domain/action/computeFrustration.js +65 -0
- package/esm/domain/action/computeFrustration.js.map +1 -0
- package/esm/domain/action/getActionNameFromElement.d.ts +4 -0
- package/esm/domain/action/getActionNameFromElement.js +236 -0
- package/esm/domain/action/getActionNameFromElement.js.map +1 -0
- package/esm/domain/action/interactionSelectorCache.d.ts +5 -0
- package/esm/domain/action/interactionSelectorCache.js +18 -0
- package/esm/domain/action/interactionSelectorCache.js.map +1 -0
- package/esm/domain/action/listenActionEvents.d.ts +19 -0
- package/esm/domain/action/listenActionEvents.js +58 -0
- package/esm/domain/action/listenActionEvents.js.map +1 -0
- package/esm/domain/action/trackClickActions.d.ts +81 -0
- package/esm/domain/action/trackClickActions.js +232 -0
- package/esm/domain/action/trackClickActions.js.map +1 -0
- package/esm/domain/assembly.d.ts +5 -0
- package/esm/domain/assembly.js +99 -0
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +325 -0
- package/esm/domain/configuration/configuration.js +200 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +2 -0
- package/esm/domain/configuration/index.js +3 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/jsonPathParser.d.ts +28 -0
- package/esm/domain/configuration/jsonPathParser.js +156 -0
- package/esm/domain/configuration/jsonPathParser.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/esm/domain/configuration/remoteConfiguration.js +236 -0
- package/esm/domain/configuration/remoteConfiguration.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/esm/domain/configuration/remoteConfiguration.types.js +6 -0
- package/esm/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/esm/domain/contexts/ciVisibilityContext.js +30 -0
- package/esm/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/esm/domain/contexts/connectivityContext.d.ts +2 -0
- package/esm/domain/contexts/connectivityContext.js +8 -0
- package/esm/domain/contexts/connectivityContext.js.map +1 -0
- package/esm/domain/contexts/defaultContext.d.ts +4 -0
- package/esm/domain/contexts/defaultContext.js +31 -0
- package/esm/domain/contexts/defaultContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.d.ts +6 -0
- package/esm/domain/contexts/displayContext.js +25 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/featureFlagContext.d.ts +19 -0
- package/esm/domain/contexts/featureFlagContext.js +49 -0
- package/esm/domain/contexts/featureFlagContext.js.map +1 -0
- package/esm/domain/contexts/internalContext.d.ts +12 -0
- package/esm/domain/contexts/internalContext.js +23 -0
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.d.ts +23 -0
- package/esm/domain/contexts/pageStateHistory.js +100 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/sessionContext.d.ts +5 -0
- package/esm/domain/contexts/sessionContext.js +44 -0
- package/esm/domain/contexts/sessionContext.js.map +1 -0
- package/esm/domain/contexts/syntheticsContext.d.ts +2 -0
- package/esm/domain/contexts/syntheticsContext.js +22 -0
- package/esm/domain/contexts/syntheticsContext.js.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/esm/domain/contexts/trackingConsentContext.js +11 -0
- package/esm/domain/contexts/trackingConsentContext.js.map +1 -0
- package/esm/domain/contexts/urlContexts.d.ts +22 -0
- package/esm/domain/contexts/urlContexts.js +60 -0
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/esm/domain/contexts/userAgentDataContext.js +28 -0
- package/esm/domain/contexts/userAgentDataContext.js.map +1 -0
- package/esm/domain/contexts/viewHistory.d.ts +17 -0
- package/esm/domain/contexts/viewHistory.js +44 -0
- package/esm/domain/contexts/viewHistory.js.map +1 -0
- package/esm/domain/discardNegativeDuration.d.ts +2 -0
- package/esm/domain/discardNegativeDuration.js +5 -0
- package/esm/domain/discardNegativeDuration.js.map +1 -0
- package/esm/domain/error/errorCollection.d.ts +17 -0
- package/esm/domain/error/errorCollection.js +70 -0
- package/esm/domain/error/errorCollection.js.map +1 -0
- package/esm/domain/error/trackConsoleError.d.ts +4 -0
- package/esm/domain/error/trackConsoleError.js +10 -0
- package/esm/domain/error/trackConsoleError.js.map +1 -0
- package/esm/domain/error/trackReportError.d.ts +5 -0
- package/esm/domain/error/trackReportError.js +13 -0
- package/esm/domain/error/trackReportError.js.map +1 -0
- package/esm/domain/event/eventCollection.d.ts +10 -0
- package/esm/domain/event/eventCollection.js +24 -0
- package/esm/domain/event/eventCollection.js.map +1 -0
- package/esm/domain/getSelectorFromElement.d.ts +64 -0
- package/esm/domain/getSelectorFromElement.js +213 -0
- package/esm/domain/getSelectorFromElement.js.map +1 -0
- package/esm/domain/getSessionReplayUrl.d.ts +9 -0
- package/esm/domain/getSessionReplayUrl.js +30 -0
- package/esm/domain/getSessionReplayUrl.js.map +1 -0
- package/esm/domain/hooks.d.ts +23 -0
- package/esm/domain/hooks.js +3 -0
- package/esm/domain/hooks.js.map +1 -0
- package/esm/domain/lifeCycle.d.ts +73 -0
- package/esm/domain/lifeCycle.js +3 -0
- package/esm/domain/lifeCycle.js.map +1 -0
- package/esm/domain/limitModification.d.ts +8 -0
- package/esm/domain/limitModification.js +43 -0
- package/esm/domain/limitModification.js.map +1 -0
- package/esm/domain/longTask/longTaskCollection.d.ts +18 -0
- package/esm/domain/longTask/longTaskCollection.js +87 -0
- package/esm/domain/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/plugins.d.ts +40 -0
- package/esm/domain/plugins.js +12 -0
- package/esm/domain/plugins.js.map +1 -0
- package/esm/domain/privacy.d.ts +44 -0
- package/esm/domain/privacy.js +302 -0
- package/esm/domain/privacy.js.map +1 -0
- package/esm/domain/privacyConstants.d.ts +23 -0
- package/esm/domain/privacyConstants.js +35 -0
- package/esm/domain/privacyConstants.js.map +1 -0
- package/esm/domain/requestCollection.d.ts +54 -0
- package/esm/domain/requestCollection.js +106 -0
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/resource/graphql.d.ts +23 -0
- package/esm/domain/resource/graphql.js +91 -0
- package/esm/domain/resource/graphql.js.map +1 -0
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/esm/domain/resource/matchRequestResourceEntry.js +46 -0
- package/esm/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/esm/domain/resource/requestRegistry.d.ts +9 -0
- package/esm/domain/resource/requestRegistry.js +37 -0
- package/esm/domain/resource/requestRegistry.js.map +1 -0
- package/esm/domain/resource/resourceCollection.d.ts +7 -0
- package/esm/domain/resource/resourceCollection.js +187 -0
- package/esm/domain/resource/resourceCollection.js.map +1 -0
- package/esm/domain/resource/resourceUtils.d.ts +55 -0
- package/esm/domain/resource/resourceUtils.js +244 -0
- package/esm/domain/resource/resourceUtils.js.map +1 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +21 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/esm/domain/rumSessionManager.d.ts +36 -0
- package/esm/domain/rumSessionManager.js +72 -0
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/sampler/sampler.d.ts +10 -0
- package/esm/domain/sampler/sampler.js +58 -0
- package/esm/domain/sampler/sampler.js.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/esm/domain/startCustomerDataTelemetry.js +52 -0
- package/esm/domain/startCustomerDataTelemetry.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/esm/domain/tracing/getDocumentTraceId.js +68 -0
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/identifier.d.ts +13 -0
- package/esm/domain/tracing/identifier.js +50 -0
- package/esm/domain/tracing/identifier.js.map +1 -0
- package/esm/domain/tracing/sampler.d.ts +10 -0
- package/esm/domain/tracing/sampler.js +64 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/tracer.d.ts +30 -0
- package/esm/domain/tracing/tracer.js +156 -0
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/tracer.types.d.ts +12 -0
- package/esm/domain/tracing/tracer.types.js +2 -0
- package/esm/domain/tracing/tracer.types.js.map +1 -0
- package/esm/domain/trackEventCounts.d.ts +17 -0
- package/esm/domain/trackEventCounts.js +47 -0
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/view/bfCacheSupport.d.ts +2 -0
- package/esm/domain/view/bfCacheSupport.js +10 -0
- package/esm/domain/view/bfCacheSupport.js.map +1 -0
- package/esm/domain/view/trackViewEventCounts.d.ts +5 -0
- package/esm/domain/view/trackViewEventCounts.js +13 -0
- package/esm/domain/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/view/trackViews.d.ts +65 -0
- package/esm/domain/view/trackViews.js +271 -0
- package/esm/domain/view/trackViews.js.map +1 -0
- package/esm/domain/view/viewCollection.d.ts +18 -0
- package/esm/domain/view/viewCollection.js +150 -0
- package/esm/domain/view/viewCollection.js.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +28 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +39 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +41 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +34 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +130 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +34 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +30 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js +40 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +38 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +149 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +57 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +47 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +40 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +72 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/esm/domain/vital/vitalCollection.d.ts +55 -0
- package/esm/domain/vital/vitalCollection.js +107 -0
- package/esm/domain/vital/vitalCollection.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.d.ts +54 -0
- package/esm/domain/waitPageActivityEnd.js +123 -0
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/domainContext.types.d.ts +39 -0
- package/esm/domainContext.types.js +5 -0
- package/esm/domainContext.types.js.map +1 -0
- package/esm/index.d.ts +41 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/rawRumEvent.types.d.ts +326 -0
- package/esm/rawRumEvent.types.js +31 -0
- package/esm/rawRumEvent.types.js.map +1 -0
- package/esm/rumEvent.types.d.ts +2026 -0
- package/esm/rumEvent.types.js +6 -0
- package/esm/rumEvent.types.js.map +1 -0
- package/esm/transport/formDataTransport.d.ts +16 -0
- package/esm/transport/formDataTransport.js +43 -0
- package/esm/transport/formDataTransport.js.map +1 -0
- package/esm/transport/startRumBatch.d.ts +5 -0
- package/esm/transport/startRumBatch.js +30 -0
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.d.ts +2 -0
- package/esm/transport/startRumEventBridge.js +8 -0
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/package.json +29 -0
- package/src/boot/preStartRum.ts +298 -0
- package/src/boot/rumPublicApi.ts +830 -0
- package/src/boot/startRum.ts +280 -0
- package/src/browser/cookieObservable.ts +63 -0
- package/src/browser/domMutationObservable.ts +98 -0
- package/src/browser/firstInputPolyfill.ts +87 -0
- package/src/browser/htmlDomUtils.ts +45 -0
- package/src/browser/locationChangeObservable.ts +69 -0
- package/src/browser/performanceObservable.ts +324 -0
- package/src/browser/performanceUtils.ts +50 -0
- package/src/browser/scroll.ts +25 -0
- package/src/browser/viewportObservable.ts +44 -0
- package/src/browser/windowOpenObservable.ts +7 -0
- package/src/domain/action/actionCollection.ts +146 -0
- package/src/domain/action/actionNameConstants.ts +20 -0
- package/src/domain/action/clickChain.ts +83 -0
- package/src/domain/action/computeFrustration.ts +77 -0
- package/src/domain/action/getActionNameFromElement.ts +337 -0
- package/src/domain/action/interactionSelectorCache.ts +21 -0
- package/src/domain/action/listenActionEvents.ts +119 -0
- package/src/domain/action/trackClickActions.ts +388 -0
- package/src/domain/assembly.ts +141 -0
- package/src/domain/configuration/configuration.ts +548 -0
- package/src/domain/configuration/index.ts +2 -0
- package/src/domain/configuration/jsonPathParser.ts +214 -0
- package/src/domain/configuration/remoteConfiguration.ts +304 -0
- package/src/domain/configuration/remoteConfiguration.types.ts +147 -0
- package/src/domain/contexts/ciVisibilityContext.ts +50 -0
- package/src/domain/contexts/connectivityContext.ts +12 -0
- package/src/domain/contexts/defaultContext.ts +43 -0
- package/src/domain/contexts/displayContext.ts +38 -0
- package/src/domain/contexts/featureFlagContext.ts +71 -0
- package/src/domain/contexts/internalContext.ts +34 -0
- package/src/domain/contexts/pageStateHistory.ts +171 -0
- package/src/domain/contexts/sessionContext.ts +59 -0
- package/src/domain/contexts/syntheticsContext.ts +33 -0
- package/src/domain/contexts/trackingConsentContext.ts +15 -0
- package/src/domain/contexts/urlContexts.ts +97 -0
- package/src/domain/contexts/userAgentDataContext.ts +36 -0
- package/src/domain/contexts/viewHistory.ts +70 -0
- package/src/domain/discardNegativeDuration.ts +6 -0
- package/src/domain/error/errorCollection.ts +107 -0
- package/src/domain/error/trackConsoleError.ts +14 -0
- package/src/domain/error/trackReportError.ts +16 -0
- package/src/domain/event/eventCollection.ts +53 -0
- package/src/domain/getSelectorFromElement.ts +268 -0
- package/src/domain/getSessionReplayUrl.ts +47 -0
- package/src/domain/hooks.ts +31 -0
- package/src/domain/lifeCycle.ts +103 -0
- package/src/domain/limitModification.ts +66 -0
- package/src/domain/longTask/longTaskCollection.ts +133 -0
- package/src/domain/plugins.ts +59 -0
- package/src/domain/privacy.ts +355 -0
- package/src/domain/privacyConstants.ts +43 -0
- package/src/domain/requestCollection.ts +179 -0
- package/src/domain/resource/graphql.ts +135 -0
- package/src/domain/resource/matchRequestResourceEntry.ts +68 -0
- package/src/domain/resource/requestRegistry.ts +52 -0
- package/src/domain/resource/resourceCollection.ts +273 -0
- package/src/domain/resource/resourceUtils.ts +355 -0
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +27 -0
- package/src/domain/rumSessionManager.ts +134 -0
- package/src/domain/sampler/sampler.ts +63 -0
- package/src/domain/startCustomerDataTelemetry.ts +83 -0
- package/src/domain/tracing/getDocumentTraceId.ts +90 -0
- package/src/domain/tracing/identifier.ts +69 -0
- package/src/domain/tracing/sampler.ts +69 -0
- package/src/domain/tracing/tracer.ts +248 -0
- package/src/domain/tracing/tracer.types.ts +13 -0
- package/src/domain/trackEventCounts.ts +67 -0
- package/src/domain/view/bfCacheSupport.ts +20 -0
- package/src/domain/view/trackViewEventCounts.ts +15 -0
- package/src/domain/view/trackViews.ts +431 -0
- package/src/domain/view/viewCollection.ts +203 -0
- package/src/domain/view/viewMetrics/getClsAttributionImpactedArea.ts +34 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +55 -0
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +70 -0
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +20 -0
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +78 -0
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +180 -0
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +47 -0
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +53 -0
- package/src/domain/view/viewMetrics/trackFirstInput.ts +59 -0
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +66 -0
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +193 -0
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +87 -0
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +69 -0
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +66 -0
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +119 -0
- package/src/domain/vital/vitalCollection.ts +207 -0
- package/src/domain/waitPageActivityEnd.ts +189 -0
- package/src/domainContext.types.ts +61 -0
- package/src/index.ts +76 -0
- package/src/rawRumEvent.types.ts +409 -0
- package/src/rumEvent.types.ts +2151 -0
- package/src/transport/formDataTransport.ts +85 -0
- package/src/transport/startRumBatch.ts +46 -0
- package/src/transport/startRumEventBridge.ts +12 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Observable,
|
|
3
|
+
RawError,
|
|
4
|
+
DeflateEncoderStreamId,
|
|
5
|
+
Encoder,
|
|
6
|
+
TrackingConsentState,
|
|
7
|
+
BufferedData,
|
|
8
|
+
BufferedObservable,
|
|
9
|
+
} from '@kubesense/kubesense-browser-core'
|
|
10
|
+
import {
|
|
11
|
+
sendToExtension,
|
|
12
|
+
createPageMayExitObservable,
|
|
13
|
+
TelemetryService,
|
|
14
|
+
startTelemetry,
|
|
15
|
+
canUseEventBridge,
|
|
16
|
+
addTelemetryDebug,
|
|
17
|
+
startAccountContext,
|
|
18
|
+
startGlobalContext,
|
|
19
|
+
startUserContext,
|
|
20
|
+
} from '@kubesense/kubesense-browser-core'
|
|
21
|
+
import { createDOMMutationObservable } from '../browser/domMutationObservable'
|
|
22
|
+
import { createWindowOpenObservable } from '../browser/windowOpenObservable'
|
|
23
|
+
import { startInternalContext } from '../domain/contexts/internalContext'
|
|
24
|
+
import { LifeCycle, LifeCycleEventType } from '../domain/lifeCycle'
|
|
25
|
+
import { startViewHistory } from '../domain/contexts/viewHistory'
|
|
26
|
+
import { startRequestCollection } from '../domain/requestCollection'
|
|
27
|
+
import { startActionCollection } from '../domain/action/actionCollection'
|
|
28
|
+
import { startErrorCollection } from '../domain/error/errorCollection'
|
|
29
|
+
import { startResourceCollection } from '../domain/resource/resourceCollection'
|
|
30
|
+
import { startViewCollection } from '../domain/view/viewCollection'
|
|
31
|
+
import type { RumSessionManager } from '../domain/rumSessionManager'
|
|
32
|
+
import { startRumSessionManager, startRumSessionManagerStub } from '../domain/rumSessionManager'
|
|
33
|
+
import { startRumBatch } from '../transport/startRumBatch'
|
|
34
|
+
import { startRumEventBridge } from '../transport/startRumEventBridge'
|
|
35
|
+
import { startUrlContexts } from '../domain/contexts/urlContexts'
|
|
36
|
+
import { createLocationChangeObservable } from '../browser/locationChangeObservable'
|
|
37
|
+
import type { RumConfiguration } from '../domain/configuration'
|
|
38
|
+
import type { ViewOptions } from '../domain/view/trackViews'
|
|
39
|
+
import { startFeatureFlagContexts } from '../domain/contexts/featureFlagContext'
|
|
40
|
+
import { startCustomerDataTelemetry } from '../domain/startCustomerDataTelemetry'
|
|
41
|
+
import { startPageStateHistory } from '../domain/contexts/pageStateHistory'
|
|
42
|
+
import { startDisplayContext } from '../domain/contexts/displayContext'
|
|
43
|
+
import type { CustomVitalsState } from '../domain/vital/vitalCollection'
|
|
44
|
+
import { startVitalCollection } from '../domain/vital/vitalCollection'
|
|
45
|
+
import { startCiVisibilityContext } from '../domain/contexts/ciVisibilityContext'
|
|
46
|
+
import { startLongTaskCollection } from '../domain/longTask/longTaskCollection'
|
|
47
|
+
import { startSyntheticsContext } from '../domain/contexts/syntheticsContext'
|
|
48
|
+
import { startRumAssembly } from '../domain/assembly'
|
|
49
|
+
import { startSessionContext } from '../domain/contexts/sessionContext'
|
|
50
|
+
import { startConnectivityContext } from '../domain/contexts/connectivityContext'
|
|
51
|
+
import { startUserAgentDataContext } from '../domain/contexts/userAgentDataContext'
|
|
52
|
+
import type { SdkName } from '../domain/contexts/defaultContext'
|
|
53
|
+
import { startDefaultContext } from '../domain/contexts/defaultContext'
|
|
54
|
+
import { startTrackingConsentContext } from '../domain/contexts/trackingConsentContext'
|
|
55
|
+
import type { Hooks } from '../domain/hooks'
|
|
56
|
+
import { createHooks } from '../domain/hooks'
|
|
57
|
+
import { startEventCollection } from '../domain/event/eventCollection'
|
|
58
|
+
import { startInitialViewMetricsTelemetry } from '../domain/view/viewMetrics/startInitialViewMetricsTelemetry'
|
|
59
|
+
import type { RecorderApi, ProfilerApi } from './rumPublicApi'
|
|
60
|
+
|
|
61
|
+
export type StartRum = typeof startRum
|
|
62
|
+
export type StartRumResult = ReturnType<StartRum>
|
|
63
|
+
|
|
64
|
+
export function startRum(
|
|
65
|
+
configuration: RumConfiguration,
|
|
66
|
+
recorderApi: RecorderApi,
|
|
67
|
+
profilerApi: ProfilerApi,
|
|
68
|
+
initialViewOptions: ViewOptions | undefined,
|
|
69
|
+
createEncoder: (streamId: DeflateEncoderStreamId) => Encoder,
|
|
70
|
+
|
|
71
|
+
// `startRum` and its subcomponents assume tracking consent is granted initially and starts
|
|
72
|
+
// collecting logs unconditionally. As such, `startRum` should be called with a
|
|
73
|
+
// `trackingConsentState` set to "granted".
|
|
74
|
+
trackingConsentState: TrackingConsentState,
|
|
75
|
+
customVitalsState: CustomVitalsState,
|
|
76
|
+
bufferedDataObservable: BufferedObservable<BufferedData>,
|
|
77
|
+
sdkName?: SdkName
|
|
78
|
+
) {
|
|
79
|
+
const cleanupTasks: Array<() => void> = []
|
|
80
|
+
const lifeCycle = new LifeCycle()
|
|
81
|
+
const hooks = createHooks()
|
|
82
|
+
|
|
83
|
+
lifeCycle.subscribe(LifeCycleEventType.RUM_EVENT_COLLECTED, (event) => sendToExtension('rum', event))
|
|
84
|
+
|
|
85
|
+
const reportError = (error: RawError) => {
|
|
86
|
+
lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error })
|
|
87
|
+
// monitor-until: forever, to keep an eye on the errors reported to customers
|
|
88
|
+
addTelemetryDebug('Error reported to customer', { 'error.message': error.message })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const pageMayExitObservable = createPageMayExitObservable(configuration)
|
|
92
|
+
const pageMayExitSubscription = pageMayExitObservable.subscribe((event) => {
|
|
93
|
+
lifeCycle.notify(LifeCycleEventType.PAGE_MAY_EXIT, event)
|
|
94
|
+
})
|
|
95
|
+
cleanupTasks.push(() => pageMayExitSubscription.unsubscribe())
|
|
96
|
+
|
|
97
|
+
const telemetry = startTelemetry(
|
|
98
|
+
TelemetryService.RUM,
|
|
99
|
+
configuration,
|
|
100
|
+
hooks,
|
|
101
|
+
reportError,
|
|
102
|
+
pageMayExitObservable,
|
|
103
|
+
createEncoder
|
|
104
|
+
)
|
|
105
|
+
cleanupTasks.push(telemetry.stop)
|
|
106
|
+
|
|
107
|
+
const session = !canUseEventBridge()
|
|
108
|
+
? startRumSessionManager(configuration, lifeCycle, trackingConsentState)
|
|
109
|
+
: startRumSessionManagerStub()
|
|
110
|
+
|
|
111
|
+
if (!canUseEventBridge()) {
|
|
112
|
+
const batch = startRumBatch(
|
|
113
|
+
configuration,
|
|
114
|
+
lifeCycle,
|
|
115
|
+
reportError,
|
|
116
|
+
pageMayExitObservable,
|
|
117
|
+
session.expireObservable,
|
|
118
|
+
createEncoder
|
|
119
|
+
)
|
|
120
|
+
cleanupTasks.push(() => batch.stop())
|
|
121
|
+
startCustomerDataTelemetry(telemetry, lifeCycle, batch.flushController.flushObservable)
|
|
122
|
+
} else {
|
|
123
|
+
startRumEventBridge(lifeCycle)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
startTrackingConsentContext(hooks, trackingConsentState)
|
|
127
|
+
|
|
128
|
+
const { stop: stopInitialViewMetricsTelemetry } = startInitialViewMetricsTelemetry(lifeCycle, telemetry)
|
|
129
|
+
cleanupTasks.push(stopInitialViewMetricsTelemetry)
|
|
130
|
+
|
|
131
|
+
const { stop: stopRumEventCollection, ...startRumEventCollectionResult } = startRumEventCollection(
|
|
132
|
+
lifeCycle,
|
|
133
|
+
hooks,
|
|
134
|
+
configuration,
|
|
135
|
+
session,
|
|
136
|
+
recorderApi,
|
|
137
|
+
initialViewOptions,
|
|
138
|
+
customVitalsState,
|
|
139
|
+
bufferedDataObservable,
|
|
140
|
+
sdkName,
|
|
141
|
+
reportError
|
|
142
|
+
)
|
|
143
|
+
cleanupTasks.push(stopRumEventCollection)
|
|
144
|
+
bufferedDataObservable.unbuffer()
|
|
145
|
+
|
|
146
|
+
// Add Clean-up tasks for Profiler API.
|
|
147
|
+
cleanupTasks.push(() => profilerApi.stop())
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
...startRumEventCollectionResult,
|
|
151
|
+
lifeCycle,
|
|
152
|
+
session,
|
|
153
|
+
stopSession: () => session.expire(),
|
|
154
|
+
telemetry,
|
|
155
|
+
stop: () => {
|
|
156
|
+
cleanupTasks.forEach((task) => task())
|
|
157
|
+
},
|
|
158
|
+
hooks,
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function startRumEventCollection(
|
|
163
|
+
lifeCycle: LifeCycle,
|
|
164
|
+
hooks: Hooks,
|
|
165
|
+
configuration: RumConfiguration,
|
|
166
|
+
session: RumSessionManager,
|
|
167
|
+
recorderApi: RecorderApi,
|
|
168
|
+
initialViewOptions: ViewOptions | undefined,
|
|
169
|
+
customVitalsState: CustomVitalsState,
|
|
170
|
+
bufferedDataObservable: Observable<BufferedData>,
|
|
171
|
+
sdkName: SdkName | undefined,
|
|
172
|
+
reportError: (error: RawError) => void
|
|
173
|
+
) {
|
|
174
|
+
const cleanupTasks: Array<() => void> = []
|
|
175
|
+
|
|
176
|
+
const domMutationObservable = createDOMMutationObservable()
|
|
177
|
+
const locationChangeObservable = createLocationChangeObservable(configuration, location)
|
|
178
|
+
const { observable: windowOpenObservable, stop: stopWindowOpen } = createWindowOpenObservable()
|
|
179
|
+
cleanupTasks.push(stopWindowOpen)
|
|
180
|
+
|
|
181
|
+
startDefaultContext(hooks, configuration, sdkName)
|
|
182
|
+
const pageStateHistory = startPageStateHistory(hooks, configuration)
|
|
183
|
+
cleanupTasks.push(() => pageStateHistory.stop())
|
|
184
|
+
const viewHistory = startViewHistory(lifeCycle)
|
|
185
|
+
cleanupTasks.push(() => viewHistory.stop())
|
|
186
|
+
const urlContexts = startUrlContexts(lifeCycle, hooks, locationChangeObservable, location)
|
|
187
|
+
cleanupTasks.push(() => urlContexts.stop())
|
|
188
|
+
const featureFlagContexts = startFeatureFlagContexts(lifeCycle, hooks, configuration)
|
|
189
|
+
startSessionContext(hooks, session, recorderApi, viewHistory)
|
|
190
|
+
startConnectivityContext(hooks)
|
|
191
|
+
startUserAgentDataContext(hooks)
|
|
192
|
+
const globalContext = startGlobalContext(hooks, configuration, 'rum', true)
|
|
193
|
+
const userContext = startUserContext(hooks, configuration, session, 'rum')
|
|
194
|
+
const accountContext = startAccountContext(hooks, configuration, 'rum')
|
|
195
|
+
|
|
196
|
+
const actionCollection = startActionCollection(
|
|
197
|
+
lifeCycle,
|
|
198
|
+
hooks,
|
|
199
|
+
domMutationObservable,
|
|
200
|
+
windowOpenObservable,
|
|
201
|
+
configuration
|
|
202
|
+
)
|
|
203
|
+
cleanupTasks.push(actionCollection.stop)
|
|
204
|
+
|
|
205
|
+
const eventCollection = startEventCollection(lifeCycle)
|
|
206
|
+
|
|
207
|
+
const displayContext = startDisplayContext(hooks, configuration)
|
|
208
|
+
cleanupTasks.push(displayContext.stop)
|
|
209
|
+
const ciVisibilityContext = startCiVisibilityContext(configuration, hooks)
|
|
210
|
+
cleanupTasks.push(ciVisibilityContext.stop)
|
|
211
|
+
startSyntheticsContext(hooks)
|
|
212
|
+
|
|
213
|
+
startRumAssembly(configuration, lifeCycle, hooks, reportError)
|
|
214
|
+
|
|
215
|
+
const {
|
|
216
|
+
addTiming,
|
|
217
|
+
startView,
|
|
218
|
+
setViewName,
|
|
219
|
+
setViewContext,
|
|
220
|
+
setViewContextProperty,
|
|
221
|
+
getViewContext,
|
|
222
|
+
stop: stopViewCollection,
|
|
223
|
+
} = startViewCollection(
|
|
224
|
+
lifeCycle,
|
|
225
|
+
hooks,
|
|
226
|
+
configuration,
|
|
227
|
+
location,
|
|
228
|
+
domMutationObservable,
|
|
229
|
+
windowOpenObservable,
|
|
230
|
+
locationChangeObservable,
|
|
231
|
+
recorderApi,
|
|
232
|
+
viewHistory,
|
|
233
|
+
initialViewOptions
|
|
234
|
+
)
|
|
235
|
+
cleanupTasks.push(stopViewCollection)
|
|
236
|
+
|
|
237
|
+
const { stop: stopResourceCollection } = startResourceCollection(lifeCycle, configuration, pageStateHistory)
|
|
238
|
+
cleanupTasks.push(stopResourceCollection)
|
|
239
|
+
|
|
240
|
+
const { stop: stopLongTaskCollection, longTaskContexts } = startLongTaskCollection(lifeCycle, configuration)
|
|
241
|
+
cleanupTasks.push(stopLongTaskCollection)
|
|
242
|
+
|
|
243
|
+
const { addError } = startErrorCollection(lifeCycle, configuration, bufferedDataObservable)
|
|
244
|
+
|
|
245
|
+
startRequestCollection(lifeCycle, configuration, session, userContext, accountContext)
|
|
246
|
+
|
|
247
|
+
const vitalCollection = startVitalCollection(lifeCycle, pageStateHistory, customVitalsState)
|
|
248
|
+
|
|
249
|
+
const internalContext = startInternalContext(
|
|
250
|
+
configuration.applicationId,
|
|
251
|
+
session,
|
|
252
|
+
viewHistory,
|
|
253
|
+
actionCollection.actionContexts,
|
|
254
|
+
urlContexts
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
addAction: actionCollection.addAction,
|
|
259
|
+
addEvent: eventCollection.addEvent,
|
|
260
|
+
addError,
|
|
261
|
+
addTiming,
|
|
262
|
+
addFeatureFlagEvaluation: featureFlagContexts.addFeatureFlagEvaluation,
|
|
263
|
+
startView,
|
|
264
|
+
setViewContext,
|
|
265
|
+
setViewContextProperty,
|
|
266
|
+
getViewContext,
|
|
267
|
+
setViewName,
|
|
268
|
+
viewHistory,
|
|
269
|
+
getInternalContext: internalContext.get,
|
|
270
|
+
startDurationVital: vitalCollection.startDurationVital,
|
|
271
|
+
stopDurationVital: vitalCollection.stopDurationVital,
|
|
272
|
+
addDurationVital: vitalCollection.addDurationVital,
|
|
273
|
+
addOperationStepVital: vitalCollection.addOperationStepVital,
|
|
274
|
+
globalContext,
|
|
275
|
+
userContext,
|
|
276
|
+
accountContext,
|
|
277
|
+
longTaskContexts,
|
|
278
|
+
stop: () => cleanupTasks.forEach((task) => task()),
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Configuration, CookieStore } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import {
|
|
3
|
+
setInterval,
|
|
4
|
+
clearInterval,
|
|
5
|
+
Observable,
|
|
6
|
+
addEventListener,
|
|
7
|
+
ONE_SECOND,
|
|
8
|
+
findCommaSeparatedValue,
|
|
9
|
+
DOM_EVENT,
|
|
10
|
+
} from '@kubesense/kubesense-browser-core'
|
|
11
|
+
|
|
12
|
+
export interface CookieStoreWindow {
|
|
13
|
+
cookieStore?: CookieStore
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type CookieObservable = ReturnType<typeof createCookieObservable>
|
|
17
|
+
|
|
18
|
+
export function createCookieObservable(configuration: Configuration, cookieName: string) {
|
|
19
|
+
const detectCookieChangeStrategy = (window as CookieStoreWindow).cookieStore
|
|
20
|
+
? listenToCookieStoreChange(configuration)
|
|
21
|
+
: watchCookieFallback
|
|
22
|
+
|
|
23
|
+
return new Observable<string | undefined>((observable) =>
|
|
24
|
+
detectCookieChangeStrategy(cookieName, (event) => observable.notify(event))
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function listenToCookieStoreChange(configuration: Configuration) {
|
|
29
|
+
return (cookieName: string, callback: (event: string | undefined) => void) => {
|
|
30
|
+
const listener = addEventListener(
|
|
31
|
+
configuration,
|
|
32
|
+
(window as CookieStoreWindow).cookieStore!,
|
|
33
|
+
DOM_EVENT.CHANGE,
|
|
34
|
+
(event) => {
|
|
35
|
+
// Based on our experimentation, we're assuming that entries for the same cookie cannot be in both the 'changed' and 'deleted' arrays.
|
|
36
|
+
// However, due to ambiguity in the specification, we asked for clarification: https://github.com/WICG/cookie-store/issues/226
|
|
37
|
+
const changeEvent =
|
|
38
|
+
event.changed.find((event) => event.name === cookieName) ||
|
|
39
|
+
event.deleted.find((event) => event.name === cookieName)
|
|
40
|
+
if (changeEvent) {
|
|
41
|
+
callback(changeEvent.value)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
return listener.stop
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const WATCH_COOKIE_INTERVAL_DELAY = ONE_SECOND
|
|
50
|
+
|
|
51
|
+
function watchCookieFallback(cookieName: string, callback: (event: string | undefined) => void) {
|
|
52
|
+
const previousCookieValue = findCommaSeparatedValue(document.cookie, cookieName)
|
|
53
|
+
const watchCookieIntervalId = setInterval(() => {
|
|
54
|
+
const cookieValue = findCommaSeparatedValue(document.cookie, cookieName)
|
|
55
|
+
if (cookieValue !== previousCookieValue) {
|
|
56
|
+
callback(cookieValue)
|
|
57
|
+
}
|
|
58
|
+
}, WATCH_COOKIE_INTERVAL_DELAY)
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
clearInterval(watchCookieIntervalId)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { monitor, noop, Observable, getZoneJsOriginalValue } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
|
|
3
|
+
// https://dom.spec.whatwg.org/#interface-mutationrecord
|
|
4
|
+
export interface RumCharacterDataMutationRecord {
|
|
5
|
+
type: 'characterData'
|
|
6
|
+
target: Node
|
|
7
|
+
oldValue: string | null
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RumAttributesMutationRecord {
|
|
11
|
+
type: 'attributes'
|
|
12
|
+
target: Element
|
|
13
|
+
oldValue: string | null
|
|
14
|
+
attributeName: string | null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface RumChildListMutationRecord {
|
|
18
|
+
type: 'childList'
|
|
19
|
+
target: Node
|
|
20
|
+
addedNodes: NodeList
|
|
21
|
+
removedNodes: NodeList
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type RumMutationRecord =
|
|
25
|
+
| RumCharacterDataMutationRecord
|
|
26
|
+
| RumAttributesMutationRecord
|
|
27
|
+
| RumChildListMutationRecord
|
|
28
|
+
|
|
29
|
+
export function createDOMMutationObservable() {
|
|
30
|
+
const MutationObserver = getMutationObserverConstructor()
|
|
31
|
+
|
|
32
|
+
return new Observable<RumMutationRecord[]>((observable) => {
|
|
33
|
+
if (!MutationObserver) {
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const observer = new MutationObserver(monitor((records) => observable.notify(records)))
|
|
38
|
+
observer.observe(document, {
|
|
39
|
+
attributes: true,
|
|
40
|
+
characterData: true,
|
|
41
|
+
childList: true,
|
|
42
|
+
subtree: true,
|
|
43
|
+
})
|
|
44
|
+
return () => observer.disconnect()
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type MutationObserverConstructor = new (callback: (records: RumMutationRecord[]) => void) => MutationObserver
|
|
49
|
+
|
|
50
|
+
export interface BrowserWindow extends Window {
|
|
51
|
+
MutationObserver?: MutationObserverConstructor
|
|
52
|
+
Zone?: unknown
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getMutationObserverConstructor(): MutationObserverConstructor | undefined {
|
|
56
|
+
let constructor: MutationObserverConstructor | undefined
|
|
57
|
+
const browserWindow = window as BrowserWindow
|
|
58
|
+
|
|
59
|
+
// Angular uses Zone.js to provide a context persisting across async tasks. Zone.js replaces the
|
|
60
|
+
// global MutationObserver constructor with a patched version to support the context propagation.
|
|
61
|
+
// There is an ongoing issue[1][2] with this setup when using a MutationObserver within a Angular
|
|
62
|
+
// component: on some occasions, the callback is being called in an infinite loop, causing the
|
|
63
|
+
// page to freeze (even if the callback is completely empty).
|
|
64
|
+
//
|
|
65
|
+
// To work around this issue, we try to get the original MutationObserver constructor stored by
|
|
66
|
+
// Zone.js.
|
|
67
|
+
//
|
|
68
|
+
// [1] https://github.com/angular/angular/issues/26948
|
|
69
|
+
// [2] https://github.com/angular/angular/issues/31712
|
|
70
|
+
if (browserWindow.Zone) {
|
|
71
|
+
// Zone.js 0.8.6+ is storing original class constructors into the browser 'window' object[3].
|
|
72
|
+
//
|
|
73
|
+
// [3] https://github.com/angular/angular/blob/6375fa79875c0fe7b815efc45940a6e6f5c9c9eb/packages/zone.js/lib/common/utils.ts#L288
|
|
74
|
+
constructor = getZoneJsOriginalValue(browserWindow, 'MutationObserver')
|
|
75
|
+
|
|
76
|
+
if (browserWindow.MutationObserver && constructor === browserWindow.MutationObserver) {
|
|
77
|
+
// Anterior Zone.js versions (used in Angular 2) does not expose the original MutationObserver
|
|
78
|
+
// in the 'window' object. Luckily, the patched MutationObserver class is storing an original
|
|
79
|
+
// instance in its properties[4]. Let's get the original MutationObserver constructor from
|
|
80
|
+
// there.
|
|
81
|
+
//
|
|
82
|
+
// [4] https://github.com/angular/zone.js/blob/v0.8.5/lib/common/utils.ts#L412
|
|
83
|
+
|
|
84
|
+
const patchedInstance = new browserWindow.MutationObserver(noop) as {
|
|
85
|
+
originalInstance?: { constructor: MutationObserverConstructor }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const originalInstance = getZoneJsOriginalValue(patchedInstance, 'originalInstance')
|
|
89
|
+
constructor = originalInstance && originalInstance.constructor
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!constructor) {
|
|
94
|
+
constructor = browserWindow.MutationObserver
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return constructor
|
|
98
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { Duration, RelativeTime } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { addEventListeners, dateNow, DOM_EVENT, relativeNow } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { RumConfiguration } from '../domain/configuration'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* first-input timing entry polyfill based on
|
|
7
|
+
* https://github.com/GoogleChrome/web-vitals/blob/master/src/lib/polyfills/firstInputPolyfill.ts
|
|
8
|
+
*/
|
|
9
|
+
export function retrieveFirstInputTiming(
|
|
10
|
+
configuration: RumConfiguration,
|
|
11
|
+
callback: (timing: PerformanceEventTiming) => void
|
|
12
|
+
) {
|
|
13
|
+
const startTimeStamp = dateNow()
|
|
14
|
+
let timingSent = false
|
|
15
|
+
|
|
16
|
+
const { stop: removeEventListeners } = addEventListeners(
|
|
17
|
+
configuration,
|
|
18
|
+
window,
|
|
19
|
+
[DOM_EVENT.CLICK, DOM_EVENT.MOUSE_DOWN, DOM_EVENT.KEY_DOWN, DOM_EVENT.TOUCH_START, DOM_EVENT.POINTER_DOWN],
|
|
20
|
+
(evt) => {
|
|
21
|
+
// Only count cancelable events, which should trigger behavior important to the user.
|
|
22
|
+
if (!evt.cancelable) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// This timing will be used to compute the "first Input delay", which is the delta between
|
|
27
|
+
// when the system received the event (e.g. evt.timeStamp) and when it could run the callback
|
|
28
|
+
// (e.g. performance.now()).
|
|
29
|
+
const timing: PerformanceEventTiming = {
|
|
30
|
+
entryType: 'first-input',
|
|
31
|
+
processingStart: relativeNow(),
|
|
32
|
+
processingEnd: relativeNow(),
|
|
33
|
+
startTime: evt.timeStamp as RelativeTime,
|
|
34
|
+
duration: 0 as Duration, // arbitrary value to avoid nullable duration and simplify INP logic
|
|
35
|
+
name: '',
|
|
36
|
+
cancelable: false,
|
|
37
|
+
target: null,
|
|
38
|
+
toJSON: () => ({}),
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (evt.type === DOM_EVENT.POINTER_DOWN) {
|
|
42
|
+
sendTimingIfPointerIsNotCancelled(configuration, timing)
|
|
43
|
+
} else {
|
|
44
|
+
sendTiming(timing)
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{ passive: true, capture: true }
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return { stop: removeEventListeners }
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Pointer events are a special case, because they can trigger main or compositor thread behavior.
|
|
54
|
+
* We differentiate these cases based on whether or not we see a pointercancel event, which are
|
|
55
|
+
* fired when we scroll. If we're scrolling we don't need to report input delay since FID excludes
|
|
56
|
+
* scrolling and pinch/zooming.
|
|
57
|
+
*/
|
|
58
|
+
function sendTimingIfPointerIsNotCancelled(configuration: RumConfiguration, timing: PerformanceEventTiming) {
|
|
59
|
+
addEventListeners(
|
|
60
|
+
configuration,
|
|
61
|
+
window,
|
|
62
|
+
[DOM_EVENT.POINTER_UP, DOM_EVENT.POINTER_CANCEL],
|
|
63
|
+
(event) => {
|
|
64
|
+
if (event.type === DOM_EVENT.POINTER_UP) {
|
|
65
|
+
sendTiming(timing)
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{ once: true }
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function sendTiming(timing: PerformanceEventTiming) {
|
|
73
|
+
if (!timingSent) {
|
|
74
|
+
timingSent = true
|
|
75
|
+
removeEventListeners()
|
|
76
|
+
// In some cases the recorded delay is clearly wrong, e.g. it's negative or it's larger than
|
|
77
|
+
// the time between now and when the page was loaded.
|
|
78
|
+
// - https://github.com/GoogleChromeLabs/first-input-delay/issues/4
|
|
79
|
+
// - https://github.com/GoogleChromeLabs/first-input-delay/issues/6
|
|
80
|
+
// - https://github.com/GoogleChromeLabs/first-input-delay/issues/7
|
|
81
|
+
const delay = timing.processingStart - timing.startTime
|
|
82
|
+
if (delay >= 0 && delay < dateNow() - startTimeStamp) {
|
|
83
|
+
callback(timing)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export function isTextNode(node: Node): node is Text {
|
|
2
|
+
return node.nodeType === Node.TEXT_NODE
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function isCommentNode(node: Node): node is Comment {
|
|
6
|
+
return node.nodeType === Node.COMMENT_NODE
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function isElementNode(node: Node): node is Element {
|
|
10
|
+
return node.nodeType === Node.ELEMENT_NODE
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function isNodeShadowHost(node: Node): node is Element & { shadowRoot: ShadowRoot } {
|
|
14
|
+
return isElementNode(node) && Boolean(node.shadowRoot)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isNodeShadowRoot(node: Node): node is ShadowRoot {
|
|
18
|
+
const shadowRoot = node as ShadowRoot
|
|
19
|
+
return !!shadowRoot.host && shadowRoot.nodeType === Node.DOCUMENT_FRAGMENT_NODE && isElementNode(shadowRoot.host)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function hasChildNodes(node: Node) {
|
|
23
|
+
return node.childNodes.length > 0 || isNodeShadowHost(node)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function forEachChildNodes(node: Node, callback: (child: Node) => void) {
|
|
27
|
+
let child = node.firstChild
|
|
28
|
+
|
|
29
|
+
while (child) {
|
|
30
|
+
callback(child)
|
|
31
|
+
|
|
32
|
+
child = child.nextSibling
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (isNodeShadowHost(node)) {
|
|
36
|
+
callback(node.shadowRoot)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Return `host` in case if the current node is a shadow root otherwise will return the `parentNode`
|
|
42
|
+
*/
|
|
43
|
+
export function getParentNode(node: Node): Node | null {
|
|
44
|
+
return isNodeShadowRoot(node) ? node.host : node.parentNode
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { addEventListener, DOM_EVENT, instrumentMethod, Observable, shallowClone } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RumConfiguration } from '../domain/configuration'
|
|
3
|
+
|
|
4
|
+
export interface LocationChange {
|
|
5
|
+
oldLocation: Readonly<Location>
|
|
6
|
+
newLocation: Readonly<Location>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createLocationChangeObservable(configuration: RumConfiguration, location: Location) {
|
|
10
|
+
let currentLocation = shallowClone(location)
|
|
11
|
+
|
|
12
|
+
return new Observable<LocationChange>((observable) => {
|
|
13
|
+
const { stop: stopHistoryTracking } = trackHistory(configuration, onLocationChange)
|
|
14
|
+
const { stop: stopHashTracking } = trackHash(configuration, onLocationChange)
|
|
15
|
+
|
|
16
|
+
function onLocationChange() {
|
|
17
|
+
if (currentLocation.href === location.href) {
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
const newLocation = shallowClone(location)
|
|
21
|
+
observable.notify({
|
|
22
|
+
newLocation,
|
|
23
|
+
oldLocation: currentLocation,
|
|
24
|
+
})
|
|
25
|
+
currentLocation = newLocation
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return () => {
|
|
29
|
+
stopHistoryTracking()
|
|
30
|
+
stopHashTracking()
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function trackHistory(configuration: RumConfiguration, onHistoryChange: () => void) {
|
|
36
|
+
const { stop: stopInstrumentingPushState } = instrumentMethod(
|
|
37
|
+
getHistoryInstrumentationTarget('pushState'),
|
|
38
|
+
'pushState',
|
|
39
|
+
({ onPostCall }) => {
|
|
40
|
+
onPostCall(onHistoryChange)
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
const { stop: stopInstrumentingReplaceState } = instrumentMethod(
|
|
44
|
+
getHistoryInstrumentationTarget('replaceState'),
|
|
45
|
+
'replaceState',
|
|
46
|
+
({ onPostCall }) => {
|
|
47
|
+
onPostCall(onHistoryChange)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
const { stop: removeListener } = addEventListener(configuration, window, DOM_EVENT.POP_STATE, onHistoryChange)
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
stop: () => {
|
|
54
|
+
stopInstrumentingPushState()
|
|
55
|
+
stopInstrumentingReplaceState()
|
|
56
|
+
removeListener()
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function trackHash(configuration: RumConfiguration, onHashChange: () => void) {
|
|
62
|
+
return addEventListener(configuration, window, DOM_EVENT.HASH_CHANGE, onHashChange)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getHistoryInstrumentationTarget(methodName: 'pushState' | 'replaceState') {
|
|
66
|
+
// Ideally we should always instument the method on the prototype, however some frameworks (e.g [Next.js](https://github.com/vercel/next.js/blob/d3f5532065f3e3bb84fb54bd2dfd1a16d0f03a21/packages/next/src/client/components/app-router.tsx#L429))
|
|
67
|
+
// are wrapping the instance method. In that case we should also wrap the instance method.
|
|
68
|
+
return Object.prototype.hasOwnProperty.call(history, methodName) ? history : History.prototype
|
|
69
|
+
}
|