Socket
Socket
Sign inDemoInstall

@datadog/browser-rum-core

Package Overview
Dependencies
Maintainers
1
Versions
177
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.8.1 to 2.9.0

2

cjs/boot/buildEnv.js

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

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

@@ -28,2 +28,3 @@ import { Context, UserConfiguration } from '@datadog/browser-core';

setUser: (newUser: User) => void;
removeUser: () => void;
} & {

@@ -30,0 +31,0 @@ onReady(callback: () => void): void;

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

else {
console.error("DD_RUM.addError: Invalid source '" + source + "'");
browser_core_1.display.error("DD_RUM.addError: Invalid source '" + source + "'");
checkedSource = browser_core_1.ErrorSource.CUSTOM;

@@ -105,5 +105,8 @@ }

else {
console.error('Unsupported user:', newUser);
browser_core_1.display.error('Unsupported user:', newUser);
}
}),
removeUser: browser_core_1.monitor(function () {
user = {};
}),
});

@@ -130,3 +133,3 @@ return rumPublicApi;

if (!userConfiguration.silentMultipleInit) {
console.error('DD_RUM is already initialized.');
browser_core_1.display.error('DD_RUM is already initialized.');
}

@@ -136,15 +139,15 @@ return false;

if (!userConfiguration || (!userConfiguration.clientToken && !userConfiguration.publicApiKey)) {
console.error('Client Token is not configured, we will not send any data.');
browser_core_1.display.error('Client Token is not configured, we will not send any data.');
return false;
}
if (!userConfiguration.applicationId) {
console.error('Application ID is not configured, no RUM data will be collected.');
browser_core_1.display.error('Application ID is not configured, no RUM data will be collected.');
return false;
}
if (userConfiguration.sampleRate !== undefined && !browser_core_1.isPercentage(userConfiguration.sampleRate)) {
console.error('Sample Rate should be a number between 0 and 100');
browser_core_1.display.error('Sample Rate should be a number between 0 and 100');
return false;
}
if (userConfiguration.resourceSampleRate !== undefined && !browser_core_1.isPercentage(userConfiguration.resourceSampleRate)) {
console.error('Resource Sample Rate should be a number between 0 and 100');
browser_core_1.display.error('Resource Sample Rate should be a number between 0 and 100');
return false;

@@ -155,3 +158,3 @@ }

userConfiguration.service === undefined) {
console.error('Service need to be configured when tracing is enabled');
browser_core_1.display.error('Service need to be configured when tracing is enabled');
return false;

@@ -158,0 +161,0 @@ }

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

format_version: 2,
drift: browser_core_1.currentDrift(),
},

@@ -77,3 +78,3 @@ application: {

if (result === false) {
console.warn("Can't dismiss view events using beforeSend!");
browser_core_1.display.warn("Can't dismiss view events using beforeSend!");
}

@@ -80,0 +81,0 @@ }

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

if (sanitized !== name) {
console.warn("Invalid timing name: " + name + ", sanitized to: " + sanitized);
browser_core_1.display.warn("Invalid timing name: " + name + ", sanitized to: " + sanitized);
}

@@ -151,0 +151,0 @@ return sanitized;

@@ -133,2 +133,3 @@ import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';

format_version: 2;
drift: number;
};

@@ -135,0 +136,0 @@ }

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

@@ -28,2 +28,3 @@ import { Context, UserConfiguration } from '@datadog/browser-core';

setUser: (newUser: User) => void;
removeUser: () => void;
} & {

@@ -30,0 +31,0 @@ onReady(callback: () => void): void;

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

import { BoundedBuffer, buildCookieOptions, checkCookiesAuthorized, checkIsNotLocalFile, createContextManager, deepClone, ErrorSource, isPercentage, makePublicApi, monitor, clocksNow, } from '@datadog/browser-core';
import { BoundedBuffer, buildCookieOptions, checkCookiesAuthorized, checkIsNotLocalFile, createContextManager, deepClone, ErrorSource, isPercentage, makePublicApi, monitor, clocksNow, display, } from '@datadog/browser-core';
import { ActionType } from '../rawRumEvent.types';

@@ -82,3 +82,3 @@ export function makeRumPublicApi(startRumImpl) {

else {
console.error("DD_RUM.addError: Invalid source '" + source + "'");
display.error("DD_RUM.addError: Invalid source '" + source + "'");
checkedSource = ErrorSource.CUSTOM;

@@ -102,5 +102,8 @@ }

else {
console.error('Unsupported user:', newUser);
display.error('Unsupported user:', newUser);
}
}),
removeUser: monitor(function () {
user = {};
}),
});

@@ -127,3 +130,3 @@ return rumPublicApi;

if (!userConfiguration.silentMultipleInit) {
console.error('DD_RUM is already initialized.');
display.error('DD_RUM is already initialized.');
}

@@ -133,15 +136,15 @@ return false;

if (!userConfiguration || (!userConfiguration.clientToken && !userConfiguration.publicApiKey)) {
console.error('Client Token is not configured, we will not send any data.');
display.error('Client Token is not configured, we will not send any data.');
return false;
}
if (!userConfiguration.applicationId) {
console.error('Application ID is not configured, no RUM data will be collected.');
display.error('Application ID is not configured, no RUM data will be collected.');
return false;
}
if (userConfiguration.sampleRate !== undefined && !isPercentage(userConfiguration.sampleRate)) {
console.error('Sample Rate should be a number between 0 and 100');
display.error('Sample Rate should be a number between 0 and 100');
return false;
}
if (userConfiguration.resourceSampleRate !== undefined && !isPercentage(userConfiguration.resourceSampleRate)) {
console.error('Resource Sample Rate should be a number between 0 and 100');
display.error('Resource Sample Rate should be a number between 0 and 100');
return false;

@@ -152,3 +155,3 @@ }

userConfiguration.service === undefined) {
console.error('Service need to be configured when tracing is enabled');
display.error('Service need to be configured when tracing is enabled');
return false;

@@ -155,0 +158,0 @@ }

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

import { combine, createErrorFilter, isEmptyObject, limitModification, timeStampNow, } from '@datadog/browser-core';
import { combine, createErrorFilter, isEmptyObject, limitModification, timeStampNow, currentDrift, display, } from '@datadog/browser-core';
import { RumEventType, } from '../rawRumEvent.types';

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

format_version: 2,
drift: currentDrift(),
},

@@ -73,3 +74,3 @@ application: {

if (result === false) {
console.warn("Can't dismiss view events using beforeSend!");
display.warn("Can't dismiss view events using beforeSend!");
}

@@ -76,0 +77,0 @@ }

import { __assign } from "tslib";
import { elapsed, generateUUID, monitor, ONE_MINUTE, throttle, clocksNow, preferredClock, clocksOrigin, } from '@datadog/browser-core';
import { elapsed, generateUUID, monitor, ONE_MINUTE, throttle, clocksNow, preferredClock, clocksOrigin, display, } from '@datadog/browser-core';
import { ViewLoadingType } from '../../../rawRumEvent.types';

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

if (sanitized !== name) {
console.warn("Invalid timing name: " + name + ", sanitized to: " + sanitized);
display.warn("Invalid timing name: " + name + ", sanitized to: " + sanitized);
}

@@ -147,0 +147,0 @@ return sanitized;

@@ -133,2 +133,3 @@ import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core';

format_version: 2;
drift: number;
};

@@ -135,0 +136,0 @@ }

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

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

"dependencies": {
"@datadog/browser-core": "2.8.1",
"@datadog/browser-core": "2.9.0",
"tslib": "^1.10.0"

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

},
"gitHead": "58466bcf571900220819af5f4cfe7ae2adf5e5ec"
"gitHead": "2720fd7c029ba8bdae5f6296e2eeffb784e49638"
}

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

import { ErrorSource, ONE_SECOND, RelativeTime, TimeStamp } from '@datadog/browser-core'
import { ErrorSource, ONE_SECOND, RelativeTime, TimeStamp, display } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../test/specHelper'

@@ -21,6 +21,6 @@ import { ActionType } from '../rawRumEvent.types'

let rumPublicApi: RumPublicApi
let errorSpy: jasmine.Spy
let displaySpy: jasmine.Spy
beforeEach(() => {
errorSpy = spyOn(console, 'error')
displaySpy = spyOn(display, 'error')
rumPublicApi = makeRumPublicApi(noopStartRum)

@@ -32,6 +32,6 @@ })

rumPublicApi.init(invalidConfiguration as RumUserConfiguration)
expect(console.error).toHaveBeenCalledTimes(1)
expect(display.error).toHaveBeenCalledTimes(1)
rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes' })
expect(errorSpy).toHaveBeenCalledTimes(1)
expect(displaySpy).toHaveBeenCalledTimes(1)
})

@@ -41,6 +41,6 @@

rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', sampleRate: 'foo' as any })
expect(errorSpy).toHaveBeenCalledTimes(1)
expect(displaySpy).toHaveBeenCalledTimes(1)
rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', sampleRate: 200 })
expect(errorSpy).toHaveBeenCalledTimes(2)
expect(displaySpy).toHaveBeenCalledTimes(2)
})

@@ -50,6 +50,6 @@

rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', resourceSampleRate: 'foo' as any })
expect(errorSpy).toHaveBeenCalledTimes(1)
expect(displaySpy).toHaveBeenCalledTimes(1)
rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', resourceSampleRate: 200 })
expect(errorSpy).toHaveBeenCalledTimes(2)
expect(displaySpy).toHaveBeenCalledTimes(2)
})

@@ -59,6 +59,6 @@

rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', sampleRate: 1, resourceSampleRate: 1 })
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)
rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', sampleRate: 1, resourceSampleRate: 1 })
expect(errorSpy).toHaveBeenCalledTimes(1)
expect(displaySpy).toHaveBeenCalledTimes(1)
})

@@ -68,3 +68,3 @@

rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', allowedTracingOrigins: [] })
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)

@@ -77,3 +77,3 @@ makeRumPublicApi(noopStartRum).init({

})
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)

@@ -85,3 +85,3 @@ makeRumPublicApi(noopStartRum).init({

})
expect(errorSpy).toHaveBeenCalledTimes(1)
expect(displaySpy).toHaveBeenCalledTimes(1)
})

@@ -97,3 +97,3 @@

})
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)

@@ -107,8 +107,8 @@ rumPublicApi.init({

})
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)
})
it("shouldn't trigger any console.log if the configuration is correct", () => {
it("shouldn't trigger any console.error if the configuration is correct", () => {
rumPublicApi.init({ clientToken: 'yes', applicationId: 'yes', sampleRate: 1, resourceSampleRate: 1 })
expect(errorSpy).toHaveBeenCalledTimes(0)
expect(displaySpy).toHaveBeenCalledTimes(0)
})

@@ -284,7 +284,7 @@ })

it('fallbacks to ErrorSource.CUSTOM if an invalid source is given', () => {
const consoleSpy = spyOn(console, 'error')
const displaySpy = spyOn(display, 'error')
rumPublicApi.init(DEFAULT_INIT_CONFIGURATION)
rumPublicApi.addError(new Error('foo'), undefined, 'invalid' as any)
expect(addErrorSpy.calls.argsFor(0)[0].source).toBe(ErrorSource.CUSTOM)
expect(consoleSpy).toHaveBeenCalledWith("DD_RUM.addError: Invalid source 'invalid'")
expect(displaySpy).toHaveBeenCalledWith("DD_RUM.addError: Invalid source 'invalid'")
})

@@ -346,3 +346,3 @@

let addActionSpy: jasmine.Spy<ReturnType<StartRum>['addAction']>
let errorSpy: jasmine.Spy<() => void>
let displaySpy: jasmine.Spy<() => void>
let rumPublicApi: RumPublicApi

@@ -353,3 +353,3 @@ let setupBuilder: TestSetupBuilder

addActionSpy = jasmine.createSpy()
errorSpy = spyOn(console, 'error')
displaySpy = spyOn(display, 'error')
rumPublicApi = makeRumPublicApi(() => ({

@@ -379,3 +379,3 @@ ...noopStartRum(),

})
expect(errorSpy).not.toHaveBeenCalled()
expect(displaySpy).not.toHaveBeenCalled()
})

@@ -395,5 +395,17 @@

})
expect(errorSpy).not.toHaveBeenCalled()
expect(displaySpy).not.toHaveBeenCalled()
})
it('should remove the user', () => {
const user = { id: 'foo', name: 'bar', email: 'qux' }
rumPublicApi.setUser(user)
rumPublicApi.removeUser()
rumPublicApi.addAction('message')
rumPublicApi.init(DEFAULT_INIT_CONFIGURATION)
expect(addActionSpy.calls.argsFor(0)[1]!.user).toEqual({})
expect(displaySpy).not.toHaveBeenCalled()
})
it('should reject non object input', () => {

@@ -403,3 +415,3 @@ rumPublicApi.setUser(2 as any)

rumPublicApi.setUser(undefined as any)
expect(errorSpy).toHaveBeenCalledTimes(3)
expect(displaySpy).toHaveBeenCalledTimes(3)
})

@@ -410,3 +422,3 @@ })

let addTimingSpy: jasmine.Spy<ReturnType<StartRum>['addTiming']>
let errorSpy: jasmine.Spy<() => void>
let displaySpy: jasmine.Spy<() => void>
let rumPublicApi: RumPublicApi

@@ -417,3 +429,3 @@ let setupBuilder: TestSetupBuilder

addTimingSpy = jasmine.createSpy()
errorSpy = spyOn(console, 'error')
displaySpy = spyOn(display, 'error')
rumPublicApi = makeRumPublicApi(() => ({

@@ -455,5 +467,5 @@ ...noopStartRum(),

expect(addTimingSpy.calls.argsFor(0)[1]).toBeUndefined()
expect(errorSpy).not.toHaveBeenCalled()
expect(displaySpy).not.toHaveBeenCalled()
})
})
})

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

ClocksState,
display,
} from '@datadog/browser-core'

@@ -127,3 +128,3 @@ import { CustomAction } from '../domain/rumEventsCollection/action/trackActions'

} else {
console.error(`DD_RUM.addError: Invalid source '${source as string}'`)
display.error(`DD_RUM.addError: Invalid source '${source as string}'`)
checkedSource = ErrorSource.CUSTOM

@@ -148,5 +149,9 @@ }

} else {
console.error('Unsupported user:', newUser)
display.error('Unsupported user:', newUser)
}
}),
removeUser: monitor(() => {
user = {}
}),
})

@@ -175,3 +180,3 @@ return rumPublicApi

if (!userConfiguration.silentMultipleInit) {
console.error('DD_RUM is already initialized.')
display.error('DD_RUM is already initialized.')
}

@@ -181,15 +186,15 @@ return false

if (!userConfiguration || (!userConfiguration.clientToken && !userConfiguration.publicApiKey)) {
console.error('Client Token is not configured, we will not send any data.')
display.error('Client Token is not configured, we will not send any data.')
return false
}
if (!userConfiguration.applicationId) {
console.error('Application ID is not configured, no RUM data will be collected.')
display.error('Application ID is not configured, no RUM data will be collected.')
return false
}
if (userConfiguration.sampleRate !== undefined && !isPercentage(userConfiguration.sampleRate)) {
console.error('Sample Rate should be a number between 0 and 100')
display.error('Sample Rate should be a number between 0 and 100')
return false
}
if (userConfiguration.resourceSampleRate !== undefined && !isPercentage(userConfiguration.resourceSampleRate)) {
console.error('Resource Sample Rate should be a number between 0 and 100')
display.error('Resource Sample Rate should be a number between 0 and 100')
return false

@@ -202,3 +207,3 @@ }

) {
console.error('Service need to be configured when tracing is enabled')
display.error('Service need to be configured when tracing is enabled')
return false

@@ -205,0 +210,0 @@ }

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

import { ErrorSource, ONE_MINUTE, RawError, RelativeTime } from '@datadog/browser-core'
import { ErrorSource, ONE_MINUTE, RawError, RelativeTime, display } from '@datadog/browser-core'
import { createRawRumEvent } from '../../test/fixtures'

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

const consoleWarnSpy = spyOn(console, 'warn')
const displaySpy = spyOn(display, 'warn')
lifeCycle.notify(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, {

@@ -140,3 +140,3 @@ rawRumEvent: createRawRumEvent(RumEventType.VIEW, {

expect(serverRumEvents[0].view.id).toBe('aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee')
expect(consoleWarnSpy).toHaveBeenCalledWith(`Can't dismiss view events using beforeSend!`)
expect(displaySpy).toHaveBeenCalledWith(`Can't dismiss view events using beforeSend!`)
})

@@ -143,0 +143,0 @@ })

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

timeStampNow,
currentDrift,
display,
} from '@datadog/browser-core'

@@ -68,2 +70,3 @@ import {

format_version: 2,
drift: currentDrift(),
},

@@ -117,3 +120,3 @@ application: {

if (result === false) {
console.warn(`Can't dismiss view events using beforeSend!`)
display.warn("Can't dismiss view events using beforeSend!")
}

@@ -120,0 +123,0 @@ }

import { Context, DOM_EVENT, ClocksState } from '@datadog/browser-core'
import { Clock } from '../../../../../core/test/specHelper'
import { RumEvent } from '../../../../../rum/src'

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

function mockValidatedClickAction(lifeCycle: LifeCycle, clock: jasmine.Clock, target: HTMLElement) {
function mockValidatedClickAction(lifeCycle: LifeCycle, clock: Clock, target: HTMLElement) {
target.addEventListener(DOM_EVENT.CLICK, () => {

@@ -40,0 +41,0 @@ clock.tick(BEFORE_PAGE_ACTIVITY_VALIDATION_DELAY)

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

import { Duration, RelativeTime, ClocksState, clocksNow } from '@datadog/browser-core'
import { Duration, RelativeTime, ClocksState, clocksNow, display } from '@datadog/browser-core'
import { setup, TestSetupBuilder } from '../../../../test/specHelper'

@@ -442,3 +442,3 @@ import {

const { clock } = setupBuilder.build()
const warnSpy = spyOn(console, 'warn')
const displaySpy = spyOn(display, 'warn')

@@ -451,3 +451,3 @@ clock.tick(1234)

})
expect(warnSpy).toHaveBeenCalled()
expect(displaySpy).toHaveBeenCalled()
})

@@ -454,0 +454,0 @@ })

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

clocksOrigin,
display,
} from '@datadog/browser-core'

@@ -235,5 +236,5 @@ import { ViewLoadingType, ViewCustomTimings } from '../../../rawRumEvent.types'

if (sanitized !== name) {
console.warn(`Invalid timing name: ${name}, sanitized to: ${sanitized}`)
display.warn(`Invalid timing name: ${name}, sanitized to: ${sanitized}`)
}
return sanitized
}

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

} from '@datadog/browser-core'
import { isIE } from '../../../core/test/specHelper'
import { Clock, isIE, mockClock } from '../../../core/test/specHelper'

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

let renewSessionSpy: jasmine.Spy
let clock: Clock

@@ -36,4 +37,3 @@ beforeEach(() => {

}
jasmine.clock().install()
jasmine.clock().mockDate(new Date())
clock = mockClock()
renewSessionSpy = jasmine.createSpy('renewSessionSpy')

@@ -48,4 +48,4 @@ lifeCycle = new LifeCycle()

// flush pending callbacks to avoid random failures
jasmine.clock().tick(new Date().getTime())
jasmine.clock().uninstall()
clock.tick(new Date().getTime())
clock.cleanup()
})

@@ -108,3 +108,3 @@

expect(renewSessionSpy).not.toHaveBeenCalled()
jasmine.clock().tick(COOKIE_ACCESS_DELAY)
clock.tick(COOKIE_ACCESS_DELAY)

@@ -111,0 +111,0 @@ setupDraws({ tracked: true, trackedWithResources: true })

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

import { noop, Observable, PreferredTime } from '@datadog/browser-core'
import { noop, Observable, preferredNow, PreferredTime } from '@datadog/browser-core'
import { Clock, mockClock } from '../../../core/test/specHelper'
import { RumPerformanceNavigationTiming, RumPerformanceResourceTiming } from '../browser/performanceCollection'

@@ -21,24 +22,2 @@ import { LifeCycle, LifeCycleEventType } from './lifeCycle'

function mockClock() {
beforeEach(() => {
jasmine.clock().install()
jasmine.clock().mockDate()
spyOn(performance, 'now').and.callFake(() => Date.now())
})
afterEach(() => {
jasmine.clock().uninstall()
})
return {
tick(ms: number) {
jasmine.clock().tick(ms)
},
expire() {
// Make sure no action is still pending
jasmine.clock().tick(EXPIRE_DELAY)
},
}
}
function eventsCollector<T>() {

@@ -153,4 +132,12 @@ const events: T[] = []

describe('waitPageActivitiesCompletion', () => {
const clock = mockClock()
let clock: Clock
beforeEach(() => {
clock = mockClock()
})
afterEach(() => {
clock.cleanup()
})
it('should not collect an event that is not followed by page activity', (done) => {

@@ -163,3 +150,3 @@ waitPageActivitiesCompletion(new Observable(), noop, (params) => {

clock.expire()
clock.tick(EXPIRE_DELAY)
})

@@ -170,6 +157,7 @@

const startTime = performance.now()
const startTime = preferredNow()
waitPageActivitiesCompletion(activityObservable, noop, (params) => {
expect(params.hadActivity).toBeTrue()
expect((params as { hadActivity: true; endTime: PreferredTime }).endTime).toEqual(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
(startTime + BEFORE_PAGE_ACTIVITY_VALIDATION_DELAY) as PreferredTime

@@ -183,3 +171,3 @@ )

clock.expire()
clock.tick(EXPIRE_DELAY)
})

@@ -190,3 +178,3 @@

const activityObservable = new Observable<PageActivityEvent>()
const startTime = performance.now()
const startTime = preferredNow()

@@ -199,2 +187,3 @@ // Extend the action but stops before PAGE_ACTIVITY_MAX_DURATION

expect((params as { hadActivity: true; endTime: PreferredTime }).endTime).toBe(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
(startTime + (extendCount + 1) * BEFORE_PAGE_ACTIVITY_END_DELAY) as PreferredTime

@@ -210,3 +199,3 @@ )

clock.expire()
clock.tick(EXPIRE_DELAY)
})

@@ -217,3 +206,3 @@

let stop = false
const startTime = performance.now()
const startTime = preferredNow()

@@ -226,2 +215,3 @@ // Extend the action until it's more than PAGE_ACTIVITY_MAX_DURATION

expect((params as { hadActivity: true; endTime: PreferredTime }).endTime).toBe(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
(startTime + PAGE_ACTIVITY_MAX_DURATION) as PreferredTime

@@ -238,3 +228,3 @@ )

clock.expire()
clock.tick(EXPIRE_DELAY)
})

@@ -246,6 +236,7 @@ })

const activityObservable = new Observable<PageActivityEvent>()
const startTime = performance.now()
const startTime = preferredNow()
waitPageActivitiesCompletion(activityObservable, noop, (params) => {
expect(params.hadActivity).toBeTrue()
expect((params as { hadActivity: true; endTime: PreferredTime }).endTime).toBe(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
(startTime + BEFORE_PAGE_ACTIVITY_VALIDATION_DELAY + PAGE_ACTIVITY_END_DELAY * 2) as PreferredTime

@@ -262,3 +253,3 @@ )

clock.expire()
clock.tick(EXPIRE_DELAY)
})

@@ -268,6 +259,7 @@

const activityObservable = new Observable<PageActivityEvent>()
const startTime = performance.now()
const startTime = preferredNow()
waitPageActivitiesCompletion(activityObservable, noop, (params) => {
expect(params.hadActivity).toBeTrue()
expect((params as { hadActivity: true; endTime: PreferredTime }).endTime).toBe(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
(startTime + PAGE_ACTIVITY_MAX_DURATION) as PreferredTime

@@ -281,5 +273,5 @@ )

clock.expire()
clock.tick(EXPIRE_DELAY)
})
})
})

@@ -151,2 +151,3 @@ import { Context, Duration, ErrorSource, ResourceType, ServerDuration, TimeStamp } from '@datadog/browser-core'

format_version: 2
drift: number
}

@@ -153,0 +154,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

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