import { RelayConversation, type RelayClientOptions, type OpenOptions } from './core.js'; import type { RenderMessage } from './store.js'; export type UseRelayConversationOptions = RelayClientOptions & OpenOptions; export interface RelayConversationHook { /** Messages in seq order (optimistic sends included, pending-marked). */ messages: RenderMessage[]; send: (text: string) => void; /** Call from your input's onChange for typing indicators. */ typing: (isTyping: boolean) => void; markRead: () => void; /** connecting | connected | reconnecting | error */ status: string; statusMessage: string | undefined; conversationId: string | undefined; /** Our canonical user id (server-resolved) — compare with message.senderId for "mine". */ me: string | undefined; /** userIds currently typing (excluding you). */ peersTyping: string[]; /** The underlying conversation for anything the hook doesn't surface * (reactions, invoke, raw store). */ conversation: RelayConversation; } /** One live conversation (support thread or DM). The connection opens on * mount and closes on unmount; options changes reopen. */ export declare function useRelayConversation(opts: UseRelayConversationOptions): RelayConversationHook; export interface ChatListRow { conversationId: string; /** Which chatroom this conversation belongs to. With `scope: 'tenant'` rows * can come from OTHER chatrooms of the same business — open them with this * profileId, not the one you queried with. */ profileId?: string; /** 'support' (default) or 'direct' (user↔user DM). */ kind?: string; /** For direct conversations: the other participant's user id. */ peerId?: string; subjectId?: string; title?: string; lastMessage?: string; updatedAt: number; unread?: boolean; } /** The current user's conversation list (the "inbox" screen of a chat app). * Polls the REST endpoint; pass `refreshMs: 0` to fetch once. * * `scope` (default `'profile'`) controls which conversations are listed: * • `'profile'` — only this chatroom's threads (the classic widget list). * • `'tenant'` — every conversation this user has with the OWNING BUSINESS * of the given profileId, across all of its chatrooms — what a real * chat-app inbox shows. Rows carry `profileId` so you can open each one * against the right chatroom. (The profileId is still required: it is * how the server resolves which tenant "mine" means — guests never see * or send tenant ids.) */ export declare function useRelayChatList(opts: Omit & { /** A chatroom id — or omit and pass `tenantId` for tenant-level listing. */ profileId?: string; /** Tenant-level identification: list EVERY conversation this user has with * the business across ALL of its chatrooms, no profileId needed (e.g. a * platform with a marketplace chatroom AND a general-support chatroom). * Provide `profileId` OR `tenantId`. */ tenantId?: string; refreshMs?: number; scope?: 'profile' | 'tenant'; }): { conversations: ChatListRow[]; loading: boolean; error: string | null; refresh: () => void; /** Where a "new conversation" should open: the configured profileId, else * the server-reported tenant default (oldest chatroom). */ defaultProfileId: string | undefined; };