@coralogix/browser 3.23.6 → 3.24.0
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/CHANGELOG.md +31 -0
- package/README.md +19 -0
- package/index.esm.js +1 -1
- package/index.esm2.js +657 -45
- package/package.json +1 -1
- package/sessionRecorder.esm.js +8 -77
- package/src/constants.d.ts +4 -1
- package/src/helpers.d.ts +2 -0
- package/src/instrumentations/screenshot/dom-change-screenshot-trigger.d.ts +28 -0
- package/src/instrumentations/screenshot/dom-change-screenshot.consts.d.ts +23 -0
- package/src/instrumentations/screenshot/screenshot-gate.d.ts +1 -0
- package/src/instrumentations/screenshot/screenshot.utils.d.ts +2 -0
- package/src/instrumentations/user-interaction/user-interaction.utils.d.ts +2 -2
- package/src/session/session.model.d.ts +1 -0
- package/src/session/sessionRecorder.d.ts +1 -0
- package/src/types.d.ts +1 -0
- package/src/version.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
## 3.24.0 (2026-09-23)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Take an extra screenshot for Coralogix Product Analytics when a user action leads to a meaningful application state — a dialog, drawer or menu opening, a view being replaced — on top of the screenshots already taken on the first click and one random later click of each view. On by default whenever session recording is running; set `sessionRecordingConfig.captureScreenshotOnDomChange: false` to turn it off. Expect a small rise in upload volume: one to four extra screenshots per page view, measured on real applications
|
|
6
|
+
- List the actions available on the captured view in each Product Analytics screenshot event (`screenshot_context.actions`, up to 100 names): the page's `data-cx-action-name` values first, then the same names a click on the page's controls would report as `resolved_name`
|
|
7
|
+
|
|
8
|
+
### 🩹 Fixes
|
|
9
|
+
|
|
10
|
+
- In `onlyWithErrorConfig` mode, hold automatic Product Analytics screenshots until the session has an error. Previously the screenshot payload was uploaded straight away while the event describing it was withheld, so sessions that never errored paid for screenshots that could not be queried
|
|
11
|
+
|
|
12
|
+
## 3.23.8 (2026-09-17)
|
|
13
|
+
|
|
14
|
+
### 🩹 Fixes
|
|
15
|
+
|
|
16
|
+
- Report a clicked button's own text as its interaction name (`resolved_name`) when the button sits inside a container that has an `aria-label`, such as a `role="dialog"` panel. The container's label was reported instead
|
|
17
|
+
- Name a click on an SVG chart shape by the shape's own `<text>` label instead of by the text of the whole page section around the chart
|
|
18
|
+
- Stop naming an icon-only control after the labels of the other buttons in its toolbar; such controls now take their `title` or `alt` attribute, and report no name when they have neither
|
|
19
|
+
- Name a `<select>` by its first option instead of by all its options joined together, and name `<input type="submit">`, `"button"` and `"reset"` by their `value`
|
|
20
|
+
- Exclude text under a masked element (`maskClass`) from `resolved_name` instead of leaking it when the clicked control contains masked content
|
|
21
|
+
- Cap `resolved_name` and `element_inner_text` at 100 characters, ending with ` [...]` when cut, so a container's content can no longer produce a very long interaction name
|
|
22
|
+
- Run only the first SDK copy loaded on a page: a second copy (another bundle importing the SDK, or a CDN script next to an npm install) no longer replaces `window.CoralogixRum`, and its `init` is ignored with a debug message
|
|
23
|
+
|
|
24
|
+
## 3.23.7 (2026-09-14)
|
|
25
|
+
|
|
26
|
+
### 🩹 Fixes
|
|
27
|
+
|
|
28
|
+
- Mask a page URL segment as `{id}` only when the whole segment is digits, so route names such as `/apm-v2` and `/oauth2` keep their real value
|
|
29
|
+
- Run your own `pageUrlBlueprinters` after the built-in ID masking, so the SDK defaults no longer overwrite them
|
|
30
|
+
- Keep the fragment when masking a numeric segment: `/user/123#details` now reports as `/user/{id}#details`
|
|
31
|
+
|
|
1
32
|
## 3.23.6 (2026-09-09)
|
|
2
33
|
|
|
3
34
|
### 🩹 Fixes
|
package/README.md
CHANGED
|
@@ -352,6 +352,18 @@ CoralogixRum.init({
|
|
|
352
352
|
recordConsoleEvents: true, // Will record all console events from dev tools. Levels: log, debug, warn, error, info, table etc..
|
|
353
353
|
sessionRecordingSampleRate: 100, // Percentage of overall sessions recording being tracked, defaults to 100% and applied after the overall sessionSampleRate.
|
|
354
354
|
immediateFlush: false, // Flush recording events immediately on start to capture short-duration sessions (<10s). Defaults to false.
|
|
355
|
+
/**
|
|
356
|
+
* Take an extra screenshot when the page changes in a way that looks like a meaningful
|
|
357
|
+
* application state, such as a dialog opening or a view being replaced. These are in addition
|
|
358
|
+
* to the screenshots taken on the first click and one random later click of each view.
|
|
359
|
+
*
|
|
360
|
+
* On by default whenever session recording is running. Detection reads the session recorder's
|
|
361
|
+
* event stream, so with autoStartSessionRecording: false it stays dormant until you call
|
|
362
|
+
* CoralogixRum.startSessionRecording(). Set it to false to turn it off.
|
|
363
|
+
*
|
|
364
|
+
* Available from version 3.24.0.
|
|
365
|
+
**/
|
|
366
|
+
captureScreenshotOnDomChange: true, // Defaults to true.
|
|
355
367
|
},
|
|
356
368
|
});
|
|
357
369
|
```
|
|
@@ -702,6 +714,13 @@ CoralogixRum.init({
|
|
|
702
714
|
});
|
|
703
715
|
```
|
|
704
716
|
|
|
717
|
+
The SDK applies its own built-in blueprinting first, then your functions, in the order you list
|
|
718
|
+
them, so your blueprinter has the final word on the URL it returns.
|
|
719
|
+
|
|
720
|
+
The built-in page blueprinting replaces UUIDs and all-digit path segments with `{id}`, so
|
|
721
|
+
`/orders/1234` becomes `/orders/{id}`. A segment that only happens to contain a digit keeps its
|
|
722
|
+
real value, which leaves route names such as `/apm-v2`, `/oauth2` and `/v1` untouched.
|
|
723
|
+
|
|
705
724
|
### Traces
|
|
706
725
|
|
|
707
726
|
Add trace context propagation in headers across service boundaries
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { x as CoralogixEventType, v as CoralogixLogSeverity, u as CoralogixRum, O as OtelNetworkAttrs, y as PerformanceTypes, w as SessionRecordingEventType, U as UrlBasedLabelProvider, z as UrlType } from './index.esm2.js';
|
|
2
2
|
import 'tslib';
|
|
3
3
|
import '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import '@opentelemetry/sdk-trace-web';
|
package/index.esm2.js
CHANGED
|
@@ -284,6 +284,25 @@ function deleteSdkState(key) {
|
|
|
284
284
|
|
|
285
285
|
var CLICK_SCREENSHOT_MANAGER_KEY = 'rumClickScreenshotManager';
|
|
286
286
|
|
|
287
|
+
var DOM_CHANGE_SCREENSHOT_TRIGGER_KEY = 'rumDomChangeScreenshotTrigger';
|
|
288
|
+
var SETTLE_QUIET_MS = 500;
|
|
289
|
+
var CONTENT_ELEMENT_FLOOR = 50;
|
|
290
|
+
var CHANGE_DEBOUNCE_MS = 400;
|
|
291
|
+
var INTERACTION_TIGHT_MS = 150;
|
|
292
|
+
var INTERACTION_TIGHT_MIN_ELEMENTS = 1;
|
|
293
|
+
var INTERACTION_LOOSE_MS = 1500;
|
|
294
|
+
var INTERACTION_LOOSE_MIN_ELEMENTS = 3;
|
|
295
|
+
var OVERLAY_MAX_DEPTH = 3;
|
|
296
|
+
var MAX_DEPTH_WALK = 40;
|
|
297
|
+
var OVERLAY_MAX_REMOVES_ABSOLUTE = 2;
|
|
298
|
+
var OVERLAY_MAX_REMOVES_FRACTION = 0.1;
|
|
299
|
+
var VIEW_CHANGE_FRACTION = 0.02;
|
|
300
|
+
var VIEW_CHANGE_MIN_WEIGHT = 25;
|
|
301
|
+
var NODE_COUNT_REFRESH_MS = 2000;
|
|
302
|
+
var MIN_CAPTURE_INTERVAL_MS = 2000;
|
|
303
|
+
var MAX_CAPTURES_PER_VIEW = 10;
|
|
304
|
+
var MAX_NODES_FOR_CAPTURE = 20000;
|
|
305
|
+
|
|
287
306
|
function getSnapshotManager() {
|
|
288
307
|
return sdkStore[SNAPSHOT_MANAGER_KEY];
|
|
289
308
|
}
|
|
@@ -296,6 +315,9 @@ function getSessionRecorder() {
|
|
|
296
315
|
function getClickScreenshotManager() {
|
|
297
316
|
return sdkStore[CLICK_SCREENSHOT_MANAGER_KEY];
|
|
298
317
|
}
|
|
318
|
+
function getDomChangeScreenshotTrigger() {
|
|
319
|
+
return sdkStore[DOM_CHANGE_SCREENSHOT_TRIGGER_KEY];
|
|
320
|
+
}
|
|
299
321
|
function getSdkConfig() {
|
|
300
322
|
return sdkStore[SDK_CONFIG_KEY];
|
|
301
323
|
}
|
|
@@ -2313,6 +2335,29 @@ var ANCESTOR_SEARCH_DEPTH = 5;
|
|
|
2313
2335
|
var POINTER_CURSOR = 'pointer';
|
|
2314
2336
|
var TEXT_CURSOR = 'text';
|
|
2315
2337
|
var BODY_NODE_NAME = 'BODY';
|
|
2338
|
+
var INPUT_BUTTON_TYPES = ['button', 'submit', 'reset'];
|
|
2339
|
+
var LINE_BREAK_NODE_NAMES = ['BR', 'P'];
|
|
2340
|
+
var BLOCK_DISPLAY_VALUES = [
|
|
2341
|
+
'block',
|
|
2342
|
+
'flex',
|
|
2343
|
+
'grid',
|
|
2344
|
+
'list-item',
|
|
2345
|
+
'table',
|
|
2346
|
+
'table-caption',
|
|
2347
|
+
];
|
|
2348
|
+
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
2349
|
+
var SVG_ROOT_LOCAL_NAME = 'svg';
|
|
2350
|
+
var NON_RENDERED_SVG_LOCAL_NAMES = [
|
|
2351
|
+
'title',
|
|
2352
|
+
'desc',
|
|
2353
|
+
'metadata',
|
|
2354
|
+
'defs',
|
|
2355
|
+
'symbol',
|
|
2356
|
+
'clipPath',
|
|
2357
|
+
'mask',
|
|
2358
|
+
'pattern',
|
|
2359
|
+
'marker',
|
|
2360
|
+
];
|
|
2316
2361
|
var CLICKABLE_SELECTOR = 'a, button, input, select, textarea, label, summary, option, li, ' +
|
|
2317
2362
|
'[role="button"], [role="link"], [role="tab"], ' +
|
|
2318
2363
|
'[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], ' +
|
|
@@ -2339,39 +2384,125 @@ function extractActionName(el) {
|
|
|
2339
2384
|
function extractAriaLabel(el) {
|
|
2340
2385
|
return getAttributeFromAncestors(el, ARIA_LABEL_ATTRIBUTE);
|
|
2341
2386
|
}
|
|
2387
|
+
function getOwnAriaLabel(element) {
|
|
2388
|
+
return getOwnAttribute(element, ARIA_LABEL_ATTRIBUTE);
|
|
2389
|
+
}
|
|
2342
2390
|
function extractTestId(el) {
|
|
2343
2391
|
return (el === null || el === void 0 ? void 0 : el.getAttribute(DATA_TEST_ATTRIBUTE)) || '';
|
|
2344
2392
|
}
|
|
2345
2393
|
function extractResolvedName(_a) {
|
|
2346
|
-
var isDeadClick = _a.isDeadClick, element = _a.element, config = _a.config, actionName = _a.actionName
|
|
2394
|
+
var isDeadClick = _a.isDeadClick, element = _a.element, config = _a.config, actionName = _a.actionName;
|
|
2347
2395
|
if (!element)
|
|
2348
2396
|
return '';
|
|
2349
2397
|
if (isDeadClick)
|
|
2350
2398
|
return '';
|
|
2351
2399
|
var resolveName = actionName ||
|
|
2352
2400
|
maskedTextIfMasked(element, config) ||
|
|
2353
|
-
resolveFallbackName(element,
|
|
2401
|
+
resolveFallbackName(element, config, ANCESTOR_SEARCH_DEPTH);
|
|
2354
2402
|
return normalizeInteractionText(resolveName);
|
|
2355
2403
|
}
|
|
2356
2404
|
function maskedTextIfMasked(element, config) {
|
|
2357
2405
|
return isElementMasked(element, config) ? MASKED_TEXT : '';
|
|
2358
2406
|
}
|
|
2359
|
-
function resolveFallbackName(element,
|
|
2407
|
+
function resolveFallbackName(element, config, depth) {
|
|
2360
2408
|
var _a;
|
|
2361
2409
|
if (!element || element.nodeName === BODY_NODE_NAME)
|
|
2362
2410
|
return '';
|
|
2411
|
+
var isSvgRoot = isSvgRootElement(element);
|
|
2412
|
+
var readText = !isSvgRoot && !isControlContainer(element);
|
|
2363
2413
|
var resolvedName = getLabelText(element) ||
|
|
2364
|
-
|
|
2414
|
+
getOwnAriaLabel(element) ||
|
|
2415
|
+
getInputButtonValue(element) ||
|
|
2416
|
+
getOwnAttribute(element, ALT_ATTRIBUTE) ||
|
|
2365
2417
|
getPlaceholder(element) ||
|
|
2366
|
-
|
|
2418
|
+
getSelectFirstOptionText(element) ||
|
|
2419
|
+
(readText ? getUnmaskedInnerText(element, config) : '') ||
|
|
2420
|
+
getOwnAttribute(element, TITLE_ATTRIBUTE);
|
|
2367
2421
|
if (resolvedName)
|
|
2368
2422
|
return resolvedName;
|
|
2369
2423
|
if ((_a = element.matches) === null || _a === void 0 ? void 0 : _a.call(element, CLICKABLE_SELECTOR))
|
|
2370
2424
|
return '';
|
|
2425
|
+
if (isSvgRoot && !hasClickableAncestor(element))
|
|
2426
|
+
return '';
|
|
2371
2427
|
var parent = element.parentElement;
|
|
2372
2428
|
if (depth <= 0 || !parent || parent.nodeName === BODY_NODE_NAME)
|
|
2373
2429
|
return '';
|
|
2374
|
-
return resolveFallbackName(parent,
|
|
2430
|
+
return resolveFallbackName(parent, config, depth - 1);
|
|
2431
|
+
}
|
|
2432
|
+
function isControlContainer(element) {
|
|
2433
|
+
var _a, _b;
|
|
2434
|
+
if ((_a = element.matches) === null || _a === void 0 ? void 0 : _a.call(element, CLICKABLE_SELECTOR))
|
|
2435
|
+
return false;
|
|
2436
|
+
return !!((_b = element.querySelector) === null || _b === void 0 ? void 0 : _b.call(element, CLICKABLE_SELECTOR));
|
|
2437
|
+
}
|
|
2438
|
+
function getOwnAttribute(element, attribute) {
|
|
2439
|
+
return element.getAttribute(attribute) || '';
|
|
2440
|
+
}
|
|
2441
|
+
function isSvgElement(element) {
|
|
2442
|
+
return element.namespaceURI === SVG_NAMESPACE;
|
|
2443
|
+
}
|
|
2444
|
+
function isSvgRootElement(element) {
|
|
2445
|
+
return isSvgElement(element) && element.localName === SVG_ROOT_LOCAL_NAME;
|
|
2446
|
+
}
|
|
2447
|
+
function hasClickableAncestor(element) {
|
|
2448
|
+
var _a, _b;
|
|
2449
|
+
return !!((_b = (_a = element.parentElement) === null || _a === void 0 ? void 0 : _a.closest) === null || _b === void 0 ? void 0 : _b.call(_a, CLICKABLE_SELECTOR));
|
|
2450
|
+
}
|
|
2451
|
+
function getInputButtonValue(element) {
|
|
2452
|
+
if (!(element instanceof HTMLInputElement))
|
|
2453
|
+
return '';
|
|
2454
|
+
return INPUT_BUTTON_TYPES.includes(element.type) ? element.value || '' : '';
|
|
2455
|
+
}
|
|
2456
|
+
function getSelectFirstOptionText(element) {
|
|
2457
|
+
var _a;
|
|
2458
|
+
if (!(element instanceof HTMLSelectElement))
|
|
2459
|
+
return '';
|
|
2460
|
+
return ((_a = element.options[0]) === null || _a === void 0 ? void 0 : _a.text) || '';
|
|
2461
|
+
}
|
|
2462
|
+
function getUnmaskedInnerText(element, config) {
|
|
2463
|
+
var maskClass = config.maskClass;
|
|
2464
|
+
if (isSvgElement(element)) {
|
|
2465
|
+
return normalizeInteractionText(collectUnmaskedText(element, maskClass));
|
|
2466
|
+
}
|
|
2467
|
+
if (!(element instanceof HTMLElement))
|
|
2468
|
+
return '';
|
|
2469
|
+
if (!hasMaskedDescendant(element, maskClass))
|
|
2470
|
+
return getInnerText(element);
|
|
2471
|
+
return normalizeInteractionText(collectUnmaskedText(element, maskClass));
|
|
2472
|
+
}
|
|
2473
|
+
function hasMaskedDescendant(element, maskClass) {
|
|
2474
|
+
var descendants = element.getElementsByTagName('*');
|
|
2475
|
+
for (var i = 0; i < descendants.length; i++) {
|
|
2476
|
+
if (isMaskedByClass(getClassName(descendants[i]), maskClass))
|
|
2477
|
+
return true;
|
|
2478
|
+
}
|
|
2479
|
+
return false;
|
|
2480
|
+
}
|
|
2481
|
+
function collectUnmaskedText(node, maskClass) {
|
|
2482
|
+
if (node.nodeType === Node.TEXT_NODE)
|
|
2483
|
+
return node.textContent || '';
|
|
2484
|
+
if (node.nodeType !== Node.ELEMENT_NODE)
|
|
2485
|
+
return '';
|
|
2486
|
+
var element = node;
|
|
2487
|
+
if (isMaskedByClass(getClassName(element), maskClass))
|
|
2488
|
+
return '';
|
|
2489
|
+
if (isSvgElement(element) &&
|
|
2490
|
+
NON_RENDERED_SVG_LOCAL_NAMES.includes(element.localName)) {
|
|
2491
|
+
return '';
|
|
2492
|
+
}
|
|
2493
|
+
var style = CxGlobal.getComputedStyle(element);
|
|
2494
|
+
if (style.display === 'none' || style.visibility === 'hidden')
|
|
2495
|
+
return '';
|
|
2496
|
+
var text = isBlockBoundary(element, style.display) ? ' ' : '';
|
|
2497
|
+
var children = element.childNodes;
|
|
2498
|
+
for (var i = 0; i < children.length; i++) {
|
|
2499
|
+
text += collectUnmaskedText(children[i], maskClass);
|
|
2500
|
+
}
|
|
2501
|
+
return text;
|
|
2502
|
+
}
|
|
2503
|
+
function isBlockBoundary(element, display) {
|
|
2504
|
+
return (LINE_BREAK_NODE_NAMES.includes(element.nodeName) ||
|
|
2505
|
+
BLOCK_DISPLAY_VALUES.includes(display));
|
|
2375
2506
|
}
|
|
2376
2507
|
function getLabelText(element) {
|
|
2377
2508
|
var _a;
|
|
@@ -2398,10 +2529,15 @@ function getInnerText(element) {
|
|
|
2398
2529
|
: '';
|
|
2399
2530
|
}
|
|
2400
2531
|
function normalizeInteractionText(text) {
|
|
2401
|
-
|
|
2402
|
-
.slice(0, MAX_INTERACTION_ELEMENT_SIZE)
|
|
2532
|
+
var normalized = text
|
|
2533
|
+
.slice(0, MAX_INTERACTION_ELEMENT_SIZE + 1)
|
|
2403
2534
|
.replace(/\s+/g, ' ')
|
|
2404
2535
|
.trim();
|
|
2536
|
+
if (normalized.length <= MAX_INTERACTION_ELEMENT_SIZE)
|
|
2537
|
+
return normalized;
|
|
2538
|
+
var maxTextBeforeMarker = MAX_INTERACTION_ELEMENT_SIZE - INTERACTION_TEXT_TRUNCATION_MARKER.length;
|
|
2539
|
+
return (normalized.slice(0, maxTextBeforeMarker).trim() +
|
|
2540
|
+
INTERACTION_TEXT_TRUNCATION_MARKER);
|
|
2405
2541
|
}
|
|
2406
2542
|
function extractMaskedOrTextContent(clickableElement, config) {
|
|
2407
2543
|
if (!clickableElement)
|
|
@@ -2463,6 +2599,7 @@ function wasPasswordInput(element) {
|
|
|
2463
2599
|
}
|
|
2464
2600
|
function isMaskedByClass(className, maskClass) {
|
|
2465
2601
|
if (maskClass instanceof RegExp) {
|
|
2602
|
+
maskClass.lastIndex = 0;
|
|
2466
2603
|
return maskClass.test(className);
|
|
2467
2604
|
}
|
|
2468
2605
|
return className.includes(maskClass);
|
|
@@ -2763,7 +2900,6 @@ var CoralogixUserInteractionInstrumentation = (function (_super) {
|
|
|
2763
2900
|
element: eventTarget,
|
|
2764
2901
|
config: config,
|
|
2765
2902
|
actionName: cxActionName,
|
|
2766
|
-
ariaLabel: ariaLabel,
|
|
2767
2903
|
});
|
|
2768
2904
|
span.setAttribute(CoralogixAttributes.IS_DEAD_CLICK, isDeadClick);
|
|
2769
2905
|
var _b = eventTarget.getBoundingClientRect(), width = _b.width, height = _b.height;
|
|
@@ -2960,6 +3096,162 @@ var CoralogixMemoryUsageInstrumentation = (function (_super) {
|
|
|
2960
3096
|
|
|
2961
3097
|
var SCREENSHOT_INSTRUMENTATION_NAME = 'screenshot';
|
|
2962
3098
|
var SCREENSHOT_INSTRUMENTATION_VERSION = '1.0.0';
|
|
3099
|
+
var MAX_SCREENSHOT_ACTIONS = 100;
|
|
3100
|
+
var FILL_ATTEMPTS_PER_SLOT = 2;
|
|
3101
|
+
var LABELLED_SELECTOR = '[aria-label], [data-testid], [data-test], [data-test-id], [role]';
|
|
3102
|
+
var NON_INTERACTIVE_TAGS = new Set([
|
|
3103
|
+
'html', 'body', 'main', 'header', 'footer', 'nav', 'aside', 'section', 'article', 'form',
|
|
3104
|
+
'table', 'thead', 'tbody', 'tr', 'ul', 'ol', 'dl', 'p', 'hr', 'br',
|
|
3105
|
+
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'picture', 'svg', 'video', 'audio', 'iframe',
|
|
3106
|
+
]);
|
|
3107
|
+
var NON_INTERACTIVE_ROLES = new Set([
|
|
3108
|
+
'dialog', 'alertdialog', 'navigation', 'region', 'main', 'banner', 'contentinfo',
|
|
3109
|
+
'complementary', 'search', 'form', 'application', 'document', 'article', 'group', 'toolbar',
|
|
3110
|
+
'tabpanel', 'tablist', 'list', 'listitem', 'table', 'row', 'rowgroup', 'cell', 'gridcell',
|
|
3111
|
+
'columnheader', 'rowheader', 'heading', 'img', 'figure', 'presentation', 'none', 'status',
|
|
3112
|
+
'alert', 'log', 'marquee', 'timer', 'tooltip', 'progressbar', 'separator', 'note', 'definition',
|
|
3113
|
+
'term', 'directory', 'feed', 'math', 'meter', 'scrollbar',
|
|
3114
|
+
]);
|
|
3115
|
+
var MAX_CANDIDATE_DESCENDANTS = 50;
|
|
3116
|
+
function collectDomActionNames(limit) {
|
|
3117
|
+
if (limit === void 0) { limit = MAX_SCREENSHOT_ACTIONS; }
|
|
3118
|
+
try {
|
|
3119
|
+
var doc = CxGlobal.document;
|
|
3120
|
+
if (!(doc === null || doc === void 0 ? void 0 : doc.querySelectorAll)) {
|
|
3121
|
+
return [];
|
|
3122
|
+
}
|
|
3123
|
+
var actions = collectExplicitActionNames(doc, limit);
|
|
3124
|
+
if (actions.length >= limit) {
|
|
3125
|
+
return actions;
|
|
3126
|
+
}
|
|
3127
|
+
var config = getSdkConfig();
|
|
3128
|
+
if (!config) {
|
|
3129
|
+
return actions;
|
|
3130
|
+
}
|
|
3131
|
+
fillFromCandidates(doc, LABELLED_SELECTOR, isLabelledCandidate, actions, limit, config);
|
|
3132
|
+
if (actions.length < limit) {
|
|
3133
|
+
fillFromCandidates(doc, CLICKABLE_SELECTOR, isSemanticCandidate, actions, limit, config);
|
|
3134
|
+
}
|
|
3135
|
+
return actions;
|
|
3136
|
+
}
|
|
3137
|
+
catch (_a) {
|
|
3138
|
+
return [];
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
function collectExplicitActionNames(doc, limit) {
|
|
3142
|
+
var elements = doc.querySelectorAll("[".concat(CX_ACTION_NAME_ATTRIBUTE, "]"));
|
|
3143
|
+
var seen = new Set();
|
|
3144
|
+
var names = [];
|
|
3145
|
+
for (var i = 0; i < elements.length; i++) {
|
|
3146
|
+
var value = elements[i].getAttribute(CX_ACTION_NAME_ATTRIBUTE);
|
|
3147
|
+
if (value && !seen.has(value)) {
|
|
3148
|
+
seen.add(value);
|
|
3149
|
+
names.push(value);
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
return names.length > limit ? takeRun(names, limit) : names;
|
|
3153
|
+
}
|
|
3154
|
+
function fillFromCandidates(doc, selector, isCandidate, actions, limit, config) {
|
|
3155
|
+
var candidates = usableCandidates(doc, selector, isCandidate);
|
|
3156
|
+
var total = candidates.length;
|
|
3157
|
+
if (total === 0) {
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
3160
|
+
var attempts = Math.min(total, (limit - actions.length) * FILL_ATTEMPTS_PER_SLOT);
|
|
3161
|
+
var start = randomIndex(total);
|
|
3162
|
+
var seen = new Set(actions);
|
|
3163
|
+
for (var step = 0; step < attempts && actions.length < limit; step++) {
|
|
3164
|
+
var name_1 = resolveClickableName(candidates[(start + step) % total], config);
|
|
3165
|
+
if (name_1 && !seen.has(name_1)) {
|
|
3166
|
+
seen.add(name_1);
|
|
3167
|
+
actions.push(name_1);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
function usableCandidates(doc, selector, isCandidate) {
|
|
3172
|
+
var matches = doc.querySelectorAll(selector);
|
|
3173
|
+
var usable = [];
|
|
3174
|
+
for (var i = 0; i < matches.length; i++) {
|
|
3175
|
+
var element = matches[i];
|
|
3176
|
+
if (!isUnderExplicitActionName(element) &&
|
|
3177
|
+
(!isCandidate || isCandidate(element)) &&
|
|
3178
|
+
isRendered(element)) {
|
|
3179
|
+
usable.push(element);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
return usable;
|
|
3183
|
+
}
|
|
3184
|
+
function isContentRegion(element) {
|
|
3185
|
+
return element.getElementsByTagName('*').length > MAX_CANDIDATE_DESCENDANTS;
|
|
3186
|
+
}
|
|
3187
|
+
function isUnderExplicitActionName(element) {
|
|
3188
|
+
return typeof element.closest === 'function'
|
|
3189
|
+
? !!element.closest("[".concat(CX_ACTION_NAME_ATTRIBUTE, "]"))
|
|
3190
|
+
: !!extractActionName(element);
|
|
3191
|
+
}
|
|
3192
|
+
function isSemanticCandidate(element) {
|
|
3193
|
+
switch (element.localName) {
|
|
3194
|
+
case 'label':
|
|
3195
|
+
return hasAssociatedControl(element);
|
|
3196
|
+
case 'li':
|
|
3197
|
+
case 'option': {
|
|
3198
|
+
var role = element.getAttribute('role');
|
|
3199
|
+
return !!role && !NON_INTERACTIVE_ROLES.has(role);
|
|
3200
|
+
}
|
|
3201
|
+
case 'input':
|
|
3202
|
+
return element.type !== 'hidden';
|
|
3203
|
+
default:
|
|
3204
|
+
return true;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
function hasAssociatedControl(label) {
|
|
3208
|
+
if (label.control) {
|
|
3209
|
+
return true;
|
|
3210
|
+
}
|
|
3211
|
+
if (label.htmlFor) {
|
|
3212
|
+
return !!label.ownerDocument.getElementById(label.htmlFor);
|
|
3213
|
+
}
|
|
3214
|
+
return !!label.querySelector('input, select, textarea, button, meter, output, progress');
|
|
3215
|
+
}
|
|
3216
|
+
function isLabelledCandidate(element) {
|
|
3217
|
+
var _a;
|
|
3218
|
+
if (NON_INTERACTIVE_TAGS.has(element.localName)) {
|
|
3219
|
+
return false;
|
|
3220
|
+
}
|
|
3221
|
+
var role = element.getAttribute('role');
|
|
3222
|
+
if (role && NON_INTERACTIVE_ROLES.has(role)) {
|
|
3223
|
+
return false;
|
|
3224
|
+
}
|
|
3225
|
+
return !((_a = element.matches) === null || _a === void 0 ? void 0 : _a.call(element, CLICKABLE_SELECTOR));
|
|
3226
|
+
}
|
|
3227
|
+
function resolveClickableName(element, config) {
|
|
3228
|
+
if (isContentRegion(element)) {
|
|
3229
|
+
return '';
|
|
3230
|
+
}
|
|
3231
|
+
var name = extractResolvedName({
|
|
3232
|
+
isDeadClick: false,
|
|
3233
|
+
element: element,
|
|
3234
|
+
config: config,
|
|
3235
|
+
actionName: '',
|
|
3236
|
+
});
|
|
3237
|
+
return name === MASKED_TEXT ? '' : name;
|
|
3238
|
+
}
|
|
3239
|
+
function isRendered(element) {
|
|
3240
|
+
return typeof element.checkVisibility === 'function'
|
|
3241
|
+
? element.checkVisibility()
|
|
3242
|
+
: true;
|
|
3243
|
+
}
|
|
3244
|
+
function takeRun(items, count) {
|
|
3245
|
+
var start = randomIndex(items.length);
|
|
3246
|
+
var run = [];
|
|
3247
|
+
for (var step = 0; step < count; step++) {
|
|
3248
|
+
run.push(items[(start + step) % items.length]);
|
|
3249
|
+
}
|
|
3250
|
+
return run;
|
|
3251
|
+
}
|
|
3252
|
+
function randomIndex(length) {
|
|
3253
|
+
return Math.floor(Math.random() * length);
|
|
3254
|
+
}
|
|
2963
3255
|
|
|
2964
3256
|
var CoralogixScreenshotInstrumentation = (function (_super) {
|
|
2965
3257
|
__extends(CoralogixScreenshotInstrumentation, _super);
|
|
@@ -2979,6 +3271,7 @@ var CoralogixScreenshotInstrumentation = (function (_super) {
|
|
|
2979
3271
|
span[CoralogixAttributes.SCREENSHOT_CONTEXT] = {
|
|
2980
3272
|
id: id,
|
|
2981
3273
|
description: description,
|
|
3274
|
+
actions: collectDomActionNames(),
|
|
2982
3275
|
};
|
|
2983
3276
|
span.end();
|
|
2984
3277
|
};
|
|
@@ -3208,7 +3501,8 @@ var CORALOGIX_LOGS_URL_SUFFIX = '/browser/v1beta/logs';
|
|
|
3208
3501
|
var CORALOGIX_RECORDING_URL_SUFFIX = '/sessionrecording';
|
|
3209
3502
|
var MFE_METADATA_FILE = 'cx-metadata.json';
|
|
3210
3503
|
var MFE_METADATA_URL_PATTERN = /cx-metadata\.json$/;
|
|
3211
|
-
var MAX_INTERACTION_ELEMENT_SIZE =
|
|
3504
|
+
var MAX_INTERACTION_ELEMENT_SIZE = 100;
|
|
3505
|
+
var INTERACTION_TEXT_TRUNCATION_MARKER = ' [...]';
|
|
3212
3506
|
var MAX_CHARACTERS = 1024;
|
|
3213
3507
|
var REQUIRED_CONFIG_KEYS = [
|
|
3214
3508
|
'application',
|
|
@@ -3224,6 +3518,8 @@ var MASKED_TEXT = '***';
|
|
|
3224
3518
|
var MASK_CLASS_DEFAULT = 'cx-mask';
|
|
3225
3519
|
var CX_PREFIX = 'cx';
|
|
3226
3520
|
var ARIA_LABEL_ATTRIBUTE = 'aria-label';
|
|
3521
|
+
var TITLE_ATTRIBUTE = 'title';
|
|
3522
|
+
var ALT_ATTRIBUTE = 'alt';
|
|
3227
3523
|
var PASSWORD_INPUT_TYPE = 'password';
|
|
3228
3524
|
var MASK_INPUT_TYPES_DEFAULT = [PASSWORD_INPUT_TYPE];
|
|
3229
3525
|
var FINGER_PRINT_KEY = 'cx-fingerprint';
|
|
@@ -3238,7 +3534,7 @@ var idPatterns = [
|
|
|
3238
3534
|
},
|
|
3239
3535
|
];
|
|
3240
3536
|
var PATH_ID_PLACEHOLDER = '/{id}';
|
|
3241
|
-
var NUMERIC_PATH_SEGMENT_REGEX =
|
|
3537
|
+
var NUMERIC_PATH_SEGMENT_REGEX = /\/\d+(?=$|[/?#])/g;
|
|
3242
3538
|
function replaceNumericPathSegments(url) {
|
|
3243
3539
|
var replacePath = function (s) {
|
|
3244
3540
|
return s.replace(NUMERIC_PATH_SEGMENT_REGEX, PATH_ID_PLACEHOLDER);
|
|
@@ -4210,9 +4506,9 @@ function resolveSessionConfig(config) {
|
|
|
4210
4506
|
return __assign(__assign({}, config), { sessionSampleRate: (_a = config.sessionSampleRate) !== null && _a !== void 0 ? _a : 100, onlyWithErrorConfig: resolveSessionWithErrorsConfig(config.onlyWithErrorConfig) });
|
|
4211
4507
|
}
|
|
4212
4508
|
function resolveSessionRecordingConfig(config) {
|
|
4213
|
-
var _a;
|
|
4509
|
+
var _a, _b;
|
|
4214
4510
|
if (config) {
|
|
4215
|
-
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !== void 0 ? _a : 100 });
|
|
4511
|
+
return __assign(__assign({}, config), { sessionRecordingSampleRate: (_a = config.sessionRecordingSampleRate) !== null && _a !== void 0 ? _a : 100, captureScreenshotOnDomChange: (_b = config.captureScreenshotOnDomChange) !== null && _b !== void 0 ? _b : true });
|
|
4216
4512
|
}
|
|
4217
4513
|
return;
|
|
4218
4514
|
}
|
|
@@ -4988,7 +5284,7 @@ var SessionManager = (function (_super) {
|
|
|
4988
5284
|
(_a = CxGlobal.sessionStorage) === null || _a === void 0 ? void 0 : _a.removeItem(PREV_SESSION_KEY);
|
|
4989
5285
|
};
|
|
4990
5286
|
SessionManager.prototype.clearSession = function () {
|
|
4991
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
5287
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4992
5288
|
if (this.debugMode) {
|
|
4993
5289
|
console.debug('Coralogix Browser SDK - Session expired, clearing session');
|
|
4994
5290
|
}
|
|
@@ -4998,10 +5294,11 @@ var SessionManager = (function (_super) {
|
|
|
4998
5294
|
(_d = getSnapshotManager()) === null || _d === void 0 ? void 0 : _d.resetSnapshot();
|
|
4999
5295
|
clearStoredSnapshotState();
|
|
5000
5296
|
(_e = getClickScreenshotManager()) === null || _e === void 0 ? void 0 : _e.reset();
|
|
5297
|
+
(_f = getDomChangeScreenshotTrigger()) === null || _f === void 0 ? void 0 : _f.reset();
|
|
5001
5298
|
this.resetCurrentPageFragment();
|
|
5002
5299
|
this.resetViewNumber();
|
|
5003
|
-
(
|
|
5004
|
-
(
|
|
5300
|
+
(_g = this.sessionRecorder) === null || _g === void 0 ? void 0 : _g.stopRecording();
|
|
5301
|
+
(_h = CxGlobal.sessionStorage) === null || _h === void 0 ? void 0 : _h.removeItem(SESSION_KEY);
|
|
5005
5302
|
};
|
|
5006
5303
|
SessionManager.prototype.clearGlobalSpans = function () {
|
|
5007
5304
|
var _a;
|
|
@@ -5253,28 +5550,14 @@ function resolveUrlBlueprinters(urlBlueprinters) {
|
|
|
5253
5550
|
if (!urlBlueprinters) {
|
|
5254
5551
|
return OPTIONS_DEFAULTS.urlBlueprinters;
|
|
5255
5552
|
}
|
|
5256
|
-
var
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
var concatBlueprinters = function (urlBlueprinters) {
|
|
5261
|
-
var _a, _b;
|
|
5262
|
-
var _c = urlBlueprinters || {}, pageUrlBlueprinters = _c.pageUrlBlueprinters, networkUrlBlueprinters = _c.networkUrlBlueprinters;
|
|
5263
|
-
if (pageUrlBlueprinters) {
|
|
5264
|
-
(_a = resolvedUrlBlueprinters.pageUrlBlueprinters).push.apply(_a, __spreadArray([], __read$1(pageUrlBlueprinters), false));
|
|
5265
|
-
}
|
|
5266
|
-
if (networkUrlBlueprinters) {
|
|
5267
|
-
(_b = resolvedUrlBlueprinters.networkUrlBlueprinters).push.apply(_b, __spreadArray([], __read$1(networkUrlBlueprinters), false));
|
|
5268
|
-
}
|
|
5553
|
+
var defaults = OPTIONS_DEFAULTS.urlBlueprinters || {};
|
|
5554
|
+
return {
|
|
5555
|
+
pageUrlBlueprinters: __spreadArray(__spreadArray([], __read$1((defaults.pageUrlBlueprinters || [])), false), __read$1((urlBlueprinters.pageUrlBlueprinters || [])), false),
|
|
5556
|
+
networkUrlBlueprinters: __spreadArray(__spreadArray([], __read$1((defaults.networkUrlBlueprinters || [])), false), __read$1((urlBlueprinters.networkUrlBlueprinters || [])), false),
|
|
5269
5557
|
};
|
|
5270
|
-
concatBlueprinters(urlBlueprinters);
|
|
5271
|
-
if (OPTIONS_DEFAULTS.urlBlueprinters) {
|
|
5272
|
-
concatBlueprinters(OPTIONS_DEFAULTS.urlBlueprinters);
|
|
5273
|
-
}
|
|
5274
|
-
return resolvedUrlBlueprinters;
|
|
5275
5558
|
}
|
|
5276
5559
|
|
|
5277
|
-
var SDK_VERSION = '3.
|
|
5560
|
+
var SDK_VERSION = '3.24.0';
|
|
5278
5561
|
|
|
5279
5562
|
function shouldDropEvent(cxRumEvent, options) {
|
|
5280
5563
|
if (isDocumentErrorWithoutMessage(cxRumEvent)) {
|
|
@@ -5797,7 +6080,7 @@ var CoralogixNavigationProcessor = (function () {
|
|
|
5797
6080
|
};
|
|
5798
6081
|
CoralogixNavigationProcessor.prototype.onEnd = function (span) { };
|
|
5799
6082
|
CoralogixNavigationProcessor.prototype.onStart = function (span) {
|
|
5800
|
-
var _a;
|
|
6083
|
+
var _a, _b;
|
|
5801
6084
|
if (this.isResolving) {
|
|
5802
6085
|
return;
|
|
5803
6086
|
}
|
|
@@ -5814,6 +6097,7 @@ var CoralogixNavigationProcessor = (function () {
|
|
|
5814
6097
|
span[CoralogixAttributes.IS_NAVIGATION_EVENT] = true;
|
|
5815
6098
|
this.handlePageNavigation(previousPageFragment);
|
|
5816
6099
|
(_a = getClickScreenshotManager()) === null || _a === void 0 ? void 0 : _a.onNavigation();
|
|
6100
|
+
(_b = getDomChangeScreenshotTrigger()) === null || _b === void 0 ? void 0 : _b.onNavigation();
|
|
5817
6101
|
}
|
|
5818
6102
|
span[CoralogixAttributes.VIEW_NUMBER] = sessionManager.viewNumber;
|
|
5819
6103
|
}
|
|
@@ -5841,6 +6125,14 @@ function getTiming(duration) {
|
|
|
5841
6125
|
return getNowTime() - getSessionManager().currentPageTimestamp;
|
|
5842
6126
|
}
|
|
5843
6127
|
|
|
6128
|
+
function canCaptureAutomaticScreenshot() {
|
|
6129
|
+
var sessionManager = getSessionManager();
|
|
6130
|
+
if (!(sessionManager === null || sessionManager === void 0 ? void 0 : sessionManager.onlySessionWithErrorMode)) {
|
|
6131
|
+
return true;
|
|
6132
|
+
}
|
|
6133
|
+
return sessionManager.sessionHasError;
|
|
6134
|
+
}
|
|
6135
|
+
|
|
5844
6136
|
var FIRST_CAPTURE_CLICK = 1;
|
|
5845
6137
|
var MIN_SECOND_CAPTURE_CLICK = 2;
|
|
5846
6138
|
var TOTAL_CAPTURE_OPTIONS = 9;
|
|
@@ -5860,12 +6152,16 @@ var ClickScreenshotManager = (function () {
|
|
|
5860
6152
|
_this.clickCount = 0;
|
|
5861
6153
|
};
|
|
5862
6154
|
this.handleClick = function () {
|
|
5863
|
-
|
|
6155
|
+
var _a;
|
|
6156
|
+
if (!((_a = getSessionRecorder()) === null || _a === void 0 ? void 0 : _a.isRecordingActive())) {
|
|
5864
6157
|
return;
|
|
5865
6158
|
}
|
|
5866
6159
|
_this.clickCount += 1;
|
|
5867
6160
|
if (_this.clickCount === FIRST_CAPTURE_CLICK ||
|
|
5868
6161
|
_this.clickCount === _this.secondCaptureClick) {
|
|
6162
|
+
if (!canCaptureAutomaticScreenshot()) {
|
|
6163
|
+
return;
|
|
6164
|
+
}
|
|
5869
6165
|
CoralogixRum.screenshot(CX_PREFIX);
|
|
5870
6166
|
}
|
|
5871
6167
|
};
|
|
@@ -5877,6 +6173,312 @@ var ClickScreenshotManager = (function () {
|
|
|
5877
6173
|
return ClickScreenshotManager;
|
|
5878
6174
|
}());
|
|
5879
6175
|
|
|
6176
|
+
var EventType;
|
|
6177
|
+
(function (EventType) {
|
|
6178
|
+
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
6179
|
+
EventType[EventType["Load"] = 1] = "Load";
|
|
6180
|
+
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
6181
|
+
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
6182
|
+
EventType[EventType["Meta"] = 4] = "Meta";
|
|
6183
|
+
EventType[EventType["Custom"] = 5] = "Custom";
|
|
6184
|
+
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
6185
|
+
EventType[EventType["Asset"] = 7] = "Asset";
|
|
6186
|
+
})(EventType || (EventType = {}));
|
|
6187
|
+
var IncrementalSource;
|
|
6188
|
+
(function (IncrementalSource) {
|
|
6189
|
+
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
6190
|
+
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
6191
|
+
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
6192
|
+
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
6193
|
+
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
6194
|
+
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
6195
|
+
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
6196
|
+
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
6197
|
+
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
6198
|
+
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
6199
|
+
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
6200
|
+
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
6201
|
+
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
6202
|
+
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
6203
|
+
IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
|
|
6204
|
+
IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
6205
|
+
IncrementalSource[IncrementalSource["CustomElement"] = 16] = "CustomElement";
|
|
6206
|
+
})(IncrementalSource || (IncrementalSource = {}));
|
|
6207
|
+
var MouseInteractions;
|
|
6208
|
+
(function (MouseInteractions) {
|
|
6209
|
+
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
6210
|
+
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
6211
|
+
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
6212
|
+
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
6213
|
+
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
6214
|
+
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
6215
|
+
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
6216
|
+
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
6217
|
+
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
6218
|
+
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
6219
|
+
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
6220
|
+
})(MouseInteractions || (MouseInteractions = {}));
|
|
6221
|
+
var PointerTypes;
|
|
6222
|
+
(function (PointerTypes) {
|
|
6223
|
+
PointerTypes[PointerTypes["Mouse"] = 0] = "Mouse";
|
|
6224
|
+
PointerTypes[PointerTypes["Pen"] = 1] = "Pen";
|
|
6225
|
+
PointerTypes[PointerTypes["Touch"] = 2] = "Touch";
|
|
6226
|
+
})(PointerTypes || (PointerTypes = {}));
|
|
6227
|
+
var CanvasContext;
|
|
6228
|
+
(function (CanvasContext) {
|
|
6229
|
+
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
6230
|
+
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
6231
|
+
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
6232
|
+
})(CanvasContext || (CanvasContext = {}));
|
|
6233
|
+
var MediaInteractions;
|
|
6234
|
+
(function (MediaInteractions) {
|
|
6235
|
+
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
6236
|
+
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
6237
|
+
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
6238
|
+
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
6239
|
+
MediaInteractions[MediaInteractions["RateChange"] = 4] = "RateChange";
|
|
6240
|
+
})(MediaInteractions || (MediaInteractions = {}));
|
|
6241
|
+
var NodeType;
|
|
6242
|
+
(function (NodeType) {
|
|
6243
|
+
NodeType[NodeType["Document"] = 0] = "Document";
|
|
6244
|
+
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
6245
|
+
NodeType[NodeType["Element"] = 2] = "Element";
|
|
6246
|
+
NodeType[NodeType["Text"] = 3] = "Text";
|
|
6247
|
+
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
6248
|
+
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
6249
|
+
})(NodeType || (NodeType = {}));
|
|
6250
|
+
|
|
6251
|
+
var NEVER = 0;
|
|
6252
|
+
var UNRESOLVED_DEPTH = MAX_DEPTH_WALK + 1;
|
|
6253
|
+
var DomChangeScreenshotTrigger = (function () {
|
|
6254
|
+
function DomChangeScreenshotTrigger() {
|
|
6255
|
+
var _this = this;
|
|
6256
|
+
this.settled = false;
|
|
6257
|
+
this.lastInteractionAt = NEVER;
|
|
6258
|
+
this.cachedElementCount = 0;
|
|
6259
|
+
this.elementCountRefreshedAt = NEVER;
|
|
6260
|
+
this.lastCaptureAt = NEVER;
|
|
6261
|
+
this.capturesThisView = 0;
|
|
6262
|
+
this.reset = function () {
|
|
6263
|
+
_this.clearTimers();
|
|
6264
|
+
_this.settled = false;
|
|
6265
|
+
_this.lastInteractionAt = NEVER;
|
|
6266
|
+
_this.lastCaptureAt = NEVER;
|
|
6267
|
+
_this.onNavigation();
|
|
6268
|
+
};
|
|
6269
|
+
this.onNavigation = function () {
|
|
6270
|
+
_this.clearTimers();
|
|
6271
|
+
_this.settled = false;
|
|
6272
|
+
_this.pendingReason = undefined;
|
|
6273
|
+
_this.capturesThisView = 0;
|
|
6274
|
+
_this.elementCountRefreshedAt = NEVER;
|
|
6275
|
+
};
|
|
6276
|
+
this.handleRecordEvent = function (event, resolveNode) {
|
|
6277
|
+
var _a;
|
|
6278
|
+
try {
|
|
6279
|
+
if ((event === null || event === void 0 ? void 0 : event.type) === EventType.FullSnapshot) {
|
|
6280
|
+
_this.armSettleTimer();
|
|
6281
|
+
return;
|
|
6282
|
+
}
|
|
6283
|
+
if ((event === null || event === void 0 ? void 0 : event.type) !== EventType.IncrementalSnapshot) {
|
|
6284
|
+
return;
|
|
6285
|
+
}
|
|
6286
|
+
var source = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source;
|
|
6287
|
+
if (_this.isUserInteraction(event)) {
|
|
6288
|
+
_this.lastInteractionAt = event.timestamp;
|
|
6289
|
+
return;
|
|
6290
|
+
}
|
|
6291
|
+
if (source !== IncrementalSource.Mutation) {
|
|
6292
|
+
return;
|
|
6293
|
+
}
|
|
6294
|
+
if (!_this.settled) {
|
|
6295
|
+
_this.armSettleTimer();
|
|
6296
|
+
return;
|
|
6297
|
+
}
|
|
6298
|
+
_this.handleMutation(event.data, event.timestamp, resolveNode);
|
|
6299
|
+
}
|
|
6300
|
+
catch (_b) {
|
|
6301
|
+
}
|
|
6302
|
+
};
|
|
6303
|
+
this.capture = function () {
|
|
6304
|
+
var reason = _this.pendingReason;
|
|
6305
|
+
_this.pendingReason = undefined;
|
|
6306
|
+
if (!reason) {
|
|
6307
|
+
return;
|
|
6308
|
+
}
|
|
6309
|
+
var now = Date.now();
|
|
6310
|
+
if (_this.capturesThisView >= MAX_CAPTURES_PER_VIEW ||
|
|
6311
|
+
now - _this.lastCaptureAt < MIN_CAPTURE_INTERVAL_MS ||
|
|
6312
|
+
_this.cachedElementCount > MAX_NODES_FOR_CAPTURE ||
|
|
6313
|
+
!canCaptureAutomaticScreenshot()) {
|
|
6314
|
+
return;
|
|
6315
|
+
}
|
|
6316
|
+
_this.lastCaptureAt = now;
|
|
6317
|
+
_this.capturesThisView += 1;
|
|
6318
|
+
_this.lastInteractionAt = NEVER;
|
|
6319
|
+
CoralogixRum.screenshot(reason);
|
|
6320
|
+
};
|
|
6321
|
+
this.markSettled = function () {
|
|
6322
|
+
var _a;
|
|
6323
|
+
var elementCount = ((_a = CxGlobal.document) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('*').length) || 0;
|
|
6324
|
+
if (elementCount < CONTENT_ELEMENT_FLOOR) {
|
|
6325
|
+
return;
|
|
6326
|
+
}
|
|
6327
|
+
_this.settled = true;
|
|
6328
|
+
_this.cachedElementCount = elementCount;
|
|
6329
|
+
_this.elementCountRefreshedAt = Date.now();
|
|
6330
|
+
};
|
|
6331
|
+
setSdkState(DOM_CHANGE_SCREENSHOT_TRIGGER_KEY, this);
|
|
6332
|
+
}
|
|
6333
|
+
DomChangeScreenshotTrigger.unregister = function () {
|
|
6334
|
+
var instance = sdkStore[DOM_CHANGE_SCREENSHOT_TRIGGER_KEY];
|
|
6335
|
+
instance === null || instance === void 0 ? void 0 : instance.clearTimers();
|
|
6336
|
+
deleteSdkState(DOM_CHANGE_SCREENSHOT_TRIGGER_KEY);
|
|
6337
|
+
};
|
|
6338
|
+
DomChangeScreenshotTrigger.prototype.isUserInteraction = function (event) {
|
|
6339
|
+
var data = event.data;
|
|
6340
|
+
if ((data === null || data === void 0 ? void 0 : data.source) === IncrementalSource.Input) {
|
|
6341
|
+
return true;
|
|
6342
|
+
}
|
|
6343
|
+
if ((data === null || data === void 0 ? void 0 : data.source) !== IncrementalSource.MouseInteraction) {
|
|
6344
|
+
return false;
|
|
6345
|
+
}
|
|
6346
|
+
return (data.type === MouseInteractions.MouseDown ||
|
|
6347
|
+
data.type === MouseInteractions.Click ||
|
|
6348
|
+
data.type === MouseInteractions.DblClick ||
|
|
6349
|
+
data.type === MouseInteractions.TouchStart);
|
|
6350
|
+
};
|
|
6351
|
+
DomChangeScreenshotTrigger.prototype.handleMutation = function (data, timestamp, resolveNode) {
|
|
6352
|
+
var _a;
|
|
6353
|
+
var adds = data.adds || [];
|
|
6354
|
+
var removes = data.removes || [];
|
|
6355
|
+
var weight = adds.length + removes.length + (((_a = data.texts) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
6356
|
+
if (!weight) {
|
|
6357
|
+
return;
|
|
6358
|
+
}
|
|
6359
|
+
var elementCount = this.getElementCount(timestamp);
|
|
6360
|
+
var reason = this.classify(adds, removes, weight, elementCount, timestamp, resolveNode);
|
|
6361
|
+
if (!reason) {
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
this.pendingReason = reason;
|
|
6365
|
+
this.clearDebounceTimer();
|
|
6366
|
+
this.debounceTimer = cxSetTimeout(this.capture, CHANGE_DEBOUNCE_MS);
|
|
6367
|
+
};
|
|
6368
|
+
DomChangeScreenshotTrigger.prototype.classify = function (adds, removes, weight, elementCount, timestamp, resolveNode) {
|
|
6369
|
+
var sinceInteraction = timestamp - this.lastInteractionAt;
|
|
6370
|
+
var withinTightWindow = sinceInteraction <= INTERACTION_TIGHT_MS;
|
|
6371
|
+
var withinLooseWindow = sinceInteraction <= INTERACTION_LOOSE_MS;
|
|
6372
|
+
if (withinLooseWindow && removesTolerable(adds.length, removes.length)) {
|
|
6373
|
+
var addedElements_1 = adds.filter(function (add) { return containsElement(add.node); }).length;
|
|
6374
|
+
var looksLikeOverlay = function () {
|
|
6375
|
+
return addedElements_1 > 0 &&
|
|
6376
|
+
shallowestDepth(adds, resolveNode) <= OVERLAY_MAX_DEPTH;
|
|
6377
|
+
};
|
|
6378
|
+
var bigEnough = withinTightWindow
|
|
6379
|
+
? addedElements_1 >= INTERACTION_TIGHT_MIN_ELEMENTS
|
|
6380
|
+
: addedElements_1 >= INTERACTION_LOOSE_MIN_ELEMENTS;
|
|
6381
|
+
if (bigEnough && looksLikeOverlay()) {
|
|
6382
|
+
return "dom-overlay";
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
if (withinLooseWindow &&
|
|
6386
|
+
weight >= threshold(VIEW_CHANGE_MIN_WEIGHT, VIEW_CHANGE_FRACTION, elementCount)) {
|
|
6387
|
+
return "dom-view-change";
|
|
6388
|
+
}
|
|
6389
|
+
return undefined;
|
|
6390
|
+
};
|
|
6391
|
+
DomChangeScreenshotTrigger.prototype.getElementCount = function (timestamp) {
|
|
6392
|
+
var _a;
|
|
6393
|
+
if (timestamp - this.elementCountRefreshedAt < NODE_COUNT_REFRESH_MS) {
|
|
6394
|
+
return this.cachedElementCount;
|
|
6395
|
+
}
|
|
6396
|
+
this.cachedElementCount =
|
|
6397
|
+
((_a = CxGlobal.document) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('*').length) || 0;
|
|
6398
|
+
this.elementCountRefreshedAt = timestamp;
|
|
6399
|
+
return this.cachedElementCount;
|
|
6400
|
+
};
|
|
6401
|
+
DomChangeScreenshotTrigger.prototype.armSettleTimer = function () {
|
|
6402
|
+
this.clearSettleTimer();
|
|
6403
|
+
this.quietTimer = cxSetTimeout(this.markSettled, SETTLE_QUIET_MS);
|
|
6404
|
+
};
|
|
6405
|
+
DomChangeScreenshotTrigger.prototype.clearTimers = function () {
|
|
6406
|
+
this.clearSettleTimer();
|
|
6407
|
+
this.clearDebounceTimer();
|
|
6408
|
+
};
|
|
6409
|
+
DomChangeScreenshotTrigger.prototype.clearSettleTimer = function () {
|
|
6410
|
+
if (this.quietTimer) {
|
|
6411
|
+
cxClearTimeout(this.quietTimer);
|
|
6412
|
+
this.quietTimer = undefined;
|
|
6413
|
+
}
|
|
6414
|
+
};
|
|
6415
|
+
DomChangeScreenshotTrigger.prototype.clearDebounceTimer = function () {
|
|
6416
|
+
if (this.debounceTimer) {
|
|
6417
|
+
cxClearTimeout(this.debounceTimer);
|
|
6418
|
+
this.debounceTimer = undefined;
|
|
6419
|
+
}
|
|
6420
|
+
};
|
|
6421
|
+
return DomChangeScreenshotTrigger;
|
|
6422
|
+
}());
|
|
6423
|
+
function shallowestDepth(adds, resolveNode) {
|
|
6424
|
+
var e_1, _a;
|
|
6425
|
+
if (!resolveNode) {
|
|
6426
|
+
return UNRESOLVED_DEPTH;
|
|
6427
|
+
}
|
|
6428
|
+
var shallowest = UNRESOLVED_DEPTH;
|
|
6429
|
+
try {
|
|
6430
|
+
for (var adds_1 = __values$1(adds), adds_1_1 = adds_1.next(); !adds_1_1.done; adds_1_1 = adds_1.next()) {
|
|
6431
|
+
var add = adds_1_1.value;
|
|
6432
|
+
var parent_1 = resolveNode(add.parentId);
|
|
6433
|
+
if (parent_1) {
|
|
6434
|
+
shallowest = Math.min(shallowest, depthFromBody(parent_1));
|
|
6435
|
+
}
|
|
6436
|
+
if (shallowest <= OVERLAY_MAX_DEPTH) {
|
|
6437
|
+
break;
|
|
6438
|
+
}
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
6442
|
+
finally {
|
|
6443
|
+
try {
|
|
6444
|
+
if (adds_1_1 && !adds_1_1.done && (_a = adds_1.return)) _a.call(adds_1);
|
|
6445
|
+
}
|
|
6446
|
+
finally { if (e_1) throw e_1.error; }
|
|
6447
|
+
}
|
|
6448
|
+
return shallowest;
|
|
6449
|
+
}
|
|
6450
|
+
function removesTolerable(added, removed) {
|
|
6451
|
+
return (removed <=
|
|
6452
|
+
Math.max(OVERLAY_MAX_REMOVES_ABSOLUTE, added * OVERLAY_MAX_REMOVES_FRACTION));
|
|
6453
|
+
}
|
|
6454
|
+
function threshold(minimum, fraction, elementCount) {
|
|
6455
|
+
return Math.max(minimum, elementCount * fraction);
|
|
6456
|
+
}
|
|
6457
|
+
function containsElement(node) {
|
|
6458
|
+
if (!node) {
|
|
6459
|
+
return false;
|
|
6460
|
+
}
|
|
6461
|
+
if (node.type === NodeType.Element) {
|
|
6462
|
+
return true;
|
|
6463
|
+
}
|
|
6464
|
+
var children = node.childNodes;
|
|
6465
|
+
return !!(children === null || children === void 0 ? void 0 : children.some(containsElement));
|
|
6466
|
+
}
|
|
6467
|
+
function depthFromBody(node) {
|
|
6468
|
+
var _a;
|
|
6469
|
+
var body = (_a = CxGlobal.document) === null || _a === void 0 ? void 0 : _a.body;
|
|
6470
|
+
var depth = 0;
|
|
6471
|
+
var current = node;
|
|
6472
|
+
while (current && current !== body) {
|
|
6473
|
+
current = current.parentElement;
|
|
6474
|
+
depth += 1;
|
|
6475
|
+
if (depth > MAX_DEPTH_WALK) {
|
|
6476
|
+
return UNRESOLVED_DEPTH;
|
|
6477
|
+
}
|
|
6478
|
+
}
|
|
6479
|
+
return current ? depth : UNRESOLVED_DEPTH;
|
|
6480
|
+
}
|
|
6481
|
+
|
|
5880
6482
|
if (supportedPerformanceTypes === null || supportedPerformanceTypes === void 0 ? void 0 : supportedPerformanceTypes.has(PerformanceTypes.LongTask)) {
|
|
5881
6483
|
var ttiHandler_1 = (CxGlobal.__tti = {
|
|
5882
6484
|
e: [],
|
|
@@ -5915,7 +6517,6 @@ function getResolvedName(element, fullData) {
|
|
|
5915
6517
|
element: element,
|
|
5916
6518
|
config: getSdkConfig(),
|
|
5917
6519
|
actionName: actionName,
|
|
5918
|
-
ariaLabel: ariaLabel,
|
|
5919
6520
|
});
|
|
5920
6521
|
return fullData
|
|
5921
6522
|
? { resolvedName: resolvedName, isDeadClick: isDeadClick, actionName: actionName, ariaLabel: ariaLabel }
|
|
@@ -5932,9 +6533,14 @@ var CoralogixRum = {
|
|
|
5932
6533
|
init: function (options) {
|
|
5933
6534
|
var _a, _b;
|
|
5934
6535
|
var _this = this;
|
|
5935
|
-
var _c
|
|
6536
|
+
var _c;
|
|
5936
6537
|
try {
|
|
5937
|
-
|
|
6538
|
+
var owner = CxGlobal === null || CxGlobal === void 0 ? void 0 : CxGlobal.CoralogixRum;
|
|
6539
|
+
if (owner && owner !== CoralogixRum) {
|
|
6540
|
+
console.debug('CoralogixRum: another SDK copy on this page owns the global, ignoring init');
|
|
6541
|
+
return;
|
|
6542
|
+
}
|
|
6543
|
+
if (isInited) {
|
|
5938
6544
|
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
5939
6545
|
console.debug('CoralogixRum already initialized, skipping init');
|
|
5940
6546
|
}
|
|
@@ -6050,8 +6656,11 @@ var CoralogixRum = {
|
|
|
6050
6656
|
spanMapProcessor = new CoralogixSpanMapProcessor();
|
|
6051
6657
|
tracerProvider.addSpanProcessor(spanMapProcessor);
|
|
6052
6658
|
new SnapshotManager();
|
|
6053
|
-
if ((
|
|
6659
|
+
if ((_c = resolvedOptions_1.sessionRecordingConfig) === null || _c === void 0 ? void 0 : _c.enable) {
|
|
6054
6660
|
new ClickScreenshotManager();
|
|
6661
|
+
if (resolvedOptions_1.sessionRecordingConfig.captureScreenshotOnDomChange) {
|
|
6662
|
+
new DomChangeScreenshotTrigger();
|
|
6663
|
+
}
|
|
6055
6664
|
}
|
|
6056
6665
|
snapshotProcessor = new CoralogixSnapshotSpanProcessor();
|
|
6057
6666
|
tracerProvider.addSpanProcessor(snapshotProcessor);
|
|
@@ -6061,10 +6670,10 @@ var CoralogixRum = {
|
|
|
6061
6670
|
tracerProvider: tracerProvider,
|
|
6062
6671
|
instrumentations: instrumentations,
|
|
6063
6672
|
});
|
|
6064
|
-
var
|
|
6673
|
+
var _d = __read$1(partition(resolvedOptions_1.labelProviders || [], function (_a) {
|
|
6065
6674
|
var urlType = _a.urlType;
|
|
6066
6675
|
return urlType === UrlType.PAGE || !urlType;
|
|
6067
|
-
}), 2), pageUrlLabelProviders =
|
|
6676
|
+
}), 2), pageUrlLabelProviders = _d[0], networkUrlLabelProviders = _d[1];
|
|
6068
6677
|
saveInternalRumData(PAGE_URL_LABEL_PROVIDERS_KEY, pageUrlLabelProviders);
|
|
6069
6678
|
saveInternalRumData(NETWORK_URL_LABEL_PROVIDERS_KEY, networkUrlLabelProviders);
|
|
6070
6679
|
isInited = true;
|
|
@@ -6151,6 +6760,7 @@ var CoralogixRum = {
|
|
|
6151
6760
|
this.stopSessionRecording();
|
|
6152
6761
|
(_a = getSessionManager()) === null || _a === void 0 ? void 0 : _a.stop();
|
|
6153
6762
|
ClickScreenshotManager.unregister();
|
|
6763
|
+
DomChangeScreenshotTrigger.unregister();
|
|
6154
6764
|
attributesProcessor === null || attributesProcessor === void 0 ? void 0 : attributesProcessor.shutdown();
|
|
6155
6765
|
navigationProcessor === null || navigationProcessor === void 0 ? void 0 : navigationProcessor.shutdown();
|
|
6156
6766
|
spanMapProcessor === null || spanMapProcessor === void 0 ? void 0 : spanMapProcessor.shutdown();
|
|
@@ -6327,7 +6937,9 @@ var CoralogixRum = {
|
|
|
6327
6937
|
}
|
|
6328
6938
|
},
|
|
6329
6939
|
};
|
|
6330
|
-
CxGlobal.CoralogixRum
|
|
6940
|
+
if (!CxGlobal.CoralogixRum) {
|
|
6941
|
+
CxGlobal.CoralogixRum = CoralogixRum;
|
|
6942
|
+
}
|
|
6331
6943
|
|
|
6332
6944
|
var UrlBasedLabelProvider = (function () {
|
|
6333
6945
|
function UrlBasedLabelProvider(config) {
|
|
@@ -6378,4 +6990,4 @@ var SessionRecordingEventType;
|
|
|
6378
6990
|
SessionRecordingEventType[SessionRecordingEventType["Plugin"] = 6] = "Plugin";
|
|
6379
6991
|
})(SessionRecordingEventType || (SessionRecordingEventType = {}));
|
|
6380
6992
|
|
|
6381
|
-
export { BATCH_TIME_DELAY as B,
|
|
6993
|
+
export { BATCH_TIME_DELAY as B, CanvasContext as C, EventType as E, IncrementalSource as I, MouseInteractions as M, NodeType as N, OtelNetworkAttrs as O, PointerTypes as P, Request as R, SESSION_RECORDER_SEGMENTS_MAP as S, UrlBasedLabelProvider as U, cxClearTimeout as a, createCxMutationObserver as b, cxSetTimeout as c, MediaInteractions as d, cxRequestAnimationFrame as e, cxCancelAnimationFrame as f, getZoneJsOriginalDom as g, CxGlobal as h, getSdkConfig as i, cxClearInterval as j, getNowTime as k, SESSION_RECORDING_NETWORK_ERR0R_MESSAGE as l, cxSetInterval as m, SESSION_RECORDING_DEFAULT_HEADERS as n, SESSION_RECORDING_POSTFIX_URL as o, getDomChangeScreenshotTrigger as p, SESSION_RECORDER_KEY as q, SESSION_RECORDING_DEFAULT_ERROR_MESSAGE as r, setSdkState as s, MAX_BATCH_TIME_MS as t, CoralogixRum as u, CoralogixLogSeverity as v, SessionRecordingEventType as w, CoralogixEventType as x, PerformanceTypes as y, UrlType as z };
|
package/package.json
CHANGED
package/sessionRecorder.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __values, __spreadArray, __read, __assign, __rest, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { c as cxSetTimeout, a as cxClearTimeout, g as getZoneJsOriginalDom, b as createCxMutationObserver, d as
|
|
2
|
+
import { N as NodeType, c as cxSetTimeout, a as cxClearTimeout, g as getZoneJsOriginalDom, b as createCxMutationObserver, M as MouseInteractions, d as MediaInteractions, P as PointerTypes, I as IncrementalSource, E as EventType, C as CanvasContext, e as cxRequestAnimationFrame, f as cxCancelAnimationFrame, h as CxGlobal, S as SESSION_RECORDER_SEGMENTS_MAP, i as getSdkConfig, j as cxClearInterval, k as getNowTime, l as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, m as cxSetInterval, R as Request, n as SESSION_RECORDING_DEFAULT_HEADERS, o as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, p as getDomChangeScreenshotTrigger, s as setSdkState, q as SESSION_RECORDER_KEY, r as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE, t as MAX_BATCH_TIME_MS } from './index.esm2.js';
|
|
3
3
|
import '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import '@opentelemetry/sdk-trace-web';
|
|
5
5
|
import '@opentelemetry/instrumentation';
|
|
@@ -12,81 +12,6 @@ import '@opentelemetry/api';
|
|
|
12
12
|
import '@opentelemetry/propagator-b3';
|
|
13
13
|
import '@opentelemetry/propagator-aws-xray';
|
|
14
14
|
|
|
15
|
-
var EventType;
|
|
16
|
-
(function (EventType) {
|
|
17
|
-
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
18
|
-
EventType[EventType["Load"] = 1] = "Load";
|
|
19
|
-
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
20
|
-
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
21
|
-
EventType[EventType["Meta"] = 4] = "Meta";
|
|
22
|
-
EventType[EventType["Custom"] = 5] = "Custom";
|
|
23
|
-
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
24
|
-
EventType[EventType["Asset"] = 7] = "Asset";
|
|
25
|
-
})(EventType || (EventType = {}));
|
|
26
|
-
var IncrementalSource;
|
|
27
|
-
(function (IncrementalSource) {
|
|
28
|
-
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
29
|
-
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
30
|
-
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
31
|
-
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
32
|
-
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
33
|
-
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
34
|
-
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
35
|
-
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
36
|
-
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
37
|
-
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
38
|
-
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
39
|
-
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
40
|
-
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
41
|
-
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
42
|
-
IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
|
|
43
|
-
IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
44
|
-
IncrementalSource[IncrementalSource["CustomElement"] = 16] = "CustomElement";
|
|
45
|
-
})(IncrementalSource || (IncrementalSource = {}));
|
|
46
|
-
var MouseInteractions;
|
|
47
|
-
(function (MouseInteractions) {
|
|
48
|
-
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
49
|
-
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
50
|
-
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
51
|
-
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
52
|
-
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
53
|
-
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
54
|
-
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
55
|
-
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
56
|
-
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
57
|
-
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
58
|
-
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
59
|
-
})(MouseInteractions || (MouseInteractions = {}));
|
|
60
|
-
var PointerTypes;
|
|
61
|
-
(function (PointerTypes) {
|
|
62
|
-
PointerTypes[PointerTypes["Mouse"] = 0] = "Mouse";
|
|
63
|
-
PointerTypes[PointerTypes["Pen"] = 1] = "Pen";
|
|
64
|
-
PointerTypes[PointerTypes["Touch"] = 2] = "Touch";
|
|
65
|
-
})(PointerTypes || (PointerTypes = {}));
|
|
66
|
-
var CanvasContext;
|
|
67
|
-
(function (CanvasContext) {
|
|
68
|
-
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
69
|
-
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
70
|
-
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
71
|
-
})(CanvasContext || (CanvasContext = {}));
|
|
72
|
-
var MediaInteractions;
|
|
73
|
-
(function (MediaInteractions) {
|
|
74
|
-
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
75
|
-
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
76
|
-
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
77
|
-
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
78
|
-
MediaInteractions[MediaInteractions["RateChange"] = 4] = "RateChange";
|
|
79
|
-
})(MediaInteractions || (MediaInteractions = {}));
|
|
80
|
-
var NodeType;
|
|
81
|
-
(function (NodeType) {
|
|
82
|
-
NodeType[NodeType["Document"] = 0] = "Document";
|
|
83
|
-
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
84
|
-
NodeType[NodeType["Element"] = 2] = "Element";
|
|
85
|
-
NodeType[NodeType["Text"] = 3] = "Text";
|
|
86
|
-
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
87
|
-
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
88
|
-
})(NodeType || (NodeType = {}));
|
|
89
|
-
|
|
90
15
|
var testableAccessors = {
|
|
91
16
|
Node: [
|
|
92
17
|
'childNodes',
|
|
@@ -5714,6 +5639,7 @@ var WorkerManager = (function () {
|
|
|
5714
5639
|
return WorkerManager;
|
|
5715
5640
|
}());
|
|
5716
5641
|
|
|
5642
|
+
var resolveMirrorNode = function (id) { var _a, _b, _c; return (_c = (_b = (_a = record.mirror) === null || _a === void 0 ? void 0 : _a.getNode) === null || _b === void 0 ? void 0 : _b.call(_a, id)) !== null && _c !== void 0 ? _c : null; };
|
|
5717
5643
|
var SessionRecorder = (function () {
|
|
5718
5644
|
function SessionRecorder(sessionManager, recordConfig) {
|
|
5719
5645
|
var _this = this;
|
|
@@ -5731,6 +5657,8 @@ var SessionRecorder = (function () {
|
|
|
5731
5657
|
this.debugMode = !!((_a = getSdkConfig()) === null || _a === void 0 ? void 0 : _a.debug);
|
|
5732
5658
|
this._recordingStopDueToTimeout = false;
|
|
5733
5659
|
this.handleRecordEvent = function (event, isCheckout) {
|
|
5660
|
+
var _a;
|
|
5661
|
+
(_a = getDomChangeScreenshotTrigger()) === null || _a === void 0 ? void 0 : _a.handleRecordEvent(event, resolveMirrorNode);
|
|
5734
5662
|
if (!_this.recordingStopped) {
|
|
5735
5663
|
if (_this.onlySessionWithErrorMode) {
|
|
5736
5664
|
_this.handleRecordEventForSessionWithError(event, isCheckout);
|
|
@@ -5834,9 +5762,12 @@ var SessionRecorder = (function () {
|
|
|
5834
5762
|
SessionRecorder.prototype.getIsAutoStartRecording = function () {
|
|
5835
5763
|
return this.isAutoStartRecording;
|
|
5836
5764
|
};
|
|
5765
|
+
SessionRecorder.prototype.isRecordingActive = function () {
|
|
5766
|
+
return !!this.recordRef;
|
|
5767
|
+
};
|
|
5837
5768
|
SessionRecorder.prototype.isConsoleRecordingActive = function () {
|
|
5838
5769
|
var _a;
|
|
5839
|
-
return (
|
|
5770
|
+
return (this.isRecordingActive() &&
|
|
5840
5771
|
((_a = getSdkConfig().sessionRecordingConfig) === null || _a === void 0 ? void 0 : _a.recordConsoleEvents) === true);
|
|
5841
5772
|
};
|
|
5842
5773
|
Object.defineProperty(SessionRecorder.prototype, "recordingStopDueToTimeout", {
|
package/src/constants.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export declare const CORALOGIX_LOGS_URL_SUFFIX = "/browser/v1beta/logs";
|
|
|
4
4
|
export declare const CORALOGIX_RECORDING_URL_SUFFIX = "/sessionrecording";
|
|
5
5
|
export declare const MFE_METADATA_FILE = "cx-metadata.json";
|
|
6
6
|
export declare const MFE_METADATA_URL_PATTERN: RegExp;
|
|
7
|
-
export declare const MAX_INTERACTION_ELEMENT_SIZE =
|
|
7
|
+
export declare const MAX_INTERACTION_ELEMENT_SIZE = 100;
|
|
8
|
+
export declare const INTERACTION_TEXT_TRUNCATION_MARKER = " [...]";
|
|
8
9
|
export declare const MAX_CHARACTERS = 1024;
|
|
9
10
|
export declare const REQUIRED_CONFIG_KEYS: Array<keyof CoralogixBrowserSdkConfig>;
|
|
10
11
|
export { SDK_CONFIG_KEY, USER_AGENT_KEY } from './tools/global-keys';
|
|
@@ -18,6 +19,8 @@ export declare const MASKED_TEXT = "***";
|
|
|
18
19
|
export declare const MASK_CLASS_DEFAULT = "cx-mask";
|
|
19
20
|
export declare const CX_PREFIX = "cx";
|
|
20
21
|
export declare const ARIA_LABEL_ATTRIBUTE = "aria-label";
|
|
22
|
+
export declare const TITLE_ATTRIBUTE = "title";
|
|
23
|
+
export declare const ALT_ATTRIBUTE = "alt";
|
|
21
24
|
export declare const PASSWORD_INPUT_TYPE: InputType;
|
|
22
25
|
export declare const MASK_INPUT_TYPES_DEFAULT: InputType[];
|
|
23
26
|
export declare const FINGER_PRINT_KEY = "cx-fingerprint";
|
package/src/helpers.d.ts
CHANGED
|
@@ -4,10 +4,12 @@ import { CoralogixBrowserSdkConfig, UserAgentData } from './types';
|
|
|
4
4
|
import { SnapshotManager } from './snapshot/snapshotManager';
|
|
5
5
|
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
|
6
6
|
import type { ClickScreenshotManager } from './instrumentations/screenshot/click-screenshot-manager';
|
|
7
|
+
import type { DomChangeScreenshotTrigger } from './instrumentations/screenshot/dom-change-screenshot-trigger';
|
|
7
8
|
export declare function getSnapshotManager(): SnapshotManager;
|
|
8
9
|
export declare function getSessionManager(): SessionManager;
|
|
9
10
|
export declare function getSessionRecorder(): SessionRecorder | undefined;
|
|
10
11
|
export declare function getClickScreenshotManager(): ClickScreenshotManager | undefined;
|
|
12
|
+
export declare function getDomChangeScreenshotTrigger(): DomChangeScreenshotTrigger | undefined;
|
|
11
13
|
export declare function getSdkConfig(): CoralogixBrowserSdkConfig;
|
|
12
14
|
export declare function getUserAgentData(): UserAgentData;
|
|
13
15
|
export declare function clearMemoryFrom(keys: string[]): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { eventWithTime } from '../../cx-rrweb/rrweb-types';
|
|
2
|
+
import { MirrorNodeResolver } from './dom-change-screenshot.consts';
|
|
3
|
+
export declare class DomChangeScreenshotTrigger {
|
|
4
|
+
private settled;
|
|
5
|
+
private quietTimer;
|
|
6
|
+
private debounceTimer;
|
|
7
|
+
private lastInteractionAt;
|
|
8
|
+
private pendingReason;
|
|
9
|
+
private cachedElementCount;
|
|
10
|
+
private elementCountRefreshedAt;
|
|
11
|
+
private lastCaptureAt;
|
|
12
|
+
private capturesThisView;
|
|
13
|
+
static unregister(): void;
|
|
14
|
+
constructor();
|
|
15
|
+
reset: () => void;
|
|
16
|
+
onNavigation: () => void;
|
|
17
|
+
handleRecordEvent: (event: eventWithTime, resolveNode?: MirrorNodeResolver) => void;
|
|
18
|
+
private isUserInteraction;
|
|
19
|
+
private handleMutation;
|
|
20
|
+
private classify;
|
|
21
|
+
private capture;
|
|
22
|
+
private getElementCount;
|
|
23
|
+
private armSettleTimer;
|
|
24
|
+
private markSettled;
|
|
25
|
+
private clearTimers;
|
|
26
|
+
private clearSettleTimer;
|
|
27
|
+
private clearDebounceTimer;
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DOM_CHANGE_SCREENSHOT_TRIGGER_KEY = "rumDomChangeScreenshotTrigger";
|
|
2
|
+
export declare const SETTLE_QUIET_MS = 500;
|
|
3
|
+
export declare const CONTENT_ELEMENT_FLOOR = 50;
|
|
4
|
+
export declare const CHANGE_DEBOUNCE_MS = 400;
|
|
5
|
+
export declare const INTERACTION_TIGHT_MS = 150;
|
|
6
|
+
export declare const INTERACTION_TIGHT_MIN_ELEMENTS = 1;
|
|
7
|
+
export declare const INTERACTION_LOOSE_MS = 1500;
|
|
8
|
+
export declare const INTERACTION_LOOSE_MIN_ELEMENTS = 3;
|
|
9
|
+
export declare const OVERLAY_MAX_DEPTH = 3;
|
|
10
|
+
export declare const MAX_DEPTH_WALK = 40;
|
|
11
|
+
export declare const OVERLAY_MAX_REMOVES_ABSOLUTE = 2;
|
|
12
|
+
export declare const OVERLAY_MAX_REMOVES_FRACTION = 0.1;
|
|
13
|
+
export declare const VIEW_CHANGE_FRACTION = 0.02;
|
|
14
|
+
export declare const VIEW_CHANGE_MIN_WEIGHT = 25;
|
|
15
|
+
export declare const NODE_COUNT_REFRESH_MS = 2000;
|
|
16
|
+
export declare const MIN_CAPTURE_INTERVAL_MS = 2000;
|
|
17
|
+
export declare const MAX_CAPTURES_PER_VIEW = 10;
|
|
18
|
+
export declare const MAX_NODES_FOR_CAPTURE = 20000;
|
|
19
|
+
export type MirrorNodeResolver = (id: number) => Node | null;
|
|
20
|
+
export declare const enum DomChangeReason {
|
|
21
|
+
Overlay = "dom-overlay",
|
|
22
|
+
ViewChange = "dom-view-change"
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function canCaptureAutomaticScreenshot(): boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { CoralogixBrowserSdkConfig } from '../../types';
|
|
2
|
+
export declare const CLICKABLE_SELECTOR: string;
|
|
2
3
|
export declare function extractActionName(el: Element | HTMLElement | null): string;
|
|
3
4
|
export declare function extractAriaLabel(el: Element | HTMLElement | null): string;
|
|
4
5
|
export declare function extractTestId(el: Element | HTMLElement | null): string;
|
|
5
|
-
export declare function extractResolvedName({ isDeadClick, element, config, actionName,
|
|
6
|
+
export declare function extractResolvedName({ isDeadClick, element, config, actionName, }: {
|
|
6
7
|
isDeadClick: boolean;
|
|
7
8
|
element: Element | HTMLElement | null;
|
|
8
9
|
config: CoralogixBrowserSdkConfig;
|
|
9
10
|
actionName: string;
|
|
10
|
-
ariaLabel: string;
|
|
11
11
|
}): string;
|
|
12
12
|
export declare function extractMaskedOrTextContent(clickableElement: Element | HTMLElement | null, config: CoralogixBrowserSdkConfig): string;
|
|
13
13
|
export declare function getClassName(element: Element | HTMLElement): string;
|
|
@@ -12,6 +12,7 @@ export interface SessionRecordingConfig extends Omit<recordOptions<eventWithTime
|
|
|
12
12
|
sessionRecordingSampleRate?: number;
|
|
13
13
|
workerUrl?: string;
|
|
14
14
|
immediateFlush?: boolean;
|
|
15
|
+
captureScreenshotOnDomChange?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export interface SessionWithErrorConfig {
|
|
17
18
|
enable: boolean;
|
|
@@ -29,6 +29,7 @@ export declare class SessionRecorder {
|
|
|
29
29
|
getSegmentIndexCounter(): Record<string, number>;
|
|
30
30
|
private restoreSegmentIndexCounter;
|
|
31
31
|
getIsAutoStartRecording(): boolean;
|
|
32
|
+
isRecordingActive(): boolean;
|
|
32
33
|
isConsoleRecordingActive(): boolean;
|
|
33
34
|
set recordingStopDueToTimeout(value: boolean);
|
|
34
35
|
get recordingStopDueToTimeout(): boolean;
|
package/src/types.d.ts
CHANGED
package/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.
|
|
1
|
+
export declare const SDK_VERSION = "3.24.0";
|