import { EventEmitter } from './event-emitter'; import { EvSource } from './eventsource'; import { Types } from './gen/signals'; type Signals = Types & { unknown: { type: 'unknown'; data: unknown; }; }; type SignalMap = { [K in keyof Signals as Signals[K]['type']]: Signals[K]['data']; }; export type Events = SignalMap & { error: Error; }; type SignalListenerState = { status: 'disconnected'; } | { status: 'connecting'; connectionPromise: Promise; } | { status: 'connected'; source: EvSource; }; export type SignalListenerStatus = SignalListenerState['status']; type ListenProps = { url: string; userKey: string; conversationId: string; timeout?: number; }; type InitializeProps = { url: string; userKey?: string; conversationId?: string; timeout?: number; }; export declare class SignalListener extends EventEmitter { private _props; private _state; private constructor(); static listen: (props: ListenProps) => Promise; static initialize: (props: InitializeProps) => Promise; get status(): SignalListenerStatus; readonly connect: () => Promise; readonly disconnect: () => Promise; private _connect; private _disconnectSync; private _handleMessage; private _handleError; private _parseSignal; private _safeJsonParse; private _toError; } export {};