import { BehaviorSubject } from 'rxjs'; import { Api } from './api'; export interface ChatUser { id: number; authId?: number; firstName: string; lastName: string; displayName: string; login: string; active?: boolean; online: boolean; } export type ChatMessageStatus = 'sending' | 'sent' | 'failed'; export interface ChatMessage { id: string; conversationId: string; senderId: number; recipientId: number; body: string; createdAt: string; clientId?: string; status?: ChatMessageStatus; readAt?: string; } export interface ChatConversation { id: string; peer: ChatUser; lastMessage: ChatMessage | null; unread: number; updatedAt: string; } export interface ChatRealtimeEvent { type: 'chat.message' | 'chat.read' | 'chat.typing' | 'chat.presence' | 'chat.conversation.updated' | 'chat.subscribed'; spoke: string; data: any; } /** API-backed direct messaging. The socket is receive-only. */ export declare class Chat { readonly api: Api; readonly users$: BehaviorSubject; readonly conversations$: BehaviorSubject; readonly selectedUser$: BehaviorSubject; readonly messages$: BehaviorSubject; readonly loading$: BehaviorSubject; readonly error$: BehaviorSubject; readonly typingUsers$: BehaviorSubject>; readonly hasMore$: BehaviorSubject; readonly unread$: import('rxjs').Observable; private socketUnsubscribe?; private typingTimers; private initialized; constructor(api: Api); initialize(force?: boolean): Promise; available(): Promise; loadDirectory(search?: string, cursor?: string): Promise; loadConversations(): Promise; selectUser(user: ChatUser): Promise; loadHistory(userId: number, before?: string): Promise; send(userId: number, body: string, clientId?: string): Promise; retry(message: ChatMessage): Promise; setTyping(userId: number, typing: boolean): Promise; markLatestRead(): Promise; destroy(): void; private connectRealtime; private onSocketEvent; private applyReadReceipt; private upsertMessage; private mergeMessages; private run; private currentUserId; private conversationId; private compareStreamIds; private createClientId; } //# sourceMappingURL=chat.d.ts.map