zestchatbotwidgetpackage
Version:
chatbot widget npm package
83 lines (79 loc) • 2.96 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import React, { Dispatch, SetStateAction } from 'react';
declare function ChatBot(): react_jsx_runtime.JSX.Element;
interface BotContextProps {
showChatBot: boolean;
setShowChatBot: Dispatch<SetStateAction<boolean>>;
messages: Message[];
setMessages: Dispatch<SetStateAction<Message[]>>;
botResponseIsLoading: boolean;
setBotResponseIsLoading: Dispatch<SetStateAction<boolean>>;
sendMessage: (text: string) => Promise<void>;
getMessage: () => Promise<void>;
handleButtonClick: (textToRender: string) => void;
renderSelectedOption: any;
tabNumber: number;
setTabNumber: Dispatch<SetStateAction<number>>;
waterMark: string;
setWaterMark: Dispatch<SetStateAction<string>>;
showFullContent: boolean;
setShowFullContent: Dispatch<SetStateAction<boolean>>;
showDetailedResponse: boolean;
setShowDetailedResponse: Dispatch<SetStateAction<boolean>>;
botConversationId: string;
setBotConversationId: Dispatch<SetStateAction<string>>;
botToken: string;
setBotToken: Dispatch<SetStateAction<string>>;
userId: string;
setUserId: Dispatch<SetStateAction<string>>;
loading: boolean;
setLoading: Dispatch<SetStateAction<boolean>>;
errorExist: boolean;
setErrorExist: Dispatch<SetStateAction<boolean>>;
showButtons: boolean;
setShowButtons: Dispatch<SetStateAction<boolean>>;
isLiveAgent: boolean;
setIsLiveAgent: Dispatch<SetStateAction<boolean>>;
userSentAMsg: boolean;
setUserSentAMsg: Dispatch<SetStateAction<boolean>>;
shouldDeactivate: boolean;
setShouldDeactivate: Dispatch<SetStateAction<boolean>>;
userHaveBeenDeactivated: boolean;
setUserHaveBeenDeactivated: Dispatch<SetStateAction<boolean>>;
accessTokenString: string;
setAccessTokenString: Dispatch<SetStateAction<string>>;
botEndPoint: string;
setBotEndPoint: Dispatch<SetStateAction<string>>;
botBrandColor: string;
setBotBrandColor: Dispatch<SetStateAction<string>>;
botAssetsUrl: string;
setBotAssetsUrl: Dispatch<SetStateAction<string>>;
botBrandName: string;
setBotBrandName: Dispatch<SetStateAction<string>>;
}
type buttonsType = {
name: string;
value: string;
};
interface Message {
id: string;
text?: string;
sender: "user" | "bot";
timestamp: Date;
pending: boolean;
delivered: boolean;
error: boolean;
buttons: buttonsType[];
buttonsVisible?: boolean;
others?: () => {};
}
declare const BotContextProvider: ({ children, initialAccessToken, liveBotEndPoint, brandColor, assetsUrl, brandName, }: {
children: React.ReactNode;
initialAccessToken: string;
liveBotEndPoint: string;
brandColor: string;
assetsUrl: string;
brandName: string;
}) => react_jsx_runtime.JSX.Element;
declare const useBotContext: () => BotContextProps;
export { BotContextProvider, ChatBot, useBotContext };