@openreplay/tracker 18.0.14-beta.0 → 18.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/entry.js +363 -109
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +300 -92
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/canvas.d.ts +6 -0
- package/dist/cjs/main/app/index.d.ts +6 -1
- package/dist/cjs/main/app/observer/observer.d.ts +10 -0
- package/dist/cjs/main/app/sanitizer.d.ts +5 -3
- package/dist/cjs/main/index.d.ts +17 -2
- package/dist/cjs/main/singleton.d.ts +25 -1
- package/dist/lib/entry.js +363 -109
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +300 -92
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/canvas.d.ts +6 -0
- package/dist/lib/main/app/index.d.ts +6 -1
- package/dist/lib/main/app/observer/observer.d.ts +10 -0
- package/dist/lib/main/app/sanitizer.d.ts +5 -3
- package/dist/lib/main/index.d.ts +17 -2
- package/dist/lib/main/singleton.d.ts +25 -1
- package/dist/types/main/app/canvas.d.ts +6 -0
- package/dist/types/main/app/index.d.ts +6 -1
- package/dist/types/main/app/observer/observer.d.ts +10 -0
- package/dist/types/main/app/sanitizer.d.ts +5 -3
- package/dist/types/main/index.d.ts +17 -2
- package/dist/types/main/singleton.d.ts +25 -1
- package/package.json +1 -1
|
@@ -24,6 +24,12 @@ declare class CanvasRecorder {
|
|
|
24
24
|
private isProcessingQueue;
|
|
25
25
|
constructor(app: App, options: Options);
|
|
26
26
|
startTracking(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reacts to a runtime sanitization change on a canvas: stop capturing if it
|
|
29
|
+
* just became masked, start if it just became visible. (Already-sent frames
|
|
30
|
+
* can't be retracted — escalation only stops future capture.)
|
|
31
|
+
*/
|
|
32
|
+
resanitizeCanvas: (node: Node, id: number) => void;
|
|
27
33
|
restartTracking: () => void;
|
|
28
34
|
captureCanvas: (node: Node) => void;
|
|
29
35
|
recordCanvas: (node: Node, id: number) => void;
|
|
@@ -8,7 +8,7 @@ import Nodes from './nodes/index.js';
|
|
|
8
8
|
import type { Options as ObserverOptions } from './observer/top_observer.js';
|
|
9
9
|
import Observer from './observer/top_observer.js';
|
|
10
10
|
import type { Options as SanitizerOptions } from './sanitizer.js';
|
|
11
|
-
import Sanitizer from './sanitizer.js';
|
|
11
|
+
import Sanitizer, { SanitizeLevel } from './sanitizer.js';
|
|
12
12
|
import type { Options as SessOptions } from './session.js';
|
|
13
13
|
import Session from './session.js';
|
|
14
14
|
import Ticker from './ticker.js';
|
|
@@ -130,6 +130,7 @@ export default class App {
|
|
|
130
130
|
readonly ticker: Ticker;
|
|
131
131
|
readonly projectKey: string;
|
|
132
132
|
readonly sanitizer: Sanitizer;
|
|
133
|
+
private readonly resanitizeCallbacks;
|
|
133
134
|
readonly debug: Logger;
|
|
134
135
|
readonly notify: Logger;
|
|
135
136
|
readonly session: Session;
|
|
@@ -354,6 +355,10 @@ export default class App {
|
|
|
354
355
|
private userStartCallback?;
|
|
355
356
|
private _start;
|
|
356
357
|
restartCanvasTracking: () => void;
|
|
358
|
+
attachResanitizeCallback: (cb: (node: Node, id: number) => void) => void;
|
|
359
|
+
callResanitizeCallbacks: (node: Node, id: number) => void;
|
|
360
|
+
resanitize: (el?: Element) => void;
|
|
361
|
+
checkSanitization: (el: Node) => SanitizeLevel | undefined;
|
|
357
362
|
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
358
363
|
waitStart(): Promise<unknown>;
|
|
359
364
|
waitStarted(): Promise<unknown>;
|
|
@@ -53,6 +53,16 @@ export default abstract class Observer {
|
|
|
53
53
|
private commitNode;
|
|
54
54
|
private commitNodes;
|
|
55
55
|
protected observeRoot(node: Node, beforeCommit: (id?: number) => unknown, nodeToBind?: Node): void;
|
|
56
|
+
/**
|
|
57
|
+
* Re-evaluates sanitization for every tracked node in `root`'s subtree against
|
|
58
|
+
* the current DOM and re-emits whatever changed. Pass the highest node you
|
|
59
|
+
* changed (or the document root) so inherited levels propagate correctly.
|
|
60
|
+
*/
|
|
61
|
+
resanitizeSubtree(root: Node): void;
|
|
62
|
+
private resanitizeNode;
|
|
63
|
+
private recreateSubtree;
|
|
64
|
+
private clearSubtreeRegistration;
|
|
65
|
+
private reemitNode;
|
|
56
66
|
disconnect(): void;
|
|
57
67
|
protected resetThrottledSetNodeData(): void;
|
|
58
68
|
}
|
|
@@ -35,8 +35,7 @@ export interface Options {
|
|
|
35
35
|
}
|
|
36
36
|
export declare const stringWiper: (input: string) => string;
|
|
37
37
|
export default class Sanitizer {
|
|
38
|
-
private readonly
|
|
39
|
-
private readonly hidden;
|
|
38
|
+
private readonly levels;
|
|
40
39
|
private readonly options;
|
|
41
40
|
readonly privateMode: boolean;
|
|
42
41
|
private readonly app;
|
|
@@ -44,7 +43,10 @@ export default class Sanitizer {
|
|
|
44
43
|
app: App;
|
|
45
44
|
options?: Partial<Options>;
|
|
46
45
|
});
|
|
47
|
-
|
|
46
|
+
computeLevel(node: Node, parentLevel: SanitizeLevel): SanitizeLevel;
|
|
47
|
+
getLevel(id: number): SanitizeLevel;
|
|
48
|
+
setLevel(id: number, level: SanitizeLevel): SanitizeLevel;
|
|
49
|
+
handleNode(id: number, parentID: number, node: Node): void;
|
|
48
50
|
sanitize(id: number, data: string): string;
|
|
49
51
|
isObscured(id: number): boolean;
|
|
50
52
|
isHidden(id: number): boolean;
|
package/dist/lib/main/index.d.ts
CHANGED
|
@@ -47,6 +47,21 @@ export default class API {
|
|
|
47
47
|
checkDoNotTrack: () => boolean | undefined;
|
|
48
48
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
49
49
|
restartCanvasTracking: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Re-evaluates sanitization against the current DOM and re-emits whatever
|
|
52
|
+
* changed, updating already-recorded nodes mid-session. Call after toggling
|
|
53
|
+
* `data-openreplay-*` attributes or after changing whatever your `domSanitizer`
|
|
54
|
+
* keys on (class/id/etc).
|
|
55
|
+
*
|
|
56
|
+
* @param el - the highest node you changed; omit to re-scan the whole document;
|
|
57
|
+
* scanning the entire doc is O(dom size)
|
|
58
|
+
* */
|
|
59
|
+
resanitize: (el?: Element) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the sanitization level the tracker currently has for a node
|
|
62
|
+
* (0 = Plain, 1 = Obscured, 2 = Hidden), or undefined if it isn't tracked.
|
|
63
|
+
* */
|
|
64
|
+
checkSanitization: (el: Node) => import("./app/sanitizer.js").SanitizeLevel | undefined;
|
|
50
65
|
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
51
66
|
isActive(): boolean;
|
|
52
67
|
/**
|
|
@@ -103,9 +118,9 @@ export default class API {
|
|
|
103
118
|
}) => string | undefined;
|
|
104
119
|
setUserID: (id: string) => void;
|
|
105
120
|
identify: (id: string) => void;
|
|
106
|
-
track: (
|
|
121
|
+
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
107
122
|
send_immediately: boolean;
|
|
108
|
-
}) => void
|
|
123
|
+
}) => void | undefined;
|
|
109
124
|
userID: (id: string) => void;
|
|
110
125
|
setUserAnonymousID(id: string): void;
|
|
111
126
|
userAnonymousID(id: string): void;
|
|
@@ -16,7 +16,7 @@ declare class TrackerSingleton {
|
|
|
16
16
|
* (which can be used to stitch sessions together)
|
|
17
17
|
* */
|
|
18
18
|
stop(): string | undefined;
|
|
19
|
-
setUserID(id: string)
|
|
19
|
+
setUserID: (id: string) => void;
|
|
20
20
|
get analytics(): import("./entry.js").Analytics | null;
|
|
21
21
|
identify: (id: string) => void;
|
|
22
22
|
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
@@ -101,6 +101,30 @@ declare class TrackerSingleton {
|
|
|
101
101
|
forceFlushBatch(): void;
|
|
102
102
|
getSessionInfo(): import("./app/session.js").SessionInfo | null;
|
|
103
103
|
getTabId(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Re-evaluates sanitization against the current DOM and re-emits whatever
|
|
106
|
+
* changed, updating already-recorded nodes mid-session. Call after toggling
|
|
107
|
+
* `data-openreplay-*` attributes or after changing whatever your `domSanitizer`
|
|
108
|
+
* keys on (class/id/etc).
|
|
109
|
+
*
|
|
110
|
+
* @param el - the highest node you changed; omit to re-scan the whole document.
|
|
111
|
+
* */
|
|
112
|
+
resanitize(el?: Element): void;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the sanitization level the tracker currently has for a node
|
|
115
|
+
* (0 = Plain, 1 = Obscured, 2 = Hidden), or undefined if it isn't tracked.
|
|
116
|
+
* */
|
|
117
|
+
checkSanitization(el: Node): import("./index.js").SanitizeLevel | undefined;
|
|
118
|
+
incident(options: {
|
|
119
|
+
label?: string;
|
|
120
|
+
startTime: number;
|
|
121
|
+
endTime?: number;
|
|
122
|
+
}): void;
|
|
123
|
+
/**
|
|
124
|
+
* Use custom token for analytics events without session recording
|
|
125
|
+
* */
|
|
126
|
+
setAnalyticsToken(token: string): void;
|
|
127
|
+
getAnalyticsToken(): string | undefined;
|
|
104
128
|
}
|
|
105
129
|
declare const tracker: TrackerSingleton;
|
|
106
130
|
export default tracker;
|
|
@@ -24,6 +24,12 @@ declare class CanvasRecorder {
|
|
|
24
24
|
private isProcessingQueue;
|
|
25
25
|
constructor(app: App, options: Options);
|
|
26
26
|
startTracking(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reacts to a runtime sanitization change on a canvas: stop capturing if it
|
|
29
|
+
* just became masked, start if it just became visible. (Already-sent frames
|
|
30
|
+
* can't be retracted — escalation only stops future capture.)
|
|
31
|
+
*/
|
|
32
|
+
resanitizeCanvas: (node: Node, id: number) => void;
|
|
27
33
|
restartTracking: () => void;
|
|
28
34
|
captureCanvas: (node: Node) => void;
|
|
29
35
|
recordCanvas: (node: Node, id: number) => void;
|
|
@@ -8,7 +8,7 @@ import Nodes from './nodes/index.js';
|
|
|
8
8
|
import type { Options as ObserverOptions } from './observer/top_observer.js';
|
|
9
9
|
import Observer from './observer/top_observer.js';
|
|
10
10
|
import type { Options as SanitizerOptions } from './sanitizer.js';
|
|
11
|
-
import Sanitizer from './sanitizer.js';
|
|
11
|
+
import Sanitizer, { SanitizeLevel } from './sanitizer.js';
|
|
12
12
|
import type { Options as SessOptions } from './session.js';
|
|
13
13
|
import Session from './session.js';
|
|
14
14
|
import Ticker from './ticker.js';
|
|
@@ -130,6 +130,7 @@ export default class App {
|
|
|
130
130
|
readonly ticker: Ticker;
|
|
131
131
|
readonly projectKey: string;
|
|
132
132
|
readonly sanitizer: Sanitizer;
|
|
133
|
+
private readonly resanitizeCallbacks;
|
|
133
134
|
readonly debug: Logger;
|
|
134
135
|
readonly notify: Logger;
|
|
135
136
|
readonly session: Session;
|
|
@@ -354,6 +355,10 @@ export default class App {
|
|
|
354
355
|
private userStartCallback?;
|
|
355
356
|
private _start;
|
|
356
357
|
restartCanvasTracking: () => void;
|
|
358
|
+
attachResanitizeCallback: (cb: (node: Node, id: number) => void) => void;
|
|
359
|
+
callResanitizeCallbacks: (node: Node, id: number) => void;
|
|
360
|
+
resanitize: (el?: Element) => void;
|
|
361
|
+
checkSanitization: (el: Node) => SanitizeLevel | undefined;
|
|
357
362
|
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
358
363
|
waitStart(): Promise<unknown>;
|
|
359
364
|
waitStarted(): Promise<unknown>;
|
|
@@ -53,6 +53,16 @@ export default abstract class Observer {
|
|
|
53
53
|
private commitNode;
|
|
54
54
|
private commitNodes;
|
|
55
55
|
protected observeRoot(node: Node, beforeCommit: (id?: number) => unknown, nodeToBind?: Node): void;
|
|
56
|
+
/**
|
|
57
|
+
* Re-evaluates sanitization for every tracked node in `root`'s subtree against
|
|
58
|
+
* the current DOM and re-emits whatever changed. Pass the highest node you
|
|
59
|
+
* changed (or the document root) so inherited levels propagate correctly.
|
|
60
|
+
*/
|
|
61
|
+
resanitizeSubtree(root: Node): void;
|
|
62
|
+
private resanitizeNode;
|
|
63
|
+
private recreateSubtree;
|
|
64
|
+
private clearSubtreeRegistration;
|
|
65
|
+
private reemitNode;
|
|
56
66
|
disconnect(): void;
|
|
57
67
|
protected resetThrottledSetNodeData(): void;
|
|
58
68
|
}
|
|
@@ -35,8 +35,7 @@ export interface Options {
|
|
|
35
35
|
}
|
|
36
36
|
export declare const stringWiper: (input: string) => string;
|
|
37
37
|
export default class Sanitizer {
|
|
38
|
-
private readonly
|
|
39
|
-
private readonly hidden;
|
|
38
|
+
private readonly levels;
|
|
40
39
|
private readonly options;
|
|
41
40
|
readonly privateMode: boolean;
|
|
42
41
|
private readonly app;
|
|
@@ -44,7 +43,10 @@ export default class Sanitizer {
|
|
|
44
43
|
app: App;
|
|
45
44
|
options?: Partial<Options>;
|
|
46
45
|
});
|
|
47
|
-
|
|
46
|
+
computeLevel(node: Node, parentLevel: SanitizeLevel): SanitizeLevel;
|
|
47
|
+
getLevel(id: number): SanitizeLevel;
|
|
48
|
+
setLevel(id: number, level: SanitizeLevel): SanitizeLevel;
|
|
49
|
+
handleNode(id: number, parentID: number, node: Node): void;
|
|
48
50
|
sanitize(id: number, data: string): string;
|
|
49
51
|
isObscured(id: number): boolean;
|
|
50
52
|
isHidden(id: number): boolean;
|
|
@@ -47,6 +47,21 @@ export default class API {
|
|
|
47
47
|
checkDoNotTrack: () => boolean | undefined;
|
|
48
48
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
49
49
|
restartCanvasTracking: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Re-evaluates sanitization against the current DOM and re-emits whatever
|
|
52
|
+
* changed, updating already-recorded nodes mid-session. Call after toggling
|
|
53
|
+
* `data-openreplay-*` attributes or after changing whatever your `domSanitizer`
|
|
54
|
+
* keys on (class/id/etc).
|
|
55
|
+
*
|
|
56
|
+
* @param el - the highest node you changed; omit to re-scan the whole document;
|
|
57
|
+
* scanning the entire doc is O(dom size)
|
|
58
|
+
* */
|
|
59
|
+
resanitize: (el?: Element) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the sanitization level the tracker currently has for a node
|
|
62
|
+
* (0 = Plain, 1 = Obscured, 2 = Hidden), or undefined if it isn't tracked.
|
|
63
|
+
* */
|
|
64
|
+
checkSanitization: (el: Node) => import("./app/sanitizer.js").SanitizeLevel | undefined;
|
|
50
65
|
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
51
66
|
isActive(): boolean;
|
|
52
67
|
/**
|
|
@@ -103,9 +118,9 @@ export default class API {
|
|
|
103
118
|
}) => string | undefined;
|
|
104
119
|
setUserID: (id: string) => void;
|
|
105
120
|
identify: (id: string) => void;
|
|
106
|
-
track: (
|
|
121
|
+
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
107
122
|
send_immediately: boolean;
|
|
108
|
-
}) => void
|
|
123
|
+
}) => void | undefined;
|
|
109
124
|
userID: (id: string) => void;
|
|
110
125
|
setUserAnonymousID(id: string): void;
|
|
111
126
|
userAnonymousID(id: string): void;
|
|
@@ -16,7 +16,7 @@ declare class TrackerSingleton {
|
|
|
16
16
|
* (which can be used to stitch sessions together)
|
|
17
17
|
* */
|
|
18
18
|
stop(): string | undefined;
|
|
19
|
-
setUserID(id: string)
|
|
19
|
+
setUserID: (id: string) => void;
|
|
20
20
|
get analytics(): import("./entry.js").Analytics | null;
|
|
21
21
|
identify: (id: string) => void;
|
|
22
22
|
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
@@ -101,6 +101,30 @@ declare class TrackerSingleton {
|
|
|
101
101
|
forceFlushBatch(): void;
|
|
102
102
|
getSessionInfo(): import("./app/session.js").SessionInfo | null;
|
|
103
103
|
getTabId(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Re-evaluates sanitization against the current DOM and re-emits whatever
|
|
106
|
+
* changed, updating already-recorded nodes mid-session. Call after toggling
|
|
107
|
+
* `data-openreplay-*` attributes or after changing whatever your `domSanitizer`
|
|
108
|
+
* keys on (class/id/etc).
|
|
109
|
+
*
|
|
110
|
+
* @param el - the highest node you changed; omit to re-scan the whole document.
|
|
111
|
+
* */
|
|
112
|
+
resanitize(el?: Element): void;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the sanitization level the tracker currently has for a node
|
|
115
|
+
* (0 = Plain, 1 = Obscured, 2 = Hidden), or undefined if it isn't tracked.
|
|
116
|
+
* */
|
|
117
|
+
checkSanitization(el: Node): import("./index.js").SanitizeLevel | undefined;
|
|
118
|
+
incident(options: {
|
|
119
|
+
label?: string;
|
|
120
|
+
startTime: number;
|
|
121
|
+
endTime?: number;
|
|
122
|
+
}): void;
|
|
123
|
+
/**
|
|
124
|
+
* Use custom token for analytics events without session recording
|
|
125
|
+
* */
|
|
126
|
+
setAnalyticsToken(token: string): void;
|
|
127
|
+
getAnalyticsToken(): string | undefined;
|
|
104
128
|
}
|
|
105
129
|
declare const tracker: TrackerSingleton;
|
|
106
130
|
export default tracker;
|