@kubesense/kubesense-browser-rum-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/preStartRum.d.ts +7 -0
- package/cjs/boot/preStartRum.js +190 -0
- package/cjs/boot/preStartRum.js.map +1 -0
- package/cjs/boot/rumPublicApi.d.ts +409 -0
- package/cjs/boot/rumPublicApi.js +168 -0
- package/cjs/boot/rumPublicApi.js.map +1 -0
- package/cjs/boot/startRum.d.ts +109 -0
- package/cjs/boot/startRum.js +153 -0
- package/cjs/boot/startRum.js.map +1 -0
- package/cjs/browser/cookieObservable.d.ts +8 -0
- package/cjs/browser/cookieObservable.js +39 -0
- package/cjs/browser/cookieObservable.js.map +1 -0
- package/cjs/browser/domMutationObservable.d.ts +27 -0
- package/cjs/browser/domMutationObservable.js +58 -0
- package/cjs/browser/domMutationObservable.js.map +1 -0
- package/cjs/browser/firstInputPolyfill.d.ts +8 -0
- package/cjs/browser/firstInputPolyfill.js +68 -0
- package/cjs/browser/firstInputPolyfill.js.map +1 -0
- package/cjs/browser/htmlDomUtils.d.ts +13 -0
- package/cjs/browser/htmlDomUtils.js +46 -0
- package/cjs/browser/htmlDomUtils.js.map +1 -0
- package/cjs/browser/locationChangeObservable.d.ts +7 -0
- package/cjs/browser/locationChangeObservable.js +51 -0
- package/cjs/browser/locationChangeObservable.js.map +1 -0
- package/cjs/browser/performanceObservable.d.ts +174 -0
- package/cjs/browser/performanceObservable.js +126 -0
- package/cjs/browser/performanceObservable.js.map +1 -0
- package/cjs/browser/performanceUtils.d.ts +7 -0
- package/cjs/browser/performanceUtils.js +42 -0
- package/cjs/browser/performanceUtils.js.map +1 -0
- package/cjs/browser/scroll.d.ts +2 -0
- package/cjs/browser/scroll.js +33 -0
- package/cjs/browser/scroll.js.map +1 -0
- package/cjs/browser/viewportObservable.d.ts +10 -0
- package/cjs/browser/viewportObservable.js +37 -0
- package/cjs/browser/viewportObservable.js.map +1 -0
- package/cjs/browser/windowOpenObservable.d.ts +5 -0
- package/cjs/browser/windowOpenObservable.js +10 -0
- package/cjs/browser/windowOpenObservable.js.map +1 -0
- package/cjs/domain/action/actionCollection.d.ts +21 -0
- package/cjs/domain/action/actionCollection.js +96 -0
- package/cjs/domain/action/actionCollection.js.map +1 -0
- package/cjs/domain/action/actionNameConstants.d.ts +18 -0
- package/cjs/domain/action/actionNameConstants.js +11 -0
- package/cjs/domain/action/actionNameConstants.js.map +1 -0
- package/cjs/domain/action/clickChain.d.ts +8 -0
- package/cjs/domain/action/clickChain.js +61 -0
- package/cjs/domain/action/clickChain.js.map +1 -0
- package/cjs/domain/action/computeFrustration.d.ts +6 -0
- package/cjs/domain/action/computeFrustration.js +70 -0
- package/cjs/domain/action/computeFrustration.js.map +1 -0
- package/cjs/domain/action/getActionNameFromElement.d.ts +4 -0
- package/cjs/domain/action/getActionNameFromElement.js +239 -0
- package/cjs/domain/action/getActionNameFromElement.js.map +1 -0
- package/cjs/domain/action/interactionSelectorCache.d.ts +5 -0
- package/cjs/domain/action/interactionSelectorCache.js +23 -0
- package/cjs/domain/action/interactionSelectorCache.js.map +1 -0
- package/cjs/domain/action/listenActionEvents.d.ts +19 -0
- package/cjs/domain/action/listenActionEvents.js +61 -0
- package/cjs/domain/action/listenActionEvents.js.map +1 -0
- package/cjs/domain/action/trackClickActions.d.ts +81 -0
- package/cjs/domain/action/trackClickActions.js +237 -0
- package/cjs/domain/action/trackClickActions.js.map +1 -0
- package/cjs/domain/assembly.d.ts +5 -0
- package/cjs/domain/assembly.js +102 -0
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +325 -0
- package/cjs/domain/configuration/configuration.js +205 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +2 -0
- package/cjs/domain/configuration/index.js +19 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/jsonPathParser.d.ts +28 -0
- package/cjs/domain/configuration/jsonPathParser.js +159 -0
- package/cjs/domain/configuration/jsonPathParser.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/cjs/domain/configuration/remoteConfiguration.js +243 -0
- package/cjs/domain/configuration/remoteConfiguration.js.map +1 -0
- package/cjs/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js +7 -0
- package/cjs/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/cjs/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/cjs/domain/contexts/ciVisibilityContext.js +34 -0
- package/cjs/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/cjs/domain/contexts/connectivityContext.d.ts +2 -0
- package/cjs/domain/contexts/connectivityContext.js +11 -0
- package/cjs/domain/contexts/connectivityContext.js.map +1 -0
- package/cjs/domain/contexts/defaultContext.d.ts +4 -0
- package/cjs/domain/contexts/defaultContext.js +34 -0
- package/cjs/domain/contexts/defaultContext.js.map +1 -0
- package/cjs/domain/contexts/displayContext.d.ts +6 -0
- package/cjs/domain/contexts/displayContext.js +28 -0
- package/cjs/domain/contexts/displayContext.js.map +1 -0
- package/cjs/domain/contexts/featureFlagContext.d.ts +19 -0
- package/cjs/domain/contexts/featureFlagContext.js +53 -0
- package/cjs/domain/contexts/featureFlagContext.js.map +1 -0
- package/cjs/domain/contexts/internalContext.d.ts +12 -0
- package/cjs/domain/contexts/internalContext.js +26 -0
- package/cjs/domain/contexts/internalContext.js.map +1 -0
- package/cjs/domain/contexts/pageStateHistory.d.ts +23 -0
- package/cjs/domain/contexts/pageStateHistory.js +104 -0
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
- package/cjs/domain/contexts/sessionContext.d.ts +5 -0
- package/cjs/domain/contexts/sessionContext.js +47 -0
- package/cjs/domain/contexts/sessionContext.js.map +1 -0
- package/cjs/domain/contexts/syntheticsContext.d.ts +2 -0
- package/cjs/domain/contexts/syntheticsContext.js +25 -0
- package/cjs/domain/contexts/syntheticsContext.js.map +1 -0
- package/cjs/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/cjs/domain/contexts/trackingConsentContext.js +14 -0
- package/cjs/domain/contexts/trackingConsentContext.js.map +1 -0
- package/cjs/domain/contexts/urlContexts.d.ts +22 -0
- package/cjs/domain/contexts/urlContexts.js +64 -0
- package/cjs/domain/contexts/urlContexts.js.map +1 -0
- package/cjs/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/cjs/domain/contexts/userAgentDataContext.js +31 -0
- package/cjs/domain/contexts/userAgentDataContext.js.map +1 -0
- package/cjs/domain/contexts/viewHistory.d.ts +17 -0
- package/cjs/domain/contexts/viewHistory.js +48 -0
- package/cjs/domain/contexts/viewHistory.js.map +1 -0
- package/cjs/domain/discardNegativeDuration.d.ts +2 -0
- package/cjs/domain/discardNegativeDuration.js +8 -0
- package/cjs/domain/discardNegativeDuration.js.map +1 -0
- package/cjs/domain/error/errorCollection.d.ts +17 -0
- package/cjs/domain/error/errorCollection.js +74 -0
- package/cjs/domain/error/errorCollection.js.map +1 -0
- package/cjs/domain/error/trackConsoleError.d.ts +4 -0
- package/cjs/domain/error/trackConsoleError.js +13 -0
- package/cjs/domain/error/trackConsoleError.js.map +1 -0
- package/cjs/domain/error/trackReportError.d.ts +5 -0
- package/cjs/domain/error/trackReportError.js +16 -0
- package/cjs/domain/error/trackReportError.js.map +1 -0
- package/cjs/domain/event/eventCollection.d.ts +10 -0
- package/cjs/domain/event/eventCollection.js +27 -0
- package/cjs/domain/event/eventCollection.js.map +1 -0
- package/cjs/domain/getSelectorFromElement.d.ts +64 -0
- package/cjs/domain/getSelectorFromElement.js +218 -0
- package/cjs/domain/getSelectorFromElement.js.map +1 -0
- package/cjs/domain/getSessionReplayUrl.d.ts +9 -0
- package/cjs/domain/getSessionReplayUrl.js +34 -0
- package/cjs/domain/getSessionReplayUrl.js.map +1 -0
- package/cjs/domain/hooks.d.ts +23 -0
- package/cjs/domain/hooks.js +6 -0
- package/cjs/domain/hooks.js.map +1 -0
- package/cjs/domain/lifeCycle.d.ts +73 -0
- package/cjs/domain/lifeCycle.js +6 -0
- package/cjs/domain/lifeCycle.js.map +1 -0
- package/cjs/domain/limitModification.d.ts +8 -0
- package/cjs/domain/limitModification.js +46 -0
- package/cjs/domain/limitModification.js.map +1 -0
- package/cjs/domain/longTask/longTaskCollection.d.ts +18 -0
- package/cjs/domain/longTask/longTaskCollection.js +91 -0
- package/cjs/domain/longTask/longTaskCollection.js.map +1 -0
- package/cjs/domain/plugins.d.ts +40 -0
- package/cjs/domain/plugins.js +15 -0
- package/cjs/domain/plugins.js.map +1 -0
- package/cjs/domain/privacy.d.ts +44 -0
- package/cjs/domain/privacy.js +313 -0
- package/cjs/domain/privacy.js.map +1 -0
- package/cjs/domain/privacyConstants.d.ts +23 -0
- package/cjs/domain/privacyConstants.js +39 -0
- package/cjs/domain/privacyConstants.js.map +1 -0
- package/cjs/domain/requestCollection.d.ts +54 -0
- package/cjs/domain/requestCollection.js +111 -0
- package/cjs/domain/requestCollection.js.map +1 -0
- package/cjs/domain/resource/graphql.d.ts +23 -0
- package/cjs/domain/resource/graphql.js +97 -0
- package/cjs/domain/resource/graphql.js.map +1 -0
- package/cjs/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js +49 -0
- package/cjs/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/cjs/domain/resource/requestRegistry.d.ts +9 -0
- package/cjs/domain/resource/requestRegistry.js +41 -0
- package/cjs/domain/resource/requestRegistry.js.map +1 -0
- package/cjs/domain/resource/resourceCollection.d.ts +7 -0
- package/cjs/domain/resource/resourceCollection.js +190 -0
- package/cjs/domain/resource/resourceCollection.js.map +1 -0
- package/cjs/domain/resource/resourceUtils.d.ts +55 -0
- package/cjs/domain/resource/resourceUtils.js +259 -0
- package/cjs/domain/resource/resourceUtils.js.map +1 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js +24 -0
- package/cjs/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/cjs/domain/rumSessionManager.d.ts +36 -0
- package/cjs/domain/rumSessionManager.js +77 -0
- package/cjs/domain/rumSessionManager.js.map +1 -0
- package/cjs/domain/sampler/sampler.d.ts +10 -0
- package/cjs/domain/sampler/sampler.js +63 -0
- package/cjs/domain/sampler/sampler.js.map +1 -0
- package/cjs/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/cjs/domain/startCustomerDataTelemetry.js +56 -0
- package/cjs/domain/startCustomerDataTelemetry.js.map +1 -0
- package/cjs/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/cjs/domain/tracing/getDocumentTraceId.js +76 -0
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/cjs/domain/tracing/identifier.d.ts +13 -0
- package/cjs/domain/tracing/identifier.js +55 -0
- package/cjs/domain/tracing/identifier.js.map +1 -0
- package/cjs/domain/tracing/sampler.d.ts +10 -0
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/tracer.d.ts +30 -0
- package/cjs/domain/tracing/tracer.js +161 -0
- package/cjs/domain/tracing/tracer.js.map +1 -0
- package/cjs/domain/tracing/tracer.types.d.ts +12 -0
- package/cjs/domain/tracing/tracer.types.js +3 -0
- package/cjs/domain/tracing/tracer.types.js.map +1 -0
- package/cjs/domain/trackEventCounts.d.ts +17 -0
- package/cjs/domain/trackEventCounts.js +50 -0
- package/cjs/domain/trackEventCounts.js.map +1 -0
- package/cjs/domain/view/bfCacheSupport.d.ts +2 -0
- package/cjs/domain/view/bfCacheSupport.js +13 -0
- package/cjs/domain/view/bfCacheSupport.js.map +1 -0
- package/cjs/domain/view/trackViewEventCounts.d.ts +5 -0
- package/cjs/domain/view/trackViewEventCounts.js +16 -0
- package/cjs/domain/view/trackViewEventCounts.js.map +1 -0
- package/cjs/domain/view/trackViews.d.ts +65 -0
- package/cjs/domain/view/trackViews.js +275 -0
- package/cjs/domain/view/trackViews.js.map +1 -0
- package/cjs/domain/view/viewCollection.d.ts +18 -0
- package/cjs/domain/view/viewCollection.js +153 -0
- package/cjs/domain/view/viewCollection.js.map +1 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js +32 -0
- package/cjs/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js +44 -0
- package/cjs/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +44 -0
- package/cjs/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js +17 -0
- package/cjs/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js +37 -0
- package/cjs/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js +135 -0
- package/cjs/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js +39 -0
- package/cjs/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js +33 -0
- package/cjs/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js +43 -0
- package/cjs/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js +41 -0
- package/cjs/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js +155 -0
- package/cjs/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js +61 -0
- package/cjs/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js +50 -0
- package/cjs/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js +43 -0
- package/cjs/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js +78 -0
- package/cjs/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/cjs/domain/vital/vitalCollection.d.ts +55 -0
- package/cjs/domain/vital/vitalCollection.js +113 -0
- package/cjs/domain/vital/vitalCollection.js.map +1 -0
- package/cjs/domain/waitPageActivityEnd.d.ts +54 -0
- package/cjs/domain/waitPageActivityEnd.js +129 -0
- package/cjs/domain/waitPageActivityEnd.js.map +1 -0
- package/cjs/domainContext.types.d.ts +39 -0
- package/cjs/domainContext.types.js +6 -0
- package/cjs/domainContext.types.js.map +1 -0
- package/cjs/index.d.ts +41 -0
- package/cjs/index.js +59 -0
- package/cjs/index.js.map +1 -0
- package/cjs/rawRumEvent.types.d.ts +326 -0
- package/cjs/rawRumEvent.types.js +34 -0
- package/cjs/rawRumEvent.types.js.map +1 -0
- package/cjs/rumEvent.types.d.ts +2026 -0
- package/cjs/rumEvent.types.js +7 -0
- package/cjs/rumEvent.types.js.map +1 -0
- package/cjs/transport/formDataTransport.d.ts +16 -0
- package/cjs/transport/formDataTransport.js +46 -0
- package/cjs/transport/formDataTransport.js.map +1 -0
- package/cjs/transport/startRumBatch.d.ts +5 -0
- package/cjs/transport/startRumBatch.js +33 -0
- package/cjs/transport/startRumBatch.js.map +1 -0
- package/cjs/transport/startRumEventBridge.d.ts +2 -0
- package/cjs/transport/startRumEventBridge.js +11 -0
- package/cjs/transport/startRumEventBridge.js.map +1 -0
- package/esm/boot/preStartRum.d.ts +7 -0
- package/esm/boot/preStartRum.js +187 -0
- package/esm/boot/preStartRum.js.map +1 -0
- package/esm/boot/rumPublicApi.d.ts +409 -0
- package/esm/boot/rumPublicApi.js +165 -0
- package/esm/boot/rumPublicApi.js.map +1 -0
- package/esm/boot/startRum.d.ts +109 -0
- package/esm/boot/startRum.js +149 -0
- package/esm/boot/startRum.js.map +1 -0
- package/esm/browser/cookieObservable.d.ts +8 -0
- package/esm/browser/cookieObservable.js +35 -0
- package/esm/browser/cookieObservable.js.map +1 -0
- package/esm/browser/domMutationObservable.d.ts +27 -0
- package/esm/browser/domMutationObservable.js +54 -0
- package/esm/browser/domMutationObservable.js.map +1 -0
- package/esm/browser/firstInputPolyfill.d.ts +8 -0
- package/esm/browser/firstInputPolyfill.js +65 -0
- package/esm/browser/firstInputPolyfill.js.map +1 -0
- package/esm/browser/htmlDomUtils.d.ts +13 -0
- package/esm/browser/htmlDomUtils.js +36 -0
- package/esm/browser/htmlDomUtils.js.map +1 -0
- package/esm/browser/locationChangeObservable.d.ts +7 -0
- package/esm/browser/locationChangeObservable.js +48 -0
- package/esm/browser/locationChangeObservable.js.map +1 -0
- package/esm/browser/performanceObservable.d.ts +174 -0
- package/esm/browser/performanceObservable.js +121 -0
- package/esm/browser/performanceObservable.js.map +1 -0
- package/esm/browser/performanceUtils.d.ts +7 -0
- package/esm/browser/performanceUtils.js +38 -0
- package/esm/browser/performanceUtils.js.map +1 -0
- package/esm/browser/scroll.d.ts +2 -0
- package/esm/browser/scroll.js +29 -0
- package/esm/browser/scroll.js.map +1 -0
- package/esm/browser/viewportObservable.d.ts +10 -0
- package/esm/browser/viewportObservable.js +32 -0
- package/esm/browser/viewportObservable.js.map +1 -0
- package/esm/browser/windowOpenObservable.d.ts +5 -0
- package/esm/browser/windowOpenObservable.js +7 -0
- package/esm/browser/windowOpenObservable.js.map +1 -0
- package/esm/domain/action/actionCollection.d.ts +21 -0
- package/esm/domain/action/actionCollection.js +93 -0
- package/esm/domain/action/actionCollection.js.map +1 -0
- package/esm/domain/action/actionNameConstants.d.ts +18 -0
- package/esm/domain/action/actionNameConstants.js +8 -0
- package/esm/domain/action/actionNameConstants.js.map +1 -0
- package/esm/domain/action/clickChain.d.ts +8 -0
- package/esm/domain/action/clickChain.js +57 -0
- package/esm/domain/action/clickChain.js.map +1 -0
- package/esm/domain/action/computeFrustration.d.ts +6 -0
- package/esm/domain/action/computeFrustration.js +65 -0
- package/esm/domain/action/computeFrustration.js.map +1 -0
- package/esm/domain/action/getActionNameFromElement.d.ts +4 -0
- package/esm/domain/action/getActionNameFromElement.js +236 -0
- package/esm/domain/action/getActionNameFromElement.js.map +1 -0
- package/esm/domain/action/interactionSelectorCache.d.ts +5 -0
- package/esm/domain/action/interactionSelectorCache.js +18 -0
- package/esm/domain/action/interactionSelectorCache.js.map +1 -0
- package/esm/domain/action/listenActionEvents.d.ts +19 -0
- package/esm/domain/action/listenActionEvents.js +58 -0
- package/esm/domain/action/listenActionEvents.js.map +1 -0
- package/esm/domain/action/trackClickActions.d.ts +81 -0
- package/esm/domain/action/trackClickActions.js +232 -0
- package/esm/domain/action/trackClickActions.js.map +1 -0
- package/esm/domain/assembly.d.ts +5 -0
- package/esm/domain/assembly.js +99 -0
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +325 -0
- package/esm/domain/configuration/configuration.js +200 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +2 -0
- package/esm/domain/configuration/index.js +3 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/jsonPathParser.d.ts +28 -0
- package/esm/domain/configuration/jsonPathParser.js +156 -0
- package/esm/domain/configuration/jsonPathParser.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.d.ts +39 -0
- package/esm/domain/configuration/remoteConfiguration.js +236 -0
- package/esm/domain/configuration/remoteConfiguration.js.map +1 -0
- package/esm/domain/configuration/remoteConfiguration.types.d.ts +138 -0
- package/esm/domain/configuration/remoteConfiguration.types.js +6 -0
- package/esm/domain/configuration/remoteConfiguration.types.js.map +1 -0
- package/esm/domain/contexts/ciVisibilityContext.d.ts +12 -0
- package/esm/domain/contexts/ciVisibilityContext.js +30 -0
- package/esm/domain/contexts/ciVisibilityContext.js.map +1 -0
- package/esm/domain/contexts/connectivityContext.d.ts +2 -0
- package/esm/domain/contexts/connectivityContext.js +8 -0
- package/esm/domain/contexts/connectivityContext.js.map +1 -0
- package/esm/domain/contexts/defaultContext.d.ts +4 -0
- package/esm/domain/contexts/defaultContext.js +31 -0
- package/esm/domain/contexts/defaultContext.js.map +1 -0
- package/esm/domain/contexts/displayContext.d.ts +6 -0
- package/esm/domain/contexts/displayContext.js +25 -0
- package/esm/domain/contexts/displayContext.js.map +1 -0
- package/esm/domain/contexts/featureFlagContext.d.ts +19 -0
- package/esm/domain/contexts/featureFlagContext.js +49 -0
- package/esm/domain/contexts/featureFlagContext.js.map +1 -0
- package/esm/domain/contexts/internalContext.d.ts +12 -0
- package/esm/domain/contexts/internalContext.js +23 -0
- package/esm/domain/contexts/internalContext.js.map +1 -0
- package/esm/domain/contexts/pageStateHistory.d.ts +23 -0
- package/esm/domain/contexts/pageStateHistory.js +100 -0
- package/esm/domain/contexts/pageStateHistory.js.map +1 -0
- package/esm/domain/contexts/sessionContext.d.ts +5 -0
- package/esm/domain/contexts/sessionContext.js +44 -0
- package/esm/domain/contexts/sessionContext.js.map +1 -0
- package/esm/domain/contexts/syntheticsContext.d.ts +2 -0
- package/esm/domain/contexts/syntheticsContext.js +22 -0
- package/esm/domain/contexts/syntheticsContext.js.map +1 -0
- package/esm/domain/contexts/trackingConsentContext.d.ts +3 -0
- package/esm/domain/contexts/trackingConsentContext.js +11 -0
- package/esm/domain/contexts/trackingConsentContext.js.map +1 -0
- package/esm/domain/contexts/urlContexts.d.ts +22 -0
- package/esm/domain/contexts/urlContexts.js +60 -0
- package/esm/domain/contexts/urlContexts.js.map +1 -0
- package/esm/domain/contexts/userAgentDataContext.d.ts +2 -0
- package/esm/domain/contexts/userAgentDataContext.js +28 -0
- package/esm/domain/contexts/userAgentDataContext.js.map +1 -0
- package/esm/domain/contexts/viewHistory.d.ts +17 -0
- package/esm/domain/contexts/viewHistory.js +44 -0
- package/esm/domain/contexts/viewHistory.js.map +1 -0
- package/esm/domain/discardNegativeDuration.d.ts +2 -0
- package/esm/domain/discardNegativeDuration.js +5 -0
- package/esm/domain/discardNegativeDuration.js.map +1 -0
- package/esm/domain/error/errorCollection.d.ts +17 -0
- package/esm/domain/error/errorCollection.js +70 -0
- package/esm/domain/error/errorCollection.js.map +1 -0
- package/esm/domain/error/trackConsoleError.d.ts +4 -0
- package/esm/domain/error/trackConsoleError.js +10 -0
- package/esm/domain/error/trackConsoleError.js.map +1 -0
- package/esm/domain/error/trackReportError.d.ts +5 -0
- package/esm/domain/error/trackReportError.js +13 -0
- package/esm/domain/error/trackReportError.js.map +1 -0
- package/esm/domain/event/eventCollection.d.ts +10 -0
- package/esm/domain/event/eventCollection.js +24 -0
- package/esm/domain/event/eventCollection.js.map +1 -0
- package/esm/domain/getSelectorFromElement.d.ts +64 -0
- package/esm/domain/getSelectorFromElement.js +213 -0
- package/esm/domain/getSelectorFromElement.js.map +1 -0
- package/esm/domain/getSessionReplayUrl.d.ts +9 -0
- package/esm/domain/getSessionReplayUrl.js +30 -0
- package/esm/domain/getSessionReplayUrl.js.map +1 -0
- package/esm/domain/hooks.d.ts +23 -0
- package/esm/domain/hooks.js +3 -0
- package/esm/domain/hooks.js.map +1 -0
- package/esm/domain/lifeCycle.d.ts +73 -0
- package/esm/domain/lifeCycle.js +3 -0
- package/esm/domain/lifeCycle.js.map +1 -0
- package/esm/domain/limitModification.d.ts +8 -0
- package/esm/domain/limitModification.js +43 -0
- package/esm/domain/limitModification.js.map +1 -0
- package/esm/domain/longTask/longTaskCollection.d.ts +18 -0
- package/esm/domain/longTask/longTaskCollection.js +87 -0
- package/esm/domain/longTask/longTaskCollection.js.map +1 -0
- package/esm/domain/plugins.d.ts +40 -0
- package/esm/domain/plugins.js +12 -0
- package/esm/domain/plugins.js.map +1 -0
- package/esm/domain/privacy.d.ts +44 -0
- package/esm/domain/privacy.js +302 -0
- package/esm/domain/privacy.js.map +1 -0
- package/esm/domain/privacyConstants.d.ts +23 -0
- package/esm/domain/privacyConstants.js +35 -0
- package/esm/domain/privacyConstants.js.map +1 -0
- package/esm/domain/requestCollection.d.ts +54 -0
- package/esm/domain/requestCollection.js +106 -0
- package/esm/domain/requestCollection.js.map +1 -0
- package/esm/domain/resource/graphql.d.ts +23 -0
- package/esm/domain/resource/graphql.js +91 -0
- package/esm/domain/resource/graphql.js.map +1 -0
- package/esm/domain/resource/matchRequestResourceEntry.d.ts +16 -0
- package/esm/domain/resource/matchRequestResourceEntry.js +46 -0
- package/esm/domain/resource/matchRequestResourceEntry.js.map +1 -0
- package/esm/domain/resource/requestRegistry.d.ts +9 -0
- package/esm/domain/resource/requestRegistry.js +37 -0
- package/esm/domain/resource/requestRegistry.js.map +1 -0
- package/esm/domain/resource/resourceCollection.d.ts +7 -0
- package/esm/domain/resource/resourceCollection.js +187 -0
- package/esm/domain/resource/resourceCollection.js.map +1 -0
- package/esm/domain/resource/resourceUtils.d.ts +55 -0
- package/esm/domain/resource/resourceUtils.js +244 -0
- package/esm/domain/resource/resourceUtils.js.map +1 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.d.ts +4 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js +21 -0
- package/esm/domain/resource/retrieveInitialDocumentResourceTiming.js.map +1 -0
- package/esm/domain/rumSessionManager.d.ts +36 -0
- package/esm/domain/rumSessionManager.js +72 -0
- package/esm/domain/rumSessionManager.js.map +1 -0
- package/esm/domain/sampler/sampler.d.ts +10 -0
- package/esm/domain/sampler/sampler.js +58 -0
- package/esm/domain/sampler/sampler.js.map +1 -0
- package/esm/domain/startCustomerDataTelemetry.d.ts +4 -0
- package/esm/domain/startCustomerDataTelemetry.js +52 -0
- package/esm/domain/startCustomerDataTelemetry.js.map +1 -0
- package/esm/domain/tracing/getDocumentTraceId.d.ts +12 -0
- package/esm/domain/tracing/getDocumentTraceId.js +68 -0
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
- package/esm/domain/tracing/identifier.d.ts +13 -0
- package/esm/domain/tracing/identifier.js +50 -0
- package/esm/domain/tracing/identifier.js.map +1 -0
- package/esm/domain/tracing/sampler.d.ts +10 -0
- package/esm/domain/tracing/sampler.js +64 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/tracer.d.ts +30 -0
- package/esm/domain/tracing/tracer.js +156 -0
- package/esm/domain/tracing/tracer.js.map +1 -0
- package/esm/domain/tracing/tracer.types.d.ts +12 -0
- package/esm/domain/tracing/tracer.types.js +2 -0
- package/esm/domain/tracing/tracer.types.js.map +1 -0
- package/esm/domain/trackEventCounts.d.ts +17 -0
- package/esm/domain/trackEventCounts.js +47 -0
- package/esm/domain/trackEventCounts.js.map +1 -0
- package/esm/domain/view/bfCacheSupport.d.ts +2 -0
- package/esm/domain/view/bfCacheSupport.js +10 -0
- package/esm/domain/view/bfCacheSupport.js.map +1 -0
- package/esm/domain/view/trackViewEventCounts.d.ts +5 -0
- package/esm/domain/view/trackViewEventCounts.js +13 -0
- package/esm/domain/view/trackViewEventCounts.js.map +1 -0
- package/esm/domain/view/trackViews.d.ts +65 -0
- package/esm/domain/view/trackViews.js +271 -0
- package/esm/domain/view/trackViews.js.map +1 -0
- package/esm/domain/view/viewCollection.d.ts +18 -0
- package/esm/domain/view/viewCollection.js +150 -0
- package/esm/domain/view/viewCollection.js.map +1 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.d.ts +6 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js +28 -0
- package/esm/domain/view/viewMetrics/getClsAttributionImpactedArea.js.map +1 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.d.ts +18 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js +39 -0
- package/esm/domain/view/viewMetrics/interactionCountPolyfill.js.map +1 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.d.ts +6 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js +41 -0
- package/esm/domain/view/viewMetrics/startInitialViewMetricsTelemetry.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.d.ts +8 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js +14 -0
- package/esm/domain/view/viewMetrics/trackBfcacheMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.d.ts +21 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js +34 -0
- package/esm/domain/view/viewMetrics/trackCommonViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.d.ts +37 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js +130 -0
- package/esm/domain/view/viewMetrics/trackCumulativeLayoutShift.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.d.ts +13 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js +34 -0
- package/esm/domain/view/viewMetrics/trackFirstContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.d.ts +10 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js +30 -0
- package/esm/domain/view/viewMetrics/trackFirstHidden.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.d.ts +19 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js +40 -0
- package/esm/domain/view/viewMetrics/trackFirstInput.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.d.ts +15 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js +38 -0
- package/esm/domain/view/viewMetrics/trackInitialViewMetrics.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js +149 -0
- package/esm/domain/view/viewMetrics/trackInteractionToNextPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.d.ts +18 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js +57 -0
- package/esm/domain/view/viewMetrics/trackLargestContentfulPaint.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js +47 -0
- package/esm/domain/view/viewMetrics/trackLoadingTime.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.d.ts +14 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js +40 -0
- package/esm/domain/view/viewMetrics/trackNavigationTimings.js.map +1 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.d.ts +25 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js +72 -0
- package/esm/domain/view/viewMetrics/trackScrollMetrics.js.map +1 -0
- package/esm/domain/vital/vitalCollection.d.ts +55 -0
- package/esm/domain/vital/vitalCollection.js +107 -0
- package/esm/domain/vital/vitalCollection.js.map +1 -0
- package/esm/domain/waitPageActivityEnd.d.ts +54 -0
- package/esm/domain/waitPageActivityEnd.js +123 -0
- package/esm/domain/waitPageActivityEnd.js.map +1 -0
- package/esm/domainContext.types.d.ts +39 -0
- package/esm/domainContext.types.js +5 -0
- package/esm/domainContext.types.js.map +1 -0
- package/esm/index.d.ts +41 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/rawRumEvent.types.d.ts +326 -0
- package/esm/rawRumEvent.types.js +31 -0
- package/esm/rawRumEvent.types.js.map +1 -0
- package/esm/rumEvent.types.d.ts +2026 -0
- package/esm/rumEvent.types.js +6 -0
- package/esm/rumEvent.types.js.map +1 -0
- package/esm/transport/formDataTransport.d.ts +16 -0
- package/esm/transport/formDataTransport.js +43 -0
- package/esm/transport/formDataTransport.js.map +1 -0
- package/esm/transport/startRumBatch.d.ts +5 -0
- package/esm/transport/startRumBatch.js +30 -0
- package/esm/transport/startRumBatch.js.map +1 -0
- package/esm/transport/startRumEventBridge.d.ts +2 -0
- package/esm/transport/startRumEventBridge.js +8 -0
- package/esm/transport/startRumEventBridge.js.map +1 -0
- package/package.json +29 -0
- package/src/boot/preStartRum.ts +298 -0
- package/src/boot/rumPublicApi.ts +830 -0
- package/src/boot/startRum.ts +280 -0
- package/src/browser/cookieObservable.ts +63 -0
- package/src/browser/domMutationObservable.ts +98 -0
- package/src/browser/firstInputPolyfill.ts +87 -0
- package/src/browser/htmlDomUtils.ts +45 -0
- package/src/browser/locationChangeObservable.ts +69 -0
- package/src/browser/performanceObservable.ts +324 -0
- package/src/browser/performanceUtils.ts +50 -0
- package/src/browser/scroll.ts +25 -0
- package/src/browser/viewportObservable.ts +44 -0
- package/src/browser/windowOpenObservable.ts +7 -0
- package/src/domain/action/actionCollection.ts +146 -0
- package/src/domain/action/actionNameConstants.ts +20 -0
- package/src/domain/action/clickChain.ts +83 -0
- package/src/domain/action/computeFrustration.ts +77 -0
- package/src/domain/action/getActionNameFromElement.ts +337 -0
- package/src/domain/action/interactionSelectorCache.ts +21 -0
- package/src/domain/action/listenActionEvents.ts +119 -0
- package/src/domain/action/trackClickActions.ts +388 -0
- package/src/domain/assembly.ts +141 -0
- package/src/domain/configuration/configuration.ts +548 -0
- package/src/domain/configuration/index.ts +2 -0
- package/src/domain/configuration/jsonPathParser.ts +214 -0
- package/src/domain/configuration/remoteConfiguration.ts +304 -0
- package/src/domain/configuration/remoteConfiguration.types.ts +147 -0
- package/src/domain/contexts/ciVisibilityContext.ts +50 -0
- package/src/domain/contexts/connectivityContext.ts +12 -0
- package/src/domain/contexts/defaultContext.ts +43 -0
- package/src/domain/contexts/displayContext.ts +38 -0
- package/src/domain/contexts/featureFlagContext.ts +71 -0
- package/src/domain/contexts/internalContext.ts +34 -0
- package/src/domain/contexts/pageStateHistory.ts +171 -0
- package/src/domain/contexts/sessionContext.ts +59 -0
- package/src/domain/contexts/syntheticsContext.ts +33 -0
- package/src/domain/contexts/trackingConsentContext.ts +15 -0
- package/src/domain/contexts/urlContexts.ts +97 -0
- package/src/domain/contexts/userAgentDataContext.ts +36 -0
- package/src/domain/contexts/viewHistory.ts +70 -0
- package/src/domain/discardNegativeDuration.ts +6 -0
- package/src/domain/error/errorCollection.ts +107 -0
- package/src/domain/error/trackConsoleError.ts +14 -0
- package/src/domain/error/trackReportError.ts +16 -0
- package/src/domain/event/eventCollection.ts +53 -0
- package/src/domain/getSelectorFromElement.ts +268 -0
- package/src/domain/getSessionReplayUrl.ts +47 -0
- package/src/domain/hooks.ts +31 -0
- package/src/domain/lifeCycle.ts +103 -0
- package/src/domain/limitModification.ts +66 -0
- package/src/domain/longTask/longTaskCollection.ts +133 -0
- package/src/domain/plugins.ts +59 -0
- package/src/domain/privacy.ts +355 -0
- package/src/domain/privacyConstants.ts +43 -0
- package/src/domain/requestCollection.ts +179 -0
- package/src/domain/resource/graphql.ts +135 -0
- package/src/domain/resource/matchRequestResourceEntry.ts +68 -0
- package/src/domain/resource/requestRegistry.ts +52 -0
- package/src/domain/resource/resourceCollection.ts +273 -0
- package/src/domain/resource/resourceUtils.ts +355 -0
- package/src/domain/resource/retrieveInitialDocumentResourceTiming.ts +27 -0
- package/src/domain/rumSessionManager.ts +134 -0
- package/src/domain/sampler/sampler.ts +63 -0
- package/src/domain/startCustomerDataTelemetry.ts +83 -0
- package/src/domain/tracing/getDocumentTraceId.ts +90 -0
- package/src/domain/tracing/identifier.ts +69 -0
- package/src/domain/tracing/sampler.ts +69 -0
- package/src/domain/tracing/tracer.ts +248 -0
- package/src/domain/tracing/tracer.types.ts +13 -0
- package/src/domain/trackEventCounts.ts +67 -0
- package/src/domain/view/bfCacheSupport.ts +20 -0
- package/src/domain/view/trackViewEventCounts.ts +15 -0
- package/src/domain/view/trackViews.ts +431 -0
- package/src/domain/view/viewCollection.ts +203 -0
- package/src/domain/view/viewMetrics/getClsAttributionImpactedArea.ts +34 -0
- package/src/domain/view/viewMetrics/interactionCountPolyfill.ts +55 -0
- package/src/domain/view/viewMetrics/startInitialViewMetricsTelemetry.ts +70 -0
- package/src/domain/view/viewMetrics/trackBfcacheMetrics.ts +20 -0
- package/src/domain/view/viewMetrics/trackCommonViewMetrics.ts +78 -0
- package/src/domain/view/viewMetrics/trackCumulativeLayoutShift.ts +180 -0
- package/src/domain/view/viewMetrics/trackFirstContentfulPaint.ts +47 -0
- package/src/domain/view/viewMetrics/trackFirstHidden.ts +53 -0
- package/src/domain/view/viewMetrics/trackFirstInput.ts +59 -0
- package/src/domain/view/viewMetrics/trackInitialViewMetrics.ts +66 -0
- package/src/domain/view/viewMetrics/trackInteractionToNextPaint.ts +193 -0
- package/src/domain/view/viewMetrics/trackLargestContentfulPaint.ts +87 -0
- package/src/domain/view/viewMetrics/trackLoadingTime.ts +69 -0
- package/src/domain/view/viewMetrics/trackNavigationTimings.ts +66 -0
- package/src/domain/view/viewMetrics/trackScrollMetrics.ts +119 -0
- package/src/domain/vital/vitalCollection.ts +207 -0
- package/src/domain/waitPageActivityEnd.ts +189 -0
- package/src/domainContext.types.ts +61 -0
- package/src/index.ts +76 -0
- package/src/rawRumEvent.types.ts +409 -0
- package/src/rumEvent.types.ts +2151 -0
- package/src/transport/formDataTransport.ts +85 -0
- package/src/transport/startRumBatch.ts +46 -0
- package/src/transport/startRumEventBridge.ts +12 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { RelativeTime, ClocksState, Context } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { SESSION_TIME_OUT_DELAY, createValueHistory } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { LifeCycle } from '../lifeCycle'
|
|
4
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
5
|
+
import type { BeforeViewUpdateEvent, ViewCreatedEvent } from '../view/trackViews'
|
|
6
|
+
|
|
7
|
+
export const VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY
|
|
8
|
+
|
|
9
|
+
export interface ViewHistoryEntry {
|
|
10
|
+
service?: string
|
|
11
|
+
version?: string
|
|
12
|
+
context?: Context | undefined
|
|
13
|
+
id: string
|
|
14
|
+
name?: string
|
|
15
|
+
startClocks: ClocksState
|
|
16
|
+
sessionIsActive?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ViewHistory {
|
|
20
|
+
findView: (startTime?: RelativeTime) => ViewHistoryEntry | undefined
|
|
21
|
+
stop: () => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function startViewHistory(lifeCycle: LifeCycle): ViewHistory {
|
|
25
|
+
const viewValueHistory = createValueHistory<ViewHistoryEntry>({ expireDelay: VIEW_CONTEXT_TIME_OUT_DELAY })
|
|
26
|
+
|
|
27
|
+
lifeCycle.subscribe(LifeCycleEventType.BEFORE_VIEW_CREATED, (view) => {
|
|
28
|
+
viewValueHistory.add(buildViewHistoryEntry(view), view.startClocks.relative)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
lifeCycle.subscribe(LifeCycleEventType.AFTER_VIEW_ENDED, ({ endClocks }) => {
|
|
32
|
+
viewValueHistory.closeActive(endClocks.relative)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
lifeCycle.subscribe(LifeCycleEventType.BEFORE_VIEW_UPDATED, (viewUpdate: BeforeViewUpdateEvent) => {
|
|
36
|
+
const currentView = viewValueHistory.find(viewUpdate.startClocks.relative)
|
|
37
|
+
if (!currentView) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (viewUpdate.name) {
|
|
41
|
+
currentView.name = viewUpdate.name
|
|
42
|
+
}
|
|
43
|
+
if (viewUpdate.context) {
|
|
44
|
+
currentView.context = viewUpdate.context
|
|
45
|
+
}
|
|
46
|
+
currentView.sessionIsActive = viewUpdate.sessionIsActive
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, () => {
|
|
50
|
+
viewValueHistory.reset()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
function buildViewHistoryEntry(view: ViewCreatedEvent) {
|
|
54
|
+
return {
|
|
55
|
+
service: view.service,
|
|
56
|
+
version: view.version,
|
|
57
|
+
context: view.context,
|
|
58
|
+
id: view.id,
|
|
59
|
+
name: view.name,
|
|
60
|
+
startClocks: view.startClocks,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
findView: (startTime) => viewValueHistory.find(startTime),
|
|
66
|
+
stop: () => {
|
|
67
|
+
viewValueHistory.stop()
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ServerDuration } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { isNumber } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
|
|
4
|
+
export function discardNegativeDuration(duration: ServerDuration | undefined): ServerDuration | undefined {
|
|
5
|
+
return isNumber(duration) && duration < 0 ? undefined : duration
|
|
6
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { Context, RawError, ClocksState, BufferedData } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import {
|
|
3
|
+
BufferedDataType,
|
|
4
|
+
Observable,
|
|
5
|
+
ErrorSource,
|
|
6
|
+
generateUUID,
|
|
7
|
+
computeRawError,
|
|
8
|
+
ErrorHandling,
|
|
9
|
+
NonErrorPrefix,
|
|
10
|
+
combine,
|
|
11
|
+
} from '@kubesense/kubesense-browser-core'
|
|
12
|
+
import type { RumConfiguration } from '../configuration'
|
|
13
|
+
import type { RawRumErrorEvent } from '../../rawRumEvent.types'
|
|
14
|
+
import { RumEventType } from '../../rawRumEvent.types'
|
|
15
|
+
import type { LifeCycle, RawRumEventCollectedData } from '../lifeCycle'
|
|
16
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
17
|
+
import type { RumErrorEventDomainContext } from '../../domainContext.types'
|
|
18
|
+
import { trackConsoleError } from './trackConsoleError'
|
|
19
|
+
import { trackReportError } from './trackReportError'
|
|
20
|
+
|
|
21
|
+
export interface ProvidedError {
|
|
22
|
+
startClocks: ClocksState
|
|
23
|
+
error: unknown
|
|
24
|
+
context?: Context
|
|
25
|
+
handlingStack: string
|
|
26
|
+
componentStack?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function startErrorCollection(
|
|
30
|
+
lifeCycle: LifeCycle,
|
|
31
|
+
configuration: RumConfiguration,
|
|
32
|
+
bufferedDataObservable: Observable<BufferedData>
|
|
33
|
+
) {
|
|
34
|
+
const errorObservable = new Observable<RawError>()
|
|
35
|
+
|
|
36
|
+
bufferedDataObservable.subscribe((bufferedData) => {
|
|
37
|
+
if (bufferedData.type === BufferedDataType.RUNTIME_ERROR) {
|
|
38
|
+
errorObservable.notify(bufferedData.error)
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
trackConsoleError(errorObservable)
|
|
43
|
+
trackReportError(configuration, errorObservable)
|
|
44
|
+
|
|
45
|
+
errorObservable.subscribe((error) => lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error }))
|
|
46
|
+
|
|
47
|
+
return doStartErrorCollection(lifeCycle)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function doStartErrorCollection(lifeCycle: LifeCycle) {
|
|
51
|
+
lifeCycle.subscribe(LifeCycleEventType.RAW_ERROR_COLLECTED, ({ error }) => {
|
|
52
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processError(error))
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
addError: ({ error, handlingStack, componentStack, startClocks, context }: ProvidedError) => {
|
|
57
|
+
const rawError = computeRawError({
|
|
58
|
+
originalError: error,
|
|
59
|
+
handlingStack,
|
|
60
|
+
componentStack,
|
|
61
|
+
startClocks,
|
|
62
|
+
nonErrorPrefix: NonErrorPrefix.PROVIDED,
|
|
63
|
+
source: ErrorSource.CUSTOM,
|
|
64
|
+
handling: ErrorHandling.HANDLED,
|
|
65
|
+
})
|
|
66
|
+
rawError.context = combine(rawError.context, context)
|
|
67
|
+
|
|
68
|
+
lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: rawError })
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function processError(error: RawError): RawRumEventCollectedData<RawRumErrorEvent> {
|
|
74
|
+
const rawRumEvent: RawRumErrorEvent = {
|
|
75
|
+
date: error.startClocks.timeStamp,
|
|
76
|
+
error: {
|
|
77
|
+
id: generateUUID(),
|
|
78
|
+
message: error.message,
|
|
79
|
+
source: error.source,
|
|
80
|
+
stack: error.stack,
|
|
81
|
+
handling_stack: error.handlingStack,
|
|
82
|
+
component_stack: error.componentStack,
|
|
83
|
+
type: error.type,
|
|
84
|
+
handling: error.handling,
|
|
85
|
+
causes: error.causes,
|
|
86
|
+
source_type: 'browser',
|
|
87
|
+
fingerprint: error.fingerprint,
|
|
88
|
+
csp: error.csp,
|
|
89
|
+
},
|
|
90
|
+
_kubesense: {
|
|
91
|
+
discarded: false,
|
|
92
|
+
},
|
|
93
|
+
type: RumEventType.ERROR,
|
|
94
|
+
context: error.context,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const domainContext: RumErrorEventDomainContext = {
|
|
98
|
+
error: error.originalError,
|
|
99
|
+
handlingStack: error.handlingStack,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
rawRumEvent,
|
|
104
|
+
startTime: error.startClocks.relative,
|
|
105
|
+
domainContext,
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Observable, RawError } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { initConsoleObservable, ConsoleApiName } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
|
|
4
|
+
export function trackConsoleError(errorObservable: Observable<RawError>) {
|
|
5
|
+
const subscription = initConsoleObservable([ConsoleApiName.error]).subscribe((consoleLog) =>
|
|
6
|
+
errorObservable.notify(consoleLog.error)
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
stop: () => {
|
|
11
|
+
subscription.unsubscribe()
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Observable, RawError } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import { initReportObservable, RawReportType } from '@kubesense/kubesense-browser-core'
|
|
3
|
+
import type { RumConfiguration } from '../configuration'
|
|
4
|
+
|
|
5
|
+
export function trackReportError(configuration: RumConfiguration, errorObservable: Observable<RawError>) {
|
|
6
|
+
const subscription = initReportObservable(configuration, [
|
|
7
|
+
RawReportType.cspViolation,
|
|
8
|
+
RawReportType.intervention,
|
|
9
|
+
]).subscribe((rawError) => errorObservable.notify(rawError))
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
stop: () => {
|
|
13
|
+
subscription.unsubscribe()
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Context, Duration, RelativeTime } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RumEventDomainContext } from '../../domainContext.types'
|
|
3
|
+
import type { LifeCycle } from '../lifeCycle'
|
|
4
|
+
import { LifeCycleEventType } from '../lifeCycle'
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
RawRumActionEvent,
|
|
8
|
+
RawRumErrorEvent,
|
|
9
|
+
RawRumLongAnimationFrameEvent,
|
|
10
|
+
RawRumLongTaskEvent,
|
|
11
|
+
RawRumResourceEvent,
|
|
12
|
+
RawRumVitalEvent,
|
|
13
|
+
} from '../../rawRumEvent.types'
|
|
14
|
+
import { RumEventType } from '../../rawRumEvent.types'
|
|
15
|
+
|
|
16
|
+
const allowedEventTypes = [
|
|
17
|
+
RumEventType.ACTION,
|
|
18
|
+
RumEventType.ERROR,
|
|
19
|
+
RumEventType.LONG_TASK,
|
|
20
|
+
RumEventType.RESOURCE,
|
|
21
|
+
RumEventType.VITAL,
|
|
22
|
+
] as const
|
|
23
|
+
|
|
24
|
+
export type AllowedRawRumEvent = (
|
|
25
|
+
| RawRumErrorEvent
|
|
26
|
+
| RawRumResourceEvent
|
|
27
|
+
| RawRumLongTaskEvent
|
|
28
|
+
| RawRumLongAnimationFrameEvent
|
|
29
|
+
| RawRumActionEvent
|
|
30
|
+
| RawRumVitalEvent
|
|
31
|
+
) & { context?: Context }
|
|
32
|
+
|
|
33
|
+
export function startEventCollection(lifeCycle: LifeCycle) {
|
|
34
|
+
return {
|
|
35
|
+
addEvent: (
|
|
36
|
+
startTime: RelativeTime,
|
|
37
|
+
event: AllowedRawRumEvent,
|
|
38
|
+
domainContext: RumEventDomainContext,
|
|
39
|
+
duration?: Duration
|
|
40
|
+
) => {
|
|
41
|
+
if (!allowedEventTypes.includes(event.type)) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
|
|
46
|
+
startTime,
|
|
47
|
+
rawRumEvent: event,
|
|
48
|
+
domainContext,
|
|
49
|
+
duration,
|
|
50
|
+
})
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './action/actionNameConstants'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Stable attributes are attributes that are commonly used to identify parts of a UI (ex:
|
|
5
|
+
* component). Those attribute values should not be generated randomly (hardcoded most of the time)
|
|
6
|
+
* and stay the same across deploys. They are not necessarily unique across the document.
|
|
7
|
+
*/
|
|
8
|
+
export const STABLE_ATTRIBUTES = [
|
|
9
|
+
DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,
|
|
10
|
+
// Common test attributes (list provided by google recorder)
|
|
11
|
+
'data-testid',
|
|
12
|
+
'data-test',
|
|
13
|
+
'data-qa',
|
|
14
|
+
'data-cy',
|
|
15
|
+
'data-test-id',
|
|
16
|
+
'data-qa-id',
|
|
17
|
+
'data-testing',
|
|
18
|
+
// FullStory decorator attributes:
|
|
19
|
+
'data-component',
|
|
20
|
+
'data-element',
|
|
21
|
+
'data-source-file',
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
type SelectorGetter = (element: Element, actionNameAttribute: string | undefined) => string | undefined
|
|
25
|
+
|
|
26
|
+
// Selectors to use if they target a single element on the whole document. Those selectors are
|
|
27
|
+
// considered as "stable" and uniquely identify an element regardless of the page state. If we find
|
|
28
|
+
// one, we should consider the selector "complete" and stop iterating over ancestors.
|
|
29
|
+
const GLOBALLY_UNIQUE_SELECTOR_GETTERS: SelectorGetter[] = [getStableAttributeSelector, getIDSelector]
|
|
30
|
+
|
|
31
|
+
// Selectors to use if they target a single element among an element descendants. Those selectors
|
|
32
|
+
// are more brittle than "globally unique" selectors and should be combined with ancestor selectors
|
|
33
|
+
// to improve specificity.
|
|
34
|
+
const UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS: SelectorGetter[] = [
|
|
35
|
+
getStableAttributeSelector,
|
|
36
|
+
getClassSelector,
|
|
37
|
+
getTagNameSelector,
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
export function getSelectorFromElement(
|
|
41
|
+
targetElement: Element,
|
|
42
|
+
actionNameAttribute: string | undefined
|
|
43
|
+
): string | undefined {
|
|
44
|
+
if (!targetElement.isConnected) {
|
|
45
|
+
// We cannot compute a selector for a detached element, as we don't have access to all of its
|
|
46
|
+
// parents, and we cannot determine if it's unique in the document.
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
let targetElementSelector: string | undefined
|
|
50
|
+
let currentElement: Element | null = targetElement
|
|
51
|
+
|
|
52
|
+
while (currentElement && currentElement.nodeName !== 'HTML') {
|
|
53
|
+
const globallyUniqueSelector = findSelector(
|
|
54
|
+
currentElement,
|
|
55
|
+
GLOBALLY_UNIQUE_SELECTOR_GETTERS,
|
|
56
|
+
isSelectorUniqueGlobally,
|
|
57
|
+
actionNameAttribute,
|
|
58
|
+
targetElementSelector
|
|
59
|
+
)
|
|
60
|
+
if (globallyUniqueSelector) {
|
|
61
|
+
return globallyUniqueSelector
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const uniqueSelectorAmongChildren = findSelector(
|
|
65
|
+
currentElement,
|
|
66
|
+
UNIQUE_AMONG_CHILDREN_SELECTOR_GETTERS,
|
|
67
|
+
isSelectorUniqueAmongSiblings,
|
|
68
|
+
actionNameAttribute,
|
|
69
|
+
targetElementSelector
|
|
70
|
+
)
|
|
71
|
+
targetElementSelector =
|
|
72
|
+
uniqueSelectorAmongChildren || combineSelector(getPositionSelector(currentElement), targetElementSelector)
|
|
73
|
+
|
|
74
|
+
currentElement = currentElement.parentElement
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return targetElementSelector
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isGeneratedValue(value: string) {
|
|
81
|
+
// To compute the "URL path group", the backend replaces every URL path parts as a question mark
|
|
82
|
+
// if it thinks the part is an identifier. The condition it uses is to checks whether a digit is
|
|
83
|
+
// present.
|
|
84
|
+
//
|
|
85
|
+
// Here, we use the same strategy: if the value contains a digit, we consider it generated. This
|
|
86
|
+
// strategy might be a bit naive and fail in some cases, but there are many fallbacks to generate
|
|
87
|
+
// CSS selectors so it should be fine most of the time.
|
|
88
|
+
return /[0-9]/.test(value)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getIDSelector(element: Element): string | undefined {
|
|
92
|
+
if (element.id && !isGeneratedValue(element.id)) {
|
|
93
|
+
return `#${CSS.escape(element.id)}`
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function getClassSelector(element: Element): string | undefined {
|
|
98
|
+
if (element.tagName === 'BODY') {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
const classList = element.classList
|
|
102
|
+
for (let i = 0; i < classList.length; i += 1) {
|
|
103
|
+
const className = classList[i]
|
|
104
|
+
if (isGeneratedValue(className)) {
|
|
105
|
+
continue
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return `${CSS.escape(element.tagName)}.${CSS.escape(className)}`
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function getTagNameSelector(element: Element): string {
|
|
113
|
+
return CSS.escape(element.tagName)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function getStableAttributeSelector(element: Element, actionNameAttribute: string | undefined): string | undefined {
|
|
117
|
+
if (actionNameAttribute) {
|
|
118
|
+
const selector = getAttributeSelector(actionNameAttribute)
|
|
119
|
+
if (selector) {
|
|
120
|
+
return selector
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
for (const attributeName of STABLE_ATTRIBUTES) {
|
|
125
|
+
const selector = getAttributeSelector(attributeName)
|
|
126
|
+
if (selector) {
|
|
127
|
+
return selector
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function getAttributeSelector(attributeName: string) {
|
|
132
|
+
if (element.hasAttribute(attributeName)) {
|
|
133
|
+
return `${CSS.escape(element.tagName)}[${attributeName}="${CSS.escape(element.getAttribute(attributeName)!)}"]`
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getPositionSelector(element: Element): string {
|
|
139
|
+
let sibling = element.parentElement!.firstElementChild
|
|
140
|
+
let elementIndex = 1
|
|
141
|
+
|
|
142
|
+
while (sibling && sibling !== element) {
|
|
143
|
+
if (sibling.tagName === element.tagName) {
|
|
144
|
+
elementIndex += 1
|
|
145
|
+
}
|
|
146
|
+
sibling = sibling.nextElementSibling
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return `${CSS.escape(element.tagName)}:nth-of-type(${elementIndex})`
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function findSelector(
|
|
153
|
+
element: Element,
|
|
154
|
+
selectorGetters: SelectorGetter[],
|
|
155
|
+
predicate: (element: Element, elementSelector: string, childSelector: string | undefined) => boolean,
|
|
156
|
+
actionNameAttribute: string | undefined,
|
|
157
|
+
childSelector: string | undefined
|
|
158
|
+
) {
|
|
159
|
+
for (const selectorGetter of selectorGetters) {
|
|
160
|
+
const elementSelector = selectorGetter(element, actionNameAttribute)
|
|
161
|
+
if (!elementSelector) {
|
|
162
|
+
continue
|
|
163
|
+
}
|
|
164
|
+
if (predicate(element, elementSelector, childSelector)) {
|
|
165
|
+
return combineSelector(elementSelector, childSelector)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Check whether the selector is unique among the whole document.
|
|
172
|
+
*/
|
|
173
|
+
function isSelectorUniqueGlobally(
|
|
174
|
+
element: Element,
|
|
175
|
+
elementSelector: string,
|
|
176
|
+
childSelector: string | undefined
|
|
177
|
+
): boolean {
|
|
178
|
+
return element.ownerDocument.querySelectorAll(combineSelector(elementSelector, childSelector)).length === 1
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Check whether the selector is unique among the element siblings. In other words, it returns true
|
|
183
|
+
* if "ELEMENT_PARENT > CHILD_SELECTOR" returns a single element.
|
|
184
|
+
*
|
|
185
|
+
* @param {Element} currentElement - the element being considered while iterating over the target
|
|
186
|
+
* element ancestors.
|
|
187
|
+
*
|
|
188
|
+
* @param {string} currentElementSelector - a selector that matches the current element. That
|
|
189
|
+
* selector is not a composed selector (i.e. it might be a single tag name, class name...).
|
|
190
|
+
*
|
|
191
|
+
* @param {string|undefined} childSelector - child selector is a selector that targets a descendant
|
|
192
|
+
* of the current element. When undefined, the current element is the target element.
|
|
193
|
+
*
|
|
194
|
+
* # Scope selector usage
|
|
195
|
+
*
|
|
196
|
+
* When composed together, the final selector will be joined with `>` operators to make sure we
|
|
197
|
+
* target direct descendants at each level. In this function, we'll use `querySelector` to check if
|
|
198
|
+
* a selector matches descendants of the current element. But by default, the query selector match
|
|
199
|
+
* elements at any level. Example:
|
|
200
|
+
*
|
|
201
|
+
* ```html
|
|
202
|
+
* <main>
|
|
203
|
+
* <div>
|
|
204
|
+
* <span></span>
|
|
205
|
+
* </div>
|
|
206
|
+
* <marquee>
|
|
207
|
+
* <div>
|
|
208
|
+
* <span></span>
|
|
209
|
+
* </div>
|
|
210
|
+
* </marquee>
|
|
211
|
+
* </main>
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* `sibling.querySelector('DIV > SPAN')` will match both span elements, so we would consider the
|
|
215
|
+
* selector to be not unique, even if it is unique when we'll compose it with the parent with a `>`
|
|
216
|
+
* operator (`MAIN > DIV > SPAN`).
|
|
217
|
+
*
|
|
218
|
+
* To avoid this, we can use the `:scope` selector to make sure the selector starts from the current
|
|
219
|
+
* sibling (i.e. `sibling.querySelector('DIV:scope > SPAN')` will only match the first span).
|
|
220
|
+
*
|
|
221
|
+
* [1]: https://developer.mozilla.org/fr/docs/Web/CSS/:scope
|
|
222
|
+
*
|
|
223
|
+
* # Performance considerations
|
|
224
|
+
*
|
|
225
|
+
* We compute selectors in performance-critical operations (ex: during a click), so we need to make
|
|
226
|
+
* sure the function is as fast as possible. We observed that naively using `querySelectorAll` to
|
|
227
|
+
* check if the selector matches more than 1 element is quite expensive, so we want to avoid it.
|
|
228
|
+
*
|
|
229
|
+
* Because we are iterating the DOM upward and we use that function at every level, we know the
|
|
230
|
+
* child selector is already unique among the current element children, so we don't need to check
|
|
231
|
+
* for the current element subtree.
|
|
232
|
+
*
|
|
233
|
+
* Instead, we can focus on the current element siblings. If we find a single element matching the
|
|
234
|
+
* selector within a sibling, we know that it's not unique. This allows us to use `querySelector`
|
|
235
|
+
* (or `matches`, when the current element is the target element) instead of `querySelectorAll`.
|
|
236
|
+
*/
|
|
237
|
+
export function isSelectorUniqueAmongSiblings(
|
|
238
|
+
currentElement: Element,
|
|
239
|
+
currentElementSelector: string,
|
|
240
|
+
childSelector: string | undefined
|
|
241
|
+
): boolean {
|
|
242
|
+
let isSiblingMatching: (sibling: Element) => boolean
|
|
243
|
+
|
|
244
|
+
if (childSelector === undefined) {
|
|
245
|
+
// If the child selector is undefined (meaning `currentElement` is the target element, not one
|
|
246
|
+
// of its ancestor), we need to use `matches` to check if the sibling is matching the selector,
|
|
247
|
+
// as `querySelector` only returns a descendant of the element.
|
|
248
|
+
isSiblingMatching = (sibling) => sibling.matches(currentElementSelector)
|
|
249
|
+
} else {
|
|
250
|
+
const scopedSelector = combineSelector(`${currentElementSelector}:scope`, childSelector)
|
|
251
|
+
isSiblingMatching = (sibling) => sibling.querySelector(scopedSelector) !== null
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const parent = currentElement.parentElement!
|
|
255
|
+
let sibling = parent.firstElementChild
|
|
256
|
+
while (sibling) {
|
|
257
|
+
if (sibling !== currentElement && isSiblingMatching(sibling)) {
|
|
258
|
+
return false
|
|
259
|
+
}
|
|
260
|
+
sibling = sibling.nextElementSibling
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return true
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function combineSelector(parent: string, child: string | undefined): string {
|
|
267
|
+
return child ? `${parent}>${child}` : parent
|
|
268
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { INTAKE_SITE_STAGING, INTAKE_SITE_PROD } from '@kubesense/kubesense-browser-core'
|
|
2
|
+
import type { RumConfiguration } from './configuration'
|
|
3
|
+
import type { ViewHistoryEntry } from './contexts/viewHistory'
|
|
4
|
+
import type { RumSession } from './rumSessionManager'
|
|
5
|
+
|
|
6
|
+
export function getSessionReplayUrl(
|
|
7
|
+
configuration: RumConfiguration,
|
|
8
|
+
{
|
|
9
|
+
session,
|
|
10
|
+
viewContext,
|
|
11
|
+
errorType,
|
|
12
|
+
}: {
|
|
13
|
+
session?: RumSession
|
|
14
|
+
viewContext?: ViewHistoryEntry
|
|
15
|
+
errorType?: string
|
|
16
|
+
}
|
|
17
|
+
): string {
|
|
18
|
+
const sessionId = session ? session.id : 'no-session-id'
|
|
19
|
+
const parameters: string[] = []
|
|
20
|
+
if (errorType !== undefined) {
|
|
21
|
+
parameters.push(`error-type=${errorType}`)
|
|
22
|
+
}
|
|
23
|
+
if (viewContext) {
|
|
24
|
+
parameters.push(`seed=${viewContext.id}`)
|
|
25
|
+
parameters.push(`from=${viewContext.startClocks.timeStamp}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const origin = getKubsesenseSiteUrl(configuration)
|
|
29
|
+
const path = `/rum/replay/sessions/${sessionId}`
|
|
30
|
+
return `${origin}${path}?${parameters.join('&')}`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getKubsesenseSiteUrl(rumConfiguration: RumConfiguration) {
|
|
34
|
+
const site = rumConfiguration.kubesenseRumEndpoint
|
|
35
|
+
const subdomain = rumConfiguration.subdomain
|
|
36
|
+
return `https://${subdomain ? `${subdomain}.` : ''}${site}`
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getSiteDefaultSubdomain(configuration: RumConfiguration): string | undefined {
|
|
40
|
+
switch (configuration.kubesenseRumEndpoint) {
|
|
41
|
+
case INTAKE_SITE_PROD:
|
|
42
|
+
case INTAKE_SITE_STAGING:
|
|
43
|
+
return 'staging'
|
|
44
|
+
default:
|
|
45
|
+
return undefined
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DISCARDED,
|
|
3
|
+
Duration,
|
|
4
|
+
HookNamesAsConst,
|
|
5
|
+
RecursivePartial,
|
|
6
|
+
RelativeTime,
|
|
7
|
+
SKIPPED,
|
|
8
|
+
TelemetryEvent,
|
|
9
|
+
} from '@kubesense/kubesense-browser-core'
|
|
10
|
+
import { abstractHooks } from '@kubesense/kubesense-browser-core'
|
|
11
|
+
import type { RumEvent } from '../rumEvent.types'
|
|
12
|
+
|
|
13
|
+
// Define a partial RUM event type.
|
|
14
|
+
// Ensuring the `type` field is always present improves type checking, especially in conditional logic in hooks (e.g., `if (eventType === 'view')`).
|
|
15
|
+
export type DefaultRumEventAttributes = RecursivePartial<RumEvent> & { type: RumEvent['type'] }
|
|
16
|
+
export type DefaultTelemetryEventAttributes = RecursivePartial<TelemetryEvent>
|
|
17
|
+
|
|
18
|
+
export interface HookCallbackMap {
|
|
19
|
+
[HookNamesAsConst.ASSEMBLE]: (param: {
|
|
20
|
+
eventType: RumEvent['type']
|
|
21
|
+
startTime: RelativeTime
|
|
22
|
+
duration?: Duration | undefined
|
|
23
|
+
}) => DefaultRumEventAttributes | SKIPPED | DISCARDED
|
|
24
|
+
[HookNamesAsConst.ASSEMBLE_TELEMETRY]: (param: {
|
|
25
|
+
startTime: RelativeTime
|
|
26
|
+
}) => DefaultTelemetryEventAttributes | SKIPPED | DISCARDED
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type Hooks = ReturnType<typeof createHooks>
|
|
30
|
+
|
|
31
|
+
export const createHooks = abstractHooks<HookCallbackMap>
|