@sessionsight/insights 1.0.0 → 1.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.
@@ -0,0 +1,115 @@
1
+ import { WorkerBridge } from './worker-bridge.js';
2
+ import type { RecordOptions, PrivacyConfig } from './types.js';
3
+ export declare class Recorder {
4
+ private bridge;
5
+ private visitorId;
6
+ private preBuffer;
7
+ private isRecording;
8
+ private stopRrweb;
9
+ private userId;
10
+ private userProperties;
11
+ private userPropertiesDirty;
12
+ private lastHref;
13
+ private lastEmittedFlagToken;
14
+ private flagCheckTimer;
15
+ private origPushState;
16
+ private origReplaceState;
17
+ private formStarted;
18
+ private formStartTimestamps;
19
+ private focusTimestamps;
20
+ private lastMouseMoveEmit;
21
+ private scrollHistory;
22
+ private lastScrollDirection;
23
+ private lastScrollY;
24
+ private fieldFocusCounts;
25
+ private lastInteractionTime;
26
+ private idleTimer;
27
+ private idleEmitted;
28
+ private static readonly IDLE_THRESHOLD_MS;
29
+ private lastErrorMessage;
30
+ private lastErrorTime;
31
+ private static readonly SCROLL_DEPTH_THRESHOLDS;
32
+ private scrollDepthHits;
33
+ private scrollSentinels;
34
+ private scrollDepthObserver;
35
+ private settledSnapshotTimer;
36
+ private static readonly SETTLED_SNAPSHOT_DELAY_MS;
37
+ private hiddenAt;
38
+ private static readonly VISIBILITY_GRACE_MS;
39
+ endedByVisibility: boolean;
40
+ private isHidden;
41
+ private propertyId;
42
+ private privacyMode;
43
+ private excludePagePatterns;
44
+ private isPaused;
45
+ constructor(bridge: WorkerBridge, propertyId: string, visitorId: string, options?: {
46
+ privacyMode?: 'default' | 'relaxed';
47
+ excludePages?: string[];
48
+ });
49
+ start(autoRecord: boolean): void;
50
+ /** Start persisting events to the server. Call after init({ autoRecord: false }). */
51
+ beginRecording(options?: RecordOptions): void;
52
+ stop(): void;
53
+ getVisitorId(): string;
54
+ getBridge(): WorkerBridge;
55
+ getPropertyId(): string;
56
+ identify(userId: string, properties?: Record<string, string | number | boolean>): void;
57
+ /**
58
+ * Apply server-delivered privacy configuration. If settings differ from the
59
+ * current defaults, update the recorder and trigger a fresh FullSnapshot so
60
+ * replay uses the correct masking from this point forward.
61
+ */
62
+ applyPrivacyConfig(config: PrivacyConfig): void;
63
+ /**
64
+ * Stamp fixed dimensions onto data-ss-exclude elements so that when rrweb
65
+ * replaces them with empty placeholders (via blockSelector), the placeholders
66
+ * preserve the original layout space.
67
+ */
68
+ private stampExcludedDimensions;
69
+ private startRrweb;
70
+ /**
71
+ * Schedule a delayed FullSnapshot to capture the page after async content
72
+ * has loaded (lazy images, client-rendered components, etc.). This gives
73
+ * the heatmap a much better baseline than the immediate rrweb snapshot.
74
+ */
75
+ private scheduleSettledSnapshot;
76
+ /** Route an event to the bridge or pre-buffer */
77
+ private pushEvent;
78
+ /** Trim pre-buffer to keep only the last 5 seconds of events */
79
+ private trimPreBuffer;
80
+ private emitCustomEvent;
81
+ private static readonly INPUT_SELECTOR;
82
+ /** Find the nearest grouping container: <form>, [data-ss-form], or null (page-level). */
83
+ private getFormContainer;
84
+ private getFormInfo;
85
+ private getFieldInfo;
86
+ private handleFieldFocus;
87
+ private handleFieldBlur;
88
+ private handleClick;
89
+ private getElementLabel;
90
+ private handleFormSubmit;
91
+ private static readonly INTERACTIVE_SELECTOR;
92
+ private static readonly DEAD_CLICK_DEFER_MS;
93
+ private handleHeatmapClick;
94
+ private deferDeadClickCheck;
95
+ private handleHeatmapMouseMove;
96
+ private handleHeatmapScroll;
97
+ private setupScrollDepthObserver;
98
+ private placeSentinels;
99
+ private teardownScrollDepthObserver;
100
+ private sanitizePii;
101
+ private stripQueryString;
102
+ private emitErrorEvent;
103
+ private handleWindowError;
104
+ private handleUnhandledRejection;
105
+ private resetIdleTimer;
106
+ private checkIdle;
107
+ private handleKeydown;
108
+ private patchHistoryMethods;
109
+ private unpatchHistoryMethods;
110
+ private handleNavigation;
111
+ private checkFlagToken;
112
+ private collectMetadata;
113
+ private handleVisibilityChange;
114
+ private handleBeforeUnload;
115
+ }