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.

93 lines (92 loc) 2.7 kB
import * as React$1 from "react"; import * as react_jsx_runtime0 from "react/jsx-runtime"; import { QueryClient } from "@tanstack/react-query"; //#region ../react/src/provider.d.ts type SupportProviderProps = { children: React$1.ReactNode; defaultOpen?: boolean; apiUrl?: string; wsUrl?: string; publicKey?: string; defaultMessages?: DefaultMessage[]; quickOptions?: string[]; autoConnect?: boolean; onWsConnect?: () => void; onWsDisconnect?: () => void; onWsError?: (error: Error) => void; queryClient?: QueryClient; }; type CossistantProviderProps = SupportProviderProps; type CossistantContextValue = { website: PublicWebsiteResponse | null; defaultMessages: DefaultMessage[]; quickOptions: string[]; setDefaultMessages: (messages: DefaultMessage[]) => void; setQuickOptions: (options: string[]) => void; unreadCount: number; setUnreadCount: (count: number) => void; isLoading: boolean; error: Error | null; client: CossistantClient; }; /** * Hosts the entire customer support widget ecosystem by handing out context * about the current website, visitor, unread counts, realtime subscriptions * and the REST client. Provide your Cossistant public key plus optional * defaults to configure the widget behaviour. */ declare function SupportProvider({ children, apiUrl, wsUrl, publicKey, defaultMessages, quickOptions, autoConnect, onWsConnect, onWsDisconnect, onWsError, queryClient }: SupportProviderProps): react_jsx_runtime0.JSX.Element; /** * Convenience hook that exposes the aggregated support context. Throws when it * is consumed outside of `SupportProvider` to catch integration mistakes. */ declare function useSupport(): { availableHumanAgents: { id: string; name: string; image: string | null; lastSeenAt: string | null; }[]; availableAIAgents: { id: string; name: string; image: string | null; }[]; visitor: { locale: string | null; id: string; isBlocked: boolean; language: string | null; contact: { id: string; name: string | null; email: string | null; image: string | null; } | null; } | undefined; website: PublicWebsiteResponse | null; defaultMessages: DefaultMessage[]; quickOptions: string[]; setDefaultMessages: (messages: DefaultMessage[]) => void; setQuickOptions: (options: string[]) => void; unreadCount: number; setUnreadCount: (count: number) => void; isLoading: boolean; error: Error | null; client: CossistantClient; }; //#endregion export { CossistantContextValue, CossistantProviderProps, SupportProvider, SupportProviderProps, useSupport }; //# sourceMappingURL=provider2.d.ts.map