@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
348 lines • 10 kB
TypeScript
import { ReactNode, ComponentType, CSSProperties } from 'react';
export interface Message {
id: string;
content: string;
sender: 'user' | 'ai' | 'system';
timestamp: Date;
type: 'text' | 'image' | 'file' | 'action';
metadata?: Record<string, any>;
status?: 'sending' | 'sent' | 'delivered' | 'read' | 'error';
}
export interface ChatSession {
id: string;
userId?: string;
startTime: Date;
lastActivity: Date;
messages: Message[];
context: Record<string, any>;
status: 'active' | 'ended' | 'paused';
}
export interface ChatError {
code: string;
message: string;
details?: any;
timestamp: Date;
recoverable: boolean;
}
export declare enum DeviceType {
DESKTOP = "desktop",
TABLET = "tablet",
MOBILE = "mobile"
}
export declare enum ChatMode {
DESKTOP = "desktop",
MOBILE = "mobile",
AUTO = "auto"
}
export interface DeviceInfo {
type: DeviceType;
screenWidth: number;
screenHeight: number;
orientation: 'portrait' | 'landscape';
isTouchDevice: boolean;
isKeyboardVisible: boolean;
userAgent: string;
pixelRatio: number;
viewport: {
width: number;
height: number;
};
}
export interface DeviceBreakpoints {
mobile: number;
tablet: number;
desktop: number;
}
export interface ChatbotTheme {
primary: string;
secondary: string;
background: string;
surface: string;
text: {
primary: string;
secondary: string;
inverse: string;
};
border: string;
shadow: string;
success: string;
warning: string;
error: string;
radius: {
sm: string;
md: string;
lg: string;
full: string;
};
spacing: {
xs: string;
sm: string;
md: string;
lg: string;
xl: string;
};
typography: {
fontFamily: string;
fontSize: {
xs: string;
sm: string;
md: string;
lg: string;
xl: string;
};
fontWeight: {
normal: string;
medium: string;
semibold: string;
bold: string;
};
};
}
export type ThemeName = 'default' | 'dark' | 'compact' | string;
export interface ThemeConfig {
name: ThemeName;
theme: ChatbotTheme;
variables?: Record<string, string>;
}
export interface ChatbotTranslations {
chatbot: string;
placeholder: string;
send: string;
typing: string;
retry: string;
error: string;
close: string;
minimize: string;
maximize: string;
welcome: string;
goodbye: string;
[key: string]: string;
}
export type SupportedLanguage = 'ko' | 'en' | 'ja' | 'zh' | 'es' | 'fr' | 'de';
export interface LanguageInfo {
code: SupportedLanguage;
name: string;
nativeName: string;
isRTL: boolean;
}
export interface I18nConfig {
defaultLanguage: SupportedLanguage;
fallbackLanguage: SupportedLanguage;
translations: Record<SupportedLanguage, ChatbotTranslations>;
languages: Record<SupportedLanguage, LanguageInfo>;
}
export interface ApiConfig {
baseUrl?: string;
apiKey?: string;
timeout?: number;
retryAttempts?: number;
headers?: Record<string, string>;
}
export interface PerformanceConfig {
enableOptimization: boolean;
enableMemoryManagement: boolean;
enableGarbageCollection: boolean;
memoryThreshold: number;
maxCacheSize: number;
debounceMs: number;
throttleMs: number;
}
export interface AccessibilityConfig {
enableScreenReader: boolean;
enableKeyboardNavigation: boolean;
enableHighContrast: boolean;
enableFocusVisible: boolean;
ariaLabels: Record<string, string>;
}
export interface AnalyticsConfig {
enabled: boolean;
trackPageViews: boolean;
trackInteractions: boolean;
trackErrors: boolean;
customEvents: boolean;
provider?: 'ga' | 'gtm' | 'custom';
trackingId?: string;
}
export interface BaseComponentProps {
className?: string;
style?: CSSProperties;
children?: ReactNode;
'data-testid'?: string;
}
export interface FloatingButtonProps extends BaseComponentProps {
position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
size: 'small' | 'medium' | 'large';
color?: string;
icon?: ReactNode;
label?: string;
disabled?: boolean;
onClick?: () => void;
onHover?: () => void;
animationDuration?: number;
}
export interface ChatWidgetProps extends BaseComponentProps {
apiConfig?: ApiConfig;
theme?: ThemeName | ChatbotTheme;
language?: SupportedLanguage;
title?: string;
placeholder?: string;
welcomeMessage?: string;
enableTypingIndicator?: boolean;
enableSuggestedQuestions?: boolean;
enableFileUpload?: boolean;
maxFileSize?: number;
allowedFileTypes?: string[];
onMessage?: (message: Message) => void;
onError?: (error: ChatError) => void;
onClose?: () => void;
onMinimize?: () => void;
}
export interface ResponsiveChatSystemProps extends BaseComponentProps {
config: ResponsiveChatSystemConfig;
deviceBreakpoints?: DeviceBreakpoints;
enableDebug?: boolean;
onDeviceChange?: (deviceInfo: DeviceInfo) => void;
onModeChange?: (mode: ChatMode) => void;
onError?: (error: ChatError) => void;
}
export interface ResponsiveChatSystemConfig {
mobileBreakpoint: number;
tabletBreakpoint: number;
desktopBreakpoint: number;
defaultChatMode: ChatMode;
enableTransitions: boolean;
animationDuration: number;
performance: PerformanceConfig;
accessibility: AccessibilityConfig;
analytics?: AnalyticsConfig;
enableDebug: boolean;
debugLevel: 'error' | 'warn' | 'info' | 'debug';
}
export interface UnifiedCustomerChatLibraryConfig extends ResponsiveChatSystemConfig {
api: ApiConfig;
ui: {
theme: ThemeName | ChatbotTheme;
brandName: string;
logo?: string;
primaryColor?: string;
enableThemeToggle: boolean;
};
i18n: {
defaultLanguage: SupportedLanguage;
enableLanguageSelector: boolean;
autoDetectLanguage: boolean;
};
features: {
enableSuggestedQuestions: boolean;
enableTypingIndicator: boolean;
enableFileUpload: boolean;
enableChatHistory: boolean;
enableRealTimeSync: boolean;
enableNotifications: boolean;
};
floatingButton: {
enabled: boolean;
position: FloatingButtonProps['position'];
size: FloatingButtonProps['size'];
customIcon?: ReactNode;
showBadge: boolean;
};
security: {
enableCSP: boolean;
allowedOrigins?: string[];
enableEncryption: boolean;
sessionTimeout: number;
};
}
export interface ChatEvent {
type: string;
timestamp: Date;
data: any;
sessionId?: string;
messageId?: string;
}
export interface ChatEventHandlers {
onMessageSent?: (message: Message) => void;
onMessageReceived?: (message: Message) => void;
onTypingStart?: () => void;
onTypingStop?: () => void;
onChatOpen?: () => void;
onChatClose?: () => void;
onError?: (error: ChatError) => void;
onSessionStart?: (session: ChatSession) => void;
onSessionEnd?: (session: ChatSession) => void;
onDeviceChange?: (deviceInfo: DeviceInfo) => void;
onThemeChange?: (theme: ThemeName) => void;
onLanguageChange?: (language: SupportedLanguage) => void;
}
export interface UseChatReturn {
isOpen: boolean;
isConnected: boolean;
isTyping: boolean;
messages: Message[];
session: ChatSession | null;
sendMessage: (content: string) => Promise<void>;
openChat: () => void;
closeChat: () => void;
toggleChat: () => void;
clearHistory: () => void;
changeTheme: (theme: ThemeName) => void;
changeLanguage: (language: SupportedLanguage) => void;
}
export interface UseDeviceDetectionReturn {
deviceInfo: DeviceInfo;
isDesktop: boolean;
isTablet: boolean;
isMobile: boolean;
orientation: 'portrait' | 'landscape';
breakpoint: 'mobile' | 'tablet' | 'desktop';
}
export interface UseResponsiveChatReturn extends UseChatReturn, UseDeviceDetectionReturn {
chatMode: ChatMode;
setChatMode: (mode: ChatMode) => void;
config: ResponsiveChatSystemConfig;
}
export interface ChatPlugin {
name: string;
version: string;
enabled: boolean;
config?: Record<string, any>;
initialize?: (context: ChatPluginContext) => void;
destroy?: () => void;
}
export interface ChatPluginContext {
api: any;
ui: any;
events: any;
utils: any;
}
export interface CustomComponent {
name: string;
component: ComponentType<any>;
props?: Record<string, any>;
position?: 'header' | 'footer' | 'sidebar' | 'overlay';
}
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
export type RequiredKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
export type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export type EventCallback<T = any> = (data: T) => void | Promise<void>;
export type AsyncFunction<T = any> = (...args: any[]) => Promise<T>;
export declare const CHAT_EVENTS: {
readonly MESSAGE_SENT: "message_sent";
readonly MESSAGE_RECEIVED: "message_received";
readonly TYPING_START: "typing_start";
readonly TYPING_STOP: "typing_stop";
readonly CHAT_OPEN: "chat_open";
readonly CHAT_CLOSE: "chat_close";
readonly ERROR: "error";
readonly SESSION_START: "session_start";
readonly SESSION_END: "session_end";
readonly DEVICE_CHANGE: "device_change";
readonly THEME_CHANGE: "theme_change";
readonly LANGUAGE_CHANGE: "language_change";
};
export type ChatEventType = typeof CHAT_EVENTS[keyof typeof CHAT_EVENTS];
export declare const DEFAULT_CONFIG: DeepPartial<UnifiedCustomerChatLibraryConfig>;
//# sourceMappingURL=types.d.ts.map