react-chatbotify
Version:
A modern React library for creating flexible and extensible chatbots.
30 lines • 1.33 kB
TypeScript
import React, { MutableRefObject, RefObject } from "react";
import { Flow } from "../types/Flow";
/**
* Creates the useBotRefsContext() hook to manage common refs.
*/
type BotRefsContextType = {
botIdRef: React.RefObject<string>;
flowRef: React.MutableRefObject<Flow>;
inputRef: React.RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
prevInputRef: React.MutableRefObject<string>;
timeoutIdRef: React.MutableRefObject<ReturnType<typeof setTimeout> | null>;
streamMessageMap: React.MutableRefObject<Map<string, string>>;
chatBodyRef: React.RefObject<HTMLDivElement | null>;
paramsInputRef: React.MutableRefObject<string>;
keepVoiceOnRef: React.MutableRefObject<boolean>;
audioContextRef: React.MutableRefObject<AudioContext | null>;
audioBufferRef: React.MutableRefObject<AudioBuffer | null>;
gainNodeRef: React.MutableRefObject<AudioNode | null>;
};
declare const useBotRefsContext: () => BotRefsContextType;
/**
* Creates provider to wrap the chatbot container.
*/
declare const BotRefsProvider: ({ children, botIdRef, flowRef, }: {
children: React.ReactNode;
botIdRef: RefObject<string>;
flowRef: MutableRefObject<Flow>;
}) => import("react/jsx-runtime").JSX.Element;
export { useBotRefsContext, BotRefsProvider };
//# sourceMappingURL=BotRefsContext.d.ts.map