@cloudcare/browser-rum 3.1.1 → 3.1.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.
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/boot/rum.js +23 -3
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +49 -13
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRecording.js +1 -1
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/assembly.js +6 -5
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/configuration.js +1 -3
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/contexts/displayContext.js +12 -18
- package/cjs/domain/contexts/displayContext.js.map +1 -1
- package/cjs/domain/performanceCollection.js +16 -10
- package/cjs/domain/performanceCollection.js.map +1 -1
- package/cjs/domain/replay/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +5 -5
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/privacy.js +0 -1
- package/cjs/domain/replay/record/privacy.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +14 -19
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +12 -13
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +10 -33
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js +2 -8
- package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +33 -18
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +11 -25
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +45 -2
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -4
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js +22 -29
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/{trackFirstInputTimings.js → trackFirstInput.js} +12 -9
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -0
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +18 -27
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +66 -11
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +11 -6
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js +10 -2
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +55 -24
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +34 -12
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/viewCollection.js +17 -14
- package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/cjs/domain/trackEventCounts.js +4 -4
- package/cjs/domain/trackEventCounts.js.map +1 -1
- package/cjs/transport/startRumBatch.js +1 -1
- package/cjs/transport/startRumBatch.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/rum.js +23 -3
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rumPublicApi.js +50 -14
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +1 -1
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/assembly.js +6 -5
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/configuration.js +1 -3
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/displayContext.js +11 -16
- package/esm/domain/contexts/displayContext.js.map +1 -1
- package/esm/domain/performanceCollection.js +17 -10
- package/esm/domain/performanceCollection.js.map +1 -1
- package/esm/domain/replay/deflate/deflateWorker.js +1 -1
- package/esm/domain/replay/record/mutationObserver.js +6 -6
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/privacy.js +0 -1
- package/esm/domain/replay/record/privacy.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +15 -19
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +13 -14
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +10 -33
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js +3 -9
- package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +34 -19
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +13 -27
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +47 -3
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -4
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +22 -28
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/{trackFirstInputTimings.js → trackFirstInput.js} +13 -9
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -0
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +19 -28
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +65 -12
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +12 -6
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +10 -2
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +55 -25
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +33 -12
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +18 -15
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/esm/domain/trackEventCounts.js +4 -4
- package/esm/domain/trackEventCounts.js.map +1 -1
- package/esm/transport/startRumBatch.js +1 -1
- package/esm/transport/startRumBatch.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/rum.js +27 -3
- package/src/boot/rumPublicApi.js +63 -16
- package/src/boot/startRecording.js +1 -0
- package/src/domain/assembly.js +6 -4
- package/src/domain/configuration.js +1 -3
- package/src/domain/contexts/displayContext.js +11 -20
- package/src/domain/performanceCollection.js +21 -10
- package/src/domain/replay/record/mutationObserver.js +7 -10
- package/src/domain/replay/record/privacy.js +1 -5
- package/src/domain/replay/record/serializationUtils.js +23 -19
- package/src/domain/replay/record/serialize.js +13 -16
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +7 -35
- package/src/domain/rumEventsCollection/resource/matchRequestTiming.js +4 -13
- package/src/domain/rumEventsCollection/resource/resourceCollection.js +67 -21
- package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +18 -35
- package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +59 -3
- package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -4
- package/src/domain/rumEventsCollection/view/trackFirstHidden.js +27 -32
- package/src/domain/rumEventsCollection/view/{trackFirstInputTimings.js → trackFirstInput.js} +25 -8
- package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +24 -28
- package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +79 -15
- package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +21 -6
- package/src/domain/rumEventsCollection/view/trackLoadingTime.js +10 -2
- package/src/domain/rumEventsCollection/view/trackScrollMetrics.js +79 -35
- package/src/domain/rumEventsCollection/view/trackViews.js +39 -16
- package/src/domain/rumEventsCollection/view/viewCollection.js +47 -18
- package/src/domain/trackEventCounts.js +4 -4
- package/src/transport/startRumBatch.js +3 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +0 -1
- package/esm/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +0 -1
package/src/boot/rum.js
CHANGED
|
@@ -20,6 +20,7 @@ import { startActionCollection } from '../domain/rumEventsCollection/actions/act
|
|
|
20
20
|
import { startRumBatch } from '../transport/startRumBatch'
|
|
21
21
|
import { startRumEventBridge } from '../transport/startRumEventBridge'
|
|
22
22
|
import { startRumAssembly } from '../domain/assembly'
|
|
23
|
+
import { startDisplayContext } from '../domain/contexts/displayContext.js'
|
|
23
24
|
import { startInternalContext } from '../domain/contexts/internalContext'
|
|
24
25
|
// import { startForegroundContexts } from '../domain/contexts/foregroundContexts'
|
|
25
26
|
import { startUrlContexts } from '../domain/contexts/urlContexts'
|
|
@@ -38,6 +39,7 @@ export function startRum(
|
|
|
38
39
|
userContextManager,
|
|
39
40
|
initialViewOptions
|
|
40
41
|
) {
|
|
42
|
+
var cleanupTasks = []
|
|
41
43
|
var lifeCycle = new LifeCycle()
|
|
42
44
|
var telemetry = startRumTelemetry(configuration)
|
|
43
45
|
telemetry.setContextProvider(function () {
|
|
@@ -64,7 +66,9 @@ export function startRum(
|
|
|
64
66
|
pageExitObservable.subscribe(function (event) {
|
|
65
67
|
lifeCycle.notify(LifeCycleEventType.PAGE_EXITED, event)
|
|
66
68
|
})
|
|
67
|
-
|
|
69
|
+
cleanupTasks.push(function () {
|
|
70
|
+
pageExitSubscription.unsubscribe()
|
|
71
|
+
})
|
|
68
72
|
var session = !canUseEventBridge()
|
|
69
73
|
? startRumSessionManager(configuration, lifeCycle)
|
|
70
74
|
: startRumSessionManagerStub()
|
|
@@ -77,6 +81,9 @@ export function startRum(
|
|
|
77
81
|
pageExitObservable,
|
|
78
82
|
session.expireObservable
|
|
79
83
|
)
|
|
84
|
+
cleanupTasks.push(function () {
|
|
85
|
+
batch.stop()
|
|
86
|
+
})
|
|
80
87
|
} else {
|
|
81
88
|
startRumEventBridge(lifeCycle)
|
|
82
89
|
}
|
|
@@ -105,9 +112,13 @@ export function startRum(
|
|
|
105
112
|
var urlContexts = _startRumEventCollection.urlContexts
|
|
106
113
|
var actionContexts = _startRumEventCollection.actionContexts
|
|
107
114
|
var pageStateHistory = _startRumEventCollection.pageStateHistory
|
|
115
|
+
var stopRumEventCollection = _startRumEventCollection.stop
|
|
108
116
|
var addAction = _startRumEventCollection.addAction
|
|
117
|
+
|
|
118
|
+
cleanupTasks.push(stopRumEventCollection)
|
|
119
|
+
|
|
109
120
|
startLongTaskCollection(lifeCycle, session)
|
|
110
|
-
startResourceCollection(lifeCycle, configuration)
|
|
121
|
+
startResourceCollection(lifeCycle, configuration, session, pageStateHistory)
|
|
111
122
|
|
|
112
123
|
var _startViewCollection = startViewCollection(
|
|
113
124
|
lifeCycle,
|
|
@@ -121,6 +132,9 @@ export function startRum(
|
|
|
121
132
|
)
|
|
122
133
|
var addTiming = _startViewCollection.addTiming
|
|
123
134
|
var startView = _startViewCollection.startView
|
|
135
|
+
var stopViewCollection = _startViewCollection.stop
|
|
136
|
+
cleanupTasks.push(stopViewCollection)
|
|
137
|
+
|
|
124
138
|
var _startErrorCollection = startErrorCollection(
|
|
125
139
|
lifeCycle,
|
|
126
140
|
configuration,
|
|
@@ -148,7 +162,12 @@ export function startRum(
|
|
|
148
162
|
stopSession: function () {
|
|
149
163
|
session.expire()
|
|
150
164
|
},
|
|
151
|
-
getInternalContext: internalContext.get
|
|
165
|
+
getInternalContext: internalContext.get,
|
|
166
|
+
stop: function () {
|
|
167
|
+
cleanupTasks.forEach(function (task) {
|
|
168
|
+
task()
|
|
169
|
+
})
|
|
170
|
+
}
|
|
152
171
|
}
|
|
153
172
|
}
|
|
154
173
|
function startRumTelemetry(configuration) {
|
|
@@ -189,6 +208,8 @@ export function startRumEventCollection(
|
|
|
189
208
|
)
|
|
190
209
|
var actionContexts = _startActionCollection.actionContexts
|
|
191
210
|
var addAction = _startActionCollection.addAction
|
|
211
|
+
|
|
212
|
+
var displayContext = startDisplayContext()
|
|
192
213
|
startRumAssembly(
|
|
193
214
|
configuration,
|
|
194
215
|
lifeCycle,
|
|
@@ -197,6 +218,7 @@ export function startRumEventCollection(
|
|
|
197
218
|
viewContexts,
|
|
198
219
|
urlContexts,
|
|
199
220
|
actionContexts,
|
|
221
|
+
displayContext,
|
|
200
222
|
buildCommonContext,
|
|
201
223
|
reportError
|
|
202
224
|
)
|
|
@@ -208,7 +230,9 @@ export function startRumEventCollection(
|
|
|
208
230
|
actionContexts: actionContexts,
|
|
209
231
|
stop: function () {
|
|
210
232
|
viewContexts.stop()
|
|
233
|
+
urlContexts.stop()
|
|
211
234
|
pageStateHistory.stop()
|
|
235
|
+
displayContext.stop()
|
|
212
236
|
}
|
|
213
237
|
}
|
|
214
238
|
}
|
package/src/boot/rumPublicApi.js
CHANGED
|
@@ -16,10 +16,13 @@ import {
|
|
|
16
16
|
noop,
|
|
17
17
|
assign,
|
|
18
18
|
canUseEventBridge,
|
|
19
|
-
monitor
|
|
19
|
+
monitor,
|
|
20
|
+
extend2Lev,
|
|
21
|
+
createStoredContextManager
|
|
20
22
|
} from '@cloudcare/browser-core'
|
|
21
23
|
import { validateAndBuildRumConfiguration } from '../domain/configuration'
|
|
22
24
|
import { buildCommonContext } from '../domain/contexts/commonContext'
|
|
25
|
+
var RUM_STORAGE_KEY = 'rum'
|
|
23
26
|
export function makeRumPublicApi(startRumImpl, recorderApi) {
|
|
24
27
|
var isAlreadyInitialized = false
|
|
25
28
|
|
|
@@ -118,6 +121,26 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
|
|
|
118
121
|
isAlreadyInitialized = true
|
|
119
122
|
}
|
|
120
123
|
function doStartRum(configuration, initialViewOptions) {
|
|
124
|
+
if (configuration.storeContextsToLocal) {
|
|
125
|
+
// localstorage
|
|
126
|
+
var beforeInitGlobalContext = globalContextManager.getContext()
|
|
127
|
+
globalContextManager = createStoredContextManager(
|
|
128
|
+
RUM_STORAGE_KEY,
|
|
129
|
+
CustomerDataType.GlobalContext
|
|
130
|
+
)
|
|
131
|
+
globalContextManager.setContext(
|
|
132
|
+
extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
var beforeInitUserContext = userContextManager.getContext()
|
|
136
|
+
userContextManager = createStoredContextManager(
|
|
137
|
+
RUM_STORAGE_KEY,
|
|
138
|
+
CustomerDataType.User
|
|
139
|
+
)
|
|
140
|
+
userContextManager.setContext(
|
|
141
|
+
extend2Lev(userContextManager.getContext(), beforeInitUserContext)
|
|
142
|
+
)
|
|
143
|
+
}
|
|
121
144
|
var startRumResults = startRumImpl(
|
|
122
145
|
configuration,
|
|
123
146
|
recorderApi,
|
|
@@ -147,24 +170,40 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
|
|
|
147
170
|
var rumPublicApi = makePublicApi({
|
|
148
171
|
init: monitor(initRum),
|
|
149
172
|
/** @deprecated: use setGlobalContextProperty instead */
|
|
150
|
-
addRumGlobalContext: monitor(
|
|
151
|
-
|
|
173
|
+
addRumGlobalContext: monitor(function (key, value) {
|
|
174
|
+
return globalContextManager.add(key, value)
|
|
175
|
+
}),
|
|
176
|
+
setGlobalContextProperty: monitor(function (key, value) {
|
|
177
|
+
return globalContextManager.setContextProperty(key, value)
|
|
178
|
+
}),
|
|
152
179
|
|
|
153
180
|
/** @deprecated: use removeGlobalContextProperty instead */
|
|
154
|
-
removeRumGlobalContext: monitor(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
)
|
|
181
|
+
removeRumGlobalContext: monitor(function (key) {
|
|
182
|
+
return globalContextManager.remove(key)
|
|
183
|
+
}),
|
|
184
|
+
removeGlobalContextProperty: monitor(function (key) {
|
|
185
|
+
return globalContextManager.removeContextProperty(key)
|
|
186
|
+
}),
|
|
158
187
|
|
|
159
188
|
/** @deprecated: use getGlobalContext instead */
|
|
160
|
-
getRumGlobalContext: monitor(
|
|
161
|
-
|
|
189
|
+
getRumGlobalContext: monitor(function () {
|
|
190
|
+
return globalContextManager.get()
|
|
191
|
+
}),
|
|
192
|
+
getGlobalContext: monitor(function () {
|
|
193
|
+
return globalContextManager.getContext()
|
|
194
|
+
}),
|
|
162
195
|
|
|
163
196
|
/** @deprecated: use setGlobalContext instead */
|
|
164
|
-
setRumGlobalContext: monitor(
|
|
165
|
-
|
|
197
|
+
setRumGlobalContext: monitor(function (context) {
|
|
198
|
+
return globalContextManager.set(context)
|
|
199
|
+
}),
|
|
200
|
+
setGlobalContext: monitor(function (context) {
|
|
201
|
+
return globalContextManager.setContext(context)
|
|
202
|
+
}),
|
|
166
203
|
|
|
167
|
-
clearGlobalContext: monitor(
|
|
204
|
+
clearGlobalContext: monitor(function () {
|
|
205
|
+
return globalContextManager.clearContext()
|
|
206
|
+
}),
|
|
168
207
|
|
|
169
208
|
getInitConfiguration: monitor(function () {
|
|
170
209
|
return getInitConfigurationStrategy()
|
|
@@ -200,18 +239,26 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
|
|
|
200
239
|
userContextManager.setContext(sanitizeUser(newUser))
|
|
201
240
|
}
|
|
202
241
|
}),
|
|
203
|
-
getUser: monitor(
|
|
242
|
+
getUser: monitor(function () {
|
|
243
|
+
return userContextManager.getContext()
|
|
244
|
+
}),
|
|
204
245
|
setUserProperty: monitor(function (key, property) {
|
|
205
246
|
var newUser = {}
|
|
206
247
|
newUser[key] = property
|
|
207
248
|
var sanitizedProperty = sanitizeUser(newUser)[key]
|
|
208
249
|
userContextManager.setContextProperty(key, sanitizedProperty)
|
|
209
250
|
}),
|
|
210
|
-
removeUserProperty: monitor(
|
|
251
|
+
removeUserProperty: monitor(function (key) {
|
|
252
|
+
return userContextManager.removeContextProperty(key)
|
|
253
|
+
}),
|
|
211
254
|
|
|
212
255
|
/** @deprecated: renamed to clearUser */
|
|
213
|
-
removeUser: monitor(
|
|
214
|
-
|
|
256
|
+
removeUser: monitor(function () {
|
|
257
|
+
return userContextManager.clearContext()
|
|
258
|
+
}),
|
|
259
|
+
clearUser: monitor(function () {
|
|
260
|
+
return userContextManager.clearContext()
|
|
261
|
+
}),
|
|
215
262
|
startView: startView,
|
|
216
263
|
stopSession: monitor(function () {
|
|
217
264
|
stopSessionStrategy()
|
package/src/domain/assembly.js
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
display,
|
|
13
13
|
assign
|
|
14
14
|
} from '@cloudcare/browser-core'
|
|
15
|
-
import { getDisplayContext } from './contexts/displayContext'
|
|
16
15
|
var SessionType = {
|
|
17
16
|
SYNTHETICS: 'synthetics',
|
|
18
17
|
USER: 'user'
|
|
@@ -36,6 +35,7 @@ export function startRumAssembly(
|
|
|
36
35
|
viewContexts,
|
|
37
36
|
urlContexts,
|
|
38
37
|
actionContexts,
|
|
38
|
+
displayContext,
|
|
39
39
|
buildCommonContext,
|
|
40
40
|
reportError
|
|
41
41
|
) {
|
|
@@ -117,7 +117,8 @@ export function startRumAssembly(
|
|
|
117
117
|
date: timeStampNow(),
|
|
118
118
|
user: {
|
|
119
119
|
id: userSessionManager.getId(),
|
|
120
|
-
is_signin: 'F'
|
|
120
|
+
is_signin: 'F',
|
|
121
|
+
is_login: false
|
|
121
122
|
},
|
|
122
123
|
session: {
|
|
123
124
|
// must be computed on each event because synthetics instrumentation can be done after sdk execution
|
|
@@ -139,7 +140,7 @@ export function startRumAssembly(
|
|
|
139
140
|
needToAssembleWithAction(rawRumEvent) && actionId
|
|
140
141
|
? { id: actionId, ids: actionIds }
|
|
141
142
|
: undefined,
|
|
142
|
-
display:
|
|
143
|
+
display: displayContext.get()
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent)
|
|
@@ -156,7 +157,8 @@ export function startRumAssembly(
|
|
|
156
157
|
serverRumEvent.user = extend2Lev(
|
|
157
158
|
{
|
|
158
159
|
// id: session.getAnonymousID(),
|
|
159
|
-
is_signin: 'T'
|
|
160
|
+
is_signin: 'T',
|
|
161
|
+
is_login: true
|
|
160
162
|
},
|
|
161
163
|
commonContext.user
|
|
162
164
|
)
|
|
@@ -74,7 +74,6 @@ export function validateAndBuildRumConfiguration(initConfiguration) {
|
|
|
74
74
|
initConfiguration.trackUserInteractions,
|
|
75
75
|
initConfiguration.trackInteractions
|
|
76
76
|
)
|
|
77
|
-
var trackFrustrations = !!initConfiguration.trackFrustrations
|
|
78
77
|
|
|
79
78
|
return assign(
|
|
80
79
|
{
|
|
@@ -90,8 +89,7 @@ export function validateAndBuildRumConfiguration(initConfiguration) {
|
|
|
90
89
|
initConfiguration.excludedActivityUrls,
|
|
91
90
|
[]
|
|
92
91
|
),
|
|
93
|
-
trackUserInteractions: trackUserInteractions
|
|
94
|
-
trackFrustrations: trackFrustrations,
|
|
92
|
+
trackUserInteractions: trackUserInteractions,
|
|
95
93
|
trackViewsManually: !!initConfiguration.trackViewsManually,
|
|
96
94
|
traceType: isNullUndefinedDefaultValue(
|
|
97
95
|
initConfiguration.traceType,
|
|
@@ -3,27 +3,18 @@ import {
|
|
|
3
3
|
initViewportObservable
|
|
4
4
|
} from '../initViewportObservable'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
viewport =
|
|
12
|
-
|
|
13
|
-
viewportDimension
|
|
14
|
-
) {
|
|
15
|
-
viewport = viewportDimension
|
|
16
|
-
}).unsubscribe
|
|
17
|
-
}
|
|
6
|
+
export function startDisplayContext() {
|
|
7
|
+
var viewport = getViewportDimension()
|
|
8
|
+
var unsubscribeViewport = initViewportObservable().subscribe(function (
|
|
9
|
+
viewportDimension
|
|
10
|
+
) {
|
|
11
|
+
viewport = viewportDimension
|
|
12
|
+
}).unsubscribe
|
|
18
13
|
|
|
19
14
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function resetDisplayContext() {
|
|
25
|
-
if (stopListeners) {
|
|
26
|
-
stopListeners()
|
|
15
|
+
get: function () {
|
|
16
|
+
return { viewport: viewport }
|
|
17
|
+
},
|
|
18
|
+
stop: unsubscribeViewport
|
|
27
19
|
}
|
|
28
|
-
viewport = undefined
|
|
29
20
|
}
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
runOnReadyState,
|
|
14
14
|
setTimeout,
|
|
15
15
|
addEventListener,
|
|
16
|
-
monitor
|
|
16
|
+
monitor,
|
|
17
|
+
assign
|
|
17
18
|
} from '@cloudcare/browser-core'
|
|
18
19
|
import {
|
|
19
20
|
FAKE_INITIAL_DOCUMENT,
|
|
@@ -55,7 +56,8 @@ export function startPerformanceCollection(lifeCycle, configuration) {
|
|
|
55
56
|
var experimentalEntries = [
|
|
56
57
|
'largest-contentful-paint',
|
|
57
58
|
'first-input',
|
|
58
|
-
'layout-shift'
|
|
59
|
+
'layout-shift',
|
|
60
|
+
'event'
|
|
59
61
|
]
|
|
60
62
|
try {
|
|
61
63
|
// Experimental entries are not retrieved by performance.getEntries()
|
|
@@ -63,7 +65,13 @@ export function startPerformanceCollection(lifeCycle, configuration) {
|
|
|
63
65
|
// to get values that could happen before SDK init
|
|
64
66
|
each(experimentalEntries, function (type) {
|
|
65
67
|
var observer = new PerformanceObserver(handlePerformanceEntryList)
|
|
66
|
-
observer.observe({
|
|
68
|
+
observer.observe({
|
|
69
|
+
type: type,
|
|
70
|
+
buffered: true,
|
|
71
|
+
// durationThreshold only impact PerformanceEventTiming entries used for INP computation which requires a threshold at 40 (default is 104ms)
|
|
72
|
+
// cf: https://github.com/GoogleChrome/web-vitals/blob/3806160ffbc93c3c4abf210a167b81228172b31c/src/onINP.ts#L209
|
|
73
|
+
durationThreshold: 40
|
|
74
|
+
})
|
|
67
75
|
})
|
|
68
76
|
} catch (e) {
|
|
69
77
|
// Some old browser versions (ex: chrome 67) don't support the PerformanceObserver type and buffered options
|
|
@@ -100,7 +108,10 @@ export function retrieveInitialDocumentResourceTiming(callback) {
|
|
|
100
108
|
var forcedAttributes = {
|
|
101
109
|
entryType: 'resource',
|
|
102
110
|
initiatorType: FAKE_INITIAL_DOCUMENT,
|
|
103
|
-
traceId: ''
|
|
111
|
+
traceId: '',
|
|
112
|
+
toJSON: function () {
|
|
113
|
+
return assign({}, timing, { toJSON: undefined })
|
|
114
|
+
}
|
|
104
115
|
}
|
|
105
116
|
if (
|
|
106
117
|
supportPerformanceTimingEvent('navigation') &&
|
|
@@ -167,7 +178,10 @@ function retrieveFirstInputTiming(callback) {
|
|
|
167
178
|
var timing = {
|
|
168
179
|
entryType: 'first-input',
|
|
169
180
|
processingStart: relativeNow(),
|
|
170
|
-
|
|
181
|
+
processingEnd: relativeNow(),
|
|
182
|
+
startTime: evt.timeStamp,
|
|
183
|
+
duration: 0,
|
|
184
|
+
name: ''
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
if (evt.type === DOM_EVENT.POINTER_DOWN) {
|
|
@@ -236,7 +250,8 @@ function handleRumPerformanceEntries(lifeCycle, configuration, entries) {
|
|
|
236
250
|
entry.entryType === 'longtask' ||
|
|
237
251
|
entry.entryType === 'largest-contentful-paint' ||
|
|
238
252
|
entry.entryType === 'first-input' ||
|
|
239
|
-
entry.entryType === 'layout-shift'
|
|
253
|
+
entry.entryType === 'layout-shift' ||
|
|
254
|
+
entry.entryType === 'event'
|
|
240
255
|
)
|
|
241
256
|
})
|
|
242
257
|
|
|
@@ -268,7 +283,3 @@ function isForbiddenResource(configuration, entry) {
|
|
|
268
283
|
!isAllowedRequestUrl(configuration, entry.name)
|
|
269
284
|
)
|
|
270
285
|
}
|
|
271
|
-
export function supportPerformanceEntry() {
|
|
272
|
-
// Safari 10 doesn't support PerformanceEntry
|
|
273
|
-
return typeof PerformanceEntry === 'function'
|
|
274
|
-
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
noop,
|
|
3
|
-
|
|
3
|
+
forEachChildNodes,
|
|
4
4
|
isNodeShadowHost,
|
|
5
5
|
getParentNode,
|
|
6
6
|
isNullUndefinedDefaultValue,
|
|
7
|
-
monitor
|
|
8
|
-
isNodeShadowRoot
|
|
7
|
+
monitor
|
|
9
8
|
} from '@cloudcare/browser-core'
|
|
10
9
|
import { getMutationObserverConstructor } from '../../domMutationCollection'
|
|
11
10
|
import { NodePrivacyLevel } from '../../../constants'
|
|
@@ -42,8 +41,7 @@ export function startMutationObserver(
|
|
|
42
41
|
mutations.concat(observer.takeRecords()),
|
|
43
42
|
mutationCallback,
|
|
44
43
|
configuration,
|
|
45
|
-
shadowRootsController
|
|
46
|
-
target
|
|
44
|
+
shadowRootsController
|
|
47
45
|
)
|
|
48
46
|
})
|
|
49
47
|
|
|
@@ -73,8 +71,7 @@ function processMutations(
|
|
|
73
71
|
mutations,
|
|
74
72
|
mutationCallback,
|
|
75
73
|
configuration,
|
|
76
|
-
shadowRootsController
|
|
77
|
-
target
|
|
74
|
+
shadowRootsController
|
|
78
75
|
) {
|
|
79
76
|
mutations
|
|
80
77
|
.filter(function (mutation) {
|
|
@@ -95,7 +92,7 @@ function processMutations(
|
|
|
95
92
|
// * should be hidden or ignored
|
|
96
93
|
var filteredMutations = mutations.filter(function (mutation) {
|
|
97
94
|
return (
|
|
98
|
-
|
|
95
|
+
mutation.target.isConnected &&
|
|
99
96
|
nodeAndAncestorsHaveSerializedNode(mutation.target) &&
|
|
100
97
|
getNodePrivacyLevel(
|
|
101
98
|
mutation.target,
|
|
@@ -399,7 +396,7 @@ function traverseRemovedShadowDom(removedNode, shadowDomRemovedCallback) {
|
|
|
399
396
|
if (isNodeShadowHost(removedNode)) {
|
|
400
397
|
shadowDomRemovedCallback(removedNode.shadowRoot)
|
|
401
398
|
}
|
|
402
|
-
|
|
403
|
-
traverseRemovedShadowDom(
|
|
399
|
+
forEachChildNodes(removedNode, function (childNode) {
|
|
400
|
+
return traverseRemovedShadowDom(childNode, shadowDomRemovedCallback)
|
|
404
401
|
})
|
|
405
402
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getParentNode,
|
|
3
3
|
isNodeShadowRoot,
|
|
4
|
-
buildUrl
|
|
4
|
+
buildUrl,
|
|
5
|
+
isSafari
|
|
5
6
|
} from '@cloudcare/browser-core'
|
|
6
7
|
import { CENSORED_STRING_MARK } from '../../../constants'
|
|
7
8
|
import { shouldMaskNode } from './privacy'
|
|
@@ -159,7 +160,10 @@ export function getCssRulesString(cssStyleSheet) {
|
|
|
159
160
|
return null
|
|
160
161
|
}
|
|
161
162
|
var styleSheetCssText = fixBrowserCompatibilityIssuesInCSS(
|
|
162
|
-
Array.from(
|
|
163
|
+
Array.from(
|
|
164
|
+
rules,
|
|
165
|
+
isSafari() ? getCssRuleStringForSafari : getCssRuleString
|
|
166
|
+
).join('')
|
|
163
167
|
)
|
|
164
168
|
return switchToAbsoluteUrl(styleSheetCssText, cssStyleSheet.href)
|
|
165
169
|
}
|
|
@@ -171,15 +175,10 @@ export function isSVGElement(el) {
|
|
|
171
175
|
return el.tagName === 'svg' || el instanceof SVGElement
|
|
172
176
|
}
|
|
173
177
|
export function getCssRuleString(rule) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
} catch {
|
|
179
|
-
// ignore
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return validateStringifiedCssRule(cssStringified)
|
|
178
|
+
return (
|
|
179
|
+
(isCSSImportRule(rule) && getCssRulesString(rule.styleSheet)) ||
|
|
180
|
+
rule.cssText
|
|
181
|
+
)
|
|
183
182
|
}
|
|
184
183
|
export function makeUrlAbsolute(url, baseUrl) {
|
|
185
184
|
try {
|
|
@@ -188,16 +187,21 @@ export function makeUrlAbsolute(url, baseUrl) {
|
|
|
188
187
|
return url
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
function isCSSStyleRule(rule) {
|
|
191
|
+
return 'selectorText' in rule
|
|
192
|
+
}
|
|
193
|
+
function getCssRuleStringForSafari(rule) {
|
|
194
|
+
// Safari does not escape attribute selectors containing : properly
|
|
195
|
+
// https://bugs.webkit.org/show_bug.cgi?id=184604
|
|
196
|
+
if (isCSSStyleRule(rule) && rule.selectorText.includes(':')) {
|
|
197
|
+
// This regex replaces [foo:bar] by [foo\\:bar]
|
|
198
|
+
const escapeColon = /(\[[\w-]+[^\\])(:[^\]]+\])/g
|
|
199
|
+
return rule.cssText.replace(escapeColon, '$1\\$2')
|
|
197
200
|
}
|
|
198
201
|
|
|
199
|
-
return
|
|
202
|
+
return getCssRuleString(rule)
|
|
200
203
|
}
|
|
204
|
+
|
|
201
205
|
export function serializeStyleSheets(cssStyleSheets) {
|
|
202
206
|
if (cssStyleSheets === undefined || cssStyleSheets.length === 0) {
|
|
203
207
|
return undefined
|
|
@@ -205,7 +209,7 @@ export function serializeStyleSheets(cssStyleSheets) {
|
|
|
205
209
|
return cssStyleSheets.map(function (cssStyleSheet) {
|
|
206
210
|
var rules = cssStyleSheet.cssRules || cssStyleSheet.rules
|
|
207
211
|
var cssRules = Array.from(rules, function (cssRule) {
|
|
208
|
-
return cssRule.cssText
|
|
212
|
+
return cssRule.cssText
|
|
209
213
|
})
|
|
210
214
|
|
|
211
215
|
var styleSheet = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assign,
|
|
3
3
|
startsWith,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isNodeShadowRoot,
|
|
5
|
+
forEachChildNodes,
|
|
6
|
+
hasChildNodes
|
|
6
7
|
} from '@cloudcare/browser-core'
|
|
7
8
|
import { STABLE_ATTRIBUTES } from '../../rumEventsCollection/actions/getSelectorsFromElement'
|
|
8
9
|
import {
|
|
@@ -109,18 +110,13 @@ function serializeDocumentTypeNode(documentType) {
|
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
function serializeDocumentFragmentNode(element, options) {
|
|
112
|
-
var childNodes = []
|
|
113
|
-
if (element.childNodes.length) {
|
|
114
|
-
childNodes = serializeChildNodes(element, options)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
113
|
var isShadowRoot = isNodeShadowRoot(element)
|
|
118
114
|
if (isShadowRoot) {
|
|
119
115
|
options.serializationContext.shadowRootsController.addShadowRoot(element)
|
|
120
116
|
}
|
|
121
117
|
return {
|
|
122
118
|
type: NodeType.DocumentFragment,
|
|
123
|
-
childNodes:
|
|
119
|
+
childNodes: serializeChildNodes(element, options),
|
|
124
120
|
isShadowRoot: isShadowRoot,
|
|
125
121
|
adoptedStyleSheets: isShadowRoot
|
|
126
122
|
? serializeStyleSheets(element.adoptedStyleSheets)
|
|
@@ -185,7 +181,7 @@ export function serializeElementNode(element, options) {
|
|
|
185
181
|
)
|
|
186
182
|
|
|
187
183
|
var childNodes = []
|
|
188
|
-
if (element
|
|
184
|
+
if (hasChildNodes(element) && tagName !== 'style') {
|
|
189
185
|
// OBJECT POOLING OPTIMIZATION:
|
|
190
186
|
// We should not create a new object systematically as it could impact performances. Try to reuse
|
|
191
187
|
// the same object as much as possible, and clone it only if we need to.
|
|
@@ -204,12 +200,12 @@ export function serializeElementNode(element, options) {
|
|
|
204
200
|
childNodes = serializeChildNodes(element, childNodesSerializationOptions)
|
|
205
201
|
}
|
|
206
202
|
|
|
207
|
-
if (isNodeShadowHost(element)) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
203
|
+
// if (isNodeShadowHost(element)) {
|
|
204
|
+
// var shadowRoot = serializeNodeWithId(element.shadowRoot, options)
|
|
205
|
+
// if (shadowRoot !== null) {
|
|
206
|
+
// childNodes.push(shadowRoot)
|
|
207
|
+
// }
|
|
208
|
+
// }
|
|
213
209
|
|
|
214
210
|
return {
|
|
215
211
|
type: NodeType.Element,
|
|
@@ -253,12 +249,13 @@ function serializeCDataNode() {
|
|
|
253
249
|
|
|
254
250
|
export function serializeChildNodes(node, options) {
|
|
255
251
|
var result = []
|
|
256
|
-
node
|
|
252
|
+
forEachChildNodes(node, function (childNode) {
|
|
257
253
|
var serializedChildNode = serializeNodeWithId(childNode, options)
|
|
258
254
|
if (serializedChildNode) {
|
|
259
255
|
result.push(serializedChildNode)
|
|
260
256
|
}
|
|
261
257
|
})
|
|
258
|
+
// node.childNodes.forEach()
|
|
262
259
|
return result
|
|
263
260
|
}
|
|
264
261
|
|