@cloudcare/browser-rum 3.3.13 → 3.3.14
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/startRecording.js +5 -2
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/domain/configuration.js +1 -0
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/privacy.js +278 -0
- package/cjs/domain/privacy.js.map +1 -0
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/record/privacy.js +11 -272
- package/cjs/domain/replay/record/privacy.js.map +1 -1
- package/cjs/domain/replay/record/record.js +10 -1
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +81 -19
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +11 -4
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +16 -5
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +2 -2
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/startRecording.js +5 -2
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/configuration.js +1 -0
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/privacy.js +266 -0
- package/esm/domain/privacy.js.map +1 -0
- package/esm/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/domain/replay/record/privacy.js +1 -266
- package/esm/domain/replay/record/privacy.js.map +1 -1
- package/esm/domain/replay/record/record.js +10 -1
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +80 -18
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +11 -4
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +17 -6
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumSessionManager.js +2 -2
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/package.json +4 -4
- package/src/boot/startRecording.js +11 -2
- package/src/domain/configuration.js +4 -0
- package/src/domain/privacy.js +356 -0
- package/src/domain/replay/record/privacy.js +1 -356
- package/src/domain/replay/record/record.js +10 -1
- package/src/domain/rumEventsCollection/actions/getActionNameFromElement.js +148 -21
- package/src/domain/rumEventsCollection/actions/trackClickActions.js +19 -5
- package/src/domain/rumEventsCollection/view/trackViews.js +33 -6
- package/src/domain/rumSessionManager.js +2 -2
|
@@ -575,8 +575,17 @@ export function record(options) {
|
|
|
575
575
|
lastReplayTimeAnchorTimestamp = timestamp
|
|
576
576
|
return true
|
|
577
577
|
}
|
|
578
|
+
function emitPeriodicReplayTimeAnchor() {
|
|
579
|
+
// Keep the explicit page-exit anchor as the hidden boundary, but do not let
|
|
580
|
+
// the background timer extend the replay timeline while the Session is no
|
|
581
|
+
// longer renewed by visible-page activity.
|
|
582
|
+
if (document.visibilityState !== 'visible') {
|
|
583
|
+
return
|
|
584
|
+
}
|
|
585
|
+
emitReplayTimeAnchor()
|
|
586
|
+
}
|
|
578
587
|
var replayTimeAnchorIntervalId = setInterval(
|
|
579
|
-
|
|
588
|
+
emitPeriodicReplayTimeAnchor,
|
|
580
589
|
SESSION_REPLAY_TIME_ANCHOR_INTERVAL
|
|
581
590
|
)
|
|
582
591
|
registerInitializationCleanup(function () {
|
|
@@ -7,20 +7,44 @@ import {
|
|
|
7
7
|
getParentElement,
|
|
8
8
|
isNodeShadowRoot
|
|
9
9
|
} from '@cloudcare/browser-core'
|
|
10
|
+
import {
|
|
11
|
+
getNodePrivacyLevel,
|
|
12
|
+
shouldMaskNode
|
|
13
|
+
} from '../../privacy'
|
|
10
14
|
|
|
11
15
|
export var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE =
|
|
12
16
|
'data-guance-action-name'
|
|
17
|
+
export var ACTION_NAME_PLACEHOLDER = 'Masked Element'
|
|
13
18
|
|
|
14
19
|
export function getActionNameFromElement(
|
|
15
20
|
element,
|
|
16
|
-
|
|
17
|
-
shouldIgnoreTextualFallback
|
|
21
|
+
configuration,
|
|
22
|
+
shouldIgnoreTextualFallback,
|
|
23
|
+
nodePrivacyLevel
|
|
18
24
|
) {
|
|
25
|
+
configuration = configuration || {}
|
|
26
|
+
var userProgrammaticAttribute = configuration.actionNameAttribute
|
|
27
|
+
var nodePrivacyLevelCache = new Map()
|
|
28
|
+
var explicitActionName = getExplicitActionName(
|
|
29
|
+
element,
|
|
30
|
+
userProgrammaticAttribute
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if (explicitActionName) {
|
|
34
|
+
return explicitActionName
|
|
35
|
+
}
|
|
36
|
+
if (
|
|
37
|
+
configuration.enablePrivacyForActionName &&
|
|
38
|
+
shouldMaskNode(configuration, element, nodePrivacyLevel)
|
|
39
|
+
) {
|
|
40
|
+
return ACTION_NAME_PLACEHOLDER
|
|
41
|
+
}
|
|
42
|
+
|
|
19
43
|
return (
|
|
20
|
-
getExplicitActionName(element, userProgrammaticAttribute) ||
|
|
21
44
|
getActionNameFromElementForStrategies(
|
|
22
45
|
element,
|
|
23
|
-
|
|
46
|
+
configuration,
|
|
47
|
+
nodePrivacyLevelCache,
|
|
24
48
|
shouldIgnoreTextualFallback
|
|
25
49
|
? shadowDomPriorityStrategies
|
|
26
50
|
: priorityStrategies
|
|
@@ -28,7 +52,8 @@ export function getActionNameFromElement(
|
|
|
28
52
|
(!shouldIgnoreTextualFallback &&
|
|
29
53
|
getActionNameFromElementForStrategies(
|
|
30
54
|
element,
|
|
31
|
-
|
|
55
|
+
configuration,
|
|
56
|
+
nodePrivacyLevelCache,
|
|
32
57
|
fallbackStrategies
|
|
33
58
|
)) ||
|
|
34
59
|
''
|
|
@@ -74,12 +99,16 @@ function getActionNameFromElementProgrammatically(
|
|
|
74
99
|
|
|
75
100
|
var priorityStrategies = [
|
|
76
101
|
// associated LABEL text
|
|
77
|
-
function (element,
|
|
102
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
78
103
|
// IE does not support element.labels, so we fallback to a CSS selector based on the element id
|
|
79
104
|
// instead
|
|
80
105
|
if (supportsLabelProperty()) {
|
|
81
106
|
if ('labels' in element && element.labels && element.labels.length > 0) {
|
|
82
|
-
return getTextualContent(
|
|
107
|
+
return getTextualContent(
|
|
108
|
+
element.labels[0],
|
|
109
|
+
configuration,
|
|
110
|
+
nodePrivacyLevelCache
|
|
111
|
+
)
|
|
83
112
|
}
|
|
84
113
|
} else if (element.id) {
|
|
85
114
|
var label =
|
|
@@ -87,7 +116,9 @@ var priorityStrategies = [
|
|
|
87
116
|
find(element.ownerDocument.querySelectorAll('label'), function (label) {
|
|
88
117
|
return label.htmlFor === element.id
|
|
89
118
|
})
|
|
90
|
-
return
|
|
119
|
+
return (
|
|
120
|
+
label && getTextualContent(label, configuration, nodePrivacyLevelCache)
|
|
121
|
+
)
|
|
91
122
|
}
|
|
92
123
|
},
|
|
93
124
|
// INPUT button (and associated) value
|
|
@@ -101,20 +132,20 @@ var priorityStrategies = [
|
|
|
101
132
|
}
|
|
102
133
|
},
|
|
103
134
|
// BUTTON, LABEL or button-like element text
|
|
104
|
-
function (element,
|
|
135
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
105
136
|
if (
|
|
106
137
|
element.nodeName === 'BUTTON' ||
|
|
107
138
|
element.nodeName === 'LABEL' ||
|
|
108
139
|
element.getAttribute('role') === 'button'
|
|
109
140
|
) {
|
|
110
|
-
return getTextualContent(element,
|
|
141
|
+
return getTextualContent(element, configuration, nodePrivacyLevelCache)
|
|
111
142
|
}
|
|
112
143
|
},
|
|
113
144
|
function (element) {
|
|
114
145
|
return element.getAttribute('aria-label')
|
|
115
146
|
},
|
|
116
147
|
// associated element text designated by the aria-labelledby attribute
|
|
117
|
-
function (element,
|
|
148
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
118
149
|
var labelledByAttribute = element.getAttribute('aria-labelledby')
|
|
119
150
|
if (labelledByAttribute) {
|
|
120
151
|
labelledByAttribute = labelledByAttribute.split(/\s+/)
|
|
@@ -125,7 +156,7 @@ var priorityStrategies = [
|
|
|
125
156
|
return Boolean(label)
|
|
126
157
|
})
|
|
127
158
|
labelledByAttribute = map(labelledByAttribute, function (ele) {
|
|
128
|
-
return getTextualContent(ele,
|
|
159
|
+
return getTextualContent(ele, configuration, nodePrivacyLevelCache)
|
|
129
160
|
})
|
|
130
161
|
return labelledByAttribute.join(' ')
|
|
131
162
|
}
|
|
@@ -143,24 +174,28 @@ var priorityStrategies = [
|
|
|
143
174
|
return element.getAttribute('placeholder')
|
|
144
175
|
},
|
|
145
176
|
// SELECT first OPTION text
|
|
146
|
-
function (element,
|
|
177
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
147
178
|
if ('options' in element && element.options.length > 0) {
|
|
148
|
-
return getTextualContent(
|
|
179
|
+
return getTextualContent(
|
|
180
|
+
element.options[0],
|
|
181
|
+
configuration,
|
|
182
|
+
nodePrivacyLevelCache
|
|
183
|
+
)
|
|
149
184
|
}
|
|
150
185
|
}
|
|
151
186
|
]
|
|
152
187
|
|
|
153
188
|
var shadowDomPriorityStrategies = priorityStrategies.concat([
|
|
154
|
-
function (element,
|
|
189
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
155
190
|
if (element.nodeName === 'A' && element.hasAttribute('href')) {
|
|
156
|
-
return getTextualContent(element,
|
|
191
|
+
return getTextualContent(element, configuration, nodePrivacyLevelCache)
|
|
157
192
|
}
|
|
158
193
|
}
|
|
159
194
|
])
|
|
160
195
|
|
|
161
196
|
var fallbackStrategies = [
|
|
162
|
-
function (element,
|
|
163
|
-
return getTextualContent(element,
|
|
197
|
+
function (element, configuration, nodePrivacyLevelCache) {
|
|
198
|
+
return getTextualContent(element, configuration, nodePrivacyLevelCache)
|
|
164
199
|
}
|
|
165
200
|
]
|
|
166
201
|
|
|
@@ -171,7 +206,8 @@ var fallbackStrategies = [
|
|
|
171
206
|
var MAX_PARENTS_TO_CONSIDER = 10
|
|
172
207
|
function getActionNameFromElementForStrategies(
|
|
173
208
|
targetElement,
|
|
174
|
-
|
|
209
|
+
configuration,
|
|
210
|
+
nodePrivacyLevelCache,
|
|
175
211
|
strategies
|
|
176
212
|
) {
|
|
177
213
|
var element = targetElement
|
|
@@ -183,9 +219,19 @@ function getActionNameFromElementForStrategies(
|
|
|
183
219
|
element.nodeName !== 'HTML' &&
|
|
184
220
|
element.nodeName !== 'HEAD'
|
|
185
221
|
) {
|
|
222
|
+
if (configuration.enablePrivacyForActionName) {
|
|
223
|
+
var privacyLevel = getNodePrivacyLevel(
|
|
224
|
+
element,
|
|
225
|
+
configuration.defaultPrivacyLevel,
|
|
226
|
+
nodePrivacyLevelCache
|
|
227
|
+
)
|
|
228
|
+
if (shouldMaskNode(configuration, element, privacyLevel)) {
|
|
229
|
+
return ACTION_NAME_PLACEHOLDER
|
|
230
|
+
}
|
|
231
|
+
}
|
|
186
232
|
for (var i = 0; i < strategies.length; i++) {
|
|
187
233
|
var strategy = strategies[i]
|
|
188
|
-
var name = strategy(element,
|
|
234
|
+
var name = strategy(element, configuration, nodePrivacyLevelCache)
|
|
189
235
|
if (typeof name === 'string') {
|
|
190
236
|
var trimmedName = name.trim()
|
|
191
237
|
if (trimmedName) {
|
|
@@ -231,11 +277,31 @@ function getElementById(refElement, id) {
|
|
|
231
277
|
: null
|
|
232
278
|
}
|
|
233
279
|
|
|
234
|
-
function getTextualContent(element,
|
|
280
|
+
function getTextualContent(element, configuration, nodePrivacyLevelCache) {
|
|
235
281
|
if (element.isContentEditable) {
|
|
236
282
|
return
|
|
237
283
|
}
|
|
238
284
|
|
|
285
|
+
if (configuration.enablePrivacyForActionName) {
|
|
286
|
+
var privacyLevel = getNodePrivacyLevel(
|
|
287
|
+
element,
|
|
288
|
+
configuration.defaultPrivacyLevel,
|
|
289
|
+
nodePrivacyLevelCache
|
|
290
|
+
)
|
|
291
|
+
if (shouldMaskNode(configuration, element, privacyLevel)) {
|
|
292
|
+
return
|
|
293
|
+
}
|
|
294
|
+
return getPrivacyAwareTextualContent(
|
|
295
|
+
element,
|
|
296
|
+
configuration,
|
|
297
|
+
nodePrivacyLevelCache
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return getLegacyTextualContent(element, configuration.actionNameAttribute)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function getLegacyTextualContent(element, userProgrammaticAttribute) {
|
|
239
305
|
if ('innerText' in element) {
|
|
240
306
|
var text = element.innerText
|
|
241
307
|
|
|
@@ -273,6 +339,67 @@ function getTextualContent(element, userProgrammaticAttribute) {
|
|
|
273
339
|
return element.textContent
|
|
274
340
|
}
|
|
275
341
|
|
|
342
|
+
function getPrivacyAwareTextualContent(
|
|
343
|
+
element,
|
|
344
|
+
configuration,
|
|
345
|
+
nodePrivacyLevelCache
|
|
346
|
+
) {
|
|
347
|
+
var ownerDocument = element.ownerDocument || document
|
|
348
|
+
var ownerWindow = ownerDocument.defaultView || window
|
|
349
|
+
var nodeFilter = ownerWindow.NodeFilter || NodeFilter
|
|
350
|
+
var walker = ownerDocument.createTreeWalker(
|
|
351
|
+
element,
|
|
352
|
+
nodeFilter.SHOW_ELEMENT | nodeFilter.SHOW_TEXT,
|
|
353
|
+
function (node) {
|
|
354
|
+
var privacyLevel = getNodePrivacyLevel(
|
|
355
|
+
node,
|
|
356
|
+
configuration.defaultPrivacyLevel,
|
|
357
|
+
nodePrivacyLevelCache
|
|
358
|
+
)
|
|
359
|
+
if (shouldMaskNode(configuration, node, privacyLevel)) {
|
|
360
|
+
return nodeFilter.FILTER_REJECT
|
|
361
|
+
}
|
|
362
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
363
|
+
if (
|
|
364
|
+
node.hasAttribute(DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE) ||
|
|
365
|
+
(configuration.actionNameAttribute &&
|
|
366
|
+
node.hasAttribute(configuration.actionNameAttribute))
|
|
367
|
+
) {
|
|
368
|
+
return nodeFilter.FILTER_REJECT
|
|
369
|
+
}
|
|
370
|
+
var style = ownerWindow.getComputedStyle(node)
|
|
371
|
+
if (
|
|
372
|
+
style.visibility !== 'visible' ||
|
|
373
|
+
style.display === 'none' ||
|
|
374
|
+
(style.contentVisibility && style.contentVisibility !== 'visible')
|
|
375
|
+
) {
|
|
376
|
+
return nodeFilter.FILTER_REJECT
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return nodeFilter.FILTER_ACCEPT
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
var text = ''
|
|
383
|
+
while (walker.nextNode()) {
|
|
384
|
+
var node = walker.currentNode
|
|
385
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
386
|
+
var style = ownerWindow.getComputedStyle(node)
|
|
387
|
+
if (
|
|
388
|
+
node.nodeName === 'BR' ||
|
|
389
|
+
node.nodeName === 'P' ||
|
|
390
|
+
['block', 'flex', 'grid', 'list-item', 'table', 'table-caption'].indexOf(
|
|
391
|
+
style.display
|
|
392
|
+
) !== -1
|
|
393
|
+
) {
|
|
394
|
+
text += ' '
|
|
395
|
+
}
|
|
396
|
+
} else {
|
|
397
|
+
text += node.textContent || ''
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return normalizeWhitespace(text).trim()
|
|
401
|
+
}
|
|
402
|
+
|
|
276
403
|
/**
|
|
277
404
|
* Returns true if element.innerText excludes the text from inline SCRIPT and STYLE element. This
|
|
278
405
|
* should be the case everywhere except on Internet Explorer 10 and 11 (see [1])
|
|
@@ -30,6 +30,8 @@ import { getSelectorFromElement } from './getSelectorsFromElement'
|
|
|
30
30
|
// import { getSelectorsFromElement } from './getSelectorsFromElement'
|
|
31
31
|
import { listenActionEvents } from './listenActionEvents'
|
|
32
32
|
import { computeFrustration } from './computeFrustration'
|
|
33
|
+
import { NodePrivacyLevel } from '../../../constants'
|
|
34
|
+
import { getNodePrivacyLevel } from '../../privacy'
|
|
33
35
|
import {
|
|
34
36
|
CLICK_ACTION_MAX_DURATION,
|
|
35
37
|
updateInteractionSelector
|
|
@@ -119,9 +121,17 @@ function processPointerDown(
|
|
|
119
121
|
domMutationObservable,
|
|
120
122
|
pointerDownEvent
|
|
121
123
|
) {
|
|
124
|
+
var target = getEventTarget(pointerDownEvent)
|
|
125
|
+
var nodePrivacyLevel = configuration.enablePrivacyForActionName
|
|
126
|
+
? getNodePrivacyLevel(target, configuration.defaultPrivacyLevel)
|
|
127
|
+
: NodePrivacyLevel.ALLOW
|
|
128
|
+
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
122
131
|
var clickActionBase = computeClickActionBase(
|
|
123
132
|
pointerDownEvent,
|
|
124
|
-
configuration
|
|
133
|
+
configuration,
|
|
134
|
+
nodePrivacyLevel
|
|
125
135
|
)
|
|
126
136
|
|
|
127
137
|
var hadActivityOnPointerDown = false
|
|
@@ -214,10 +224,13 @@ function startClickAction(
|
|
|
214
224
|
})
|
|
215
225
|
}
|
|
216
226
|
|
|
217
|
-
function computeClickActionBase(event,
|
|
227
|
+
function computeClickActionBase(event, configuration, nodePrivacyLevel) {
|
|
218
228
|
var target = getEventTarget(event)
|
|
219
229
|
var rect = target.getBoundingClientRect()
|
|
220
|
-
var selector = getSelectorFromElement(
|
|
230
|
+
var selector = getSelectorFromElement(
|
|
231
|
+
target,
|
|
232
|
+
configuration.actionNameAttribute
|
|
233
|
+
)
|
|
221
234
|
if (selector) {
|
|
222
235
|
updateInteractionSelector(event.timeStamp, selector)
|
|
223
236
|
}
|
|
@@ -234,8 +247,9 @@ function computeClickActionBase(event, actionNameAttribute) {
|
|
|
234
247
|
},
|
|
235
248
|
name: getActionNameFromElement(
|
|
236
249
|
target,
|
|
237
|
-
|
|
238
|
-
target !== event.target
|
|
250
|
+
configuration,
|
|
251
|
+
target !== event.target,
|
|
252
|
+
nodePrivacyLevel
|
|
239
253
|
)
|
|
240
254
|
}
|
|
241
255
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ViewLoadingType,
|
|
12
12
|
LifeCycleEventType,
|
|
13
13
|
PageExitReason,
|
|
14
|
+
SESSION_TIME_OUT_DELAY,
|
|
14
15
|
isHashAnAnchor,
|
|
15
16
|
getPathFromHash,
|
|
16
17
|
noop,
|
|
@@ -43,6 +44,9 @@ export function trackViews(
|
|
|
43
44
|
recorderApi
|
|
44
45
|
) {
|
|
45
46
|
var eventBridgeAvailable = canUseEventBridge()
|
|
47
|
+
var maxViewDuration = eventBridgeAvailable
|
|
48
|
+
? Infinity
|
|
49
|
+
: SESSION_TIME_OUT_DELAY
|
|
46
50
|
var isWebViewActive =
|
|
47
51
|
!eventBridgeAvailable ||
|
|
48
52
|
(document.visibilityState !== 'hidden' && document.hasFocus())
|
|
@@ -64,7 +68,8 @@ export function trackViews(
|
|
|
64
68
|
viewOptions,
|
|
65
69
|
canMatchSoftNavigation,
|
|
66
70
|
fallbackNavigationType,
|
|
67
|
-
recorderApi
|
|
71
|
+
recorderApi,
|
|
72
|
+
maxViewDuration
|
|
68
73
|
)
|
|
69
74
|
activeViews.add(newlyCreatedView)
|
|
70
75
|
newlyCreatedView.stopObservable.subscribe(function () {
|
|
@@ -136,9 +141,26 @@ export function trackViews(
|
|
|
136
141
|
}
|
|
137
142
|
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, renewCurrentView)
|
|
138
143
|
|
|
139
|
-
lifeCycle.subscribe(
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
lifeCycle.subscribe(
|
|
145
|
+
LifeCycleEventType.SESSION_EXPIRED,
|
|
146
|
+
function (sessionExpirationTime) {
|
|
147
|
+
var sessionExpirationClocks
|
|
148
|
+
if (
|
|
149
|
+
typeof sessionExpirationTime === 'number' &&
|
|
150
|
+
sessionExpirationTime >= currentView.startClocks.timeStamp
|
|
151
|
+
) {
|
|
152
|
+
const origin = clocksOrigin()
|
|
153
|
+
sessionExpirationClocks = {
|
|
154
|
+
relative: elapsed(origin.timeStamp, sessionExpirationTime),
|
|
155
|
+
timeStamp: sessionExpirationTime
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
currentView.end({
|
|
159
|
+
sessionIsActive: false,
|
|
160
|
+
endClocks: sessionExpirationClocks
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
)
|
|
142
164
|
|
|
143
165
|
if (eventBridgeAvailable) {
|
|
144
166
|
function updateWebViewLifecycle(event) {
|
|
@@ -235,7 +257,8 @@ function newView(
|
|
|
235
257
|
viewOptions,
|
|
236
258
|
canMatchSoftNavigation,
|
|
237
259
|
fallbackNavigationType,
|
|
238
|
-
recorderApi
|
|
260
|
+
recorderApi,
|
|
261
|
+
maxViewDuration
|
|
239
262
|
) {
|
|
240
263
|
// Setup initial values
|
|
241
264
|
if (startClocks === undefined) {
|
|
@@ -411,7 +434,10 @@ function newView(
|
|
|
411
434
|
startClocks: startClocks,
|
|
412
435
|
commonViewMetrics: getCommonViewMetrics(),
|
|
413
436
|
initialViewMetrics: initialViewMetrics,
|
|
414
|
-
duration:
|
|
437
|
+
duration: Math.min(
|
|
438
|
+
elapsed(startClocks.timeStamp, currentEnd),
|
|
439
|
+
maxViewDuration
|
|
440
|
+
),
|
|
415
441
|
isActive: endClocks === undefined,
|
|
416
442
|
sessionIsActive: sessionIsActive,
|
|
417
443
|
eventCounts: eventCounts
|
|
@@ -422,6 +448,7 @@ function newView(
|
|
|
422
448
|
service: service,
|
|
423
449
|
version: version,
|
|
424
450
|
contextManager: contextManager,
|
|
451
|
+
startClocks: startClocks,
|
|
425
452
|
stopObservable: stopObservable,
|
|
426
453
|
end: function (options) {
|
|
427
454
|
if (endClocks) {
|
|
@@ -43,8 +43,8 @@ export function startRumSessionManager(configuration, lifeCycle) {
|
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
|
|
46
|
-
sessionManager.expireObservable.subscribe(function () {
|
|
47
|
-
lifeCycle.notify(LifeCycleEventType.SESSION_EXPIRED)
|
|
46
|
+
sessionManager.expireObservable.subscribe(function (sessionExpirationTime) {
|
|
47
|
+
lifeCycle.notify(LifeCycleEventType.SESSION_EXPIRED, sessionExpirationTime)
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
sessionManager.renewObservable.subscribe(function () {
|