Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 4.1.0 to 4.2.0

2

cjs/boot/buildEnv.d.ts

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

import { BuildEnv } from '@datadog/browser-core';
import type { BuildEnv } from '@datadog/browser-core';
export declare const buildEnv: BuildEnv;

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

buildMode: 'release',
sdkVersion: '4.1.0',
sdkVersion: '4.2.0',
};
//# sourceMappingURL=buildEnv.js.map

@@ -1,8 +0,8 @@

import { Context, InitConfiguration, InternalMonitoring } from '@datadog/browser-core';
import { LifeCycle } from '../domain/lifeCycle';
import { ParentContexts } from '../domain/parentContexts';
import { RumSessionManager } from '../domain/rumSessionManager';
import { CommonContext, User, ReplayStats } from '../rawRumEvent.types';
import { RumConfiguration, RumInitConfiguration } from '../domain/configuration';
import { startRum } from './startRum';
import type { Context, InitConfiguration, InternalMonitoring } from '@datadog/browser-core';
import type { LifeCycle } from '../domain/lifeCycle';
import type { ParentContexts } from '../domain/parentContexts';
import type { RumSessionManager } from '../domain/rumSessionManager';
import type { CommonContext, User, ReplayStats } from '../rawRumEvent.types';
import type { RumConfiguration, RumInitConfiguration } from '../domain/configuration';
import type { startRum } from './startRum';
export declare type RumPublicApi = ReturnType<typeof makeRumPublicApi>;

@@ -9,0 +9,0 @@ export declare type StartRum = (configuration: RumConfiguration, internalMonitoring: InternalMonitoring, getCommonContext: () => CommonContext, recorderApi: RecorderApi, initialViewName?: string) => StartRumResult;

@@ -1,8 +0,8 @@

import { InternalMonitoring, Observable } from '@datadog/browser-core';
import type { InternalMonitoring, Observable } from '@datadog/browser-core';
import { LifeCycle } from '../domain/lifeCycle';
import { RumSessionManager } from '../domain/rumSessionManager';
import { CommonContext } from '../rawRumEvent.types';
import { LocationChange } from '../browser/locationChangeObservable';
import { RumConfiguration } from '../domain/configuration';
import { RecorderApi } from './rumPublicApi';
import type { RumSessionManager } from '../domain/rumSessionManager';
import type { CommonContext } from '../rawRumEvent.types';
import type { LocationChange } from '../browser/locationChangeObservable';
import type { RumConfiguration } from '../domain/configuration';
import type { RecorderApi } from './rumPublicApi';
export declare function startRum(configuration: RumConfiguration, internalMonitoring: InternalMonitoring, getCommonContext: () => CommonContext, recorderApi: RecorderApi, initialViewName?: string): {

@@ -9,0 +9,0 @@ addAction: (action: import("../domain/rumEventsCollection/action/trackActions").CustomAction, savedCommonContext?: CommonContext | undefined) => void;

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

import { Duration, RelativeTime } from '@datadog/browser-core';
import { RumConfiguration } from '../domain/configuration';
import { LifeCycle } from '../domain/lifeCycle';
import { PerformanceEntryRepresentation } from '../domainContext.types';
import type { Duration, RelativeTime } from '@datadog/browser-core';
import type { RumConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
import type { PerformanceEntryRepresentation } from '../domainContext.types';
export interface RumPerformanceResourceTiming {

@@ -6,0 +6,0 @@ entryType: 'resource';

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

retrieveInitialDocumentResourceTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});
if (supportPerformanceObject()) {
handlePerformanceEntries(lifeCycle, configuration, performance.getEntries());
handleRumPerformanceEntries(lifeCycle, configuration, performance.getEntries());
}
if (window.PerformanceObserver) {
var handlePerformanceEntryList_1 = browser_core_1.monitor(function (entries) {
return handlePerformanceEntries(lifeCycle, configuration, entries.getEntries());
return handleRumPerformanceEntries(lifeCycle, configuration, entries.getEntries());
});

@@ -47,3 +47,4 @@ var mainEntries = ['resource', 'navigation', 'longtask', 'paint'];

catch (e) {
// Some old browser versions don't support PerformanceObserver without entryTypes option
// Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options
// In these cases, fallback to PerformanceObserver with entryTypes
mainEntries.push.apply(mainEntries, experimentalEntries);

@@ -62,3 +63,3 @@ }

retrieveNavigationTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});

@@ -68,3 +69,3 @@ }

retrieveFirstInputTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});

@@ -172,5 +173,5 @@ }

}
function handlePerformanceEntries(lifeCycle, configuration, entries) {
entries.forEach(function (entry) {
if (entry.entryType === 'resource' ||
function handleRumPerformanceEntries(lifeCycle, configuration, entries) {
var rumPerformanceEntries = entries.filter(function (entry) {
return entry.entryType === 'resource' ||
entry.entryType === 'navigation' ||

@@ -181,12 +182,8 @@ entry.entryType === 'paint' ||

entry.entryType === 'first-input' ||
entry.entryType === 'layout-shift') {
handleRumPerformanceEntry(lifeCycle, configuration, entry);
}
entry.entryType === 'layout-shift';
});
}
function handleRumPerformanceEntry(lifeCycle, configuration, entry) {
if (isIncompleteNavigation(entry) || isForbiddenResource(configuration, entry)) {
return;
var rumAllowedPerformanceEntries = rumPerformanceEntries.filter(function (entry) { return !isIncompleteNavigation(entry) && !isForbiddenResource(configuration, entry); });
if (rumAllowedPerformanceEntries.length) {
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, rumAllowedPerformanceEntries);
}
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, entry);
}

@@ -193,0 +190,0 @@ function isIncompleteNavigation(entry) {

@@ -1,7 +0,7 @@

import { CommonContext } from '../rawRumEvent.types';
import { LifeCycle } from './lifeCycle';
import { ParentContexts } from './parentContexts';
import { RumSessionManager } from './rumSessionManager';
import { UrlContexts } from './urlContexts';
import { RumConfiguration } from './configuration';
import type { CommonContext } from '../rawRumEvent.types';
import type { LifeCycle } from './lifeCycle';
import type { ParentContexts } from './parentContexts';
import type { RumSessionManager } from './rumSessionManager';
import type { UrlContexts } from './urlContexts';
import type { RumConfiguration } from './configuration';
export declare function startRumAssembly(configuration: RumConfiguration, lifeCycle: LifeCycle, sessionManager: RumSessionManager, parentContexts: ParentContexts, urlContexts: UrlContexts, getCommonContext: () => CommonContext): void;

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

service: configuration.service,
source: 'browser',
session: {

@@ -70,0 +71,0 @@ id: session.id,

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

import { Configuration, DefaultPrivacyLevel, InitConfiguration } from '@datadog/browser-core';
import { RumEventDomainContext } from '../domainContext.types';
import { RumEvent } from '../rumEvent.types';
import type { Configuration, InitConfiguration } from '@datadog/browser-core';
import { DefaultPrivacyLevel } from '@datadog/browser-core';
import type { RumEventDomainContext } from '../domainContext.types';
import type { RumEvent } from '../rumEvent.types';
export interface RumInitConfiguration extends InitConfiguration {

@@ -5,0 +6,0 @@ applicationId: string;

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

import { RelativeTime, Duration } from '@datadog/browser-core';
import { InForegroundPeriod } from '../rawRumEvent.types';
import type { RelativeTime, Duration } from '@datadog/browser-core';
import type { InForegroundPeriod } from '../rawRumEvent.types';
export declare const MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = 500;

@@ -4,0 +4,0 @@ export declare const MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = 2500;

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

import { InternalContext } from '../rawRumEvent.types';
import { ParentContexts } from './parentContexts';
import { RumSessionManager } from './rumSessionManager';
import { UrlContexts } from './urlContexts';
import type { InternalContext } from '../rawRumEvent.types';
import type { ParentContexts } from './parentContexts';
import type { RumSessionManager } from './rumSessionManager';
import type { UrlContexts } from './urlContexts';
/**

@@ -6,0 +6,0 @@ * Internal context keep returning v1 format

@@ -1,11 +0,11 @@

import { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core';
import { RumPerformanceEntry } from '../browser/performanceCollection';
import { RumEventDomainContext } from '../domainContext.types';
import { CommonContext, RawRumEvent } from '../rawRumEvent.types';
import { RumEvent } from '../rumEvent.types';
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions';
import { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews';
import type { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core';
import type { RumPerformanceEntry } from '../browser/performanceCollection';
import type { RumEventDomainContext } from '../domainContext.types';
import type { CommonContext, RawRumEvent } from '../rawRumEvent.types';
import type { RumEvent } from '../rumEvent.types';
import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import type { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions';
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews';
export declare enum LifeCycleEventType {
PERFORMANCE_ENTRY_COLLECTED = 0,
PERFORMANCE_ENTRIES_COLLECTED = 0,
AUTO_ACTION_CREATED = 1,

@@ -28,3 +28,3 @@ AUTO_ACTION_COMPLETED = 2,

private callbacks;
notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, data: RumPerformanceEntry): void;
notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, data: RumPerformanceEntry[]): void;
notify(eventType: LifeCycleEventType.REQUEST_STARTED, data: RequestStartEvent): void;

@@ -45,3 +45,3 @@ notify(eventType: LifeCycleEventType.REQUEST_COMPLETED, data: RequestCompleteEvent): void;

notify(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, data: RumEvent & Context): void;
subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, callback: (data: RumPerformanceEntry) => void): Subscription;
subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, callback: (data: RumPerformanceEntry[]) => void): Subscription;
subscribe(eventType: LifeCycleEventType.REQUEST_STARTED, callback: (data: RequestStartEvent) => void): Subscription;

@@ -48,0 +48,0 @@ subscribe(eventType: LifeCycleEventType.REQUEST_COMPLETED, callback: (data: RequestCompleteEvent) => void): Subscription;

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

(function (LifeCycleEventType) {
LifeCycleEventType[LifeCycleEventType["PERFORMANCE_ENTRY_COLLECTED"] = 0] = "PERFORMANCE_ENTRY_COLLECTED";
LifeCycleEventType[LifeCycleEventType["PERFORMANCE_ENTRIES_COLLECTED"] = 0] = "PERFORMANCE_ENTRIES_COLLECTED";
LifeCycleEventType[LifeCycleEventType["AUTO_ACTION_CREATED"] = 1] = "AUTO_ACTION_CREATED";

@@ -9,0 +9,0 @@ LifeCycleEventType[LifeCycleEventType["AUTO_ACTION_COMPLETED"] = 2] = "AUTO_ACTION_COMPLETED";

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

import { RelativeTime } from '@datadog/browser-core';
import { ActionContext, ViewContext } from '../rawRumEvent.types';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime } from '@datadog/browser-core';
import type { ActionContext, ViewContext } from '../rawRumEvent.types';
import type { LifeCycle } from './lifeCycle';
export declare const VIEW_CONTEXT_TIME_OUT_DELAY: number;

@@ -5,0 +5,0 @@ export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;

@@ -1,6 +0,7 @@

import { Duration, RequestType, XhrCompleteContext, XhrStartContext, ClocksState, FetchStartContext, FetchCompleteContext } from '@datadog/browser-core';
import { RumSessionManager } from '..';
import { RumConfiguration } from './configuration';
import { LifeCycle } from './lifeCycle';
import { TraceIdentifier, Tracer } from './tracing/tracer';
import type { Duration, XhrCompleteContext, XhrStartContext, ClocksState, FetchStartContext, FetchCompleteContext } from '@datadog/browser-core';
import { RequestType } from '@datadog/browser-core';
import type { RumSessionManager } from '..';
import type { RumConfiguration } from './configuration';
import type { LifeCycle } from './lifeCycle';
import type { TraceIdentifier, Tracer } from './tracing/tracer';
export interface CustomContext {

@@ -28,3 +29,2 @@ requestIndex: number;

status: number;
responseText?: string;
responseType?: string;

@@ -31,0 +31,0 @@ startClocks: ClocksState;

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

requestIndex: context.requestIndex,
responseText: context.responseText,
spanId: context.spanId,

@@ -71,3 +70,2 @@ startClocks: context.startClocks,

requestIndex: context.requestIndex,
responseText: context.responseText,
responseType: context.responseType,

@@ -74,0 +72,0 @@ spanId: context.spanId,

@@ -1,9 +0,9 @@

import { Observable } from '@datadog/browser-core';
import { CommonContext } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import { RumConfiguration } from '../../configuration';
import { CustomAction } from './trackActions';
import type { Observable } from '@datadog/browser-core';
import type { CommonContext } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
import type { RumConfiguration } from '../../configuration';
import type { CustomAction } from './trackActions';
export declare function startActionCollection(lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, foregroundContexts: ForegroundContexts): {
addAction: (action: CustomAction, savedCommonContext?: CommonContext | undefined) => void;
};

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

import { Context, Duration, ClocksState, Observable } from '@datadog/browser-core';
import type { Context, Duration, ClocksState, Observable } from '@datadog/browser-core';
import { ActionType } from '../../../rawRumEvent.types';
import { RumConfiguration } from '../../configuration';
import { LifeCycle } from '../../lifeCycle';
import type { RumConfiguration } from '../../configuration';
import type { LifeCycle } from '../../lifeCycle';
declare type AutoActionType = ActionType.CLICK;

@@ -6,0 +6,0 @@ export interface ActionCounts {

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

import { Context, ClocksState } from '@datadog/browser-core';
import { CommonContext } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import type { Context, ClocksState } from '@datadog/browser-core';
import type { CommonContext } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
export interface ProvidedError {

@@ -6,0 +6,0 @@ startClocks: ClocksState;

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

import { LifeCycle } from '../../lifeCycle';
import { RumSessionManager } from '../../rumSessionManager';
import type { LifeCycle } from '../../lifeCycle';
import type { RumSessionManager } from '../../rumSessionManager';
export declare function startLongTaskCollection(lifeCycle: LifeCycle, sessionManager: RumSessionManager): void;

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

function startLongTaskCollection(lifeCycle, sessionManager) {
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType !== 'longtask') {
return;
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType !== 'longtask') {
break;
}
var session = sessionManager.findTrackedSession(entry.startTime);
if (!session || session.hasLitePlan) {
break;
}
var startClocks = browser_core_1.relativeToClocks(entry.startTime);
var rawRumEvent = {
date: startClocks.timeStamp,
long_task: {
id: browser_core_1.generateUUID(),
duration: browser_core_1.toServerDuration(entry.duration),
},
type: rawRumEvent_types_1.RumEventType.LONG_TASK,
};
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
});
}
var session = sessionManager.findTrackedSession(entry.startTime);
if (!session || session.hasLitePlan) {
return;
}
var startClocks = browser_core_1.relativeToClocks(entry.startTime);
var rawRumEvent = {
date: startClocks.timeStamp,
long_task: {
id: browser_core_1.generateUUID(),
duration: browser_core_1.toServerDuration(entry.duration),
},
type: rawRumEvent_types_1.RumEventType.LONG_TASK,
};
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
});
});

@@ -32,0 +35,0 @@ }

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

import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import { RequestCompleteEvent } from '../../requestCollection';
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import type { RequestCompleteEvent } from '../../requestCollection';
/**

@@ -4,0 +4,0 @@ * Look for corresponding timing in resource timing buffer

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

import { LifeCycle } from '../../lifeCycle';
import type { LifeCycle } from '../../lifeCycle';
export declare function startResourceCollection(lifeCycle: LifeCycle): void;

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

});
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'resource' && !resourceUtils_1.isRequestKind(entry)) {
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry));
lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'resource' && !resourceUtils_1.isRequestKind(entry)) {
lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry));
}
}

@@ -20,0 +23,0 @@ });

@@ -1,5 +0,6 @@

import { ResourceType, ServerDuration } from '@datadog/browser-core';
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types';
import { RumConfiguration } from '../../configuration';
import type { ServerDuration } from '@datadog/browser-core';
import { ResourceType } from '@datadog/browser-core';
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import type { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types';
import type { RumConfiguration } from '../../configuration';
export interface PerformanceResourceDetails {

@@ -6,0 +7,0 @@ redirect?: PerformanceResourceDetailsElement;

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

import { EventEmitter, RelativeTime } from '@datadog/browser-core';
import type { EventEmitter, RelativeTime } from '@datadog/browser-core';
export declare function trackFirstHidden(emitter?: EventEmitter): {

@@ -3,0 +3,0 @@ timeStamp: RelativeTime;

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

import { Duration, EventEmitter, RelativeTime } from '@datadog/browser-core';
import { LifeCycle } from '../../lifeCycle';
import type { Duration, EventEmitter, RelativeTime } from '@datadog/browser-core';
import type { LifeCycle } from '../../lifeCycle';
export declare const TIMING_MAXIMUM_DELAY: number;

@@ -4,0 +4,0 @@ export interface Timings {

@@ -44,10 +44,13 @@ "use strict";

function trackNavigationTimings(lifeCycle, callback) {
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
});
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
});
}
}

@@ -60,8 +63,11 @@ }).unsubscribe;

var firstHidden = trackFirstHidden_1.trackFirstHidden();
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < exports.TIMING_MAXIMUM_DELAY) {
callback(entry.startTime);
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var fcpEntry = browser_core_1.find(entries, function (entry) {
return entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < exports.TIMING_MAXIMUM_DELAY;
});
if (fcpEntry) {
callback(fcpEntry.startTime);
}

@@ -87,8 +93,11 @@ }).unsubscribe;

}, { capture: true, once: true }).stop;
var unsubscribeLifeCycle = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < exports.TIMING_MAXIMUM_DELAY) {
callback(entry.startTime);
var unsubscribeLifeCycle = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var lcpEntry = browser_core_1.findLast(entries, function (entry) {
return entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < exports.TIMING_MAXIMUM_DELAY;
});
if (lcpEntry) {
callback(lcpEntry.startTime);
}

@@ -114,5 +123,8 @@ }).unsubscribe;

var firstHidden = trackFirstHidden_1.trackFirstHidden();
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp) {
var firstInputDelay = browser_core_1.elapsed(entry.startTime, entry.processingStart);
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var firstInputEntry = browser_core_1.find(entries, function (entry) {
return entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp;
});
if (firstInputEntry) {
var firstInputDelay = browser_core_1.elapsed(firstInputEntry.startTime, firstInputEntry.processingStart);
callback({

@@ -122,3 +134,3 @@ // Ensure firstInputDelay to be positive, see

firstInputDelay: firstInputDelay >= 0 ? firstInputDelay : 0,
firstInputTime: entry.startTime,
firstInputTime: firstInputEntry.startTime,
});

@@ -125,0 +137,0 @@ }

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

import { Duration, Observable } from '@datadog/browser-core';
import type { Duration, Observable } from '@datadog/browser-core';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { EventCounts } from '../../trackEventCounts';
import type { LifeCycle } from '../../lifeCycle';
import type { EventCounts } from '../../trackEventCounts';
export interface ViewMetrics {

@@ -6,0 +6,0 @@ eventCounts: EventCounts;

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

var window = slidingSessionWindow();
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry);
if (window.value() > maxClsValue) {
maxClsValue = window.value();
callback(browser_core_1.round(maxClsValue, 4));
var stop = lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry);
if (window.value() > maxClsValue) {
maxClsValue = window.value();
callback(browser_core_1.round(maxClsValue, 4));
}
}

@@ -116,0 +119,0 @@ }

@@ -1,7 +0,8 @@

import { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';
import { ViewLoadingType, ViewCustomTimings } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { EventCounts } from '../../trackEventCounts';
import { LocationChange } from '../../../browser/locationChangeObservable';
import { Timings } from './trackInitialViewTimings';
import type { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';
import type { ViewCustomTimings } from '../../../rawRumEvent.types';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { EventCounts } from '../../trackEventCounts';
import type { LocationChange } from '../../../browser/locationChangeObservable';
import type { Timings } from './trackInitialViewTimings';
export interface ViewEvent {

@@ -8,0 +9,0 @@ id: string;

@@ -1,7 +0,7 @@

import { Observable } from '@datadog/browser-core';
import { RecorderApi } from '../../../boot/rumPublicApi';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import { LocationChange } from '../../../browser/locationChangeObservable';
import { RumConfiguration } from '../../configuration';
import type { Observable } from '@datadog/browser-core';
import type { RecorderApi } from '../../../boot/rumPublicApi';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
import type { LocationChange } from '../../../browser/locationChangeObservable';
import type { RumConfiguration } from '../../configuration';
export declare function startViewCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, location: Location, domMutationObservable: Observable<void>, locationChangeObservable: Observable<LocationChange>, foregroundContexts: ForegroundContexts, recorderApi: RecorderApi, initialViewName?: string): {

@@ -8,0 +8,0 @@ addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;

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

import { RelativeTime } from '@datadog/browser-core';
import { RumConfiguration } from './configuration';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime } from '@datadog/browser-core';
import type { RumConfiguration } from './configuration';
import type { LifeCycle } from './lifeCycle';
export declare const RUM_SESSION_KEY = "rum";

@@ -5,0 +5,0 @@ export interface RumSessionManager {

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

import { TimeStamp } from '@datadog/browser-core';
import type { TimeStamp } from '@datadog/browser-core';
interface DocumentTraceData {

@@ -3,0 +3,0 @@ traceId: string;

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

import { RumConfiguration } from '../configuration';
import { RumFetchCompleteContext, RumFetchStartContext, RumXhrCompleteContext, RumXhrStartContext } from '../requestCollection';
import { RumSessionManager } from '../rumSessionManager';
import type { RumConfiguration } from '../configuration';
import type { RumFetchCompleteContext, RumFetchStartContext, RumXhrCompleteContext, RumXhrStartContext } from '../requestCollection';
import type { RumSessionManager } from '../rumSessionManager';
export interface Tracer {

@@ -5,0 +5,0 @@ traceFetch: (context: Partial<RumFetchStartContext>) => void;

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

import { LifeCycle } from './lifeCycle';
import type { LifeCycle } from './lifeCycle';
export interface EventCounts {

@@ -3,0 +3,0 @@ errorCount: number;

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

import { RelativeTime, Observable } from '@datadog/browser-core';
import { UrlContext } from '../rawRumEvent.types';
import { LocationChange } from '../browser/locationChangeObservable';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime, Observable } from '@datadog/browser-core';
import type { UrlContext } from '../rawRumEvent.types';
import type { LocationChange } from '../browser/locationChangeObservable';
import type { LifeCycle } from './lifeCycle';
/**

@@ -6,0 +6,0 @@ * We want to attach to an event:

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

import { Duration, Observable } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import type { Duration } from '@datadog/browser-core';
import { Observable } from '@datadog/browser-core';
import type { LifeCycle } from './lifeCycle';
export declare const PAGE_ACTIVITY_VALIDATION_DELAY = 100;

@@ -4,0 +5,0 @@ export declare const PAGE_ACTIVITY_END_DELAY = 100;

@@ -83,7 +83,9 @@ "use strict";

var pendingRequestsCount = 0;
subscriptions.push(domMutationObservable.subscribe(function () { return notifyPageActivity(pendingRequestsCount); }), lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType !== 'resource') {
return;
subscriptions.push(domMutationObservable.subscribe(function () { return notifyPageActivity(pendingRequestsCount); }), lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
if (entries.some(function (_a) {
var entryType = _a.entryType;
return entryType === 'resource';
})) {
notifyPageActivity(pendingRequestsCount);
}
notifyPageActivity(pendingRequestsCount);
}), lifeCycle.subscribe(lifeCycle_1.LifeCycleEventType.REQUEST_STARTED, function (startEvent) {

@@ -90,0 +92,0 @@ if (firstRequestIndex === undefined) {

/**
* Keep these types in a separate file in order to reference it from the official doc
*/
import { RumEventType } from './rawRumEvent.types';
import type { RumEventType } from './rawRumEvent.types';
export declare type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;

@@ -6,0 +6,0 @@ export interface RumViewEventDomainContext {

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

import { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';
import { RumSessionPlan } from './domain/rumSessionManager';
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';
import type { RumSessionPlan } from './domain/rumSessionManager';
export declare enum RumEventType {

@@ -149,2 +149,3 @@ ACTION = "action",

service?: string;
source: 'browser';
session: {

@@ -151,0 +152,0 @@ id: string;

@@ -143,3 +143,3 @@ /**

*/
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native';
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native' | 'flutter';
/**

@@ -640,2 +640,6 @@ * Resource properties of the error

/**
* The source of this event
*/
readonly source?: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native';
/**
* View properties

@@ -734,2 +738,3 @@ */

readonly test_execution_id: string;
[k: string]: unknown;
};

@@ -736,0 +741,0 @@ /**

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

import { RumConfiguration } from '../domain/configuration';
import { LifeCycle } from '../domain/lifeCycle';
import type { RumConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startRumBatch(configuration: RumConfiguration, lifeCycle: LifeCycle): {
stop: () => void;
};

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

import { LifeCycle } from '../domain/lifeCycle';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startRumEventBridge(lifeCycle: LifeCycle): void;

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

import { BuildEnv } from '@datadog/browser-core';
import type { BuildEnv } from '@datadog/browser-core';
export declare const buildEnv: BuildEnv;
export var buildEnv = {
buildMode: 'release',
sdkVersion: '4.1.0',
sdkVersion: '4.2.0',
};
//# sourceMappingURL=buildEnv.js.map

@@ -1,8 +0,8 @@

import { Context, InitConfiguration, InternalMonitoring } from '@datadog/browser-core';
import { LifeCycle } from '../domain/lifeCycle';
import { ParentContexts } from '../domain/parentContexts';
import { RumSessionManager } from '../domain/rumSessionManager';
import { CommonContext, User, ReplayStats } from '../rawRumEvent.types';
import { RumConfiguration, RumInitConfiguration } from '../domain/configuration';
import { startRum } from './startRum';
import type { Context, InitConfiguration, InternalMonitoring } from '@datadog/browser-core';
import type { LifeCycle } from '../domain/lifeCycle';
import type { ParentContexts } from '../domain/parentContexts';
import type { RumSessionManager } from '../domain/rumSessionManager';
import type { CommonContext, User, ReplayStats } from '../rawRumEvent.types';
import type { RumConfiguration, RumInitConfiguration } from '../domain/configuration';
import type { startRum } from './startRum';
export declare type RumPublicApi = ReturnType<typeof makeRumPublicApi>;

@@ -9,0 +9,0 @@ export declare type StartRum = (configuration: RumConfiguration, internalMonitoring: InternalMonitoring, getCommonContext: () => CommonContext, recorderApi: RecorderApi, initialViewName?: string) => StartRumResult;

@@ -1,8 +0,8 @@

import { InternalMonitoring, Observable } from '@datadog/browser-core';
import type { InternalMonitoring, Observable } from '@datadog/browser-core';
import { LifeCycle } from '../domain/lifeCycle';
import { RumSessionManager } from '../domain/rumSessionManager';
import { CommonContext } from '../rawRumEvent.types';
import { LocationChange } from '../browser/locationChangeObservable';
import { RumConfiguration } from '../domain/configuration';
import { RecorderApi } from './rumPublicApi';
import type { RumSessionManager } from '../domain/rumSessionManager';
import type { CommonContext } from '../rawRumEvent.types';
import type { LocationChange } from '../browser/locationChangeObservable';
import type { RumConfiguration } from '../domain/configuration';
import type { RecorderApi } from './rumPublicApi';
export declare function startRum(configuration: RumConfiguration, internalMonitoring: InternalMonitoring, getCommonContext: () => CommonContext, recorderApi: RecorderApi, initialViewName?: string): {

@@ -9,0 +9,0 @@ addAction: (action: import("../domain/rumEventsCollection/action/trackActions").CustomAction, savedCommonContext?: CommonContext | undefined) => void;

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

import { Duration, RelativeTime } from '@datadog/browser-core';
import { RumConfiguration } from '../domain/configuration';
import { LifeCycle } from '../domain/lifeCycle';
import { PerformanceEntryRepresentation } from '../domainContext.types';
import type { Duration, RelativeTime } from '@datadog/browser-core';
import type { RumConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
import type { PerformanceEntryRepresentation } from '../domainContext.types';
export interface RumPerformanceResourceTiming {

@@ -6,0 +6,0 @@ entryType: 'resource';

@@ -20,10 +20,10 @@ import { __assign } from "tslib";

retrieveInitialDocumentResourceTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});
if (supportPerformanceObject()) {
handlePerformanceEntries(lifeCycle, configuration, performance.getEntries());
handleRumPerformanceEntries(lifeCycle, configuration, performance.getEntries());
}
if (window.PerformanceObserver) {
var handlePerformanceEntryList_1 = monitor(function (entries) {
return handlePerformanceEntries(lifeCycle, configuration, entries.getEntries());
return handleRumPerformanceEntries(lifeCycle, configuration, entries.getEntries());
});

@@ -42,3 +42,4 @@ var mainEntries = ['resource', 'navigation', 'longtask', 'paint'];

catch (e) {
// Some old browser versions don't support PerformanceObserver without entryTypes option
// Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options
// In these cases, fallback to PerformanceObserver with entryTypes
mainEntries.push.apply(mainEntries, experimentalEntries);

@@ -57,3 +58,3 @@ }

retrieveNavigationTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});

@@ -63,3 +64,3 @@ }

retrieveFirstInputTiming(function (timing) {
handleRumPerformanceEntry(lifeCycle, configuration, timing);
handleRumPerformanceEntries(lifeCycle, configuration, [timing]);
});

@@ -165,5 +166,5 @@ }

}
function handlePerformanceEntries(lifeCycle, configuration, entries) {
entries.forEach(function (entry) {
if (entry.entryType === 'resource' ||
function handleRumPerformanceEntries(lifeCycle, configuration, entries) {
var rumPerformanceEntries = entries.filter(function (entry) {
return entry.entryType === 'resource' ||
entry.entryType === 'navigation' ||

@@ -174,12 +175,8 @@ entry.entryType === 'paint' ||

entry.entryType === 'first-input' ||
entry.entryType === 'layout-shift') {
handleRumPerformanceEntry(lifeCycle, configuration, entry);
}
entry.entryType === 'layout-shift';
});
}
function handleRumPerformanceEntry(lifeCycle, configuration, entry) {
if (isIncompleteNavigation(entry) || isForbiddenResource(configuration, entry)) {
return;
var rumAllowedPerformanceEntries = rumPerformanceEntries.filter(function (entry) { return !isIncompleteNavigation(entry) && !isForbiddenResource(configuration, entry); });
if (rumAllowedPerformanceEntries.length) {
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, rumAllowedPerformanceEntries);
}
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, entry);
}

@@ -186,0 +183,0 @@ function isIncompleteNavigation(entry) {

@@ -1,7 +0,7 @@

import { CommonContext } from '../rawRumEvent.types';
import { LifeCycle } from './lifeCycle';
import { ParentContexts } from './parentContexts';
import { RumSessionManager } from './rumSessionManager';
import { UrlContexts } from './urlContexts';
import { RumConfiguration } from './configuration';
import type { CommonContext } from '../rawRumEvent.types';
import type { LifeCycle } from './lifeCycle';
import type { ParentContexts } from './parentContexts';
import type { RumSessionManager } from './rumSessionManager';
import type { UrlContexts } from './urlContexts';
import type { RumConfiguration } from './configuration';
export declare function startRumAssembly(configuration: RumConfiguration, lifeCycle: LifeCycle, sessionManager: RumSessionManager, parentContexts: ParentContexts, urlContexts: UrlContexts, getCommonContext: () => CommonContext): void;
import { __spreadArrays } from "tslib";
import { combine, isEmptyObject, limitModification, timeStampNow, currentDrift, display, createEventRateLimiter, canUseEventBridge, } from '@datadog/browser-core';
import { RumEventType, } from '../rawRumEvent.types';
import { RumEventType } from '../rawRumEvent.types';
import { buildEnv } from '../boot/buildEnv';

@@ -65,2 +65,3 @@ import { getSyntheticsContext } from './syntheticsContext';

service: configuration.service,
source: 'browser',
session: {

@@ -67,0 +68,0 @@ id: session.id,

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

import { Configuration, DefaultPrivacyLevel, InitConfiguration } from '@datadog/browser-core';
import { RumEventDomainContext } from '../domainContext.types';
import { RumEvent } from '../rumEvent.types';
import type { Configuration, InitConfiguration } from '@datadog/browser-core';
import { DefaultPrivacyLevel } from '@datadog/browser-core';
import type { RumEventDomainContext } from '../domainContext.types';
import type { RumEvent } from '../rumEvent.types';
export interface RumInitConfiguration extends InitConfiguration {

@@ -5,0 +6,0 @@ applicationId: string;

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

import { RelativeTime, Duration } from '@datadog/browser-core';
import { InForegroundPeriod } from '../rawRumEvent.types';
import type { RelativeTime, Duration } from '@datadog/browser-core';
import type { InForegroundPeriod } from '../rawRumEvent.types';
export declare const MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = 500;

@@ -4,0 +4,0 @@ export declare const MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS = 2500;

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

import { addEventListener, elapsed, relativeNow, toServerDuration, } from '@datadog/browser-core';
import { addEventListener, elapsed, relativeNow, toServerDuration } from '@datadog/browser-core';
// Arbitrary value to cap number of element mostly for backend & to save bandwidth

@@ -3,0 +3,0 @@ export var MAX_NUMBER_OF_SELECTABLE_FOREGROUND_PERIODS = 500;

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

import { InternalContext } from '../rawRumEvent.types';
import { ParentContexts } from './parentContexts';
import { RumSessionManager } from './rumSessionManager';
import { UrlContexts } from './urlContexts';
import type { InternalContext } from '../rawRumEvent.types';
import type { ParentContexts } from './parentContexts';
import type { RumSessionManager } from './rumSessionManager';
import type { UrlContexts } from './urlContexts';
/**

@@ -6,0 +6,0 @@ * Internal context keep returning v1 format

@@ -1,11 +0,11 @@

import { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core';
import { RumPerformanceEntry } from '../browser/performanceCollection';
import { RumEventDomainContext } from '../domainContext.types';
import { CommonContext, RawRumEvent } from '../rawRumEvent.types';
import { RumEvent } from '../rumEvent.types';
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions';
import { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews';
import type { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core';
import type { RumPerformanceEntry } from '../browser/performanceCollection';
import type { RumEventDomainContext } from '../domainContext.types';
import type { CommonContext, RawRumEvent } from '../rawRumEvent.types';
import type { RumEvent } from '../rumEvent.types';
import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection';
import type { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions';
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews';
export declare enum LifeCycleEventType {
PERFORMANCE_ENTRY_COLLECTED = 0,
PERFORMANCE_ENTRIES_COLLECTED = 0,
AUTO_ACTION_CREATED = 1,

@@ -28,3 +28,3 @@ AUTO_ACTION_COMPLETED = 2,

private callbacks;
notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, data: RumPerformanceEntry): void;
notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, data: RumPerformanceEntry[]): void;
notify(eventType: LifeCycleEventType.REQUEST_STARTED, data: RequestStartEvent): void;

@@ -45,3 +45,3 @@ notify(eventType: LifeCycleEventType.REQUEST_COMPLETED, data: RequestCompleteEvent): void;

notify(eventType: LifeCycleEventType.RUM_EVENT_COLLECTED, data: RumEvent & Context): void;
subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, callback: (data: RumPerformanceEntry) => void): Subscription;
subscribe(eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, callback: (data: RumPerformanceEntry[]) => void): Subscription;
subscribe(eventType: LifeCycleEventType.REQUEST_STARTED, callback: (data: RequestStartEvent) => void): Subscription;

@@ -48,0 +48,0 @@ subscribe(eventType: LifeCycleEventType.REQUEST_COMPLETED, callback: (data: RequestCompleteEvent) => void): Subscription;

export var LifeCycleEventType;
(function (LifeCycleEventType) {
LifeCycleEventType[LifeCycleEventType["PERFORMANCE_ENTRY_COLLECTED"] = 0] = "PERFORMANCE_ENTRY_COLLECTED";
LifeCycleEventType[LifeCycleEventType["PERFORMANCE_ENTRIES_COLLECTED"] = 0] = "PERFORMANCE_ENTRIES_COLLECTED";
LifeCycleEventType[LifeCycleEventType["AUTO_ACTION_CREATED"] = 1] = "AUTO_ACTION_CREATED";

@@ -5,0 +5,0 @@ LifeCycleEventType[LifeCycleEventType["AUTO_ACTION_COMPLETED"] = 2] = "AUTO_ACTION_COMPLETED";

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

import { RelativeTime } from '@datadog/browser-core';
import { ActionContext, ViewContext } from '../rawRumEvent.types';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime } from '@datadog/browser-core';
import type { ActionContext, ViewContext } from '../rawRumEvent.types';
import type { LifeCycle } from './lifeCycle';
export declare const VIEW_CONTEXT_TIME_OUT_DELAY: number;

@@ -5,0 +5,0 @@ export declare const ACTION_CONTEXT_TIME_OUT_DELAY: number;

@@ -1,6 +0,7 @@

import { Duration, RequestType, XhrCompleteContext, XhrStartContext, ClocksState, FetchStartContext, FetchCompleteContext } from '@datadog/browser-core';
import { RumSessionManager } from '..';
import { RumConfiguration } from './configuration';
import { LifeCycle } from './lifeCycle';
import { TraceIdentifier, Tracer } from './tracing/tracer';
import type { Duration, XhrCompleteContext, XhrStartContext, ClocksState, FetchStartContext, FetchCompleteContext } from '@datadog/browser-core';
import { RequestType } from '@datadog/browser-core';
import type { RumSessionManager } from '..';
import type { RumConfiguration } from './configuration';
import type { LifeCycle } from './lifeCycle';
import type { TraceIdentifier, Tracer } from './tracing/tracer';
export interface CustomContext {

@@ -28,3 +29,2 @@ requestIndex: number;

status: number;
responseText?: string;
responseType?: string;

@@ -31,0 +31,0 @@ startClocks: ClocksState;

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

import { RequestType, initFetchObservable, initXhrObservable, } from '@datadog/browser-core';
import { RequestType, initFetchObservable, initXhrObservable } from '@datadog/browser-core';
import { LifeCycleEventType } from './lifeCycle';

@@ -31,3 +31,2 @@ import { isAllowedRequestUrl } from './rumEventsCollection/resource/resourceUtils';

requestIndex: context.requestIndex,
responseText: context.responseText,
spanId: context.spanId,

@@ -66,3 +65,2 @@ startClocks: context.startClocks,

requestIndex: context.requestIndex,
responseText: context.responseText,
responseType: context.responseType,

@@ -69,0 +67,0 @@ spanId: context.spanId,

@@ -1,9 +0,9 @@

import { Observable } from '@datadog/browser-core';
import { CommonContext } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import { RumConfiguration } from '../../configuration';
import { CustomAction } from './trackActions';
import type { Observable } from '@datadog/browser-core';
import type { CommonContext } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
import type { RumConfiguration } from '../../configuration';
import type { CustomAction } from './trackActions';
export declare function startActionCollection(lifeCycle: LifeCycle, domMutationObservable: Observable<void>, configuration: RumConfiguration, foregroundContexts: ForegroundContexts): {
addAction: (action: CustomAction, savedCommonContext?: CommonContext | undefined) => void;
};

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

import { Context, Duration, ClocksState, Observable } from '@datadog/browser-core';
import type { Context, Duration, ClocksState, Observable } from '@datadog/browser-core';
import { ActionType } from '../../../rawRumEvent.types';
import { RumConfiguration } from '../../configuration';
import { LifeCycle } from '../../lifeCycle';
import type { RumConfiguration } from '../../configuration';
import type { LifeCycle } from '../../lifeCycle';
declare type AutoActionType = ActionType.CLICK;

@@ -6,0 +6,0 @@ export interface ActionCounts {

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

import { addEventListener, generateUUID, clocksNow, ONE_SECOND, } from '@datadog/browser-core';
import { addEventListener, generateUUID, clocksNow, ONE_SECOND } from '@datadog/browser-core';
import { ActionType } from '../../../rawRumEvent.types';

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

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

import { Context, ClocksState } from '@datadog/browser-core';
import { CommonContext } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import type { Context, ClocksState } from '@datadog/browser-core';
import type { CommonContext } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
export interface ProvidedError {

@@ -6,0 +6,0 @@ startClocks: ClocksState;

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

import { LifeCycle } from '../../lifeCycle';
import { RumSessionManager } from '../../rumSessionManager';
import type { LifeCycle } from '../../lifeCycle';
import type { RumSessionManager } from '../../rumSessionManager';
export declare function startLongTaskCollection(lifeCycle: LifeCycle, sessionManager: RumSessionManager): void;

@@ -5,26 +5,29 @@ import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core';

export function startLongTaskCollection(lifeCycle, sessionManager) {
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType !== 'longtask') {
return;
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType !== 'longtask') {
break;
}
var session = sessionManager.findTrackedSession(entry.startTime);
if (!session || session.hasLitePlan) {
break;
}
var startClocks = relativeToClocks(entry.startTime);
var rawRumEvent = {
date: startClocks.timeStamp,
long_task: {
id: generateUUID(),
duration: toServerDuration(entry.duration),
},
type: RumEventType.LONG_TASK,
};
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
});
}
var session = sessionManager.findTrackedSession(entry.startTime);
if (!session || session.hasLitePlan) {
return;
}
var startClocks = relativeToClocks(entry.startTime);
var rawRumEvent = {
date: startClocks.timeStamp,
long_task: {
id: generateUUID(),
duration: toServerDuration(entry.duration),
},
type: RumEventType.LONG_TASK,
};
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent: rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
});
});
}
//# sourceMappingURL=longTaskCollection.js.map

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

import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import { RequestCompleteEvent } from '../../requestCollection';
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import type { RequestCompleteEvent } from '../../requestCollection';
/**

@@ -4,0 +4,0 @@ * Look for corresponding timing in resource timing buffer

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

import { LifeCycle } from '../../lifeCycle';
import type { LifeCycle } from '../../lifeCycle';
export declare function startResourceCollection(lifeCycle: LifeCycle): void;
import { __assign } from "tslib";
import { combine, generateUUID, RequestType, ResourceType, toServerDuration, relativeToClocks, } from '@datadog/browser-core';
import { supportPerformanceEntry, } from '../../../browser/performanceCollection';
import { supportPerformanceEntry } from '../../../browser/performanceCollection';
import { RumEventType } from '../../../rawRumEvent.types';

@@ -12,5 +12,8 @@ import { LifeCycleEventType } from '../../lifeCycle';

});
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'resource' && !isRequestKind(entry)) {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry));
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'resource' && !isRequestKind(entry)) {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry));
}
}

@@ -17,0 +20,0 @@ });

@@ -1,5 +0,6 @@

import { ResourceType, ServerDuration } from '@datadog/browser-core';
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types';
import { RumConfiguration } from '../../configuration';
import type { ServerDuration } from '@datadog/browser-core';
import { ResourceType } from '@datadog/browser-core';
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection';
import type { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types';
import type { RumConfiguration } from '../../configuration';
export interface PerformanceResourceDetails {

@@ -6,0 +7,0 @@ redirect?: PerformanceResourceDetailsElement;

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

import { EventEmitter, RelativeTime } from '@datadog/browser-core';
import type { EventEmitter, RelativeTime } from '@datadog/browser-core';
export declare function trackFirstHidden(emitter?: EventEmitter): {

@@ -3,0 +3,0 @@ timeStamp: RelativeTime;

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

import { Duration, EventEmitter, RelativeTime } from '@datadog/browser-core';
import { LifeCycle } from '../../lifeCycle';
import type { Duration, EventEmitter, RelativeTime } from '@datadog/browser-core';
import type { LifeCycle } from '../../lifeCycle';
export declare const TIMING_MAXIMUM_DELAY: number;

@@ -4,0 +4,0 @@ export interface Timings {

import { __assign } from "tslib";
import { addEventListeners, elapsed, ONE_MINUTE, } from '@datadog/browser-core';
import { addEventListeners, elapsed, ONE_MINUTE, find, findLast } from '@datadog/browser-core';
import { LifeCycleEventType } from '../../lifeCycle';

@@ -40,10 +40,13 @@ import { trackFirstHidden } from './trackFirstHidden';

export function trackNavigationTimings(lifeCycle, callback) {
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
});
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
});
}
}

@@ -55,8 +58,11 @@ }).unsubscribe;

var firstHidden = trackFirstHidden();
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY) {
callback(entry.startTime);
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var fcpEntry = find(entries, function (entry) {
return entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY;
});
if (fcpEntry) {
callback(fcpEntry.startTime);
}

@@ -81,8 +87,11 @@ }).unsubscribe;

}, { capture: true, once: true }).stop;
var unsubscribeLifeCycle = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY) {
callback(entry.startTime);
var unsubscribeLifeCycle = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var lcpEntry = findLast(entries, function (entry) {
return entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY;
});
if (lcpEntry) {
callback(lcpEntry.startTime);
}

@@ -107,5 +116,8 @@ }).unsubscribe;

var firstHidden = trackFirstHidden();
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp) {
var firstInputDelay = elapsed(entry.startTime, entry.processingStart);
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
var firstInputEntry = find(entries, function (entry) {
return entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp;
});
if (firstInputEntry) {
var firstInputDelay = elapsed(firstInputEntry.startTime, firstInputEntry.processingStart);
callback({

@@ -115,3 +127,3 @@ // Ensure firstInputDelay to be positive, see

firstInputDelay: firstInputDelay >= 0 ? firstInputDelay : 0,
firstInputTime: entry.startTime,
firstInputTime: firstInputEntry.startTime,
});

@@ -118,0 +130,0 @@ }

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

import { Duration, Observable } from '@datadog/browser-core';
import type { Duration, Observable } from '@datadog/browser-core';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { EventCounts } from '../../trackEventCounts';
import type { LifeCycle } from '../../lifeCycle';
import type { EventCounts } from '../../trackEventCounts';
export interface ViewMetrics {

@@ -6,0 +6,0 @@ eventCounts: EventCounts;

@@ -104,8 +104,11 @@ import { noop, round, ONE_SECOND } from '@datadog/browser-core';

var window = slidingSessionWindow();
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry);
if (window.value() > maxClsValue) {
maxClsValue = window.value();
callback(round(maxClsValue, 4));
var stop = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
var entry = entries_1[_i];
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry);
if (window.value() > maxClsValue) {
maxClsValue = window.value();
callback(round(maxClsValue, 4));
}
}

@@ -112,0 +115,0 @@ }

@@ -1,7 +0,8 @@

import { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';
import { ViewLoadingType, ViewCustomTimings } from '../../../rawRumEvent.types';
import { LifeCycle } from '../../lifeCycle';
import { EventCounts } from '../../trackEventCounts';
import { LocationChange } from '../../../browser/locationChangeObservable';
import { Timings } from './trackInitialViewTimings';
import type { Duration, ClocksState, TimeStamp, Observable, RelativeTime } from '@datadog/browser-core';
import type { ViewCustomTimings } from '../../../rawRumEvent.types';
import { ViewLoadingType } from '../../../rawRumEvent.types';
import type { LifeCycle } from '../../lifeCycle';
import type { EventCounts } from '../../trackEventCounts';
import type { LocationChange } from '../../../browser/locationChangeObservable';
import type { Timings } from './trackInitialViewTimings';
export interface ViewEvent {

@@ -8,0 +9,0 @@ id: string;

@@ -1,7 +0,7 @@

import { Observable } from '@datadog/browser-core';
import { RecorderApi } from '../../../boot/rumPublicApi';
import { LifeCycle } from '../../lifeCycle';
import { ForegroundContexts } from '../../foregroundContexts';
import { LocationChange } from '../../../browser/locationChangeObservable';
import { RumConfiguration } from '../../configuration';
import type { Observable } from '@datadog/browser-core';
import type { RecorderApi } from '../../../boot/rumPublicApi';
import type { LifeCycle } from '../../lifeCycle';
import type { ForegroundContexts } from '../../foregroundContexts';
import type { LocationChange } from '../../../browser/locationChangeObservable';
import type { RumConfiguration } from '../../configuration';
export declare function startViewCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, location: Location, domMutationObservable: Observable<void>, locationChangeObservable: Observable<LocationChange>, foregroundContexts: ForegroundContexts, recorderApi: RecorderApi, initialViewName?: string): {

@@ -8,0 +8,0 @@ addTiming: (name: string, time?: import("@datadog/browser-core").TimeStamp | import("@datadog/browser-core").RelativeTime) => void;

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

import { isEmptyObject, mapValues, toServerDuration, isNumber, } from '@datadog/browser-core';
import { isEmptyObject, mapValues, toServerDuration, isNumber } from '@datadog/browser-core';
import { RumEventType } from '../../../rawRumEvent.types';

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

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

import { RelativeTime } from '@datadog/browser-core';
import { RumConfiguration } from './configuration';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime } from '@datadog/browser-core';
import type { RumConfiguration } from './configuration';
import type { LifeCycle } from './lifeCycle';
export declare const RUM_SESSION_KEY = "rum";

@@ -5,0 +5,0 @@ export interface RumSessionManager {

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

import { TimeStamp } from '@datadog/browser-core';
import type { TimeStamp } from '@datadog/browser-core';
interface DocumentTraceData {

@@ -3,0 +3,0 @@ traceId: string;

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

import { RumConfiguration } from '../configuration';
import { RumFetchCompleteContext, RumFetchStartContext, RumXhrCompleteContext, RumXhrStartContext } from '../requestCollection';
import { RumSessionManager } from '../rumSessionManager';
import type { RumConfiguration } from '../configuration';
import type { RumFetchCompleteContext, RumFetchStartContext, RumXhrCompleteContext, RumXhrStartContext } from '../requestCollection';
import type { RumSessionManager } from '../rumSessionManager';
export interface Tracer {

@@ -5,0 +5,0 @@ traceFetch: (context: Partial<RumFetchStartContext>) => void;

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

import { LifeCycle } from './lifeCycle';
import type { LifeCycle } from './lifeCycle';
export interface EventCounts {

@@ -3,0 +3,0 @@ errorCount: number;

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

import { RelativeTime, Observable } from '@datadog/browser-core';
import { UrlContext } from '../rawRumEvent.types';
import { LocationChange } from '../browser/locationChangeObservable';
import { LifeCycle } from './lifeCycle';
import type { RelativeTime, Observable } from '@datadog/browser-core';
import type { UrlContext } from '../rawRumEvent.types';
import type { LocationChange } from '../browser/locationChangeObservable';
import type { LifeCycle } from './lifeCycle';
/**

@@ -6,0 +6,0 @@ * We want to attach to an event:

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

import { Duration, Observable } from '@datadog/browser-core';
import { LifeCycle } from './lifeCycle';
import type { Duration } from '@datadog/browser-core';
import { Observable } from '@datadog/browser-core';
import type { LifeCycle } from './lifeCycle';
export declare const PAGE_ACTIVITY_VALIDATION_DELAY = 100;

@@ -4,0 +5,0 @@ export declare const PAGE_ACTIVITY_END_DELAY = 100;

@@ -78,7 +78,9 @@ import { elapsed, monitor, Observable, timeStampNow } from '@datadog/browser-core';

var pendingRequestsCount = 0;
subscriptions.push(domMutationObservable.subscribe(function () { return notifyPageActivity(pendingRequestsCount); }), lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, function (entry) {
if (entry.entryType !== 'resource') {
return;
subscriptions.push(domMutationObservable.subscribe(function () { return notifyPageActivity(pendingRequestsCount); }), lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, function (entries) {
if (entries.some(function (_a) {
var entryType = _a.entryType;
return entryType === 'resource';
})) {
notifyPageActivity(pendingRequestsCount);
}
notifyPageActivity(pendingRequestsCount);
}), lifeCycle.subscribe(LifeCycleEventType.REQUEST_STARTED, function (startEvent) {

@@ -85,0 +87,0 @@ if (firstRequestIndex === undefined) {

/**
* Keep these types in a separate file in order to reference it from the official doc
*/
import { RumEventType } from './rawRumEvent.types';
import type { RumEventType } from './rawRumEvent.types';
export declare type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW ? RumViewEventDomainContext : T extends RumEventType.ACTION ? RumActionEventDomainContext : T extends RumEventType.RESOURCE ? RumFetchResourceEventDomainContext | RumXhrResourceEventDomainContext | RumOtherResourceEventDomainContext : T extends RumEventType.ERROR ? RumErrorEventDomainContext : T extends RumEventType.LONG_TASK ? RumLongTaskEventDomainContext : never;

@@ -6,0 +6,0 @@ export interface RumViewEventDomainContext {

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

import { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';
import { RumSessionPlan } from './domain/rumSessionManager';
import type { Context, Duration, ErrorSource, ErrorHandling, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';
import type { RumSessionPlan } from './domain/rumSessionManager';
export declare enum RumEventType {

@@ -149,2 +149,3 @@ ACTION = "action",

service?: string;
source: 'browser';
session: {

@@ -151,0 +152,0 @@ id: string;

@@ -143,3 +143,3 @@ /**

*/
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native';
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native' | 'flutter';
/**

@@ -640,2 +640,6 @@ * Resource properties of the error

/**
* The source of this event
*/
readonly source?: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native';
/**
* View properties

@@ -734,2 +738,3 @@ */

readonly test_execution_id: string;
[k: string]: unknown;
};

@@ -736,0 +741,0 @@ /**

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

import { RumConfiguration } from '../domain/configuration';
import { LifeCycle } from '../domain/lifeCycle';
import type { RumConfiguration } from '../domain/configuration';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startRumBatch(configuration: RumConfiguration, lifeCycle: LifeCycle): {
stop: () => void;
};

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

import { LifeCycle } from '../domain/lifeCycle';
import type { LifeCycle } from '../domain/lifeCycle';
export declare function startRumEventBridge(lifeCycle: LifeCycle): void;
{
"name": "@datadog/browser-rum-core",
"version": "4.1.0",
"version": "4.2.0",
"license": "Apache-2.0",

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

"dependencies": {
"@datadog/browser-core": "4.1.0",
"@datadog/browser-core": "4.2.0",
"tslib": "^1.10.0"

@@ -27,3 +27,3 @@ },

},
"gitHead": "27c7b4c01354dd77116f5bfb6eef370d4e2585bd"
"gitHead": "caceec86d8039d63ae5c176ba82e35e466e6cec7"
}

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

import { BuildEnv, BuildMode } from '@datadog/browser-core'
import type { BuildEnv, BuildMode } from '@datadog/browser-core'

@@ -3,0 +3,0 @@ export const buildEnv: BuildEnv = {

@@ -0,7 +1,6 @@

import type { RelativeTime, TimeStamp } from '@datadog/browser-core'
import {
ONE_SECOND,
RelativeTime,
getTimeStamp,
display,
TimeStamp,
DefaultPrivacyLevel,

@@ -12,2 +11,3 @@ updateExperimentalFeatures,

import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../test/specHelper'
import {

@@ -18,7 +18,7 @@ cleanupSyntheticsWorkerValues,

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

@@ -25,0 +25,0 @@ const noopStartRum = (): ReturnType<StartRum> => ({

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

import type { Context, InitConfiguration, InternalMonitoring, TimeStamp, RelativeTime } from '@datadog/browser-core'
import {
BoundedBuffer,
buildCookieOptions,
Context,
createContextManager,

@@ -9,11 +9,7 @@ deepClone,

monitor,
InitConfiguration,
clocksNow,
timeStampNow,
display,
InternalMonitoring,
callMonitored,
createHandlingStack,
TimeStamp,
RelativeTime,
canUseEventBridge,

@@ -23,9 +19,11 @@ areCookiesAuthorized,

} from '@datadog/browser-core'
import { LifeCycle } from '../domain/lifeCycle'
import { ParentContexts } from '../domain/parentContexts'
import { RumSessionManager } from '../domain/rumSessionManager'
import { CommonContext, User, ActionType, ReplayStats } from '../rawRumEvent.types'
import type { LifeCycle } from '../domain/lifeCycle'
import type { ParentContexts } from '../domain/parentContexts'
import type { RumSessionManager } from '../domain/rumSessionManager'
import type { CommonContext, User, ReplayStats } from '../rawRumEvent.types'
import { ActionType } from '../rawRumEvent.types'
import { willSyntheticsInjectRum } from '../domain/syntheticsContext'
import { RumConfiguration, RumInitConfiguration, validateAndBuildRumConfiguration } from '../domain/configuration'
import { startRum } from './startRum'
import type { RumConfiguration, RumInitConfiguration } from '../domain/configuration'
import { validateAndBuildRumConfiguration } from '../domain/configuration'
import type { startRum } from './startRum'

@@ -32,0 +30,0 @@ export type RumPublicApi = ReturnType<typeof makeRumPublicApi>

@@ -1,23 +0,18 @@

import {
RelativeTime,
Observable,
noop,
relativeNow,
isIE,
resetExperimentalFeatures,
updateExperimentalFeatures,
Context,
} from '@datadog/browser-core'
import { createRumSessionManagerMock, RumSessionManagerMock } from '../../test/mockRumSessionManager'
import { noopRecorderApi, setup, TestSetupBuilder } from '../../test/specHelper'
import { RumPerformanceNavigationTiming, RumPerformanceEntry } from '../browser/performanceCollection'
import { LifeCycle, LifeCycleEventType } from '../domain/lifeCycle'
import type { RelativeTime, Observable, Context } from '@datadog/browser-core'
import { noop, relativeNow, isIE, resetExperimentalFeatures, updateExperimentalFeatures } from '@datadog/browser-core'
import type { RumSessionManagerMock } from '../../test/mockRumSessionManager'
import { createRumSessionManagerMock } from '../../test/mockRumSessionManager'
import type { TestSetupBuilder } from '../../test/specHelper'
import { noopRecorderApi, setup } from '../../test/specHelper'
import type { RumPerformanceNavigationTiming, RumPerformanceEntry } from '../browser/performanceCollection'
import type { LifeCycle } from '../domain/lifeCycle'
import { LifeCycleEventType } from '../domain/lifeCycle'
import { SESSION_KEEP_ALIVE_INTERVAL, THROTTLE_VIEW_UPDATE_PERIOD } from '../domain/rumEventsCollection/view/trackViews'
import { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection'
import { RumEvent } from '../rumEvent.types'
import { LocationChange } from '../browser/locationChangeObservable'
import type { RumEvent } from '../rumEvent.types'
import type { LocationChange } from '../browser/locationChangeObservable'
import { startLongTaskCollection } from '../domain/rumEventsCollection/longTask/longTaskCollection'
import { RumSessionManager } from '..'
import type { RumSessionManager } from '..'
import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper'
import { RumConfiguration } from '../domain/configuration'
import type { RumConfiguration } from '../domain/configuration'
import { startRumEventCollection } from './startRum'

@@ -230,8 +225,10 @@

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, {
entryType: 'longtask',
startTime: relativeNow() - 5,
toJSON: noop,
duration: 5,
} as RumPerformanceEntry)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
{
entryType: 'longtask',
startTime: relativeNow() - 5,
toJSON: noop,
duration: 5,
} as RumPerformanceEntry,
])

@@ -273,3 +270,3 @@ clock.tick(THROTTLE_VIEW_UPDATE_PERIOD)

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_NAVIGATION_ENTRY])
clock.tick(THROTTLE_VIEW_UPDATE_PERIOD)

@@ -276,0 +273,0 @@

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

import { combine, InternalMonitoring, canUseEventBridge, Observable } from '@datadog/browser-core'
import type { InternalMonitoring, Observable } from '@datadog/browser-core'
import { combine, canUseEventBridge } from '@datadog/browser-core'
import { createDOMMutationObservable } from '../browser/domMutationObservable'

@@ -15,10 +16,12 @@ import { startPerformanceCollection } from '../browser/performanceCollection'

import { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection'
import { RumSessionManager, startRumSessionManager, startRumSessionManagerStub } from '../domain/rumSessionManager'
import { CommonContext } from '../rawRumEvent.types'
import type { RumSessionManager } from '../domain/rumSessionManager'
import { startRumSessionManager, startRumSessionManagerStub } from '../domain/rumSessionManager'
import type { CommonContext } from '../rawRumEvent.types'
import { startRumBatch } from '../transport/startRumBatch'
import { startRumEventBridge } from '../transport/startRumEventBridge'
import { startUrlContexts } from '../domain/urlContexts'
import { createLocationChangeObservable, LocationChange } from '../browser/locationChangeObservable'
import { RumConfiguration } from '../domain/configuration'
import { RecorderApi } from './rumPublicApi'
import type { LocationChange } from '../browser/locationChangeObservable'
import { createLocationChangeObservable } from '../browser/locationChangeObservable'
import type { RumConfiguration } from '../domain/configuration'
import type { RecorderApi } from './rumPublicApi'

@@ -25,0 +28,0 @@ export function startRum(

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

import { Observable, Subscription } from '@datadog/browser-core'
import type { Observable, Subscription } from '@datadog/browser-core'
import { mockLocation } from '../../../core/test/specHelper'
import { createLocationChangeObservable, LocationChange } from './locationChangeObservable'
import type { LocationChange } from './locationChangeObservable'
import { createLocationChangeObservable } from './locationChangeObservable'

@@ -5,0 +6,0 @@ describe('locationChangeObservable', () => {

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

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

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

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

import type { Duration, RelativeTime, TimeStamp } from '@datadog/browser-core'
import {
addEventListeners,
DOM_EVENT,
Duration,
getRelativeTime,

@@ -9,12 +9,11 @@ isNumber,

relativeNow,
RelativeTime,
runOnReadyState,
TimeStamp,
} from '@datadog/browser-core'
import { RumConfiguration } from '../domain/configuration'
import { LifeCycle, LifeCycleEventType } from '../domain/lifeCycle'
import type { RumConfiguration } from '../domain/configuration'
import type { LifeCycle } from '../domain/lifeCycle'
import { LifeCycleEventType } from '../domain/lifeCycle'
import { FAKE_INITIAL_DOCUMENT, isAllowedRequestUrl } from '../domain/rumEventsCollection/resource/resourceUtils'
import { getDocumentTraceId } from '../domain/tracing/getDocumentTraceId'
import { PerformanceEntryRepresentation } from '../domainContext.types'
import type { PerformanceEntryRepresentation } from '../domainContext.types'

@@ -110,11 +109,11 @@ export interface RumPerformanceResourceTiming {

retrieveInitialDocumentResourceTiming((timing) => {
handleRumPerformanceEntry(lifeCycle, configuration, timing)
handleRumPerformanceEntries(lifeCycle, configuration, [timing])
})
if (supportPerformanceObject()) {
handlePerformanceEntries(lifeCycle, configuration, performance.getEntries())
handleRumPerformanceEntries(lifeCycle, configuration, performance.getEntries())
}
if (window.PerformanceObserver) {
const handlePerformanceEntryList = monitor((entries: PerformanceObserverEntryList) =>
handlePerformanceEntries(lifeCycle, configuration, entries.getEntries())
handleRumPerformanceEntries(lifeCycle, configuration, entries.getEntries())
)

@@ -133,3 +132,4 @@ const mainEntries = ['resource', 'navigation', 'longtask', 'paint']

} catch (e) {
// Some old browser versions don't support PerformanceObserver without entryTypes option
// Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options
// In these cases, fallback to PerformanceObserver with entryTypes
mainEntries.push(...experimentalEntries)

@@ -150,3 +150,3 @@ }

retrieveNavigationTiming((timing) => {
handleRumPerformanceEntry(lifeCycle, configuration, timing)
handleRumPerformanceEntries(lifeCycle, configuration, [timing])
})

@@ -156,3 +156,3 @@ }

retrieveFirstInputTiming((timing) => {
handleRumPerformanceEntry(lifeCycle, configuration, timing)
handleRumPerformanceEntries(lifeCycle, configuration, [timing])
})

@@ -292,5 +292,9 @@ }

function handlePerformanceEntries(lifeCycle: LifeCycle, configuration: RumConfiguration, entries: PerformanceEntry[]) {
entries.forEach((entry) => {
if (
function handleRumPerformanceEntries(
lifeCycle: LifeCycle,
configuration: RumConfiguration,
entries: Array<PerformanceEntry | RumPerformanceEntry>
) {
const rumPerformanceEntries = entries.filter(
(entry) =>
entry.entryType === 'resource' ||

@@ -303,14 +307,11 @@ entry.entryType === 'navigation' ||

entry.entryType === 'layout-shift'
) {
handleRumPerformanceEntry(lifeCycle, configuration, (entry as unknown) as RumPerformanceEntry)
}
})
}
) as RumPerformanceEntry[]
function handleRumPerformanceEntry(lifeCycle: LifeCycle, configuration: RumConfiguration, entry: RumPerformanceEntry) {
if (isIncompleteNavigation(entry) || isForbiddenResource(configuration, entry)) {
return
const rumAllowedPerformanceEntries = rumPerformanceEntries.filter(
(entry) => !isIncompleteNavigation(entry) && !isForbiddenResource(configuration, entry)
)
if (rumAllowedPerformanceEntries.length) {
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, rumAllowedPerformanceEntries)
}
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, entry)
}

@@ -317,0 +318,0 @@

@@ -0,6 +1,5 @@

import type { RawError, RelativeTime } from '@datadog/browser-core'
import {
ErrorSource,
ONE_MINUTE,
RawError,
RelativeTime,
display,

@@ -12,2 +11,3 @@ updateExperimentalFeatures,

import { createRawRumEvent } from '../../test/fixtures'
import type { TestSetupBuilder } from '../../test/specHelper'
import {

@@ -19,10 +19,11 @@ cleanupSyntheticsWorkerValues,

setup,
TestSetupBuilder,
} from '../../test/specHelper'
import { RumEventDomainContext } from '../domainContext.types'
import { CommonContext, RawRumActionEvent, RawRumErrorEvent, RawRumEvent, RumEventType } from '../rawRumEvent.types'
import { RumActionEvent, RumErrorEvent, RumEvent } from '../rumEvent.types'
import type { RumEventDomainContext } from '../domainContext.types'
import type { CommonContext, RawRumActionEvent, RawRumErrorEvent, RawRumEvent } from '../rawRumEvent.types'
import { RumEventType } from '../rawRumEvent.types'
import type { RumActionEvent, RumErrorEvent, RumEvent } from '../rumEvent.types'
import { initEventBridgeStub, deleteEventBridgeStub } from '../../../core/test/specHelper'
import { startRumAssembly } from './assembly'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from './lifeCycle'
import type { LifeCycle, RawRumEventCollectedData } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'
import { RumSessionPlan } from './rumSessionManager'

@@ -302,2 +303,3 @@

expect(serverRumEvents[0].session.id).toBeDefined()
expect(serverRumEvents[0].source).toBe('browser')
})

@@ -304,0 +306,0 @@

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

import type { Context, RawError, EventRateLimiter } from '@datadog/browser-core'
import {
combine,
Context,
isEmptyObject,

@@ -9,9 +9,7 @@ limitModification,

display,
RawError,
createEventRateLimiter,
EventRateLimiter,
canUseEventBridge,
} from '@datadog/browser-core'
import { RumEventDomainContext } from '../domainContext.types'
import {
import type { RumEventDomainContext } from '../domainContext.types'
import type {
CommonContext,

@@ -23,5 +21,5 @@ RawRumErrorEvent,

RumContext,
RumEventType,
User,
} from '../rawRumEvent.types'
import { RumEventType } from '../rawRumEvent.types'
import { RumEvent } from '../rumEvent.types'

@@ -31,7 +29,9 @@ import { buildEnv } from '../boot/buildEnv'

import { getCiTestContext } from './ciTestContext'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { ParentContexts } from './parentContexts'
import { RumSessionManager, RumSessionPlan } from './rumSessionManager'
import { UrlContexts } from './urlContexts'
import { RumConfiguration } from './configuration'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'
import type { ParentContexts } from './parentContexts'
import type { RumSessionManager } from './rumSessionManager'
import { RumSessionPlan } from './rumSessionManager'
import type { UrlContexts } from './urlContexts'
import type { RumConfiguration } from './configuration'

@@ -117,2 +117,3 @@ enum SessionType {

service: configuration.service,
source: 'browser',
session: {

@@ -119,0 +120,0 @@ id: session.id,

@@ -0,6 +1,5 @@

import type { Configuration, InitConfiguration } from '@datadog/browser-core'
import {
Configuration,
DefaultPrivacyLevel,
display,
InitConfiguration,
isPercentage,

@@ -11,4 +10,4 @@ objectHasValue,

import { buildEnv } from '../boot/buildEnv'
import { RumEventDomainContext } from '../domainContext.types'
import { RumEvent } from '../rumEvent.types'
import type { RumEventDomainContext } from '../domainContext.types'
import type { RumEvent } from '../rumEvent.types'

@@ -15,0 +14,0 @@ export interface RumInitConfiguration extends InitConfiguration {

@@ -1,6 +0,8 @@

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

@@ -7,0 +9,0 @@ MAX_NUMBER_OF_STORED_FOREGROUND_PERIODS,

@@ -1,11 +0,4 @@

import {
addEventListener,
DOM_EVENT,
RelativeTime,
elapsed,
relativeNow,
Duration,
toServerDuration,
} from '@datadog/browser-core'
import { InForegroundPeriod } from '../rawRumEvent.types'
import type { RelativeTime, Duration } from '@datadog/browser-core'
import { addEventListener, DOM_EVENT, elapsed, relativeNow, toServerDuration } from '@datadog/browser-core'
import type { InForegroundPeriod } from '../rawRumEvent.types'

@@ -12,0 +5,0 @@ // Arbitrary value to cap number of element mostly for backend & to save bandwidth

@@ -1,8 +0,9 @@

import { RelativeTime } from '@datadog/browser-core'
import type { RelativeTime } from '@datadog/browser-core'
import { createRumSessionManagerMock } from '../../test/mockRumSessionManager'
import { setup, TestSetupBuilder } from '../../test/specHelper'
import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import { startInternalContext } from './internalContext'
import { ParentContexts } from './parentContexts'
import { UrlContexts } from './urlContexts'
import { RumSessionManager } from './rumSessionManager'
import type { ParentContexts } from './parentContexts'
import type { UrlContexts } from './urlContexts'
import type { RumSessionManager } from './rumSessionManager'

@@ -9,0 +10,0 @@ describe('internal context', () => {

@@ -1,6 +0,6 @@

import { RelativeTime } from '@datadog/browser-core'
import { InternalContext } from '../rawRumEvent.types'
import { ParentContexts } from './parentContexts'
import { RumSessionManager } from './rumSessionManager'
import { UrlContexts } from './urlContexts'
import type { RelativeTime } from '@datadog/browser-core'
import type { InternalContext } from '../rawRumEvent.types'
import type { ParentContexts } from './parentContexts'
import type { RumSessionManager } from './rumSessionManager'
import type { UrlContexts } from './urlContexts'

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

@@ -1,12 +0,12 @@

import { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core'
import { RumPerformanceEntry } from '../browser/performanceCollection'
import { RumEventDomainContext } from '../domainContext.types'
import { CommonContext, RawRumEvent } from '../rawRumEvent.types'
import { RumEvent } from '../rumEvent.types'
import { RequestCompleteEvent, RequestStartEvent } from './requestCollection'
import { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions'
import { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews'
import type { Context, RawError, RelativeTime, Subscription } from '@datadog/browser-core'
import type { RumPerformanceEntry } from '../browser/performanceCollection'
import type { RumEventDomainContext } from '../domainContext.types'
import type { CommonContext, RawRumEvent } from '../rawRumEvent.types'
import type { RumEvent } from '../rumEvent.types'
import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection'
import type { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions'
import type { ViewEvent, ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews'
export enum LifeCycleEventType {
PERFORMANCE_ENTRY_COLLECTED,
PERFORMANCE_ENTRIES_COLLECTED,
AUTO_ACTION_CREATED,

@@ -43,3 +43,3 @@ AUTO_ACTION_COMPLETED,

notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, data: RumPerformanceEntry): void
notify(eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, data: RumPerformanceEntry[]): void
notify(eventType: LifeCycleEventType.REQUEST_STARTED, data: RequestStartEvent): void

@@ -73,4 +73,4 @@ notify(eventType: LifeCycleEventType.REQUEST_COMPLETED, data: RequestCompleteEvent): void

subscribe(
eventType: LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
callback: (data: RumPerformanceEntry) => void
eventType: LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED,
callback: (data: RumPerformanceEntry[]) => void
): Subscription

@@ -77,0 +77,0 @@ subscribe(eventType: LifeCycleEventType.REQUEST_STARTED, callback: (data: RequestStartEvent) => void): Subscription

@@ -1,12 +0,10 @@

import { RelativeTime, relativeToClocks, CLEAR_OLD_CONTEXTS_INTERVAL } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../test/specHelper'
import type { RelativeTime } from '@datadog/browser-core'
import { relativeToClocks, CLEAR_OLD_CONTEXTS_INTERVAL } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import { LifeCycleEventType } from './lifeCycle'
import {
ACTION_CONTEXT_TIME_OUT_DELAY,
ParentContexts,
startParentContexts,
VIEW_CONTEXT_TIME_OUT_DELAY,
} from './parentContexts'
import { AutoAction } from './rumEventsCollection/action/trackActions'
import { ViewCreatedEvent } from './rumEventsCollection/view/trackViews'
import type { ParentContexts } from './parentContexts'
import { ACTION_CONTEXT_TIME_OUT_DELAY, startParentContexts, VIEW_CONTEXT_TIME_OUT_DELAY } from './parentContexts'
import type { AutoAction } from './rumEventsCollection/action/trackActions'
import type { ViewCreatedEvent } from './rumEventsCollection/view/trackViews'

@@ -13,0 +11,0 @@ describe('parentContexts', () => {

@@ -1,6 +0,8 @@

import { ONE_MINUTE, RelativeTime, SESSION_TIME_OUT_DELAY, ContextHistory } from '@datadog/browser-core'
import { ActionContext, ViewContext } from '../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions'
import { ViewCreatedEvent } from './rumEventsCollection/view/trackViews'
import type { RelativeTime } from '@datadog/browser-core'
import { ONE_MINUTE, SESSION_TIME_OUT_DELAY, ContextHistory } from '@datadog/browser-core'
import type { ActionContext, ViewContext } from '../rawRumEvent.types'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'
import type { AutoAction, AutoActionCreatedEvent } from './rumEventsCollection/action/trackActions'
import type { ViewCreatedEvent } from './rumEventsCollection/view/trackViews'

@@ -7,0 +9,0 @@ export const VIEW_CONTEXT_TIME_OUT_DELAY = SESSION_TIME_OUT_DELAY

import { isIE, RequestType } from '@datadog/browser-core'
import { FetchStub, FetchStubManager, SPEC_ENDPOINTS, stubFetch, stubXhr, withXhr } from '../../../core/test/specHelper'
import { RumConfiguration, validateAndBuildRumConfiguration } from './configuration'
import type { FetchStub, FetchStubManager } from '../../../core/test/specHelper'
import { SPEC_ENDPOINTS, stubFetch, stubXhr, withXhr } from '../../../core/test/specHelper'
import type { RumConfiguration } from './configuration'
import { validateAndBuildRumConfiguration } from './configuration'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RequestCompleteEvent, RequestStartEvent, trackFetch, trackXhr } from './requestCollection'
import { clearTracingIfNeeded, TraceIdentifier, Tracer } from './tracing/tracer'
import type { RequestCompleteEvent, RequestStartEvent } from './requestCollection'
import { trackFetch, trackXhr } from './requestCollection'
import type { Tracer } from './tracing/tracer'
import { clearTracingIfNeeded, TraceIdentifier } from './tracing/tracer'

@@ -73,3 +77,2 @@ const configuration: RumConfiguration = {

expect(request.status).toEqual(500)
expect(request.responseText).toEqual('fetch error')
done()

@@ -197,3 +200,2 @@ })

expect(request.status).toEqual(200)
expect(request.responseText).toEqual('ok')
done()

@@ -200,0 +202,0 @@ },

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

import {
import type {
Duration,
RequestType,
initFetchObservable,
initXhrObservable,
XhrCompleteContext,

@@ -12,7 +9,10 @@ XhrStartContext,

} from '@datadog/browser-core'
import { RumSessionManager } from '..'
import { RumConfiguration } from './configuration'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RequestType, initFetchObservable, initXhrObservable } from '@datadog/browser-core'
import type { RumSessionManager } from '..'
import type { RumConfiguration } from './configuration'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'
import { isAllowedRequestUrl } from './rumEventsCollection/resource/resourceUtils'
import { startTracer, TraceIdentifier, Tracer } from './tracing/tracer'
import type { TraceIdentifier, Tracer } from './tracing/tracer'
import { startTracer } from './tracing/tracer'

@@ -39,3 +39,2 @@ export interface CustomContext {

status: number
responseText?: string
responseType?: string

@@ -87,3 +86,2 @@ startClocks: ClocksState

requestIndex: context.requestIndex,
responseText: context.responseText,
spanId: context.spanId,

@@ -127,3 +125,2 @@ startClocks: context.startClocks,

requestIndex: context.requestIndex,
responseText: context.responseText,
responseType: context.responseType,

@@ -130,0 +127,0 @@ spanId: context.spanId,

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

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

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

@@ -1,7 +0,11 @@

import { combine, toServerDuration, generateUUID, Observable } from '@datadog/browser-core'
import { ActionType, CommonContext, RumEventType, RawRumActionEvent } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from '../../lifeCycle'
import { ForegroundContexts } from '../../foregroundContexts'
import { RumConfiguration } from '../../configuration'
import { AutoAction, CustomAction, trackActions } from './trackActions'
import type { Observable } from '@datadog/browser-core'
import { combine, toServerDuration, generateUUID } from '@datadog/browser-core'
import type { CommonContext, RawRumActionEvent } from '../../../rawRumEvent.types'
import { ActionType, RumEventType } from '../../../rawRumEvent.types'
import type { LifeCycle, RawRumEventCollectedData } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { ForegroundContexts } from '../../foregroundContexts'
import type { RumConfiguration } from '../../configuration'
import type { AutoAction, CustomAction } from './trackActions'
import { trackActions } from './trackActions'

@@ -8,0 +12,0 @@ export function startActionCollection(

@@ -1,9 +0,13 @@

import { Context, DOM_EVENT, ClocksState, Observable } from '@datadog/browser-core'
import { Clock, createNewEvent } from '../../../../../core/test/specHelper'
import { setup, TestSetupBuilder } from '../../../../test/specHelper'
import type { Context, ClocksState, Observable } from '@datadog/browser-core'
import { DOM_EVENT } from '@datadog/browser-core'
import type { Clock } from '../../../../../core/test/specHelper'
import { createNewEvent } from '../../../../../core/test/specHelper'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import { RumEventType, ActionType } from '../../../rawRumEvent.types'
import { RumEvent } from '../../../rumEvent.types'
import type { RumEvent } from '../../../rumEvent.types'
import { LifeCycleEventType } from '../../lifeCycle'
import { PAGE_ACTIVITY_VALIDATION_DELAY } from '../../waitIdlePage'
import { AutoAction, AUTO_ACTION_MAX_DURATION, trackActions } from './trackActions'
import type { AutoAction } from './trackActions'
import { AUTO_ACTION_MAX_DURATION, trackActions } from './trackActions'

@@ -10,0 +14,0 @@ // Used to wait some time after the creation of a action

@@ -1,16 +0,9 @@

import {
addEventListener,
Context,
DOM_EVENT,
Duration,
generateUUID,
ClocksState,
clocksNow,
ONE_SECOND,
Observable,
} from '@datadog/browser-core'
import type { Context, Duration, ClocksState, Observable } from '@datadog/browser-core'
import { addEventListener, DOM_EVENT, generateUUID, clocksNow, ONE_SECOND } from '@datadog/browser-core'
import { ActionType } from '../../../rawRumEvent.types'
import { RumConfiguration } from '../../configuration'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { EventCounts, trackEventCounts } from '../../trackEventCounts'
import type { RumConfiguration } from '../../configuration'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { EventCounts } from '../../trackEventCounts'
import { trackEventCounts } from '../../trackEventCounts'
import { waitIdlePage } from '../../waitIdlePage'

@@ -17,0 +10,0 @@ import { getActionNameFromElement } from './getActionNameFromElement'

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

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

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

@@ -0,8 +1,6 @@

import type { Context, RawError, ClocksState } from '@datadog/browser-core'
import {
computeStackTrace,
Context,
formatUnknownError,
RawError,
ErrorSource,
ClocksState,
generateUUID,

@@ -14,5 +12,7 @@ ErrorHandling,

} from '@datadog/browser-core'
import { CommonContext, RawRumErrorEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from '../../lifeCycle'
import { ForegroundContexts } from '../../foregroundContexts'
import type { CommonContext, RawRumErrorEvent } from '../../../rawRumEvent.types'
import { RumEventType } from '../../../rawRumEvent.types'
import type { LifeCycle, RawRumEventCollectedData } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { ForegroundContexts } from '../../foregroundContexts'

@@ -19,0 +19,0 @@ export interface ProvidedError {

@@ -1,5 +0,7 @@

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

@@ -36,3 +38,3 @@ import { LifeCycleEventType } from '../../lifeCycle'

const { lifeCycle, rawRumEvents } = setupBuilder.build()
;[
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
LONG_TASK,

@@ -42,5 +44,4 @@ { duration: 100 as Duration, entryType: 'navigation', startTime: 1234 },

{ duration: 100 as Duration, entryType: 'paint', startTime: 1234 },
].forEach((entry) => {
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, entry as RumPerformanceEntry)
})
] as RumPerformanceEntry[])
expect(rawRumEvents.length).toBe(1)

@@ -53,7 +54,7 @@ })

sessionManager.setReplayPlan()
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, LONG_TASK)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [LONG_TASK])
expect(rawRumEvents.length).toBe(1)
sessionManager.setLitePlan()
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, LONG_TASK)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [LONG_TASK])
expect(rawRumEvents.length).toBe(1)

@@ -64,3 +65,3 @@ })

const { lifeCycle, rawRumEvents } = setupBuilder.build()
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, LONG_TASK)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [LONG_TASK])

@@ -67,0 +68,0 @@ expect(rawRumEvents[0].startTime).toBe(1234 as RelativeTime)

import { toServerDuration, relativeToClocks, generateUUID } from '@datadog/browser-core'
import { RawRumLongTaskEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { RumSessionManager } from '../../rumSessionManager'
import type { RawRumLongTaskEvent } from '../../../rawRumEvent.types'
import { RumEventType } from '../../../rawRumEvent.types'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { RumSessionManager } from '../../rumSessionManager'
export function startLongTaskCollection(lifeCycle: LifeCycle, sessionManager: RumSessionManager) {
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType !== 'longtask') {
return
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
for (const entry of entries) {
if (entry.entryType !== 'longtask') {
break
}
const session = sessionManager.findTrackedSession(entry.startTime)
if (!session || session.hasLitePlan) {
break
}
const startClocks = relativeToClocks(entry.startTime)
const rawRumEvent: RawRumLongTaskEvent = {
date: startClocks.timeStamp,
long_task: {
id: generateUUID(),
duration: toServerDuration(entry.duration),
},
type: RumEventType.LONG_TASK,
}
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
})
}
const session = sessionManager.findTrackedSession(entry.startTime)
if (!session || session.hasLitePlan) {
return
}
const startClocks = relativeToClocks(entry.startTime)
const rawRumEvent: RawRumLongTaskEvent = {
date: startClocks.timeStamp,
long_task: {
id: generateUUID(),
duration: toServerDuration(entry.duration),
},
type: RumEventType.LONG_TASK,
}
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {
rawRumEvent,
startTime: startClocks.relative,
domainContext: { performanceEntry: entry.toJSON() },
})
})
}

@@ -1,5 +0,6 @@

import { Duration, isIE, RelativeTime, relativeToClocks } from '@datadog/browser-core'
import type { Duration, RelativeTime } from '@datadog/browser-core'
import { isIE, relativeToClocks } from '@datadog/browser-core'
import { createResourceEntry } from '../../../../test/fixtures'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { RequestCompleteEvent } from '../../requestCollection'
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import type { RequestCompleteEvent } from '../../requestCollection'

@@ -6,0 +7,0 @@ import { matchRequestTiming } from './matchRequestTiming'

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

import { Duration, RelativeTime } from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { RequestCompleteEvent } from '../../requestCollection'
import type { Duration, RelativeTime } from '@datadog/browser-core'
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import type { RequestCompleteEvent } from '../../requestCollection'
import { toValidEntry } from './resourceUtils'

@@ -5,0 +5,0 @@

@@ -1,15 +0,10 @@

import {
Duration,
isIE,
RelativeTime,
RequestType,
ResourceType,
ServerDuration,
TimeStamp,
} from '@datadog/browser-core'
import type { Duration, RelativeTime, ServerDuration, TimeStamp } from '@datadog/browser-core'
import { isIE, RequestType, ResourceType } from '@datadog/browser-core'
import { createResourceEntry } from '../../../../test/fixtures'
import { setup, TestSetupBuilder } from '../../../../test/specHelper'
import { RawRumResourceEvent, RumEventType } from '../../../rawRumEvent.types'
import type { TestSetupBuilder } from '../../../../test/specHelper'
import { setup } from '../../../../test/specHelper'
import type { RawRumResourceEvent } from '../../../rawRumEvent.types'
import { RumEventType } from '../../../rawRumEvent.types'
import { LifeCycleEventType } from '../../lifeCycle'
import { RequestCompleteEvent } from '../../requestCollection'
import type { RequestCompleteEvent } from '../../requestCollection'
import { TraceIdentifier } from '../../tracing/tracer'

@@ -38,3 +33,3 @@ import { startResourceCollection } from './resourceCollection'

})
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, performanceEntry)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [performanceEntry])

@@ -156,8 +151,7 @@ expect(rawRumEvents[0].startTime).toBe(1234 as RelativeTime)

const { lifeCycle, rawRumEvents } = setupBuilder.build()
lifeCycle.notify(
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
createResourceEntry({
traceId: '1234',
})
)
}),
])
const traceInfo = (rawRumEvents[0].rawRumEvent as RawRumResourceEvent)._dd!

@@ -164,0 +158,0 @@ expect(traceInfo).toBeDefined()

@@ -9,8 +9,5 @@ import {

} from '@datadog/browser-core'
import {
RumPerformanceEntry,
RumPerformanceResourceTiming,
supportPerformanceEntry,
} from '../../../browser/performanceCollection'
import {
import type { RumPerformanceEntry, RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { supportPerformanceEntry } from '../../../browser/performanceCollection'
import type {
PerformanceEntryRepresentation,

@@ -20,5 +17,7 @@ RumXhrResourceEventDomainContext,

} from '../../../domainContext.types'
import { RawRumResourceEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from '../../lifeCycle'
import { RequestCompleteEvent } from '../../requestCollection'
import type { RawRumResourceEvent } from '../../../rawRumEvent.types'
import { RumEventType } from '../../../rawRumEvent.types'
import type { LifeCycle, RawRumEventCollectedData } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { RequestCompleteEvent } from '../../requestCollection'
import { matchRequestTiming } from './matchRequestTiming'

@@ -38,5 +37,7 @@ import {

lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType === 'resource' && !isRequestKind(entry)) {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry))
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
for (const entry of entries) {
if (entry.entryType === 'resource' && !isRequestKind(entry)) {
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, processResourceEntry(entry))
}
}

@@ -43,0 +44,0 @@ })

@@ -1,5 +0,6 @@

import { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core'
import type { Duration, RelativeTime, ServerDuration } from '@datadog/browser-core'
import { SPEC_ENDPOINTS } from '../../../../../core/test/specHelper'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { RumConfiguration, validateAndBuildRumConfiguration } from '../../configuration'
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import type { RumConfiguration } from '../../configuration'
import { validateAndBuildRumConfiguration } from '../../configuration'
import {

@@ -6,0 +7,0 @@ computePerformanceResourceDetails,

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

import type { RelativeTime, ServerDuration } from '@datadog/browser-core'
import {

@@ -7,11 +8,9 @@ addMonitoringMessage,

isValidUrl,
RelativeTime,
ResourceType,
ServerDuration,
toServerDuration,
} from '@datadog/browser-core'
import { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import type { RumPerformanceResourceTiming } from '../../../browser/performanceCollection'
import { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types'
import { RumConfiguration } from '../../configuration'
import type { PerformanceResourceDetailsElement } from '../../../rawRumEvent.types'
import type { RumConfiguration } from '../../configuration'

@@ -18,0 +17,0 @@ export interface PerformanceResourceDetails {

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

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

@@ -3,0 +4,0 @@ import { resetFirstHidden, trackFirstHidden } from './trackFirstHidden'

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

import { addEventListeners, DOM_EVENT, EventEmitter, RelativeTime } from '@datadog/browser-core'
import type { EventEmitter, RelativeTime } from '@datadog/browser-core'
import { addEventListeners, DOM_EVENT } from '@datadog/browser-core'

@@ -3,0 +4,0 @@ let trackFirstHiddenSingleton: { timeStamp: RelativeTime } | undefined

@@ -1,5 +0,7 @@

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

@@ -12,4 +14,4 @@ RumLargestContentfulPaintTiming,

import { resetFirstHidden } from './trackFirstHidden'
import type { Timings } from './trackInitialViewTimings'
import {
Timings,
trackFirstContentfulPaintTiming,

@@ -65,5 +67,7 @@ trackFirstInputTimings,

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_FIRST_INPUT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
FAKE_NAVIGATION_ENTRY,
FAKE_PAINT_ENTRY,
FAKE_FIRST_INPUT_ENTRY,
])

@@ -99,3 +103,3 @@ expect(timingsCallback).toHaveBeenCalledTimes(3)

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_NAVIGATION_ENTRY])

@@ -131,3 +135,3 @@ expect(navigationTimingsCallback).toHaveBeenCalledTimes(1)

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_PAINT_ENTRY])

@@ -141,3 +145,3 @@ expect(fcpCallback).toHaveBeenCalledTimes(1 as RelativeTime)

const { lifeCycle } = setupBuilder.build()
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_PAINT_ENTRY])
expect(fcpCallback).not.toHaveBeenCalled()

@@ -149,6 +153,8 @@ })

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, {
...FAKE_PAINT_ENTRY,
startTime: TIMING_MAXIMUM_DELAY as RelativeTime,
})
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
{
...FAKE_PAINT_ENTRY,
startTime: TIMING_MAXIMUM_DELAY as RelativeTime,
},
])
expect(fcpCallback).not.toHaveBeenCalled()

@@ -181,3 +187,3 @@ })

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY])
expect(lcpCallback).toHaveBeenCalledTimes(1 as RelativeTime)

@@ -192,3 +198,3 @@ expect(lcpCallback).toHaveBeenCalledWith(789 as RelativeTime)

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY])
expect(lcpCallback).not.toHaveBeenCalled()

@@ -201,3 +207,3 @@ })

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY])

@@ -210,6 +216,8 @@ expect(lcpCallback).not.toHaveBeenCalled()

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, {
...FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY,
startTime: TIMING_MAXIMUM_DELAY as RelativeTime,
})
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
{
...FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY,
startTime: TIMING_MAXIMUM_DELAY as RelativeTime,
},
])
expect(lcpCallback).not.toHaveBeenCalled()

@@ -240,3 +248,3 @@ })

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_FIRST_INPUT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_FIRST_INPUT_ENTRY])
expect(fitCallback).toHaveBeenCalledTimes(1)

@@ -250,3 +258,3 @@ expect(fitCallback).toHaveBeenCalledWith({ firstInputDelay: 100, firstInputTime: 1000 })

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_FIRST_INPUT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_FIRST_INPUT_ENTRY])

@@ -259,7 +267,9 @@ expect(fitCallback).not.toHaveBeenCalled()

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, {
entryType: 'first-input' as const,
processingStart: 900 as RelativeTime,
startTime: 1000 as RelativeTime,
})
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
{
entryType: 'first-input' as const,
processingStart: 900 as RelativeTime,
startTime: 1000 as RelativeTime,
},
])

@@ -266,0 +276,0 @@ expect(fitCallback).toHaveBeenCalledTimes(1)

@@ -1,11 +0,10 @@

import {
addEventListeners,
DOM_EVENT,
Duration,
elapsed,
EventEmitter,
RelativeTime,
ONE_MINUTE,
} from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import type { Duration, EventEmitter, RelativeTime } from '@datadog/browser-core'
import { addEventListeners, DOM_EVENT, elapsed, ONE_MINUTE, find, findLast } from '@datadog/browser-core'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type {
RumFirstInputTiming,
RumLargestContentfulPaintTiming,
RumPerformancePaintTiming,
} from '../../../browser/performanceCollection'
import { trackFirstHidden } from './trackFirstHidden'

@@ -62,10 +61,12 @@

export function trackNavigationTimings(lifeCycle: LifeCycle, callback: (timings: Partial<Timings>) => void) {
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
})
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
for (const entry of entries) {
if (entry.entryType === 'navigation') {
callback({
domComplete: entry.domComplete,
domContentLoaded: entry.domContentLoadedEventEnd,
domInteractive: entry.domInteractive,
loadEvent: entry.loadEventEnd,
})
}
}

@@ -79,10 +80,13 @@ })

const firstHidden = trackFirstHidden()
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (
entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY
) {
callback(entry.startTime)
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
const fcpEntry = find(
entries,
(entry): entry is RumPerformancePaintTiming =>
entry.entryType === 'paint' &&
entry.name === 'first-contentful-paint' &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY
)
if (fcpEntry) {
callback(fcpEntry.startTime)
}

@@ -120,11 +124,14 @@ })

const { unsubscribe: unsubscribeLifeCycle } = lifeCycle.subscribe(
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
(entry) => {
if (
entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY
) {
callback(entry.startTime)
LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED,
(entries) => {
const lcpEntry = findLast(
entries,
(entry): entry is RumLargestContentfulPaintTiming =>
entry.entryType === 'largest-contentful-paint' &&
entry.startTime < firstInteractionTimestamp &&
entry.startTime < firstHidden.timeStamp &&
entry.startTime < TIMING_MAXIMUM_DELAY
)
if (lcpEntry) {
callback(lcpEntry.startTime)
}

@@ -156,5 +163,10 @@ }

const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp) {
const firstInputDelay = elapsed(entry.startTime, entry.processingStart)
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
const firstInputEntry = find(
entries,
(entry): entry is RumFirstInputTiming =>
entry.entryType === 'first-input' && entry.startTime < firstHidden.timeStamp
)
if (firstInputEntry) {
const firstInputDelay = elapsed(firstInputEntry.startTime, firstInputEntry.processingStart)
callback({

@@ -164,3 +176,3 @@ // Ensure firstInputDelay to be positive, see

firstInputDelay: firstInputDelay >= 0 ? firstInputDelay : (0 as Duration),
firstInputTime: entry.startTime as Duration,
firstInputTime: firstInputEntry.startTime as Duration,
})

@@ -167,0 +179,0 @@ }

@@ -1,7 +0,10 @@

import { Context, RelativeTime, Duration, relativeNow } from '@datadog/browser-core'
import { RumEvent } from '../../../rumEvent.types'
import { TestSetupBuilder, setup, setupViewTest, ViewTest } from '../../../../test/specHelper'
import { RumPerformanceNavigationTiming } from '../../../browser/performanceCollection'
import type { Context, RelativeTime, Duration } from '@datadog/browser-core'
import { relativeNow } from '@datadog/browser-core'
import type { RumEvent } from '../../../rumEvent.types'
import type { TestSetupBuilder, ViewTest } from '../../../../test/specHelper'
import { setup, setupViewTest } from '../../../../test/specHelper'
import type { RumPerformanceNavigationTiming } from '../../../browser/performanceCollection'
import { RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import { PAGE_ACTIVITY_END_DELAY, PAGE_ACTIVITY_VALIDATION_DELAY } from '../../waitIdlePage'

@@ -90,3 +93,3 @@ import { THROTTLE_VIEW_UPDATE_PERIOD } from './trackViews'

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_NAVIGATION_ENTRY])
clock.tick(THROTTLE_VIEW_UPDATE_PERIOD)

@@ -106,6 +109,5 @@

lifeCycle.notify(
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
FAKE_NAVIGATION_ENTRY_WITH_LOADEVENT_AFTER_ACTIVITY_TIMING
)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
FAKE_NAVIGATION_ENTRY_WITH_LOADEVENT_AFTER_ACTIVITY_TIMING,
])

@@ -131,6 +133,5 @@ domMutationObservable.notify()

clock.tick(BEFORE_PAGE_ACTIVITY_VALIDATION_DELAY)
lifeCycle.notify(
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
FAKE_NAVIGATION_ENTRY_WITH_LOADEVENT_BEFORE_ACTIVITY_TIMING
)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
FAKE_NAVIGATION_ENTRY_WITH_LOADEVENT_BEFORE_ACTIVITY_TIMING,
])
domMutationObservable.notify()

@@ -282,8 +283,10 @@ clock.tick(AFTER_PAGE_ACTIVITY_END_DELAY)

function newLayoutShift(lifeCycle: LifeCycle, { value = 0.1, hadRecentInput = false }) {
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, {
entryType: 'layout-shift',
startTime: relativeNow(),
hadRecentInput,
value,
})
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
{
entryType: 'layout-shift',
startTime: relativeNow(),
hadRecentInput,
value,
},
])
}

@@ -290,0 +293,0 @@

@@ -1,6 +0,10 @@

import { Duration, noop, round, RelativeTime, ONE_SECOND, Observable } from '@datadog/browser-core'
import { RumLayoutShiftTiming, supportPerformanceTimingEvent } from '../../../browser/performanceCollection'
import type { Duration, RelativeTime, Observable } from '@datadog/browser-core'
import { noop, round, ONE_SECOND } from '@datadog/browser-core'
import type { RumLayoutShiftTiming } from '../../../browser/performanceCollection'
import { supportPerformanceTimingEvent } from '../../../browser/performanceCollection'
import { ViewLoadingType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { EventCounts, trackEventCounts } from '../../trackEventCounts'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { EventCounts } from '../../trackEventCounts'
import { trackEventCounts } from '../../trackEventCounts'
import { waitIdlePage } from '../../waitIdlePage'

@@ -130,8 +134,10 @@

const window = slidingSessionWindow()
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry)
if (window.value() > maxClsValue) {
maxClsValue = window.value()
callback(round(maxClsValue, 4))
const { unsubscribe: stop } = lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
for (const entry of entries) {
if (entry.entryType === 'layout-shift' && !entry.hadRecentInput) {
window.update(entry)
if (window.value() > maxClsValue) {
maxClsValue = window.value()
callback(round(maxClsValue, 4))
}
}

@@ -138,0 +144,0 @@ }

@@ -1,4 +0,6 @@

import { Duration, RelativeTime, timeStampNow, display, relativeToClocks, relativeNow } from '@datadog/browser-core'
import { setup, TestSetupBuilder, setupViewTest, ViewTest } from '../../../../test/specHelper'
import {
import type { Duration, RelativeTime } from '@datadog/browser-core'
import { timeStampNow, display, relativeToClocks, relativeNow } from '@datadog/browser-core'
import type { TestSetupBuilder, ViewTest } from '../../../../test/specHelper'
import { setup, setupViewTest } from '../../../../test/specHelper'
import type {
RumLargestContentfulPaintTiming,

@@ -10,3 +12,4 @@ RumPerformanceNavigationTiming,

import { LifeCycleEventType } from '../../lifeCycle'
import { THROTTLE_VIEW_UPDATE_PERIOD, ViewEvent } from './trackViews'
import type { ViewEvent } from './trackViews'
import { THROTTLE_VIEW_UPDATE_PERIOD } from './trackViews'

@@ -134,3 +137,3 @@ const FAKE_PAINT_ENTRY: RumPerformancePaintTiming = {

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [FAKE_NAVIGATION_ENTRY])

@@ -157,5 +160,7 @@ expect(getViewUpdateCount()).toEqual(1)

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
FAKE_PAINT_ENTRY,
FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY,
FAKE_NAVIGATION_ENTRY,
])
expect(getViewUpdateCount()).toEqual(1)

@@ -196,5 +201,7 @@

lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, FAKE_NAVIGATION_ENTRY)
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [
FAKE_PAINT_ENTRY,
FAKE_LARGEST_CONTENTFUL_PAINT_ENTRY,
FAKE_NAVIGATION_ENTRY,
])

@@ -201,0 +208,0 @@ clock.tick(THROTTLE_VIEW_UPDATE_PERIOD)

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

import type { Duration, ClocksState, TimeStamp, Observable, Subscription, RelativeTime } from '@datadog/browser-core'
import {
Duration,
elapsed,

@@ -8,19 +8,17 @@ generateUUID,

throttle,
ClocksState,
clocksNow,
clocksOrigin,
timeStampNow,
TimeStamp,
display,
Observable,
Subscription,
RelativeTime,
looksLikeRelativeTime,
} from '@datadog/browser-core'
import { ViewLoadingType, ViewCustomTimings } from '../../../rawRumEvent.types'
import type { ViewCustomTimings } from '../../../rawRumEvent.types'
import { ViewLoadingType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from '../../lifeCycle'
import { EventCounts } from '../../trackEventCounts'
import { LocationChange } from '../../../browser/locationChangeObservable'
import { Timings, trackInitialViewTimings } from './trackInitialViewTimings'
import type { LifeCycle } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { EventCounts } from '../../trackEventCounts'
import type { LocationChange } from '../../../browser/locationChangeObservable'
import type { Timings } from './trackInitialViewTimings'
import { trackInitialViewTimings } from './trackInitialViewTimings'
import { trackViewMetrics } from './trackViewMetrics'

@@ -27,0 +25,0 @@

@@ -1,7 +0,9 @@

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

@@ -8,0 +10,0 @@

@@ -1,17 +0,13 @@

import {
Duration,
isEmptyObject,
mapValues,
ServerDuration,
toServerDuration,
Observable,
isNumber,
} from '@datadog/browser-core'
import { RecorderApi } from '../../../boot/rumPublicApi'
import { RawRumViewEvent, RumEventType } from '../../../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from '../../lifeCycle'
import { ForegroundContexts } from '../../foregroundContexts'
import { LocationChange } from '../../../browser/locationChangeObservable'
import { RumConfiguration } from '../../configuration'
import { trackViews, ViewEvent } from './trackViews'
import type { Duration, ServerDuration, Observable } from '@datadog/browser-core'
import { isEmptyObject, mapValues, toServerDuration, isNumber } from '@datadog/browser-core'
import type { RecorderApi } from '../../../boot/rumPublicApi'
import type { RawRumViewEvent } from '../../../rawRumEvent.types'
import { RumEventType } from '../../../rawRumEvent.types'
import type { LifeCycle, RawRumEventCollectedData } from '../../lifeCycle'
import { LifeCycleEventType } from '../../lifeCycle'
import type { ForegroundContexts } from '../../foregroundContexts'
import type { LocationChange } from '../../../browser/locationChangeObservable'
import type { RumConfiguration } from '../../configuration'
import type { ViewEvent } from './trackViews'
import { trackViews } from './trackViews'

@@ -18,0 +14,0 @@ export function startViewCollection(

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

import type { RelativeTime } from '@datadog/browser-core'
import {

@@ -9,6 +10,7 @@ COOKIE_ACCESS_DELAY,

ONE_SECOND,
RelativeTime,
} from '@datadog/browser-core'
import { Clock, mockClock } from '../../../core/test/specHelper'
import { RumConfiguration, validateAndBuildRumConfiguration } from './configuration'
import type { Clock } from '../../../core/test/specHelper'
import { mockClock } from '../../../core/test/specHelper'
import type { RumConfiguration } from './configuration'
import { validateAndBuildRumConfiguration } from './configuration'

@@ -15,0 +17,0 @@ import { LifeCycle, LifeCycleEventType } from './lifeCycle'

@@ -1,4 +0,6 @@

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

@@ -5,0 +7,0 @@ export const RUM_SESSION_KEY = 'rum'

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

import { TimeStamp } from '@datadog/browser-core'
import type { TimeStamp } from '@datadog/browser-core'
import {

@@ -3,0 +3,0 @@ createDocumentTraceData,

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

import { findCommaSeparatedValue, ONE_MINUTE, TimeStamp } from '@datadog/browser-core'
import type { TimeStamp } from '@datadog/browser-core'
import { findCommaSeparatedValue, ONE_MINUTE } from '@datadog/browser-core'

@@ -3,0 +4,0 @@ interface DocumentTraceData {

import { isIE, objectEntries } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../../test/specHelper'
import { createRumSessionManagerMock, RumSessionManagerMock } from '../../../test/mockRumSessionManager'
import { RumFetchCompleteContext, RumFetchStartContext, RumXhrStartContext } from '../requestCollection'
import type { TestSetupBuilder } from '../../../test/specHelper'
import { setup } from '../../../test/specHelper'
import type { RumSessionManagerMock } from '../../../test/mockRumSessionManager'
import { createRumSessionManagerMock } from '../../../test/mockRumSessionManager'
import type { RumFetchCompleteContext, RumFetchStartContext, RumXhrStartContext } from '../requestCollection'
import { validateAndBuildRumConfiguration } from '../configuration'

@@ -6,0 +8,0 @@ import { startTracer, TraceIdentifier } from './tracer'

import { getOrigin, objectEntries } from '@datadog/browser-core'
import { RumConfiguration } from '../configuration'
import {
import type { RumConfiguration } from '../configuration'
import type {
RumFetchCompleteContext,

@@ -9,3 +9,3 @@ RumFetchStartContext,

} from '../requestCollection'
import { RumSessionManager } from '../rumSessionManager'
import type { RumSessionManager } from '../rumSessionManager'

@@ -12,0 +12,0 @@ export interface Tracer {

@@ -1,6 +0,8 @@

import { Context, objectValues } from '@datadog/browser-core'
import { RumEvent } from '../rumEvent.types'
import type { Context } from '@datadog/browser-core'
import { objectValues } from '@datadog/browser-core'
import type { RumEvent } from '../rumEvent.types'
import { RumEventType } from '../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { EventCounts, trackEventCounts } from './trackEventCounts'
import type { EventCounts } from './trackEventCounts'
import { trackEventCounts } from './trackEventCounts'

@@ -7,0 +9,0 @@ describe('trackEventCounts', () => {

import { noop } from '@datadog/browser-core'
import { RumEventType } from '../rawRumEvent.types'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'

@@ -5,0 +6,0 @@ export interface EventCounts {

@@ -1,5 +0,8 @@

import { relativeToClocks, RelativeTime } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../test/specHelper'
import { startUrlContexts, UrlContexts } from './urlContexts'
import { ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews'
import type { RelativeTime } from '@datadog/browser-core'
import { relativeToClocks } from '@datadog/browser-core'
import type { TestSetupBuilder } from '../../test/specHelper'
import { setup } from '../../test/specHelper'
import type { UrlContexts } from './urlContexts'
import { startUrlContexts } from './urlContexts'
import type { ViewCreatedEvent, ViewEndedEvent } from './rumEventsCollection/view/trackViews'
import { LifeCycleEventType } from './lifeCycle'

@@ -6,0 +9,0 @@

@@ -1,5 +0,7 @@

import { RelativeTime, Observable, SESSION_TIME_OUT_DELAY, relativeNow, ContextHistory } from '@datadog/browser-core'
import { UrlContext } from '../rawRumEvent.types'
import { LocationChange } from '../browser/locationChangeObservable'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import type { RelativeTime, Observable } from '@datadog/browser-core'
import { SESSION_TIME_OUT_DELAY, relativeNow, ContextHistory } from '@datadog/browser-core'
import type { UrlContext } from '../rawRumEvent.types'
import type { LocationChange } from '../browser/locationChangeObservable'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'

@@ -6,0 +8,0 @@ /**

import { Observable, ONE_SECOND } from '@datadog/browser-core'
import { Clock, mockClock } from '@datadog/browser-core/test/specHelper'
import { RumPerformanceNavigationTiming, RumPerformanceResourceTiming } from '../browser/performanceCollection'
import type { Clock } from '@datadog/browser-core/test/specHelper'
import { mockClock } from '@datadog/browser-core/test/specHelper'
import type { RumPerformanceNavigationTiming, RumPerformanceResourceTiming } from '../browser/performanceCollection'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RequestCompleteEvent } from './requestCollection'
import type { RequestCompleteEvent } from './requestCollection'
import type { PageActivityEvent, IdlePageEvent } from './waitIdlePage'
import {
PAGE_ACTIVITY_END_DELAY,
PAGE_ACTIVITY_VALIDATION_DELAY,
PageActivityEvent,
IdlePageEvent,
doWaitIdlePage,

@@ -60,4 +60,4 @@ createPageActivityObservable,

entryType: 'resource',
}
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, performanceTiming as RumPerformanceResourceTiming)
} as RumPerformanceResourceTiming
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [performanceTiming])
expect(events).toEqual([{ isBusy: false }])

@@ -70,7 +70,4 @@ })

entryType: 'navigation',
}
lifeCycle.notify(
LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED,
performanceTiming as RumPerformanceNavigationTiming
)
} as RumPerformanceNavigationTiming
lifeCycle.notify(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, [performanceTiming])
expect(events).toEqual([])

@@ -77,0 +74,0 @@ })

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

import { Duration, elapsed, monitor, Observable, Subscription, TimeoutId, timeStampNow } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import type { Duration, Subscription, TimeoutId } from '@datadog/browser-core'
import { elapsed, monitor, Observable, timeStampNow } from '@datadog/browser-core'
import type { LifeCycle } from './lifeCycle'
import { LifeCycleEventType } from './lifeCycle'

@@ -116,8 +118,6 @@ // Delay to wait for a page activity to validate the tracking process

domMutationObservable.subscribe(() => notifyPageActivity(pendingRequestsCount)),
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRY_COLLECTED, (entry) => {
if (entry.entryType !== 'resource') {
return
lifeCycle.subscribe(LifeCycleEventType.PERFORMANCE_ENTRIES_COLLECTED, (entries) => {
if (entries.some(({ entryType }) => entryType === 'resource')) {
notifyPageActivity(pendingRequestsCount)
}
notifyPageActivity(pendingRequestsCount)
}),

@@ -124,0 +124,0 @@ lifeCycle.subscribe(LifeCycleEventType.REQUEST_STARTED, (startEvent) => {

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

import { RumEventType } from './rawRumEvent.types'
import type { RumEventType } from './rawRumEvent.types'

@@ -8,0 +8,0 @@ export type RumEventDomainContext<T extends RumEventType = any> = T extends RumEventType.VIEW

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

import {
import type {
Context,

@@ -10,3 +10,3 @@ Duration,

} from '@datadog/browser-core'
import { RumSessionPlan } from './domain/rumSessionManager'
import type { RumSessionPlan } from './domain/rumSessionManager'

@@ -178,2 +178,3 @@ export enum RumEventType {

service?: string
source: 'browser'
session: {

@@ -180,0 +181,0 @@ id: string

@@ -145,3 +145,3 @@ /* eslint-disable */

*/
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native'
readonly source_type?: 'android' | 'browser' | 'ios' | 'react-native' | 'flutter'
/**

@@ -690,2 +690,6 @@ * Resource properties of the error

/**
* The source of this event
*/
readonly source?: 'android' | 'ios' | 'browser' | 'flutter' | 'react-native'
/**
* View properties

@@ -794,2 +798,3 @@ */

readonly test_execution_id: string
[k: string]: unknown
}

@@ -796,0 +801,0 @@ /**

@@ -1,6 +0,8 @@

import { Batch, combine, Context, HttpRequest, EndpointBuilder } from '@datadog/browser-core'
import { RumConfiguration } from '../domain/configuration'
import { LifeCycle, LifeCycleEventType } from '../domain/lifeCycle'
import type { Context, EndpointBuilder } from '@datadog/browser-core'
import { Batch, combine, HttpRequest } from '@datadog/browser-core'
import type { RumConfiguration } from '../domain/configuration'
import type { LifeCycle } from '../domain/lifeCycle'
import { LifeCycleEventType } from '../domain/lifeCycle'
import { RumEventType } from '../rawRumEvent.types'
import { RumEvent } from '../rumEvent.types'
import type { RumEvent } from '../rumEvent.types'

@@ -7,0 +9,0 @@ export function startRumBatch(configuration: RumConfiguration, lifeCycle: LifeCycle) {

@@ -1,4 +0,6 @@

import { Context, getEventBridge } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from '../domain/lifeCycle'
import { RumEvent } from '../rumEvent.types'
import type { Context } from '@datadog/browser-core'
import { getEventBridge } from '@datadog/browser-core'
import type { LifeCycle } from '../domain/lifeCycle'
import { LifeCycleEventType } from '../domain/lifeCycle'
import type { RumEvent } from '../rumEvent.types'

@@ -5,0 +7,0 @@ export function startRumEventBridge(lifeCycle: LifeCycle) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc