@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,83 @@
|
|
|
1
|
+
import type { TimeoutId } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { ONE_SECOND, clearTimeout, setTimeout } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { Click } from './trackClickActions'
|
|
4
|
+
|
|
5
|
+
export interface ClickChain {
|
|
6
|
+
tryAppend: (click: Click) => boolean
|
|
7
|
+
stop: () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND
|
|
11
|
+
export const MAX_DISTANCE_BETWEEN_CLICKS = 100
|
|
12
|
+
|
|
13
|
+
const enum ClickChainStatus {
|
|
14
|
+
WaitingForMoreClicks,
|
|
15
|
+
WaitingForClicksToStop,
|
|
16
|
+
Finalized,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createClickChain(firstClick: Click, onFinalize: (clicks: Click[]) => void): ClickChain {
|
|
20
|
+
const bufferedClicks: Click[] = []
|
|
21
|
+
let status = ClickChainStatus.WaitingForMoreClicks
|
|
22
|
+
let maxDurationBetweenClicksTimeoutId: TimeoutId | undefined
|
|
23
|
+
appendClick(firstClick)
|
|
24
|
+
|
|
25
|
+
function appendClick(click: Click) {
|
|
26
|
+
click.stopObservable.subscribe(tryFinalize)
|
|
27
|
+
bufferedClicks.push(click)
|
|
28
|
+
clearTimeout(maxDurationBetweenClicksTimeoutId)
|
|
29
|
+
maxDurationBetweenClicksTimeoutId = setTimeout(dontAcceptMoreClick, MAX_DURATION_BETWEEN_CLICKS)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function tryFinalize() {
|
|
33
|
+
if (status === ClickChainStatus.WaitingForClicksToStop && bufferedClicks.every((click) => click.isStopped())) {
|
|
34
|
+
status = ClickChainStatus.Finalized
|
|
35
|
+
onFinalize(bufferedClicks)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function dontAcceptMoreClick() {
|
|
40
|
+
clearTimeout(maxDurationBetweenClicksTimeoutId)
|
|
41
|
+
if (status === ClickChainStatus.WaitingForMoreClicks) {
|
|
42
|
+
status = ClickChainStatus.WaitingForClicksToStop
|
|
43
|
+
tryFinalize()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
tryAppend: (click) => {
|
|
49
|
+
if (status !== ClickChainStatus.WaitingForMoreClicks) {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (
|
|
54
|
+
bufferedClicks.length > 0 &&
|
|
55
|
+
!areEventsSimilar(bufferedClicks[bufferedClicks.length - 1].event, click.event)
|
|
56
|
+
) {
|
|
57
|
+
dontAcceptMoreClick()
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
appendClick(click)
|
|
62
|
+
return true
|
|
63
|
+
},
|
|
64
|
+
stop: () => {
|
|
65
|
+
dontAcceptMoreClick()
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Checks whether two events are similar by comparing their target, position and timestamp
|
|
72
|
+
*/
|
|
73
|
+
function areEventsSimilar(first: MouseEvent, second: MouseEvent) {
|
|
74
|
+
return (
|
|
75
|
+
first.target === second.target &&
|
|
76
|
+
mouseEventDistance(first, second) <= MAX_DISTANCE_BETWEEN_CLICKS &&
|
|
77
|
+
first.timeStamp - second.timeStamp <= MAX_DURATION_BETWEEN_CLICKS
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function mouseEventDistance(origin: MouseEvent, other: MouseEvent) {
|
|
82
|
+
return Math.sqrt(Math.pow(origin.clientX - other.clientX, 2) + Math.pow(origin.clientY - other.clientY, 2))
|
|
83
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ONE_SECOND } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { FrustrationType } from '../../rawRumEvent.types'
|
|
3
|
+
import type { Click } from './trackClickActions'
|
|
4
|
+
|
|
5
|
+
const MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE = 3
|
|
6
|
+
|
|
7
|
+
export function computeFrustration(clicks: Click[], rageClick: Click) {
|
|
8
|
+
if (isRage(clicks)) {
|
|
9
|
+
rageClick.addFrustration(FrustrationType.RAGE_CLICK)
|
|
10
|
+
if (clicks.some(isDead)) {
|
|
11
|
+
rageClick.addFrustration(FrustrationType.DEAD_CLICK)
|
|
12
|
+
}
|
|
13
|
+
if (rageClick.hasError) {
|
|
14
|
+
rageClick.addFrustration(FrustrationType.ERROR_CLICK)
|
|
15
|
+
}
|
|
16
|
+
return { isRage: true }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const hasSelectionChanged = clicks.some((click) => click.getUserActivity().selection)
|
|
20
|
+
clicks.forEach((click) => {
|
|
21
|
+
if (click.hasError) {
|
|
22
|
+
click.addFrustration(FrustrationType.ERROR_CLICK)
|
|
23
|
+
}
|
|
24
|
+
if (
|
|
25
|
+
isDead(click) &&
|
|
26
|
+
// Avoid considering clicks part of a double-click or triple-click selections as dead clicks
|
|
27
|
+
!hasSelectionChanged
|
|
28
|
+
) {
|
|
29
|
+
click.addFrustration(FrustrationType.DEAD_CLICK)
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
return { isRage: false }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isRage(clicks: Click[]) {
|
|
36
|
+
if (clicks.some((click) => click.getUserActivity().selection || click.getUserActivity().scroll)) {
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
for (let i = 0; i < clicks.length - (MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1); i += 1) {
|
|
40
|
+
if (
|
|
41
|
+
clicks[i + MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1].event.timeStamp - clicks[i].event.timeStamp <=
|
|
42
|
+
ONE_SECOND
|
|
43
|
+
) {
|
|
44
|
+
return true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return false
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const DEAD_CLICK_EXCLUDE_SELECTOR =
|
|
51
|
+
// inputs that don't trigger a meaningful event like "input" when clicked, including textual
|
|
52
|
+
// inputs (using a negative selector is shorter here)
|
|
53
|
+
'input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]),' +
|
|
54
|
+
'textarea,' +
|
|
55
|
+
'select,' +
|
|
56
|
+
// contenteditable and their descendants don't always trigger meaningful changes when manipulated
|
|
57
|
+
'[contenteditable],' +
|
|
58
|
+
'[contenteditable] *,' +
|
|
59
|
+
// canvas, as there is no good way to detect activity occurring on them
|
|
60
|
+
'canvas,' +
|
|
61
|
+
// links that are interactive (have an href attribute) or any of their descendants, as they can
|
|
62
|
+
// open a new tab or navigate to a hash without triggering a meaningful event
|
|
63
|
+
'a[href],' +
|
|
64
|
+
'a[href] *'
|
|
65
|
+
|
|
66
|
+
export function isDead(click: Click) {
|
|
67
|
+
if (click.hasPageActivity || click.getUserActivity().input || click.getUserActivity().scroll) {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
let target: Element | null = click.event.target
|
|
71
|
+
|
|
72
|
+
if (target.tagName === 'LABEL' && target.hasAttribute('for')) {
|
|
73
|
+
target = document.getElementById(target.getAttribute('for')!)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return !target || !target.matches(DEAD_CLICK_EXCLUDE_SELECTOR)
|
|
77
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { ExperimentalFeature, isExperimentalFeatureEnabled, safeTruncate } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { getPrivacySelector, NodePrivacyLevel } from '../privacyConstants'
|
|
3
|
+
import { getNodePrivacyLevel, maskDisallowedTextContent, shouldMaskNode, shouldMaskAttribute } from '../privacy'
|
|
4
|
+
import type { NodePrivacyLevelCache } from '../privacy'
|
|
5
|
+
import type { RumConfiguration } from '../configuration'
|
|
6
|
+
import { isElementNode } from '../../browser/htmlDomUtils'
|
|
7
|
+
import {
|
|
8
|
+
ActionNameSource,
|
|
9
|
+
DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,
|
|
10
|
+
ACTION_NAME_PLACEHOLDER,
|
|
11
|
+
} from './actionNameConstants'
|
|
12
|
+
import type { ActionName } from './actionNameConstants'
|
|
13
|
+
|
|
14
|
+
export function getActionNameFromElement(
|
|
15
|
+
element: Element,
|
|
16
|
+
rumConfiguration: RumConfiguration,
|
|
17
|
+
nodePrivacyLevel: NodePrivacyLevel = NodePrivacyLevel.ALLOW
|
|
18
|
+
): ActionName {
|
|
19
|
+
const nodePrivacyLevelCache: NodePrivacyLevelCache = new Map()
|
|
20
|
+
|
|
21
|
+
const { actionNameAttribute: userProgrammaticAttribute } = rumConfiguration
|
|
22
|
+
|
|
23
|
+
// Proceed to get the action name in two steps:
|
|
24
|
+
// * first, get the name programmatically, explicitly defined by the user.
|
|
25
|
+
// * then, if privacy is set to mask, return a placeholder for the undefined.
|
|
26
|
+
// * if privacy is not set to mask, use strategies that are known to return good results.
|
|
27
|
+
// Those strategies will be used on the element and a few parents, but it's likely that they won't succeed at all.
|
|
28
|
+
// * if no name is found this way, use strategies returning less accurate names as a fallback.
|
|
29
|
+
// Those are much likely to succeed.
|
|
30
|
+
const defaultActionName =
|
|
31
|
+
getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
|
|
32
|
+
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute))
|
|
33
|
+
|
|
34
|
+
if (defaultActionName) {
|
|
35
|
+
return { name: defaultActionName, nameSource: ActionNameSource.CUSTOM_ATTRIBUTE }
|
|
36
|
+
} else if (nodePrivacyLevel === NodePrivacyLevel.MASK) {
|
|
37
|
+
return { name: ACTION_NAME_PLACEHOLDER, nameSource: ActionNameSource.MASK_PLACEHOLDER }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
getActionNameFromElementForStrategies(element, priorityStrategies, rumConfiguration, nodePrivacyLevelCache) ||
|
|
42
|
+
getActionNameFromElementForStrategies(element, fallbackStrategies, rumConfiguration, nodePrivacyLevelCache) || {
|
|
43
|
+
name: '',
|
|
44
|
+
nameSource: ActionNameSource.BLANK,
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getActionNameFromElementProgrammatically(targetElement: Element, programmaticAttribute: string) {
|
|
50
|
+
// We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,
|
|
51
|
+
// without limit. It is up to the user to declare a relevant naming strategy.
|
|
52
|
+
const elementWithAttribute = targetElement.closest(`[${programmaticAttribute}]`)
|
|
53
|
+
|
|
54
|
+
if (!elementWithAttribute) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
const name = elementWithAttribute.getAttribute(programmaticAttribute)!
|
|
58
|
+
return truncate(normalizeWhitespace(name.trim()))
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type NameStrategy = (
|
|
62
|
+
element: Element | HTMLElement | HTMLInputElement | HTMLSelectElement,
|
|
63
|
+
rumConfiguration: RumConfiguration,
|
|
64
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
65
|
+
) => ActionName | undefined | null
|
|
66
|
+
|
|
67
|
+
const priorityStrategies: NameStrategy[] = [
|
|
68
|
+
// associated LABEL text
|
|
69
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
70
|
+
if ('labels' in element && element.labels && element.labels.length > 0) {
|
|
71
|
+
return getActionNameFromTextualContent(element.labels[0], rumConfiguration, nodePrivacyLevelCache)
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// INPUT button (and associated) value
|
|
75
|
+
(element) => {
|
|
76
|
+
if (element.nodeName === 'INPUT') {
|
|
77
|
+
const input = element as HTMLInputElement
|
|
78
|
+
const type = input.getAttribute('type')
|
|
79
|
+
if (type === 'button' || type === 'submit' || type === 'reset') {
|
|
80
|
+
return { name: input.value, nameSource: ActionNameSource.TEXT_CONTENT }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
// BUTTON, LABEL or button-like element text
|
|
85
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
86
|
+
if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {
|
|
87
|
+
return getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache)
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
91
|
+
getActionNameFromStandardAttribute(element, 'aria-label', rumConfiguration, nodePrivacyLevelCache),
|
|
92
|
+
// associated element text designated by the aria-labelledby attribute
|
|
93
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
94
|
+
const labelledByAttribute = element.getAttribute('aria-labelledby')
|
|
95
|
+
if (labelledByAttribute) {
|
|
96
|
+
return {
|
|
97
|
+
name: labelledByAttribute
|
|
98
|
+
.split(/\s+/)
|
|
99
|
+
.map((id) => getElementById(element, id))
|
|
100
|
+
.filter((label): label is HTMLElement => Boolean(label))
|
|
101
|
+
.map((element) => getTextualContent(element, rumConfiguration, nodePrivacyLevelCache))
|
|
102
|
+
.join(' '),
|
|
103
|
+
nameSource: ActionNameSource.TEXT_CONTENT,
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
108
|
+
getActionNameFromStandardAttribute(element, 'alt', rumConfiguration, nodePrivacyLevelCache),
|
|
109
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
110
|
+
getActionNameFromStandardAttribute(element, 'name', rumConfiguration, nodePrivacyLevelCache),
|
|
111
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
112
|
+
getActionNameFromStandardAttribute(element, 'title', rumConfiguration, nodePrivacyLevelCache),
|
|
113
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
114
|
+
getActionNameFromStandardAttribute(element, 'placeholder', rumConfiguration, nodePrivacyLevelCache),
|
|
115
|
+
// SELECT first OPTION text
|
|
116
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
117
|
+
if ('options' in element && element.options.length > 0) {
|
|
118
|
+
return getActionNameFromTextualContent(element.options[0], rumConfiguration, nodePrivacyLevelCache)
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
const fallbackStrategies: NameStrategy[] = [
|
|
124
|
+
(element, rumConfiguration, nodePrivacyLevelCache) =>
|
|
125
|
+
getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache),
|
|
126
|
+
]
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Iterates over the target element and its parent, using the strategies list to get an action name.
|
|
130
|
+
* Each strategies are applied on each element, stopping as soon as a non-empty value is returned.
|
|
131
|
+
*/
|
|
132
|
+
const MAX_PARENTS_TO_CONSIDER = 10
|
|
133
|
+
function getActionNameFromElementForStrategies(
|
|
134
|
+
targetElement: Element,
|
|
135
|
+
strategies: NameStrategy[],
|
|
136
|
+
rumConfiguration: RumConfiguration,
|
|
137
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
138
|
+
) {
|
|
139
|
+
let element: Element | null = targetElement
|
|
140
|
+
let recursionCounter = 0
|
|
141
|
+
while (
|
|
142
|
+
recursionCounter <= MAX_PARENTS_TO_CONSIDER &&
|
|
143
|
+
element &&
|
|
144
|
+
element.nodeName !== 'BODY' &&
|
|
145
|
+
element.nodeName !== 'HTML' &&
|
|
146
|
+
element.nodeName !== 'HEAD'
|
|
147
|
+
) {
|
|
148
|
+
for (const strategy of strategies) {
|
|
149
|
+
const actionName = strategy(element, rumConfiguration, nodePrivacyLevelCache)
|
|
150
|
+
if (actionName) {
|
|
151
|
+
const { name, nameSource } = actionName
|
|
152
|
+
const trimmedName = name && name.trim()
|
|
153
|
+
if (trimmedName) {
|
|
154
|
+
return { name: truncate(normalizeWhitespace(trimmedName)), nameSource }
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Consider a FORM as a contextual limit to get the action name. This is experimental and may
|
|
159
|
+
// be reconsidered in the future.
|
|
160
|
+
if (element.nodeName === 'FORM') {
|
|
161
|
+
break
|
|
162
|
+
}
|
|
163
|
+
element = element.parentElement
|
|
164
|
+
recursionCounter += 1
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function normalizeWhitespace(s: string) {
|
|
169
|
+
return s.replace(/\s+/g, ' ')
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function truncate(s: string) {
|
|
173
|
+
return s.length > 100 ? `${safeTruncate(s, 100)} [...]` : s
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function getElementById(refElement: Element, id: string) {
|
|
177
|
+
// Use the element ownerDocument here, because tests are executed in an iframe, so
|
|
178
|
+
// document.getElementById won't work.
|
|
179
|
+
return refElement.ownerDocument ? refElement.ownerDocument.getElementById(id) : null
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function getActionNameFromStandardAttribute(
|
|
183
|
+
element: Element | HTMLElement,
|
|
184
|
+
attribute: string,
|
|
185
|
+
rumConfiguration: RumConfiguration,
|
|
186
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
187
|
+
): ActionName {
|
|
188
|
+
const { enablePrivacyForActionName, defaultPrivacyLevel } = rumConfiguration
|
|
189
|
+
let attributeValue = element.getAttribute(attribute)
|
|
190
|
+
if (attributeValue && enablePrivacyForActionName) {
|
|
191
|
+
const nodePrivacyLevel = getNodePrivacyLevel(element, defaultPrivacyLevel, nodePrivacyLevelCache)
|
|
192
|
+
if (shouldMaskAttribute(element.tagName, attribute, attributeValue, nodePrivacyLevel, rumConfiguration)) {
|
|
193
|
+
attributeValue = maskDisallowedTextContent(attributeValue, ACTION_NAME_PLACEHOLDER)
|
|
194
|
+
}
|
|
195
|
+
} else if (!attributeValue) {
|
|
196
|
+
attributeValue = ''
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
name: attributeValue,
|
|
201
|
+
nameSource: ActionNameSource.STANDARD_ATTRIBUTE,
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function getActionNameFromTextualContent(
|
|
206
|
+
element: Element | HTMLElement,
|
|
207
|
+
rumConfiguration: RumConfiguration,
|
|
208
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
209
|
+
): ActionName {
|
|
210
|
+
return {
|
|
211
|
+
name: getTextualContent(element, rumConfiguration, nodePrivacyLevelCache) || '',
|
|
212
|
+
nameSource: ActionNameSource.TEXT_CONTENT,
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function getTextualContent(
|
|
217
|
+
element: Element,
|
|
218
|
+
rumConfiguration: RumConfiguration,
|
|
219
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
220
|
+
) {
|
|
221
|
+
if ((element as HTMLElement).isContentEditable) {
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const {
|
|
226
|
+
enablePrivacyForActionName,
|
|
227
|
+
actionNameAttribute: userProgrammaticAttribute,
|
|
228
|
+
defaultPrivacyLevel,
|
|
229
|
+
} = rumConfiguration
|
|
230
|
+
|
|
231
|
+
if (isExperimentalFeatureEnabled(ExperimentalFeature.USE_TREE_WALKER_FOR_ACTION_NAME)) {
|
|
232
|
+
return getTextualContentWithTreeWalker(
|
|
233
|
+
element,
|
|
234
|
+
userProgrammaticAttribute,
|
|
235
|
+
enablePrivacyForActionName,
|
|
236
|
+
defaultPrivacyLevel,
|
|
237
|
+
nodePrivacyLevelCache
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if ('innerText' in element) {
|
|
242
|
+
let text = (element as HTMLElement).innerText
|
|
243
|
+
|
|
244
|
+
const removeTextFromElements = (query: string) => {
|
|
245
|
+
const list = element.querySelectorAll<Element | HTMLElement>(query)
|
|
246
|
+
for (let index = 0; index < list.length; index += 1) {
|
|
247
|
+
const element = list[index]
|
|
248
|
+
if ('innerText' in element) {
|
|
249
|
+
const textToReplace = element.innerText
|
|
250
|
+
if (textToReplace && textToReplace.trim().length > 0) {
|
|
251
|
+
text = text.replace(textToReplace, '')
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// remove the text of elements with programmatic attribute value
|
|
258
|
+
removeTextFromElements(`[${DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE}]`)
|
|
259
|
+
|
|
260
|
+
if (userProgrammaticAttribute) {
|
|
261
|
+
removeTextFromElements(`[${userProgrammaticAttribute}]`)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (enablePrivacyForActionName) {
|
|
265
|
+
// remove the text of elements with privacy override
|
|
266
|
+
removeTextFromElements(
|
|
267
|
+
`${getPrivacySelector(NodePrivacyLevel.HIDDEN)}, ${getPrivacySelector(NodePrivacyLevel.MASK)}`
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return text
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return element.textContent
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function getTextualContentWithTreeWalker(
|
|
278
|
+
element: Element,
|
|
279
|
+
userProgrammaticAttribute: string | undefined,
|
|
280
|
+
privacyEnabledActionName: boolean,
|
|
281
|
+
defaultPrivacyLevel: NodePrivacyLevel,
|
|
282
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache
|
|
283
|
+
) {
|
|
284
|
+
const walker = document.createTreeWalker(
|
|
285
|
+
element,
|
|
286
|
+
// eslint-disable-next-line no-bitwise
|
|
287
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,
|
|
288
|
+
rejectInvisibleOrMaskedElementsFilter
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
let text = ''
|
|
292
|
+
|
|
293
|
+
while (walker.nextNode()) {
|
|
294
|
+
const node = walker.currentNode
|
|
295
|
+
if (isElementNode(node)) {
|
|
296
|
+
if (
|
|
297
|
+
// Following InnerText rendering spec https://html.spec.whatwg.org/multipage/dom.html#rendered-text-collection-steps
|
|
298
|
+
node.nodeName === 'BR' ||
|
|
299
|
+
node.nodeName === 'P' ||
|
|
300
|
+
['block', 'flex', 'grid', 'list-item', 'table', 'table-caption'].includes(getComputedStyle(node).display)
|
|
301
|
+
) {
|
|
302
|
+
text += ' '
|
|
303
|
+
}
|
|
304
|
+
continue // skip element nodes
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
text += node.textContent || ''
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return text.replace(/\s+/g, ' ').trim()
|
|
311
|
+
|
|
312
|
+
function rejectInvisibleOrMaskedElementsFilter(node: Node) {
|
|
313
|
+
const nodeSelfPrivacyLevel = getNodePrivacyLevel(node, defaultPrivacyLevel, nodePrivacyLevelCache)
|
|
314
|
+
if (privacyEnabledActionName && nodeSelfPrivacyLevel && shouldMaskNode(node, nodeSelfPrivacyLevel)) {
|
|
315
|
+
return NodeFilter.FILTER_REJECT
|
|
316
|
+
}
|
|
317
|
+
if (isElementNode(node)) {
|
|
318
|
+
if (
|
|
319
|
+
node.hasAttribute(DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
|
|
320
|
+
(userProgrammaticAttribute && node.hasAttribute(userProgrammaticAttribute))
|
|
321
|
+
) {
|
|
322
|
+
return NodeFilter.FILTER_REJECT
|
|
323
|
+
}
|
|
324
|
+
const style = getComputedStyle(node)
|
|
325
|
+
if (
|
|
326
|
+
style.visibility !== 'visible' ||
|
|
327
|
+
style.display === 'none' ||
|
|
328
|
+
(style.contentVisibility && style.contentVisibility !== 'visible')
|
|
329
|
+
// contentVisibility is not supported in all browsers, so we need to check it
|
|
330
|
+
) {
|
|
331
|
+
return NodeFilter.FILTER_REJECT
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return NodeFilter.FILTER_ACCEPT
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { elapsed, ONE_SECOND, relativeNow } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RelativeTime } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
|
|
4
|
+
// Maximum duration for click actions
|
|
5
|
+
export const CLICK_ACTION_MAX_DURATION = 10 * ONE_SECOND
|
|
6
|
+
export const interactionSelectorCache = new Map<RelativeTime, string>()
|
|
7
|
+
|
|
8
|
+
export function getInteractionSelector(relativeTimestamp: RelativeTime) {
|
|
9
|
+
const selector = interactionSelectorCache.get(relativeTimestamp)
|
|
10
|
+
interactionSelectorCache.delete(relativeTimestamp)
|
|
11
|
+
return selector
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function updateInteractionSelector(relativeTimestamp: RelativeTime, selector: string) {
|
|
15
|
+
interactionSelectorCache.set(relativeTimestamp, selector)
|
|
16
|
+
interactionSelectorCache.forEach((_, relativeTimestamp) => {
|
|
17
|
+
if (elapsed(relativeTimestamp, relativeNow()) > CLICK_ACTION_MAX_DURATION) {
|
|
18
|
+
interactionSelectorCache.delete(relativeTimestamp)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { addEventListener, DOM_EVENT } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RelativeTime } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { RumConfiguration } from '../configuration'
|
|
4
|
+
|
|
5
|
+
export interface ExtraPointerEventFields {
|
|
6
|
+
target: Element
|
|
7
|
+
timeStamp: RelativeTime
|
|
8
|
+
}
|
|
9
|
+
export type MouseEventOnElement = PointerEvent & ExtraPointerEventFields
|
|
10
|
+
|
|
11
|
+
export interface UserActivity {
|
|
12
|
+
selection: boolean
|
|
13
|
+
input: boolean
|
|
14
|
+
scroll: boolean
|
|
15
|
+
}
|
|
16
|
+
export interface ActionEventsHooks<ClickContext> {
|
|
17
|
+
onPointerDown: (event: MouseEventOnElement) => ClickContext | undefined
|
|
18
|
+
onPointerUp: (context: ClickContext, event: MouseEventOnElement, getUserActivity: () => UserActivity) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function listenActionEvents<ClickContext>(
|
|
22
|
+
configuration: RumConfiguration,
|
|
23
|
+
{ onPointerDown, onPointerUp }: ActionEventsHooks<ClickContext>
|
|
24
|
+
) {
|
|
25
|
+
let selectionEmptyAtPointerDown: boolean
|
|
26
|
+
let userActivity: UserActivity = {
|
|
27
|
+
selection: false,
|
|
28
|
+
input: false,
|
|
29
|
+
scroll: false,
|
|
30
|
+
}
|
|
31
|
+
let clickContext: ClickContext | undefined
|
|
32
|
+
|
|
33
|
+
const listeners = [
|
|
34
|
+
addEventListener(
|
|
35
|
+
configuration,
|
|
36
|
+
window,
|
|
37
|
+
DOM_EVENT.POINTER_DOWN,
|
|
38
|
+
(event: PointerEvent) => {
|
|
39
|
+
if (isValidPointerEvent(event)) {
|
|
40
|
+
selectionEmptyAtPointerDown = isSelectionEmpty()
|
|
41
|
+
userActivity = {
|
|
42
|
+
selection: false,
|
|
43
|
+
input: false,
|
|
44
|
+
scroll: false,
|
|
45
|
+
}
|
|
46
|
+
clickContext = onPointerDown(event)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{ capture: true }
|
|
50
|
+
),
|
|
51
|
+
|
|
52
|
+
addEventListener(
|
|
53
|
+
configuration,
|
|
54
|
+
window,
|
|
55
|
+
DOM_EVENT.SELECTION_CHANGE,
|
|
56
|
+
() => {
|
|
57
|
+
if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {
|
|
58
|
+
userActivity.selection = true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{ capture: true }
|
|
62
|
+
),
|
|
63
|
+
|
|
64
|
+
addEventListener(
|
|
65
|
+
configuration,
|
|
66
|
+
window,
|
|
67
|
+
DOM_EVENT.SCROLL,
|
|
68
|
+
() => {
|
|
69
|
+
userActivity.scroll = true
|
|
70
|
+
},
|
|
71
|
+
{ capture: true, passive: true }
|
|
72
|
+
),
|
|
73
|
+
|
|
74
|
+
addEventListener(
|
|
75
|
+
configuration,
|
|
76
|
+
window,
|
|
77
|
+
DOM_EVENT.POINTER_UP,
|
|
78
|
+
(event: PointerEvent) => {
|
|
79
|
+
if (isValidPointerEvent(event) && clickContext) {
|
|
80
|
+
// Use a scoped variable to make sure the value is not changed by other clicks
|
|
81
|
+
const localUserActivity = userActivity
|
|
82
|
+
onPointerUp(clickContext, event, () => localUserActivity)
|
|
83
|
+
clickContext = undefined
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{ capture: true }
|
|
87
|
+
),
|
|
88
|
+
|
|
89
|
+
addEventListener(
|
|
90
|
+
configuration,
|
|
91
|
+
window,
|
|
92
|
+
DOM_EVENT.INPUT,
|
|
93
|
+
() => {
|
|
94
|
+
userActivity.input = true
|
|
95
|
+
},
|
|
96
|
+
{ capture: true }
|
|
97
|
+
),
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
stop: () => {
|
|
102
|
+
listeners.forEach((listener) => listener.stop())
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isSelectionEmpty(): boolean {
|
|
108
|
+
const selection = window.getSelection()
|
|
109
|
+
return !selection || selection.isCollapsed
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isValidPointerEvent(event: PointerEvent): event is MouseEventOnElement {
|
|
113
|
+
return (
|
|
114
|
+
event.target instanceof Element &&
|
|
115
|
+
// Only consider 'primary' pointer events for now. Multi-touch support could be implemented in
|
|
116
|
+
// the future.
|
|
117
|
+
event.isPrimary !== false
|
|
118
|
+
)
|
|
119
|
+
}
|