UNPKG

@botonic/react

Version:

Build Chatbots using React

47 lines (46 loc) 2.3 kB
/// <reference types="react" /> import { Session } from '@botonic/core'; import { Reply } from '../../components'; import { Webview } from '../../components/index-types'; import { WebchatMessage } from '../../index-types'; import { WebchatTheme } from '../theme/types'; import { ClientInput, DevSettings, ErrorMessage, WebchatState } from './types'; export interface UseWebchat { addMessage: (message: WebchatMessage) => void; addMessageComponent: (message: { props: WebchatMessage; }) => void; clearMessages: () => void; doRenderCustomComponent: (toggle: boolean) => void; resetUnreadMessages: () => void; setCurrentAttachment: (attachment?: File) => void; setError: (error?: ErrorMessage) => void; setIsInputFocused: (isInputFocused: boolean) => void; setLastMessageVisible: (isLastMessageVisible: boolean) => void; setOnline: (online: boolean) => void; toggleCoverComponent: (toggle: boolean) => void; toggleEmojiPicker: (toggle: boolean) => void; togglePersistentMenu: (toggle: boolean) => void; toggleWebchat: (toggle: boolean) => void; updateDevSettings: (settings: DevSettings) => void; updateHandoff: (handoff: boolean) => void; updateLastMessageDate: (date: string) => void; updateLastRoutePath: (path: string) => void; updateLatestInput: (input: ClientInput) => void; updateMessage: (message: WebchatMessage) => void; updateReplies: (replies: (typeof Reply)[]) => void; updateSession: (session: Partial<Session>) => void; updateTheme: (theme: WebchatTheme, themeUpdates?: WebchatTheme) => void; updateTyping: (typing: boolean) => void; updateWebview: (webview: Webview, params: Record<string, string>) => void; removeReplies: () => void; removeWebview: () => void; webchatState: WebchatState; webchatContainerRef: React.MutableRefObject<HTMLDivElement | null>; headerRef: React.MutableRefObject<HTMLDivElement | null>; chatAreaRef: React.MutableRefObject<HTMLDivElement | null>; scrollableMessagesListRef: React.MutableRefObject<HTMLDivElement | null>; repliesRef: React.MutableRefObject<HTMLDivElement | null>; inputPanelRef: React.MutableRefObject<HTMLDivElement | null>; } export declare function useWebchat(theme?: WebchatTheme): UseWebchat;