@openreplay/tracker 16.4.11-beta.0 → 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 +1 -44
- package/dist/cjs/entry.js +1584 -2177
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +1566 -2135
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/canvas.d.ts +11 -0
- package/dist/cjs/main/app/index.d.ts +2 -7
- package/dist/cjs/main/app/messages.gen.d.ts +0 -5
- package/dist/cjs/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/cjs/main/app/nodes/index.d.ts +2 -1
- package/dist/cjs/main/app/observer/top_observer.d.ts +2 -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 +22 -17
- 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/mouse.d.ts +1 -0
- package/dist/cjs/main/modules/viewport.d.ts +7 -0
- package/dist/cjs/main/singleton.d.ts +5 -7
- package/dist/cjs/main/utils.d.ts +2 -0
- package/dist/lib/common/messages.gen.d.ts +1 -44
- package/dist/lib/entry.js +1583 -2178
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +1566 -2135
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/canvas.d.ts +11 -0
- package/dist/lib/main/app/index.d.ts +2 -7
- package/dist/lib/main/app/messages.gen.d.ts +0 -5
- package/dist/lib/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/lib/main/app/nodes/index.d.ts +2 -1
- package/dist/lib/main/app/observer/top_observer.d.ts +2 -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 +22 -17
- 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/mouse.d.ts +1 -0
- package/dist/lib/main/modules/viewport.d.ts +7 -0
- package/dist/lib/main/singleton.d.ts +5 -7
- package/dist/lib/main/utils.d.ts +2 -0
- package/dist/types/common/messages.gen.d.ts +1 -44
- package/dist/types/main/app/canvas.d.ts +11 -0
- package/dist/types/main/app/index.d.ts +2 -7
- package/dist/types/main/app/messages.gen.d.ts +0 -5
- package/dist/types/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/types/main/app/nodes/index.d.ts +2 -1
- package/dist/types/main/app/observer/top_observer.d.ts +2 -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 +22 -17
- 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/mouse.d.ts +1 -0
- package/dist/types/main/modules/viewport.d.ts +7 -0
- package/dist/types/main/singleton.d.ts +5 -7
- package/dist/types/main/utils.d.ts +2 -0
- package/package.json +1 -1
- 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;
|
|
@@ -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,20 +151,18 @@ 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;
|
|
165
162
|
private rootId;
|
|
166
163
|
private pageFrames;
|
|
167
164
|
private frameOderNumber;
|
|
168
|
-
private
|
|
165
|
+
private frameLevel;
|
|
169
166
|
private emptyBatchCounter;
|
|
170
167
|
constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
|
|
171
168
|
/** used by child iframes for crossdomain only */
|
|
@@ -191,6 +188,7 @@ export default class App {
|
|
|
191
188
|
allowAppStart(): void;
|
|
192
189
|
private checkNodeId;
|
|
193
190
|
private initWorker;
|
|
191
|
+
private restart;
|
|
194
192
|
private handleWorkerMsg;
|
|
195
193
|
private _debug;
|
|
196
194
|
send: (message: Message, urgent?: boolean) => void;
|
|
@@ -293,9 +291,6 @@ export default class App {
|
|
|
293
291
|
private _start;
|
|
294
292
|
restartCanvasTracking: () => void;
|
|
295
293
|
flushBuffer: (buffer: Message[]) => Promise<unknown>;
|
|
296
|
-
onUxtCb: never[];
|
|
297
|
-
addOnUxtCb(cb: (id: number) => void): void;
|
|
298
|
-
getUxtId(): number | null;
|
|
299
294
|
waitStart(): Promise<unknown>;
|
|
300
295
|
waitStarted(): Promise<unknown>;
|
|
301
296
|
waitStatus(status: ActivityState): Promise<unknown>;
|
|
@@ -28,9 +28,6 @@ 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
30
|
export declare function NodeAnimationResult(id: number, styles: string): Messages.NodeAnimationResult;
|
|
31
|
-
export declare function CSSInsertRule(id: number, rule: string, index: number): Messages.CSSInsertRule;
|
|
32
|
-
export declare function CSSDeleteRule(id: number, index: number): Messages.CSSDeleteRule;
|
|
33
|
-
export declare function Fetch(method: string, url: string, request: string, response: string, status: number, timestamp: number, duration: number): Messages.Fetch;
|
|
34
31
|
export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
|
|
35
32
|
export declare function OTable(key: string, value: string): Messages.OTable;
|
|
36
33
|
export declare function StateAction(type: string): Messages.StateAction;
|
|
@@ -49,13 +46,11 @@ export declare function ConnectionInformation(downlink: number, type: string): M
|
|
|
49
46
|
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
50
47
|
export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
|
|
51
48
|
export declare function SetNodeFocus(id: number): Messages.SetNodeFocus;
|
|
52
|
-
export declare function LongTask(timestamp: number, duration: number, context: number, containerType: number, containerSrc: string, containerId: string, containerName: string): Messages.LongTask;
|
|
53
49
|
export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
|
|
54
50
|
export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
|
|
55
51
|
export declare function TechnicalInfo(type: string, value: string): Messages.TechnicalInfo;
|
|
56
52
|
export declare function CustomIssue(name: string, payload: string): Messages.CustomIssue;
|
|
57
53
|
export declare function SetNodeSlot(id: number, slotID: number): Messages.SetNodeSlot;
|
|
58
|
-
export declare function CSSInsertRuleURLBased(id: number, rule: string, index: number, baseURL: string): Messages.CSSInsertRuleURLBased;
|
|
59
54
|
export declare function MouseClick(id: number, hesitationTime: number, label: string, selector: string, normalizedX: number, normalizedY: number): Messages.MouseClick;
|
|
60
55
|
export declare function MouseClickDeprecated(id: number, hesitationTime: number, label: string, selector: string): Messages.MouseClickDeprecated;
|
|
61
56
|
export declare function CreateIFrameDocument(frameID: number, id: number): Messages.CreateIFrameDocument;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const BITS_LEVEL = 2;
|
|
2
|
+
export declare const BITS_ORDER = 7;
|
|
3
|
+
export declare const BITS_NODE = 22;
|
|
4
|
+
export declare const SHIFT_ORDER = 22;
|
|
5
|
+
export declare const SHIFT_LEVEL: number;
|
|
6
|
+
export declare const MASK_NODE: number;
|
|
7
|
+
export declare const MASK_ORDER: number;
|
|
8
|
+
export declare const MASK_LEVEL: number;
|
|
9
|
+
export declare function pack(level: number, order: number, nodeId: number): number;
|
|
10
|
+
export declare function unpack(id: number): {
|
|
11
|
+
level: number;
|
|
12
|
+
order: number;
|
|
13
|
+
nodeId: number;
|
|
14
|
+
};
|
|
@@ -15,10 +15,11 @@ export default class Nodes {
|
|
|
15
15
|
private readonly forceNgOff;
|
|
16
16
|
private readonly maintainer;
|
|
17
17
|
constructor(params: NodesOptions);
|
|
18
|
-
|
|
18
|
+
crossdomainMode(level: number, frameOrder: number): void;
|
|
19
19
|
attachNodeCallback: (nodeCallback: NodeCallback) => number;
|
|
20
20
|
scanTree: (cb: (node: Node | void) => void) => void;
|
|
21
21
|
attachNodeListener: (node: Node, type: string, listener: EventListener, useCapture?: boolean) => void;
|
|
22
|
+
createFrameId: (level: number, frameOrder: number) => number;
|
|
22
23
|
registerNode(node: Node): [/*id:*/ number, /*isNew:*/ boolean];
|
|
23
24
|
unregisterNode: (node: Node) => number | undefined;
|
|
24
25
|
cleanTree(): void;
|
|
@@ -2,6 +2,7 @@ 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 */
|
|
@@ -45,7 +46,7 @@ export default class TopObserver extends Observer {
|
|
|
45
46
|
private shadowRootObservers;
|
|
46
47
|
private handleShadowRoot;
|
|
47
48
|
observe(): void;
|
|
48
|
-
crossdomainObserve(rootNodeId: number, frameOder: number): void;
|
|
49
|
+
crossdomainObserve(rootNodeId: number, frameOder: number, frameLevel: number): void;
|
|
49
50
|
disconnect(): void;
|
|
50
51
|
}
|
|
51
52
|
export {};
|
|
@@ -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';
|
|
@@ -28,28 +28,24 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
28
28
|
resetTabOnWindowOpen?: boolean;
|
|
29
29
|
network?: Partial<NetworkOptions>;
|
|
30
30
|
mouse?: Partial<MouseHandlerOptions>;
|
|
31
|
-
|
|
32
|
-
onFlagsLoad?: (flags: IFeatureFlag[]) => void;
|
|
33
|
-
};
|
|
31
|
+
customAttributes?: string[];
|
|
34
32
|
__DISABLE_SECURE_MODE?: boolean;
|
|
35
33
|
css: CssRulesOptions;
|
|
36
34
|
webAnimations?: WapOptions;
|
|
37
35
|
urls?: Partial<ViewportOptions>;
|
|
36
|
+
analytics?: {
|
|
37
|
+
ingestPoint?: string;
|
|
38
|
+
active?: boolean;
|
|
39
|
+
};
|
|
38
40
|
};
|
|
39
41
|
export default class API {
|
|
40
42
|
readonly options: Partial<Options>;
|
|
41
|
-
featureFlags: FeatureFlags;
|
|
42
43
|
private readonly app;
|
|
44
|
+
readonly analytics: AnalyticsSDK | null;
|
|
43
45
|
private readonly crossdomainMode;
|
|
44
46
|
constructor(options: Partial<Options>);
|
|
45
47
|
checkDoNotTrack: () => boolean | undefined;
|
|
46
48
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
47
|
-
isFlagEnabled(flagName: string): boolean;
|
|
48
|
-
onFlagsLoad(callback: (flags: IFeatureFlag[]) => void): void;
|
|
49
|
-
clearPersistFlags(): void;
|
|
50
|
-
reloadFlags(): Promise<void> | undefined;
|
|
51
|
-
getFeatureFlag(flagName: string): IFeatureFlag | undefined;
|
|
52
|
-
getAllFeatureFlags(): IFeatureFlag[] | undefined;
|
|
53
49
|
restartCanvasTracking: () => void;
|
|
54
50
|
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
55
51
|
isActive(): boolean;
|
|
@@ -101,13 +97,16 @@ export default class API {
|
|
|
101
97
|
getSessionInfo(): SessionInfo | null;
|
|
102
98
|
getSessionID(): string | null | undefined;
|
|
103
99
|
getTabId(): string | null;
|
|
104
|
-
getUxId(): number | null;
|
|
105
100
|
sessionID(): string | null | undefined;
|
|
106
|
-
getSessionURL(options?: {
|
|
101
|
+
getSessionURL: (options?: {
|
|
107
102
|
withCurrentTime?: boolean;
|
|
108
|
-
})
|
|
109
|
-
setUserID(id: string)
|
|
110
|
-
|
|
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;
|
|
111
110
|
setUserAnonymousID(id: string): void;
|
|
112
111
|
userAnonymousID(id: string): void;
|
|
113
112
|
setMetadata(key: string, value: string): void;
|
|
@@ -120,4 +119,10 @@ export default class API {
|
|
|
120
119
|
startTime: number;
|
|
121
120
|
endTime?: number;
|
|
122
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;
|
|
123
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 {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import Message, { CustomEvent, JSException, MouseClick, NetworkRequest, SetPageLocation } from '../../common/messages.gen.js';
|
|
2
2
|
import App, { StartOptions } from '../app/index.js';
|
|
3
|
-
|
|
3
|
+
export interface IFeatureFlag {
|
|
4
|
+
key: string;
|
|
5
|
+
is_persist: boolean;
|
|
6
|
+
value: string | boolean;
|
|
7
|
+
payload: string;
|
|
8
|
+
}
|
|
4
9
|
interface Filter {
|
|
5
10
|
filters: {
|
|
6
11
|
operator: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type App from '../app/index.js';
|
|
2
2
|
type TextFieldElement = HTMLInputElement | HTMLTextAreaElement;
|
|
3
|
-
export declare function getInputLabel(node: TextFieldElement): string;
|
|
3
|
+
export declare function getInputLabel(node: TextFieldElement, customAttributes?: string[]): string;
|
|
4
4
|
export declare const InputMode: {
|
|
5
5
|
readonly Plain: 0;
|
|
6
6
|
readonly Obscured: 1;
|
|
@@ -29,6 +29,7 @@ export interface Options {
|
|
|
29
29
|
* will override other settings.
|
|
30
30
|
* */
|
|
31
31
|
defaultInputMode: InputModeT;
|
|
32
|
+
customAttributes?: string[];
|
|
32
33
|
}
|
|
33
34
|
export default function (app: App, opts: Partial<Options>): void;
|
|
34
35
|
export {};
|
|
@@ -8,6 +8,7 @@ export interface MouseHandlerOptions {
|
|
|
8
8
|
* default 7 = 210ms
|
|
9
9
|
* */
|
|
10
10
|
trackingOffset?: number;
|
|
11
|
+
customAttributes?: string[];
|
|
11
12
|
}
|
|
12
13
|
export default function (app: App, options?: MouseHandlerOptions): void;
|
|
13
14
|
export declare function getCSSPath(el: any): string | false;
|
|
@@ -2,5 +2,12 @@ import type App from '../app/index.js';
|
|
|
2
2
|
export interface Options {
|
|
3
3
|
urlSanitizer?: (url: string) => string;
|
|
4
4
|
titleSanitizer?: (title: string) => string;
|
|
5
|
+
/** if present, tracker will remove hash symbol to present url as regular router url on replay level;
|
|
6
|
+
*
|
|
7
|
+
* applied BEFORE sanitizers.
|
|
8
|
+
*
|
|
9
|
+
* @example 'site.com/#/path' -> 'site.com/path'
|
|
10
|
+
*/
|
|
11
|
+
replaceHashSymbol?: boolean;
|
|
5
12
|
}
|
|
6
13
|
export default function (app: App, options?: Options): void;
|
|
@@ -17,6 +17,11 @@ declare class TrackerSingleton {
|
|
|
17
17
|
* */
|
|
18
18
|
stop(): string | undefined;
|
|
19
19
|
setUserID(id: string): void;
|
|
20
|
+
get analytics(): import("./entry.js").Analytics | null;
|
|
21
|
+
identify: (id: string) => void;
|
|
22
|
+
track: (eventName: string, properties?: Record<string, any>, options?: {
|
|
23
|
+
send_immediately: boolean;
|
|
24
|
+
}) => void;
|
|
20
25
|
/**
|
|
21
26
|
* Set metadata for the current session
|
|
22
27
|
*
|
|
@@ -36,12 +41,6 @@ declare class TrackerSingleton {
|
|
|
36
41
|
event(key: string, payload?: any, issue?: boolean): void;
|
|
37
42
|
issue(key: string, payload?: any): void;
|
|
38
43
|
handleError(e: Error | ErrorEvent | PromiseRejectionEvent, metadata?: Record<string, any>): void;
|
|
39
|
-
isFlagEnabled(flagName: string): boolean;
|
|
40
|
-
onFlagsLoad(...args: Parameters<Tracker['onFlagsLoad']>): void;
|
|
41
|
-
clearPersistFlags(): void;
|
|
42
|
-
reloadFlags(): Promise<void> | undefined;
|
|
43
|
-
getFeatureFlag(flagName: string): import("./modules/featureFlags.js").IFeatureFlag | undefined;
|
|
44
|
-
getAllFeatureFlags(): import("./modules/featureFlags.js").IFeatureFlag[] | undefined;
|
|
45
44
|
restartCanvasTracking(): void;
|
|
46
45
|
/**
|
|
47
46
|
* Set the anonymous user ID
|
|
@@ -102,7 +101,6 @@ declare class TrackerSingleton {
|
|
|
102
101
|
forceFlushBatch(): void;
|
|
103
102
|
getSessionInfo(): import("./app/session.js").SessionInfo | null;
|
|
104
103
|
getTabId(): string | null;
|
|
105
|
-
getUxId(): number | null;
|
|
106
104
|
}
|
|
107
105
|
declare const tracker: TrackerSingleton;
|
|
108
106
|
export default tracker;
|