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.

56 lines (55 loc) 1.66 kB
import React from "react"; import * as react_jsx_runtime1 from "react/jsx-runtime"; //#region ../react/src/realtime/provider.d.ts type SubscribeHandler = (event: AnyRealtimeEvent) => void; type VisitorAuthConfig = { kind: "visitor"; visitorId: string | null; websiteId?: string | null; publicKey?: string | null; }; type SessionAuthConfig = { kind: "session"; sessionToken: string | null; websiteId?: string | null; userId?: string | null; }; type RealtimeAuthConfig = VisitorAuthConfig | SessionAuthConfig; type RealtimeProviderProps = { children: React.ReactNode; wsUrl?: string; auth: RealtimeAuthConfig | null; autoConnect?: boolean; onConnect?: () => void; onDisconnect?: () => void; onError?: (error: Error) => void; }; type RealtimeConnectionState = { isConnected: boolean; isConnecting: boolean; error: Error | null; send: (event: AnyRealtimeEvent) => void; sendRaw: (data: string) => void; subscribe: (handler: SubscribeHandler) => () => void; lastEvent: AnyRealtimeEvent | null; connectionId: string | null; reconnect: () => void; }; type RealtimeContextValue = RealtimeConnectionState & { visitorId: string | null; websiteId: string | null; userId: string | null; }; declare function RealtimeProvider({ children, wsUrl, auth, autoConnect, onConnect, onDisconnect, onError }: RealtimeProviderProps): react_jsx_runtime1.JSX.Element; declare function useRealtimeConnection(): RealtimeContextValue; //#endregion export { type RealtimeAuthConfig, type RealtimeContextValue, RealtimeProvider, type RealtimeProviderProps, useRealtimeConnection }; //# sourceMappingURL=provider3.d.ts.map