@infomatebot/chatbot-widget
Version:
Build intelligent chatbots using pre-designed conversation flows with quick reply options. Upload documents for AI-powered, context-aware responses and reduce support costs by 80% with guided conversations
38 lines • 2.45 kB
TypeScript
import type { ChatbotConfig } from '../types/public.types';
import type { RequiredChatbotConfig, Message, InternalChatbotConfig } from '../types/internal.types';
export declare function generateMessageId(): string;
export declare function generateConversationId(): string;
export declare function mergeConfig(userConfig: Partial<ChatbotConfig>): RequiredChatbotConfig;
export declare function validateConfig(config: ChatbotConfig): {
isValid: boolean;
errors: string[];
};
export declare function isValidUrl(url: string): boolean;
export declare function isValidColor(color: string): boolean;
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
export declare function delay(ms: number): Promise<void>;
export declare function generateId(): string;
export declare function sanitizeHtml(html: string): string;
export declare function decodeHtmlEntities(text: string): string;
export declare function formatTimestamp(timestamp: string): string;
export declare function scrollToBottom(element: HTMLElement, smooth?: boolean): void;
export declare function autoResizeTextarea(textarea: HTMLTextAreaElement, maxHeight?: number): void;
export declare function classifyMessage(message: string): string;
export declare function getRandomResponse(responses: readonly string[]): string;
export declare function attributeToProperty(attributeName: string): string;
export declare function propertyToAttribute(propertyName: string): string;
export declare function isMobile(): boolean;
export declare function prefersReducedMotion(): boolean;
export declare function deepClone<T>(obj: T): T;
export declare function validateMessage(content: string): {
isValid: boolean;
error?: string;
};
export declare function createMessage(content: string, sender: 'bot' | 'user', type?: Message['type']): Message;
export declare function getBrowserInfo(): Record<string, string>;
export declare function safeJsonParse<T>(json: string, fallback: T): T;
export declare function createCssVar(name: string): string;
export declare function setCssVars(element: HTMLElement, vars: Record<string, string>): void;
export declare function createInternalConfig(credentials: ChatbotConfig, backendConfig: any): InternalChatbotConfig;
//# sourceMappingURL=helpers.d.ts.map