Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datadog/browser-rum-core - npm Package Compare versions

Comparing version 4.36.0 to 4.37.0

src/domain/rumEventsCollection/view/setupViewTest.specHelper.ts

15

cjs/boot/rumPublicApi.d.ts

@@ -9,4 +9,4 @@ import type { Context, InitConfiguration, User } from '@datadog/browser-core';

import type { startRum } from './startRum';
export declare type RumPublicApi = ReturnType<typeof makeRumPublicApi>;
export declare type StartRum = typeof startRum;
export type RumPublicApi = ReturnType<typeof makeRumPublicApi>;
export type StartRum = typeof startRum;
export interface RecorderApi {

@@ -37,7 +37,7 @@ start: () => void;

clearGlobalContext: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInitConfiguration: () => InitConfiguration | undefined;
addAction: (name: string, context?: object | undefined) => void;
addError: (error: unknown, context?: object | undefined) => void;
addTiming: (name: string, time?: number | undefined) => void;
addAction: (name: string, context?: object) => void;
addError: (error: unknown, context?: object) => void;
addTiming: (name: string, time?: number) => void;
setUser: (newUser: User) => void;

@@ -51,5 +51,6 @@ getUser: () => Context;

startView: {
(name?: string | undefined): void;
(name?: string): void;
(options: ViewOptions): void;
};
stopSession: () => void;
startSessionReplayRecording: () => void;

@@ -56,0 +57,0 @@ stopSessionReplayRecording: () => void;

@@ -14,2 +14,3 @@ "use strict";

var getInitConfigurationStrategy = function () { return undefined; };
var stopSessionStrategy = browser_core_1.noop;
var bufferApiCalls = new browser_core_1.BoundedBuffer();

@@ -76,3 +77,3 @@ var addTimingStrategy = function (name, time) {

var startRumResults = startRumImpl(initConfiguration, configuration, recorderApi, globalContextManager, userContextManager, initialViewOptions);
(startViewStrategy = startRumResults.startView, addActionStrategy = startRumResults.addAction, addErrorStrategy = startRumResults.addError, addTimingStrategy = startRumResults.addTiming, addFeatureFlagEvaluationStrategy = startRumResults.addFeatureFlagEvaluation, getInternalContextStrategy = startRumResults.getInternalContext);
(startViewStrategy = startRumResults.startView, addActionStrategy = startRumResults.addAction, addErrorStrategy = startRumResults.addError, addTimingStrategy = startRumResults.addTiming, addFeatureFlagEvaluationStrategy = startRumResults.addFeatureFlagEvaluation, getInternalContextStrategy = startRumResults.getInternalContext, stopSessionStrategy = startRumResults.stopSession);
bufferApiCalls.drain();

@@ -104,6 +105,6 @@ recorderApi.onRumStart(startRumResults.lifeCycle, configuration, startRumResults.session, startRumResults.viewContexts);

addActionStrategy({
name: name,
context: (0, browser_core_1.deepClone)(context),
name: (0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs') ? (0, browser_core_1.sanitize)(name) : name,
context: ((0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs') ? (0, browser_core_1.sanitize)(context) : (0, browser_core_1.deepClone)(context)),
startClocks: (0, browser_core_1.clocksNow)(),
type: "custom" /* CUSTOM */,
type: "custom" /* ActionType.CUSTOM */,
});

@@ -117,3 +118,5 @@ }),

handlingStack: handlingStack,
context: (0, browser_core_1.deepClone)(context),
context: ((0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs')
? (0, browser_core_1.sanitize)(context)
: (0, browser_core_1.deepClone)(context)),
startClocks: (0, browser_core_1.clocksNow)(),

@@ -124,3 +127,3 @@ });

addTiming: (0, browser_core_1.monitor)(function (name, time) {
addTimingStrategy(name, time);
addTimingStrategy((0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs') ? (0, browser_core_1.sanitize)(name) : name, time);
}),

@@ -143,2 +146,5 @@ setUser: (0, browser_core_1.monitor)(function (newUser) {

startView: startView,
stopSession: (0, browser_core_1.monitor)(function () {
stopSessionStrategy();
}),
startSessionReplayRecording: (0, browser_core_1.monitor)(recorderApi.start),

@@ -150,3 +156,3 @@ stopSessionReplayRecording: (0, browser_core_1.monitor)(recorderApi.stop),

addFeatureFlagEvaluation: (0, browser_core_1.monitor)(function (key, value) {
addFeatureFlagEvaluationStrategy(key, value);
addFeatureFlagEvaluationStrategy((0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs') ? (0, browser_core_1.sanitize)(key) : key, (0, browser_core_1.isExperimentalFeatureEnabled)('sanitize_inputs') ? (0, browser_core_1.sanitize)(value) : value);
}),

@@ -153,0 +159,0 @@ });

@@ -18,2 +18,3 @@ import type { Observable, RawError, ContextManager } from '@datadog/browser-core';

session: RumSessionManager;
stopSession: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;

@@ -20,0 +21,0 @@ };

@@ -30,3 +30,3 @@ "use strict";

var lifeCycle = new lifeCycle_1.LifeCycle();
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) { return (0, browser_core_1.sendToExtension)('rum', event); });
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) { return (0, browser_core_1.sendToExtension)('rum', event); });
var telemetry = startRumTelemetry(configuration);

@@ -51,3 +51,3 @@ telemetry.setContextProvider(function () {

var reportError = function (error) {
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error });
lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error });
};

@@ -58,3 +58,3 @@ var featureFlagContexts = (0, featureFlagContext_1.startFeatureFlagContexts)(lifeCycle);

pageExitObservable.subscribe(function (event) {
lifeCycle.notify(9 /* PAGE_EXITED */, event);
lifeCycle.notify(9 /* LifeCycleEventType.PAGE_EXITED */, event);
});

@@ -89,2 +89,3 @@ var batch = (0, startRumBatch_1.startRumBatch)(configuration, lifeCycle, telemetry.observable, reportError, pageExitObservable);

session: session,
stopSession: function () { return session.expire(); },
getInternalContext: internalContext.get,

@@ -95,3 +96,3 @@ };

function startRumTelemetry(configuration) {
var telemetry = (0, browser_core_1.startTelemetry)("browser-rum-sdk" /* RUM */, configuration);
var telemetry = (0, browser_core_1.startTelemetry)("browser-rum-sdk" /* TelemetryService.RUM */, configuration);
if ((0, browser_core_1.canUseEventBridge)()) {

@@ -98,0 +99,0 @@ var bridge_1 = (0, browser_core_1.getEventBridge)();

import { Observable } from '@datadog/browser-core';
export declare function createDOMMutationObservable(): Observable<void>;
declare type MutationObserverConstructor = new (callback: MutationCallback) => MutationObserver;
type MutationObserverConstructor = new (callback: MutationCallback) => MutationObserver;
export interface BrowserWindow extends Window {

@@ -5,0 +5,0 @@ MutationObserver?: MutationObserverConstructor;

@@ -36,3 +36,3 @@ "use strict";

}).stop;
var removeListener = (0, browser_core_1.addEventListener)(window, "popstate" /* POP_STATE */, onHistoryChange).stop;
var removeListener = (0, browser_core_1.addEventListener)(window, "popstate" /* DOM_EVENT.POP_STATE */, onHistoryChange).stop;
return {

@@ -47,4 +47,4 @@ stop: function () {

function trackHash(onHashChange) {
return (0, browser_core_1.addEventListener)(window, "hashchange" /* HASH_CHANGE */, onHashChange);
return (0, browser_core_1.addEventListener)(window, "hashchange" /* DOM_EVENT.HASH_CHANGE */, onHashChange);
}
//# sourceMappingURL=locationChangeObservable.js.map

@@ -60,8 +60,8 @@ import type { Duration, RelativeTime } from '@datadog/browser-core';

}
export declare type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumLayoutShiftTiming;
export type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumLayoutShiftTiming;
export declare function supportPerformanceTimingEvent(entryType: string): boolean;
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: RumConfiguration): void;
export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void;
export declare type RelativePerformanceTiming = {
export type RelativePerformanceTiming = {
-readonly [key in keyof Omit<PerformanceTiming, 'toJSON'>]: RelativeTime;
};

@@ -110,3 +110,3 @@ "use strict";

var timingSent = false;
var removeEventListeners = (0, browser_core_1.addEventListeners)(window, ["click" /* CLICK */, "mousedown" /* MOUSE_DOWN */, "keydown" /* KEY_DOWN */, "touchstart" /* TOUCH_START */, "pointerdown" /* POINTER_DOWN */], function (evt) {
var removeEventListeners = (0, browser_core_1.addEventListeners)(window, ["click" /* DOM_EVENT.CLICK */, "mousedown" /* DOM_EVENT.MOUSE_DOWN */, "keydown" /* DOM_EVENT.KEY_DOWN */, "touchstart" /* DOM_EVENT.TOUCH_START */, "pointerdown" /* DOM_EVENT.POINTER_DOWN */], function (evt) {
// Only count cancelable events, which should trigger behavior important to the user.

@@ -124,3 +124,3 @@ if (!evt.cancelable) {

};
if (evt.type === "pointerdown" /* POINTER_DOWN */) {
if (evt.type === "pointerdown" /* DOM_EVENT.POINTER_DOWN */) {
sendTimingIfPointerIsNotCancelled(timing);

@@ -139,4 +139,4 @@ }

function sendTimingIfPointerIsNotCancelled(timing) {
(0, browser_core_1.addEventListeners)(window, ["pointerup" /* POINTER_UP */, "pointercancel" /* POINTER_CANCEL */], function (event) {
if (event.type === "pointerup" /* POINTER_UP */) {
(0, browser_core_1.addEventListeners)(window, ["pointerup" /* DOM_EVENT.POINTER_UP */, "pointercancel" /* DOM_EVENT.POINTER_CANCEL */], function (event) {
if (event.type === "pointerup" /* DOM_EVENT.POINTER_UP */) {
sendTiming(timing);

@@ -186,3 +186,3 @@ }

if (rumAllowedPerformanceEntries.length) {
lifeCycle.notify(0 /* PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);
lifeCycle.notify(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);
}

@@ -189,0 +189,0 @@ }

@@ -18,3 +18,3 @@ "use strict";

}, 200).throttled;
return (0, browser_core_1.addEventListener)(window, "resize" /* RESIZE */, updateDimension, { capture: true, passive: true }).stop;
return (0, browser_core_1.addEventListener)(window, "resize" /* DOM_EVENT.RESIZE */, updateDimension, { capture: true, passive: true }).stop;
});

@@ -21,0 +21,0 @@ return observable;

@@ -25,8 +25,8 @@ "use strict";

var eventRateLimiters = (_a = {},
_a["error" /* ERROR */] = (0, browser_core_1.createEventRateLimiter)("error" /* ERROR */, configuration.eventRateLimiterThreshold, reportError),
_a["action" /* ACTION */] = (0, browser_core_1.createEventRateLimiter)("action" /* ACTION */, configuration.eventRateLimiterThreshold, reportError),
_a["error" /* RumEventType.ERROR */] = (0, browser_core_1.createEventRateLimiter)("error" /* RumEventType.ERROR */, configuration.eventRateLimiterThreshold, reportError),
_a["action" /* RumEventType.ACTION */] = (0, browser_core_1.createEventRateLimiter)("action" /* RumEventType.ACTION */, configuration.eventRateLimiterThreshold, reportError),
_a);
var syntheticsContext = (0, syntheticsContext_1.getSyntheticsContext)();
var ciTestContext = (0, ciTestContext_1.getCiTestContext)();
lifeCycle.subscribe(10 /* RAW_RUM_EVENT_COLLECTED */, function (_a) {
lifeCycle.subscribe(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, function (_a) {
var startTime = _a.startTime, rawRumEvent = _a.rawRumEvent, domainContext = _a.domainContext, savedCommonContext = _a.savedCommonContext, customerContext = _a.customerContext;

@@ -38,3 +38,3 @@ var viewContext = viewContexts.findView(startTime);

// TODO: stop sending view updates when session is expired
var session = sessionManager.findTrackedSession(rawRumEvent.type !== "view" /* VIEW */ ? startTime : undefined);
var session = sessionManager.findTrackedSession(rawRumEvent.type !== "view" /* RumEventType.VIEW */ ? startTime : undefined);
if (session && viewContext && urlContext) {

@@ -50,3 +50,3 @@ var commonContext = savedCommonContext || buildCommonContext();

},
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "4.36.0" : undefined,
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "4.37.0" : undefined,
},

@@ -62,3 +62,3 @@ application: {

id: session.id,
type: syntheticsContext ? "synthetics" /* SYNTHETICS */ : ciTestContext ? "ci_test" /* CI_TEST */ : "user" /* USER */,
type: syntheticsContext ? "synthetics" /* SessionType.SYNTHETICS */ : ciTestContext ? "ci_test" /* SessionType.CI_TEST */ : "user" /* SessionType.USER */,
},

@@ -90,3 +90,3 @@ view: {

}
lifeCycle.notify(11 /* RUM_EVENT_COLLECTED */, serverRumEvent);
lifeCycle.notify(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent);
}

@@ -100,4 +100,4 @@ }

if (beforeSend) {
var result = (0, browser_core_1.limitModification)(event, event.type === "view" /* VIEW */ ? VIEW_EVENTS_MODIFIABLE_FIELD_PATHS : OTHER_EVENTS_MODIFIABLE_FIELD_PATHS, function (event) { return beforeSend(event, domainContext); });
if (result === false && event.type !== "view" /* VIEW */) {
var result = (0, browser_core_1.limitModification)(event, event.type === "view" /* RumEventType.VIEW */ ? VIEW_EVENTS_MODIFIABLE_FIELD_PATHS : OTHER_EVENTS_MODIFIABLE_FIELD_PATHS, function (event) { return beforeSend(event, domainContext); });
if (result === false && event.type !== "view" /* RumEventType.VIEW */) {
return false;

@@ -113,4 +113,4 @@ }

function needToAssembleWithAction(event) {
return ["error" /* ERROR */, "resource" /* RESOURCE */, "long_task" /* LONG_TASK */].indexOf(event.type) !== -1;
return ["error" /* RumEventType.ERROR */, "resource" /* RumEventType.RESOURCE */, "long_task" /* RumEventType.LONG_TASK */].indexOf(event.type) !== -1;
}
//# sourceMappingURL=assembly.js.map

@@ -41,3 +41,3 @@ import type { Configuration, InitConfiguration, MatchOption, RawTelemetryConfiguration } from '@datadog/browser-core';

}
export declare type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>;
export type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>;
export interface RumConfiguration extends Configuration {

@@ -44,0 +44,0 @@ actionNameAttribute: string | undefined;

@@ -5,3 +5,3 @@ import type { RelativeTime, ContextValue, Context } from '@datadog/browser-core';

export declare const FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY: number;
export declare type FeatureFlagContext = Context;
export type FeatureFlagContext = Context;
export interface FeatureFlagContexts {

@@ -8,0 +8,0 @@ findFeatureFlagEvaluations: (startTime?: RelativeTime) => FeatureFlagContext | undefined;

@@ -25,7 +25,7 @@ "use strict";

var bytesCountCache;
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
featureFlagContexts.closeActive(endClocks.relative);
});
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (_a) {
var startClocks = _a.startClocks;

@@ -50,3 +50,3 @@ featureFlagContexts.add({}, startClocks.relative);

if (currentContext) {
currentContext[key] = (0, browser_core_1.deepClone)(value);
currentContext[key] = value;
bytesCountCache = undefined;

@@ -53,0 +53,0 @@ }

@@ -54,3 +54,3 @@ "use strict";

function trackFocus(onFocusChange) {
return (0, browser_core_1.addEventListener)(window, "focus" /* FOCUS */, function (event) {
return (0, browser_core_1.addEventListener)(window, "focus" /* DOM_EVENT.FOCUS */, function (event) {
if (!event.isTrusted) {

@@ -63,3 +63,3 @@ return;

function trackBlur(onBlurChange) {
return (0, browser_core_1.addEventListener)(window, "blur" /* BLUR */, function (event) {
return (0, browser_core_1.addEventListener)(window, "blur" /* DOM_EVENT.BLUR */, function (event) {
if (!event.isTrusted) {

@@ -66,0 +66,0 @@ return;

@@ -23,3 +23,3 @@ import type { ActionContexts } from '../rumEventsCollection/action/actionCollection';

export declare function startInternalContext(applicationId: string, sessionManager: RumSessionManager, viewContexts: ViewContexts, actionContexts: ActionContexts, urlContexts: UrlContexts): {
get: (startTime?: number | undefined) => InternalContext | undefined;
get: (startTime?: number) => InternalContext | undefined;
};

@@ -10,3 +10,3 @@ import type { Duration, RelativeTime } from '@datadog/browser-core';

}
export declare type PageStateEntry = {
export type PageStateEntry = {
state: PageState;

@@ -13,0 +13,0 @@ startTime: RelativeTime;

@@ -11,9 +11,9 @@ "use strict";

var stop = (0, browser_core_1.addEventListeners)(window, [
"pageshow" /* PAGE_SHOW */,
"focus" /* FOCUS */,
"blur" /* BLUR */,
"visibilitychange" /* VISIBILITY_CHANGE */,
"resume" /* RESUME */,
"freeze" /* FREEZE */,
"pagehide" /* PAGE_HIDE */,
"pageshow" /* DOM_EVENT.PAGE_SHOW */,
"focus" /* DOM_EVENT.FOCUS */,
"blur" /* DOM_EVENT.BLUR */,
"visibilitychange" /* DOM_EVENT.VISIBILITY_CHANGE */,
"resume" /* DOM_EVENT.RESUME */,
"freeze" /* DOM_EVENT.FREEZE */,
"pagehide" /* DOM_EVENT.PAGE_HIDE */,
], function (event) {

@@ -25,7 +25,7 @@ // Only get events fired by the browser to avoid false currentPageState changes done with custom events

}
if (event.type === "freeze" /* FREEZE */) {
addPageState("frozen" /* FROZEN */);
if (event.type === "freeze" /* DOM_EVENT.FREEZE */) {
addPageState("frozen" /* PageState.FROZEN */);
}
else if (event.type === "pagehide" /* PAGE_HIDE */) {
addPageState(event.persisted ? "frozen" /* FROZEN */ : "terminated" /* TERMINATED */);
else if (event.type === "pagehide" /* DOM_EVENT.PAGE_HIDE */) {
addPageState(event.persisted ? "frozen" /* PageState.FROZEN */ : "terminated" /* PageState.TERMINATED */);
}

@@ -58,8 +58,8 @@ else {

if (document.visibilityState === 'hidden') {
return "hidden" /* HIDDEN */;
return "hidden" /* PageState.HIDDEN */;
}
if (document.hasFocus()) {
return "active" /* ACTIVE */;
return "active" /* PageState.ACTIVE */;
}
return "passive" /* PASSIVE */;
return "passive" /* PageState.PASSIVE */;
}

@@ -66,0 +66,0 @@ function addPageState(nextPageState, maxPageStateEntries) {

@@ -19,4 +19,4 @@ import type { RelativeTime, Observable } from '@datadog/browser-core';

export declare function startUrlContexts(lifeCycle: LifeCycle, locationChangeObservable: Observable<LocationChange>, location: Location): {
findUrl: (startTime?: RelativeTime | undefined) => UrlContext | undefined;
findUrl: (startTime?: RelativeTime) => UrlContext | undefined;
stop: () => void;
};

@@ -14,7 +14,7 @@ "use strict";

var previousViewUrl;
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
urlContextHistory.closeActive(endClocks.relative);
});
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (_a) {
var startClocks = _a.startClocks;

@@ -21,0 +21,0 @@ var viewUrl = location.href;

@@ -8,10 +8,10 @@ "use strict";

var viewContextHistory = new browser_core_1.ContextHistory(exports.VIEW_CONTEXT_TIME_OUT_DELAY);
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (view) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (view) {
viewContextHistory.add(buildViewContext(view), view.startClocks.relative);
});
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
viewContextHistory.closeActive(endClocks.relative);
});
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
viewContextHistory.reset();

@@ -18,0 +18,0 @@ });

@@ -24,3 +24,3 @@ "use strict";

context.requestIndex = getNextRequestIndex();
lifeCycle.notify(5 /* REQUEST_STARTED */, {
lifeCycle.notify(5 /* LifeCycleEventType.REQUEST_STARTED */, {
requestIndex: context.requestIndex,

@@ -32,3 +32,3 @@ url: context.url,

tracer.clearTracingIfNeeded(context);
lifeCycle.notify(6 /* REQUEST_COMPLETED */, {
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_COMPLETED */, {
duration: context.duration,

@@ -42,3 +42,3 @@ method: context.method,

traceSampled: context.traceSampled,
type: "xhr" /* XHR */,
type: "xhr" /* RequestType.XHR */,
url: context.url,

@@ -63,3 +63,3 @@ xhr: context.xhr,

context.requestIndex = getNextRequestIndex();
lifeCycle.notify(5 /* REQUEST_STARTED */, {
lifeCycle.notify(5 /* LifeCycleEventType.REQUEST_STARTED */, {
requestIndex: context.requestIndex,

@@ -72,3 +72,3 @@ url: context.url,

tracer.clearTracingIfNeeded(context);
lifeCycle.notify(6 /* REQUEST_COMPLETED */, {
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_COMPLETED */, {
duration: duration,

@@ -83,3 +83,3 @@ method: context.method,

traceSampled: context.traceSampled,
type: "fetch" /* FETCH */,
type: "fetch" /* RequestType.FETCH */,
url: context.url,

@@ -86,0 +86,0 @@ response: context.response,

@@ -15,6 +15,6 @@ import type { ClocksState, Context, Observable } from '@datadog/browser-core';

}
export declare type AutoAction = ClickAction;
export type AutoAction = ClickAction;
export declare function startActionCollection(lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, foregroundContexts: ForegroundContexts): {
addAction: (action: CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addAction: (action: CustomAction, savedCommonContext?: CommonContext) => void;
actionContexts: ActionContexts;
};

@@ -7,4 +7,4 @@ "use strict";

function startActionCollection(lifeCycle, domMutationObservable, configuration, foregroundContexts) {
lifeCycle.subscribe(1 /* AUTO_ACTION_COMPLETED */, function (action) {
return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processAction(action, foregroundContexts));
lifeCycle.subscribe(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, function (action) {
return lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, foregroundContexts));
});

@@ -17,3 +17,3 @@ var actionContexts = { findActionId: browser_core_1.noop };

addAction: function (action, savedCommonContext) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, (0, browser_core_1.assign)({
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, (0, browser_core_1.assign)({
savedCommonContext: savedCommonContext,

@@ -63,3 +63,3 @@ }, processAction(action, foregroundContexts)));

date: action.startClocks.timeStamp,
type: "action" /* ACTION */,
type: "action" /* RumEventType.ACTION */,
}, autoActionProperties);

@@ -78,4 +78,4 @@ var inForeground = foregroundContexts.isInForegroundAt(action.startClocks.relative);

function isAutoAction(action) {
return action.type !== "custom" /* CUSTOM */;
return action.type !== "custom" /* ActionType.CUSTOM */;
}
//# sourceMappingURL=actionCollection.js.map

@@ -9,3 +9,3 @@ "use strict";

var bufferedClicks = [];
var status = 0 /* WaitingForMoreClicks */;
var status = 0 /* ClickChainStatus.WaitingForMoreClicks */;
var maxDurationBetweenClicksTimeout;

@@ -20,4 +20,4 @@ appendClick(firstClick);

function tryFinalize() {
if (status === 1 /* WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {
status = 2 /* Finalized */;
if (status === 1 /* ClickChainStatus.WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {
status = 2 /* ClickChainStatus.Finalized */;
onFinalize(bufferedClicks);

@@ -28,4 +28,4 @@ }

(0, browser_core_1.clearTimeout)(maxDurationBetweenClicksTimeout);
if (status === 0 /* WaitingForMoreClicks */) {
status = 1 /* WaitingForClicksToStop */;
if (status === 0 /* ClickChainStatus.WaitingForMoreClicks */) {
status = 1 /* ClickChainStatus.WaitingForClicksToStop */;
tryFinalize();

@@ -36,3 +36,3 @@ }

tryAppend: function (click) {
if (status !== 0 /* WaitingForMoreClicks */) {
if (status !== 0 /* ClickChainStatus.WaitingForMoreClicks */) {
return false;

@@ -39,0 +39,0 @@ }

@@ -8,8 +8,8 @@ "use strict";

if (isRage(clicks)) {
rageClick.addFrustration("rage_click" /* RAGE_CLICK */);
rageClick.addFrustration("rage_click" /* FrustrationType.RAGE_CLICK */);
if (clicks.some(isDead)) {
rageClick.addFrustration("dead_click" /* DEAD_CLICK */);
rageClick.addFrustration("dead_click" /* FrustrationType.DEAD_CLICK */);
}
if (rageClick.hasError) {
rageClick.addFrustration("error_click" /* ERROR_CLICK */);
rageClick.addFrustration("error_click" /* FrustrationType.ERROR_CLICK */);
}

@@ -21,3 +21,3 @@ return { isRage: true };

if (click.hasError) {
click.addFrustration("error_click" /* ERROR_CLICK */);
click.addFrustration("error_click" /* FrustrationType.ERROR_CLICK */);
}

@@ -27,3 +27,3 @@ if (isDead(click) &&

!hasSelectionChanged) {
click.addFrustration("dead_click" /* DEAD_CLICK */);
click.addFrustration("dead_click" /* FrustrationType.DEAD_CLICK */);
}

@@ -30,0 +30,0 @@ });

@@ -1,2 +0,2 @@

export declare type MouseEventOnElement = PointerEvent & {
export type MouseEventOnElement = PointerEvent & {
target: Element;

@@ -3,0 +3,0 @@ };

@@ -14,3 +14,3 @@ "use strict";

var listeners = [
(0, browser_core_1.addEventListener)(window, "pointerdown" /* POINTER_DOWN */, function (event) {
(0, browser_core_1.addEventListener)(window, "pointerdown" /* DOM_EVENT.POINTER_DOWN */, function (event) {
if (isValidPointerEvent(event)) {

@@ -25,3 +25,3 @@ selectionEmptyAtPointerDown = isSelectionEmpty();

}, { capture: true }),
(0, browser_core_1.addEventListener)(window, "selectionchange" /* SELECTION_CHANGE */, function () {
(0, browser_core_1.addEventListener)(window, "selectionchange" /* DOM_EVENT.SELECTION_CHANGE */, function () {
if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {

@@ -31,3 +31,3 @@ userActivity.selection = true;

}, { capture: true }),
(0, browser_core_1.addEventListener)(window, "pointerup" /* POINTER_UP */, function (event) {
(0, browser_core_1.addEventListener)(window, "pointerup" /* DOM_EVENT.POINTER_UP */, function (event) {
if (isValidPointerEvent(event) && clickContext) {

@@ -40,3 +40,3 @@ // Use a scoped variable to make sure the value is not changed by other clicks

}, { capture: true }),
(0, browser_core_1.addEventListener)(window, "input" /* INPUT */, function () {
(0, browser_core_1.addEventListener)(window, "input" /* DOM_EVENT.INPUT */, function () {
userActivity.input = true;

@@ -43,0 +43,0 @@ }, { capture: true }),

@@ -37,3 +37,3 @@ import type { Duration, ClocksState, RelativeTime, TimeStamp } from '@datadog/browser-core';

}
declare type ClickActionIdHistory = ContextHistory<ClickAction['id']>;
type ClickActionIdHistory = ContextHistory<ClickAction['id']>;
export declare const CLICK_ACTION_MAX_DURATION: number;

@@ -45,7 +45,7 @@ export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;

};
declare type ClickActionBase = Pick<ClickAction, 'type' | 'name' | 'target' | 'position'>;
export declare type Click = ReturnType<typeof newClick>;
type ClickActionBase = Pick<ClickAction, 'type' | 'name' | 'target' | 'position'>;
export type Click = ReturnType<typeof newClick>;
declare function newClick(lifeCycle: LifeCycle, history: ClickActionIdHistory, getUserActivity: () => UserActivity, clickActionBase: ClickActionBase, startEvent: MouseEventOnElement): {
event: MouseEventOnElement;
stop: (newActivityEndTime?: TimeStamp | undefined) => void;
stop: (newActivityEndTime?: TimeStamp) => void;
stopObservable: Observable<void>;

@@ -62,3 +62,3 @@ readonly hasError: boolean;

clone: () => any;
validate: (domEvents?: Event[] | undefined) => void;
validate: (domEvents?: Event[]) => void;
discard: () => void;

@@ -65,0 +65,0 @@ };

@@ -19,6 +19,6 @@ "use strict";

var currentClickChain;
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
history.reset();
});
lifeCycle.subscribe(4 /* VIEW_ENDED */, stopClickChain);
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain);
var stopActionEventsListener = (0, listenActionEvents_1.listenActionEvents)({

@@ -119,3 +119,3 @@ onPointerDown: function (pointerDownEvent) {

}, exports.CLICK_ACTION_MAX_DURATION).stop;
var viewEndedSubscription = lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
var viewEndedSubscription = lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;

@@ -150,3 +150,3 @@ click.stop(endClocks.timeStamp);

return {
type: "click" /* CLICK */,
type: "click" /* ActionType.CLICK */,
target: target,

@@ -168,3 +168,3 @@ position: position,

});
var status = 0 /* ONGOING */;
var status = 0 /* ClickStatus.ONGOING */;
var activityEndTime;

@@ -174,7 +174,7 @@ var frustrationTypes = [];

function stop(newActivityEndTime) {
if (status !== 0 /* ONGOING */) {
if (status !== 0 /* ClickStatus.ONGOING */) {
return;
}
activityEndTime = newActivityEndTime;
status = 1 /* STOPPED */;
status = 1 /* ClickStatus.STOPPED */;
if (activityEndTime) {

@@ -204,7 +204,7 @@ historyEntry.close((0, browser_core_1.getRelativeTime)(activityEndTime));

startClocks: startClocks,
isStopped: function () { return status === 1 /* STOPPED */ || status === 2 /* FINALIZED */; },
isStopped: function () { return status === 1 /* ClickStatus.STOPPED */ || status === 2 /* ClickStatus.FINALIZED */; },
clone: function () { return newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent); },
validate: function (domEvents) {
stop();
if (status !== 1 /* STOPPED */) {
if (status !== 1 /* ClickStatus.STOPPED */) {
return;

@@ -214,3 +214,3 @@ }

var clickAction = (0, browser_core_1.assign)({
type: "click" /* CLICK */,
type: "click" /* ActionType.CLICK */,
duration: activityEndTime && (0, browser_core_1.elapsed)(startClocks.timeStamp, activityEndTime),

@@ -228,8 +228,8 @@ startClocks: startClocks,

}, clickActionBase);
lifeCycle.notify(1 /* AUTO_ACTION_COMPLETED */, clickAction);
status = 2 /* FINALIZED */;
lifeCycle.notify(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, clickAction);
status = 2 /* ClickStatus.FINALIZED */;
},
discard: function () {
stop();
status = 2 /* FINALIZED */;
status = 2 /* ClickStatus.FINALIZED */;
},

@@ -236,0 +236,0 @@ };

@@ -16,3 +16,3 @@ import type { Context, ClocksState } from '@datadog/browser-core';

export declare function doStartErrorCollection(lifeCycle: LifeCycle, foregroundContexts: ForegroundContexts, featureFlagContexts: FeatureFlagContexts): {
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext) => void;
};

@@ -12,3 +12,3 @@ "use strict";

(0, trackReportError_1.trackReportError)(errorObservable);
errorObservable.subscribe(function (error) { return lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error }); });
errorObservable.subscribe(function (error) { return lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error }); });
return doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts);

@@ -18,5 +18,5 @@ }

function doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts) {
lifeCycle.subscribe(12 /* RAW_ERROR_COLLECTED */, function (_a) {
lifeCycle.subscribe(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, function (_a) {
var error = _a.error, customerContext = _a.customerContext, savedCommonContext = _a.savedCommonContext;
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, (0, browser_core_1.assign)({
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, (0, browser_core_1.assign)({
customerContext: customerContext,

@@ -37,5 +37,5 @@ savedCommonContext: savedCommonContext,

source: browser_core_1.ErrorSource.CUSTOM,
handling: "handled" /* HANDLED */,
handling: "handled" /* ErrorHandling.HANDLED */,
});
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, {
lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, {
customerContext: customerContext,

@@ -63,3 +63,3 @@ savedCommonContext: savedCommonContext,

},
type: "error" /* ERROR */,
type: "error" /* RumEventType.ERROR */,
};

@@ -66,0 +66,0 @@ var inForeground = foregroundContexts.isInForegroundAt(error.startClocks.relative);

@@ -12,3 +12,3 @@ "use strict";

source: browser_core_1.ErrorSource.CONSOLE,
handling: "handled" /* HANDLED */,
handling: "handled" /* ErrorHandling.HANDLED */,
handlingStack: consoleError.handlingStack,

@@ -15,0 +15,0 @@ });

@@ -13,3 +13,3 @@ "use strict";

source: browser_core_1.ErrorSource.REPORT,
handling: "unhandled" /* UNHANDLED */,
handling: "unhandled" /* ErrorHandling.UNHANDLED */,
});

@@ -16,0 +16,0 @@ });

@@ -6,3 +6,3 @@ "use strict";

function startLongTaskCollection(lifeCycle, sessionManager) {
lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -24,3 +24,3 @@ var entry = entries_1[_i];

},
type: "long_task" /* LONG_TASK */,
type: "long_task" /* RumEventType.LONG_TASK */,
_dd: {

@@ -30,3 +30,3 @@ discarded: false,

};
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, {
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, {
rawRumEvent: rawRumEvent,

@@ -33,0 +33,0 @@ startTime: startClocks.relative,

@@ -8,10 +8,10 @@ "use strict";

function startResourceCollection(lifeCycle, configuration, sessionManager, pageStateHistory) {
lifeCycle.subscribe(6 /* REQUEST_COMPLETED */, function (request) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processRequest(request, configuration, sessionManager, pageStateHistory));
lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processRequest(request, configuration, sessionManager, pageStateHistory));
});
lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'resource' && !(0, resourceUtils_1.isRequestKind)(entry)) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processResourceEntry(entry, configuration, sessionManager, pageStateHistory));
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processResourceEntry(entry, configuration, sessionManager, pageStateHistory));
}

@@ -24,3 +24,3 @@ }

var _a;
var type = request.type === "xhr" /* XHR */ ? "xhr" /* XHR */ : "fetch" /* FETCH */;
var type = request.type === "xhr" /* RequestType.XHR */ ? "xhr" /* ResourceType.XHR */ : "fetch" /* ResourceType.FETCH */;
var matchingTiming = (0, matchRequestTiming_1.matchRequestTiming)(request);

@@ -44,3 +44,3 @@ var startClocks = matchingTiming ? (0, browser_core_1.relativeToClocks)(matchingTiming.startTime) : request.startClocks;

},
type: "resource" /* RESOURCE */,
type: "resource" /* RumEventType.RESOURCE */,
}, tracingInfo, correspondingTimingOverrides, indexingInfo, durationOverrideInfo, pageStateInfo);

@@ -74,3 +74,3 @@ return {

},
type: "resource" /* RESOURCE */,
type: "resource" /* RumEventType.RESOURCE */,
}, tracingInfo, entryMetrics, indexingInfo, pageStateInfo);

@@ -77,0 +77,0 @@ return {

@@ -7,10 +7,10 @@ "use strict";

var RESOURCE_TYPES = [
["document" /* DOCUMENT */, function (initiatorType) { return exports.FAKE_INITIAL_DOCUMENT === initiatorType; }],
["xhr" /* XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
["fetch" /* FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],
["beacon" /* BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],
["css" /* CSS */, function (_, path) { return /\.css$/i.test(path); }],
["js" /* JS */, function (_, path) { return /\.js$/i.test(path); }],
["document" /* ResourceType.DOCUMENT */, function (initiatorType) { return exports.FAKE_INITIAL_DOCUMENT === initiatorType; }],
["xhr" /* ResourceType.XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
["fetch" /* ResourceType.FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],
["beacon" /* ResourceType.BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],
["css" /* ResourceType.CSS */, function (_, path) { return /\.css$/i.test(path); }],
["js" /* ResourceType.JS */, function (_, path) { return /\.js$/i.test(path); }],
[
"image" /* IMAGE */,
"image" /* ResourceType.IMAGE */,
function (initiatorType, path) {

@@ -20,5 +20,5 @@ return (0, browser_core_1.includes)(['image', 'img', 'icon'], initiatorType) || /\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(path) !== null;

],
["font" /* FONT */, function (_, path) { return /\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],
["font" /* ResourceType.FONT */, function (_, path) { return /\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],
[
"media" /* MEDIA */,
"media" /* ResourceType.MEDIA */,
function (initiatorType, path) {

@@ -33,3 +33,3 @@ return (0, browser_core_1.includes)(['audio', 'video'], initiatorType) || /\.(mp3|mp4)$/i.exec(path) !== null;

(0, browser_core_1.addTelemetryDebug)("Failed to construct URL for \"".concat(timing.name, "\""));
return "other" /* OTHER */;
return "other" /* ResourceType.OTHER */;
}

@@ -43,3 +43,3 @@ var path = (0, browser_core_1.getPathName)(url);

}
return "other" /* OTHER */;
return "other" /* ResourceType.OTHER */;
}

@@ -46,0 +46,0 @@ exports.computeResourceKind = computeResourceKind;

@@ -19,3 +19,3 @@ "use strict";

};
(stopListeners = (0, browser_core_1.addEventListeners)(eventTarget, ["pagehide" /* PAGE_HIDE */, "visibilitychange" /* VISIBILITY_CHANGE */], function (event) {
(stopListeners = (0, browser_core_1.addEventListeners)(eventTarget, ["pagehide" /* DOM_EVENT.PAGE_HIDE */, "visibilitychange" /* DOM_EVENT.VISIBILITY_CHANGE */], function (event) {
if (event.type === 'pagehide' || document.visibilityState === 'hidden') {

@@ -22,0 +22,0 @@ trackFirstHiddenSingleton.timeStamp = event.timeStamp;

@@ -42,3 +42,3 @@ "use strict";

function trackNavigationTimings(lifeCycle, callback) {
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -66,3 +66,3 @@ var entry = entries_1[_i];

var firstHidden = (0, trackFirstHidden_1.trackFirstHidden)();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var fcpEntry = (0, browser_core_1.find)(entries, function (entry) {

@@ -93,6 +93,6 @@ return entry.entryType === 'paint' &&

var firstInteractionTimestamp = Infinity;
var stopEventListener = (0, browser_core_1.addEventListeners)(eventTarget, ["pointerdown" /* POINTER_DOWN */, "keydown" /* KEY_DOWN */], function (event) {
var stopEventListener = (0, browser_core_1.addEventListeners)(eventTarget, ["pointerdown" /* DOM_EVENT.POINTER_DOWN */, "keydown" /* DOM_EVENT.KEY_DOWN */], function (event) {
firstInteractionTimestamp = event.timeStamp;
}, { capture: true, once: true }).stop;
var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var lcpEntry = (0, browser_core_1.findLast)(entries, function (entry) {

@@ -126,3 +126,3 @@ return entry.entryType === 'largest-contentful-paint' &&

var firstHidden = (0, trackFirstHidden_1.trackFirstHidden)();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var firstInputEntry = (0, browser_core_1.find)(entries, function (entry) {

@@ -129,0 +129,0 @@ return entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp;

@@ -35,3 +35,3 @@ "use strict";

function trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadType, viewStart, callback) {
var isWaitingForLoadEvent = loadType === "initial_load" /* INITIAL_LOAD */;
var isWaitingForLoadEvent = loadType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */;
var isWaitingForActivityLoadingTime = true;

@@ -84,3 +84,3 @@ var loadingTimeCandidates = [];

var window = slidingSessionWindow();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -87,0 +87,0 @@ var entry = entries_1[_i];

@@ -45,4 +45,4 @@ import type { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';

addTiming: (name: string, time?: RelativeTime | TimeStamp) => void;
startView: (options?: ViewOptions | undefined, startClocks?: ClocksState | undefined) => void;
startView: (options?: ViewOptions, startClocks?: ClocksState) => void;
stop: () => void;
};

@@ -19,3 +19,3 @@ "use strict";

function trackInitialView(options) {
var initialView = newView(lifeCycle, domMutationObservable, configuration, location, "initial_load" /* INITIAL_LOAD */, (0, browser_core_1.clocksOrigin)(), options);
var initialView = newView(lifeCycle, domMutationObservable, configuration, location, "initial_load" /* ViewLoadingType.INITIAL_LOAD */, (0, browser_core_1.clocksOrigin)(), options);
var stop = (0, trackInitialViewTimings_1.trackInitialViewTimings)(lifeCycle, function (timings) {

@@ -28,6 +28,6 @@ initialView.updateTimings(timings);

function trackViewChange(startClocks, viewOptions) {
return newView(lifeCycle, domMutationObservable, configuration, location, "route_change" /* ROUTE_CHANGE */, startClocks, viewOptions);
return newView(lifeCycle, domMutationObservable, configuration, location, "route_change" /* ViewLoadingType.ROUTE_CHANGE */, startClocks, viewOptions);
}
function startViewLifeCycle() {
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
// do not trigger view update to avoid wrong data

@@ -43,3 +43,3 @@ currentView.end();

// End the current view on page unload
lifeCycle.subscribe(9 /* PAGE_EXITED */, function (pageExitEvent) {
lifeCycle.subscribe(9 /* LifeCycleEventType.PAGE_EXITED */, function (pageExitEvent) {
if (pageExitEvent.reason === browser_core_1.PageExitReason.UNLOADING || pageExitEvent.reason === browser_core_1.PageExitReason.PAGEHIDE) {

@@ -51,8 +51,8 @@ currentView.end();

// Session keep alive
var keepAliveInterval = window.setInterval((0, browser_core_1.monitor)(function () {
var keepAliveInterval = (0, browser_core_1.setInterval)(function () {
currentView.triggerUpdate();
}), exports.SESSION_KEEP_ALIVE_INTERVAL);
}, exports.SESSION_KEEP_ALIVE_INTERVAL);
return {
stop: function () {
clearInterval(keepAliveInterval);
(0, browser_core_1.clearInterval)(keepAliveInterval);
},

@@ -109,3 +109,3 @@ };

}
lifeCycle.notify(2 /* VIEW_CREATED */, {
lifeCycle.notify(2 /* LifeCycleEventType.VIEW_CREATED */, {
id: id,

@@ -128,3 +128,3 @@ name: name,

var currentEnd = endClocks === undefined ? (0, browser_core_1.timeStampNow)() : endClocks.timeStamp;
lifeCycle.notify(3 /* VIEW_UPDATED */, (0, browser_core_1.assign)({
lifeCycle.notify(3 /* LifeCycleEventType.VIEW_UPDATED */, (0, browser_core_1.assign)({
customTimings: customTimings,

@@ -153,3 +153,3 @@ documentVersion: documentVersion,

endClocks = clocks;
lifeCycle.notify(4 /* VIEW_ENDED */, { endClocks: endClocks });
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_ENDED */, { endClocks: endClocks });
stopViewMetricsTracking();

@@ -156,0 +156,0 @@ scheduleStopEventCountsTracking();

@@ -7,4 +7,4 @@ "use strict";

function startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, featureFlagContexts, recorderApi, initialViewOptions) {
lifeCycle.subscribe(3 /* VIEW_UPDATED */, function (view) {
return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi));
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, function (view) {
return lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi));
});

@@ -23,3 +23,3 @@ return (0, trackViews_1.trackViews)(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions);

date: view.startClocks.timeStamp,
type: "view" /* VIEW */,
type: "view" /* RumEventType.VIEW */,
view: {

@@ -26,0 +26,0 @@ action: {

@@ -7,4 +7,5 @@ import type { RelativeTime } from '@datadog/browser-core';

findTrackedSession: (startTime?: RelativeTime) => RumSession | undefined;
expire: () => void;
}
export declare type RumSession = {
export type RumSession = {
id: string;

@@ -11,0 +12,0 @@ plan: RumSessionPlan;

@@ -11,6 +11,6 @@ "use strict";

sessionManager.expireObservable.subscribe(function () {
lifeCycle.notify(7 /* SESSION_EXPIRED */);
lifeCycle.notify(7 /* LifeCycleEventType.SESSION_EXPIRED */);
});
sessionManager.renewObservable.subscribe(function () {
lifeCycle.notify(8 /* SESSION_RENEWED */);
lifeCycle.notify(8 /* LifeCycleEventType.SESSION_RENEWED */);
});

@@ -23,17 +23,18 @@ return {

}
var plan = session.trackingType === "1" /* TRACKED_WITH_SESSION_REPLAY */
? 2 /* WITH_SESSION_REPLAY */
: 1 /* WITHOUT_SESSION_REPLAY */;
var plan = session.trackingType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */
? 2 /* RumSessionPlan.WITH_SESSION_REPLAY */
: 1 /* RumSessionPlan.WITHOUT_SESSION_REPLAY */;
return {
id: session.id,
plan: plan,
sessionReplayAllowed: plan === 2 /* WITH_SESSION_REPLAY */,
sessionReplayAllowed: plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
longTaskAllowed: configuration.trackLongTasks !== undefined
? configuration.trackLongTasks
: configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,
: configuration.oldPlansBehavior && plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
resourceAllowed: configuration.trackResources !== undefined
? configuration.trackResources
: configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,
: configuration.oldPlansBehavior && plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
};
},
expire: sessionManager.expire,
};

@@ -48,3 +49,3 @@ }

id: '00000000-aaaa-0000-aaaa-000000000000',
plan: 1 /* WITHOUT_SESSION_REPLAY */,
plan: 1 /* RumSessionPlan.WITHOUT_SESSION_REPLAY */,
sessionReplayAllowed: false,

@@ -56,2 +57,3 @@ longTaskAllowed: true,

findTrackedSession: function () { return session; },
expire: browser_core_1.noop,
};

@@ -66,9 +68,9 @@ }

else if (!(0, browser_core_1.performDraw)(configuration.sessionSampleRate)) {
trackingType = "0" /* NOT_TRACKED */;
trackingType = "0" /* RumTrackingType.NOT_TRACKED */;
}
else if (!(0, browser_core_1.performDraw)(configuration.sessionReplaySampleRate)) {
trackingType = "2" /* TRACKED_WITHOUT_SESSION_REPLAY */;
trackingType = "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */;
}
else {
trackingType = "1" /* TRACKED_WITH_SESSION_REPLAY */;
trackingType = "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */;
}

@@ -81,10 +83,10 @@ return {

function hasValidRumSession(trackingType) {
return (trackingType === "0" /* NOT_TRACKED */ ||
trackingType === "1" /* TRACKED_WITH_SESSION_REPLAY */ ||
trackingType === "2" /* TRACKED_WITHOUT_SESSION_REPLAY */);
return (trackingType === "0" /* RumTrackingType.NOT_TRACKED */ ||
trackingType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */ ||
trackingType === "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */);
}
function isTypeTracked(rumSessionType) {
return (rumSessionType === "2" /* TRACKED_WITHOUT_SESSION_REPLAY */ ||
rumSessionType === "1" /* TRACKED_WITH_SESSION_REPLAY */);
return (rumSessionType === "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */ ||
rumSessionType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */);
}
//# sourceMappingURL=rumSessionManager.js.map

@@ -18,3 +18,3 @@ "use strict";

// It means that contexts bytes count sums can be higher than it really is
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {
batchHasRumEvent = true;

@@ -24,3 +24,3 @@ updateMeasure(currentBatchMeasures.globalContextBytes, !(0, browser_core_1.isEmptyObject)(globalContextManager.get()) ? globalContextManager.getBytesCount() : 0);

var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations();
var hasFeatureFlagContext = (0, browser_core_1.includes)(["view" /* VIEW */, "error" /* ERROR */], event.type) &&
var hasFeatureFlagContext = (0, browser_core_1.includes)(["view" /* RumEventType.VIEW */, "error" /* RumEventType.ERROR */], event.type) &&
featureFlagContext &&

@@ -45,3 +45,3 @@ !(0, browser_core_1.isEmptyObject)(featureFlagContext);

});
setInterval((0, browser_core_1.monitor)(sendCurrentPeriodMeasures), exports.MEASURES_PERIOD_DURATION);
(0, browser_core_1.setInterval)(sendCurrentPeriodMeasures, exports.MEASURES_PERIOD_DURATION);
}

@@ -48,0 +48,0 @@ exports.startCustomerDataTelemetry = startCustomerDataTelemetry;

@@ -8,6 +8,6 @@ import type { MatchOption } from '@datadog/browser-core';

*/
export declare type PropagatorType = 'datadog' | 'b3' | 'b3multi' | 'tracecontext';
export declare type TracingOption = {
export type PropagatorType = 'datadog' | 'b3' | 'b3multi' | 'tracecontext';
export type TracingOption = {
match: MatchOption;
propagatorTypes: PropagatorType[];
};

@@ -14,3 +14,3 @@ "use strict";

};
var subscription = lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) {
var subscription = lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {
if (event.type === 'view' || !isChildEvent(event)) {

@@ -20,7 +20,7 @@ return;

switch (event.type) {
case "error" /* ERROR */:
case "error" /* RumEventType.ERROR */:
eventCounts.errorCount += 1;
callback();
break;
case "action" /* ACTION */:
case "action" /* RumEventType.ACTION */:
eventCounts.actionCount += 1;

@@ -32,7 +32,7 @@ if (event.action.frustration) {

break;
case "long_task" /* LONG_TASK */:
case "long_task" /* RumEventType.LONG_TASK */:
eventCounts.longTaskCount += 1;
callback();
break;
case "resource" /* RESOURCE */:
case "resource" /* RumEventType.RESOURCE */:
eventCounts.resourceCount += 1;

@@ -39,0 +39,0 @@ callback();

@@ -10,3 +10,3 @@ import type { TimeStamp } from '@datadog/browser-core';

}
export declare type PageActivityEndEvent = {
export type PageActivityEndEvent = {
hadActivity: true;

@@ -13,0 +13,0 @@ end: TimeStamp;

@@ -81,7 +81,7 @@ "use strict";

var pendingRequestsCount = 0;
subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
if (entries.some(function (entry) { return entry.entryType === 'resource' && !isExcludedUrl(configuration, entry.name); })) {
notifyPageActivity();
}
}), lifeCycle.subscribe(5 /* REQUEST_STARTED */, function (startEvent) {
}), lifeCycle.subscribe(5 /* LifeCycleEventType.REQUEST_STARTED */, function (startEvent) {
if (isExcludedUrl(configuration, startEvent.url)) {

@@ -95,3 +95,3 @@ return;

notifyPageActivity();
}), lifeCycle.subscribe(6 /* REQUEST_COMPLETED */, function (request) {
}), lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {
if (isExcludedUrl(configuration, request.url) ||

@@ -98,0 +98,0 @@ firstRequestIndex === undefined ||

@@ -5,3 +5,3 @@ /**

import type { RumEventType } from './rawRumEvent.types';
export declare type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;
export type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;
export interface RumViewEventDomainContext {

@@ -42,2 +42,2 @@ location: Readonly<Location>;

*/
export declare type PerformanceEntryRepresentation = Omit<PerformanceEntry, 'toJSON'>;
export type PerformanceEntryRepresentation = Omit<PerformanceEntry, 'toJSON'>;

@@ -172,3 +172,3 @@ import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause } from '@datadog/browser-core';

}
export declare type RawRumEvent = RawRumErrorEvent | RawRumResourceEvent | RawRumViewEvent | RawRumLongTaskEvent | RawRumActionEvent;
export type RawRumEvent = RawRumErrorEvent | RawRumResourceEvent | RawRumViewEvent | RawRumLongTaskEvent | RawRumActionEvent;
export interface RumContext {

@@ -175,0 +175,0 @@ date: TimeStamp;

@@ -7,7 +7,7 @@ /**

*/
export declare type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent;
export type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent;
/**
* Schema of all properties of an Action event
*/
export declare type RumActionEvent = CommonProperties & {
export type RumActionEvent = CommonProperties & {
/**

@@ -154,3 +154,3 @@ * RUM event type

*/
export declare type RumErrorEvent = CommonProperties & ActionChildProperties & {
export type RumErrorEvent = CommonProperties & ActionChildProperties & {
/**

@@ -281,3 +281,3 @@ * RUM event type

*/
export declare type RumLongTaskEvent = CommonProperties & ActionChildProperties & {
export type RumLongTaskEvent = CommonProperties & ActionChildProperties & {
/**

@@ -320,3 +320,3 @@ * RUM event type

*/
export declare type RumResourceEvent = CommonProperties & ActionChildProperties & {
export type RumResourceEvent = CommonProperties & ActionChildProperties & {
/**

@@ -489,3 +489,3 @@ * RUM event type

*/
export declare type RumViewEvent = CommonProperties & {
export type RumViewEvent = CommonProperties & {
/**

@@ -492,0 +492,0 @@ * RUM event type

@@ -7,4 +7,4 @@ "use strict";

var batch = makeRumBatch(configuration, reportError, pageExitObservable);
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {
if (serverRumEvent.type === "view" /* VIEW */) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {
if (serverRumEvent.type === "view" /* RumEventType.VIEW */) {
batch.upsert(serverRumEvent, serverRumEvent.view.id);

@@ -11,0 +11,0 @@ }

@@ -7,3 +7,3 @@ "use strict";

var bridge = (0, browser_core_1.getEventBridge)();
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {
bridge.send('rum', serverRumEvent);

@@ -10,0 +10,0 @@ });

@@ -9,4 +9,4 @@ import type { Context, InitConfiguration, User } from '@datadog/browser-core';

import type { startRum } from './startRum';
export declare type RumPublicApi = ReturnType<typeof makeRumPublicApi>;
export declare type StartRum = typeof startRum;
export type RumPublicApi = ReturnType<typeof makeRumPublicApi>;
export type StartRum = typeof startRum;
export interface RecorderApi {

@@ -37,7 +37,7 @@ start: () => void;

clearGlobalContext: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInitConfiguration: () => InitConfiguration | undefined;
addAction: (name: string, context?: object | undefined) => void;
addError: (error: unknown, context?: object | undefined) => void;
addTiming: (name: string, time?: number | undefined) => void;
addAction: (name: string, context?: object) => void;
addError: (error: unknown, context?: object) => void;
addTiming: (name: string, time?: number) => void;
setUser: (newUser: User) => void;

@@ -51,5 +51,6 @@ getUser: () => Context;

startView: {
(name?: string | undefined): void;
(name?: string): void;
(options: ViewOptions): void;
};
stopSession: () => void;
startSessionReplayRecording: () => void;

@@ -56,0 +57,0 @@ stopSessionReplayRecording: () => void;

@@ -1,2 +0,2 @@

import { willSyntheticsInjectRum, assign, BoundedBuffer, buildCookieOptions, createContextManager, deepClone, makePublicApi, monitor, clocksNow, timeStampNow, display, callMonitored, createHandlingStack, canUseEventBridge, areCookiesAuthorized, checkUser, sanitizeUser, } from '@datadog/browser-core';
import { noop, isExperimentalFeatureEnabled, willSyntheticsInjectRum, assign, BoundedBuffer, buildCookieOptions, createContextManager, deepClone, makePublicApi, monitor, clocksNow, timeStampNow, display, callMonitored, createHandlingStack, canUseEventBridge, areCookiesAuthorized, checkUser, sanitizeUser, sanitize, } from '@datadog/browser-core';
import { validateAndBuildRumConfiguration } from '../domain/configuration';

@@ -11,2 +11,3 @@ import { buildCommonContext } from '../domain/contexts/commonContext';

var getInitConfigurationStrategy = function () { return undefined; };
var stopSessionStrategy = noop;
var bufferApiCalls = new BoundedBuffer();

@@ -73,3 +74,3 @@ var addTimingStrategy = function (name, time) {

var startRumResults = startRumImpl(initConfiguration, configuration, recorderApi, globalContextManager, userContextManager, initialViewOptions);
(startViewStrategy = startRumResults.startView, addActionStrategy = startRumResults.addAction, addErrorStrategy = startRumResults.addError, addTimingStrategy = startRumResults.addTiming, addFeatureFlagEvaluationStrategy = startRumResults.addFeatureFlagEvaluation, getInternalContextStrategy = startRumResults.getInternalContext);
(startViewStrategy = startRumResults.startView, addActionStrategy = startRumResults.addAction, addErrorStrategy = startRumResults.addError, addTimingStrategy = startRumResults.addTiming, addFeatureFlagEvaluationStrategy = startRumResults.addFeatureFlagEvaluation, getInternalContextStrategy = startRumResults.getInternalContext, stopSessionStrategy = startRumResults.stopSession);
bufferApiCalls.drain();

@@ -101,6 +102,6 @@ recorderApi.onRumStart(startRumResults.lifeCycle, configuration, startRumResults.session, startRumResults.viewContexts);

addActionStrategy({
name: name,
context: deepClone(context),
name: isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(name) : name,
context: (isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(context) : deepClone(context)),
startClocks: clocksNow(),
type: "custom" /* CUSTOM */,
type: "custom" /* ActionType.CUSTOM */,
});

@@ -114,3 +115,5 @@ }),

handlingStack: handlingStack,
context: deepClone(context),
context: (isExperimentalFeatureEnabled('sanitize_inputs')
? sanitize(context)
: deepClone(context)),
startClocks: clocksNow(),

@@ -121,3 +124,3 @@ });

addTiming: monitor(function (name, time) {
addTimingStrategy(name, time);
addTimingStrategy(isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(name) : name, time);
}),

@@ -140,2 +143,5 @@ setUser: monitor(function (newUser) {

startView: startView,
stopSession: monitor(function () {
stopSessionStrategy();
}),
startSessionReplayRecording: monitor(recorderApi.start),

@@ -147,3 +153,3 @@ stopSessionReplayRecording: monitor(recorderApi.stop),

addFeatureFlagEvaluation: monitor(function (key, value) {
addFeatureFlagEvaluationStrategy(key, value);
addFeatureFlagEvaluationStrategy(isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(key) : key, isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(value) : value);
}),

@@ -150,0 +156,0 @@ });

@@ -18,2 +18,3 @@ import type { Observable, RawError, ContextManager } from '@datadog/browser-core';

session: RumSessionManager;
stopSession: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;

@@ -20,0 +21,0 @@ };

@@ -27,3 +27,3 @@ import { sendToExtension, createPageExitObservable, addTelemetryConfiguration, startTelemetry, canUseEventBridge, getEventBridge, } from '@datadog/browser-core';

var lifeCycle = new LifeCycle();
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) { return sendToExtension('rum', event); });
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) { return sendToExtension('rum', event); });
var telemetry = startRumTelemetry(configuration);

@@ -48,3 +48,3 @@ telemetry.setContextProvider(function () {

var reportError = function (error) {
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error });
lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error });
};

@@ -55,3 +55,3 @@ var featureFlagContexts = startFeatureFlagContexts(lifeCycle);

pageExitObservable.subscribe(function (event) {
lifeCycle.notify(9 /* PAGE_EXITED */, event);
lifeCycle.notify(9 /* LifeCycleEventType.PAGE_EXITED */, event);
});

@@ -86,2 +86,3 @@ var batch = startRumBatch(configuration, lifeCycle, telemetry.observable, reportError, pageExitObservable);

session: session,
stopSession: function () { return session.expire(); },
getInternalContext: internalContext.get,

@@ -91,3 +92,3 @@ };

function startRumTelemetry(configuration) {
var telemetry = startTelemetry("browser-rum-sdk" /* RUM */, configuration);
var telemetry = startTelemetry("browser-rum-sdk" /* TelemetryService.RUM */, configuration);
if (canUseEventBridge()) {

@@ -94,0 +95,0 @@ var bridge_1 = getEventBridge();

import { Observable } from '@datadog/browser-core';
export declare function createDOMMutationObservable(): Observable<void>;
declare type MutationObserverConstructor = new (callback: MutationCallback) => MutationObserver;
type MutationObserverConstructor = new (callback: MutationCallback) => MutationObserver;
export interface BrowserWindow extends Window {

@@ -5,0 +5,0 @@ MutationObserver?: MutationObserverConstructor;

@@ -32,3 +32,3 @@ import { addEventListener, instrumentMethodAndCallOriginal, Observable, shallowClone, } from '@datadog/browser-core';

}).stop;
var removeListener = addEventListener(window, "popstate" /* POP_STATE */, onHistoryChange).stop;
var removeListener = addEventListener(window, "popstate" /* DOM_EVENT.POP_STATE */, onHistoryChange).stop;
return {

@@ -43,4 +43,4 @@ stop: function () {

function trackHash(onHashChange) {
return addEventListener(window, "hashchange" /* HASH_CHANGE */, onHashChange);
return addEventListener(window, "hashchange" /* DOM_EVENT.HASH_CHANGE */, onHashChange);
}
//# sourceMappingURL=locationChangeObservable.js.map

@@ -60,8 +60,8 @@ import type { Duration, RelativeTime } from '@datadog/browser-core';

}
export declare type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumLayoutShiftTiming;
export type RumPerformanceEntry = RumPerformanceResourceTiming | RumPerformanceLongTaskTiming | RumPerformancePaintTiming | RumPerformanceNavigationTiming | RumLargestContentfulPaintTiming | RumFirstInputTiming | RumLayoutShiftTiming;
export declare function supportPerformanceTimingEvent(entryType: string): boolean;
export declare function startPerformanceCollection(lifeCycle: LifeCycle, configuration: RumConfiguration): void;
export declare function retrieveInitialDocumentResourceTiming(callback: (timing: RumPerformanceResourceTiming) => void): void;
export declare type RelativePerformanceTiming = {
export type RelativePerformanceTiming = {
-readonly [key in keyof Omit<PerformanceTiming, 'toJSON'>]: RelativeTime;
};

@@ -104,3 +104,3 @@ import { dateNow, assign, addEventListeners, getRelativeTime, isNumber, monitor, setTimeout, relativeNow, runOnReadyState, } from '@datadog/browser-core';

var timingSent = false;
var removeEventListeners = addEventListeners(window, ["click" /* CLICK */, "mousedown" /* MOUSE_DOWN */, "keydown" /* KEY_DOWN */, "touchstart" /* TOUCH_START */, "pointerdown" /* POINTER_DOWN */], function (evt) {
var removeEventListeners = addEventListeners(window, ["click" /* DOM_EVENT.CLICK */, "mousedown" /* DOM_EVENT.MOUSE_DOWN */, "keydown" /* DOM_EVENT.KEY_DOWN */, "touchstart" /* DOM_EVENT.TOUCH_START */, "pointerdown" /* DOM_EVENT.POINTER_DOWN */], function (evt) {
// Only count cancelable events, which should trigger behavior important to the user.

@@ -118,3 +118,3 @@ if (!evt.cancelable) {

};
if (evt.type === "pointerdown" /* POINTER_DOWN */) {
if (evt.type === "pointerdown" /* DOM_EVENT.POINTER_DOWN */) {
sendTimingIfPointerIsNotCancelled(timing);

@@ -133,4 +133,4 @@ }

function sendTimingIfPointerIsNotCancelled(timing) {
addEventListeners(window, ["pointerup" /* POINTER_UP */, "pointercancel" /* POINTER_CANCEL */], function (event) {
if (event.type === "pointerup" /* POINTER_UP */) {
addEventListeners(window, ["pointerup" /* DOM_EVENT.POINTER_UP */, "pointercancel" /* DOM_EVENT.POINTER_CANCEL */], function (event) {
if (event.type === "pointerup" /* DOM_EVENT.POINTER_UP */) {
sendTiming(timing);

@@ -180,3 +180,3 @@ }

if (rumAllowedPerformanceEntries.length) {
lifeCycle.notify(0 /* PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);
lifeCycle.notify(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, rumAllowedPerformanceEntries);
}

@@ -183,0 +183,0 @@ }

@@ -14,3 +14,3 @@ import { Observable, throttle, addEventListener } from '@datadog/browser-core';

}, 200).throttled;
return addEventListener(window, "resize" /* RESIZE */, updateDimension, { capture: true, passive: true }).stop;
return addEventListener(window, "resize" /* DOM_EVENT.RESIZE */, updateDimension, { capture: true, passive: true }).stop;
});

@@ -17,0 +17,0 @@ return observable;

@@ -22,8 +22,8 @@ import { combine, isEmptyObject, limitModification, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, } from '@datadog/browser-core';

var eventRateLimiters = (_a = {},
_a["error" /* ERROR */] = createEventRateLimiter("error" /* ERROR */, configuration.eventRateLimiterThreshold, reportError),
_a["action" /* ACTION */] = createEventRateLimiter("action" /* ACTION */, configuration.eventRateLimiterThreshold, reportError),
_a["error" /* RumEventType.ERROR */] = createEventRateLimiter("error" /* RumEventType.ERROR */, configuration.eventRateLimiterThreshold, reportError),
_a["action" /* RumEventType.ACTION */] = createEventRateLimiter("action" /* RumEventType.ACTION */, configuration.eventRateLimiterThreshold, reportError),
_a);
var syntheticsContext = getSyntheticsContext();
var ciTestContext = getCiTestContext();
lifeCycle.subscribe(10 /* RAW_RUM_EVENT_COLLECTED */, function (_a) {
lifeCycle.subscribe(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, function (_a) {
var startTime = _a.startTime, rawRumEvent = _a.rawRumEvent, domainContext = _a.domainContext, savedCommonContext = _a.savedCommonContext, customerContext = _a.customerContext;

@@ -35,3 +35,3 @@ var viewContext = viewContexts.findView(startTime);

// TODO: stop sending view updates when session is expired
var session = sessionManager.findTrackedSession(rawRumEvent.type !== "view" /* VIEW */ ? startTime : undefined);
var session = sessionManager.findTrackedSession(rawRumEvent.type !== "view" /* RumEventType.VIEW */ ? startTime : undefined);
if (session && viewContext && urlContext) {

@@ -47,3 +47,3 @@ var commonContext = savedCommonContext || buildCommonContext();

},
browser_sdk_version: canUseEventBridge() ? "4.36.0" : undefined,
browser_sdk_version: canUseEventBridge() ? "4.37.0" : undefined,
},

@@ -59,3 +59,3 @@ application: {

id: session.id,
type: syntheticsContext ? "synthetics" /* SYNTHETICS */ : ciTestContext ? "ci_test" /* CI_TEST */ : "user" /* USER */,
type: syntheticsContext ? "synthetics" /* SessionType.SYNTHETICS */ : ciTestContext ? "ci_test" /* SessionType.CI_TEST */ : "user" /* SessionType.USER */,
},

@@ -87,3 +87,3 @@ view: {

}
lifeCycle.notify(11 /* RUM_EVENT_COLLECTED */, serverRumEvent);
lifeCycle.notify(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, serverRumEvent);
}

@@ -96,4 +96,4 @@ }

if (beforeSend) {
var result = limitModification(event, event.type === "view" /* VIEW */ ? VIEW_EVENTS_MODIFIABLE_FIELD_PATHS : OTHER_EVENTS_MODIFIABLE_FIELD_PATHS, function (event) { return beforeSend(event, domainContext); });
if (result === false && event.type !== "view" /* VIEW */) {
var result = limitModification(event, event.type === "view" /* RumEventType.VIEW */ ? VIEW_EVENTS_MODIFIABLE_FIELD_PATHS : OTHER_EVENTS_MODIFIABLE_FIELD_PATHS, function (event) { return beforeSend(event, domainContext); });
if (result === false && event.type !== "view" /* RumEventType.VIEW */) {
return false;

@@ -109,4 +109,4 @@ }

function needToAssembleWithAction(event) {
return ["error" /* ERROR */, "resource" /* RESOURCE */, "long_task" /* LONG_TASK */].indexOf(event.type) !== -1;
return ["error" /* RumEventType.ERROR */, "resource" /* RumEventType.RESOURCE */, "long_task" /* RumEventType.LONG_TASK */].indexOf(event.type) !== -1;
}
//# sourceMappingURL=assembly.js.map

@@ -41,3 +41,3 @@ import type { Configuration, InitConfiguration, MatchOption, RawTelemetryConfiguration } from '@datadog/browser-core';

}
export declare type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>;
export type HybridInitConfiguration = Omit<RumInitConfiguration, 'applicationId' | 'clientToken'>;
export interface RumConfiguration extends Configuration {

@@ -44,0 +44,0 @@ actionNameAttribute: string | undefined;

@@ -5,3 +5,3 @@ import type { RelativeTime, ContextValue, Context } from '@datadog/browser-core';

export declare const FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY: number;
export declare type FeatureFlagContext = Context;
export type FeatureFlagContext = Context;
export interface FeatureFlagContexts {

@@ -8,0 +8,0 @@ findFeatureFlagEvaluations: (startTime?: RelativeTime) => FeatureFlagContext | undefined;

@@ -1,2 +0,2 @@

import { jsonStringify, computeBytesCount, deepClone, noop, isExperimentalFeatureEnabled, SESSION_TIME_OUT_DELAY, ContextHistory, } from '@datadog/browser-core';
import { jsonStringify, computeBytesCount, noop, isExperimentalFeatureEnabled, SESSION_TIME_OUT_DELAY, ContextHistory, } from '@datadog/browser-core';
export var FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY;

@@ -22,7 +22,7 @@ /**

var bytesCountCache;
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
featureFlagContexts.closeActive(endClocks.relative);
});
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (_a) {
var startClocks = _a.startClocks;

@@ -47,3 +47,3 @@ featureFlagContexts.add({}, startClocks.relative);

if (currentContext) {
currentContext[key] = deepClone(value);
currentContext[key] = value;
bytesCountCache = undefined;

@@ -50,0 +50,0 @@ }

@@ -48,3 +48,3 @@ import { addDuration, addEventListener, elapsed, relativeNow, toServerDuration } from '@datadog/browser-core';

function trackFocus(onFocusChange) {
return addEventListener(window, "focus" /* FOCUS */, function (event) {
return addEventListener(window, "focus" /* DOM_EVENT.FOCUS */, function (event) {
if (!event.isTrusted) {

@@ -57,3 +57,3 @@ return;

function trackBlur(onBlurChange) {
return addEventListener(window, "blur" /* BLUR */, function (event) {
return addEventListener(window, "blur" /* DOM_EVENT.BLUR */, function (event) {
if (!event.isTrusted) {

@@ -60,0 +60,0 @@ return;

@@ -23,3 +23,3 @@ import type { ActionContexts } from '../rumEventsCollection/action/actionCollection';

export declare function startInternalContext(applicationId: string, sessionManager: RumSessionManager, viewContexts: ViewContexts, actionContexts: ActionContexts, urlContexts: UrlContexts): {
get: (startTime?: number | undefined) => InternalContext | undefined;
get: (startTime?: number) => InternalContext | undefined;
};

@@ -10,3 +10,3 @@ import type { Duration, RelativeTime } from '@datadog/browser-core';

}
export declare type PageStateEntry = {
export type PageStateEntry = {
state: PageState;

@@ -13,0 +13,0 @@ startTime: RelativeTime;

@@ -8,9 +8,9 @@ import { addDuration, addEventListeners, relativeNow } from '@datadog/browser-core';

var stop = addEventListeners(window, [
"pageshow" /* PAGE_SHOW */,
"focus" /* FOCUS */,
"blur" /* BLUR */,
"visibilitychange" /* VISIBILITY_CHANGE */,
"resume" /* RESUME */,
"freeze" /* FREEZE */,
"pagehide" /* PAGE_HIDE */,
"pageshow" /* DOM_EVENT.PAGE_SHOW */,
"focus" /* DOM_EVENT.FOCUS */,
"blur" /* DOM_EVENT.BLUR */,
"visibilitychange" /* DOM_EVENT.VISIBILITY_CHANGE */,
"resume" /* DOM_EVENT.RESUME */,
"freeze" /* DOM_EVENT.FREEZE */,
"pagehide" /* DOM_EVENT.PAGE_HIDE */,
], function (event) {

@@ -22,7 +22,7 @@ // Only get events fired by the browser to avoid false currentPageState changes done with custom events

}
if (event.type === "freeze" /* FREEZE */) {
addPageState("frozen" /* FROZEN */);
if (event.type === "freeze" /* DOM_EVENT.FREEZE */) {
addPageState("frozen" /* PageState.FROZEN */);
}
else if (event.type === "pagehide" /* PAGE_HIDE */) {
addPageState(event.persisted ? "frozen" /* FROZEN */ : "terminated" /* TERMINATED */);
else if (event.type === "pagehide" /* DOM_EVENT.PAGE_HIDE */) {
addPageState(event.persisted ? "frozen" /* PageState.FROZEN */ : "terminated" /* PageState.TERMINATED */);
}

@@ -54,8 +54,8 @@ else {

if (document.visibilityState === 'hidden') {
return "hidden" /* HIDDEN */;
return "hidden" /* PageState.HIDDEN */;
}
if (document.hasFocus()) {
return "active" /* ACTIVE */;
return "active" /* PageState.ACTIVE */;
}
return "passive" /* PASSIVE */;
return "passive" /* PageState.PASSIVE */;
}

@@ -62,0 +62,0 @@ export function addPageState(nextPageState, maxPageStateEntries) {

@@ -19,4 +19,4 @@ import type { RelativeTime, Observable } from '@datadog/browser-core';

export declare function startUrlContexts(lifeCycle: LifeCycle, locationChangeObservable: Observable<LocationChange>, location: Location): {
findUrl: (startTime?: RelativeTime | undefined) => UrlContext | undefined;
findUrl: (startTime?: RelativeTime) => UrlContext | undefined;
stop: () => void;
};

@@ -11,7 +11,7 @@ import { SESSION_TIME_OUT_DELAY, relativeNow, ContextHistory } from '@datadog/browser-core';

var previousViewUrl;
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
urlContextHistory.closeActive(endClocks.relative);
});
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (_a) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (_a) {
var startClocks = _a.startClocks;

@@ -18,0 +18,0 @@ var viewUrl = location.href;

@@ -5,10 +5,10 @@ import { SESSION_TIME_OUT_DELAY, ContextHistory } from '@datadog/browser-core';

var viewContextHistory = new ContextHistory(VIEW_CONTEXT_TIME_OUT_DELAY);
lifeCycle.subscribe(2 /* VIEW_CREATED */, function (view) {
lifeCycle.subscribe(2 /* LifeCycleEventType.VIEW_CREATED */, function (view) {
viewContextHistory.add(buildViewContext(view), view.startClocks.relative);
});
lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;
viewContextHistory.closeActive(endClocks.relative);
});
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
viewContextHistory.reset();

@@ -15,0 +15,0 @@ });

@@ -20,3 +20,3 @@ import { initFetchObservable, initXhrObservable, readBytesFromStream, elapsed, timeStampNow, tryToClone, } from '@datadog/browser-core';

context.requestIndex = getNextRequestIndex();
lifeCycle.notify(5 /* REQUEST_STARTED */, {
lifeCycle.notify(5 /* LifeCycleEventType.REQUEST_STARTED */, {
requestIndex: context.requestIndex,

@@ -28,3 +28,3 @@ url: context.url,

tracer.clearTracingIfNeeded(context);
lifeCycle.notify(6 /* REQUEST_COMPLETED */, {
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_COMPLETED */, {
duration: context.duration,

@@ -38,3 +38,3 @@ method: context.method,

traceSampled: context.traceSampled,
type: "xhr" /* XHR */,
type: "xhr" /* RequestType.XHR */,
url: context.url,

@@ -58,3 +58,3 @@ xhr: context.xhr,

context.requestIndex = getNextRequestIndex();
lifeCycle.notify(5 /* REQUEST_STARTED */, {
lifeCycle.notify(5 /* LifeCycleEventType.REQUEST_STARTED */, {
requestIndex: context.requestIndex,

@@ -67,3 +67,3 @@ url: context.url,

tracer.clearTracingIfNeeded(context);
lifeCycle.notify(6 /* REQUEST_COMPLETED */, {
lifeCycle.notify(6 /* LifeCycleEventType.REQUEST_COMPLETED */, {
duration: duration,

@@ -78,3 +78,3 @@ method: context.method,

traceSampled: context.traceSampled,
type: "fetch" /* FETCH */,
type: "fetch" /* RequestType.FETCH */,
url: context.url,

@@ -81,0 +81,0 @@ response: context.response,

@@ -15,6 +15,6 @@ import type { ClocksState, Context, Observable } from '@datadog/browser-core';

}
export declare type AutoAction = ClickAction;
export type AutoAction = ClickAction;
export declare function startActionCollection(lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, foregroundContexts: ForegroundContexts): {
addAction: (action: CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addAction: (action: CustomAction, savedCommonContext?: CommonContext) => void;
actionContexts: ActionContexts;
};
import { noop, assign, combine, toServerDuration, generateUUID } from '@datadog/browser-core';
import { trackClickActions } from './trackClickActions';
export function startActionCollection(lifeCycle, domMutationObservable, configuration, foregroundContexts) {
lifeCycle.subscribe(1 /* AUTO_ACTION_COMPLETED */, function (action) {
return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processAction(action, foregroundContexts));
lifeCycle.subscribe(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, function (action) {
return lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processAction(action, foregroundContexts));
});

@@ -13,3 +13,3 @@ var actionContexts = { findActionId: noop };

addAction: function (action, savedCommonContext) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, assign({
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, assign({
savedCommonContext: savedCommonContext,

@@ -58,3 +58,3 @@ }, processAction(action, foregroundContexts)));

date: action.startClocks.timeStamp,
type: "action" /* ACTION */,
type: "action" /* RumEventType.ACTION */,
}, autoActionProperties);

@@ -73,4 +73,4 @@ var inForeground = foregroundContexts.isInForegroundAt(action.startClocks.relative);

function isAutoAction(action) {
return action.type !== "custom" /* CUSTOM */;
return action.type !== "custom" /* ActionType.CUSTOM */;
}
//# sourceMappingURL=actionCollection.js.map

@@ -6,3 +6,3 @@ import { ONE_SECOND, clearTimeout, setTimeout } from '@datadog/browser-core';

var bufferedClicks = [];
var status = 0 /* WaitingForMoreClicks */;
var status = 0 /* ClickChainStatus.WaitingForMoreClicks */;
var maxDurationBetweenClicksTimeout;

@@ -17,4 +17,4 @@ appendClick(firstClick);

function tryFinalize() {
if (status === 1 /* WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {
status = 2 /* Finalized */;
if (status === 1 /* ClickChainStatus.WaitingForClicksToStop */ && bufferedClicks.every(function (click) { return click.isStopped(); })) {
status = 2 /* ClickChainStatus.Finalized */;
onFinalize(bufferedClicks);

@@ -25,4 +25,4 @@ }

clearTimeout(maxDurationBetweenClicksTimeout);
if (status === 0 /* WaitingForMoreClicks */) {
status = 1 /* WaitingForClicksToStop */;
if (status === 0 /* ClickChainStatus.WaitingForMoreClicks */) {
status = 1 /* ClickChainStatus.WaitingForClicksToStop */;
tryFinalize();

@@ -33,3 +33,3 @@ }

tryAppend: function (click) {
if (status !== 0 /* WaitingForMoreClicks */) {
if (status !== 0 /* ClickChainStatus.WaitingForMoreClicks */) {
return false;

@@ -36,0 +36,0 @@ }

@@ -5,8 +5,8 @@ import { elementMatches, ONE_SECOND } from '@datadog/browser-core';

if (isRage(clicks)) {
rageClick.addFrustration("rage_click" /* RAGE_CLICK */);
rageClick.addFrustration("rage_click" /* FrustrationType.RAGE_CLICK */);
if (clicks.some(isDead)) {
rageClick.addFrustration("dead_click" /* DEAD_CLICK */);
rageClick.addFrustration("dead_click" /* FrustrationType.DEAD_CLICK */);
}
if (rageClick.hasError) {
rageClick.addFrustration("error_click" /* ERROR_CLICK */);
rageClick.addFrustration("error_click" /* FrustrationType.ERROR_CLICK */);
}

@@ -18,3 +18,3 @@ return { isRage: true };

if (click.hasError) {
click.addFrustration("error_click" /* ERROR_CLICK */);
click.addFrustration("error_click" /* FrustrationType.ERROR_CLICK */);
}

@@ -24,3 +24,3 @@ if (isDead(click) &&

!hasSelectionChanged) {
click.addFrustration("dead_click" /* DEAD_CLICK */);
click.addFrustration("dead_click" /* FrustrationType.DEAD_CLICK */);
}

@@ -27,0 +27,0 @@ });

@@ -1,2 +0,2 @@

export declare type MouseEventOnElement = PointerEvent & {
export type MouseEventOnElement = PointerEvent & {
target: Element;

@@ -3,0 +3,0 @@ };

@@ -11,3 +11,3 @@ import { addEventListener } from '@datadog/browser-core';

var listeners = [
addEventListener(window, "pointerdown" /* POINTER_DOWN */, function (event) {
addEventListener(window, "pointerdown" /* DOM_EVENT.POINTER_DOWN */, function (event) {
if (isValidPointerEvent(event)) {

@@ -22,3 +22,3 @@ selectionEmptyAtPointerDown = isSelectionEmpty();

}, { capture: true }),
addEventListener(window, "selectionchange" /* SELECTION_CHANGE */, function () {
addEventListener(window, "selectionchange" /* DOM_EVENT.SELECTION_CHANGE */, function () {
if (!selectionEmptyAtPointerDown || !isSelectionEmpty()) {

@@ -28,3 +28,3 @@ userActivity.selection = true;

}, { capture: true }),
addEventListener(window, "pointerup" /* POINTER_UP */, function (event) {
addEventListener(window, "pointerup" /* DOM_EVENT.POINTER_UP */, function (event) {
if (isValidPointerEvent(event) && clickContext) {

@@ -37,3 +37,3 @@ // Use a scoped variable to make sure the value is not changed by other clicks

}, { capture: true }),
addEventListener(window, "input" /* INPUT */, function () {
addEventListener(window, "input" /* DOM_EVENT.INPUT */, function () {
userActivity.input = true;

@@ -40,0 +40,0 @@ }, { capture: true }),

@@ -37,3 +37,3 @@ import type { Duration, ClocksState, RelativeTime, TimeStamp } from '@datadog/browser-core';

}
declare type ClickActionIdHistory = ContextHistory<ClickAction['id']>;
type ClickActionIdHistory = ContextHistory<ClickAction['id']>;
export declare const CLICK_ACTION_MAX_DURATION: number;

@@ -45,7 +45,7 @@ export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;

};
declare type ClickActionBase = Pick<ClickAction, 'type' | 'name' | 'target' | 'position'>;
export declare type Click = ReturnType<typeof newClick>;
type ClickActionBase = Pick<ClickAction, 'type' | 'name' | 'target' | 'position'>;
export type Click = ReturnType<typeof newClick>;
declare function newClick(lifeCycle: LifeCycle, history: ClickActionIdHistory, getUserActivity: () => UserActivity, clickActionBase: ClickActionBase, startEvent: MouseEventOnElement): {
event: MouseEventOnElement;
stop: (newActivityEndTime?: TimeStamp | undefined) => void;
stop: (newActivityEndTime?: TimeStamp) => void;
stopObservable: Observable<void>;

@@ -62,3 +62,3 @@ readonly hasError: boolean;

clone: () => any;
validate: (domEvents?: Event[] | undefined) => void;
validate: (domEvents?: Event[]) => void;
discard: () => void;

@@ -65,0 +65,0 @@ };

@@ -16,6 +16,6 @@ import { includes, timeStampNow, isExperimentalFeatureEnabled, Observable, assign, getRelativeTime, ONE_MINUTE, ContextHistory, generateUUID, clocksNow, ONE_SECOND, elapsed, } from '@datadog/browser-core';

var currentClickChain;
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
history.reset();
});
lifeCycle.subscribe(4 /* VIEW_ENDED */, stopClickChain);
lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, stopClickChain);
var stopActionEventsListener = listenActionEvents({

@@ -115,3 +115,3 @@ onPointerDown: function (pointerDownEvent) {

}, CLICK_ACTION_MAX_DURATION).stop;
var viewEndedSubscription = lifeCycle.subscribe(4 /* VIEW_ENDED */, function (_a) {
var viewEndedSubscription = lifeCycle.subscribe(4 /* LifeCycleEventType.VIEW_ENDED */, function (_a) {
var endClocks = _a.endClocks;

@@ -146,3 +146,3 @@ click.stop(endClocks.timeStamp);

return {
type: "click" /* CLICK */,
type: "click" /* ActionType.CLICK */,
target: target,

@@ -164,3 +164,3 @@ position: position,

});
var status = 0 /* ONGOING */;
var status = 0 /* ClickStatus.ONGOING */;
var activityEndTime;

@@ -170,7 +170,7 @@ var frustrationTypes = [];

function stop(newActivityEndTime) {
if (status !== 0 /* ONGOING */) {
if (status !== 0 /* ClickStatus.ONGOING */) {
return;
}
activityEndTime = newActivityEndTime;
status = 1 /* STOPPED */;
status = 1 /* ClickStatus.STOPPED */;
if (activityEndTime) {

@@ -200,7 +200,7 @@ historyEntry.close(getRelativeTime(activityEndTime));

startClocks: startClocks,
isStopped: function () { return status === 1 /* STOPPED */ || status === 2 /* FINALIZED */; },
isStopped: function () { return status === 1 /* ClickStatus.STOPPED */ || status === 2 /* ClickStatus.FINALIZED */; },
clone: function () { return newClick(lifeCycle, history, getUserActivity, clickActionBase, startEvent); },
validate: function (domEvents) {
stop();
if (status !== 1 /* STOPPED */) {
if (status !== 1 /* ClickStatus.STOPPED */) {
return;

@@ -210,3 +210,3 @@ }

var clickAction = assign({
type: "click" /* CLICK */,
type: "click" /* ActionType.CLICK */,
duration: activityEndTime && elapsed(startClocks.timeStamp, activityEndTime),

@@ -224,8 +224,8 @@ startClocks: startClocks,

}, clickActionBase);
lifeCycle.notify(1 /* AUTO_ACTION_COMPLETED */, clickAction);
status = 2 /* FINALIZED */;
lifeCycle.notify(1 /* LifeCycleEventType.AUTO_ACTION_COMPLETED */, clickAction);
status = 2 /* ClickStatus.FINALIZED */;
},
discard: function () {
stop();
status = 2 /* FINALIZED */;
status = 2 /* ClickStatus.FINALIZED */;
},

@@ -232,0 +232,0 @@ };

@@ -16,3 +16,3 @@ import type { Context, ClocksState } from '@datadog/browser-core';

export declare function doStartErrorCollection(lifeCycle: LifeCycle, foregroundContexts: ForegroundContexts, featureFlagContexts: FeatureFlagContexts): {
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext) => void;
};

@@ -9,9 +9,9 @@ import { PROVIDED_ERROR_MESSAGE_PREFIX, isEmptyObject, assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, } from '@datadog/browser-core';

trackReportError(errorObservable);
errorObservable.subscribe(function (error) { return lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, { error: error }); });
errorObservable.subscribe(function (error) { return lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, { error: error }); });
return doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts);
}
export function doStartErrorCollection(lifeCycle, foregroundContexts, featureFlagContexts) {
lifeCycle.subscribe(12 /* RAW_ERROR_COLLECTED */, function (_a) {
lifeCycle.subscribe(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, function (_a) {
var error = _a.error, customerContext = _a.customerContext, savedCommonContext = _a.savedCommonContext;
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, assign({
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, assign({
customerContext: customerContext,

@@ -32,5 +32,5 @@ savedCommonContext: savedCommonContext,

source: ErrorSource.CUSTOM,
handling: "handled" /* HANDLED */,
handling: "handled" /* ErrorHandling.HANDLED */,
});
lifeCycle.notify(12 /* RAW_ERROR_COLLECTED */, {
lifeCycle.notify(12 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, {
customerContext: customerContext,

@@ -57,3 +57,3 @@ savedCommonContext: savedCommonContext,

},
type: "error" /* ERROR */,
type: "error" /* RumEventType.ERROR */,
};

@@ -60,0 +60,0 @@ var inForeground = foregroundContexts.isInForegroundAt(error.startClocks.relative);

@@ -9,3 +9,3 @@ import { clocksNow, initConsoleObservable, ErrorSource, ConsoleApiName } from '@datadog/browser-core';

source: ErrorSource.CONSOLE,
handling: "handled" /* HANDLED */,
handling: "handled" /* ErrorHandling.HANDLED */,
handlingStack: consoleError.handlingStack,

@@ -12,0 +12,0 @@ });

@@ -10,3 +10,3 @@ import { clocksNow, ErrorSource, initReportObservable, RawReportType } from '@datadog/browser-core';

source: ErrorSource.REPORT,
handling: "unhandled" /* UNHANDLED */,
handling: "unhandled" /* ErrorHandling.UNHANDLED */,
});

@@ -13,0 +13,0 @@ });

import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core';
export function startLongTaskCollection(lifeCycle, sessionManager) {
lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -20,3 +20,3 @@ var entry = entries_1[_i];

},
type: "long_task" /* LONG_TASK */,
type: "long_task" /* RumEventType.LONG_TASK */,
_dd: {

@@ -26,3 +26,3 @@ discarded: false,

};
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, {
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, {
rawRumEvent: rawRumEvent,

@@ -29,0 +29,0 @@ startTime: startClocks.relative,

@@ -5,10 +5,10 @@ import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, isExperimentalFeatureEnabled, } from '@datadog/browser-core';

export function startResourceCollection(lifeCycle, configuration, sessionManager, pageStateHistory) {
lifeCycle.subscribe(6 /* REQUEST_COMPLETED */, function (request) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processRequest(request, configuration, sessionManager, pageStateHistory));
lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processRequest(request, configuration, sessionManager, pageStateHistory));
});
lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'resource' && !isRequestKind(entry)) {
lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processResourceEntry(entry, configuration, sessionManager, pageStateHistory));
lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processResourceEntry(entry, configuration, sessionManager, pageStateHistory));
}

@@ -20,3 +20,3 @@ }

var _a;
var type = request.type === "xhr" /* XHR */ ? "xhr" /* XHR */ : "fetch" /* FETCH */;
var type = request.type === "xhr" /* RequestType.XHR */ ? "xhr" /* ResourceType.XHR */ : "fetch" /* ResourceType.FETCH */;
var matchingTiming = matchRequestTiming(request);

@@ -40,3 +40,3 @@ var startClocks = matchingTiming ? relativeToClocks(matchingTiming.startTime) : request.startClocks;

},
type: "resource" /* RESOURCE */,
type: "resource" /* RumEventType.RESOURCE */,
}, tracingInfo, correspondingTimingOverrides, indexingInfo, durationOverrideInfo, pageStateInfo);

@@ -70,3 +70,3 @@ return {

},
type: "resource" /* RESOURCE */,
type: "resource" /* RumEventType.RESOURCE */,
}, tracingInfo, entryMetrics, indexingInfo, pageStateInfo);

@@ -73,0 +73,0 @@ return {

import { assign, addTelemetryDebug, elapsed, getPathName, includes, isValidUrl, toServerDuration, } from '@datadog/browser-core';
export var FAKE_INITIAL_DOCUMENT = 'initial_document';
var RESOURCE_TYPES = [
["document" /* DOCUMENT */, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],
["xhr" /* XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
["fetch" /* FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],
["beacon" /* BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],
["css" /* CSS */, function (_, path) { return /\.css$/i.test(path); }],
["js" /* JS */, function (_, path) { return /\.js$/i.test(path); }],
["document" /* ResourceType.DOCUMENT */, function (initiatorType) { return FAKE_INITIAL_DOCUMENT === initiatorType; }],
["xhr" /* ResourceType.XHR */, function (initiatorType) { return 'xmlhttprequest' === initiatorType; }],
["fetch" /* ResourceType.FETCH */, function (initiatorType) { return 'fetch' === initiatorType; }],
["beacon" /* ResourceType.BEACON */, function (initiatorType) { return 'beacon' === initiatorType; }],
["css" /* ResourceType.CSS */, function (_, path) { return /\.css$/i.test(path); }],
["js" /* ResourceType.JS */, function (_, path) { return /\.js$/i.test(path); }],
[
"image" /* IMAGE */,
"image" /* ResourceType.IMAGE */,
function (initiatorType, path) {

@@ -16,5 +16,5 @@ return includes(['image', 'img', 'icon'], initiatorType) || /\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(path) !== null;

],
["font" /* FONT */, function (_, path) { return /\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],
["font" /* ResourceType.FONT */, function (_, path) { return /\.(woff|eot|woff2|ttf)$/i.exec(path) !== null; }],
[
"media" /* MEDIA */,
"media" /* ResourceType.MEDIA */,
function (initiatorType, path) {

@@ -29,3 +29,3 @@ return includes(['audio', 'video'], initiatorType) || /\.(mp3|mp4)$/i.exec(path) !== null;

addTelemetryDebug("Failed to construct URL for \"".concat(timing.name, "\""));
return "other" /* OTHER */;
return "other" /* ResourceType.OTHER */;
}

@@ -39,3 +39,3 @@ var path = getPathName(url);

}
return "other" /* OTHER */;
return "other" /* ResourceType.OTHER */;
}

@@ -42,0 +42,0 @@ function areInOrder() {

@@ -16,3 +16,3 @@ import { addEventListeners } from '@datadog/browser-core';

};
(stopListeners = addEventListeners(eventTarget, ["pagehide" /* PAGE_HIDE */, "visibilitychange" /* VISIBILITY_CHANGE */], function (event) {
(stopListeners = addEventListeners(eventTarget, ["pagehide" /* DOM_EVENT.PAGE_HIDE */, "visibilitychange" /* DOM_EVENT.VISIBILITY_CHANGE */], function (event) {
if (event.type === 'pagehide' || document.visibilityState === 'hidden') {

@@ -19,0 +19,0 @@ trackFirstHiddenSingleton.timeStamp = event.timeStamp;

@@ -38,3 +38,3 @@ import { assign, addEventListeners, elapsed, ONE_MINUTE, find, findLast, relativeNow, } from '@datadog/browser-core';

export function trackNavigationTimings(lifeCycle, callback) {
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -61,3 +61,3 @@ var entry = entries_1[_i];

var firstHidden = trackFirstHidden();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var fcpEntry = find(entries, function (entry) {

@@ -87,6 +87,6 @@ return entry.entryType === 'paint' &&

var firstInteractionTimestamp = Infinity;
var stopEventListener = addEventListeners(eventTarget, ["pointerdown" /* POINTER_DOWN */, "keydown" /* KEY_DOWN */], function (event) {
var stopEventListener = addEventListeners(eventTarget, ["pointerdown" /* DOM_EVENT.POINTER_DOWN */, "keydown" /* DOM_EVENT.KEY_DOWN */], function (event) {
firstInteractionTimestamp = event.timeStamp;
}, { capture: true, once: true }).stop;
var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var unsubscribeLifeCycle = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var lcpEntry = findLast(entries, function (entry) {

@@ -119,3 +119,3 @@ return entry.entryType === 'largest-contentful-paint' &&

var firstHidden = trackFirstHidden();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var firstInputEntry = find(entries, function (entry) {

@@ -122,0 +122,0 @@ return entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp;

@@ -31,3 +31,3 @@ import { noop, round, ONE_SECOND, elapsed } from '@datadog/browser-core';

function trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadType, viewStart, callback) {
var isWaitingForLoadEvent = loadType === "initial_load" /* INITIAL_LOAD */;
var isWaitingForLoadEvent = loadType === "initial_load" /* ViewLoadingType.INITIAL_LOAD */;
var isWaitingForActivityLoadingTime = true;

@@ -80,3 +80,3 @@ var loadingTimeCandidates = [];

var window = slidingSessionWindow();
var stop = lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
var stop = lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {

@@ -83,0 +83,0 @@ var entry = entries_1[_i];

@@ -45,4 +45,4 @@ import type { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';

addTiming: (name: string, time?: RelativeTime | TimeStamp) => void;
startView: (options?: ViewOptions | undefined, startClocks?: ClocksState | undefined) => void;
startView: (options?: ViewOptions, startClocks?: ClocksState) => void;
stop: () => void;
};

@@ -1,2 +0,2 @@

import { PageExitReason, shallowClone, assign, elapsed, generateUUID, monitor, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, } from '@datadog/browser-core';
import { PageExitReason, shallowClone, assign, elapsed, generateUUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, setInterval, clearInterval, } from '@datadog/browser-core';
import { trackInitialViewTimings } from './trackInitialViewTimings';

@@ -16,3 +16,3 @@ import { trackViewMetrics } from './trackViewMetrics';

function trackInitialView(options) {
var initialView = newView(lifeCycle, domMutationObservable, configuration, location, "initial_load" /* INITIAL_LOAD */, clocksOrigin(), options);
var initialView = newView(lifeCycle, domMutationObservable, configuration, location, "initial_load" /* ViewLoadingType.INITIAL_LOAD */, clocksOrigin(), options);
var stop = trackInitialViewTimings(lifeCycle, function (timings) {

@@ -25,6 +25,6 @@ initialView.updateTimings(timings);

function trackViewChange(startClocks, viewOptions) {
return newView(lifeCycle, domMutationObservable, configuration, location, "route_change" /* ROUTE_CHANGE */, startClocks, viewOptions);
return newView(lifeCycle, domMutationObservable, configuration, location, "route_change" /* ViewLoadingType.ROUTE_CHANGE */, startClocks, viewOptions);
}
function startViewLifeCycle() {
lifeCycle.subscribe(8 /* SESSION_RENEWED */, function () {
lifeCycle.subscribe(8 /* LifeCycleEventType.SESSION_RENEWED */, function () {
// do not trigger view update to avoid wrong data

@@ -40,3 +40,3 @@ currentView.end();

// End the current view on page unload
lifeCycle.subscribe(9 /* PAGE_EXITED */, function (pageExitEvent) {
lifeCycle.subscribe(9 /* LifeCycleEventType.PAGE_EXITED */, function (pageExitEvent) {
if (pageExitEvent.reason === PageExitReason.UNLOADING || pageExitEvent.reason === PageExitReason.PAGEHIDE) {

@@ -48,5 +48,5 @@ currentView.end();

// Session keep alive
var keepAliveInterval = window.setInterval(monitor(function () {
var keepAliveInterval = setInterval(function () {
currentView.triggerUpdate();
}), SESSION_KEEP_ALIVE_INTERVAL);
}, SESSION_KEEP_ALIVE_INTERVAL);
return {

@@ -105,3 +105,3 @@ stop: function () {

}
lifeCycle.notify(2 /* VIEW_CREATED */, {
lifeCycle.notify(2 /* LifeCycleEventType.VIEW_CREATED */, {
id: id,

@@ -124,3 +124,3 @@ name: name,

var currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp;
lifeCycle.notify(3 /* VIEW_UPDATED */, assign({
lifeCycle.notify(3 /* LifeCycleEventType.VIEW_UPDATED */, assign({
customTimings: customTimings,

@@ -149,3 +149,3 @@ documentVersion: documentVersion,

endClocks = clocks;
lifeCycle.notify(4 /* VIEW_ENDED */, { endClocks: endClocks });
lifeCycle.notify(4 /* LifeCycleEventType.VIEW_ENDED */, { endClocks: endClocks });
stopViewMetricsTracking();

@@ -152,0 +152,0 @@ scheduleStopEventCountsTracking();

import { isEmptyObject, mapValues, toServerDuration, isNumber } from '@datadog/browser-core';
import { trackViews } from './trackViews';
export function startViewCollection(lifeCycle, configuration, location, domMutationObservable, locationChangeObservable, foregroundContexts, featureFlagContexts, recorderApi, initialViewOptions) {
lifeCycle.subscribe(3 /* VIEW_UPDATED */, function (view) {
return lifeCycle.notify(10 /* RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi));
lifeCycle.subscribe(3 /* LifeCycleEventType.VIEW_UPDATED */, function (view) {
return lifeCycle.notify(10 /* LifeCycleEventType.RAW_RUM_EVENT_COLLECTED */, processViewUpdate(view, foregroundContexts, featureFlagContexts, recorderApi));
});

@@ -18,3 +18,3 @@ return trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, !configuration.trackViewsManually, initialViewOptions);

date: view.startClocks.timeStamp,
type: "view" /* VIEW */,
type: "view" /* RumEventType.VIEW */,
view: {

@@ -21,0 +21,0 @@ action: {

@@ -7,4 +7,5 @@ import type { RelativeTime } from '@datadog/browser-core';

findTrackedSession: (startTime?: RelativeTime) => RumSession | undefined;
expire: () => void;
}
export declare type RumSession = {
export type RumSession = {
id: string;

@@ -11,0 +12,0 @@ plan: RumSessionPlan;

@@ -1,2 +0,2 @@

import { performDraw, startSessionManager } from '@datadog/browser-core';
import { noop, performDraw, startSessionManager } from '@datadog/browser-core';
export var RUM_SESSION_KEY = 'rum';

@@ -8,6 +8,6 @@ export function startRumSessionManager(configuration, lifeCycle) {

sessionManager.expireObservable.subscribe(function () {
lifeCycle.notify(7 /* SESSION_EXPIRED */);
lifeCycle.notify(7 /* LifeCycleEventType.SESSION_EXPIRED */);
});
sessionManager.renewObservable.subscribe(function () {
lifeCycle.notify(8 /* SESSION_RENEWED */);
lifeCycle.notify(8 /* LifeCycleEventType.SESSION_RENEWED */);
});

@@ -20,17 +20,18 @@ return {

}
var plan = session.trackingType === "1" /* TRACKED_WITH_SESSION_REPLAY */
? 2 /* WITH_SESSION_REPLAY */
: 1 /* WITHOUT_SESSION_REPLAY */;
var plan = session.trackingType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */
? 2 /* RumSessionPlan.WITH_SESSION_REPLAY */
: 1 /* RumSessionPlan.WITHOUT_SESSION_REPLAY */;
return {
id: session.id,
plan: plan,
sessionReplayAllowed: plan === 2 /* WITH_SESSION_REPLAY */,
sessionReplayAllowed: plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
longTaskAllowed: configuration.trackLongTasks !== undefined
? configuration.trackLongTasks
: configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,
: configuration.oldPlansBehavior && plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
resourceAllowed: configuration.trackResources !== undefined
? configuration.trackResources
: configuration.oldPlansBehavior && plan === 2 /* WITH_SESSION_REPLAY */,
: configuration.oldPlansBehavior && plan === 2 /* RumSessionPlan.WITH_SESSION_REPLAY */,
};
},
expire: sessionManager.expire,
};

@@ -44,3 +45,3 @@ }

id: '00000000-aaaa-0000-aaaa-000000000000',
plan: 1 /* WITHOUT_SESSION_REPLAY */,
plan: 1 /* RumSessionPlan.WITHOUT_SESSION_REPLAY */,
sessionReplayAllowed: false,

@@ -52,2 +53,3 @@ longTaskAllowed: true,

findTrackedSession: function () { return session; },
expire: noop,
};

@@ -61,9 +63,9 @@ }

else if (!performDraw(configuration.sessionSampleRate)) {
trackingType = "0" /* NOT_TRACKED */;
trackingType = "0" /* RumTrackingType.NOT_TRACKED */;
}
else if (!performDraw(configuration.sessionReplaySampleRate)) {
trackingType = "2" /* TRACKED_WITHOUT_SESSION_REPLAY */;
trackingType = "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */;
}
else {
trackingType = "1" /* TRACKED_WITH_SESSION_REPLAY */;
trackingType = "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */;
}

@@ -76,10 +78,10 @@ return {

function hasValidRumSession(trackingType) {
return (trackingType === "0" /* NOT_TRACKED */ ||
trackingType === "1" /* TRACKED_WITH_SESSION_REPLAY */ ||
trackingType === "2" /* TRACKED_WITHOUT_SESSION_REPLAY */);
return (trackingType === "0" /* RumTrackingType.NOT_TRACKED */ ||
trackingType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */ ||
trackingType === "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */);
}
function isTypeTracked(rumSessionType) {
return (rumSessionType === "2" /* TRACKED_WITHOUT_SESSION_REPLAY */ ||
rumSessionType === "1" /* TRACKED_WITH_SESSION_REPLAY */);
return (rumSessionType === "2" /* RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY */ ||
rumSessionType === "1" /* RumTrackingType.TRACKED_WITH_SESSION_REPLAY */);
}
//# sourceMappingURL=rumSessionManager.js.map

@@ -1,2 +0,2 @@

import { isEmptyObject, includes, performDraw, ONE_SECOND, addTelemetryDebug, monitor } from '@datadog/browser-core';
import { isEmptyObject, includes, performDraw, ONE_SECOND, addTelemetryDebug, setInterval } from '@datadog/browser-core';
export var MEASURES_PERIOD_DURATION = 10 * ONE_SECOND;

@@ -15,3 +15,3 @@ var currentPeriodMeasures;

// It means that contexts bytes count sums can be higher than it really is
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {
batchHasRumEvent = true;

@@ -21,3 +21,3 @@ updateMeasure(currentBatchMeasures.globalContextBytes, !isEmptyObject(globalContextManager.get()) ? globalContextManager.getBytesCount() : 0);

var featureFlagContext = featureFlagContexts.findFeatureFlagEvaluations();
var hasFeatureFlagContext = includes(["view" /* VIEW */, "error" /* ERROR */], event.type) &&
var hasFeatureFlagContext = includes(["view" /* RumEventType.VIEW */, "error" /* RumEventType.ERROR */], event.type) &&
featureFlagContext &&

@@ -42,3 +42,3 @@ !isEmptyObject(featureFlagContext);

});
setInterval(monitor(sendCurrentPeriodMeasures), MEASURES_PERIOD_DURATION);
setInterval(sendCurrentPeriodMeasures, MEASURES_PERIOD_DURATION);
}

@@ -45,0 +45,0 @@ function sendCurrentPeriodMeasures() {

@@ -8,6 +8,6 @@ import type { MatchOption } from '@datadog/browser-core';

*/
export declare type PropagatorType = 'datadog' | 'b3' | 'b3multi' | 'tracecontext';
export declare type TracingOption = {
export type PropagatorType = 'datadog' | 'b3' | 'b3multi' | 'tracecontext';
export type TracingOption = {
match: MatchOption;
propagatorTypes: PropagatorType[];
};

@@ -11,3 +11,3 @@ import { noop } from '@datadog/browser-core';

};
var subscription = lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (event) {
var subscription = lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (event) {
if (event.type === 'view' || !isChildEvent(event)) {

@@ -17,7 +17,7 @@ return;

switch (event.type) {
case "error" /* ERROR */:
case "error" /* RumEventType.ERROR */:
eventCounts.errorCount += 1;
callback();
break;
case "action" /* ACTION */:
case "action" /* RumEventType.ACTION */:
eventCounts.actionCount += 1;

@@ -29,7 +29,7 @@ if (event.action.frustration) {

break;
case "long_task" /* LONG_TASK */:
case "long_task" /* RumEventType.LONG_TASK */:
eventCounts.longTaskCount += 1;
callback();
break;
case "resource" /* RESOURCE */:
case "resource" /* RumEventType.RESOURCE */:
eventCounts.resourceCount += 1;

@@ -36,0 +36,0 @@ callback();

@@ -10,3 +10,3 @@ import type { TimeStamp } from '@datadog/browser-core';

}
export declare type PageActivityEndEvent = {
export type PageActivityEndEvent = {
hadActivity: true;

@@ -13,0 +13,0 @@ end: TimeStamp;

@@ -76,7 +76,7 @@ import { instrumentMethodAndCallOriginal, matchList, monitor, Observable, timeStampNow, setTimeout, clearTimeout, } from '@datadog/browser-core';

var pendingRequestsCount = 0;
subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
subscriptions.push(domMutationObservable.subscribe(notifyPageActivity), lifeCycle.subscribe(0 /* LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED */, function (entries) {
if (entries.some(function (entry) { return entry.entryType === 'resource' && !isExcludedUrl(configuration, entry.name); })) {
notifyPageActivity();
}
}), lifeCycle.subscribe(5 /* REQUEST_STARTED */, function (startEvent) {
}), lifeCycle.subscribe(5 /* LifeCycleEventType.REQUEST_STARTED */, function (startEvent) {
if (isExcludedUrl(configuration, startEvent.url)) {

@@ -90,3 +90,3 @@ return;

notifyPageActivity();
}), lifeCycle.subscribe(6 /* REQUEST_COMPLETED */, function (request) {
}), lifeCycle.subscribe(6 /* LifeCycleEventType.REQUEST_COMPLETED */, function (request) {
if (isExcludedUrl(configuration, request.url) ||

@@ -93,0 +93,0 @@ firstRequestIndex === undefined ||

@@ -5,3 +5,3 @@ /**

import type { RumEventType } from './rawRumEvent.types';
export declare type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;
export type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;
export interface RumViewEventDomainContext {

@@ -42,2 +42,2 @@ location: Readonly<Location>;

*/
export declare type PerformanceEntryRepresentation = Omit<PerformanceEntry, 'toJSON'>;
export type PerformanceEntryRepresentation = Omit<PerformanceEntry, 'toJSON'>;

@@ -172,3 +172,3 @@ import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp, RawErrorCause } from '@datadog/browser-core';

}
export declare type RawRumEvent = RawRumErrorEvent | RawRumResourceEvent | RawRumViewEvent | RawRumLongTaskEvent | RawRumActionEvent;
export type RawRumEvent = RawRumErrorEvent | RawRumResourceEvent | RawRumViewEvent | RawRumLongTaskEvent | RawRumActionEvent;
export interface RumContext {

@@ -175,0 +175,0 @@ date: TimeStamp;

@@ -7,7 +7,7 @@ /**

*/
export declare type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent;
export type RumEvent = RumActionEvent | RumErrorEvent | RumLongTaskEvent | RumResourceEvent | RumViewEvent;
/**
* Schema of all properties of an Action event
*/
export declare type RumActionEvent = CommonProperties & {
export type RumActionEvent = CommonProperties & {
/**

@@ -154,3 +154,3 @@ * RUM event type

*/
export declare type RumErrorEvent = CommonProperties & ActionChildProperties & {
export type RumErrorEvent = CommonProperties & ActionChildProperties & {
/**

@@ -281,3 +281,3 @@ * RUM event type

*/
export declare type RumLongTaskEvent = CommonProperties & ActionChildProperties & {
export type RumLongTaskEvent = CommonProperties & ActionChildProperties & {
/**

@@ -320,3 +320,3 @@ * RUM event type

*/
export declare type RumResourceEvent = CommonProperties & ActionChildProperties & {
export type RumResourceEvent = CommonProperties & ActionChildProperties & {
/**

@@ -489,3 +489,3 @@ * RUM event type

*/
export declare type RumViewEvent = CommonProperties & {
export type RumViewEvent = CommonProperties & {
/**

@@ -492,0 +492,0 @@ * RUM event type

import { Batch, combine, createHttpRequest, isTelemetryReplicationAllowed } from '@datadog/browser-core';
export function startRumBatch(configuration, lifeCycle, telemetryEventObservable, reportError, pageExitObservable) {
var batch = makeRumBatch(configuration, reportError, pageExitObservable);
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {
if (serverRumEvent.type === "view" /* VIEW */) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {
if (serverRumEvent.type === "view" /* RumEventType.VIEW */) {
batch.upsert(serverRumEvent, serverRumEvent.view.id);

@@ -7,0 +7,0 @@ }

import { getEventBridge } from '@datadog/browser-core';
export function startRumEventBridge(lifeCycle) {
var bridge = getEventBridge();
lifeCycle.subscribe(11 /* RUM_EVENT_COLLECTED */, function (serverRumEvent) {
lifeCycle.subscribe(11 /* LifeCycleEventType.RUM_EVENT_COLLECTED */, function (serverRumEvent) {
bridge.send('rum', serverRumEvent);

@@ -6,0 +6,0 @@ });

{
"name": "@datadog/browser-rum-core",
"version": "4.36.0",
"version": "4.37.0",
"license": "Apache-2.0",

@@ -15,3 +15,3 @@ "main": "cjs/index.js",

"dependencies": {
"@datadog/browser-core": "4.36.0"
"@datadog/browser-core": "4.37.0"
},

@@ -29,3 +29,3 @@ "devDependencies": {

},
"gitHead": "bcd2446e1d5f38c915f5fb581421bfd3fdd8dab6"
"gitHead": "058831610a12a72ff5e650e47a6ce8cfe9e20012"
}

@@ -5,6 +5,7 @@ import type { RelativeTime, TimeStamp, Context } from '@datadog/browser-core'

import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../test/specHelper'
import { noopRecorderApi, setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import type { HybridInitConfiguration, RumInitConfiguration } from '../domain/configuration'
import { ActionType } from '../rawRumEvent.types'
import { noopRecorderApi } from '../../test/noopRecorderApi'
import type { RumPublicApi, StartRum, RecorderApi } from './rumPublicApi'

@@ -23,2 +24,3 @@ import { makeRumPublicApi } from './rumPublicApi'

session: {} as any,
stopSession: () => undefined,
})

@@ -803,2 +805,24 @@ const DEFAULT_INIT_CONFIGURATION = { applicationId: 'xxx', clientToken: 'xxx' }

describe('stopSession', () => {
let rumPublicApi: RumPublicApi
let stopSessionSpy: jasmine.Spy
beforeEach(() => {
stopSessionSpy = jasmine.createSpy()
rumPublicApi = makeRumPublicApi(() => ({ ...noopStartRum(), stopSession: stopSessionSpy }), noopRecorderApi)
})
it('calls stopSession on the startRum result', () => {
rumPublicApi.init(DEFAULT_INIT_CONFIGURATION)
rumPublicApi.stopSession()
expect(stopSessionSpy).toHaveBeenCalled()
})
it('does nothing when called before init', () => {
rumPublicApi.stopSession()
rumPublicApi.init(DEFAULT_INIT_CONFIGURATION)
expect(stopSessionSpy).not.toHaveBeenCalled()
})
})
describe('recording', () => {

@@ -805,0 +829,0 @@ let recorderApiOnRumStartSpy: jasmine.Spy<RecorderApi['onRumStart']>

import type { Context, InitConfiguration, TimeStamp, RelativeTime, User } from '@datadog/browser-core'
import {
noop,
isExperimentalFeatureEnabled,
willSyntheticsInjectRum,

@@ -20,2 +22,3 @@ assign,

sanitizeUser,
sanitize,
} from '@datadog/browser-core'

@@ -67,2 +70,3 @@ import type { LifeCycle } from '../domain/lifeCycle'

let getInitConfigurationStrategy = (): InitConfiguration | undefined => undefined
let stopSessionStrategy: () => void = noop

@@ -159,2 +163,3 @@ let bufferApiCalls = new BoundedBuffer()

getInternalContext: getInternalContextStrategy,
stopSession: stopSessionStrategy,
} = startRumResults)

@@ -205,4 +210,4 @@ bufferApiCalls.drain()

addActionStrategy({
name,
context: deepClone(context as Context),
name: isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(name)! : name,
context: (isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(context) : deepClone(context)) as Context,
startClocks: clocksNow(),

@@ -217,5 +222,7 @@ type: ActionType.CUSTOM,

addErrorStrategy({
error,
error, // Do not sanitize error here, it is needed unserialized by computeRawError()
handlingStack,
context: deepClone(context as Context),
context: (isExperimentalFeatureEnabled('sanitize_inputs')
? sanitize(context)
: deepClone(context)) as Context,
startClocks: clocksNow(),

@@ -227,3 +234,6 @@ })

addTiming: monitor((name: string, time?: number) => {
addTimingStrategy(name, time as RelativeTime | TimeStamp | undefined)
addTimingStrategy(
isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(name)! : name,
time as RelativeTime | TimeStamp | undefined
)
}),

@@ -252,2 +262,6 @@

stopSession: monitor(() => {
stopSessionStrategy()
}),
startSessionReplayRecording: monitor(recorderApi.start),

@@ -260,3 +274,6 @@ stopSessionReplayRecording: monitor(recorderApi.stop),

addFeatureFlagEvaluation: monitor((key: string, value: any) => {
addFeatureFlagEvaluationStrategy(key, value)
addFeatureFlagEvaluationStrategy(
isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(key)! : key,
isExperimentalFeatureEnabled('sanitize_inputs') ? sanitize(value) : value
)
}),

@@ -263,0 +280,0 @@ })

@@ -15,4 +15,4 @@ import type { RelativeTime, Observable, RawError, Duration } from '@datadog/browser-core'

import { createRumSessionManagerMock } from '../../test/mockRumSessionManager'
import type { TestSetupBuilder } from '../../test/specHelper'
import { noopRecorderApi, setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import type { RumPerformanceNavigationTiming, RumPerformanceEntry } from '../browser/performanceCollection'

@@ -30,2 +30,3 @@ import type { LifeCycle } from '../domain/lifeCycle'

import { startFeatureFlagContexts } from '../domain/contexts/featureFlagContext'
import { noopRecorderApi } from '../../test/noopRecorderApi'
import { startRum, startRumEventCollection } from './startRum'

@@ -32,0 +33,0 @@

@@ -146,2 +146,3 @@ import type { Observable, TelemetryEvent, RawError, ContextManager } from '@datadog/browser-core'

session,
stopSession: () => session.expire(),
getInternalContext: internalContext.get,

@@ -148,0 +149,0 @@ }

@@ -1,3 +0,3 @@

import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import { retrieveInitialDocumentResourceTiming, startPerformanceCollection } from './performanceCollection'

@@ -4,0 +4,0 @@

@@ -5,4 +5,4 @@ import type { RelativeTime } from '@datadog/browser-core'

import { createRawRumEvent } from '../../test/fixtures'
import type { TestSetupBuilder } from '../../test/specHelper'
import { mockCiVisibilityWindowValues, cleanupCiVisibilityWindowValues, setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import type { RumEventDomainContext } from '../domainContext.types'

@@ -14,2 +14,3 @@ import type { RawRumActionEvent, RawRumErrorEvent, RawRumEvent } from '../rawRumEvent.types'

import { cleanupSyntheticsWorkerValues, mockSyntheticsWorkerValues } from '../../../core/test/syntheticsWorkerValues'
import { cleanupCiVisibilityWindowValues, mockCiVisibilityWindowValues } from '../../test/mockCiVisibilityWindowValues'
import { startRumAssembly } from './assembly'

@@ -16,0 +17,0 @@ import type { LifeCycle, RawRumEventCollectedData } from './lifeCycle'

@@ -1,2 +0,5 @@

import { mockCiVisibilityWindowValues, cleanupCiVisibilityWindowValues } from '../../../test/specHelper'
import {
cleanupCiVisibilityWindowValues,
mockCiVisibilityWindowValues,
} from '../../../test/mockCiVisibilityWindowValues'
import { getCiTestContext } from './ciTestContext'

@@ -3,0 +6,0 @@

import type { Context, ContextManager } from '@datadog/browser-core'
import { createContextManager } from '@datadog/browser-core'
import { noopRecorderApi } from '../../../test/specHelper'
import type { RecorderApi } from '../../boot/rumPublicApi'
import { noopRecorderApi } from '../../../test/noopRecorderApi'
import type { CommonContext } from './commonContext'

@@ -6,0 +6,0 @@ import { buildCommonContext as buildCommonContextImpl } from './commonContext'

import type { RelativeTime } from '@datadog/browser-core'
import { resetExperimentalFeatures, updateExperimentalFeatures, relativeToClocks } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import { LifeCycleEventType } from '../lifeCycle'

@@ -6,0 +6,0 @@ import type { ViewCreatedEvent, ViewEndedEvent } from '../rumEventsCollection/view/trackViews'

@@ -5,3 +5,2 @@ import type { RelativeTime, ContextValue, Context } from '@datadog/browser-core'

computeBytesCount,
deepClone,
noop,

@@ -73,3 +72,3 @@ isExperimentalFeatureEnabled,

if (currentContext) {
currentContext[key] = deepClone(value)
currentContext[key] = value
bytesCountCache = undefined

@@ -76,0 +75,0 @@ }

import type { RelativeTime, Duration, ServerDuration } from '@datadog/browser-core'
import { relativeNow } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import type { ForegroundContexts } from './foregroundContexts'

@@ -6,0 +6,0 @@ import {

import type { RelativeTime } from '@datadog/browser-core'
import { createRumSessionManagerMock } from '../../../test/mockRumSessionManager'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import type { ActionContexts } from '../rumEventsCollection/action/actionCollection'

@@ -6,0 +6,0 @@ import type { RumSessionManager } from '../rumSessionManager'

import type { RelativeTime } from '@datadog/browser-core'
import { resetExperimentalFeatures } from '@datadog/browser-core'
import type { TestSetupBuilder } from 'packages/rum-core/test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from 'packages/rum-core/test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import type { PageStateHistory } from './pageStateHistory'

@@ -6,0 +6,0 @@ import { resetPageStates, startPageStateHistory, addPageState, PageState } from './pageStateHistory'

import type { RelativeTime } from '@datadog/browser-core'
import { relativeToClocks } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import { LifeCycleEventType } from '../lifeCycle'

@@ -6,0 +6,0 @@ import type { ViewCreatedEvent, ViewEndedEvent } from '../rumEventsCollection/view/trackViews'

import type { RelativeTime } from '@datadog/browser-core'
import { relativeToClocks, CLEAR_OLD_CONTEXTS_INTERVAL } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import { LifeCycleEventType } from '../lifeCycle'

@@ -6,0 +6,0 @@ import type { ViewCreatedEvent } from '../rumEventsCollection/view/trackViews'

import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core'
import { createNewEvent } from '../../../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import { RumEventType, ActionType } from '../../../rawRumEvent.types'

@@ -6,0 +6,0 @@ import { LifeCycleEventType } from '../../lifeCycle'

@@ -11,4 +11,4 @@ import type { Context, Duration } from '@datadog/browser-core'

import { createNewEvent } from '../../../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import { RumEventType, ActionType, FrustrationType } from '../../../rawRumEvent.types'

@@ -15,0 +15,0 @@ import type { RumEvent } from '../../../rumEvent.types'

import type { RelativeTime, TimeStamp, ErrorWithCause } from '@datadog/browser-core'
import { ErrorHandling, ErrorSource } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type { RawRumErrorEvent } from '../../../rawRumEvent.types'

@@ -6,0 +6,0 @@ import { RumEventType } from '../../../rawRumEvent.types'

import type { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core'
import type { RumSessionManagerMock } from '../../../../test/mockRumSessionManager'
import { createRumSessionManagerMock } from '../../../../test/mockRumSessionManager'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type { RumPerformanceEntry, RumPerformanceLongTaskTiming } from '../../../browser/performanceCollection'

@@ -7,0 +7,0 @@ import { RumEventType } from '../../../rawRumEvent.types'

@@ -12,4 +12,4 @@ import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core'

import { createResourceEntry } from '../../../../test/fixtures'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type { RawRumResourceEvent } from '../../../rawRumEvent.types'

@@ -16,0 +16,0 @@ import { RumEventType } from '../../../rawRumEvent.types'

import type { Duration, RelativeTime } from '@datadog/browser-core'
import { DOM_EVENT } from '@datadog/browser-core'
import { createNewEvent, restorePageVisibility, setPageVisibility } from '../../../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type {

@@ -7,0 +7,0 @@ RumFirstInputTiming,

import type { Context, RelativeTime, Duration } from '@datadog/browser-core'
import { addDuration, relativeNow } from '@datadog/browser-core'
import type { RumEvent } from '../../../rumEvent.types'
import type { TestSetupBuilder, ViewTest } from '../../../../test/specHelper'
import { setup, setupViewTest } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type { RumPerformanceNavigationTiming } from '../../../browser/performanceCollection'

@@ -12,2 +12,4 @@ import { FrustrationType, RumEventType } from '../../../rawRumEvent.types'

import { THROTTLE_VIEW_UPDATE_PERIOD } from './trackViews'
import type { ViewTest } from './setupViewTest.specHelper'
import { setupViewTest } from './setupViewTest.specHelper'

@@ -14,0 +16,0 @@ const BEFORE_PAGE_ACTIVITY_VALIDATION_DELAY = (PAGE_ACTIVITY_VALIDATION_DELAY * 0.8) as Duration

@@ -10,4 +10,4 @@ import type { Context, Duration, RelativeTime } from '@datadog/browser-core'

} from '@datadog/browser-core'
import type { TestSetupBuilder, ViewTest } from '../../../../test/specHelper'
import { setup, setupViewTest } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type {

@@ -23,2 +23,4 @@ RumLargestContentfulPaintTiming,

import { THROTTLE_VIEW_UPDATE_PERIOD } from './trackViews'
import type { ViewTest } from './setupViewTest.specHelper'
import { setupViewTest } from './setupViewTest.specHelper'

@@ -25,0 +27,0 @@ const FAKE_PAINT_ENTRY: RumPerformancePaintTiming = {

@@ -8,3 +8,2 @@ import type { Duration, ClocksState, TimeStamp, Observable, Subscription, RelativeTime } from '@datadog/browser-core'

generateUUID,
monitor,
ONE_MINUTE,

@@ -17,2 +16,4 @@ throttle,

looksLikeRelativeTime,
setInterval,
clearInterval,
} from '@datadog/browser-core'

@@ -141,8 +142,5 @@

// Session keep alive
const keepAliveInterval = window.setInterval(
monitor(() => {
currentView.triggerUpdate()
}),
SESSION_KEEP_ALIVE_INTERVAL
)
const keepAliveInterval = setInterval(() => {
currentView.triggerUpdate()
}, SESSION_KEEP_ALIVE_INTERVAL)

@@ -149,0 +147,0 @@ return {

import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core'
import type { RecorderApi } from '../../../boot/rumPublicApi'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { noopRecorderApi, setup } from '../../../../test/specHelper'
import type { TestSetupBuilder } from '../../../../test/testSetupBuilder'
import { setup } from '../../../../test/testSetupBuilder'
import type { RawRumViewEvent } from '../../../rawRumEvent.types'
import { RumEventType, ViewLoadingType } from '../../../rawRumEvent.types'
import { LifeCycleEventType } from '../../lifeCycle'
import { noopRecorderApi } from '../../../../test/noopRecorderApi'
import type { ViewEvent } from './trackViews'

@@ -9,0 +10,0 @@ import { startViewCollection } from './viewCollection'

import type { RelativeTime } from '@datadog/browser-core'
import { performDraw, startSessionManager } from '@datadog/browser-core'
import { noop, performDraw, startSessionManager } from '@datadog/browser-core'
import type { RumConfiguration } from './configuration'

@@ -11,2 +11,3 @@ import type { LifeCycle } from './lifeCycle'

findTrackedSession: (startTime?: RelativeTime) => RumSession | undefined
expire: () => void
}

@@ -73,2 +74,3 @@

},
expire: sessionManager.expire,
}

@@ -90,2 +92,3 @@ }

findTrackedSession: () => session,
expire: noop,
}

@@ -92,0 +95,0 @@ }

import type { BatchFlushEvent, Context, ContextManager, TelemetryEvent } from '@datadog/browser-core'
import { resetExperimentalFeatures, TelemetryService, startTelemetry, Observable } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import { RumEventType } from '../rawRumEvent.types'

@@ -6,0 +6,0 @@ import type { RumEvent } from '../rumEvent.types'

import type { BatchFlushEvent, Context, ContextManager, Observable, Telemetry } from '@datadog/browser-core'
import { isEmptyObject, includes, performDraw, ONE_SECOND, addTelemetryDebug, monitor } from '@datadog/browser-core'
import { isEmptyObject, includes, performDraw, ONE_SECOND, addTelemetryDebug, setInterval } from '@datadog/browser-core'
import { RumEventType } from '../rawRumEvent.types'

@@ -94,3 +94,3 @@ import type { RumEvent } from '../rumEvent.types'

setInterval(monitor(sendCurrentPeriodMeasures), MEASURES_PERIOD_DURATION)
setInterval(sendCurrentPeriodMeasures, MEASURES_PERIOD_DURATION)
}

@@ -97,0 +97,0 @@

import { display, isIE, objectEntries } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { TestSetupBuilder } from '../../../test/testSetupBuilder'
import { setup } from '../../../test/testSetupBuilder'
import type { RumSessionManagerMock } from '../../../test/mockRumSessionManager'

@@ -330,3 +330,3 @@ import { createRumSessionManagerMock } from '../../../test/mockRumSessionManager'

it('should preserve original headers array', () => {
const headers = [
const headers: Array<[string, string]> = [
['foo', 'bar'],

@@ -601,3 +601,3 @@ ['foo', 'baz'],

function tracingHeadersAsArrayFor(traceId: TraceIdentifier, spanId: TraceIdentifier, samplingPriority: '1' | '0') {
return objectEntries(tracingHeadersFor(traceId, spanId, samplingPriority)) as Array<[string, string]>
return objectEntries(tracingHeadersFor(traceId, spanId, samplingPriority))
}

@@ -604,0 +604,0 @@

@@ -78,3 +78,3 @@ import {

context.init = shallowClone(context.init)
const headers: string[][] = []
const headers: Array<[string, string]> = []
if (context.init.headers instanceof Headers) {

@@ -93,3 +93,3 @@ context.init.headers.forEach((value, key) => {

}
context.init.headers = headers.concat(objectEntries(tracingHeaders) as string[][])
context.init.headers = headers.concat(objectEntries(tracingHeaders))
}

@@ -96,0 +96,0 @@ }),

@@ -5,4 +5,4 @@ import type { RelativeTime, Subscription } from '@datadog/browser-core'

import { mockClock } from '@datadog/browser-core/test/specHelper'
import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/testSetupBuilder'
import { setup } from '../../test/testSetupBuilder'
import type { RumPerformanceNavigationTiming, RumPerformanceResourceTiming } from '../browser/performanceCollection'

@@ -9,0 +9,0 @@ import { LifeCycleEventType } from './lifeCycle'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc