UNPKG

@cossistant/next

Version:

Next.js-ready SDK for building AI-powered support/chat widgets. Hooks + primitives, WS-driven, TypeScript-first. Next.js-ready, Tailwind optional.

40 lines (39 loc) 1.4 kB
//#region ../react/src/hooks/use-send-message.d.ts type SendMessageOptions = { conversationId?: string | null; message: string; files?: File[]; defaultTimelineItems?: TimelineItem[]; visitorId?: string; /** * Optional message ID to use for the optimistic update and API request. * When not provided, a ULID will be generated on the client. */ messageId?: string; onSuccess?: (conversationId: string, messageId: string) => void; onError?: (error: Error) => void; }; type SendMessageResult = { conversationId: string; messageId: string; conversation?: CreateConversationResponseBody["conversation"]; initialTimelineItems?: CreateConversationResponseBody["initialTimelineItems"]; }; type UseSendMessageResult = { mutate: (options: SendMessageOptions) => void; mutateAsync: (options: SendMessageOptions) => Promise<SendMessageResult | null>; isPending: boolean; error: Error | null; reset: () => void; }; type UseSendMessageOptions = { client?: CossistantClient; }; /** * Sends visitor messages while handling optimistic pending conversations and * exposing react-query-like mutation state. */ declare function useSendMessage(options?: UseSendMessageOptions): UseSendMessageResult; //#endregion export { SendMessageOptions, SendMessageResult, UseSendMessageOptions, UseSendMessageResult, useSendMessage }; //# sourceMappingURL=use-send-message.d.ts.map