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

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
182
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 2.17.0 to 2.18.0

2

cjs/boot/buildEnv.js

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

datacenter: 'us',
sdkVersion: '2.17.0',
sdkVersion: '2.18.0',
};
//# sourceMappingURL=buildEnv.js.map

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

var viewContext = parentContexts.findView(startTime);
if (session.isTracked() && viewContext && viewContext.session.id === session.getId()) {
var plan = session.getPlan();
if (plan && viewContext && viewContext.session.id === session.getId()) {
var actionContext = parentContexts.findAction(startTime);

@@ -42,2 +43,5 @@ var commonContext = savedCommonContext || getCommonContext();

drift: browser_core_1.currentDrift(),
session: {
plan: plan,
},
},

@@ -44,0 +48,0 @@ application: {

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

function startErrorCollection(lifeCycle, configuration, foregroundContexts) {
browser_core_1.startAutomaticErrorCollection(configuration).subscribe(function (error) {
return lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error });
});
var errorObservable = new browser_core_1.Observable();
browser_core_1.trackConsoleError(errorObservable);
browser_core_1.trackRuntimeError(errorObservable);
if (!configuration.isEnabled('remove-network-errors')) {
browser_core_1.trackNetworkError(configuration, errorObservable); // deprecated: to remove with version 3
}
errorObservable.subscribe(function (error) { return lifeCycle.notify(lifeCycle_1.LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error }); });
return doStartErrorCollection(lifeCycle, foregroundContexts);

@@ -14,0 +18,0 @@ }

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

getId: () => string | undefined;
getPlan(): RumSessionPlan | undefined;
isTracked: () => boolean;
isTrackedWithResource: () => boolean;
}
export declare enum RumSessionPlan {
LITE = 1,
REPLAY = 2
}
export declare enum RumTrackingType {

@@ -11,0 +16,0 @@ NOT_TRACKED = "0",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.startRumSession = exports.RumTrackingType = exports.RUM_SESSION_KEY = void 0;
exports.startRumSession = exports.RumTrackingType = exports.RumSessionPlan = exports.RUM_SESSION_KEY = void 0;
var browser_core_1 = require("@datadog/browser-core");
var lifeCycle_1 = require("./lifeCycle");
exports.RUM_SESSION_KEY = 'rum';
var RumSessionPlan;
(function (RumSessionPlan) {
RumSessionPlan[RumSessionPlan["LITE"] = 1] = "LITE";
RumSessionPlan[RumSessionPlan["REPLAY"] = 2] = "REPLAY";
})(RumSessionPlan = exports.RumSessionPlan || (exports.RumSessionPlan = {}));
var RumTrackingType;

@@ -22,3 +27,4 @@ (function (RumTrackingType) {

getId: session.getId,
isTracked: function () { return session.getId() !== undefined && isTracked(session.getTrackingType()); },
getPlan: function () { return getSessionPlan(session); },
isTracked: function () { return isSessionTracked(session); },
isTrackedWithResource: function () {

@@ -30,2 +36,11 @@ return session.getId() !== undefined && session.getTrackingType() === RumTrackingType.TRACKED_WITH_RESOURCES;

exports.startRumSession = startRumSession;
function isSessionTracked(session) {
return session.getId() !== undefined && isTypeTracked(session.getTrackingType());
}
function getSessionPlan(session) {
return isSessionTracked(session)
? // TODO: return correct plan based on tracking type
RumSessionPlan.REPLAY
: undefined;
}
function computeSessionState(configuration, rawTrackingType) {

@@ -47,3 +62,3 @@ var trackingType;

trackingType: trackingType,
isTracked: isTracked(trackingType),
isTracked: isTypeTracked(trackingType),
};

@@ -56,3 +71,3 @@ }

}
function isTracked(rumSessionType) {
function isTypeTracked(rumSessionType) {
return (rumSessionType === RumTrackingType.TRACKED_WITH_RESOURCES ||

@@ -59,0 +74,0 @@ rumSessionType === RumTrackingType.TRACKED_WITHOUT_RESOURCES);

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

@@ -149,2 +150,5 @@ ACTION = "action",

drift: number;
session: {
plan: RumSessionPlan;
};
};

@@ -151,0 +155,0 @@ }

export var buildEnv = {
buildMode: 'release',
datacenter: 'us',
sdkVersion: '2.17.0',
sdkVersion: '2.18.0',
};
//# sourceMappingURL=buildEnv.js.map

@@ -31,3 +31,4 @@ import { __spreadArrays } from "tslib";

var viewContext = parentContexts.findView(startTime);
if (session.isTracked() && viewContext && viewContext.session.id === session.getId()) {
var plan = session.getPlan();
if (plan && viewContext && viewContext.session.id === session.getId()) {
var actionContext = parentContexts.findAction(startTime);

@@ -39,2 +40,5 @@ var commonContext = savedCommonContext || getCommonContext();

drift: currentDrift(),
session: {
plan: plan,
},
},

@@ -41,0 +45,0 @@ application: {

import { __assign } from "tslib";
import { computeStackTrace, formatUnknownError, startAutomaticErrorCollection, generateUUID, ErrorHandling, } from '@datadog/browser-core';
import { computeStackTrace, formatUnknownError, generateUUID, ErrorHandling, Observable, trackConsoleError, trackRuntimeError, trackNetworkError, } from '@datadog/browser-core';
import { RumEventType } from '../../../rawRumEvent.types';
import { LifeCycleEventType } from '../../lifeCycle';
export function startErrorCollection(lifeCycle, configuration, foregroundContexts) {
startAutomaticErrorCollection(configuration).subscribe(function (error) {
return lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error });
});
var errorObservable = new Observable();
trackConsoleError(errorObservable);
trackRuntimeError(errorObservable);
if (!configuration.isEnabled('remove-network-errors')) {
trackNetworkError(configuration, errorObservable); // deprecated: to remove with version 3
}
errorObservable.subscribe(function (error) { return lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error }); });
return doStartErrorCollection(lifeCycle, foregroundContexts);

@@ -10,0 +14,0 @@ }

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

getId: () => string | undefined;
getPlan(): RumSessionPlan | undefined;
isTracked: () => boolean;
isTrackedWithResource: () => boolean;
}
export declare enum RumSessionPlan {
LITE = 1,
REPLAY = 2
}
export declare enum RumTrackingType {

@@ -11,0 +16,0 @@ NOT_TRACKED = "0",

import { performDraw, startSessionManagement } from '@datadog/browser-core';
import { LifeCycleEventType } from './lifeCycle';
export var RUM_SESSION_KEY = 'rum';
export var RumSessionPlan;
(function (RumSessionPlan) {
RumSessionPlan[RumSessionPlan["LITE"] = 1] = "LITE";
RumSessionPlan[RumSessionPlan["REPLAY"] = 2] = "REPLAY";
})(RumSessionPlan || (RumSessionPlan = {}));
export var RumTrackingType;

@@ -19,3 +24,4 @@ (function (RumTrackingType) {

getId: session.getId,
isTracked: function () { return session.getId() !== undefined && isTracked(session.getTrackingType()); },
getPlan: function () { return getSessionPlan(session); },
isTracked: function () { return isSessionTracked(session); },
isTrackedWithResource: function () {

@@ -26,2 +32,11 @@ return session.getId() !== undefined && session.getTrackingType() === RumTrackingType.TRACKED_WITH_RESOURCES;

}
function isSessionTracked(session) {
return session.getId() !== undefined && isTypeTracked(session.getTrackingType());
}
function getSessionPlan(session) {
return isSessionTracked(session)
? // TODO: return correct plan based on tracking type
RumSessionPlan.REPLAY
: undefined;
}
function computeSessionState(configuration, rawTrackingType) {

@@ -43,3 +58,3 @@ var trackingType;

trackingType: trackingType,
isTracked: isTracked(trackingType),
isTracked: isTypeTracked(trackingType),
};

@@ -52,3 +67,3 @@ }

}
function isTracked(rumSessionType) {
function isTypeTracked(rumSessionType) {
return (rumSessionType === RumTrackingType.TRACKED_WITH_RESOURCES ||

@@ -55,0 +70,0 @@ rumSessionType === RumTrackingType.TRACKED_WITHOUT_RESOURCES);

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

@@ -149,2 +150,5 @@ ACTION = "action",

drift: number;
session: {
plan: RumSessionPlan;
};
};

@@ -151,0 +155,0 @@ }

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

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

"dependencies": {
"@datadog/browser-core": "2.17.0",
"@datadog/browser-core": "2.18.0",
"tslib": "^1.10.0"

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

},
"gitHead": "062e559cfe16288cf412ec73d365ee4e9d4c96ec"
"gitHead": "d05764270c7dda8dbf93c31592c48e3a1bc57cef"
}

@@ -11,2 +11,3 @@ import { RelativeTime, Configuration } from '@datadog/browser-core'

import { startViewCollection } from '../domain/rumEventsCollection/view/viewCollection'
import { RumSessionPlan } from '../domain/rumSession'
import { RumEvent } from '../rumEvent.types'

@@ -82,2 +83,3 @@ import { startRumEventCollection } from './startRum'

getId: () => sessionId,
getPlan: () => RumSessionPlan.REPLAY,
isTracked: () => true,

@@ -118,2 +120,3 @@ isTrackedWithResource: () => true,

getId: () => '1234',
getPlan: () => (isSessionTracked ? RumSessionPlan.REPLAY : undefined),
isTracked: () => isSessionTracked,

@@ -120,0 +123,0 @@ isTrackedWithResource: () => true,

@@ -9,2 +9,3 @@ import { ErrorSource, ONE_MINUTE, RawError, RelativeTime, display } from '@datadog/browser-core'

import { LifeCycle, LifeCycleEventType, RawRumEventCollectedData } from './lifeCycle'
import { RumSessionPlan } from './rumSession'

@@ -453,2 +454,3 @@ describe('rum assembly', () => {

getId: () => '1234',
getPlan: () => undefined,
isTracked: () => false,

@@ -496,3 +498,3 @@ isTrackedWithResource: () => false,

describe('session context', () => {
it('should include the session type and id', () => {
it('should include the session type, id and plan', () => {
const { lifeCycle } = setupBuilder.build()

@@ -507,2 +509,5 @@ notifyRawRumEvent(lifeCycle, {

})
expect(serverRumEvents[0]._dd.session).toEqual({
plan: RumSessionPlan.REPLAY,
})
})

@@ -509,0 +514,0 @@

@@ -76,3 +76,4 @@ import {

const viewContext = parentContexts.findView(startTime)
if (session.isTracked() && viewContext && viewContext.session.id === session.getId()) {
const plan = session.getPlan()
if (plan && viewContext && viewContext.session.id === session.getId()) {
const actionContext = parentContexts.findAction(startTime)

@@ -84,2 +85,5 @@ const commonContext = savedCommonContext || getCommonContext()

drift: currentDrift(),
session: {
plan,
},
},

@@ -86,0 +90,0 @@ application: {

@@ -60,2 +60,3 @@ import { setup, TestSetupBuilder } from '../../test/specHelper'

getId: () => '1234',
getPlan: () => undefined,
isTracked: () => false,

@@ -62,0 +63,0 @@ isTrackedWithResource: () => false,

@@ -13,2 +13,3 @@ import { Duration, RelativeTime, relativeToClocks } from '@datadog/browser-core'

import { ViewCreatedEvent } from './rumEventsCollection/view/trackViews'
import { RumSessionPlan } from './rumSession'

@@ -44,2 +45,3 @@ function stubActionWithDuration(duration: number): AutoAction {

getId: () => sessionId,
getPlan: () => RumSessionPlan.REPLAY,
isTracked: () => true,

@@ -46,0 +48,0 @@ isTrackedWithResource: () => true,

@@ -7,6 +7,9 @@ import {

RawError,
startAutomaticErrorCollection,
ClocksState,
generateUUID,
ErrorHandling,
Observable,
trackConsoleError,
trackRuntimeError,
trackNetworkError,
} from '@datadog/browser-core'

@@ -32,6 +35,11 @@ import { CommonContext, RawRumErrorEvent, RumEventType } from '../../../rawRumEvent.types'

) {
startAutomaticErrorCollection(configuration).subscribe((error) =>
lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error })
)
const errorObservable = new Observable<RawError>()
trackConsoleError(errorObservable)
trackRuntimeError(errorObservable)
if (!configuration.isEnabled('remove-network-errors')) {
trackNetworkError(configuration, errorObservable) // deprecated: to remove with version 3
}
errorObservable.subscribe((error) => lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error }))
return doStartErrorCollection(lifeCycle, foregroundContexts)

@@ -38,0 +46,0 @@ }

@@ -8,2 +8,3 @@ import { Duration, RelativeTime, RequestType, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core'

import { RequestCompleteEvent } from '../../requestCollection'
import { RumSessionPlan } from '../../rumSession'
import { TraceIdentifier } from '../../tracing/tracer'

@@ -20,2 +21,3 @@ import { startResourceCollection } from './resourceCollection'

getId: () => '1234',
getPlan: () => RumSessionPlan.REPLAY,
isTracked: () => true,

@@ -163,2 +165,3 @@ isTrackedWithResource: () => true,

getId: () => '1234',
getPlan: () => RumSessionPlan.REPLAY,
isTracked: () => true,

@@ -201,2 +204,3 @@ isTrackedWithResource: () => false,

getId: () => '1234',
getPlan: () => RumSessionPlan.REPLAY,
isTracked: () => true,

@@ -203,0 +207,0 @@ isTrackedWithResource: () => isTrackedWithResource,

@@ -13,3 +13,3 @@ import {

import { LifeCycle, LifeCycleEventType } from './lifeCycle'
import { RUM_SESSION_KEY, RumTrackingType, startRumSession } from './rumSession'
import { RUM_SESSION_KEY, RumTrackingType, startRumSession, RumSessionPlan } from './rumSession'

@@ -25,4 +25,4 @@ function setupDraws({ tracked, trackedWithResources }: { tracked?: boolean; trackedWithResources?: boolean }) {

isEnabled: () => true,
resourceSampleRate: 0.5,
sampleRate: 0.5,
resourceSampleRate: 50,
sampleRate: 50,
}

@@ -51,66 +51,106 @@ let lifeCycle: LifeCycle

it('when tracked with resources should store session type and id', () => {
setupDraws({ tracked: true, trackedWithResources: true })
describe('cookie storage', () => {
it('when tracked with resources should store session type and id', () => {
setupDraws({ tracked: true, trackedWithResources: true })
startRumSession(configuration as Configuration, lifeCycle)
startRumSession(configuration as Configuration, lifeCycle)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
})
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
})
it('when tracked without resources should store session type and id', () => {
setupDraws({ tracked: true, trackedWithResources: false })
it('when tracked without resources should store session type and id', () => {
setupDraws({ tracked: true, trackedWithResources: false })
startRumSession(configuration as Configuration, lifeCycle)
startRumSession(configuration as Configuration, lifeCycle)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITHOUT_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
})
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(
`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITHOUT_RESOURCES}`
)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
})
it('when not tracked should store session type', () => {
setupDraws({ tracked: false })
it('when not tracked should store session type', () => {
setupDraws({ tracked: false })
startRumSession(configuration as Configuration, lifeCycle)
startRumSession(configuration as Configuration, lifeCycle)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.NOT_TRACKED}`)
expect(getCookie(SESSION_COOKIE_NAME)).not.toContain('id=')
})
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.NOT_TRACKED}`)
expect(getCookie(SESSION_COOKIE_NAME)).not.toContain('id=')
})
it('when tracked should keep existing session type and id', () => {
setCookie(SESSION_COOKIE_NAME, 'id=abcdef&rum=1', DURATION)
it('when tracked should keep existing session type and id', () => {
setCookie(SESSION_COOKIE_NAME, 'id=abcdef&rum=1', DURATION)
startRumSession(configuration as Configuration, lifeCycle)
startRumSession(configuration as Configuration, lifeCycle)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toContain('id=abcdef')
})
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toContain('id=abcdef')
})
it('when not tracked should keep existing session type', () => {
setCookie(SESSION_COOKIE_NAME, 'rum=0', DURATION)
it('when not tracked should keep existing session type', () => {
setCookie(SESSION_COOKIE_NAME, 'rum=0', DURATION)
startRumSession(configuration as Configuration, lifeCycle)
startRumSession(configuration as Configuration, lifeCycle)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.NOT_TRACKED}`)
expect(renewSessionSpy).not.toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.NOT_TRACKED}`)
})
it('should renew on activity after expiration', () => {
startRumSession(configuration as Configuration, lifeCycle)
setCookie(SESSION_COOKIE_NAME, '', DURATION)
expect(getCookie(SESSION_COOKIE_NAME)).toBeUndefined()
expect(renewSessionSpy).not.toHaveBeenCalled()
clock.tick(COOKIE_ACCESS_DELAY)
setupDraws({ tracked: true, trackedWithResources: true })
document.dispatchEvent(new CustomEvent('click'))
expect(renewSessionSpy).toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
})
})
it('should renew on activity after expiration', () => {
startRumSession(configuration as Configuration, lifeCycle)
describe('getId', () => {
it('should return the session id', () => {
setCookie(SESSION_COOKIE_NAME, 'id=abcdef&rum=1', DURATION)
const rumSession = startRumSession(configuration as Configuration, lifeCycle)
expect(rumSession.getId()).toBe('abcdef')
})
setCookie(SESSION_COOKIE_NAME, '', DURATION)
expect(getCookie(SESSION_COOKIE_NAME)).toBeUndefined()
expect(renewSessionSpy).not.toHaveBeenCalled()
clock.tick(COOKIE_ACCESS_DELAY)
it('should return undefined if the session has expired', () => {
const rumSession = startRumSession(configuration as Configuration, lifeCycle)
setCookie(SESSION_COOKIE_NAME, '', DURATION)
clock.tick(COOKIE_ACCESS_DELAY)
expect(rumSession.getId()).toBe(undefined)
})
})
setupDraws({ tracked: true, trackedWithResources: true })
document.dispatchEvent(new CustomEvent('click'))
describe('getPlan', () => {
it('should return the session plan', () => {
setCookie(SESSION_COOKIE_NAME, 'id=abcdef&rum=1', DURATION)
const rumSession = startRumSession(configuration as Configuration, lifeCycle)
expect(rumSession.getPlan()).toBe(RumSessionPlan.REPLAY)
})
expect(renewSessionSpy).toHaveBeenCalled()
expect(getCookie(SESSION_COOKIE_NAME)).toContain(`${RUM_SESSION_KEY}=${RumTrackingType.TRACKED_WITH_RESOURCES}`)
expect(getCookie(SESSION_COOKIE_NAME)).toMatch(/id=[a-f0-9-]/)
it('should return undefined if the session has expired', () => {
const rumSession = startRumSession(configuration as Configuration, lifeCycle)
setCookie(SESSION_COOKIE_NAME, '', DURATION)
clock.tick(COOKIE_ACCESS_DELAY)
expect(rumSession.getPlan()).toBe(undefined)
})
it('should return undefined if the session is not tracked', () => {
setCookie(SESSION_COOKIE_NAME, 'id=abcdef&rum=0', DURATION)
const rumSession = startRumSession(configuration as Configuration, lifeCycle)
expect(rumSession.getPlan()).toBe(undefined)
})
})
})

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

import { Configuration, performDraw, startSessionManagement } from '@datadog/browser-core'
import { Configuration, performDraw, Session, startSessionManagement } from '@datadog/browser-core'
import { LifeCycle, LifeCycleEventType } from './lifeCycle'

@@ -8,2 +8,3 @@

getId: () => string | undefined
getPlan(): RumSessionPlan | undefined
isTracked: () => boolean

@@ -13,2 +14,7 @@ isTrackedWithResource: () => boolean

export enum RumSessionPlan {
LITE = 1,
REPLAY = 2,
}
export enum RumTrackingType {

@@ -31,3 +37,4 @@ NOT_TRACKED = '0',

getId: session.getId,
isTracked: () => session.getId() !== undefined && isTracked(session.getTrackingType()),
getPlan: () => getSessionPlan(session),
isTracked: () => isSessionTracked(session),
isTrackedWithResource: () =>

@@ -38,2 +45,13 @@ session.getId() !== undefined && session.getTrackingType() === RumTrackingType.TRACKED_WITH_RESOURCES,

function isSessionTracked(session: Session<RumTrackingType>) {
return session.getId() !== undefined && isTypeTracked(session.getTrackingType())
}
function getSessionPlan(session: Session<RumTrackingType>) {
return isSessionTracked(session)
? // TODO: return correct plan based on tracking type
RumSessionPlan.REPLAY
: undefined
}
function computeSessionState(configuration: Configuration, rawTrackingType?: string) {

@@ -52,3 +70,3 @@ let trackingType: RumTrackingType

trackingType,
isTracked: isTracked(trackingType),
isTracked: isTypeTracked(trackingType),
}

@@ -65,3 +83,3 @@ }

function isTracked(rumSessionType: RumTrackingType | undefined) {
function isTypeTracked(rumSessionType: RumTrackingType | undefined) {
return (

@@ -68,0 +86,0 @@ rumSessionType === RumTrackingType.TRACKED_WITH_RESOURCES ||

@@ -10,2 +10,3 @@ import {

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

@@ -177,2 +178,5 @@ export enum RumEventType {

drift: number
session: {
plan: RumSessionPlan
}
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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