@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,208 @@
|
|
|
1
|
+
import { CanvasRecordingQuality } from "./configuration.mjs";
|
|
2
|
+
import { isIndexableObject } from "@kubesense/kubesense-js-core/util";
|
|
3
|
+
import { DefaultPrivacyLevel, TraceContextInjection, getCachedSdkConfig, readBoolean, readEnum, readNumberInRange, readSampleRate, readString, readStringList, refreshSdkConfig } from "@kubesense/kubesense-browser-core";
|
|
4
|
+
//#region src/domain/configuration/remoteSdkConfiguration.ts
|
|
5
|
+
const PROPAGATOR_TYPES = [
|
|
6
|
+
"kubesense",
|
|
7
|
+
"b3",
|
|
8
|
+
"b3multi",
|
|
9
|
+
"tracecontext"
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Applies the dashboard-managed configuration document to the user's init configuration.
|
|
13
|
+
*
|
|
14
|
+
* Only scalar settings travel: anything that is a function or a matcher (`beforeSend`,
|
|
15
|
+
* `allowedTracingUrls`, `excludedActivityUrls`, plugins) stays in application code. Identity and
|
|
16
|
+
* endpoint settings (`clientToken`, `applicationId`, `kubesenseRumEndpoint`, `proxy`) are also
|
|
17
|
+
* excluded — they determine where the configuration request itself goes, and letting them be
|
|
18
|
+
* remotely rewritten would be a redirection risk.
|
|
19
|
+
*
|
|
20
|
+
* Every field is applied only when present and valid, so the user's own init configuration —
|
|
21
|
+
* and failing that, the SDK default — always wins over a missing or malformed remote value.
|
|
22
|
+
*/
|
|
23
|
+
const PRIVACY_LEVELS = [
|
|
24
|
+
DefaultPrivacyLevel.ALLOW,
|
|
25
|
+
DefaultPrivacyLevel.MASK,
|
|
26
|
+
DefaultPrivacyLevel.MASK_USER_INPUT,
|
|
27
|
+
DefaultPrivacyLevel.MASK_UNLESS_ALLOWLISTED
|
|
28
|
+
];
|
|
29
|
+
const TRACE_CONTEXT_INJECTIONS = [TraceContextInjection.ALL, TraceContextInjection.SAMPLED];
|
|
30
|
+
const CANVAS_RECORDING_QUALITIES = [
|
|
31
|
+
CanvasRecordingQuality.LOW,
|
|
32
|
+
CanvasRecordingQuality.MEDIUM,
|
|
33
|
+
CanvasRecordingQuality.HIGH
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* Read the cached document and merge it into the init configuration. Synchronous and
|
|
37
|
+
* network-free: this runs on the initialization path.
|
|
38
|
+
*/
|
|
39
|
+
function applyCachedSdkConfiguration(initConfiguration, contexts) {
|
|
40
|
+
const remoteConfig = getCachedSdkConfig(initConfiguration.clientToken);
|
|
41
|
+
if (!remoteConfig) return {
|
|
42
|
+
initConfiguration,
|
|
43
|
+
rumEnabled: true
|
|
44
|
+
};
|
|
45
|
+
return applySdkConfiguration(initConfiguration, remoteConfig, contexts);
|
|
46
|
+
}
|
|
47
|
+
function applySdkConfiguration(initConfiguration, remoteConfig, contexts) {
|
|
48
|
+
const features = remoteConfig.features;
|
|
49
|
+
if (readBoolean(features, "rum") === false) return {
|
|
50
|
+
initConfiguration,
|
|
51
|
+
rumEnabled: false
|
|
52
|
+
};
|
|
53
|
+
const applied = { ...initConfiguration };
|
|
54
|
+
applyRumSection(applied, remoteConfig.rum);
|
|
55
|
+
applyContexts(remoteConfig.rum, contexts);
|
|
56
|
+
applySessionReplaySection(applied, remoteConfig.sessionReplay);
|
|
57
|
+
applyProfilingSection(applied, remoteConfig.profiling);
|
|
58
|
+
applyFeatureSwitches(applied, features);
|
|
59
|
+
return {
|
|
60
|
+
initConfiguration: applied,
|
|
61
|
+
rumEnabled: true
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function applyRumSection(applied, rum) {
|
|
65
|
+
if (!rum) return;
|
|
66
|
+
assign(applied, "sessionSampleRate", readSampleRate(rum, "sessionSampleRate"));
|
|
67
|
+
assign(applied, "telemetrySampleRate", readSampleRate(rum, "telemetrySampleRate"));
|
|
68
|
+
assign(applied, "traceSampleRate", readSampleRate(rum, "traceSampleRate"));
|
|
69
|
+
assign(applied, "trackUserInteractions", readBoolean(rum, "trackUserInteractions"));
|
|
70
|
+
assign(applied, "trackResources", readBoolean(rum, "trackResources"));
|
|
71
|
+
assign(applied, "trackLongTasks", readBoolean(rum, "trackLongTasks"));
|
|
72
|
+
assign(applied, "trackViewsManually", readBoolean(rum, "trackViewsManually"));
|
|
73
|
+
assign(applied, "trackAnonymousUser", readBoolean(rum, "trackAnonymousUser"));
|
|
74
|
+
assign(applied, "trackSessionAcrossSubdomains", readBoolean(rum, "trackSessionAcrossSubdomains"));
|
|
75
|
+
assign(applied, "enablePrivacyForActionName", readBoolean(rum, "enablePrivacyForActionName"));
|
|
76
|
+
assign(applied, "propagateTraceBaggage", readBoolean(rum, "propagateTraceBaggage"));
|
|
77
|
+
assign(applied, "defaultPrivacyLevel", readEnum(rum, "defaultPrivacyLevel", PRIVACY_LEVELS));
|
|
78
|
+
assign(applied, "traceContextInjection", readEnum(rum, "traceContextInjection", TRACE_CONTEXT_INJECTIONS));
|
|
79
|
+
assign(applied, "actionNameAttribute", readString(rum, "actionNameAttribute"));
|
|
80
|
+
assign(applied, "betaEnableViewUpdates", readBoolean(rum, "betaEnableViewUpdates"));
|
|
81
|
+
assign(applied, "betaTrackWebSockets", readBoolean(rum, "betaTrackWebSockets"));
|
|
82
|
+
assign(applied, "trackResourceHeaders", readBoolean(rum, "trackResourceHeaders"));
|
|
83
|
+
assign(applied, "allowedTracingUrls", readTracingUrls(rum.allowedTracingUrls));
|
|
84
|
+
assign(applied, "allowedTrackingOrigins", readStringList(rum.allowedTrackingOrigins));
|
|
85
|
+
assign(applied, "service", readString(rum, "service"));
|
|
86
|
+
assign(applied, "env", readString(rum, "env"));
|
|
87
|
+
assign(applied, "version", readString(rum, "version"));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Tracing URLs arriving as JSON can only be plain strings (prefix matches), optionally paired with
|
|
91
|
+
* the propagators to inject. As with route rules, regexes and functions stay in application code:
|
|
92
|
+
* they cannot be expressed safely in JSON, and this list decides which cross-origin requests get
|
|
93
|
+
* tracing headers attached — a pattern that is broader than intended leaks trace ids to third
|
|
94
|
+
* parties and can break their CORS preflight.
|
|
95
|
+
*/
|
|
96
|
+
function readTracingUrls(value) {
|
|
97
|
+
if (!Array.isArray(value)) return;
|
|
98
|
+
const options = [];
|
|
99
|
+
for (const entry of value) {
|
|
100
|
+
if (typeof entry === "string" && entry.length > 0) {
|
|
101
|
+
options.push(entry);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (!isIndexableObject(entry)) continue;
|
|
105
|
+
const match = readString(entry, "match");
|
|
106
|
+
if (!match) continue;
|
|
107
|
+
const propagatorTypes = readStringList(entry.propagatorTypes)?.filter((propagator) => PROPAGATOR_TYPES.includes(propagator));
|
|
108
|
+
options.push(propagatorTypes?.length ? {
|
|
109
|
+
match,
|
|
110
|
+
propagatorTypes
|
|
111
|
+
} : { match });
|
|
112
|
+
}
|
|
113
|
+
return options.length > 0 ? options : void 0;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Properties from the document are set individually rather than replacing the whole context, so
|
|
117
|
+
* anything the application has already attached with `setGlobalContext()` / `setUser()` survives.
|
|
118
|
+
*
|
|
119
|
+
* The user is applied here, before `startUserContext()` installs its change subscription, so a
|
|
120
|
+
* remotely-supplied identity behaves exactly like an application calling `setUser()` at the top of
|
|
121
|
+
* its bootstrap: it becomes the session owner rather than looking like a mid-session user switch.
|
|
122
|
+
* Changing the user in the dashboard therefore expires the session once, on the first load that
|
|
123
|
+
* reads the new document — which is the intended behaviour for a user change — and steady-state
|
|
124
|
+
* loads leave the session alone.
|
|
125
|
+
*/
|
|
126
|
+
function applyContexts(rum, contexts) {
|
|
127
|
+
applyContextProperties(contexts?.globalContext, rum?.context);
|
|
128
|
+
applyContextProperties(contexts?.userContext, rum?.user);
|
|
129
|
+
}
|
|
130
|
+
function applyContextProperties(contextManager, properties) {
|
|
131
|
+
if (!contextManager || !isIndexableObject(properties)) return;
|
|
132
|
+
for (const [key, value] of Object.entries(properties)) contextManager.setContextProperty(key, value);
|
|
133
|
+
}
|
|
134
|
+
function applySessionReplaySection(applied, sessionReplay) {
|
|
135
|
+
if (!sessionReplay) return;
|
|
136
|
+
assign(applied, "sessionReplaySampleRate", readSampleRate(sessionReplay, "sampleRate"));
|
|
137
|
+
assign(applied, "startSessionReplayRecordingManually", readBoolean(sessionReplay, "startRecordingManually"));
|
|
138
|
+
assign(applied, "defaultPrivacyLevel", readEnum(sessionReplay, "defaultPrivacyLevel", PRIVACY_LEVELS));
|
|
139
|
+
assign(applied, "sessionReplayRoutes", readRoutes(sessionReplay.routes));
|
|
140
|
+
assign(applied, "sessionReplayCanvasRecording", readCanvasRecording(sessionReplay.canvasRecording));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Canvas capture is the most expensive replay setting there is — it uploads rendered frames — so it
|
|
144
|
+
* is only enabled when the document says so explicitly, and each limit is validated against the
|
|
145
|
+
* range the SDK accepts instead of being clamped.
|
|
146
|
+
*/
|
|
147
|
+
function readCanvasRecording(canvasRecording) {
|
|
148
|
+
if (!isIndexableObject(canvasRecording)) return;
|
|
149
|
+
const enable = readBoolean(canvasRecording, "enable");
|
|
150
|
+
if (enable === void 0) return;
|
|
151
|
+
return {
|
|
152
|
+
enable,
|
|
153
|
+
quality: readEnum(canvasRecording, "quality", CANVAS_RECORDING_QUALITIES),
|
|
154
|
+
maxFramesPerSecond: readNumberInRange(canvasRecording, "maxFramesPerSecond", 0, 8),
|
|
155
|
+
hashingMaxDimension: readNumberInRange(canvasRecording, "hashingMaxDimension", 1, 100),
|
|
156
|
+
maxImageDimension: readNumberInRange(canvasRecording, "maxImageDimension", 1, 1280)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Route rules arriving as JSON can only be plain strings (prefix matches). Regexes and functions
|
|
161
|
+
* are deliberately not accepted from the dashboard: they cannot be expressed safely in JSON and a
|
|
162
|
+
* pathological pattern would run on every view change.
|
|
163
|
+
*/
|
|
164
|
+
function readRoutes(routes) {
|
|
165
|
+
if (!routes || typeof routes !== "object" || Array.isArray(routes)) return;
|
|
166
|
+
const include = readStringList(routes.include);
|
|
167
|
+
const exclude = readStringList(routes.exclude);
|
|
168
|
+
if (!include && !exclude) return;
|
|
169
|
+
return {
|
|
170
|
+
include,
|
|
171
|
+
exclude
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function applyProfilingSection(applied, profiling) {
|
|
175
|
+
if (!profiling) return;
|
|
176
|
+
assign(applied, "profilingSampleRate", readSampleRate(profiling, "sampleRate"));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Feature switches are applied last so they always win over the per-section sample rates above.
|
|
180
|
+
* Turning a feature off is expressed through the setting that stops all of its collection.
|
|
181
|
+
*/
|
|
182
|
+
function applyFeatureSwitches(applied, features) {
|
|
183
|
+
const source = features;
|
|
184
|
+
if (readBoolean(source, "sessionReplay") === false) {
|
|
185
|
+
applied.sessionReplaySampleRate = 0;
|
|
186
|
+
applied.startSessionReplayRecordingManually = true;
|
|
187
|
+
applied.sessionReplayRoutes = void 0;
|
|
188
|
+
}
|
|
189
|
+
if (readBoolean(source, "profiling") === false) applied.profilingSampleRate = 0;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Assigning only defined values keeps the "absent means keep the local value" guarantee in one
|
|
193
|
+
* place instead of at every call site.
|
|
194
|
+
*/
|
|
195
|
+
function assign(target, key, value) {
|
|
196
|
+
if (value !== void 0) target[key] = value;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Refresh the cache for the next page load. Must be called *after* the SDK has started so it
|
|
200
|
+
* never delays initialization.
|
|
201
|
+
*/
|
|
202
|
+
function scheduleSdkConfigurationRefresh(initConfiguration) {
|
|
203
|
+
return refreshSdkConfig(initConfiguration, initConfiguration.applicationId);
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { applyCachedSdkConfiguration, applySdkConfiguration, scheduleSdkConfigurationRefresh };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=remoteSdkConfiguration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteSdkConfiguration.mjs","names":[],"sources":["../../../src/domain/configuration/remoteSdkConfiguration.ts"],"sourcesContent":["import type { RemoteSdkConfig } from '@kubesense/kubesense-browser-core'\nimport {\n DefaultPrivacyLevel,\n TraceContextInjection,\n getCachedSdkConfig,\n readBoolean,\n readEnum,\n readNumberInRange,\n readSampleRate,\n readString,\n readStringList,\n refreshSdkConfig,\n} from '@kubesense/kubesense-browser-core'\nimport { isIndexableObject } from '@kubesense/kubesense-js-core/util'\nimport type { MatchOption } from '@kubesense/kubesense-js-core/configuration'\nimport type { PropagatorType } from '../tracing/tracer.types'\nimport type { RumInitConfiguration } from './configuration'\nimport { CanvasRecordingQuality } from './configuration'\nimport type { SessionReplayRoutes } from './sessionReplayRoutes'\n\nconst PROPAGATOR_TYPES: readonly PropagatorType[] = ['kubesense', 'b3', 'b3multi', 'tracecontext']\n\n/**\n * Applies the dashboard-managed configuration document to the user's init configuration.\n *\n * Only scalar settings travel: anything that is a function or a matcher (`beforeSend`,\n * `allowedTracingUrls`, `excludedActivityUrls`, plugins) stays in application code. Identity and\n * endpoint settings (`clientToken`, `applicationId`, `kubesenseRumEndpoint`, `proxy`) are also\n * excluded — they determine where the configuration request itself goes, and letting them be\n * remotely rewritten would be a redirection risk.\n *\n * Every field is applied only when present and valid, so the user's own init configuration —\n * and failing that, the SDK default — always wins over a missing or malformed remote value.\n */\n\nconst PRIVACY_LEVELS = [\n DefaultPrivacyLevel.ALLOW,\n DefaultPrivacyLevel.MASK,\n DefaultPrivacyLevel.MASK_USER_INPUT,\n DefaultPrivacyLevel.MASK_UNLESS_ALLOWLISTED,\n] as const\n\nconst TRACE_CONTEXT_INJECTIONS = [TraceContextInjection.ALL, TraceContextInjection.SAMPLED] as const\n\nconst CANVAS_RECORDING_QUALITIES = [\n CanvasRecordingQuality.LOW,\n CanvasRecordingQuality.MEDIUM,\n CanvasRecordingQuality.HIGH,\n] as const\n\nexport interface RemoteSdkConfigurationResult {\n initConfiguration: RumInitConfiguration\n /** `false` when the dashboard has switched RUM off entirely. */\n rumEnabled: boolean\n}\n\n/** The context managers the document can contribute to. */\nexport interface RemoteSdkConfigurationContexts {\n globalContext?: { setContextProperty: (key: string, value: unknown) => void }\n userContext?: { setContextProperty: (key: string, value: unknown) => void }\n}\n\n/**\n * Read the cached document and merge it into the init configuration. Synchronous and\n * network-free: this runs on the initialization path.\n */\nexport function applyCachedSdkConfiguration(\n initConfiguration: RumInitConfiguration,\n contexts?: RemoteSdkConfigurationContexts\n): RemoteSdkConfigurationResult {\n const remoteConfig = getCachedSdkConfig(initConfiguration.clientToken)\n if (!remoteConfig) {\n return { initConfiguration, rumEnabled: true }\n }\n return applySdkConfiguration(initConfiguration, remoteConfig, contexts)\n}\n\nexport function applySdkConfiguration(\n initConfiguration: RumInitConfiguration,\n remoteConfig: RemoteSdkConfig,\n contexts?: RemoteSdkConfigurationContexts\n): RemoteSdkConfigurationResult {\n const features = remoteConfig.features\n if (readBoolean(features as { [key: string]: unknown } | undefined, 'rum') === false) {\n return { initConfiguration, rumEnabled: false }\n }\n\n const applied: RumInitConfiguration = { ...initConfiguration }\n\n applyRumSection(applied, remoteConfig.rum)\n applyContexts(remoteConfig.rum, contexts)\n applySessionReplaySection(applied, remoteConfig.sessionReplay)\n applyProfilingSection(applied, remoteConfig.profiling)\n applyFeatureSwitches(applied, features)\n\n return { initConfiguration: applied, rumEnabled: true }\n}\n\nfunction applyRumSection(applied: RumInitConfiguration, rum: { [key: string]: unknown } | undefined) {\n if (!rum) {\n return\n }\n\n assign(applied, 'sessionSampleRate', readSampleRate(rum, 'sessionSampleRate'))\n assign(applied, 'telemetrySampleRate', readSampleRate(rum, 'telemetrySampleRate'))\n assign(applied, 'traceSampleRate', readSampleRate(rum, 'traceSampleRate'))\n\n assign(applied, 'trackUserInteractions', readBoolean(rum, 'trackUserInteractions'))\n assign(applied, 'trackResources', readBoolean(rum, 'trackResources'))\n assign(applied, 'trackLongTasks', readBoolean(rum, 'trackLongTasks'))\n assign(applied, 'trackViewsManually', readBoolean(rum, 'trackViewsManually'))\n assign(applied, 'trackAnonymousUser', readBoolean(rum, 'trackAnonymousUser'))\n assign(applied, 'trackSessionAcrossSubdomains', readBoolean(rum, 'trackSessionAcrossSubdomains'))\n assign(applied, 'enablePrivacyForActionName', readBoolean(rum, 'enablePrivacyForActionName'))\n assign(applied, 'propagateTraceBaggage', readBoolean(rum, 'propagateTraceBaggage'))\n\n assign(applied, 'defaultPrivacyLevel', readEnum(rum, 'defaultPrivacyLevel', PRIVACY_LEVELS))\n assign(applied, 'traceContextInjection', readEnum(rum, 'traceContextInjection', TRACE_CONTEXT_INJECTIONS))\n assign(applied, 'actionNameAttribute', readString(rum, 'actionNameAttribute'))\n\n assign(applied, 'betaEnableViewUpdates', readBoolean(rum, 'betaEnableViewUpdates'))\n assign(applied, 'betaTrackWebSockets', readBoolean(rum, 'betaTrackWebSockets'))\n // Only the \"collect the default headers / collect nothing\" switch travels. The MatchHeader[] form\n // selects headers by name with optional extractor functions, which cannot come from JSON.\n assign(applied, 'trackResourceHeaders', readBoolean(rum, 'trackResourceHeaders'))\n\n assign(applied, 'allowedTracingUrls', readTracingUrls(rum.allowedTracingUrls))\n assign(applied, 'allowedTrackingOrigins', readStringList(rum.allowedTrackingOrigins))\n\n assign(applied, 'service', readString(rum, 'service'))\n assign(applied, 'env', readString(rum, 'env'))\n assign(applied, 'version', readString(rum, 'version'))\n}\n\n/**\n * Tracing URLs arriving as JSON can only be plain strings (prefix matches), optionally paired with\n * the propagators to inject. As with route rules, regexes and functions stay in application code:\n * they cannot be expressed safely in JSON, and this list decides which cross-origin requests get\n * tracing headers attached — a pattern that is broader than intended leaks trace ids to third\n * parties and can break their CORS preflight.\n */\nfunction readTracingUrls(value: unknown): RumInitConfiguration['allowedTracingUrls'] | undefined {\n if (!Array.isArray(value)) {\n return undefined\n }\n\n const options: Array<MatchOption | { match: MatchOption; propagatorTypes?: PropagatorType[] }> = []\n for (const entry of value) {\n if (typeof entry === 'string' && entry.length > 0) {\n options.push(entry)\n continue\n }\n if (!isIndexableObject(entry)) {\n continue\n }\n const match = readString(entry, 'match')\n if (!match) {\n continue\n }\n const propagatorTypes = readStringList(entry.propagatorTypes)?.filter((propagator): propagator is PropagatorType =>\n (PROPAGATOR_TYPES as readonly string[]).includes(propagator)\n )\n options.push(propagatorTypes?.length ? { match, propagatorTypes } : { match })\n }\n\n return options.length > 0 ? options : undefined\n}\n\n/**\n * Properties from the document are set individually rather than replacing the whole context, so\n * anything the application has already attached with `setGlobalContext()` / `setUser()` survives.\n *\n * The user is applied here, before `startUserContext()` installs its change subscription, so a\n * remotely-supplied identity behaves exactly like an application calling `setUser()` at the top of\n * its bootstrap: it becomes the session owner rather than looking like a mid-session user switch.\n * Changing the user in the dashboard therefore expires the session once, on the first load that\n * reads the new document — which is the intended behaviour for a user change — and steady-state\n * loads leave the session alone.\n */\nfunction applyContexts(\n rum: { [key: string]: unknown } | undefined,\n contexts: RemoteSdkConfigurationContexts | undefined\n) {\n applyContextProperties(contexts?.globalContext, rum?.context)\n applyContextProperties(contexts?.userContext, rum?.user)\n}\n\nfunction applyContextProperties(\n contextManager: { setContextProperty: (key: string, value: unknown) => void } | undefined,\n properties: unknown\n) {\n if (!contextManager || !isIndexableObject(properties)) {\n return\n }\n\n for (const [key, value] of Object.entries(properties)) {\n contextManager.setContextProperty(key, value)\n }\n}\n\nfunction applySessionReplaySection(\n applied: RumInitConfiguration,\n sessionReplay: { [key: string]: unknown } | undefined\n) {\n if (!sessionReplay) {\n return\n }\n\n assign(applied, 'sessionReplaySampleRate', readSampleRate(sessionReplay, 'sampleRate'))\n assign(applied, 'startSessionReplayRecordingManually', readBoolean(sessionReplay, 'startRecordingManually'))\n assign(applied, 'defaultPrivacyLevel', readEnum(sessionReplay, 'defaultPrivacyLevel', PRIVACY_LEVELS))\n assign(applied, 'sessionReplayRoutes', readRoutes(sessionReplay.routes))\n assign(applied, 'sessionReplayCanvasRecording', readCanvasRecording(sessionReplay.canvasRecording))\n}\n\n/**\n * Canvas capture is the most expensive replay setting there is — it uploads rendered frames — so it\n * is only enabled when the document says so explicitly, and each limit is validated against the\n * range the SDK accepts instead of being clamped.\n */\nfunction readCanvasRecording(canvasRecording: unknown): RumInitConfiguration['sessionReplayCanvasRecording'] {\n if (!isIndexableObject(canvasRecording)) {\n return undefined\n }\n\n const enable = readBoolean(canvasRecording, 'enable')\n if (enable === undefined) {\n // Without an explicit switch there is nothing to apply: the remaining fields are only limits.\n return undefined\n }\n\n return {\n enable,\n quality: readEnum(canvasRecording, 'quality', CANVAS_RECORDING_QUALITIES),\n maxFramesPerSecond: readNumberInRange(canvasRecording, 'maxFramesPerSecond', 0, 8),\n hashingMaxDimension: readNumberInRange(canvasRecording, 'hashingMaxDimension', 1, 100),\n maxImageDimension: readNumberInRange(canvasRecording, 'maxImageDimension', 1, 1280),\n }\n}\n\n/**\n * Route rules arriving as JSON can only be plain strings (prefix matches). Regexes and functions\n * are deliberately not accepted from the dashboard: they cannot be expressed safely in JSON and a\n * pathological pattern would run on every view change.\n */\nfunction readRoutes(routes: unknown): SessionReplayRoutes | undefined {\n if (!routes || typeof routes !== 'object' || Array.isArray(routes)) {\n return undefined\n }\n\n const include = readStringList((routes as { include?: unknown }).include)\n const exclude = readStringList((routes as { exclude?: unknown }).exclude)\n\n if (!include && !exclude) {\n return undefined\n }\n\n return { include, exclude }\n}\n\nfunction applyProfilingSection(applied: RumInitConfiguration, profiling: { [key: string]: unknown } | undefined) {\n if (!profiling) {\n return\n }\n assign(applied, 'profilingSampleRate', readSampleRate(profiling, 'sampleRate'))\n}\n\n/**\n * Feature switches are applied last so they always win over the per-section sample rates above.\n * Turning a feature off is expressed through the setting that stops all of its collection.\n */\nfunction applyFeatureSwitches(applied: RumInitConfiguration, features: RemoteSdkConfig['features']) {\n const source = features as { [key: string]: unknown } | undefined\n\n if (readBoolean(source, 'sessionReplay') === false) {\n applied.sessionReplaySampleRate = 0\n applied.startSessionReplayRecordingManually = true\n // Drop any route rules too: with replay off they are dead weight, and leaving them behind\n // would suggest recording still happens somewhere.\n applied.sessionReplayRoutes = undefined\n }\n\n if (readBoolean(source, 'profiling') === false) {\n applied.profilingSampleRate = 0\n }\n}\n\n/**\n * Assigning only defined values keeps the \"absent means keep the local value\" guarantee in one\n * place instead of at every call site.\n */\nfunction assign<K extends keyof RumInitConfiguration>(\n target: RumInitConfiguration,\n key: K,\n value: RumInitConfiguration[K] | undefined\n) {\n if (value !== undefined) {\n target[key] = value\n }\n}\n\n/**\n * Refresh the cache for the next page load. Must be called *after* the SDK has started so it\n * never delays initialization.\n */\nexport function scheduleSdkConfigurationRefresh(initConfiguration: RumInitConfiguration) {\n return refreshSdkConfig(initConfiguration, initConfiguration.applicationId)\n}\n"],"mappings":";;;;AAoBA,MAAM,mBAA8C;CAAC;CAAa;CAAM;CAAW;AAAc;;;;;;;;;;;;;AAejG,MAAM,iBAAiB;CACrB,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;CACpB,oBAAoB;AACtB;AAEA,MAAM,2BAA2B,CAAC,sBAAsB,KAAK,sBAAsB,OAAO;AAE1F,MAAM,6BAA6B;CACjC,uBAAuB;CACvB,uBAAuB;CACvB,uBAAuB;AACzB;;;;;AAkBA,SAAgB,4BACd,mBACA,UAC8B;CAC9B,MAAM,eAAe,mBAAmB,kBAAkB,WAAW;CACrE,IAAI,CAAC,cACH,OAAO;EAAE;EAAmB,YAAY;CAAK;CAE/C,OAAO,sBAAsB,mBAAmB,cAAc,QAAQ;AACxE;AAEA,SAAgB,sBACd,mBACA,cACA,UAC8B;CAC9B,MAAM,WAAW,aAAa;CAC9B,IAAI,YAAY,UAAoD,KAAK,MAAM,OAC7E,OAAO;EAAE;EAAmB,YAAY;CAAM;CAGhD,MAAM,UAAgC,EAAE,GAAG,kBAAkB;CAE7D,gBAAgB,SAAS,aAAa,GAAG;CACzC,cAAc,aAAa,KAAK,QAAQ;CACxC,0BAA0B,SAAS,aAAa,aAAa;CAC7D,sBAAsB,SAAS,aAAa,SAAS;CACrD,qBAAqB,SAAS,QAAQ;CAEtC,OAAO;EAAE,mBAAmB;EAAS,YAAY;CAAK;AACxD;AAEA,SAAS,gBAAgB,SAA+B,KAA6C;CACnG,IAAI,CAAC,KACH;CAGF,OAAO,SAAS,qBAAqB,eAAe,KAAK,mBAAmB,CAAC;CAC7E,OAAO,SAAS,uBAAuB,eAAe,KAAK,qBAAqB,CAAC;CACjF,OAAO,SAAS,mBAAmB,eAAe,KAAK,iBAAiB,CAAC;CAEzE,OAAO,SAAS,yBAAyB,YAAY,KAAK,uBAAuB,CAAC;CAClF,OAAO,SAAS,kBAAkB,YAAY,KAAK,gBAAgB,CAAC;CACpE,OAAO,SAAS,kBAAkB,YAAY,KAAK,gBAAgB,CAAC;CACpE,OAAO,SAAS,sBAAsB,YAAY,KAAK,oBAAoB,CAAC;CAC5E,OAAO,SAAS,sBAAsB,YAAY,KAAK,oBAAoB,CAAC;CAC5E,OAAO,SAAS,gCAAgC,YAAY,KAAK,8BAA8B,CAAC;CAChG,OAAO,SAAS,8BAA8B,YAAY,KAAK,4BAA4B,CAAC;CAC5F,OAAO,SAAS,yBAAyB,YAAY,KAAK,uBAAuB,CAAC;CAElF,OAAO,SAAS,uBAAuB,SAAS,KAAK,uBAAuB,cAAc,CAAC;CAC3F,OAAO,SAAS,yBAAyB,SAAS,KAAK,yBAAyB,wBAAwB,CAAC;CACzG,OAAO,SAAS,uBAAuB,WAAW,KAAK,qBAAqB,CAAC;CAE7E,OAAO,SAAS,yBAAyB,YAAY,KAAK,uBAAuB,CAAC;CAClF,OAAO,SAAS,uBAAuB,YAAY,KAAK,qBAAqB,CAAC;CAG9E,OAAO,SAAS,wBAAwB,YAAY,KAAK,sBAAsB,CAAC;CAEhF,OAAO,SAAS,sBAAsB,gBAAgB,IAAI,kBAAkB,CAAC;CAC7E,OAAO,SAAS,0BAA0B,eAAe,IAAI,sBAAsB,CAAC;CAEpF,OAAO,SAAS,WAAW,WAAW,KAAK,SAAS,CAAC;CACrD,OAAO,SAAS,OAAO,WAAW,KAAK,KAAK,CAAC;CAC7C,OAAO,SAAS,WAAW,WAAW,KAAK,SAAS,CAAC;AACvD;;;;;;;;AASA,SAAS,gBAAgB,OAAwE;CAC/F,IAAI,CAAC,MAAM,QAAQ,KAAK,GACtB;CAGF,MAAM,UAA2F,CAAC;CAClG,KAAK,MAAM,SAAS,OAAO;EACzB,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,GAAG;GACjD,QAAQ,KAAK,KAAK;GAClB;EACF;EACA,IAAI,CAAC,kBAAkB,KAAK,GAC1B;EAEF,MAAM,QAAQ,WAAW,OAAO,OAAO;EACvC,IAAI,CAAC,OACH;EAEF,MAAM,kBAAkB,eAAe,MAAM,eAAe,CAAC,EAAE,QAAQ,eACpE,iBAAuC,SAAS,UAAU,CAC7D;EACA,QAAQ,KAAK,iBAAiB,SAAS;GAAE;GAAO;EAAgB,IAAI,EAAE,MAAM,CAAC;CAC/E;CAEA,OAAO,QAAQ,SAAS,IAAI,UAAU,KAAA;AACxC;;;;;;;;;;;;AAaA,SAAS,cACP,KACA,UACA;CACA,uBAAuB,UAAU,eAAe,KAAK,OAAO;CAC5D,uBAAuB,UAAU,aAAa,KAAK,IAAI;AACzD;AAEA,SAAS,uBACP,gBACA,YACA;CACA,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,UAAU,GAClD;CAGF,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,UAAU,GAClD,eAAe,mBAAmB,KAAK,KAAK;AAEhD;AAEA,SAAS,0BACP,SACA,eACA;CACA,IAAI,CAAC,eACH;CAGF,OAAO,SAAS,2BAA2B,eAAe,eAAe,YAAY,CAAC;CACtF,OAAO,SAAS,uCAAuC,YAAY,eAAe,wBAAwB,CAAC;CAC3G,OAAO,SAAS,uBAAuB,SAAS,eAAe,uBAAuB,cAAc,CAAC;CACrG,OAAO,SAAS,uBAAuB,WAAW,cAAc,MAAM,CAAC;CACvE,OAAO,SAAS,gCAAgC,oBAAoB,cAAc,eAAe,CAAC;AACpG;;;;;;AAOA,SAAS,oBAAoB,iBAAgF;CAC3G,IAAI,CAAC,kBAAkB,eAAe,GACpC;CAGF,MAAM,SAAS,YAAY,iBAAiB,QAAQ;CACpD,IAAI,WAAW,KAAA,GAEb;CAGF,OAAO;EACL;EACA,SAAS,SAAS,iBAAiB,WAAW,0BAA0B;EACxE,oBAAoB,kBAAkB,iBAAiB,sBAAsB,GAAG,CAAC;EACjF,qBAAqB,kBAAkB,iBAAiB,uBAAuB,GAAG,GAAG;EACrF,mBAAmB,kBAAkB,iBAAiB,qBAAqB,GAAG,IAAI;CACpF;AACF;;;;;;AAOA,SAAS,WAAW,QAAkD;CACpE,IAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GAC/D;CAGF,MAAM,UAAU,eAAgB,OAAiC,OAAO;CACxE,MAAM,UAAU,eAAgB,OAAiC,OAAO;CAExE,IAAI,CAAC,WAAW,CAAC,SACf;CAGF,OAAO;EAAE;EAAS;CAAQ;AAC5B;AAEA,SAAS,sBAAsB,SAA+B,WAAmD;CAC/G,IAAI,CAAC,WACH;CAEF,OAAO,SAAS,uBAAuB,eAAe,WAAW,YAAY,CAAC;AAChF;;;;;AAMA,SAAS,qBAAqB,SAA+B,UAAuC;CAClG,MAAM,SAAS;CAEf,IAAI,YAAY,QAAQ,eAAe,MAAM,OAAO;EAClD,QAAQ,0BAA0B;EAClC,QAAQ,sCAAsC;EAG9C,QAAQ,sBAAsB,KAAA;CAChC;CAEA,IAAI,YAAY,QAAQ,WAAW,MAAM,OACvC,QAAQ,sBAAsB;AAElC;;;;;AAMA,SAAS,OACP,QACA,KACA,OACA;CACA,IAAI,UAAU,KAAA,GACZ,OAAO,OAAO;AAElB;;;;;AAMA,SAAgB,gCAAgC,mBAAyC;CACvF,OAAO,iBAAiB,mBAAmB,kBAAkB,aAAa;AAC5E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { matchList } from "@kubesense/kubesense-browser-core";
|
|
2
|
+
//#region src/domain/configuration/sessionReplayRoutes.ts
|
|
3
|
+
/**
|
|
4
|
+
* Rules are matched against the **path** — `pathname` + `search` + `hash` — not the full URL, so
|
|
5
|
+
* a dashboard entry reads the way a route is written (`/checkout`). String options match by
|
|
6
|
+
* prefix, so `/checkout` also covers `/checkout/payment`.
|
|
7
|
+
*/
|
|
8
|
+
function getRoutePath(location = window.location) {
|
|
9
|
+
return `${location.pathname}${location.search}${location.hash}`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether recording is allowed on the given path.
|
|
13
|
+
*
|
|
14
|
+
* No rules at all means "record everywhere", which keeps the behaviour of an SDK that has never
|
|
15
|
+
* been configured with routes.
|
|
16
|
+
*/
|
|
17
|
+
function isRouteRecordable(routes, path) {
|
|
18
|
+
if (!routes) return true;
|
|
19
|
+
if (routes.exclude && routes.exclude.length > 0 && matchList(routes.exclude, path, true)) return false;
|
|
20
|
+
if (routes.include && routes.include.length > 0) return matchList(routes.include, path, true);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { getRoutePath, isRouteRecordable };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=sessionReplayRoutes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionReplayRoutes.mjs","names":[],"sources":["../../../src/domain/configuration/sessionReplayRoutes.ts"],"sourcesContent":["import type { MatchOption } from '@kubesense/kubesense-js-core/configuration'\nimport { matchList } from '@kubesense/kubesense-browser-core'\n\n/**\n * Route-scoped Session Replay.\n *\n * Recording is normally decided once per session by `sessionReplaySampleRate`. These rules add a\n * second, per-view gate so a session that *is* eligible only gets recorded while the user is on\n * a matching route.\n *\n * Rules can only ever narrow recording, never widen it: a session that lost the replay sampling\n * draw is never recorded, whatever the routes say.\n */\nexport interface SessionReplayRoutes {\n /** Record only on these routes. When omitted, every route is eligible. */\n include?: MatchOption[] | undefined\n /** Never record on these routes. Takes precedence over `include`. */\n exclude?: MatchOption[] | undefined\n}\n\n/**\n * Rules are matched against the **path** — `pathname` + `search` + `hash` — not the full URL, so\n * a dashboard entry reads the way a route is written (`/checkout`). String options match by\n * prefix, so `/checkout` also covers `/checkout/payment`.\n */\nexport function getRoutePath(location: Location | URL = window.location): string {\n return `${location.pathname}${location.search}${location.hash}`\n}\n\n/**\n * Returns whether recording is allowed on the given path.\n *\n * No rules at all means \"record everywhere\", which keeps the behaviour of an SDK that has never\n * been configured with routes.\n */\nexport function isRouteRecordable(routes: SessionReplayRoutes | undefined, path: string): boolean {\n if (!routes) {\n return true\n }\n\n // Exclusions win, so a route can always be carved out of a broad `include`.\n if (routes.exclude && routes.exclude.length > 0 && matchList(routes.exclude, path, true)) {\n return false\n }\n\n if (routes.include && routes.include.length > 0) {\n return matchList(routes.include, path, true)\n }\n\n return true\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,aAAa,WAA2B,OAAO,UAAkB;CAC/E,OAAO,GAAG,SAAS,WAAW,SAAS,SAAS,SAAS;AAC3D;;;;;;;AAQA,SAAgB,kBAAkB,QAAyC,MAAuB;CAChG,IAAI,CAAC,QACH,OAAO;CAIT,IAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,KAAK,UAAU,OAAO,SAAS,MAAM,IAAI,GACrF,OAAO;CAGT,IAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,GAC5C,OAAO,UAAU,OAAO,SAAS,MAAM,IAAI;CAG7C,OAAO;AACT"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createCookieObservable } from "../../browser/cookieObservable.mjs";
|
|
2
|
+
import "./sessionContext.mjs";
|
|
3
|
+
import { display, getInitCookie } from "@kubesense/kubesense-browser-core";
|
|
4
|
+
import { SKIPPED } from "@kubesense/kubesense-js-core/assembly";
|
|
5
|
+
//#region src/domain/contexts/ciVisibilityContext.ts
|
|
6
|
+
const CI_VISIBILITY_TEST_ID_COOKIE_NAME = "kubesense-ci-visibility-test-execution-id";
|
|
7
|
+
function startCiVisibilityContext(assembleHook, cookieObservable = createCookieObservable(CI_VISIBILITY_TEST_ID_COOKIE_NAME)) {
|
|
8
|
+
let testExecutionId = getInitCookie("kubesense-ci-visibility-test-execution-id") || readCypressTraceId();
|
|
9
|
+
const cookieObservableSubscription = cookieObservable.subscribe((value) => {
|
|
10
|
+
testExecutionId = value;
|
|
11
|
+
});
|
|
12
|
+
assembleHook.register(({ eventType }) => {
|
|
13
|
+
if (typeof testExecutionId !== "string") return SKIPPED;
|
|
14
|
+
return {
|
|
15
|
+
type: eventType,
|
|
16
|
+
session: { type: "ci_test" },
|
|
17
|
+
ci_test: { test_execution_id: testExecutionId }
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
return { stop: () => {
|
|
21
|
+
cookieObservableSubscription.unsubscribe();
|
|
22
|
+
} };
|
|
23
|
+
}
|
|
24
|
+
function readCypressTraceId() {
|
|
25
|
+
const cypress = window.Cypress;
|
|
26
|
+
if (!cypress) return;
|
|
27
|
+
try {
|
|
28
|
+
return cypress.env("traceId");
|
|
29
|
+
} catch {
|
|
30
|
+
display.warn("Failed to read Cypress test execution id via Cypress.env(). Upgrade dd-trace-js to >= 5.88.0 to keep RUM ↔ test correlation working.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { CI_VISIBILITY_TEST_ID_COOKIE_NAME, startCiVisibilityContext };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=ciVisibilityContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ciVisibilityContext.mjs","names":[],"sources":["../../../src/domain/contexts/ciVisibilityContext.ts"],"sourcesContent":["import { display, getInitCookie } from '@kubesense/kubesense-browser-core'\nimport { SKIPPED } from '@kubesense/kubesense-js-core/assembly'\nimport { createCookieObservable } from '../../browser/cookieObservable'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\nimport { SessionType } from './sessionContext'\n\nexport const CI_VISIBILITY_TEST_ID_COOKIE_NAME = 'kubesense-ci-visibility-test-execution-id'\n\nexport interface CiTestWindow extends Window {\n Cypress?: {\n env: (key: string) => string | undefined\n }\n}\n\nexport function startCiVisibilityContext(\n assembleHook: AssembleHook,\n cookieObservable = createCookieObservable(CI_VISIBILITY_TEST_ID_COOKIE_NAME)\n) {\n let testExecutionId = getInitCookie(CI_VISIBILITY_TEST_ID_COOKIE_NAME) || readCypressTraceId()\n\n const cookieObservableSubscription = cookieObservable.subscribe((value) => {\n testExecutionId = value\n })\n\n assembleHook.register(({ eventType }): DefaultRumEventAttributes | SKIPPED => {\n if (typeof testExecutionId !== 'string') {\n return SKIPPED\n }\n\n return {\n type: eventType,\n session: {\n type: SessionType.CI_TEST,\n },\n ci_test: {\n test_execution_id: testExecutionId,\n },\n }\n })\n\n return {\n stop: () => {\n cookieObservableSubscription.unsubscribe()\n },\n }\n}\n\nfunction readCypressTraceId(): string | undefined {\n const cypress = (window as CiTestWindow).Cypress\n if (!cypress) {\n return undefined\n }\n try {\n return cypress.env('traceId')\n } catch {\n display.warn(\n 'Failed to read Cypress test execution id via Cypress.env(). Upgrade dd-trace-js to >= 5.88.0 to keep RUM ↔ test correlation working.'\n )\n return undefined\n }\n}\n"],"mappings":";;;;;AAMA,MAAa,oCAAoC;AAQjD,SAAgB,yBACd,cACA,mBAAmB,uBAAuB,iCAAiC,GAC3E;CACA,IAAI,kBAAkB,cAAA,2CAA+C,KAAK,mBAAmB;CAE7F,MAAM,+BAA+B,iBAAiB,WAAW,UAAU;EACzE,kBAAkB;CACpB,CAAC;CAED,aAAa,UAAU,EAAE,gBAAqD;EAC5E,IAAI,OAAO,oBAAoB,UAC7B,OAAO;EAGT,OAAO;GACL,MAAM;GACN,SAAS,EACP,MAAA,UACF;GACA,SAAS,EACP,mBAAmB,gBACrB;EACF;CACF,CAAC;CAED,OAAO,EACL,YAAY;EACV,6BAA6B,YAAY;CAC3C,EACF;AACF;AAEA,SAAS,qBAAyC;CAChD,MAAM,UAAW,OAAwB;CACzC,IAAI,CAAC,SACH;CAEF,IAAI;EACF,OAAO,QAAQ,IAAI,SAAS;CAC9B,QAAQ;EACN,QAAQ,KACN,sIACF;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getConnectivity } from "@kubesense/kubesense-browser-core";
|
|
2
|
+
//#region src/domain/contexts/connectivityContext.ts
|
|
3
|
+
function startConnectivityContext(assembleHook) {
|
|
4
|
+
assembleHook.register(({ eventType }) => ({
|
|
5
|
+
type: eventType,
|
|
6
|
+
connectivity: getConnectivity()
|
|
7
|
+
}));
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { startConnectivityContext };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=connectivityContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectivityContext.mjs","names":[],"sources":["../../../src/domain/contexts/connectivityContext.ts"],"sourcesContent":["import { getConnectivity } from '@kubesense/kubesense-browser-core'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\n\nexport function startConnectivityContext(assembleHook: AssembleHook) {\n assembleHook.register(({ eventType }): DefaultRumEventAttributes => ({\n type: eventType,\n connectivity: getConnectivity(),\n }))\n}\n"],"mappings":";;AAGA,SAAgB,yBAAyB,cAA4B;CACnE,aAAa,UAAU,EAAE,iBAA4C;EACnE,MAAM;EACN,cAAc,gBAAgB;CAChC,EAAE;AACJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { clockDrift, timeStampNow } from "@kubesense/kubesense-js-core/time";
|
|
2
|
+
import { canUseEventBridge, round } from "@kubesense/kubesense-browser-core";
|
|
3
|
+
//#region src/domain/contexts/defaultContext.ts
|
|
4
|
+
function startDefaultContext(assembleHook, configuration, sdkName) {
|
|
5
|
+
assembleHook.register(({ eventType }) => {
|
|
6
|
+
const source = configuration.source;
|
|
7
|
+
return {
|
|
8
|
+
type: eventType,
|
|
9
|
+
_kubesense: {
|
|
10
|
+
format_version: 2,
|
|
11
|
+
drift: clockDrift(),
|
|
12
|
+
configuration: {
|
|
13
|
+
session_sample_rate: round(configuration.sessionSampleRate, 3),
|
|
14
|
+
session_replay_sample_rate: round(configuration.sessionReplaySampleRate, 3),
|
|
15
|
+
profiling_sample_rate: round(configuration.profilingSampleRate, 3),
|
|
16
|
+
trace_sample_rate: round(configuration.traceSampleRate, 3)
|
|
17
|
+
},
|
|
18
|
+
browser_sdk_version: canUseEventBridge() ? "2.0.0" : void 0,
|
|
19
|
+
sdk_name: sdkName
|
|
20
|
+
},
|
|
21
|
+
application: { id: configuration.applicationId },
|
|
22
|
+
date: timeStampNow(),
|
|
23
|
+
source
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { startDefaultContext };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=defaultContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultContext.mjs","names":[],"sources":["../../../src/domain/contexts/defaultContext.ts"],"sourcesContent":["import { clockDrift, timeStampNow } from '@kubesense/kubesense-js-core/time'\nimport { canUseEventBridge, round } from '@kubesense/kubesense-browser-core'\nimport type { RumConfiguration } from '../configuration'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\n\n// replaced at build time\ndeclare const __BUILD_ENV__SDK_VERSION__: string\n\nexport type SdkName = 'rum' | 'rum-slim' | 'rum-synthetics' | 'rum-salesforce' | 'rum-shopify'\n\nexport function startDefaultContext(\n assembleHook: AssembleHook,\n configuration: RumConfiguration,\n sdkName: SdkName | undefined\n) {\n assembleHook.register(({ eventType }): DefaultRumEventAttributes => {\n const source = configuration.source\n\n return {\n type: eventType,\n _kubesense: {\n format_version: 2,\n drift: clockDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(configuration.sessionReplaySampleRate, 3),\n profiling_sample_rate: round(configuration.profilingSampleRate, 3),\n trace_sample_rate: round(configuration.traceSampleRate, 3),\n },\n browser_sdk_version: canUseEventBridge() ? __BUILD_ENV__SDK_VERSION__ : undefined,\n sdk_name: sdkName,\n },\n application: {\n id: configuration.applicationId,\n },\n date: timeStampNow(),\n source,\n }\n })\n}\n"],"mappings":";;;AAUA,SAAgB,oBACd,cACA,eACA,SACA;CACA,aAAa,UAAU,EAAE,gBAA2C;EAClE,MAAM,SAAS,cAAc;EAE7B,OAAO;GACL,MAAM;GACN,YAAY;IACV,gBAAgB;IAChB,OAAO,WAAW;IAClB,eAAe;KACb,qBAAqB,MAAM,cAAc,mBAAmB,CAAC;KAC7D,4BAA4B,MAAM,cAAc,yBAAyB,CAAC;KAC1E,uBAAuB,MAAM,cAAc,qBAAqB,CAAC;KACjE,mBAAmB,MAAM,cAAc,iBAAiB,CAAC;IAC3D;IACA,qBAAqB,kBAAkB,IAAA,UAAiC,KAAA;IACxE,UAAU;GACZ;GACA,aAAa,EACX,IAAI,cAAc,cACpB;GACA,MAAM,aAAa;GACnB;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getViewportDimension, initViewportObservable } from "../../browser/viewportObservable.mjs";
|
|
2
|
+
import { monitor } from "@kubesense/kubesense-js-core/monitor";
|
|
3
|
+
//#region src/domain/contexts/displayContext.ts
|
|
4
|
+
function startDisplayContext(assembleHook) {
|
|
5
|
+
let viewport;
|
|
6
|
+
const animationFrameId = requestAnimationFrame(monitor(() => {
|
|
7
|
+
viewport = getViewportDimension();
|
|
8
|
+
}));
|
|
9
|
+
const unsubscribeViewport = initViewportObservable().subscribe((viewportDimension) => {
|
|
10
|
+
viewport = viewportDimension;
|
|
11
|
+
}).unsubscribe;
|
|
12
|
+
assembleHook.register(({ eventType }) => ({
|
|
13
|
+
type: eventType,
|
|
14
|
+
display: viewport ? { viewport } : void 0
|
|
15
|
+
}));
|
|
16
|
+
return { stop: () => {
|
|
17
|
+
unsubscribeViewport();
|
|
18
|
+
if (animationFrameId) cancelAnimationFrame(animationFrameId);
|
|
19
|
+
} };
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { startDisplayContext };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=displayContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayContext.mjs","names":[],"sources":["../../../src/domain/contexts/displayContext.ts"],"sourcesContent":["import { monitor } from '@kubesense/kubesense-js-core/monitor'\nimport type { ViewportDimension } from '../../browser/viewportObservable'\nimport { getViewportDimension, initViewportObservable } from '../../browser/viewportObservable'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\n\nexport type DisplayContext = ReturnType<typeof startDisplayContext>\n\nexport function startDisplayContext(assembleHook: AssembleHook) {\n let viewport: ViewportDimension | undefined\n // Use requestAnimationFrame to delay the calculation of viewport dimensions until after SDK initialization, preventing long tasks.\n const animationFrameId = requestAnimationFrame(\n monitor(() => {\n viewport = getViewportDimension()\n })\n )\n\n const unsubscribeViewport = initViewportObservable().subscribe((viewportDimension) => {\n viewport = viewportDimension\n }).unsubscribe\n\n assembleHook.register(({ eventType }): DefaultRumEventAttributes => ({\n type: eventType,\n display: viewport ? { viewport } : undefined,\n }))\n\n return {\n stop: () => {\n unsubscribeViewport()\n if (animationFrameId) {\n cancelAnimationFrame(animationFrameId)\n }\n },\n }\n}\n"],"mappings":";;;AAOA,SAAgB,oBAAoB,cAA4B;CAC9D,IAAI;CAEJ,MAAM,mBAAmB,sBACvB,cAAc;EACZ,WAAW,qBAAqB;CAClC,CAAC,CACH;CAEA,MAAM,sBAAsB,uBAAuB,CAAC,CAAC,WAAW,sBAAsB;EACpF,WAAW;CACb,CAAC,CAAC,CAAC;CAEH,aAAa,UAAU,EAAE,iBAA4C;EACnE,MAAM;EACN,SAAS,WAAW,EAAE,SAAS,IAAI,KAAA;CACrC,EAAE;CAEF,OAAO,EACL,YAAY;EACV,oBAAoB;EACpB,IAAI,kBACF,qBAAqB,gBAAgB;CAEzC,EACF;AACF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RumEventType } from "../../rawRumEvent.types.mjs";
|
|
2
|
+
import "../lifeCycle.mjs";
|
|
3
|
+
import { SESSION_TIME_OUT_DELAY, createValueHistory, isEmptyObject } from "@kubesense/kubesense-browser-core";
|
|
4
|
+
import { SKIPPED } from "@kubesense/kubesense-js-core/assembly";
|
|
5
|
+
//#region src/domain/contexts/featureFlagContext.ts
|
|
6
|
+
const FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;
|
|
7
|
+
/**
|
|
8
|
+
* Start feature flag contexts
|
|
9
|
+
*
|
|
10
|
+
* Feature flag contexts follow the life of views.
|
|
11
|
+
* A new context is added when a view is created and ended when the view is ended
|
|
12
|
+
*
|
|
13
|
+
* Note: we choose not to add a new context at each evaluation to save memory
|
|
14
|
+
*/
|
|
15
|
+
function startFeatureFlagContexts(lifeCycle, assembleHook, configuration) {
|
|
16
|
+
const featureFlagContexts = createValueHistory({ expireDelay: FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY });
|
|
17
|
+
lifeCycle.subscribe(1, ({ startClocks }) => {
|
|
18
|
+
featureFlagContexts.add({}, startClocks.relative);
|
|
19
|
+
});
|
|
20
|
+
lifeCycle.subscribe(6, ({ endClocks }) => {
|
|
21
|
+
featureFlagContexts.closeActive(endClocks.relative);
|
|
22
|
+
});
|
|
23
|
+
assembleHook.register(({ startTime, eventType }) => {
|
|
24
|
+
if (!configuration.trackFeatureFlagsForEvents.concat([RumEventType.VIEW, RumEventType.ERROR]).includes(eventType)) return SKIPPED;
|
|
25
|
+
const featureFlagContext = featureFlagContexts.find(startTime);
|
|
26
|
+
if (!featureFlagContext || isEmptyObject(featureFlagContext)) return SKIPPED;
|
|
27
|
+
return {
|
|
28
|
+
type: eventType,
|
|
29
|
+
feature_flags: featureFlagContext
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
return { addFeatureFlagEvaluation: (key, value) => {
|
|
33
|
+
const currentContext = featureFlagContexts.find();
|
|
34
|
+
if (currentContext) currentContext[key] = value;
|
|
35
|
+
} };
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY, startFeatureFlagContexts };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=featureFlagContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureFlagContext.mjs","names":[],"sources":["../../../src/domain/contexts/featureFlagContext.ts"],"sourcesContent":["import type { ContextValue, Context } from '@kubesense/kubesense-browser-core'\nimport { SESSION_TIME_OUT_DELAY, createValueHistory, isEmptyObject } from '@kubesense/kubesense-browser-core'\nimport { SKIPPED } from '@kubesense/kubesense-js-core/assembly'\nimport type { LifeCycle } from '../lifeCycle'\nimport { LifeCycleEventType } from '../lifeCycle'\nimport { RumEventType } from '../../rawRumEvent.types'\nimport type { RumConfiguration } from '../configuration'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\n\nexport const FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY\nexport const BYTES_COMPUTATION_THROTTLING_DELAY = 200\n\nexport type FeatureFlagContext = Context\n\nexport interface FeatureFlagContexts {\n addFeatureFlagEvaluation: (key: string, value: ContextValue) => void\n}\n\n/**\n * Start feature flag contexts\n *\n * Feature flag contexts follow the life of views.\n * A new context is added when a view is created and ended when the view is ended\n *\n * Note: we choose not to add a new context at each evaluation to save memory\n */\nexport function startFeatureFlagContexts(\n lifeCycle: LifeCycle,\n assembleHook: AssembleHook,\n configuration: RumConfiguration\n): FeatureFlagContexts {\n const featureFlagContexts = createValueHistory<FeatureFlagContext>({\n expireDelay: FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY,\n })\n\n lifeCycle.subscribe(LifeCycleEventType.BEFORE_VIEW_CREATED, ({ startClocks }) => {\n featureFlagContexts.add({}, startClocks.relative)\n })\n\n lifeCycle.subscribe(LifeCycleEventType.AFTER_VIEW_ENDED, ({ endClocks }) => {\n featureFlagContexts.closeActive(endClocks.relative)\n })\n\n assembleHook.register(({ startTime, eventType }): DefaultRumEventAttributes | SKIPPED => {\n const trackFeatureFlagsForEvents = (configuration.trackFeatureFlagsForEvents as RumEventType[]).concat([\n RumEventType.VIEW,\n RumEventType.ERROR,\n ])\n if (!trackFeatureFlagsForEvents.includes(eventType as RumEventType)) {\n return SKIPPED\n }\n\n const featureFlagContext = featureFlagContexts.find(startTime)\n if (!featureFlagContext || isEmptyObject(featureFlagContext)) {\n return SKIPPED\n }\n\n return {\n type: eventType,\n feature_flags: featureFlagContext,\n }\n })\n\n return {\n addFeatureFlagEvaluation: (key: string, value: ContextValue) => {\n const currentContext = featureFlagContexts.find()\n if (currentContext) {\n currentContext[key] = value\n }\n },\n }\n}\n"],"mappings":";;;;;AASA,MAAa,sCAAsC;;;;;;;;;AAiBnD,SAAgB,yBACd,WACA,cACA,eACqB;CACrB,MAAM,sBAAsB,mBAAuC,EACjE,aAAa,oCACf,CAAC;CAED,UAAU,UAAA,IAAmD,EAAE,kBAAkB;EAC/E,oBAAoB,IAAI,CAAC,GAAG,YAAY,QAAQ;CAClD,CAAC;CAED,UAAU,UAAA,IAAgD,EAAE,gBAAgB;EAC1E,oBAAoB,YAAY,UAAU,QAAQ;CACpD,CAAC;CAED,aAAa,UAAU,EAAE,WAAW,gBAAqD;EAKvF,IAAI,CAJgC,cAAc,2BAA8C,OAAO,CACrG,aAAa,MACb,aAAa,KACf,CAC8B,CAAC,CAAC,SAAS,SAAyB,GAChE,OAAO;EAGT,MAAM,qBAAqB,oBAAoB,KAAK,SAAS;EAC7D,IAAI,CAAC,sBAAsB,cAAc,kBAAkB,GACzD,OAAO;EAGT,OAAO;GACL,MAAM;GACN,eAAe;EACjB;CACF,CAAC;CAED,OAAO,EACL,2BAA2B,KAAa,UAAwB;EAC9D,MAAM,iBAAiB,oBAAoB,KAAK;EAChD,IAAI,gBACF,eAAe,OAAO;CAE1B,EACF;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/domain/contexts/internalContext.ts
|
|
2
|
+
/**
|
|
3
|
+
* Internal context keep returning v1 format
|
|
4
|
+
* to not break compatibility with logs data format
|
|
5
|
+
*/
|
|
6
|
+
function startInternalContext(applicationId, sessionManager, viewHistory, actionContexts, urlContexts) {
|
|
7
|
+
return { get: (startTime) => {
|
|
8
|
+
const viewContext = viewHistory.findView(startTime);
|
|
9
|
+
const urlContext = urlContexts.findUrl(startTime);
|
|
10
|
+
const session = sessionManager.findTrackedSession(startTime);
|
|
11
|
+
if (session && viewContext && urlContext) {
|
|
12
|
+
const actionId = actionContexts.findActionId(startTime);
|
|
13
|
+
return {
|
|
14
|
+
application_id: applicationId,
|
|
15
|
+
session_id: session.id,
|
|
16
|
+
user_action: actionId ? { id: actionId } : void 0,
|
|
17
|
+
view: {
|
|
18
|
+
id: viewContext.id,
|
|
19
|
+
name: viewContext.name,
|
|
20
|
+
referrer: urlContext.referrer,
|
|
21
|
+
url: urlContext.url
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
} };
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { startInternalContext };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=internalContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalContext.mjs","names":[],"sources":["../../../src/domain/contexts/internalContext.ts"],"sourcesContent":["import type { RelativeTime } from '@kubesense/kubesense-js-core/time'\nimport type { RumInternalContext, SessionManager } from '@kubesense/kubesense-browser-core'\nimport type { ActionContexts } from '../action/actionCollection'\nimport type { ViewHistory } from './viewHistory'\nimport type { UrlContexts } from './urlContexts'\n\n/**\n * Internal context keep returning v1 format\n * to not break compatibility with logs data format\n */\nexport function startInternalContext(\n applicationId: string,\n sessionManager: SessionManager,\n viewHistory: ViewHistory,\n actionContexts: ActionContexts,\n urlContexts: UrlContexts\n) {\n return {\n get: (startTime?: number): RumInternalContext | undefined => {\n const viewContext = viewHistory.findView(startTime as RelativeTime)\n const urlContext = urlContexts.findUrl(startTime as RelativeTime)\n const session = sessionManager.findTrackedSession(startTime as RelativeTime)\n if (session && viewContext && urlContext) {\n const actionId = actionContexts.findActionId(startTime as RelativeTime)\n return {\n application_id: applicationId,\n session_id: session.id,\n user_action: actionId ? { id: actionId } : undefined,\n view: { id: viewContext.id, name: viewContext.name, referrer: urlContext.referrer, url: urlContext.url },\n }\n }\n },\n }\n}\n"],"mappings":";;;;;AAUA,SAAgB,qBACd,eACA,gBACA,aACA,gBACA,aACA;CACA,OAAO,EACL,MAAM,cAAuD;EAC3D,MAAM,cAAc,YAAY,SAAS,SAAyB;EAClE,MAAM,aAAa,YAAY,QAAQ,SAAyB;EAChE,MAAM,UAAU,eAAe,mBAAmB,SAAyB;EAC3E,IAAI,WAAW,eAAe,YAAY;GACxC,MAAM,WAAW,eAAe,aAAa,SAAyB;GACtE,OAAO;IACL,gBAAgB;IAChB,YAAY,QAAQ;IACpB,aAAa,WAAW,EAAE,IAAI,SAAS,IAAI,KAAA;IAC3C,MAAM;KAAE,IAAI,YAAY;KAAI,MAAM,YAAY;KAAM,UAAU,WAAW;KAAU,KAAK,WAAW;IAAI;GACzG;EACF;CACF,EACF;AACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { RumEventType } from "../../rawRumEvent.types.mjs";
|
|
2
|
+
import { supportPerformanceTimingEvent } from "../../browser/performanceObservable.mjs";
|
|
3
|
+
import { elapsed, relativeNow, toServerDuration } from "@kubesense/kubesense-js-core/time";
|
|
4
|
+
import { DOM_EVENT, SESSION_TIME_OUT_DELAY, addEventListeners, createValueHistory } from "@kubesense/kubesense-browser-core";
|
|
5
|
+
import { SKIPPED } from "@kubesense/kubesense-js-core/assembly";
|
|
6
|
+
//#region src/domain/contexts/pageStateHistory.ts
|
|
7
|
+
const MAX_PAGE_STATE_ENTRIES = 4e3;
|
|
8
|
+
const PAGE_STATE_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;
|
|
9
|
+
function startPageStateHistory(assembleHook, maxPageStateEntriesSelectable = 500) {
|
|
10
|
+
const pageStateEntryHistory = createValueHistory({
|
|
11
|
+
expireDelay: PAGE_STATE_CONTEXT_TIME_OUT_DELAY,
|
|
12
|
+
maxEntries: MAX_PAGE_STATE_ENTRIES
|
|
13
|
+
});
|
|
14
|
+
let currentPageState;
|
|
15
|
+
if (supportPerformanceTimingEvent("visibility-state")) performance.getEntriesByType("visibility-state").forEach((entry) => {
|
|
16
|
+
addPageState(entry.name === "hidden" ? "hidden" : "active", entry.startTime);
|
|
17
|
+
});
|
|
18
|
+
addPageState(getPageState(), relativeNow());
|
|
19
|
+
const { stop: stopEventListeners } = addEventListeners(window, [
|
|
20
|
+
DOM_EVENT.PAGE_SHOW,
|
|
21
|
+
DOM_EVENT.FOCUS,
|
|
22
|
+
DOM_EVENT.BLUR,
|
|
23
|
+
DOM_EVENT.VISIBILITY_CHANGE,
|
|
24
|
+
DOM_EVENT.RESUME,
|
|
25
|
+
DOM_EVENT.FREEZE,
|
|
26
|
+
DOM_EVENT.PAGE_HIDE
|
|
27
|
+
], (event) => {
|
|
28
|
+
addPageState(computePageState(event), event.timeStamp);
|
|
29
|
+
}, { capture: true });
|
|
30
|
+
function addPageState(nextPageState, startTime = relativeNow()) {
|
|
31
|
+
if (nextPageState === currentPageState) return;
|
|
32
|
+
currentPageState = nextPageState;
|
|
33
|
+
pageStateEntryHistory.closeActive(startTime);
|
|
34
|
+
pageStateEntryHistory.add({
|
|
35
|
+
state: currentPageState,
|
|
36
|
+
startTime
|
|
37
|
+
}, startTime);
|
|
38
|
+
}
|
|
39
|
+
function wasInPageStateDuringPeriod(state, startTime, duration) {
|
|
40
|
+
return pageStateEntryHistory.findAll(startTime, duration).some((pageState) => pageState.state === state);
|
|
41
|
+
}
|
|
42
|
+
assembleHook.register(({ startTime, duration = 0, eventType }) => {
|
|
43
|
+
if (eventType === RumEventType.VIEW) return {
|
|
44
|
+
type: eventType,
|
|
45
|
+
_kubesense: { page_states: processPageStates(pageStateEntryHistory.findAll(startTime, duration), startTime, maxPageStateEntriesSelectable) }
|
|
46
|
+
};
|
|
47
|
+
if (eventType === RumEventType.ACTION || eventType === RumEventType.ERROR) return {
|
|
48
|
+
type: eventType,
|
|
49
|
+
view: { in_foreground: wasInPageStateDuringPeriod("active", startTime, 0) }
|
|
50
|
+
};
|
|
51
|
+
return SKIPPED;
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
wasInPageStateDuringPeriod,
|
|
55
|
+
addPageState,
|
|
56
|
+
stop: () => {
|
|
57
|
+
stopEventListeners();
|
|
58
|
+
pageStateEntryHistory.stop();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function processPageStates(pageStateEntries, eventStartTime, maxPageStateEntriesSelectable) {
|
|
63
|
+
if (pageStateEntries.length === 0) return;
|
|
64
|
+
return pageStateEntries.slice(-maxPageStateEntriesSelectable).reverse().map(({ state, startTime }) => ({
|
|
65
|
+
state,
|
|
66
|
+
start: toServerDuration(elapsed(eventStartTime, startTime))
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
function computePageState(event) {
|
|
70
|
+
if (event.type === DOM_EVENT.FREEZE) return "frozen";
|
|
71
|
+
else if (event.type === DOM_EVENT.PAGE_HIDE) return event.persisted ? "frozen" : "terminated";
|
|
72
|
+
return getPageState();
|
|
73
|
+
}
|
|
74
|
+
function getPageState() {
|
|
75
|
+
if (document.visibilityState === "hidden") return "hidden";
|
|
76
|
+
if (document.hasFocus()) return "active";
|
|
77
|
+
return "passive";
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { MAX_PAGE_STATE_ENTRIES, PAGE_STATE_CONTEXT_TIME_OUT_DELAY, startPageStateHistory };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=pageStateHistory.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageStateHistory.mjs","names":[],"sources":["../../../src/domain/contexts/pageStateHistory.ts"],"sourcesContent":["import { elapsed, toServerDuration, relativeNow } from '@kubesense/kubesense-js-core/time'\nimport type { Duration, RelativeTime } from '@kubesense/kubesense-js-core/time'\nimport { SKIPPED } from '@kubesense/kubesense-js-core/assembly'\nimport {\n createValueHistory,\n SESSION_TIME_OUT_DELAY,\n addEventListeners,\n DOM_EVENT,\n} from '@kubesense/kubesense-browser-core'\nimport { supportPerformanceTimingEvent, RumPerformanceEntryType } from '../../browser/performanceObservable'\nimport type { PageStateServerEntry } from '../../rawRumEvent.types'\nimport { RumEventType } from '../../rawRumEvent.types'\nimport type { AssembleHook, DefaultRumEventAttributes } from '../hooks'\n\n// Arbitrary value to cap number of element for memory consumption in the browser\nexport const MAX_PAGE_STATE_ENTRIES = 4000\n// Arbitrary value to cap number of element for backend & to save bandwidth\nexport const MAX_PAGE_STATE_ENTRIES_SELECTABLE = 500\n\nexport const PAGE_STATE_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY\n\nexport const enum PageState {\n ACTIVE = 'active',\n PASSIVE = 'passive',\n HIDDEN = 'hidden',\n FROZEN = 'frozen',\n TERMINATED = 'terminated',\n}\n\nexport interface PageStateEntry {\n state: PageState\n startTime: RelativeTime\n}\n\nexport interface PageStateHistory {\n wasInPageStateDuringPeriod: (state: PageState, startTime: RelativeTime, duration: Duration) => boolean\n addPageState(nextPageState: PageState, startTime?: RelativeTime): void\n stop: () => void\n}\n\nexport function startPageStateHistory(\n assembleHook: AssembleHook,\n maxPageStateEntriesSelectable = MAX_PAGE_STATE_ENTRIES_SELECTABLE\n): PageStateHistory {\n const pageStateEntryHistory = createValueHistory<PageStateEntry>({\n expireDelay: PAGE_STATE_CONTEXT_TIME_OUT_DELAY,\n maxEntries: MAX_PAGE_STATE_ENTRIES,\n })\n\n let currentPageState: PageState\n\n if (supportPerformanceTimingEvent(RumPerformanceEntryType.VISIBILITY_STATE)) {\n const visibilityEntries = performance.getEntriesByType(RumPerformanceEntryType.VISIBILITY_STATE)\n\n visibilityEntries.forEach((entry) => {\n const state = entry.name === 'hidden' ? PageState.HIDDEN : PageState.ACTIVE\n addPageState(state, entry.startTime as RelativeTime)\n })\n }\n\n addPageState(getPageState(), relativeNow())\n\n const { stop: stopEventListeners } = addEventListeners(\n window,\n [\n DOM_EVENT.PAGE_SHOW,\n DOM_EVENT.FOCUS,\n DOM_EVENT.BLUR,\n DOM_EVENT.VISIBILITY_CHANGE,\n DOM_EVENT.RESUME,\n DOM_EVENT.FREEZE,\n DOM_EVENT.PAGE_HIDE,\n ],\n (event) => {\n addPageState(computePageState(event), event.timeStamp as RelativeTime)\n },\n { capture: true }\n )\n\n function addPageState(nextPageState: PageState, startTime = relativeNow()) {\n if (nextPageState === currentPageState) {\n return\n }\n\n currentPageState = nextPageState\n pageStateEntryHistory.closeActive(startTime)\n pageStateEntryHistory.add({ state: currentPageState, startTime }, startTime)\n }\n\n function wasInPageStateDuringPeriod(state: PageState, startTime: RelativeTime, duration: Duration) {\n return pageStateEntryHistory.findAll(startTime, duration).some((pageState) => pageState.state === state)\n }\n\n assembleHook.register(({ startTime, duration = 0 as Duration, eventType }): DefaultRumEventAttributes | SKIPPED => {\n if (eventType === RumEventType.VIEW) {\n const pageStates = pageStateEntryHistory.findAll(startTime, duration)\n return {\n type: eventType,\n _kubesense: { page_states: processPageStates(pageStates, startTime, maxPageStateEntriesSelectable) },\n }\n }\n\n if (eventType === RumEventType.ACTION || eventType === RumEventType.ERROR) {\n return {\n type: eventType,\n view: { in_foreground: wasInPageStateDuringPeriod(PageState.ACTIVE, startTime, 0 as Duration) },\n }\n }\n\n return SKIPPED\n })\n\n return {\n wasInPageStateDuringPeriod,\n addPageState,\n stop: () => {\n stopEventListeners()\n pageStateEntryHistory.stop()\n },\n }\n}\n\nfunction processPageStates(\n pageStateEntries: PageStateEntry[],\n eventStartTime: RelativeTime,\n maxPageStateEntriesSelectable: number\n): PageStateServerEntry[] | undefined {\n if (pageStateEntries.length === 0) {\n return\n }\n\n return pageStateEntries\n .slice(-maxPageStateEntriesSelectable)\n .reverse()\n .map(({ state, startTime }) => ({\n state,\n start: toServerDuration(elapsed(eventStartTime, startTime)),\n }))\n}\n\nfunction computePageState(event: Event & { type: DOM_EVENT }) {\n if (event.type === DOM_EVENT.FREEZE) {\n return PageState.FROZEN\n } else if (event.type === DOM_EVENT.PAGE_HIDE) {\n return (event as PageTransitionEvent).persisted ? PageState.FROZEN : PageState.TERMINATED\n }\n return getPageState()\n}\n\nfunction getPageState() {\n if (document.visibilityState === 'hidden') {\n return PageState.HIDDEN\n }\n\n if (document.hasFocus()) {\n return PageState.ACTIVE\n }\n\n return PageState.PASSIVE\n}\n"],"mappings":";;;;;;AAeA,MAAa,yBAAyB;AAItC,MAAa,oCAAoC;AAqBjD,SAAgB,sBACd,cACA,gCAAA,KACkB;CAClB,MAAM,wBAAwB,mBAAmC;EAC/D,aAAa;EACb,YAAY;CACd,CAAC;CAED,IAAI;CAEJ,IAAI,8BAAA,kBAAsE,GAGxE,YAFsC,iBAAA,kBAEtB,CAAC,CAAC,SAAS,UAAU;EAEnC,aADc,MAAM,SAAS,WAAA,WAAA,UACT,MAAM,SAAyB;CACrD,CAAC;CAGH,aAAa,aAAa,GAAG,YAAY,CAAC;CAE1C,MAAM,EAAE,MAAM,uBAAuB,kBACnC,QACA;EACE,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;CACZ,IACC,UAAU;EACT,aAAa,iBAAiB,KAAK,GAAG,MAAM,SAAyB;CACvE,GACA,EAAE,SAAS,KAAK,CAClB;CAEA,SAAS,aAAa,eAA0B,YAAY,YAAY,GAAG;EACzE,IAAI,kBAAkB,kBACpB;EAGF,mBAAmB;EACnB,sBAAsB,YAAY,SAAS;EAC3C,sBAAsB,IAAI;GAAE,OAAO;GAAkB;EAAU,GAAG,SAAS;CAC7E;CAEA,SAAS,2BAA2B,OAAkB,WAAyB,UAAoB;EACjG,OAAO,sBAAsB,QAAQ,WAAW,QAAQ,CAAC,CAAC,MAAM,cAAc,UAAU,UAAU,KAAK;CACzG;CAEA,aAAa,UAAU,EAAE,WAAW,WAAW,GAAe,gBAAqD;EACjH,IAAI,cAAc,aAAa,MAE7B,OAAO;GACL,MAAM;GACN,YAAY,EAAE,aAAa,kBAHV,sBAAsB,QAAQ,WAAW,QAGJ,GAAG,WAAW,6BAA6B,EAAE;EACrG;EAGF,IAAI,cAAc,aAAa,UAAU,cAAc,aAAa,OAClE,OAAO;GACL,MAAM;GACN,MAAM,EAAE,eAAe,2BAAA,UAA6C,WAAW,CAAa,EAAE;EAChG;EAGF,OAAO;CACT,CAAC;CAED,OAAO;EACL;EACA;EACA,YAAY;GACV,mBAAmB;GACnB,sBAAsB,KAAK;EAC7B;CACF;AACF;AAEA,SAAS,kBACP,kBACA,gBACA,+BACoC;CACpC,IAAI,iBAAiB,WAAW,GAC9B;CAGF,OAAO,iBACJ,MAAM,CAAC,6BAA6B,CAAC,CACrC,QAAQ,CAAC,CACT,KAAK,EAAE,OAAO,iBAAiB;EAC9B;EACA,OAAO,iBAAiB,QAAQ,gBAAgB,SAAS,CAAC;CAC5D,EAAE;AACN;AAEA,SAAS,iBAAiB,OAAoC;CAC5D,IAAI,MAAM,SAAS,UAAU,QAC3B,OAAA;MACK,IAAI,MAAM,SAAS,UAAU,WAClC,OAAQ,MAA8B,YAAA,WAAA;CAExC,OAAO,aAAa;AACtB;AAEA,SAAS,eAAe;CACtB,IAAI,SAAS,oBAAoB,UAC/B,OAAA;CAGF,IAAI,SAAS,SAAS,GACpB,OAAA;CAGF,OAAA;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RumEventType } from "../../rawRumEvent.types.mjs";
|
|
2
|
+
import { computeSessionReplayState } from "../sessionReplayState.mjs";
|
|
3
|
+
import { DISCARDED } from "@kubesense/kubesense-js-core/assembly";
|
|
4
|
+
//#region src/domain/contexts/sessionContext.ts
|
|
5
|
+
function startSessionContext(assembleHook, configuration, sessionManager, recorderApi, viewHistory) {
|
|
6
|
+
assembleHook.register(({ eventType, startTime }) => {
|
|
7
|
+
const session = sessionManager.findTrackedSession(startTime);
|
|
8
|
+
const view = viewHistory.findView(startTime);
|
|
9
|
+
if (!session || !view) return DISCARDED;
|
|
10
|
+
let hasReplay;
|
|
11
|
+
let sampledForReplay;
|
|
12
|
+
let isActive;
|
|
13
|
+
if (eventType === RumEventType.VIEW) {
|
|
14
|
+
hasReplay = recorderApi.getReplayStats(view.id) ? true : void 0;
|
|
15
|
+
sampledForReplay = computeSessionReplayState(session, configuration) === 1;
|
|
16
|
+
isActive = view.sessionIsActive ? void 0 : false;
|
|
17
|
+
} else hasReplay = recorderApi.isRecording() ? true : void 0;
|
|
18
|
+
return {
|
|
19
|
+
type: eventType,
|
|
20
|
+
session: {
|
|
21
|
+
id: session.id,
|
|
22
|
+
type: "user",
|
|
23
|
+
has_replay: hasReplay,
|
|
24
|
+
sampled_for_replay: sampledForReplay,
|
|
25
|
+
is_active: isActive
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { startSessionContext };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=sessionContext.mjs.map
|