import * as React$2 from "react"; import React$1 from "react"; //#region ../../packages/utils/src/captcha/captcha-provider.d.ts type CaptchaResponse = { token: string; key: "X-RECAPTCHA-ENTERPRISE-TOKEN" | "X-HCAPTCHA-TOKEN"; }; declare const useCaptcha: () => { executeCaptcha: (action: string, signal?: AbortSignal) => Promise; isChallengeOpen: boolean; }; //#endregion //#region ../../packages/utils/src/captcha/recaptcha.d.ts /** * Recaptcha action types to classify recaptcha assessments. * IMPORTANT: Make sure these match the ones on the widget-proxy */ declare enum CaptchaAction { AskAi = "ask_ai", FeedbackSubmit = "feedback_submit", Search = "search", HandoffSubmit = "handoff_submit", FileUpload = "file_upload", Retrieval = "retrieval" } //#endregion //#region ../../packages/utils/src/hooks/use-recaptcha.d.ts declare global { interface Window { grecaptcha: { enterprise: { execute: (id: string, action: { action: string; }) => Promise; ready: (callback: () => void) => Promise; }; }; hcaptcha?: { render?: (container: string, params: object) => Promise; execute?: (id: string) => Promise; }; } } //#endregion //#region ../../packages/utils/src/helpers/streaming-types.d.ts interface StreamSource { title: string; subtitle: string; source_url: string; source_type: string; } interface BaseChunk { type: T; content: C; stream_end: End; } type RelevantSourcesChunk = BaseChunk<"relevant_sources", { relevant_sources: StreamSource[]; }, false>; type PartialAnswerChunk = BaseChunk<"partial_answer", { text: string; }, false>; type AgentActivityStatus = "started" | "completed" | "error"; interface AgentActivityUpdatePayload { id: string; name: string; status: AgentActivityStatus; batch_id?: string; num_results?: number; error?: string; summary?: string; } type AgentActivityUpdateChunk = BaseChunk<"agent_activity_update", AgentActivityUpdatePayload, false>; type MetadataChunk = BaseChunk<"metadata", { is_uncertain: boolean; }, false>; type IdentifiersChunk = BaseChunk<"identifiers", { thread_id: string; question_answer_id: string; }, true>; type StreamStartChunk = BaseChunk<"stream_start", { thread_id: string; }, false>; type ErrorChunk = BaseChunk<"error", { reason: string; }, true>; type StreamChunk = RelevantSourcesChunk | PartialAnswerChunk | MetadataChunk | IdentifiersChunk | StreamStartChunk | AgentActivityUpdateChunk | ErrorChunk; interface ResponseChunk { chunk: StreamChunk; } //#endregion //#region ../../packages/utils/src/helpers/stream-processor.d.ts interface StreamHandlers { onIdentifiers: (threadId: string, qaPairId: string) => void; onStreamStart?: (threadId: string) => void; onFirstToken: () => void; onRelevantSources: (relevant_sources: StreamSource[]) => void; onPartialAnswer: (partial_answer: string) => void; onMetadata: (metadata: { is_uncertain: boolean; }) => void; onAgentActivityUpdate?: (payload: AgentActivityUpdatePayload) => void; onError: (errorMessage: string) => void; } declare const processStream: (response: Response, { onIdentifiers, onStreamStart, onFirstToken, onRelevantSources, onPartialAnswer, onMetadata, onAgentActivityUpdate, onError }: StreamHandlers) => Promise; //#endregion //#region src/types/files.d.ts /** * A file that has been uploaded to the backend and can be attached to a * question. */ interface FileUpload { /** Server-issued unique identifier, referenced in the chat request. */ id: string; /** Original file name. */ file_name: string; /** MIME type, or null if the backend could not determine it. */ file_type: string | null; /** Human-readable file type (e.g. "PDF", "Image"), or null. */ file_type_display_name: string | null; /** Size in bytes. */ file_size: number; /** * Signed URL to fetch the file's content. Short-lived (minutes) — only * usable shortly after upload. */ download_url: string; } /** * Reasons a file can fail server-side validation after upload. */ type FileValidationErrorType = "text_file_too_large" | "text_file_encoding_error" | "unsupported_file_type"; //#endregion //#region src/types/qa.d.ts /** * Per-QA timing of the agent activity (the retrieval steps streamed before * the answer, see `toolCalls`). Tracks elapsed time so historical QAs can * display "Thought for Xs". */ interface QAThinking { /** Epoch ms at submit. */ startedAt: number; /** * Epoch ms when the activity ended: the first answer token arrived, or the * stream ended, failed or was stopped first. Null while still running. */ completedAt: number | null; } /** Live state for a single retrieval sub-agent invocation. */ interface AgentActivityDisplay { /** Unique id issued by the backend; stable across status transitions. */ id: string; /** Opaque internal sub-agent name (e.g. `multistep_search`). */ name: string; status: AgentActivityStatus; /** * Optional batch id; all calls sharing one were dispatched in parallel * and are aggregated into a single timeline row. */ batchId?: string; /** Number of results returned (post-dedup). */ numResults?: number; error?: string; /** LLM-generated 2-3 word summary of retrieved documents. */ summary?: string; /** Local timestamp at first sighting; drives chronological order. */ startedAt: number; } interface QABase { /** The user's question */ question: string; /** The AI-generated answer */ answer: string; /** Reference sources that support the answer */ sources: StreamSource[]; /** Whether the answer generation was manually stopped */ isGenerationAborted: boolean; /** User feedback reaction (thumbs up/down) or null if not provided */ reaction: Reaction | null; /** Retrieval tool call events streamed during answer generation. */ toolCalls: AgentActivityDisplay[]; /** Files the user attached to this question. Empty when none. */ files: FileUpload[]; /** Timing of the agent activity. Set for every QA, in every mode. */ thinking?: QAThinking; } /** Feedback not yet enabled (optimistic state while streaming) */ type QAStreaming = QABase & { /** ID is null during streaming */id: null; /** Feedback submission is disabled during streaming */ isFeedbackSubmissionEnabled?: false; status: "streaming"; }; /** Final server record with feedback flag on */ type QAPendingCompletion = QABase & { /** Unique ID for this question-answer pair */id: string; status: "pending_completion"; isFeedbackSubmissionEnabled: true; metadata: { is_uncertain: boolean; }; }; type QACompleted = Omit & { status: "completed"; }; /** * Represents a question-answer pair. */ type QA = QAStreaming | QAPendingCompletion | QACompleted; interface QuestionAnswer { id: string; question: string; answer: string; relevant_sources: StreamSource[]; total_upvotes: number; total_downvotes: number; } //#endregion //#region src/types/feedback.d.ts type Reaction = "upvote" | "downvote"; /** * Feedback comment with specific categories and free-text feedback */ interface FeedbackComment { incorrect?: boolean; irrelevant?: boolean; unaddressed?: boolean; issue?: string; } interface FeedbackResponse { total_upvotes: number; total_downvotes: number; } /** * Input for an exit-feedback (CSAT-on-close) upsert, keyed by the QA. The * impression (shown) creates the row; the vote and optional comment update it. */ interface ExitFeedbackInput { /** ID of the QA the user was on when the feedback was collected. */ questionAnswer: string; /** Binary reaction; omitted for the initial impression (shown, not yet answered). */ reaction?: Reaction; /** Optional free-text note. */ comment?: string; } //#endregion //#region src/types/user.d.ts /** * User identification data that helps with personalization * and tracking conversation history */ interface UserIdentifiers { email?: string; unique_client_id?: string; fingerprint_id?: string; kapa_web_id?: string; } /** Additional user metadata for analytics/tracking */ interface UserMetadata { company_name?: string; first_name?: string; last_name?: string; } //#endregion //#region src/lib/conversation.d.ts /** * Represents a conversation history with question-answer pairs. * @extends Array */ declare class Conversation extends Array { constructor(...items: QA[]); getById(id: string): QA | undefined; getLatest(): QA | undefined; /** * Retrieves the latest completed QA item from the collection. * * A completed QA item is identified by the presence of an `id` property. * If the collection is empty or no completed items are found, the method returns `undefined`. * * @returns {QA | undefined} The latest completed QA item, or `undefined` if none exist. */ getLatestCompleted(): QA | undefined; formatForCallbacks(): EventCallbackQA[]; setById(id: string, partialItem: Partial): void; setLatest(partialItem: Partial): void; /** * Mutate the latest QA's `thinking` snapshot. No-op if the latest QA * wasn't a deep-thinking request (no `thinking` field). */ updateThinking(mutate: (current: QAThinking) => QAThinking): boolean; } //#endregion //#region src/types/sdk-context.d.ts /** * Interface for the useChat hook */ interface UseChat { /** * True when the SDK is connecting to the backend. * Use this to show a loading indicator before streaming begins. */ isPreparingAnswer: boolean; /** * True when an answer is being streamed from the AI. * Use this to show a streaming indicator during generation. */ isGeneratingAnswer: boolean; /** * Error message or null if no error has occurred. * Check this to display error states to the user. */ error: string | null; /** Conversation history containing all Q&A pairs. */ conversation: Conversation; /** * Current conversation thread ID from the backend. * Null for new conversations that haven't received a response yet. */ threadId: string | null; /** * Submit a new question to the AI, optionally with attached files. * Returns false when a previous question is still being answered and the * new one was ignored. */ submitQuery: (q: string, files?: FileUpload[]) => boolean; /** Clear the conversation history */ resetConversation: () => void; /** * Restore a previous conversation so it renders and can be continued. * Seeds both the thread ID and the completed Q&A pairs; the next * `submitQuery` continues the same backend thread. Aborts any in-flight * generation first. */ restoreConversation: (threadId: string, conversation: QACompleted[]) => void; /** Abort the current generation */ stopGeneration: () => void; /** Send feedback for a specific Q&A pair * * @param questionAnswerId - The ID of the Q&A pair to provide feedback on * @param reaction - The user's reaction (upvote/downvote) * @param comment - Optional feedback comment */ addFeedback: (questionAnswerId: string, reaction: Reaction, comment?: FeedbackComment) => void; /** * Upsert an exit-feedback (CSAT-on-close) record, keyed by the QA: an * impression when shown, then the vote and optional comment. */ upsertExitFeedback: (input: ExitFeedbackInput) => Promise; /** Email a handoff (transcript + user note) to the recipient address. * * @param args Recipient address, user email and optional note. * @throws If captcha verification fails, no thread exists yet, or the * backend rejects the request. */ submitHandoff: (args: { recipientEmail: string; userEmail: string; note?: string; }) => Promise; } type ThreadId = string | null; type EventCallbackQA = { questionAnswerId: string; question: string; answer: string; }; interface ConversationCtx { /** Full conversation history, after the event occurred */ conversation: EventCallbackQA[]; /** Conversation thread ID (null for initial queries) */ threadId: ThreadId; } /** ------------- Payload shapes ------------- */ interface QuerySubmitPayload extends ConversationCtx { question: string; } interface AnswerGenerationStopPayload extends ConversationCtx { question: string; } type ConversationResetPayload = ConversationCtx; interface AnswerGenerationCompletedPayload extends ConversationCtx { questionAnswerId: string; question: string; answer: string; } interface FeedbackSubmitPayload extends ConversationCtx { feedbackId: string; reaction: Reaction; comment?: FeedbackComment; questionAnswerId: string; question: string; answer: string; } interface AskAICallbacks { /** * Called when a user submits a question to the AI * @param p Information about the submitted query */ onQuerySubmit?: (p: QuerySubmitPayload) => void; /** * Called when an answer has finished generating completely * @param p Information about the completed answer */ onAnswerGenerationCompleted?: (p: AnswerGenerationCompletedPayload) => void; /** * Called when answer generation is manually stopped by the user * @param p Information about the stopped generation */ onAnswerGenerationStop?: (p: AnswerGenerationStopPayload) => void; /** * Called when the conversation history is reset * @param p Information about the reset conversation */ onConversationReset?: (p: ConversationResetPayload) => void; /** * Called when a user submits feedback on an answer * @param p Information about the submitted feedback */ onFeedbackSubmit?: (p: FeedbackSubmitPayload) => void; } interface Callbacks { /** * Callbacks for Ask AI mode */ askAI?: AskAICallbacks; } type UserTrackingMode = "fingerprint" | "cookie" | "none"; //#endregion //#region src/types/auth.d.ts /** reCAPTCHA/hCaptcha verification token for bot protection */ interface CaptchaToken { /** Header name, e.g. `X-CAPTCHA` */ key: string; /** Token (opaque) */ token: string; } //#endregion //#region src/hooks/use-user-identifiers.d.ts interface UseUserIdentifiersConfig { mode: UserTrackingMode; } interface UseUserIdentifiersReturn { buildIdentifiers: () => Promise<{ identifiers: UserIdentifiers; metadata: UserMetadata; }>; } declare const useUserIdentifiers: (config: UseUserIdentifiersConfig) => UseUserIdentifiersReturn; //#endregion //#region src/types/chat.d.ts type QueryMode = "default" | "deep_thinking"; //#endregion //#region src/lib/api.d.ts interface SubmitQueryArgs { /** User's question */ query: string; mode?: QueryMode; /** * Optional thread ID for continuing a conversation. * If null, a new conversation thread will be created. */ threadId: string | null; /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; /** Optional customization ID to apply prompt customizations */ customizationId?: string; /** Source groups to include in the answer */ sourceGroupIDsInclude?: string[]; /** * User identification data that helps with personalization * and tracking conversation history */ userIdentifiers: UserIdentifiers; /** Additional user metadata for analytics/tracking */ userMetadata: UserMetadata; /** The URL where the query was initiated */ originUrl: string; /** * IDs of files (previously uploaded via {@link KapaApiService.initiateFileUpload} * and validated) to attach to this question. */ files?: string[]; } /** * Parameters for initiating a file upload (step 1 of the upload flow). */ interface InitiateFileUploadArgs { /** Original file name. */ fileName: string; /** Size in bytes. */ fileSize: number; /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; /** Lets the proxy attribute the request to a user for rate limiting */ userIdentifiers: UserIdentifiers; } /** * Response from initiating a file upload: the file record plus a signed URL to * PUT the raw bytes to. */ interface InitiateFileUploadResponse extends FileUpload { /** Signed URL to upload the file bytes to (PUT). Short-lived. */ upload_url: string; } /** * Parameters for validating an uploaded file (step 3 of the upload flow). */ interface ValidateFileArgs { /** ID returned by {@link KapaApiService.initiateFileUpload}. */ fileId: string; /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; /** Lets the proxy attribute the request to a user for rate limiting */ userIdentifiers: UserIdentifiers; } /** * Result of server-side file validation. */ interface ValidateFileResponse { is_valid: boolean; error_type: FileValidationErrorType | null; } /** * Parameters for submitting a widget-initiated handoff. */ interface SubmitHandoffArgs { /** ID of the thread to attach to the email */ threadId: string; /** Customer's support address (from data-handoff-email) */ recipientEmail: string; /** Email address provided by the end user in the form */ userEmail: string; /** Optional note from the end user */ note?: string; /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; } /** * Parameters for submitting user feedback on answers. */ interface SubmitFeedbackArgs { /** Unique identifier for the question-answer pair */ questionAnswerId: string; /** User's reaction to an answer */ reaction: Reaction; /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; /** Optional user-provided comment/reason */ comment?: FeedbackComment; } /** * Parameters for upserting an exit-feedback (CSAT-on-close) record. */ interface UpsertExitFeedbackArgs extends ExitFeedbackInput { /** reCAPTCHA/hCaptcha verification token for bot protection */ captcha: CaptchaToken; /** Your Kapa integration ID */ integrationId: string; /** Lets the proxy attribute the request to a user for rate limiting */ userIdentifiers: UserIdentifiers; } interface ChatStreamCallbacks { /** * Called when the first response byte is received. * Useful for updating UI to show that streaming has begun. */ onFirstToken?: () => void; /** * Called repeatedly with chunks of the answer as they arrive. * @param partial - The new text chunk to append to the answer */ onPartialAnswer?: (partial: string) => void; /** * Called with the metadata of the answer at the end of the stream. * @param metadata - The metadata of the answer */ onMetadata?: (metadata: { is_uncertain: boolean; }) => void; /** * Called on each sub-agent lifecycle event (started / completed / error) * during deep-thinking retrieval. Drives the live tool-call timeline UI. */ onAgentActivityUpdate?: (payload: AgentActivityUpdatePayload) => void; /** * Called with the list of relevant citation sources. * @param sources - Array of source documents cited in the answer */ onRelevantSources?: (sources: StreamSource[]) => void; /** * Called when an error occurs during streaming. * @param msg - The error message */ onError?: (msg: string) => void; /** * Called with thread and QA pair identifiers once they're available. * @param threadId - The conversation thread ID * @param qaPairId - The unique ID for this question-answer pair */ onIdentifiers?: (threadId: string, qaPairId: string) => void; /** * Called with the thread ID as soon as it's available (before the stream * completes). * @param threadId - The conversation thread ID */ onStreamStart?: (threadId: string) => void; } /** * Interface for API service that handles communication with the Kapa AI backend. */ interface KapaApiService { /** Post a question to the backend and stream back the answer */ submitQuery(args: SubmitQueryArgs, cbs: ChatStreamCallbacks): Promise; /** * Initiate a file upload. Returns the file record and a signed URL the * client PUTs the raw bytes to. Throws on failure (e.g. file too large). */ initiateFileUpload(args: InitiateFileUploadArgs): Promise; /** Validate a previously uploaded file (after the bytes have been PUT). */ validateFile(args: ValidateFileArgs): Promise; /** Send feedback (👍 / 👎) for a specific QA pair */ addFeedback(args: SubmitFeedbackArgs): Promise; /** * Upsert an exit-feedback (CSAT-on-close) record, keyed by the QA. Called on * show (impression, with reaction/comment omitted) and again on vote/comment. */ upsertExitFeedback(args: UpsertExitFeedbackArgs): Promise; /** Email a handoff (transcript + user note) to the customer's support address */ submitHandoff(args: SubmitHandoffArgs): Promise; /** Abort the current network request, if any */ abortCurrent(): void; } /** * Default implementation of the KapaApiService interface. * Handles API communication with the Kapa backend, including streaming * responses and feedback submission. * * @implements {KapaApiService} */ declare class DefaultKapaApiService implements KapaApiService { private abortController; private proxyURL; private processStreamFn; constructor(processStreamFn: typeof processStream, proxyURL?: string); /** * Cancels any ongoing API request. * Creates a new AbortController for future requests. */ abortCurrent(): void; /** * @inheritdoc */ submitQuery({ query, threadId, captcha, integrationId, customizationId, sourceGroupIDsInclude, userIdentifiers, userMetadata, originUrl, files, mode }: SubmitQueryArgs, callbacks: ChatStreamCallbacks): Promise; /** * @inheritdoc */ initiateFileUpload({ fileName, fileSize, captcha, integrationId, userIdentifiers }: InitiateFileUploadArgs): Promise; /** * @inheritdoc */ validateFile({ fileId, captcha, integrationId, userIdentifiers }: ValidateFileArgs): Promise; /** * @inheritdoc */ addFeedback({ questionAnswerId: qaPairId, reaction, captcha, integrationId, comment }: SubmitFeedbackArgs): Promise; /** * @inheritdoc */ upsertExitFeedback({ questionAnswer, reaction, comment, captcha, integrationId, userIdentifiers }: UpsertExitFeedbackArgs): Promise; /** * @inheritdoc */ submitHandoff({ threadId, recipientEmail, userEmail, note, captcha, integrationId }: SubmitHandoffArgs): Promise; } //#endregion //#region src/lib/conversation-history.d.ts /** A single stored conversation: its backend thread id and full transcript. */ interface StoredConversationThread { threadId: string; /** First question, a file name, or "" when neither is available. */ title: string; /** Epoch ms of the first stored answer; never changes afterwards. */ createdAt: number; /** * Epoch ms of the latest answer. Only a new answer bumps it: viewing a * conversation or voting on an existing answer keeps the timestamp, so * recency ordering reflects actual conversation activity. */ updatedAt: number; qas: QACompleted[]; } /** Value returned by {@link useConversationHistory}. */ interface ConversationHistory { /** Whether persistence is enabled on the provider. */ enabled: boolean; /** Stored conversations, most-recent first. Updates as the user chats. */ threads: StoredConversationThread[]; /** * Restore a stored thread so its transcript renders and follow-ups resume * it. No-op when persistence is disabled or the thread is not stored. */ restoreThread: (threadId: string) => void; /** * Delete the stored conversations. The open conversation stays on screen * but is no longer saved. */ clear: () => void; } declare const clearConversationHistory: ({ integrationId, storageKey }: { integrationId: string; storageKey?: string; }) => void; //#endregion //#region src/lib/deep-thinking.d.ts declare const useDeepThinking: () => { active: boolean; seconds: number; toggle: () => void; activate: () => void; deactivate: () => void; }; //#endregion //#region src/lib/file-upload.d.ts declare const MAX_UPLOADED_FILES = 10; interface BaseFileItem { tempId: string; file: File; } interface QueuedFileItem extends BaseFileItem { status: "queued"; } interface UploadingFileItem extends BaseFileItem { status: "uploading"; } interface UploadedFileItem extends BaseFileItem { status: "uploaded"; file_upload: FileUpload; } interface ValidatingFileItem extends BaseFileItem { status: "validating"; file_upload: FileUpload; } interface ValidatedFileItem extends BaseFileItem { status: "validated"; file_upload: FileUpload; } interface UnsupportedFileItem extends BaseFileItem { status: "unsupported"; file_upload: Omit; } interface ErrorFileItem extends BaseFileItem { status: "error"; } type CompletedFileItem = ValidatedFileItem | UnsupportedFileItem | ErrorFileItem; type FileItem = QueuedFileItem | UploadingFileItem | UploadedFileItem | ValidatingFileItem | CompletedFileItem; declare function isCompleted(file: FileItem): file is CompletedFileItem; declare function hasUpload(file: FileItem): file is UploadedFileItem | ValidatingFileItem | ValidatedFileItem | UnsupportedFileItem; interface FileUploadContextType { files: FileItem[]; addFiles: (files: File[]) => void; removeFile: (tempId: string) => void; clearFiles: () => void; isAnyUploading: boolean; validatedFiles: ValidatedFileItem[]; maxFiles: number; } declare const useFileUpload: () => FileUploadContextType; //#endregion //#region src/provider.d.ts /** * Options for locally persisting conversation history. * * Transcripts (questions, answers, sources, file metadata) are stored * unencrypted in localStorage, readable by any script on the page and shared * across tabs on the same origin (without live cross-tab sync). */ interface ConversationHistoryOptions { /** Persist completed conversations to localStorage. @default true */ enabled?: boolean; /** * localStorage key to store under. When it changes after mount, the * conversation open at that moment is no longer saved under either key. * @default `kapa_conversation_history_${integrationId}` */ storageKey?: string; /** Cap on stored conversations; the oldest are evicted. @default 50 */ maxThreads?: number; } /** * Context provider for the kapa.ai SDK * * @example * ```jsx * * * * ``` * * @public */ declare const KapaSDKProvider: React$2.FC<{ children: React$2.ReactNode; /** * Your Kapa integration identifier * @example "6d04c434-4090-4ebf-aeb3-8e90645a504d" * @required */ integrationId: string; /** * Optional customization ID to apply prompt customizations * @example "a1b2c3d4-5678-90ab-cdef-1234567890ab" */ customizationId?: string; /** * Source group IDs to include in the answer * @example ["source-group-1", "source-group-2"] */ sourceGroupIDsInclude?: string[]; /** * Text to append to the answer when it is uncertain * @example "Please reach out to our [support team](https://kapa.ai/support) for further assistance." */ uncertainAnswerCallout?: string; /** * Callback functions for tracking user interactions with the SDK * @example { onAskQuestion: (q) => console.log('question_asked', { question: q }) } * @required */ callbacks?: Callbacks; /** * Enable browser fingerprinting or cookie keeping track of a unique * identifier (kapa_web_id). * When enabled, the SDK generates anonymized IDs for end users * @default "cookie" */ userTrackingMode?: UserTrackingMode; /** * Choose which captcha provider to use for bot protection * @default "recaptcha" */ botProtectionMechanism?: "recaptcha" | "hcaptcha"; /** * Whether the user has provided consent for captcha * Set to false if you need to obtain consent before enabling captcha * @default true */ hasConsentForCaptcha?: boolean; /** * Locally persist completed conversations so they can be listed and resumed * via {@link useConversationHistory}. Enabled unless `enabled` is false. */ conversationHistory?: ConversationHistoryOptions; /** * Optional API service implementation for testing or custom networking * You can provide a custom implementation that follows the KapaApiService interface */ apiService?: KapaApiService; }>; //#endregion //#region src/use-ask-ai.d.ts /** * Custom hook that provides access to Kapa chat functionality * * It gives you access to the conversation state and actions to interact with the chatbot. * * @throws {Error} Will throw an error if used outside of a KapaProvider * * @returns {UseChat} An object containing state values and action functions * * @example * ```jsx * function ChatComponent() { * const { submitQuery, conversation } = useChat(); * * return ( *
* {conversation.map((qa) => ( *
* {qa.question}: {qa.answer} *
* ))} * setQuery(e.target.value)} * value={query} * /> * *
* ); * } * ``` * * @public */ declare function useChat(): UseChat; //#endregion //#region src/use-conversation-history.d.ts /** * Access locally persisted conversation history. * * Enable persistence with the `conversationHistory` prop on `KapaProvider`. * Returns the stored conversations (most-recent first, live as the user chats) * and `restoreThread`, which reopens a thread so its transcript renders and * follow-up questions resume it. * * @throws {Error} Will throw an error if used outside of a KapaProvider * * @returns {ConversationHistory} The stored conversations and restore action * * @example * ```jsx * const { threads, restoreThread } = useConversationHistory(); * return threads.map((t) => ( * * )); * ``` * * @public */ declare function useConversationHistory(): ConversationHistory; //#endregion export { AgentActivityDisplay, AnswerGenerationCompletedPayload, AnswerGenerationStopPayload, AskAICallbacks, Callbacks, CaptchaAction, CaptchaToken, ConversationCtx, type ConversationHistory, type ConversationHistoryOptions, ConversationResetPayload, DefaultKapaApiService, type ErrorChunk, EventCallbackQA, ExitFeedbackInput, FeedbackComment, FeedbackResponse, FeedbackSubmitPayload, type FileItem, FileUpload, FileValidationErrorType, type IdentifiersChunk, KapaSDKProvider as KapaProvider, MAX_UPLOADED_FILES, type MetadataChunk, type PartialAnswerChunk, QA, QACompleted, QAPendingCompletion, QAStreaming, QAThinking, QuerySubmitPayload, QuestionAnswer, Reaction, type RelevantSourcesChunk, type ResponseChunk, type StreamSource as Source, type StreamSource, type StoredConversationThread, type StreamChunk, ThreadId, UseChat, UserIdentifiers, UserMetadata, UserTrackingMode, type ValidatedFileItem, clearConversationHistory, hasUpload as fileItemHasUpload, isCompleted as isFileUploadCompleted, processStream, useCaptcha, useChat, useConversationHistory, useDeepThinking, useFileUpload, useUserIdentifiers }; //# sourceMappingURL=index.d.mts.map