UNPKG

@mendable/search

Version:

A React component for integrating Mendable Search into your application.

229 lines (221 loc) 9.08 kB
import React from 'react'; interface MendableSearchStyle { darkMode: boolean; accentColor: string; backgroundColor?: string; } interface MendableInPlaceProps { anon_key: string; style?: MendableSearchStyle; hintText?: string; showSimpleSearch?: boolean; welcomeMessage?: string; botIcon?: JSX.Element | React.ReactNode | string | undefined; userIcon?: JSX.Element | React.ReactNode | undefined; messageSettings?: MessageSettings; footer?: MendableFooterProps; inputSettings?: InputSettings; testing_id?: string; askAIText?: string; context?: string; privacyDisclaimer?: string; _shouldStream?: boolean; _initialConversation?: any[]; language?: string; metadata?: Json; hintQuestions?: string[]; toolbarSettings?: ToolbarSettings; onMessageForTracking?: (question: string, answer: string, sources?: string[], confidence_score?: number) => void; onSourceClickedForTracking?: (source: string) => void; onSwitchingSearchType?: (searchType: string) => void; onRateClicked?: (isLiked: boolean, question: string, answer: string, sources: string[]) => void; __experimentalBuilderApiKey?: string; _isFullyLoaded?: (b: boolean) => void; } interface MendableSearchProps { anon_key: string; customSearchBar?: JSX.Element | undefined; floatingButtonEnabled?: boolean; style?: MendableSearchStyle; welcomeMessage?: string; hintText: string; openState?: boolean; setOpenState?: (openState: boolean) => void; showSimpleSearch?: boolean; botIcon?: JSX.Element | React.ReactNode | string | undefined; userIcon?: JSX.Element | React.ReactNode | undefined; dialogCustomStyle?: DialogCustomStyle; messageSettings?: MessageSettings; footer?: MendableFooterProps; cmdShortcutKey?: string; hintQuestions?: string[]; inputSettings?: InputSettings; _shouldStream?: boolean; testing_id?: string; isPinnable?: boolean; _setIsPinned?: () => void; _isPinned?: boolean; askAIText?: string; context?: string; privacyDisclaimer?: string; toolbarSettings?: ToolbarSettings; metadata?: Json; __experimentalBuilderApiKey?: string; _isFullyLoaded?: (b: boolean) => void; onMessageForTracking?: (question: string, answer: string, sources?: string[], confidence_score?: number) => void; onSourceClickedForTracking?: (source: string) => void; onSwitchingSearchType?: (searchType: string) => void; onRateClicked?: (isLiked: boolean, question: string, answer: string, sources: string[]) => void; } interface DialogCustomStyle { dialogTopMargin?: string; } interface MendableFooterProps { bottomRightLink?: { label: string; link: string; }; } type Json = string | number | boolean | null | { [key: string]: Json | undefined; } | Json[]; interface SearchBarProps { anon_key: string; language?: string; placeholder?: string; welcomeMessage?: string; onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void; style?: MendableSearchStyle; searchBarStyle?: SearchBarStyle; botIcon?: JSX.Element | React.ReactNode | string | undefined; userIcon?: JSX.Element | React.ReactNode | undefined; cmdShortcutKey?: string; dialogPlaceholder?: string; showSimpleSearch?: boolean; dialogCustomStyle?: DialogCustomStyle; messageSettings?: MessageSettings; footer?: MendableFooterProps; _js?: boolean; _shouldStream?: boolean; testing_id?: string; askAIText?: string; context?: string; hintQuestions?: string[]; toolbarSettings?: ToolbarSettings; inputSettings?: InputSettings; isPinnable?: boolean; privacyDisclaimer?: string; metadata?: Json; onMessageForTracking?: (question: string, answer: string, sources?: string[], confidence_score?: number) => void; onSourceClickedForTracking?: (source: string) => void; onSwitchingSearchType?: (searchType: string) => void; onRateClicked?: (isLiked: boolean, question: string, answer: string, sources: string[]) => void; __experimentalBuilderApiKey?: string; } interface SearchBarStyle { color?: string; backgroundColor?: string; borderColor?: string; shadow?: boolean; borderRadius?: string; showShortcut?: boolean; searchIcon?: JSX.Element | React.ReactNode | string | undefined; } interface FloatingButtonProps { anon_key: string; style?: MendableSearchStyle; icon?: JSX.Element | React.ReactNode | string | undefined; floatingButtonStyle?: FloatingButtonStyle; cmdShortcutKey?: string; showSimpleSearch?: boolean; welcomeMessage?: string; dialogPlaceholder?: string; botIcon?: JSX.Element | React.ReactNode | string | undefined; userIcon?: JSX.Element | React.ReactNode | undefined; positionOverwriteClassname?: string; dialogCustomStyle?: DialogCustomStyle; footer?: MendableFooterProps; showPopup?: boolean; popupText?: string; dismissPopupAfter?: number; hintQuestions?: string[]; toolbarSettings?: ToolbarSettings; metadata?: Json; customText?: string; messageSettings?: MessageSettings; inputSettings?: InputSettings; language?: string; _js?: boolean; _shouldStream?: boolean; testing_id?: string; askAIText?: string; context?: string; privacyDisclaimer?: string; onMessageForTracking?: (question: string, answer: string, sources?: string[], confidence_score?: number) => void; onSourceClickedForTracking?: (source: string) => void; onSwitchingSearchType?: (searchType: string) => void; onRateClicked?: (isLiked: boolean, question: string, answer: string, sources: string[]) => void; __experimentalBuilderApiKey?: string; } interface MendableChatBubbleProps { anon_key: string; style?: MendableSearchStyle; icon?: JSX.Element | React.ReactNode | string | undefined; floatingButtonStyle?: FloatingButtonStyle; cmdShortcutKey?: string; showSimpleSearch?: boolean; welcomeMessage?: string; dialogPlaceholder?: string; botIcon?: JSX.Element | React.ReactNode | string | undefined; userIcon?: JSX.Element | React.ReactNode | undefined; positionOverwriteClassname?: string; dialogCustomStyle?: DialogCustomStyle; customText?: string; messageSettings?: MessageSettings; footer?: MendableFooterProps; toolbarSettings?: ToolbarSettings; hintQuestions?: string[]; inputSettings?: InputSettings; language?: string; _js?: boolean; _shouldStream?: boolean; testing_id?: string; askAIText?: string; context?: string; metadata?: Json; __experimentalBuilderApiKey?: string; } interface MessageSettings { openSourcesInNewTab?: boolean; openInNewTabForOutsideSources?: boolean; prettySources?: boolean; persistMessagesBetweenSessions?: boolean; scrollToView?: boolean; hideSources?: boolean; legacySourceDisplay?: boolean; textAlign?: string; sourcesFirst?: boolean; sourcesDisplay?: "short" | "long"; } interface ToolbarSettings { showStopGeneratingButton?: boolean; } interface InputSettings { askButtonStyle?: AskButtonStyle; } interface AskButtonStyle { activeColor: string; disabledColor: string; textColor: string; disabledTextColor: string; } interface FloatingButtonStyle { color: string; backgroundColor: string; } declare function MendableSearch({ anon_key, style, dialogCustomStyle, welcomeMessage, openState, setOpenState, showSimpleSearch, isPinnable, cmdShortcutKey, hintQuestions, onMessageForTracking, onSourceClickedForTracking, onSwitchingSearchType, _isFullyLoaded, ...restProps }: MendableSearchProps): React.JSX.Element; declare function MendableSearchBar({ anon_key, placeholder, cmdShortcutKey, onKeyDown, style, welcomeMessage, botIcon, userIcon, searchBarStyle, dialogPlaceholder, showSimpleSearch, dialogCustomStyle, messageSettings, language, _js, _shouldStream, testing_id, askAIText, isPinnable, privacyDisclaimer, footer, metadata, onMessageForTracking, onSourceClickedForTracking, onSwitchingSearchType, ...restProps }: SearchBarProps): React.JSX.Element; declare function MendableFloatingButton({ floatingButtonStyle, icon, dialogPlaceholder, positionOverwriteClassname, language, welcomeMessage, cmdShortcutKey, customText, showPopup, popupText, dismissPopupAfter, ...restProps }: FloatingButtonProps): React.JSX.Element; declare function MendableInPlace({ anon_key, style, hintText, showSimpleSearch, welcomeMessage, botIcon, userIcon, testing_id, hintQuestions, _shouldStream, _initialConversation, language, _isFullyLoaded, ...restProps }: MendableInPlaceProps): React.JSX.Element; declare function MendableChatBubble({ floatingButtonStyle, icon, dialogPlaceholder, positionOverwriteClassname, language, welcomeMessage, cmdShortcutKey, customText, ...restProps }: MendableChatBubbleProps): React.JSX.Element; export { MendableChatBubble, MendableFloatingButton, MendableInPlace, MendableSearch, MendableSearchBar };