@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,324 @@
|
|
|
1
|
+
import type { Duration, RelativeTime, TimeoutId } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { addEventListener, Observable, setTimeout, clearTimeout, monitor } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { RumConfiguration } from '../domain/configuration'
|
|
4
|
+
import { hasValidResourceEntryDuration, isAllowedRequestUrl } from '../domain/resource/resourceUtils'
|
|
5
|
+
import { retrieveFirstInputTiming } from './firstInputPolyfill'
|
|
6
|
+
|
|
7
|
+
type RumPerformanceObserverConstructor = new (callback: PerformanceObserverCallback) => RumPerformanceObserver
|
|
8
|
+
|
|
9
|
+
export interface BrowserWindow extends Window {
|
|
10
|
+
PerformanceObserver: RumPerformanceObserverConstructor
|
|
11
|
+
performance: Performance & { interactionCount?: number }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface RumPerformanceObserver extends PerformanceObserver {
|
|
15
|
+
observe(options?: PerformanceObserverInit & { durationThreshold?: number }): void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// We want to use a real enum (i.e. not a const enum) here, to be able to check whether an arbitrary
|
|
19
|
+
// string is an expected performance entry
|
|
20
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
21
|
+
export enum RumPerformanceEntryType {
|
|
22
|
+
EVENT = 'event',
|
|
23
|
+
FIRST_INPUT = 'first-input',
|
|
24
|
+
LARGEST_CONTENTFUL_PAINT = 'largest-contentful-paint',
|
|
25
|
+
LAYOUT_SHIFT = 'layout-shift',
|
|
26
|
+
LONG_TASK = 'longtask',
|
|
27
|
+
LONG_ANIMATION_FRAME = 'long-animation-frame',
|
|
28
|
+
NAVIGATION = 'navigation',
|
|
29
|
+
PAINT = 'paint',
|
|
30
|
+
RESOURCE = 'resource',
|
|
31
|
+
VISIBILITY_STATE = 'visibility-state',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RumPerformanceLongTaskTiming {
|
|
35
|
+
name: string
|
|
36
|
+
entryType: RumPerformanceEntryType.LONG_TASK
|
|
37
|
+
startTime: RelativeTime
|
|
38
|
+
duration: Duration
|
|
39
|
+
toJSON(): Omit<PerformanceEntry, 'toJSON'>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface RumPerformanceResourceTiming {
|
|
43
|
+
entryType: RumPerformanceEntryType.RESOURCE
|
|
44
|
+
initiatorType: string
|
|
45
|
+
responseStatus?: number
|
|
46
|
+
name: string
|
|
47
|
+
startTime: RelativeTime
|
|
48
|
+
duration: Duration
|
|
49
|
+
fetchStart: RelativeTime
|
|
50
|
+
workerStart: RelativeTime
|
|
51
|
+
domainLookupStart: RelativeTime
|
|
52
|
+
domainLookupEnd: RelativeTime
|
|
53
|
+
connectStart: RelativeTime
|
|
54
|
+
secureConnectionStart: RelativeTime
|
|
55
|
+
connectEnd: RelativeTime
|
|
56
|
+
requestStart: RelativeTime
|
|
57
|
+
responseStart: RelativeTime
|
|
58
|
+
responseEnd: RelativeTime
|
|
59
|
+
redirectStart: RelativeTime
|
|
60
|
+
redirectEnd: RelativeTime
|
|
61
|
+
decodedBodySize?: number
|
|
62
|
+
encodedBodySize?: number
|
|
63
|
+
transferSize?: number
|
|
64
|
+
nextHopProtocol?: string
|
|
65
|
+
renderBlockingStatus?: string
|
|
66
|
+
traceId?: string
|
|
67
|
+
deliveryType?: 'cache' | 'navigational-prefetch' | ''
|
|
68
|
+
toJSON(): Omit<PerformanceEntry, 'toJSON'>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface RumPerformancePaintTiming {
|
|
72
|
+
entryType: RumPerformanceEntryType.PAINT
|
|
73
|
+
name: 'first-paint' | 'first-contentful-paint'
|
|
74
|
+
startTime: RelativeTime
|
|
75
|
+
toJSON(): Omit<RumPerformancePaintTiming, 'toJSON'>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface RumPerformanceNavigationTiming extends Omit<RumPerformanceResourceTiming, 'entryType'> {
|
|
79
|
+
entryType: RumPerformanceEntryType.NAVIGATION
|
|
80
|
+
initiatorType: 'navigation'
|
|
81
|
+
name: string
|
|
82
|
+
|
|
83
|
+
domComplete: RelativeTime
|
|
84
|
+
domContentLoadedEventEnd: RelativeTime
|
|
85
|
+
domInteractive: RelativeTime
|
|
86
|
+
loadEventEnd: RelativeTime
|
|
87
|
+
|
|
88
|
+
toJSON(): Omit<RumPerformanceNavigationTiming, 'toJSON'>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface RumLargestContentfulPaintTiming {
|
|
92
|
+
entryType: RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT
|
|
93
|
+
startTime: RelativeTime
|
|
94
|
+
size: number
|
|
95
|
+
element?: Element
|
|
96
|
+
url?: string
|
|
97
|
+
toJSON(): Omit<RumLargestContentfulPaintTiming, 'toJSON'>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface RumFirstInputTiming {
|
|
101
|
+
entryType: RumPerformanceEntryType.FIRST_INPUT
|
|
102
|
+
startTime: RelativeTime
|
|
103
|
+
processingStart: RelativeTime
|
|
104
|
+
processingEnd: RelativeTime
|
|
105
|
+
duration: Duration
|
|
106
|
+
target?: Node
|
|
107
|
+
interactionId?: number
|
|
108
|
+
toJSON(): Omit<RumFirstInputTiming, 'toJSON'>
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface RumPerformanceEventTiming {
|
|
112
|
+
entryType: RumPerformanceEntryType.EVENT
|
|
113
|
+
startTime: RelativeTime
|
|
114
|
+
processingStart: RelativeTime
|
|
115
|
+
processingEnd: RelativeTime
|
|
116
|
+
duration: Duration
|
|
117
|
+
interactionId?: number
|
|
118
|
+
target?: Node
|
|
119
|
+
name: string
|
|
120
|
+
toJSON(): Omit<RumPerformanceEventTiming, 'toJSON'>
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface RumLayoutShiftAttribution {
|
|
124
|
+
node: Node | null
|
|
125
|
+
previousRect: DOMRectReadOnly
|
|
126
|
+
currentRect: DOMRectReadOnly
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface RumLayoutShiftTiming {
|
|
130
|
+
entryType: RumPerformanceEntryType.LAYOUT_SHIFT
|
|
131
|
+
startTime: RelativeTime
|
|
132
|
+
value: number
|
|
133
|
+
hadRecentInput: boolean
|
|
134
|
+
sources: RumLayoutShiftAttribution[]
|
|
135
|
+
toJSON(): Omit<RumLayoutShiftTiming, 'toJSON'>
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Documentation https://developer.chrome.com/docs/web-platform/long-animation-frames#better-attribution
|
|
139
|
+
export interface RumPerformanceScriptTiming {
|
|
140
|
+
duration: Duration
|
|
141
|
+
entryType: 'script'
|
|
142
|
+
executionStart: RelativeTime
|
|
143
|
+
forcedStyleAndLayoutDuration: Duration
|
|
144
|
+
invoker: string // e.g. "https://static.kubesense.ai/static/c/93085/chunk-bc4db53278fd4c77a637.min.js"
|
|
145
|
+
invokerType:
|
|
146
|
+
| 'user-callback'
|
|
147
|
+
| 'event-listener'
|
|
148
|
+
| 'resolve-promise'
|
|
149
|
+
| 'reject-promise'
|
|
150
|
+
| 'classic-script'
|
|
151
|
+
| 'module-script'
|
|
152
|
+
name: 'script'
|
|
153
|
+
pauseDuration: Duration
|
|
154
|
+
sourceCharPosition: number
|
|
155
|
+
sourceFunctionName: string
|
|
156
|
+
sourceURL: string
|
|
157
|
+
startTime: RelativeTime
|
|
158
|
+
window: Window
|
|
159
|
+
windowAttribution: string
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface RumPerformanceLongAnimationFrameTiming {
|
|
163
|
+
blockingDuration: Duration
|
|
164
|
+
duration: Duration
|
|
165
|
+
entryType: RumPerformanceEntryType.LONG_ANIMATION_FRAME
|
|
166
|
+
firstUIEventTimestamp: RelativeTime
|
|
167
|
+
name: 'long-animation-frame'
|
|
168
|
+
renderStart: RelativeTime
|
|
169
|
+
scripts: RumPerformanceScriptTiming[]
|
|
170
|
+
startTime: RelativeTime
|
|
171
|
+
styleAndLayoutStart: RelativeTime
|
|
172
|
+
toJSON(): Omit<RumPerformanceLongAnimationFrameTiming, 'toJSON'>
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface RumFirstHiddenTiming {
|
|
176
|
+
entryType: RumPerformanceEntryType.VISIBILITY_STATE
|
|
177
|
+
name: 'hidden' | 'visible'
|
|
178
|
+
startTime: RelativeTime
|
|
179
|
+
toJSON(): Omit<RumFirstHiddenTiming, 'toJSON'>
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type RumPerformanceEntry =
|
|
183
|
+
| RumPerformanceResourceTiming
|
|
184
|
+
| RumPerformanceLongTaskTiming
|
|
185
|
+
| RumPerformanceLongAnimationFrameTiming
|
|
186
|
+
| RumPerformancePaintTiming
|
|
187
|
+
| RumPerformanceNavigationTiming
|
|
188
|
+
| RumLargestContentfulPaintTiming
|
|
189
|
+
| RumFirstInputTiming
|
|
190
|
+
| RumPerformanceEventTiming
|
|
191
|
+
| RumLayoutShiftTiming
|
|
192
|
+
| RumFirstHiddenTiming
|
|
193
|
+
|
|
194
|
+
export interface EntryTypeToReturnType {
|
|
195
|
+
[RumPerformanceEntryType.EVENT]: RumPerformanceEventTiming
|
|
196
|
+
[RumPerformanceEntryType.FIRST_INPUT]: RumFirstInputTiming
|
|
197
|
+
[RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT]: RumLargestContentfulPaintTiming
|
|
198
|
+
[RumPerformanceEntryType.LAYOUT_SHIFT]: RumLayoutShiftTiming
|
|
199
|
+
[RumPerformanceEntryType.PAINT]: RumPerformancePaintTiming
|
|
200
|
+
[RumPerformanceEntryType.LONG_TASK]: RumPerformanceLongTaskTiming
|
|
201
|
+
[RumPerformanceEntryType.LONG_ANIMATION_FRAME]: RumPerformanceLongAnimationFrameTiming
|
|
202
|
+
[RumPerformanceEntryType.NAVIGATION]: RumPerformanceNavigationTiming
|
|
203
|
+
[RumPerformanceEntryType.RESOURCE]: RumPerformanceResourceTiming
|
|
204
|
+
[RumPerformanceEntryType.VISIBILITY_STATE]: RumFirstHiddenTiming
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function createPerformanceObservable<T extends RumPerformanceEntryType>(
|
|
208
|
+
configuration: RumConfiguration,
|
|
209
|
+
options: { type: T; buffered?: boolean; durationThreshold?: number }
|
|
210
|
+
) {
|
|
211
|
+
return new Observable<Array<EntryTypeToReturnType[T]>>((observable) => {
|
|
212
|
+
if (!window.PerformanceObserver) {
|
|
213
|
+
return
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const handlePerformanceEntries = (entries: PerformanceEntryList) => {
|
|
217
|
+
const rumPerformanceEntries = filterRumPerformanceEntries(entries as Array<EntryTypeToReturnType[T]>)
|
|
218
|
+
if (rumPerformanceEntries.length > 0) {
|
|
219
|
+
observable.notify(rumPerformanceEntries)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
let timeoutId: TimeoutId | undefined
|
|
224
|
+
let isObserverInitializing = true
|
|
225
|
+
const observer = new PerformanceObserver(
|
|
226
|
+
monitor((entries) => {
|
|
227
|
+
// In Safari the performance observer callback is synchronous.
|
|
228
|
+
// Because the buffered performance entry list can be quite large we delay the computation to prevent the SDK from blocking the main thread on init
|
|
229
|
+
if (isObserverInitializing) {
|
|
230
|
+
timeoutId = setTimeout(() => handlePerformanceEntries(entries.getEntries()))
|
|
231
|
+
} else {
|
|
232
|
+
handlePerformanceEntries(entries.getEntries())
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
)
|
|
236
|
+
try {
|
|
237
|
+
observer.observe(options)
|
|
238
|
+
} catch {
|
|
239
|
+
// Some old browser versions (<= chrome 74 ) don't support the PerformanceObserver type and buffered options
|
|
240
|
+
// In these cases, fallback to getEntriesByType and PerformanceObserver with entryTypes
|
|
241
|
+
// TODO: remove this fallback in the next major version
|
|
242
|
+
const fallbackSupportedEntryTypes = [
|
|
243
|
+
RumPerformanceEntryType.RESOURCE,
|
|
244
|
+
RumPerformanceEntryType.NAVIGATION,
|
|
245
|
+
RumPerformanceEntryType.LONG_TASK,
|
|
246
|
+
RumPerformanceEntryType.PAINT,
|
|
247
|
+
]
|
|
248
|
+
if (fallbackSupportedEntryTypes.includes(options.type)) {
|
|
249
|
+
if (options.buffered) {
|
|
250
|
+
timeoutId = setTimeout(() => handlePerformanceEntries(performance.getEntriesByType(options.type)))
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
observer.observe({ entryTypes: [options.type] })
|
|
254
|
+
} catch {
|
|
255
|
+
// Old versions of Safari are throwing "entryTypes contained only unsupported types"
|
|
256
|
+
// errors when observing only unsupported entry types.
|
|
257
|
+
//
|
|
258
|
+
// We could use `supportPerformanceTimingEvent` to make sure we don't invoke
|
|
259
|
+
// `observer.observe` with an unsupported entry type, but Safari 11 and 12 don't support
|
|
260
|
+
// `Performance.supportedEntryTypes`, so doing so would lose support for these versions
|
|
261
|
+
// even if they do support the entry type.
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
isObserverInitializing = false
|
|
267
|
+
|
|
268
|
+
manageResourceTimingBufferFull(configuration)
|
|
269
|
+
|
|
270
|
+
let stopFirstInputTiming: (() => void) | undefined
|
|
271
|
+
if (
|
|
272
|
+
!supportPerformanceTimingEvent(RumPerformanceEntryType.FIRST_INPUT) &&
|
|
273
|
+
options.type === RumPerformanceEntryType.FIRST_INPUT
|
|
274
|
+
) {
|
|
275
|
+
;({ stop: stopFirstInputTiming } = retrieveFirstInputTiming(configuration, (timing) => {
|
|
276
|
+
handlePerformanceEntries([timing])
|
|
277
|
+
}))
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return () => {
|
|
281
|
+
observer.disconnect()
|
|
282
|
+
if (stopFirstInputTiming) {
|
|
283
|
+
stopFirstInputTiming()
|
|
284
|
+
}
|
|
285
|
+
clearTimeout(timeoutId)
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
let resourceTimingBufferFullListener: { stop: () => void }
|
|
291
|
+
function manageResourceTimingBufferFull(configuration: RumConfiguration) {
|
|
292
|
+
if (!resourceTimingBufferFullListener && supportPerformanceObject() && 'addEventListener' in performance) {
|
|
293
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=1559377
|
|
294
|
+
resourceTimingBufferFullListener = addEventListener(configuration, performance, 'resourcetimingbufferfull', () => {
|
|
295
|
+
performance.clearResourceTimings()
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
return () => {
|
|
299
|
+
resourceTimingBufferFullListener?.stop()
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function supportPerformanceObject() {
|
|
304
|
+
return window.performance !== undefined && 'getEntries' in performance
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function supportPerformanceTimingEvent(entryType: RumPerformanceEntryType) {
|
|
308
|
+
return (
|
|
309
|
+
window.PerformanceObserver &&
|
|
310
|
+
PerformanceObserver.supportedEntryTypes !== undefined &&
|
|
311
|
+
PerformanceObserver.supportedEntryTypes.includes(entryType)
|
|
312
|
+
)
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function filterRumPerformanceEntries<T extends RumPerformanceEntryType>(entries: Array<EntryTypeToReturnType[T]>) {
|
|
316
|
+
return entries.filter((entry) => !isForbiddenResource(entry))
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function isForbiddenResource(entry: RumPerformanceEntry) {
|
|
320
|
+
return (
|
|
321
|
+
entry.entryType === RumPerformanceEntryType.RESOURCE &&
|
|
322
|
+
(!isAllowedRequestUrl(entry.name) || !hasValidResourceEntryDuration(entry))
|
|
323
|
+
)
|
|
324
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { RelativeTime, TimeStamp } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { getRelativeTime, isNumber } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { RumPerformanceNavigationTiming } from './performanceObservable'
|
|
4
|
+
import { RumPerformanceEntryType, supportPerformanceTimingEvent } from './performanceObservable'
|
|
5
|
+
|
|
6
|
+
export function getNavigationEntry(): RumPerformanceNavigationTiming {
|
|
7
|
+
if (supportPerformanceTimingEvent(RumPerformanceEntryType.NAVIGATION)) {
|
|
8
|
+
const navigationEntry = performance.getEntriesByType(
|
|
9
|
+
RumPerformanceEntryType.NAVIGATION
|
|
10
|
+
)[0] as unknown as RumPerformanceNavigationTiming
|
|
11
|
+
if (navigationEntry) {
|
|
12
|
+
return navigationEntry
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const timings = computeTimingsFromDeprecatedPerformanceTiming()
|
|
17
|
+
const entry: RumPerformanceNavigationTiming = {
|
|
18
|
+
entryType: RumPerformanceEntryType.NAVIGATION as const,
|
|
19
|
+
initiatorType: 'navigation' as const,
|
|
20
|
+
name: window.location.href,
|
|
21
|
+
startTime: 0 as RelativeTime,
|
|
22
|
+
duration: timings.loadEventEnd,
|
|
23
|
+
decodedBodySize: 0,
|
|
24
|
+
encodedBodySize: 0,
|
|
25
|
+
transferSize: 0,
|
|
26
|
+
workerStart: 0 as RelativeTime,
|
|
27
|
+
toJSON: () => ({ ...entry, toJSON: undefined }),
|
|
28
|
+
...timings,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return entry
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type TimingsFromDeprecatedPerformanceTiming = {
|
|
35
|
+
-readonly [key in keyof Omit<PerformanceTiming, 'toJSON'>]: RelativeTime
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function computeTimingsFromDeprecatedPerformanceTiming() {
|
|
39
|
+
const result: Partial<TimingsFromDeprecatedPerformanceTiming> = {}
|
|
40
|
+
const timing = performance.timing
|
|
41
|
+
|
|
42
|
+
for (const key in timing) {
|
|
43
|
+
if (isNumber(timing[key as keyof PerformanceTiming])) {
|
|
44
|
+
const numberKey = key as keyof TimingsFromDeprecatedPerformanceTiming
|
|
45
|
+
const timingElement = timing[numberKey] as TimeStamp
|
|
46
|
+
result[numberKey] = timingElement === 0 ? (0 as RelativeTime) : getRelativeTime(timingElement)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result as TimingsFromDeprecatedPerformanceTiming
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function getScrollX() {
|
|
2
|
+
let scrollX
|
|
3
|
+
const visual = window.visualViewport
|
|
4
|
+
if (visual) {
|
|
5
|
+
scrollX = visual.pageLeft - visual.offsetLeft
|
|
6
|
+
} else if (window.scrollX !== undefined) {
|
|
7
|
+
scrollX = window.scrollX
|
|
8
|
+
} else {
|
|
9
|
+
scrollX = window.pageXOffset || 0
|
|
10
|
+
}
|
|
11
|
+
return Math.round(scrollX)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getScrollY() {
|
|
15
|
+
let scrollY
|
|
16
|
+
const visual = window.visualViewport
|
|
17
|
+
if (visual) {
|
|
18
|
+
scrollY = visual.pageTop - visual.offsetTop
|
|
19
|
+
} else if (window.scrollY !== undefined) {
|
|
20
|
+
scrollY = window.scrollY
|
|
21
|
+
} else {
|
|
22
|
+
scrollY = window.pageYOffset || 0
|
|
23
|
+
}
|
|
24
|
+
return Math.round(scrollY)
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Observable, throttle, addEventListener, DOM_EVENT } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RumConfiguration } from '../domain/configuration'
|
|
3
|
+
|
|
4
|
+
export interface ViewportDimension {
|
|
5
|
+
height: number
|
|
6
|
+
width: number
|
|
7
|
+
[k: string]: unknown
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let viewportObservable: Observable<ViewportDimension> | undefined
|
|
11
|
+
|
|
12
|
+
export function initViewportObservable(configuration: RumConfiguration) {
|
|
13
|
+
if (!viewportObservable) {
|
|
14
|
+
viewportObservable = createViewportObservable(configuration)
|
|
15
|
+
}
|
|
16
|
+
return viewportObservable
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createViewportObservable(configuration: RumConfiguration) {
|
|
20
|
+
return new Observable<ViewportDimension>((observable) => {
|
|
21
|
+
const { throttled: updateDimension } = throttle(() => {
|
|
22
|
+
observable.notify(getViewportDimension())
|
|
23
|
+
}, 200)
|
|
24
|
+
|
|
25
|
+
return addEventListener(configuration, window, DOM_EVENT.RESIZE, updateDimension, { capture: true, passive: true })
|
|
26
|
+
.stop
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// excludes the width and height of any rendered classic scrollbar that is fixed to the visual viewport
|
|
31
|
+
export function getViewportDimension(): ViewportDimension {
|
|
32
|
+
const visual = window.visualViewport
|
|
33
|
+
if (visual) {
|
|
34
|
+
return {
|
|
35
|
+
width: Number(visual.width * visual.scale),
|
|
36
|
+
height: Number(visual.height * visual.scale),
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
width: Number(window.innerWidth || 0),
|
|
42
|
+
height: Number(window.innerHeight || 0),
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { instrumentMethod, Observable } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
|
|
3
|
+
export function createWindowOpenObservable() {
|
|
4
|
+
const observable = new Observable<void>()
|
|
5
|
+
const { stop } = instrumentMethod(window, 'open', () => observable.notify())
|
|
6
|
+
return { observable, stop }
|
|
7
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { ClocksState, Context, Observable } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { noop, combine, toServerDuration, generateUUID, SKIPPED, HookNames } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import { discardNegativeDuration } from '../discardNegativeDuration'
|
|
4
|
+
import type { RawRumActionEvent } from '../../rawRumEvent.types'
|
|
5
|
+
import { ActionType, RumEventType } from '../../rawRumEvent.types'
|
|
6
|
+
import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle'
|
|
7
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
8
|
+
import type { RumConfiguration } from '../configuration'
|
|
9
|
+
import type { RumActionEventDomainContext } from '../../domainContext.types'
|
|
10
|
+
import type { DefaultRumEventAttributes, DefaultTelemetryEventAttributes, Hooks } from '../hooks'
|
|
11
|
+
import type { RumMutationRecord } from '../../browser/domMutationObservable'
|
|
12
|
+
import type { ActionContexts, ClickAction } from './trackClickActions'
|
|
13
|
+
import { trackClickActions } from './trackClickActions'
|
|
14
|
+
|
|
15
|
+
export type { ActionContexts }
|
|
16
|
+
|
|
17
|
+
export interface CustomAction {
|
|
18
|
+
type: typeof ActionType.CUSTOM
|
|
19
|
+
name: string
|
|
20
|
+
startClocks: ClocksState
|
|
21
|
+
context?: Context
|
|
22
|
+
handlingStack?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type AutoAction = ClickAction
|
|
26
|
+
|
|
27
|
+
export function startActionCollection(
|
|
28
|
+
lifeCycle: LifeCycle,
|
|
29
|
+
hooks: Hooks,
|
|
30
|
+
domMutationObservable: Observable<RumMutationRecord[]>,
|
|
31
|
+
windowOpenObservable: Observable<void>,
|
|
32
|
+
configuration: RumConfiguration
|
|
33
|
+
) {
|
|
34
|
+
const { unsubscribe: unsubscribeAutoAction } = lifeCycle.subscribe(
|
|
35
|
+
LifeCycleEventType.AUTO_ACTION_COMPLETED,
|
|
36
|
+
(action) => {
|
|
37
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action))
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
hooks.register(HookNames.Assemble, ({ startTime, eventType }): DefaultRumEventAttributes | SKIPPED => {
|
|
42
|
+
if (
|
|
43
|
+
eventType !== RumEventType.ERROR &&
|
|
44
|
+
eventType !== RumEventType.RESOURCE &&
|
|
45
|
+
eventType !== RumEventType.LONG_TASK
|
|
46
|
+
) {
|
|
47
|
+
return SKIPPED
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const actionId = actionContexts.findActionId(startTime)
|
|
51
|
+
if (!actionId) {
|
|
52
|
+
return SKIPPED
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
type: eventType,
|
|
57
|
+
action: { id: actionId },
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
hooks.register(
|
|
62
|
+
HookNames.AssembleTelemetry,
|
|
63
|
+
({ startTime }): DefaultTelemetryEventAttributes => ({
|
|
64
|
+
action: { id: actionContexts.findActionId(startTime) as string },
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
let actionContexts: ActionContexts = { findActionId: noop as () => undefined }
|
|
69
|
+
let stop: () => void = noop
|
|
70
|
+
|
|
71
|
+
if (configuration.trackUserInteractions) {
|
|
72
|
+
;({ actionContexts, stop } = trackClickActions(
|
|
73
|
+
lifeCycle,
|
|
74
|
+
domMutationObservable,
|
|
75
|
+
windowOpenObservable,
|
|
76
|
+
configuration
|
|
77
|
+
))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
addAction: (action: CustomAction) => {
|
|
82
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processAction(action))
|
|
83
|
+
},
|
|
84
|
+
actionContexts,
|
|
85
|
+
stop: () => {
|
|
86
|
+
unsubscribeAutoAction()
|
|
87
|
+
stop()
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function processAction(action: AutoAction | CustomAction): RawRumEventCollectedData<RawRumActionEvent> {
|
|
93
|
+
const autoActionProperties = isAutoAction(action)
|
|
94
|
+
? {
|
|
95
|
+
action: {
|
|
96
|
+
id: action.id,
|
|
97
|
+
loading_time: discardNegativeDuration(toServerDuration(action.duration)),
|
|
98
|
+
frustration: {
|
|
99
|
+
type: action.frustrationTypes,
|
|
100
|
+
},
|
|
101
|
+
error: {
|
|
102
|
+
count: action.counts.errorCount,
|
|
103
|
+
},
|
|
104
|
+
long_task: {
|
|
105
|
+
count: action.counts.longTaskCount,
|
|
106
|
+
},
|
|
107
|
+
resource: {
|
|
108
|
+
count: action.counts.resourceCount,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
_kubesense: {
|
|
112
|
+
action: {
|
|
113
|
+
target: action.target,
|
|
114
|
+
position: action.position,
|
|
115
|
+
name_source: action.nameSource,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
: {
|
|
120
|
+
context: action.context,
|
|
121
|
+
}
|
|
122
|
+
const actionEvent: RawRumActionEvent = combine(
|
|
123
|
+
{
|
|
124
|
+
action: { id: generateUUID(), target: { name: action.name }, type: action.type },
|
|
125
|
+
date: action.startClocks.timeStamp,
|
|
126
|
+
type: RumEventType.ACTION,
|
|
127
|
+
},
|
|
128
|
+
autoActionProperties
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
const duration = isAutoAction(action) ? action.duration : undefined
|
|
132
|
+
const domainContext: RumActionEventDomainContext = isAutoAction(action)
|
|
133
|
+
? { events: action.events }
|
|
134
|
+
: { handlingStack: action.handlingStack }
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
rawRumEvent: actionEvent,
|
|
138
|
+
duration,
|
|
139
|
+
startTime: action.startClocks.relative,
|
|
140
|
+
domainContext,
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isAutoAction(action: AutoAction | CustomAction): action is AutoAction {
|
|
145
|
+
return action.type !== ActionType.CUSTOM
|
|
146
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the action name from the attribute 'data-kubesense-action-name' on the element or any of its parent.
|
|
3
|
+
* It can also be retrieved from a user defined attribute.
|
|
4
|
+
*/
|
|
5
|
+
export const DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-kubesense-action-name'
|
|
6
|
+
export const ACTION_NAME_PLACEHOLDER = 'Masked Element'
|
|
7
|
+
export const ACTION_NAME_MASK = 'xxx'
|
|
8
|
+
|
|
9
|
+
export const enum ActionNameSource {
|
|
10
|
+
CUSTOM_ATTRIBUTE = 'custom_attribute',
|
|
11
|
+
MASK_PLACEHOLDER = 'mask_placeholder',
|
|
12
|
+
TEXT_CONTENT = 'text_content',
|
|
13
|
+
STANDARD_ATTRIBUTE = 'standard_attribute',
|
|
14
|
+
BLANK = 'blank',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ActionName {
|
|
18
|
+
name: string
|
|
19
|
+
nameSource: ActionNameSource
|
|
20
|
+
}
|