import { AthenaChatModule } from '@xylex-group/athena'; import { ReactNode } from 'react'; import { AthenaChatState, AthenaChatStore, AthenaChatStoreConfig } from './store.js'; import { AthenaChatUser } from './types.js'; /** * Props accepted by {@link AthenaChatProvider}. * * **Security contract.** Everything on this interface crosses into a * `"use client"` component and is therefore serialised into the RSC payload and * shipped to the browser. No property here accepts a gateway key, signing * secret or API key, and none ever should: the browser path authenticates with * the viewer's own session (cookie or session token) that the Athena client was * already constructed with. Bot credentials and webhook signing secrets belong * exclusively to `@xylex-group/athena-auth-ui/chat/server`. */ export interface AthenaChatProviderProps { /** * Athena chat module — pass `client.chat` from a browser Athena client. * * The client carries the viewer's session; this provider never sees or needs * a credential of its own. */ chat: AthenaChatModule; children: ReactNode; /** Signed-in user id, used for ownership checks and read cursors. */ currentUserId: string; /** * Starts the Chat realtime session and streams committed events into the store. * * Defaults to `true`. Set to `false` to run history-only (for example in * tests, or where a proxy does not forward WebSocket upgrades). */ realtime?: boolean; /** * Room to open on mount. When omitted the most recently active room opens. */ roomId?: string | null; /** * Uploads a file and returns its Athena file id. * * Omit to disable attachments. Implement this against your own upload route * so storage credentials stay on the server. */ uploadFile?: AthenaChatStoreConfig["uploadFile"]; /** * Directory of participants used to render sender names, avatars and to * resolve `@mentions` into user ids at send time. */ users?: readonly AthenaChatUser[]; } /** * Provides an Athena-backed chat store to the component tree. * * The store is created once per provider instance and rebuilt only when the * chat module or the signed-in user changes, so a parent re-render never drops * loaded history. */ export declare function AthenaChatProvider({ chat, children, currentUserId, realtime, roomId, uploadFile, users }: AthenaChatProviderProps): import("react").JSX.Element; /** * Selects from the Athena chat store. * * Always pass a selector; selecting the whole state re-renders on every keystroke. */ export declare function useAthenaChat(selector: (state: AthenaChatState) => TSelected): TSelected; /** * Selects a derived object or array from the store with shallow comparison. */ export declare function useAthenaChatShallow(selector: (state: AthenaChatState) => TSelected): TSelected; /** * Returns the store instance for imperative access outside of render. */ export declare function useAthenaChatActions(): AthenaChatStore; /** Resolves a sender id to a display identity, falling back to the raw id. */ export declare function useAthenaChatUser(userId: string): AthenaChatUser; /** Participants who can be mentioned, excluding the signed-in user. */ export declare function useAthenaChatMentionables(): AthenaChatUser[];