/** * TicketLiveProvider — the ONE client home for support-ticket realtime. * * DOMAIN logic only — connection lifecycle (subscribed-confirm, server * retry grace, failed-reconnect pacing, hidden-tab suspend/resume) is * owned entirely by the common SSE client (`createSseSubscription`); * this provider consumes its consolidated `onConnectedChange` signal. * * Owns: * - the unread summary — delivered EXCLUSIVELY by the stream * (`ticket-summary` frames on connect + debounced after events) and * by `ticket-read` responses. The client holds NO summary fetch * path: resync-on-(re)connect is served by the SERVER (every * connect pushes a fresh summary); * - query invalidation on events (list + open drawer refresh live); * - `markRead` with local write-through zeroing for 0-latency, * reconciled by the response's server-computed summary; * - the ticket-contract `no-stream` (204) retry policy. * * There is NO polling anywhere and NO summary endpoint. Hosts whose * stream endpoint 404s (terminal) or is absent get no unread indication * — the indication IS a realtime feature. * * Invalidation semantics on events — deliberately `invalidateQueries`, * NOT `setQueryData` patches: the ticket hooks run `gcTime: 0`, so * there is usually no cache entry to patch, and `TicketsCacheSlot` * shape rules apply when there is. */ import React from 'react'; export interface TicketLiveContextValue { /** Viewer has a resolved, non-anon chat identity. Surfaces (e.g. the * header cell) hide themselves when false — computed here so they * don't each spin up their own identity resolution. */ authed: boolean; /** Realtime-subscribed (server-confirmed), not merely HTTP-open. */ connected: boolean; /** Unread total across tickets — drives the header count badge. */ unreadTotal: number; /** Per-ticket unread counts (missing key = 0) — drives row dots. * The currently-open ticket is masked to 0. */ unreadByTicket: Record; /** The ticket with the NEWEST unread reply (open ticket excluded) — * the header cell routes to it via the SSOT deep link * (`buildTicketOpenHref`). Null when nothing is unread. */ nextUnreadTicketId: string | null; /** Mark a ticket read: POSTs the receipt, zeroes the ticket locally * (0-latency), then applies the response's server-computed summary. */ markRead: (ticketExternalId: string) => Promise; /** Drawer open/close registration — suppresses unread bumps for the * open ticket and masks it in the derived map. */ setOpenTicketId: (ticketExternalId: string | null) => void; /** Hint that the viewer just created a ticket — reconnects the stream * (fresh ownership set + fresh server-pushed summary). */ notifyTicketCreated: () => void; } export declare function useOptionalTicketLive(): TicketLiveContextValue | null; export declare function useTicketLive(): TicketLiveContextValue; export declare function TicketLiveProvider({ children }: { children: React.ReactNode; }): React.JSX.Element; //# sourceMappingURL=ticket-live-provider.d.ts.map