@openreplay/tracker 16.4.10 → 16.4.11-beta.1
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/common/messages.gen.d.ts +53 -46
- package/dist/cjs/entry.js +2011 -2354
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +1993 -2312
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/canvas.d.ts +11 -0
- package/dist/cjs/main/app/guards.d.ts +1 -0
- package/dist/cjs/main/app/index.d.ts +6 -12
- package/dist/cjs/main/app/messages.gen.d.ts +7 -7
- package/dist/cjs/main/app/observer/observer.d.ts +4 -0
- package/dist/cjs/main/app/observer/top_observer.d.ts +3 -1
- package/dist/cjs/main/app/session.d.ts +1 -0
- package/dist/cjs/main/entry.d.ts +5 -4
- package/dist/cjs/main/index.d.ts +31 -18
- package/dist/cjs/main/modules/analytics/batcher.d.ts +45 -0
- package/dist/cjs/main/modules/analytics/constantProperties.d.ts +53 -0
- package/dist/cjs/main/modules/analytics/demo.d.ts +0 -0
- package/dist/cjs/main/modules/analytics/events.d.ts +37 -0
- package/dist/cjs/main/modules/analytics/index.d.ts +73 -0
- package/dist/cjs/main/modules/analytics/people.d.ts +51 -0
- package/dist/cjs/main/modules/analytics/types.d.ts +32 -0
- package/dist/cjs/main/modules/analytics/utils.d.ts +19 -0
- package/dist/cjs/main/modules/conditionsManager.d.ts +6 -1
- package/dist/cjs/main/modules/input.d.ts +2 -1
- package/dist/cjs/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/cjs/main/modules/mouse.d.ts +1 -0
- package/dist/cjs/main/modules/tagWatcher.d.ts +1 -1
- package/dist/cjs/main/modules/viewport.d.ts +7 -0
- package/dist/cjs/main/modules/webAnimations.d.ts +9 -0
- package/dist/cjs/main/singleton.d.ts +5 -7
- package/dist/cjs/main/utils.d.ts +5 -0
- package/dist/lib/common/messages.gen.d.ts +53 -46
- package/dist/lib/entry.js +2010 -2355
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +1993 -2312
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/canvas.d.ts +11 -0
- package/dist/lib/main/app/guards.d.ts +1 -0
- package/dist/lib/main/app/index.d.ts +6 -12
- package/dist/lib/main/app/messages.gen.d.ts +7 -7
- package/dist/lib/main/app/observer/observer.d.ts +4 -0
- package/dist/lib/main/app/observer/top_observer.d.ts +3 -1
- package/dist/lib/main/app/session.d.ts +1 -0
- package/dist/lib/main/entry.d.ts +5 -4
- package/dist/lib/main/index.d.ts +31 -18
- package/dist/lib/main/modules/analytics/batcher.d.ts +45 -0
- package/dist/lib/main/modules/analytics/constantProperties.d.ts +53 -0
- package/dist/lib/main/modules/analytics/demo.d.ts +0 -0
- package/dist/lib/main/modules/analytics/events.d.ts +37 -0
- package/dist/lib/main/modules/analytics/index.d.ts +73 -0
- package/dist/lib/main/modules/analytics/people.d.ts +51 -0
- package/dist/lib/main/modules/analytics/types.d.ts +32 -0
- package/dist/lib/main/modules/analytics/utils.d.ts +19 -0
- package/dist/lib/main/modules/conditionsManager.d.ts +6 -1
- package/dist/lib/main/modules/input.d.ts +2 -1
- package/dist/lib/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/lib/main/modules/mouse.d.ts +1 -0
- package/dist/lib/main/modules/tagWatcher.d.ts +1 -1
- package/dist/lib/main/modules/viewport.d.ts +7 -0
- package/dist/lib/main/modules/webAnimations.d.ts +9 -0
- package/dist/lib/main/singleton.d.ts +5 -7
- package/dist/lib/main/utils.d.ts +5 -0
- package/dist/types/common/messages.gen.d.ts +53 -46
- package/dist/types/main/app/canvas.d.ts +11 -0
- package/dist/types/main/app/guards.d.ts +1 -0
- package/dist/types/main/app/index.d.ts +6 -12
- package/dist/types/main/app/messages.gen.d.ts +7 -7
- package/dist/types/main/app/observer/observer.d.ts +4 -0
- package/dist/types/main/app/observer/top_observer.d.ts +3 -1
- package/dist/types/main/app/session.d.ts +1 -0
- package/dist/types/main/entry.d.ts +5 -4
- package/dist/types/main/index.d.ts +31 -18
- package/dist/types/main/modules/analytics/batcher.d.ts +45 -0
- package/dist/types/main/modules/analytics/constantProperties.d.ts +53 -0
- package/dist/types/main/modules/analytics/demo.d.ts +0 -0
- package/dist/types/main/modules/analytics/events.d.ts +37 -0
- package/dist/types/main/modules/analytics/index.d.ts +73 -0
- package/dist/types/main/modules/analytics/people.d.ts +51 -0
- package/dist/types/main/modules/analytics/types.d.ts +32 -0
- package/dist/types/main/modules/analytics/utils.d.ts +19 -0
- package/dist/types/main/modules/conditionsManager.d.ts +6 -1
- package/dist/types/main/modules/input.d.ts +2 -1
- package/dist/types/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/types/main/modules/mouse.d.ts +1 -0
- package/dist/types/main/modules/tagWatcher.d.ts +1 -1
- package/dist/types/main/modules/viewport.d.ts +7 -0
- package/dist/types/main/modules/webAnimations.d.ts +9 -0
- package/dist/types/main/singleton.d.ts +5 -7
- package/dist/types/main/utils.d.ts +5 -0
- package/package.json +2 -2
- package/dist/cjs/main/modules/featureFlags.d.ts +0 -25
- package/dist/cjs/main/modules/userTesting/SignalManager.d.ts +0 -29
- package/dist/cjs/main/modules/userTesting/dnd.d.ts +0 -1
- package/dist/cjs/main/modules/userTesting/index.d.ts +0 -45
- package/dist/cjs/main/modules/userTesting/recorder.d.ts +0 -24
- package/dist/cjs/main/modules/userTesting/styles.d.ts +0 -277
- package/dist/cjs/main/modules/userTesting/utils.d.ts +0 -9
- package/dist/lib/main/modules/featureFlags.d.ts +0 -25
- package/dist/lib/main/modules/userTesting/SignalManager.d.ts +0 -29
- package/dist/lib/main/modules/userTesting/dnd.d.ts +0 -1
- package/dist/lib/main/modules/userTesting/index.d.ts +0 -45
- package/dist/lib/main/modules/userTesting/recorder.d.ts +0 -24
- package/dist/lib/main/modules/userTesting/styles.d.ts +0 -277
- package/dist/lib/main/modules/userTesting/utils.d.ts +0 -9
- package/dist/types/main/modules/featureFlags.d.ts +0 -25
- package/dist/types/main/modules/userTesting/SignalManager.d.ts +0 -29
- package/dist/types/main/modules/userTesting/dnd.d.ts +0 -1
- package/dist/types/main/modules/userTesting/index.d.ts +0 -45
- package/dist/types/main/modules/userTesting/recorder.d.ts +0 -24
- package/dist/types/main/modules/userTesting/styles.d.ts +0 -277
- package/dist/types/main/modules/userTesting/utils.d.ts +0 -9
|
@@ -5,6 +5,8 @@ interface Options {
|
|
|
5
5
|
isDebug?: boolean;
|
|
6
6
|
fixedScaling?: boolean;
|
|
7
7
|
useAnimationFrame?: boolean;
|
|
8
|
+
framesSupport?: boolean;
|
|
9
|
+
/** @deprecated webp is the default format for pipeline optimization */
|
|
8
10
|
fileExt?: 'webp' | 'png' | 'jpeg' | 'avif';
|
|
9
11
|
}
|
|
10
12
|
declare class CanvasRecorder {
|
|
@@ -12,8 +14,14 @@ declare class CanvasRecorder {
|
|
|
12
14
|
private readonly options;
|
|
13
15
|
private snapshots;
|
|
14
16
|
private readonly intervals;
|
|
17
|
+
private readonly observers;
|
|
15
18
|
private readonly interval;
|
|
16
19
|
private readonly fileExt;
|
|
20
|
+
private uploadQueue;
|
|
21
|
+
private readonly MAX_CONCURRENT_UPLOADS;
|
|
22
|
+
private readonly MAX_QUEUE_SIZE;
|
|
23
|
+
private readonly pendingBatches;
|
|
24
|
+
private isProcessingQueue;
|
|
17
25
|
constructor(app: App, options: Options);
|
|
18
26
|
startTracking(): void;
|
|
19
27
|
restartTracking: () => void;
|
|
@@ -23,6 +31,9 @@ declare class CanvasRecorder {
|
|
|
23
31
|
data: Blob;
|
|
24
32
|
id: number;
|
|
25
33
|
}[], canvasId: number, createdAt: number): void;
|
|
34
|
+
private processUploadQueue;
|
|
35
|
+
private uploadBatch;
|
|
36
|
+
private cleanupCanvas;
|
|
26
37
|
clear(): void;
|
|
27
38
|
}
|
|
28
39
|
export default CanvasRecorder;
|
|
@@ -18,6 +18,7 @@ type TagTypeMap = {
|
|
|
18
18
|
style: HTMLStyleElement | SVGStyleElement;
|
|
19
19
|
link: HTMLLinkElement;
|
|
20
20
|
canvas: HTMLCanvasElement;
|
|
21
|
+
slot: HTMLSlotElement;
|
|
21
22
|
};
|
|
22
23
|
export declare function hasTag<T extends keyof TagTypeMap>(el: Node, tagName: T): el is TagTypeMap[typeof tagName];
|
|
23
24
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Options as WebworkerOptions } from '../../common/interaction.js';
|
|
2
2
|
import AttributeSender from '../modules/attributeSender.js';
|
|
3
|
-
import FeatureFlags from '../modules/featureFlags.js';
|
|
4
3
|
import type { Options as NetworkOptions } from '../modules/network.js';
|
|
5
4
|
import Logger, { ILogLevel } from './logger.js';
|
|
6
5
|
import Message from './messages.gen.js';
|
|
@@ -152,13 +151,11 @@ export default class App {
|
|
|
152
151
|
private readonly version;
|
|
153
152
|
private worker?;
|
|
154
153
|
attributeSender: AttributeSender;
|
|
155
|
-
featureFlags: FeatureFlags;
|
|
156
154
|
socketMode: boolean;
|
|
157
155
|
private compressionThreshold;
|
|
158
156
|
private readonly bc;
|
|
159
157
|
private readonly contextId;
|
|
160
158
|
private canvasRecorder;
|
|
161
|
-
private uxtManager;
|
|
162
159
|
private conditionsManager;
|
|
163
160
|
private readonly tagWatcher;
|
|
164
161
|
private canStart;
|
|
@@ -166,7 +163,6 @@ export default class App {
|
|
|
166
163
|
private pageFrames;
|
|
167
164
|
private frameOderNumber;
|
|
168
165
|
private frameLevel;
|
|
169
|
-
private features;
|
|
170
166
|
private emptyBatchCounter;
|
|
171
167
|
constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
|
|
172
168
|
/** used by child iframes for crossdomain only */
|
|
@@ -192,6 +188,7 @@ export default class App {
|
|
|
192
188
|
allowAppStart(): void;
|
|
193
189
|
private checkNodeId;
|
|
194
190
|
private initWorker;
|
|
191
|
+
private restart;
|
|
195
192
|
private handleWorkerMsg;
|
|
196
193
|
private _debug;
|
|
197
194
|
send: (message: Message, urgent?: boolean) => void;
|
|
@@ -253,7 +250,7 @@ export default class App {
|
|
|
253
250
|
* user 30 seconds to "activate" and record session by calling `start()` on conditional trigger,
|
|
254
251
|
* and we will then send buffered batch, so it won't get lost
|
|
255
252
|
* */
|
|
256
|
-
coldStart
|
|
253
|
+
coldStart(startOpts?: StartOptions, conditional?: boolean): Promise<void>;
|
|
257
254
|
private setupConditionalStart;
|
|
258
255
|
onSessionSent: () => void;
|
|
259
256
|
/**
|
|
@@ -261,7 +258,7 @@ export default class App {
|
|
|
261
258
|
* @param {Object} startOpts - options for session start, same as .start()
|
|
262
259
|
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
263
260
|
* */
|
|
264
|
-
offlineRecording
|
|
261
|
+
offlineRecording(startOpts: StartOptions | undefined, onSessionSent: () => void): {
|
|
265
262
|
saveBuffer: () => void;
|
|
266
263
|
getBuffer: () => Message[];
|
|
267
264
|
setBuffer: (buffer: Message[]) => void;
|
|
@@ -273,15 +270,15 @@ export default class App {
|
|
|
273
270
|
*
|
|
274
271
|
* Keeping the size of local storage reasonable is up to the end users of this library
|
|
275
272
|
* */
|
|
276
|
-
saveBuffer
|
|
273
|
+
saveBuffer(): void;
|
|
277
274
|
/**
|
|
278
275
|
* @returns buffer with stored messages for offline recording
|
|
279
276
|
* */
|
|
280
|
-
getBuffer
|
|
277
|
+
getBuffer(): Message[];
|
|
281
278
|
/**
|
|
282
279
|
* Used to set a buffer with messages array
|
|
283
280
|
* */
|
|
284
|
-
setBuffer
|
|
281
|
+
setBuffer(buffer: Message[]): void;
|
|
285
282
|
/**
|
|
286
283
|
* Uploads the stored session buffer to backend
|
|
287
284
|
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
@@ -294,9 +291,6 @@ export default class App {
|
|
|
294
291
|
private _start;
|
|
295
292
|
restartCanvasTracking: () => void;
|
|
296
293
|
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
297
|
-
onUxtCb: never[];
|
|
298
|
-
addOnUxtCb(cb: (id: number) => void): void;
|
|
299
|
-
getUxtId(): number | null;
|
|
300
294
|
waitStart(): Promise<unknown>;
|
|
301
295
|
waitStarted(): Promise<unknown>;
|
|
302
296
|
waitStatus(status: ActivityState): Promise<unknown>;
|
|
@@ -27,9 +27,7 @@ export declare function UserAnonymousID(id: string): Messages.UserAnonymousID;
|
|
|
27
27
|
export declare function Metadata(key: string, value: string): Messages.Metadata;
|
|
28
28
|
export declare function StringDictGlobal(key: number, value: string): Messages.StringDictGlobal;
|
|
29
29
|
export declare function SetNodeAttributeDictGlobal(id: number, name: number, value: number): Messages.SetNodeAttributeDictGlobal;
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function CSSDeleteRule(id: number, index: number): Messages.CSSDeleteRule;
|
|
32
|
-
export declare function Fetch(method: string, url: string, request: string, response: string, status: number, timestamp: number, duration: number): Messages.Fetch;
|
|
30
|
+
export declare function NodeAnimationResult(id: number, styles: string): Messages.NodeAnimationResult;
|
|
33
31
|
export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
|
|
34
32
|
export declare function OTable(key: string, value: string): Messages.OTable;
|
|
35
33
|
export declare function StateAction(type: string): Messages.StateAction;
|
|
@@ -43,17 +41,16 @@ export declare function StringDictDeprecated(key: number, value: string): Messag
|
|
|
43
41
|
export declare function SetNodeAttributeDictDeprecated(id: number, nameKey: number, valueKey: number): Messages.SetNodeAttributeDictDeprecated;
|
|
44
42
|
export declare function StringDict(key: string, value: string): Messages.StringDict;
|
|
45
43
|
export declare function SetNodeAttributeDict(id: number, name: string, value: string): Messages.SetNodeAttributeDict;
|
|
46
|
-
export declare function
|
|
44
|
+
export declare function ResourceTimingDeprecatedDeprecated(timestamp: number, duration: number, ttfb: number, headerSize: number, encodedBodySize: number, decodedBodySize: number, url: string, initiator: string): Messages.ResourceTimingDeprecatedDeprecated;
|
|
47
45
|
export declare function ConnectionInformation(downlink: number, type: string): Messages.ConnectionInformation;
|
|
48
46
|
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
49
47
|
export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
|
|
50
48
|
export declare function SetNodeFocus(id: number): Messages.SetNodeFocus;
|
|
51
|
-
export declare function LongTask(timestamp: number, duration: number, context: number, containerType: number, containerSrc: string, containerId: string, containerName: string): Messages.LongTask;
|
|
52
49
|
export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
|
|
53
50
|
export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
|
|
54
51
|
export declare function TechnicalInfo(type: string, value: string): Messages.TechnicalInfo;
|
|
55
52
|
export declare function CustomIssue(name: string, payload: string): Messages.CustomIssue;
|
|
56
|
-
export declare function
|
|
53
|
+
export declare function SetNodeSlot(id: number, slotID: number): Messages.SetNodeSlot;
|
|
57
54
|
export declare function MouseClick(id: number, hesitationTime: number, label: string, selector: string, normalizedX: number, normalizedY: number): Messages.MouseClick;
|
|
58
55
|
export declare function MouseClickDeprecated(id: number, hesitationTime: number, label: string, selector: string): Messages.MouseClickDeprecated;
|
|
59
56
|
export declare function CreateIFrameDocument(frameID: number, id: number): Messages.CreateIFrameDocument;
|
|
@@ -68,11 +65,14 @@ export declare function BatchMetadata(version: number, pageNo: number, firstInde
|
|
|
68
65
|
export declare function PartitionedMessage(partNo: number, partTotal: number): Messages.PartitionedMessage;
|
|
69
66
|
export declare function NetworkRequest(type: string, method: string, url: string, request: string, response: string, status: number, timestamp: number, duration: number, transferredBodySize: number): Messages.NetworkRequest;
|
|
70
67
|
export declare function WSChannel(chType: string, channelName: string, data: string, timestamp: number, dir: string, messageType: string): Messages.WSChannel;
|
|
68
|
+
export declare function ResourceTiming(timestamp: number, duration: number, ttfb: number, headerSize: number, encodedBodySize: number, decodedBodySize: number, url: string, initiator: string, transferredSize: number, cached: boolean, queueing: number, dnsLookup: number, initialConnection: number, ssl: number, contentDownload: number, total: number, stalled: number): Messages.ResourceTiming;
|
|
69
|
+
export declare function Incident(label: string, startTime: number, endTime: number): Messages.Incident;
|
|
70
|
+
export declare function LongAnimationTask(name: string, duration: number, blockingDuration: number, firstUIEventTimestamp: number, startTime: number, scripts: string): Messages.LongAnimationTask;
|
|
71
71
|
export declare function InputChange(id: number, value: string, valueMasked: boolean, label: string, hesitationTime: number, inputDuration: number): Messages.InputChange;
|
|
72
72
|
export declare function SelectionChange(selectionStart: number, selectionEnd: number, selection: string): Messages.SelectionChange;
|
|
73
73
|
export declare function MouseThrashing(timestamp: number): Messages.MouseThrashing;
|
|
74
74
|
export declare function UnbindNodes(totalRemovedPercent: number): Messages.UnbindNodes;
|
|
75
|
-
export declare function
|
|
75
|
+
export declare function ResourceTimingDeprecated(timestamp: number, duration: number, ttfb: number, headerSize: number, encodedBodySize: number, decodedBodySize: number, url: string, initiator: string, transferredSize: number, cached: boolean): Messages.ResourceTimingDeprecated;
|
|
76
76
|
export declare function TabChange(tabId: string): Messages.TabChange;
|
|
77
77
|
export declare function TabData(tabId: string): Messages.TabData;
|
|
78
78
|
export declare function CanvasNode(nodeId: string, timestamp: number): Messages.CanvasNode;
|
|
@@ -2,6 +2,7 @@ import App from '../index.js';
|
|
|
2
2
|
export declare function parseUseEl(useElement: SVGUseElement, mode: 'inline' | 'dataurl' | 'svgtext', domParser: DOMParser): Promise<any>;
|
|
3
3
|
interface Options {
|
|
4
4
|
disableSprites?: boolean;
|
|
5
|
+
disableThrottling?: boolean;
|
|
5
6
|
inlineRemoteCss?: boolean;
|
|
6
7
|
inlinerOptions?: {
|
|
7
8
|
forceFetch?: boolean;
|
|
@@ -17,6 +18,7 @@ export default abstract class Observer {
|
|
|
17
18
|
private readonly indexes;
|
|
18
19
|
private readonly attributesMap;
|
|
19
20
|
private readonly textSet;
|
|
21
|
+
private readonly slotMap;
|
|
20
22
|
private readonly disableSprites;
|
|
21
23
|
/**
|
|
22
24
|
* this option means that, instead of using link element with href to load css,
|
|
@@ -35,6 +37,8 @@ export default abstract class Observer {
|
|
|
35
37
|
*/
|
|
36
38
|
private handleIframeSrcChange;
|
|
37
39
|
private sendNodeAttribute;
|
|
40
|
+
throttling: boolean;
|
|
41
|
+
private throttledSetNodeData;
|
|
38
42
|
private sendNodeData;
|
|
39
43
|
private bindNode;
|
|
40
44
|
private bindTree;
|
|
@@ -2,11 +2,12 @@ import Observer from './observer.js';
|
|
|
2
2
|
import { Offset } from './iframe_offsets.js';
|
|
3
3
|
import App from '../index.js';
|
|
4
4
|
export declare enum InlineCssMode {
|
|
5
|
+
Unset = -1,
|
|
5
6
|
/** default behavior -- will parse and cache the css file on backend */
|
|
6
7
|
Disabled = 0,
|
|
7
8
|
/** will attempt to record the linked css file as AdoptedStyleSheet object */
|
|
8
9
|
Inline = 1,
|
|
9
|
-
/** will fetch the file, then
|
|
10
|
+
/** will fetch the file, then simulate AdoptedStyleSheets behavior programmaticaly for the replay */
|
|
10
11
|
InlineFetched = 2,
|
|
11
12
|
/** will fetch the file, then save it as plain css inside <style> node */
|
|
12
13
|
PlainFetched = 3
|
|
@@ -22,6 +23,7 @@ export interface Options {
|
|
|
22
23
|
* @default InlineCssMode.None = 0
|
|
23
24
|
* */
|
|
24
25
|
inlineCss: InlineCssMode;
|
|
26
|
+
disableThrottling?: boolean;
|
|
25
27
|
}
|
|
26
28
|
type Context = Window & typeof globalThis;
|
|
27
29
|
type ContextCallback = (context: Context) => void;
|
|
@@ -45,6 +45,7 @@ export default class Session {
|
|
|
45
45
|
getPageNumber: () => number | undefined;
|
|
46
46
|
incPageNo: () => number;
|
|
47
47
|
getSessionToken: (projectKey?: string) => string | undefined;
|
|
48
|
+
getRawTokenWithProject: () => string | null;
|
|
48
49
|
setSessionToken: (token: string, projectKey: string) => void;
|
|
49
50
|
applySessionHash(hash: string): void;
|
|
50
51
|
getSessionHash(): string | undefined;
|
package/dist/cjs/main/entry.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import TrackerClass from './index
|
|
2
|
-
export { default as App } from './app/index
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
import TrackerClass from './index';
|
|
2
|
+
export { default as App } from './app/index';
|
|
3
|
+
export { default as tracker, default as openReplay } from './singleton';
|
|
4
|
+
export { SanitizeLevel, Messages, Options } from './index';
|
|
5
|
+
export { default as Analytics } from './modules/analytics/index';
|
|
5
6
|
export default TrackerClass;
|
package/dist/cjs/main/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import App from './app/index
|
|
1
|
+
import App from './app/index';
|
|
2
2
|
export { default as App } from './app/index.js';
|
|
3
3
|
import * as _Messages from './app/messages.gen.js';
|
|
4
4
|
export declare const Messages: typeof _Messages;
|
|
5
5
|
export { SanitizeLevel } from './app/sanitizer.js';
|
|
6
|
-
import
|
|
6
|
+
import AnalyticsSDK from './modules/analytics/index.js';
|
|
7
7
|
import type { Options as AppOptions } from './app/index.js';
|
|
8
8
|
import type { Options as ConsoleOptions } from './modules/console.js';
|
|
9
9
|
import type { Options as ExceptionOptions } from './modules/exception.js';
|
|
@@ -14,10 +14,12 @@ import type { Options as NetworkOptions } from './modules/network.js';
|
|
|
14
14
|
import type { MouseHandlerOptions } from './modules/mouse.js';
|
|
15
15
|
import type { SessionInfo } from './app/session.js';
|
|
16
16
|
import type { CssRulesOptions } from './modules/cssrules.js';
|
|
17
|
+
import type { LATOptions } from './modules/longAnimationTask.js';
|
|
18
|
+
import type { Options as WapOptions } from './modules/webAnimations.js';
|
|
17
19
|
import type { Options as ViewportOptions } from './modules/viewport.js';
|
|
18
20
|
import type { StartOptions } from './app/index.js';
|
|
19
21
|
import type { StartPromiseReturn } from './app/index.js';
|
|
20
|
-
export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
|
|
22
|
+
export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions & LATOptions> & {
|
|
21
23
|
projectID?: number;
|
|
22
24
|
projectKey: string;
|
|
23
25
|
sessionToken?: string;
|
|
@@ -26,27 +28,24 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
26
28
|
resetTabOnWindowOpen?: boolean;
|
|
27
29
|
network?: Partial<NetworkOptions>;
|
|
28
30
|
mouse?: Partial<MouseHandlerOptions>;
|
|
29
|
-
|
|
30
|
-
onFlagsLoad?: (flags: IFeatureFlag[]) => void;
|
|
31
|
-
};
|
|
31
|
+
customAttributes?: string[];
|
|
32
32
|
__DISABLE_SECURE_MODE?: boolean;
|
|
33
33
|
css: CssRulesOptions;
|
|
34
|
+
webAnimations?: WapOptions;
|
|
34
35
|
urls?: Partial<ViewportOptions>;
|
|
36
|
+
analytics?: {
|
|
37
|
+
ingestPoint?: string;
|
|
38
|
+
active?: boolean;
|
|
39
|
+
};
|
|
35
40
|
};
|
|
36
41
|
export default class API {
|
|
37
42
|
readonly options: Partial<Options>;
|
|
38
|
-
featureFlags: FeatureFlags;
|
|
39
43
|
private readonly app;
|
|
44
|
+
readonly analytics: AnalyticsSDK | null;
|
|
40
45
|
private readonly crossdomainMode;
|
|
41
46
|
constructor(options: Partial<Options>);
|
|
42
47
|
checkDoNotTrack: () => boolean | undefined;
|
|
43
48
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
44
|
-
isFlagEnabled(flagName: string): boolean;
|
|
45
|
-
onFlagsLoad(callback: (flags: IFeatureFlag[]) => void): void;
|
|
46
|
-
clearPersistFlags(): void;
|
|
47
|
-
reloadFlags(): Promise<void> | undefined;
|
|
48
|
-
getFeatureFlag(flagName: string): IFeatureFlag | undefined;
|
|
49
|
-
getAllFeatureFlags(): IFeatureFlag[] | undefined;
|
|
50
49
|
restartCanvasTracking: () => void;
|
|
51
50
|
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
52
51
|
isActive(): boolean;
|
|
@@ -98,13 +97,16 @@ export default class API {
|
|
|
98
97
|
getSessionInfo(): SessionInfo | null;
|
|
99
98
|
getSessionID(): string | null | undefined;
|
|
100
99
|
getTabId(): string | null;
|
|
101
|
-
getUxId(): number | null;
|
|
102
100
|
sessionID(): string | null | undefined;
|
|
103
|
-
getSessionURL(options?: {
|
|
101
|
+
getSessionURL: (options?: {
|
|
104
102
|
withCurrentTime?: boolean;
|
|
105
|
-
})
|
|
106
|
-
setUserID(id: string)
|
|
107
|
-
|
|
103
|
+
}) => string | undefined;
|
|
104
|
+
setUserID: (id: string) => void;
|
|
105
|
+
identify: (id: string) => void;
|
|
106
|
+
track: ((eventName: string, properties?: Record<string, any>, options?: {
|
|
107
|
+
send_immediately: boolean;
|
|
108
|
+
}) => void) | undefined;
|
|
109
|
+
userID: (id: string) => void;
|
|
108
110
|
setUserAnonymousID(id: string): void;
|
|
109
111
|
userAnonymousID(id: string): void;
|
|
110
112
|
setMetadata(key: string, value: string): void;
|
|
@@ -112,4 +114,15 @@ export default class API {
|
|
|
112
114
|
event(key: string, payload?: any, issue?: boolean): void;
|
|
113
115
|
issue(key: string, payload?: any): void;
|
|
114
116
|
handleError: (e: Error | ErrorEvent | PromiseRejectionEvent, metadata?: Record<string, any>) => void;
|
|
117
|
+
incident: (options: {
|
|
118
|
+
label?: string;
|
|
119
|
+
startTime: number;
|
|
120
|
+
endTime?: number;
|
|
121
|
+
}) => void;
|
|
122
|
+
private analyticsToken;
|
|
123
|
+
/**
|
|
124
|
+
* Use custom token for analytics events without session recording
|
|
125
|
+
* */
|
|
126
|
+
setAnalyticsToken: (token: string) => void;
|
|
127
|
+
getAnalyticsToken: () => string;
|
|
115
128
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
interface PeopleEvent {
|
|
2
|
+
type: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
payload: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
interface Event {
|
|
7
|
+
name: string;
|
|
8
|
+
payload: Record<string, any>;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates batches of events, then sends them at intervals.
|
|
13
|
+
*/
|
|
14
|
+
declare class Batcher {
|
|
15
|
+
private readonly backendUrl;
|
|
16
|
+
private readonly getToken;
|
|
17
|
+
private readonly init;
|
|
18
|
+
private readonly autosendInterval;
|
|
19
|
+
private readonly retryTimeout;
|
|
20
|
+
private readonly retryLimit;
|
|
21
|
+
private readonly apiEdp;
|
|
22
|
+
private batch;
|
|
23
|
+
private intervalId;
|
|
24
|
+
constructor(backendUrl: string, getToken: () => string | null, init: () => Promise<void>);
|
|
25
|
+
getBatches(): {
|
|
26
|
+
data: {
|
|
27
|
+
user_actions: PeopleEvent[];
|
|
28
|
+
events: Event[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
addEvent(event: any): void;
|
|
32
|
+
sendImmediately(event: any): void;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* Essentially we're dividing the batch by identify events and squash all same category events into one in each part,
|
|
36
|
+
* taking priority to the last one
|
|
37
|
+
*/
|
|
38
|
+
dedupePeopleEvents(): PeopleEvent[];
|
|
39
|
+
private squashPeopleEvents;
|
|
40
|
+
private sendBatch;
|
|
41
|
+
startAutosend(): void;
|
|
42
|
+
flush(): void;
|
|
43
|
+
stop(): void;
|
|
44
|
+
}
|
|
45
|
+
export default Batcher;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface StorageLike {
|
|
2
|
+
getItem: (key: string) => string | null;
|
|
3
|
+
setItem: (key: string, value: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export default class ConstantProperties {
|
|
6
|
+
private readonly localStorage;
|
|
7
|
+
private readonly sessionStorage;
|
|
8
|
+
os: string;
|
|
9
|
+
osVersion: string;
|
|
10
|
+
browser: string;
|
|
11
|
+
browserVersion: string;
|
|
12
|
+
platform: string;
|
|
13
|
+
screenHeight: number;
|
|
14
|
+
screenWidth: number;
|
|
15
|
+
initialReferrer: string;
|
|
16
|
+
utmSource: string | null;
|
|
17
|
+
utmMedium: string | null;
|
|
18
|
+
utmCampaign: string | null;
|
|
19
|
+
deviceId: string;
|
|
20
|
+
searchEngine: string | null;
|
|
21
|
+
user_id: string | null;
|
|
22
|
+
constructor(localStorage: StorageLike, sessionStorage: StorageLike);
|
|
23
|
+
get all(): {
|
|
24
|
+
os: string;
|
|
25
|
+
os_version: string;
|
|
26
|
+
browser: string;
|
|
27
|
+
browser_version: string;
|
|
28
|
+
platform: string;
|
|
29
|
+
screen_height: number;
|
|
30
|
+
screen_width: number;
|
|
31
|
+
initial_referrer: string;
|
|
32
|
+
utm_source: string | null;
|
|
33
|
+
utm_medium: string | null;
|
|
34
|
+
utm_campaign: string | null;
|
|
35
|
+
user_id: string | null;
|
|
36
|
+
distinct_id: string;
|
|
37
|
+
sdk_edition: string;
|
|
38
|
+
sdk_version: string;
|
|
39
|
+
timezone: string;
|
|
40
|
+
search_engine: string | null;
|
|
41
|
+
};
|
|
42
|
+
setUserId: (user_id: string | null) => void;
|
|
43
|
+
resetUserId: (hard?: boolean) => void;
|
|
44
|
+
get defaultPropertyKeys(): string[];
|
|
45
|
+
get distinctId(): string;
|
|
46
|
+
private getDistinctDeviceId;
|
|
47
|
+
private getReferrer;
|
|
48
|
+
private parseUTM;
|
|
49
|
+
private getSearchEngine;
|
|
50
|
+
getSuperProperties: () => Record<string, any>;
|
|
51
|
+
saveSuperProperties: (props: Record<string, any>) => void;
|
|
52
|
+
clearSuperProperties: () => void;
|
|
53
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Batcher from './batcher.js';
|
|
2
|
+
import ConstantProperties from './constantProperties.js';
|
|
3
|
+
export default class Events {
|
|
4
|
+
private readonly constantProperties;
|
|
5
|
+
private readonly getTimestamp;
|
|
6
|
+
private readonly batcher;
|
|
7
|
+
ownProperties: Record<string, any>;
|
|
8
|
+
constructor(constantProperties: ConstantProperties, getTimestamp: () => number, batcher: Batcher);
|
|
9
|
+
/**
|
|
10
|
+
* Add event to batch with option to send it immediately,
|
|
11
|
+
* properties are optional and will not be saved as super prop
|
|
12
|
+
* */
|
|
13
|
+
sendEvent: (eventName: string, properties?: Record<string, any>, options?: {
|
|
14
|
+
send_immediately: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
/**
|
|
17
|
+
* creates super property for all events
|
|
18
|
+
* */
|
|
19
|
+
setProperty: (nameOrProperties: Record<string, any> | string, value?: any) => void;
|
|
20
|
+
/**
|
|
21
|
+
* set super property only if it doesn't exist yet
|
|
22
|
+
* */
|
|
23
|
+
setPropertiesOnce: (nameOrProperties: Record<string, any> | string, value?: any) => void;
|
|
24
|
+
/**
|
|
25
|
+
* removes properties from list of super properties
|
|
26
|
+
* */
|
|
27
|
+
unsetProperties: (properties: string | string[]) => void;
|
|
28
|
+
/** clears all super properties */
|
|
29
|
+
reset: () => void;
|
|
30
|
+
/** mixpanel compatibility */
|
|
31
|
+
register: (nameOrProperties: Record<string, any> | string, value?: any) => void;
|
|
32
|
+
register_once: (nameOrProperties: Record<string, any> | string, value?: any) => void;
|
|
33
|
+
unregister: (properties: string | string[]) => void;
|
|
34
|
+
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
35
|
+
send_immediately: boolean;
|
|
36
|
+
}) => void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ConstantProperties from './constantProperties.js';
|
|
2
|
+
import type { StorageLike } from './constantProperties.js';
|
|
3
|
+
import Events from './events.js';
|
|
4
|
+
import People from './people.js';
|
|
5
|
+
interface Options {
|
|
6
|
+
ingestPoint: string;
|
|
7
|
+
projectKey: string;
|
|
8
|
+
/** Storage class for persistent data */
|
|
9
|
+
localStorage?: StorageLike;
|
|
10
|
+
/** Storage class for data on a per-session basis */
|
|
11
|
+
sessionStorage?: StorageLike;
|
|
12
|
+
/** Used to request a custom session token when in not-standalone mode */
|
|
13
|
+
getToken?: () => string;
|
|
14
|
+
/** Used to get current timestamp when not in standalone mode */
|
|
15
|
+
getTimestamp?: () => number;
|
|
16
|
+
/** Callback for people.identify */
|
|
17
|
+
setUserId?: (user_id: string) => void;
|
|
18
|
+
/** automatically set when used inside openreplay tracker */
|
|
19
|
+
notStandalone?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export default class Analytics {
|
|
22
|
+
readonly events: Events;
|
|
23
|
+
readonly constantProperties: ConstantProperties;
|
|
24
|
+
readonly people: People;
|
|
25
|
+
private token;
|
|
26
|
+
private readonly batcher;
|
|
27
|
+
private readonly backendUrl;
|
|
28
|
+
private readonly projectKey;
|
|
29
|
+
private readonly localStorage;
|
|
30
|
+
private readonly sessionStorage;
|
|
31
|
+
private readonly getToken;
|
|
32
|
+
private readonly getTimestamp;
|
|
33
|
+
private readonly setUserId;
|
|
34
|
+
private readonly standalone;
|
|
35
|
+
/**
|
|
36
|
+
* @param localStorage Class or Object that implements Storage-like interface that stores
|
|
37
|
+
* values persistently like window.localStorage or any other file-based storage
|
|
38
|
+
*
|
|
39
|
+
* @param sessionStorage Class or Object that implements Storage-like interface that stores values
|
|
40
|
+
* on per-session basis like window.sessionStorage or any other in-memory storage
|
|
41
|
+
*
|
|
42
|
+
* @param getToken Function that returns token to bind events to a session
|
|
43
|
+
*
|
|
44
|
+
* @param getTimestamp returns current timestamp
|
|
45
|
+
*
|
|
46
|
+
* @param setUserId callback for people.identify
|
|
47
|
+
*
|
|
48
|
+
* @param standalone if true, analytics will manage its own token (instead of using with openreplay tracker session)
|
|
49
|
+
* */
|
|
50
|
+
constructor(options: Options);
|
|
51
|
+
_getToken: () => string | null;
|
|
52
|
+
_getTimestamp: () => number;
|
|
53
|
+
init: () => Promise<void>;
|
|
54
|
+
reset: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* COMPATIBILITY LAYER
|
|
57
|
+
* */
|
|
58
|
+
/**
|
|
59
|
+
* Identify a user with an id (e.g. email, username, etc.)
|
|
60
|
+
* will bind all events and properties (including device_id) to this user
|
|
61
|
+
*
|
|
62
|
+
* you will need to manually call people.reset() to clear the id on logout event
|
|
63
|
+
* */
|
|
64
|
+
identify: (user_id: string) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Add event to batch with option to send it immediately,
|
|
67
|
+
* properties are optional and will not be saved as super prop
|
|
68
|
+
* */
|
|
69
|
+
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
70
|
+
send_immediately: boolean;
|
|
71
|
+
}) => void;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Batcher from './batcher.js';
|
|
2
|
+
import ConstantProperties from './constantProperties.js';
|
|
3
|
+
type Value = string | number;
|
|
4
|
+
export default class People {
|
|
5
|
+
private readonly constantProperties;
|
|
6
|
+
private readonly getTimestamp;
|
|
7
|
+
private readonly onId;
|
|
8
|
+
private readonly batcher;
|
|
9
|
+
ownProperties: Record<string, Value | Value[]>;
|
|
10
|
+
constructor(constantProperties: ConstantProperties, getTimestamp: () => number, onId: (user_id: string) => void, batcher: Batcher);
|
|
11
|
+
identify: (user_id: string, options?: {
|
|
12
|
+
fromTracker: boolean;
|
|
13
|
+
}) => void;
|
|
14
|
+
/** Resets user id and own properties
|
|
15
|
+
*
|
|
16
|
+
* !hard reset will destroy persistent device id!
|
|
17
|
+
* */
|
|
18
|
+
reset: (hard?: boolean) => void;
|
|
19
|
+
get user_id(): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Will delete user and its data from backend, then reset all local properties
|
|
22
|
+
*/
|
|
23
|
+
deleteUser: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* set user properties, overwriting existing ones
|
|
26
|
+
* */
|
|
27
|
+
setProperties: (propertyOrObj: Record<string, string | number> | string, value?: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Set property if it doesn't exist yet
|
|
30
|
+
* */
|
|
31
|
+
setPropertiesOnce: (properties: Record<string, string | number>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Add value to property (will turn string prop into array)
|
|
34
|
+
* */
|
|
35
|
+
appendValues: (key: string, value: string | number) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Add unique values to property (will turn string prop into array)
|
|
38
|
+
* */
|
|
39
|
+
appendUniqueValues: (key: string, value: string | number) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Adds value (incl. negative) to existing numerical property
|
|
42
|
+
* */
|
|
43
|
+
increment: (key: string, value: number) => void;
|
|
44
|
+
/** mixpanel compatibility */
|
|
45
|
+
union: (key: string, value: string | number) => void;
|
|
46
|
+
set: (propertyOrObj: Record<string, string | number> | string, value?: string) => void;
|
|
47
|
+
set_once: (properties: Record<string, string | number>) => void;
|
|
48
|
+
append: (key: string, value: string | number) => void;
|
|
49
|
+
incrementBy: (key: string, value: number) => void;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const mutationTypes: {
|
|
2
|
+
identity: string;
|
|
3
|
+
deleteUser: string;
|
|
4
|
+
setProperty: string;
|
|
5
|
+
setPropertyOnce: string;
|
|
6
|
+
appendProperty: string;
|
|
7
|
+
appendUniqueProperty: string;
|
|
8
|
+
incrementProperty: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const categories: {
|
|
11
|
+
readonly people: "user_actions";
|
|
12
|
+
readonly events: "events";
|
|
13
|
+
};
|
|
14
|
+
export declare const createEvent: (category: (typeof categories)[keyof typeof categories], type?: (typeof mutationTypes)[keyof typeof mutationTypes], timestamp?: number, payload?: Record<string, any>) => {
|
|
15
|
+
category: "user_actions";
|
|
16
|
+
data: {
|
|
17
|
+
type: string | undefined;
|
|
18
|
+
user_id: any;
|
|
19
|
+
payload: any;
|
|
20
|
+
timestamp: number | undefined;
|
|
21
|
+
name?: undefined;
|
|
22
|
+
};
|
|
23
|
+
} | {
|
|
24
|
+
category: "events";
|
|
25
|
+
data: {
|
|
26
|
+
name: any;
|
|
27
|
+
payload: any;
|
|
28
|
+
timestamp: number | undefined;
|
|
29
|
+
type?: undefined;
|
|
30
|
+
user_id?: undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface ClientData {
|
|
2
|
+
screen: string;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
browser: string;
|
|
6
|
+
browserVersion: string;
|
|
7
|
+
browserMajorVersion: number;
|
|
8
|
+
mobile: boolean;
|
|
9
|
+
os: string;
|
|
10
|
+
osVersion: string;
|
|
11
|
+
cookies: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Detects client browser, OS, and device information
|
|
15
|
+
*/
|
|
16
|
+
export declare function uaParse(sWindow: Window & typeof globalThis): ClientData;
|
|
17
|
+
export declare function isObject(item: any): boolean;
|
|
18
|
+
export declare function getUTCOffsetString(): string;
|
|
19
|
+
export {};
|