@openreplay/tracker 11.0.6 → 12.0.0-beta.99
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 +4 -2
- package/cjs/app/index.d.ts +88 -9
- package/cjs/app/index.js +492 -125
- package/cjs/app/logger.d.ts +7 -17
- package/cjs/app/logger.js +11 -19
- package/cjs/app/messages.gen.d.ts +2 -0
- package/cjs/app/messages.gen.js +20 -1
- package/cjs/app/observer/iframe_observer.js +4 -1
- package/cjs/app/observer/shadow_root_observer.js +4 -1
- package/cjs/app/observer/top_observer.js +7 -4
- package/cjs/app/workerManager/QueueSender.d.ts +23 -0
- package/cjs/app/workerManager/QueueSender.js +126 -0
- package/cjs/app/workerManager/index.d.ts +37 -0
- package/cjs/app/workerManager/index.js +167 -0
- package/cjs/common/interaction.d.ts +56 -18
- package/cjs/common/messages.gen.d.ts +17 -2
- package/cjs/index.d.ts +45 -2
- package/cjs/index.js +237 -106
- package/cjs/modules/Network/beaconProxy.js +4 -1
- package/cjs/modules/Network/fetchProxy.js +24 -1
- package/cjs/modules/Network/index.js +6 -3
- package/cjs/modules/Network/xhrProxy.js +24 -1
- package/cjs/modules/conditionsManager.d.ts +84 -0
- package/cjs/modules/conditionsManager.js +343 -0
- package/cjs/modules/exception.js +4 -1
- package/cjs/modules/featureFlags.d.ts +1 -1
- package/cjs/modules/featureFlags.js +36 -46
- package/cjs/modules/network.js +5 -2
- package/cjs/modules/tagWatcher.d.ts +21 -0
- package/cjs/modules/tagWatcher.js +77 -0
- package/cjs/modules/userTesting/index.js +30 -4
- package/cjs/modules/userTesting/recorder.js +71 -88
- package/coverage/clover.xml +577 -544
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/index.html +28 -28
- package/coverage/lcov-report/main/app/canvas.ts.html +97 -46
- package/coverage/lcov-report/main/app/guards.ts.html +1 -1
- package/coverage/lcov-report/main/app/index.html +19 -19
- package/coverage/lcov-report/main/app/index.ts.html +62 -35
- package/coverage/lcov-report/main/app/logger.ts.html +1 -1
- package/coverage/lcov-report/main/app/messages.gen.ts.html +32 -5
- package/coverage/lcov-report/main/app/nodes.ts.html +17 -5
- package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/index.html +1 -1
- package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/top_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/sanitizer.ts.html +1 -1
- package/coverage/lcov-report/main/app/session.ts.html +1 -1
- package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
- package/coverage/lcov-report/main/index.html +9 -9
- package/coverage/lcov-report/main/index.ts.html +27 -6
- package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/index.html +1 -1
- package/coverage/lcov-report/main/modules/Network/index.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/utils.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/attributeSender.ts.html +1 -1
- package/coverage/lcov-report/main/modules/axiosSpy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/conditionsManager.ts.html +92 -38
- package/coverage/lcov-report/main/modules/connection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/console.ts.html +1 -1
- package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +1 -1
- package/coverage/lcov-report/main/modules/cssrules.ts.html +1 -1
- package/coverage/lcov-report/main/modules/exception.ts.html +1 -1
- package/coverage/lcov-report/main/modules/featureFlags.ts.html +1 -1
- package/coverage/lcov-report/main/modules/focus.ts.html +1 -1
- package/coverage/lcov-report/main/modules/fonts.ts.html +1 -1
- package/coverage/lcov-report/main/modules/img.ts.html +1 -1
- package/coverage/lcov-report/main/modules/index.html +21 -21
- package/coverage/lcov-report/main/modules/input.ts.html +1 -1
- package/coverage/lcov-report/main/modules/mouse.ts.html +1 -1
- package/coverage/lcov-report/main/modules/network.ts.html +1 -1
- package/coverage/lcov-report/main/modules/performance.ts.html +1 -1
- package/coverage/lcov-report/main/modules/scroll.ts.html +1 -1
- package/coverage/lcov-report/main/modules/selection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tabs.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tagWatcher.ts.html +54 -27
- package/coverage/lcov-report/main/modules/timing.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/index.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/index.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +1 -1
- package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
- package/coverage/lcov-report/main/utils.ts.html +1 -1
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +1 -1
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +17 -5
- package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +1 -1
- package/coverage/lcov-report/webworker/QueueSender.ts.html +1 -1
- package/coverage/lcov-report/webworker/index.html +7 -7
- package/coverage/lcov-report/webworker/index.ts.html +1 -1
- package/coverage/lcov.info +1100 -1033
- package/lib/app/index.d.ts +88 -9
- package/lib/app/index.js +452 -111
- package/lib/app/logger.d.ts +7 -17
- package/lib/app/logger.js +11 -19
- package/lib/app/messages.gen.d.ts +2 -0
- package/lib/app/messages.gen.js +17 -0
- package/lib/app/workerManager/QueueSender.d.ts +23 -0
- package/lib/app/workerManager/QueueSender.js +123 -0
- package/lib/app/workerManager/index.d.ts +37 -0
- package/lib/app/workerManager/index.js +162 -0
- package/lib/common/interaction.d.ts +56 -18
- package/lib/common/messages.gen.d.ts +17 -2
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/index.d.ts +45 -2
- package/lib/index.js +191 -86
- package/lib/modules/conditionsManager.d.ts +84 -0
- package/lib/modules/conditionsManager.js +340 -0
- package/lib/modules/featureFlags.d.ts +1 -1
- package/lib/modules/featureFlags.js +36 -46
- package/lib/modules/tagWatcher.d.ts +21 -0
- package/lib/modules/tagWatcher.js +74 -0
- package/lib/modules/userTesting/recorder.js +71 -88
- package/package.json +1 -1
- package/tsconfig-base.json +3 -2
package/CHANGELOG.md
CHANGED
package/cjs/app/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FeatureFlags from '../modules/featureFlags.js';
|
|
2
|
+
import Message from './messages.gen.js';
|
|
2
3
|
import Nodes from './nodes.js';
|
|
3
4
|
import Observer from './observer/top_observer.js';
|
|
4
5
|
import Sanitizer from './sanitizer.js';
|
|
5
6
|
import Ticker from './ticker.js';
|
|
6
|
-
import Logger from './logger.js';
|
|
7
|
+
import Logger, { ILogLevel } from './logger.js';
|
|
7
8
|
import Session from './session.js';
|
|
8
9
|
import AttributeSender from '../modules/attributeSender.js';
|
|
9
10
|
import type { Options as ObserverOptions } from './observer/top_observer.js';
|
|
10
11
|
import type { Options as SanitizerOptions } from './sanitizer.js';
|
|
11
|
-
import type { Options as LoggerOptions } from './logger.js';
|
|
12
12
|
import type { Options as SessOptions } from './session.js';
|
|
13
13
|
import type { Options as NetworkOptions } from '../modules/network.js';
|
|
14
|
-
import type { Options as WebworkerOptions } from '../common/interaction.js';
|
|
14
|
+
import type { Options as WebworkerOptions, FromWorkerData } from '../common/interaction.js';
|
|
15
15
|
export interface StartOptions {
|
|
16
16
|
userID?: string;
|
|
17
17
|
metadata?: Record<string, string>;
|
|
@@ -46,22 +46,23 @@ type AppOptions = {
|
|
|
46
46
|
local_uuid_key: string;
|
|
47
47
|
ingestPoint: string;
|
|
48
48
|
resourceBaseHref: string | null;
|
|
49
|
-
verbose: boolean;
|
|
50
49
|
__is_snippet: boolean;
|
|
51
50
|
__debug_report_edp: string | null;
|
|
52
|
-
__debug__?:
|
|
51
|
+
__debug__?: ILogLevel;
|
|
53
52
|
__save_canvas_locally?: boolean;
|
|
54
53
|
localStorage: Storage | null;
|
|
55
54
|
sessionStorage: Storage | null;
|
|
56
55
|
forceSingleTab?: boolean;
|
|
57
56
|
disableStringDict?: boolean;
|
|
58
57
|
assistSocketHost?: string;
|
|
58
|
+
/** @deprecated */
|
|
59
59
|
onStart?: StartCallback;
|
|
60
60
|
network?: NetworkOptions;
|
|
61
61
|
} & WebworkerOptions & SessOptions;
|
|
62
62
|
export type Options = AppOptions & ObserverOptions & SanitizerOptions;
|
|
63
63
|
export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";
|
|
64
64
|
export default class App {
|
|
65
|
+
private readonly signalError;
|
|
65
66
|
readonly nodes: Nodes;
|
|
66
67
|
readonly ticker: Ticker;
|
|
67
68
|
readonly projectKey: string;
|
|
@@ -72,6 +73,12 @@ export default class App {
|
|
|
72
73
|
readonly localStorage: Storage;
|
|
73
74
|
readonly sessionStorage: Storage;
|
|
74
75
|
private readonly messages;
|
|
76
|
+
/**
|
|
77
|
+
* we need 2 buffers, so we don't lose anything
|
|
78
|
+
* @read coldStart implementation
|
|
79
|
+
* */
|
|
80
|
+
private bufferedMessages1;
|
|
81
|
+
private readonly bufferedMessages2;
|
|
75
82
|
readonly observer: Observer;
|
|
76
83
|
private readonly startCallbacks;
|
|
77
84
|
private readonly stopCallbacks;
|
|
@@ -81,7 +88,7 @@ export default class App {
|
|
|
81
88
|
private readonly revID;
|
|
82
89
|
private activityState;
|
|
83
90
|
private readonly version;
|
|
84
|
-
private readonly
|
|
91
|
+
private readonly workerManager?;
|
|
85
92
|
private compressionThreshold;
|
|
86
93
|
private restartAttempts;
|
|
87
94
|
private readonly bc;
|
|
@@ -89,11 +96,29 @@ export default class App {
|
|
|
89
96
|
attributeSender: AttributeSender;
|
|
90
97
|
private canvasRecorder;
|
|
91
98
|
private uxtManager;
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
private conditionsManager;
|
|
100
|
+
featureFlags: FeatureFlags;
|
|
101
|
+
private readonly tagWatcher;
|
|
102
|
+
constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void);
|
|
103
|
+
handleWorkerMsg(data: FromWorkerData): void;
|
|
104
|
+
private readonly _debug;
|
|
94
105
|
private _usingOldFetchPlugin;
|
|
95
106
|
send(message: Message, urgent?: boolean): void;
|
|
107
|
+
/**
|
|
108
|
+
* Normal workflow: add timestamp and tab data to batch, then commit it
|
|
109
|
+
* every ~30ms
|
|
110
|
+
* */
|
|
111
|
+
private _nCommit;
|
|
112
|
+
coldStartCommitN: number;
|
|
113
|
+
/**
|
|
114
|
+
* Cold start: add timestamp and tab data to both batches
|
|
115
|
+
* every 2nd tick, ~60ms
|
|
116
|
+
* this will make batches a bit larger and replay will work with bigger jumps every frame
|
|
117
|
+
* but in turn we don't overload batch writer on session start with 1000 batches
|
|
118
|
+
* */
|
|
119
|
+
private _cStartCommit;
|
|
96
120
|
private commit;
|
|
121
|
+
private postToWorker;
|
|
97
122
|
private delay;
|
|
98
123
|
timestamp(): number;
|
|
99
124
|
safe<T extends (this: any, ...args: any[]) => void>(fn: T): T;
|
|
@@ -127,8 +152,55 @@ export default class App {
|
|
|
127
152
|
isServiceURL(url: string): boolean;
|
|
128
153
|
active(): boolean;
|
|
129
154
|
resetNextPageSession(flag: boolean): void;
|
|
155
|
+
coldInterval: ReturnType<typeof setInterval> | null;
|
|
156
|
+
orderNumber: number;
|
|
157
|
+
coldStartTs: number;
|
|
158
|
+
singleBuffer: boolean;
|
|
159
|
+
private checkSessionToken;
|
|
160
|
+
/**
|
|
161
|
+
* start buffering messages without starting the actual session, which gives
|
|
162
|
+
* user 30 seconds to "activate" and record session by calling `start()` on conditional trigger,
|
|
163
|
+
* and we will then send buffered batch, so it won't get lost
|
|
164
|
+
* */
|
|
165
|
+
coldStart(startOpts?: StartOptions, conditional?: boolean): Promise<void>;
|
|
166
|
+
onSessionSent: () => void;
|
|
167
|
+
/**
|
|
168
|
+
* Starts offline session recording
|
|
169
|
+
* @param {Object} startOpts - options for session start, same as .start()
|
|
170
|
+
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
171
|
+
* */
|
|
172
|
+
offlineRecording(startOpts: StartOptions | undefined, onSessionSent: () => void): {
|
|
173
|
+
saveBuffer: () => void;
|
|
174
|
+
getBuffer: () => Message[];
|
|
175
|
+
setBuffer: (buffer: Message[]) => void;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Saves the captured messages in localStorage (or whatever is used in its place)
|
|
179
|
+
*
|
|
180
|
+
* Then, when this.offlineRecording is called, it will preload this messages and clear the storage item
|
|
181
|
+
*
|
|
182
|
+
* Keeping the size of local storage reasonable is up to the end users of this library
|
|
183
|
+
* */
|
|
184
|
+
saveBuffer(): void;
|
|
185
|
+
/**
|
|
186
|
+
* @returns buffer with stored messages for offline recording
|
|
187
|
+
* */
|
|
188
|
+
getBuffer(): Message[];
|
|
189
|
+
/**
|
|
190
|
+
* Used to set a buffer with messages array
|
|
191
|
+
* */
|
|
192
|
+
setBuffer(buffer: Message[]): void;
|
|
193
|
+
/**
|
|
194
|
+
* Uploads the stored session buffer to backend
|
|
195
|
+
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
196
|
+
* so the session can be uploaded properly
|
|
197
|
+
* @resolve - if messages were loaded in service worker successfully
|
|
198
|
+
* @reject {string} - error message
|
|
199
|
+
* */
|
|
200
|
+
uploadOfflineRecording(): Promise<void>;
|
|
130
201
|
private _start;
|
|
131
202
|
restartCanvasTracking: () => void;
|
|
203
|
+
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
132
204
|
onUxtCb: never[];
|
|
133
205
|
addOnUxtCb(cb: (id: number) => void): void;
|
|
134
206
|
getUxtId(): number | null;
|
|
@@ -139,6 +211,13 @@ export default class App {
|
|
|
139
211
|
start(...args: Parameters<App['_start']>): Promise<StartPromiseReturn>;
|
|
140
212
|
forceFlushBatch(): void;
|
|
141
213
|
getTabId(): string;
|
|
214
|
+
clearBuffers(): void;
|
|
215
|
+
/**
|
|
216
|
+
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
217
|
+
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
218
|
+
* @returns {(msgType: string, data: string, dir: "up" | "down") => void}
|
|
219
|
+
* */
|
|
220
|
+
trackWs(channelName: string): (msgType: string, data: string, dir: 'up' | 'down') => void;
|
|
142
221
|
stop(stopWorker?: boolean): void;
|
|
143
222
|
}
|
|
144
223
|
export {};
|