blocks/faq-chat
Import
Section titled “Import”import * as api from "@fungi.computer/caps/blocks/faq-chat";Exports
Section titled “Exports”| 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”type FaqChatEntry = object;One reviewed question and its fixed answer.
Properties
Section titled “Properties”id: string;Stable identity for the entry.
question
Section titled “question”question: string;The question as a visitor would ask it. Also shown as a suggestion.
answer
Section titled “answer”answer: ReactNode;The reviewed answer. The chat never generates text of its own.
keywords?
Section titled “keywords?”optional keywords?: readonly string[];Lowercase words or phrases that route a typed question here.
actions?
Section titled “actions?”optional actions?: ReactNode;Caller-owned next steps shown under the answer, such as links.
FaqChatFallbacktype alias
Section titled “FaqChatFallback”type FaqChatFallback = object;The reply for a typed question that matches no entry.
Properties
Section titled “Properties”answer
Section titled “answer”answer: ReactNode;actions?
Section titled “actions?”optional actions?: ReactNode;FaqChatPropstype alias
Section titled “FaqChatProps”type FaqChatProps = Omit<HTMLAttributes<HTMLElement>, "title"> & object;Props accepted by FaqChat.
Type Declaration
Section titled “Type Declaration”| 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”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()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
entries |
readonly FaqChatEntry[] |
text |
string |
Returns
Section titled “Returns”FaqChatEntry | undefined