@kubesense/kubesense-browser-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +3 -0
- package/cjs/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/cjs/boot/displayAlreadyInitializedError.js +10 -0
- package/cjs/boot/displayAlreadyInitializedError.js.map +1 -0
- package/cjs/boot/init.d.ts +13 -0
- package/cjs/boot/init.js +39 -0
- package/cjs/boot/init.js.map +1 -0
- package/cjs/browser/addEventListener.d.ts +87 -0
- package/cjs/browser/addEventListener.js +55 -0
- package/cjs/browser/addEventListener.js.map +1 -0
- package/cjs/browser/browser.types.d.ts +51 -0
- package/cjs/browser/browser.types.js +6 -0
- package/cjs/browser/browser.types.js.map +1 -0
- package/cjs/browser/cookie.d.ts +26 -0
- package/cjs/browser/cookie.js +112 -0
- package/cjs/browser/cookie.js.map +1 -0
- package/cjs/browser/fetchObservable.d.ts +38 -0
- package/cjs/browser/fetchObservable.js +103 -0
- package/cjs/browser/fetchObservable.js.map +1 -0
- package/cjs/browser/pageMayExitObservable.d.ts +14 -0
- package/cjs/browser/pageMayExitObservable.js +45 -0
- package/cjs/browser/pageMayExitObservable.js.map +1 -0
- package/cjs/browser/runOnReadyState.d.ts +5 -0
- package/cjs/browser/runOnReadyState.js +20 -0
- package/cjs/browser/runOnReadyState.js.map +1 -0
- package/cjs/browser/xhrObservable.d.ts +24 -0
- package/cjs/browser/xhrObservable.js +86 -0
- package/cjs/browser/xhrObservable.js.map +1 -0
- package/cjs/domain/allowedTrackingOrigins.d.ts +4 -0
- package/cjs/domain/allowedTrackingOrigins.js +25 -0
- package/cjs/domain/allowedTrackingOrigins.js.map +1 -0
- package/cjs/domain/bufferedData.d.ts +14 -0
- package/cjs/domain/bufferedData.js +22 -0
- package/cjs/domain/bufferedData.js.map +1 -0
- package/cjs/domain/configuration/configuration.d.ts +284 -0
- package/cjs/domain/configuration/configuration.js +135 -0
- package/cjs/domain/configuration/configuration.js.map +1 -0
- package/cjs/domain/configuration/endpointBuilder.d.ts +12 -0
- package/cjs/domain/configuration/endpointBuilder.js +66 -0
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -0
- package/cjs/domain/configuration/index.d.ts +6 -0
- package/cjs/domain/configuration/index.js +31 -0
- package/cjs/domain/configuration/index.js.map +1 -0
- package/cjs/domain/configuration/transportConfiguration.d.ts +21 -0
- package/cjs/domain/configuration/transportConfiguration.js +58 -0
- package/cjs/domain/configuration/transportConfiguration.js.map +1 -0
- package/cjs/domain/connectivity/connectivity.d.ts +14 -0
- package/cjs/domain/connectivity/connectivity.js +14 -0
- package/cjs/domain/connectivity/connectivity.js.map +1 -0
- package/cjs/domain/connectivity/index.d.ts +1 -0
- package/cjs/domain/connectivity/index.js +18 -0
- package/cjs/domain/connectivity/index.js.map +1 -0
- package/cjs/domain/console/consoleObservable.d.ts +21 -0
- package/cjs/domain/console/consoleObservable.js +84 -0
- package/cjs/domain/console/consoleObservable.js.map +1 -0
- package/cjs/domain/context/contextConstants.d.ts +21 -0
- package/cjs/domain/context/contextConstants.js +18 -0
- package/cjs/domain/context/contextConstants.js.map +1 -0
- package/cjs/domain/context/contextManager.d.ts +19 -0
- package/cjs/domain/context/contextManager.js +59 -0
- package/cjs/domain/context/contextManager.js.map +1 -0
- package/cjs/domain/context/contextUtils.d.ts +5 -0
- package/cjs/domain/context/contextUtils.js +16 -0
- package/cjs/domain/context/contextUtils.js.map +1 -0
- package/cjs/domain/context/defineContextMethod.d.ts +6 -0
- package/cjs/domain/context/defineContextMethod.js +21 -0
- package/cjs/domain/context/defineContextMethod.js.map +1 -0
- package/cjs/domain/context/storeContextManager.d.ts +6 -0
- package/cjs/domain/context/storeContextManager.js +40 -0
- package/cjs/domain/context/storeContextManager.js.map +1 -0
- package/cjs/domain/contexts/accountContext.d.ts +26 -0
- package/cjs/domain/contexts/accountContext.js +33 -0
- package/cjs/domain/contexts/accountContext.js.map +1 -0
- package/cjs/domain/contexts/globalContext.d.ts +18 -0
- package/cjs/domain/contexts/globalContext.js +21 -0
- package/cjs/domain/contexts/globalContext.js.map +1 -0
- package/cjs/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/cjs/domain/contexts/rumInternalContext.type.js +3 -0
- package/cjs/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/cjs/domain/contexts/userContext.d.ts +31 -0
- package/cjs/domain/contexts/userContext.js +120 -0
- package/cjs/domain/contexts/userContext.js.map +1 -0
- package/cjs/domain/deflate/deflate.types.d.ts +40 -0
- package/cjs/domain/deflate/deflate.types.js +3 -0
- package/cjs/domain/deflate/deflate.types.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +1 -0
- package/cjs/domain/deflate/index.js +18 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/error/error.d.ts +23 -0
- package/cjs/domain/error/error.js +81 -0
- package/cjs/domain/error/error.js.map +1 -0
- package/cjs/domain/error/error.types.d.ts +47 -0
- package/cjs/domain/error/error.types.js +13 -0
- package/cjs/domain/error/error.types.js.map +1 -0
- package/cjs/domain/error/trackRuntimeError.d.ts +11 -0
- package/cjs/domain/error/trackRuntimeError.js +48 -0
- package/cjs/domain/error/trackRuntimeError.js.map +1 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js +41 -0
- package/cjs/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/cjs/domain/extension/extensionUtils.d.ts +10 -0
- package/cjs/domain/extension/extensionUtils.js +30 -0
- package/cjs/domain/extension/extensionUtils.js.map +1 -0
- package/cjs/domain/intakeSites.d.ts +4 -0
- package/cjs/domain/intakeSites.js +7 -0
- package/cjs/domain/intakeSites.js.map +1 -0
- package/cjs/domain/report/browser.types.d.ts +34 -0
- package/cjs/domain/report/browser.types.js +3 -0
- package/cjs/domain/report/browser.types.js.map +1 -0
- package/cjs/domain/report/reportObservable.d.ts +14 -0
- package/cjs/domain/report/reportObservable.js +99 -0
- package/cjs/domain/report/reportObservable.js.map +1 -0
- package/cjs/domain/resourceUtils.d.ts +18 -0
- package/cjs/domain/resourceUtils.js +20 -0
- package/cjs/domain/resourceUtils.js.map +1 -0
- package/cjs/domain/session/oldCookiesMigration.d.ts +11 -0
- package/cjs/domain/session/oldCookiesMigration.js +40 -0
- package/cjs/domain/session/oldCookiesMigration.js.map +1 -0
- package/cjs/domain/session/sessionConstants.d.ts +15 -0
- package/cjs/domain/session/sessionConstants.js +16 -0
- package/cjs/domain/session/sessionConstants.js.map +1 -0
- package/cjs/domain/session/sessionManager.d.ts +28 -0
- package/cjs/domain/session/sessionManager.js +201 -0
- package/cjs/domain/session/sessionManager.js.map +1 -0
- package/cjs/domain/session/sessionState.d.ts +16 -0
- package/cjs/domain/session/sessionState.js +70 -0
- package/cjs/domain/session/sessionState.js.map +1 -0
- package/cjs/domain/session/sessionStateValidation.d.ts +3 -0
- package/cjs/domain/session/sessionStateValidation.js +11 -0
- package/cjs/domain/session/sessionStateValidation.js.map +1 -0
- package/cjs/domain/session/sessionStore.d.ts +38 -0
- package/cjs/domain/session/sessionStore.js +186 -0
- package/cjs/domain/session/sessionStore.js.map +1 -0
- package/cjs/domain/session/sessionStoreOperations.d.ts +12 -0
- package/cjs/domain/session/sessionStoreOperations.js +119 -0
- package/cjs/domain/session/sessionStoreOperations.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.d.ts +12 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js +104 -0
- package/cjs/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.d.ts +6 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js +42 -0
- package/cjs/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js +5 -0
- package/cjs/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js +31 -0
- package/cjs/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/cjs/domain/tags.d.ts +6 -0
- package/cjs/domain/tags.js +66 -0
- package/cjs/domain/tags.js.map +1 -0
- package/cjs/domain/telemetry/index.d.ts +4 -0
- package/cjs/domain/telemetry/index.js +28 -0
- package/cjs/domain/telemetry/index.js.map +1 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js +9 -0
- package/cjs/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/cjs/domain/telemetry/telemetry.d.ts +56 -0
- package/cjs/domain/telemetry/telemetry.js +245 -0
- package/cjs/domain/telemetry/telemetry.js.map +1 -0
- package/cjs/domain/telemetry/telemetryEvent.types.d.ts +866 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js +7 -0
- package/cjs/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/cjs/domain/trackingConsent.d.ts +13 -0
- package/cjs/domain/trackingConsent.js +28 -0
- package/cjs/domain/trackingConsent.js.map +1 -0
- package/cjs/domain/userAgentData/index.d.ts +1 -0
- package/cjs/domain/userAgentData/index.js +18 -0
- package/cjs/domain/userAgentData/index.js.map +1 -0
- package/cjs/domain/userAgentData/userAgentData.d.ts +22 -0
- package/cjs/domain/userAgentData/userAgentData.js +109 -0
- package/cjs/domain/userAgentData/userAgentData.js.map +1 -0
- package/cjs/index.d.ts +101 -0
- package/cjs/index.js +199 -0
- package/cjs/index.js.map +1 -0
- package/cjs/tools/abstractHooks.d.ts +24 -0
- package/cjs/tools/abstractHooks.js +41 -0
- package/cjs/tools/abstractHooks.js.map +1 -0
- package/cjs/tools/abstractLifeCycle.d.ts +23 -0
- package/cjs/tools/abstractLifeCycle.js +28 -0
- package/cjs/tools/abstractLifeCycle.js.map +1 -0
- package/cjs/tools/boundedBuffer.d.ts +16 -0
- package/cjs/tools/boundedBuffer.js +32 -0
- package/cjs/tools/boundedBuffer.js.map +1 -0
- package/cjs/tools/catchUserErrors.d.ts +1 -0
- package/cjs/tools/catchUserErrors.js +15 -0
- package/cjs/tools/catchUserErrors.js.map +1 -0
- package/cjs/tools/display.d.ts +38 -0
- package/cjs/tools/display.js +44 -0
- package/cjs/tools/display.js.map +1 -0
- package/cjs/tools/encoder.d.ts +54 -0
- package/cjs/tools/encoder.js +40 -0
- package/cjs/tools/encoder.js.map +1 -0
- package/cjs/tools/experimentalFeatures.d.ts +21 -0
- package/cjs/tools/experimentalFeatures.js +50 -0
- package/cjs/tools/experimentalFeatures.js.map +1 -0
- package/cjs/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/cjs/tools/getZoneJsOriginalValue.js +29 -0
- package/cjs/tools/getZoneJsOriginalValue.js.map +1 -0
- package/cjs/tools/globalObject.d.ts +19 -0
- package/cjs/tools/globalObject.js +44 -0
- package/cjs/tools/globalObject.js.map +1 -0
- package/cjs/tools/instrumentMethod.d.ts +75 -0
- package/cjs/tools/instrumentMethod.js +118 -0
- package/cjs/tools/instrumentMethod.js.map +1 -0
- package/cjs/tools/matchOption.d.ts +8 -0
- package/cjs/tools/matchOption.js +35 -0
- package/cjs/tools/matchOption.js.map +1 -0
- package/cjs/tools/mergeInto.d.ts +25 -0
- package/cjs/tools/mergeInto.js +98 -0
- package/cjs/tools/mergeInto.js.map +1 -0
- package/cjs/tools/monitor.d.ts +9 -0
- package/cjs/tools/monitor.js +61 -0
- package/cjs/tools/monitor.js.map +1 -0
- package/cjs/tools/observable.d.ts +30 -0
- package/cjs/tools/observable.js +89 -0
- package/cjs/tools/observable.js.map +1 -0
- package/cjs/tools/queueMicrotask.d.ts +1 -0
- package/cjs/tools/queueMicrotask.js +17 -0
- package/cjs/tools/queueMicrotask.js.map +1 -0
- package/cjs/tools/readBytesFromStream.d.ts +10 -0
- package/cjs/tools/readBytesFromStream.js +28 -0
- package/cjs/tools/readBytesFromStream.js.map +1 -0
- package/cjs/tools/requestIdleCallback.d.ts +12 -0
- package/cjs/tools/requestIdleCallback.js +35 -0
- package/cjs/tools/requestIdleCallback.js.map +1 -0
- package/cjs/tools/sendToExtension.d.ts +3 -0
- package/cjs/tools/sendToExtension.js +11 -0
- package/cjs/tools/sendToExtension.js.map +1 -0
- package/cjs/tools/serialisation/context.d.ts +9 -0
- package/cjs/tools/serialisation/context.js +3 -0
- package/cjs/tools/serialisation/context.js.map +1 -0
- package/cjs/tools/serialisation/jsonStringify.d.ts +13 -0
- package/cjs/tools/serialisation/jsonStringify.js +48 -0
- package/cjs/tools/serialisation/jsonStringify.js.map +1 -0
- package/cjs/tools/serialisation/sanitize.d.ts +18 -0
- package/cjs/tools/serialisation/sanitize.js +188 -0
- package/cjs/tools/serialisation/sanitize.js.map +1 -0
- package/cjs/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/cjs/tools/stackTrace/computeStackTrace.js +187 -0
- package/cjs/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/cjs/tools/stackTrace/handlingStack.d.ts +10 -0
- package/cjs/tools/stackTrace/handlingStack.js +46 -0
- package/cjs/tools/stackTrace/handlingStack.js.map +1 -0
- package/cjs/tools/taskQueue.d.ts +15 -0
- package/cjs/tools/taskQueue.js +54 -0
- package/cjs/tools/taskQueue.js.map +1 -0
- package/cjs/tools/timer.d.ts +5 -0
- package/cjs/tools/timer.js +22 -0
- package/cjs/tools/timer.js.map +1 -0
- package/cjs/tools/utils/arrayUtils.d.ts +3 -0
- package/cjs/tools/utils/arrayUtils.js +20 -0
- package/cjs/tools/utils/arrayUtils.js.map +1 -0
- package/cjs/tools/utils/browserDetection.d.ts +8 -0
- package/cjs/tools/utils/browserDetection.js +33 -0
- package/cjs/tools/utils/browserDetection.js.map +1 -0
- package/cjs/tools/utils/byteUtils.d.ts +8 -0
- package/cjs/tools/utils/byteUtils.js +34 -0
- package/cjs/tools/utils/byteUtils.js.map +1 -0
- package/cjs/tools/utils/functionUtils.d.ts +8 -0
- package/cjs/tools/utils/functionUtils.js +43 -0
- package/cjs/tools/utils/functionUtils.js.map +1 -0
- package/cjs/tools/utils/numberUtils.d.ts +8 -0
- package/cjs/tools/utils/numberUtils.js +23 -0
- package/cjs/tools/utils/numberUtils.js.map +1 -0
- package/cjs/tools/utils/objectUtils.d.ts +10 -0
- package/cjs/tools/utils/objectUtils.js +23 -0
- package/cjs/tools/utils/objectUtils.js.map +1 -0
- package/cjs/tools/utils/polyfills.d.ts +7 -0
- package/cjs/tools/utils/polyfills.js +23 -0
- package/cjs/tools/utils/polyfills.js.map +1 -0
- package/cjs/tools/utils/responseUtils.d.ts +2 -0
- package/cjs/tools/utils/responseUtils.js +17 -0
- package/cjs/tools/utils/responseUtils.js.map +1 -0
- package/cjs/tools/utils/stringUtils.d.ts +23 -0
- package/cjs/tools/utils/stringUtils.js +91 -0
- package/cjs/tools/utils/stringUtils.js.map +1 -0
- package/cjs/tools/utils/timeUtils.d.ts +53 -0
- package/cjs/tools/utils/timeUtils.js +101 -0
- package/cjs/tools/utils/timeUtils.js.map +1 -0
- package/cjs/tools/utils/timezone.d.ts +1 -0
- package/cjs/tools/utils/timezone.js +13 -0
- package/cjs/tools/utils/timezone.js.map +1 -0
- package/cjs/tools/utils/typeUtils.d.ts +4 -0
- package/cjs/tools/utils/typeUtils.js +16 -0
- package/cjs/tools/utils/typeUtils.js.map +1 -0
- package/cjs/tools/utils/urlPolyfill.d.ts +5 -0
- package/cjs/tools/utils/urlPolyfill.js +59 -0
- package/cjs/tools/utils/urlPolyfill.js.map +1 -0
- package/cjs/tools/valueHistory.d.ts +27 -0
- package/cjs/tools/valueHistory.js +104 -0
- package/cjs/tools/valueHistory.js.map +1 -0
- package/cjs/transport/batch.d.ts +16 -0
- package/cjs/transport/batch.js +110 -0
- package/cjs/transport/batch.js.map +1 -0
- package/cjs/transport/eventBridge.d.ts +21 -0
- package/cjs/transport/eventBridge.js +46 -0
- package/cjs/transport/eventBridge.js.map +1 -0
- package/cjs/transport/flushController.d.ts +65 -0
- package/cjs/transport/flushController.js +123 -0
- package/cjs/transport/flushController.js.map +1 -0
- package/cjs/transport/httpRequest.d.ts +57 -0
- package/cjs/transport/httpRequest.js +107 -0
- package/cjs/transport/httpRequest.js.map +1 -0
- package/cjs/transport/index.d.ts +7 -0
- package/cjs/transport/index.js +15 -0
- package/cjs/transport/index.js.map +1 -0
- package/cjs/transport/sendWithRetryStrategy.d.ts +41 -0
- package/cjs/transport/sendWithRetryStrategy.js +163 -0
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -0
- package/esm/boot/displayAlreadyInitializedError.d.ts +2 -0
- package/esm/boot/displayAlreadyInitializedError.js +7 -0
- package/esm/boot/displayAlreadyInitializedError.js.map +1 -0
- package/esm/boot/init.d.ts +13 -0
- package/esm/boot/init.js +35 -0
- package/esm/boot/init.js.map +1 -0
- package/esm/browser/addEventListener.d.ts +87 -0
- package/esm/browser/addEventListener.js +51 -0
- package/esm/browser/addEventListener.js.map +1 -0
- package/esm/browser/browser.types.d.ts +51 -0
- package/esm/browser/browser.types.js +5 -0
- package/esm/browser/browser.types.js.map +1 -0
- package/esm/browser/cookie.d.ts +26 -0
- package/esm/browser/cookie.js +101 -0
- package/esm/browser/cookie.js.map +1 -0
- package/esm/browser/fetchObservable.d.ts +38 -0
- package/esm/browser/fetchObservable.js +99 -0
- package/esm/browser/fetchObservable.js.map +1 -0
- package/esm/browser/pageMayExitObservable.d.ts +14 -0
- package/esm/browser/pageMayExitObservable.js +40 -0
- package/esm/browser/pageMayExitObservable.js.map +1 -0
- package/esm/browser/runOnReadyState.d.ts +5 -0
- package/esm/browser/runOnReadyState.js +16 -0
- package/esm/browser/runOnReadyState.js.map +1 -0
- package/esm/browser/xhrObservable.d.ts +24 -0
- package/esm/browser/xhrObservable.js +83 -0
- package/esm/browser/xhrObservable.js.map +1 -0
- package/esm/domain/allowedTrackingOrigins.d.ts +4 -0
- package/esm/domain/allowedTrackingOrigins.js +21 -0
- package/esm/domain/allowedTrackingOrigins.js.map +1 -0
- package/esm/domain/bufferedData.d.ts +14 -0
- package/esm/domain/bufferedData.js +19 -0
- package/esm/domain/bufferedData.js.map +1 -0
- package/esm/domain/configuration/configuration.d.ts +284 -0
- package/esm/domain/configuration/configuration.js +129 -0
- package/esm/domain/configuration/configuration.js.map +1 -0
- package/esm/domain/configuration/endpointBuilder.d.ts +12 -0
- package/esm/domain/configuration/endpointBuilder.js +62 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +6 -0
- package/esm/domain/configuration/index.js +5 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +21 -0
- package/esm/domain/configuration/transportConfiguration.js +54 -0
- package/esm/domain/configuration/transportConfiguration.js.map +1 -0
- package/esm/domain/connectivity/connectivity.d.ts +14 -0
- package/esm/domain/connectivity/connectivity.js +11 -0
- package/esm/domain/connectivity/connectivity.js.map +1 -0
- package/esm/domain/connectivity/index.d.ts +1 -0
- package/esm/domain/connectivity/index.js +2 -0
- package/esm/domain/connectivity/index.js.map +1 -0
- package/esm/domain/console/consoleObservable.d.ts +21 -0
- package/esm/domain/console/consoleObservable.js +80 -0
- package/esm/domain/console/consoleObservable.js.map +1 -0
- package/esm/domain/context/contextConstants.d.ts +21 -0
- package/esm/domain/context/contextConstants.js +15 -0
- package/esm/domain/context/contextConstants.js.map +1 -0
- package/esm/domain/context/contextManager.d.ts +19 -0
- package/esm/domain/context/contextManager.js +56 -0
- package/esm/domain/context/contextManager.js.map +1 -0
- package/esm/domain/context/contextUtils.d.ts +5 -0
- package/esm/domain/context/contextUtils.js +13 -0
- package/esm/domain/context/contextUtils.js.map +1 -0
- package/esm/domain/context/defineContextMethod.d.ts +6 -0
- package/esm/domain/context/defineContextMethod.js +17 -0
- package/esm/domain/context/defineContextMethod.js.map +1 -0
- package/esm/domain/context/storeContextManager.d.ts +6 -0
- package/esm/domain/context/storeContextManager.js +35 -0
- package/esm/domain/context/storeContextManager.js.map +1 -0
- package/esm/domain/contexts/accountContext.d.ts +26 -0
- package/esm/domain/contexts/accountContext.js +29 -0
- package/esm/domain/contexts/accountContext.js.map +1 -0
- package/esm/domain/contexts/globalContext.d.ts +18 -0
- package/esm/domain/contexts/globalContext.js +17 -0
- package/esm/domain/contexts/globalContext.js.map +1 -0
- package/esm/domain/contexts/rumInternalContext.type.d.ts +14 -0
- package/esm/domain/contexts/rumInternalContext.type.js +2 -0
- package/esm/domain/contexts/rumInternalContext.type.js.map +1 -0
- package/esm/domain/contexts/userContext.d.ts +31 -0
- package/esm/domain/contexts/userContext.js +116 -0
- package/esm/domain/contexts/userContext.js.map +1 -0
- package/esm/domain/deflate/deflate.types.d.ts +40 -0
- package/esm/domain/deflate/deflate.types.js +2 -0
- package/esm/domain/deflate/deflate.types.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +1 -0
- package/esm/domain/deflate/index.js +2 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/error/error.d.ts +23 -0
- package/esm/domain/error/error.js +72 -0
- package/esm/domain/error/error.js.map +1 -0
- package/esm/domain/error/error.types.d.ts +47 -0
- package/esm/domain/error/error.types.js +10 -0
- package/esm/domain/error/error.types.js.map +1 -0
- package/esm/domain/error/trackRuntimeError.d.ts +11 -0
- package/esm/domain/error/trackRuntimeError.js +43 -0
- package/esm/domain/error/trackRuntimeError.js.map +1 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.d.ts +5 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js +38 -0
- package/esm/domain/eventRateLimiter/createEventRateLimiter.js.map +1 -0
- package/esm/domain/extension/extensionUtils.d.ts +10 -0
- package/esm/domain/extension/extensionUtils.js +25 -0
- package/esm/domain/extension/extensionUtils.js.map +1 -0
- package/esm/domain/intakeSites.d.ts +4 -0
- package/esm/domain/intakeSites.js +4 -0
- package/esm/domain/intakeSites.js.map +1 -0
- package/esm/domain/report/browser.types.d.ts +34 -0
- package/esm/domain/report/browser.types.js +2 -0
- package/esm/domain/report/browser.types.js.map +1 -0
- package/esm/domain/report/reportObservable.d.ts +14 -0
- package/esm/domain/report/reportObservable.js +95 -0
- package/esm/domain/report/reportObservable.js.map +1 -0
- package/esm/domain/resourceUtils.d.ts +18 -0
- package/esm/domain/resourceUtils.js +17 -0
- package/esm/domain/resourceUtils.js.map +1 -0
- package/esm/domain/session/oldCookiesMigration.d.ts +11 -0
- package/esm/domain/session/oldCookiesMigration.js +36 -0
- package/esm/domain/session/oldCookiesMigration.js.map +1 -0
- package/esm/domain/session/sessionConstants.d.ts +15 -0
- package/esm/domain/session/sessionConstants.js +13 -0
- package/esm/domain/session/sessionConstants.js.map +1 -0
- package/esm/domain/session/sessionManager.d.ts +28 -0
- package/esm/domain/session/sessionManager.js +196 -0
- package/esm/domain/session/sessionManager.js.map +1 -0
- package/esm/domain/session/sessionState.d.ts +16 -0
- package/esm/domain/session/sessionState.js +60 -0
- package/esm/domain/session/sessionState.js.map +1 -0
- package/esm/domain/session/sessionStateValidation.d.ts +3 -0
- package/esm/domain/session/sessionStateValidation.js +7 -0
- package/esm/domain/session/sessionStateValidation.js.map +1 -0
- package/esm/domain/session/sessionStore.d.ts +38 -0
- package/esm/domain/session/sessionStore.js +180 -0
- package/esm/domain/session/sessionStore.js.map +1 -0
- package/esm/domain/session/sessionStoreOperations.d.ts +12 -0
- package/esm/domain/session/sessionStoreOperations.js +114 -0
- package/esm/domain/session/sessionStoreOperations.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.d.ts +12 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js +98 -0
- package/esm/domain/session/storeStrategies/sessionInCookie.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.d.ts +6 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js +37 -0
- package/esm/domain/session/storeStrategies/sessionInLocalStorage.js.map +1 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.d.ts +16 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js +2 -0
- package/esm/domain/session/storeStrategies/sessionStoreStrategy.js.map +1 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.d.ts +12 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js +24 -0
- package/esm/domain/synthetics/syntheticsWorkerValues.js.map +1 -0
- package/esm/domain/tags.d.ts +6 -0
- package/esm/domain/tags.js +59 -0
- package/esm/domain/tags.js.map +1 -0
- package/esm/domain/telemetry/index.d.ts +4 -0
- package/esm/domain/telemetry/index.js +3 -0
- package/esm/domain/telemetry/index.js.map +1 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.d.ts +18 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/rawTelemetryEvent.types.js.map +1 -0
- package/esm/domain/telemetry/telemetry.d.ts +56 -0
- package/esm/domain/telemetry/telemetry.js +232 -0
- package/esm/domain/telemetry/telemetry.js.map +1 -0
- package/esm/domain/telemetry/telemetryEvent.types.d.ts +866 -0
- package/esm/domain/telemetry/telemetryEvent.types.js +6 -0
- package/esm/domain/telemetry/telemetryEvent.types.js.map +1 -0
- package/esm/domain/trackingConsent.d.ts +13 -0
- package/esm/domain/trackingConsent.js +24 -0
- package/esm/domain/trackingConsent.js.map +1 -0
- package/esm/domain/userAgentData/index.d.ts +1 -0
- package/esm/domain/userAgentData/index.js +2 -0
- package/esm/domain/userAgentData/index.js.map +1 -0
- package/esm/domain/userAgentData/userAgentData.d.ts +22 -0
- package/esm/domain/userAgentData/userAgentData.js +105 -0
- package/esm/domain/userAgentData/userAgentData.js.map +1 -0
- package/esm/index.d.ts +101 -0
- package/esm/index.js +77 -0
- package/esm/index.js.map +1 -0
- package/esm/tools/abstractHooks.d.ts +24 -0
- package/esm/tools/abstractHooks.js +37 -0
- package/esm/tools/abstractHooks.js.map +1 -0
- package/esm/tools/abstractLifeCycle.d.ts +23 -0
- package/esm/tools/abstractLifeCycle.js +24 -0
- package/esm/tools/abstractLifeCycle.js.map +1 -0
- package/esm/tools/boundedBuffer.d.ts +16 -0
- package/esm/tools/boundedBuffer.js +29 -0
- package/esm/tools/boundedBuffer.js.map +1 -0
- package/esm/tools/catchUserErrors.d.ts +1 -0
- package/esm/tools/catchUserErrors.js +12 -0
- package/esm/tools/catchUserErrors.js.map +1 -0
- package/esm/tools/display.d.ts +38 -0
- package/esm/tools/display.js +41 -0
- package/esm/tools/display.js.map +1 -0
- package/esm/tools/encoder.d.ts +54 -0
- package/esm/tools/encoder.js +37 -0
- package/esm/tools/encoder.js.map +1 -0
- package/esm/tools/experimentalFeatures.d.ts +21 -0
- package/esm/tools/experimentalFeatures.js +42 -0
- package/esm/tools/experimentalFeatures.js.map +1 -0
- package/esm/tools/getZoneJsOriginalValue.d.ts +19 -0
- package/esm/tools/getZoneJsOriginalValue.js +26 -0
- package/esm/tools/getZoneJsOriginalValue.js.map +1 -0
- package/esm/tools/globalObject.d.ts +19 -0
- package/esm/tools/globalObject.js +40 -0
- package/esm/tools/globalObject.js.map +1 -0
- package/esm/tools/instrumentMethod.d.ts +75 -0
- package/esm/tools/instrumentMethod.js +114 -0
- package/esm/tools/instrumentMethod.js.map +1 -0
- package/esm/tools/matchOption.d.ts +8 -0
- package/esm/tools/matchOption.js +31 -0
- package/esm/tools/matchOption.js.map +1 -0
- package/esm/tools/mergeInto.d.ts +25 -0
- package/esm/tools/mergeInto.js +93 -0
- package/esm/tools/mergeInto.js.map +1 -0
- package/esm/tools/monitor.d.ts +9 -0
- package/esm/tools/monitor.js +51 -0
- package/esm/tools/monitor.js.map +1 -0
- package/esm/tools/observable.d.ts +30 -0
- package/esm/tools/observable.js +83 -0
- package/esm/tools/observable.js.map +1 -0
- package/esm/tools/queueMicrotask.d.ts +1 -0
- package/esm/tools/queueMicrotask.js +14 -0
- package/esm/tools/queueMicrotask.js.map +1 -0
- package/esm/tools/readBytesFromStream.d.ts +10 -0
- package/esm/tools/readBytesFromStream.js +25 -0
- package/esm/tools/readBytesFromStream.js.map +1 -0
- package/esm/tools/requestIdleCallback.d.ts +12 -0
- package/esm/tools/requestIdleCallback.js +30 -0
- package/esm/tools/requestIdleCallback.js.map +1 -0
- package/esm/tools/sendToExtension.d.ts +3 -0
- package/esm/tools/sendToExtension.js +8 -0
- package/esm/tools/sendToExtension.js.map +1 -0
- package/esm/tools/serialisation/context.d.ts +9 -0
- package/esm/tools/serialisation/context.js +2 -0
- package/esm/tools/serialisation/context.js.map +1 -0
- package/esm/tools/serialisation/jsonStringify.d.ts +13 -0
- package/esm/tools/serialisation/jsonStringify.js +44 -0
- package/esm/tools/serialisation/jsonStringify.js.map +1 -0
- package/esm/tools/serialisation/sanitize.d.ts +18 -0
- package/esm/tools/serialisation/sanitize.js +185 -0
- package/esm/tools/serialisation/sanitize.js.map +1 -0
- package/esm/tools/stackTrace/computeStackTrace.d.ts +25 -0
- package/esm/tools/stackTrace/computeStackTrace.js +183 -0
- package/esm/tools/stackTrace/computeStackTrace.js.map +1 -0
- package/esm/tools/stackTrace/handlingStack.d.ts +10 -0
- package/esm/tools/stackTrace/handlingStack.js +41 -0
- package/esm/tools/stackTrace/handlingStack.js.map +1 -0
- package/esm/tools/taskQueue.d.ts +15 -0
- package/esm/tools/taskQueue.js +50 -0
- package/esm/tools/taskQueue.js.map +1 -0
- package/esm/tools/timer.d.ts +5 -0
- package/esm/tools/timer.js +16 -0
- package/esm/tools/timer.js.map +1 -0
- package/esm/tools/utils/arrayUtils.d.ts +3 -0
- package/esm/tools/utils/arrayUtils.js +15 -0
- package/esm/tools/utils/arrayUtils.js.map +1 -0
- package/esm/tools/utils/browserDetection.d.ts +8 -0
- package/esm/tools/utils/browserDetection.js +28 -0
- package/esm/tools/utils/browserDetection.js.map +1 -0
- package/esm/tools/utils/byteUtils.d.ts +8 -0
- package/esm/tools/utils/byteUtils.js +29 -0
- package/esm/tools/utils/byteUtils.js.map +1 -0
- package/esm/tools/utils/functionUtils.d.ts +8 -0
- package/esm/tools/utils/functionUtils.js +39 -0
- package/esm/tools/utils/functionUtils.js.map +1 -0
- package/esm/tools/utils/numberUtils.d.ts +8 -0
- package/esm/tools/utils/numberUtils.js +17 -0
- package/esm/tools/utils/numberUtils.js.map +1 -0
- package/esm/tools/utils/objectUtils.d.ts +10 -0
- package/esm/tools/utils/objectUtils.js +17 -0
- package/esm/tools/utils/objectUtils.js.map +1 -0
- package/esm/tools/utils/polyfills.d.ts +7 -0
- package/esm/tools/utils/polyfills.js +18 -0
- package/esm/tools/utils/polyfills.js.map +1 -0
- package/esm/tools/utils/responseUtils.d.ts +2 -0
- package/esm/tools/utils/responseUtils.js +13 -0
- package/esm/tools/utils/responseUtils.js.map +1 -0
- package/esm/tools/utils/stringUtils.d.ts +23 -0
- package/esm/tools/utils/stringUtils.js +84 -0
- package/esm/tools/utils/stringUtils.js.map +1 -0
- package/esm/tools/utils/timeUtils.d.ts +53 -0
- package/esm/tools/utils/timeUtils.js +84 -0
- package/esm/tools/utils/timeUtils.js.map +1 -0
- package/esm/tools/utils/timezone.d.ts +1 -0
- package/esm/tools/utils/timezone.js +10 -0
- package/esm/tools/utils/timezone.js.map +1 -0
- package/esm/tools/utils/typeUtils.d.ts +4 -0
- package/esm/tools/utils/typeUtils.js +13 -0
- package/esm/tools/utils/typeUtils.js.map +1 -0
- package/esm/tools/utils/urlPolyfill.d.ts +5 -0
- package/esm/tools/utils/urlPolyfill.js +52 -0
- package/esm/tools/utils/urlPolyfill.js.map +1 -0
- package/esm/tools/valueHistory.d.ts +27 -0
- package/esm/tools/valueHistory.js +100 -0
- package/esm/tools/valueHistory.js.map +1 -0
- package/esm/transport/batch.d.ts +16 -0
- package/esm/transport/batch.js +106 -0
- package/esm/transport/batch.js.map +1 -0
- package/esm/transport/eventBridge.d.ts +21 -0
- package/esm/transport/eventBridge.js +41 -0
- package/esm/transport/eventBridge.js.map +1 -0
- package/esm/transport/flushController.d.ts +65 -0
- package/esm/transport/flushController.js +119 -0
- package/esm/transport/flushController.js.map +1 -0
- package/esm/transport/httpRequest.d.ts +57 -0
- package/esm/transport/httpRequest.js +101 -0
- package/esm/transport/httpRequest.js.map +1 -0
- package/esm/transport/index.d.ts +7 -0
- package/esm/transport/index.js +5 -0
- package/esm/transport/index.js.map +1 -0
- package/esm/transport/sendWithRetryStrategy.d.ts +41 -0
- package/esm/transport/sendWithRetryStrategy.js +158 -0
- package/esm/transport/sendWithRetryStrategy.js.map +1 -0
- package/package.json +28 -0
- package/src/boot/displayAlreadyInitializedError.ts +8 -0
- package/src/boot/init.ts +54 -0
- package/src/browser/addEventListener.ts +145 -0
- package/src/browser/browser.types.ts +84 -0
- package/src/browser/cookie.ts +122 -0
- package/src/browser/fetchObservable.ts +167 -0
- package/src/browser/pageMayExitObservable.ts +56 -0
- package/src/browser/runOnReadyState.ts +25 -0
- package/src/browser/xhrObservable.ts +134 -0
- package/src/domain/allowedTrackingOrigins.ts +29 -0
- package/src/domain/bufferedData.ts +32 -0
- package/src/domain/configuration/configuration.ts +409 -0
- package/src/domain/configuration/endpointBuilder.ts +105 -0
- package/src/domain/configuration/index.ts +12 -0
- package/src/domain/configuration/transportConfiguration.ts +86 -0
- package/src/domain/connectivity/connectivity.ts +31 -0
- package/src/domain/connectivity/index.ts +1 -0
- package/src/domain/console/consoleObservable.ts +118 -0
- package/src/domain/context/contextConstants.ts +27 -0
- package/src/domain/context/contextManager.ts +81 -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 +148 -0
- package/src/domain/deflate/deflate.types.ts +57 -0
- package/src/domain/deflate/index.ts +1 -0
- package/src/domain/error/error.ts +127 -0
- package/src/domain/error/error.types.ts +64 -0
- package/src/domain/error/trackRuntimeError.ts +50 -0
- package/src/domain/eventRateLimiter/createEventRateLimiter.ts +49 -0
- package/src/domain/extension/extensionUtils.ts +28 -0
- package/src/domain/intakeSites.ts +6 -0
- package/src/domain/report/browser.types.ts +38 -0
- package/src/domain/report/reportObservable.ts +133 -0
- package/src/domain/resourceUtils.ts +21 -0
- package/src/domain/session/README.md +193 -0
- package/src/domain/session/oldCookiesMigration.ts +42 -0
- package/src/domain/session/sessionConstants.ts +19 -0
- package/src/domain/session/sessionManager.ts +262 -0
- package/src/domain/session/sessionState.ts +83 -0
- package/src/domain/session/sessionStateValidation.ts +9 -0
- package/src/domain/session/sessionStore.ts +250 -0
- package/src/domain/session/sessionStoreOperations.ts +131 -0
- package/src/domain/session/storeStrategies/sessionInCookie.ts +146 -0
- package/src/domain/session/storeStrategies/sessionInLocalStorage.ts +44 -0
- package/src/domain/session/storeStrategies/sessionStoreStrategy.ts +16 -0
- package/src/domain/synthetics/syntheticsWorkerValues.ts +38 -0
- package/src/domain/tags.ts +75 -0
- package/src/domain/telemetry/index.ts +22 -0
- package/src/domain/telemetry/rawTelemetryEvent.types.ts +22 -0
- package/src/domain/telemetry/telemetry.ts +344 -0
- package/src/domain/telemetry/telemetryEvent.types.ts +907 -0
- package/src/domain/trackingConsent.ts +34 -0
- package/src/domain/userAgentData/index.ts +1 -0
- package/src/domain/userAgentData/userAgentData.ts +163 -0
- package/src/index.ts +169 -0
- package/src/tools/abstractHooks.ts +72 -0
- package/src/tools/abstractLifeCycle.ts +46 -0
- package/src/tools/boundedBuffer.ts +44 -0
- package/src/tools/catchUserErrors.ts +11 -0
- package/src/tools/display.ts +56 -0
- package/src/tools/encoder.ts +103 -0
- package/src/tools/experimentalFeatures.ts +52 -0
- package/src/tools/getZoneJsOriginalValue.ts +38 -0
- package/src/tools/globalObject.ts +51 -0
- package/src/tools/instrumentMethod.ts +170 -0
- package/src/tools/matchOption.ts +31 -0
- package/src/tools/mergeInto.ts +177 -0
- package/src/tools/monitor.ts +71 -0
- package/src/tools/observable.ts +103 -0
- package/src/tools/queueMicrotask.ts +13 -0
- package/src/tools/readBytesFromStream.ts +37 -0
- package/src/tools/requestIdleCallback.ts +40 -0
- package/src/tools/sendToExtension.ts +14 -0
- package/src/tools/serialisation/context.ts +11 -0
- package/src/tools/serialisation/jsonStringify.ts +53 -0
- package/src/tools/serialisation/sanitize.ts +273 -0
- package/src/tools/stackTrace/computeStackTrace.ts +251 -0
- package/src/tools/stackTrace/handlingStack.ts +48 -0
- package/src/tools/taskQueue.ts +63 -0
- package/src/tools/timer.ts +21 -0
- package/src/tools/utils/arrayUtils.ts +16 -0
- package/src/tools/utils/browserDetection.ts +39 -0
- package/src/tools/utils/byteUtils.ts +40 -0
- package/src/tools/utils/functionUtils.ts +45 -0
- package/src/tools/utils/numberUtils.ts +19 -0
- package/src/tools/utils/objectUtils.ts +19 -0
- package/src/tools/utils/polyfills.ts +23 -0
- package/src/tools/utils/responseUtils.ts +12 -0
- package/src/tools/utils/stringUtils.ts +86 -0
- package/src/tools/utils/timeUtils.ts +117 -0
- package/src/tools/utils/timezone.ts +9 -0
- package/src/tools/utils/typeUtils.ts +12 -0
- package/src/tools/utils/urlPolyfill.ts +55 -0
- package/src/tools/valueHistory.ts +151 -0
- package/src/transport/batch.ts +144 -0
- package/src/transport/eventBridge.ts +60 -0
- package/src/transport/flushController.ts +150 -0
- package/src/transport/httpRequest.ts +191 -0
- package/src/transport/index.ts +7 -0
- package/src/transport/sendWithRetryStrategy.ts +222 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Observable } from '../tools/observable'
|
|
2
|
+
|
|
3
|
+
export const TrackingConsent = {
|
|
4
|
+
GRANTED: 'granted',
|
|
5
|
+
NOT_GRANTED: 'not-granted',
|
|
6
|
+
} as const
|
|
7
|
+
export type TrackingConsent = (typeof TrackingConsent)[keyof typeof TrackingConsent]
|
|
8
|
+
|
|
9
|
+
export interface TrackingConsentState {
|
|
10
|
+
tryToInit: (trackingConsent: TrackingConsent) => void
|
|
11
|
+
update: (trackingConsent: TrackingConsent) => void
|
|
12
|
+
isGranted: () => boolean
|
|
13
|
+
observable: Observable<void>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function createTrackingConsentState(currentConsent?: TrackingConsent): TrackingConsentState {
|
|
17
|
+
const observable = new Observable<void>()
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
tryToInit(trackingConsent: TrackingConsent) {
|
|
21
|
+
if (!currentConsent) {
|
|
22
|
+
currentConsent = trackingConsent
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
update(trackingConsent: TrackingConsent) {
|
|
26
|
+
currentConsent = trackingConsent
|
|
27
|
+
observable.notify()
|
|
28
|
+
},
|
|
29
|
+
isGranted() {
|
|
30
|
+
return currentConsent === TrackingConsent.GRANTED
|
|
31
|
+
},
|
|
32
|
+
observable,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './userAgentData'
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { globalObject } from '../../tools/globalObject'
|
|
2
|
+
|
|
3
|
+
export interface UserAgentBrowser {
|
|
4
|
+
name: string
|
|
5
|
+
version: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface UserAgentOS {
|
|
9
|
+
name: string
|
|
10
|
+
version: string
|
|
11
|
+
version_major: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface UserAgentDevice {
|
|
15
|
+
type?: 'mobile' | 'desktop' | 'tablet' | 'tv' | 'gaming_console' | 'bot' | 'other'
|
|
16
|
+
model?: string
|
|
17
|
+
brand?: string
|
|
18
|
+
architecture?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface UserAgentContext {
|
|
22
|
+
browser?: UserAgentBrowser
|
|
23
|
+
os?: UserAgentOS
|
|
24
|
+
device?: UserAgentDevice
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface UADataBrand {
|
|
28
|
+
brand: string
|
|
29
|
+
version: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface NavigatorUAData {
|
|
33
|
+
readonly brands: UADataBrand[]
|
|
34
|
+
readonly mobile: boolean
|
|
35
|
+
readonly platform: string
|
|
36
|
+
getHighEntropyValues(hints: string[]): Promise<{
|
|
37
|
+
architecture?: string
|
|
38
|
+
bitness?: string
|
|
39
|
+
brands?: UADataBrand[]
|
|
40
|
+
fullVersionList?: UADataBrand[]
|
|
41
|
+
mobile?: boolean
|
|
42
|
+
model?: string
|
|
43
|
+
platform?: string
|
|
44
|
+
platformVersion?: string
|
|
45
|
+
wow64?: boolean
|
|
46
|
+
}>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface NavigatorWithUAData extends Navigator {
|
|
50
|
+
userAgentData?: NavigatorUAData
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Chromium ships its brand list with intentionally-shuffled "Not-A.Brand" /
|
|
54
|
+
// "Not(A:Brand" entries to discourage UA sniffing. Pick the most-specific real
|
|
55
|
+
// brand: Edge > Chrome > Chromium > anything else.
|
|
56
|
+
const BRAND_PRIORITY: Record<string, number> = {
|
|
57
|
+
'Microsoft Edge': 1,
|
|
58
|
+
'Google Chrome': 2,
|
|
59
|
+
Chromium: 3,
|
|
60
|
+
Opera: 4,
|
|
61
|
+
Brave: 5,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function pickBrand(brands: UADataBrand[] | undefined): UADataBrand | undefined {
|
|
65
|
+
if (!brands || brands.length === 0) {
|
|
66
|
+
return undefined
|
|
67
|
+
}
|
|
68
|
+
let best: UADataBrand | undefined
|
|
69
|
+
let bestPriority = Number.MAX_SAFE_INTEGER
|
|
70
|
+
for (const entry of brands) {
|
|
71
|
+
if (!entry.brand || entry.brand.indexOf('Not') === 0) {
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
const priority = BRAND_PRIORITY[entry.brand] ?? 99
|
|
75
|
+
if (priority < bestPriority) {
|
|
76
|
+
best = entry
|
|
77
|
+
bestPriority = priority
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return best ?? brands.find((b) => b.brand && b.brand.indexOf('Not') !== 0)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function majorVersion(version: string): string {
|
|
84
|
+
const dot = version.indexOf('.')
|
|
85
|
+
return dot >= 0 ? version.slice(0, dot) : version
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function getUAData(): NavigatorUAData | undefined {
|
|
89
|
+
const nav = globalObject.navigator as NavigatorWithUAData | undefined
|
|
90
|
+
return nav?.userAgentData
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Sync values available immediately on first paint: brand + major version
|
|
94
|
+
// from low-entropy hints. We deliberately do NOT emit os/device here — only
|
|
95
|
+
// the platform *name* is available synchronously, not the version, and the
|
|
96
|
+
// server's setOperatingSystem/setDevice overwrites unconditionally, so
|
|
97
|
+
// shipping empty version strings would clobber the server-side UA fallback.
|
|
98
|
+
// Browser brand + major version, by contrast, is reliable from sync hints.
|
|
99
|
+
// Returns undefined on non-Chromium so the server's UA parser handles
|
|
100
|
+
// Safari/Firefox — their classic UA isn't frozen.
|
|
101
|
+
export function getSyncUserAgentContext(): UserAgentContext | undefined {
|
|
102
|
+
const uaData = getUAData()
|
|
103
|
+
if (!uaData) {
|
|
104
|
+
return undefined
|
|
105
|
+
}
|
|
106
|
+
const brand = pickBrand(uaData.brands)
|
|
107
|
+
if (!brand) {
|
|
108
|
+
return undefined
|
|
109
|
+
}
|
|
110
|
+
return { browser: { name: brand.brand, version: brand.version } }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Async high-entropy values: full browser version, real OS version (recovers
|
|
114
|
+
// the value the classic UA freezes — macOS 14.x.y instead of 10.15.7, Windows
|
|
115
|
+
// 13.x build instead of 10.0), model on mobile, CPU architecture.
|
|
116
|
+
export function resolveHighEntropyUserAgentContext(): Promise<UserAgentContext | undefined> {
|
|
117
|
+
const uaData = getUAData()
|
|
118
|
+
if (!uaData || typeof uaData.getHighEntropyValues !== 'function') {
|
|
119
|
+
return Promise.resolve(undefined)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return uaData
|
|
123
|
+
.getHighEntropyValues(['fullVersionList', 'platformVersion', 'model', 'architecture', 'bitness'])
|
|
124
|
+
.then((values) => {
|
|
125
|
+
const ctx: UserAgentContext = {}
|
|
126
|
+
|
|
127
|
+
const fullBrand = pickBrand(values.fullVersionList) ?? pickBrand(uaData.brands)
|
|
128
|
+
if (fullBrand) {
|
|
129
|
+
ctx.browser = { name: fullBrand.brand, version: fullBrand.version }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Only emit os when we have a real version — empty strings would
|
|
133
|
+
// overwrite the server-side UA fallback (setOperatingSystem is an
|
|
134
|
+
// unconditional assign). platformVersion can be blank when the page
|
|
135
|
+
// sets Permissions-Policy: ch-ua-platform-version=() or in some
|
|
136
|
+
// privacy-hardened browsers (Brave strict mode).
|
|
137
|
+
const platformVersion = values.platformVersion ?? ''
|
|
138
|
+
const platformName = uaData.platform || values.platform || ''
|
|
139
|
+
if (platformVersion && platformName) {
|
|
140
|
+
ctx.os = {
|
|
141
|
+
name: platformName,
|
|
142
|
+
version: platformVersion,
|
|
143
|
+
version_major: majorVersion(platformVersion),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Same reasoning for device — only emit if we have a meaningful model
|
|
148
|
+
// or architecture; otherwise the server-side device_name/brand
|
|
149
|
+
// fallback ("Mac", "Apple", "Windows", …) survives.
|
|
150
|
+
const model = values.model || ''
|
|
151
|
+
const architecture = values.architecture || ''
|
|
152
|
+
if (model || architecture || uaData.mobile) {
|
|
153
|
+
ctx.device = {
|
|
154
|
+
type: uaData.mobile ? 'mobile' : 'desktop',
|
|
155
|
+
model: model || undefined,
|
|
156
|
+
architecture: architecture || undefined,
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return ctx
|
|
161
|
+
})
|
|
162
|
+
.catch(() => undefined)
|
|
163
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export type { Configuration, InitConfiguration, EndpointBuilder, ProxyFn } from './domain/configuration'
|
|
2
|
+
export {
|
|
3
|
+
validateAndBuildConfiguration,
|
|
4
|
+
DefaultPrivacyLevel,
|
|
5
|
+
TraceContextInjection,
|
|
6
|
+
serializeConfiguration,
|
|
7
|
+
isSampleRate,
|
|
8
|
+
buildEndpointHost,
|
|
9
|
+
INTAKE_URL_PARAMETERS,
|
|
10
|
+
INTAKE_SITE_PROD,
|
|
11
|
+
INTAKE_SITE_STAGING,
|
|
12
|
+
isIntakeUrl,
|
|
13
|
+
} from './domain/configuration'
|
|
14
|
+
export * from './domain/intakeSites'
|
|
15
|
+
export type { TrackingConsentState } from './domain/trackingConsent'
|
|
16
|
+
export { TrackingConsent, createTrackingConsentState } from './domain/trackingConsent'
|
|
17
|
+
export {
|
|
18
|
+
isExperimentalFeatureEnabled,
|
|
19
|
+
addExperimentalFeatures,
|
|
20
|
+
resetExperimentalFeatures,
|
|
21
|
+
getExperimentalFeatures,
|
|
22
|
+
initFeatureFlags,
|
|
23
|
+
ExperimentalFeature,
|
|
24
|
+
} from './tools/experimentalFeatures'
|
|
25
|
+
export { trackRuntimeError } from './domain/error/trackRuntimeError'
|
|
26
|
+
export type { StackTrace } from './tools/stackTrace/computeStackTrace'
|
|
27
|
+
export { computeStackTrace } from './tools/stackTrace/computeStackTrace'
|
|
28
|
+
export type { PublicApi } from './boot/init'
|
|
29
|
+
export { defineGlobal, makePublicApi } from './boot/init'
|
|
30
|
+
export { displayAlreadyInitializedError } from './boot/displayAlreadyInitializedError'
|
|
31
|
+
export { initReportObservable, RawReportType } from './domain/report/reportObservable'
|
|
32
|
+
export type {
|
|
33
|
+
Telemetry,
|
|
34
|
+
RawTelemetryEvent,
|
|
35
|
+
RawTelemetryConfiguration,
|
|
36
|
+
TelemetryEvent,
|
|
37
|
+
TelemetryErrorEvent,
|
|
38
|
+
TelemetryDebugEvent,
|
|
39
|
+
TelemetryConfigurationEvent,
|
|
40
|
+
TelemetryUsageEvent,
|
|
41
|
+
RawTelemetryUsage,
|
|
42
|
+
RawTelemetryUsageFeature,
|
|
43
|
+
} from './domain/telemetry'
|
|
44
|
+
export {
|
|
45
|
+
startTelemetry,
|
|
46
|
+
addTelemetryDebug,
|
|
47
|
+
addTelemetryError,
|
|
48
|
+
resetTelemetry,
|
|
49
|
+
TelemetryService,
|
|
50
|
+
TelemetryMetrics,
|
|
51
|
+
addTelemetryConfiguration,
|
|
52
|
+
addTelemetryUsage,
|
|
53
|
+
addTelemetryMetrics,
|
|
54
|
+
} from './domain/telemetry'
|
|
55
|
+
export { monitored, monitor, callMonitored, setDebugMode, monitorError } from './tools/monitor'
|
|
56
|
+
export type { Subscription } from './tools/observable'
|
|
57
|
+
export { Observable, BufferedObservable } from './tools/observable'
|
|
58
|
+
export type { SessionManager } from './domain/session/sessionManager'
|
|
59
|
+
export { startSessionManager, stopSessionManager } from './domain/session/sessionManager'
|
|
60
|
+
export {
|
|
61
|
+
SESSION_TIME_OUT_DELAY, // Exposed for tests
|
|
62
|
+
SESSION_NOT_TRACKED,
|
|
63
|
+
SessionPersistence,
|
|
64
|
+
} from './domain/session/sessionConstants'
|
|
65
|
+
export type { BandwidthStats, HttpRequest, HttpRequestEvent, Payload, FlushEvent, FlushReason } from './transport'
|
|
66
|
+
export {
|
|
67
|
+
createHttpRequest,
|
|
68
|
+
canUseEventBridge,
|
|
69
|
+
getEventBridge,
|
|
70
|
+
bridgeSupports,
|
|
71
|
+
BridgeCapability,
|
|
72
|
+
createBatch,
|
|
73
|
+
createFlushController,
|
|
74
|
+
FLUSH_DURATION_LIMIT,
|
|
75
|
+
} from './transport'
|
|
76
|
+
export * from './tools/display'
|
|
77
|
+
export type { Encoder, EncoderResult } from './tools/encoder'
|
|
78
|
+
export { createIdentityEncoder } from './tools/encoder'
|
|
79
|
+
export * from './tools/utils/urlPolyfill'
|
|
80
|
+
export * from './tools/utils/timeUtils'
|
|
81
|
+
export * from './tools/utils/arrayUtils'
|
|
82
|
+
export * from './tools/serialisation/sanitize'
|
|
83
|
+
export * from './tools/globalObject'
|
|
84
|
+
export { AbstractLifeCycle } from './tools/abstractLifeCycle'
|
|
85
|
+
export * from './domain/eventRateLimiter/createEventRateLimiter'
|
|
86
|
+
export * from './tools/utils/browserDetection'
|
|
87
|
+
export { sendToExtension } from './tools/sendToExtension'
|
|
88
|
+
export { runOnReadyState, asyncRunOnReadyState } from './browser/runOnReadyState'
|
|
89
|
+
export { getZoneJsOriginalValue } from './tools/getZoneJsOriginalValue'
|
|
90
|
+
export type { InstrumentedMethodCall } from './tools/instrumentMethod'
|
|
91
|
+
export { instrumentMethod, instrumentSetter } from './tools/instrumentMethod'
|
|
92
|
+
export {
|
|
93
|
+
computeRawError,
|
|
94
|
+
getFileFromStackTraceString,
|
|
95
|
+
isError,
|
|
96
|
+
NO_ERROR_STACK_PRESENT_MESSAGE,
|
|
97
|
+
} from './domain/error/error'
|
|
98
|
+
export { NonErrorPrefix } from './domain/error/error.types'
|
|
99
|
+
export type { Context, ContextArray, ContextValue } from './tools/serialisation/context'
|
|
100
|
+
export {
|
|
101
|
+
areCookiesAuthorized,
|
|
102
|
+
getCookie,
|
|
103
|
+
getInitCookie,
|
|
104
|
+
setCookie,
|
|
105
|
+
deleteCookie,
|
|
106
|
+
resetInitCookies,
|
|
107
|
+
} from './browser/cookie'
|
|
108
|
+
export type { CookieStore, WeakRef, WeakRefConstructor } from './browser/browser.types'
|
|
109
|
+
export type { XhrCompleteContext, XhrStartContext } from './browser/xhrObservable'
|
|
110
|
+
export { initXhrObservable } from './browser/xhrObservable'
|
|
111
|
+
export type { FetchResolveContext, FetchStartContext, FetchContext } from './browser/fetchObservable'
|
|
112
|
+
export { initFetchObservable, resetFetchObservable, ResponseBodyAction } from './browser/fetchObservable'
|
|
113
|
+
export type { PageMayExitEvent } from './browser/pageMayExitObservable'
|
|
114
|
+
export { createPageMayExitObservable, PageExitReason, isPageExitReason } from './browser/pageMayExitObservable'
|
|
115
|
+
export * from './browser/addEventListener'
|
|
116
|
+
export { requestIdleCallback } from './tools/requestIdleCallback'
|
|
117
|
+
export * from './tools/taskQueue'
|
|
118
|
+
export * from './tools/timer'
|
|
119
|
+
export type { ConsoleLog } from './domain/console/consoleObservable'
|
|
120
|
+
export { initConsoleObservable, resetConsoleObservable } from './domain/console/consoleObservable'
|
|
121
|
+
export type { BoundedBuffer } from './tools/boundedBuffer'
|
|
122
|
+
export { createBoundedBuffer } from './tools/boundedBuffer'
|
|
123
|
+
export { catchUserErrors } from './tools/catchUserErrors'
|
|
124
|
+
export type { ContextManager } from './domain/context/contextManager'
|
|
125
|
+
export { createContextManager } from './domain/context/contextManager'
|
|
126
|
+
export { defineContextMethod, bufferContextCalls } from './domain/context/defineContextMethod'
|
|
127
|
+
export { storeContextManager, removeStorageListeners } from './domain/context/storeContextManager'
|
|
128
|
+
export { startAccountContext, buildAccountContextManager } from './domain/contexts/accountContext'
|
|
129
|
+
export { startGlobalContext, buildGlobalContextManager } from './domain/contexts/globalContext'
|
|
130
|
+
export { startUserContext, buildUserContextManager } from './domain/contexts/userContext'
|
|
131
|
+
export type { User } from './domain/contexts/userContext'
|
|
132
|
+
export type { Account } from './domain/contexts/accountContext'
|
|
133
|
+
export type { RumInternalContext } from './domain/contexts/rumInternalContext.type'
|
|
134
|
+
export { CustomerDataType, CustomerContextKey, ContextManagerMethod } from './domain/context/contextConstants'
|
|
135
|
+
export type { ValueHistory, ValueHistoryEntry } from './tools/valueHistory'
|
|
136
|
+
export { createValueHistory, CLEAR_OLD_VALUES_INTERVAL } from './tools/valueHistory'
|
|
137
|
+
export { readBytesFromStream } from './tools/readBytesFromStream'
|
|
138
|
+
export type { SessionState } from './domain/session/sessionState'
|
|
139
|
+
export { STORAGE_POLL_DELAY } from './domain/session/sessionStore'
|
|
140
|
+
export { SESSION_STORE_KEY } from './domain/session/storeStrategies/sessionStoreStrategy'
|
|
141
|
+
export {
|
|
142
|
+
willSyntheticsInjectRum,
|
|
143
|
+
getSyntheticsTestId,
|
|
144
|
+
getSyntheticsResultId,
|
|
145
|
+
isSyntheticsTest,
|
|
146
|
+
} from './domain/synthetics/syntheticsWorkerValues'
|
|
147
|
+
export { checkContext } from './domain/context/contextUtils'
|
|
148
|
+
export * from './domain/resourceUtils'
|
|
149
|
+
export * from './domain/bufferedData'
|
|
150
|
+
export * from './tools/utils/polyfills'
|
|
151
|
+
export * from './tools/utils/timezone'
|
|
152
|
+
export * from './tools/utils/numberUtils'
|
|
153
|
+
export * from './tools/utils/byteUtils'
|
|
154
|
+
export * from './tools/utils/objectUtils'
|
|
155
|
+
export * from './tools/utils/functionUtils'
|
|
156
|
+
export * from './tools/serialisation/jsonStringify'
|
|
157
|
+
export * from './tools/mergeInto'
|
|
158
|
+
export * from './tools/utils/stringUtils'
|
|
159
|
+
export * from './tools/matchOption'
|
|
160
|
+
export * from './tools/utils/responseUtils'
|
|
161
|
+
export * from './tools/utils/typeUtils'
|
|
162
|
+
export type { RawError, RawErrorCause, ErrorWithCause, Csp } from './domain/error/error.types'
|
|
163
|
+
export { ErrorHandling, ErrorSource } from './domain/error/error.types'
|
|
164
|
+
export * from './domain/deflate'
|
|
165
|
+
export * from './domain/connectivity'
|
|
166
|
+
export * from './domain/userAgentData'
|
|
167
|
+
export * from './tools/stackTrace/handlingStack'
|
|
168
|
+
export * from './tools/abstractHooks'
|
|
169
|
+
export * from './domain/tags'
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { combine } from './mergeInto'
|
|
2
|
+
|
|
3
|
+
export const enum HookNames {
|
|
4
|
+
Assemble,
|
|
5
|
+
AssembleTelemetry,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// This is a workaround for an issue occurring when the Browser SDK is included in a TypeScript
|
|
9
|
+
// project configured with `isolatedModules: true`. Even if the const enum is declared in this
|
|
10
|
+
// module, we cannot use it directly to define the EventMap interface keys (TS error: "Cannot access
|
|
11
|
+
// ambient const enums when the '--isolatedModules' flag is provided.").
|
|
12
|
+
export declare const HookNamesAsConst: {
|
|
13
|
+
ASSEMBLE: HookNames.Assemble
|
|
14
|
+
ASSEMBLE_TELEMETRY: HookNames.AssembleTelemetry
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type RecursivePartial<T> = {
|
|
18
|
+
[P in keyof T]?: T[P] extends Array<infer U>
|
|
19
|
+
? Array<RecursivePartial<U>>
|
|
20
|
+
: T[P] extends object | undefined
|
|
21
|
+
? RecursivePartial<T[P]>
|
|
22
|
+
: T[P]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Discards the event from being sent
|
|
26
|
+
export const DISCARDED = 'DISCARDED'
|
|
27
|
+
// Skips from the assembly of the event
|
|
28
|
+
export const SKIPPED = 'SKIPPED'
|
|
29
|
+
|
|
30
|
+
export type DISCARDED = typeof DISCARDED
|
|
31
|
+
export type SKIPPED = typeof SKIPPED
|
|
32
|
+
|
|
33
|
+
export type AbstractHooks = ReturnType<typeof abstractHooks>
|
|
34
|
+
|
|
35
|
+
export function abstractHooks<T extends { [K in HookNames]: (...args: any[]) => unknown }>() {
|
|
36
|
+
const callbacks: { [K in HookNames]?: Array<T[K]> } = {}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
register<K extends HookNames>(hookName: K, callback: T[K]) {
|
|
40
|
+
if (!callbacks[hookName]) {
|
|
41
|
+
callbacks[hookName] = []
|
|
42
|
+
}
|
|
43
|
+
callbacks[hookName]!.push(callback)
|
|
44
|
+
return {
|
|
45
|
+
unregister: () => {
|
|
46
|
+
callbacks[hookName] = callbacks[hookName]!.filter((cb) => cb !== callback)
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
triggerHook<K extends HookNames>(
|
|
51
|
+
hookName: K,
|
|
52
|
+
param: Parameters<T[K]>[0]
|
|
53
|
+
): Exclude<ReturnType<T[K]>, SKIPPED> | DISCARDED | undefined {
|
|
54
|
+
const hookCallbacks = callbacks[hookName] || []
|
|
55
|
+
const results: any[] = []
|
|
56
|
+
|
|
57
|
+
for (const callback of hookCallbacks) {
|
|
58
|
+
const result = callback(param)
|
|
59
|
+
if (result === DISCARDED) {
|
|
60
|
+
return DISCARDED
|
|
61
|
+
}
|
|
62
|
+
if (result === SKIPPED) {
|
|
63
|
+
continue
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
results.push(result)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return combine(...(results as [any, any])) as Exclude<ReturnType<T[K]>, SKIPPED>
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Subscription } from './observable'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type helper to extract event types that have "void" data. This allows to call `notify` without a
|
|
5
|
+
* second argument. Ex:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* interface EventMap {
|
|
9
|
+
* foo: void
|
|
10
|
+
* }
|
|
11
|
+
* const LifeCycle = AbstractLifeCycle<EventMap>
|
|
12
|
+
* new LifeCycle().notify('foo')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
type EventTypesWithoutData<EventMap> = {
|
|
16
|
+
[K in keyof EventMap]: EventMap[K] extends void ? K : never
|
|
17
|
+
}[keyof EventMap]
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
20
|
+
export class AbstractLifeCycle<EventMap> {
|
|
21
|
+
private callbacks: { [key in keyof EventMap]?: Array<(data: any) => void> } = {}
|
|
22
|
+
|
|
23
|
+
notify<EventType extends EventTypesWithoutData<EventMap>>(eventType: EventType): void
|
|
24
|
+
notify<EventType extends keyof EventMap>(eventType: EventType, data: EventMap[EventType]): void
|
|
25
|
+
notify(eventType: keyof EventMap, data?: unknown) {
|
|
26
|
+
const eventCallbacks = this.callbacks[eventType]
|
|
27
|
+
if (eventCallbacks) {
|
|
28
|
+
eventCallbacks.forEach((callback) => callback(data))
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
subscribe<EventType extends keyof EventMap>(
|
|
33
|
+
eventType: EventType,
|
|
34
|
+
callback: (data: EventMap[EventType]) => void
|
|
35
|
+
): Subscription {
|
|
36
|
+
if (!this.callbacks[eventType]) {
|
|
37
|
+
this.callbacks[eventType] = []
|
|
38
|
+
}
|
|
39
|
+
this.callbacks[eventType]!.push(callback)
|
|
40
|
+
return {
|
|
41
|
+
unsubscribe: () => {
|
|
42
|
+
this.callbacks[eventType] = this.callbacks[eventType]!.filter((other) => callback !== other)
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { removeItem } from './utils/arrayUtils'
|
|
2
|
+
|
|
3
|
+
const BUFFER_LIMIT = 500
|
|
4
|
+
/**
|
|
5
|
+
* BoundedBuffer is a deprecated interface.
|
|
6
|
+
*
|
|
7
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
8
|
+
*/
|
|
9
|
+
export interface BoundedBuffer<T = void> {
|
|
10
|
+
add: (callback: (arg: T) => void) => void
|
|
11
|
+
remove: (callback: (arg: T) => void) => void
|
|
12
|
+
drain: (arg: T) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* createBoundedBuffer creates a BoundedBuffer.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use `BufferedObservable` instead.
|
|
19
|
+
*/
|
|
20
|
+
export function createBoundedBuffer<T = void>(): BoundedBuffer<T> {
|
|
21
|
+
const buffer: Array<(arg: T) => void> = []
|
|
22
|
+
|
|
23
|
+
const add: BoundedBuffer<T>['add'] = (callback: (arg: T) => void) => {
|
|
24
|
+
const length = buffer.push(callback)
|
|
25
|
+
if (length > BUFFER_LIMIT) {
|
|
26
|
+
buffer.splice(0, 1)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const remove: BoundedBuffer<T>['remove'] = (callback: (arg: T) => void) => {
|
|
31
|
+
removeItem(buffer, callback)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const drain = (arg: T) => {
|
|
35
|
+
buffer.forEach((callback) => callback(arg))
|
|
36
|
+
buffer.length = 0
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
add,
|
|
41
|
+
remove,
|
|
42
|
+
drain,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { display } from './display'
|
|
2
|
+
|
|
3
|
+
export function catchUserErrors<Args extends any[], R>(fn: (...args: Args) => R, errorMsg: string) {
|
|
4
|
+
return (...args: Args) => {
|
|
5
|
+
try {
|
|
6
|
+
return fn(...args)
|
|
7
|
+
} catch (err) {
|
|
8
|
+
display.error(errorMsg, err)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* eslint-disable local-rules/disallow-side-effects */
|
|
2
|
+
/**
|
|
3
|
+
* Keep references on console methods to avoid triggering patched behaviors
|
|
4
|
+
*
|
|
5
|
+
* NB: in some setup, console could already be patched by another SDK.
|
|
6
|
+
* In this case, some display messages can be sent by the other SDK
|
|
7
|
+
* but we should be safe from infinite loop nonetheless.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const ConsoleApiName = {
|
|
11
|
+
log: 'log',
|
|
12
|
+
debug: 'debug',
|
|
13
|
+
info: 'info',
|
|
14
|
+
warn: 'warn',
|
|
15
|
+
error: 'error',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
export type ConsoleApiName = (typeof ConsoleApiName)[keyof typeof ConsoleApiName]
|
|
19
|
+
|
|
20
|
+
interface Display {
|
|
21
|
+
debug: typeof console.debug
|
|
22
|
+
log: typeof console.log
|
|
23
|
+
info: typeof console.info
|
|
24
|
+
warn: typeof console.warn
|
|
25
|
+
error: typeof console.error
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* When building JS bundles, some users might use a plugin[1] or configuration[2] to remove
|
|
30
|
+
* "console.*" references. This causes some issue as we expect `console.*` to be defined.
|
|
31
|
+
* As a workaround, let's use a variable alias, so those expressions won't be taken into account by
|
|
32
|
+
* simple static analysis.
|
|
33
|
+
*
|
|
34
|
+
* [1]: https://babeljs.io/docs/babel-plugin-transform-remove-console/
|
|
35
|
+
* [2]: https://github.com/terser/terser#compress-options (look for drop_console)
|
|
36
|
+
*/
|
|
37
|
+
export const globalConsole = console
|
|
38
|
+
|
|
39
|
+
export const originalConsoleMethods = {} as Display
|
|
40
|
+
Object.keys(ConsoleApiName).forEach((name) => {
|
|
41
|
+
originalConsoleMethods[name as ConsoleApiName] = globalConsole[name as ConsoleApiName]
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const PREFIX = 'Kubsesense Browser SDK:'
|
|
45
|
+
|
|
46
|
+
export const display: Display = {
|
|
47
|
+
debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX),
|
|
48
|
+
log: originalConsoleMethods.log.bind(globalConsole, PREFIX),
|
|
49
|
+
info: originalConsoleMethods.info.bind(globalConsole, PREFIX),
|
|
50
|
+
warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),
|
|
51
|
+
error: originalConsoleMethods.error.bind(globalConsole, PREFIX),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const DOCS_ORIGIN = 'https://docs.kubesense.ai'
|
|
55
|
+
export const DOCS_TROUBLESHOOTING = `${DOCS_ORIGIN}/rum/browser/troubleshooting`
|
|
56
|
+
export const MORE_DETAILS = 'More details:'
|