@openobserve/browser-core 0.2.11 → 0.2.12-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/package.json +6 -5
- package/src/boot/displayAlreadyInitializedError.ts +8 -0
- package/src/boot/init.ts +29 -15
- package/src/browser/addEventListener.ts +44 -35
- package/src/browser/{types.ts → browser.types.ts} +42 -0
- package/src/browser/cookie.ts +69 -15
- package/src/browser/fetchObservable.ts +97 -42
- package/src/browser/{pageExitObservable.ts → pageMayExitObservable.ts} +11 -24
- package/src/browser/runOnReadyState.ts +14 -4
- package/src/browser/xhrObservable.ts +45 -38
- package/src/domain/allowedTrackingOrigins.ts +30 -0
- package/src/domain/bufferedData.ts +32 -0
- package/src/domain/configuration/configuration.ts +366 -95
- package/src/domain/configuration/endpointBuilder.ts +48 -64
- package/src/domain/configuration/index.ts +6 -4
- package/src/domain/configuration/transportConfiguration.ts +42 -35
- package/src/domain/connectivity/connectivity.ts +31 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +59 -27
- package/src/domain/context/contextConstants.ts +27 -0
- package/src/domain/context/contextManager.ts +85 -0
- package/src/domain/context/contextUtils.ts +14 -0
- package/src/domain/context/defineContextMethod.ts +31 -0
- package/src/domain/context/storeContextManager.ts +55 -0
- package/src/domain/contexts/accountContext.ts +47 -0
- package/src/domain/contexts/globalContext.ts +30 -0
- package/src/domain/contexts/rumInternalContext.type.ts +15 -0
- package/src/domain/contexts/userContext.ts +64 -0
- package/src/domain/deflate/{types.ts → deflate.types.ts} +18 -2
- package/src/domain/deflate/index.ts +1 -1
- package/src/domain/error/error.ts +28 -84
- package/src/domain/error/error.types.ts +21 -4
- package/src/domain/error/trackRuntimeError.ts +37 -8
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +5 -2
- package/src/domain/extension/extensionUtils.ts +28 -0
- package/src/domain/intakeSites.ts +18 -0
- package/src/domain/report/browser.types.ts +12 -0
- package/src/domain/report/reportObservable.ts +37 -30
- package/src/domain/resourceUtils.ts +20 -16
- package/src/domain/session/README.md +193 -0
- package/src/domain/session/oldCookiesMigration.ts +7 -7
- package/src/domain/session/sessionConstants.ts +16 -1
- package/src/domain/session/sessionManager.ts +179 -15
- package/src/domain/session/sessionState.ts +49 -17
- package/src/domain/session/sessionStateValidation.ts +9 -0
- package/src/domain/session/sessionStore.ts +118 -55
- package/src/domain/session/sessionStoreOperations.ts +51 -32
- package/src/domain/session/storeStrategies/sessionInCookie.ts +113 -23
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +11 -8
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +6 -2
- package/src/domain/synthetics/syntheticsWorkerValues.ts +15 -4
- package/src/domain/tags.ts +76 -0
- package/src/domain/telemetry/index.ts +12 -4
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +11 -3
- package/src/domain/telemetry/telemetry.ts +242 -98
- package/src/domain/telemetry/telemetryEvent.types.ts +530 -5
- package/src/domain/trackingConsent.ts +34 -0
- package/src/index.ts +92 -55
- package/src/tools/abstractHooks.ts +72 -0
- package/src/tools/abstractLifeCycle.ts +1 -0
- package/src/tools/boundedBuffer.ts +36 -8
- package/src/tools/display.ts +18 -13
- package/src/tools/encoder.ts +103 -0
- package/src/tools/experimentalFeatures.ts +18 -9
- package/src/tools/getZoneJsOriginalValue.ts +1 -1
- package/src/tools/{getGlobalObject.ts → globalObject.ts} +20 -0
- package/src/tools/instrumentMethod.ts +127 -66
- package/src/tools/matchOption.ts +1 -2
- package/src/tools/mergeInto.ts +16 -16
- package/src/tools/monitor.ts +14 -10
- package/src/tools/observable.ts +79 -15
- package/src/tools/queueMicrotask.ts +13 -0
- package/src/tools/readBytesFromStream.ts +24 -64
- package/src/tools/requestIdleCallback.ts +40 -0
- package/src/tools/sendToExtension.ts +3 -1
- package/src/tools/serialisation/context.ts +4 -1
- package/src/tools/serialisation/sanitize.ts +32 -14
- package/src/tools/stackTrace/computeStackTrace.ts +250 -0
- package/src/tools/stackTrace/handlingStack.ts +48 -0
- package/src/tools/taskQueue.ts +63 -0
- package/src/tools/timer.ts +1 -1
- package/src/tools/utils/arrayUtils.ts +11 -3
- package/src/tools/utils/browserDetection.ts +35 -3
- package/src/tools/utils/byteUtils.ts +13 -2
- package/src/tools/utils/functionUtils.ts +0 -2
- package/src/tools/utils/numberUtils.ts +2 -1
- package/src/tools/utils/objectUtils.ts +1 -3
- package/src/tools/utils/polyfills.ts +6 -110
- package/src/tools/utils/responseUtils.ts +1 -1
- package/src/tools/utils/stringUtils.ts +62 -4
- package/src/tools/utils/timeUtils.ts +18 -13
- package/src/tools/utils/timezone.ts +9 -0
- package/src/tools/utils/urlPolyfill.ts +29 -59
- package/src/tools/valueHistory.ts +66 -35
- package/src/transport/batch.ts +113 -61
- package/src/transport/eventBridge.ts +24 -5
- package/src/transport/flushController.ts +44 -23
- package/src/transport/httpRequest.ts +99 -71
- package/src/transport/index.ts +7 -4
- package/src/transport/sendWithRetryStrategy.ts +60 -41
- package/cjs/boot/init.d.ts +0 -5
- package/cjs/boot/init.js +0 -36
- package/cjs/boot/init.js.map +0 -1
- package/cjs/browser/addEventListener.d.ts +0 -76
- package/cjs/browser/addEventListener.js +0 -52
- package/cjs/browser/addEventListener.js.map +0 -1
- package/cjs/browser/cookie.d.ts +0 -10
- package/cjs/browser/cookie.js +0 -69
- package/cjs/browser/cookie.js.map +0 -1
- package/cjs/browser/fetchObservable.d.ts +0 -23
- package/cjs/browser/fetchObservable.js +0 -74
- package/cjs/browser/fetchObservable.js.map +0 -1
- package/cjs/browser/pageExitObservable.d.ts +0 -14
- package/cjs/browser/pageExitObservable.js +0 -58
- package/cjs/browser/pageExitObservable.js.map +0 -1
- package/cjs/browser/runOnReadyState.d.ts +0 -2
- package/cjs/browser/runOnReadyState.js +0 -15
- package/cjs/browser/runOnReadyState.js.map +0 -1
- package/cjs/browser/types.d.ts +0 -19
- package/cjs/browser/types.js +0 -6
- package/cjs/browser/types.js.map +0 -1
- package/cjs/browser/xhrObservable.d.ts +0 -22
- package/cjs/browser/xhrObservable.js +0 -93
- package/cjs/browser/xhrObservable.js.map +0 -1
- package/cjs/domain/configuration/configuration.d.ts +0 -67
- package/cjs/domain/configuration/configuration.js +0 -95
- package/cjs/domain/configuration/configuration.js.map +0 -1
- package/cjs/domain/configuration/endpointBuilder.d.ts +0 -14
- package/cjs/domain/configuration/endpointBuilder.js +0 -94
- package/cjs/domain/configuration/endpointBuilder.js.map +0 -1
- package/cjs/domain/configuration/index.d.ts +0 -3
- package/cjs/domain/configuration/index.js +0 -25
- package/cjs/domain/configuration/index.js.map +0 -1
- package/cjs/domain/configuration/intakeSites.d.ts +0 -5
- package/cjs/domain/configuration/intakeSites.js +0 -9
- package/cjs/domain/configuration/intakeSites.js.map +0 -1
- package/cjs/domain/configuration/tags.d.ts +0 -4
- package/cjs/domain/configuration/tags.js +0 -39
- package/cjs/domain/configuration/tags.js.map +0 -1
- package/cjs/domain/configuration/transportConfiguration.d.ts +0 -16
- package/cjs/domain/configuration/transportConfiguration.js +0 -42
- package/cjs/domain/configuration/transportConfiguration.js.map +0 -1
- package/cjs/domain/console/consoleObservable.d.ts +0 -11
- package/cjs/domain/console/consoleObservable.js +0 -75
- package/cjs/domain/console/consoleObservable.js.map +0 -1
- package/cjs/domain/deflate/index.d.ts +0 -1
- package/cjs/domain/deflate/index.js +0 -18
- package/cjs/domain/deflate/index.js.map +0 -1
- package/cjs/domain/deflate/types.d.ts +0 -26
- package/cjs/domain/deflate/types.js +0 -3
- package/cjs/domain/deflate/types.js.map +0 -1
- package/cjs/domain/error/error.d.ts +0 -28
- package/cjs/domain/error/error.js +0 -131
- package/cjs/domain/error/error.js.map +0 -1
- package/cjs/domain/error/error.types.d.ts +0 -40
- package/cjs/domain/error/error.types.js +0 -13
- package/cjs/domain/error/error.types.js.map +0 -1
- package/cjs/domain/error/trackRuntimeError.d.ts +0 -5
- package/cjs/domain/error/trackRuntimeError.js +0 -21
- package/cjs/domain/error/trackRuntimeError.js.map +0 -1
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +0 -40
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
- package/cjs/domain/report/browser.types.d.ts +0 -24
- package/cjs/domain/report/browser.types.js +0 -3
- package/cjs/domain/report/browser.types.js.map +0 -1
- package/cjs/domain/report/reportObservable.d.ts +0 -15
- package/cjs/domain/report/reportObservable.js +0 -94
- package/cjs/domain/report/reportObservable.js.map +0 -1
- package/cjs/domain/resourceUtils.d.ts +0 -16
- package/cjs/domain/resourceUtils.js +0 -3
- package/cjs/domain/resourceUtils.js.map +0 -1
- package/cjs/domain/session/oldCookiesMigration.d.ts +0 -11
- package/cjs/domain/session/oldCookiesMigration.js +0 -40
- package/cjs/domain/session/oldCookiesMigration.js.map +0 -1
- package/cjs/domain/session/sessionConstants.d.ts +0 -2
- package/cjs/domain/session/sessionConstants.js +0 -7
- package/cjs/domain/session/sessionConstants.js.map +0 -1
- package/cjs/domain/session/sessionManager.d.ts +0 -20
- package/cjs/domain/session/sessionManager.js +0 -65
- package/cjs/domain/session/sessionManager.js.map +0 -1
- package/cjs/domain/session/sessionState.d.ts +0 -11
- package/cjs/domain/session/sessionState.js +0 -45
- package/cjs/domain/session/sessionState.js.map +0 -1
- package/cjs/domain/session/sessionStore.d.ts +0 -34
- package/cjs/domain/session/sessionStore.js +0 -144
- package/cjs/domain/session/sessionStore.js.map +0 -1
- package/cjs/domain/session/sessionStoreOperations.d.ts +0 -15
- package/cjs/domain/session/sessionStoreOperations.js +0 -104
- package/cjs/domain/session/sessionStoreOperations.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +0 -6
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +0 -48
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -3
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +0 -40
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -14
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +0 -5
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +0 -11
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +0 -22
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
- package/cjs/domain/telemetry/index.d.ts +0 -3
- package/cjs/domain/telemetry/index.js +0 -28
- package/cjs/domain/telemetry/index.js.map +0 -1
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -11
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +0 -8
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
- package/cjs/domain/telemetry/telemetry.d.ts +0 -112
- package/cjs/domain/telemetry/telemetry.js +0 -146
- package/cjs/domain/telemetry/telemetry.js.map +0 -1
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +0 -375
- package/cjs/domain/telemetry/telemetryEvent.types.js +0 -7
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/cjs/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/cjs/domain/tracekit/computeStackTrace.js +0 -118
- package/cjs/domain/tracekit/computeStackTrace.js.map +0 -1
- package/cjs/domain/tracekit/index.d.ts +0 -3
- package/cjs/domain/tracekit/index.js +0 -8
- package/cjs/domain/tracekit/index.js.map +0 -1
- package/cjs/domain/tracekit/tracekit.d.ts +0 -35
- package/cjs/domain/tracekit/tracekit.js +0 -95
- package/cjs/domain/tracekit/tracekit.js.map +0 -1
- package/cjs/domain/tracekit/types.d.ts +0 -44
- package/cjs/domain/tracekit/types.js +0 -3
- package/cjs/domain/tracekit/types.js.map +0 -1
- package/cjs/domain/user/index.d.ts +0 -2
- package/cjs/domain/user/index.js +0 -19
- package/cjs/domain/user/index.js.map +0 -1
- package/cjs/domain/user/user.d.ts +0 -12
- package/cjs/domain/user/user.js +0 -35
- package/cjs/domain/user/user.js.map +0 -1
- package/cjs/domain/user/user.types.d.ts +0 -6
- package/cjs/domain/user/user.types.js +0 -3
- package/cjs/domain/user/user.types.js.map +0 -1
- package/cjs/index.d.ts +0 -63
- package/cjs/index.js +0 -155
- package/cjs/index.js.map +0 -1
- package/cjs/tools/abstractLifeCycle.d.ts +0 -23
- package/cjs/tools/abstractLifeCycle.js +0 -29
- package/cjs/tools/abstractLifeCycle.js.map +0 -1
- package/cjs/tools/boundedBuffer.d.ts +0 -5
- package/cjs/tools/boundedBuffer.js +0 -22
- package/cjs/tools/boundedBuffer.js.map +0 -1
- package/cjs/tools/catchUserErrors.d.ts +0 -1
- package/cjs/tools/catchUserErrors.js +0 -20
- package/cjs/tools/catchUserErrors.js.map +0 -1
- package/cjs/tools/display.d.ts +0 -35
- package/cjs/tools/display.js +0 -45
- package/cjs/tools/display.js.map +0 -1
- package/cjs/tools/experimentalFeatures.d.ts +0 -24
- package/cjs/tools/experimentalFeatures.js +0 -47
- package/cjs/tools/experimentalFeatures.js.map +0 -1
- package/cjs/tools/getGlobalObject.d.ts +0 -4
- package/cjs/tools/getGlobalObject.js +0 -37
- package/cjs/tools/getGlobalObject.js.map +0 -1
- package/cjs/tools/getZoneJsOriginalValue.d.ts +0 -19
- package/cjs/tools/getZoneJsOriginalValue.js +0 -30
- package/cjs/tools/getZoneJsOriginalValue.js.map +0 -1
- package/cjs/tools/instrumentMethod.d.ts +0 -19
- package/cjs/tools/instrumentMethod.js +0 -83
- package/cjs/tools/instrumentMethod.js.map +0 -1
- package/cjs/tools/matchOption.d.ts +0 -8
- package/cjs/tools/matchOption.js +0 -38
- package/cjs/tools/matchOption.js.map +0 -1
- package/cjs/tools/mergeInto.d.ts +0 -25
- package/cjs/tools/mergeInto.js +0 -105
- package/cjs/tools/mergeInto.js.map +0 -1
- package/cjs/tools/monitor.d.ts +0 -9
- package/cjs/tools/monitor.js +0 -76
- package/cjs/tools/monitor.js.map +0 -1
- package/cjs/tools/observable.d.ts +0 -12
- package/cjs/tools/observable.js +0 -44
- package/cjs/tools/observable.js.map +0 -1
- package/cjs/tools/readBytesFromStream.d.ts +0 -11
- package/cjs/tools/readBytesFromStream.js +0 -64
- package/cjs/tools/readBytesFromStream.js.map +0 -1
- package/cjs/tools/sendToExtension.d.ts +0 -3
- package/cjs/tools/sendToExtension.js +0 -11
- package/cjs/tools/sendToExtension.js.map +0 -1
- package/cjs/tools/serialisation/context.d.ts +0 -6
- package/cjs/tools/serialisation/context.js +0 -3
- package/cjs/tools/serialisation/context.js.map +0 -1
- package/cjs/tools/serialisation/contextManager.d.ts +0 -21
- package/cjs/tools/serialisation/contextManager.js +0 -70
- package/cjs/tools/serialisation/contextManager.js.map +0 -1
- package/cjs/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js +0 -18
- package/cjs/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/cjs/tools/serialisation/jsonStringify.d.ts +0 -14
- package/cjs/tools/serialisation/jsonStringify.js +0 -49
- package/cjs/tools/serialisation/jsonStringify.js.map +0 -1
- package/cjs/tools/serialisation/sanitize.d.ts +0 -18
- package/cjs/tools/serialisation/sanitize.js +0 -185
- package/cjs/tools/serialisation/sanitize.js.map +0 -1
- package/cjs/tools/timer.d.ts +0 -5
- package/cjs/tools/timer.js +0 -23
- package/cjs/tools/timer.js.map +0 -1
- package/cjs/tools/utils/arrayUtils.d.ts +0 -1
- package/cjs/tools/utils/arrayUtils.js +0 -11
- package/cjs/tools/utils/arrayUtils.js.map +0 -1
- package/cjs/tools/utils/browserDetection.d.ts +0 -2
- package/cjs/tools/utils/browserDetection.js +0 -12
- package/cjs/tools/utils/browserDetection.js.map +0 -1
- package/cjs/tools/utils/byteUtils.d.ts +0 -4
- package/cjs/tools/utils/byteUtils.js +0 -31
- package/cjs/tools/utils/byteUtils.js.map +0 -1
- package/cjs/tools/utils/functionUtils.d.ts +0 -9
- package/cjs/tools/utils/functionUtils.js +0 -48
- package/cjs/tools/utils/functionUtils.js.map +0 -1
- package/cjs/tools/utils/numberUtils.d.ts +0 -8
- package/cjs/tools/utils/numberUtils.js +0 -24
- package/cjs/tools/utils/numberUtils.js.map +0 -1
- package/cjs/tools/utils/objectUtils.d.ts +0 -10
- package/cjs/tools/utils/objectUtils.js +0 -26
- package/cjs/tools/utils/objectUtils.js.map +0 -1
- package/cjs/tools/utils/polyfills.d.ts +0 -24
- package/cjs/tools/utils/polyfills.js +0 -110
- package/cjs/tools/utils/polyfills.js.map +0 -1
- package/cjs/tools/utils/responseUtils.d.ts +0 -2
- package/cjs/tools/utils/responseUtils.js +0 -18
- package/cjs/tools/utils/responseUtils.js.map +0 -1
- package/cjs/tools/utils/stringUtils.d.ts +0 -7
- package/cjs/tools/utils/stringUtils.js +0 -32
- package/cjs/tools/utils/stringUtils.js.map +0 -1
- package/cjs/tools/utils/timeUtils.d.ts +0 -57
- package/cjs/tools/utils/timeUtils.js +0 -99
- package/cjs/tools/utils/timeUtils.js.map +0 -1
- package/cjs/tools/utils/typeUtils.d.ts +0 -4
- package/cjs/tools/utils/typeUtils.js +0 -17
- package/cjs/tools/utils/typeUtils.js.map +0 -1
- package/cjs/tools/utils/urlPolyfill.d.ts +0 -14
- package/cjs/tools/utils/urlPolyfill.js +0 -92
- package/cjs/tools/utils/urlPolyfill.js.map +0 -1
- package/cjs/tools/valueHistory.d.ts +0 -50
- package/cjs/tools/valueHistory.js +0 -106
- package/cjs/tools/valueHistory.js.map +0 -1
- package/cjs/transport/batch.d.ts +0 -19
- package/cjs/transport/batch.js +0 -79
- package/cjs/transport/batch.js.map +0 -1
- package/cjs/transport/eventBridge.d.ts +0 -12
- package/cjs/transport/eventBridge.js +0 -34
- package/cjs/transport/eventBridge.js.map +0 -1
- package/cjs/transport/flushController.d.ts +0 -48
- package/cjs/transport/flushController.js +0 -97
- package/cjs/transport/flushController.js.map +0 -1
- package/cjs/transport/httpRequest.d.ts +0 -37
- package/cjs/transport/httpRequest.js +0 -91
- package/cjs/transport/httpRequest.js.map +0 -1
- package/cjs/transport/index.d.ts +0 -4
- package/cjs/transport/index.js +0 -13
- package/cjs/transport/index.js.map +0 -1
- package/cjs/transport/sendWithRetryStrategy.d.ts +0 -39
- package/cjs/transport/sendWithRetryStrategy.js +0 -151
- package/cjs/transport/sendWithRetryStrategy.js.map +0 -1
- package/cjs/transport/startBatchWithReplica.d.ts +0 -15
- package/cjs/transport/startBatchWithReplica.js +0 -37
- package/cjs/transport/startBatchWithReplica.js.map +0 -1
- package/esm/boot/init.d.ts +0 -5
- package/esm/boot/init.js +0 -31
- package/esm/boot/init.js.map +0 -1
- package/esm/browser/addEventListener.d.ts +0 -76
- package/esm/browser/addEventListener.js +0 -47
- package/esm/browser/addEventListener.js.map +0 -1
- package/esm/browser/cookie.d.ts +0 -10
- package/esm/browser/cookie.js +0 -61
- package/esm/browser/cookie.js.map +0 -1
- package/esm/browser/fetchObservable.d.ts +0 -23
- package/esm/browser/fetchObservable.js +0 -70
- package/esm/browser/fetchObservable.js.map +0 -1
- package/esm/browser/pageExitObservable.d.ts +0 -14
- package/esm/browser/pageExitObservable.js +0 -53
- package/esm/browser/pageExitObservable.js.map +0 -1
- package/esm/browser/runOnReadyState.d.ts +0 -2
- package/esm/browser/runOnReadyState.js +0 -11
- package/esm/browser/runOnReadyState.js.map +0 -1
- package/esm/browser/types.d.ts +0 -19
- package/esm/browser/types.js +0 -5
- package/esm/browser/types.js.map +0 -1
- package/esm/browser/xhrObservable.d.ts +0 -22
- package/esm/browser/xhrObservable.js +0 -89
- package/esm/browser/xhrObservable.js.map +0 -1
- package/esm/domain/configuration/configuration.d.ts +0 -67
- package/esm/domain/configuration/configuration.js +0 -90
- package/esm/domain/configuration/configuration.js.map +0 -1
- package/esm/domain/configuration/endpointBuilder.d.ts +0 -14
- package/esm/domain/configuration/endpointBuilder.js +0 -90
- package/esm/domain/configuration/endpointBuilder.js.map +0 -1
- package/esm/domain/configuration/index.d.ts +0 -3
- package/esm/domain/configuration/index.js +0 -4
- package/esm/domain/configuration/index.js.map +0 -1
- package/esm/domain/configuration/intakeSites.d.ts +0 -5
- package/esm/domain/configuration/intakeSites.js +0 -6
- package/esm/domain/configuration/intakeSites.js.map +0 -1
- package/esm/domain/configuration/tags.d.ts +0 -4
- package/esm/domain/configuration/tags.js +0 -34
- package/esm/domain/configuration/tags.js.map +0 -1
- package/esm/domain/configuration/transportConfiguration.d.ts +0 -16
- package/esm/domain/configuration/transportConfiguration.js +0 -38
- package/esm/domain/configuration/transportConfiguration.js.map +0 -1
- package/esm/domain/console/consoleObservable.d.ts +0 -11
- package/esm/domain/console/consoleObservable.js +0 -70
- package/esm/domain/console/consoleObservable.js.map +0 -1
- package/esm/domain/deflate/index.d.ts +0 -1
- package/esm/domain/deflate/index.js +0 -2
- package/esm/domain/deflate/index.js.map +0 -1
- package/esm/domain/deflate/types.d.ts +0 -26
- package/esm/domain/deflate/types.js +0 -2
- package/esm/domain/deflate/types.js.map +0 -1
- package/esm/domain/error/error.d.ts +0 -28
- package/esm/domain/error/error.js +0 -121
- package/esm/domain/error/error.js.map +0 -1
- package/esm/domain/error/error.types.d.ts +0 -40
- package/esm/domain/error/error.types.js +0 -10
- package/esm/domain/error/error.types.js.map +0 -1
- package/esm/domain/error/trackRuntimeError.d.ts +0 -5
- package/esm/domain/error/trackRuntimeError.js +0 -17
- package/esm/domain/error/trackRuntimeError.js.map +0 -1
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +0 -5
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +0 -36
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +0 -1
- package/esm/domain/report/browser.types.d.ts +0 -24
- package/esm/domain/report/browser.types.js +0 -2
- package/esm/domain/report/browser.types.js.map +0 -1
- package/esm/domain/report/reportObservable.d.ts +0 -15
- package/esm/domain/report/reportObservable.js +0 -90
- package/esm/domain/report/reportObservable.js.map +0 -1
- package/esm/domain/resourceUtils.d.ts +0 -16
- package/esm/domain/resourceUtils.js +0 -2
- package/esm/domain/resourceUtils.js.map +0 -1
- package/esm/domain/session/oldCookiesMigration.d.ts +0 -11
- package/esm/domain/session/oldCookiesMigration.js +0 -36
- package/esm/domain/session/oldCookiesMigration.js.map +0 -1
- package/esm/domain/session/sessionConstants.d.ts +0 -2
- package/esm/domain/session/sessionConstants.js +0 -4
- package/esm/domain/session/sessionConstants.js.map +0 -1
- package/esm/domain/session/sessionManager.d.ts +0 -20
- package/esm/domain/session/sessionManager.js +0 -60
- package/esm/domain/session/sessionManager.js.map +0 -1
- package/esm/domain/session/sessionState.d.ts +0 -11
- package/esm/domain/session/sessionState.js +0 -38
- package/esm/domain/session/sessionState.js.map +0 -1
- package/esm/domain/session/sessionStore.d.ts +0 -34
- package/esm/domain/session/sessionStore.js +0 -139
- package/esm/domain/session/sessionStore.js.map +0 -1
- package/esm/domain/session/sessionStoreOperations.d.ts +0 -15
- package/esm/domain/session/sessionStoreOperations.js +0 -99
- package/esm/domain/session/sessionStoreOperations.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +0 -6
- package/esm/domain/session/storeStrategies/sessionInCookie.js +0 -42
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +0 -3
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +0 -35
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +0 -1
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +0 -14
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +0 -2
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +0 -1
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +0 -11
- package/esm/domain/synthetics/syntheticsWorkerValues.js +0 -16
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +0 -1
- package/esm/domain/telemetry/index.d.ts +0 -3
- package/esm/domain/telemetry/index.js +0 -4
- package/esm/domain/telemetry/index.js.map +0 -1
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +0 -11
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +0 -5
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +0 -1
- package/esm/domain/telemetry/telemetry.d.ts +0 -112
- package/esm/domain/telemetry/telemetry.js +0 -134
- package/esm/domain/telemetry/telemetry.js.map +0 -1
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +0 -375
- package/esm/domain/telemetry/telemetryEvent.types.js +0 -6
- package/esm/domain/telemetry/telemetryEvent.types.js.map +0 -1
- package/esm/domain/tracekit/computeStackTrace.d.ts +0 -5
- package/esm/domain/tracekit/computeStackTrace.js +0 -114
- package/esm/domain/tracekit/computeStackTrace.js.map +0 -1
- package/esm/domain/tracekit/index.d.ts +0 -3
- package/esm/domain/tracekit/index.js +0 -3
- package/esm/domain/tracekit/index.js.map +0 -1
- package/esm/domain/tracekit/tracekit.d.ts +0 -35
- package/esm/domain/tracekit/tracekit.js +0 -91
- package/esm/domain/tracekit/tracekit.js.map +0 -1
- package/esm/domain/tracekit/types.d.ts +0 -44
- package/esm/domain/tracekit/types.js +0 -2
- package/esm/domain/tracekit/types.js.map +0 -1
- package/esm/domain/user/index.d.ts +0 -2
- package/esm/domain/user/index.js +0 -3
- package/esm/domain/user/index.js.map +0 -1
- package/esm/domain/user/user.d.ts +0 -12
- package/esm/domain/user/user.js +0 -30
- package/esm/domain/user/user.js.map +0 -1
- package/esm/domain/user/user.types.d.ts +0 -6
- package/esm/domain/user/user.types.js +0 -2
- package/esm/domain/user/user.types.js.map +0 -1
- package/esm/index.d.ts +0 -63
- package/esm/index.js +0 -61
- package/esm/index.js.map +0 -1
- package/esm/tools/abstractLifeCycle.d.ts +0 -23
- package/esm/tools/abstractLifeCycle.js +0 -26
- package/esm/tools/abstractLifeCycle.js.map +0 -1
- package/esm/tools/boundedBuffer.d.ts +0 -5
- package/esm/tools/boundedBuffer.js +0 -19
- package/esm/tools/boundedBuffer.js.map +0 -1
- package/esm/tools/catchUserErrors.d.ts +0 -1
- package/esm/tools/catchUserErrors.js +0 -16
- package/esm/tools/catchUserErrors.js.map +0 -1
- package/esm/tools/display.d.ts +0 -35
- package/esm/tools/display.js +0 -41
- package/esm/tools/display.js.map +0 -1
- package/esm/tools/experimentalFeatures.d.ts +0 -24
- package/esm/tools/experimentalFeatures.js +0 -40
- package/esm/tools/experimentalFeatures.js.map +0 -1
- package/esm/tools/getGlobalObject.d.ts +0 -4
- package/esm/tools/getGlobalObject.js +0 -33
- package/esm/tools/getGlobalObject.js.map +0 -1
- package/esm/tools/getZoneJsOriginalValue.d.ts +0 -19
- package/esm/tools/getZoneJsOriginalValue.js +0 -26
- package/esm/tools/getZoneJsOriginalValue.js.map +0 -1
- package/esm/tools/instrumentMethod.d.ts +0 -19
- package/esm/tools/instrumentMethod.js +0 -77
- package/esm/tools/instrumentMethod.js.map +0 -1
- package/esm/tools/matchOption.d.ts +0 -8
- package/esm/tools/matchOption.js +0 -33
- package/esm/tools/matchOption.js.map +0 -1
- package/esm/tools/mergeInto.d.ts +0 -25
- package/esm/tools/mergeInto.js +0 -99
- package/esm/tools/mergeInto.js.map +0 -1
- package/esm/tools/monitor.d.ts +0 -9
- package/esm/tools/monitor.js +0 -66
- package/esm/tools/monitor.js.map +0 -1
- package/esm/tools/observable.d.ts +0 -12
- package/esm/tools/observable.js +0 -40
- package/esm/tools/observable.js.map +0 -1
- package/esm/tools/readBytesFromStream.d.ts +0 -11
- package/esm/tools/readBytesFromStream.js +0 -60
- package/esm/tools/readBytesFromStream.js.map +0 -1
- package/esm/tools/sendToExtension.d.ts +0 -3
- package/esm/tools/sendToExtension.js +0 -7
- package/esm/tools/sendToExtension.js.map +0 -1
- package/esm/tools/serialisation/context.d.ts +0 -6
- package/esm/tools/serialisation/context.js +0 -2
- package/esm/tools/serialisation/context.js.map +0 -1
- package/esm/tools/serialisation/contextManager.d.ts +0 -21
- package/esm/tools/serialisation/contextManager.js +0 -66
- package/esm/tools/serialisation/contextManager.js.map +0 -1
- package/esm/tools/serialisation/heavyCustomerDataWarning.d.ts +0 -8
- package/esm/tools/serialisation/heavyCustomerDataWarning.js +0 -14
- package/esm/tools/serialisation/heavyCustomerDataWarning.js.map +0 -1
- package/esm/tools/serialisation/jsonStringify.d.ts +0 -14
- package/esm/tools/serialisation/jsonStringify.js +0 -44
- package/esm/tools/serialisation/jsonStringify.js.map +0 -1
- package/esm/tools/serialisation/sanitize.d.ts +0 -18
- package/esm/tools/serialisation/sanitize.js +0 -181
- package/esm/tools/serialisation/sanitize.js.map +0 -1
- package/esm/tools/timer.d.ts +0 -5
- package/esm/tools/timer.js +0 -16
- package/esm/tools/timer.js.map +0 -1
- package/esm/tools/utils/arrayUtils.d.ts +0 -1
- package/esm/tools/utils/arrayUtils.js +0 -7
- package/esm/tools/utils/arrayUtils.js.map +0 -1
- package/esm/tools/utils/browserDetection.d.ts +0 -2
- package/esm/tools/utils/browserDetection.js +0 -7
- package/esm/tools/utils/browserDetection.js.map +0 -1
- package/esm/tools/utils/byteUtils.d.ts +0 -4
- package/esm/tools/utils/byteUtils.js +0 -26
- package/esm/tools/utils/byteUtils.js.map +0 -1
- package/esm/tools/utils/functionUtils.d.ts +0 -9
- package/esm/tools/utils/functionUtils.js +0 -43
- package/esm/tools/utils/functionUtils.js.map +0 -1
- package/esm/tools/utils/numberUtils.d.ts +0 -8
- package/esm/tools/utils/numberUtils.js +0 -17
- package/esm/tools/utils/numberUtils.js.map +0 -1
- package/esm/tools/utils/objectUtils.d.ts +0 -10
- package/esm/tools/utils/objectUtils.js +0 -19
- package/esm/tools/utils/objectUtils.js.map +0 -1
- package/esm/tools/utils/polyfills.d.ts +0 -24
- package/esm/tools/utils/polyfills.js +0 -95
- package/esm/tools/utils/polyfills.js.map +0 -1
- package/esm/tools/utils/responseUtils.d.ts +0 -2
- package/esm/tools/utils/responseUtils.js +0 -13
- package/esm/tools/utils/responseUtils.js.map +0 -1
- package/esm/tools/utils/stringUtils.d.ts +0 -7
- package/esm/tools/utils/stringUtils.js +0 -26
- package/esm/tools/utils/stringUtils.js.map +0 -1
- package/esm/tools/utils/timeUtils.d.ts +0 -57
- package/esm/tools/utils/timeUtils.js +0 -82
- package/esm/tools/utils/timeUtils.js.map +0 -1
- package/esm/tools/utils/typeUtils.d.ts +0 -4
- package/esm/tools/utils/typeUtils.js +0 -13
- package/esm/tools/utils/typeUtils.js.map +0 -1
- package/esm/tools/utils/urlPolyfill.d.ts +0 -14
- package/esm/tools/utils/urlPolyfill.js +0 -80
- package/esm/tools/utils/urlPolyfill.js.map +0 -1
- package/esm/tools/valueHistory.d.ts +0 -50
- package/esm/tools/valueHistory.js +0 -103
- package/esm/tools/valueHistory.js.map +0 -1
- package/esm/transport/batch.d.ts +0 -19
- package/esm/transport/batch.js +0 -76
- package/esm/transport/batch.js.map +0 -1
- package/esm/transport/eventBridge.d.ts +0 -12
- package/esm/transport/eventBridge.js +0 -29
- package/esm/transport/eventBridge.js.map +0 -1
- package/esm/transport/flushController.d.ts +0 -48
- package/esm/transport/flushController.js +0 -93
- package/esm/transport/flushController.js.map +0 -1
- package/esm/transport/httpRequest.d.ts +0 -37
- package/esm/transport/httpRequest.js +0 -85
- package/esm/transport/httpRequest.js.map +0 -1
- package/esm/transport/index.d.ts +0 -4
- package/esm/transport/index.js +0 -5
- package/esm/transport/index.js.map +0 -1
- package/esm/transport/sendWithRetryStrategy.d.ts +0 -39
- package/esm/transport/sendWithRetryStrategy.js +0 -146
- package/esm/transport/sendWithRetryStrategy.js.map +0 -1
- package/esm/transport/startBatchWithReplica.d.ts +0 -15
- package/esm/transport/startBatchWithReplica.js +0 -33
- package/esm/transport/startBatchWithReplica.js.map +0 -1
- package/src/domain/configuration/intakeSites.ts +0 -5
- package/src/domain/configuration/tags.ts +0 -43
- package/src/domain/tracekit/computeStackTrace.ts +0 -141
- package/src/domain/tracekit/index.ts +0 -3
- package/src/domain/tracekit/tracekit.ts +0 -96
- package/src/domain/tracekit/types.ts +0 -47
- package/src/domain/user/index.ts +0 -2
- package/src/domain/user/user.ts +0 -33
- package/src/domain/user/user.types.ts +0 -6
- package/src/tools/serialisation/contextManager.ts +0 -79
- package/src/tools/serialisation/heavyCustomerDataWarning.ts +0 -26
- package/src/transport/startBatchWithReplica.ts +0 -52
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { toStackTraceString } from '
|
|
1
|
+
import { toStackTraceString } from '../../tools/stackTrace/handlingStack'
|
|
2
2
|
import { monitor } from '../../tools/monitor'
|
|
3
3
|
import { mergeObservables, Observable } from '../../tools/observable'
|
|
4
4
|
import { addEventListener, DOM_EVENT } from '../../browser/addEventListener'
|
|
5
|
-
import { includes } from '../../tools/utils/polyfills'
|
|
6
5
|
import { safeTruncate } from '../../tools/utils/stringUtils'
|
|
7
6
|
import type { Configuration } from '../configuration'
|
|
7
|
+
import type { RawError } from '../error/error.types'
|
|
8
|
+
import { ErrorHandling, ErrorSource } from '../error/error.types'
|
|
9
|
+
import { clocksNow } from '../../tools/utils/timeUtils'
|
|
8
10
|
import type { ReportType, InterventionReport, DeprecationReport } from './browser.types'
|
|
9
11
|
|
|
10
12
|
export const RawReportType = {
|
|
@@ -15,17 +17,14 @@ export const RawReportType = {
|
|
|
15
17
|
|
|
16
18
|
export type RawReportType = (typeof RawReportType)[keyof typeof RawReportType]
|
|
17
19
|
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
subtype: string
|
|
21
|
-
message: string
|
|
22
|
-
stack?: string
|
|
20
|
+
export type RawReportError = RawError & {
|
|
21
|
+
originalError: SecurityPolicyViolationEvent | DeprecationReport | InterventionReport
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export function initReportObservable(configuration: Configuration, apis: RawReportType[]) {
|
|
26
|
-
const observables: Array<Observable<
|
|
25
|
+
const observables: Array<Observable<RawReportError>> = []
|
|
27
26
|
|
|
28
|
-
if (includes(
|
|
27
|
+
if (apis.includes(RawReportType.cspViolation)) {
|
|
29
28
|
observables.push(createCspViolationReportObservable(configuration))
|
|
30
29
|
}
|
|
31
30
|
|
|
@@ -34,19 +33,17 @@ export function initReportObservable(configuration: Configuration, apis: RawRepo
|
|
|
34
33
|
observables.push(createReportObservable(reportTypes))
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
return mergeObservables
|
|
36
|
+
return mergeObservables(...observables)
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
function createReportObservable(reportTypes: ReportType[]) {
|
|
41
|
-
|
|
40
|
+
return new Observable<RawReportError>((observable) => {
|
|
42
41
|
if (!window.ReportingObserver) {
|
|
43
42
|
return
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
const handleReports = monitor((reports: Array<DeprecationReport | InterventionReport>, _: ReportingObserver) =>
|
|
47
|
-
reports.forEach((report) =>
|
|
48
|
-
observable.notify(buildRawReportFromReport(report))
|
|
49
|
-
})
|
|
46
|
+
reports.forEach((report) => observable.notify(buildRawReportErrorFromReport(report)))
|
|
50
47
|
) as ReportingObserverCallback
|
|
51
48
|
|
|
52
49
|
const observer = new window.ReportingObserver(handleReports, {
|
|
@@ -59,37 +56,38 @@ function createReportObservable(reportTypes: ReportType[]) {
|
|
|
59
56
|
observer.disconnect()
|
|
60
57
|
}
|
|
61
58
|
})
|
|
62
|
-
|
|
63
|
-
return observable
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
function createCspViolationReportObservable(configuration: Configuration) {
|
|
67
|
-
|
|
62
|
+
return new Observable<RawReportError>((observable) => {
|
|
68
63
|
const { stop } = addEventListener(configuration, document, DOM_EVENT.SECURITY_POLICY_VIOLATION, (event) => {
|
|
69
|
-
observable.notify(
|
|
64
|
+
observable.notify(buildRawReportErrorFromCspViolation(event))
|
|
70
65
|
})
|
|
71
66
|
|
|
72
67
|
return stop
|
|
73
68
|
})
|
|
74
|
-
return observable
|
|
75
69
|
}
|
|
76
70
|
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
function buildRawReportErrorFromReport(report: DeprecationReport | InterventionReport): RawReportError {
|
|
72
|
+
const { type, body } = report
|
|
73
|
+
|
|
74
|
+
return buildRawReportError({
|
|
75
|
+
type: body.id,
|
|
81
76
|
message: `${type}: ${body.message}`,
|
|
77
|
+
originalError: report,
|
|
82
78
|
stack: buildStack(body.id, body.message, body.sourceFile, body.lineNumber, body.columnNumber),
|
|
83
|
-
}
|
|
79
|
+
})
|
|
84
80
|
}
|
|
85
81
|
|
|
86
|
-
function
|
|
87
|
-
const type = RawReportType.cspViolation
|
|
82
|
+
function buildRawReportErrorFromCspViolation(event: SecurityPolicyViolationEvent): RawReportError {
|
|
88
83
|
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive`
|
|
89
|
-
return {
|
|
90
|
-
type:
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
return buildRawReportError({
|
|
85
|
+
type: event.effectiveDirective,
|
|
86
|
+
message: `${RawReportType.cspViolation}: ${message}`,
|
|
87
|
+
originalError: event,
|
|
88
|
+
csp: {
|
|
89
|
+
disposition: event.disposition,
|
|
90
|
+
},
|
|
93
91
|
stack: buildStack(
|
|
94
92
|
event.effectiveDirective,
|
|
95
93
|
event.originalPolicy
|
|
@@ -99,6 +97,15 @@ function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): Ra
|
|
|
99
97
|
event.lineNumber,
|
|
100
98
|
event.columnNumber
|
|
101
99
|
),
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function buildRawReportError(partial: Omit<RawReportError, 'startClocks' | 'source' | 'handling'>): RawReportError {
|
|
104
|
+
return {
|
|
105
|
+
startClocks: clocksNow(),
|
|
106
|
+
source: ErrorSource.REPORT,
|
|
107
|
+
handling: ErrorHandling.UNHANDLED,
|
|
108
|
+
...partial,
|
|
102
109
|
}
|
|
103
110
|
}
|
|
104
111
|
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
export const
|
|
2
|
-
DOCUMENT
|
|
3
|
-
XHR
|
|
4
|
-
BEACON
|
|
5
|
-
FETCH
|
|
6
|
-
CSS
|
|
7
|
-
JS
|
|
8
|
-
IMAGE
|
|
9
|
-
FONT
|
|
10
|
-
MEDIA
|
|
11
|
-
OTHER
|
|
12
|
-
}
|
|
1
|
+
export const ResourceType = {
|
|
2
|
+
DOCUMENT: 'document',
|
|
3
|
+
XHR: 'xhr',
|
|
4
|
+
BEACON: 'beacon',
|
|
5
|
+
FETCH: 'fetch',
|
|
6
|
+
CSS: 'css',
|
|
7
|
+
JS: 'js',
|
|
8
|
+
IMAGE: 'image',
|
|
9
|
+
FONT: 'font',
|
|
10
|
+
MEDIA: 'media',
|
|
11
|
+
OTHER: 'other',
|
|
12
|
+
} as const
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export type ResourceType = (typeof ResourceType)[keyof typeof ResourceType]
|
|
15
|
+
|
|
16
|
+
export const RequestType = {
|
|
17
|
+
FETCH: ResourceType.FETCH,
|
|
18
|
+
XHR: ResourceType.XHR,
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
export type RequestType = (typeof RequestType)[keyof typeof RequestType]
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
## possible states:
|
|
2
|
+
|
|
3
|
+
| state | value |
|
|
4
|
+
| ----------------------- | ------------------------------------------------------------ |
|
|
5
|
+
| NotStarted<sup>\*</sup> | `{}` |
|
|
6
|
+
| Expired | `{expired: '1'}` or `expire > 15 minutes` or `created > 4H` |
|
|
7
|
+
| Tracked | `{id: 'xxxx-xx-xx}` |
|
|
8
|
+
| NotTracked | `{rum: 0}` or `{logs: 0}` |
|
|
9
|
+
|
|
10
|
+
(<sup>\*</sup>) `NotStarted` is a state that can happen in a few different ways:
|
|
11
|
+
|
|
12
|
+
- First load of the page if there is no cookie present already
|
|
13
|
+
- After the cookie has been deleted by a 3rd party (user, ad blocker, ...)
|
|
14
|
+
- After the cookie has expired (it is deleted by the browser)
|
|
15
|
+
|
|
16
|
+
Other terminology:
|
|
17
|
+
|
|
18
|
+
- A _started_ session is a session that is either `Expired`, `Tracked`, or `NotTracked`.
|
|
19
|
+
- An _active_ session is a session that is either `Tracked` or `NotTracked`.
|
|
20
|
+
|
|
21
|
+
## start session
|
|
22
|
+
|
|
23
|
+
```mermaid
|
|
24
|
+
stateDiagram-v2
|
|
25
|
+
state fork_state <<fork>>
|
|
26
|
+
state fork_state2 <<fork>>
|
|
27
|
+
|
|
28
|
+
[*] --> fork_state
|
|
29
|
+
|
|
30
|
+
fork_state --> NotStarted
|
|
31
|
+
fork_state --> Expired
|
|
32
|
+
fork_state --> Tracked
|
|
33
|
+
fork_state --> NotTracked
|
|
34
|
+
NotStarted --> Expired: startSession()
|
|
35
|
+
|
|
36
|
+
Expired --> fork_state2
|
|
37
|
+
Tracked --> fork_state2
|
|
38
|
+
NotTracked --> fork_state2
|
|
39
|
+
fork_state2 --> [*]: expandOrRenew()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## On User Activity
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
stateDiagram-v2
|
|
46
|
+
state fork_state <<fork>>
|
|
47
|
+
|
|
48
|
+
[*] --> fork_state
|
|
49
|
+
|
|
50
|
+
fork_state --> [*]: expandOrRenew()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## On Visibility Change
|
|
54
|
+
|
|
55
|
+
```mermaid
|
|
56
|
+
stateDiagram-v2
|
|
57
|
+
state fork_state <<fork>>
|
|
58
|
+
state visibility <<choice>>
|
|
59
|
+
|
|
60
|
+
[*] --> visibility: VisibilityChange
|
|
61
|
+
|
|
62
|
+
visibility --> [*]: hidden
|
|
63
|
+
visibility --> fork_state : visible
|
|
64
|
+
|
|
65
|
+
fork_state --> [*]: extendOrExpire()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## On resume from frozen state
|
|
69
|
+
|
|
70
|
+
```mermaid
|
|
71
|
+
stateDiagram-v2
|
|
72
|
+
state fork_state <<fork>>
|
|
73
|
+
state fork_state2 <<fork>>
|
|
74
|
+
|
|
75
|
+
[*] --> fork_state: Resume
|
|
76
|
+
|
|
77
|
+
fork_state --> NotStarted
|
|
78
|
+
fork_state --> Expired
|
|
79
|
+
fork_state --> Tracked
|
|
80
|
+
fork_state --> NotTracked
|
|
81
|
+
|
|
82
|
+
NotStarted --> Expired: restartSession()
|
|
83
|
+
Expired --> fork_state2
|
|
84
|
+
Tracked --> fork_state2
|
|
85
|
+
NotTracked --> fork_state2
|
|
86
|
+
|
|
87
|
+
fork_state2 --> [*]: extendOrExpire()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Watch (every second)
|
|
91
|
+
|
|
92
|
+
```mermaid
|
|
93
|
+
stateDiagram-v2
|
|
94
|
+
state fork_state <<fork>>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
[*] --> fork_state
|
|
98
|
+
fork_state --> [*]: extendOrExpire()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 3rd party cookie clearing
|
|
102
|
+
|
|
103
|
+
```mermaid
|
|
104
|
+
stateDiagram-v2
|
|
105
|
+
state fork_state <<fork>>
|
|
106
|
+
state join_state <<join>>
|
|
107
|
+
NotStarted2: NotStarted
|
|
108
|
+
|
|
109
|
+
[*] --> fork_state
|
|
110
|
+
|
|
111
|
+
fork_state --> NotStarted
|
|
112
|
+
fork_state --> Expired
|
|
113
|
+
fork_state --> Tracked
|
|
114
|
+
fork_state --> NotTracked
|
|
115
|
+
|
|
116
|
+
Expired --> join_state
|
|
117
|
+
Tracked --> join_state
|
|
118
|
+
NotTracked --> join_state
|
|
119
|
+
NotStarted --> join_state
|
|
120
|
+
|
|
121
|
+
join_state --> NotStarted2 : clearCookies()
|
|
122
|
+
|
|
123
|
+
NotStarted2 --> [*]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Expand Or Renew
|
|
127
|
+
|
|
128
|
+
```mermaid
|
|
129
|
+
stateDiagram-v2
|
|
130
|
+
state fork_state <<fork>>
|
|
131
|
+
state fork_state2 <<fork>>
|
|
132
|
+
state fork_state3 <<fork>>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
state expandOrRenew() {
|
|
136
|
+
[*] --> fork_state: expandOrRenew()
|
|
137
|
+
Tracked2: Tracked
|
|
138
|
+
NotTracked2: NotTracked
|
|
139
|
+
|
|
140
|
+
fork_state --> NotStarted
|
|
141
|
+
fork_state --> Expired
|
|
142
|
+
fork_state --> Tracked
|
|
143
|
+
fork_state --> NotTracked
|
|
144
|
+
|
|
145
|
+
NotStarted --> [*]
|
|
146
|
+
|
|
147
|
+
Expired --> fork_state2: renew()
|
|
148
|
+
Tracked --> fork_state2: extend()
|
|
149
|
+
NotTracked --> fork_state2: extend()
|
|
150
|
+
|
|
151
|
+
fork_state2 --> fork_state3: computeTrackingType()
|
|
152
|
+
|
|
153
|
+
fork_state3 --> Tracked2
|
|
154
|
+
fork_state3 --> NotTracked2
|
|
155
|
+
|
|
156
|
+
Tracked2 --> [*]
|
|
157
|
+
NotTracked2 --> [*]
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> [!NOTE]
|
|
162
|
+
> Because `computeTrackingType()` happens at every `expandOrRenew()`, it is in theory possible to switch from `Tracked` to `NotTracked` and vice versa within an active session. However, this is not expected to happen in practice at this time.
|
|
163
|
+
|
|
164
|
+
## Extend Or Expire
|
|
165
|
+
|
|
166
|
+
```mermaid
|
|
167
|
+
stateDiagram-v2
|
|
168
|
+
state fork_state <<fork>>
|
|
169
|
+
|
|
170
|
+
state extendOrExpire() {
|
|
171
|
+
[*] --> fork_state : extendOrExpire()
|
|
172
|
+
Tracked2: Tracked
|
|
173
|
+
NotTracked2: NotTracked
|
|
174
|
+
Expired2: Expired
|
|
175
|
+
|
|
176
|
+
fork_state --> NotStarted
|
|
177
|
+
fork_state --> Expired
|
|
178
|
+
fork_state --> Tracked
|
|
179
|
+
fork_state --> NotTracked
|
|
180
|
+
|
|
181
|
+
Tracked --> Tracked2: extend()
|
|
182
|
+
NotTracked --> NotTracked2: extend()
|
|
183
|
+
Expired --> Expired2: expire()
|
|
184
|
+
|
|
185
|
+
NotStarted --> [*]
|
|
186
|
+
Tracked2 --> [*]
|
|
187
|
+
NotTracked2 --> [*]
|
|
188
|
+
Expired2 --> [*]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
> [!NOTE]
|
|
193
|
+
> Because a session time out can result in an `Expired` state, `expire()` explicitly normalizes the state to `isExpired=1`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInitCookie } from '../../browser/cookie'
|
|
2
2
|
import type { SessionStoreStrategy } from './storeStrategies/sessionStoreStrategy'
|
|
3
3
|
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
|
|
4
4
|
import type { SessionState } from './sessionState'
|
|
5
|
-
import { expandSessionState,
|
|
5
|
+
import { expandSessionState, isSessionStarted } from './sessionState'
|
|
6
6
|
|
|
7
7
|
export const OLD_SESSION_COOKIE_NAME = '_oo'
|
|
8
8
|
export const OLD_RUM_COOKIE_NAME = '_oo_r'
|
|
@@ -17,11 +17,11 @@ export const LOGS_SESSION_KEY = 'logs'
|
|
|
17
17
|
* to allow older sdk versions to be upgraded to newer versions without compatibility issues.
|
|
18
18
|
*/
|
|
19
19
|
export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy) {
|
|
20
|
-
const sessionString =
|
|
20
|
+
const sessionString = getInitCookie(SESSION_STORE_KEY)
|
|
21
21
|
if (!sessionString) {
|
|
22
|
-
const oldSessionId =
|
|
23
|
-
const oldRumType =
|
|
24
|
-
const oldLogsType =
|
|
22
|
+
const oldSessionId = getInitCookie(OLD_SESSION_COOKIE_NAME)
|
|
23
|
+
const oldRumType = getInitCookie(OLD_RUM_COOKIE_NAME)
|
|
24
|
+
const oldLogsType = getInitCookie(OLD_LOGS_COOKIE_NAME)
|
|
25
25
|
const session: SessionState = {}
|
|
26
26
|
|
|
27
27
|
if (oldSessionId) {
|
|
@@ -34,7 +34,7 @@ export function tryOldCookiesMigration(cookieStoreStrategy: SessionStoreStrategy
|
|
|
34
34
|
session[RUM_SESSION_KEY] = oldRumType
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (isSessionStarted(session)) {
|
|
38
38
|
expandSessionState(session)
|
|
39
39
|
cookieStoreStrategy.persistSession(session)
|
|
40
40
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import { ONE_HOUR, ONE_MINUTE } from '../../tools/utils/timeUtils'
|
|
1
|
+
import { ONE_HOUR, ONE_MINUTE, ONE_YEAR } from '../../tools/utils/timeUtils'
|
|
2
2
|
|
|
3
3
|
export const SESSION_TIME_OUT_DELAY = 4 * ONE_HOUR
|
|
4
4
|
export const SESSION_EXPIRATION_DELAY = 15 * ONE_MINUTE
|
|
5
|
+
export const SESSION_COOKIE_EXPIRATION_DELAY = ONE_YEAR
|
|
6
|
+
export const SESSION_NOT_TRACKED = '0'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const SessionPersistence = {
|
|
12
|
+
COOKIE: 'cookie',
|
|
13
|
+
LOCAL_STORAGE: 'local-storage',
|
|
14
|
+
} as const
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @inline
|
|
18
|
+
*/
|
|
19
|
+
export type SessionPersistence = (typeof SessionPersistence)[keyof typeof SessionPersistence]
|
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Observable } from '../../tools/observable'
|
|
2
2
|
import type { Context } from '../../tools/serialisation/context'
|
|
3
|
-
import {
|
|
3
|
+
import { createValueHistory } from '../../tools/valueHistory'
|
|
4
4
|
import type { RelativeTime } from '../../tools/utils/timeUtils'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { clocksOrigin, dateNow, ONE_MINUTE, relativeNow } from '../../tools/utils/timeUtils'
|
|
6
|
+
import { addEventListener, addEventListeners, DOM_EVENT } from '../../browser/addEventListener'
|
|
7
7
|
import { clearInterval, setInterval } from '../../tools/timer'
|
|
8
8
|
import type { Configuration } from '../configuration'
|
|
9
|
-
import {
|
|
9
|
+
import type { TrackingConsentState } from '../trackingConsent'
|
|
10
|
+
import { addTelemetryDebug } from '../telemetry'
|
|
11
|
+
import { isSyntheticsTest } from '../synthetics/syntheticsWorkerValues'
|
|
12
|
+
import type { CookieStore } from '../../browser/browser.types'
|
|
13
|
+
import { getCurrentSite } from '../../browser/cookie'
|
|
14
|
+
import { ExperimentalFeature, isExperimentalFeatureEnabled } from '../../tools/experimentalFeatures'
|
|
15
|
+
import { findLast } from '../../tools/utils/polyfills'
|
|
16
|
+
import { monitorError } from '../../tools/monitor'
|
|
17
|
+
import { SESSION_NOT_TRACKED, SESSION_TIME_OUT_DELAY, SessionPersistence } from './sessionConstants'
|
|
10
18
|
import { startSessionStore } from './sessionStore'
|
|
19
|
+
import type { SessionState } from './sessionState'
|
|
20
|
+
import { toSessionState } from './sessionState'
|
|
21
|
+
import { retrieveSessionCookie } from './storeStrategies/sessionInCookie'
|
|
22
|
+
import { SESSION_STORE_KEY } from './storeStrategies/sessionStoreStrategy'
|
|
23
|
+
import { retrieveSessionFromLocalStorage } from './storeStrategies/sessionInLocalStorage'
|
|
11
24
|
|
|
12
25
|
export interface SessionManager<TrackingType extends string> {
|
|
13
|
-
|
|
26
|
+
findSession: (
|
|
27
|
+
startTime?: RelativeTime,
|
|
28
|
+
options?: { returnInactive: boolean }
|
|
29
|
+
) => SessionContext<TrackingType> | undefined
|
|
14
30
|
renewObservable: Observable<void>
|
|
15
31
|
expireObservable: Observable<void>
|
|
32
|
+
sessionStateUpdateObservable: Observable<{ previousState: SessionState; newState: SessionState }>
|
|
16
33
|
expire: () => void
|
|
34
|
+
updateSessionState: (state: Partial<SessionState>) => void
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
export interface SessionContext<TrackingType extends string> extends Context {
|
|
20
38
|
id: string
|
|
21
39
|
trackingType: TrackingType
|
|
40
|
+
isReplayForced: boolean
|
|
41
|
+
anonymousId: string | undefined
|
|
22
42
|
}
|
|
23
43
|
|
|
24
44
|
export const VISIBILITY_CHECK_DELAY = ONE_MINUTE
|
|
@@ -28,40 +48,91 @@ let stopCallbacks: Array<() => void> = []
|
|
|
28
48
|
export function startSessionManager<TrackingType extends string>(
|
|
29
49
|
configuration: Configuration,
|
|
30
50
|
productKey: string,
|
|
31
|
-
|
|
51
|
+
computeTrackingType: (rawTrackingType?: string) => TrackingType,
|
|
52
|
+
trackingConsentState: TrackingConsentState
|
|
32
53
|
): SessionManager<TrackingType> {
|
|
54
|
+
const renewObservable = new Observable<void>()
|
|
55
|
+
const expireObservable = new Observable<void>()
|
|
56
|
+
|
|
33
57
|
// TODO - Improve configuration type and remove assertion
|
|
34
|
-
const sessionStore = startSessionStore(
|
|
58
|
+
const sessionStore = startSessionStore(
|
|
59
|
+
configuration.sessionStoreStrategyType!,
|
|
60
|
+
configuration,
|
|
61
|
+
productKey,
|
|
62
|
+
computeTrackingType
|
|
63
|
+
)
|
|
35
64
|
stopCallbacks.push(() => sessionStore.stop())
|
|
36
65
|
|
|
37
|
-
const sessionContextHistory =
|
|
66
|
+
const sessionContextHistory = createValueHistory<SessionContext<TrackingType>>({
|
|
67
|
+
expireDelay: SESSION_CONTEXT_TIMEOUT_DELAY,
|
|
68
|
+
})
|
|
38
69
|
stopCallbacks.push(() => sessionContextHistory.stop())
|
|
39
70
|
|
|
40
71
|
sessionStore.renewObservable.subscribe(() => {
|
|
41
72
|
sessionContextHistory.add(buildSessionContext(), relativeNow())
|
|
73
|
+
renewObservable.notify()
|
|
42
74
|
})
|
|
43
75
|
sessionStore.expireObservable.subscribe(() => {
|
|
76
|
+
expireObservable.notify()
|
|
44
77
|
sessionContextHistory.closeActive(relativeNow())
|
|
45
78
|
})
|
|
46
79
|
|
|
80
|
+
// We expand/renew session unconditionally as tracking consent is always granted when the session
|
|
81
|
+
// manager is started.
|
|
47
82
|
sessionStore.expandOrRenewSession()
|
|
48
83
|
sessionContextHistory.add(buildSessionContext(), clocksOrigin().relative)
|
|
84
|
+
if (isExperimentalFeatureEnabled(ExperimentalFeature.SHORT_SESSION_INVESTIGATION)) {
|
|
85
|
+
const session = sessionStore.getSession()
|
|
86
|
+
if (session) {
|
|
87
|
+
detectSessionIdChange(configuration, session)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
49
90
|
|
|
50
|
-
|
|
91
|
+
trackingConsentState.observable.subscribe(() => {
|
|
92
|
+
if (trackingConsentState.isGranted()) {
|
|
93
|
+
sessionStore.expandOrRenewSession()
|
|
94
|
+
} else {
|
|
95
|
+
sessionStore.expire(false)
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
trackActivity(configuration, () => {
|
|
100
|
+
if (trackingConsentState.isGranted()) {
|
|
101
|
+
sessionStore.expandOrRenewSession()
|
|
102
|
+
}
|
|
103
|
+
})
|
|
51
104
|
trackVisibility(configuration, () => sessionStore.expandSession())
|
|
105
|
+
trackResume(configuration, () => sessionStore.restartSession())
|
|
52
106
|
|
|
53
107
|
function buildSessionContext() {
|
|
108
|
+
const session = sessionStore.getSession()
|
|
109
|
+
|
|
110
|
+
if (!session) {
|
|
111
|
+
reportUnexpectedSessionState(configuration).catch(() => void 0) // Ignore errors
|
|
112
|
+
|
|
113
|
+
return {
|
|
114
|
+
id: 'invalid',
|
|
115
|
+
trackingType: SESSION_NOT_TRACKED as TrackingType,
|
|
116
|
+
isReplayForced: false,
|
|
117
|
+
anonymousId: undefined,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
54
121
|
return {
|
|
55
|
-
id:
|
|
56
|
-
trackingType:
|
|
122
|
+
id: session.id!,
|
|
123
|
+
trackingType: session[productKey] as TrackingType,
|
|
124
|
+
isReplayForced: !!session.forcedReplay,
|
|
125
|
+
anonymousId: session.anonymousId,
|
|
57
126
|
}
|
|
58
127
|
}
|
|
59
128
|
|
|
60
129
|
return {
|
|
61
|
-
|
|
62
|
-
renewObservable
|
|
63
|
-
expireObservable
|
|
130
|
+
findSession: (startTime, options) => sessionContextHistory.find(startTime, options),
|
|
131
|
+
renewObservable,
|
|
132
|
+
expireObservable,
|
|
133
|
+
sessionStateUpdateObservable: sessionStore.sessionStateUpdateObservable,
|
|
64
134
|
expire: sessionStore.expire,
|
|
135
|
+
updateSessionState: sessionStore.updateSessionState,
|
|
65
136
|
}
|
|
66
137
|
}
|
|
67
138
|
|
|
@@ -96,3 +167,96 @@ function trackVisibility(configuration: Configuration, expandSession: () => void
|
|
|
96
167
|
clearInterval(visibilityCheckInterval)
|
|
97
168
|
})
|
|
98
169
|
}
|
|
170
|
+
|
|
171
|
+
function trackResume(configuration: Configuration, cb: () => void) {
|
|
172
|
+
const { stop } = addEventListener(configuration, window, DOM_EVENT.RESUME, cb, { capture: true })
|
|
173
|
+
stopCallbacks.push(stop)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function reportUnexpectedSessionState(configuration: Configuration) {
|
|
177
|
+
const sessionStoreStrategyType = configuration.sessionStoreStrategyType
|
|
178
|
+
if (!sessionStoreStrategyType) {
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
let rawSession
|
|
183
|
+
let cookieContext
|
|
184
|
+
|
|
185
|
+
if (sessionStoreStrategyType.type === SessionPersistence.COOKIE) {
|
|
186
|
+
rawSession = retrieveSessionCookie(sessionStoreStrategyType.cookieOptions, configuration)
|
|
187
|
+
|
|
188
|
+
cookieContext = {
|
|
189
|
+
cookie: await getSessionCookies(),
|
|
190
|
+
currentDomain: `${window.location.protocol}//${window.location.hostname}`,
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
rawSession = retrieveSessionFromLocalStorage()
|
|
194
|
+
}
|
|
195
|
+
// monitor-until: forever, could be handy to troubleshoot issues until session manager rework
|
|
196
|
+
addTelemetryDebug('Unexpected session state', {
|
|
197
|
+
sessionStoreStrategyType: sessionStoreStrategyType.type,
|
|
198
|
+
session: rawSession,
|
|
199
|
+
isSyntheticsTest: isSyntheticsTest(),
|
|
200
|
+
createdTimestamp: rawSession?.created,
|
|
201
|
+
expireTimestamp: rawSession?.expire,
|
|
202
|
+
...cookieContext,
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function detectSessionIdChange(configuration: Configuration, initialSessionState: SessionState) {
|
|
207
|
+
if (!window.cookieStore || !initialSessionState.created) {
|
|
208
|
+
return
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const sessionCreatedTime = Number(initialSessionState.created)
|
|
212
|
+
const sdkInitTime = dateNow()
|
|
213
|
+
|
|
214
|
+
const { stop } = addEventListener(configuration, cookieStore as CookieStore, DOM_EVENT.CHANGE, listener)
|
|
215
|
+
stopCallbacks.push(stop)
|
|
216
|
+
|
|
217
|
+
function listener(event: CookieChangeEvent) {
|
|
218
|
+
const changed = findLast(event.changed, (change): change is CookieListItem => change.name === SESSION_STORE_KEY)
|
|
219
|
+
if (!changed) {
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const sessionAge = dateNow() - sessionCreatedTime
|
|
224
|
+
if (sessionAge > 14 * ONE_MINUTE) {
|
|
225
|
+
// The session might have expired just because it's too old or lack activity
|
|
226
|
+
stop()
|
|
227
|
+
} else {
|
|
228
|
+
const newSessionState = toSessionState(changed.value)
|
|
229
|
+
if (newSessionState.id && newSessionState.id !== initialSessionState.id) {
|
|
230
|
+
stop()
|
|
231
|
+
const time = dateNow() - sdkInitTime
|
|
232
|
+
getSessionCookies()
|
|
233
|
+
.then((cookie) => {
|
|
234
|
+
// monitor-until: 2025-12-01, after RUM-10845 investigation done
|
|
235
|
+
addTelemetryDebug('Session cookie changed', {
|
|
236
|
+
time,
|
|
237
|
+
session_age: sessionAge,
|
|
238
|
+
old: initialSessionState,
|
|
239
|
+
new: newSessionState,
|
|
240
|
+
cookie,
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
.catch(monitorError)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async function getSessionCookies(): Promise<{ count: number; domain: string }> {
|
|
250
|
+
let sessionCookies: string[] | Awaited<ReturnType<CookieStore['getAll']>>
|
|
251
|
+
if ('cookieStore' in window) {
|
|
252
|
+
sessionCookies = await (window as { cookieStore: CookieStore }).cookieStore.getAll(SESSION_STORE_KEY)
|
|
253
|
+
} else {
|
|
254
|
+
sessionCookies = document.cookie.split(/\s*;\s*/).filter((cookie) => cookie.startsWith(SESSION_STORE_KEY))
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
count: sessionCookies.length,
|
|
259
|
+
domain: getCurrentSite() || 'undefined',
|
|
260
|
+
...sessionCookies,
|
|
261
|
+
}
|
|
262
|
+
}
|