@oxvo/browser 7.1.0
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/LICENSE +21 -0
- package/README.md +63 -0
- package/dist/cjs/common/interaction.d.ts +37 -0
- package/dist/cjs/common/messages.gen.d.ts +587 -0
- package/dist/cjs/entry.js +10678 -0
- package/dist/cjs/entry.js.map +1 -0
- package/dist/cjs/index.js +10435 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/main/app/canvas.d.ts +37 -0
- package/dist/cjs/main/app/guards.d.ts +24 -0
- package/dist/cjs/main/app/index.d.ts +314 -0
- package/dist/cjs/main/app/logger.d.ts +17 -0
- package/dist/cjs/main/app/messages.gen.d.ts +83 -0
- package/dist/cjs/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/cjs/main/app/nodes/index.d.ts +32 -0
- package/dist/cjs/main/app/nodes/maintainer.d.ts +28 -0
- package/dist/cjs/main/app/observer/cssInliner.d.ts +1 -0
- package/dist/cjs/main/app/observer/iframe_observer.d.ts +6 -0
- package/dist/cjs/main/app/observer/iframe_offsets.d.ts +8 -0
- package/dist/cjs/main/app/observer/observer.d.ts +52 -0
- package/dist/cjs/main/app/observer/shadow_root_observer.d.ts +4 -0
- package/dist/cjs/main/app/observer/top_observer.d.ts +52 -0
- package/dist/cjs/main/app/sanitizer.d.ts +53 -0
- package/dist/cjs/main/app/session.d.ts +58 -0
- package/dist/cjs/main/app/ticker.d.ts +18 -0
- package/dist/cjs/main/entry.d.ts +6 -0
- package/dist/cjs/main/index.d.ts +119 -0
- 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 +56 -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/attributeSender.d.ts +22 -0
- package/dist/cjs/main/modules/axiosSpy.d.ts +54 -0
- package/dist/cjs/main/modules/conditionsManager.d.ts +89 -0
- package/dist/cjs/main/modules/connection.d.ts +2 -0
- package/dist/cjs/main/modules/console.d.ts +6 -0
- package/dist/cjs/main/modules/constructedStyleSheets.d.ts +4 -0
- package/dist/cjs/main/modules/cssrules.d.ts +18 -0
- package/dist/cjs/main/modules/exception.d.ts +16 -0
- package/dist/cjs/main/modules/focus.d.ts +2 -0
- package/dist/cjs/main/modules/fonts.d.ts +2 -0
- package/dist/cjs/main/modules/img.d.ts +2 -0
- package/dist/cjs/main/modules/input.d.ts +34 -0
- package/dist/cjs/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/cjs/main/modules/markerWatcher.d.ts +25 -0
- package/dist/cjs/main/modules/mouse.d.ts +13 -0
- package/dist/cjs/main/modules/network.d.ts +32 -0
- package/dist/cjs/main/modules/performance.d.ts +7 -0
- package/dist/cjs/main/modules/scroll.d.ts +2 -0
- package/dist/cjs/main/modules/selection.d.ts +7 -0
- package/dist/cjs/main/modules/tabs.d.ts +2 -0
- package/dist/cjs/main/modules/timing.d.ts +9 -0
- package/dist/cjs/main/modules/viewport.d.ts +13 -0
- package/dist/cjs/main/modules/webAnimations.d.ts +9 -0
- package/dist/cjs/main/singleton.d.ts +102 -0
- package/dist/cjs/main/utils.d.ts +35 -0
- package/dist/lib/common/interaction.d.ts +37 -0
- package/dist/lib/common/messages.gen.d.ts +587 -0
- package/dist/lib/entry.js +10669 -0
- package/dist/lib/entry.js.map +1 -0
- package/dist/lib/index.js +10429 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/main/app/canvas.d.ts +37 -0
- package/dist/lib/main/app/guards.d.ts +24 -0
- package/dist/lib/main/app/index.d.ts +314 -0
- package/dist/lib/main/app/logger.d.ts +17 -0
- package/dist/lib/main/app/messages.gen.d.ts +83 -0
- package/dist/lib/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/lib/main/app/nodes/index.d.ts +32 -0
- package/dist/lib/main/app/nodes/maintainer.d.ts +28 -0
- package/dist/lib/main/app/observer/cssInliner.d.ts +1 -0
- package/dist/lib/main/app/observer/iframe_observer.d.ts +6 -0
- package/dist/lib/main/app/observer/iframe_offsets.d.ts +8 -0
- package/dist/lib/main/app/observer/observer.d.ts +52 -0
- package/dist/lib/main/app/observer/shadow_root_observer.d.ts +4 -0
- package/dist/lib/main/app/observer/top_observer.d.ts +52 -0
- package/dist/lib/main/app/sanitizer.d.ts +53 -0
- package/dist/lib/main/app/session.d.ts +58 -0
- package/dist/lib/main/app/ticker.d.ts +18 -0
- package/dist/lib/main/entry.d.ts +6 -0
- package/dist/lib/main/index.d.ts +119 -0
- 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 +56 -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/attributeSender.d.ts +22 -0
- package/dist/lib/main/modules/axiosSpy.d.ts +54 -0
- package/dist/lib/main/modules/conditionsManager.d.ts +89 -0
- package/dist/lib/main/modules/connection.d.ts +2 -0
- package/dist/lib/main/modules/console.d.ts +6 -0
- package/dist/lib/main/modules/constructedStyleSheets.d.ts +4 -0
- package/dist/lib/main/modules/cssrules.d.ts +18 -0
- package/dist/lib/main/modules/exception.d.ts +16 -0
- package/dist/lib/main/modules/focus.d.ts +2 -0
- package/dist/lib/main/modules/fonts.d.ts +2 -0
- package/dist/lib/main/modules/img.d.ts +2 -0
- package/dist/lib/main/modules/input.d.ts +34 -0
- package/dist/lib/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/lib/main/modules/markerWatcher.d.ts +25 -0
- package/dist/lib/main/modules/mouse.d.ts +13 -0
- package/dist/lib/main/modules/network.d.ts +32 -0
- package/dist/lib/main/modules/performance.d.ts +7 -0
- package/dist/lib/main/modules/scroll.d.ts +2 -0
- package/dist/lib/main/modules/selection.d.ts +7 -0
- package/dist/lib/main/modules/tabs.d.ts +2 -0
- package/dist/lib/main/modules/timing.d.ts +9 -0
- package/dist/lib/main/modules/viewport.d.ts +13 -0
- package/dist/lib/main/modules/webAnimations.d.ts +9 -0
- package/dist/lib/main/singleton.d.ts +102 -0
- package/dist/lib/main/utils.d.ts +35 -0
- package/dist/types/common/interaction.d.ts +37 -0
- package/dist/types/common/messages.gen.d.ts +587 -0
- package/dist/types/main/app/canvas.d.ts +37 -0
- package/dist/types/main/app/guards.d.ts +24 -0
- package/dist/types/main/app/index.d.ts +314 -0
- package/dist/types/main/app/logger.d.ts +17 -0
- package/dist/types/main/app/messages.gen.d.ts +83 -0
- package/dist/types/main/app/nodes/idSeq.d.ts +14 -0
- package/dist/types/main/app/nodes/index.d.ts +32 -0
- package/dist/types/main/app/nodes/maintainer.d.ts +28 -0
- package/dist/types/main/app/observer/cssInliner.d.ts +1 -0
- package/dist/types/main/app/observer/iframe_observer.d.ts +6 -0
- package/dist/types/main/app/observer/iframe_offsets.d.ts +8 -0
- package/dist/types/main/app/observer/observer.d.ts +52 -0
- package/dist/types/main/app/observer/shadow_root_observer.d.ts +4 -0
- package/dist/types/main/app/observer/top_observer.d.ts +52 -0
- package/dist/types/main/app/sanitizer.d.ts +53 -0
- package/dist/types/main/app/session.d.ts +58 -0
- package/dist/types/main/app/ticker.d.ts +18 -0
- package/dist/types/main/entry.d.ts +6 -0
- package/dist/types/main/index.d.ts +119 -0
- 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 +56 -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/attributeSender.d.ts +22 -0
- package/dist/types/main/modules/axiosSpy.d.ts +54 -0
- package/dist/types/main/modules/conditionsManager.d.ts +89 -0
- package/dist/types/main/modules/connection.d.ts +2 -0
- package/dist/types/main/modules/console.d.ts +6 -0
- package/dist/types/main/modules/constructedStyleSheets.d.ts +4 -0
- package/dist/types/main/modules/cssrules.d.ts +18 -0
- package/dist/types/main/modules/exception.d.ts +16 -0
- package/dist/types/main/modules/focus.d.ts +2 -0
- package/dist/types/main/modules/fonts.d.ts +2 -0
- package/dist/types/main/modules/img.d.ts +2 -0
- package/dist/types/main/modules/input.d.ts +34 -0
- package/dist/types/main/modules/longAnimationTask.d.ts +25 -0
- package/dist/types/main/modules/markerWatcher.d.ts +25 -0
- package/dist/types/main/modules/mouse.d.ts +13 -0
- package/dist/types/main/modules/network.d.ts +32 -0
- package/dist/types/main/modules/performance.d.ts +7 -0
- package/dist/types/main/modules/scroll.d.ts +2 -0
- package/dist/types/main/modules/selection.d.ts +7 -0
- package/dist/types/main/modules/tabs.d.ts +2 -0
- package/dist/types/main/modules/timing.d.ts +9 -0
- package/dist/types/main/modules/viewport.d.ts +13 -0
- package/dist/types/main/modules/webAnimations.d.ts +9 -0
- package/dist/types/main/singleton.d.ts +102 -0
- package/dist/types/main/utils.d.ts +35 -0
- package/package.json +87 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Observer from './observer.js';
|
|
2
|
+
import { Offset } from './iframe_offsets.js';
|
|
3
|
+
import App from '../index.js';
|
|
4
|
+
export declare enum InlineCssMode {
|
|
5
|
+
Unset = -1,
|
|
6
|
+
/** default behavior -- will parse and cache the css file on backend */
|
|
7
|
+
Disabled = 0,
|
|
8
|
+
/** will attempt to record the linked css file as AdoptedStyleSheet object */
|
|
9
|
+
Inline = 1,
|
|
10
|
+
/** will fetch the file, then simulate AdoptedStyleSheets behavior programmaticaly for the replay */
|
|
11
|
+
InlineFetched = 2,
|
|
12
|
+
/** will fetch the file, then save it as plain css inside <style> node */
|
|
13
|
+
PlainFetched = 3
|
|
14
|
+
}
|
|
15
|
+
export interface Options {
|
|
16
|
+
captureIFrames: boolean;
|
|
17
|
+
disableSprites: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* with this option instead of using link element with href to load css,
|
|
20
|
+
* we will try to parse the css text instead and send it as css rules set
|
|
21
|
+
* can (and probably will) affect performance to certain degree,
|
|
22
|
+
* especially if the css itself is crossdomain
|
|
23
|
+
* @default InlineCssMode.None = 0
|
|
24
|
+
* */
|
|
25
|
+
inlineCss: InlineCssMode;
|
|
26
|
+
disableThrottling?: boolean;
|
|
27
|
+
}
|
|
28
|
+
type Context = Window & typeof globalThis;
|
|
29
|
+
type ContextCallback = (context: Context) => void;
|
|
30
|
+
export default class TopObserver extends Observer {
|
|
31
|
+
private readonly options;
|
|
32
|
+
private readonly iframeOffsets;
|
|
33
|
+
readonly app: App;
|
|
34
|
+
constructor(params: {
|
|
35
|
+
app: App;
|
|
36
|
+
options: Partial<Options>;
|
|
37
|
+
});
|
|
38
|
+
private readonly contextCallbacks;
|
|
39
|
+
private readonly contextsSet;
|
|
40
|
+
attachContextCallback(cb: ContextCallback): void;
|
|
41
|
+
getDocumentOffset(doc: Document): Offset;
|
|
42
|
+
private iframeObserversArr;
|
|
43
|
+
private iframeObservers;
|
|
44
|
+
private docObservers;
|
|
45
|
+
private handleIframe;
|
|
46
|
+
private shadowRootObservers;
|
|
47
|
+
private handleShadowRoot;
|
|
48
|
+
observe(): void;
|
|
49
|
+
crossdomainObserve(rootNodeId: number, frameOder: number, frameLevel: number): void;
|
|
50
|
+
disconnect(): void;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type App from './index.js';
|
|
2
|
+
export declare enum SanitizeLevel {
|
|
3
|
+
Plain = 0,
|
|
4
|
+
Obscured = 1,
|
|
5
|
+
Hidden = 2
|
|
6
|
+
}
|
|
7
|
+
export interface Options {
|
|
8
|
+
/**
|
|
9
|
+
* Sanitize emails in text DOM nodes
|
|
10
|
+
*
|
|
11
|
+
* (for inputs, look for maskInputEmails)
|
|
12
|
+
* */
|
|
13
|
+
maskTextEmails: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Sanitize emails in text DOM nodes
|
|
16
|
+
*
|
|
17
|
+
* (for inputs, look for maskInputNumbers)
|
|
18
|
+
* */
|
|
19
|
+
maskTextNumbers: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sanitize the DOM node based on the returned level
|
|
22
|
+
* (Plain = 0, Obscured = 1, Hidden = 2)
|
|
23
|
+
*
|
|
24
|
+
* higher security levels will override other settings or data-params.
|
|
25
|
+
*
|
|
26
|
+
* @param node - the DOM node to sanitize
|
|
27
|
+
* @returns the level of sanitization to apply
|
|
28
|
+
*
|
|
29
|
+
* */
|
|
30
|
+
domSanitizer?: (node: Element) => SanitizeLevel;
|
|
31
|
+
/**
|
|
32
|
+
* private by default mode that will mask all elements not marked by data-oxvosessions-unmask
|
|
33
|
+
* */
|
|
34
|
+
maskAllByDefault?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const stringWiper: (input: string) => string;
|
|
37
|
+
export default class Sanitizer {
|
|
38
|
+
private readonly obscured;
|
|
39
|
+
private readonly hidden;
|
|
40
|
+
private readonly options;
|
|
41
|
+
readonly maskAllByDefault: boolean;
|
|
42
|
+
private readonly app;
|
|
43
|
+
constructor(params: {
|
|
44
|
+
app: App;
|
|
45
|
+
options?: Partial<Options>;
|
|
46
|
+
});
|
|
47
|
+
handleNode(id: number, parentID: number, node: Node): Set<number> | undefined;
|
|
48
|
+
sanitize(id: number, data: string): string;
|
|
49
|
+
isObscured(id: number): boolean;
|
|
50
|
+
isHidden(id: number): boolean;
|
|
51
|
+
getInnerTextSecure(el: HTMLElement): string;
|
|
52
|
+
clear(): void;
|
|
53
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type App from './index.js';
|
|
2
|
+
interface UserInfo {
|
|
3
|
+
userBrowser: string;
|
|
4
|
+
userCity: string;
|
|
5
|
+
userCountry: string;
|
|
6
|
+
userDevice: string;
|
|
7
|
+
userOS: string;
|
|
8
|
+
userState: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SessionInfo {
|
|
11
|
+
sessionID: string | undefined;
|
|
12
|
+
metadata: Record<string, string>;
|
|
13
|
+
userID: string | null;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
projectID?: string;
|
|
16
|
+
}
|
|
17
|
+
type OnUpdateCallback = (i: Partial<SessionInfo>) => void;
|
|
18
|
+
export type Options = {
|
|
19
|
+
session_token_key: string;
|
|
20
|
+
session_pageno_key: string;
|
|
21
|
+
session_tabid_key: string;
|
|
22
|
+
};
|
|
23
|
+
export default class Session {
|
|
24
|
+
private metadata;
|
|
25
|
+
private userID;
|
|
26
|
+
private sessionID;
|
|
27
|
+
private readonly callbacks;
|
|
28
|
+
private timestamp;
|
|
29
|
+
private projectID;
|
|
30
|
+
private tabId;
|
|
31
|
+
userInfo: UserInfo;
|
|
32
|
+
private token;
|
|
33
|
+
private readonly app;
|
|
34
|
+
private readonly options;
|
|
35
|
+
constructor(params: {
|
|
36
|
+
app: App;
|
|
37
|
+
options: Options;
|
|
38
|
+
});
|
|
39
|
+
attachUpdateCallback(cb: OnUpdateCallback): void;
|
|
40
|
+
private handleUpdate;
|
|
41
|
+
assign(newInfo: Partial<SessionInfo>): void;
|
|
42
|
+
setMetadata(key: string, value: string): void;
|
|
43
|
+
setUserID(userID: string): void;
|
|
44
|
+
setUserInfo(userInfo: UserInfo): void;
|
|
45
|
+
getPageNumber: () => number | undefined;
|
|
46
|
+
incPageNo: () => number;
|
|
47
|
+
getSessionSecret: (projectKey?: string) => string | undefined;
|
|
48
|
+
getRawSecretWithProject: () => string | null;
|
|
49
|
+
setSessionSecret: (token: string, projectKey: string) => void;
|
|
50
|
+
applySessionHash(hash: string): void;
|
|
51
|
+
getSessionHash(): string | undefined;
|
|
52
|
+
getTabId(): string;
|
|
53
|
+
regenerateTabId(): void;
|
|
54
|
+
private createTabId;
|
|
55
|
+
getInfo(): SessionInfo;
|
|
56
|
+
reset(): void;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import App from './index.js';
|
|
2
|
+
type Callback = () => void;
|
|
3
|
+
export default class Ticker {
|
|
4
|
+
private readonly app;
|
|
5
|
+
private timer;
|
|
6
|
+
private readonly callbacks;
|
|
7
|
+
constructor(app: App);
|
|
8
|
+
/**
|
|
9
|
+
* @param {Callback} callback - repeated cb
|
|
10
|
+
* @param {number} n - number of turn skips; ticker have a 30 ms cycle
|
|
11
|
+
* @param {boolean} useSafe - using safe wrapper to check if app is active
|
|
12
|
+
* @param {object} thisArg - link to <this>
|
|
13
|
+
* */
|
|
14
|
+
attach(callback: Callback, n?: number, useSafe?: boolean, thisArg?: any): void;
|
|
15
|
+
start(): void;
|
|
16
|
+
stop(): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TrackerClass from './index';
|
|
2
|
+
export { default as App } from './app/index';
|
|
3
|
+
export { default as browser, default as oxvosessions } from './singleton';
|
|
4
|
+
export { SanitizeLevel, Messages, Options } from './index';
|
|
5
|
+
export { default as Analytics } from './modules/analytics/index';
|
|
6
|
+
export default TrackerClass;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import App from './app/index';
|
|
2
|
+
export { default as App } from './app/index.js';
|
|
3
|
+
import * as _Messages from './app/messages.gen.js';
|
|
4
|
+
export declare const Messages: typeof _Messages;
|
|
5
|
+
export { SanitizeLevel } from './app/sanitizer.js';
|
|
6
|
+
import AnalyticsSDK from './modules/analytics/index.js';
|
|
7
|
+
import type { Options as AppOptions } from './app/index.js';
|
|
8
|
+
import type { Options as ConsoleOptions } from './modules/console.js';
|
|
9
|
+
import type { Options as ExceptionOptions } from './modules/exception.js';
|
|
10
|
+
import type { Options as InputOptions } from './modules/input.js';
|
|
11
|
+
import type { Options as PerformanceOptions } from './modules/performance.js';
|
|
12
|
+
import type { Options as TimingOptions } from './modules/timing.js';
|
|
13
|
+
import type { Options as NetworkOptions } from './modules/network.js';
|
|
14
|
+
import type { MouseHandlerOptions } from './modules/mouse.js';
|
|
15
|
+
import type { SessionInfo } from './app/session.js';
|
|
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';
|
|
19
|
+
import type { Options as ViewportOptions } from './modules/viewport.js';
|
|
20
|
+
import type { StartOptions } from './app/index.js';
|
|
21
|
+
import type { StartPromiseReturn } from './app/index.js';
|
|
22
|
+
export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions & LATOptions> & {
|
|
23
|
+
siteKey: string;
|
|
24
|
+
sessionToken?: string;
|
|
25
|
+
honorDoNotTrack?: boolean;
|
|
26
|
+
autoResetOnWindowOpen?: boolean;
|
|
27
|
+
resetTabOnWindowOpen?: boolean;
|
|
28
|
+
networkCapture?: Partial<NetworkOptions>;
|
|
29
|
+
mouse?: Partial<MouseHandlerOptions>;
|
|
30
|
+
devAllowInsecure?: boolean;
|
|
31
|
+
css: CssRulesOptions;
|
|
32
|
+
webAnimations?: WapOptions;
|
|
33
|
+
urls?: Partial<ViewportOptions>;
|
|
34
|
+
analytics?: {
|
|
35
|
+
endpoint?: string;
|
|
36
|
+
active?: boolean;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default class API {
|
|
40
|
+
readonly options: Partial<Options>;
|
|
41
|
+
private readonly app;
|
|
42
|
+
readonly analytics: AnalyticsSDK | null;
|
|
43
|
+
private readonly crossdomainMode;
|
|
44
|
+
private initBlockedReason;
|
|
45
|
+
constructor(options: Partial<Options>);
|
|
46
|
+
checkDoNotTrack: () => boolean | undefined;
|
|
47
|
+
signalStartIssue: (reason: string, missingApi: string[]) => void;
|
|
48
|
+
restartCanvasTracking: () => void;
|
|
49
|
+
use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
|
|
50
|
+
isActive(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a named hook that expects event name, data string and msg direction (up/down),
|
|
53
|
+
* it will skip any message bigger than 5 mb or event name bigger than 255 symbols
|
|
54
|
+
* msg direction is "down" (incoming) by default
|
|
55
|
+
*
|
|
56
|
+
* @returns {(msgType: string, data: string, dir: 'up' | 'down') => void}
|
|
57
|
+
* */
|
|
58
|
+
trackWs(channelName: string): ((msgType: string, data: string, dir: "up" | "down") => void) | undefined;
|
|
59
|
+
start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>;
|
|
60
|
+
browserEnvCheck(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
|
|
63
|
+
* session by calling start() on conditional trigger and we will then send buffered batch, so it won't get lost
|
|
64
|
+
* */
|
|
65
|
+
coldStart(startOpts?: Partial<StartOptions>, conditional?: boolean): Promise<never> | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Starts offline session recording. Keep in mind that only user device time will be used for timestamps.
|
|
68
|
+
* (no backend delay sync)
|
|
69
|
+
*
|
|
70
|
+
* @param {Object} startOpts - options for session start, same as .start()
|
|
71
|
+
* @param {Function} onSessionSent - callback that will be called once session is fully sent
|
|
72
|
+
* @returns methods to manipulate buffer:
|
|
73
|
+
*
|
|
74
|
+
* saveBuffer - to save it in localStorage
|
|
75
|
+
*
|
|
76
|
+
* getBuffer - returns current buffer
|
|
77
|
+
*
|
|
78
|
+
* setBuffer - replaces current buffer with given
|
|
79
|
+
* */
|
|
80
|
+
startOfflineRecording(startOpts: Partial<StartOptions>, onSessionSent: () => void): Promise<never> | {
|
|
81
|
+
saveBuffer: () => void;
|
|
82
|
+
getBuffer: () => _Messages.default[];
|
|
83
|
+
setBuffer: (buffer: _Messages.default[]) => void;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Uploads the stored session buffer to backend
|
|
87
|
+
* @returns promise that resolves once messages are loaded, it has to be awaited
|
|
88
|
+
* so the session can be uploaded properly
|
|
89
|
+
* @resolve - if messages were loaded into service worker successfully
|
|
90
|
+
* @reject {string} - error message
|
|
91
|
+
* */
|
|
92
|
+
uploadOfflineRecording(): Promise<void> | undefined;
|
|
93
|
+
stop(): string | undefined;
|
|
94
|
+
forceFlushBatch(): void;
|
|
95
|
+
getSessionSecret(): string | null | undefined;
|
|
96
|
+
getSessionMeta(): SessionInfo | null;
|
|
97
|
+
getSessionKey(): string | null | undefined;
|
|
98
|
+
getTabId(): string | null;
|
|
99
|
+
getSessionLink: (options?: {
|
|
100
|
+
withCurrentTime?: boolean;
|
|
101
|
+
}) => string | undefined;
|
|
102
|
+
identify: (id: string, properties?: Record<string, any>) => void;
|
|
103
|
+
setVisitorID(id: string): void;
|
|
104
|
+
setMetadata(key: string, value: string): void;
|
|
105
|
+
track(key: string, payload?: any, issue?: boolean): void;
|
|
106
|
+
report(key: string, payload?: any): void;
|
|
107
|
+
handleError: (e: Error | ErrorEvent | PromiseRejectionEvent, metadata?: Record<string, any>) => void;
|
|
108
|
+
incident: (options: {
|
|
109
|
+
label?: string;
|
|
110
|
+
startTime: number;
|
|
111
|
+
endTime?: number;
|
|
112
|
+
}) => void;
|
|
113
|
+
private analyticsToken;
|
|
114
|
+
/**
|
|
115
|
+
* Use custom token for analytics events without session recording
|
|
116
|
+
* */
|
|
117
|
+
setAnalyticsToken: (token: string) => void;
|
|
118
|
+
getAnalyticsToken: () => string;
|
|
119
|
+
}
|
|
@@ -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 oxvosessions 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 oxvosessions 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, properties?: Record<string, any>) => 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,56 @@
|
|
|
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
|
+
private readonly defaultPropertyKeyMap;
|
|
11
|
+
constructor(constantProperties: ConstantProperties, getTimestamp: () => number, onId: (user_id: string) => void, batcher: Batcher);
|
|
12
|
+
private normalizeUserPropertyKey;
|
|
13
|
+
private normalizeUserProperties;
|
|
14
|
+
identify: (user_id: string, propertiesOrOptions?: Record<string, any> | {
|
|
15
|
+
fromTracker?: boolean;
|
|
16
|
+
}, options?: {
|
|
17
|
+
fromTracker?: boolean;
|
|
18
|
+
}) => void;
|
|
19
|
+
/** Resets user id and own properties
|
|
20
|
+
*
|
|
21
|
+
* !hard reset will destroy persistent device id!
|
|
22
|
+
* */
|
|
23
|
+
reset: (hard?: boolean) => void;
|
|
24
|
+
get user_id(): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Will delete user and its data from backend, then reset all local properties
|
|
27
|
+
*/
|
|
28
|
+
deleteUser: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* set user properties, overwriting existing ones
|
|
31
|
+
* */
|
|
32
|
+
setProperties: (propertyOrObj: Record<string, string | number> | string, value?: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Set property if it doesn't exist yet
|
|
35
|
+
* */
|
|
36
|
+
setPropertiesOnce: (properties: Record<string, string | number>) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Add value to property (will turn string prop into array)
|
|
39
|
+
* */
|
|
40
|
+
appendValues: (key: string, value: string | number) => void;
|
|
41
|
+
/**
|
|
42
|
+
* Add unique values to property (will turn string prop into array)
|
|
43
|
+
* */
|
|
44
|
+
appendUniqueValues: (key: string, value: string | number) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Adds value (incl. negative) to existing numerical property
|
|
47
|
+
* */
|
|
48
|
+
increment: (key: string, value: number) => void;
|
|
49
|
+
/** mixpanel compatibility */
|
|
50
|
+
union: (key: string, value: string | number) => void;
|
|
51
|
+
set: (propertyOrObj: Record<string, string | number> | string, value?: string) => void;
|
|
52
|
+
set_once: (properties: Record<string, string | number>) => void;
|
|
53
|
+
append: (key: string, value: string | number) => void;
|
|
54
|
+
incrementBy: (key: string, value: number) => void;
|
|
55
|
+
}
|
|
56
|
+
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 {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import App from '../app/index.js';
|
|
2
|
+
export declare class StringDictionary {
|
|
3
|
+
private lastTs;
|
|
4
|
+
private lastSuffix;
|
|
5
|
+
/** backwards dictionary of
|
|
6
|
+
* [repeated str:key]
|
|
7
|
+
* */
|
|
8
|
+
private backDict;
|
|
9
|
+
getKey: (str: string) => [number, boolean];
|
|
10
|
+
}
|
|
11
|
+
export default class AttributeSender {
|
|
12
|
+
private dict;
|
|
13
|
+
private readonly app;
|
|
14
|
+
private readonly isDictDisabled;
|
|
15
|
+
constructor(options: {
|
|
16
|
+
app: App;
|
|
17
|
+
isDictDisabled: boolean;
|
|
18
|
+
});
|
|
19
|
+
sendSetAttribute: (id: number, name: string, value: string) => void;
|
|
20
|
+
private applyDict;
|
|
21
|
+
clear(): void;
|
|
22
|
+
}
|