@cloudcare/browser-rum 3.0.0 → 3.0.2
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/domain/replay/record/mutationObserver.js +12 -7
- package/cjs/domain/replay/record/observers.js +10 -13
- package/cjs/domain/replay/record/privacy.js +1 -3
- package/cjs/domain/replay/record/serializationUtils.js +100 -0
- package/cjs/domain/replay/record/serialize.js +40 -13
- package/cjs/domain/replay/segmentCollection/deflateWorker.js +8 -7
- package/cjs/domain/replay/segmentCollection/startDeflateWorker.js +1 -0
- package/cjs/domain/rumSessionManager.js +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/domain/replay/record/mutationObserver.js +13 -8
- package/esm/domain/replay/record/observers.js +12 -15
- package/esm/domain/replay/record/privacy.js +1 -3
- package/esm/domain/replay/record/serializationUtils.js +96 -0
- package/esm/domain/replay/record/serialize.js +41 -14
- package/esm/domain/replay/segmentCollection/deflateWorker.js +13 -10
- package/esm/domain/replay/segmentCollection/startDeflateWorker.js +1 -0
- package/esm/domain/rumSessionManager.js +1 -1
- package/package.json +3 -3
- package/src/domain/replay/record/mutationObserver.js +18 -8
- package/src/domain/replay/record/observers.js +16 -13
- package/src/domain/replay/record/privacy.js +1 -1
- package/src/domain/replay/record/serializationUtils.js +81 -2
- package/src/domain/replay/record/serialize.js +54 -15
- package/src/domain/replay/segmentCollection/deflateWorker.js +19 -12
- package/src/domain/replay/segmentCollection/segment.js +0 -1
- package/src/domain/replay/segmentCollection/startDeflateWorker.js +1 -0
- package/src/domain/rumSessionManager.js +1 -1
package/cjs/boot/buildEnv.js
CHANGED
|
@@ -83,13 +83,19 @@ function processMutations(mutations, mutationCallback, configuration, shadowRoot
|
|
|
83
83
|
}), configuration, shadowRootsController);
|
|
84
84
|
|
|
85
85
|
var adds = _processChildListMutations.adds;
|
|
86
|
-
var removes = _processChildListMutations.removes;
|
|
87
|
-
|
|
86
|
+
var removes = _processChildListMutations.removes; // var hasBeenSerialized = _processChildListMutations.hasBeenSerialized
|
|
87
|
+
|
|
88
|
+
var serializedNodeIds = _processChildListMutations.serializedNodeIds;
|
|
89
|
+
|
|
90
|
+
function hasBeenSerialized(node) {
|
|
91
|
+
return (0, _serializationUtils.hasSerializedNode)(node) && serializedNodeIds.has((0, _serializationUtils.getSerializedNodeId)(node));
|
|
92
|
+
}
|
|
93
|
+
|
|
88
94
|
var texts = processCharacterDataMutations(filteredMutations.filter(function (mutation) {
|
|
89
95
|
return mutation.type === 'characterData' && !hasBeenSerialized(mutation.target);
|
|
90
96
|
}), configuration);
|
|
91
97
|
var attributes = processAttributesMutations(filteredMutations.filter(function (mutation) {
|
|
92
|
-
mutation.type === 'attributes' && !hasBeenSerialized(mutation.target);
|
|
98
|
+
return mutation.type === 'attributes' && !hasBeenSerialized(mutation.target);
|
|
93
99
|
}), configuration);
|
|
94
100
|
|
|
95
101
|
if (!texts.length && !attributes.length && !removes.length && !adds.length) {
|
|
@@ -207,6 +213,7 @@ function processChildListMutations(mutations, configuration, shadowRootsControll
|
|
|
207
213
|
return {
|
|
208
214
|
adds: addedNodeMutations,
|
|
209
215
|
removes: removedNodeMutations,
|
|
216
|
+
serializedNodeIds: serializedNodeIds,
|
|
210
217
|
hasBeenSerialized: hasBeenSerialized
|
|
211
218
|
};
|
|
212
219
|
|
|
@@ -247,8 +254,6 @@ function processCharacterDataMutations(mutations, configuration) {
|
|
|
247
254
|
|
|
248
255
|
try {
|
|
249
256
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
250
|
-
var _getTextContent;
|
|
251
|
-
|
|
252
257
|
var mutation = _step2.value;
|
|
253
258
|
var value = mutation.target.textContent;
|
|
254
259
|
|
|
@@ -265,7 +270,7 @@ function processCharacterDataMutations(mutations, configuration) {
|
|
|
265
270
|
textMutations.push({
|
|
266
271
|
id: (0, _serializationUtils.getSerializedNodeId)(mutation.target),
|
|
267
272
|
// TODO: pass a valid "ignoreWhiteSpace" argument
|
|
268
|
-
value: (
|
|
273
|
+
value: (0, _browserCore.isNullUndefinedDefaultValue)((0, _privacy.getTextContent)(mutation.target, false, parentNodePrivacyLevel, null))
|
|
269
274
|
});
|
|
270
275
|
}
|
|
271
276
|
} catch (err) {
|
|
@@ -284,7 +289,7 @@ function processAttributesMutations(mutations, configuration) {
|
|
|
284
289
|
var filteredMutations = mutations.filter(function (mutation) {
|
|
285
290
|
var handledAttributes = handledElements.get(mutation.target);
|
|
286
291
|
|
|
287
|
-
if (handledAttributes
|
|
292
|
+
if (handledAttributes && handledAttributes.has(mutation.attributeName)) {
|
|
288
293
|
return false;
|
|
289
294
|
}
|
|
290
295
|
|
|
@@ -447,19 +447,16 @@ function initVisualViewportResizeObserver(cb) {
|
|
|
447
447
|
|
|
448
448
|
function initFrustrationObserver(lifeCycle, frustrationCb) {
|
|
449
449
|
return lifeCycle.subscribe(_browserCore.LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, function (data) {
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
})
|
|
461
|
-
}
|
|
462
|
-
});
|
|
450
|
+
if (data.rawRumEvent.type === _browserCore.RumEventType.ACTION && data.rawRumEvent.action.type === _browserCore.ActionType.CLICK && data.rawRumEvent.action.frustration && data.rawRumEvent.action.frustration.type && data.rawRumEvent.action.frustration.type.length && 'events' in data.domainContext && data.domainContext.events && data.domainContext.events.length) {// frustrationCb({
|
|
451
|
+
// timestamp: data.rawRumEvent.date,
|
|
452
|
+
// type: RecordType.FrustrationRecord,
|
|
453
|
+
// data: {
|
|
454
|
+
// frustrationTypes: data.rawRumEvent.action.frustration.type,
|
|
455
|
+
// recordIds: data.domainContext.events.map(function (e) {
|
|
456
|
+
// return getRecordIdForEvent(e)
|
|
457
|
+
// })
|
|
458
|
+
// }
|
|
459
|
+
// })
|
|
463
460
|
}
|
|
464
461
|
}).unsubscribe;
|
|
465
462
|
}
|
|
@@ -173,11 +173,9 @@ var censorText = function censorText(text) {
|
|
|
173
173
|
exports.censorText = censorText;
|
|
174
174
|
|
|
175
175
|
function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {
|
|
176
|
-
var _textNode$parentEleme;
|
|
177
|
-
|
|
178
176
|
// The parent node may not be a html element which has a tagName attribute.
|
|
179
177
|
// So just let it be undefined which is ok in this use case.
|
|
180
|
-
var parentTagName =
|
|
178
|
+
var parentTagName = textNode.parentElement && textNode.parentElement.tagName;
|
|
181
179
|
var textContent = textNode.textContent || '';
|
|
182
180
|
|
|
183
181
|
if (ignoreWhiteSpace && !textContent.trim()) {
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.URL_IN_CSS_REF = exports.DATA_URI = exports.ABSOLUTE_URL = void 0;
|
|
7
|
+
exports.absoluteToDoc = absoluteToDoc;
|
|
8
|
+
exports.getAbsoluteSrcsetString = getAbsoluteSrcsetString;
|
|
7
9
|
exports.getElementInputValue = getElementInputValue;
|
|
8
10
|
exports.getSerializedNodeId = getSerializedNodeId;
|
|
9
11
|
exports.hasSerializedNode = hasSerializedNode;
|
|
@@ -89,6 +91,19 @@ function getElementInputValue(element, nodePrivacyLevel) {
|
|
|
89
91
|
return value;
|
|
90
92
|
}
|
|
91
93
|
|
|
94
|
+
function extractOrigin(url) {
|
|
95
|
+
var origin = '';
|
|
96
|
+
|
|
97
|
+
if (url.indexOf('//') > -1) {
|
|
98
|
+
origin = url.split('/').slice(0, 3).join('/');
|
|
99
|
+
} else {
|
|
100
|
+
origin = url.split('/')[0];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
origin = origin.split('?')[0];
|
|
104
|
+
return origin;
|
|
105
|
+
}
|
|
106
|
+
|
|
92
107
|
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
|
|
93
108
|
exports.URL_IN_CSS_REF = URL_IN_CSS_REF;
|
|
94
109
|
var ABSOLUTE_URL = /^[A-Za-z]+:|^\/\//;
|
|
@@ -104,6 +119,10 @@ function switchToAbsoluteUrl(cssText, cssHref) {
|
|
|
104
119
|
return matchingSubstring;
|
|
105
120
|
}
|
|
106
121
|
|
|
122
|
+
if (url[0] === '/') {
|
|
123
|
+
return 'url('.concat(quote).concat(extractOrigin(cssHref) + url).concat(quote, ')');
|
|
124
|
+
}
|
|
125
|
+
|
|
107
126
|
var quote = singleQuote || doubleQuote || '';
|
|
108
127
|
return "url(".concat(quote).concat(makeUrlAbsolute(url, cssHref)).concat(quote, ")");
|
|
109
128
|
});
|
|
@@ -134,4 +153,85 @@ function serializeStyleSheets(cssStyleSheets) {
|
|
|
134
153
|
};
|
|
135
154
|
return styleSheet;
|
|
136
155
|
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
159
|
+
if (!attributeValue || attributeValue.trim() === '') {
|
|
160
|
+
return attributeValue;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
var a = doc.createElement('a');
|
|
164
|
+
a.href = attributeValue;
|
|
165
|
+
return a.href;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
169
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
170
|
+
|
|
171
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
172
|
+
if (attributeValue.trim() === '') {
|
|
173
|
+
return attributeValue;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var pos = 0;
|
|
177
|
+
|
|
178
|
+
function collectCharacters(regEx) {
|
|
179
|
+
var chars;
|
|
180
|
+
var match = regEx.exec(attributeValue.substring(pos));
|
|
181
|
+
|
|
182
|
+
if (match) {
|
|
183
|
+
chars = match[0];
|
|
184
|
+
pos += chars.length;
|
|
185
|
+
return chars;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
var output = [];
|
|
192
|
+
|
|
193
|
+
while (true) {
|
|
194
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
195
|
+
|
|
196
|
+
if (pos >= attributeValue.length) {
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
201
|
+
|
|
202
|
+
if (url.slice(-1) === ',') {
|
|
203
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
204
|
+
output.push(url);
|
|
205
|
+
} else {
|
|
206
|
+
var descriptorsStr = '';
|
|
207
|
+
url = absoluteToDoc(doc, url);
|
|
208
|
+
var inParens = false;
|
|
209
|
+
|
|
210
|
+
while (true) {
|
|
211
|
+
var c = attributeValue.charAt(pos);
|
|
212
|
+
|
|
213
|
+
if (c === '') {
|
|
214
|
+
output.push((url + descriptorsStr).trim());
|
|
215
|
+
break;
|
|
216
|
+
} else if (!inParens) {
|
|
217
|
+
if (c === ',') {
|
|
218
|
+
pos += 1;
|
|
219
|
+
output.push((url + descriptorsStr).trim());
|
|
220
|
+
break;
|
|
221
|
+
} else if (c === '(') {
|
|
222
|
+
inParens = true;
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
if (c === ')') {
|
|
226
|
+
inParens = false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
descriptorsStr += c;
|
|
231
|
+
pos += 1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return output.join(', ');
|
|
137
237
|
}
|
|
@@ -216,11 +216,9 @@ function serializeElementNode(element, options) {
|
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
function serializeTextNode(textNode, options) {
|
|
219
|
-
var _textNode$parentEleme;
|
|
220
|
-
|
|
221
219
|
// The parent node may not be a html element which has a tagName attribute.
|
|
222
220
|
// So just let it be undefined which is ok in this use case.
|
|
223
|
-
var parentTagName =
|
|
221
|
+
var parentTagName = textNode.parentElement && textNode.parentElement.tagName;
|
|
224
222
|
var textContent = (0, _privacy.getTextContent)(textNode, options.ignoreWhiteSpace || false, options.parentNodePrivacyLevel);
|
|
225
223
|
|
|
226
224
|
if (!textContent) {
|
|
@@ -324,19 +322,24 @@ function getValidTagName(tagName) {
|
|
|
324
322
|
return processedTagName;
|
|
325
323
|
}
|
|
326
324
|
|
|
327
|
-
function getCssRulesString(
|
|
328
|
-
|
|
329
|
-
|
|
325
|
+
function getCssRulesString(cssStyleSheet) {
|
|
326
|
+
if (!cssStyleSheet) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
330
329
|
|
|
331
|
-
|
|
332
|
-
var styleSheetCssText = Array.from(rules, getCssRuleString).join('');
|
|
333
|
-
return (0, _serializationUtils.switchToAbsoluteUrl)(styleSheetCssText, s.href);
|
|
334
|
-
}
|
|
330
|
+
var rules;
|
|
335
331
|
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
try {
|
|
333
|
+
rules = cssStyleSheet.rules || cssStyleSheet.cssRules;
|
|
334
|
+
} catch (_unused) {// if css is protected by CORS we cannot access cssRules see: https://www.w3.org/TR/cssom-1/#the-cssstylesheet-interface
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (!rules) {
|
|
338
338
|
return null;
|
|
339
339
|
}
|
|
340
|
+
|
|
341
|
+
var styleSheetCssText = Array.from(rules, getCssRuleString).join('');
|
|
342
|
+
return (0, _serializationUtils.switchToAbsoluteUrl)(styleSheetCssText, cssStyleSheet.href);
|
|
340
343
|
}
|
|
341
344
|
|
|
342
345
|
function getCssRuleString(rule) {
|
|
@@ -351,6 +354,30 @@ function isSVGElement(el) {
|
|
|
351
354
|
return el.tagName === 'svg' || el instanceof SVGElement;
|
|
352
355
|
}
|
|
353
356
|
|
|
357
|
+
function transformAttribute(doc, tagName, name, value) {
|
|
358
|
+
if (name === 'src' || name === 'href' && value && !(tagName === 'use' && value[0] === '#')) {
|
|
359
|
+
return (0, _serializationUtils.absoluteToDoc)(doc, value);
|
|
360
|
+
} else if (name === 'xlink:href' && value && value[0] !== '#') {
|
|
361
|
+
return (0, _serializationUtils.absoluteToDoc)(doc, value);
|
|
362
|
+
} else if (name === 'background' && value && (tagName === 'table' || tagName === 'td' || tagName === 'th')) {
|
|
363
|
+
return (0, _serializationUtils.absoluteToDoc)(doc, value);
|
|
364
|
+
} else if (name === 'srcset' && value) {
|
|
365
|
+
return (0, _serializationUtils.getAbsoluteSrcsetString)(doc, value);
|
|
366
|
+
} else if (name === 'style' && value) {
|
|
367
|
+
return (0, _serializationUtils.switchToAbsoluteUrl)(value, getHref());
|
|
368
|
+
} else if (tagName === 'object' && name === 'data' && value) {
|
|
369
|
+
return (0, _serializationUtils.absoluteToDoc)(doc, value);
|
|
370
|
+
} else {
|
|
371
|
+
return value;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function getHref() {
|
|
376
|
+
var a = document.createElement('a');
|
|
377
|
+
a.href = '';
|
|
378
|
+
return a.href;
|
|
379
|
+
}
|
|
380
|
+
|
|
354
381
|
function getAttributesForPrivacyLevel(element, nodePrivacyLevel, options) {
|
|
355
382
|
if (nodePrivacyLevel === _constants.NodePrivacyLevel.HIDDEN) {
|
|
356
383
|
return {};
|
|
@@ -366,7 +393,7 @@ function getAttributesForPrivacyLevel(element, nodePrivacyLevel, options) {
|
|
|
366
393
|
var attributeValue = serializeAttribute(element, nodePrivacyLevel, attributeName, options.configuration);
|
|
367
394
|
|
|
368
395
|
if (attributeValue !== null) {
|
|
369
|
-
safeAttrs[attributeName] = attributeValue;
|
|
396
|
+
safeAttrs[attributeName] = transformAttribute(doc, tagName, attributeName, attributeValue);
|
|
370
397
|
}
|
|
371
398
|
}
|
|
372
399
|
|
|
@@ -17,11 +17,11 @@ function createDeflateWorker() {
|
|
|
17
17
|
|
|
18
18
|
function workerCodeFn() {
|
|
19
19
|
monitor(function () {
|
|
20
|
-
var _makePakoDeflate = makePakoDeflate()
|
|
21
|
-
Deflate = _makePakoDeflate.Deflate,
|
|
22
|
-
constants = _makePakoDeflate.constants,
|
|
23
|
-
string2buf = _makePakoDeflate.string2buf;
|
|
20
|
+
var _makePakoDeflate = makePakoDeflate();
|
|
24
21
|
|
|
22
|
+
var Deflate = _makePakoDeflate.Deflate;
|
|
23
|
+
var constants = _makePakoDeflate.constants;
|
|
24
|
+
var string2buf = _makePakoDeflate.string2buf;
|
|
25
25
|
var deflate = new Deflate();
|
|
26
26
|
var rawBytesCount = 0;
|
|
27
27
|
self.addEventListener('message', monitor(function (event) {
|
|
@@ -50,14 +50,13 @@ function workerCodeFn() {
|
|
|
50
50
|
|
|
51
51
|
case 'flush':
|
|
52
52
|
{
|
|
53
|
-
var
|
|
54
|
-
|
|
53
|
+
var additionalBytesCount = data.data ? pushData(data.data) : 0;
|
|
55
54
|
deflate.push('', constants.Z_FINISH);
|
|
56
55
|
self.postMessage({
|
|
57
56
|
type: 'flushed',
|
|
58
57
|
id: data.id,
|
|
59
58
|
result: deflate.result,
|
|
60
|
-
additionalBytesCount:
|
|
59
|
+
additionalBytesCount: additionalBytesCount,
|
|
61
60
|
rawBytesCount: rawBytesCount
|
|
62
61
|
});
|
|
63
62
|
deflate = new Deflate();
|
|
@@ -81,6 +80,8 @@ function workerCodeFn() {
|
|
|
81
80
|
try {
|
|
82
81
|
return fn.apply(this, arguments);
|
|
83
82
|
} catch (e) {
|
|
83
|
+
console.error('===monitor', e);
|
|
84
|
+
|
|
84
85
|
try {
|
|
85
86
|
self.postMessage({
|
|
86
87
|
type: 'errored',
|
|
@@ -75,7 +75,7 @@ function computeSessionState(configuration, rawTrackingType) {
|
|
|
75
75
|
|
|
76
76
|
if (hasValidRumSession(rawTrackingType)) {
|
|
77
77
|
trackingType = rawTrackingType;
|
|
78
|
-
} else if (!(0, _browserCore.performDraw)(configuration.
|
|
78
|
+
} else if (!(0, _browserCore.performDraw)(configuration.sessionSampleRate)) {
|
|
79
79
|
trackingType = RumTrackingType.NOT_TRACKED;
|
|
80
80
|
} else if (!(0, _browserCore.performDraw)(configuration.sessionReplaySampleRate)) {
|
|
81
81
|
trackingType = RumTrackingType.TRACKED_WITHOUT_SESSION_REPLAY;
|
package/esm/boot/buildEnv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { noop, getChildNodes, isNodeShadowHost, getParentNode } from '@cloudcare/browser-core';
|
|
1
|
+
import { noop, getChildNodes, isNodeShadowHost, getParentNode, isNullUndefinedDefaultValue } from '@cloudcare/browser-core';
|
|
2
2
|
import { getMutationObserverConstructor } from '../../domMutationCollection';
|
|
3
3
|
import { NodePrivacyLevel } from '../../../constants';
|
|
4
4
|
import { getNodePrivacyLevel, getTextContent } from './privacy';
|
|
@@ -63,13 +63,19 @@ function processMutations(mutations, mutationCallback, configuration, shadowRoot
|
|
|
63
63
|
}), configuration, shadowRootsController);
|
|
64
64
|
|
|
65
65
|
var adds = _processChildListMutations.adds;
|
|
66
|
-
var removes = _processChildListMutations.removes;
|
|
67
|
-
|
|
66
|
+
var removes = _processChildListMutations.removes; // var hasBeenSerialized = _processChildListMutations.hasBeenSerialized
|
|
67
|
+
|
|
68
|
+
var serializedNodeIds = _processChildListMutations.serializedNodeIds;
|
|
69
|
+
|
|
70
|
+
function hasBeenSerialized(node) {
|
|
71
|
+
return hasSerializedNode(node) && serializedNodeIds.has(getSerializedNodeId(node));
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
var texts = processCharacterDataMutations(filteredMutations.filter(function (mutation) {
|
|
69
75
|
return mutation.type === 'characterData' && !hasBeenSerialized(mutation.target);
|
|
70
76
|
}), configuration);
|
|
71
77
|
var attributes = processAttributesMutations(filteredMutations.filter(function (mutation) {
|
|
72
|
-
mutation.type === 'attributes' && !hasBeenSerialized(mutation.target);
|
|
78
|
+
return mutation.type === 'attributes' && !hasBeenSerialized(mutation.target);
|
|
73
79
|
}), configuration);
|
|
74
80
|
|
|
75
81
|
if (!texts.length && !attributes.length && !removes.length && !adds.length) {
|
|
@@ -175,6 +181,7 @@ function processChildListMutations(mutations, configuration, shadowRootsControll
|
|
|
175
181
|
return {
|
|
176
182
|
adds: addedNodeMutations,
|
|
177
183
|
removes: removedNodeMutations,
|
|
184
|
+
serializedNodeIds: serializedNodeIds,
|
|
178
185
|
hasBeenSerialized: hasBeenSerialized
|
|
179
186
|
};
|
|
180
187
|
|
|
@@ -211,8 +218,6 @@ function processCharacterDataMutations(mutations, configuration) {
|
|
|
211
218
|
}); // Emit mutations
|
|
212
219
|
|
|
213
220
|
for (var mutation of filteredMutations) {
|
|
214
|
-
var _getTextContent;
|
|
215
|
-
|
|
216
221
|
var value = mutation.target.textContent;
|
|
217
222
|
|
|
218
223
|
if (value === mutation.oldValue) {
|
|
@@ -228,7 +233,7 @@ function processCharacterDataMutations(mutations, configuration) {
|
|
|
228
233
|
textMutations.push({
|
|
229
234
|
id: getSerializedNodeId(mutation.target),
|
|
230
235
|
// TODO: pass a valid "ignoreWhiteSpace" argument
|
|
231
|
-
value: (
|
|
236
|
+
value: isNullUndefinedDefaultValue(getTextContent(mutation.target, false, parentNodePrivacyLevel, null))
|
|
232
237
|
});
|
|
233
238
|
}
|
|
234
239
|
|
|
@@ -242,7 +247,7 @@ function processAttributesMutations(mutations, configuration) {
|
|
|
242
247
|
var filteredMutations = mutations.filter(function (mutation) {
|
|
243
248
|
var handledAttributes = handledElements.get(mutation.target);
|
|
244
249
|
|
|
245
|
-
if (handledAttributes
|
|
250
|
+
if (handledAttributes && handledAttributes.has(mutation.attributeName)) {
|
|
246
251
|
return false;
|
|
247
252
|
}
|
|
248
253
|
|
|
@@ -162,8 +162,8 @@ function tryToComputeCoordinates(event) {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
return {
|
|
165
|
-
x,
|
|
166
|
-
y
|
|
165
|
+
x: x,
|
|
166
|
+
y: y
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -431,19 +431,16 @@ function initVisualViewportResizeObserver(cb) {
|
|
|
431
431
|
|
|
432
432
|
export function initFrustrationObserver(lifeCycle, frustrationCb) {
|
|
433
433
|
return lifeCycle.subscribe(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, function (data) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
})
|
|
445
|
-
}
|
|
446
|
-
});
|
|
434
|
+
if (data.rawRumEvent.type === RumEventType.ACTION && data.rawRumEvent.action.type === ActionType.CLICK && data.rawRumEvent.action.frustration && data.rawRumEvent.action.frustration.type && data.rawRumEvent.action.frustration.type.length && 'events' in data.domainContext && data.domainContext.events && data.domainContext.events.length) {// frustrationCb({
|
|
435
|
+
// timestamp: data.rawRumEvent.date,
|
|
436
|
+
// type: RecordType.FrustrationRecord,
|
|
437
|
+
// data: {
|
|
438
|
+
// frustrationTypes: data.rawRumEvent.action.frustration.type,
|
|
439
|
+
// recordIds: data.domainContext.events.map(function (e) {
|
|
440
|
+
// return getRecordIdForEvent(e)
|
|
441
|
+
// })
|
|
442
|
+
// }
|
|
443
|
+
// })
|
|
447
444
|
}
|
|
448
445
|
}).unsubscribe;
|
|
449
446
|
}
|
|
@@ -151,11 +151,9 @@ export var censorText = function censorText(text) {
|
|
|
151
151
|
return text.replace(/\S/g, TEXT_MASKING_CHAR);
|
|
152
152
|
};
|
|
153
153
|
export function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {
|
|
154
|
-
var _textNode$parentEleme;
|
|
155
|
-
|
|
156
154
|
// The parent node may not be a html element which has a tagName attribute.
|
|
157
155
|
// So just let it be undefined which is ok in this use case.
|
|
158
|
-
var parentTagName =
|
|
156
|
+
var parentTagName = textNode.parentElement && textNode.parentElement.tagName;
|
|
159
157
|
var textContent = textNode.textContent || '';
|
|
160
158
|
|
|
161
159
|
if (ignoreWhiteSpace && !textContent.trim()) {
|
|
@@ -65,6 +65,20 @@ export function getElementInputValue(element, nodePrivacyLevel) {
|
|
|
65
65
|
|
|
66
66
|
return value;
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
function extractOrigin(url) {
|
|
70
|
+
var origin = '';
|
|
71
|
+
|
|
72
|
+
if (url.indexOf('//') > -1) {
|
|
73
|
+
origin = url.split('/').slice(0, 3).join('/');
|
|
74
|
+
} else {
|
|
75
|
+
origin = url.split('/')[0];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
origin = origin.split('?')[0];
|
|
79
|
+
return origin;
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
export var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
|
|
69
83
|
export var ABSOLUTE_URL = /^[A-Za-z]+:|^\/\//;
|
|
70
84
|
export var DATA_URI = /^data:.*,/i;
|
|
@@ -76,6 +90,10 @@ export function switchToAbsoluteUrl(cssText, cssHref) {
|
|
|
76
90
|
return matchingSubstring;
|
|
77
91
|
}
|
|
78
92
|
|
|
93
|
+
if (url[0] === '/') {
|
|
94
|
+
return 'url('.concat(quote).concat(extractOrigin(cssHref) + url).concat(quote, ')');
|
|
95
|
+
}
|
|
96
|
+
|
|
79
97
|
var quote = singleQuote || doubleQuote || '';
|
|
80
98
|
return "url(".concat(quote).concat(makeUrlAbsolute(url, cssHref)).concat(quote, ")");
|
|
81
99
|
});
|
|
@@ -104,4 +122,82 @@ export function serializeStyleSheets(cssStyleSheets) {
|
|
|
104
122
|
};
|
|
105
123
|
return styleSheet;
|
|
106
124
|
});
|
|
125
|
+
}
|
|
126
|
+
export function absoluteToDoc(doc, attributeValue) {
|
|
127
|
+
if (!attributeValue || attributeValue.trim() === '') {
|
|
128
|
+
return attributeValue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
var a = doc.createElement('a');
|
|
132
|
+
a.href = attributeValue;
|
|
133
|
+
return a.href;
|
|
134
|
+
}
|
|
135
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
136
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
137
|
+
export function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
138
|
+
if (attributeValue.trim() === '') {
|
|
139
|
+
return attributeValue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var pos = 0;
|
|
143
|
+
|
|
144
|
+
function collectCharacters(regEx) {
|
|
145
|
+
var chars;
|
|
146
|
+
var match = regEx.exec(attributeValue.substring(pos));
|
|
147
|
+
|
|
148
|
+
if (match) {
|
|
149
|
+
chars = match[0];
|
|
150
|
+
pos += chars.length;
|
|
151
|
+
return chars;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return '';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var output = [];
|
|
158
|
+
|
|
159
|
+
while (true) {
|
|
160
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
161
|
+
|
|
162
|
+
if (pos >= attributeValue.length) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
167
|
+
|
|
168
|
+
if (url.slice(-1) === ',') {
|
|
169
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
170
|
+
output.push(url);
|
|
171
|
+
} else {
|
|
172
|
+
var descriptorsStr = '';
|
|
173
|
+
url = absoluteToDoc(doc, url);
|
|
174
|
+
var inParens = false;
|
|
175
|
+
|
|
176
|
+
while (true) {
|
|
177
|
+
var c = attributeValue.charAt(pos);
|
|
178
|
+
|
|
179
|
+
if (c === '') {
|
|
180
|
+
output.push((url + descriptorsStr).trim());
|
|
181
|
+
break;
|
|
182
|
+
} else if (!inParens) {
|
|
183
|
+
if (c === ',') {
|
|
184
|
+
pos += 1;
|
|
185
|
+
output.push((url + descriptorsStr).trim());
|
|
186
|
+
break;
|
|
187
|
+
} else if (c === '(') {
|
|
188
|
+
inParens = true;
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
if (c === ')') {
|
|
192
|
+
inParens = false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
descriptorsStr += c;
|
|
197
|
+
pos += 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return output.join(', ');
|
|
107
203
|
}
|