import { SessionDto } from '../types/dtos'; import { WidgetConfig } from '../types/widget-config'; import { PrimitiveState } from '../utils/PrimitiveState'; import { SessionsState } from './session.ctx'; /** The one backend call this needs; `ApiCaller.markSessionRead` satisfies it. */ export type UnreadApi = { markSessionRead: (args: { sessionId: string; }) => Promise<{ data?: SessionDto; }>; }; export type UnreadState = { /** Sessions the backend flags as holding a reply the visitor has not looked at. */ unreadSessionIds: string[]; /** Unread sessions, not unread messages. */ count: number; }; /** * The launcher dot. The backend owns the read state: every session row * carries `unread`, and this reports which session is on screen so the * backend can clear it. Shared by every conversation runtime of a widget, * so companion tabs feed one count. */ export declare class UnreadCtx { state: PrimitiveState; private config; private api; private sessionsState; private setSessions; /** The session whose transcript is on screen right now, if any. */ private viewingSessionId; /** Sessions with a read call in flight, so one reply is reported once. */ private readsInFlight; private retryTimer; private lastNotifiedCount; private subscriptions; private disposed; /** * Sessions this page has already reported as seen. A session without a * backend read marker is never flagged, so the first look is reported * even when nothing is unread; that is what starts tracking it. */ private reportedSessionIds; constructor({ config, api, sessionsState, setSessions, }: { config: WidgetConfig; api: UnreadApi; sessionsState: PrimitiveState; /** Merges the backend's answer to a read call into the shared list. */ setSessions: (sessions: SessionDto[]) => void; }); dispose: () => void; /** * Which session the visitor is actually looking at: widget open, chat * screen with its transcript showing, tab visible. `null` otherwise. * Looking at a session is what clears its dot; opening the widget onto the * list does not. */ setViewingSessionId: (sessionId: string | null) => void; private evaluate; private markViewedSessionRead; private scheduleRetry; private notifyCount; } //# sourceMappingURL=unread.ctx.d.ts.map