import { Observable } from 'rxjs'; import { EngineAction, EngineConfig } from './types'; import { ChatEngineResponse } from './client'; type ReceiveMessage = { text: string; source: string; invitationNo?: string; alias?: string; timestamp?: number; }; export declare class Engine { config: EngineConfig; private readonly client; private readonly messageSubject$; private readonly actionsSubject$; messages: () => Observable; actions: () => Observable; private readonly sessionId; private lastObjectId; /** * Tracks when the page was last hidden/visible. On iOS Safari, switching to * another tab (e.g. for authentication) freezes the page and aborts * in-flight fetch requests. We use timestamps to distinguish recoverable * fetch interruptions (page was recently frozen) from genuine failures. */ private lastPageHiddenAt; private lastPageVisibleAt; constructor(config: EngineConfig, sessionId: string | null); private setupVisibilityTracking; /** * Returns true if the error is a fetch interruption that likely occurred * because iOS Safari froze/resumed the page (e.g. when a new tab opened for * authentication). We allow a grace window after the page was hidden or * recently became visible again. */ private isRecoverableFetchInterruption; chatJoin(payload: { customerName: string; invitationUid: string; }): Observable; chatRequest(payload: { customerName?: string; customerEmailAddress: string; visitorQuestion: string; customData: Record; errand: string; authToken?: string; }): Observable; reconnect(): Observable; poll(): Observable; chatWrite(message: string): Promise; sendPenStatusOn(key: string): void; videoPrepared(result: string): Promise; chatAuthentication(authToken: string): Promise; chatQuit(): Promise; chatEmailSession(emailAddress: string): Promise; isOpenEntrance(entrance: string): Promise; private processMessages; getChatStatus(): Promise<"finished" | "noSession" | "active">; rehydrate(): Promise; } export {};