import { eventWithTime } from 'rrweb'; /** * Configuration options for the Sessionable SDK */ interface SessionableOptions { /** * Your Sessionable API key */ apiKey: string; /** * Start recording automatically after initialization * @default false */ autoStart?: boolean; /** * Custom metadata to include with each session * @default {} */ metadata?: Record; /** * Whether to mask input fields (passwords, text inputs, etc.) * @default false */ maskInputs?: boolean; /** * CSS selector for text content that should be masked * When provided, any text matching this selector will be masked in recordings * Example: '.sensitive-data, [data-mask]' * @default undefined */ maskTextSelector?: string; /** * Debug mode - when true, uses localhost:5173 as API endpoint * Use this for local development and testing * @default false */ debug?: boolean; } /** * Session metrics and status information */ interface SessionMetrics { /** * Unique ID for this session */ sessionId: string; /** * Total number of events recorded in this session */ eventsRecorded: number; /** * Number of batches sent to the server */ batchesSent: number; /** * Number of batches successfully uploaded */ batchesSuccessful: number; /** * Current connection status with the API */ connectionStatus: 'connected' | 'disconnected' | 'connecting' | 'error'; /** * Last error message if any */ lastError: string | null; /** * Size of the last batch sent */ lastBatchSize: number; /** * Timestamp of the last successful upload */ lastSuccessfulUpload: Date | null; /** * Timestamp when recording started */ recordingStartTime: Date; /** * Whether recording is currently active */ isRecording: boolean; } /** * Payload sent to the Sessionable API */ interface SessionPayload { /** * Unique ID for this session */ session_id: string; /** * Anonymous user ID associated with this session */ anonymous_id: string; /** * Array of recorded events */ events: eventWithTime[]; /** * Metadata associated with this session */ metadata: Record; } /** * Props for the React SessionRecorder component */ interface SessionRecorderProps extends SessionableOptions { /** * CSS class name to apply to the notification component */ className?: string; /** * Whether to show the recording UI controls * @default false */ showControls?: boolean; } export type { SessionableOptions as S, SessionMetrics as a, SessionPayload as b, SessionRecorderProps as c };