@openreplay/tracker 16.0.2-beta.0 → 16.0.2
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/interaction.d.ts +2 -2
- package/dist/cjs/common/messages.gen.d.ts +1 -44
- package/dist/cjs/entry.js +9814 -0
- package/dist/cjs/entry.js.map +1 -0
- package/dist/cjs/index.js +59 -95
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/index.d.ts +0 -2
- package/dist/cjs/main/app/messages.gen.d.ts +0 -5
- package/dist/cjs/main/app/observer/observer.d.ts +5 -1
- package/dist/cjs/main/app/observer/top_observer.d.ts +1 -0
- package/dist/cjs/main/entry.d.ts +5 -0
- package/dist/cjs/main/index.d.ts +3 -3
- package/dist/cjs/main/modules/attributeSender.d.ts +2 -2
- package/dist/cjs/main/singleton.d.ts +108 -0
- package/dist/lib/common/interaction.d.ts +2 -2
- package/dist/lib/common/messages.gen.d.ts +1 -44
- package/dist/lib/entry.js +9807 -0
- package/dist/lib/entry.js.map +1 -0
- package/dist/lib/index.js +59 -95
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/index.d.ts +0 -2
- package/dist/lib/main/app/messages.gen.d.ts +0 -5
- package/dist/lib/main/app/observer/observer.d.ts +5 -1
- package/dist/lib/main/app/observer/top_observer.d.ts +1 -0
- package/dist/lib/main/entry.d.ts +5 -0
- package/dist/lib/main/index.d.ts +3 -3
- package/dist/lib/main/modules/attributeSender.d.ts +2 -2
- package/dist/lib/main/singleton.d.ts +108 -0
- package/dist/types/common/interaction.d.ts +2 -2
- package/dist/types/common/messages.gen.d.ts +1 -44
- package/dist/types/main/app/index.d.ts +0 -2
- package/dist/types/main/app/messages.gen.d.ts +0 -5
- package/dist/types/main/app/observer/observer.d.ts +5 -1
- package/dist/types/main/app/observer/top_observer.d.ts +1 -0
- package/dist/types/main/entry.d.ts +5 -0
- package/dist/types/main/index.d.ts +3 -3
- package/dist/types/main/modules/attributeSender.d.ts +2 -2
- package/dist/types/main/singleton.d.ts +108 -0
- package/package.json +11 -6
|
@@ -194,8 +194,6 @@ export default class App {
|
|
|
194
194
|
startTimeout: ReturnType<typeof setTimeout> | null;
|
|
195
195
|
allowAppStart(): void;
|
|
196
196
|
private checkNodeId;
|
|
197
|
-
heartbeatInterval: ReturnType<typeof setInterval> | null;
|
|
198
|
-
restartTimeout: ReturnType<typeof setTimeout> | null;
|
|
199
197
|
private initWorker;
|
|
200
198
|
private handleWorkerMsg;
|
|
201
199
|
private _debug;
|
|
@@ -27,9 +27,6 @@ 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 CSSInsertRule(id: number, rule: string, index: number): Messages.CSSInsertRule;
|
|
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;
|
|
33
30
|
export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
|
|
34
31
|
export declare function OTable(key: string, value: string): Messages.OTable;
|
|
35
32
|
export declare function StateAction(type: string): Messages.StateAction;
|
|
@@ -48,12 +45,10 @@ export declare function ConnectionInformation(downlink: number, type: string): M
|
|
|
48
45
|
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
49
46
|
export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
|
|
50
47
|
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
48
|
export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
|
|
53
49
|
export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
|
|
54
50
|
export declare function TechnicalInfo(type: string, value: string): Messages.TechnicalInfo;
|
|
55
51
|
export declare function CustomIssue(name: string, payload: string): Messages.CustomIssue;
|
|
56
|
-
export declare function CSSInsertRuleURLBased(id: number, rule: string, index: number, baseURL: string): Messages.CSSInsertRuleURLBased;
|
|
57
52
|
export declare function MouseClick(id: number, hesitationTime: number, label: string, selector: string, normalizedX: number, normalizedY: number): Messages.MouseClick;
|
|
58
53
|
export declare function MouseClickDeprecated(id: number, hesitationTime: number, label: string, selector: string): Messages.MouseClickDeprecated;
|
|
59
54
|
export declare function CreateIFrameDocument(frameID: number, id: number): Messages.CreateIFrameDocument;
|
|
@@ -8,7 +8,11 @@ export default abstract class Observer {
|
|
|
8
8
|
private readonly indexes;
|
|
9
9
|
private readonly attributesMap;
|
|
10
10
|
private readonly textSet;
|
|
11
|
-
|
|
11
|
+
private readonly disableSprites;
|
|
12
|
+
private readonly domParser;
|
|
13
|
+
constructor(app: App, isTopContext?: boolean, options?: {
|
|
14
|
+
disableSprites: boolean;
|
|
15
|
+
});
|
|
12
16
|
private clear;
|
|
13
17
|
/**
|
|
14
18
|
* EXPERIMENTAL: Unbinds the removed nodes in case of iframe src change.
|
package/dist/lib/main/index.d.ts
CHANGED
|
@@ -30,11 +30,11 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
30
30
|
__DISABLE_SECURE_MODE?: boolean;
|
|
31
31
|
};
|
|
32
32
|
export default class API {
|
|
33
|
-
|
|
33
|
+
readonly options: Partial<Options>;
|
|
34
34
|
featureFlags: FeatureFlags;
|
|
35
35
|
private readonly app;
|
|
36
36
|
private readonly crossdomainMode;
|
|
37
|
-
constructor(options: Options);
|
|
37
|
+
constructor(options: Partial<Options>);
|
|
38
38
|
checkDoNotTrack: () => boolean | undefined;
|
|
39
39
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
40
40
|
isFlagEnabled(flagName: string): boolean;
|
|
@@ -44,7 +44,7 @@ export default class API {
|
|
|
44
44
|
getFeatureFlag(flagName: string): IFeatureFlag | undefined;
|
|
45
45
|
getAllFeatureFlags(): IFeatureFlag[] | undefined;
|
|
46
46
|
restartCanvasTracking: () => void;
|
|
47
|
-
use<T>(fn: (app: App | null, options?: Options) => T): T;
|
|
47
|
+
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
48
48
|
isActive(): boolean;
|
|
49
49
|
/**
|
|
50
50
|
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
@@ -5,11 +5,11 @@ export declare class StringDictionary {
|
|
|
5
5
|
/** backwards dictionary of
|
|
6
6
|
* [repeated str:key]
|
|
7
7
|
* */
|
|
8
|
-
|
|
8
|
+
backDict: Record<string, number>;
|
|
9
9
|
getKey: (str: string) => [number, boolean];
|
|
10
10
|
}
|
|
11
11
|
export default class AttributeSender {
|
|
12
|
-
|
|
12
|
+
dict: StringDictionary;
|
|
13
13
|
private readonly app;
|
|
14
14
|
private readonly isDictDisabled;
|
|
15
15
|
constructor(options: {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Tracker, { App, Options } from './index.js';
|
|
2
|
+
import type { StartOptions, StartPromiseReturn } from './app/index.js';
|
|
3
|
+
declare class TrackerSingleton {
|
|
4
|
+
private instance;
|
|
5
|
+
private isConfigured;
|
|
6
|
+
/**
|
|
7
|
+
* Call this method once to create tracker configuration
|
|
8
|
+
* @param options {Object} Check available options:
|
|
9
|
+
* https://docs.openreplay.com/en/sdk/constructor/#initialization-options
|
|
10
|
+
*/
|
|
11
|
+
configure(options: Partial<Options>): void;
|
|
12
|
+
get options(): Partial<Options> | null;
|
|
13
|
+
start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>;
|
|
14
|
+
/**
|
|
15
|
+
* Stop the session and return sessionHash
|
|
16
|
+
* (which can be used to stitch sessions together)
|
|
17
|
+
* */
|
|
18
|
+
stop(): string | undefined;
|
|
19
|
+
setUserID(id: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Set metadata for the current session
|
|
22
|
+
*
|
|
23
|
+
* Make sure that its configured in project settings first
|
|
24
|
+
*
|
|
25
|
+
* Read more: https://docs.openreplay.com/en/installation/metadata/
|
|
26
|
+
*/
|
|
27
|
+
setMetadata(key: string, value: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns full URL for the current session
|
|
30
|
+
*/
|
|
31
|
+
getSessionURL(options?: {
|
|
32
|
+
withCurrentTime?: boolean;
|
|
33
|
+
}): string | undefined;
|
|
34
|
+
getSessionID(): string | null | undefined;
|
|
35
|
+
getSessionToken(): string | null | undefined;
|
|
36
|
+
event(key: string, payload?: any, issue?: boolean): void;
|
|
37
|
+
issue(key: string, payload?: any): void;
|
|
38
|
+
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
|
+
restartCanvasTracking(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Set the anonymous user ID
|
|
48
|
+
*/
|
|
49
|
+
setUserAnonymousID(id: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Check if the tracker is active
|
|
52
|
+
*/
|
|
53
|
+
isActive(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get the underlying Tracker instance
|
|
56
|
+
*
|
|
57
|
+
* Use when you need access to methods not exposed by the singleton
|
|
58
|
+
*/
|
|
59
|
+
getInstance(): Tracker | null;
|
|
60
|
+
/**
|
|
61
|
+
* start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
|
|
62
|
+
* session by calling start() on conditional trigger and we will then send buffered batch, so it won't get lost
|
|
63
|
+
* */
|
|
64
|
+
coldStart(startOpts?: Partial<StartOptions>, conditional?: boolean): Promise<never> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
67
|
+
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
68
|
+
* msg direction is "down" (incoming) by default
|
|
69
|
+
*
|
|
70
|
+
* @returns {(msgType: string, data: string, dir: 'up' | 'down') => void}
|
|
71
|
+
* */
|
|
72
|
+
trackWs(channelName: string): ((msgType: string, data: string, dir: 'up' | 'down') => void) | undefined;
|
|
73
|
+
private ensureConfigured;
|
|
74
|
+
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
75
|
+
/**
|
|
76
|
+
* Starts offline session recording. Keep in mind that only user device time will be used for timestamps.
|
|
77
|
+
* (no backend delay sync)
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} startOpts - options for session start, same as .start()
|
|
80
|
+
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
81
|
+
* @returns methods to manipulate buffer:
|
|
82
|
+
*
|
|
83
|
+
* saveBuffer - to save it in localStorage
|
|
84
|
+
*
|
|
85
|
+
* getBuffer - returns current buffer
|
|
86
|
+
*
|
|
87
|
+
* setBuffer - replaces current buffer with given
|
|
88
|
+
* */
|
|
89
|
+
startOfflineRecording(...args: Parameters<Tracker['startOfflineRecording']>): Promise<never> | {
|
|
90
|
+
saveBuffer: () => void;
|
|
91
|
+
getBuffer: () => import("./app/messages.gen.js").default[];
|
|
92
|
+
setBuffer: (buffer: import("./app/messages.gen.js").default[]) => void;
|
|
93
|
+
} | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Uploads the stored session buffer to backend
|
|
96
|
+
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
97
|
+
* so the session can be uploaded properly
|
|
98
|
+
* @resolve - if messages were loaded into service worker successfully
|
|
99
|
+
* @reject {string} - error message
|
|
100
|
+
* */
|
|
101
|
+
uploadOfflineRecording(): Promise<void> | undefined;
|
|
102
|
+
forceFlushBatch(): void;
|
|
103
|
+
getSessionInfo(): import("./app/session.js").SessionInfo | null;
|
|
104
|
+
getTabId(): string | null;
|
|
105
|
+
getUxId(): number | null;
|
|
106
|
+
}
|
|
107
|
+
declare const tracker: TrackerSingleton;
|
|
108
|
+
export default tracker;
|
|
@@ -22,7 +22,7 @@ export type ToWorkerData = null | 'stop' | Start | Auth | Array<Message> | {
|
|
|
22
22
|
} | {
|
|
23
23
|
type: 'uncompressed';
|
|
24
24
|
batch: Uint8Array;
|
|
25
|
-
} | 'forceFlushBatch' | 'check_queue'
|
|
25
|
+
} | 'forceFlushBatch' | 'check_queue';
|
|
26
26
|
type Failure = {
|
|
27
27
|
type: 'failure';
|
|
28
28
|
reason: string;
|
|
@@ -33,5 +33,5 @@ type QEmpty = {
|
|
|
33
33
|
export type FromWorkerData = 'a_stop' | 'a_start' | Failure | 'not_init' | {
|
|
34
34
|
type: 'compress';
|
|
35
35
|
batch: Uint8Array;
|
|
36
|
-
} | QEmpty
|
|
36
|
+
} | QEmpty;
|
|
37
37
|
export {};
|
|
@@ -26,9 +26,6 @@ export declare const enum Type {
|
|
|
26
26
|
Metadata = 30,
|
|
27
27
|
StringDictGlobal = 34,
|
|
28
28
|
SetNodeAttributeDictGlobal = 35,
|
|
29
|
-
CSSInsertRule = 37,
|
|
30
|
-
CSSDeleteRule = 38,
|
|
31
|
-
Fetch = 39,
|
|
32
29
|
Profiler = 40,
|
|
33
30
|
OTable = 41,
|
|
34
31
|
StateAction = 42,
|
|
@@ -47,12 +44,10 @@ export declare const enum Type {
|
|
|
47
44
|
SetPageVisibility = 55,
|
|
48
45
|
LoadFontFace = 57,
|
|
49
46
|
SetNodeFocus = 58,
|
|
50
|
-
LongTask = 59,
|
|
51
47
|
SetNodeAttributeURLBased = 60,
|
|
52
48
|
SetCSSDataURLBased = 61,
|
|
53
49
|
TechnicalInfo = 63,
|
|
54
50
|
CustomIssue = 64,
|
|
55
|
-
CSSInsertRuleURLBased = 67,
|
|
56
51
|
MouseClick = 68,
|
|
57
52
|
MouseClickDeprecated = 69,
|
|
58
53
|
CreateIFrameDocument = 70,
|
|
@@ -234,27 +229,6 @@ export type SetNodeAttributeDictGlobal = [
|
|
|
234
229
|
number,
|
|
235
230
|
number
|
|
236
231
|
];
|
|
237
|
-
export type CSSInsertRule = [
|
|
238
|
-
Type.CSSInsertRule,
|
|
239
|
-
number,
|
|
240
|
-
string,
|
|
241
|
-
number
|
|
242
|
-
];
|
|
243
|
-
export type CSSDeleteRule = [
|
|
244
|
-
Type.CSSDeleteRule,
|
|
245
|
-
number,
|
|
246
|
-
number
|
|
247
|
-
];
|
|
248
|
-
export type Fetch = [
|
|
249
|
-
Type.Fetch,
|
|
250
|
-
string,
|
|
251
|
-
string,
|
|
252
|
-
string,
|
|
253
|
-
string,
|
|
254
|
-
number,
|
|
255
|
-
number,
|
|
256
|
-
number
|
|
257
|
-
];
|
|
258
232
|
export type Profiler = [
|
|
259
233
|
Type.Profiler,
|
|
260
234
|
string,
|
|
@@ -361,16 +335,6 @@ export type SetNodeFocus = [
|
|
|
361
335
|
Type.SetNodeFocus,
|
|
362
336
|
number
|
|
363
337
|
];
|
|
364
|
-
export type LongTask = [
|
|
365
|
-
Type.LongTask,
|
|
366
|
-
number,
|
|
367
|
-
number,
|
|
368
|
-
number,
|
|
369
|
-
number,
|
|
370
|
-
string,
|
|
371
|
-
string,
|
|
372
|
-
string
|
|
373
|
-
];
|
|
374
338
|
export type SetNodeAttributeURLBased = [
|
|
375
339
|
Type.SetNodeAttributeURLBased,
|
|
376
340
|
number,
|
|
@@ -394,13 +358,6 @@ export type CustomIssue = [
|
|
|
394
358
|
string,
|
|
395
359
|
string
|
|
396
360
|
];
|
|
397
|
-
export type CSSInsertRuleURLBased = [
|
|
398
|
-
Type.CSSInsertRuleURLBased,
|
|
399
|
-
number,
|
|
400
|
-
string,
|
|
401
|
-
number,
|
|
402
|
-
string
|
|
403
|
-
];
|
|
404
361
|
export type MouseClick = [
|
|
405
362
|
Type.MouseClick,
|
|
406
363
|
number,
|
|
@@ -576,5 +533,5 @@ export type WebVitals = [
|
|
|
576
533
|
string,
|
|
577
534
|
string
|
|
578
535
|
];
|
|
579
|
-
type Message = Timestamp | SetPageLocationDeprecated | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequestDeprecated | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | StringDictGlobal | SetNodeAttributeDictGlobal |
|
|
536
|
+
type Message = Timestamp | SetPageLocationDeprecated | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequestDeprecated | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | StringDictGlobal | SetNodeAttributeDictGlobal | Profiler | OTable | StateAction | ReduxDeprecated | Vuex | MobX | NgRx | GraphQLDeprecated | PerformanceTrack | StringDictDeprecated | SetNodeAttributeDictDeprecated | StringDict | SetNodeAttributeDict | ResourceTimingDeprecated | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | MouseClick | MouseClickDeprecated | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | JSException | Zustand | BatchMetadata | PartitionedMessage | NetworkRequest | WSChannel | InputChange | SelectionChange | MouseThrashing | UnbindNodes | ResourceTiming | TabChange | TabData | CanvasNode | TagTrigger | Redux | SetPageLocation | GraphQL | WebVitals;
|
|
580
537
|
export default Message;
|
|
@@ -194,8 +194,6 @@ export default class App {
|
|
|
194
194
|
startTimeout: ReturnType<typeof setTimeout> | null;
|
|
195
195
|
allowAppStart(): void;
|
|
196
196
|
private checkNodeId;
|
|
197
|
-
heartbeatInterval: ReturnType<typeof setInterval> | null;
|
|
198
|
-
restartTimeout: ReturnType<typeof setTimeout> | null;
|
|
199
197
|
private initWorker;
|
|
200
198
|
private handleWorkerMsg;
|
|
201
199
|
private _debug;
|
|
@@ -27,9 +27,6 @@ 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 CSSInsertRule(id: number, rule: string, index: number): Messages.CSSInsertRule;
|
|
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;
|
|
33
30
|
export declare function Profiler(name: string, duration: number, args: string, result: string): Messages.Profiler;
|
|
34
31
|
export declare function OTable(key: string, value: string): Messages.OTable;
|
|
35
32
|
export declare function StateAction(type: string): Messages.StateAction;
|
|
@@ -48,12 +45,10 @@ export declare function ConnectionInformation(downlink: number, type: string): M
|
|
|
48
45
|
export declare function SetPageVisibility(hidden: boolean): Messages.SetPageVisibility;
|
|
49
46
|
export declare function LoadFontFace(parentID: number, family: string, source: string, descriptors: string): Messages.LoadFontFace;
|
|
50
47
|
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
48
|
export declare function SetNodeAttributeURLBased(id: number, name: string, value: string, baseURL: string): Messages.SetNodeAttributeURLBased;
|
|
53
49
|
export declare function SetCSSDataURLBased(id: number, data: string, baseURL: string): Messages.SetCSSDataURLBased;
|
|
54
50
|
export declare function TechnicalInfo(type: string, value: string): Messages.TechnicalInfo;
|
|
55
51
|
export declare function CustomIssue(name: string, payload: string): Messages.CustomIssue;
|
|
56
|
-
export declare function CSSInsertRuleURLBased(id: number, rule: string, index: number, baseURL: string): Messages.CSSInsertRuleURLBased;
|
|
57
52
|
export declare function MouseClick(id: number, hesitationTime: number, label: string, selector: string, normalizedX: number, normalizedY: number): Messages.MouseClick;
|
|
58
53
|
export declare function MouseClickDeprecated(id: number, hesitationTime: number, label: string, selector: string): Messages.MouseClickDeprecated;
|
|
59
54
|
export declare function CreateIFrameDocument(frameID: number, id: number): Messages.CreateIFrameDocument;
|
|
@@ -8,7 +8,11 @@ export default abstract class Observer {
|
|
|
8
8
|
private readonly indexes;
|
|
9
9
|
private readonly attributesMap;
|
|
10
10
|
private readonly textSet;
|
|
11
|
-
|
|
11
|
+
private readonly disableSprites;
|
|
12
|
+
private readonly domParser;
|
|
13
|
+
constructor(app: App, isTopContext?: boolean, options?: {
|
|
14
|
+
disableSprites: boolean;
|
|
15
|
+
});
|
|
12
16
|
private clear;
|
|
13
17
|
/**
|
|
14
18
|
* EXPERIMENTAL: Unbinds the removed nodes in case of iframe src change.
|
|
@@ -30,11 +30,11 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
30
30
|
__DISABLE_SECURE_MODE?: boolean;
|
|
31
31
|
};
|
|
32
32
|
export default class API {
|
|
33
|
-
|
|
33
|
+
readonly options: Partial<Options>;
|
|
34
34
|
featureFlags: FeatureFlags;
|
|
35
35
|
private readonly app;
|
|
36
36
|
private readonly crossdomainMode;
|
|
37
|
-
constructor(options: Options);
|
|
37
|
+
constructor(options: Partial<Options>);
|
|
38
38
|
checkDoNotTrack: () => boolean | undefined;
|
|
39
39
|
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
40
40
|
isFlagEnabled(flagName: string): boolean;
|
|
@@ -44,7 +44,7 @@ export default class API {
|
|
|
44
44
|
getFeatureFlag(flagName: string): IFeatureFlag | undefined;
|
|
45
45
|
getAllFeatureFlags(): IFeatureFlag[] | undefined;
|
|
46
46
|
restartCanvasTracking: () => void;
|
|
47
|
-
use<T>(fn: (app: App | null, options?: Options) => T): T;
|
|
47
|
+
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
48
48
|
isActive(): boolean;
|
|
49
49
|
/**
|
|
50
50
|
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
@@ -5,11 +5,11 @@ export declare class StringDictionary {
|
|
|
5
5
|
/** backwards dictionary of
|
|
6
6
|
* [repeated str:key]
|
|
7
7
|
* */
|
|
8
|
-
|
|
8
|
+
backDict: Record<string, number>;
|
|
9
9
|
getKey: (str: string) => [number, boolean];
|
|
10
10
|
}
|
|
11
11
|
export default class AttributeSender {
|
|
12
|
-
|
|
12
|
+
dict: StringDictionary;
|
|
13
13
|
private readonly app;
|
|
14
14
|
private readonly isDictDisabled;
|
|
15
15
|
constructor(options: {
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Tracker, { App, Options } from './index.js';
|
|
2
|
+
import type { StartOptions, StartPromiseReturn } from './app/index.js';
|
|
3
|
+
declare class TrackerSingleton {
|
|
4
|
+
private instance;
|
|
5
|
+
private isConfigured;
|
|
6
|
+
/**
|
|
7
|
+
* Call this method once to create tracker configuration
|
|
8
|
+
* @param options {Object} Check available options:
|
|
9
|
+
* https://docs.openreplay.com/en/sdk/constructor/#initialization-options
|
|
10
|
+
*/
|
|
11
|
+
configure(options: Partial<Options>): void;
|
|
12
|
+
get options(): Partial<Options> | null;
|
|
13
|
+
start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>;
|
|
14
|
+
/**
|
|
15
|
+
* Stop the session and return sessionHash
|
|
16
|
+
* (which can be used to stitch sessions together)
|
|
17
|
+
* */
|
|
18
|
+
stop(): string | undefined;
|
|
19
|
+
setUserID(id: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Set metadata for the current session
|
|
22
|
+
*
|
|
23
|
+
* Make sure that its configured in project settings first
|
|
24
|
+
*
|
|
25
|
+
* Read more: https://docs.openreplay.com/en/installation/metadata/
|
|
26
|
+
*/
|
|
27
|
+
setMetadata(key: string, value: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns full URL for the current session
|
|
30
|
+
*/
|
|
31
|
+
getSessionURL(options?: {
|
|
32
|
+
withCurrentTime?: boolean;
|
|
33
|
+
}): string | undefined;
|
|
34
|
+
getSessionID(): string | null | undefined;
|
|
35
|
+
getSessionToken(): string | null | undefined;
|
|
36
|
+
event(key: string, payload?: any, issue?: boolean): void;
|
|
37
|
+
issue(key: string, payload?: any): void;
|
|
38
|
+
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
|
+
restartCanvasTracking(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Set the anonymous user ID
|
|
48
|
+
*/
|
|
49
|
+
setUserAnonymousID(id: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Check if the tracker is active
|
|
52
|
+
*/
|
|
53
|
+
isActive(): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get the underlying Tracker instance
|
|
56
|
+
*
|
|
57
|
+
* Use when you need access to methods not exposed by the singleton
|
|
58
|
+
*/
|
|
59
|
+
getInstance(): Tracker | null;
|
|
60
|
+
/**
|
|
61
|
+
* start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
|
|
62
|
+
* session by calling start() on conditional trigger and we will then send buffered batch, so it won't get lost
|
|
63
|
+
* */
|
|
64
|
+
coldStart(startOpts?: Partial<StartOptions>, conditional?: boolean): Promise<never> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
67
|
+
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
68
|
+
* msg direction is "down" (incoming) by default
|
|
69
|
+
*
|
|
70
|
+
* @returns {(msgType: string, data: string, dir: 'up' | 'down') => void}
|
|
71
|
+
* */
|
|
72
|
+
trackWs(channelName: string): ((msgType: string, data: string, dir: 'up' | 'down') => void) | undefined;
|
|
73
|
+
private ensureConfigured;
|
|
74
|
+
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
75
|
+
/**
|
|
76
|
+
* Starts offline session recording. Keep in mind that only user device time will be used for timestamps.
|
|
77
|
+
* (no backend delay sync)
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} startOpts - options for session start, same as .start()
|
|
80
|
+
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
81
|
+
* @returns methods to manipulate buffer:
|
|
82
|
+
*
|
|
83
|
+
* saveBuffer - to save it in localStorage
|
|
84
|
+
*
|
|
85
|
+
* getBuffer - returns current buffer
|
|
86
|
+
*
|
|
87
|
+
* setBuffer - replaces current buffer with given
|
|
88
|
+
* */
|
|
89
|
+
startOfflineRecording(...args: Parameters<Tracker['startOfflineRecording']>): Promise<never> | {
|
|
90
|
+
saveBuffer: () => void;
|
|
91
|
+
getBuffer: () => import("./app/messages.gen.js").default[];
|
|
92
|
+
setBuffer: (buffer: import("./app/messages.gen.js").default[]) => void;
|
|
93
|
+
} | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Uploads the stored session buffer to backend
|
|
96
|
+
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
97
|
+
* so the session can be uploaded properly
|
|
98
|
+
* @resolve - if messages were loaded into service worker successfully
|
|
99
|
+
* @reject {string} - error message
|
|
100
|
+
* */
|
|
101
|
+
uploadOfflineRecording(): Promise<void> | undefined;
|
|
102
|
+
forceFlushBatch(): void;
|
|
103
|
+
getSessionInfo(): import("./app/session.js").SessionInfo | null;
|
|
104
|
+
getTabId(): string | null;
|
|
105
|
+
getUxId(): number | null;
|
|
106
|
+
}
|
|
107
|
+
declare const tracker: TrackerSingleton;
|
|
108
|
+
export default tracker;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openreplay/tracker",
|
|
3
3
|
"description": "The OpenReplay tracker main package",
|
|
4
|
-
"version": "16.0.2
|
|
4
|
+
"version": "16.0.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logging",
|
|
7
7
|
"replay"
|
|
@@ -15,13 +15,18 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
+
"require": "./dist/cjs/entry.js",
|
|
19
|
+
"import": "./dist/lib/entry.js",
|
|
20
|
+
"types": "./dist/lib/main/entry.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./class": {
|
|
18
23
|
"require": "./dist/cjs/index.js",
|
|
19
24
|
"import": "./dist/lib/index.js",
|
|
20
25
|
"types": "./dist/lib/main/index.d.ts"
|
|
21
26
|
},
|
|
22
27
|
"./cjs": {
|
|
23
|
-
"require": "./dist/cjs/
|
|
24
|
-
"types": "./dist/cjs/main/
|
|
28
|
+
"require": "./dist/cjs/entry.js",
|
|
29
|
+
"types": "./dist/cjs/main/entry.d.ts"
|
|
25
30
|
}
|
|
26
31
|
},
|
|
27
32
|
"files": [
|
|
@@ -29,9 +34,9 @@
|
|
|
29
34
|
"dist/cjs/**/*",
|
|
30
35
|
"dist/types/**/*"
|
|
31
36
|
],
|
|
32
|
-
"main": "./dist/cjs/
|
|
33
|
-
"module": "./dist/lib/
|
|
34
|
-
"types": "./dist/lib/main/
|
|
37
|
+
"main": "./dist/cjs/entry.js",
|
|
38
|
+
"module": "./dist/lib/entry.js",
|
|
39
|
+
"types": "./dist/lib/main/entry.d.ts",
|
|
35
40
|
"scripts": {
|
|
36
41
|
"lint": "eslint src --ext .ts,.js --fix --quiet",
|
|
37
42
|
"clean": "rm -Rf build && rm -Rf dist",
|