@agentman/chat-widget
Version:
Agentman Chat Widget for easy integration with web applications
126 lines (125 loc) • 3.17 kB
TypeScript
import type { ChatConfig, ChatTheme, ChatAssets } from '../types/types';
import { InputComponent } from './InputComponent';
/**
* WelcomeScreen Component - Claude-style minimalist welcome interface
*
* Features:
* - Centered chat input
* - Message prompts below input
* - Clean, focused design without header
* - Responsive layout
*/
export declare class WelcomeScreen {
private config;
private theme;
private assets;
private element;
private boundInputKeyHandler;
private boundSendHandler;
private boundPromptClickHandler;
private boundConversationsClickHandler?;
private boundToggleHandler?;
private boundAttachmentClickHandler?;
private boundFileSelectHandler?;
private boundAttachmentRemoveHandler?;
private inputComponent;
constructor(config: ChatConfig, theme: ChatTheme, assets: ChatAssets, eventHandlers: {
onInputKey: (e: KeyboardEvent) => void;
onSend: () => void;
onPromptClick: (prompt: string) => void;
onConversationsClick?: () => void;
onToggle?: () => void;
onAttachmentClick?: () => void;
onFileSelect?: (files: FileList) => void;
onAttachmentRemove?: (fileId: string) => void;
});
/**
* Create and return the welcome screen DOM element
*/
create(): HTMLElement;
/**
* Update theme colors
*/
updateTheme(theme: Partial<ChatTheme>): void;
/**
* Get the input value
*/
getInputValue(): string;
/**
* Clear the input
*/
clearInput(): void;
/**
* Focus the input
*/
focusInput(): void;
/**
* Get the input component instance
*/
getInputComponent(): InputComponent | null;
/**
* Update attachment preview
*/
updateAttachmentPreview(attachments: Record<string, unknown>[]): void;
/**
* Clear file input
*/
clearFileInput(): void;
/**
* Destroy the component and clean up
*/
destroy(): void;
/**
* Generate the welcome screen HTML template
*/
private generateTemplate;
/**
* Generate minimize button
*/
private generateMinimizeButton;
/**
* Generate welcome header with logo and title
*/
private generateHeader;
/**
* Generate centered input section
*/
private generateInputSection;
/**
* Generate message prompts
*/
private generatePrompts;
/**
* Generate bottom section with conversations link and branding
*/
private generateBottomSection;
/**
* Generate branding section
* @deprecated Use generateBottomSection instead
*/
private generateBranding;
/**
* Create and mount the input component
*/
private createInputComponent;
/**
* Attach event listeners
*/
private attachEventListeners;
/**
* Remove event listeners
*/
private removeEventListeners;
/**
* Handle prompt button clicks
*/
private handlePromptClick;
/**
* Apply theme to the component
*/
private applyTheme;
/**
* Escape HTML to prevent XSS
*/
private escapeHtml;
}