Skip to content
API reference

blocks/faq-chat

Import
import * as api from "@fungi.computer/caps/blocks/faq-chat";
Kind Export Description
type alias FaqChatEntry One reviewed question and its fixed answer.
type alias FaqChatFallback The reply for a typed question that matches no entry.
type alias FaqChatProps Props accepted by FaqChat.
constant FaqChat A chat-shaped FAQ. Visitors pick or type a question and get the caller’s reviewed answer with its next steps. Message rows follow Parakeet: the visitor’s turn sits on the surface with a primary rule, the answer is plain.
function matchFaqEntry() Routes a typed question to the entry whose keywords it mentions most. Returns undefined when nothing matches, so the caller can answer honestly.

FaqChatEntrytype alias

Section titled “FaqChatEntry”
Signature
type FaqChatEntry = object;

One reviewed question and its fixed answer.

Signature
id: string;

Stable identity for the entry.

Signature
question: string;

The question as a visitor would ask it. Also shown as a suggestion.

Signature
answer: ReactNode;

The reviewed answer. The chat never generates text of its own.

Signature
optional keywords?: readonly string[];

Lowercase words or phrases that route a typed question here.

Signature
optional actions?: ReactNode;

Caller-owned next steps shown under the answer, such as links.


FaqChatFallbacktype alias

Section titled “FaqChatFallback”
Signature
type FaqChatFallback = object;

The reply for a typed question that matches no entry.

Signature
answer: ReactNode;
Signature
optional actions?: ReactNode;

FaqChatPropstype alias

Section titled “FaqChatProps”
Signature
type FaqChatProps = Omit<HTMLAttributes<HTMLElement>, "title"> & object;

Props accepted by FaqChat.

Name Type Description
entries readonly FaqChatEntry[] -
greeting ReactNode The first agent message, shown before any question.
fallback FaqChatFallback -
title ReactNode Visible heading and accessible name of the chat.
note? ReactNode A short honest note about where answers come from.
avatar? ReactNode Optional mark shown beside the title, such as a logo.
inputLabel? string Accessible label of the typed-question field.
placeholder? string -
submitLabel? string -

FaqChatconstant

Section titled “FaqChat”
Signature
const FaqChat: ForwardRefExoticComponent<
Omit<HTMLAttributes<HTMLElement>, "title"> &
object &
RefAttributes<HTMLElement>
>;

A chat-shaped FAQ. Visitors pick or type a question and get the caller’s reviewed answer with its next steps. Message rows follow Parakeet: the visitor’s turn sits on the surface with a primary rule, the answer is plain.

matchFaqEntry()function

Section titled “matchFaqEntry()”
Signature
function matchFaqEntry(entries, text): FaqChatEntry | undefined;

Routes a typed question to the entry whose keywords it mentions most. Returns undefined when nothing matches, so the caller can answer honestly.

Parameter Type
entries readonly FaqChatEntry[]
text string

FaqChatEntry | undefined