import { default as default_2 } from 'react'; import { JSONSchemaType } from 'ajv'; import { ReactNode } from 'react'; declare type Action = { id: string; type: ActionType; action: { version: string; options: { title?: string; [key: string]: any; }; }; }; declare type ActionButtonsBlock = { id: string; type: 'action-buttons'; }; declare type ActionInput = { name: string; required: boolean; schema: { type: string; title: string; description: string; oneOf?: { const: string; title: string; }[]; }; type: string; ui: { type: string; }; }; declare type ActionInputFormBlock = { id: string; type: 'action-input-form'; state: 'ready' | 'processing' | 'completed'; actionId: string; initialValues: ActionInputs; schema: ActionInputsSchema; onSubmit?: (inputs: ActionInputs) => void; inputs: ActionInput[]; }; declare type ActionInputs = Record; declare type ActionInputsSchema = JSONSchemaType; declare type ActionInputValue = string | number | boolean | null; declare enum ActionType { CallPhone = "call_phone", OpenUrl = "open_url", SendEmail = "send_email", RunCallback = "run_callback", LaunchIntercomChat = "launch_intercom_chat", LaunchZendeskChat = "launch_zendesk_chat", LaunchZendeskMessenger = "launch_zendesk_messenger", LaunchFreshdesk = "launch_freshdesk", LaunchSupportTicketForm = "launch_support_ticket_form", LaunchZendeskSunshineChat = "launch_zendesk_sunshine_chat" } declare type AddActionButtons = { type: typeof AnswersActions.ADD_ACTION_BUTTONS; payload: { searchIntentId: string; actions: Array<{ id: string; type: string; action: { version: string; options: { title?: string; [key: string]: any; }; }; }>; index?: number; }; }; export declare interface Answer { id: string; state: AnswerState; question: string; blocks: AnswerBlock[]; searchResults?: SearchResult[]; followUpQuestions?: string[]; searchQueryId?: string; feedback?: FeedbackResponse; isUncertain?: boolean; uncertaintyLanguage?: string | null; uncertaintyFallbackText?: string; searchIntentId?: string; actions?: Action[]; hasError?: boolean; attachments?: AnswerAttachment[]; } declare interface AnswerAttachment { type: AttachmentType; url: string; filename?: string; } declare type AnswerBlock = MarkdownTextBlock | ActionButtonsBlock | ActionInputFormBlock; declare type AnswerListAction = SetAnswers | ClearAll | AppendNewAnswer | SetSearchResults | AppendAnswerChunk | SetAnswerError | SetUserFeedback | ClearUserFeedback | SetFollowUpQuestions | AppendBlock | CompleteAnswer | MarkAsUncertain | InvokeAction | GetActionInputs | AddActionButtons | NoArticlesFound | SetAwaitingKnowledgeGroup | SetKnowledgeGroupSelected; declare const AnswersActions: { readonly SET_ANSWERS: "answers/set_answers"; readonly CLEAR_ALL: "answers/clear_all"; readonly APPEND_NEW_ANSWER: "answers/create_empty_answer"; readonly APPEND_BLOCK: "answers/append_block"; readonly APPEND_ANSWER_CHUNK: "answers/append_stream_chunk"; readonly SET_SEARCH_RESULTS: "answers/update_search_results"; readonly SET_FOLLOW_UP_QUESTIONS: "answers/set_follow_up_questions"; readonly COMPLETE_ANSWER: "answers/finish_streaming"; readonly SET_ANSWER_ERROR: "answers/set_error_state"; readonly SET_USER_FEEDBACK: "answers/set_user_feedback"; readonly CLEAR_USER_FEEDBACK: "answers/clear_user_feedback"; readonly MARK_AS_UNCERTAIN: "answers/mark_as_uncertain"; readonly NO_ARTICLES_FOUND: "answers/no_articles_found"; readonly GET_ACTION_INPUTS: "answers/request_action_inputs"; readonly INVOKE_ACTION: "answers/invoke_action"; readonly ADD_ACTION_BUTTONS: "answers/add_action_buttons"; readonly SET_AWAITING_KNOWLEDGE_GROUP: "answers/set_awaiting_knowledge_group"; readonly SET_KNOWLEDGE_GROUP_SELECTED: "answers/set_knowledge_group_selected"; }; declare type AnswerState = 'fetching-search-results' | 'fetching-stream' | 'streaming' | 'getting-action-inputs' | 'awaiting-knowledge-group' | 'completed'; declare type AppendAnswerChunk = { type: typeof AnswersActions.APPEND_ANSWER_CHUNK; payload: { text: string; index?: number; }; }; declare type AppendBlock = { type: typeof AnswersActions.APPEND_BLOCK; payload: { block: AnswerBlock; index?: number; }; }; declare type AppendNewAnswer = { type: typeof AnswersActions.APPEND_NEW_ANSWER; payload: { id?: string; query: string; attachments?: AnswerAttachment[]; }; }; declare type AttachmentType = 'image' | 'file'; export declare const ChatSearch: default_2.ForwardRefExoticComponent>; declare interface ChatSearchContextProps { query: string; setQuery: default_2.Dispatch>; queryId: string; setQueryId: default_2.Dispatch>; followUpQuery: string; setFollowUpQuery: default_2.Dispatch>; isSearching: boolean; setIsSearching: default_2.Dispatch>; showResults: boolean; setShowResults: default_2.Dispatch>; answers: Answer[]; answerListDispatch: default_2.Dispatch; activeAnswerIndex: number; setActiveAnswerIndex: default_2.Dispatch>; conversationId: string | undefined; setConversationId: (id: string) => void; clearConversationId: () => void; isLoadingConversation: boolean; setIsLoadingConversation: default_2.Dispatch>; loadError: string; setLoadError: default_2.Dispatch>; showMobileCloseWidgetButton: boolean; setShowMobileCloseWidgetButton: default_2.Dispatch>; contentTypeEndpoint?: string; } export declare interface ChatSearchHandle { createNewThread: (firstQuery?: string) => void; showFollowUpThread: (show: boolean) => void; subscribeToStateChanges: (callback: (state: ChatSearchState) => void) => () => void; focusSearchField: () => void; showCloseButton: (showButton: boolean) => void; loadConversation: (conversationId: string) => void; } export declare interface ChatSearchProps { suggestions?: Suggestion[]; collections?: Array; selectedCollectionId?: string; onCollectionChange?: (collectionId: string) => void; selectedRegion?: string; onRegionChange?: (region: string) => void; apiKey?: string; fetchRegionConfig?: (apiKey: string, region: string) => Promise<{ settings?: { collections?: Collection[]; }; } | null>; searchEndpoint: string; answerEndpoint: string; answerStreamEndpoint: string; uploadEndpoint?: string; feedbackEndpoint?: string; feedbackReasonEndpoint?: string; loadConversationEndpoint?: string; followUpQuestionsEndpoint?: string; autocompleteEndpoint?: string; contentTypeEndpoint?: string; disableFollowUpQuestions?: boolean; enableFileAttachment?: boolean; disableFeedback?: boolean; disclaimer?: string; offset?: number; headers?: Record; textConfig?: TextConfig; searchPath?: string; className?: string; onToggleSizeButtonClick?: () => void; trackEvent?: (eventName: string, data?: Record) => void; featureFlags?: FeatureFlags; onCloseWidget?: () => void; isWidgetMode?: boolean; nextBestActions?: NextBestAction[]; bodyActionButtons?: NextBestAction[]; onNextBestActionClick?: ({ action, searchQueryId, query, answer, conversation, }: { action: NextBestAction; searchQueryId: string; query: string; answer: string; conversation?: ConversationContext; }) => void; userData?: Record | null; redirectRules?: RedirectRule[]; secretAttributes?: string; allowedRegions?: string[]; style?: React.CSSProperties; isAgentAssist?: boolean; isSearchWidget?: boolean; hideCitations?: boolean; conversationInlineSlot?: ReactNode; liveHumanAgentChatSlot?: ReactNode; knowledgeSourceGroups?: KnowledgeSourceGroup[]; } export declare const ChatSearchProvider: default_2.FC<{ children: ReactNode; searchPath?: string; contentTypeEndpoint?: string; widgetKey?: string; }>; export declare interface ChatSearchState { showResults: boolean; answers: Answer[]; isLoading: boolean; error?: string; } declare type ClearAll = { type: typeof AnswersActions.CLEAR_ALL; }; declare type ClearUserFeedback = { type: typeof AnswersActions.CLEAR_USER_FEEDBACK; payload: { index?: number; }; }; export declare interface Collection { id: string; name: string; siteEnabled?: boolean; } declare type CompleteAnswer = { type: typeof AnswersActions.COMPLETE_ANSWER; payload: { index?: number; }; }; export declare type ConversationContext = { conversationId?: string; messages: ConversationMessage[]; }; export declare type ConversationMessage = { question: string; answer: string; }; declare type FeatureFlags = { [key: string]: boolean | string | number; }; declare type FeedbackResponse = 'accept' | 'reject'; declare type GetActionInputs = { type: typeof AnswersActions.GET_ACTION_INPUTS; payload: { searchIntentId: string; actionId: string; inputs: ActionInput[]; schema: JSONSchema; initialValues: ActionInputs; onSubmit: (parameters: ActionInputs) => void; index?: number; }; }; declare type InvokeAction = { type: typeof AnswersActions.INVOKE_ACTION; payload: { index?: number; }; }; declare type JSONSchema = JSONSchemaType; export declare interface KnowledgeSourceGroup { id: string; name: string; collectionIds: string[]; } declare type MarkAsUncertain = { type: typeof AnswersActions.MARK_AS_UNCERTAIN; payload: { uncertaintyText: string; index?: number; }; }; declare type MarkdownTextBlock = { id: string; type: 'markdown-text'; text: string; }; declare type NextBestAction = { id?: string; label: string; type: NextBestActionType; icon?: string | UrlString; value: any; }; declare enum NextBestActionType { Link = "link", Email = "email", Phone = "phone", Callback = "callback", Function = "function", ZendeskChat = "zendesk_chat", ZendeskMessenger = "zendesk_messenger", IntercomChat = "intercom_chat", Freshdesk = "freshdesk", ZendeskSunshineChat = "zendesk_sunshine_chat" } declare type NoArticlesFound = { type: typeof AnswersActions.NO_ARTICLES_FOUND; payload: { index?: number; }; }; /** * Defines a URL redirect rule with pattern matching * @example { source: '/knowledge/:id/:path', destination: '/knowledge/test/:path' } */ declare type RedirectRule = { source: string; destination: string; }; declare interface SearchResult { id: string; title: string; url: string; } declare type SetAnswerError = { type: typeof AnswersActions.SET_ANSWER_ERROR; payload: { error: string; index?: number; }; }; declare type SetAnswers = { type: typeof AnswersActions.SET_ANSWERS; payload: { answers: Answer[]; }; }; declare type SetAwaitingKnowledgeGroup = { type: typeof AnswersActions.SET_AWAITING_KNOWLEDGE_GROUP; payload: { index?: number; }; }; declare type SetFollowUpQuestions = { type: typeof AnswersActions.SET_FOLLOW_UP_QUESTIONS; payload: { questions: string[]; index?: number; }; }; declare type SetKnowledgeGroupSelected = { type: typeof AnswersActions.SET_KNOWLEDGE_GROUP_SELECTED; payload: { index?: number; }; }; declare type SetSearchResults = { type: typeof AnswersActions.SET_SEARCH_RESULTS; payload: { searchQueryId: string; results: SearchResult[]; index?: number; state?: Answer['state']; }; }; declare type SetUserFeedback = { type: typeof AnswersActions.SET_USER_FEEDBACK; payload: { feedback: FeedbackResponse; index?: number; }; }; declare interface Suggestion { id: string; question: string; conversationId?: string; messageCount?: number; } declare interface TextConfig { headerText?: string; searchPlaceholder?: string; attachImageText?: string; allDocumentsText?: string; loadingSearchText?: string; loadingAnswerText?: string; errorText?: string; followUpPlaceholder?: string; positiveAnswerText?: string; negativeAnswerText?: string; suggestionsTitle?: string; uncertaintyFallbackText?: Record; } declare type UrlString = string & { __url: never; }; export declare const useChatSearch: () => ChatSearchContextProps; export declare const useIsChatSearchDirty: () => boolean; export { }