@openreplay/tracker 16.0.0 → 16.0.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/README.md +1 -1
- package/dist/cjs/entry.js +9867 -0
- package/dist/cjs/entry.js.map +1 -0
- package/dist/cjs/index.js +69 -24
- package/dist/cjs/index.js.map +1 -1
- 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/singleton.d.ts +108 -0
- package/dist/lib/entry.js +9860 -0
- package/dist/lib/entry.js.map +1 -0
- package/dist/lib/index.js +69 -24
- package/dist/lib/index.js.map +1 -1
- 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/singleton.d.ts +108 -0
- 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/singleton.d.ts +108 -0
- package/package.json +11 -6
|
@@ -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/cjs/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),
|
|
@@ -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;
|