You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
0
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.21.0 to 5.22.0

cjs/domain/configuration/configuration.d.ts

76

cjs/boot/preStartRum.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPreStartStrategy = void 0;
exports.createPreStartStrategy = createPreStartStrategy;
var browser_core_1 = require("@datadog/browser-core");
var configuration_1 = require("../domain/configuration");
var configuration_2 = require("../domain/configuration");
var plugins_1 = require("../domain/plugins");
function createPreStartStrategy(_a, getCommonContext, trackingConsentState, doStartRum) {

@@ -37,4 +38,39 @@ var ignoreInitIfSyntheticsWillInjectRum = _a.ignoreInitIfSyntheticsWillInjectRum, startDeflateWorker = _a.startDeflateWorker;

}
function doInit(initConfiguration) {
var eventBridgeAvailable = (0, browser_core_1.canUseEventBridge)();
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration);
}
// Update the exposed initConfiguration to reflect the bridge and remote configuration overrides
cachedInitConfiguration = initConfiguration;
(0, browser_core_1.addTelemetryConfiguration)((0, configuration_2.serializeRumConfiguration)(initConfiguration));
if (cachedConfiguration) {
(0, browser_core_1.displayAlreadyInitializedError)('DD_RUM', initConfiguration);
return;
}
var configuration = (0, configuration_1.validateAndBuildRumConfiguration)(initConfiguration);
if (!configuration) {
return;
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
browser_core_1.display.warn('No storage available for session. We will not send any data.');
return;
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(configuration, 'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
browser_core_1.noop);
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return;
}
}
cachedConfiguration = configuration;
trackingConsentState.tryToInit(configuration.trackingConsent);
tryStartRum();
}
return {
init: function (initConfiguration) {
init: function (initConfiguration, publicApi) {
if (!initConfiguration) {

@@ -46,13 +82,4 @@ browser_core_1.display.error('Missing configuration');

(0, browser_core_1.initFeatureFlags)(initConfiguration.enableExperimentalFeatures);
var eventBridgeAvailable = (0, browser_core_1.canUseEventBridge)();
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration);
}
// Expose the initial configuration regardless of initialization success.
cachedInitConfiguration = initConfiguration;
(0, browser_core_1.addTelemetryConfiguration)((0, configuration_2.serializeRumConfiguration)(initConfiguration));
if (cachedConfiguration) {
(0, browser_core_1.displayAlreadyInitializedError)('DD_RUM', initConfiguration);
return;
}
// If we are in a Synthetics test configured to automatically inject a RUM instance, we want

@@ -65,24 +92,12 @@ // to completely discard the customer application RUM instance by ignoring their init() call.

}
var configuration = (0, configuration_1.validateAndBuildRumConfiguration)(initConfiguration);
if (!configuration) {
return;
if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.PLUGINS)) {
(0, plugins_1.callPluginsMethod)(initConfiguration.plugins, 'onInit', { initConfiguration: initConfiguration, publicApi: publicApi });
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
browser_core_1.display.warn('No storage available for session. We will not send any data.');
return;
if (initConfiguration.remoteConfigurationId &&
(0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.REMOTE_CONFIGURATION)) {
(0, configuration_2.fetchAndApplyRemoteConfiguration)(initConfiguration, doInit);
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(configuration, 'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
browser_core_1.noop);
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return;
}
else {
doInit(initConfiguration);
}
cachedConfiguration = configuration;
trackingConsentState.tryToInit(configuration.trackingConsent);
tryStartRum();
},

@@ -128,3 +143,2 @@ get initConfiguration() {

}
exports.createPreStartStrategy = createPreStartStrategy;
function overrideInitConfigurationForBridge(initConfiguration) {

@@ -131,0 +145,0 @@ var _a, _b;

@@ -204,3 +204,3 @@ import type { Context, User, DeflateWorker, DeflateEncoderStreamId, DeflateEncoder, TrackingConsent, PublicApi } from '@datadog/browser-core';

export interface Strategy {
init: (initConfiguration: RumInitConfiguration) => void;
init: (initConfiguration: RumInitConfiguration, publicApi: RumPublicApi) => void;
initConfiguration: RumInitConfiguration | undefined;

@@ -207,0 +207,0 @@ getInternalContext: StartRumResult['getInternalContext'];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeRumPublicApi = void 0;
exports.makeRumPublicApi = makeRumPublicApi;
var browser_core_1 = require("@datadog/browser-core");

@@ -62,3 +62,3 @@ var commonContext_1 = require("../domain/contexts/commonContext");

var rumPublicApi = (0, browser_core_1.makePublicApi)({
init: (0, browser_core_1.monitor)(function (initConfiguration) { return strategy.init(initConfiguration); }),
init: (0, browser_core_1.monitor)(function (initConfiguration) { return strategy.init(initConfiguration, rumPublicApi); }),
setTrackingConsent: (0, browser_core_1.monitor)(function (trackingConsent) {

@@ -143,3 +143,2 @@ trackingConsentState.update(trackingConsent);

}
exports.makeRumPublicApi = makeRumPublicApi;
function createPostStartStrategy(preStartStrategy, startRumResult) {

@@ -146,0 +145,0 @@ return (0, browser_core_1.assign)({

@@ -12,7 +12,7 @@ import type { Observable, RawError, DeflateEncoderStreamId, Encoder, CustomerDataTrackerManager, TrackingConsentState } from '@datadog/browser-core';

export declare function startRum(configuration: RumConfiguration, recorderApi: RecorderApi, customerDataTrackerManager: CustomerDataTrackerManager, getCommonContext: () => CommonContext, initialViewOptions: ViewOptions | undefined, createEncoder: (streamId: DeflateEncoderStreamId) => Encoder, trackingConsentState: TrackingConsentState): {
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: import("../domain/error/errorCollection").ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: import("../domain/error/errorCollection").ProvidedError, savedCommonContext?: CommonContext) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").RelativeTime | import("@datadog/browser-core").TimeStamp) => void;
addFeatureFlagEvaluation: (key: string, value: import("@datadog/browser-core").ContextValue) => void;
startView: (options?: ViewOptions | undefined, startClocks?: import("@datadog/browser-core").ClocksState | undefined) => void;
startView: (options?: ViewOptions, startClocks?: import("@datadog/browser-core").ClocksState) => void;
lifeCycle: import("@datadog/browser-core").AbstractLifeCycle<import("../domain/lifeCycle").LifeCycleEventMap>;

@@ -22,3 +22,3 @@ viewContexts: import("../domain/contexts/viewContexts").ViewContexts;

stopSession: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number) => import("../domain/contexts/internalContext").InternalContext | undefined;
startDurationVital: (vitalStart: import("../domain/vital/vitalCollection").DurationVitalStart) => void;

@@ -32,8 +32,8 @@ stopDurationVital: (vitalStop: import("../domain/vital/vitalCollection").DurationVitalStop) => void;

urlContexts: {
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime | undefined) => import("../domain/contexts/urlContexts").UrlContext | undefined;
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime) => import("../domain/contexts/urlContexts").UrlContext | undefined;
stop: () => void;
};
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext) => void;
actionContexts: import("../domain/action/trackClickActions").ActionContexts;
stop: () => void;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumEventCollection = exports.startRum = void 0;
exports.startRum = startRum;
exports.startRumEventCollection = startRumEventCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -108,3 +109,2 @@ var domMutationObservable_1 = require("../browser/domMutationObservable");

}
exports.startRum = startRum;
function startRumTelemetry(configuration) {

@@ -142,3 +142,2 @@ var telemetry = (0, browser_core_1.startTelemetry)("browser-rum-sdk" /* TelemetryService.RUM */, configuration);

}
exports.startRumEventCollection = startRumEventCollection;
//# sourceMappingURL=startRum.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WATCH_COOKIE_INTERVAL_DELAY = exports.createCookieObservable = void 0;
exports.WATCH_COOKIE_INTERVAL_DELAY = void 0;
exports.createCookieObservable = createCookieObservable;
var browser_core_1 = require("@datadog/browser-core");

@@ -13,3 +14,2 @@ function createCookieObservable(configuration, cookieName) {

}
exports.createCookieObservable = createCookieObservable;
function listenToCookieStoreChange(configuration) {

@@ -16,0 +16,0 @@ return function (cookieName, callback) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMutationObserverConstructor = exports.createDOMMutationObservable = void 0;
exports.createDOMMutationObservable = createDOMMutationObservable;
exports.getMutationObserverConstructor = getMutationObserverConstructor;
var browser_core_1 = require("@datadog/browser-core");

@@ -21,3 +22,2 @@ function createDOMMutationObservable() {

}
exports.createDOMMutationObservable = createDOMMutationObservable;
function getMutationObserverConstructor() {

@@ -59,3 +59,2 @@ var constructor;

}
exports.getMutationObserverConstructor = getMutationObserverConstructor;
//# sourceMappingURL=domMutationObservable.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParentNode = exports.forEachChildNodes = exports.hasChildNodes = exports.isNodeShadowRoot = exports.isNodeShadowHost = exports.isElementNode = exports.isCommentNode = exports.isTextNode = void 0;
exports.isTextNode = isTextNode;
exports.isCommentNode = isCommentNode;
exports.isElementNode = isElementNode;
exports.isNodeShadowHost = isNodeShadowHost;
exports.isNodeShadowRoot = isNodeShadowRoot;
exports.hasChildNodes = hasChildNodes;
exports.forEachChildNodes = forEachChildNodes;
exports.getParentNode = getParentNode;
function isTextNode(node) {
return node.nodeType === Node.TEXT_NODE;
}
exports.isTextNode = isTextNode;
function isCommentNode(node) {
return node.nodeType === Node.COMMENT_NODE;
}
exports.isCommentNode = isCommentNode;
function isElementNode(node) {
return node.nodeType === Node.ELEMENT_NODE;
}
exports.isElementNode = isElementNode;
function isNodeShadowHost(node) {
return isElementNode(node) && Boolean(node.shadowRoot);
}
exports.isNodeShadowHost = isNodeShadowHost;
function isNodeShadowRoot(node) {

@@ -24,7 +27,5 @@ var shadowRoot = node;

}
exports.isNodeShadowRoot = isNodeShadowRoot;
function hasChildNodes(node) {
return node.childNodes.length > 0 || isNodeShadowHost(node);
}
exports.hasChildNodes = hasChildNodes;
function forEachChildNodes(node, callback) {

@@ -40,3 +41,2 @@ var child = node.firstChild;

}
exports.forEachChildNodes = forEachChildNodes;
/**

@@ -48,3 +48,2 @@ * Return `host` in case if the current node is a shadow root otherwise will return the `parentNode`

}
exports.getParentNode = getParentNode;
//# sourceMappingURL=htmlDomUtils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createLocationChangeObservable = void 0;
exports.createLocationChangeObservable = createLocationChangeObservable;
var browser_core_1 = require("@datadog/browser-core");

@@ -27,3 +27,2 @@ function createLocationChangeObservable(configuration, location) {

}
exports.createLocationChangeObservable = createLocationChangeObservable;
function trackHistory(configuration, onHistoryChange) {

@@ -30,0 +29,0 @@ var stopInstrumentingPushState = (0, browser_core_1.instrumentMethod)(history, 'pushState', function (_a) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.retrieveInitialDocumentResourceTiming = exports.startPerformanceCollection = exports.supportPerformanceTimingEvent = exports.RumPerformanceEntryType = void 0;
exports.RumPerformanceEntryType = void 0;
exports.supportPerformanceTimingEvent = supportPerformanceTimingEvent;
exports.startPerformanceCollection = startPerformanceCollection;
exports.retrieveInitialDocumentResourceTiming = retrieveInitialDocumentResourceTiming;
var browser_core_1 = require("@datadog/browser-core");

@@ -29,3 +32,2 @@ var resourceUtils_1 = require("../domain/resource/resourceUtils");

}
exports.supportPerformanceTimingEvent = supportPerformanceTimingEvent;
function startPerformanceCollection(lifeCycle, configuration) {

@@ -107,3 +109,2 @@ var cleanupTasks = [];

}
exports.startPerformanceCollection = startPerformanceCollection;
function retrieveInitialDocumentResourceTiming(configuration, callback) {

@@ -138,3 +139,2 @@ (0, browser_core_1.runOnReadyState)(configuration, 'interactive', function () {

}
exports.retrieveInitialDocumentResourceTiming = retrieveInitialDocumentResourceTiming;
function retrieveNavigationTiming(configuration, callback) {

@@ -141,0 +141,0 @@ function sendFakeTiming() {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeakSet = exports.getClassList = exports.getParentElement = exports.elementMatches = exports.cssEscape = void 0;
exports.WeakSet = void 0;
exports.cssEscape = cssEscape;
exports.elementMatches = elementMatches;
exports.getParentElement = getParentElement;
exports.getClassList = getClassList;
// https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/selector/escapeSelector.js

@@ -23,3 +27,2 @@ function cssEscape(str) {

}
exports.cssEscape = cssEscape;
function elementMatches(element, selector) {

@@ -35,3 +38,2 @@ if (element.matches) {

}
exports.elementMatches = elementMatches;
/**

@@ -54,3 +56,2 @@ * Return the parentElement of an node

}
exports.getParentElement = getParentElement;
/**

@@ -71,3 +72,2 @@ * Return the classList of an element or an array of classes if classList is not supported

}
exports.getClassList = getClassList;
// ie11 supports WeakMap but not WeakSet

@@ -74,0 +74,0 @@ var PLACEHOLDER = 1;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getScrollY = exports.getScrollX = void 0;
exports.getScrollX = getScrollX;
exports.getScrollY = getScrollY;
function getScrollX() {

@@ -18,3 +19,2 @@ var scrollX;

}
exports.getScrollX = getScrollX;
function getScrollY() {

@@ -34,3 +34,2 @@ var scrollY;

}
exports.getScrollY = getScrollY;
//# sourceMappingURL=scroll.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getViewportDimension = exports.createViewportObservable = exports.initViewportObservable = void 0;
exports.initViewportObservable = initViewportObservable;
exports.createViewportObservable = createViewportObservable;
exports.getViewportDimension = getViewportDimension;
var browser_core_1 = require("@datadog/browser-core");

@@ -12,3 +14,2 @@ var viewportObservable;

}
exports.initViewportObservable = initViewportObservable;
function createViewportObservable(configuration) {

@@ -23,3 +24,2 @@ return new browser_core_1.Observable(function (observable) {

}
exports.createViewportObservable = createViewportObservable;
// excludes the width and height of any rendered classic scrollbar that is fixed to the visual viewport

@@ -39,3 +39,2 @@ function getViewportDimension() {

}
exports.getViewportDimension = getViewportDimension;
//# sourceMappingURL=viewportObservable.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startActionCollection = void 0;
exports.startActionCollection = startActionCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -24,3 +24,2 @@ var discardNegativeDuration_1 = require("../discardNegativeDuration");

}
exports.startActionCollection = startActionCollection;
function processAction(action, pageStateHistory) {

@@ -67,5 +66,3 @@ var autoActionProperties = isAutoAction(action)

var domainContext = isAutoAction(action) ? { events: action.events } : {};
if (!isAutoAction(action) &&
action.handlingStack &&
(0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.MICRO_FRONTEND)) {
if (!isAutoAction(action) && action.handlingStack) {
domainContext.handlingStack = action.handlingStack;

@@ -72,0 +69,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createClickChain = exports.MAX_DISTANCE_BETWEEN_CLICKS = exports.MAX_DURATION_BETWEEN_CLICKS = void 0;
exports.MAX_DISTANCE_BETWEEN_CLICKS = exports.MAX_DURATION_BETWEEN_CLICKS = void 0;
exports.createClickChain = createClickChain;
var browser_core_1 = require("@datadog/browser-core");

@@ -49,3 +50,2 @@ exports.MAX_DURATION_BETWEEN_CLICKS = browser_core_1.ONE_SECOND;

}
exports.createClickChain = createClickChain;
/**

@@ -52,0 +52,0 @@ * Checks whether two events are similar by comparing their target, position and timestamp

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDead = exports.isRage = exports.computeFrustration = void 0;
exports.computeFrustration = computeFrustration;
exports.isRage = isRage;
exports.isDead = isDead;
var browser_core_1 = require("@datadog/browser-core");

@@ -31,3 +33,2 @@ var polyfills_1 = require("../../browser/polyfills");

}
exports.computeFrustration = computeFrustration;
function isRage(clicks) {

@@ -45,3 +46,2 @@ if (clicks.some(function (click) { return click.getUserActivity().selection || click.getUserActivity().scroll; })) {

}
exports.isRage = isRage;
var DEAD_CLICK_EXCLUDE_SELECTOR =

@@ -68,3 +68,2 @@ // inputs that don't trigger a meaningful event like "input" when clicked, including textual

}
exports.isDead = isDead;
//# sourceMappingURL=computeFrustration.js.map

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

import { NodePrivacyLevel } from '../privacy';
import type { RumConfiguration } from '../configuration';
/**

@@ -6,2 +8,3 @@ * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.

export declare const DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = "data-dd-action-name";
export declare function getActionNameFromElement(element: Element, userProgrammaticAttribute?: string): string;
export declare const ACTION_NAME_PLACEHOLDER = "Masked Element";
export declare function getActionNameFromElement(element: Element, { enablePrivacyForActionName, actionNameAttribute: userProgrammaticAttribute }: RumConfiguration, nodePrivacyLevel?: NodePrivacyLevel): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getActionNameFromElement = exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = void 0;
exports.ACTION_NAME_PLACEHOLDER = exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = void 0;
exports.getActionNameFromElement = getActionNameFromElement;
var browser_core_1 = require("@datadog/browser-core");
var polyfills_1 = require("../../browser/polyfills");
var privacy_1 = require("../privacy");
/**

@@ -11,3 +13,5 @@ * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.

exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-dd-action-name';
function getActionNameFromElement(element, userProgrammaticAttribute) {
exports.ACTION_NAME_PLACEHOLDER = 'Masked Element';
function getActionNameFromElement(element, _a, nodePrivacyLevel) {
var enablePrivacyForActionName = _a.enablePrivacyForActionName, userProgrammaticAttribute = _a.actionNameAttribute;
// Proceed to get the action name in two steps:

@@ -19,9 +23,12 @@ // * first, get the name programmatically, explicitly defined by the user.

// Those are much likely to succeed.
return (getActionNameFromElementProgrammatically(element, exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute)) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies) ||
var defaultActionName = getActionNameFromElementProgrammatically(element, exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute));
if (nodePrivacyLevel === privacy_1.NodePrivacyLevel.MASK) {
return defaultActionName || exports.ACTION_NAME_PLACEHOLDER;
}
return (defaultActionName ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies, enablePrivacyForActionName) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies, enablePrivacyForActionName) ||
'');
}
exports.getActionNameFromElement = getActionNameFromElement;
function getActionNameFromElementProgrammatically(targetElement, programmaticAttribute) {

@@ -54,3 +61,3 @@ var elementWithAttribute;

// associated LABEL text
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacy) {
// IE does not support element.labels, so we fallback to a CSS selector based on the element id

@@ -66,3 +73,3 @@ // instead

(0, browser_core_1.find)(element.ownerDocument.querySelectorAll('label'), function (label) { return label.htmlFor === element.id; });
return label && getTextualContent(label, userProgrammaticAttribute);
return label && getTextualContent(label, userProgrammaticAttribute, privacy);
}

@@ -81,5 +88,5 @@ },

// BUTTON, LABEL or button-like element text
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {
return getTextualContent(element, userProgrammaticAttribute);
return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName);
}

@@ -89,3 +96,3 @@ },

// associated element text designated by the aria-labelledby attribute
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
var labelledByAttribute = element.getAttribute('aria-labelledby');

@@ -97,3 +104,3 @@ if (labelledByAttribute) {

.filter(function (label) { return Boolean(label); })
.map(function (element) { return getTextualContent(element, userProgrammaticAttribute); })
.map(function (element) { return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName); })
.join(' ');

@@ -114,3 +121,5 @@ }

var fallbackStrategies = [
function (element, userProgrammaticAttribute) { return getTextualContent(element, userProgrammaticAttribute); },
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName);
},
];

@@ -122,3 +131,3 @@ /**

var MAX_PARENTS_TO_CONSIDER = 10;
function getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies) {
function getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies, privacyEnabledActionName) {
var element = targetElement;

@@ -133,3 +142,3 @@ var recursionCounter = 0;

var strategy = strategies_1[_i];
var name_1 = strategy(element, userProgrammaticAttribute);
var name_1 = strategy(element, userProgrammaticAttribute, privacyEnabledActionName);
if (typeof name_1 === 'string') {

@@ -162,3 +171,3 @@ var trimmedName = name_1.trim();

}
function getTextualContent(element, userProgrammaticAttribute) {
function getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName) {
if (element.isContentEditable) {

@@ -191,2 +200,6 @@ return;

}
if (privacyEnabledActionName) {
// remove the text of elements with privacy override
removeTextFromElements("".concat((0, privacy_1.getPrivacySelector)(privacy_1.NodePrivacyLevel.HIDDEN), ", ").concat((0, privacy_1.getPrivacySelector)(privacy_1.NodePrivacyLevel.MASK)));
}
return text_1;

@@ -193,0 +206,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.listenActionEvents = void 0;
exports.listenActionEvents = listenActionEvents;
var browser_core_1 = require("@datadog/browser-core");

@@ -52,3 +52,2 @@ function listenActionEvents(configuration, _a) {

}
exports.listenActionEvents = listenActionEvents;
function isSelectionEmpty() {

@@ -55,0 +54,0 @@ var selection = window.getSelection();

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

import { ActionType } from '../../rawRumEvent.types';
import type { LifeCycle } from '../lifeCycle';
import type { RumConfiguration } from '../configuration';
import type { LifeCycle } from '../lifeCycle';
import type { MouseEventOnElement, UserActivity } from './listenActionEvents';

@@ -9,0 +9,0 @@ interface ActionCounts {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.finalizeClicks = exports.trackClickActions = exports.ACTION_CONTEXT_TIME_OUT_DELAY = exports.CLICK_ACTION_MAX_DURATION = void 0;
exports.ACTION_CONTEXT_TIME_OUT_DELAY = exports.CLICK_ACTION_MAX_DURATION = void 0;
exports.trackClickActions = trackClickActions;
exports.finalizeClicks = finalizeClicks;
var browser_core_1 = require("@datadog/browser-core");

@@ -8,2 +10,3 @@ var trackEventCounts_1 = require("../trackEventCounts");

var getSelectorFromElement_1 = require("../getSelectorFromElement");
var privacy_1 = require("../privacy");
var clickChain_1 = require("./clickChain");

@@ -30,3 +33,3 @@ var getActionNameFromElement_1 = require("./getActionNameFromElement");

var clickActionBase = _a.clickActionBase, hadActivityOnPointerDown = _a.hadActivityOnPointerDown;
return startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);
startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);
},

@@ -59,5 +62,10 @@ }).stop;

}
exports.trackClickActions = trackClickActions;
function processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent) {
var clickActionBase = computeClickActionBase(pointerDownEvent, configuration.actionNameAttribute);
var nodePrivacyLevel = configuration.enablePrivacyForActionName
? (0, privacy_1.getNodePrivacyLevel)(pointerDownEvent.target, configuration.defaultPrivacyLevel)
: privacy_1.NodePrivacyLevel.ALLOW;
if (nodePrivacyLevel === privacy_1.NodePrivacyLevel.HIDDEN) {
return undefined;
}
var clickActionBase = computeClickActionBase(pointerDownEvent, nodePrivacyLevel, configuration);
var hadActivityOnPointerDown = false;

@@ -108,3 +116,3 @@ (0, waitPageActivityEnd_1.waitPageActivityEnd)(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {

}
function computeClickActionBase(event, actionNameAttribute) {
function computeClickActionBase(event, nodePrivacyLevel, configuration) {
var rect = event.target.getBoundingClientRect();

@@ -116,3 +124,3 @@ return {

height: Math.round(rect.height),
selector: (0, getSelectorFromElement_1.getSelectorFromElement)(event.target, actionNameAttribute),
selector: (0, getSelectorFromElement_1.getSelectorFromElement)(event.target, configuration.actionNameAttribute),
},

@@ -124,3 +132,3 @@ position: {

},
name: (0, getActionNameFromElement_1.getActionNameFromElement)(event.target, actionNameAttribute),
name: (0, getActionNameFromElement_1.getActionNameFromElement)(event.target, configuration, nodePrivacyLevel),
};

@@ -216,3 +224,2 @@ }

}
exports.finalizeClicks = finalizeClicks;
//# sourceMappingURL=trackClickActions.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumAssembly = void 0;
exports.startRumAssembly = startRumAssembly;
var browser_core_1 = require("@datadog/browser-core");

@@ -15,12 +15,9 @@ var syntheticsContext_1 = require("./contexts/syntheticsContext");

};
var ROOT_MODIFIABLE_FIELD_PATHS = {
service: 'string',
version: 'string',
};
var modifiableFieldPathsByEvent;
function startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, displayContext, ciVisibilityContext, getCommonContext, reportError) {
var _a, _b;
// TODO: lift this declaration to module level once feature flag is removed
var ROOT_MODIFIABLE_FIELD_PATHS = (0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.MICRO_FRONTEND)
? {
service: 'string',
version: 'string',
}
: {};
modifiableFieldPathsByEvent = (_a = {},

@@ -69,3 +66,3 @@ _a["view" /* RumEventType.VIEW */] = VIEW_MODIFIABLE_FIELD_PATHS,

},
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.21.0" : undefined,
browser_sdk_version: (0, browser_core_1.canUseEventBridge)() ? "5.22.0" : undefined,
},

@@ -123,3 +120,2 @@ application: {

}
exports.startRumAssembly = startRumAssembly;
function shouldSend(event, beforeSend, domainContext, eventRateLimiters) {

@@ -126,0 +122,0 @@ var _a;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startCiVisibilityContext = exports.CI_VISIBILITY_TEST_ID_COOKIE_NAME = void 0;
exports.CI_VISIBILITY_TEST_ID_COOKIE_NAME = void 0;
exports.startCiVisibilityContext = startCiVisibilityContext;
var browser_core_1 = require("@datadog/browser-core");

@@ -25,3 +26,2 @@ var cookieObservable_1 = require("../../browser/cookieObservable");

}
exports.startCiVisibilityContext = startCiVisibilityContext;
//# sourceMappingURL=ciVisibilityContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildCommonContext = void 0;
exports.buildCommonContext = buildCommonContext;
function buildCommonContext(globalContextManager, userContextManager, recorderApi) {

@@ -11,3 +11,2 @@ return {

}
exports.buildCommonContext = buildCommonContext;
//# sourceMappingURL=commonContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startDisplayContext = void 0;
exports.startDisplayContext = startDisplayContext;
var viewportObservable_1 = require("../../browser/viewportObservable");

@@ -15,3 +15,2 @@ function startDisplayContext(configuration) {

}
exports.startDisplayContext = startDisplayContext;
//# sourceMappingURL=displayContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startFeatureFlagContexts = exports.BYTES_COMPUTATION_THROTTLING_DELAY = exports.FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = void 0;
exports.BYTES_COMPUTATION_THROTTLING_DELAY = exports.FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = void 0;
exports.startFeatureFlagContexts = startFeatureFlagContexts;
var browser_core_1 = require("@datadog/browser-core");

@@ -38,3 +39,2 @@ exports.FEATURE_FLAG_CONTEXT_TIME_OUT_DELAY = browser_core_1.SESSION_TIME_OUT_DELAY;

}
exports.startFeatureFlagContexts = startFeatureFlagContexts;
//# sourceMappingURL=featureFlagContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startInternalContext = void 0;
exports.startInternalContext = startInternalContext;
/**

@@ -26,3 +26,2 @@ * Internal context keep returning v1 format

}
exports.startInternalContext = startInternalContext;
//# sourceMappingURL=internalContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startPageStateHistory = exports.PAGE_STATE_CONTEXT_TIME_OUT_DELAY = exports.MAX_PAGE_STATE_ENTRIES_SELECTABLE = exports.MAX_PAGE_STATE_ENTRIES = void 0;
exports.PAGE_STATE_CONTEXT_TIME_OUT_DELAY = exports.MAX_PAGE_STATE_ENTRIES_SELECTABLE = exports.MAX_PAGE_STATE_ENTRIES = void 0;
exports.startPageStateHistory = startPageStateHistory;
var browser_core_1 = require("@datadog/browser-core");

@@ -70,3 +71,2 @@ // Arbitrary value to cap number of element for memory consumption in the browser

}
exports.startPageStateHistory = startPageStateHistory;
function computePageState(event) {

@@ -73,0 +73,0 @@ if (event.type === browser_core_1.DOM_EVENT.FREEZE) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSyntheticsContext = void 0;
exports.getSyntheticsContext = getSyntheticsContext;
var browser_core_1 = require("@datadog/browser-core");

@@ -16,3 +16,2 @@ function getSyntheticsContext() {

}
exports.getSyntheticsContext = getSyntheticsContext;
//# sourceMappingURL=syntheticsContext.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startUrlContexts = exports.URL_CONTEXT_TIME_OUT_DELAY = void 0;
exports.URL_CONTEXT_TIME_OUT_DELAY = void 0;
exports.startUrlContexts = startUrlContexts;
var browser_core_1 = require("@datadog/browser-core");

@@ -54,3 +55,2 @@ /**

}
exports.startUrlContexts = startUrlContexts;
//# sourceMappingURL=urlContexts.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startViewContexts = exports.VIEW_CONTEXT_TIME_OUT_DELAY = void 0;
exports.VIEW_CONTEXT_TIME_OUT_DELAY = void 0;
exports.startViewContexts = startViewContexts;
var browser_core_1 = require("@datadog/browser-core");

@@ -34,3 +35,2 @@ exports.VIEW_CONTEXT_TIME_OUT_DELAY = browser_core_1.SESSION_TIME_OUT_DELAY;

}
exports.startViewContexts = startViewContexts;
//# sourceMappingURL=viewContexts.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.discardNegativeDuration = void 0;
exports.discardNegativeDuration = discardNegativeDuration;
var browser_core_1 = require("@datadog/browser-core");

@@ -8,3 +8,2 @@ function discardNegativeDuration(duration) {

}
exports.discardNegativeDuration = discardNegativeDuration;
//# sourceMappingURL=discardNegativeDuration.js.map

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

export declare function startErrorCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, pageStateHistory: PageStateHistory, featureFlagContexts: FeatureFlagContexts): {
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext) => void;
};

@@ -17,0 +17,0 @@ export declare function doStartErrorCollection(lifeCycle: LifeCycle, pageStateHistory: PageStateHistory, featureFlagContexts: FeatureFlagContexts): {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doStartErrorCollection = exports.startErrorCollection = void 0;
exports.startErrorCollection = startErrorCollection;
exports.doStartErrorCollection = doStartErrorCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -15,3 +16,2 @@ var trackConsoleError_1 = require("./trackConsoleError");

}
exports.startErrorCollection = startErrorCollection;
function doStartErrorCollection(lifeCycle, pageStateHistory, featureFlagContexts) {

@@ -46,3 +46,2 @@ lifeCycle.subscribe(14 /* LifeCycleEventType.RAW_ERROR_COLLECTED */, function (_a) {

}
exports.doStartErrorCollection = doStartErrorCollection;
function processError(error, pageStateHistory, featureFlagContexts) {

@@ -73,6 +72,4 @@ var rawRumEvent = {

error: error.originalError,
handlingStack: error.handlingStack,
};
if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.MICRO_FRONTEND)) {
domainContext.handlingStack = error.handlingStack;
}
return {

@@ -79,0 +76,0 @@ rawRumEvent: rawRumEvent,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackConsoleError = void 0;
exports.trackConsoleError = trackConsoleError;
var browser_core_1 = require("@datadog/browser-core");

@@ -23,3 +23,2 @@ function trackConsoleError(errorObservable) {

}
exports.trackConsoleError = trackConsoleError;
//# sourceMappingURL=trackConsoleError.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackReportError = void 0;
exports.trackReportError = trackReportError;
var browser_core_1 = require("@datadog/browser-core");

@@ -32,3 +32,2 @@ function trackReportError(configuration, errorObservable) {

}
exports.trackReportError = trackReportError;
//# sourceMappingURL=trackReportError.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.supportScopeSelector = exports.isSelectorUniqueAmongSiblings = exports.getSelectorFromElement = exports.STABLE_ATTRIBUTES = void 0;
exports.STABLE_ATTRIBUTES = void 0;
exports.getSelectorFromElement = getSelectorFromElement;
exports.isSelectorUniqueAmongSiblings = isSelectorUniqueAmongSiblings;
exports.supportScopeSelector = supportScopeSelector;
var polyfills_1 = require("../browser/polyfills");

@@ -58,3 +61,2 @@ var getActionNameFromElement_1 = require("./action/getActionNameFromElement");

}
exports.getSelectorFromElement = getSelectorFromElement;
function isGeneratedValue(value) {

@@ -226,3 +228,2 @@ // To compute the "URL path group", the backend replaces every URL path parts as a question mark

}
exports.isSelectorUniqueAmongSiblings = isSelectorUniqueAmongSiblings;
function combineSelector(parent, child) {

@@ -244,3 +245,2 @@ return child ? "".concat(parent, ">").concat(child) : parent;

}
exports.supportScopeSelector = supportScopeSelector;
/**

@@ -247,0 +247,0 @@ * Polyfill-utility for the `isConnected` property not supported in IE11

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDatadogSiteUrl = exports.getSessionReplayUrl = void 0;
exports.getSessionReplayUrl = getSessionReplayUrl;
exports.getDatadogSiteUrl = getDatadogSiteUrl;
var browser_core_1 = require("@datadog/browser-core");

@@ -20,3 +21,2 @@ function getSessionReplayUrl(configuration, _a) {

}
exports.getSessionReplayUrl = getSessionReplayUrl;
function getDatadogSiteUrl(rumConfiguration) {

@@ -27,3 +27,2 @@ var site = rumConfiguration.site;

}
exports.getDatadogSiteUrl = getDatadogSiteUrl;
function getSiteDefaultSubdomain(configuration) {

@@ -30,0 +29,0 @@ switch (configuration.site) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.limitModification = void 0;
exports.limitModification = limitModification;
var browser_core_1 = require("@datadog/browser-core");

@@ -25,3 +25,2 @@ /**

}
exports.limitModification = limitModification;
function get(object, path) {

@@ -28,0 +27,0 @@ var current = object;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startLongTaskCollection = void 0;
exports.startLongTaskCollection = startLongTaskCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -36,3 +36,2 @@ var performanceCollection_1 = require("../../browser/performanceCollection");

}
exports.startLongTaskCollection = startLongTaskCollection;
//# sourceMappingURL=longTaskCollection.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackFetch = exports.trackXhr = exports.startRequestCollection = void 0;
exports.startRequestCollection = startRequestCollection;
exports.trackXhr = trackXhr;
exports.trackFetch = trackFetch;
var browser_core_1 = require("@datadog/browser-core");

@@ -13,3 +15,2 @@ var resourceUtils_1 = require("./resource/resourceUtils");

}
exports.startRequestCollection = startRequestCollection;
function trackXhr(lifeCycle, configuration, tracer) {

@@ -52,3 +53,2 @@ var subscription = (0, browser_core_1.initXhrObservable)(configuration).subscribe(function (rawContext) {

}
exports.trackXhr = trackXhr;
function trackFetch(lifeCycle, configuration, tracer) {

@@ -96,3 +96,2 @@ var subscription = (0, browser_core_1.initFetchObservable)().subscribe(function (rawContext) {

}
exports.trackFetch = trackFetch;
function getNextRequestIndex() {

@@ -99,0 +98,0 @@ var result = nextRequestIndex;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchRequestTiming = void 0;
exports.matchRequestTiming = matchRequestTiming;
var browser_core_1 = require("@datadog/browser-core");

@@ -41,3 +41,2 @@ var polyfills_1 = require("../../browser/polyfills");

}
exports.matchRequestTiming = matchRequestTiming;
function endTime(timing) {

@@ -44,0 +43,0 @@ return (0, browser_core_1.addDuration)(timing.startTime, timing.duration);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startResourceCollection = void 0;
exports.startResourceCollection = startResourceCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -27,3 +27,2 @@ var performanceCollection_1 = require("../../browser/performanceCollection");

}
exports.startResourceCollection = startResourceCollection;
function processRequest(request, configuration, pageStateHistory) {

@@ -54,3 +53,3 @@ var matchingTiming = (0, matchRequestTiming_1.matchRequestTiming)(request);

}, tracingInfo, correspondingTimingOverrides);
var collectedData = {
return {
startTime: startClocks.relative,

@@ -66,8 +65,5 @@ rawRumEvent: resourceEvent,

isAborted: request.isAborted,
handlingStack: request.handlingStack,
},
};
if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.MICRO_FRONTEND)) {
collectedData.domainContext.handlingStack = request.handlingStack;
}
return collectedData;
}

@@ -74,0 +70,0 @@ function processResourceEntry(entry, configuration) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sanitizeDataUrl = exports.isLongDataUrl = exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = exports.isAllowedRequestUrl = exports.computeSize = exports.isValidEntry = exports.computePerformanceResourceDetails = exports.computePerformanceResourceDuration = exports.isRequestKind = exports.computeResourceKind = exports.FAKE_INITIAL_DOCUMENT = void 0;
exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = exports.FAKE_INITIAL_DOCUMENT = void 0;
exports.computeResourceKind = computeResourceKind;
exports.isRequestKind = isRequestKind;
exports.computePerformanceResourceDuration = computePerformanceResourceDuration;
exports.computePerformanceResourceDetails = computePerformanceResourceDetails;
exports.isValidEntry = isValidEntry;
exports.computeSize = computeSize;
exports.isAllowedRequestUrl = isAllowedRequestUrl;
exports.isLongDataUrl = isLongDataUrl;
exports.sanitizeDataUrl = sanitizeDataUrl;
var browser_core_1 = require("@datadog/browser-core");

@@ -42,3 +51,2 @@ exports.FAKE_INITIAL_DOCUMENT = 'initial_document';

}
exports.computeResourceKind = computeResourceKind;
function areInOrder() {

@@ -59,3 +67,2 @@ var numbers = [];

}
exports.isRequestKind = isRequestKind;
function computePerformanceResourceDuration(entry) {

@@ -69,3 +76,2 @@ var duration = entry.duration, startTime = entry.startTime, responseEnd = entry.responseEnd;

}
exports.computePerformanceResourceDuration = computePerformanceResourceDuration;
function computePerformanceResourceDetails(entry) {

@@ -98,3 +104,2 @@ if (!isValidEntry(entry)) {

}
exports.computePerformanceResourceDetails = computePerformanceResourceDetails;
function isValidEntry(entry) {

@@ -114,3 +119,2 @@ if ((0, browser_core_1.isExperimentalFeatureEnabled)(browser_core_1.ExperimentalFeature.TOLERANT_RESOURCE_TIMINGS)) {

}
exports.isValidEntry = isValidEntry;
function hasRedirection(entry) {

@@ -145,7 +149,5 @@ return entry.redirectEnd > entry.startTime;

}
exports.computeSize = computeSize;
function isAllowedRequestUrl(configuration, url) {
return url && !configuration.isIntakeUrl(url);
}
exports.isAllowedRequestUrl = isAllowedRequestUrl;
var DATA_URL_REGEX = /data:(.+)?(;base64)?,/g;

@@ -164,7 +166,5 @@ exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 24000;

}
exports.isLongDataUrl = isLongDataUrl;
function sanitizeDataUrl(url) {
return "".concat(url.match(DATA_URL_REGEX)[0], "[...]");
}
exports.sanitizeDataUrl = sanitizeDataUrl;
//# sourceMappingURL=resourceUtils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumSessionManagerStub = exports.startRumSessionManager = exports.RUM_SESSION_KEY = void 0;
exports.RUM_SESSION_KEY = void 0;
exports.startRumSessionManager = startRumSessionManager;
exports.startRumSessionManagerStub = startRumSessionManagerStub;
var browser_core_1 = require("@datadog/browser-core");

@@ -43,3 +45,2 @@ exports.RUM_SESSION_KEY = 'rum';

}
exports.startRumSessionManager = startRumSessionManager;
/**

@@ -60,3 +61,2 @@ * Start a tracked replay session stub

}
exports.startRumSessionManagerStub = startRumSessionManagerStub;
function computeSessionState(configuration, rawTrackingType) {

@@ -63,0 +63,0 @@ var trackingType;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startCustomerDataTelemetry = exports.MEASURES_PERIOD_DURATION = void 0;
exports.MEASURES_PERIOD_DURATION = void 0;
exports.startCustomerDataTelemetry = startCustomerDataTelemetry;
var browser_core_1 = require("@datadog/browser-core");

@@ -43,3 +44,2 @@ exports.MEASURES_PERIOD_DURATION = 10 * browser_core_1.ONE_SECOND;

}
exports.startCustomerDataTelemetry = startCustomerDataTelemetry;
function sendCurrentPeriodMeasures() {

@@ -46,0 +46,0 @@ if (currentPeriodMeasures.batchCount === 0) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findTraceComment = exports.createDocumentTraceData = exports.getDocumentTraceDataFromComment = exports.getDocumentTraceDataFromMeta = exports.getDocumentTraceId = exports.INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD = void 0;
exports.INITIAL_DOCUMENT_OUTDATED_TRACE_ID_THRESHOLD = void 0;
exports.getDocumentTraceId = getDocumentTraceId;
exports.getDocumentTraceDataFromMeta = getDocumentTraceDataFromMeta;
exports.getDocumentTraceDataFromComment = getDocumentTraceDataFromComment;
exports.createDocumentTraceData = createDocumentTraceData;
exports.findTraceComment = findTraceComment;
var browser_core_1 = require("@datadog/browser-core");

@@ -14,3 +19,2 @@ var htmlDomUtils_1 = require("../../browser/htmlDomUtils");

}
exports.getDocumentTraceId = getDocumentTraceId;
function getDocumentTraceDataFromMeta(document) {

@@ -21,3 +25,2 @@ var traceIdMeta = document.querySelector('meta[name=dd-trace-id]');

}
exports.getDocumentTraceDataFromMeta = getDocumentTraceDataFromMeta;
function getDocumentTraceDataFromComment(document) {

@@ -30,3 +33,2 @@ var comment = findTraceComment(document);

}
exports.getDocumentTraceDataFromComment = getDocumentTraceDataFromComment;
function createDocumentTraceData(traceId, rawTraceTime) {

@@ -42,3 +44,2 @@ var traceTime = rawTraceTime && Number(rawTraceTime);

}
exports.createDocumentTraceData = createDocumentTraceData;
function findTraceComment(document) {

@@ -71,3 +72,2 @@ // 1. Try to find the comment as a direct child of the document

}
exports.findTraceComment = findTraceComment;
function getTraceCommentFromNode(node) {

@@ -74,0 +74,0 @@ if (node && (0, htmlDomUtils_1.isCommentNode)(node)) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraceIdentifier = exports.isTracingSupported = exports.startTracer = exports.clearTracingIfNeeded = exports.isTracingOption = void 0;
exports.TraceIdentifier = void 0;
exports.isTracingOption = isTracingOption;
exports.clearTracingIfNeeded = clearTracingIfNeeded;
exports.startTracer = startTracer;
exports.isTracingSupported = isTracingSupported;
var browser_core_1 = require("@datadog/browser-core");

@@ -11,3 +15,2 @@ function isTracingOption(item) {

}
exports.isTracingOption = isTracingOption;
/**

@@ -37,3 +40,2 @@ * Clear tracing information to avoid incomplete traces. Ideally, we should do it when the

}
exports.clearTracingIfNeeded = clearTracingIfNeeded;
function startTracer(configuration, sessionManager) {

@@ -83,3 +85,2 @@ return {

}
exports.startTracer = startTracer;
function injectHeadersIfTracingAllowed(configuration, context, sessionManager, inject) {

@@ -106,3 +107,2 @@ if (!isTracingSupported() || !sessionManager.findTrackedSession()) {

}
exports.isTracingSupported = isTracingSupported;
function getCrypto() {

@@ -109,0 +109,0 @@ return window.crypto || window.msCrypto;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackEventCounts = void 0;
exports.trackEventCounts = trackEventCounts;
var browser_core_1 = require("@datadog/browser-core");

@@ -50,3 +50,2 @@ function trackEventCounts(_a) {

}
exports.trackEventCounts = trackEventCounts;
//# sourceMappingURL=trackEventCounts.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackViewEventCounts = void 0;
exports.trackViewEventCounts = trackViewEventCounts;
var trackEventCounts_1 = require("../trackEventCounts");

@@ -16,3 +16,2 @@ function trackViewEventCounts(lifeCycle, viewId, onChange) {

}
exports.trackViewEventCounts = trackViewEventCounts;
//# sourceMappingURL=trackViewEventCounts.js.map

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

import type { LocationChange } from '../../browser/locationChangeObservable';
import type { RumConfiguration } from '../configuration';
import type { RumConfiguration, RumInitConfiguration } from '../configuration';
import type { InitialViewMetrics } from './viewMetrics/trackInitialViewMetrics';

@@ -44,4 +44,4 @@ import type { CommonViewMetrics } from './viewMetrics/trackCommonViewMetrics';

name?: string;
service?: string;
version?: string;
service?: RumInitConfiguration['service'];
version?: RumInitConfiguration['version'];
}

@@ -48,0 +48,0 @@ export declare function trackViews(location: Location, lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, locationChangeObservable: Observable<LocationChange>, areViewsTrackedAutomatically: boolean, initialViewOptions?: ViewOptions): {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackViews = exports.KEEP_TRACKING_AFTER_VIEW_DELAY = exports.SESSION_KEEP_ALIVE_INTERVAL = exports.THROTTLE_VIEW_UPDATE_PERIOD = void 0;
exports.KEEP_TRACKING_AFTER_VIEW_DELAY = exports.SESSION_KEEP_ALIVE_INTERVAL = exports.THROTTLE_VIEW_UPDATE_PERIOD = void 0;
exports.trackViews = trackViews;
var browser_core_1 = require("@datadog/browser-core");

@@ -77,3 +78,2 @@ var trackViewEventCounts_1 = require("./trackViewEventCounts");

}
exports.trackViews = trackViews;
function newView(lifeCycle, domMutationObservable, configuration, initialLocation, loadingType, startClocks, viewOptions) {

@@ -94,4 +94,4 @@ if (startClocks === void 0) { startClocks = (0, browser_core_1.clocksNow)(); }

name = viewOptions.name;
service = viewOptions.service;
version = viewOptions.version;
service = viewOptions.service || undefined;
version = viewOptions.version || undefined;
}

@@ -98,0 +98,0 @@ var viewCreatedEvent = {

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

export declare function startViewCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, location: Location, domMutationObservable: Observable<void>, locationChangeObservable: Observable<LocationChange>, featureFlagContexts: FeatureFlagContexts, pageStateHistory: PageStateHistory, recorderApi: RecorderApi, initialViewOptions?: ViewOptions): {
addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;
startView: (options?: ViewOptions | undefined, startClocks?: import("@datadog/browser-core").ClocksState | undefined) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").RelativeTime | import("@datadog/browser-core").TimeStamp) => void;
startView: (options?: ViewOptions, startClocks?: import("@datadog/browser-core").ClocksState) => void;
stop: () => void;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startViewCollection = void 0;
exports.startViewCollection = startViewCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -13,3 +13,2 @@ var discardNegativeDuration_1 = require("../discardNegativeDuration");

}
exports.startViewCollection = startViewCollection;
function processViewUpdate(view, configuration, featureFlagContexts, recorderApi, pageStateHistory) {

@@ -16,0 +15,0 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;

@@ -15,3 +15,4 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getInteractionCount = exports.initInteractionCountPolyfill = void 0;
exports.getInteractionCount = void 0;
exports.initInteractionCountPolyfill = initInteractionCountPolyfill;
var browser_core_1 = require("@datadog/browser-core");

@@ -38,3 +39,2 @@ var observer;

}
exports.initInteractionCountPolyfill = initInteractionCountPolyfill;
/**

@@ -41,0 +41,0 @@ * Returns the `interactionCount` value using the native API (if available)

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackCommonViewMetrics = void 0;
exports.trackCommonViewMetrics = trackCommonViewMetrics;
var trackCumulativeLayoutShift_1 = require("./trackCumulativeLayoutShift");

@@ -37,3 +37,2 @@ var trackInteractionToNextPaint_1 = require("./trackInteractionToNextPaint");

}
exports.trackCommonViewMetrics = trackCommonViewMetrics;
//# sourceMappingURL=trackCommonViewMetrics.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLayoutShiftSupported = exports.MAX_WINDOW_DURATION = exports.trackCumulativeLayoutShift = void 0;
exports.MAX_WINDOW_DURATION = void 0;
exports.trackCumulativeLayoutShift = trackCumulativeLayoutShift;
exports.isLayoutShiftSupported = isLayoutShiftSupported;
var browser_core_1 = require("@datadog/browser-core");

@@ -66,3 +68,2 @@ var htmlDomUtils_1 = require("../../../browser/htmlDomUtils");

}
exports.trackCumulativeLayoutShift = trackCumulativeLayoutShift;
function getTargetFromSource(sources) {

@@ -114,3 +115,2 @@ var _a;

}
exports.isLayoutShiftSupported = isLayoutShiftSupported;
//# sourceMappingURL=trackCumulativeLayoutShift.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackFirstContentfulPaint = exports.FCP_MAXIMUM_DELAY = void 0;
exports.FCP_MAXIMUM_DELAY = void 0;
exports.trackFirstContentfulPaint = trackFirstContentfulPaint;
var browser_core_1 = require("@datadog/browser-core");

@@ -25,3 +26,2 @@ var performanceCollection_1 = require("../../../browser/performanceCollection");

}
exports.trackFirstContentfulPaint = trackFirstContentfulPaint;
//# sourceMappingURL=trackFirstContentfulPaint.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackFirstHidden = void 0;
exports.trackFirstHidden = trackFirstHidden;
var browser_core_1 = require("@datadog/browser-core");

@@ -30,3 +30,2 @@ function trackFirstHidden(configuration, eventTarget) {

}
exports.trackFirstHidden = trackFirstHidden;
//# sourceMappingURL=trackFirstHidden.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackFirstInput = void 0;
exports.trackFirstInput = trackFirstInput;
var browser_core_1 = require("@datadog/browser-core");

@@ -40,3 +40,2 @@ var htmlDomUtils_1 = require("../../../browser/htmlDomUtils");

}
exports.trackFirstInput = trackFirstInput;
//# sourceMappingURL=trackFirstInput.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackInitialViewMetrics = void 0;
exports.trackInitialViewMetrics = trackInitialViewMetrics;
var trackFirstContentfulPaint_1 = require("./trackFirstContentfulPaint");

@@ -41,3 +41,2 @@ var trackFirstInput_1 = require("./trackFirstInput");

}
exports.trackInitialViewMetrics = trackInitialViewMetrics;
//# sourceMappingURL=trackInitialViewMetrics.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInteractionToNextPaintSupported = exports.trackViewInteractionCount = exports.trackInteractionToNextPaint = exports.MAX_INP_VALUE = void 0;
exports.MAX_INP_VALUE = void 0;
exports.trackInteractionToNextPaint = trackInteractionToNextPaint;
exports.trackViewInteractionCount = trackViewInteractionCount;
exports.isInteractionToNextPaintSupported = isInteractionToNextPaintSupported;
var browser_core_1 = require("@datadog/browser-core");

@@ -81,3 +84,2 @@ var performanceCollection_1 = require("../../../browser/performanceCollection");

}
exports.trackInteractionToNextPaint = trackInteractionToNextPaint;
function trackLongestInteractions(getViewInteractionCount) {

@@ -138,3 +140,2 @@ var longestInteractions = [];

}
exports.trackViewInteractionCount = trackViewInteractionCount;
function isInteractionToNextPaintSupported() {

@@ -145,3 +146,2 @@ return ((0, performanceCollection_1.supportPerformanceTimingEvent)(performanceCollection_1.RumPerformanceEntryType.EVENT) &&

}
exports.isInteractionToNextPaintSupported = isInteractionToNextPaintSupported;
//# sourceMappingURL=trackInteractionToNextPaint.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackLargestContentfulPaint = exports.LCP_MAXIMUM_DELAY = void 0;
exports.LCP_MAXIMUM_DELAY = void 0;
exports.trackLargestContentfulPaint = trackLargestContentfulPaint;
var browser_core_1 = require("@datadog/browser-core");

@@ -54,3 +55,2 @@ var performanceCollection_1 = require("../../../browser/performanceCollection");

}
exports.trackLargestContentfulPaint = trackLargestContentfulPaint;
//# sourceMappingURL=trackLargestContentfulPaint.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackLoadingTime = void 0;
exports.trackLoadingTime = trackLoadingTime;
var browser_core_1 = require("@datadog/browser-core");

@@ -35,3 +35,2 @@ var waitPageActivityEnd_1 = require("../../waitPageActivityEnd");

}
exports.trackLoadingTime = trackLoadingTime;
//# sourceMappingURL=trackLoadingTime.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.trackNavigationTimings = void 0;
exports.trackNavigationTimings = trackNavigationTimings;
var browser_core_1 = require("@datadog/browser-core");

@@ -27,3 +27,2 @@ var performanceCollection_1 = require("../../../browser/performanceCollection");

}
exports.trackNavigationTimings = trackNavigationTimings;
//# sourceMappingURL=trackNavigationTimings.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createScrollValuesObservable = exports.computeScrollValues = exports.trackScrollMetrics = exports.THROTTLE_SCROLL_DURATION = void 0;
exports.THROTTLE_SCROLL_DURATION = void 0;
exports.trackScrollMetrics = trackScrollMetrics;
exports.computeScrollValues = computeScrollValues;
exports.createScrollValuesObservable = createScrollValuesObservable;
var browser_core_1 = require("@datadog/browser-core");

@@ -40,3 +43,2 @@ var scroll_1 = require("../../../browser/scroll");

}
exports.trackScrollMetrics = trackScrollMetrics;
function computeScrollValues() {

@@ -53,3 +55,2 @@ var scrollTop = (0, scroll_1.getScrollY)();

}
exports.computeScrollValues = computeScrollValues;
function createScrollValuesObservable(configuration, throttleDuration) {

@@ -80,3 +81,2 @@ if (throttleDuration === void 0) { throttleDuration = exports.THROTTLE_SCROLL_DURATION; }

}
exports.createScrollValuesObservable = createScrollValuesObservable;
//# sourceMappingURL=trackScrollMetrics.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startVitalCollection = void 0;
exports.startVitalCollection = startVitalCollection;
var browser_core_1 = require("@datadog/browser-core");

@@ -31,3 +31,2 @@ function startVitalCollection(lifeCycle, pageStateHistory) {

}
exports.startVitalCollection = startVitalCollection;
function buildDurationVital(vitalStart, vitalStop) {

@@ -34,0 +33,0 @@ return {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPageActivityObservable = exports.doWaitPageActivityEnd = exports.waitPageActivityEnd = exports.PAGE_ACTIVITY_END_DELAY = exports.PAGE_ACTIVITY_VALIDATION_DELAY = void 0;
exports.PAGE_ACTIVITY_END_DELAY = exports.PAGE_ACTIVITY_VALIDATION_DELAY = void 0;
exports.waitPageActivityEnd = waitPageActivityEnd;
exports.doWaitPageActivityEnd = doWaitPageActivityEnd;
exports.createPageActivityObservable = createPageActivityObservable;
var browser_core_1 = require("@datadog/browser-core");

@@ -44,3 +47,2 @@ var performanceCollection_1 = require("../browser/performanceCollection");

}
exports.waitPageActivityEnd = waitPageActivityEnd;
function doWaitPageActivityEnd(pageActivityObservable, pageActivityEndCallback, maxDuration) {

@@ -78,3 +80,2 @@ var pageActivityEndTimeoutId;

}
exports.doWaitPageActivityEnd = doWaitPageActivityEnd;
function createPageActivityObservable(lifeCycle, domMutationObservable, configuration) {

@@ -118,3 +119,2 @@ return new browser_core_1.Observable(function (observable) {

}
exports.createPageActivityObservable = createPageActivityObservable;
function isExcludedUrl(configuration, requestUrl) {

@@ -121,0 +121,0 @@ return (0, browser_core_1.matchList)(configuration.excludedActivityUrls, requestUrl);

@@ -14,3 +14,3 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions } from './boot/rumPublicApi';

export { getScrollX, getScrollY } from './browser/scroll';
export { RumInitConfiguration, RumConfiguration } from './domain/configuration';
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration';
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement';

@@ -22,2 +22,4 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement';

export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils';
export * from './domain/privacy';
export { SessionReplayState } from './domain/rumSessionManager';
export type { RumPlugin } from './domain/plugins';

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

Object.defineProperty(exports, "MAX_ATTRIBUTE_VALUE_CHAR_LENGTH", { enumerable: true, get: function () { return resourceUtils_1.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH; } });
__exportStar(require("./domain/privacy"), exports);
//# sourceMappingURL=index.js.map

@@ -1007,2 +1007,10 @@ /**

/**
* Details of the vital. It can be used as a secondary identifier (URL, React component name...)
*/
readonly details?: string;
/**
* Duration of the vital in nanoseconds
*/
readonly duration?: number;
/**
* User custom vital.

@@ -1009,0 +1017,0 @@ */

@@ -7,5 +7,5 @@ import type { Context, TelemetryEvent, Observable, RawError, PageExitEvent, Encoder } from '@datadog/browser-core';

flushObservable: Observable<import("@datadog/browser-core").FlushEvent>;
add(message: Context, replicated?: boolean | undefined): void;
add(message: Context, replicated?: boolean): void;
upsert: (message: Context, key: string) => void;
stop: () => void;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumBatch = void 0;
exports.startRumBatch = startRumBatch;
var browser_core_1 = require("@datadog/browser-core");

@@ -26,3 +26,2 @@ function startRumBatch(configuration, lifeCycle, telemetryEventObservable, reportError, pageExitObservable, sessionExpireObservable, createEncoder) {

}
exports.startRumBatch = startRumBatch;
//# sourceMappingURL=startRumBatch.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumEventBridge = void 0;
exports.startRumEventBridge = startRumEventBridge;
var browser_core_1 = require("@datadog/browser-core");

@@ -11,3 +11,2 @@ function startRumEventBridge(lifeCycle) {

}
exports.startRumEventBridge = startRumEventBridge;
//# sourceMappingURL=startRumEventBridge.js.map

@@ -1,4 +0,5 @@

import { BoundedBuffer, display, canUseEventBridge, displayAlreadyInitializedError, willSyntheticsInjectRum, noop, timeStampNow, clocksNow, assign, getEventBridge, addTelemetryConfiguration, initFeatureFlags, } from '@datadog/browser-core';
import { BoundedBuffer, display, canUseEventBridge, displayAlreadyInitializedError, willSyntheticsInjectRum, noop, timeStampNow, clocksNow, assign, getEventBridge, ExperimentalFeature, isExperimentalFeatureEnabled, initFeatureFlags, addTelemetryConfiguration, } from '@datadog/browser-core';
import { validateAndBuildRumConfiguration, } from '../domain/configuration';
import { serializeRumConfiguration } from '../domain/configuration';
import { fetchAndApplyRemoteConfiguration, serializeRumConfiguration } from '../domain/configuration';
import { callPluginsMethod } from '../domain/plugins';
export function createPreStartStrategy(_a, getCommonContext, trackingConsentState, doStartRum) {

@@ -34,4 +35,39 @@ var ignoreInitIfSyntheticsWillInjectRum = _a.ignoreInitIfSyntheticsWillInjectRum, startDeflateWorker = _a.startDeflateWorker;

}
function doInit(initConfiguration) {
var eventBridgeAvailable = canUseEventBridge();
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration);
}
// Update the exposed initConfiguration to reflect the bridge and remote configuration overrides
cachedInitConfiguration = initConfiguration;
addTelemetryConfiguration(serializeRumConfiguration(initConfiguration));
if (cachedConfiguration) {
displayAlreadyInitializedError('DD_RUM', initConfiguration);
return;
}
var configuration = validateAndBuildRumConfiguration(initConfiguration);
if (!configuration) {
return;
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
display.warn('No storage available for session. We will not send any data.');
return;
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(configuration, 'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
noop);
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return;
}
}
cachedConfiguration = configuration;
trackingConsentState.tryToInit(configuration.trackingConsent);
tryStartRum();
}
return {
init: function (initConfiguration) {
init: function (initConfiguration, publicApi) {
if (!initConfiguration) {

@@ -43,13 +79,4 @@ display.error('Missing configuration');

initFeatureFlags(initConfiguration.enableExperimentalFeatures);
var eventBridgeAvailable = canUseEventBridge();
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration);
}
// Expose the initial configuration regardless of initialization success.
cachedInitConfiguration = initConfiguration;
addTelemetryConfiguration(serializeRumConfiguration(initConfiguration));
if (cachedConfiguration) {
displayAlreadyInitializedError('DD_RUM', initConfiguration);
return;
}
// If we are in a Synthetics test configured to automatically inject a RUM instance, we want

@@ -62,24 +89,12 @@ // to completely discard the customer application RUM instance by ignoring their init() call.

}
var configuration = validateAndBuildRumConfiguration(initConfiguration);
if (!configuration) {
return;
if (isExperimentalFeatureEnabled(ExperimentalFeature.PLUGINS)) {
callPluginsMethod(initConfiguration.plugins, 'onInit', { initConfiguration: initConfiguration, publicApi: publicApi });
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
display.warn('No storage available for session. We will not send any data.');
return;
if (initConfiguration.remoteConfigurationId &&
isExperimentalFeatureEnabled(ExperimentalFeature.REMOTE_CONFIGURATION)) {
fetchAndApplyRemoteConfiguration(initConfiguration, doInit);
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(configuration, 'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
noop);
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return;
}
else {
doInit(initConfiguration);
}
cachedConfiguration = configuration;
trackingConsentState.tryToInit(configuration.trackingConsent);
tryStartRum();
},

@@ -86,0 +101,0 @@ get initConfiguration() {

@@ -204,3 +204,3 @@ import type { Context, User, DeflateWorker, DeflateEncoderStreamId, DeflateEncoder, TrackingConsent, PublicApi } from '@datadog/browser-core';

export interface Strategy {
init: (initConfiguration: RumInitConfiguration) => void;
init: (initConfiguration: RumInitConfiguration, publicApi: RumPublicApi) => void;
initConfiguration: RumInitConfiguration | undefined;

@@ -207,0 +207,0 @@ getInternalContext: StartRumResult['getInternalContext'];

@@ -59,3 +59,3 @@ import { addTelemetryUsage, timeStampToClocks, isExperimentalFeatureEnabled, ExperimentalFeature, assign, createContextManager, deepClone, makePublicApi, monitor, clocksNow, callMonitored, createHandlingStack, checkUser, sanitizeUser, sanitize, createIdentityEncoder, createCustomerDataTrackerManager, storeContextManager, displayAlreadyInitializedError, createTrackingConsentState, } from '@datadog/browser-core';

var rumPublicApi = makePublicApi({
init: monitor(function (initConfiguration) { return strategy.init(initConfiguration); }),
init: monitor(function (initConfiguration) { return strategy.init(initConfiguration, rumPublicApi); }),
setTrackingConsent: monitor(function (trackingConsent) {

@@ -62,0 +62,0 @@ trackingConsentState.update(trackingConsent);

@@ -12,7 +12,7 @@ import type { Observable, RawError, DeflateEncoderStreamId, Encoder, CustomerDataTrackerManager, TrackingConsentState } from '@datadog/browser-core';

export declare function startRum(configuration: RumConfiguration, recorderApi: RecorderApi, customerDataTrackerManager: CustomerDataTrackerManager, getCommonContext: () => CommonContext, initialViewOptions: ViewOptions | undefined, createEncoder: (streamId: DeflateEncoderStreamId) => Encoder, trackingConsentState: TrackingConsentState): {
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: import("../domain/error/errorCollection").ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: import("../domain/error/errorCollection").ProvidedError, savedCommonContext?: CommonContext) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").RelativeTime | import("@datadog/browser-core").TimeStamp) => void;
addFeatureFlagEvaluation: (key: string, value: import("@datadog/browser-core").ContextValue) => void;
startView: (options?: ViewOptions | undefined, startClocks?: import("@datadog/browser-core").ClocksState | undefined) => void;
startView: (options?: ViewOptions, startClocks?: import("@datadog/browser-core").ClocksState) => void;
lifeCycle: import("@datadog/browser-core").AbstractLifeCycle<import("../domain/lifeCycle").LifeCycleEventMap>;

@@ -22,3 +22,3 @@ viewContexts: import("../domain/contexts/viewContexts").ViewContexts;

stopSession: () => void;
getInternalContext: (startTime?: number | undefined) => import("../domain/contexts/internalContext").InternalContext | undefined;
getInternalContext: (startTime?: number) => import("../domain/contexts/internalContext").InternalContext | undefined;
startDurationVital: (vitalStart: import("../domain/vital/vitalCollection").DurationVitalStart) => void;

@@ -32,8 +32,8 @@ stopDurationVital: (vitalStop: import("../domain/vital/vitalCollection").DurationVitalStop) => void;

urlContexts: {
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime | undefined) => import("../domain/contexts/urlContexts").UrlContext | undefined;
findUrl: (startTime?: import("@datadog/browser-core").RelativeTime) => import("../domain/contexts/urlContexts").UrlContext | undefined;
stop: () => void;
};
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext | undefined) => void;
addAction: (action: import("../domain/action/actionCollection").CustomAction, savedCommonContext?: CommonContext) => void;
actionContexts: import("../domain/action/trackClickActions").ActionContexts;
stop: () => void;
};

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

import { noop, assign, combine, toServerDuration, generateUUID, isExperimentalFeatureEnabled, ExperimentalFeature, } from '@datadog/browser-core';
import { noop, assign, combine, toServerDuration, generateUUID } from '@datadog/browser-core';
import { discardNegativeDuration } from '../discardNegativeDuration';

@@ -62,5 +62,3 @@ import { trackClickActions } from './trackClickActions';

var domainContext = isAutoAction(action) ? { events: action.events } : {};
if (!isAutoAction(action) &&
action.handlingStack &&
isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {
if (!isAutoAction(action) && action.handlingStack) {
domainContext.handlingStack = action.handlingStack;

@@ -67,0 +65,0 @@ }

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

import { NodePrivacyLevel } from '../privacy';
import type { RumConfiguration } from '../configuration';
/**

@@ -6,2 +8,3 @@ * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.

export declare const DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = "data-dd-action-name";
export declare function getActionNameFromElement(element: Element, userProgrammaticAttribute?: string): string;
export declare const ACTION_NAME_PLACEHOLDER = "Masked Element";
export declare function getActionNameFromElement(element: Element, { enablePrivacyForActionName, actionNameAttribute: userProgrammaticAttribute }: RumConfiguration, nodePrivacyLevel?: NodePrivacyLevel): string;
import { safeTruncate, isIE, find } from '@datadog/browser-core';
import { getParentElement } from '../../browser/polyfills';
import { NodePrivacyLevel, getPrivacySelector } from '../privacy';
/**

@@ -8,3 +9,5 @@ * Get the action name from the attribute 'data-dd-action-name' on the element or any of its parent.

export var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-dd-action-name';
export function getActionNameFromElement(element, userProgrammaticAttribute) {
export var ACTION_NAME_PLACEHOLDER = 'Masked Element';
export function getActionNameFromElement(element, _a, nodePrivacyLevel) {
var enablePrivacyForActionName = _a.enablePrivacyForActionName, userProgrammaticAttribute = _a.actionNameAttribute;
// Proceed to get the action name in two steps:

@@ -16,6 +19,10 @@ // * first, get the name programmatically, explicitly defined by the user.

// Those are much likely to succeed.
return (getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute)) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies) ||
var defaultActionName = getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute));
if (nodePrivacyLevel === NodePrivacyLevel.MASK) {
return defaultActionName || ACTION_NAME_PLACEHOLDER;
}
return (defaultActionName ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies, enablePrivacyForActionName) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies, enablePrivacyForActionName) ||
'');

@@ -50,3 +57,3 @@ }

// associated LABEL text
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacy) {
// IE does not support element.labels, so we fallback to a CSS selector based on the element id

@@ -62,3 +69,3 @@ // instead

find(element.ownerDocument.querySelectorAll('label'), function (label) { return label.htmlFor === element.id; });
return label && getTextualContent(label, userProgrammaticAttribute);
return label && getTextualContent(label, userProgrammaticAttribute, privacy);
}

@@ -77,5 +84,5 @@ },

// BUTTON, LABEL or button-like element text
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {
return getTextualContent(element, userProgrammaticAttribute);
return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName);
}

@@ -85,3 +92,3 @@ },

// associated element text designated by the aria-labelledby attribute
function (element, userProgrammaticAttribute) {
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
var labelledByAttribute = element.getAttribute('aria-labelledby');

@@ -93,3 +100,3 @@ if (labelledByAttribute) {

.filter(function (label) { return Boolean(label); })
.map(function (element) { return getTextualContent(element, userProgrammaticAttribute); })
.map(function (element) { return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName); })
.join(' ');

@@ -110,3 +117,5 @@ }

var fallbackStrategies = [
function (element, userProgrammaticAttribute) { return getTextualContent(element, userProgrammaticAttribute); },
function (element, userProgrammaticAttribute, privacyEnabledActionName) {
return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName);
},
];

@@ -118,3 +127,3 @@ /**

var MAX_PARENTS_TO_CONSIDER = 10;
function getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies) {
function getActionNameFromElementForStrategies(targetElement, userProgrammaticAttribute, strategies, privacyEnabledActionName) {
var element = targetElement;

@@ -129,3 +138,3 @@ var recursionCounter = 0;

var strategy = strategies_1[_i];
var name_1 = strategy(element, userProgrammaticAttribute);
var name_1 = strategy(element, userProgrammaticAttribute, privacyEnabledActionName);
if (typeof name_1 === 'string') {

@@ -158,3 +167,3 @@ var trimmedName = name_1.trim();

}
function getTextualContent(element, userProgrammaticAttribute) {
function getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName) {
if (element.isContentEditable) {

@@ -187,2 +196,6 @@ return;

}
if (privacyEnabledActionName) {
// remove the text of elements with privacy override
removeTextFromElements("".concat(getPrivacySelector(NodePrivacyLevel.HIDDEN), ", ").concat(getPrivacySelector(NodePrivacyLevel.MASK)));
}
return text_1;

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

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

import { ActionType } from '../../rawRumEvent.types';
import type { LifeCycle } from '../lifeCycle';
import type { RumConfiguration } from '../configuration';
import type { LifeCycle } from '../lifeCycle';
import type { MouseEventOnElement, UserActivity } from './listenActionEvents';

@@ -9,0 +9,0 @@ interface ActionCounts {

@@ -5,2 +5,3 @@ import { includes, timeStampNow, Observable, assign, getRelativeTime, ONE_MINUTE, ValueHistory, generateUUID, clocksNow, ONE_SECOND, elapsed, } from '@datadog/browser-core';

import { getSelectorFromElement } from '../getSelectorFromElement';
import { getNodePrivacyLevel, NodePrivacyLevel } from '../privacy';
import { createClickChain } from './clickChain';

@@ -27,3 +28,3 @@ import { getActionNameFromElement } from './getActionNameFromElement';

var clickActionBase = _a.clickActionBase, hadActivityOnPointerDown = _a.hadActivityOnPointerDown;
return startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);
startClickAction(configuration, lifeCycle, domMutationObservable, history, stopObservable, appendClickToClickChain, clickActionBase, startEvent, getUserActivity, hadActivityOnPointerDown);
},

@@ -57,3 +58,9 @@ }).stop;

function processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent) {
var clickActionBase = computeClickActionBase(pointerDownEvent, configuration.actionNameAttribute);
var nodePrivacyLevel = configuration.enablePrivacyForActionName
? getNodePrivacyLevel(pointerDownEvent.target, configuration.defaultPrivacyLevel)
: NodePrivacyLevel.ALLOW;
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
return undefined;
}
var clickActionBase = computeClickActionBase(pointerDownEvent, nodePrivacyLevel, configuration);
var hadActivityOnPointerDown = false;

@@ -104,3 +111,3 @@ waitPageActivityEnd(lifeCycle, domMutationObservable, configuration, function (pageActivityEndEvent) {

}
function computeClickActionBase(event, actionNameAttribute) {
function computeClickActionBase(event, nodePrivacyLevel, configuration) {
var rect = event.target.getBoundingClientRect();

@@ -112,3 +119,3 @@ return {

height: Math.round(rect.height),
selector: getSelectorFromElement(event.target, actionNameAttribute),
selector: getSelectorFromElement(event.target, configuration.actionNameAttribute),
},

@@ -120,3 +127,3 @@ position: {

},
name: getActionNameFromElement(event.target, actionNameAttribute),
name: getActionNameFromElement(event.target, configuration, nodePrivacyLevel),
};

@@ -123,0 +130,0 @@ }

@@ -12,12 +12,9 @@ import { combine, isEmptyObject, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, assign, round, isExperimentalFeatureEnabled, ExperimentalFeature, getConnectivity, } from '@datadog/browser-core';

};
var ROOT_MODIFIABLE_FIELD_PATHS = {
service: 'string',
version: 'string',
};
var modifiableFieldPathsByEvent;
export function startRumAssembly(configuration, lifeCycle, sessionManager, viewContexts, urlContexts, actionContexts, displayContext, ciVisibilityContext, getCommonContext, reportError) {
var _a, _b;
// TODO: lift this declaration to module level once feature flag is removed
var ROOT_MODIFIABLE_FIELD_PATHS = isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)
? {
service: 'string',
version: 'string',
}
: {};
modifiableFieldPathsByEvent = (_a = {},

@@ -66,3 +63,3 @@ _a["view" /* RumEventType.VIEW */] = VIEW_MODIFIABLE_FIELD_PATHS,

},
browser_sdk_version: canUseEventBridge() ? "5.21.0" : undefined,
browser_sdk_version: canUseEventBridge() ? "5.22.0" : undefined,
},

@@ -69,0 +66,0 @@ application: {

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

export declare function startErrorCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, pageStateHistory: PageStateHistory, featureFlagContexts: FeatureFlagContexts): {
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext | undefined) => void;
addError: ({ error, handlingStack, startClocks, context: customerContext }: ProvidedError, savedCommonContext?: CommonContext) => void;
};

@@ -17,0 +17,0 @@ export declare function doStartErrorCollection(lifeCycle: LifeCycle, pageStateHistory: PageStateHistory, featureFlagContexts: FeatureFlagContexts): {

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

import { isEmptyObject, assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, isExperimentalFeatureEnabled, ExperimentalFeature, } from '@datadog/browser-core';
import { isEmptyObject, assign, ErrorSource, generateUUID, computeRawError, computeStackTrace, Observable, trackRuntimeError, } from '@datadog/browser-core';
import { trackConsoleError } from './trackConsoleError';

@@ -66,6 +66,4 @@ import { trackReportError } from './trackReportError';

error: error.originalError,
handlingStack: error.handlingStack,
};
if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {
domainContext.handlingStack = error.handlingStack;
}
return {

@@ -72,0 +70,0 @@ rawRumEvent: rawRumEvent,

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

import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, ExperimentalFeature, isExperimentalFeatureEnabled, } from '@datadog/browser-core';
import { combine, generateUUID, toServerDuration, relativeToClocks, assign, isNumber, } from '@datadog/browser-core';
import { RumPerformanceEntryType } from '../../browser/performanceCollection';

@@ -49,3 +49,3 @@ import { matchRequestTiming } from './matchRequestTiming';

}, tracingInfo, correspondingTimingOverrides);
var collectedData = {
return {
startTime: startClocks.relative,

@@ -61,8 +61,5 @@ rawRumEvent: resourceEvent,

isAborted: request.isAborted,
handlingStack: request.handlingStack,
},
};
if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {
collectedData.domainContext.handlingStack = request.handlingStack;
}
return collectedData;
}

@@ -69,0 +66,0 @@ function processResourceEntry(entry, configuration) {

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

import type { LocationChange } from '../../browser/locationChangeObservable';
import type { RumConfiguration } from '../configuration';
import type { RumConfiguration, RumInitConfiguration } from '../configuration';
import type { InitialViewMetrics } from './viewMetrics/trackInitialViewMetrics';

@@ -44,4 +44,4 @@ import type { CommonViewMetrics } from './viewMetrics/trackCommonViewMetrics';

name?: string;
service?: string;
version?: string;
service?: RumInitConfiguration['service'];
version?: RumInitConfiguration['version'];
}

@@ -48,0 +48,0 @@ export declare function trackViews(location: Location, lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, locationChangeObservable: Observable<LocationChange>, areViewsTrackedAutomatically: boolean, initialViewOptions?: ViewOptions): {

@@ -89,4 +89,4 @@ import { noop, PageExitReason, shallowClone, elapsed, generateUUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, display, looksLikeRelativeTime, setInterval, clearInterval, setTimeout, Observable, } from '@datadog/browser-core';

name = viewOptions.name;
service = viewOptions.service;
version = viewOptions.version;
service = viewOptions.service || undefined;
version = viewOptions.version || undefined;
}

@@ -93,0 +93,0 @@ var viewCreatedEvent = {

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

export declare function startViewCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, location: Location, domMutationObservable: Observable<void>, locationChangeObservable: Observable<LocationChange>, featureFlagContexts: FeatureFlagContexts, pageStateHistory: PageStateHistory, recorderApi: RecorderApi, initialViewOptions?: ViewOptions): {
addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;
startView: (options?: ViewOptions | undefined, startClocks?: import("@datadog/browser-core").ClocksState | undefined) => void;
addTiming: (name: string, time?: import("@datadog/browser-core").RelativeTime | import("@datadog/browser-core").TimeStamp) => void;
startView: (options?: ViewOptions, startClocks?: import("@datadog/browser-core").ClocksState) => void;
stop: () => void;
};

@@ -14,3 +14,3 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions } from './boot/rumPublicApi';

export { getScrollX, getScrollY } from './browser/scroll';
export { RumInitConfiguration, RumConfiguration } from './domain/configuration';
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration';
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement';

@@ -22,2 +22,4 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement';

export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils';
export * from './domain/privacy';
export { SessionReplayState } from './domain/rumSessionManager';
export type { RumPlugin } from './domain/plugins';

@@ -14,2 +14,3 @@ export { makeRumPublicApi } from './boot/rumPublicApi';

export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils';
export * from './domain/privacy';
//# sourceMappingURL=index.js.map

@@ -1007,2 +1007,10 @@ /**

/**
* Details of the vital. It can be used as a secondary identifier (URL, React component name...)
*/
readonly details?: string;
/**
* Duration of the vital in nanoseconds
*/
readonly duration?: number;
/**
* User custom vital.

@@ -1009,0 +1017,0 @@ */

@@ -7,5 +7,5 @@ import type { Context, TelemetryEvent, Observable, RawError, PageExitEvent, Encoder } from '@datadog/browser-core';

flushObservable: Observable<import("@datadog/browser-core").FlushEvent>;
add(message: Context, replicated?: boolean | undefined): void;
add(message: Context, replicated?: boolean): void;
upsert: (message: Context, key: string) => void;
stop: () => void;
};
{
"name": "@datadog/browser-rum-core",
"version": "5.21.0",
"version": "5.22.0",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "5.21.0"
"@datadog/browser-core": "5.22.0"
},

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

},
"gitHead": "717e92a496147b5e5f4e0e23e56984944a9c0493"
"gitHead": "35c6150b014fc5c0d594730de6eef0fadd851ebf"
}

@@ -12,4 +12,6 @@ import {

getEventBridge,
ExperimentalFeature,
isExperimentalFeatureEnabled,
initFeatureFlags,
addTelemetryConfiguration,
initFeatureFlags,
} from '@datadog/browser-core'

@@ -24,3 +26,4 @@ import type { TrackingConsentState, DeflateWorker } from '@datadog/browser-core'

import type { ViewOptions } from '../domain/view/trackViews'
import { serializeRumConfiguration } from '../domain/configuration'
import { fetchAndApplyRemoteConfiguration, serializeRumConfiguration } from '../domain/configuration'
import { callPluginsMethod } from '../domain/plugins'
import type { RumPublicApiOptions, Strategy } from './rumPublicApi'

@@ -78,4 +81,49 @@ import type { StartRumResult } from './startRum'

function doInit(initConfiguration: RumInitConfiguration) {
const eventBridgeAvailable = canUseEventBridge()
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration)
}
// Update the exposed initConfiguration to reflect the bridge and remote configuration overrides
cachedInitConfiguration = initConfiguration
addTelemetryConfiguration(serializeRumConfiguration(initConfiguration))
if (cachedConfiguration) {
displayAlreadyInitializedError('DD_RUM', initConfiguration)
return
}
const configuration = validateAndBuildRumConfiguration(initConfiguration)
if (!configuration) {
return
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
display.warn('No storage available for session. We will not send any data.')
return
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(
configuration,
'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
noop
)
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return
}
}
cachedConfiguration = configuration
trackingConsentState.tryToInit(configuration.trackingConsent)
tryStartRum()
}
return {
init(initConfiguration) {
init(initConfiguration, publicApi) {
if (!initConfiguration) {

@@ -85,20 +133,8 @@ display.error('Missing configuration')

}
// Set the experimental feature flags as early as possible, so we can use them in most places
initFeatureFlags(initConfiguration.enableExperimentalFeatures)
const eventBridgeAvailable = canUseEventBridge()
if (eventBridgeAvailable) {
initConfiguration = overrideInitConfigurationForBridge(initConfiguration)
}
// Expose the initial configuration regardless of initialization success.
cachedInitConfiguration = initConfiguration
addTelemetryConfiguration(serializeRumConfiguration(initConfiguration))
if (cachedConfiguration) {
displayAlreadyInitializedError('DD_RUM', initConfiguration)
return
}
// If we are in a Synthetics test configured to automatically inject a RUM instance, we want

@@ -112,30 +148,14 @@ // to completely discard the customer application RUM instance by ignoring their init() call.

const configuration = validateAndBuildRumConfiguration(initConfiguration)
if (!configuration) {
return
if (isExperimentalFeatureEnabled(ExperimentalFeature.PLUGINS)) {
callPluginsMethod(initConfiguration.plugins, 'onInit', { initConfiguration, publicApi })
}
if (!eventBridgeAvailable && !configuration.sessionStoreStrategyType) {
display.warn('No storage available for session. We will not send any data.')
return
if (
initConfiguration.remoteConfigurationId &&
isExperimentalFeatureEnabled(ExperimentalFeature.REMOTE_CONFIGURATION)
) {
fetchAndApplyRemoteConfiguration(initConfiguration, doInit)
} else {
doInit(initConfiguration)
}
if (configuration.compressIntakeRequests && !eventBridgeAvailable && startDeflateWorker) {
deflateWorker = startDeflateWorker(
configuration,
'Datadog RUM',
// Worker initialization can fail asynchronously, especially in Firefox where even CSP
// issues are reported asynchronously. For now, the SDK will continue its execution even if
// data won't be sent to Datadog. We could improve this behavior in the future.
noop
)
if (!deflateWorker) {
// `startDeflateWorker` should have logged an error message explaining the issue
return
}
}
cachedConfiguration = configuration
trackingConsentState.tryToInit(configuration.trackingConsent)
tryStartRum()
},

@@ -142,0 +162,0 @@

@@ -282,3 +282,3 @@ import type {

export interface Strategy {
init: (initConfiguration: RumInitConfiguration) => void
init: (initConfiguration: RumInitConfiguration, publicApi: RumPublicApi) => void
initConfiguration: RumInitConfiguration | undefined

@@ -400,4 +400,4 @@ getInternalContext: StartRumResult['getInternalContext']

})
const rumPublicApi = makePublicApi<RumPublicApi>({
init: monitor((initConfiguration) => strategy.init(initConfiguration)),
const rumPublicApi: RumPublicApi = makePublicApi<RumPublicApi>({
init: monitor((initConfiguration) => strategy.init(initConfiguration, rumPublicApi)),

@@ -404,0 +404,0 @@ setTrackingConsent: monitor((trackingConsent) => {

import type { ClocksState, Context, Observable } from '@datadog/browser-core'
import {
noop,
assign,
combine,
toServerDuration,
generateUUID,
isExperimentalFeatureEnabled,
ExperimentalFeature,
} from '@datadog/browser-core'
import { noop, assign, combine, toServerDuration, generateUUID } from '@datadog/browser-core'

@@ -117,7 +109,3 @@ import { discardNegativeDuration } from '../discardNegativeDuration'

if (
!isAutoAction(action) &&
action.handlingStack &&
isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)
) {
if (!isAutoAction(action) && action.handlingStack) {
domainContext.handlingStack = action.handlingStack

@@ -124,0 +112,0 @@ }

import { safeTruncate, isIE, find } from '@datadog/browser-core'
import { getParentElement } from '../../browser/polyfills'
import { NodePrivacyLevel, getPrivacySelector } from '../privacy'
import type { RumConfiguration } from '../configuration'

@@ -9,4 +11,8 @@ /**

export const DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-dd-action-name'
export function getActionNameFromElement(element: Element, userProgrammaticAttribute?: string): string {
export const ACTION_NAME_PLACEHOLDER = 'Masked Element'
export function getActionNameFromElement(
element: Element,
{ enablePrivacyForActionName, actionNameAttribute: userProgrammaticAttribute }: RumConfiguration,
nodePrivacyLevel?: NodePrivacyLevel
): string {
// Proceed to get the action name in two steps:

@@ -18,7 +24,24 @@ // * first, get the name programmatically, explicitly defined by the user.

// Those are much likely to succeed.
const defaultActionName =
getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute))
if (nodePrivacyLevel === NodePrivacyLevel.MASK) {
return defaultActionName || ACTION_NAME_PLACEHOLDER
}
return (
getActionNameFromElementProgrammatically(element, DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
(userProgrammaticAttribute && getActionNameFromElementProgrammatically(element, userProgrammaticAttribute)) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, priorityStrategies) ||
getActionNameFromElementForStrategies(element, userProgrammaticAttribute, fallbackStrategies) ||
defaultActionName ||
getActionNameFromElementForStrategies(
element,
userProgrammaticAttribute,
priorityStrategies,
enablePrivacyForActionName
) ||
getActionNameFromElementForStrategies(
element,
userProgrammaticAttribute,
fallbackStrategies,
enablePrivacyForActionName
) ||
''

@@ -56,3 +79,4 @@ )

element: Element | HTMLElement | HTMLInputElement | HTMLSelectElement,
userProgrammaticAttribute: string | undefined
userProgrammaticAttribute: string | undefined,
privacyEnabledActionName?: boolean
) => string | undefined | null

@@ -62,3 +86,3 @@

// associated LABEL text
(element, userProgrammaticAttribute) => {
(element, userProgrammaticAttribute, privacy) => {
// IE does not support element.labels, so we fallback to a CSS selector based on the element id

@@ -74,3 +98,3 @@ // instead

find(element.ownerDocument.querySelectorAll('label'), (label) => label.htmlFor === element.id)
return label && getTextualContent(label, userProgrammaticAttribute)
return label && getTextualContent(label, userProgrammaticAttribute, privacy)
}

@@ -89,5 +113,5 @@ },

// BUTTON, LABEL or button-like element text
(element, userProgrammaticAttribute) => {
(element, userProgrammaticAttribute, privacyEnabledActionName) => {
if (element.nodeName === 'BUTTON' || element.nodeName === 'LABEL' || element.getAttribute('role') === 'button') {
return getTextualContent(element, userProgrammaticAttribute)
return getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName)
}

@@ -97,3 +121,3 @@ },

// associated element text designated by the aria-labelledby attribute
(element, userProgrammaticAttribute) => {
(element, userProgrammaticAttribute, privacyEnabledActionName) => {
const labelledByAttribute = element.getAttribute('aria-labelledby')

@@ -105,3 +129,3 @@ if (labelledByAttribute) {

.filter((label): label is HTMLElement => Boolean(label))
.map((element) => getTextualContent(element, userProgrammaticAttribute))
.map((element) => getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName))
.join(' ')

@@ -123,3 +147,4 @@ }

const fallbackStrategies: NameStrategy[] = [
(element, userProgrammaticAttribute) => getTextualContent(element, userProgrammaticAttribute),
(element, userProgrammaticAttribute, privacyEnabledActionName) =>
getTextualContent(element, userProgrammaticAttribute, privacyEnabledActionName),
]

@@ -135,3 +160,4 @@

userProgrammaticAttribute: string | undefined,
strategies: NameStrategy[]
strategies: NameStrategy[],
privacyEnabledActionName?: boolean
) {

@@ -148,3 +174,3 @@ let element: Element | null = targetElement

for (const strategy of strategies) {
const name = strategy(element, userProgrammaticAttribute)
const name = strategy(element, userProgrammaticAttribute, privacyEnabledActionName)
if (typeof name === 'string') {

@@ -181,3 +207,7 @@ const trimmedName = name.trim()

function getTextualContent(element: Element | HTMLElement, userProgrammaticAttribute: string | undefined) {
function getTextualContent(
element: Element | HTMLElement,
userProgrammaticAttribute: string | undefined,
privacyEnabledActionName?: boolean
) {
if ((element as HTMLElement).isContentEditable) {

@@ -216,2 +246,9 @@ return

if (privacyEnabledActionName) {
// remove the text of elements with privacy override
removeTextFromElements(
`${getPrivacySelector(NodePrivacyLevel.HIDDEN)}, ${getPrivacySelector(NodePrivacyLevel.MASK)}`
)
}
return text

@@ -218,0 +255,0 @@ }

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

import { ActionType } from '../../rawRumEvent.types'
import type { RumConfiguration } from '../configuration'
import type { LifeCycle } from '../lifeCycle'

@@ -24,2 +23,4 @@ import { LifeCycleEventType } from '../lifeCycle'

import { getSelectorFromElement } from '../getSelectorFromElement'
import { getNodePrivacyLevel, NodePrivacyLevel } from '../privacy'
import type { RumConfiguration } from '../configuration'
import type { ClickChain } from './clickChain'

@@ -87,3 +88,3 @@ import { createClickChain } from './clickChain'

processPointerDown(configuration, lifeCycle, domMutationObservable, pointerDownEvent),
onPointerUp: ({ clickActionBase, hadActivityOnPointerDown }, startEvent, getUserActivity) =>
onPointerUp: ({ clickActionBase, hadActivityOnPointerDown }, startEvent, getUserActivity) => {
startClickAction(

@@ -100,3 +101,4 @@ configuration,

hadActivityOnPointerDown
),
)
},
})

@@ -139,4 +141,12 @@

) {
const clickActionBase = computeClickActionBase(pointerDownEvent, configuration.actionNameAttribute)
const nodePrivacyLevel = configuration.enablePrivacyForActionName
? getNodePrivacyLevel(pointerDownEvent.target, configuration.defaultPrivacyLevel)
: NodePrivacyLevel.ALLOW
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
return undefined
}
const clickActionBase = computeClickActionBase(pointerDownEvent, nodePrivacyLevel, configuration)
let hadActivityOnPointerDown = false

@@ -216,4 +226,9 @@

function computeClickActionBase(event: MouseEventOnElement, actionNameAttribute?: string): ClickActionBase {
function computeClickActionBase(
event: MouseEventOnElement,
nodePrivacyLevel: NodePrivacyLevel,
configuration: RumConfiguration
): ClickActionBase {
const rect = event.target.getBoundingClientRect()
return {

@@ -224,3 +239,3 @@ type: ActionType.CLICK,

height: Math.round(rect.height),
selector: getSelectorFromElement(event.target, actionNameAttribute),
selector: getSelectorFromElement(event.target, configuration.actionNameAttribute),
},

@@ -232,3 +247,3 @@ position: {

},
name: getActionNameFromElement(event.target, actionNameAttribute),
name: getActionNameFromElement(event.target, configuration, nodePrivacyLevel),
}

@@ -235,0 +250,0 @@ }

@@ -59,2 +59,7 @@ import type { Context, RawError, EventRateLimiter, User } from '@datadog/browser-core'

const ROOT_MODIFIABLE_FIELD_PATHS: ModifiableFieldPaths = {
service: 'string',
version: 'string',
}
let modifiableFieldPathsByEvent: { [key in RumEventType]: ModifiableFieldPaths }

@@ -76,12 +81,2 @@

) {
// TODO: lift this declaration to module level once feature flag is removed
const ROOT_MODIFIABLE_FIELD_PATHS: ModifiableFieldPaths = isExperimentalFeatureEnabled(
ExperimentalFeature.MICRO_FRONTEND
)
? {
service: 'string',
version: 'string',
}
: {}
modifiableFieldPathsByEvent = {

@@ -88,0 +83,0 @@ [RumEventType.VIEW]: VIEW_MODIFIABLE_FIELD_PATHS,

@@ -13,4 +13,2 @@ import type { Context, RawError, ClocksState } from '@datadog/browser-core'

NonErrorPrefix,
isExperimentalFeatureEnabled,
ExperimentalFeature,
} from '@datadog/browser-core'

@@ -128,8 +126,5 @@ import type { RumConfiguration } from '../configuration'

error: error.originalError,
handlingStack: error.handlingStack,
}
if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {
domainContext.handlingStack = error.handlingStack
}
return {

@@ -136,0 +131,0 @@ rawRumEvent,

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

isNumber,
ExperimentalFeature,
isExperimentalFeatureEnabled,
} from '@datadog/browser-core'

@@ -98,3 +96,4 @@ import type { RumConfiguration } from '../configuration'

)
const collectedData = {
return {
startTime: startClocks.relative,

@@ -110,10 +109,5 @@ rawRumEvent: resourceEvent,

isAborted: request.isAborted,
handlingStack: request.handlingStack,
} as RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext,
}
if (isExperimentalFeatureEnabled(ExperimentalFeature.MICRO_FRONTEND)) {
collectedData.domainContext.handlingStack = request.handlingStack
}
return collectedData
}

@@ -120,0 +114,0 @@

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

import type { LocationChange } from '../../browser/locationChangeObservable'
import type { RumConfiguration } from '../configuration'
import type { RumConfiguration, RumInitConfiguration } from '../configuration'
import { trackViewEventCounts } from './trackViewEventCounts'

@@ -79,4 +79,4 @@ import { trackInitialViewMetrics } from './viewMetrics/trackInitialViewMetrics'

name?: string
service?: string
version?: string
service?: RumInitConfiguration['service']
version?: RumInitConfiguration['version']
}

@@ -190,4 +190,4 @@

name = viewOptions.name
service = viewOptions.service
version = viewOptions.version
service = viewOptions.service || undefined
version = viewOptions.version || undefined
}

@@ -194,0 +194,0 @@

@@ -32,3 +32,3 @@ export { RumPublicApi, makeRumPublicApi, RecorderApi, StartRecordingOptions } from './boot/rumPublicApi'

export { getScrollX, getScrollY } from './browser/scroll'
export { RumInitConfiguration, RumConfiguration } from './domain/configuration'
export { RumInitConfiguration, RumConfiguration, RumRemoteConfiguration } from './domain/configuration'
export { DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE } from './domain/action/getActionNameFromElement'

@@ -40,2 +40,4 @@ export { STABLE_ATTRIBUTES } from './domain/getSelectorFromElement'

export { isLongDataUrl, sanitizeDataUrl, MAX_ATTRIBUTE_VALUE_CHAR_LENGTH } from './domain/resource/resourceUtils'
export * from './domain/privacy'
export { SessionReplayState } from './domain/rumSessionManager'
export type { RumPlugin } from './domain/plugins'

@@ -1080,2 +1080,10 @@ /* eslint-disable */

/**
* Details of the vital. It can be used as a secondary identifier (URL, React component name...)
*/
readonly details?: string
/**
* Duration of the vital in nanoseconds
*/
readonly duration?: number
/**
* User custom vital.

@@ -1082,0 +1090,0 @@ */

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc