import { Room } from 'livekit-client'; import { Session, SessionOptions, SessionState } from '../types/session'; import { SessionEvent, EventHandler, EventPayload } from '../types/events'; /** * Configuration options for SessionManager */ export interface SessionManagerConfig { /** * Backend API base URL * @default 'https://slide-api-production.up.railway.app' */ apiUrl?: string; /** * Enable debug logging * @default false */ debug?: boolean; /** * Maximum reconnection attempts * @default 3 */ maxReconnectAttempts?: number; } /** * SessionManager class for LiveKit session lifecycle management */ export declare class SessionManager { private readonly config; private state; private session; private room; private eventHandlers; private reconnectAttempts; /** * Create a new SessionManager instance */ constructor(config?: SessionManagerConfig); /** * Get current session state */ getState(): SessionState; /** * Get current session information */ getSession(): Session | null; /** * Get LiveKit room instance */ getRoom(): Room | null; /** * Create a new LiveKit session via backend API * * @param options - Session creation options * @returns Session information with tokens */ createSession(options: SessionOptions): Promise; /** * Join LiveKit room with customer token * * @param token - LiveKit access token (optional if session already created) * @returns LiveKit Room instance */ joinRoom(token?: string): Promise; /** * Disconnect from LiveKit room and cleanup */ disconnect(): Promise; /** * Subscribe to session events * * @param event - Event type to subscribe to * @param handler - Event handler function * @returns Unsubscribe function */ on(event: SessionEvent, handler: EventHandler): () => void; /** * Unsubscribe from session events * * @param event - Event type to unsubscribe from * @param handler - Event handler function to remove */ off(event: SessionEvent, handler: EventHandler): void; /** * Emit an event to all subscribers * * @param event - Event type * @param payload - Event payload */ private emit; /** * Setup LiveKit room event handlers */ private setupRoomEventHandlers; /** * Map LiveKit connection quality to our enum */ private mapConnectionQuality; /** * Emit an error event */ private emitError; /** * Update session state and emit state change event */ private setState; /** * Debug logging */ private log; }