@cloudcare/browser-rum 3.3.0 → 3.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/bundle/dataflux-rum.js +1 -1
  2. package/cjs/boot/buildEnv.js +1 -1
  3. package/cjs/boot/perStartRum.js +11 -7
  4. package/cjs/boot/perStartRum.js.map +1 -1
  5. package/cjs/boot/recorderApi.js +39 -43
  6. package/cjs/boot/recorderApi.js.map +1 -1
  7. package/cjs/boot/recorderApiStub.js +53 -0
  8. package/cjs/boot/recorderApiStub.js.map +1 -0
  9. package/cjs/boot/rum.entry.js +6 -7
  10. package/cjs/boot/rum.entry.js.map +1 -1
  11. package/cjs/boot/rum.slim.entry.js +13 -0
  12. package/cjs/boot/rum.slim.entry.js.map +1 -0
  13. package/cjs/boot/rumEntryFactory.js +15 -0
  14. package/cjs/boot/rumEntryFactory.js.map +1 -0
  15. package/cjs/boot/rumPublicApi.js +8 -46
  16. package/cjs/boot/rumPublicApi.js.map +1 -1
  17. package/cjs/boot/rumRecorderApiStub.js +19 -0
  18. package/cjs/boot/rumRecorderApiStub.js.map +1 -0
  19. package/cjs/boot/rumSlimConfiguration.js +16 -0
  20. package/cjs/boot/rumSlimConfiguration.js.map +1 -0
  21. package/cjs/boot/sessionReplayPublicApi.js +62 -0
  22. package/cjs/boot/sessionReplayPublicApi.js.map +1 -0
  23. package/cjs/boot/startRecording.js +6 -1
  24. package/cjs/boot/startRecording.js.map +1 -1
  25. package/cjs/domain/deflate/deflateEncoder.js +2 -4
  26. package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
  27. package/cjs/domain/deflate/deflateWorker.js +1 -1
  28. package/cjs/domain/encoderStreamId.js +11 -0
  29. package/cjs/domain/encoderStreamId.js.map +1 -0
  30. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  31. package/cjs/domain/replay/record/mutationObserver.js +14 -1
  32. package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
  33. package/cjs/domain/replay/record/record.js +39 -0
  34. package/cjs/domain/replay/record/record.js.map +1 -1
  35. package/cjs/domain/tracing/jaegerTracer.js +6 -6
  36. package/cjs/domain/tracing/jaegerTracer.js.map +1 -1
  37. package/cjs/domain/tracing/traceIdentifier.js +22 -0
  38. package/cjs/domain/tracing/traceIdentifier.js.map +1 -1
  39. package/cjs/domain/tracing/zipkinMultiTracer.js +6 -6
  40. package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -1
  41. package/cjs/domain/tracing/zipkinSingleTracer.js +6 -6
  42. package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -1
  43. package/cjs/transport/startRumBatch.js +2 -2
  44. package/cjs/transport/startRumBatch.js.map +1 -1
  45. package/esm/boot/buildEnv.js +1 -1
  46. package/esm/boot/perStartRum.js +11 -7
  47. package/esm/boot/perStartRum.js.map +1 -1
  48. package/esm/boot/recorderApi.js +39 -43
  49. package/esm/boot/recorderApi.js.map +1 -1
  50. package/esm/boot/recorderApiStub.js +47 -0
  51. package/esm/boot/recorderApiStub.js.map +1 -0
  52. package/esm/boot/rum.entry.js +6 -7
  53. package/esm/boot/rum.entry.js.map +1 -1
  54. package/esm/boot/rum.slim.entry.js +7 -0
  55. package/esm/boot/rum.slim.entry.js.map +1 -0
  56. package/esm/boot/rumEntryFactory.js +9 -0
  57. package/esm/boot/rumEntryFactory.js.map +1 -0
  58. package/esm/boot/rumPublicApi.js +8 -46
  59. package/esm/boot/rumPublicApi.js.map +1 -1
  60. package/esm/boot/rumRecorderApiStub.js +13 -0
  61. package/esm/boot/rumRecorderApiStub.js.map +1 -0
  62. package/esm/boot/rumSlimConfiguration.js +10 -0
  63. package/esm/boot/rumSlimConfiguration.js.map +1 -0
  64. package/esm/boot/sessionReplayPublicApi.js +56 -0
  65. package/esm/boot/sessionReplayPublicApi.js.map +1 -0
  66. package/esm/boot/startRecording.js +6 -1
  67. package/esm/boot/startRecording.js.map +1 -1
  68. package/esm/domain/deflate/deflateEncoder.js +2 -4
  69. package/esm/domain/deflate/deflateEncoder.js.map +1 -1
  70. package/esm/domain/deflate/deflateWorker.js +1 -1
  71. package/esm/domain/encoderStreamId.js +5 -0
  72. package/esm/domain/encoderStreamId.js.map +1 -0
  73. package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
  74. package/esm/domain/replay/record/mutationObserver.js +14 -1
  75. package/esm/domain/replay/record/mutationObserver.js.map +1 -1
  76. package/esm/domain/replay/record/record.js +39 -0
  77. package/esm/domain/replay/record/record.js.map +1 -1
  78. package/esm/domain/tracing/jaegerTracer.js +7 -7
  79. package/esm/domain/tracing/jaegerTracer.js.map +1 -1
  80. package/esm/domain/tracing/traceIdentifier.js +20 -0
  81. package/esm/domain/tracing/traceIdentifier.js.map +1 -1
  82. package/esm/domain/tracing/zipkinMultiTracer.js +7 -7
  83. package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
  84. package/esm/domain/tracing/zipkinSingleTracer.js +7 -7
  85. package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
  86. package/esm/transport/startRumBatch.js +2 -2
  87. package/esm/transport/startRumBatch.js.map +1 -1
  88. package/package.json +2 -2
  89. package/src/boot/perStartRum.js +11 -7
  90. package/src/boot/recorderApi.js +42 -43
  91. package/src/boot/recorderApiStub.js +47 -0
  92. package/src/boot/rum.entry.js +6 -8
  93. package/src/boot/rum.slim.entry.js +7 -0
  94. package/src/boot/rumEntryFactory.js +10 -0
  95. package/src/boot/rumPublicApi.js +14 -46
  96. package/src/boot/rumRecorderApiStub.js +14 -0
  97. package/src/boot/rumSlimConfiguration.js +11 -0
  98. package/src/boot/sessionReplayPublicApi.js +57 -0
  99. package/src/boot/startRecording.js +6 -1
  100. package/src/domain/deflate/deflateEncoder.js +2 -4
  101. package/src/domain/encoderStreamId.js +5 -0
  102. package/src/domain/replay/record/mutationObserver.js +14 -1
  103. package/src/domain/replay/record/record.js +46 -0
  104. package/src/domain/tracing/jaegerTracer.js +16 -9
  105. package/src/domain/tracing/traceIdentifier.js +24 -0
  106. package/src/domain/tracing/zipkinMultiTracer.js +16 -9
  107. package/src/domain/tracing/zipkinSingleTracer.js +14 -7
  108. package/src/transport/startRumBatch.js +2 -2
  109. package/types/index.d.ts +15 -0
@@ -24,12 +24,13 @@ export function createPreStartStrategy(
24
24
  ) {
25
25
  var ignoreInitIfSyntheticsWillInjectRum =
26
26
  rumPublicApiOptions.ignoreInitIfSyntheticsWillInjectRum
27
- var startDeflateWorker = rumPublicApiOptions.startDeflateWorker
27
+ var startCompressionWorker = rumPublicApiOptions.startCompressionWorker
28
+ var overrideInitConfiguration = rumPublicApiOptions.overrideInitConfiguration
28
29
  var bufferApiCalls = createBoundedBuffer()
29
30
  var remoteConfigrationCallbacks = createBoundedBuffer()
30
31
  var firstStartViewCall
31
32
 
32
- var deflateWorker
33
+ var compressionWorker
33
34
 
34
35
  var cachedInitConfiguration
35
36
  var cachedConfiguration
@@ -58,7 +59,7 @@ export function createPreStartStrategy(
58
59
 
59
60
  var startRumResult = doStartRum(
60
61
  cachedConfiguration,
61
- deflateWorker,
62
+ compressionWorker,
62
63
  initialViewOptions
63
64
  )
64
65
 
@@ -70,6 +71,9 @@ export function createPreStartStrategy(
70
71
  if (eventBridgeAvailable) {
71
72
  initConfiguration = overrideInitConfigurationForBridge(initConfiguration)
72
73
  }
74
+ if (overrideInitConfiguration) {
75
+ initConfiguration = overrideInitConfiguration(initConfiguration)
76
+ }
73
77
 
74
78
  // Update the exposed initConfiguration to reflect the bridge and remote configuration overrides
75
79
  cachedInitConfiguration = initConfiguration
@@ -96,9 +100,9 @@ export function createPreStartStrategy(
96
100
  configuration.compressIntakeRequests &&
97
101
  !configuration.sendContentTypeByJson &&
98
102
  !eventBridgeAvailable &&
99
- startDeflateWorker
103
+ startCompressionWorker
100
104
  ) {
101
- deflateWorker = startDeflateWorker(
105
+ compressionWorker = startCompressionWorker(
102
106
  configuration,
103
107
  'RUM',
104
108
  // Worker initialization can fail asynchronously, especially in Firefox where even CSP
@@ -106,8 +110,8 @@ export function createPreStartStrategy(
106
110
  // data won't be sent to Datadog. We could improve this behavior in the future.
107
111
  noop
108
112
  )
109
- if (!deflateWorker) {
110
- // `startDeflateWorker` should have logged an error message explaining the issue
113
+ if (!compressionWorker) {
114
+ // The compression worker starter should have logged an error message explaining the issue
111
115
  return
112
116
  }
113
117
  }
@@ -8,6 +8,7 @@ import {
8
8
  PageExitReason
9
9
  } from '@cloudcare/browser-core'
10
10
 
11
+ import { makeRecorderApiStub } from './recorderApiStub'
11
12
  import { getReplayStats as getReplayStatsImpl } from '../domain/replay/replayStats'
12
13
  import {
13
14
  createDeflateEncoder,
@@ -33,48 +34,7 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
33
34
  (canUseEventBridge() && !bridgeSupports(BridgeCapability.RECORDS)) ||
34
35
  !isBrowserSupported()
35
36
  ) {
36
- return {
37
- start: noop,
38
- stop: noop,
39
- takeSubsequentFullSnapshot: noop,
40
- snapshotCanvas: function () {
41
- return {
42
- ok: false,
43
- reason: 'not_recording'
44
- }
45
- },
46
- getSerializedNodeIdForDebug: function () {
47
- return undefined
48
- },
49
- getLastAutoCanvasSnapshotResultForDebug: function () {
50
- return undefined
51
- },
52
- getAutoCanvasSnapshotDebugHistoryForDebug: function () {
53
- return undefined
54
- },
55
- getLastCanvasMutationForDebug: function () {
56
- return undefined
57
- },
58
- getCanvasMutationHistoryForDebug: function () {
59
- return undefined
60
- },
61
- getLastReplaySegmentFlushForDebug: function () {
62
- return undefined
63
- },
64
- getReplaySegmentFlushHistoryForDebug: function () {
65
- return undefined
66
- },
67
- getReplayPerformanceForDebug: function () {
68
- return undefined
69
- },
70
- getReplayStats: function () {
71
- return undefined
72
- },
73
- onRumStart: noop,
74
- isRecording: function () {
75
- return false
76
- }
77
- }
37
+ return makeRecorderApiStub()
78
38
  }
79
39
 
80
40
  var state = {
@@ -109,6 +69,12 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
109
69
  var getCanvasMutationHistoryForDebug = function () {
110
70
  return undefined
111
71
  }
72
+ var getLastDomMutationForDebug = function () {
73
+ return undefined
74
+ }
75
+ var getDomMutationHistoryForDebug = function () {
76
+ return undefined
77
+ }
112
78
  var getLastReplaySegmentFlushForDebug = function () {
113
79
  return undefined
114
80
  }
@@ -118,6 +84,7 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
118
84
  var getReplayPerformanceForDebug = function () {
119
85
  return undefined
120
86
  }
87
+ var flushReplayMutationsForDebug = noop
121
88
  return {
122
89
  start: function (options) {
123
90
  startStrategy(options)
@@ -226,12 +193,18 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
226
193
  recordingImpl.getLastCanvasMutationForDebug || noop,
227
194
  getCanvasMutationHistoryForDebug:
228
195
  recordingImpl.getCanvasMutationHistoryForDebug || noop,
196
+ getLastDomMutationForDebug:
197
+ recordingImpl.getLastDomMutationForDebug || noop,
198
+ getDomMutationHistoryForDebug:
199
+ recordingImpl.getDomMutationHistoryForDebug || noop,
229
200
  getLastReplaySegmentFlushForDebug:
230
201
  recordingImpl.getLastReplaySegmentFlushForDebug || noop,
231
202
  getReplaySegmentFlushHistoryForDebug:
232
203
  recordingImpl.getReplaySegmentFlushHistoryForDebug || noop,
233
204
  getReplayPerformanceForDebug:
234
- recordingImpl.getReplayPerformanceForDebug || noop
205
+ recordingImpl.getReplayPerformanceForDebug || noop,
206
+ flushReplayMutationsForDebug:
207
+ recordingImpl.flushReplayMutationsForDebug || noop
235
208
  }
236
209
  })
237
210
  }
@@ -291,6 +264,18 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
291
264
  }
292
265
  return undefined
293
266
  }
267
+ getLastDomMutationForDebug = function () {
268
+ if (state.status === RecorderStatus.Started) {
269
+ return state.getLastDomMutationForDebug()
270
+ }
271
+ return undefined
272
+ }
273
+ getDomMutationHistoryForDebug = function () {
274
+ if (state.status === RecorderStatus.Started) {
275
+ return state.getDomMutationHistoryForDebug()
276
+ }
277
+ return undefined
278
+ }
294
279
  getLastReplaySegmentFlushForDebug = function () {
295
280
  if (state.status === RecorderStatus.Started) {
296
281
  return state.getLastReplaySegmentFlushForDebug()
@@ -309,6 +294,11 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
309
294
  }
310
295
  return undefined
311
296
  }
297
+ flushReplayMutationsForDebug = function () {
298
+ if (state.status === RecorderStatus.Started) {
299
+ state.flushReplayMutationsForDebug()
300
+ }
301
+ }
312
302
  if (state.status === RecorderStatus.IntentToStart) {
313
303
  startStrategy()
314
304
  }
@@ -337,12 +327,21 @@ export function makeRecorderApi(startRecordingImpl, createDeflateWorkerImpl) {
337
327
  getCanvasMutationHistoryForDebug: function () {
338
328
  return getCanvasMutationHistoryForDebug()
339
329
  },
330
+ getLastDomMutationForDebug: function () {
331
+ return getLastDomMutationForDebug()
332
+ },
333
+ getDomMutationHistoryForDebug: function () {
334
+ return getDomMutationHistoryForDebug()
335
+ },
340
336
  getReplaySegmentFlushHistoryForDebug: function () {
341
337
  return getReplaySegmentFlushHistoryForDebug()
342
338
  },
343
339
  getReplayPerformanceForDebug: function () {
344
340
  return getReplayPerformanceForDebug()
345
341
  },
342
+ flushReplayMutationsForDebug: function () {
343
+ flushReplayMutationsForDebug()
344
+ },
346
345
  isRecording: function () {
347
346
  return (
348
347
  getDeflateWorkerStatus() === DeflateWorkerStatus.Initialized &&
@@ -0,0 +1,47 @@
1
+ import { noop } from '@cloudcare/browser-core'
2
+ import { makeRumRecorderApiStub } from './rumRecorderApiStub'
3
+
4
+ export function makeRecorderApiStub() {
5
+ var recorderApi = makeRumRecorderApiStub()
6
+ recorderApi.start = noop
7
+ recorderApi.stop = noop
8
+ recorderApi.takeSubsequentFullSnapshot = noop
9
+ recorderApi.snapshotCanvas = function () {
10
+ return {
11
+ ok: false,
12
+ reason: 'not_recording'
13
+ }
14
+ }
15
+ recorderApi.getSerializedNodeIdForDebug = function () {
16
+ return undefined
17
+ }
18
+ recorderApi.getLastAutoCanvasSnapshotResultForDebug = function () {
19
+ return undefined
20
+ }
21
+ recorderApi.getAutoCanvasSnapshotDebugHistoryForDebug = function () {
22
+ return undefined
23
+ }
24
+ recorderApi.getLastCanvasMutationForDebug = function () {
25
+ return undefined
26
+ }
27
+ recorderApi.getCanvasMutationHistoryForDebug = function () {
28
+ return undefined
29
+ }
30
+ recorderApi.getLastDomMutationForDebug = function () {
31
+ return undefined
32
+ }
33
+ recorderApi.getDomMutationHistoryForDebug = function () {
34
+ return undefined
35
+ }
36
+ recorderApi.getLastReplaySegmentFlushForDebug = function () {
37
+ return undefined
38
+ }
39
+ recorderApi.getReplaySegmentFlushHistoryForDebug = function () {
40
+ return undefined
41
+ }
42
+ recorderApi.getReplayPerformanceForDebug = function () {
43
+ return undefined
44
+ }
45
+ recorderApi.flushReplayMutationsForDebug = noop
46
+ return recorderApi
47
+ }
@@ -1,13 +1,11 @@
1
- import { defineGlobal, getGlobalObject } from '@cloudcare/browser-core'
2
- import { startRum } from './rum'
3
- import { makeRumPublicApi } from './rumPublicApi'
4
1
  import { startRecording } from './startRecording'
5
2
  import { makeRecorderApi } from './recorderApi'
6
3
  import { createDeflateEncoder, startDeflateWorker } from '../domain/deflate'
4
+ import { makeRumEntry } from './rumEntryFactory'
5
+ import { makeSessionReplayPublicApi } from './sessionReplayPublicApi'
7
6
  var recorderApi = makeRecorderApi(startRecording)
8
- export var datafluxRum = makeRumPublicApi(startRum, recorderApi, {
9
- startDeflateWorker: startDeflateWorker,
10
- createDeflateEncoder: createDeflateEncoder
7
+ export var datafluxRum = makeRumEntry(recorderApi, {
8
+ startCompressionWorker: startDeflateWorker,
9
+ createCompressionEncoder: createDeflateEncoder,
10
+ makeRecorderPublicApi: makeSessionReplayPublicApi
11
11
  })
12
-
13
- defineGlobal(getGlobalObject(), 'DATAFLUX_RUM', datafluxRum)
@@ -0,0 +1,7 @@
1
+ import { makeRumRecorderApiStub } from './rumRecorderApiStub'
2
+ import { makeRumEntry } from './rumEntryFactory'
3
+ import { forceRumSlimConfiguration } from './rumSlimConfiguration'
4
+
5
+ export var datafluxRum = makeRumEntry(makeRumRecorderApiStub(), {
6
+ overrideInitConfiguration: forceRumSlimConfiguration
7
+ })
@@ -0,0 +1,10 @@
1
+ import { defineGlobal, getGlobalObject } from '@cloudcare/browser-core'
2
+ import { startRum } from './rum'
3
+ import { makeRumPublicApi } from './rumPublicApi'
4
+
5
+ export function makeRumEntry(recorderApi, options) {
6
+ var datafluxRum = makeRumPublicApi(startRum, recorderApi, options)
7
+ defineGlobal(getGlobalObject(), 'DATAFLUX_RUM', datafluxRum)
8
+ return datafluxRum
9
+ }
10
+
@@ -60,7 +60,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
60
60
  resourceTrackerManager: resourceTrackerManager
61
61
  }),
62
62
  getCommonContext,
63
- function (configuration, deflateWorker, initialViewOptions) {
63
+ function (configuration, compressionWorker, initialViewOptions) {
64
64
  if (configuration.storeContextsToLocal) {
65
65
  storeContextManager(
66
66
  configuration,
@@ -76,7 +76,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
76
76
  )
77
77
  }
78
78
  customerDataTrackerManager.setCompressionStatus(
79
- deflateWorker
79
+ compressionWorker
80
80
  ? CustomerDataCompressionStatus.Enabled
81
81
  : CustomerDataCompressionStatus.Disabled
82
82
  )
@@ -86,9 +86,12 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
86
86
  customerDataTrackerManager,
87
87
  getCommonContext,
88
88
  initialViewOptions,
89
- deflateWorker && options.createDeflateEncoder
89
+ compressionWorker && options.createCompressionEncoder
90
90
  ? function (streamId) {
91
- return options.createDeflateEncoder(deflateWorker, streamId)
91
+ return options.createCompressionEncoder(
92
+ compressionWorker,
93
+ streamId
94
+ )
92
95
  }
93
96
  : createIdentityEncoder,
94
97
  resourceTrackerManager
@@ -98,7 +101,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
98
101
  configuration,
99
102
  startRumResult.session,
100
103
  startRumResult.viewContexts,
101
- deflateWorker
104
+ compressionWorker
102
105
  )
103
106
 
104
107
  strategy = createPostStartStrategy(strategy, startRumResult)
@@ -119,7 +122,11 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
119
122
  addTelemetryUsage({ feature: 'start-view' })
120
123
  })
121
124
 
122
- var rumPublicApi = makePublicApi({
125
+ const recorderPublicApi = options.makeRecorderPublicApi
126
+ ? options.makeRecorderPublicApi(recorderApi)
127
+ : {}
128
+
129
+ var rumPublicApi = makePublicApi(assign({
123
130
  init: monitor(function (initConfiguration) {
124
131
  strategy.init(initConfiguration)
125
132
  }),
@@ -286,45 +293,6 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
286
293
  strategy.setForcedSession()
287
294
  addTelemetryUsage({ feature: 'set-forced-session' })
288
295
  }),
289
- startSessionReplayRecording: monitor(function (options) {
290
- recorderApi.start(options)
291
- addTelemetryUsage({
292
- feature: 'start-session-replay-recording',
293
- force: options && options.force
294
- })
295
- }),
296
- isRecording: monitor(function () {
297
- return recorderApi.isRecording()
298
- }),
299
- stopSessionReplayRecording: monitor(recorderApi.stop),
300
- takeSubsequentFullSnapshot: monitor(recorderApi.takeSubsequentFullSnapshot),
301
- snapshotCanvas: monitor(function (canvas, options) {
302
- return recorderApi.snapshotCanvas(canvas, options)
303
- }),
304
- getSerializedNodeIdForDebug: monitor(function (node) {
305
- return recorderApi.getSerializedNodeIdForDebug(node)
306
- }),
307
- getLastAutoCanvasSnapshotResultForDebug: monitor(function () {
308
- return recorderApi.getLastAutoCanvasSnapshotResultForDebug()
309
- }),
310
- getAutoCanvasSnapshotDebugHistoryForDebug: monitor(function () {
311
- return recorderApi.getAutoCanvasSnapshotDebugHistoryForDebug()
312
- }),
313
- getLastCanvasMutationForDebug: monitor(function () {
314
- return recorderApi.getLastCanvasMutationForDebug()
315
- }),
316
- getCanvasMutationHistoryForDebug: monitor(function () {
317
- return recorderApi.getCanvasMutationHistoryForDebug()
318
- }),
319
- getLastReplaySegmentFlushForDebug: monitor(function () {
320
- return recorderApi.getLastReplaySegmentFlushForDebug()
321
- }),
322
- getReplaySegmentFlushHistoryForDebug: monitor(function () {
323
- return recorderApi.getReplaySegmentFlushHistoryForDebug()
324
- }),
325
- getReplayPerformanceForDebug: monitor(function () {
326
- return recorderApi.getReplayPerformanceForDebug()
327
- }),
328
296
  createResourceTrackerId: monitor(function () {
329
297
  return resourceTrackerManager.createTrackerId()
330
298
  }),
@@ -346,7 +314,7 @@ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
346
314
  getResource: monitor(function (trackerId) {
347
315
  return resourceTrackerManager.getResource(trackerId)
348
316
  })
349
- })
317
+ }, recorderPublicApi))
350
318
  return rumPublicApi
351
319
  }
352
320
  function createPostStartStrategy(preStartStrategy, startRumResult) {
@@ -0,0 +1,14 @@
1
+ import { noop } from '@cloudcare/browser-core'
2
+
3
+ export function makeRumRecorderApiStub() {
4
+ return {
5
+ getReplayStats: function () {
6
+ return undefined
7
+ },
8
+ onRumStart: noop,
9
+ isRecording: function () {
10
+ return false
11
+ }
12
+ }
13
+ }
14
+
@@ -0,0 +1,11 @@
1
+ import { assign } from '@cloudcare/browser-core'
2
+
3
+ export function forceRumSlimConfiguration(initConfiguration) {
4
+ return assign({}, initConfiguration, {
5
+ sessionReplaySampleRate: 0,
6
+ sessionReplayOnErrorSampleRate: 0,
7
+ replayCanvasEnabled: false,
8
+ compressIntakeRequests: false
9
+ })
10
+ }
11
+
@@ -0,0 +1,57 @@
1
+ import { addTelemetryUsage, monitor } from '@cloudcare/browser-core'
2
+
3
+ export function makeSessionReplayPublicApi(recorderApi) {
4
+ return {
5
+ startSessionReplayRecording: monitor(function (options) {
6
+ recorderApi.start(options)
7
+ addTelemetryUsage({
8
+ feature: 'start-session-replay-recording',
9
+ force: options && options.force
10
+ })
11
+ }),
12
+ isRecording: monitor(function () {
13
+ return recorderApi.isRecording()
14
+ }),
15
+ stopSessionReplayRecording: monitor(recorderApi.stop),
16
+ takeSubsequentFullSnapshot: monitor(recorderApi.takeSubsequentFullSnapshot),
17
+ snapshotCanvas: monitor(function (canvas, options) {
18
+ return recorderApi.snapshotCanvas(canvas, options)
19
+ }),
20
+ getSerializedNodeIdForDebug: monitor(function (node) {
21
+ return recorderApi.getSerializedNodeIdForDebug(node)
22
+ }),
23
+ getLastAutoCanvasSnapshotResultForDebug: monitor(function () {
24
+ return recorderApi.getLastAutoCanvasSnapshotResultForDebug()
25
+ }),
26
+ getAutoCanvasSnapshotDebugHistoryForDebug: monitor(function () {
27
+ return recorderApi.getAutoCanvasSnapshotDebugHistoryForDebug()
28
+ }),
29
+ getLastCanvasMutationForDebug: monitor(function () {
30
+ return recorderApi.getLastCanvasMutationForDebug()
31
+ }),
32
+ getCanvasMutationHistoryForDebug: monitor(function () {
33
+ return recorderApi.getCanvasMutationHistoryForDebug()
34
+ }),
35
+ getLastDomMutationForDebug: monitor(function () {
36
+ return recorderApi.getLastDomMutationForDebug()
37
+ }),
38
+ getDomMutationHistoryForDebug: monitor(function () {
39
+ return recorderApi.getDomMutationHistoryForDebug()
40
+ }),
41
+ getLastReplaySegmentFlushForDebug: monitor(function () {
42
+ return recorderApi.getLastReplaySegmentFlushForDebug()
43
+ }),
44
+ getReplaySegmentFlushHistoryForDebug: monitor(function () {
45
+ return recorderApi.getReplaySegmentFlushHistoryForDebug()
46
+ }),
47
+ getReplayPerformanceForDebug: monitor(function () {
48
+ return recorderApi.getReplayPerformanceForDebug()
49
+ }),
50
+ flushReplayMutationsForDebug: monitor(function () {
51
+ if (recorderApi.flushReplayMutationsForDebug) {
52
+ recorderApi.flushReplayMutationsForDebug()
53
+ }
54
+ })
55
+ }
56
+ }
57
+
@@ -137,6 +137,8 @@ export function startRecording(
137
137
  var getLastCanvasMutationForDebug = _record.getLastCanvasMutationForDebug
138
138
  var getCanvasMutationHistoryForDebug =
139
139
  _record.getCanvasMutationHistoryForDebug
140
+ var getLastDomMutationForDebug = _record.getLastDomMutationForDebug
141
+ var getDomMutationHistoryForDebug = _record.getDomMutationHistoryForDebug
140
142
  var getReplayPerformanceForDebug = function () {
141
143
  return cloneReplayPerformanceForDebug(
142
144
  _record.getReplayPerformanceForDebug
@@ -188,10 +190,13 @@ export function startRecording(
188
190
  getAutoCanvasSnapshotDebugHistoryForDebug,
189
191
  getLastCanvasMutationForDebug: getLastCanvasMutationForDebug,
190
192
  getCanvasMutationHistoryForDebug: getCanvasMutationHistoryForDebug,
193
+ getLastDomMutationForDebug: getLastDomMutationForDebug,
194
+ getDomMutationHistoryForDebug: getDomMutationHistoryForDebug,
191
195
  getLastReplaySegmentFlushForDebug: getLastReplaySegmentFlushForDebug,
192
196
  getReplaySegmentFlushHistoryForDebug:
193
197
  getReplaySegmentFlushHistoryForDebug,
194
- getReplayPerformanceForDebug: getReplayPerformanceForDebug
198
+ getReplayPerformanceForDebug: getReplayPerformanceForDebug,
199
+ flushReplayMutationsForDebug: flushMutations
195
200
  }
196
201
  }
197
202
 
@@ -4,10 +4,8 @@ import {
4
4
  addTelemetryDebug,
5
5
  assign
6
6
  } from '@cloudcare/browser-core'
7
- export var DeflateEncoderStreamId = {
8
- REPLAY: 1,
9
- RUM: 2
10
- }
7
+ import { EncoderStreamId } from '../encoderStreamId'
8
+ export var DeflateEncoderStreamId = EncoderStreamId
11
9
  export function createDeflateEncoder(worker, streamId) {
12
10
  var rawBytesCount = 0
13
11
  var compressedData = []
@@ -0,0 +1,5 @@
1
+ export var EncoderStreamId = {
2
+ REPLAY: 1,
3
+ RUM: 2
4
+ }
5
+
@@ -589,6 +589,11 @@ function createMutationTasksController(
589
589
  }
590
590
 
591
591
  var parentNode = getParentNode(task.rootNode)
592
+ var parentPendingRootTask = findPendingRootTask(parentNode)
593
+ if (parentPendingRootTask && parentPendingRootTask !== task) {
594
+ cancelPendingRootTask(task)
595
+ return
596
+ }
592
597
  var parentNodePrivacyLevel = getNodePrivacyLevel(
593
598
  parentNode,
594
599
  configuration.defaultPrivacyLevel
@@ -625,7 +630,15 @@ function createMutationTasksController(
625
630
  if (!task || task.generation !== generation) {
626
631
  return
627
632
  }
628
- if (node === task.rootNode || !task.rootNode.isConnected) {
633
+ if (node === task.rootNode) {
634
+ if (task.rootNode.isConnected) {
635
+ refreshPendingRootTask(task)
636
+ return
637
+ }
638
+ cancelPendingRootTask(task)
639
+ return
640
+ }
641
+ if (!task.rootNode.isConnected) {
629
642
  cancelPendingRootTask(task)
630
643
  return
631
644
  }
@@ -119,6 +119,11 @@ function flushPendingMutations() {
119
119
  )
120
120
  )
121
121
  mutationPayloads.forEach(function (mutationPayload) {
122
+ lastDomMutationForDebug = cloneDomMutationDebugResult(mutationPayload)
123
+ pushCanvasDebugHistoryEntry(
124
+ domMutationHistoryForDebug,
125
+ lastDomMutationForDebug
126
+ )
122
127
  emit(
123
128
  assembleIncrementalSnapshot(IncrementalSource.Mutation, mutationPayload)
124
129
  )
@@ -136,6 +141,8 @@ function flushPendingMutations() {
136
141
  var autoCanvasSnapshotDebugHistoryForDebug = []
137
142
  var lastCanvasMutationForDebug
138
143
  var canvasMutationHistoryForDebug = []
144
+ var lastDomMutationForDebug
145
+ var domMutationHistoryForDebug = []
139
146
  var shouldUseCanvasCommandCapture = shouldUseCommandCapture(
140
147
  options.configuration
141
148
  )
@@ -381,6 +388,12 @@ function flushPendingMutations() {
381
388
  getCanvasMutationHistoryForDebug: function () {
382
389
  return canvasMutationHistoryForDebug.map(cloneCanvasMutationDebugResult)
383
390
  },
391
+ getLastDomMutationForDebug: function () {
392
+ return cloneDomMutationDebugResult(lastDomMutationForDebug)
393
+ },
394
+ getDomMutationHistoryForDebug: function () {
395
+ return domMutationHistoryForDebug.map(cloneDomMutationDebugResult)
396
+ },
384
397
  getReplayPerformanceForDebug: function () {
385
398
  return cloneReplayPerformanceStats(replayPerformanceStats)
386
399
  },
@@ -812,3 +825,36 @@ function cloneCanvasMutationDebugResult(result) {
812
825
 
813
826
  return clonedResult
814
827
  }
828
+
829
+ function cloneDomMutationDebugResult(result) {
830
+ if (!result) {
831
+ return result
832
+ }
833
+
834
+ return {
835
+ timestamp:
836
+ typeof result.timestamp === 'number' ? result.timestamp : timeStampNow(),
837
+ adds: (result.adds || []).map(cloneDebugValue),
838
+ removes: (result.removes || []).map(cloneDebugValue),
839
+ texts: (result.texts || []).map(cloneDebugValue),
840
+ attributes: (result.attributes || []).map(cloneDebugValue),
841
+ addsCount: (result.adds || []).length,
842
+ removesCount: (result.removes || []).length,
843
+ textsCount: (result.texts || []).length,
844
+ attributesCount: (result.attributes || []).length
845
+ }
846
+ }
847
+
848
+ function cloneDebugValue(value) {
849
+ if (!value || typeof value !== 'object') {
850
+ return value
851
+ }
852
+ if (Array.isArray(value)) {
853
+ return value.map(cloneDebugValue)
854
+ }
855
+
856
+ return Object.keys(value).reduce(function (accumulator, key) {
857
+ accumulator[key] = cloneDebugValue(value[key])
858
+ return accumulator
859
+ }, {})
860
+ }