import { type AlgoliaDocSearchHit, type FileSectionReference, type PromptFeedback, type SearchResult, type SubmitChatOptions, type SubmitFeedbackOptions, type SubmitSearchQueryOptions } from '@xrpl/ai-core'; import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, PropsWithChildren } from 'react'; import type { ChatViewMessage } from './index.js'; interface AsProp { as?: C; } type PropsToOmit = keyof (AsProp & P); export type PolymorphicComponentProp = PropsWithChildren> & Omit, PropsToOmit>; export type PolymorphicComponentPropWithRef = PolymorphicComponentProp & { ref?: PolymorphicRef; }; export type PolymorphicRef = ComponentPropsWithRef['ref']; export interface SectionHeading { value?: string | undefined; id?: string | undefined; slug?: string | undefined; } export interface SearchResultComponentProps { href?: string; heading?: string; title?: string; subtitle?: string; } export interface MarkpromptOptions { /** * Display format. * @default "dialog" **/ display?: 'plain' | 'dialog'; /** * Enable and configure search functionality. * @default "search" * */ defaultView?: 'search' | 'chat' | 'prompt'; close?: { /** * `aria-label` for the close modal button * @default "Close XRPL AI" **/ label?: string; /** * Show the close button * @default true **/ visible?: boolean; }; description?: { /** * Visually hide the description * @default true **/ hide?: boolean; /** * Description text **/ text?: string; }; feedback?: SubmitFeedbackOptions & { /** * Enable feedback functionality, shows a thumbs up/down button after a * prompt was submitted. * @default false * */ enabled?: boolean; /** * Heading above the form * @default "Was this response helpful?" **/ heading?: string; /** * Called when feedback is submitted * @default undefined */ onFeedbackSubmit?: (feedback: PromptFeedback, messages: ChatViewMessage[], promptId?: string) => void; /** * Options for additional feedback after the thumbs up / thumbs down button */ extended: { /** * Enable extended feedback functionality, shows a list of choices after a thumbs up/down button was clicked. * @default false */ enabled?: boolean; /** * Choices for the extended feedback form (e.g. "I found what I was looking for") - only shown when `extended.enabled` is true. * @default ['Response was accurate', 'Solved my problem', 'Easy to understand', 'Something else'>] */ choices?: string[]; /** * Label for the extended feedback form * @default "What did you like about it?"" */ extendedLabel?: string; /** * Placeholder for the extended feedback form * @default "Your feedback..." */ additionalPlaceholder?: string; /** * Label for the extended feedback button * @default "Submit Feedback" */ extendedButtonText?: string; /** * Loading text for the extended feedback button * @default "Submitting..." */ extendedButtonLoadingText?: string; }; }; /** * Enable and configure chat functionality. Allows users to have a conversation with an assistant. * Enabling chat functionality will disable prompt functionality. */ chat?: SubmitChatOptions & { /** * Show a chat-like prompt input allowing for conversation-style interaction * rather than single question prompts. * @default false **/ enabled?: boolean; /** * Label for the chat input * @default "Ask AI" **/ label?: string; /** * Label for the tab bar * @default "Ask AI" **/ tabLabel?: string; /** * Placeholder for the chat input * @default "Ask AI…" **/ placeholder?: string; /** * Show sender info, like avatar * @default true **/ showSender?: boolean; /** * Enable chat history features * - enable saving chat history to local storage * - show chat history UI * - resume chat conversations * @default true */ history?: boolean; }; /** * Enable and configure prompt functionality. Allows users to ask a single question to an assistant */ prompt?: SubmitChatOptions & { /** * Label for the prompt input * @default "Ask AI" **/ label?: string; /** * Label for the tab bar * @default "Ask AI" **/ tabLabel?: string; /** * Placeholder for the prompt input * @default "Ask AI…" **/ placeholder?: string; }; references?: { /** * Display mode for the references. References can either be * displayed after the response or not displayed at all. * @default 'end' * */ display?: 'none' | 'end'; /** Callback to transform a reference into an href */ getHref?: (reference: FileSectionReference) => string | undefined; /** Callback to transform a reference into a label */ getLabel?: (reference: FileSectionReference) => string | undefined; /** * Heading above the references * @default "Answer generated from the following sources:" **/ heading?: string; /** Loading text, default: `Fetching relevant pages…` */ loadingText?: string; /** * Callback to transform a reference id into an href and text * @deprecated Use `getHref` and `getLabel` instead **/ transformReferenceId?: (referenceId: string) => { href: string; text: string; }; }; /** * Enable and configure search functionality */ search?: SubmitSearchQueryOptions & { /** * Enable search * @default false **/ enabled?: boolean; /** Callback to transform a search result into an href */ getHref?: (reference: SearchResult | AlgoliaDocSearchHit) => string | undefined; /** Callback to transform a search result into a heading */ getHeading?: (reference: SearchResult | AlgoliaDocSearchHit, query: string) => string | undefined; /** Callback to transform a search result into a title */ getTitle?: (reference: SearchResult | AlgoliaDocSearchHit, query: string) => string | undefined; /** Callback to transform a search result into a subtitle */ getSubtitle?: (reference: SearchResult | AlgoliaDocSearchHit, query: string) => string | undefined; /** * Label for the search input, not shown but used for `aria-label` * @default "Search docs…" **/ label?: string; /** * Label for the tab bar * @default "Search" **/ tabLabel?: string; /** * Placeholder for the search input * @default "Search docs…" */ placeholder?: string; }; trigger?: { /** * `aria-label` for the open button * @default "Open XRPL AI" **/ label?: string; /** * Placeholder text for non-floating element. * @default "Ask docs" **/ placeholder?: string; /** * Should the trigger button be displayed as a floating button at the bottom right of the page? * Setting this to false will display a trigger button in the element passed * to the `markprompt` function. */ floating?: boolean; /** Do you use a custom element as the dialog trigger? */ customElement?: boolean; }; title?: { /** * Visually hide the title * @default true **/ hide?: boolean; /** * Text for the title * @default "Ask AI" **/ text?: string; }; /** * Show Markprompt branding * @default false **/ showBranding?: boolean; /** * Display debug info * @default false **/ debug?: boolean; support?: { disclaimer?: { enabled?: boolean; content?: React.ElementType | string; }; }; } export {}; //# sourceMappingURL=types.d.ts.map