// SDK Configuration Types export interface OperoChatSDKConfig { apiKey: string; apiEndpoint?: string; userEmail?: string; customStyles?: OperoChatStyles; callbacks?: OperoChatCallbacks; analytics?: OperoAnalyticsConfig; } // Analytics Configuration export interface OperoAnalyticsConfig { enableInDevelopment?: boolean; // Default: false - only config option } // Styling Types export interface OperoChatStyles { // Colors primaryColor?: string; secondaryColor?: string; backgroundColor?: string; textColor?: string; userBubbleColor?: string; assistantBubbleColor?: string; assistantMessageText?: string; // Chat bubble styling chatBubbleRadius?: number; // Disclaimer styling disclaimerTextColor?: string; // Powered by banner styling poweredByTextColor?: string; poweredByLinkColor?: string; // Error banner styling errorBannerBackgroundColor?: string; errorBannerBorderColor?: string; errorBannerTextColor?: string; errorBannerDismissBackgroundColor?: string; errorBannerDismissTextColor?: string; // Progress banner styling progressBannerBackgroundColor?: string; progressBannerBorderColor?: string; progressBannerTextColor?: string; progressIndicatorColor?: string; // Sources styling sourcesHeaderColor?: string; sourceItemBackgroundColor?: string; sourceTitleColor?: string; sourceTagColor?: string; sourceTagBackgroundColor?: string; // History styling historySectionBackgroundColor?: string; historyTitleColor?: string; conversationItemBackgroundColor?: string; conversationItemBorderColor?: string; conversationTitleColor?: string; conversationDateColor?: string; loadMoreButtonBackgroundColor?: string; loadMoreButtonTextColor?: string; loadingSpinnerColor?: string; loadingTextColor?: string; } // Callback Types export interface OperoChatCallbacks { onReady?: () => void; onMessageSent?: (message: string) => void; onStreamStart?: () => void; onStreamEnd?: (fullMessage: string) => void; onError?: (error: OperoChatError) => void; onSources?: (sources: OperoSource[]) => OperoSource[]; onProgress?: (progressMessage: string) => string; } // Error Types export interface OperoChatError { type: "network" | "api" | "auth" | "validation" | "unknown"; message: string; details?: any; persistent?: boolean; } // Reaction Types export type ReactionType = "thumbs_up" | "thumbs_down"; export interface MessageReaction { type: ReactionType; created_at?: string; } // Markdown Section Types export interface MarkdownSection { heading: string; content: string; level: 1 | 2 | 3; // H1, H2, or H3 } // Filter types - generic passthrough for any filters from app to API export type OperoApiFilters = Record; // Message Types export interface OperoChatMessage { id: string; role: "user" | "assistant"; content: string; timestamp: Date; isStreaming?: boolean; sources?: OperoSource[]; hasFilters?: boolean; // Track if assistant message was generated with filters reaction?: MessageReaction; // User's reaction to message message_id?: string; // Backend message ID for reactions } export interface OperoSource { title: string; url?: string; type?: string; language?: string; filename?: string; pageNumber?: number; document_id?: string; relevance_score?: number; metadata?: { filetype?: string; languages?: string[]; page_number?: number; page_name?: string; date_processed?: string; s3_path?: string; distance?: number; }; } export interface ProcessedSource { document_id: string; title: string; url?: string; metadata: { filetype: string; languages: string[]; date_processed?: string; s3_path?: string; }; pages: Map; pageRelevance: Map; maxRelevance: number; } // Chat State Types export interface OperoChatState { messages: OperoChatMessage[]; conversationId?: string; isStreaming: boolean; isOpen: boolean; sources?: any[]; } // API Configuration Types export interface OperoAPIConfig { endpoint: string; apiKey: string; userEmail?: string; features?: OperoAPIFeatures; } export interface OperoAPIFeatures { streaming: boolean; titleGeneration: boolean; sources: boolean; progress: boolean; } // Component Prop Types export interface OperoChatContainerProps { isVisible: boolean; onClose?: () => void; children: React.ReactNode; customStyles?: OperoChatStyles; } export interface OperoChatHeaderProps { title?: string; onClose?: () => void; onNewConversation?: () => void; onOpenHistory?: () => void; customStyles?: OperoChatStyles; } export interface OperoChatInputProps { onSend: (message: string) => void; placeholder?: string; disabled?: boolean; customStyles?: OperoChatStyles; } export interface OperoChatBubbleProps { message: OperoChatMessage; customStyles?: OperoChatStyles; onReaction?: (messageId: string, reactionType: ReactionType) => void; } export interface OperoChatMessagesProps { messages: OperoChatMessage[]; customStyles?: OperoChatStyles; } export interface OperoProgressIndicatorProps { message?: string; isVisible: boolean; customStyles?: OperoChatStyles; } export interface OperoSourcesDisplayProps { sources: any[]; customStyles?: OperoChatStyles; } export interface OperoDisclaimerProps { customStyles?: OperoChatStyles; } export interface OperoPoweredByProps { customStyles?: OperoChatStyles; } export interface OperoErrorBannerProps { message: string; onDismiss?: () => void; customStyles?: OperoChatStyles; } export interface OperoProgressBannerProps { message: string; isVisible: boolean; customStyles?: OperoChatStyles; } export interface OperoConfirmationDialogProps { isVisible: boolean; title: string; message: string; confirmText?: string; cancelText?: string; onConfirm: () => void; onCancel: () => void; customStyles?: OperoChatStyles; } export interface OperoSampleQuestionsProps { apiKey: string; apiEndpoint?: string; userEmail?: string; userRole?: string; filters?: any; questionCount?: number; onQuestionPress: (question: string) => void; onError?: (error: OperoChatError) => void; customStyles?: OperoChatStyles; } export interface OperoChatProviderProps { apiKey: string; apiEndpoint?: string; userEmail?: string; userRole?: string; customStyles?: OperoChatStyles; filters?: OperoApiFilters; analytics?: OperoAnalyticsConfig; showHistory?: boolean; onReady?: () => void; onError?: (error: any) => void; onMessageSent?: (message: string) => void; onStreamStart?: () => void; onStreamEnd?: (fullMessage: string) => void; onSources?: (sources: OperoSource[]) => OperoSource[]; onProgress?: (progressMessage: string) => string; children: React.ReactNode; } export interface UseOperoChatConfig { apiKey: string; apiEndpoint?: string; userEmail?: string; userRole?: string; callbacks?: OperoChatCallbacks; customStyles?: OperoChatStyles; filters?: OperoApiFilters; analytics?: OperoAnalyticsConfig; } export interface UseOperoChatReturn { isVisible: boolean; messages: OperoChatMessage[]; isLoading: boolean; isConnected: boolean; errorMessage: string | null; progressMessage: string | null; conversationTitle: string; openChat: () => void; closeChat: () => void; sendMessage: (message: string) => Promise; checkConnectivity: () => Promise; clearMessages: () => void; dismissError: () => void; }