@openobserve/browser-core 0.2.12-beta.21 → 0.2.12-beta.22
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/cjs/boot/displayAlreadyInitializedError.d.ts +1 -1
- package/cjs/boot/init.d.ts +1 -1
- package/cjs/boot/init.js +1 -1
- package/cjs/browser/addEventListener.d.ts +1 -1
- package/cjs/browser/addEventListener.js +1 -1
- package/cjs/domain/configuration/endpointBuilder.js +14 -12
- package/cjs/domain/configuration/endpointBuilder.js.map +1 -1
- package/cjs/domain/context/storeContextManager.js +1 -1
- package/cjs/domain/tags.js +1 -1
- package/cjs/domain/telemetry/telemetry.js +2 -2
- 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 +14 -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 +28 -0
- package/esm/browser/cookie.js +103 -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 +312 -0
- package/esm/domain/configuration/configuration.js +131 -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 +74 -0
- package/esm/domain/configuration/endpointBuilder.js.map +1 -0
- package/esm/domain/configuration/index.d.ts +5 -0
- package/esm/domain/configuration/index.js +4 -0
- package/esm/domain/configuration/index.js.map +1 -0
- package/esm/domain/configuration/transportConfiguration.d.ts +20 -0
- package/esm/domain/configuration/transportConfiguration.js +50 -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 +57 -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 +29 -0
- package/esm/domain/contexts/userContext.js +41 -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 +65 -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 +8 -0
- package/esm/domain/intakeSites.js +8 -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 +179 -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 +60 -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 +228 -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/index.d.ts +100 -0
- package/esm/index.js +76 -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 +52 -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 +9 -0
- package/esm/tools/utils/numberUtils.js +18 -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 +56 -0
- package/esm/transport/httpRequest.js +89 -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 +1 -1
- package/src/boot/displayAlreadyInitializedError.ts +1 -1
- package/src/boot/init.ts +1 -1
- package/src/browser/addEventListener.ts +2 -2
- package/src/domain/configuration/endpointBuilder.ts +16 -15
- package/src/domain/context/storeContextManager.ts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { InitConfiguration } from '../domain/configuration';
|
|
2
|
-
export declare function displayAlreadyInitializedError(sdkName: '
|
|
2
|
+
export declare function displayAlreadyInitializedError(sdkName: 'OO_RUM' | 'OO_LOGS', initConfiguration: InitConfiguration): void;
|
package/cjs/boot/init.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface PublicApi {
|
|
|
4
4
|
*/
|
|
5
5
|
version: string;
|
|
6
6
|
/**
|
|
7
|
-
* For CDN async setup: Early RUM API calls must be wrapped in the `window.
|
|
7
|
+
* For CDN async setup: Early RUM API calls must be wrapped in the `window.OO_RUM.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
|
|
8
8
|
*
|
|
9
9
|
* See [CDN async setup](https://docs.datadoghq.com/real_user_monitoring/browser/#cdn-async) for further information.
|
|
10
10
|
*/
|
package/cjs/boot/init.js
CHANGED
|
@@ -7,7 +7,7 @@ const monitor_1 = require("../tools/monitor");
|
|
|
7
7
|
const display_1 = require("../tools/display");
|
|
8
8
|
function makePublicApi(stub) {
|
|
9
9
|
const publicApi = {
|
|
10
|
-
version:
|
|
10
|
+
version: "0.2.12-beta.22",
|
|
11
11
|
// This API method is intentionally not monitored, since the only thing executed is the
|
|
12
12
|
// user-provided 'callback'. All SDK usages executed in the callback should be monitored, and
|
|
13
13
|
// we don't want to interfere with the user uncaught exceptions.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CookieStore, CookieStoreEventMap, VisualViewport, VisualViewportEventMap } from './browser.types';
|
|
2
2
|
export type TrustableEvent<E extends Event = Event> = E & {
|
|
3
|
-
|
|
3
|
+
__ooIsTrusted?: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare const enum DOM_EVENT {
|
|
6
6
|
BEFORE_UNLOAD = "beforeunload",
|
|
@@ -31,7 +31,7 @@ function addEventListener(configuration, eventTarget, eventName, listener, optio
|
|
|
31
31
|
*/
|
|
32
32
|
function addEventListeners(configuration, eventTarget, eventNames, listener, { once, capture, passive } = {}) {
|
|
33
33
|
const listenerWithMonitor = (0, monitor_1.monitor)((event) => {
|
|
34
|
-
if (!event.isTrusted && !event.
|
|
34
|
+
if (!event.isTrusted && !event.__ooIsTrusted && !configuration.allowUntrustedEvents) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (once) {
|
|
@@ -22,9 +22,9 @@ function createEndpointBuilder(initConfiguration, trackType, extraParameters) {
|
|
|
22
22
|
* request, as only parameters are changing.
|
|
23
23
|
*/
|
|
24
24
|
function createEndpointUrlWithParametersBuilder(initConfiguration, trackType) {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
if (proxy) {
|
|
25
|
+
const path = `/api/v2/${trackType}`;
|
|
26
|
+
const proxy = initConfiguration.proxy;
|
|
27
|
+
if (typeof proxy === 'string') {
|
|
28
28
|
const normalizedProxyUrl = (0, urlPolyfill_1.normalizeUrl)(proxy);
|
|
29
29
|
return (parameters) => `${normalizedProxyUrl}?ooforward=${encodeURIComponent(`${path}?${parameters}`)}`;
|
|
30
30
|
}
|
|
@@ -36,7 +36,9 @@ function createEndpointUrlWithParametersBuilder(initConfiguration, trackType) {
|
|
|
36
36
|
}
|
|
37
37
|
function buildEndpointHost(trackType, initConfiguration) {
|
|
38
38
|
const { site = intakeSites_1.INTAKE_SITE_US1, internalAnalyticsSubdomain } = initConfiguration;
|
|
39
|
-
|
|
39
|
+
if (trackType === 'logs' && initConfiguration.usePciIntake && site === intakeSites_1.INTAKE_SITE_US1) {
|
|
40
|
+
return intakeSites_1.PCI_INTAKE_HOST_US1;
|
|
41
|
+
}
|
|
40
42
|
if (internalAnalyticsSubdomain && site === intakeSites_1.INTAKE_SITE_US1) {
|
|
41
43
|
return `${internalAnalyticsSubdomain}.${intakeSites_1.INTAKE_SITE_US1}`;
|
|
42
44
|
}
|
|
@@ -53,19 +55,19 @@ function buildEndpointHost(trackType, initConfiguration) {
|
|
|
53
55
|
*/
|
|
54
56
|
function buildEndpointParameters({ clientToken, internalAnalyticsSubdomain, source = 'browser' }, trackType, api, { retry, encoding }, extraParameters = []) {
|
|
55
57
|
const parameters = [
|
|
56
|
-
|
|
57
|
-
`
|
|
58
|
-
`
|
|
59
|
-
'
|
|
60
|
-
`
|
|
58
|
+
`oosource=${source}`,
|
|
59
|
+
`oo-api-key=${clientToken}`,
|
|
60
|
+
`oo-evp-origin-version=${encodeURIComponent("0.2.12-beta.22")}`,
|
|
61
|
+
'oo-evp-origin=browser',
|
|
62
|
+
`oo-request-id=${(0, stringUtils_1.generateUUID)()}`,
|
|
61
63
|
].concat(extraParameters);
|
|
62
64
|
if (encoding) {
|
|
63
|
-
parameters.push(`
|
|
65
|
+
parameters.push(`oo-evp-encoding=${encoding}`);
|
|
64
66
|
}
|
|
65
67
|
if (trackType === 'rum') {
|
|
66
|
-
parameters.push(`batch_time=${(0, timeUtils_1.timeStampNow)()}`, `
|
|
68
|
+
parameters.push(`batch_time=${(0, timeUtils_1.timeStampNow)()}`, `_oo.api=${api}`);
|
|
67
69
|
if (retry) {
|
|
68
|
-
parameters.push(`
|
|
70
|
+
parameters.push(`_oo.retry_count=${retry.count}`, `_oo.retry_after=${retry.lastFailureStatus}`);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
if (internalAnalyticsSubdomain) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpointBuilder.js","sourceRoot":"","sources":["../../../src/domain/configuration/endpointBuilder.ts"],"names":[],"mappings":";;AA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AAU,CAAC,IAAI,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,SAAS,KAAK,KAAK,EAAE,CAAC;QACxB,UAAU,CAAC,IAAI,CAAC,cAAc,IAAA,wBAAY,GAAE,EAAE,EAAE,WAAW,GAAG,EAAE,CAAC,CAAA;QAEjE,IAAI,KAAK,EAAE,CAAC;YACV,UAAU,CAAC,IAAI,CAAC,mBAAmB,KAAK,CAAC,KAAK,EAAE,EAAE,mBAAmB,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAA;QACjG,CAAC;IACH,CAAC;IAED,IAAI,0BAA0B,EAAE,CAAC;QAC/B,UAAU,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC;IAED,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -6,7 +6,7 @@ exports.removeStorageListeners = removeStorageListeners;
|
|
|
6
6
|
const addEventListener_1 = require("../../browser/addEventListener");
|
|
7
7
|
const mergeInto_1 = require("../../tools/mergeInto");
|
|
8
8
|
const objectUtils_1 = require("../../tools/utils/objectUtils");
|
|
9
|
-
const CONTEXT_STORE_KEY_PREFIX = '
|
|
9
|
+
const CONTEXT_STORE_KEY_PREFIX = '_oo_c';
|
|
10
10
|
const storageListeners = [];
|
|
11
11
|
function storeContextManager(configuration, contextManager, productKey, customerDataType) {
|
|
12
12
|
const storageKey = buildStorageKey(productKey, customerDataType);
|
package/cjs/domain/tags.js
CHANGED
|
@@ -9,7 +9,7 @@ const display_1 = require("../tools/display");
|
|
|
9
9
|
exports.TAG_SIZE_LIMIT = 200;
|
|
10
10
|
function buildTags(configuration) {
|
|
11
11
|
const { env, service, version, datacenter, sdkVersion, variant } = configuration;
|
|
12
|
-
const tags = [buildTag('sdk_version', sdkVersion !== null && sdkVersion !== void 0 ? sdkVersion :
|
|
12
|
+
const tags = [buildTag('sdk_version', sdkVersion !== null && sdkVersion !== void 0 ? sdkVersion : "0.2.12-beta.22")];
|
|
13
13
|
if (env) {
|
|
14
14
|
tags.push(buildTag('env', env));
|
|
15
15
|
}
|
|
@@ -105,7 +105,7 @@ function startTelemetryCollection(telemetryService, configuration, hooks, observ
|
|
|
105
105
|
type: 'telemetry',
|
|
106
106
|
date: clockNow.timeStamp,
|
|
107
107
|
service: telemetryService,
|
|
108
|
-
version:
|
|
108
|
+
version: "0.2.12-beta.22",
|
|
109
109
|
source: 'browser',
|
|
110
110
|
_oo: {
|
|
111
111
|
format_version: 2,
|
|
@@ -113,7 +113,7 @@ function startTelemetryCollection(telemetryService, configuration, hooks, observ
|
|
|
113
113
|
telemetry: (0, mergeInto_1.combine)(rawEvent, {
|
|
114
114
|
runtime_env: runtimeEnvInfo,
|
|
115
115
|
connectivity: (0, connectivity_1.getConnectivity)(),
|
|
116
|
-
sdk_setup:
|
|
116
|
+
sdk_setup: "npm",
|
|
117
117
|
}),
|
|
118
118
|
ootags: (0, tags_1.buildTags)(configuration).join(','),
|
|
119
119
|
experimental_features: Array.from((0, experimentalFeatures_1.getExperimentalFeatures)()),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { display } from '../tools/display';
|
|
2
|
+
export function displayAlreadyInitializedError(sdkName, initConfiguration) {
|
|
3
|
+
if (!initConfiguration.silentMultipleInit) {
|
|
4
|
+
display.error(`${sdkName} is already initialized.`);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=displayAlreadyInitializedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayAlreadyInitializedError.js","sourceRoot":"","sources":["../../src/boot/displayAlreadyInitializedError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,MAAM,UAAU,8BAA8B,CAAC,OAA6B,EAAE,iBAAoC;IAChH,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC;QAC1C,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,0BAA0B,CAAC,CAAA;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PublicApi {
|
|
2
|
+
/**
|
|
3
|
+
* Version of the Logs browser SDK
|
|
4
|
+
*/
|
|
5
|
+
version: string;
|
|
6
|
+
/**
|
|
7
|
+
* For CDN async setup: Early RUM API calls must be wrapped in the `window.OO_RUM.onReady()` callback. This ensures the code only gets executed once the SDK is properly loaded.
|
|
8
|
+
*
|
|
9
|
+
* See [CDN async setup](https://docs.datadoghq.com/real_user_monitoring/browser/#cdn-async) for further information.
|
|
10
|
+
*/
|
|
11
|
+
onReady: (callback: () => void) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function makePublicApi<T extends PublicApi>(stub: Omit<T, keyof PublicApi>): T;
|
|
14
|
+
export declare function defineGlobal<Global, Name extends keyof Global>(global: Global, name: Name, api: Global[Name]): void;
|
package/esm/boot/init.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { catchUserErrors } from '../tools/catchUserErrors';
|
|
2
|
+
import { setDebugMode } from '../tools/monitor';
|
|
3
|
+
import { display } from '../tools/display';
|
|
4
|
+
export function makePublicApi(stub) {
|
|
5
|
+
const publicApi = {
|
|
6
|
+
version: "0.2.12-beta.22",
|
|
7
|
+
// This API method is intentionally not monitored, since the only thing executed is the
|
|
8
|
+
// user-provided 'callback'. All SDK usages executed in the callback should be monitored, and
|
|
9
|
+
// we don't want to interfere with the user uncaught exceptions.
|
|
10
|
+
onReady(callback) {
|
|
11
|
+
callback();
|
|
12
|
+
},
|
|
13
|
+
...stub,
|
|
14
|
+
};
|
|
15
|
+
// Add a "hidden" property to set debug mode. We define it that way to hide it
|
|
16
|
+
// as much as possible but of course it's not a real protection.
|
|
17
|
+
Object.defineProperty(publicApi, '_setDebug', {
|
|
18
|
+
get() {
|
|
19
|
+
return setDebugMode;
|
|
20
|
+
},
|
|
21
|
+
enumerable: false,
|
|
22
|
+
});
|
|
23
|
+
return publicApi;
|
|
24
|
+
}
|
|
25
|
+
export function defineGlobal(global, name, api) {
|
|
26
|
+
const existingGlobalVariable = global[name];
|
|
27
|
+
if (existingGlobalVariable && !existingGlobalVariable.q && existingGlobalVariable.version) {
|
|
28
|
+
display.warn('SDK is loaded more than once. This is unsupported and might have unexpected behavior.');
|
|
29
|
+
}
|
|
30
|
+
global[name] = api;
|
|
31
|
+
if (existingGlobalVariable && existingGlobalVariable.q) {
|
|
32
|
+
existingGlobalVariable.q.forEach((fn) => catchUserErrors(fn, 'onReady callback threw an error:')());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/boot/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAmB1C,MAAM,UAAU,aAAa,CAAsB,IAA8B;IAC/E,MAAM,SAAS,GAAG;QAChB,OAAO,EAAE,0BAA0B;QACnC,uFAAuF;QACvF,8FAA8F;QAC9F,gEAAgE;QAChE,OAAO,CAAC,QAAoB;YAC1B,QAAQ,EAAE,CAAA;QACZ,CAAC;QACD,GAAG,IAAI;KACR,CAAA;IAED,8EAA8E;IAC9E,gEAAgE;IAChE,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,WAAW,EAAE;QAC5C,GAAG;YACD,OAAO,YAAY,CAAA;QACrB,CAAC;QACD,UAAU,EAAE,KAAK;KAClB,CAAC,CAAA;IAEF,OAAO,SAAc,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAoC,MAAc,EAAE,IAAU,EAAE,GAAiB;IAC3G,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAA4D,CAAA;IACtG,IAAI,sBAAsB,IAAI,CAAC,sBAAsB,CAAC,CAAC,IAAI,sBAAsB,CAAC,OAAO,EAAE,CAAC;QAC1F,OAAO,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAA;IACvG,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IAClB,IAAI,sBAAsB,IAAI,sBAAsB,CAAC,CAAC,EAAE,CAAC;QACvD,sBAAsB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE,kCAAkC,CAAC,EAAE,CAAC,CAAA;IACrG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { CookieStore, CookieStoreEventMap, VisualViewport, VisualViewportEventMap } from './browser.types';
|
|
2
|
+
export type TrustableEvent<E extends Event = Event> = E & {
|
|
3
|
+
__ooIsTrusted?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const enum DOM_EVENT {
|
|
6
|
+
BEFORE_UNLOAD = "beforeunload",
|
|
7
|
+
CLICK = "click",
|
|
8
|
+
DBL_CLICK = "dblclick",
|
|
9
|
+
KEY_DOWN = "keydown",
|
|
10
|
+
LOAD = "load",
|
|
11
|
+
POP_STATE = "popstate",
|
|
12
|
+
SCROLL = "scroll",
|
|
13
|
+
TOUCH_START = "touchstart",
|
|
14
|
+
TOUCH_END = "touchend",
|
|
15
|
+
TOUCH_MOVE = "touchmove",
|
|
16
|
+
VISIBILITY_CHANGE = "visibilitychange",
|
|
17
|
+
PAGE_SHOW = "pageshow",
|
|
18
|
+
FREEZE = "freeze",
|
|
19
|
+
RESUME = "resume",
|
|
20
|
+
DOM_CONTENT_LOADED = "DOMContentLoaded",
|
|
21
|
+
POINTER_DOWN = "pointerdown",
|
|
22
|
+
POINTER_UP = "pointerup",
|
|
23
|
+
POINTER_CANCEL = "pointercancel",
|
|
24
|
+
HASH_CHANGE = "hashchange",
|
|
25
|
+
PAGE_HIDE = "pagehide",
|
|
26
|
+
MOUSE_DOWN = "mousedown",
|
|
27
|
+
MOUSE_UP = "mouseup",
|
|
28
|
+
MOUSE_MOVE = "mousemove",
|
|
29
|
+
FOCUS = "focus",
|
|
30
|
+
BLUR = "blur",
|
|
31
|
+
CONTEXT_MENU = "contextmenu",
|
|
32
|
+
RESIZE = "resize",
|
|
33
|
+
CHANGE = "change",
|
|
34
|
+
INPUT = "input",
|
|
35
|
+
PLAY = "play",
|
|
36
|
+
PAUSE = "pause",
|
|
37
|
+
SECURITY_POLICY_VIOLATION = "securitypolicyviolation",
|
|
38
|
+
SELECTION_CHANGE = "selectionchange",
|
|
39
|
+
STORAGE = "storage"
|
|
40
|
+
}
|
|
41
|
+
interface AddEventListenerOptions {
|
|
42
|
+
once?: boolean;
|
|
43
|
+
capture?: boolean;
|
|
44
|
+
passive?: boolean;
|
|
45
|
+
}
|
|
46
|
+
type EventMapFor<T> = T extends Window ? WindowEventMap & {
|
|
47
|
+
freeze: Event;
|
|
48
|
+
resume: Event;
|
|
49
|
+
visibilitychange: Event;
|
|
50
|
+
} : T extends Document ? DocumentEventMap : T extends HTMLElement ? HTMLElementEventMap : T extends VisualViewport ? VisualViewportEventMap : T extends ShadowRoot ? GlobalEventHandlersEventMap : T extends XMLHttpRequest ? XMLHttpRequestEventMap : T extends Performance ? PerformanceEventMap : T extends Worker ? WorkerEventMap : T extends CookieStore ? CookieStoreEventMap : Record<never, never>;
|
|
51
|
+
/**
|
|
52
|
+
* Add an event listener to an event target object (Window, Element, mock object...). This provides
|
|
53
|
+
* a few conveniences compared to using `element.addEventListener` directly:
|
|
54
|
+
*
|
|
55
|
+
* * supports IE11 by: using an option object only if needed and emulating the `once` option
|
|
56
|
+
*
|
|
57
|
+
* * wraps the listener with a `monitor` function
|
|
58
|
+
*
|
|
59
|
+
* * returns a `stop` function to remove the listener
|
|
60
|
+
*/
|
|
61
|
+
export declare function addEventListener<Target extends EventTarget, EventName extends keyof EventMapFor<Target> & string>(configuration: {
|
|
62
|
+
allowUntrustedEvents?: boolean | undefined;
|
|
63
|
+
}, eventTarget: Target, eventName: EventName, listener: (event: EventMapFor<Target>[EventName] & {
|
|
64
|
+
type: EventName;
|
|
65
|
+
}) => void, options?: AddEventListenerOptions): {
|
|
66
|
+
stop: () => void;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Add event listeners to an event target object (Window, Element, mock object...). This provides
|
|
70
|
+
* a few conveniences compared to using `element.addEventListener` directly:
|
|
71
|
+
*
|
|
72
|
+
* * supports IE11 by: using an option object only if needed and emulating the `once` option
|
|
73
|
+
*
|
|
74
|
+
* * wraps the listener with a `monitor` function
|
|
75
|
+
*
|
|
76
|
+
* * returns a `stop` function to remove the listener
|
|
77
|
+
*
|
|
78
|
+
* * with `once: true`, the listener will be called at most once, even if different events are listened
|
|
79
|
+
*/
|
|
80
|
+
export declare function addEventListeners<Target extends EventTarget, EventName extends keyof EventMapFor<Target> & string>(configuration: {
|
|
81
|
+
allowUntrustedEvents?: boolean | undefined;
|
|
82
|
+
}, eventTarget: Target, eventNames: EventName[], listener: (event: EventMapFor<Target>[EventName] & {
|
|
83
|
+
type: EventName;
|
|
84
|
+
}) => void, { once, capture, passive }?: AddEventListenerOptions): {
|
|
85
|
+
stop: () => void;
|
|
86
|
+
};
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { monitor } from '../tools/monitor';
|
|
2
|
+
import { getZoneJsOriginalValue } from '../tools/getZoneJsOriginalValue';
|
|
3
|
+
/**
|
|
4
|
+
* Add an event listener to an event target object (Window, Element, mock object...). This provides
|
|
5
|
+
* a few conveniences compared to using `element.addEventListener` directly:
|
|
6
|
+
*
|
|
7
|
+
* * supports IE11 by: using an option object only if needed and emulating the `once` option
|
|
8
|
+
*
|
|
9
|
+
* * wraps the listener with a `monitor` function
|
|
10
|
+
*
|
|
11
|
+
* * returns a `stop` function to remove the listener
|
|
12
|
+
*/
|
|
13
|
+
export function addEventListener(configuration, eventTarget, eventName, listener, options) {
|
|
14
|
+
return addEventListeners(configuration, eventTarget, [eventName], listener, options);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Add event listeners to an event target object (Window, Element, mock object...). This provides
|
|
18
|
+
* a few conveniences compared to using `element.addEventListener` directly:
|
|
19
|
+
*
|
|
20
|
+
* * supports IE11 by: using an option object only if needed and emulating the `once` option
|
|
21
|
+
*
|
|
22
|
+
* * wraps the listener with a `monitor` function
|
|
23
|
+
*
|
|
24
|
+
* * returns a `stop` function to remove the listener
|
|
25
|
+
*
|
|
26
|
+
* * with `once: true`, the listener will be called at most once, even if different events are listened
|
|
27
|
+
*/
|
|
28
|
+
export function addEventListeners(configuration, eventTarget, eventNames, listener, { once, capture, passive } = {}) {
|
|
29
|
+
const listenerWithMonitor = monitor((event) => {
|
|
30
|
+
if (!event.isTrusted && !event.__ooIsTrusted && !configuration.allowUntrustedEvents) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (once) {
|
|
34
|
+
stop();
|
|
35
|
+
}
|
|
36
|
+
listener(event);
|
|
37
|
+
});
|
|
38
|
+
const options = passive ? { capture, passive } : capture;
|
|
39
|
+
// Use the window.EventTarget.prototype when possible to avoid wrong overrides (e.g: https://github.com/salesforce/lwc/issues/1824)
|
|
40
|
+
const listenerTarget = window.EventTarget && eventTarget instanceof EventTarget ? window.EventTarget.prototype : eventTarget;
|
|
41
|
+
const add = getZoneJsOriginalValue(listenerTarget, 'addEventListener');
|
|
42
|
+
eventNames.forEach((eventName) => add.call(eventTarget, eventName, listenerWithMonitor, options));
|
|
43
|
+
function stop() {
|
|
44
|
+
const remove = getZoneJsOriginalValue(listenerTarget, 'removeEventListener');
|
|
45
|
+
eventNames.forEach((eventName) => remove.call(eventTarget, eventName, listenerWithMonitor, options));
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
stop,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=addEventListener.js.map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,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAA;IACtE,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAA;IAEjG,SAAS,IAAI;QACX,MAAM,MAAM,GAAG,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAA;QAC5E,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAA;IACtG,CAAC;IAED,OAAO;QACL,IAAI;KACL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface VisualViewportEventMap {
|
|
2
|
+
resize: Event;
|
|
3
|
+
scroll: Event;
|
|
4
|
+
}
|
|
5
|
+
export interface VisualViewport extends EventTarget {
|
|
6
|
+
readonly height: number;
|
|
7
|
+
readonly offsetLeft: number;
|
|
8
|
+
readonly offsetTop: number;
|
|
9
|
+
onresize: ((this: VisualViewport, ev: Event) => any) | null;
|
|
10
|
+
onscroll: ((this: VisualViewport, ev: Event) => any) | null;
|
|
11
|
+
readonly pageLeft: number;
|
|
12
|
+
readonly pageTop: number;
|
|
13
|
+
readonly scale: number;
|
|
14
|
+
readonly width: number;
|
|
15
|
+
addEventListener<K extends keyof VisualViewportEventMap>(type: K, listener: (this: VisualViewport, ev: VisualViewportEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
16
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
17
|
+
removeEventListener<K extends keyof VisualViewportEventMap>(type: K, listener: (this: VisualViewport, ev: VisualViewportEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
18
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
19
|
+
}
|
|
20
|
+
export interface WeakRef<T extends object> {
|
|
21
|
+
readonly [Symbol.toStringTag]: 'WeakRef';
|
|
22
|
+
deref(): T | undefined;
|
|
23
|
+
}
|
|
24
|
+
export interface WeakRefConstructor {
|
|
25
|
+
readonly prototype: WeakRef<any>;
|
|
26
|
+
new <T extends object>(target: T): WeakRef<T>;
|
|
27
|
+
}
|
|
28
|
+
export interface CookieStore extends EventTarget {
|
|
29
|
+
get(name: string): Promise<unknown>;
|
|
30
|
+
getAll(name?: string): Promise<Array<{
|
|
31
|
+
name: string;
|
|
32
|
+
value: string;
|
|
33
|
+
domain?: string;
|
|
34
|
+
path?: string;
|
|
35
|
+
expires?: number;
|
|
36
|
+
secure?: boolean;
|
|
37
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
38
|
+
partitioned?: boolean;
|
|
39
|
+
}>>;
|
|
40
|
+
}
|
|
41
|
+
export interface CookieStoreEventMap {
|
|
42
|
+
change: CookieChangeEvent;
|
|
43
|
+
}
|
|
44
|
+
export interface CookieChangeItem {
|
|
45
|
+
name: string;
|
|
46
|
+
value: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
export type CookieChangeEvent = Event & {
|
|
49
|
+
changed: CookieChangeItem[];
|
|
50
|
+
deleted: CookieChangeItem[];
|
|
51
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Those types come from the official TypeScript DOM library, but are not included in our minimal
|
|
2
|
+
// supported TS version.
|
|
3
|
+
// https://github.com/microsoft/TypeScript/blob/13c374a868c926f6a907666a5599992c1351b773/src/lib/dom.generated.d.ts#L15399-L15418
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=browser.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.types.js","sourceRoot":"","sources":["../../src/browser/browser.types.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,wBAAwB;AACxB,iIAAiI"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface CookieOptions {
|
|
2
|
+
secure?: boolean;
|
|
3
|
+
crossSite?: boolean;
|
|
4
|
+
partitioned?: boolean;
|
|
5
|
+
domain?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function setCookie(name: string, value: string, expireDelay?: number, options?: CookieOptions): void;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the value of the cookie with the given name
|
|
10
|
+
* If there are multiple cookies with the same name, returns the first one
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCookie(name: string): string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Returns all the values of the cookies with the given name
|
|
15
|
+
*/
|
|
16
|
+
export declare function getCookies(name: string): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)
|
|
19
|
+
* to avoid accessing document.cookie multiple times.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ If there are multiple cookies with the same name, returns the LAST one (unlike `getCookie()`)
|
|
22
|
+
*/
|
|
23
|
+
export declare function getInitCookie(name: string): string | undefined;
|
|
24
|
+
export declare function resetInitCookies(): void;
|
|
25
|
+
export declare function deleteCookie(name: string, options?: CookieOptions): void;
|
|
26
|
+
export declare function areCookiesAuthorized(options: CookieOptions): boolean;
|
|
27
|
+
export declare function getCurrentSite(hostname?: string, referrer?: string): string | undefined;
|
|
28
|
+
export declare function resetGetCurrentSite(): void;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { display } from '../tools/display';
|
|
2
|
+
import { ONE_MINUTE, ONE_SECOND } from '../tools/utils/timeUtils';
|
|
3
|
+
import { findAllCommaSeparatedValues, findCommaSeparatedValue, findCommaSeparatedValues, generateUUID, } from '../tools/utils/stringUtils';
|
|
4
|
+
import { buildUrl } from '../tools/utils/urlPolyfill';
|
|
5
|
+
export function setCookie(name, value, expireDelay = 0, options) {
|
|
6
|
+
const date = new Date();
|
|
7
|
+
date.setTime(date.getTime() + expireDelay);
|
|
8
|
+
const expires = `expires=${date.toUTCString()}`;
|
|
9
|
+
const sameSite = options && options.crossSite ? 'none' : 'strict';
|
|
10
|
+
const domain = options && options.domain ? `;domain=${options.domain}` : '';
|
|
11
|
+
const secure = options && options.secure ? ';secure' : '';
|
|
12
|
+
const partitioned = options && options.partitioned ? ';partitioned' : '';
|
|
13
|
+
document.cookie = `${name}=${value};${expires};path=/;samesite=${sameSite}${domain}${secure}${partitioned}`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the value of the cookie with the given name
|
|
17
|
+
* If there are multiple cookies with the same name, returns the first one
|
|
18
|
+
*/
|
|
19
|
+
export function getCookie(name) {
|
|
20
|
+
return findCommaSeparatedValue(document.cookie, name);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns all the values of the cookies with the given name
|
|
24
|
+
*/
|
|
25
|
+
export function getCookies(name) {
|
|
26
|
+
return findAllCommaSeparatedValues(document.cookie).get(name) || [];
|
|
27
|
+
}
|
|
28
|
+
let initCookieParsed;
|
|
29
|
+
/**
|
|
30
|
+
* Returns a cached value of the cookie. Use this during SDK initialization (and whenever possible)
|
|
31
|
+
* to avoid accessing document.cookie multiple times.
|
|
32
|
+
*
|
|
33
|
+
* ⚠️ If there are multiple cookies with the same name, returns the LAST one (unlike `getCookie()`)
|
|
34
|
+
*/
|
|
35
|
+
export function getInitCookie(name) {
|
|
36
|
+
if (!initCookieParsed) {
|
|
37
|
+
initCookieParsed = findCommaSeparatedValues(document.cookie);
|
|
38
|
+
}
|
|
39
|
+
return initCookieParsed.get(name);
|
|
40
|
+
}
|
|
41
|
+
export function resetInitCookies() {
|
|
42
|
+
initCookieParsed = undefined;
|
|
43
|
+
}
|
|
44
|
+
export function deleteCookie(name, options) {
|
|
45
|
+
setCookie(name, '', 0, options);
|
|
46
|
+
}
|
|
47
|
+
export function areCookiesAuthorized(options) {
|
|
48
|
+
if (document.cookie === undefined || document.cookie === null) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during
|
|
53
|
+
// the test cookie lifetime
|
|
54
|
+
const testCookieName = `oo_cookie_test_${generateUUID()}`;
|
|
55
|
+
const testCookieValue = 'test';
|
|
56
|
+
setCookie(testCookieName, testCookieValue, ONE_MINUTE, options);
|
|
57
|
+
const isCookieCorrectlySet = getCookie(testCookieName) === testCookieValue;
|
|
58
|
+
deleteCookie(testCookieName, options);
|
|
59
|
+
return isCookieCorrectlySet;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
display.error(error);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* No API to retrieve it, number of levels for subdomain and suffix are unknown
|
|
68
|
+
* strategy: find the minimal domain on which cookies are allowed to be set
|
|
69
|
+
* https://web.dev/same-site-same-origin/#site
|
|
70
|
+
*/
|
|
71
|
+
let getCurrentSiteCache;
|
|
72
|
+
export function getCurrentSite(hostname = location.hostname, referrer = document.referrer) {
|
|
73
|
+
if (getCurrentSiteCache === undefined) {
|
|
74
|
+
const defaultHostName = getCookieDefaultHostName(hostname, referrer);
|
|
75
|
+
if (defaultHostName) {
|
|
76
|
+
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during
|
|
77
|
+
// the test cookie lifetime
|
|
78
|
+
const testCookieName = `oo_site_test_${generateUUID()}`;
|
|
79
|
+
const testCookieValue = 'test';
|
|
80
|
+
const domainLevels = defaultHostName.split('.');
|
|
81
|
+
let candidateDomain = domainLevels.pop();
|
|
82
|
+
while (domainLevels.length && !getCookie(testCookieName)) {
|
|
83
|
+
candidateDomain = `${domainLevels.pop()}.${candidateDomain}`;
|
|
84
|
+
setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain });
|
|
85
|
+
}
|
|
86
|
+
deleteCookie(testCookieName, { domain: candidateDomain });
|
|
87
|
+
getCurrentSiteCache = candidateDomain;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return getCurrentSiteCache;
|
|
91
|
+
}
|
|
92
|
+
function getCookieDefaultHostName(hostname, referrer) {
|
|
93
|
+
try {
|
|
94
|
+
return hostname || buildUrl(referrer).hostname;
|
|
95
|
+
}
|
|
96
|
+
catch (_a) {
|
|
97
|
+
// Ignore
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export function resetGetCurrentSite() {
|
|
101
|
+
getCurrentSiteCache = undefined;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=cookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../src/browser/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,YAAY,GACb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AASrD,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,KAAa,EAAE,cAAsB,CAAC,EAAE,OAAuB;IACrG,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;IACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,CAAA;IAC1C,MAAM,OAAO,GAAG,WAAW,IAAI,CAAC,WAAW,EAAE,EAAE,CAAA;IAC/C,MAAM,QAAQ,GAAG,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;IACjE,MAAM,MAAM,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,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AE,CAAA;gBAC7D,SAAS,CAAC,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAA;YACrF,CAAC;YACD,YAAY,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAA;YACzD,mBAAmB,GAAG,eAAe,CAAA;QACvC,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED,SAAS,wBAAwB,CAAC,QAAgB,EAAE,QAAgB;IAClE,IAAI,CAAC;QACH,OAAO,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAA;IAChD,CAAC;IAAC,WAAM,CAAC;QACP,SAAS;IACX,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,mBAAmB,GAAG,SAAS,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Observable } from '../tools/observable';
|
|
2
|
+
import type { ClocksState } from '../tools/utils/timeUtils';
|
|
3
|
+
interface FetchContextBase {
|
|
4
|
+
method: string;
|
|
5
|
+
startClocks: ClocksState;
|
|
6
|
+
input: unknown;
|
|
7
|
+
init?: RequestInit;
|
|
8
|
+
url: string;
|
|
9
|
+
handlingStack?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface FetchStartContext extends FetchContextBase {
|
|
12
|
+
state: 'start';
|
|
13
|
+
}
|
|
14
|
+
export interface FetchResolveContext extends FetchContextBase {
|
|
15
|
+
state: 'resolve';
|
|
16
|
+
status: number;
|
|
17
|
+
response?: Response;
|
|
18
|
+
responseBody?: string;
|
|
19
|
+
responseType?: string;
|
|
20
|
+
isAborted: boolean;
|
|
21
|
+
error?: Error;
|
|
22
|
+
}
|
|
23
|
+
export type FetchContext = FetchStartContext | FetchResolveContext;
|
|
24
|
+
type ResponseBodyActionGetter = (context: FetchResolveContext) => ResponseBodyAction;
|
|
25
|
+
/**
|
|
26
|
+
* Action to take with the response body of a fetch request.
|
|
27
|
+
* Values are ordered by priority: higher values take precedence when multiple actions are requested.
|
|
28
|
+
*/
|
|
29
|
+
export declare const enum ResponseBodyAction {
|
|
30
|
+
IGNORE = 0,
|
|
31
|
+
WAIT = 1,
|
|
32
|
+
COLLECT = 2
|
|
33
|
+
}
|
|
34
|
+
export declare function initFetchObservable({ responseBodyAction }?: {
|
|
35
|
+
responseBodyAction?: ResponseBodyActionGetter;
|
|
36
|
+
}): Observable<FetchContext>;
|
|
37
|
+
export declare function resetFetchObservable(): void;
|
|
38
|
+
export {};
|