@ethora/chat-component 26.7.3 → 26.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{VideoCallOverlay-DDSIVjTW.js → VideoCallOverlay-C4M2I9oV.js} +2 -2
- package/dist/{VideoCallOverlay-DDSIVjTW.js.map → VideoCallOverlay-C4M2I9oV.js.map} +1 -1
- package/dist/components/MessageBubble/QuickReplies.d.ts +18 -0
- package/dist/helpers/quickReplies.d.ts +31 -0
- package/dist/main-DeiuFYsl.js +55812 -0
- package/dist/main-DeiuFYsl.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +13 -12
- package/dist/types/models/config.model.d.ts +19 -0
- package/dist/types/models/message.model.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +7 -3
- package/dist/main-CtoP9N3C.js +0 -74757
- package/dist/main-CtoP9N3C.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { QuickReply } from '../../helpers/quickReplies';
|
|
3
|
+
interface QuickRepliesProps {
|
|
4
|
+
replies: QuickReply[];
|
|
5
|
+
messageId: string;
|
|
6
|
+
accentColor?: string;
|
|
7
|
+
/** Already answered (in this session) - chips render disabled. */
|
|
8
|
+
answered?: boolean;
|
|
9
|
+
onSelect: (reply: QuickReply, questionId: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Buttons offered by a bot message. Tapping one answers the message: the
|
|
13
|
+
* chips lock immediately (so a double tap cannot post two answers) and stay
|
|
14
|
+
* visible, which keeps the transcript readable - you can still see what the
|
|
15
|
+
* options were next to the answer that was picked.
|
|
16
|
+
*/
|
|
17
|
+
declare const QuickReplies: React.FC<QuickRepliesProps>;
|
|
18
|
+
export default QuickReplies;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One bot-offered button, as carried by the `quickReplies` attribute on a
|
|
3
|
+
* message stanza's <data> element. The wire format is the one the existing
|
|
4
|
+
* Ethora bots already emit (see ethora-backend/tools/web3-bots/*: they stamp
|
|
5
|
+
* `quickReplies: JSON.stringify(message.buttons)` with `{name, value}`
|
|
6
|
+
* objects), so nothing on the bot side has to change to light these up.
|
|
7
|
+
*
|
|
8
|
+
* `questionId` is the only addition: quiz-style flows need a stable id for
|
|
9
|
+
* the answer they collect, and it is optional so plain "yes/no" bots keep
|
|
10
|
+
* working. When it is absent we fall back to the button's index.
|
|
11
|
+
*/
|
|
12
|
+
export interface QuickReply {
|
|
13
|
+
/** Label shown on the chip. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Text sent back to the room when the chip is tapped. */
|
|
16
|
+
value: string;
|
|
17
|
+
/** Quiz question this button answers, used to build the answer URL. */
|
|
18
|
+
questionId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Decode the `quickReplies` payload into buttons. Deliberately forgiving:
|
|
22
|
+
* the attribute is written by bots (and, once the LLM-driven flow lands, by
|
|
23
|
+
* a model), so anything unparseable must degrade to "no buttons" rather
|
|
24
|
+
* than break the message. Accepts the already-decoded array too, since
|
|
25
|
+
* getDataFromXml decodes it in place the same way it does `mentions`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const parseQuickReplies: (rawValue: unknown) => QuickReply[];
|
|
28
|
+
export declare const markQuickRepliesAnswered: (messageId: string) => void;
|
|
29
|
+
export declare const hasAnsweredQuickReplies: (messageId: string) => boolean;
|
|
30
|
+
/** Test seam - the set is process-wide. */
|
|
31
|
+
export declare const resetAnsweredQuickReplies: () => void;
|