@coralogix/browser 3.23.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/browser",
3
- "version": "3.23.5",
3
+ "version": "3.24.0",
4
4
  "description": "Official Coralogix SDK for browsers",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
@@ -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 cxRequestAnimationFrame, e as cxCancelAnimationFrame, C as CxGlobal, S as SESSION_RECORDER_SEGMENTS_MAP, f as getSdkConfig, h as cxClearInterval, i as getNowTime, j as SESSION_RECORDING_NETWORK_ERR0R_MESSAGE, k as cxSetInterval, R as Request, l as SESSION_RECORDING_DEFAULT_HEADERS, m as SESSION_RECORDING_POSTFIX_URL, B as BATCH_TIME_DELAY, n as SESSION_RECORDER_KEY, o as SESSION_RECORDING_DEFAULT_ERROR_MESSAGE, M as MAX_BATCH_TIME_MS } from './index.esm2.js';
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);
@@ -5793,7 +5721,7 @@ var SessionRecorder = (function () {
5793
5721
  _this.batchTimeDelay = BATCH_TIME_DELAY;
5794
5722
  }
5795
5723
  };
5796
- CxGlobal[SESSION_RECORDER_KEY] = this;
5724
+ setSdkState(SESSION_RECORDER_KEY, this);
5797
5725
  this.sessionManager = sessionManager;
5798
5726
  if ((_b = getSdkConfig().sessionConfig) === null || _b === void 0 ? void 0 : _b.keepSessionAfterReload) {
5799
5727
  this.restoreSegmentIndexCounter();
@@ -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 (!!this.recordRef &&
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", {
@@ -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 = 1024;
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,2 +1,4 @@
1
1
  export declare const SCREENSHOT_INSTRUMENTATION_NAME = "screenshot";
2
2
  export declare const SCREENSHOT_INSTRUMENTATION_VERSION = "1.0.0";
3
+ export declare const MAX_SCREENSHOT_ACTIONS = 100;
4
+ export declare function collectDomActionNames(limit?: number): string[];
@@ -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, ariaLabel, }: {
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;
@@ -0,0 +1,6 @@
1
+ export declare const SDK_STORE_KEY = "__cx_store__";
2
+ export declare const CACHED_LOGS_KEY = "cachedLogs";
3
+ export type SdkStore = Record<string, any>;
4
+ export declare const sdkStore: SdkStore;
5
+ export declare function setSdkState(key: string, value: unknown): void;
6
+ export declare function deleteSdkState(key: string): void;
package/src/types.d.ts CHANGED
@@ -73,6 +73,7 @@ export interface CustomTargetElement extends HTMLElement {
73
73
  export interface ScreenshotContext {
74
74
  id: string;
75
75
  description?: string;
76
+ actions?: string[];
76
77
  }
77
78
  export interface DomContext {
78
79
  visibility_state: DocumentVisibilityState;
package/src/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "3.23.5";
1
+ export declare const SDK_VERSION = "3.24.0";