@openreplay/tracker 11.0.6 → 12.0.0-beta.9
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 +84 -6
- package/cjs/app/index.js +427 -58
- 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/common/interaction.d.ts +5 -2
- 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 +344 -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 +76 -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 +84 -6
- package/lib/app/index.js +387 -44
- 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/common/interaction.d.ts +5 -2
- 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 +341 -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 +73 -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,14 +1,14 @@
|
|
|
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
14
|
import type { Options as WebworkerOptions } from '../common/interaction.js';
|
|
@@ -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;
|
|
@@ -89,11 +96,28 @@ export default class App {
|
|
|
89
96
|
attributeSender: AttributeSender;
|
|
90
97
|
private canvasRecorder;
|
|
91
98
|
private uxtManager;
|
|
92
|
-
|
|
99
|
+
private conditionsManager;
|
|
100
|
+
featureFlags: FeatureFlags;
|
|
101
|
+
private tagWatcher;
|
|
102
|
+
constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void);
|
|
93
103
|
private _debug;
|
|
94
104
|
private _usingOldFetchPlugin;
|
|
95
105
|
send(message: Message, urgent?: boolean): void;
|
|
106
|
+
/**
|
|
107
|
+
* Normal workflow: add timestamp and tab data to batch, then commit it
|
|
108
|
+
* every ~30ms
|
|
109
|
+
* */
|
|
110
|
+
private _nCommit;
|
|
111
|
+
coldStartCommitN: number;
|
|
112
|
+
/**
|
|
113
|
+
* Cold start: add timestamp and tab data to both batches
|
|
114
|
+
* every 2nd tick, ~60ms
|
|
115
|
+
* this will make batches a bit larger and replay will work with bigger jumps every frame
|
|
116
|
+
* but in turn we don't overload batch writer on session start with 1000 batches
|
|
117
|
+
* */
|
|
118
|
+
private _cStartCommit;
|
|
96
119
|
private commit;
|
|
120
|
+
private postToWorker;
|
|
97
121
|
private delay;
|
|
98
122
|
timestamp(): number;
|
|
99
123
|
safe<T extends (this: any, ...args: any[]) => void>(fn: T): T;
|
|
@@ -127,8 +151,55 @@ export default class App {
|
|
|
127
151
|
isServiceURL(url: string): boolean;
|
|
128
152
|
active(): boolean;
|
|
129
153
|
resetNextPageSession(flag: boolean): void;
|
|
154
|
+
coldInterval: ReturnType<typeof setInterval> | null;
|
|
155
|
+
orderNumber: number;
|
|
156
|
+
coldStartTs: number;
|
|
157
|
+
singleBuffer: boolean;
|
|
158
|
+
private checkSessionToken;
|
|
159
|
+
/**
|
|
160
|
+
* start buffering messages without starting the actual session, which gives
|
|
161
|
+
* user 30 seconds to "activate" and record session by calling `start()` on conditional trigger
|
|
162
|
+
* and we will then send buffered batch, so it won't get lost
|
|
163
|
+
* */
|
|
164
|
+
coldStart(startOpts?: StartOptions, conditional?: boolean): Promise<void>;
|
|
165
|
+
onSessionSent: () => void;
|
|
166
|
+
/**
|
|
167
|
+
* Starts offline session recording
|
|
168
|
+
* @param {Object} startOpts - options for session start, same as .start()
|
|
169
|
+
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
170
|
+
* */
|
|
171
|
+
offlineRecording(startOpts: StartOptions | undefined, onSessionSent: () => void): {
|
|
172
|
+
saveBuffer: () => void;
|
|
173
|
+
getBuffer: () => Message[];
|
|
174
|
+
setBuffer: (buffer: Message[]) => void;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Saves the captured messages in localStorage (or whatever is used in its place)
|
|
178
|
+
*
|
|
179
|
+
* Then when this.offlineRecording is called, it will preload this messages and clear the storage item
|
|
180
|
+
*
|
|
181
|
+
* Keeping the size of local storage reasonable is up to the end users of this library
|
|
182
|
+
* */
|
|
183
|
+
saveBuffer(): void;
|
|
184
|
+
/**
|
|
185
|
+
* @returns buffer with stored messages for offline recording
|
|
186
|
+
* */
|
|
187
|
+
getBuffer(): Message[];
|
|
188
|
+
/**
|
|
189
|
+
* Used to set a buffer with messages array
|
|
190
|
+
* */
|
|
191
|
+
setBuffer(buffer: Message[]): void;
|
|
192
|
+
/**
|
|
193
|
+
* Uploads the stored session buffer to backend
|
|
194
|
+
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
195
|
+
* so the session can be uploaded properly
|
|
196
|
+
* @resolve {boolean} - if messages were loaded successfully
|
|
197
|
+
* @reject {string} - error message
|
|
198
|
+
* */
|
|
199
|
+
uploadOfflineRecording(): Promise<void>;
|
|
130
200
|
private _start;
|
|
131
201
|
restartCanvasTracking: () => void;
|
|
202
|
+
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
132
203
|
onUxtCb: never[];
|
|
133
204
|
addOnUxtCb(cb: (id: number) => void): void;
|
|
134
205
|
getUxtId(): number | null;
|
|
@@ -139,6 +210,13 @@ export default class App {
|
|
|
139
210
|
start(...args: Parameters<App['_start']>): Promise<StartPromiseReturn>;
|
|
140
211
|
forceFlushBatch(): void;
|
|
141
212
|
getTabId(): string;
|
|
213
|
+
clearBuffers(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
216
|
+
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
217
|
+
* @returns {(msgType: string, data: string, dir: "up" | "down") => void}
|
|
218
|
+
* */
|
|
219
|
+
trackWs(channelName: string): (msgType: string, data: string, dir: 'up' | 'down') => void;
|
|
142
220
|
stop(stopWorker?: boolean): void;
|
|
143
221
|
}
|
|
144
222
|
export {};
|