Socket
Socket
Sign inDemoInstall

@datadog/browser-rum

Package Overview
Dependencies
3
Maintainers
1
Versions
248
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.28.1 to 4.29.0

4

cjs/domain/segmentCollection/segmentCollection.js

@@ -80,5 +80,3 @@ "use strict";

var payload = (0, buildReplayPayload_1.buildReplayPayload)(data, segment.metadata, rawSegmentBytesCount);
if (!(0, browser_core_1.isExperimentalFeatureEnabled)('retry_replay') ||
segment.flushReason === 'visibility_hidden' ||
segment.flushReason === 'before_unload') {
if (segment.flushReason === 'visibility_hidden' || segment.flushReason === 'before_unload') {
httpRequest.sendOnExit(payload);

@@ -85,0 +83,0 @@ }

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

import { isExperimentalFeatureEnabled, ONE_SECOND, monitor } from '@datadog/browser-core';
import { ONE_SECOND, monitor } from '@datadog/browser-core';
import { buildReplayPayload } from './buildReplayPayload';

@@ -76,5 +76,3 @@ import { Segment } from './segment';

var payload = buildReplayPayload(data, segment.metadata, rawSegmentBytesCount);
if (!isExperimentalFeatureEnabled('retry_replay') ||
segment.flushReason === 'visibility_hidden' ||
segment.flushReason === 'before_unload') {
if (segment.flushReason === 'visibility_hidden' || segment.flushReason === 'before_unload') {
httpRequest.sendOnExit(payload);

@@ -81,0 +79,0 @@ }

{
"name": "@datadog/browser-rum",
"version": "4.28.1",
"version": "4.29.0",
"license": "Apache-2.0",

@@ -15,7 +15,7 @@ "main": "cjs/entries/main.js",

"dependencies": {
"@datadog/browser-core": "4.28.1",
"@datadog/browser-rum-core": "4.28.1"
"@datadog/browser-core": "4.29.0",
"@datadog/browser-rum-core": "4.29.0"
},
"peerDependencies": {
"@datadog/browser-logs": "4.28.1"
"@datadog/browser-logs": "4.29.0"
},

@@ -36,3 +36,3 @@ "peerDependenciesMeta": {

},
"gitHead": "6d2b900395438ecb2917b8ee5d090cc5772b53db"
"gitHead": "8983972b924a04cbd3084d569673d8e1eaaf3d06"
}
import type { HttpRequest, TimeStamp } from '@datadog/browser-core'
import { PageExitReason, updateExperimentalFeatures, resetExperimentalFeatures, isIE } from '@datadog/browser-core'
import { PageExitReason, isIE } from '@datadog/browser-core'
import type { ViewContexts, ViewContext } from '@datadog/browser-rum-core'

@@ -86,3 +86,2 @@ import { LifeCycle, LifeCycleEventType } from '@datadog/browser-rum-core'

stopSegmentCollection()
resetExperimentalFeatures()
})

@@ -139,13 +138,2 @@

describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.sendOnExit` when sending the segment', () => {
addRecordAndFlushSegment(emulatePageUnload)
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
})
})
it('next segment is created because of beforeunload event', () => {

@@ -168,13 +156,2 @@ addRecordAndFlushSegment(emulatePageUnload)

describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.sendOnExit` when sending the segment', () => {
addRecordAndFlushSegment(emulatePageHidden)
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
})
})
it('next segment is created because of visibility hidden event', () => {

@@ -192,18 +169,7 @@ addRecordAndFlushSegment(emulatePageHidden)

it('uses `httpRequest.sendOnExit` when sending the segment', () => {
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(emulateViewChange)
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
expect(httpRequestSpy.send).toHaveBeenCalled()
})
describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(emulateViewChange)
expect(httpRequestSpy.send).toHaveBeenCalled()
})
})
it('next segment is created because of view change', () => {

@@ -217,22 +183,9 @@ addRecordAndFlushSegment(emulateViewChange)

describe('flush when reaching a bytes limit', () => {
it('uses `httpRequest.sendOnExit` when sending the segment', () => {
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(() => {
addRecord(VERY_BIG_RECORD)
})
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
expect(httpRequestSpy.send).toHaveBeenCalled()
})
describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(() => {
addRecord(VERY_BIG_RECORD)
})
expect(httpRequestSpy.send).toHaveBeenCalled()
})
})
it('next segment is created because the bytes limit has been reached', () => {

@@ -254,4 +207,4 @@ addRecordAndFlushSegment(() => {

expect(httpRequestSpy.sendOnExit).toHaveBeenCalledTimes(1)
expect(getSentFormData(httpRequestSpy.sendOnExit).get('records_count')).toBe('4')
expect(httpRequestSpy.send).toHaveBeenCalledTimes(1)
expect(getSentFormData(httpRequestSpy.send).get('records_count')).toBe('4')
})

@@ -273,4 +226,4 @@

expect(httpRequestSpy.sendOnExit).toHaveBeenCalledTimes(1)
expect(getSentFormData(httpRequestSpy.sendOnExit).get('records_count')).toBe('2')
expect(httpRequestSpy.send).toHaveBeenCalledTimes(1)
expect(getSentFormData(httpRequestSpy.send).get('records_count')).toBe('2')
})

@@ -280,3 +233,3 @@ })

describe('flush when a duration has been reached', () => {
it('uses `httpRequest.sendOnExit` when sending the segment', () => {
it('uses `httpRequest.send` when sending the segment', () => {
clock = mockClock()

@@ -286,19 +239,5 @@ addRecordAndFlushSegment(() => {

})
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
expect(httpRequestSpy.send).toHaveBeenCalled()
})
describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.send` when sending the segment', () => {
clock = mockClock()
addRecordAndFlushSegment(() => {
clock!.tick(SEGMENT_DURATION_LIMIT)
})
expect(httpRequestSpy.send).toHaveBeenCalled()
})
})
it('next segment is created because of the segment duration limit has been reached', () => {

@@ -329,17 +268,6 @@ clock = mockClock()

describe('flush when stopping segment collection', () => {
it('uses `httpRequest.sendOnExit` when sending the segment', () => {
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(stopSegmentCollection)
expect(httpRequestSpy.sendOnExit).toHaveBeenCalled()
expect(httpRequestSpy.send).toHaveBeenCalled()
})
describe('with the retry_replay experimental flag', () => {
beforeEach(() => {
updateExperimentalFeatures(['retry_replay'])
})
it('uses `httpRequest.send` when sending the segment', () => {
addRecordAndFlushSegment(stopSegmentCollection)
expect(httpRequestSpy.send).toHaveBeenCalled()
})
})
})

@@ -346,0 +274,0 @@ })

import type { HttpRequest, TimeoutId } from '@datadog/browser-core'
import { isExperimentalFeatureEnabled, ONE_SECOND, monitor } from '@datadog/browser-core'
import { ONE_SECOND, monitor } from '@datadog/browser-core'
import type { LifeCycle, ViewContexts, RumSessionManager } from '@datadog/browser-rum-core'

@@ -136,7 +136,3 @@ import { LifeCycleEventType } from '@datadog/browser-rum-core'

const payload = buildReplayPayload(data, segment.metadata, rawSegmentBytesCount)
if (
!isExperimentalFeatureEnabled('retry_replay') ||
segment.flushReason === 'visibility_hidden' ||
segment.flushReason === 'before_unload'
) {
if (segment.flushReason === 'visibility_hidden' || segment.flushReason === 'before_unload') {
httpRequest.sendOnExit(payload)

@@ -143,0 +139,0 @@ } else {

Sorry, the diff of this file is too big to display

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc