@temps-sdk/react-analytics 0.0.1-beta.2 → 0.0.1-beta.21

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,55 @@
1
+ export interface EngagementTrackerOptions {
2
+ basePath?: string;
3
+ domain?: string;
4
+ heartbeatInterval?: number;
5
+ inactivityTimeout?: number;
6
+ engagementThreshold?: number;
7
+ onHeartbeat?: (data: EngagementData) => void;
8
+ onPageLeave?: (data: EngagementData) => void;
9
+ }
10
+ export interface EngagementData {
11
+ engagement_time_seconds: number;
12
+ total_time_seconds: number;
13
+ heartbeat_count: number;
14
+ is_engaged: boolean;
15
+ is_visible: boolean;
16
+ time_since_last_activity: number;
17
+ }
18
+ export declare class EngagementTracker {
19
+ private startTime;
20
+ private engagementTime;
21
+ private lastActivityTime;
22
+ private lastEngagementStart;
23
+ private heartbeatCount;
24
+ private heartbeatInterval;
25
+ private inactivityTimeout;
26
+ private engagementThreshold;
27
+ private isVisible;
28
+ private isFocused;
29
+ private isActive;
30
+ private heartbeatTimer;
31
+ private inactivityTimer;
32
+ private hasTrackedLeave;
33
+ private readonly basePath;
34
+ private readonly domain;
35
+ private readonly onHeartbeat?;
36
+ private readonly onPageLeave?;
37
+ constructor(options?: EngagementTrackerOptions);
38
+ private setupEventListeners;
39
+ private handleVisibilityChange;
40
+ private handleFocus;
41
+ private handleBlur;
42
+ private pauseEngagement;
43
+ private handleUserActivity;
44
+ private resetInactivityTimer;
45
+ private updateEngagementTime;
46
+ private startHeartbeat;
47
+ private stopHeartbeat;
48
+ private sendHeartbeat;
49
+ private handlePageLeave;
50
+ private handleNavigation;
51
+ private getEngagementData;
52
+ private reset;
53
+ destroy(): void;
54
+ }
55
+ //# sourceMappingURL=EngagementTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngagementTracker.d.ts","sourceRoot":"","sources":["../src/EngagementTracker.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,cAAc;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,mBAAmB,CAAuB;IAClD,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,cAAc,CAA+C;IACrE,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAiC;IAC9D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAiC;gBAElD,OAAO,GAAE,wBAA6B;IAsBlD,OAAO,CAAC,mBAAmB;IA6B3B,OAAO,CAAC,sBAAsB,CAW5B;IAEF,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,UAAU,CAIhB;IAEF,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,kBAAkB,CAexB;IAEF,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,aAAa;YAOP,aAAa;IA+B3B,OAAO,CAAC,eAAe,CAyBrB;IAEF,OAAO,CAAC,gBAAgB,CAGtB;IAEF,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,KAAK;IAeN,OAAO,IAAI,IAAI;CAoBvB"}
@@ -0,0 +1,223 @@
1
+ "use client";
2
+ import { sendAnalytics, sendAnalyticsReliable } from "./utils";
3
+ export class EngagementTracker {
4
+ constructor(options = {}) {
5
+ this.engagementTime = 0;
6
+ this.lastEngagementStart = null;
7
+ this.heartbeatCount = 0;
8
+ this.isActive = true;
9
+ this.heartbeatTimer = null;
10
+ this.inactivityTimer = null;
11
+ this.hasTrackedLeave = false;
12
+ this.handleVisibilityChange = () => {
13
+ const wasVisible = this.isVisible;
14
+ this.isVisible = document.visibilityState === "visible";
15
+ if (!wasVisible && this.isVisible) {
16
+ // Tab became visible - but don't start engagement until user interacts
17
+ this.startHeartbeat();
18
+ }
19
+ else if (wasVisible && !this.isVisible) {
20
+ // Tab became hidden - pause engagement
21
+ this.pauseEngagement();
22
+ }
23
+ };
24
+ this.handleFocus = () => {
25
+ this.isFocused = true;
26
+ };
27
+ this.handleBlur = () => {
28
+ this.isFocused = false;
29
+ // When window loses focus, pause engagement tracking
30
+ this.pauseEngagement();
31
+ };
32
+ this.handleUserActivity = () => {
33
+ // Only track activity if tab is visible AND focused
34
+ if (!this.isVisible || !this.isFocused)
35
+ return;
36
+ const now = Date.now();
37
+ if (!this.isActive) {
38
+ // Resume from inactive state
39
+ this.isActive = true;
40
+ this.lastEngagementStart = now;
41
+ this.startHeartbeat();
42
+ }
43
+ this.lastActivityTime = now;
44
+ this.resetInactivityTimer();
45
+ };
46
+ this.handlePageLeave = () => {
47
+ if (this.hasTrackedLeave)
48
+ return;
49
+ this.hasTrackedLeave = true;
50
+ this.updateEngagementTime();
51
+ const data = this.getEngagementData();
52
+ if (this.onPageLeave) {
53
+ this.onPageLeave(data);
54
+ }
55
+ sendAnalyticsReliable("event", {
56
+ event_name: "page_leave",
57
+ request_path: window.location.pathname,
58
+ request_query: window.location.search,
59
+ domain: this.domain,
60
+ event_data: {
61
+ engagement_time_seconds: data.engagement_time_seconds,
62
+ total_time_seconds: data.total_time_seconds,
63
+ heartbeat_count: this.heartbeatCount,
64
+ was_engaged: data.is_engaged,
65
+ url: window.location.href,
66
+ referrer: document.referrer,
67
+ },
68
+ }, this.basePath);
69
+ };
70
+ this.handleNavigation = () => {
71
+ this.handlePageLeave();
72
+ this.reset();
73
+ };
74
+ this.basePath = options.basePath || "/_temps";
75
+ this.domain = options.domain || window.location.hostname;
76
+ this.heartbeatInterval = options.heartbeatInterval || 30000; // 30 seconds
77
+ this.inactivityTimeout = options.inactivityTimeout || 30000; // 30 seconds
78
+ this.engagementThreshold = options.engagementThreshold || 10000; // 10 seconds
79
+ this.onHeartbeat = options.onHeartbeat;
80
+ this.onPageLeave = options.onPageLeave;
81
+ this.startTime = Date.now();
82
+ this.lastActivityTime = Date.now();
83
+ this.isVisible = document.visibilityState === "visible";
84
+ this.isFocused = document.hasFocus();
85
+ // Don't start engagement tracking until first user interaction
86
+ this.lastEngagementStart = null;
87
+ this.isActive = false;
88
+ this.setupEventListeners();
89
+ this.startHeartbeat();
90
+ }
91
+ setupEventListeners() {
92
+ // Visibility change
93
+ document.addEventListener("visibilitychange", this.handleVisibilityChange);
94
+ // Focus/blur for better multi-monitor support
95
+ window.addEventListener("focus", this.handleFocus);
96
+ window.addEventListener("blur", this.handleBlur);
97
+ // User activity tracking - use more specific events to avoid false positives
98
+ const activityEvents = ["mousedown", "keypress", "scroll", "touchstart", "click"];
99
+ activityEvents.forEach(event => {
100
+ document.addEventListener(event, this.handleUserActivity, { passive: true });
101
+ });
102
+ // Page leave events
103
+ window.addEventListener("pagehide", this.handlePageLeave);
104
+ window.addEventListener("beforeunload", this.handlePageLeave);
105
+ // SPA navigation
106
+ const originalPushState = window.history.pushState;
107
+ window.history.pushState = (...args) => {
108
+ this.handlePageLeave();
109
+ originalPushState.apply(window.history, args);
110
+ this.reset();
111
+ };
112
+ window.addEventListener("popstate", this.handleNavigation);
113
+ }
114
+ pauseEngagement() {
115
+ this.updateEngagementTime();
116
+ this.lastEngagementStart = null;
117
+ if (!this.isVisible) {
118
+ this.stopHeartbeat();
119
+ }
120
+ }
121
+ resetInactivityTimer() {
122
+ if (this.inactivityTimer) {
123
+ clearTimeout(this.inactivityTimer);
124
+ }
125
+ this.inactivityTimer = setTimeout(() => {
126
+ if (this.isVisible) {
127
+ this.updateEngagementTime();
128
+ this.isActive = false;
129
+ this.lastEngagementStart = null;
130
+ }
131
+ }, this.inactivityTimeout);
132
+ }
133
+ updateEngagementTime() {
134
+ if (this.lastEngagementStart !== null) {
135
+ const currentEngagement = Date.now() - this.lastEngagementStart;
136
+ this.engagementTime += currentEngagement;
137
+ }
138
+ }
139
+ startHeartbeat() {
140
+ if (this.heartbeatTimer)
141
+ return;
142
+ this.heartbeatTimer = setInterval(() => {
143
+ // Only send heartbeat if tab is visible AND user has been active
144
+ if (this.isVisible && this.isActive) {
145
+ this.sendHeartbeat();
146
+ }
147
+ }, this.heartbeatInterval);
148
+ }
149
+ stopHeartbeat() {
150
+ if (this.heartbeatTimer) {
151
+ clearInterval(this.heartbeatTimer);
152
+ this.heartbeatTimer = null;
153
+ }
154
+ }
155
+ async sendHeartbeat() {
156
+ this.updateEngagementTime();
157
+ this.heartbeatCount++;
158
+ const data = this.getEngagementData();
159
+ if (this.onHeartbeat) {
160
+ this.onHeartbeat(data);
161
+ }
162
+ await sendAnalytics("event", {
163
+ event_name: "heartbeat",
164
+ request_path: window.location.pathname,
165
+ request_query: window.location.search,
166
+ domain: this.domain,
167
+ event_data: {
168
+ engagement_time: Math.round(this.engagementTime),
169
+ total_time: Math.round(Date.now() - this.startTime),
170
+ is_engaged: data.is_engaged,
171
+ is_visible: this.isVisible,
172
+ time_since_last_activity: data.time_since_last_activity,
173
+ heartbeat_count: this.heartbeatCount,
174
+ },
175
+ }, "POST", this.basePath);
176
+ // Reset engagement start for next period
177
+ if (this.isActive && this.isVisible) {
178
+ this.lastEngagementStart = Date.now();
179
+ }
180
+ }
181
+ getEngagementData() {
182
+ const totalTime = Date.now() - this.startTime;
183
+ const timeSinceLastActivity = Date.now() - this.lastActivityTime;
184
+ return {
185
+ engagement_time_seconds: Math.round(this.engagementTime / 1000),
186
+ total_time_seconds: Math.round(totalTime / 1000),
187
+ heartbeat_count: this.heartbeatCount,
188
+ is_engaged: this.engagementTime >= this.engagementThreshold,
189
+ is_visible: this.isVisible,
190
+ time_since_last_activity: Math.round(timeSinceLastActivity / 1000),
191
+ };
192
+ }
193
+ reset() {
194
+ this.startTime = Date.now();
195
+ this.engagementTime = 0;
196
+ this.lastActivityTime = Date.now();
197
+ this.heartbeatCount = 0;
198
+ this.hasTrackedLeave = false;
199
+ // Reset to inactive state - wait for user interaction
200
+ this.isActive = false;
201
+ this.lastEngagementStart = null;
202
+ if (this.isVisible) {
203
+ this.startHeartbeat();
204
+ }
205
+ }
206
+ destroy() {
207
+ this.handlePageLeave();
208
+ this.stopHeartbeat();
209
+ if (this.inactivityTimer) {
210
+ clearTimeout(this.inactivityTimer);
211
+ }
212
+ document.removeEventListener("visibilitychange", this.handleVisibilityChange);
213
+ window.removeEventListener("focus", this.handleFocus);
214
+ window.removeEventListener("blur", this.handleBlur);
215
+ window.removeEventListener("pagehide", this.handlePageLeave);
216
+ window.removeEventListener("beforeunload", this.handlePageLeave);
217
+ window.removeEventListener("popstate", this.handleNavigation);
218
+ const activityEvents = ["mousedown", "keypress", "scroll", "touchstart", "click"];
219
+ activityEvents.forEach(event => {
220
+ document.removeEventListener(event, this.handleUserActivity);
221
+ });
222
+ }
223
+ }
@@ -1,4 +1,4 @@
1
1
  import type { AnalyticsContextValue, TempsAnalyticsProviderProps } from "./types";
2
- export declare function TempsAnalyticsProvider({ basePath, disabled, ignoreLocalhost, autoTrackPageviews, children, }: TempsAnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function TempsAnalyticsProvider({ basePath, disabled, ignoreLocalhost, autoTrackPageviews, autoTrackPageLeave, pageLeaveEventName, autoTrackSpeedAnalytics, autoTrackEngagement, heartbeatInterval, inactivityTimeout, engagementThreshold, enableSessionRecording, sessionRecordingConfig, domain, children, }: TempsAnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
3
3
  export declare function useTempsAnalytics(): AnalyticsContextValue;
4
4
  //# sourceMappingURL=Provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../src/Provider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAIlF,wBAAgB,sBAAsB,CAAC,EACrC,QAAwB,EACxB,QAAgB,EAChB,eAAsB,EACtB,kBAAyB,EACzB,QAAQ,GACT,EAAE,2BAA2B,2CAqI7B;AAED,wBAAgB,iBAAiB,IAAI,qBAAqB,CAMzD"}
1
+ {"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../src/Provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AASlF,wBAAgB,sBAAsB,CAAC,EACrC,QAAoB,EACpB,QAAgB,EAChB,eAAsB,EACtB,kBAAyB,EACzB,kBAAyB,EACzB,kBAAiC,EACjC,uBAA8B,EAC9B,mBAA0B,EAC1B,iBAAyB,EACzB,iBAAyB,EACzB,mBAA2B,EAC3B,sBAA8B,EAC9B,sBAA2B,EAC3B,MAAM,EACN,QAAQ,GACT,EAAE,2BAA2B,2CAmO7B;AAED,wBAAgB,iBAAiB,IAAI,qBAAqB,CAMzD"}
package/dist/Provider.js CHANGED
@@ -1,12 +1,18 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef } from "react";
4
- import { isLocalhostLike, isTestEnvironment, sendAnalytics } from "./utils";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef } from "react";
4
+ import { isLocalhostLike, isTestEnvironment, sendAnalytics, sendAnalyticsReliable } from "./utils";
5
+ import { useSpeedAnalytics } from "./useSpeedAnalytics";
6
+ import { EngagementTracker } from "./EngagementTracker";
7
+ import { SessionRecorder } from "./SessionRecorder";
8
+ import { SessionRecordingProvider, useSessionRecordingControl } from "./useSessionRecording";
5
9
  const AnalyticsContext = createContext(undefined);
6
- export function TempsAnalyticsProvider({ basePath = "/api/_temps", disabled = false, ignoreLocalhost = true, autoTrackPageviews = true, children, }) {
10
+ export function TempsAnalyticsProvider({ basePath = "/_temps", disabled = false, ignoreLocalhost = true, autoTrackPageviews = true, autoTrackPageLeave = true, pageLeaveEventName = "page_leave", autoTrackSpeedAnalytics = true, autoTrackEngagement = true, heartbeatInterval = 30000, inactivityTimeout = 30000, engagementThreshold = 10000, enableSessionRecording = false, sessionRecordingConfig = {}, domain, children, }) {
7
11
  const enabled = useMemo(() => {
8
12
  if (disabled)
9
13
  return false;
14
+ if (typeof window === "undefined")
15
+ return false;
10
16
  if (ignoreLocalhost && (isLocalhostLike() || isTestEnvironment()))
11
17
  return false;
12
18
  try {
@@ -23,23 +29,25 @@ export function TempsAnalyticsProvider({ basePath = "/api/_temps", disabled = fa
23
29
  event_name: eventName,
24
30
  request_query: window.location.search,
25
31
  request_path: window.location.pathname,
32
+ domain: domain || window.location.hostname,
26
33
  event_data: data,
27
34
  }, "POST", basePath);
28
- }, [enabled, basePath]);
35
+ }, [enabled, basePath, domain]);
29
36
  const trackPageview = useCallback(() => {
30
37
  if (!enabled)
31
38
  return;
32
39
  void sendAnalytics("event", {
33
- event_name: "pageview",
40
+ event_name: "page_view",
34
41
  request_query: window.location.search,
35
42
  request_path: window.location.pathname,
43
+ domain: domain || window.location.hostname,
36
44
  event_data: {
37
45
  referrer: document.referrer,
38
46
  userAgent: navigator.userAgent,
39
47
  timestamp: new Date().toISOString(),
40
48
  },
41
49
  }, "POST", basePath);
42
- }, [enabled, basePath]);
50
+ }, [enabled, basePath, domain]);
43
51
  const identify = useCallback(async () => {
44
52
  // no-op placeholder for SDK parity; implement when identity endpoint is available
45
53
  }, []);
@@ -118,8 +126,66 @@ export function TempsAnalyticsProvider({ basePath = "/api/_temps", disabled = fa
118
126
  document.addEventListener("click", onClick);
119
127
  return () => document.removeEventListener("click", onClick);
120
128
  }, [enabled, trackEvent]);
129
+ // Engagement tracking with heartbeats and page leave
130
+ useEffect(() => {
131
+ if (!enabled)
132
+ return;
133
+ // If engagement tracking is enabled, it handles both heartbeats and page leave
134
+ if (autoTrackEngagement) {
135
+ const tracker = new EngagementTracker({
136
+ basePath,
137
+ domain,
138
+ heartbeatInterval,
139
+ inactivityTimeout,
140
+ engagementThreshold,
141
+ });
142
+ return () => {
143
+ tracker.destroy();
144
+ };
145
+ }
146
+ // Legacy page leave tracking without engagement metrics
147
+ else if (autoTrackPageLeave) {
148
+ let hasTracked = false;
149
+ let startTime = Date.now();
150
+ const trackPageLeave = () => {
151
+ if (hasTracked)
152
+ return;
153
+ hasTracked = true;
154
+ const timeOnPage = Date.now() - startTime;
155
+ sendAnalyticsReliable("event", {
156
+ event_name: pageLeaveEventName,
157
+ request_query: window.location.search,
158
+ request_path: window.location.pathname,
159
+ domain: domain || window.location.hostname,
160
+ event_data: {
161
+ time_on_page_ms: timeOnPage,
162
+ timestamp: new Date().toISOString(),
163
+ url: window.location.href,
164
+ referrer: document.referrer,
165
+ },
166
+ }, basePath);
167
+ };
168
+ // Use pagehide as primary (most reliable), with beforeunload as fallback
169
+ const handlePageLeave = () => trackPageLeave();
170
+ // pagehide is the most reliable for modern browsers
171
+ window.addEventListener("pagehide", handlePageLeave);
172
+ // beforeunload as fallback for older browsers
173
+ window.addEventListener("beforeunload", handlePageLeave);
174
+ return () => {
175
+ window.removeEventListener("pagehide", handlePageLeave);
176
+ window.removeEventListener("beforeunload", handlePageLeave);
177
+ };
178
+ }
179
+ }, [autoTrackPageLeave, autoTrackEngagement, enabled, pageLeaveEventName, domain, basePath, heartbeatInterval, inactivityTimeout, engagementThreshold]);
180
+ // Speed analytics tracking
181
+ useSpeedAnalytics({
182
+ basePath,
183
+ disabled: !enabled || !autoTrackSpeedAnalytics,
184
+ });
185
+ // Session recording control
186
+ const { isEnabled: isRecordingEnabled } = useSessionRecordingControl(enableSessionRecording);
121
187
  const value = useMemo(() => ({ trackEvent, identify, trackPageview, enabled }), [trackEvent, identify, trackPageview, enabled]);
122
- return _jsx(AnalyticsContext.Provider, { value: value, children: children });
188
+ return (_jsx(AnalyticsContext.Provider, { value: value, children: _jsxs(SessionRecordingProvider, { defaultEnabled: enableSessionRecording, children: [children, enabled && (_jsx(SessionRecorder, { basePath: basePath, domain: domain, enabled: isRecordingEnabled, excludedPaths: sessionRecordingConfig.excludedPaths, sessionSampleRate: sessionRecordingConfig.sessionSampleRate, maskAllInputs: sessionRecordingConfig.maskAllInputs, maskTextSelector: sessionRecordingConfig.maskTextSelector, blockClass: sessionRecordingConfig.blockClass, ignoreClass: sessionRecordingConfig.ignoreClass, maskTextClass: sessionRecordingConfig.maskTextClass, recordCanvas: sessionRecordingConfig.recordCanvas, collectFonts: sessionRecordingConfig.collectFonts, batchSize: sessionRecordingConfig.batchSize, flushInterval: sessionRecordingConfig.flushInterval }))] }) }));
123
189
  }
124
190
  export function useTempsAnalytics() {
125
191
  const ctx = useContext(AnalyticsContext);
@@ -0,0 +1,21 @@
1
+ export declare const SESSION_RECORDER_ENDPOINT = "session-replay";
2
+ interface SessionRecorderProps {
3
+ basePath?: string;
4
+ domain?: string;
5
+ enabled?: boolean;
6
+ excludedPaths?: string[];
7
+ sessionSampleRate?: number;
8
+ maskAllInputs?: boolean;
9
+ maskTextSelector?: string;
10
+ blockClass?: string;
11
+ ignoreClass?: string;
12
+ maskTextClass?: string;
13
+ recordCanvas?: boolean;
14
+ collectFonts?: boolean;
15
+ slimDOMOptions?: Record<string, boolean>;
16
+ batchSize?: number;
17
+ flushInterval?: number;
18
+ }
19
+ export declare function SessionRecorder({ basePath, domain, enabled, excludedPaths, sessionSampleRate, maskAllInputs, maskTextSelector, blockClass, ignoreClass, maskTextClass, recordCanvas, collectFonts, slimDOMOptions, batchSize, flushInterval, }: SessionRecorderProps): null;
20
+ export {};
21
+ //# sourceMappingURL=SessionRecorder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionRecorder.d.ts","sourceRoot":"","sources":["../src/SessionRecorder.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA+CD,wBAAgB,eAAe,CAAC,EAC9B,QAAoB,EACpB,MAAM,EACN,OAAe,EACf,aAAkB,EAClB,iBAAuB,EACvB,aAAoB,EACpB,gBAAgC,EAChC,UAAuB,EACvB,WAAyB,EACzB,aAAyB,EACzB,YAAoB,EACpB,YAAoB,EACpB,cAUC,EACD,SAAe,EACf,aAAoB,GACrB,EAAE,oBAAoB,QA4XtB"}