@brainfish-ai/web-tracker 0.0.12 → 0.0.14

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.
@@ -33,4 +33,5 @@ export declare class Tracker extends TrackerSdk {
33
33
  * @returns Promise that resolves when events are recorded and session is managed
34
34
  */
35
35
  private recordEventsToServer;
36
+ private sendScreenViewEvent;
36
37
  }
@@ -1,6 +1,7 @@
1
1
  import { default as Sender } from './sender';
2
2
  import { default as RecordingManager } from './recordingManager';
3
3
  import { default as Timer } from './timer';
4
+ import { default as SessionManager } from '../session/sessionManager';
4
5
  export default class Agent {
5
6
  recordingManager: RecordingManager;
6
7
  sender: Sender;
@@ -8,18 +9,25 @@ export default class Agent {
8
9
  MAX_IDLE_TIME: any;
9
10
  timer: Timer | undefined;
10
11
  sendEvents: ((events: any[]) => Promise<void>) | undefined;
12
+ sendScreenViewEvent: ((props: any) => void) | undefined;
11
13
  recordingBlocklist: string[];
12
14
  _allowLocalhostRecording?: boolean;
13
15
  _allowScreenRecording?: boolean;
16
+ private sessionCreationPromise;
17
+ private static _sessionManager;
18
+ get sessionManager(): SessionManager;
14
19
  constructor();
15
- start({ endpoint, sendEvents, recordingBlocklist, _allowLocalhostRecording, _allowScreenRecording, }: {
20
+ start({ endpoint, sendEvents, sendScreenViewEvent, recordingBlocklist, _allowLocalhostRecording, _allowScreenRecording, }: {
16
21
  endpoint: string;
17
22
  sendEvents: (events: any[]) => Promise<void>;
23
+ sendScreenViewEvent: (props: any) => void;
18
24
  recordingBlocklist: string[];
19
25
  _allowLocalhostRecording?: boolean;
20
26
  _allowScreenRecording?: boolean;
21
27
  }): Promise<void>;
22
28
  handleTimeout(): void;
29
+ handleActivityDuringIdle(): void;
23
30
  takeFullSnapshot(): void;
24
31
  static handleCustomEvent(customEventType: string): void;
32
+ private createSession;
25
33
  }
@@ -1,25 +1,6 @@
1
1
  declare class Recorder {
2
2
  static mockImplementation(arg0: () => any): void;
3
3
  options: {
4
- emit: {
5
- (event: any): void;
6
- (event: any): void;
7
- };
8
- plugins: import('@rrweb/types').RecordPlugin[];
9
- recordOptions: {
10
- blockClass: string;
11
- blockSelector: null;
12
- ignoreClass: string;
13
- ignoreCSSAttributes: null;
14
- maskTextClass: string;
15
- maskTextSelector: null;
16
- maskAllInputs: boolean;
17
- maskInputOptions: {
18
- password: boolean;
19
- };
20
- maskInputFn: undefined;
21
- maskTextFn: undefined;
22
- };
23
4
  recordConsolePlugin: {
24
5
  level: string[];
25
6
  lengthThreshold: number;
@@ -29,6 +10,23 @@ declare class Recorder {
29
10
  depthOfLimit: number;
30
11
  };
31
12
  };
13
+ emit: {
14
+ (event: any): void;
15
+ (event: any): void;
16
+ };
17
+ plugins: import('@rrweb/types').RecordPlugin[];
18
+ blockClass: string;
19
+ blockSelector: undefined;
20
+ ignoreClass: string;
21
+ ignoreCSSAttributes: undefined;
22
+ maskTextClass: string;
23
+ maskTextSelector: undefined;
24
+ maskAllInputs: boolean;
25
+ maskInputOptions: {
26
+ password: boolean;
27
+ };
28
+ maskInputFn: undefined;
29
+ maskTextFn: undefined;
32
30
  };
33
31
  stop: (() => void) | null;
34
32
  constructor(handleEvent: {
@@ -13,5 +13,6 @@ declare class RecordingManager {
13
13
  private isClick;
14
14
  private nodeIsInteresting;
15
15
  private isCustom;
16
+ private isInteractiveEvent;
16
17
  }
17
18
  export default RecordingManager;
@@ -1,5 +1,5 @@
1
1
  export type SessionCallbacks = {
2
- onSessionChanged?: () => void;
2
+ takeFullSnapshot?: () => void;
3
3
  };
4
4
  /**
5
5
  * Manages session state and transitions for the tracker
@@ -9,7 +9,8 @@ export type SessionCallbacks = {
9
9
  export declare class SessionManager {
10
10
  private static instance;
11
11
  private sessionId;
12
- private constructor();
12
+ private lastScreenViewEventTime;
13
+ isIdle: boolean;
13
14
  static getInstance(): SessionManager;
14
15
  /**
15
16
  * Determines the current session state based on previous and current session IDs
@@ -24,10 +25,10 @@ export declare class SessionManager {
24
25
  * @param newSessionId The new session ID from the server
25
26
  * @param callbacks Optional callbacks for session state changes
26
27
  */
27
- updateSession(newSessionId: string, callbacks?: SessionCallbacks): void;
28
- /**
29
- * Gets the current session ID
30
- */
28
+ updateSession(newSessionId: string | null, callbacks?: SessionCallbacks): void;
29
+ updateLastScreenViewEventTime(): void;
30
+ updateIdleStatus(isIdle: boolean): void;
31
+ getLastScreenViewEventTime(): number;
31
32
  getCurrentSessionId(): string | null;
32
33
  }
33
34
  export default SessionManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/web-tracker",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "main": "dist/index.js",
5
5
  "description": "Brainfish Tracker for Web",
6
6
  "files": [