@docshound/chat-react
Version:
React component library for integrating the DocsHound chat widget into React and Next.js applications.
117 lines (113 loc) • 3.68 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
type DocsHoundChatProps = {
/**
* Domain where the guide is published. Eg: https://docs.docshound.com
*
* This field is not reactive, so if you change it, you need to reload the page.
*
* Required field;
*/
src: string;
/**
* The name of the agent responding in the chat.
*
* Optional field. Defaults to value set in the DocsHound.
*/
agentName?: string;
/**
* The URL for the avatar image of the agent.
*
* Optional field. Defaults to value set in the DocsHound.
*/
agentAvatarUrl?: string;
/**
* A unique identifier for the user interacting with the chat.
* This should be unique identifier coming from your system.
* Used to identify the user and their support tickets.
*
* Optional field. Defaults to undefined.
*/
userId?: string;
/**
* The email address of the user interacting with the chat.
* Will be pre-filled for the user when they decide to submit a support ticket.
*
* Optional field. Defaults to undefined.
*/
userEmail?: string;
/**
* The display name of the user interacting with the chat.
*
* Optional field. Defaults to 'You'.
*/
userName?: string;
/**
* The platform where the chat is being used. Could be either 'site' (marketing site), 'app' (application), or 'docs' (documentation site / platform).
*
* Optional field, defaults to 'app'.
*/
platform?: "site" | "app" | "docs";
/**
* The URL for the avatar image of the user interacting with the chat.
*
* Optional field. Defaults to generic user avatar.
*/
userAvatarUrl?: string;
/**
* The initial agent message that will be prepopulated when user opens the chatbot widget.
*
* Optional field. Default to value set in DocsHound.
*/
firstMessage?: string;
/**
* Defines the theme of the chat interface, either 'light' or 'dark'.
*
* Optional field. Defaults to value set in DocsHound.
*/
theme?: "light" | "dark";
/**
* Defines the position of the chat widget on the screen. Can be either 'center' or 'right'.
*
* Optional field. Defaults to 'right'
*/
position?: "center" | "right";
/**
* Sets the accent color of the chat interface (e.g., for buttons or highlights).
*
* Optional field. Defaults to value set in DocsHound.
*/
accentColor?: string;
/**
* The label for the trigger button that starts the chat.
*
* Optional field. Defaults to value set in DocsHound.
*/
triggerLabel?: string;
/**
* Authentication token for jwt / password / basic protected guides
*
* Optional field.
*/
token?: string;
};
declare const DocsHoundChat: ({ src, agentName, agentAvatarUrl, accentColor, platform, position, theme, triggerLabel, userAvatarUrl, userId, userEmail, userName, firstMessage, token, }: DocsHoundChatProps) => react_jsx_runtime.JSX.Element;
type UseDocsHoundChat = {
/**
* Method to clear thread and send a query on behalf of the user
*
* @param question - user query
*/
sendQuestion: (question: string) => void;
/**
* Method to show or hide the chat component
*
* @param show - Whether to show or hide the chat component
*/
show: (show: boolean) => void;
/**
* Method to clear history of the chat component
*/
clear: () => void;
};
declare function useDocsHoundChat(): UseDocsHoundChat;
export { DocsHoundChat, type DocsHoundChatProps, useDocsHoundChat };