@mendable/search
Version:
A React component for integrating Mendable Search into your application.
299 lines (298 loc) • 10.4 kB
TypeScript
import React from "react";
export interface MendableSearchStyle {
darkMode: boolean;
accentColor: string;
backgroundColor?: string;
}
export 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;
}
export 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;
}
export interface MendableSidebarProps {
anon_key: string;
customSearchBar?: JSX.Element | undefined;
floatingButtonEnabled?: boolean;
style?: MendableSearchStyle;
welcomeMessage?: string;
hintText: string;
openState?: boolean;
historyState: any;
setHistory: (historyState: any) => void;
setOpenState: (openState: boolean) => void;
showSimpleSearch?: boolean;
botIcon?: JSX.Element | React.ReactNode | string | undefined;
userIcon?: JSX.Element | React.ReactNode | undefined;
dialogCustomStyle?: DialogCustomStyle;
footer?: MendableFooterProps;
hintQuestions?: string[];
toolbarSettings?: ToolbarSettings;
inputSettings?: InputSettings;
messageSettings?: MessageSettings;
_shouldStream?: boolean;
testing_id?: string;
_setIsPinned?: () => void;
_isPinned: boolean;
askAIText?: string;
context?: string;
privacyDisclaimer?: string;
metadata?: Json;
__experimentalBuilderApiKey?: 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;
}
export interface DialogCustomStyle {
dialogTopMargin?: string;
}
export interface MendableFooterProps {
bottomRightLink?: {
label: string;
link: string;
};
}
export type Json = string | number | boolean | null | {
[key: string]: Json | undefined;
} | Json[];
export 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;
}
export interface SearchBarStyle {
color?: string;
backgroundColor?: string;
borderColor?: string;
shadow?: boolean;
borderRadius?: string;
showShortcut?: boolean;
searchIcon?: JSX.Element | React.ReactNode | string | undefined;
}
export 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;
}
export 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;
}
export interface MessageSettings {
openSourcesInNewTab?: boolean;
openInNewTabForOutsideSources?: boolean;
prettySources?: boolean;
persistMessagesBetweenSessions?: boolean;
scrollToView?: boolean;
hideSources?: boolean;
legacySourceDisplay?: boolean;
textAlign?: string;
sourcesFirst?: boolean;
sourcesDisplay?: "short" | "long";
}
export interface ToolbarSettings {
showStopGeneratingButton?: boolean;
}
export interface InputSettings {
askButtonStyle?: AskButtonStyle;
}
export interface AskButtonStyle {
activeColor: string;
disabledColor: string;
textColor: string;
disabledTextColor: string;
}
export declare const DefaultAskButtonStyle: AskButtonStyle;
export interface CustomSearchBarProps {
toggledOn: boolean;
onClick: () => void;
}
export interface FloatingButtonStyle {
color: string;
backgroundColor: string;
}
export declare const DefaultStyle: MendableSearchStyle;
export declare const DefaultSearchBarStyle: SearchBarStyle;
export declare const DefaultSearchBarLightModeStyle: SearchBarStyle;
export declare const DefaultSearchBarStyle2: SearchBarStyle;
export declare const DefaultFloatingButtonStyle: FloatingButtonStyle;
export declare const DefaultLightStyle: MendableSearchStyle;
export declare const DefaultLightFloatingButtonStyle: FloatingButtonStyle;
export declare const DefaultMessageSettings: MessageSettings;
export declare const DefaultToolbarSettings: ToolbarSettings;
export interface Company {
company_id: number;
display_name: string;
name: string;
is_white_label: boolean;
}
export interface Project {
id: number;
created_at: string;
name: string;
company_id: number;
support_url: string;
}
export interface Conversation {
conversation_id: number;
start_time: string;
end_time: string | null;
message_count: number;
project_id: number;
}
export declare enum Alert {
NoDocs = "noDocs",
FullDocs = "fullDocs",
None = "none",
Error = "error"
}
export type PinToggleButtonProps = {
isPinned: boolean;
setPinState: () => void;
style?: MendableSearchStyle;
};
export interface MendableTool {
name: string;
is_action: boolean;
}