@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.
Files changed (173) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/dist/cjs/common/interaction.d.ts +37 -0
  4. package/dist/cjs/common/messages.gen.d.ts +587 -0
  5. package/dist/cjs/entry.js +10678 -0
  6. package/dist/cjs/entry.js.map +1 -0
  7. package/dist/cjs/index.js +10435 -0
  8. package/dist/cjs/index.js.map +1 -0
  9. package/dist/cjs/main/app/canvas.d.ts +37 -0
  10. package/dist/cjs/main/app/guards.d.ts +24 -0
  11. package/dist/cjs/main/app/index.d.ts +314 -0
  12. package/dist/cjs/main/app/logger.d.ts +17 -0
  13. package/dist/cjs/main/app/messages.gen.d.ts +83 -0
  14. package/dist/cjs/main/app/nodes/idSeq.d.ts +14 -0
  15. package/dist/cjs/main/app/nodes/index.d.ts +32 -0
  16. package/dist/cjs/main/app/nodes/maintainer.d.ts +28 -0
  17. package/dist/cjs/main/app/observer/cssInliner.d.ts +1 -0
  18. package/dist/cjs/main/app/observer/iframe_observer.d.ts +6 -0
  19. package/dist/cjs/main/app/observer/iframe_offsets.d.ts +8 -0
  20. package/dist/cjs/main/app/observer/observer.d.ts +52 -0
  21. package/dist/cjs/main/app/observer/shadow_root_observer.d.ts +4 -0
  22. package/dist/cjs/main/app/observer/top_observer.d.ts +52 -0
  23. package/dist/cjs/main/app/sanitizer.d.ts +53 -0
  24. package/dist/cjs/main/app/session.d.ts +58 -0
  25. package/dist/cjs/main/app/ticker.d.ts +18 -0
  26. package/dist/cjs/main/entry.d.ts +6 -0
  27. package/dist/cjs/main/index.d.ts +119 -0
  28. package/dist/cjs/main/modules/analytics/batcher.d.ts +45 -0
  29. package/dist/cjs/main/modules/analytics/constantProperties.d.ts +53 -0
  30. package/dist/cjs/main/modules/analytics/demo.d.ts +0 -0
  31. package/dist/cjs/main/modules/analytics/events.d.ts +37 -0
  32. package/dist/cjs/main/modules/analytics/index.d.ts +73 -0
  33. package/dist/cjs/main/modules/analytics/people.d.ts +56 -0
  34. package/dist/cjs/main/modules/analytics/types.d.ts +32 -0
  35. package/dist/cjs/main/modules/analytics/utils.d.ts +19 -0
  36. package/dist/cjs/main/modules/attributeSender.d.ts +22 -0
  37. package/dist/cjs/main/modules/axiosSpy.d.ts +54 -0
  38. package/dist/cjs/main/modules/conditionsManager.d.ts +89 -0
  39. package/dist/cjs/main/modules/connection.d.ts +2 -0
  40. package/dist/cjs/main/modules/console.d.ts +6 -0
  41. package/dist/cjs/main/modules/constructedStyleSheets.d.ts +4 -0
  42. package/dist/cjs/main/modules/cssrules.d.ts +18 -0
  43. package/dist/cjs/main/modules/exception.d.ts +16 -0
  44. package/dist/cjs/main/modules/focus.d.ts +2 -0
  45. package/dist/cjs/main/modules/fonts.d.ts +2 -0
  46. package/dist/cjs/main/modules/img.d.ts +2 -0
  47. package/dist/cjs/main/modules/input.d.ts +34 -0
  48. package/dist/cjs/main/modules/longAnimationTask.d.ts +25 -0
  49. package/dist/cjs/main/modules/markerWatcher.d.ts +25 -0
  50. package/dist/cjs/main/modules/mouse.d.ts +13 -0
  51. package/dist/cjs/main/modules/network.d.ts +32 -0
  52. package/dist/cjs/main/modules/performance.d.ts +7 -0
  53. package/dist/cjs/main/modules/scroll.d.ts +2 -0
  54. package/dist/cjs/main/modules/selection.d.ts +7 -0
  55. package/dist/cjs/main/modules/tabs.d.ts +2 -0
  56. package/dist/cjs/main/modules/timing.d.ts +9 -0
  57. package/dist/cjs/main/modules/viewport.d.ts +13 -0
  58. package/dist/cjs/main/modules/webAnimations.d.ts +9 -0
  59. package/dist/cjs/main/singleton.d.ts +102 -0
  60. package/dist/cjs/main/utils.d.ts +35 -0
  61. package/dist/lib/common/interaction.d.ts +37 -0
  62. package/dist/lib/common/messages.gen.d.ts +587 -0
  63. package/dist/lib/entry.js +10669 -0
  64. package/dist/lib/entry.js.map +1 -0
  65. package/dist/lib/index.js +10429 -0
  66. package/dist/lib/index.js.map +1 -0
  67. package/dist/lib/main/app/canvas.d.ts +37 -0
  68. package/dist/lib/main/app/guards.d.ts +24 -0
  69. package/dist/lib/main/app/index.d.ts +314 -0
  70. package/dist/lib/main/app/logger.d.ts +17 -0
  71. package/dist/lib/main/app/messages.gen.d.ts +83 -0
  72. package/dist/lib/main/app/nodes/idSeq.d.ts +14 -0
  73. package/dist/lib/main/app/nodes/index.d.ts +32 -0
  74. package/dist/lib/main/app/nodes/maintainer.d.ts +28 -0
  75. package/dist/lib/main/app/observer/cssInliner.d.ts +1 -0
  76. package/dist/lib/main/app/observer/iframe_observer.d.ts +6 -0
  77. package/dist/lib/main/app/observer/iframe_offsets.d.ts +8 -0
  78. package/dist/lib/main/app/observer/observer.d.ts +52 -0
  79. package/dist/lib/main/app/observer/shadow_root_observer.d.ts +4 -0
  80. package/dist/lib/main/app/observer/top_observer.d.ts +52 -0
  81. package/dist/lib/main/app/sanitizer.d.ts +53 -0
  82. package/dist/lib/main/app/session.d.ts +58 -0
  83. package/dist/lib/main/app/ticker.d.ts +18 -0
  84. package/dist/lib/main/entry.d.ts +6 -0
  85. package/dist/lib/main/index.d.ts +119 -0
  86. package/dist/lib/main/modules/analytics/batcher.d.ts +45 -0
  87. package/dist/lib/main/modules/analytics/constantProperties.d.ts +53 -0
  88. package/dist/lib/main/modules/analytics/demo.d.ts +0 -0
  89. package/dist/lib/main/modules/analytics/events.d.ts +37 -0
  90. package/dist/lib/main/modules/analytics/index.d.ts +73 -0
  91. package/dist/lib/main/modules/analytics/people.d.ts +56 -0
  92. package/dist/lib/main/modules/analytics/types.d.ts +32 -0
  93. package/dist/lib/main/modules/analytics/utils.d.ts +19 -0
  94. package/dist/lib/main/modules/attributeSender.d.ts +22 -0
  95. package/dist/lib/main/modules/axiosSpy.d.ts +54 -0
  96. package/dist/lib/main/modules/conditionsManager.d.ts +89 -0
  97. package/dist/lib/main/modules/connection.d.ts +2 -0
  98. package/dist/lib/main/modules/console.d.ts +6 -0
  99. package/dist/lib/main/modules/constructedStyleSheets.d.ts +4 -0
  100. package/dist/lib/main/modules/cssrules.d.ts +18 -0
  101. package/dist/lib/main/modules/exception.d.ts +16 -0
  102. package/dist/lib/main/modules/focus.d.ts +2 -0
  103. package/dist/lib/main/modules/fonts.d.ts +2 -0
  104. package/dist/lib/main/modules/img.d.ts +2 -0
  105. package/dist/lib/main/modules/input.d.ts +34 -0
  106. package/dist/lib/main/modules/longAnimationTask.d.ts +25 -0
  107. package/dist/lib/main/modules/markerWatcher.d.ts +25 -0
  108. package/dist/lib/main/modules/mouse.d.ts +13 -0
  109. package/dist/lib/main/modules/network.d.ts +32 -0
  110. package/dist/lib/main/modules/performance.d.ts +7 -0
  111. package/dist/lib/main/modules/scroll.d.ts +2 -0
  112. package/dist/lib/main/modules/selection.d.ts +7 -0
  113. package/dist/lib/main/modules/tabs.d.ts +2 -0
  114. package/dist/lib/main/modules/timing.d.ts +9 -0
  115. package/dist/lib/main/modules/viewport.d.ts +13 -0
  116. package/dist/lib/main/modules/webAnimations.d.ts +9 -0
  117. package/dist/lib/main/singleton.d.ts +102 -0
  118. package/dist/lib/main/utils.d.ts +35 -0
  119. package/dist/types/common/interaction.d.ts +37 -0
  120. package/dist/types/common/messages.gen.d.ts +587 -0
  121. package/dist/types/main/app/canvas.d.ts +37 -0
  122. package/dist/types/main/app/guards.d.ts +24 -0
  123. package/dist/types/main/app/index.d.ts +314 -0
  124. package/dist/types/main/app/logger.d.ts +17 -0
  125. package/dist/types/main/app/messages.gen.d.ts +83 -0
  126. package/dist/types/main/app/nodes/idSeq.d.ts +14 -0
  127. package/dist/types/main/app/nodes/index.d.ts +32 -0
  128. package/dist/types/main/app/nodes/maintainer.d.ts +28 -0
  129. package/dist/types/main/app/observer/cssInliner.d.ts +1 -0
  130. package/dist/types/main/app/observer/iframe_observer.d.ts +6 -0
  131. package/dist/types/main/app/observer/iframe_offsets.d.ts +8 -0
  132. package/dist/types/main/app/observer/observer.d.ts +52 -0
  133. package/dist/types/main/app/observer/shadow_root_observer.d.ts +4 -0
  134. package/dist/types/main/app/observer/top_observer.d.ts +52 -0
  135. package/dist/types/main/app/sanitizer.d.ts +53 -0
  136. package/dist/types/main/app/session.d.ts +58 -0
  137. package/dist/types/main/app/ticker.d.ts +18 -0
  138. package/dist/types/main/entry.d.ts +6 -0
  139. package/dist/types/main/index.d.ts +119 -0
  140. package/dist/types/main/modules/analytics/batcher.d.ts +45 -0
  141. package/dist/types/main/modules/analytics/constantProperties.d.ts +53 -0
  142. package/dist/types/main/modules/analytics/demo.d.ts +0 -0
  143. package/dist/types/main/modules/analytics/events.d.ts +37 -0
  144. package/dist/types/main/modules/analytics/index.d.ts +73 -0
  145. package/dist/types/main/modules/analytics/people.d.ts +56 -0
  146. package/dist/types/main/modules/analytics/types.d.ts +32 -0
  147. package/dist/types/main/modules/analytics/utils.d.ts +19 -0
  148. package/dist/types/main/modules/attributeSender.d.ts +22 -0
  149. package/dist/types/main/modules/axiosSpy.d.ts +54 -0
  150. package/dist/types/main/modules/conditionsManager.d.ts +89 -0
  151. package/dist/types/main/modules/connection.d.ts +2 -0
  152. package/dist/types/main/modules/console.d.ts +6 -0
  153. package/dist/types/main/modules/constructedStyleSheets.d.ts +4 -0
  154. package/dist/types/main/modules/cssrules.d.ts +18 -0
  155. package/dist/types/main/modules/exception.d.ts +16 -0
  156. package/dist/types/main/modules/focus.d.ts +2 -0
  157. package/dist/types/main/modules/fonts.d.ts +2 -0
  158. package/dist/types/main/modules/img.d.ts +2 -0
  159. package/dist/types/main/modules/input.d.ts +34 -0
  160. package/dist/types/main/modules/longAnimationTask.d.ts +25 -0
  161. package/dist/types/main/modules/markerWatcher.d.ts +25 -0
  162. package/dist/types/main/modules/mouse.d.ts +13 -0
  163. package/dist/types/main/modules/network.d.ts +32 -0
  164. package/dist/types/main/modules/performance.d.ts +7 -0
  165. package/dist/types/main/modules/scroll.d.ts +2 -0
  166. package/dist/types/main/modules/selection.d.ts +7 -0
  167. package/dist/types/main/modules/tabs.d.ts +2 -0
  168. package/dist/types/main/modules/timing.d.ts +9 -0
  169. package/dist/types/main/modules/viewport.d.ts +13 -0
  170. package/dist/types/main/modules/webAnimations.d.ts +9 -0
  171. package/dist/types/main/singleton.d.ts +102 -0
  172. package/dist/types/main/utils.d.ts +35 -0
  173. package/package.json +87 -0
@@ -0,0 +1,54 @@
1
+ import type App from '../app/index.js';
2
+ import type { RequestResponseData, Options } from './network.js';
3
+ interface RawAxiosHeaders {
4
+ [key: string]: string;
5
+ }
6
+ interface AxiosRequestConfig {
7
+ url: string;
8
+ method?: string;
9
+ baseURL?: string;
10
+ status?: number;
11
+ headers: {
12
+ toJSON(): RawAxiosHeaders;
13
+ };
14
+ params?: any;
15
+ data?: any;
16
+ }
17
+ interface InternalAxiosRequestConfig extends AxiosRequestConfig {
18
+ __oxvosessions_timing: number;
19
+ headers: {
20
+ toJSON(): RawAxiosHeaders;
21
+ set(name: string, value: string): void;
22
+ };
23
+ }
24
+ interface AxiosResponse<T = any> {
25
+ data: T;
26
+ status: number;
27
+ statusText: string;
28
+ headers: {
29
+ toJSON(): RawAxiosHeaders;
30
+ };
31
+ config: InternalAxiosRequestConfig;
32
+ request?: any;
33
+ response?: AxiosRequestConfig;
34
+ }
35
+ export interface AxiosInstance extends Record<string, any> {
36
+ getUri: (config?: AxiosRequestConfig) => string;
37
+ interceptors: {
38
+ request: AxiosInterceptorManager<InternalAxiosRequestConfig>;
39
+ response: AxiosInterceptorManager<AxiosResponse>;
40
+ };
41
+ }
42
+ export interface AxiosInterceptorOptions {
43
+ synchronous?: boolean;
44
+ }
45
+ export interface AxiosInterceptorManager<V> {
46
+ use(onFulfilled?: ((value: V) => V | Promise<V>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number;
47
+ eject?: (id: number) => void;
48
+ clear?: () => void;
49
+ }
50
+ export default function (app: App, instance: AxiosInstance, opts: Options, sanitize: (data: RequestResponseData) => RequestResponseData | null, stringify: (data: {
51
+ headers: Record<string, string>;
52
+ body: any;
53
+ }) => string): void;
54
+ export {};
@@ -0,0 +1,89 @@
1
+ import Message, { CustomEvent, JSException, MouseClick, NetworkRequest, SetPageLocation } from '../../common/messages.gen.js';
2
+ import App, { StartOptions } from '../app/index.js';
3
+ export interface IFeatureFlag {
4
+ key: string;
5
+ is_persist: boolean;
6
+ value: string | boolean;
7
+ payload: string;
8
+ }
9
+ interface Filter {
10
+ filters: {
11
+ operator: string;
12
+ value: string[];
13
+ type: string;
14
+ source?: string;
15
+ }[];
16
+ operator: string;
17
+ value: string[];
18
+ type: string;
19
+ source?: string;
20
+ }
21
+ export default class ConditionsManager {
22
+ private readonly app;
23
+ private readonly startParams;
24
+ conditions: Condition[];
25
+ hasStarted: boolean;
26
+ constructor(app: App, startParams: StartOptions);
27
+ setConditions(conditions: Condition[]): void;
28
+ fetchConditions(projectId: string, token: string): Promise<void>;
29
+ createConditionFromFilter: (filter: Filter) => Condition | undefined;
30
+ trigger(conditionName: string): void;
31
+ processMessage(message: Message): void;
32
+ processFlags(flag: IFeatureFlag[]): void;
33
+ durationInt: ReturnType<typeof setInterval> | null;
34
+ processDuration(durationMs: number, condName: string): void;
35
+ networkRequest(message: NetworkRequest): void;
36
+ customEvent(message: CustomEvent): void;
37
+ clickEvent(message: MouseClick): void;
38
+ pageLocationEvent(message: SetPageLocation): void;
39
+ jsExceptionEvent(message: JSException): void;
40
+ }
41
+ type CommonCondition = {
42
+ type: 'visited_url' | 'click' | 'custom_event';
43
+ operator: keyof typeof operators;
44
+ value: string[];
45
+ name: string;
46
+ };
47
+ type ExceptionCondition = {
48
+ type: 'exception';
49
+ operator: 'contains' | 'startsWith' | 'endsWith';
50
+ value: string[];
51
+ name: string;
52
+ };
53
+ type FeatureFlagCondition = {
54
+ type: 'feature_flag';
55
+ operator: 'is';
56
+ value: string[];
57
+ name: string;
58
+ };
59
+ type SessionDurationCondition = {
60
+ type: 'session_duration';
61
+ value: number[];
62
+ name: string;
63
+ };
64
+ type SubCondition = {
65
+ type: 'network_request';
66
+ key: 'url' | 'status' | 'method' | 'duration';
67
+ operator: keyof typeof operators;
68
+ value: string[];
69
+ };
70
+ type NetworkRequestCondition = {
71
+ type: 'network_request';
72
+ subConditions: SubCondition[];
73
+ name: string;
74
+ };
75
+ type Condition = CommonCondition | ExceptionCondition | FeatureFlagCondition | SessionDurationCondition | NetworkRequestCondition;
76
+ declare const operators: {
77
+ is: (val: string, target: string[]) => boolean;
78
+ isAny: () => boolean;
79
+ isNot: (val: string, target: string[]) => boolean;
80
+ contains: (val: string, target: string[]) => boolean;
81
+ notContains: (val: string, target: string[]) => boolean;
82
+ startsWith: (val: string, target: string[]) => boolean;
83
+ endsWith: (val: string, target: string[]) => boolean;
84
+ greaterThan: (val: number, target: number) => boolean;
85
+ greaterOrEqual: (val: number, target: number) => boolean;
86
+ lessOrEqual: (val: number, target: number) => boolean;
87
+ lessThan: (val: number, target: number) => boolean;
88
+ };
89
+ export {};
@@ -0,0 +1,2 @@
1
+ import App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,6 @@
1
+ import type App from '../app/index.js';
2
+ export interface Options {
3
+ consoleMethods: Array<string> | null;
4
+ consoleThrottling: number;
5
+ }
6
+ export default function (app: App, opts: Partial<Options>): void;
@@ -0,0 +1,4 @@
1
+ import type App from '../app/index.js';
2
+ export declare function nextID(): number;
3
+ export declare const styleSheetIDMap: Map<CSSStyleSheet, number>;
4
+ export default function (app: App | null): void;
@@ -0,0 +1,18 @@
1
+ import type App from '../app/index.js';
2
+ export interface CssRulesOptions {
3
+ /** turn this on if you have issues with emotionjs created styles */
4
+ scanInMemoryCSS?: boolean;
5
+ /** how often to scan tracked stylesheets (with "empty" rules) */
6
+ checkCssInterval?: number;
7
+ /**
8
+ Useful for cases where you expect limited amount of mutations
9
+
10
+ i.e when sheets are hydrated on client after initial render.
11
+
12
+ if you want to observe for x seconds, do (x*1000)/checkCssInterval = checkLimit
13
+
14
+ applied to each stylesheet individually.
15
+ */
16
+ checkLimit?: number;
17
+ }
18
+ export default function (app: App, opts: CssRulesOptions): void;
@@ -0,0 +1,16 @@
1
+ import type App from '../app/index.js';
2
+ import type Message from '../app/messages.gen.js';
3
+ export interface Options {
4
+ trackErrors: boolean;
5
+ }
6
+ interface StackFrame {
7
+ columnNumber?: number;
8
+ lineNumber?: number;
9
+ fileName?: string;
10
+ functionName?: string;
11
+ source?: string;
12
+ }
13
+ export declare function getExceptionMessage(error: Error, fallbackStack: Array<StackFrame>, metadata?: Record<string, any>): Message;
14
+ export declare function getExceptionMessageFromEvent(e: ErrorEvent | PromiseRejectionEvent, context?: typeof globalThis, metadata?: Record<string, any>): Message | null;
15
+ export default function (app: App, opts: Partial<Options>): void;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,34 @@
1
+ import type App from '../app/index.js';
2
+ type TextFieldElement = HTMLInputElement | HTMLTextAreaElement;
3
+ export declare function getInputLabel(node: TextFieldElement): string;
4
+ export declare const InputMode: {
5
+ readonly Plain: 0;
6
+ readonly Obscured: 1;
7
+ readonly Hidden: 2;
8
+ };
9
+ export type InputModeT = (typeof InputMode)[keyof typeof InputMode];
10
+ export interface Options {
11
+ /**
12
+ * Sanitize numbers from DOM input nodes.
13
+ *
14
+ * (for plain text nodes, look for maskTextNumbers)
15
+ * */
16
+ maskInputNumbers: boolean;
17
+ /**
18
+ * Sanitize emails from DOM input nodes.
19
+ *
20
+ * (for plain text nodes, look for maskTextEmails)
21
+ * */
22
+ maskInputEmails: boolean;
23
+ /**
24
+ * Sanitize dates from DOM input nodes.
25
+ * */
26
+ maskInputDates: boolean;
27
+ /**
28
+ * Default input mode for all input nodes. Higher security level
29
+ * will override other settings.
30
+ * */
31
+ inputPrivacyMode: InputModeT;
32
+ }
33
+ export default function (app: App, opts: Partial<Options>): void;
34
+ export {};
@@ -0,0 +1,25 @@
1
+ import type App from '../app/index.js';
2
+ export interface LongAnimationTask extends PerformanceEntry {
3
+ name: string;
4
+ duration: number;
5
+ blockingDuration: number;
6
+ firstUIEventTimestamp: number;
7
+ startTime: number;
8
+ scripts: [
9
+ {
10
+ name: string;
11
+ duration: number;
12
+ invoker: string;
13
+ invokerType: string;
14
+ pauseDuration: number;
15
+ sourceURL: string;
16
+ sourceFunctionName: string;
17
+ sourceCharPosition: number;
18
+ forcedStyleAndLayoutDuration: number;
19
+ }
20
+ ];
21
+ }
22
+ export interface LATOptions {
23
+ longTasks: boolean;
24
+ }
25
+ export default function (app: App, opts: Partial<LATOptions>): void;
@@ -0,0 +1,25 @@
1
+ export declare const WATCHED_MARKERS_KEY = "__or__watched_markers__";
2
+ declare class MarkerWatcher {
3
+ interval: ReturnType<typeof setInterval> | null;
4
+ tags: {
5
+ id: number;
6
+ selector: string;
7
+ }[];
8
+ observer: IntersectionObserver;
9
+ private readonly sessionStorage;
10
+ private readonly errLog;
11
+ private readonly onMarkerHit;
12
+ constructor(params: {
13
+ sessionStorage: Storage;
14
+ errLog: (args: any[]) => void;
15
+ onMarkerHit: (markerId: number) => void;
16
+ });
17
+ fetchTags(ingest: string, token: string): Promise<void>;
18
+ setTags(tags: {
19
+ id: number;
20
+ selector: string;
21
+ }[]): void;
22
+ onMarkerRendered(markerId: number): void;
23
+ clear(): void;
24
+ }
25
+ export default MarkerWatcher;
@@ -0,0 +1,13 @@
1
+ import type App from '../app/index.js';
2
+ export interface MouseHandlerOptions {
3
+ disableClickmaps?: boolean;
4
+ /**
5
+ * how many ticks to wait before capturing mouse position
6
+ * (can affect performance)
7
+ * 1 tick = 30ms
8
+ * default 7 = 210ms
9
+ * */
10
+ trackingOffset?: number;
11
+ }
12
+ export default function (app: App, options?: MouseHandlerOptions): void;
13
+ export declare function getCSSPath(el: any): string | false;
@@ -0,0 +1,32 @@
1
+ import type App from '../app/index.js';
2
+ import type { AxiosInstance } from './axiosSpy.js';
3
+ interface RequestData {
4
+ body: string | null;
5
+ headers: Record<string, string>;
6
+ }
7
+ interface ResponseData {
8
+ body: any;
9
+ headers: Record<string, string>;
10
+ }
11
+ export interface RequestResponseData {
12
+ readonly status: number;
13
+ readonly method: string;
14
+ url: string;
15
+ request: RequestData;
16
+ response: ResponseData;
17
+ }
18
+ type Sanitizer = (data: RequestResponseData) => RequestResponseData | null;
19
+ export interface Options {
20
+ sessionTokenHeader: string | boolean;
21
+ errorsOnly: boolean;
22
+ ignoreHeaders: Array<string> | boolean;
23
+ captureBodies: boolean;
24
+ captureInIframes: boolean;
25
+ sanitizer?: Sanitizer;
26
+ axiosInstances?: Array<AxiosInstance>;
27
+ useProxy?: boolean;
28
+ tokenUrlMatcher?: (url: string) => boolean;
29
+ enabled: boolean;
30
+ }
31
+ export default function (app: App, opts?: Partial<Options>): void;
32
+ export {};
@@ -0,0 +1,7 @@
1
+ import type App from '../app/index.js';
2
+ export declare const deviceMemory: number;
3
+ export declare const jsHeapSizeLimit: number;
4
+ export interface Options {
5
+ trackPerformance: boolean;
6
+ }
7
+ export default function (app: App, opts: Partial<Options>): void;
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App, insideIframe: boolean | null): void;
@@ -0,0 +1,7 @@
1
+ import type App from '../app/index.js';
2
+ declare function selection(app: App): void;
3
+ export default selection;
4
+ /** TODO: research how to get all in-between nodes inside selection range
5
+ * including nodes between anchor and focus nodes and their children
6
+ * without recursively searching the dom tree
7
+ */
@@ -0,0 +1,2 @@
1
+ import type App from '../app/index.js';
2
+ export default function (app: App): void;
@@ -0,0 +1,9 @@
1
+ import type App from '../app/index.js';
2
+ export interface Options {
3
+ trackResourceTimings: boolean;
4
+ capturePageLoadTimings: boolean;
5
+ capturePageRenderTimings: boolean;
6
+ excludedResourceUrls?: Array<string>;
7
+ resourceNameSanitizer?: (url: string) => string;
8
+ }
9
+ export default function (app: App, opts: Partial<Options>): void;
@@ -0,0 +1,13 @@
1
+ import type App from '../app/index.js';
2
+ export interface Options {
3
+ urlSanitizer?: (url: string) => string;
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;
12
+ }
13
+ export default function (app: App, options?: Options): void;
@@ -0,0 +1,9 @@
1
+ import type App from '../app/index.js';
2
+ /**
3
+ * this will only work for custom elements by default (because of ionic)
4
+ */
5
+ export interface Options {
6
+ allElements?: boolean;
7
+ }
8
+ declare function webAnimations(app: App, options?: Options): void;
9
+ export default webAnimations;
@@ -0,0 +1,102 @@
1
+ import Tracker, { App, Options } from './index.js';
2
+ import type { StartOptions, StartPromiseReturn } from './app/index.js';
3
+ declare class BrowserSingleton {
4
+ private instance;
5
+ private isConfigured;
6
+ /**
7
+ * Call this method once to create browser SDK configuration
8
+ * @param options {Object} Check available options:
9
+ * https://docs.oxvo.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
+ identify(id: string, properties?: Record<string, any>): void;
20
+ get analytics(): import("./entry.js").Analytics | null;
21
+ /**
22
+ * Set metadata for the current session
23
+ *
24
+ * Keys must be configured in project settings (metadata slots)
25
+ *
26
+ * Read more: https://docs.oxvo.com/en/installation/metadata/
27
+ */
28
+ setMetadata(key: string, value: string): void;
29
+ /**
30
+ * Returns full URL for the current session
31
+ */
32
+ getSessionLink(options?: {
33
+ withCurrentTime?: boolean;
34
+ }): string | undefined;
35
+ getSessionKey(): string | null | undefined;
36
+ getSessionSecret(): string | null | undefined;
37
+ track(key: string, payload?: any, issue?: boolean): void;
38
+ report(key: string, payload?: any): void;
39
+ handleError(e: Error | ErrorEvent | PromiseRejectionEvent, metadata?: Record<string, any>): void;
40
+ restartCanvasTracking(): void;
41
+ /**
42
+ * Set the anonymous user ID
43
+ */
44
+ setVisitorID(id: string): void;
45
+ /**
46
+ * Check if the browser SDK is active
47
+ */
48
+ isActive(): boolean;
49
+ /**
50
+ * Get the underlying browser SDK instance
51
+ *
52
+ * Use when you need access to methods not exposed by the singleton
53
+ */
54
+ getInstance(): Tracker | null;
55
+ /**
56
+ * start buffering messages without starting the actual session, which gives user 30 seconds to "activate" and record
57
+ * session by calling start() on conditional trigger and we will then send buffered batch, so it won't get lost
58
+ * */
59
+ coldStart(startOpts?: Partial<StartOptions>, conditional?: boolean): Promise<never> | undefined;
60
+ /**
61
+ * Creates a named hook that expects event name, data string and msg direction (up/down),
62
+ * it will skip any message bigger than 5 mb or event name bigger than 255 symbols
63
+ * msg direction is "down" (incoming) by default
64
+ *
65
+ * @returns {(msgType: string, data: string, dir: 'up' | 'down') => void}
66
+ * */
67
+ trackWs(channelName: string): ((msgType: string, data: string, dir: 'up' | 'down') => void) | undefined;
68
+ private ensureConfigured;
69
+ use<T>(fn: (app: App | null, options?: Partial<Options>) => T): T;
70
+ /**
71
+ * Starts offline session recording. Keep in mind that only user device time will be used for timestamps.
72
+ * (no backend delay sync)
73
+ *
74
+ * @param {Object} startOpts - options for session start, same as .start()
75
+ * @param {Function} onSessionSent - callback that will be called once session is fully sent
76
+ * @returns methods to manipulate buffer:
77
+ *
78
+ * saveBuffer - to save it in localStorage
79
+ *
80
+ * getBuffer - returns current buffer
81
+ *
82
+ * setBuffer - replaces current buffer with given
83
+ * */
84
+ startOfflineRecording(...args: Parameters<Tracker['startOfflineRecording']>): Promise<never> | {
85
+ saveBuffer: () => void;
86
+ getBuffer: () => import("./app/messages.gen.js").default[];
87
+ setBuffer: (buffer: import("./app/messages.gen.js").default[]) => void;
88
+ } | undefined;
89
+ /**
90
+ * Uploads the stored session buffer to backend
91
+ * @returns promise that resolves once messages are loaded, it has to be awaited
92
+ * so the session can be uploaded properly
93
+ * @resolve - if messages were loaded into service worker successfully
94
+ * @reject {string} - error message
95
+ * */
96
+ uploadOfflineRecording(): Promise<void> | undefined;
97
+ forceFlushBatch(): void;
98
+ getSessionMeta(): import("./app/session.js").SessionInfo | null;
99
+ getTabId(): string | null;
100
+ }
101
+ declare const browser: BrowserSingleton;
102
+ export default browser;
@@ -0,0 +1,35 @@
1
+ export declare const IN_BROWSER: boolean;
2
+ export declare const IS_FIREFOX: false | RegExpMatchArray | null;
3
+ export declare const MAX_STR_LEN = 100000;
4
+ export declare function adjustTimeOrigin(): void;
5
+ export declare function getTimeOrigin(): number;
6
+ export declare const now: () => number;
7
+ export declare const stars: (str: string) => string;
8
+ export declare function normSpaces(str: string): string;
9
+ export declare function isURL(s: string): boolean;
10
+ export declare const DOCS_HOST = "https://docs.oxvo.com";
11
+ export declare function isLoopbackHost(hostname: string): boolean;
12
+ export declare function canUseTrackerOrigin(protocol: string, hostname: string, devAllowInsecure?: boolean): boolean;
13
+ export declare function deprecationWarn(nameOfFeature: string, useInstead: string, docsPath?: string): void;
14
+ export declare function getLabelAttribute(e: Element): string | null;
15
+ export declare function hasOxvoSessionsAttribute(e: Element, attr: string): boolean;
16
+ /**
17
+ * checks if iframe is accessible
18
+ **/
19
+ export declare function canAccessIframe(iframe: HTMLIFrameElement): boolean;
20
+ export declare function canAccessTarget(target: EventTarget): boolean;
21
+ export declare function generateRandomId(len?: number): string;
22
+ export declare function inIframe(): boolean | null;
23
+ /**
24
+ * Because angular devs decided that its a good idea to override a browser apis
25
+ * we need to use this to achieve safe behavior
26
+ * */
27
+ export declare function ngSafeBrowserMethod(method: string): string;
28
+ export declare function createMutationObserver(cb: MutationCallback, forceNgOff?: boolean): MutationObserver;
29
+ export declare function createEventListener(target: EventTarget, event: string, cb: EventListenerOrEventListenerObject, capture?: boolean, forceNgOff?: boolean): void;
30
+ export declare function deleteEventListener(target: EventTarget, event: string, cb: EventListenerOrEventListenerObject, capture?: boolean, forceNgOff?: boolean): void;
31
+ export declare function requestIdleCb(callback: () => void): void;
32
+ export declare function simpleMerge<T>(defaultObj: T, givenObj: Partial<T>): T;
33
+ export declare function throttleWithTrailing<K, Args extends any[]>(fn: (key: K, ...args: Args) => void, interval: number): ((key: K, ...args: Args) => void) & {
34
+ clear: () => void;
35
+ };
@@ -0,0 +1,37 @@
1
+ import Message from './messages.gen.js';
2
+ export interface Options {
3
+ connAttemptCount?: number;
4
+ connAttemptGap?: number;
5
+ }
6
+ type Start = {
7
+ type: 'start';
8
+ ingestPoint: string;
9
+ pageNo: number;
10
+ timestamp: number;
11
+ url: string;
12
+ tabId: string;
13
+ } & Options;
14
+ type Auth = {
15
+ type: 'auth';
16
+ token: string;
17
+ beaconSizeLimit?: number;
18
+ };
19
+ export type ToWorkerData = null | 'stop' | Start | Auth | Array<Message> | {
20
+ type: 'compressed';
21
+ batch: Uint8Array;
22
+ } | {
23
+ type: 'uncompressed';
24
+ batch: Uint8Array;
25
+ } | 'forceFlushBatch' | 'closing' | 'check_queue';
26
+ type Failure = {
27
+ type: 'failure';
28
+ reason: string;
29
+ };
30
+ type QEmpty = {
31
+ type: 'queue_empty';
32
+ };
33
+ export type FromWorkerData = 'a_stop' | 'a_start' | Failure | 'not_init' | {
34
+ type: 'compress';
35
+ batch: Uint8Array;
36
+ } | QEmpty;
37
+ export {};