UNPKG

@developer.notchatbot/webchat

Version:

A beautiful React chatbot widget with single-file bundle

226 lines (225 loc) 6.22 kB
export interface WebChatPositionConfig { position?: 'bottom-right' | 'bottom-left'; marginBottom?: number; marginSide?: number; showPopup?: boolean; } export interface WebChatConfig { elementId: string; title?: string; placeholder?: string; primaryColor?: string; avatar?: string; apiKey?: string; position?: 'bottom-right' | 'bottom-left'; initialMessage?: string; closeButtonIcon?: 'default' | 'text' | 'custom'; closeButtonText?: string; closeButtonCustomIcon?: string; marginBottom?: number; marginSide?: number; showPopup?: boolean; note?: string; mobile?: WebChatPositionConfig; desktop?: WebChatPositionConfig; whatsapp?: Omit<WhatsAppConfig, 'position' | 'marginBottom' | 'marginSide' | 'mobile' | 'desktop'> & { active?: boolean; }; } export interface EmbedChatInputConfig { backgroundColor?: string; inputBorder?: string; inputBorderRadius?: string; iconColor?: string; } export interface EmbedChatConfig { elementId: string; title?: string; placeholder?: string; primaryColor?: string; avatar?: string; apiKey?: string; initialMessage?: string; footerText?: string; width?: string | number; height?: string | number; maxWidth?: string | number; maxHeight?: string | number; minWidth?: string | number; minHeight?: string | number; showHeader?: boolean; showFooter?: boolean; borderRadius?: string | number; border?: string; boxShadow?: string; chatTransparent?: boolean; chatBackground?: string; textColor?: string; bubbleUserColor?: string; input?: EmbedChatInputConfig; footerColor?: string; customCSS?: string; } export interface FileWithBlobUrl { url: string; name: string; type: string; size?: number; } export interface EmbedChatProps { config: EmbedChatConfig; } export interface EmbedChatWindowProps { config: EmbedChatConfig; messages: Message[]; onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void; isLoading?: boolean; isAiTyping?: boolean; chatbotActivated?: boolean; } export interface EmbedChatHeaderProps { title: string; primaryColor?: string; avatar?: string; } export interface EmbedChatFooterProps { footerText?: string; primaryColor?: string; footerColor?: string; } export interface EmbedChatInstance { destroy: () => void; updateConfig?: (newConfig: Partial<EmbedChatConfig>) => void; injectCSS?: (css: string) => void; removeCustomCSS?: () => void; } export interface Message { id: string; text: string; sender: 'user' | 'bot'; timestamp: Date | string; conversationId?: string; type: string; metaContent?: string; } export interface ChatBotProps { config: WebChatConfig; } export interface ChatButtonProps { isOpen: boolean; onClick: () => void; primaryColor?: string; position?: 'bottom-right' | 'bottom-left'; marginBottom?: number; marginSide?: number; hasNewMessages?: boolean; isMobile?: boolean; isMenuOpen?: boolean; hasWhatsAppMenu?: boolean; } export interface ChatWindowProps { isOpen: boolean; onClose: () => void; config: WebChatConfig; messages: Message[]; onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void; isLoading?: boolean; isAiTyping?: boolean; position?: 'bottom-right' | 'bottom-left'; marginBottom?: number; marginSide?: number; isMobile?: boolean; chatbotActivated?: boolean; isRated?: boolean; onRatingChange?: (isRated: boolean) => void; conversationId?: string; } export interface ChatHeaderProps { title: string; onClose: () => void; primaryColor?: string; avatar?: string; closeButtonIcon?: 'default' | 'text' | 'custom'; closeButtonText?: string; closeButtonCustomIcon?: string; } export interface MessageListProps { messages: Message[]; isTyping: boolean; avatar?: string; textColor?: string; bubbleUserColor?: string; chatbotActivated?: boolean; } export interface MessageProps { message: Message; avatar?: string; textColor?: string; bubbleUserColor?: string; } export interface MessageInputProps { onSendMessage: (message: string, files?: FileWithBlobUrl[]) => void; placeholder?: string; primaryColor?: string; disabled?: boolean; input?: EmbedChatInputConfig; apiKey?: string; } export interface TypingIndicatorProps { avatar?: string; } export interface ChatBubblePopoverProps { initialMessage?: string; avatar?: string; position: 'bottom-left' | 'bottom-right'; marginBottom: number; marginSide: number; primaryColor: string; isMobile: boolean; isOpen: boolean; onPopoverClick: () => void; } export interface WebChatInstance { root: any; destroy: () => void; getConversationId: () => string | null; setIsOpen?: (open: boolean) => void; updateConfig?: (newConfig: Partial<WebChatConfig>) => void; setPosition?: (pos: Partial<WebChatConfig>) => void; hide?: () => void; show?: () => void; injectCSS?: (css: string) => void; removeCustomCSS?: () => void; } export interface WebChatAPI { initialize: (config?: Partial<WebChatConfig>) => WebChatInstance | null; } export interface EmbedChatAPI { initialize: (config: EmbedChatConfig) => EmbedChatInstance | null; } export interface WhatsAppPositionConfig { position?: 'bottom-right' | 'bottom-left'; marginBottom?: number; marginSide?: number; } export interface WhatsAppConfig { phoneNumber: string; active?: boolean; color?: string; position?: 'bottom-right' | 'bottom-left'; marginBottom?: number; marginSide?: number; size?: number; message?: string; mobile?: WhatsAppPositionConfig; desktop?: WhatsAppPositionConfig; } export interface WhatsAppInstance { destroy: () => void; hide: () => void; show: () => void; updateConfig: (newConfig: Partial<WhatsAppConfig>) => void; } export interface WhatsAppAPI { initialize: (config: WhatsAppConfig) => WhatsAppInstance | null; }