UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

107 lines (106 loc) 2.67 kB
/** * DisclaimerComponent - Reusable AI disclaimer component for the chat widget * * Provides a consistent way to display AI disclaimers across different views * with support for multiple display variants and proper accessibility. */ import type { ChatConfig } from '../types/types'; /** * Disclaimer configuration */ export interface DisclaimerConfig { enabled: boolean; message: string; linkText?: string; linkUrl?: string; } /** * Disclaimer display variants */ export type DisclaimerVariant = 'standalone' | 'inline' | 'compact'; /** * Disclaimer component options */ export interface DisclaimerOptions { variant?: DisclaimerVariant; className?: string; showIcon?: boolean; ariaLabel?: string; iconType?: 'info' | 'warning' | 'alert'; } /** * DisclaimerComponent Class * * A reusable component for rendering AI disclaimers with: * - Multiple display variants (standalone, inline, compact) * - Optional link support * - Proper HTML escaping for security * - Accessibility features (ARIA labels, semantic HTML) * - Responsive design support */ export declare class DisclaimerComponent { private config?; private options; private element; constructor(config?: DisclaimerConfig, options?: DisclaimerOptions); /** * Check if disclaimer should be rendered */ private shouldRender; /** * Render the disclaimer component */ render(): HTMLElement | null; /** * Render standalone variant (for welcome screen) */ private renderStandalone; /** * Render inline variant (for branding section) */ private renderInline; /** * Render compact variant (for mobile or limited space) */ private renderCompact; /** * Render the optional link */ private renderLink; /** * Get icon SVG based on type */ private getIcon; /** * Get info icon SVG */ private getInfoIcon; /** * Get external link icon SVG */ private getExternalLinkIcon; /** * Escape HTML to prevent XSS */ private escapeHtml; /** * Get warning icon SVG */ private getWarningIcon; /** * Get alert icon SVG */ private getAlertIcon; /** * Update configuration */ update(config: DisclaimerConfig | undefined): void; /** * Destroy the component and clean up */ destroy(): void; /** * Static factory method for creating disclaimer from configuration */ static fromConfig(config?: NonNullable<ChatConfig['features']>['disclaimer'], variant?: DisclaimerVariant): DisclaimerComponent | null; }