@cloudcare/browser-rum 3.0.19 → 3.0.20
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/recorderApi.js +1 -1
- package/cjs/boot/rum.js +10 -2
- package/cjs/boot/rumPublicApi.js +17 -4
- package/cjs/domain/replay/record/serializationUtils.js +13 -1
- package/cjs/domain/replay/record/serialize.js +31 -2
- package/cjs/domain/rumSessionManager.js +7 -2
- package/cjs/transport/startRumEventBridge.js +16 -0
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/recorderApi.js +2 -2
- package/esm/boot/rum.js +11 -4
- package/esm/boot/rumPublicApi.js +18 -5
- package/esm/domain/replay/record/serializationUtils.js +11 -1
- package/esm/domain/replay/record/serialize.js +32 -3
- package/esm/domain/rumSessionManager.js +8 -3
- package/esm/transport/startRumEventBridge.js +8 -0
- package/package.json +3 -3
- package/src/boot/recorderApi.js +3 -2
- package/src/boot/rum.js +22 -10
- package/src/boot/rumPublicApi.js +16 -4
- package/src/domain/replay/record/serializationUtils.js +10 -1
- package/src/domain/replay/record/serialize.js +37 -5
- package/src/domain/rumSessionManager.js +9 -3
- package/src/transport/startRumEventBridge.js +17 -0
|
@@ -28,7 +28,8 @@ import {
|
|
|
28
28
|
switchToAbsoluteUrl,
|
|
29
29
|
serializeStyleSheets,
|
|
30
30
|
absoluteToDoc,
|
|
31
|
-
getAbsoluteSrcsetString
|
|
31
|
+
getAbsoluteSrcsetString,
|
|
32
|
+
validateStringifiedCssRule
|
|
32
33
|
} from './serializationUtils'
|
|
33
34
|
|
|
34
35
|
// Those values are the only one that can be used when inheriting privacy levels from parent to
|
|
@@ -337,6 +338,29 @@ function getValidTagName(tagName) {
|
|
|
337
338
|
|
|
338
339
|
return processedTagName
|
|
339
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Browsers sometimes destructively modify the css rules they receive.
|
|
343
|
+
* This function tries to rectify the modifications the browser made to make it more cross platform compatible.
|
|
344
|
+
* @param cssText - output of `CSSStyleRule.cssText`
|
|
345
|
+
* @returns `cssText` with browser inconsistencies fixed.
|
|
346
|
+
*/
|
|
347
|
+
function fixBrowserCompatibilityIssuesInCSS(cssText) {
|
|
348
|
+
/**
|
|
349
|
+
* Chrome outputs `-webkit-background-clip` as `background-clip` in `CSSStyleRule.cssText`.
|
|
350
|
+
* But then Chrome ignores `background-clip` as css input.
|
|
351
|
+
* Re-introduce `-webkit-background-clip` to fix this issue.
|
|
352
|
+
*/
|
|
353
|
+
if (
|
|
354
|
+
cssText.includes(' background-clip: text;') &&
|
|
355
|
+
!cssText.includes(' -webkit-background-clip: text;')
|
|
356
|
+
) {
|
|
357
|
+
cssText = cssText.replace(
|
|
358
|
+
' background-clip: text;',
|
|
359
|
+
' -webkit-background-clip: text; background-clip: text;'
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
return cssText
|
|
363
|
+
}
|
|
340
364
|
|
|
341
365
|
function getCssRulesString(cssStyleSheet) {
|
|
342
366
|
if (!cssStyleSheet) {
|
|
@@ -351,14 +375,22 @@ function getCssRulesString(cssStyleSheet) {
|
|
|
351
375
|
if (!rules) {
|
|
352
376
|
return null
|
|
353
377
|
}
|
|
354
|
-
var styleSheetCssText =
|
|
378
|
+
var styleSheetCssText = fixBrowserCompatibilityIssuesInCSS(
|
|
379
|
+
Array.from(rules, getCssRuleString).join('')
|
|
380
|
+
)
|
|
355
381
|
return switchToAbsoluteUrl(styleSheetCssText, cssStyleSheet.href)
|
|
356
382
|
}
|
|
357
383
|
|
|
358
384
|
function getCssRuleString(rule) {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
385
|
+
var cssStringified = rule.cssText
|
|
386
|
+
if (isCSSImportRule(rule)) {
|
|
387
|
+
try {
|
|
388
|
+
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified
|
|
389
|
+
} catch {
|
|
390
|
+
// ignore
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return validateStringifiedCssRule(cssStringified)
|
|
362
394
|
}
|
|
363
395
|
|
|
364
396
|
function isCSSImportRule(rule) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
performDraw,
|
|
3
3
|
startSessionManager,
|
|
4
|
-
LifeCycleEventType
|
|
4
|
+
LifeCycleEventType,
|
|
5
|
+
noop,
|
|
6
|
+
Observable
|
|
5
7
|
} from '@cloudcare/browser-core'
|
|
6
8
|
|
|
7
9
|
export var RUM_SESSION_KEY = 'rum'
|
|
@@ -64,12 +66,16 @@ export function startRumSessionManager(configuration, lifeCycle) {
|
|
|
64
66
|
*/
|
|
65
67
|
export function startRumSessionManagerStub() {
|
|
66
68
|
var session = {
|
|
67
|
-
id: '00000000-aaaa-0000-aaaa-000000000000'
|
|
69
|
+
id: '00000000-aaaa-0000-aaaa-000000000000',
|
|
70
|
+
plan: RumSessionPlan.WITHOUT_SESSION_REPLAY, // plan value should not be taken into account for mobile
|
|
71
|
+
sessionReplayAllowed: false
|
|
68
72
|
}
|
|
69
73
|
return {
|
|
70
74
|
findTrackedSession: function () {
|
|
71
75
|
return session
|
|
72
|
-
}
|
|
76
|
+
},
|
|
77
|
+
expire: noop,
|
|
78
|
+
expireObservable: new Observable()
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
81
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEventBridge,
|
|
3
|
+
LifeCycleEventType,
|
|
4
|
+
processedMessageByDataMap
|
|
5
|
+
} from '@cloudcare/browser-core'
|
|
6
|
+
|
|
7
|
+
export function startRumEventBridge(lifeCycle) {
|
|
8
|
+
var bridge = getEventBridge()
|
|
9
|
+
|
|
10
|
+
lifeCycle.subscribe(
|
|
11
|
+
LifeCycleEventType.RUM_EVENT_COLLECTED,
|
|
12
|
+
function (serverRumEvent) {
|
|
13
|
+
var data = processedMessageByDataMap(serverRumEvent).rowData
|
|
14
|
+
bridge.send('rum', data)
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
}
|