@kubesense/kubesense-browser-rum-core 1.8.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/cjs/boot/preStartRum.d.ts +4 -3
- package/cjs/boot/preStartRum.js +229 -204
- package/cjs/boot/preStartRum.js.map +1 -1
- package/cjs/boot/rumPublicApi.d.ts +190 -51
- package/cjs/boot/rumPublicApi.js +267 -164
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRum.d.ts +42 -31
- package/cjs/boot/startRum.js +157 -150
- package/cjs/boot/startRum.js.map +1 -1
- package/cjs/browser/cookieObservable.d.ts +1 -5
- package/cjs/browser/cookieObservable.js +30 -34
- package/cjs/browser/cookieObservable.js.map +1 -1
- package/cjs/browser/domMutationObservable.d.ts +3 -3
- package/cjs/browser/domMutationObservable.js +29 -53
- package/cjs/browser/domMutationObservable.js.map +1 -1
- package/cjs/browser/htmlDomUtils.d.ts +5 -0
- package/cjs/browser/htmlDomUtils.js +38 -28
- package/cjs/browser/htmlDomUtils.js.map +1 -1
- package/cjs/browser/locationChangeObservable.d.ts +1 -2
- package/cjs/browser/locationChangeObservable.js +44 -45
- package/cjs/browser/locationChangeObservable.js.map +1 -1
- package/cjs/browser/performanceObservable.d.ts +4 -4
- package/cjs/browser/performanceObservable.js +50 -114
- package/cjs/browser/performanceObservable.js.map +1 -1
- package/cjs/browser/performanceUtils.d.ts +13 -1
- package/cjs/browser/performanceUtils.js +63 -37
- package/cjs/browser/performanceUtils.js.map +1 -1
- package/cjs/browser/scroll.js +17 -28
- package/cjs/browser/scroll.js.map +1 -1
- package/cjs/browser/viewportObservable.d.ts +2 -3
- package/cjs/browser/viewportObservable.js +29 -31
- package/cjs/browser/viewportObservable.js.map +1 -1
- package/cjs/browser/windowOpenObservable.js +11 -7
- package/cjs/browser/windowOpenObservable.js.map +1 -1
- package/cjs/domain/action/actionCollection.d.ts +11 -12
- package/cjs/domain/action/actionCollection.js +82 -89
- package/cjs/domain/action/actionCollection.js.map +1 -1
- package/cjs/domain/action/actionNameConstants.js +10 -9
- package/cjs/domain/action/actionNameConstants.js.map +1 -1
- package/cjs/domain/action/clickChain.js +51 -54
- package/cjs/domain/action/clickChain.js.map +1 -1
- package/cjs/domain/action/computeFrustration.js +30 -62
- package/cjs/domain/action/computeFrustration.js.map +1 -1
- package/cjs/domain/action/frustrationIgnore.d.ts +9 -0
- package/cjs/domain/action/frustrationIgnore.js +32 -0
- package/cjs/domain/action/frustrationIgnore.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.js +141 -217
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -1
- package/cjs/domain/action/interactionSelectorCache.d.ts +1 -1
- package/cjs/domain/action/interactionSelectorCache.js +17 -18
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -1
- package/cjs/domain/action/isActionChildEvent.d.ts +2 -0
- package/cjs/domain/action/isActionChildEvent.js +8 -0
- package/cjs/domain/action/isActionChildEvent.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +2 -3
- package/cjs/domain/action/listenActionEvents.js +51 -55
- package/cjs/domain/action/listenActionEvents.js.map +1 -1
- package/cjs/domain/action/trackClickActions.d.ts +15 -21
- package/cjs/domain/action/trackClickActions.js +188 -226
- package/cjs/domain/action/trackClickActions.js.map +1 -1
- package/cjs/domain/action/trackManualActions.d.ts +45 -0
- package/cjs/domain/action/trackManualActions.js +48 -0
- package/cjs/domain/action/trackManualActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +1 -2
- package/cjs/domain/assembly.js +80 -95
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/configuration/configuration.d.ts +575 -81
- package/cjs/domain/configuration/configuration.js +464 -199
- package/cjs/domain/configuration/configuration.js.map +1 -1
- package/cjs/domain/configuration/index.d.ts +1 -0
- package/cjs/domain/configuration/index.js +27 -21
- package/cjs/domain/configuration/jsonPathParser.js +125 -139
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -1
- package/cjs/domain/configuration/remoteConfiguration.d.ts +18 -5
- package/cjs/domain/configuration/remoteConfiguration.js +268 -226
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -1
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +49 -0
- package/cjs/domain/configuration/remoteConfigurationCache.d.ts +42 -0
- package/cjs/domain/configuration/remoteConfigurationCache.js +95 -0
- package/cjs/domain/configuration/remoteConfigurationCache.js.map +1 -0
- package/cjs/domain/configuration/remoteSdkConfiguration.d.ts +11 -2
- package/cjs/domain/configuration/remoteSdkConfiguration.js +185 -117
- package/cjs/domain/configuration/remoteSdkConfiguration.js.map +1 -1
- package/cjs/domain/configuration/sessionReplayRoutes.d.ts +1 -6
- package/cjs/domain/configuration/sessionReplayRoutes.js +20 -63
- package/cjs/domain/configuration/sessionReplayRoutes.js.map +1 -1
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +2 -4
- package/cjs/domain/contexts/ciVisibilityContext.js +36 -32
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -1
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -2
- package/cjs/domain/contexts/connectivityContext.js +10 -9
- package/cjs/domain/contexts/connectivityContext.js.map +1 -1
- package/cjs/domain/contexts/defaultContext.d.ts +3 -3
- package/cjs/domain/contexts/defaultContext.js +28 -32
- package/cjs/domain/contexts/defaultContext.js.map +1 -1
- package/cjs/domain/contexts/displayContext.d.ts +2 -3
- package/cjs/domain/contexts/displayContext.js +22 -26
- package/cjs/domain/contexts/displayContext.js.map +1 -1
- package/cjs/domain/contexts/featureFlagContext.d.ts +2 -2
- package/cjs/domain/contexts/featureFlagContext.js +38 -50
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -1
- package/cjs/domain/contexts/internalContext.d.ts +2 -3
- package/cjs/domain/contexts/internalContext.js +26 -22
- package/cjs/domain/contexts/internalContext.js.map +1 -1
- package/cjs/domain/contexts/pageStateHistory.d.ts +3 -4
- package/cjs/domain/contexts/pageStateHistory.js +76 -96
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -1
- package/cjs/domain/contexts/sessionContext.d.ts +9 -3
- package/cjs/domain/contexts/sessionContext.js +31 -45
- package/cjs/domain/contexts/sessionContext.js.map +1 -1
- package/cjs/domain/contexts/sourceCodeMfeContext.d.ts +10 -0
- package/cjs/domain/contexts/sourceCodeMfeContext.js +35 -0
- package/cjs/domain/contexts/sourceCodeMfeContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -2
- package/cjs/domain/contexts/syntheticsContext.js +19 -23
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -1
- package/cjs/domain/contexts/trackingConsentContext.d.ts +2 -2
- package/cjs/domain/contexts/trackingConsentContext.js +10 -12
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.d.ts +4 -3
- package/cjs/domain/contexts/urlContexts.js +65 -61
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -2
- package/cjs/domain/contexts/userAgentDataContext.js +20 -29
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -1
- package/cjs/domain/contexts/viewHistory.d.ts +5 -2
- package/cjs/domain/contexts/viewHistory.js +41 -45
- package/cjs/domain/contexts/viewHistory.js.map +1 -1
- package/cjs/domain/discardNegativeDuration.d.ts +1 -1
- package/cjs/domain/discardNegativeDuration.js +6 -5
- package/cjs/domain/discardNegativeDuration.js.map +1 -1
- package/cjs/domain/error/errorCollection.d.ts +3 -3
- package/cjs/domain/error/errorCollection.js +67 -68
- package/cjs/domain/error/errorCollection.js.map +1 -1
- package/cjs/domain/error/trackReportError.d.ts +1 -2
- package/cjs/domain/error/trackReportError.js +10 -14
- package/cjs/domain/error/trackReportError.js.map +1 -1
- package/cjs/domain/event/eventCollection.d.ts +2 -1
- package/cjs/domain/event/eventCollection.js +21 -22
- package/cjs/domain/event/eventCollection.js.map +1 -1
- package/cjs/domain/eventTracker.d.ts +37 -0
- package/cjs/domain/eventTracker.js +94 -0
- package/cjs/domain/eventTracker.js.map +1 -0
- package/cjs/domain/extractRegexMatch.d.ts +5 -0
- package/cjs/domain/extractRegexMatch.js +16 -0
- package/cjs/domain/extractRegexMatch.js.map +1 -0
- package/cjs/domain/getComposedPathSelector.d.ts +22 -0
- package/cjs/domain/getComposedPathSelector.js +95 -0
- package/cjs/domain/getComposedPathSelector.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +18 -6
- package/cjs/domain/getSelectorFromElement.js +199 -191
- package/cjs/domain/getSelectorFromElement.js.map +1 -1
- package/cjs/domain/getSessionReplayUrl.d.ts +2 -2
- package/cjs/domain/getSessionReplayUrl.js +17 -30
- package/cjs/domain/getSessionReplayUrl.js.map +1 -1
- package/cjs/domain/hooks.d.ts +26 -17
- package/cjs/domain/hooks.js +12 -5
- package/cjs/domain/hooks.js.map +1 -1
- package/cjs/domain/lifeCycle.d.ts +26 -12
- package/cjs/domain/lifeCycle.js +28 -5
- package/cjs/domain/lifeCycle.js.map +1 -1
- package/cjs/domain/limitModification.d.ts +5 -1
- package/cjs/domain/limitModification.js +32 -36
- package/cjs/domain/limitModification.js.map +1 -1
- package/cjs/domain/longTask/longTaskCollection.d.ts +0 -13
- package/cjs/domain/longTask/longTaskCollection.js +75 -87
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -1
- package/cjs/domain/plugins.d.ts +37 -14
- package/cjs/domain/plugins.js +22 -13
- package/cjs/domain/plugins.js.map +1 -1
- package/cjs/domain/privacy.d.ts +6 -1
- package/cjs/domain/privacy.js +143 -286
- package/cjs/domain/privacy.js.map +1 -1
- package/cjs/domain/privacyConstants.js +43 -34
- package/cjs/domain/privacyConstants.js.map +1 -1
- package/cjs/domain/requestCollection.d.ts +6 -5
- package/cjs/domain/requestCollection.js +82 -105
- package/cjs/domain/requestCollection.js.map +1 -1
- package/cjs/domain/resource/graphql.d.ts +1 -1
- package/cjs/domain/resource/graphql.js +85 -86
- package/cjs/domain/resource/graphql.js.map +1 -1
- package/cjs/domain/resource/requestRegistry.js +30 -38
- package/cjs/domain/resource/requestRegistry.js.map +1 -1
- package/cjs/domain/resource/resourceCollection.d.ts +5 -3
- package/cjs/domain/resource/resourceCollection.js +241 -175
- package/cjs/domain/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/resource/resourceUtils.d.ts +13 -13
- package/cjs/domain/resource/resourceUtils.js +323 -221
- package/cjs/domain/resource/resourceUtils.js.map +1 -1
- package/cjs/domain/resource/trackManualResources.d.ts +55 -0
- package/cjs/domain/resource/trackManualResources.js +53 -0
- package/cjs/domain/resource/trackManualResources.js.map +1 -0
- package/cjs/domain/resource/webSocketCollection.d.ts +46 -0
- package/cjs/domain/resource/webSocketCollection.js +163 -0
- package/cjs/domain/resource/webSocketCollection.js.map +1 -0
- package/cjs/domain/session/session.types.d.ts +4 -0
- package/cjs/domain/sessionReplayState.d.ts +8 -0
- package/cjs/domain/sessionReplayState.js +19 -0
- package/cjs/domain/sessionReplayState.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.js +39 -43
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -1
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +1 -1
- package/cjs/domain/tracing/getDocumentTraceId.js +42 -63
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -1
- package/cjs/domain/tracing/identifier.js +13 -46
- package/cjs/domain/tracing/identifier.js.map +1 -1
- package/cjs/domain/tracing/tracer.d.ts +2 -5
- package/cjs/domain/tracing/tracer.js +110 -150
- package/cjs/domain/tracing/tracer.js.map +1 -1
- package/cjs/domain/trackEventCounts.js +43 -48
- package/cjs/domain/trackEventCounts.js.map +1 -1
- package/cjs/domain/view/bfCacheSupport.d.ts +1 -2
- package/cjs/domain/view/bfCacheSupport.js +10 -11
- package/cjs/domain/view/bfCacheSupport.js.map +1 -1
- package/cjs/domain/view/trackViewEventCounts.js +14 -13
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -1
- package/cjs/domain/view/trackViews.d.ts +8 -2
- package/cjs/domain/view/trackViews.js +221 -270
- package/cjs/domain/view/trackViews.js.map +1 -1
- package/cjs/domain/view/viewCollection.d.ts +4 -3
- package/cjs/domain/view/viewCollection.js +124 -148
- package/cjs/domain/view/viewCollection.js.map +1 -1
- package/cjs/domain/view/viewDiff.d.ts +22 -0
- package/cjs/domain/view/viewDiff.js +62 -0
- package/cjs/domain/view/viewDiff.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +20 -22
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -1
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +35 -33
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +1 -1
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -13
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +4 -2
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +51 -34
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +1 -1
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +106 -122
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +26 -34
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +31 -31
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +1 -3
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +33 -38
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +10 -1
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +202 -144
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +6 -1
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +65 -55
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +2 -1
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +42 -46
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +2 -3
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +28 -36
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -1
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +3 -4
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +63 -72
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -1
- package/cjs/domain/vital/vitalCollection.d.ts +44 -20
- package/cjs/domain/vital/vitalCollection.js +81 -109
- package/cjs/domain/vital/vitalCollection.js.map +1 -1
- package/cjs/domain/waitPageActivityEnd.d.ts +1 -4
- package/cjs/domain/waitPageActivityEnd.js +99 -119
- package/cjs/domain/waitPageActivityEnd.js.map +1 -1
- package/cjs/domainContext.types.d.ts +21 -13
- package/cjs/index.d.ts +11 -10
- package/cjs/index.js +84 -62
- package/cjs/rawRumEvent.types.d.ts +79 -13
- package/cjs/rawRumEvent.types.js +40 -27
- package/cjs/rawRumEvent.types.js.map +1 -1
- package/cjs/rumEvent.types.d.ts +906 -669
- package/cjs/transport/formDataTransport.js +43 -41
- package/cjs/transport/formDataTransport.js.map +1 -1
- package/cjs/transport/startRumBatch.d.ts +27 -3
- package/cjs/transport/startRumBatch.js +132 -31
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/cjs/transport/startRumEventBridge.js +10 -8
- package/cjs/transport/startRumEventBridge.js.map +1 -1
- package/esm/boot/preStartRum.mjs +233 -0
- package/esm/boot/preStartRum.mjs.map +1 -0
- package/esm/boot/rumPublicApi.mjs +271 -0
- package/esm/boot/rumPublicApi.mjs.map +1 -0
- package/esm/boot/startRum.mjs +159 -0
- package/esm/boot/startRum.mjs.map +1 -0
- package/esm/browser/cookieObservable.mjs +34 -0
- package/esm/browser/cookieObservable.mjs.map +1 -0
- package/esm/browser/domMutationObservable.mjs +33 -0
- package/esm/browser/domMutationObservable.mjs.map +1 -0
- package/esm/browser/htmlDomUtils.mjs +48 -0
- package/esm/browser/htmlDomUtils.mjs.map +1 -0
- package/esm/browser/locationChangeObservable.mjs +50 -0
- package/esm/browser/locationChangeObservable.mjs.map +1 -0
- package/esm/browser/performanceObservable.mjs +60 -0
- package/esm/browser/performanceObservable.mjs.map +1 -0
- package/esm/browser/performanceUtils.mjs +64 -0
- package/esm/browser/performanceUtils.mjs.map +1 -0
- package/esm/browser/scroll.mjs +21 -0
- package/esm/browser/scroll.mjs.map +1 -0
- package/esm/browser/viewportObservable.mjs +33 -0
- package/esm/browser/viewportObservable.mjs.map +1 -0
- package/esm/browser/windowOpenObservable.mjs +14 -0
- package/esm/browser/windowOpenObservable.mjs.map +1 -0
- package/esm/domain/action/actionCollection.mjs +89 -0
- package/esm/domain/action/actionCollection.mjs.map +1 -0
- package/esm/domain/action/actionNameConstants.mjs +11 -0
- package/esm/domain/action/actionNameConstants.mjs.map +1 -0
- package/esm/domain/action/clickChain.mjs +57 -0
- package/esm/domain/action/clickChain.mjs.map +1 -0
- package/esm/domain/action/computeFrustration.mjs +36 -0
- package/esm/domain/action/computeFrustration.mjs.map +1 -0
- package/esm/domain/action/frustrationIgnore.mjs +31 -0
- package/esm/domain/action/frustrationIgnore.mjs.map +1 -0
- package/esm/domain/action/getActionNameFromElement.mjs +163 -0
- package/esm/domain/action/getActionNameFromElement.mjs.map +1 -0
- package/esm/domain/action/interactionSelectorCache.mjs +19 -0
- package/esm/domain/action/interactionSelectorCache.mjs.map +1 -0
- package/esm/domain/action/isActionChildEvent.mjs +8 -0
- package/esm/domain/action/isActionChildEvent.mjs.map +1 -0
- package/esm/domain/action/listenActionEvents.mjs +57 -0
- package/esm/domain/action/listenActionEvents.mjs.map +1 -0
- package/esm/domain/action/trackClickActions.mjs +198 -0
- package/esm/domain/action/trackClickActions.mjs.map +1 -0
- package/esm/domain/action/trackManualActions.mjs +48 -0
- package/esm/domain/action/trackManualActions.mjs.map +1 -0
- package/esm/domain/assembly.mjs +87 -0
- package/esm/domain/assembly.mjs.map +1 -0
- package/esm/domain/configuration/configuration.mjs +474 -0
- package/esm/domain/configuration/configuration.mjs.map +1 -0
- package/esm/domain/configuration/index.mjs +6 -0
- package/esm/domain/configuration/jsonPathParser.mjs +145 -0
- package/esm/domain/configuration/jsonPathParser.mjs.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.mjs +279 -0
- package/esm/domain/configuration/remoteConfiguration.mjs.map +1 -0
- package/esm/domain/configuration/remoteConfigurationCache.mjs +92 -0
- package/esm/domain/configuration/remoteConfigurationCache.mjs.map +1 -0
- package/esm/domain/configuration/remoteSdkConfiguration.mjs +208 -0
- package/esm/domain/configuration/remoteSdkConfiguration.mjs.map +1 -0
- package/esm/domain/configuration/sessionReplayRoutes.mjs +26 -0
- package/esm/domain/configuration/sessionReplayRoutes.mjs.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.mjs +37 -0
- package/esm/domain/contexts/ciVisibilityContext.mjs.map +1 -0
- package/esm/domain/contexts/connectivityContext.mjs +12 -0
- package/esm/domain/contexts/connectivityContext.mjs.map +1 -0
- package/esm/domain/contexts/defaultContext.mjs +30 -0
- package/esm/domain/contexts/defaultContext.mjs.map +1 -0
- package/esm/domain/contexts/displayContext.mjs +24 -0
- package/esm/domain/contexts/displayContext.mjs.map +1 -0
- package/esm/domain/contexts/featureFlagContext.mjs +40 -0
- package/esm/domain/contexts/featureFlagContext.mjs.map +1 -0
- package/esm/domain/contexts/internalContext.mjs +30 -0
- package/esm/domain/contexts/internalContext.mjs.map +1 -0
- package/esm/domain/contexts/pageStateHistory.mjs +82 -0
- package/esm/domain/contexts/pageStateHistory.mjs.map +1 -0
- package/esm/domain/contexts/sessionContext.mjs +33 -0
- package/esm/domain/contexts/sessionContext.mjs.map +1 -0
- package/esm/domain/contexts/sourceCodeMfeContext.mjs +35 -0
- package/esm/domain/contexts/sourceCodeMfeContext.mjs.map +1 -0
- package/esm/domain/contexts/syntheticsContext.mjs +21 -0
- package/esm/domain/contexts/syntheticsContext.mjs.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.mjs +12 -0
- package/esm/domain/contexts/trackingConsentContext.mjs.map +1 -0
- package/esm/domain/contexts/urlContexts.mjs +67 -0
- package/esm/domain/contexts/urlContexts.mjs.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.mjs +22 -0
- package/esm/domain/contexts/userAgentDataContext.mjs.map +1 -0
- package/esm/domain/contexts/viewHistory.mjs +43 -0
- package/esm/domain/contexts/viewHistory.mjs.map +1 -0
- package/esm/domain/discardNegativeDuration.mjs +9 -0
- package/esm/domain/discardNegativeDuration.mjs.map +1 -0
- package/esm/domain/error/errorCollection.mjs +72 -0
- package/esm/domain/error/errorCollection.mjs.map +1 -0
- package/esm/domain/error/trackReportError.mjs +12 -0
- package/esm/domain/error/trackReportError.mjs.map +1 -0
- package/esm/domain/event/eventCollection.mjs +26 -0
- package/esm/domain/event/eventCollection.mjs.map +1 -0
- package/esm/domain/eventTracker.mjs +93 -0
- package/esm/domain/eventTracker.mjs.map +1 -0
- package/esm/domain/extractRegexMatch.mjs +16 -0
- package/esm/domain/extractRegexMatch.mjs.map +1 -0
- package/esm/domain/getComposedPathSelector.mjs +93 -0
- package/esm/domain/getComposedPathSelector.mjs.map +1 -0
- package/esm/domain/getSelectorFromElement.mjs +218 -0
- package/esm/domain/getSelectorFromElement.mjs.map +1 -0
- package/esm/domain/getSessionReplayUrl.mjs +20 -0
- package/esm/domain/getSessionReplayUrl.mjs.map +1 -0
- package/esm/domain/hooks.mjs +13 -0
- package/esm/domain/hooks.mjs.map +1 -0
- package/esm/domain/lifeCycle.mjs +28 -0
- package/esm/domain/lifeCycle.mjs.map +1 -0
- package/esm/domain/limitModification.mjs +42 -0
- package/esm/domain/limitModification.mjs.map +1 -0
- package/esm/domain/longTask/longTaskCollection.mjs +79 -0
- package/esm/domain/longTask/longTaskCollection.mjs.map +1 -0
- package/esm/domain/plugins.mjs +23 -0
- package/esm/domain/plugins.mjs.map +1 -0
- package/esm/domain/privacy.mjs +161 -0
- package/esm/domain/privacy.mjs.map +1 -0
- package/esm/domain/privacyConstants.mjs +36 -0
- package/esm/domain/privacyConstants.mjs.map +1 -0
- package/esm/domain/requestCollection.mjs +86 -0
- package/esm/domain/requestCollection.mjs.map +1 -0
- package/esm/domain/resource/graphql.mjs +93 -0
- package/esm/domain/resource/graphql.mjs.map +1 -0
- package/esm/domain/resource/requestRegistry.mjs +32 -0
- package/esm/domain/resource/requestRegistry.mjs.map +1 -0
- package/esm/domain/resource/resourceCollection.mjs +256 -0
- package/esm/domain/resource/resourceCollection.mjs.map +1 -0
- package/esm/domain/resource/resourceUtils.mjs +349 -0
- package/esm/domain/resource/resourceUtils.mjs.map +1 -0
- package/esm/domain/resource/trackManualResources.mjs +53 -0
- package/esm/domain/resource/trackManualResources.mjs.map +1 -0
- package/esm/domain/resource/webSocketCollection.mjs +160 -0
- package/esm/domain/resource/webSocketCollection.mjs.map +1 -0
- package/esm/domain/sessionReplayState.mjs +18 -0
- package/esm/domain/sessionReplayState.mjs.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.mjs +51 -0
- package/esm/domain/startCustomerDataTelemetry.mjs.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.mjs +50 -0
- package/esm/domain/tracing/getDocumentTraceId.mjs.map +1 -0
- package/esm/domain/tracing/identifier.mjs +20 -0
- package/esm/domain/tracing/identifier.mjs.map +1 -0
- package/esm/domain/tracing/tracer.mjs +120 -0
- package/esm/domain/tracing/tracer.mjs.map +1 -0
- package/esm/domain/trackEventCounts.mjs +45 -0
- package/esm/domain/trackEventCounts.mjs.map +1 -0
- package/esm/domain/view/bfCacheSupport.mjs +12 -0
- package/esm/domain/view/bfCacheSupport.mjs.map +1 -0
- package/esm/domain/view/trackViewEventCounts.mjs +17 -0
- package/esm/domain/view/trackViewEventCounts.mjs.map +1 -0
- package/esm/domain/view/trackViews.mjs +230 -0
- package/esm/domain/view/trackViews.mjs.map +1 -0
- package/esm/domain/view/viewCollection.mjs +129 -0
- package/esm/domain/view/viewCollection.mjs.map +1 -0
- package/esm/domain/view/viewDiff.mjs +61 -0
- package/esm/domain/view/viewDiff.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.mjs +30 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.mjs +45 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.mjs +18 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.mjs +54 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.mjs +117 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.mjs +29 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.mjs +33 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.mjs +36 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.mjs +210 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.mjs +70 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.mjs +46 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.mjs +35 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.mjs.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.mjs +66 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.mjs.map +1 -0
- package/esm/domain/vital/vitalCollection.mjs +85 -0
- package/esm/domain/vital/vitalCollection.mjs.map +1 -0
- package/esm/domain/waitPageActivityEnd.mjs +107 -0
- package/esm/domain/waitPageActivityEnd.mjs.map +1 -0
- package/esm/index.mjs +23 -0
- package/esm/rawRumEvent.types.mjs +42 -0
- package/esm/rawRumEvent.types.mjs.map +1 -0
- package/esm/transport/formDataTransport.mjs +48 -0
- package/esm/transport/formDataTransport.mjs.map +1 -0
- package/esm/transport/startRumBatch.mjs +132 -0
- package/esm/transport/startRumBatch.mjs.map +1 -0
- package/esm/transport/startRumEventBridge.mjs +13 -0
- package/esm/transport/startRumEventBridge.mjs.map +1 -0
- package/package.json +19 -11
- package/src/boot/preStartRum.ts +216 -88
- package/src/boot/rumPublicApi.ts +358 -119
- package/src/boot/startRum.ts +88 -84
- package/src/browser/cookieObservable.ts +19 -28
- package/src/browser/domMutationObservable.ts +7 -12
- package/src/browser/htmlDomUtils.ts +15 -0
- package/src/browser/locationChangeObservable.ts +23 -12
- package/src/browser/performanceObservable.ts +23 -73
- package/src/browser/performanceUtils.ts +52 -4
- package/src/browser/viewportObservable.ts +4 -6
- package/src/domain/action/actionCollection.ts +94 -87
- package/src/domain/action/clickChain.ts +11 -10
- package/src/domain/action/computeFrustration.ts +19 -5
- package/src/domain/action/frustrationIgnore.ts +54 -0
- package/src/domain/action/getActionNameFromElement.ts +27 -61
- package/src/domain/action/interactionSelectorCache.ts +2 -2
- package/src/domain/action/isActionChildEvent.ts +6 -0
- package/src/domain/action/listenActionEvents.ts +2 -11
- package/src/domain/action/trackClickActions.ts +92 -82
- package/src/domain/action/trackManualActions.ts +104 -0
- package/src/domain/assembly.ts +57 -70
- package/src/domain/configuration/configuration.ts +587 -208
- package/src/domain/configuration/index.ts +1 -0
- package/src/domain/configuration/remoteConfiguration.ts +152 -29
- package/src/domain/configuration/remoteConfiguration.types.ts +51 -1
- package/src/domain/configuration/remoteConfigurationCache.ts +153 -0
- package/src/domain/configuration/remoteSdkConfiguration.ts +131 -13
- package/src/domain/configuration/sessionReplayRoutes.ts +2 -47
- package/src/domain/contexts/ciVisibilityContext.ts +23 -12
- package/src/domain/contexts/connectivityContext.ts +7 -10
- package/src/domain/contexts/defaultContext.ts +11 -14
- package/src/domain/contexts/displayContext.ts +8 -12
- package/src/domain/contexts/featureFlagContext.ts +5 -4
- package/src/domain/contexts/internalContext.ts +3 -3
- package/src/domain/contexts/pageStateHistory.ts +20 -31
- package/src/domain/contexts/sessionContext.ts +16 -22
- package/src/domain/contexts/sourceCodeMfeContext.ts +53 -0
- package/src/domain/contexts/syntheticsContext.ts +7 -17
- package/src/domain/contexts/trackingConsentContext.ts +7 -4
- package/src/domain/contexts/urlContexts.ts +13 -9
- package/src/domain/contexts/userAgentDataContext.ts +12 -13
- package/src/domain/contexts/viewHistory.ts +4 -3
- package/src/domain/discardNegativeDuration.ts +1 -1
- package/src/domain/error/errorCollection.ts +12 -22
- package/src/domain/error/trackReportError.ts +4 -7
- package/src/domain/event/eventCollection.ts +4 -2
- package/src/domain/eventTracker.ts +169 -0
- package/src/domain/extractRegexMatch.ts +15 -0
- package/src/domain/getComposedPathSelector.ts +130 -0
- package/src/domain/getSelectorFromElement.ts +125 -31
- package/src/domain/getSessionReplayUrl.ts +4 -13
- package/src/domain/hooks.ts +34 -21
- package/src/domain/lifeCycle.ts +21 -8
- package/src/domain/limitModification.ts +20 -4
- package/src/domain/longTask/longTaskCollection.ts +18 -47
- package/src/domain/plugins.ts +54 -25
- package/src/domain/privacy.ts +16 -24
- package/src/domain/requestCollection.ts +108 -97
- package/src/domain/resource/graphql.ts +71 -25
- package/src/domain/resource/requestRegistry.ts +1 -3
- package/src/domain/resource/resourceCollection.ts +319 -137
- package/src/domain/resource/resourceUtils.ts +24 -26
- package/src/domain/resource/trackManualResources.ts +121 -0
- package/src/domain/resource/webSocketCollection.ts +281 -0
- package/src/domain/session/session.types.ts +5 -0
- package/src/domain/sessionReplayState.ts +36 -0
- package/src/domain/startCustomerDataTelemetry.ts +2 -2
- package/src/domain/tracing/getDocumentTraceId.ts +5 -4
- package/src/domain/tracing/identifier.ts +6 -37
- package/src/domain/tracing/tracer.ts +22 -21
- package/src/domain/tracing/tracer.types.ts +3 -3
- package/src/domain/view/bfCacheSupport.ts +1 -6
- package/src/domain/view/trackViews.ts +40 -37
- package/src/domain/view/viewCollection.ts +29 -23
- package/src/domain/view/viewDiff.ts +115 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +13 -2
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +1 -1
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +27 -6
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +5 -3
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +4 -9
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +2 -8
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +4 -13
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +180 -35
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +47 -6
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +4 -3
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +10 -18
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +23 -37
- package/src/domain/vital/vitalCollection.ts +83 -102
- package/src/domain/waitPageActivityEnd.ts +7 -11
- package/src/domainContext.types.ts +23 -15
- package/src/index.ts +17 -11
- package/src/rawRumEvent.types.ts +80 -26
- package/src/rumEvent.types.ts +730 -505
- package/src/transport/formDataTransport.ts +16 -6
- package/src/transport/startRumBatch.ts +181 -24
- package/cjs/browser/firstInputPolyfill.d.ts +0 -8
- package/cjs/browser/firstInputPolyfill.js +0 -68
- package/cjs/browser/firstInputPolyfill.js.map +0 -1
- package/cjs/domain/configuration/index.js.map +0 -1
- package/cjs/domain/configuration/remoteConfiguration.types.js +0 -7
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +0 -1
- package/cjs/domain/error/trackConsoleError.d.ts +0 -4
- package/cjs/domain/error/trackConsoleError.js +0 -13
- package/cjs/domain/error/trackConsoleError.js.map +0 -1
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +0 -16
- package/cjs/domain/resource/matchRequestResourceEntry.js +0 -49
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +0 -1
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +0 -4
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +0 -24
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +0 -1
- package/cjs/domain/rumSessionManager.d.ts +0 -36
- package/cjs/domain/rumSessionManager.js +0 -77
- package/cjs/domain/rumSessionManager.js.map +0 -1
- package/cjs/domain/sampler/sampler.d.ts +0 -10
- package/cjs/domain/sampler/sampler.js +0 -63
- package/cjs/domain/sampler/sampler.js.map +0 -1
- package/cjs/domain/tracing/sampler.d.ts +0 -10
- package/cjs/domain/tracing/sampler.js +0 -69
- package/cjs/domain/tracing/sampler.js.map +0 -1
- package/cjs/domain/tracing/tracer.types.js +0 -3
- package/cjs/domain/tracing/tracer.types.js.map +0 -1
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +0 -6
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +0 -44
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +0 -1
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +0 -19
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +0 -43
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +0 -1
- package/cjs/domainContext.types.js +0 -6
- package/cjs/domainContext.types.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/rumEvent.types.js +0 -7
- package/cjs/rumEvent.types.js.map +0 -1
- package/esm/boot/preStartRum.d.ts +0 -7
- package/esm/boot/preStartRum.js +0 -205
- package/esm/boot/preStartRum.js.map +0 -1
- package/esm/boot/rumPublicApi.d.ts +0 -409
- package/esm/boot/rumPublicApi.js +0 -165
- package/esm/boot/rumPublicApi.js.map +0 -1
- package/esm/boot/startRum.d.ts +0 -109
- package/esm/boot/startRum.js +0 -149
- package/esm/boot/startRum.js.map +0 -1
- package/esm/browser/cookieObservable.d.ts +0 -8
- package/esm/browser/cookieObservable.js +0 -35
- package/esm/browser/cookieObservable.js.map +0 -1
- package/esm/browser/domMutationObservable.d.ts +0 -27
- package/esm/browser/domMutationObservable.js +0 -54
- package/esm/browser/domMutationObservable.js.map +0 -1
- package/esm/browser/firstInputPolyfill.d.ts +0 -8
- package/esm/browser/firstInputPolyfill.js +0 -65
- package/esm/browser/firstInputPolyfill.js.map +0 -1
- package/esm/browser/htmlDomUtils.d.ts +0 -13
- package/esm/browser/htmlDomUtils.js +0 -36
- package/esm/browser/htmlDomUtils.js.map +0 -1
- package/esm/browser/locationChangeObservable.d.ts +0 -7
- package/esm/browser/locationChangeObservable.js +0 -48
- package/esm/browser/locationChangeObservable.js.map +0 -1
- package/esm/browser/performanceObservable.d.ts +0 -174
- package/esm/browser/performanceObservable.js +0 -121
- package/esm/browser/performanceObservable.js.map +0 -1
- package/esm/browser/performanceUtils.d.ts +0 -7
- package/esm/browser/performanceUtils.js +0 -38
- package/esm/browser/performanceUtils.js.map +0 -1
- package/esm/browser/scroll.d.ts +0 -2
- package/esm/browser/scroll.js +0 -29
- package/esm/browser/scroll.js.map +0 -1
- package/esm/browser/viewportObservable.d.ts +0 -10
- package/esm/browser/viewportObservable.js +0 -32
- package/esm/browser/viewportObservable.js.map +0 -1
- package/esm/browser/windowOpenObservable.d.ts +0 -5
- package/esm/browser/windowOpenObservable.js +0 -7
- package/esm/browser/windowOpenObservable.js.map +0 -1
- package/esm/domain/action/actionCollection.d.ts +0 -21
- package/esm/domain/action/actionCollection.js +0 -93
- package/esm/domain/action/actionCollection.js.map +0 -1
- package/esm/domain/action/actionNameConstants.d.ts +0 -18
- package/esm/domain/action/actionNameConstants.js +0 -8
- package/esm/domain/action/actionNameConstants.js.map +0 -1
- package/esm/domain/action/clickChain.d.ts +0 -8
- package/esm/domain/action/clickChain.js +0 -57
- package/esm/domain/action/clickChain.js.map +0 -1
- package/esm/domain/action/computeFrustration.d.ts +0 -6
- package/esm/domain/action/computeFrustration.js +0 -65
- package/esm/domain/action/computeFrustration.js.map +0 -1
- package/esm/domain/action/getActionNameFromElement.d.ts +0 -4
- package/esm/domain/action/getActionNameFromElement.js +0 -236
- package/esm/domain/action/getActionNameFromElement.js.map +0 -1
- package/esm/domain/action/interactionSelectorCache.d.ts +0 -5
- package/esm/domain/action/interactionSelectorCache.js +0 -18
- package/esm/domain/action/interactionSelectorCache.js.map +0 -1
- package/esm/domain/action/listenActionEvents.d.ts +0 -19
- package/esm/domain/action/listenActionEvents.js +0 -58
- package/esm/domain/action/listenActionEvents.js.map +0 -1
- package/esm/domain/action/trackClickActions.d.ts +0 -81
- package/esm/domain/action/trackClickActions.js +0 -232
- package/esm/domain/action/trackClickActions.js.map +0 -1
- package/esm/domain/assembly.d.ts +0 -5
- package/esm/domain/assembly.js +0 -99
- package/esm/domain/assembly.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -358
- package/esm/domain/configuration/configuration.js +0 -209
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -4
- package/esm/domain/configuration/index.js +0 -5
- package/esm/domain/configuration/index.js.map +0 -1
- package/esm/domain/configuration/jsonPathParser.d.ts +0 -28
- package/esm/domain/configuration/jsonPathParser.js +0 -156
- package/esm/domain/configuration/jsonPathParser.js.map +0 -1
- package/esm/domain/configuration/remoteConfiguration.d.ts +0 -39
- package/esm/domain/configuration/remoteConfiguration.js +0 -236
- package/esm/domain/configuration/remoteConfiguration.js.map +0 -1
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +0 -138
- package/esm/domain/configuration/remoteConfiguration.types.js +0 -6
- package/esm/domain/configuration/remoteConfiguration.types.js.map +0 -1
- package/esm/domain/configuration/remoteSdkConfiguration.d.ts +0 -18
- package/esm/domain/configuration/remoteSdkConfiguration.js +0 -137
- package/esm/domain/configuration/remoteSdkConfiguration.js.map +0 -1
- package/esm/domain/configuration/sessionReplayRoutes.d.ts +0 -35
- package/esm/domain/configuration/sessionReplayRoutes.js +0 -65
- package/esm/domain/configuration/sessionReplayRoutes.js.map +0 -1
- package/esm/domain/contexts/ciVisibilityContext.d.ts +0 -12
- package/esm/domain/contexts/ciVisibilityContext.js +0 -30
- package/esm/domain/contexts/ciVisibilityContext.js.map +0 -1
- package/esm/domain/contexts/connectivityContext.d.ts +0 -2
- package/esm/domain/contexts/connectivityContext.js +0 -8
- package/esm/domain/contexts/connectivityContext.js.map +0 -1
- package/esm/domain/contexts/defaultContext.d.ts +0 -4
- package/esm/domain/contexts/defaultContext.js +0 -31
- package/esm/domain/contexts/defaultContext.js.map +0 -1
- package/esm/domain/contexts/displayContext.d.ts +0 -6
- package/esm/domain/contexts/displayContext.js +0 -25
- package/esm/domain/contexts/displayContext.js.map +0 -1
- package/esm/domain/contexts/featureFlagContext.d.ts +0 -19
- package/esm/domain/contexts/featureFlagContext.js +0 -49
- package/esm/domain/contexts/featureFlagContext.js.map +0 -1
- package/esm/domain/contexts/internalContext.d.ts +0 -12
- package/esm/domain/contexts/internalContext.js +0 -23
- package/esm/domain/contexts/internalContext.js.map +0 -1
- package/esm/domain/contexts/pageStateHistory.d.ts +0 -23
- package/esm/domain/contexts/pageStateHistory.js +0 -100
- package/esm/domain/contexts/pageStateHistory.js.map +0 -1
- package/esm/domain/contexts/sessionContext.d.ts +0 -5
- package/esm/domain/contexts/sessionContext.js +0 -44
- package/esm/domain/contexts/sessionContext.js.map +0 -1
- package/esm/domain/contexts/syntheticsContext.d.ts +0 -2
- package/esm/domain/contexts/syntheticsContext.js +0 -22
- package/esm/domain/contexts/syntheticsContext.js.map +0 -1
- package/esm/domain/contexts/trackingConsentContext.d.ts +0 -3
- package/esm/domain/contexts/trackingConsentContext.js +0 -11
- package/esm/domain/contexts/trackingConsentContext.js.map +0 -1
- package/esm/domain/contexts/urlContexts.d.ts +0 -22
- package/esm/domain/contexts/urlContexts.js +0 -60
- package/esm/domain/contexts/urlContexts.js.map +0 -1
- package/esm/domain/contexts/userAgentDataContext.d.ts +0 -2
- package/esm/domain/contexts/userAgentDataContext.js +0 -28
- package/esm/domain/contexts/userAgentDataContext.js.map +0 -1
- package/esm/domain/contexts/viewHistory.d.ts +0 -17
- package/esm/domain/contexts/viewHistory.js +0 -44
- package/esm/domain/contexts/viewHistory.js.map +0 -1
- package/esm/domain/discardNegativeDuration.d.ts +0 -2
- package/esm/domain/discardNegativeDuration.js +0 -5
- package/esm/domain/discardNegativeDuration.js.map +0 -1
- package/esm/domain/error/errorCollection.d.ts +0 -17
- package/esm/domain/error/errorCollection.js +0 -70
- package/esm/domain/error/errorCollection.js.map +0 -1
- package/esm/domain/error/trackConsoleError.d.ts +0 -4
- package/esm/domain/error/trackConsoleError.js +0 -10
- package/esm/domain/error/trackConsoleError.js.map +0 -1
- package/esm/domain/error/trackReportError.d.ts +0 -5
- package/esm/domain/error/trackReportError.js +0 -13
- package/esm/domain/error/trackReportError.js.map +0 -1
- package/esm/domain/event/eventCollection.d.ts +0 -10
- package/esm/domain/event/eventCollection.js +0 -24
- package/esm/domain/event/eventCollection.js.map +0 -1
- package/esm/domain/getSelectorFromElement.d.ts +0 -64
- package/esm/domain/getSelectorFromElement.js +0 -213
- package/esm/domain/getSelectorFromElement.js.map +0 -1
- package/esm/domain/getSessionReplayUrl.d.ts +0 -9
- package/esm/domain/getSessionReplayUrl.js +0 -30
- package/esm/domain/getSessionReplayUrl.js.map +0 -1
- package/esm/domain/hooks.d.ts +0 -23
- package/esm/domain/hooks.js +0 -3
- package/esm/domain/hooks.js.map +0 -1
- package/esm/domain/lifeCycle.d.ts +0 -73
- package/esm/domain/lifeCycle.js +0 -3
- package/esm/domain/lifeCycle.js.map +0 -1
- package/esm/domain/limitModification.d.ts +0 -8
- package/esm/domain/limitModification.js +0 -43
- package/esm/domain/limitModification.js.map +0 -1
- package/esm/domain/longTask/longTaskCollection.d.ts +0 -18
- package/esm/domain/longTask/longTaskCollection.js +0 -87
- package/esm/domain/longTask/longTaskCollection.js.map +0 -1
- package/esm/domain/plugins.d.ts +0 -40
- package/esm/domain/plugins.js +0 -12
- package/esm/domain/plugins.js.map +0 -1
- package/esm/domain/privacy.d.ts +0 -44
- package/esm/domain/privacy.js +0 -302
- package/esm/domain/privacy.js.map +0 -1
- package/esm/domain/privacyConstants.d.ts +0 -23
- package/esm/domain/privacyConstants.js +0 -35
- package/esm/domain/privacyConstants.js.map +0 -1
- package/esm/domain/requestCollection.d.ts +0 -54
- package/esm/domain/requestCollection.js +0 -106
- package/esm/domain/requestCollection.js.map +0 -1
- package/esm/domain/resource/graphql.d.ts +0 -23
- package/esm/domain/resource/graphql.js +0 -91
- package/esm/domain/resource/graphql.js.map +0 -1
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +0 -16
- package/esm/domain/resource/matchRequestResourceEntry.js +0 -46
- package/esm/domain/resource/matchRequestResourceEntry.js.map +0 -1
- package/esm/domain/resource/requestRegistry.d.ts +0 -9
- package/esm/domain/resource/requestRegistry.js +0 -37
- package/esm/domain/resource/requestRegistry.js.map +0 -1
- package/esm/domain/resource/resourceCollection.d.ts +0 -7
- package/esm/domain/resource/resourceCollection.js +0 -187
- package/esm/domain/resource/resourceCollection.js.map +0 -1
- package/esm/domain/resource/resourceUtils.d.ts +0 -55
- package/esm/domain/resource/resourceUtils.js +0 -244
- package/esm/domain/resource/resourceUtils.js.map +0 -1
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +0 -4
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +0 -21
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +0 -1
- package/esm/domain/rumSessionManager.d.ts +0 -36
- package/esm/domain/rumSessionManager.js +0 -72
- package/esm/domain/rumSessionManager.js.map +0 -1
- package/esm/domain/sampler/sampler.d.ts +0 -10
- package/esm/domain/sampler/sampler.js +0 -58
- package/esm/domain/sampler/sampler.js.map +0 -1
- package/esm/domain/startCustomerDataTelemetry.d.ts +0 -4
- package/esm/domain/startCustomerDataTelemetry.js +0 -52
- package/esm/domain/startCustomerDataTelemetry.js.map +0 -1
- package/esm/domain/tracing/getDocumentTraceId.d.ts +0 -12
- package/esm/domain/tracing/getDocumentTraceId.js +0 -68
- package/esm/domain/tracing/getDocumentTraceId.js.map +0 -1
- package/esm/domain/tracing/identifier.d.ts +0 -13
- package/esm/domain/tracing/identifier.js +0 -50
- package/esm/domain/tracing/identifier.js.map +0 -1
- package/esm/domain/tracing/sampler.d.ts +0 -10
- package/esm/domain/tracing/sampler.js +0 -64
- package/esm/domain/tracing/sampler.js.map +0 -1
- package/esm/domain/tracing/tracer.d.ts +0 -30
- package/esm/domain/tracing/tracer.js +0 -156
- package/esm/domain/tracing/tracer.js.map +0 -1
- package/esm/domain/tracing/tracer.types.d.ts +0 -12
- package/esm/domain/tracing/tracer.types.js +0 -2
- package/esm/domain/tracing/tracer.types.js.map +0 -1
- package/esm/domain/trackEventCounts.d.ts +0 -17
- package/esm/domain/trackEventCounts.js +0 -47
- package/esm/domain/trackEventCounts.js.map +0 -1
- package/esm/domain/view/bfCacheSupport.d.ts +0 -2
- package/esm/domain/view/bfCacheSupport.js +0 -10
- package/esm/domain/view/bfCacheSupport.js.map +0 -1
- package/esm/domain/view/trackViewEventCounts.d.ts +0 -5
- package/esm/domain/view/trackViewEventCounts.js +0 -13
- package/esm/domain/view/trackViewEventCounts.js.map +0 -1
- package/esm/domain/view/trackViews.d.ts +0 -65
- package/esm/domain/view/trackViews.js +0 -278
- package/esm/domain/view/trackViews.js.map +0 -1
- package/esm/domain/view/viewCollection.d.ts +0 -18
- package/esm/domain/view/viewCollection.js +0 -150
- package/esm/domain/view/viewCollection.js.map +0 -1
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +0 -6
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +0 -28
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +0 -1
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +0 -18
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +0 -39
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +0 -1
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +0 -6
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +0 -41
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +0 -8
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +0 -14
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +0 -21
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +0 -34
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +0 -37
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +0 -130
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +0 -13
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +0 -34
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +0 -10
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +0 -30
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +0 -19
- package/esm/domain/view/viewMetrics/trackFirstInput.js +0 -40
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +0 -15
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +0 -38
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +0 -25
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +0 -149
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +0 -18
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +0 -57
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +0 -14
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +0 -47
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +0 -14
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +0 -40
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +0 -1
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +0 -25
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +0 -72
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +0 -1
- package/esm/domain/vital/vitalCollection.d.ts +0 -55
- package/esm/domain/vital/vitalCollection.js +0 -107
- package/esm/domain/vital/vitalCollection.js.map +0 -1
- package/esm/domain/waitPageActivityEnd.d.ts +0 -54
- package/esm/domain/waitPageActivityEnd.js +0 -123
- package/esm/domain/waitPageActivityEnd.js.map +0 -1
- package/esm/domainContext.types.d.ts +0 -39
- package/esm/domainContext.types.js +0 -5
- package/esm/domainContext.types.js.map +0 -1
- package/esm/index.d.ts +0 -42
- package/esm/index.js +0 -22
- package/esm/index.js.map +0 -1
- package/esm/rawRumEvent.types.d.ts +0 -326
- package/esm/rawRumEvent.types.js +0 -31
- package/esm/rawRumEvent.types.js.map +0 -1
- package/esm/rumEvent.types.d.ts +0 -2038
- package/esm/rumEvent.types.js +0 -6
- package/esm/rumEvent.types.js.map +0 -1
- package/esm/transport/formDataTransport.d.ts +0 -16
- package/esm/transport/formDataTransport.js +0 -43
- package/esm/transport/formDataTransport.js.map +0 -1
- package/esm/transport/startRumBatch.d.ts +0 -5
- package/esm/transport/startRumBatch.js +0 -30
- package/esm/transport/startRumBatch.js.map +0 -1
- package/esm/transport/startRumEventBridge.d.ts +0 -2
- package/esm/transport/startRumEventBridge.js +0 -8
- package/esm/transport/startRumEventBridge.js.map +0 -1
- package/src/browser/firstInputPolyfill.ts +0 -87
- package/src/domain/error/trackConsoleError.ts +0 -14
- package/src/domain/resource/matchRequestResourceEntry.ts +0 -68
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +0 -27
- package/src/domain/rumSessionManager.ts +0 -134
- package/src/domain/sampler/sampler.ts +0 -63
- package/src/domain/tracing/sampler.ts +0 -69
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +0 -70
- package/src/domain/view/viewMetrics/trackFirstInput.ts +0 -59
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { shouldIgnore } from "./frustrationIgnore.mjs";
|
|
2
|
+
import { ONE_SECOND } from "@kubesense/kubesense-js-core/time";
|
|
3
|
+
import { clearTimeout, setTimeout } from "@kubesense/kubesense-browser-core";
|
|
4
|
+
//#region src/domain/action/clickChain.ts
|
|
5
|
+
const MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND;
|
|
6
|
+
function createClickChain(firstClick, onFinalize) {
|
|
7
|
+
const bufferedClicks = [];
|
|
8
|
+
let status = 0;
|
|
9
|
+
let maxDurationBetweenClicksTimeoutId;
|
|
10
|
+
appendClick(firstClick);
|
|
11
|
+
function appendClick(click) {
|
|
12
|
+
click.stopObservable.subscribe(tryFinalize);
|
|
13
|
+
bufferedClicks.push(click);
|
|
14
|
+
clearTimeout(maxDurationBetweenClicksTimeoutId);
|
|
15
|
+
maxDurationBetweenClicksTimeoutId = setTimeout(dontAcceptMoreClick, MAX_DURATION_BETWEEN_CLICKS);
|
|
16
|
+
}
|
|
17
|
+
function tryFinalize() {
|
|
18
|
+
if (status === 1 && bufferedClicks.every((click) => click.isStopped())) {
|
|
19
|
+
status = 2;
|
|
20
|
+
onFinalize(bufferedClicks);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function dontAcceptMoreClick() {
|
|
24
|
+
clearTimeout(maxDurationBetweenClicksTimeoutId);
|
|
25
|
+
if (status === 0) {
|
|
26
|
+
status = 1;
|
|
27
|
+
tryFinalize();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
tryAppend: (click) => {
|
|
32
|
+
if (status !== 0) return false;
|
|
33
|
+
if (bufferedClicks.length > 0 && !areClicksSimilar(bufferedClicks[bufferedClicks.length - 1], click)) {
|
|
34
|
+
dontAcceptMoreClick();
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
appendClick(click);
|
|
38
|
+
return true;
|
|
39
|
+
},
|
|
40
|
+
stop: () => {
|
|
41
|
+
dontAcceptMoreClick();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether two clicks are similar by comparing their rage ignore state, target, position and timestamp
|
|
47
|
+
*/
|
|
48
|
+
function areClicksSimilar(first, second) {
|
|
49
|
+
return shouldIgnore(first.ignore, 1) === shouldIgnore(second.ignore, 1) && first.event.target === second.event.target && mouseEventDistance(first.event, second.event) <= 100 && first.event.timeStamp - second.event.timeStamp <= MAX_DURATION_BETWEEN_CLICKS;
|
|
50
|
+
}
|
|
51
|
+
function mouseEventDistance(origin, other) {
|
|
52
|
+
return Math.sqrt(Math.pow(origin.clientX - other.clientX, 2) + Math.pow(origin.clientY - other.clientY, 2));
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { MAX_DURATION_BETWEEN_CLICKS, createClickChain };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=clickChain.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickChain.mjs","names":[],"sources":["../../../src/domain/action/clickChain.ts"],"sourcesContent":["import type { TimeoutId } from '@kubesense/kubesense-browser-core'\nimport { ONE_SECOND } from '@kubesense/kubesense-js-core/time'\nimport { clearTimeout, setTimeout } from '@kubesense/kubesense-browser-core'\nimport type { Click } from './trackClickActions'\nimport { FrustrationIgnore, shouldIgnore } from './frustrationIgnore'\n\nexport interface ClickChain {\n tryAppend: (click: Click) => boolean\n stop: () => void\n}\n\nexport const MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND\nexport const MAX_DISTANCE_BETWEEN_CLICKS = 100\n\nconst enum ClickChainStatus {\n WaitingForMoreClicks,\n WaitingForClicksToStop,\n Finalized,\n}\n\nexport function createClickChain(firstClick: Click, onFinalize: (clicks: Click[]) => void): ClickChain {\n const bufferedClicks: Click[] = []\n let status = ClickChainStatus.WaitingForMoreClicks\n let maxDurationBetweenClicksTimeoutId: TimeoutId | undefined\n appendClick(firstClick)\n\n function appendClick(click: Click) {\n click.stopObservable.subscribe(tryFinalize)\n bufferedClicks.push(click)\n clearTimeout(maxDurationBetweenClicksTimeoutId)\n maxDurationBetweenClicksTimeoutId = setTimeout(dontAcceptMoreClick, MAX_DURATION_BETWEEN_CLICKS)\n }\n\n function tryFinalize() {\n if (status === ClickChainStatus.WaitingForClicksToStop && bufferedClicks.every((click) => click.isStopped())) {\n status = ClickChainStatus.Finalized\n onFinalize(bufferedClicks)\n }\n }\n\n function dontAcceptMoreClick() {\n clearTimeout(maxDurationBetweenClicksTimeoutId)\n if (status === ClickChainStatus.WaitingForMoreClicks) {\n status = ClickChainStatus.WaitingForClicksToStop\n tryFinalize()\n }\n }\n\n return {\n tryAppend: (click) => {\n if (status !== ClickChainStatus.WaitingForMoreClicks) {\n return false\n }\n\n if (bufferedClicks.length > 0 && !areClicksSimilar(bufferedClicks[bufferedClicks.length - 1], click)) {\n dontAcceptMoreClick()\n return false\n }\n\n appendClick(click)\n return true\n },\n stop: () => {\n dontAcceptMoreClick()\n },\n }\n}\n\n/**\n * Checks whether two clicks are similar by comparing their rage ignore state, target, position and timestamp\n */\nfunction areClicksSimilar(first: Click, second: Click) {\n return (\n shouldIgnore(first.ignore, FrustrationIgnore.RAGE_CLICK) ===\n shouldIgnore(second.ignore, FrustrationIgnore.RAGE_CLICK) &&\n first.event.target === second.event.target &&\n mouseEventDistance(first.event, second.event) <= MAX_DISTANCE_BETWEEN_CLICKS &&\n first.event.timeStamp - second.event.timeStamp <= MAX_DURATION_BETWEEN_CLICKS\n )\n}\n\nfunction mouseEventDistance(origin: MouseEvent, other: MouseEvent) {\n return Math.sqrt(Math.pow(origin.clientX - other.clientX, 2) + Math.pow(origin.clientY - other.clientY, 2))\n}\n"],"mappings":";;;;AAWA,MAAa,8BAA8B;AAS3C,SAAgB,iBAAiB,YAAmB,YAAmD;CACrG,MAAM,iBAA0B,CAAC;CACjC,IAAI,SAAA;CACJ,IAAI;CACJ,YAAY,UAAU;CAEtB,SAAS,YAAY,OAAc;EACjC,MAAM,eAAe,UAAU,WAAW;EAC1C,eAAe,KAAK,KAAK;EACzB,aAAa,iCAAiC;EAC9C,oCAAoC,WAAW,qBAAqB,2BAA2B;CACjG;CAEA,SAAS,cAAc;EACrB,IAAI,WAAA,KAAsD,eAAe,OAAO,UAAU,MAAM,UAAU,CAAC,GAAG;GAC5G,SAAA;GACA,WAAW,cAAc;EAC3B;CACF;CAEA,SAAS,sBAAsB;EAC7B,aAAa,iCAAiC;EAC9C,IAAI,WAAA,GAAkD;GACpD,SAAA;GACA,YAAY;EACd;CACF;CAEA,OAAO;EACL,YAAY,UAAU;GACpB,IAAI,WAAA,GACF,OAAO;GAGT,IAAI,eAAe,SAAS,KAAK,CAAC,iBAAiB,eAAe,eAAe,SAAS,IAAI,KAAK,GAAG;IACpG,oBAAoB;IACpB,OAAO;GACT;GAEA,YAAY,KAAK;GACjB,OAAO;EACT;EACA,YAAY;GACV,oBAAoB;EACtB;CACF;AACF;;;;AAKA,SAAS,iBAAiB,OAAc,QAAe;CACrD,OACE,aAAa,MAAM,QAAA,CAAoC,MACrD,aAAa,OAAO,QAAA,CAAoC,KAC1D,MAAM,MAAM,WAAW,OAAO,MAAM,UACpC,mBAAmB,MAAM,OAAO,OAAO,KAAK,KAAA,OAC5C,MAAM,MAAM,YAAY,OAAO,MAAM,aAAa;AAEtD;AAEA,SAAS,mBAAmB,QAAoB,OAAmB;CACjE,OAAO,KAAK,KAAK,KAAK,IAAI,OAAO,UAAU,MAAM,SAAS,CAAC,IAAI,KAAK,IAAI,OAAO,UAAU,MAAM,SAAS,CAAC,CAAC;AAC5G"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FrustrationType } from "../../rawRumEvent.types.mjs";
|
|
2
|
+
import { shouldIgnore } from "./frustrationIgnore.mjs";
|
|
3
|
+
import { ONE_SECOND } from "@kubesense/kubesense-js-core/time";
|
|
4
|
+
//#region src/domain/action/computeFrustration.ts
|
|
5
|
+
const MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE = 3;
|
|
6
|
+
function computeFrustration(clicks, rageClick) {
|
|
7
|
+
if (isRage(clicks)) {
|
|
8
|
+
rageClick.addFrustration(FrustrationType.RAGE_CLICK);
|
|
9
|
+
if (clicks.some(isDead)) rageClick.addFrustration(FrustrationType.DEAD_CLICK);
|
|
10
|
+
if (rageClick.hasError && !shouldIgnore(rageClick.ignore, 4)) rageClick.addFrustration(FrustrationType.ERROR_CLICK);
|
|
11
|
+
return { isRage: true };
|
|
12
|
+
}
|
|
13
|
+
const hasSelectionChanged = clicks.some((click) => click.getUserActivity().selection);
|
|
14
|
+
clicks.forEach((click) => {
|
|
15
|
+
if (click.hasError && !shouldIgnore(click.ignore, 4)) click.addFrustration(FrustrationType.ERROR_CLICK);
|
|
16
|
+
if (isDead(click) && !hasSelectionChanged) click.addFrustration(FrustrationType.DEAD_CLICK);
|
|
17
|
+
});
|
|
18
|
+
return { isRage: false };
|
|
19
|
+
}
|
|
20
|
+
function isRage(clicks) {
|
|
21
|
+
if (clicks.some((click) => shouldIgnore(click.ignore, 1) || click.getUserActivity().selection || click.getUserActivity().scroll)) return false;
|
|
22
|
+
for (let i = 0; i < clicks.length - 2; i += 1) if (clicks[i + MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1].event.timeStamp - clicks[i].event.timeStamp <= ONE_SECOND) return true;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const DEAD_CLICK_EXCLUDE_SELECTOR = "input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"range\"]),textarea,select,[contenteditable],[contenteditable] *,canvas,a[href],a[href] *";
|
|
26
|
+
function isDead(click) {
|
|
27
|
+
if (shouldIgnore(click.ignore, 2)) return false;
|
|
28
|
+
if (click.hasPageActivity || click.getUserActivity().input || click.getUserActivity().scroll) return false;
|
|
29
|
+
let target = click.event.target;
|
|
30
|
+
if (target.tagName === "LABEL" && target.hasAttribute("for")) target = document.getElementById(target.getAttribute("for"));
|
|
31
|
+
return !target?.matches(DEAD_CLICK_EXCLUDE_SELECTOR);
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { computeFrustration, isDead, isRage };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=computeFrustration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeFrustration.mjs","names":[],"sources":["../../../src/domain/action/computeFrustration.ts"],"sourcesContent":["import { ONE_SECOND } from '@kubesense/kubesense-js-core/time'\nimport { FrustrationType } from '../../rawRumEvent.types'\nimport type { Click } from './trackClickActions'\nimport { FrustrationIgnore, shouldIgnore } from './frustrationIgnore'\n\nconst MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE = 3\n\nexport function computeFrustration(clicks: Click[], rageClick: Click) {\n if (isRage(clicks)) {\n rageClick.addFrustration(FrustrationType.RAGE_CLICK)\n if (clicks.some(isDead)) {\n rageClick.addFrustration(FrustrationType.DEAD_CLICK)\n }\n // The rage action is represented by the initiating click, so its policy applies to the whole action lifetime.\n if (rageClick.hasError && !shouldIgnore(rageClick.ignore, FrustrationIgnore.ERROR_CLICK)) {\n rageClick.addFrustration(FrustrationType.ERROR_CLICK)\n }\n return { isRage: true }\n }\n\n const hasSelectionChanged = clicks.some((click) => click.getUserActivity().selection)\n clicks.forEach((click) => {\n if (click.hasError && !shouldIgnore(click.ignore, FrustrationIgnore.ERROR_CLICK)) {\n click.addFrustration(FrustrationType.ERROR_CLICK)\n }\n if (\n isDead(click) &&\n // Avoid considering clicks part of a double-click or triple-click selections as dead clicks\n !hasSelectionChanged\n ) {\n click.addFrustration(FrustrationType.DEAD_CLICK)\n }\n })\n return { isRage: false }\n}\n\nexport function isRage(clicks: Click[]) {\n if (\n clicks.some(\n (click) =>\n shouldIgnore(click.ignore, FrustrationIgnore.RAGE_CLICK) ||\n click.getUserActivity().selection ||\n click.getUserActivity().scroll\n )\n ) {\n return false\n }\n for (let i = 0; i < clicks.length - (MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1); i += 1) {\n if (\n clicks[i + MIN_CLICKS_PER_SECOND_TO_CONSIDER_RAGE - 1].event.timeStamp - clicks[i].event.timeStamp <=\n ONE_SECOND\n ) {\n return true\n }\n }\n return false\n}\n\nconst DEAD_CLICK_EXCLUDE_SELECTOR =\n // inputs that don't trigger a meaningful event like \"input\" when clicked, including textual\n // inputs (using a negative selector is shorter here)\n 'input:not([type=\"checkbox\"]):not([type=\"radio\"]):not([type=\"button\"]):not([type=\"submit\"]):not([type=\"reset\"]):not([type=\"range\"]),' +\n 'textarea,' +\n 'select,' +\n // contenteditable and their descendants don't always trigger meaningful changes when manipulated\n '[contenteditable],' +\n '[contenteditable] *,' +\n // canvas, as there is no good way to detect activity occurring on them\n 'canvas,' +\n // links that are interactive (have an href attribute) or any of their descendants, as they can\n // open a new tab or navigate to a hash without triggering a meaningful event\n 'a[href],' +\n 'a[href] *'\n\nexport function isDead(click: Click) {\n if (shouldIgnore(click.ignore, FrustrationIgnore.DEAD_CLICK)) {\n return false\n }\n\n if (click.hasPageActivity || click.getUserActivity().input || click.getUserActivity().scroll) {\n return false\n }\n\n let target: Element | null = click.event.target\n\n if (target.tagName === 'LABEL' && target.hasAttribute('for')) {\n target = document.getElementById(target.getAttribute('for')!)\n }\n\n return !target?.matches(DEAD_CLICK_EXCLUDE_SELECTOR)\n}\n"],"mappings":";;;;AAKA,MAAM,yCAAyC;AAE/C,SAAgB,mBAAmB,QAAiB,WAAkB;CACpE,IAAI,OAAO,MAAM,GAAG;EAClB,UAAU,eAAe,gBAAgB,UAAU;EACnD,IAAI,OAAO,KAAK,MAAM,GACpB,UAAU,eAAe,gBAAgB,UAAU;EAGrD,IAAI,UAAU,YAAY,CAAC,aAAa,UAAU,QAAA,CAAqC,GACrF,UAAU,eAAe,gBAAgB,WAAW;EAEtD,OAAO,EAAE,QAAQ,KAAK;CACxB;CAEA,MAAM,sBAAsB,OAAO,MAAM,UAAU,MAAM,gBAAgB,CAAC,CAAC,SAAS;CACpF,OAAO,SAAS,UAAU;EACxB,IAAI,MAAM,YAAY,CAAC,aAAa,MAAM,QAAA,CAAqC,GAC7E,MAAM,eAAe,gBAAgB,WAAW;EAElD,IACE,OAAO,KAAK,KAEZ,CAAC,qBAED,MAAM,eAAe,gBAAgB,UAAU;CAEnD,CAAC;CACD,OAAO,EAAE,QAAQ,MAAM;AACzB;AAEA,SAAgB,OAAO,QAAiB;CACtC,IACE,OAAO,MACJ,UACC,aAAa,MAAM,QAAA,CAAoC,KACvD,MAAM,gBAAgB,CAAC,CAAC,aACxB,MAAM,gBAAgB,CAAC,CAAC,MAC5B,GAEA,OAAO;CAET,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,SAAU,GAA6C,KAAK,GACrF,IACE,OAAO,IAAI,yCAAyC,EAAE,CAAC,MAAM,YAAY,OAAO,EAAE,CAAC,MAAM,aACzF,YAEA,OAAO;CAGX,OAAO;AACT;AAEA,MAAM,8BAGJ;AAaF,SAAgB,OAAO,OAAc;CACnC,IAAI,aAAa,MAAM,QAAA,CAAoC,GACzD,OAAO;CAGT,IAAI,MAAM,mBAAmB,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,gBAAgB,CAAC,CAAC,QACpF,OAAO;CAGT,IAAI,SAAyB,MAAM,MAAM;CAEzC,IAAI,OAAO,YAAY,WAAW,OAAO,aAAa,KAAK,GACzD,SAAS,SAAS,eAAe,OAAO,aAAa,KAAK,CAAE;CAG9D,OAAO,CAAC,QAAQ,QAAQ,2BAA2B;AACrD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getParentElement } from "../../browser/htmlDomUtils.mjs";
|
|
2
|
+
//#region src/domain/action/frustrationIgnore.ts
|
|
3
|
+
const FRUSTRATION_IGNORE_ATTRIBUTE = "data-dd-ignore-frustration";
|
|
4
|
+
const ALL_FRUSTRATIONS_IGNORE_VALUE = "all";
|
|
5
|
+
const RAGE_CLICK_IGNORE_VALUE = "rage-click";
|
|
6
|
+
const DEAD_CLICK_IGNORE_VALUE = "dead-click";
|
|
7
|
+
const ERROR_CLICK_IGNORE_VALUE = "error-click";
|
|
8
|
+
function shouldIgnore(ignoredFrustrations, frustration) {
|
|
9
|
+
return (ignoredFrustrations & frustration) !== 0;
|
|
10
|
+
}
|
|
11
|
+
function getFrustrationIgnore(element) {
|
|
12
|
+
let frustrationIgnore = 0;
|
|
13
|
+
let currentElement = element;
|
|
14
|
+
while (currentElement) {
|
|
15
|
+
const attributeValue = currentElement.getAttribute(FRUSTRATION_IGNORE_ATTRIBUTE);
|
|
16
|
+
if (attributeValue !== null) {
|
|
17
|
+
const values = attributeValue.split(/\s+/);
|
|
18
|
+
if (attributeValue.trim() === "" || values.includes(ALL_FRUSTRATIONS_IGNORE_VALUE)) return 7;
|
|
19
|
+
if (values.includes(RAGE_CLICK_IGNORE_VALUE)) frustrationIgnore |= 1;
|
|
20
|
+
if (values.includes(DEAD_CLICK_IGNORE_VALUE)) frustrationIgnore |= 2;
|
|
21
|
+
if (values.includes(ERROR_CLICK_IGNORE_VALUE)) frustrationIgnore |= 4;
|
|
22
|
+
}
|
|
23
|
+
if (frustrationIgnore === 7) break;
|
|
24
|
+
currentElement = getParentElement(currentElement);
|
|
25
|
+
}
|
|
26
|
+
return frustrationIgnore;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { getFrustrationIgnore, shouldIgnore };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=frustrationIgnore.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frustrationIgnore.mjs","names":[],"sources":["../../../src/domain/action/frustrationIgnore.ts"],"sourcesContent":["import { getParentElement } from '../../browser/htmlDomUtils'\n\nconst FRUSTRATION_IGNORE_ATTRIBUTE = 'data-dd-ignore-frustration'\nconst ALL_FRUSTRATIONS_IGNORE_VALUE = 'all'\nconst RAGE_CLICK_IGNORE_VALUE = 'rage-click'\nconst DEAD_CLICK_IGNORE_VALUE = 'dead-click'\nconst ERROR_CLICK_IGNORE_VALUE = 'error-click'\n\nexport const enum FrustrationIgnore {\n NONE = 0,\n RAGE_CLICK = 1,\n DEAD_CLICK = 2,\n ERROR_CLICK = 4,\n ALL = 7,\n}\n\nexport function shouldIgnore(ignoredFrustrations: FrustrationIgnore, frustration: FrustrationIgnore) {\n // eslint-disable-next-line no-bitwise\n return (ignoredFrustrations & frustration) !== 0\n}\n\nexport function getFrustrationIgnore(element: Element): FrustrationIgnore {\n let frustrationIgnore = FrustrationIgnore.NONE\n let currentElement: Element | null = element\n\n while (currentElement) {\n const attributeValue = currentElement.getAttribute(FRUSTRATION_IGNORE_ATTRIBUTE)\n if (attributeValue !== null) {\n const values = attributeValue.split(/\\s+/)\n const ignoreAll = attributeValue.trim() === '' || values.includes(ALL_FRUSTRATIONS_IGNORE_VALUE)\n if (ignoreAll) {\n return FrustrationIgnore.ALL\n }\n if (values.includes(RAGE_CLICK_IGNORE_VALUE)) {\n // eslint-disable-next-line no-bitwise\n frustrationIgnore |= FrustrationIgnore.RAGE_CLICK\n }\n if (values.includes(DEAD_CLICK_IGNORE_VALUE)) {\n // eslint-disable-next-line no-bitwise\n frustrationIgnore |= FrustrationIgnore.DEAD_CLICK\n }\n if (values.includes(ERROR_CLICK_IGNORE_VALUE)) {\n // eslint-disable-next-line no-bitwise\n frustrationIgnore |= FrustrationIgnore.ERROR_CLICK\n }\n }\n if (frustrationIgnore === FrustrationIgnore.ALL) {\n break\n }\n currentElement = getParentElement(currentElement)\n }\n\n return frustrationIgnore\n}\n"],"mappings":";;AAEA,MAAM,+BAA+B;AACrC,MAAM,gCAAgC;AACtC,MAAM,0BAA0B;AAChC,MAAM,0BAA0B;AAChC,MAAM,2BAA2B;AAUjC,SAAgB,aAAa,qBAAwC,aAAgC;CAEnG,QAAQ,sBAAsB,iBAAiB;AACjD;AAEA,SAAgB,qBAAqB,SAAqC;CACxE,IAAI,oBAAA;CACJ,IAAI,iBAAiC;CAErC,OAAO,gBAAgB;EACrB,MAAM,iBAAiB,eAAe,aAAa,4BAA4B;EAC/E,IAAI,mBAAmB,MAAM;GAC3B,MAAM,SAAS,eAAe,MAAM,KAAK;GAEzC,IADkB,eAAe,KAAK,MAAM,MAAM,OAAO,SAAS,6BAA6B,GAE7F,OAAA;GAEF,IAAI,OAAO,SAAS,uBAAuB,GAEzC,qBAAA;GAEF,IAAI,OAAO,SAAS,uBAAuB,GAEzC,qBAAA;GAEF,IAAI,OAAO,SAAS,wBAAwB,GAE1C,qBAAA;EAEJ;EACA,IAAI,sBAAA,GACF;EAEF,iBAAiB,iBAAiB,cAAc;CAClD;CAEA,OAAO;AACT"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { getParentElement, isElementNode } from "../../browser/htmlDomUtils.mjs";
|
|
2
|
+
import { ACTION_NAME_PLACEHOLDER } from "./actionNameConstants.mjs";
|
|
3
|
+
import { NodePrivacyLevel } from "../privacyConstants.mjs";
|
|
4
|
+
import { getNodePrivacyLevel, maskDisallowedTextContent, shouldMaskAttribute, shouldMaskNode } from "../privacy.mjs";
|
|
5
|
+
import { safeTruncate } from "@kubesense/kubesense-browser-core";
|
|
6
|
+
//#region src/domain/action/getActionNameFromElement.ts
|
|
7
|
+
function getActionNameFromElement(element, rumConfiguration, nodePrivacyLevel = NodePrivacyLevel.ALLOW) {
|
|
8
|
+
const nodePrivacyLevelCache = /* @__PURE__ */ new Map();
|
|
9
|
+
const { actionNameAttribute: userProgrammaticAttribute } = rumConfiguration;
|
|
10
|
+
const defaultActionName = getActionNameFromElementProgrammatically(element, "data-kubesense-action-name") || userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute);
|
|
11
|
+
if (defaultActionName) return {
|
|
12
|
+
name: defaultActionName,
|
|
13
|
+
nameSource: "custom_attribute"
|
|
14
|
+
};
|
|
15
|
+
else if (nodePrivacyLevel === NodePrivacyLevel.MASK) return {
|
|
16
|
+
name: ACTION_NAME_PLACEHOLDER,
|
|
17
|
+
nameSource: "mask_placeholder"
|
|
18
|
+
};
|
|
19
|
+
return getActionNameFromElementForStrategies(element, priorityStrategies, rumConfiguration, nodePrivacyLevelCache) || getActionNameFromElementForStrategies(element, fallbackStrategies, rumConfiguration, nodePrivacyLevelCache) || {
|
|
20
|
+
name: "",
|
|
21
|
+
nameSource: "blank"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function getActionNameFromElementProgrammatically(targetElement, programmaticAttribute) {
|
|
25
|
+
const elementWithAttribute = closestShadowAware(targetElement, `[${programmaticAttribute}]`);
|
|
26
|
+
if (!elementWithAttribute) return;
|
|
27
|
+
return truncate(normalizeWhitespace(elementWithAttribute.getAttribute(programmaticAttribute).trim()));
|
|
28
|
+
}
|
|
29
|
+
function closestShadowAware(element, selector) {
|
|
30
|
+
let current = element;
|
|
31
|
+
while (current) {
|
|
32
|
+
if (current.matches(selector)) return current;
|
|
33
|
+
current = getParentElement(current);
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const priorityStrategies = [
|
|
38
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
39
|
+
if ("labels" in element && element.labels && element.labels.length > 0) return getActionNameFromTextualContent(element.labels[0], rumConfiguration, nodePrivacyLevelCache);
|
|
40
|
+
},
|
|
41
|
+
(element) => {
|
|
42
|
+
if (element.nodeName === "INPUT") {
|
|
43
|
+
const input = element;
|
|
44
|
+
const type = input.getAttribute("type");
|
|
45
|
+
if (type === "button" || type === "submit" || type === "reset") return {
|
|
46
|
+
name: input.value,
|
|
47
|
+
nameSource: "text_content"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
52
|
+
if (element.nodeName === "BUTTON" || element.nodeName === "LABEL" || element.getAttribute("role") === "button") return getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache);
|
|
53
|
+
},
|
|
54
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromStandardAttribute(element, "aria-label", rumConfiguration, nodePrivacyLevelCache),
|
|
55
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
56
|
+
const labelledByAttribute = element.getAttribute("aria-labelledby");
|
|
57
|
+
if (labelledByAttribute) return {
|
|
58
|
+
name: labelledByAttribute.split(/\s+/).map((id) => getElementById(element, id)).filter((label) => Boolean(label)).map((element) => getTextualContent(element, rumConfiguration, nodePrivacyLevelCache)).join(" "),
|
|
59
|
+
nameSource: "text_content"
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromStandardAttribute(element, "alt", rumConfiguration, nodePrivacyLevelCache),
|
|
63
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromStandardAttribute(element, "name", rumConfiguration, nodePrivacyLevelCache),
|
|
64
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromStandardAttribute(element, "title", rumConfiguration, nodePrivacyLevelCache),
|
|
65
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromStandardAttribute(element, "placeholder", rumConfiguration, nodePrivacyLevelCache),
|
|
66
|
+
(element, rumConfiguration, nodePrivacyLevelCache) => {
|
|
67
|
+
if ("options" in element && element.options.length > 0) return getActionNameFromTextualContent(element.options[0], rumConfiguration, nodePrivacyLevelCache);
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const fallbackStrategies = [(element, rumConfiguration, nodePrivacyLevelCache) => getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache)];
|
|
71
|
+
/**
|
|
72
|
+
* Iterates over the target element and its parent, using the strategies list to get an action name.
|
|
73
|
+
* Each strategies are applied on each element, stopping as soon as a non-empty value is returned.
|
|
74
|
+
*/
|
|
75
|
+
const MAX_PARENTS_TO_CONSIDER = 10;
|
|
76
|
+
function getActionNameFromElementForStrategies(targetElement, strategies, rumConfiguration, nodePrivacyLevelCache) {
|
|
77
|
+
let element = targetElement;
|
|
78
|
+
let recursionCounter = 0;
|
|
79
|
+
while (recursionCounter <= MAX_PARENTS_TO_CONSIDER && element && element.nodeName !== "BODY" && element.nodeName !== "HTML" && element.nodeName !== "HEAD") {
|
|
80
|
+
for (const strategy of strategies) {
|
|
81
|
+
const actionName = strategy(element, rumConfiguration, nodePrivacyLevelCache);
|
|
82
|
+
if (actionName) {
|
|
83
|
+
const { name, nameSource } = actionName;
|
|
84
|
+
const trimmedName = name?.trim();
|
|
85
|
+
if (trimmedName) return {
|
|
86
|
+
name: truncate(normalizeWhitespace(trimmedName)),
|
|
87
|
+
nameSource
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (element.nodeName === "FORM") break;
|
|
92
|
+
element = getParentElement(element);
|
|
93
|
+
recursionCounter += 1;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function normalizeWhitespace(s) {
|
|
97
|
+
return s.replace(/\s+/g, " ");
|
|
98
|
+
}
|
|
99
|
+
function truncate(s) {
|
|
100
|
+
return s.length > 100 ? `${safeTruncate(s, 100)} [...]` : s;
|
|
101
|
+
}
|
|
102
|
+
function getElementById(refElement, id) {
|
|
103
|
+
const rootNode = refElement.getRootNode();
|
|
104
|
+
if (rootNode instanceof ShadowRoot) {
|
|
105
|
+
const shadowElement = rootNode.getElementById(id);
|
|
106
|
+
if (shadowElement) return shadowElement;
|
|
107
|
+
}
|
|
108
|
+
return refElement.ownerDocument ? refElement.ownerDocument.getElementById(id) : null;
|
|
109
|
+
}
|
|
110
|
+
function getActionNameFromStandardAttribute(element, attribute, rumConfiguration, nodePrivacyLevelCache) {
|
|
111
|
+
const { enablePrivacyForActionName, defaultPrivacyLevel } = rumConfiguration;
|
|
112
|
+
let attributeValue = element.getAttribute(attribute);
|
|
113
|
+
if (attributeValue && enablePrivacyForActionName) {
|
|
114
|
+
const nodePrivacyLevel = getNodePrivacyLevel(element, defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
115
|
+
if (shouldMaskAttribute(element.tagName, attribute, attributeValue, nodePrivacyLevel, rumConfiguration)) attributeValue = maskDisallowedTextContent(attributeValue, ACTION_NAME_PLACEHOLDER);
|
|
116
|
+
} else if (!attributeValue) attributeValue = "";
|
|
117
|
+
return {
|
|
118
|
+
name: attributeValue,
|
|
119
|
+
nameSource: "standard_attribute"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache) {
|
|
123
|
+
return {
|
|
124
|
+
name: getTextualContent(element, rumConfiguration, nodePrivacyLevelCache) || "",
|
|
125
|
+
nameSource: "text_content"
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function getTextualContent(element, rumConfiguration, nodePrivacyLevelCache) {
|
|
129
|
+
if (element.isContentEditable) return;
|
|
130
|
+
const { enablePrivacyForActionName, actionNameAttribute: userProgrammaticAttribute, defaultPrivacyLevel } = rumConfiguration;
|
|
131
|
+
const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, rejectInvisibleOrMaskedElementsFilter);
|
|
132
|
+
let text = "";
|
|
133
|
+
while (walker.nextNode()) {
|
|
134
|
+
const node = walker.currentNode;
|
|
135
|
+
if (isElementNode(node)) {
|
|
136
|
+
if (node.nodeName === "BR" || node.nodeName === "P" || [
|
|
137
|
+
"block",
|
|
138
|
+
"flex",
|
|
139
|
+
"grid",
|
|
140
|
+
"list-item",
|
|
141
|
+
"table",
|
|
142
|
+
"table-caption"
|
|
143
|
+
].includes(getComputedStyle(node).display)) text += " ";
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
text += node.textContent || "";
|
|
147
|
+
}
|
|
148
|
+
return text.replace(/\s+/g, " ").trim();
|
|
149
|
+
function rejectInvisibleOrMaskedElementsFilter(node) {
|
|
150
|
+
const nodeSelfPrivacyLevel = getNodePrivacyLevel(node, defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
151
|
+
if (enablePrivacyForActionName && nodeSelfPrivacyLevel && shouldMaskNode(node, nodeSelfPrivacyLevel)) return NodeFilter.FILTER_REJECT;
|
|
152
|
+
if (isElementNode(node)) {
|
|
153
|
+
if (node.hasAttribute("data-kubesense-action-name") || userProgrammaticAttribute && node.hasAttribute(userProgrammaticAttribute)) return NodeFilter.FILTER_REJECT;
|
|
154
|
+
const style = getComputedStyle(node);
|
|
155
|
+
if (style.visibility !== "visible" || style.display === "none" || style.contentVisibility && style.contentVisibility !== "visible") return NodeFilter.FILTER_REJECT;
|
|
156
|
+
}
|
|
157
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
export { getActionNameFromElement };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=getActionNameFromElement.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getActionNameFromElement.mjs","names":[],"sources":["../../../src/domain/action/getActionNameFromElement.ts"],"sourcesContent":["import { safeTruncate } from '@kubesense/kubesense-browser-core'\nimport { NodePrivacyLevel } from '../privacyConstants'\nimport { getNodePrivacyLevel, maskDisallowedTextContent, shouldMaskNode, shouldMaskAttribute } from '../privacy'\nimport type { NodePrivacyLevelCache } from '../privacy'\nimport type { RumConfiguration } from '../configuration'\nimport { isElementNode, getParentElement } from '../../browser/htmlDomUtils'\nimport {\n ActionNameSource,\n DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,\n ACTION_NAME_PLACEHOLDER,\n} from './actionNameConstants'\nimport type { ActionName } from './actionNameConstants'\n\nexport function getActionNameFromElement(\n element: Element,\n rumConfiguration: RumConfiguration,\n nodePrivacyLevel: NodePrivacyLevel = NodePrivacyLevel.ALLOW\n): ActionName {\n const nodePrivacyLevelCache: NodePrivacyLevelCache = new Map()\n\n const { actionNameAttribute: userProgrammaticAttribute } = rumConfiguration\n\n // Proceed to get the action name in two steps:\n // * first, get the name programmatically, explicitly defined by the user.\n // * then, if privacy is set to mask, return a placeholder for the undefined.\n // * if privacy is not set to mask, use strategies that are known to return good results.\n // Those strategies will be used on the element and a few parents, but it's likely that they won't succeed at all.\n // * if no name is found this way, use strategies returning less accurate names as a fallback.\n // Those are much likely to succeed.\n const defaultActionName =\n getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||\n (userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute))\n\n if (defaultActionName) {\n return { name: defaultActionName, nameSource: ActionNameSource.CUSTOM_ATTRIBUTE }\n } else if (nodePrivacyLevel === NodePrivacyLevel.MASK) {\n return { name: ACTION_NAME_PLACEHOLDER, nameSource: ActionNameSource.MASK_PLACEHOLDER }\n }\n\n return (\n getActionNameFromElementForStrategies(element, priorityStrategies, rumConfiguration, nodePrivacyLevelCache) ||\n getActionNameFromElementForStrategies(element, fallbackStrategies, rumConfiguration, nodePrivacyLevelCache) || {\n name: '',\n nameSource: ActionNameSource.BLANK,\n }\n )\n}\n\nfunction getActionNameFromElementProgrammatically(targetElement: Element, programmaticAttribute: string) {\n // We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,\n // without limit. It is up to the user to declare a relevant naming strategy.\n const elementWithAttribute = closestShadowAware(targetElement, `[${programmaticAttribute}]`)\n\n if (!elementWithAttribute) {\n return\n }\n const name = elementWithAttribute.getAttribute(programmaticAttribute)!\n return truncate(normalizeWhitespace(name.trim()))\n}\n\nfunction closestShadowAware(element: Element, selector: string): Element | null {\n let current: Element | null = element\n while (current) {\n if (current.matches(selector)) {\n return current\n }\n current = getParentElement(current)\n }\n return null\n}\n\ntype NameStrategy = (\n element: Element | HTMLElement | HTMLInputElement | HTMLSelectElement,\n rumConfiguration: RumConfiguration,\n nodePrivacyLevelCache: NodePrivacyLevelCache\n) => ActionName | undefined | null\n\nconst priorityStrategies: NameStrategy[] = [\n // associated LABEL text\n (element, rumConfiguration, nodePrivacyLevelCache) => {\n if ('labels' in element && element.labels && element.labels.length > 0) {\n return getActionNameFromTextualContent(element.labels[0], rumConfiguration, nodePrivacyLevelCache)\n }\n },\n // INPUT button (and associated) value\n (element) => {\n if (element.nodeName === 'INPUT') {\n const input = element as HTMLInputElement\n const type = input.getAttribute('type')\n if (type === 'button' || type === 'submit' || type === 'reset') {\n return { name: input.value, nameSource: ActionNameSource.TEXT_CONTENT }\n }\n }\n },\n // BUTTON, LABEL or button-like element text\n (element, rumConfiguration, nodePrivacyLevelCache) => {\n if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {\n return getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache)\n }\n },\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromStandardAttribute(element, 'aria-label', rumConfiguration, nodePrivacyLevelCache),\n // associated element text designated by the aria-labelledby attribute\n (element, rumConfiguration, nodePrivacyLevelCache) => {\n const labelledByAttribute = element.getAttribute('aria-labelledby')\n if (labelledByAttribute) {\n return {\n name: labelledByAttribute\n .split(/\\s+/)\n .map((id) => getElementById(element, id))\n .filter((label): label is HTMLElement => Boolean(label))\n .map((element) => getTextualContent(element, rumConfiguration, nodePrivacyLevelCache))\n .join(' '),\n nameSource: ActionNameSource.TEXT_CONTENT,\n }\n }\n },\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromStandardAttribute(element, 'alt', rumConfiguration, nodePrivacyLevelCache),\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromStandardAttribute(element, 'name', rumConfiguration, nodePrivacyLevelCache),\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromStandardAttribute(element, 'title', rumConfiguration, nodePrivacyLevelCache),\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromStandardAttribute(element, 'placeholder', rumConfiguration, nodePrivacyLevelCache),\n // SELECT first OPTION text\n (element, rumConfiguration, nodePrivacyLevelCache) => {\n if ('options' in element && element.options.length > 0) {\n return getActionNameFromTextualContent(element.options[0], rumConfiguration, nodePrivacyLevelCache)\n }\n },\n]\n\nconst fallbackStrategies: NameStrategy[] = [\n (element, rumConfiguration, nodePrivacyLevelCache) =>\n getActionNameFromTextualContent(element, rumConfiguration, nodePrivacyLevelCache),\n]\n\n/**\n * Iterates over the target element and its parent, using the strategies list to get an action name.\n * Each strategies are applied on each element, stopping as soon as a non-empty value is returned.\n */\nconst MAX_PARENTS_TO_CONSIDER = 10\nfunction getActionNameFromElementForStrategies(\n targetElement: Element,\n strategies: NameStrategy[],\n rumConfiguration: RumConfiguration,\n nodePrivacyLevelCache: NodePrivacyLevelCache\n) {\n let element: Element | null = targetElement\n let recursionCounter = 0\n while (\n recursionCounter <= MAX_PARENTS_TO_CONSIDER &&\n element &&\n element.nodeName !== 'BODY' &&\n element.nodeName !== 'HTML' &&\n element.nodeName !== 'HEAD'\n ) {\n for (const strategy of strategies) {\n const actionName = strategy(element, rumConfiguration, nodePrivacyLevelCache)\n if (actionName) {\n const { name, nameSource } = actionName\n const trimmedName = name?.trim()\n if (trimmedName) {\n return { name: truncate(normalizeWhitespace(trimmedName)), nameSource }\n }\n }\n }\n // Consider a FORM as a contextual limit to get the action name. This is experimental and may\n // be reconsidered in the future.\n if (element.nodeName === 'FORM') {\n break\n }\n element = getParentElement(element)\n recursionCounter += 1\n }\n}\n\nfunction normalizeWhitespace(s: string) {\n return s.replace(/\\s+/g, ' ')\n}\n\nfunction truncate(s: string) {\n return s.length > 100 ? `${safeTruncate(s, 100)} [...]` : s\n}\n\nfunction getElementById(refElement: Element, id: string): HTMLElement | null {\n const rootNode = refElement.getRootNode()\n if (rootNode instanceof ShadowRoot) {\n const shadowElement = rootNode.getElementById(id)\n if (shadowElement) {\n return shadowElement\n }\n }\n\n // Use the element ownerDocument here, because tests are executed in an iframe, so\n // document.getElementById won't work.\n return refElement.ownerDocument ? refElement.ownerDocument.getElementById(id) : null\n}\n\nfunction getActionNameFromStandardAttribute(\n element: Element | HTMLElement,\n attribute: string,\n rumConfiguration: RumConfiguration,\n nodePrivacyLevelCache: NodePrivacyLevelCache\n): ActionName {\n const { enablePrivacyForActionName, defaultPrivacyLevel } = rumConfiguration\n let attributeValue = element.getAttribute(attribute)\n if (attributeValue && enablePrivacyForActionName) {\n const nodePrivacyLevel = getNodePrivacyLevel(element, defaultPrivacyLevel, nodePrivacyLevelCache)\n if (shouldMaskAttribute(element.tagName, attribute, attributeValue, nodePrivacyLevel, rumConfiguration)) {\n attributeValue = maskDisallowedTextContent(attributeValue, ACTION_NAME_PLACEHOLDER)\n }\n } else if (!attributeValue) {\n attributeValue = ''\n }\n\n return {\n name: attributeValue,\n nameSource: ActionNameSource.STANDARD_ATTRIBUTE,\n }\n}\n\nfunction getActionNameFromTextualContent(\n element: Element | HTMLElement,\n rumConfiguration: RumConfiguration,\n nodePrivacyLevelCache: NodePrivacyLevelCache\n): ActionName {\n return {\n name: getTextualContent(element, rumConfiguration, nodePrivacyLevelCache) || '',\n nameSource: ActionNameSource.TEXT_CONTENT,\n }\n}\n\nfunction getTextualContent(\n element: Element,\n rumConfiguration: RumConfiguration,\n nodePrivacyLevelCache: NodePrivacyLevelCache\n) {\n if ((element as HTMLElement).isContentEditable) {\n return\n }\n\n const {\n enablePrivacyForActionName,\n actionNameAttribute: userProgrammaticAttribute,\n defaultPrivacyLevel,\n } = rumConfiguration\n\n const walker = document.createTreeWalker(\n element,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT,\n rejectInvisibleOrMaskedElementsFilter\n )\n\n let text = ''\n\n while (walker.nextNode()) {\n const node = walker.currentNode\n if (isElementNode(node)) {\n if (\n // Following InnerText rendering spec https://html.spec.whatwg.org/multipage/dom.html#rendered-text-collection-steps\n node.nodeName === 'BR' ||\n node.nodeName === 'P' ||\n ['block', 'flex', 'grid', 'list-item', 'table', 'table-caption'].includes(getComputedStyle(node).display)\n ) {\n text += ' '\n }\n continue // skip element nodes\n }\n\n text += node.textContent || ''\n }\n\n return text.replace(/\\s+/g, ' ').trim()\n\n function rejectInvisibleOrMaskedElementsFilter(node: Node) {\n const nodeSelfPrivacyLevel = getNodePrivacyLevel(node, defaultPrivacyLevel, nodePrivacyLevelCache)\n if (enablePrivacyForActionName && nodeSelfPrivacyLevel && shouldMaskNode(node, nodeSelfPrivacyLevel)) {\n return NodeFilter.FILTER_REJECT\n }\n if (isElementNode(node)) {\n if (\n node.hasAttribute(DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||\n (userProgrammaticAttribute && node.hasAttribute(userProgrammaticAttribute))\n ) {\n return NodeFilter.FILTER_REJECT\n }\n const style = getComputedStyle(node)\n if (\n style.visibility !== 'visible' ||\n style.display === 'none' ||\n (style.contentVisibility && style.contentVisibility !== 'visible')\n // contentVisibility is not supported in all browsers, so we need to check it\n ) {\n return NodeFilter.FILTER_REJECT\n }\n }\n\n return NodeFilter.FILTER_ACCEPT\n }\n}\n"],"mappings":";;;;;;AAaA,SAAgB,yBACd,SACA,kBACA,mBAAqC,iBAAiB,OAC1C;CACZ,MAAM,wCAA+C,IAAI,IAAI;CAE7D,MAAM,EAAE,qBAAqB,8BAA8B;CAS3D,MAAM,oBACJ,yCAAyC,SAAA,4BAAmD,KAC3F,6BAA6B,yCAAyC,SAAS,yBAAyB;CAE3G,IAAI,mBACF,OAAO;EAAE,MAAM;EAAmB,YAAA;CAA8C;MAC3E,IAAI,qBAAqB,iBAAiB,MAC/C,OAAO;EAAE,MAAM;EAAyB,YAAA;CAA8C;CAGxF,OACE,sCAAsC,SAAS,oBAAoB,kBAAkB,qBAAqB,KAC1G,sCAAsC,SAAS,oBAAoB,kBAAkB,qBAAqB,KAAK;EAC7G,MAAM;EACN,YAAA;CACF;AAEJ;AAEA,SAAS,yCAAyC,eAAwB,uBAA+B;CAGvG,MAAM,uBAAuB,mBAAmB,eAAe,IAAI,sBAAsB,EAAE;CAE3F,IAAI,CAAC,sBACH;CAGF,OAAO,SAAS,oBADH,qBAAqB,aAAa,qBACR,CAAC,CAAC,KAAK,CAAC,CAAC;AAClD;AAEA,SAAS,mBAAmB,SAAkB,UAAkC;CAC9E,IAAI,UAA0B;CAC9B,OAAO,SAAS;EACd,IAAI,QAAQ,QAAQ,QAAQ,GAC1B,OAAO;EAET,UAAU,iBAAiB,OAAO;CACpC;CACA,OAAO;AACT;AAQA,MAAM,qBAAqC;EAExC,SAAS,kBAAkB,0BAA0B;EACpD,IAAI,YAAY,WAAW,QAAQ,UAAU,QAAQ,OAAO,SAAS,GACnE,OAAO,gCAAgC,QAAQ,OAAO,IAAI,kBAAkB,qBAAqB;CAErG;EAEC,YAAY;EACX,IAAI,QAAQ,aAAa,SAAS;GAChC,MAAM,QAAQ;GACd,MAAM,OAAO,MAAM,aAAa,MAAM;GACtC,IAAI,SAAS,YAAY,SAAS,YAAY,SAAS,SACrD,OAAO;IAAE,MAAM,MAAM;IAAO,YAAA;GAA0C;EAE1E;CACF;EAEC,SAAS,kBAAkB,0BAA0B;EACpD,IAAI,QAAQ,aAAa,YAAY,QAAQ,aAAa,WAAW,QAAQ,aAAa,MAAM,MAAM,UACpG,OAAO,gCAAgC,SAAS,kBAAkB,qBAAqB;CAE3F;EACC,SAAS,kBAAkB,0BAC1B,mCAAmC,SAAS,cAAc,kBAAkB,qBAAqB;EAElG,SAAS,kBAAkB,0BAA0B;EACpD,MAAM,sBAAsB,QAAQ,aAAa,iBAAiB;EAClE,IAAI,qBACF,OAAO;GACL,MAAM,oBACH,MAAM,KAAK,CAAC,CACZ,KAAK,OAAO,eAAe,SAAS,EAAE,CAAC,CAAC,CACxC,QAAQ,UAAgC,QAAQ,KAAK,CAAC,CAAC,CACvD,KAAK,YAAY,kBAAkB,SAAS,kBAAkB,qBAAqB,CAAC,CAAC,CACrF,KAAK,GAAG;GACX,YAAA;EACF;CAEJ;EACC,SAAS,kBAAkB,0BAC1B,mCAAmC,SAAS,OAAO,kBAAkB,qBAAqB;EAC3F,SAAS,kBAAkB,0BAC1B,mCAAmC,SAAS,QAAQ,kBAAkB,qBAAqB;EAC5F,SAAS,kBAAkB,0BAC1B,mCAAmC,SAAS,SAAS,kBAAkB,qBAAqB;EAC7F,SAAS,kBAAkB,0BAC1B,mCAAmC,SAAS,eAAe,kBAAkB,qBAAqB;EAEnG,SAAS,kBAAkB,0BAA0B;EACpD,IAAI,aAAa,WAAW,QAAQ,QAAQ,SAAS,GACnD,OAAO,gCAAgC,QAAQ,QAAQ,IAAI,kBAAkB,qBAAqB;CAEtG;AACF;AAEA,MAAM,qBAAqC,EACxC,SAAS,kBAAkB,0BAC1B,gCAAgC,SAAS,kBAAkB,qBAAqB,CACpF;;;;;AAMA,MAAM,0BAA0B;AAChC,SAAS,sCACP,eACA,YACA,kBACA,uBACA;CACA,IAAI,UAA0B;CAC9B,IAAI,mBAAmB;CACvB,OACE,oBAAoB,2BACpB,WACA,QAAQ,aAAa,UACrB,QAAQ,aAAa,UACrB,QAAQ,aAAa,QACrB;EACA,KAAK,MAAM,YAAY,YAAY;GACjC,MAAM,aAAa,SAAS,SAAS,kBAAkB,qBAAqB;GAC5E,IAAI,YAAY;IACd,MAAM,EAAE,MAAM,eAAe;IAC7B,MAAM,cAAc,MAAM,KAAK;IAC/B,IAAI,aACF,OAAO;KAAE,MAAM,SAAS,oBAAoB,WAAW,CAAC;KAAG;IAAW;GAE1E;EACF;EAGA,IAAI,QAAQ,aAAa,QACvB;EAEF,UAAU,iBAAiB,OAAO;EAClC,oBAAoB;CACtB;AACF;AAEA,SAAS,oBAAoB,GAAW;CACtC,OAAO,EAAE,QAAQ,QAAQ,GAAG;AAC9B;AAEA,SAAS,SAAS,GAAW;CAC3B,OAAO,EAAE,SAAS,MAAM,GAAG,aAAa,GAAG,GAAG,EAAE,UAAU;AAC5D;AAEA,SAAS,eAAe,YAAqB,IAAgC;CAC3E,MAAM,WAAW,WAAW,YAAY;CACxC,IAAI,oBAAoB,YAAY;EAClC,MAAM,gBAAgB,SAAS,eAAe,EAAE;EAChD,IAAI,eACF,OAAO;CAEX;CAIA,OAAO,WAAW,gBAAgB,WAAW,cAAc,eAAe,EAAE,IAAI;AAClF;AAEA,SAAS,mCACP,SACA,WACA,kBACA,uBACY;CACZ,MAAM,EAAE,4BAA4B,wBAAwB;CAC5D,IAAI,iBAAiB,QAAQ,aAAa,SAAS;CACnD,IAAI,kBAAkB,4BAA4B;EAChD,MAAM,mBAAmB,oBAAoB,SAAS,qBAAqB,qBAAqB;EAChG,IAAI,oBAAoB,QAAQ,SAAS,WAAW,gBAAgB,kBAAkB,gBAAgB,GACpG,iBAAiB,0BAA0B,gBAAgB,uBAAuB;CAEtF,OAAO,IAAI,CAAC,gBACV,iBAAiB;CAGnB,OAAO;EACL,MAAM;EACN,YAAA;CACF;AACF;AAEA,SAAS,gCACP,SACA,kBACA,uBACY;CACZ,OAAO;EACL,MAAM,kBAAkB,SAAS,kBAAkB,qBAAqB,KAAK;EAC7E,YAAA;CACF;AACF;AAEA,SAAS,kBACP,SACA,kBACA,uBACA;CACA,IAAK,QAAwB,mBAC3B;CAGF,MAAM,EACJ,4BACA,qBAAqB,2BACrB,wBACE;CAEJ,MAAM,SAAS,SAAS,iBACtB,SAEA,WAAW,eAAe,WAAW,WACrC,qCACF;CAEA,IAAI,OAAO;CAEX,OAAO,OAAO,SAAS,GAAG;EACxB,MAAM,OAAO,OAAO;EACpB,IAAI,cAAc,IAAI,GAAG;GACvB,IAEE,KAAK,aAAa,QAClB,KAAK,aAAa,OAClB;IAAC;IAAS;IAAQ;IAAQ;IAAa;IAAS;GAAe,CAAC,CAAC,SAAS,iBAAiB,IAAI,CAAC,CAAC,OAAO,GAExG,QAAQ;GAEV;EACF;EAEA,QAAQ,KAAK,eAAe;CAC9B;CAEA,OAAO,KAAK,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;CAEtC,SAAS,sCAAsC,MAAY;EACzD,MAAM,uBAAuB,oBAAoB,MAAM,qBAAqB,qBAAqB;EACjG,IAAI,8BAA8B,wBAAwB,eAAe,MAAM,oBAAoB,GACjG,OAAO,WAAW;EAEpB,IAAI,cAAc,IAAI,GAAG;GACvB,IACE,KAAK,aAAA,4BAAuD,KAC3D,6BAA6B,KAAK,aAAa,yBAAyB,GAEzE,OAAO,WAAW;GAEpB,MAAM,QAAQ,iBAAiB,IAAI;GACnC,IACE,MAAM,eAAe,aACrB,MAAM,YAAY,UACjB,MAAM,qBAAqB,MAAM,sBAAsB,WAGxD,OAAO,WAAW;EAEtB;EAEA,OAAO,WAAW;CACpB;AACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ONE_SECOND, elapsed, relativeNow } from "@kubesense/kubesense-js-core/time";
|
|
2
|
+
//#region src/domain/action/interactionSelectorCache.ts
|
|
3
|
+
const CLICK_ACTION_MAX_DURATION = 10 * ONE_SECOND;
|
|
4
|
+
const interactionSelectorCache = /* @__PURE__ */ new Map();
|
|
5
|
+
function getInteractionSelector(relativeTimestamp) {
|
|
6
|
+
const selector = interactionSelectorCache.get(relativeTimestamp);
|
|
7
|
+
interactionSelectorCache.delete(relativeTimestamp);
|
|
8
|
+
return selector;
|
|
9
|
+
}
|
|
10
|
+
function updateInteractionSelector(relativeTimestamp, selector) {
|
|
11
|
+
interactionSelectorCache.set(relativeTimestamp, selector);
|
|
12
|
+
interactionSelectorCache.forEach((_, relativeTimestamp) => {
|
|
13
|
+
if (elapsed(relativeTimestamp, relativeNow()) > CLICK_ACTION_MAX_DURATION) interactionSelectorCache.delete(relativeTimestamp);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CLICK_ACTION_MAX_DURATION, getInteractionSelector, interactionSelectorCache, updateInteractionSelector };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=interactionSelectorCache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionSelectorCache.mjs","names":[],"sources":["../../../src/domain/action/interactionSelectorCache.ts"],"sourcesContent":["import { relativeNow, ONE_SECOND, elapsed } from '@kubesense/kubesense-js-core/time'\nimport type { RelativeTime } from '@kubesense/kubesense-js-core/time'\n\n// Maximum duration for click actions\nexport const CLICK_ACTION_MAX_DURATION = 10 * ONE_SECOND\nexport const interactionSelectorCache = new Map<RelativeTime, string>()\n\nexport function getInteractionSelector(relativeTimestamp: RelativeTime) {\n const selector = interactionSelectorCache.get(relativeTimestamp)\n interactionSelectorCache.delete(relativeTimestamp)\n return selector\n}\n\nexport function updateInteractionSelector(relativeTimestamp: RelativeTime, selector: string) {\n interactionSelectorCache.set(relativeTimestamp, selector)\n interactionSelectorCache.forEach((_, relativeTimestamp) => {\n if (elapsed(relativeTimestamp, relativeNow()) > CLICK_ACTION_MAX_DURATION) {\n interactionSelectorCache.delete(relativeTimestamp)\n }\n })\n}\n"],"mappings":";;AAIA,MAAa,4BAA4B,KAAK;AAC9C,MAAa,2CAA2B,IAAI,IAA0B;AAEtE,SAAgB,uBAAuB,mBAAiC;CACtE,MAAM,WAAW,yBAAyB,IAAI,iBAAiB;CAC/D,yBAAyB,OAAO,iBAAiB;CACjD,OAAO;AACT;AAEA,SAAgB,0BAA0B,mBAAiC,UAAkB;CAC3F,yBAAyB,IAAI,mBAAmB,QAAQ;CACxD,yBAAyB,SAAS,GAAG,sBAAsB;EACzD,IAAI,QAAQ,mBAAmB,YAAY,CAAC,IAAI,2BAC9C,yBAAyB,OAAO,iBAAiB;CAErD,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isActionChildEvent.mjs","names":[],"sources":["../../../src/domain/action/isActionChildEvent.ts"],"sourcesContent":["import type { RumActionEvent, RumErrorEvent, RumLongTaskEvent, RumResourceEvent } from '../../rumEvent.types'\n\nexport function isActionChildEvent(id: string) {\n return (event: RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent) =>\n event.action?.id?.includes(id) ?? false\n}\n"],"mappings":";AAEA,SAAgB,mBAAmB,IAAY;CAC7C,QAAQ,UACN,MAAM,QAAQ,IAAI,SAAS,EAAE,KAAK;AACtC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { DOM_EVENT, addEventListener } from "@kubesense/kubesense-browser-core";
|
|
2
|
+
//#region src/domain/action/listenActionEvents.ts
|
|
3
|
+
function listenActionEvents({ onPointerDown, onPointerUp }) {
|
|
4
|
+
let selectionEmptyAtPointerDown;
|
|
5
|
+
let userActivity = {
|
|
6
|
+
selection: false,
|
|
7
|
+
input: false,
|
|
8
|
+
scroll: false
|
|
9
|
+
};
|
|
10
|
+
let clickContext;
|
|
11
|
+
const listeners = [
|
|
12
|
+
addEventListener(window, DOM_EVENT.POINTER_DOWN, (event) => {
|
|
13
|
+
if (isValidPointerEvent(event)) {
|
|
14
|
+
selectionEmptyAtPointerDown = isSelectionEmpty();
|
|
15
|
+
userActivity = {
|
|
16
|
+
selection: false,
|
|
17
|
+
input: false,
|
|
18
|
+
scroll: false
|
|
19
|
+
};
|
|
20
|
+
clickContext = onPointerDown(event);
|
|
21
|
+
}
|
|
22
|
+
}, { capture: true }),
|
|
23
|
+
addEventListener(window, DOM_EVENT.SELECTION_CHANGE, () => {
|
|
24
|
+
if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) userActivity.selection = true;
|
|
25
|
+
}, { capture: true }),
|
|
26
|
+
addEventListener(window, DOM_EVENT.SCROLL, () => {
|
|
27
|
+
userActivity.scroll = true;
|
|
28
|
+
}, {
|
|
29
|
+
capture: true,
|
|
30
|
+
passive: true
|
|
31
|
+
}),
|
|
32
|
+
addEventListener(window, DOM_EVENT.POINTER_UP, (event) => {
|
|
33
|
+
if (isValidPointerEvent(event) && clickContext) {
|
|
34
|
+
const localUserActivity = userActivity;
|
|
35
|
+
onPointerUp(clickContext, event, () => localUserActivity);
|
|
36
|
+
clickContext = void 0;
|
|
37
|
+
}
|
|
38
|
+
}, { capture: true }),
|
|
39
|
+
addEventListener(window, DOM_EVENT.INPUT, () => {
|
|
40
|
+
userActivity.input = true;
|
|
41
|
+
}, { capture: true })
|
|
42
|
+
];
|
|
43
|
+
return { stop: () => {
|
|
44
|
+
listeners.forEach((listener) => listener.stop());
|
|
45
|
+
} };
|
|
46
|
+
}
|
|
47
|
+
function isSelectionEmpty() {
|
|
48
|
+
const selection = window.getSelection();
|
|
49
|
+
return !selection || selection.isCollapsed;
|
|
50
|
+
}
|
|
51
|
+
function isValidPointerEvent(event) {
|
|
52
|
+
return event.target instanceof Element && event.isPrimary !== false;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { listenActionEvents };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=listenActionEvents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listenActionEvents.mjs","names":[],"sources":["../../../src/domain/action/listenActionEvents.ts"],"sourcesContent":["import { addEventListener, DOM_EVENT } from '@kubesense/kubesense-browser-core'\nimport type { RelativeTime } from '@kubesense/kubesense-js-core/time'\n\nexport interface ExtraPointerEventFields {\n target: Element\n timeStamp: RelativeTime\n}\nexport type MouseEventOnElement = PointerEvent & ExtraPointerEventFields\n\nexport interface UserActivity {\n selection: boolean\n input: boolean\n scroll: boolean\n}\nexport interface ActionEventsHooks<ClickContext> {\n onPointerDown: (event: MouseEventOnElement) => ClickContext | undefined\n onPointerUp: (context: ClickContext, event: MouseEventOnElement, getUserActivity: () => UserActivity) => void\n}\n\nexport function listenActionEvents<ClickContext>({ onPointerDown, onPointerUp }: ActionEventsHooks<ClickContext>) {\n let selectionEmptyAtPointerDown: boolean\n let userActivity: UserActivity = {\n selection: false,\n input: false,\n scroll: false,\n }\n let clickContext: ClickContext | undefined\n\n const listeners = [\n addEventListener(\n window,\n DOM_EVENT.POINTER_DOWN,\n (event: PointerEvent) => {\n if (isValidPointerEvent(event)) {\n selectionEmptyAtPointerDown = isSelectionEmpty()\n userActivity = {\n selection: false,\n input: false,\n scroll: false,\n }\n clickContext = onPointerDown(event)\n }\n },\n { capture: true }\n ),\n\n addEventListener(\n window,\n DOM_EVENT.SELECTION_CHANGE,\n () => {\n if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {\n userActivity.selection = true\n }\n },\n { capture: true }\n ),\n\n addEventListener(\n window,\n DOM_EVENT.SCROLL,\n () => {\n userActivity.scroll = true\n },\n { capture: true, passive: true }\n ),\n\n addEventListener(\n window,\n DOM_EVENT.POINTER_UP,\n (event: PointerEvent) => {\n if (isValidPointerEvent(event) && clickContext) {\n // Use a scoped variable to make sure the value is not changed by other clicks\n const localUserActivity = userActivity\n onPointerUp(clickContext, event, () => localUserActivity)\n clickContext = undefined\n }\n },\n { capture: true }\n ),\n\n addEventListener(\n window,\n DOM_EVENT.INPUT,\n () => {\n userActivity.input = true\n },\n { capture: true }\n ),\n ]\n\n return {\n stop: () => {\n listeners.forEach((listener) => listener.stop())\n },\n }\n}\n\nfunction isSelectionEmpty(): boolean {\n const selection = window.getSelection()\n return !selection || selection.isCollapsed\n}\n\nfunction isValidPointerEvent(event: PointerEvent): event is MouseEventOnElement {\n return (\n event.target instanceof Element &&\n // Only consider 'primary' pointer events for now. Multi-touch support could be implemented in\n // the future.\n event.isPrimary !== false\n )\n}\n"],"mappings":";;AAmBA,SAAgB,mBAAiC,EAAE,eAAe,eAAgD;CAChH,IAAI;CACJ,IAAI,eAA6B;EAC/B,WAAW;EACX,OAAO;EACP,QAAQ;CACV;CACA,IAAI;CAEJ,MAAM,YAAY;EAChB,iBACE,QACA,UAAU,eACT,UAAwB;GACvB,IAAI,oBAAoB,KAAK,GAAG;IAC9B,8BAA8B,iBAAiB;IAC/C,eAAe;KACb,WAAW;KACX,OAAO;KACP,QAAQ;IACV;IACA,eAAe,cAAc,KAAK;GACpC;EACF,GACA,EAAE,SAAS,KAAK,CAClB;EAEA,iBACE,QACA,UAAU,wBACJ;GACJ,IAAI,CAAC,+BAA+B,CAAC,iBAAiB,GACpD,aAAa,YAAY;EAE7B,GACA,EAAE,SAAS,KAAK,CAClB;EAEA,iBACE,QACA,UAAU,cACJ;GACJ,aAAa,SAAS;EACxB,GACA;GAAE,SAAS;GAAM,SAAS;EAAK,CACjC;EAEA,iBACE,QACA,UAAU,aACT,UAAwB;GACvB,IAAI,oBAAoB,KAAK,KAAK,cAAc;IAE9C,MAAM,oBAAoB;IAC1B,YAAY,cAAc,aAAa,iBAAiB;IACxD,eAAe,KAAA;GACjB;EACF,GACA,EAAE,SAAS,KAAK,CAClB;EAEA,iBACE,QACA,UAAU,aACJ;GACJ,aAAa,QAAQ;EACvB,GACA,EAAE,SAAS,KAAK,CAClB;CACF;CAEA,OAAO,EACL,YAAY;EACV,UAAU,SAAS,aAAa,SAAS,KAAK,CAAC;CACjD,EACF;AACF;AAEA,SAAS,mBAA4B;CACnC,MAAM,YAAY,OAAO,aAAa;CACtC,OAAO,CAAC,aAAa,UAAU;AACjC;AAEA,SAAS,oBAAoB,OAAmD;CAC9E,OACE,MAAM,kBAAkB,WAGxB,MAAM,cAAc;AAExB"}
|