@webority/chat-react 0.128.0 → 0.134.0
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/chat-react.js +14 -11
- package/dist/types/ChatAgentTyping.d.ts +4 -0
- package/dist/types/ChatAuthorBadge.d.ts +4 -0
- package/dist/types/ChatComposer.d.ts +10 -0
- package/dist/types/ChatConversationActions.d.ts +7 -0
- package/dist/types/ChatEmbed.d.ts +5 -0
- package/dist/types/ChatExplain.d.ts +16 -0
- package/dist/types/ChatFooter.d.ts +8 -0
- package/dist/types/ChatFrame.d.ts +26 -0
- package/dist/types/ChatHistory.d.ts +9 -0
- package/dist/types/ChatLauncher.d.ts +5 -0
- package/dist/types/ChatLiveStatus.d.ts +4 -0
- package/dist/types/ChatMessageActions.d.ts +10 -0
- package/dist/types/ChatNudge.d.ts +10 -0
- package/dist/types/ChatOpenTickets.d.ts +9 -0
- package/dist/types/ChatPage.d.ts +49 -0
- package/dist/types/ChatPanel.d.ts +9 -0
- package/dist/types/ChatPastChats.d.ts +9 -0
- package/dist/types/ChatReadAloudButton.d.ts +8 -0
- package/dist/types/ChatShell.d.ts +32 -0
- package/dist/types/ChatStarters.d.ts +8 -0
- package/dist/types/ChatThread.d.ts +15 -0
- package/dist/types/chatLive.d.ts +5 -0
- package/dist/types/chatPrint.d.ts +6 -0
- package/dist/types/chatShared.d.ts +10 -0
- package/dist/types/dictationText.d.ts +31 -0
- package/dist/types/index.d.ts +20 -14
- package/dist/types/loaders/ChatLoader.d.ts +21 -0
- package/dist/types/loaders/OrbLoader.d.ts +11 -0
- package/dist/types/loaders/PhrasesLoader.d.ts +14 -0
- package/dist/types/loaders/SkeletonLoader.d.ts +11 -0
- package/dist/types/loaders/StepsLoader.d.ts +12 -0
- package/dist/types/loaders/TypingPill.d.ts +12 -0
- package/dist/types/recaptcha.d.ts +2 -0
- package/dist/types/renderers/ActionPart.d.ts +4 -0
- package/dist/types/renderers/ChartPart.d.ts +4 -0
- package/dist/types/renderers/ChatLinkContext.d.ts +8 -0
- package/dist/types/renderers/FigureText.d.ts +5 -0
- package/dist/types/renderers/FiguresPart.d.ts +4 -0
- package/dist/types/renderers/FilePart.d.ts +4 -0
- package/dist/types/renderers/HandoffPart.d.ts +4 -0
- package/dist/types/renderers/ImagePart.d.ts +4 -0
- package/dist/types/renderers/InputRequestPart.d.ts +5 -0
- package/dist/types/renderers/NoticePart.d.ts +3 -0
- package/dist/types/renderers/QuickRepliesPart.d.ts +4 -0
- package/dist/types/renderers/RecordCardPart.d.ts +4 -0
- package/dist/types/renderers/SourcesPart.d.ts +4 -0
- package/dist/types/renderers/TablePart.d.ts +4 -0
- package/dist/types/renderers/TextPart.d.ts +5 -0
- package/dist/types/renderers/TicketPart.d.ts +4 -0
- package/dist/types/renderers/VoiceClipPart.d.ts +7 -0
- package/dist/types/renderers/index.d.ts +32 -0
- package/dist/types/useAutoOpen.d.ts +11 -0
- package/dist/types/useChat.d.ts +34 -76
- package/dist/types/useChatDictation.d.ts +24 -0
- package/dist/types/useChatExplain.d.ts +57 -0
- package/dist/types/useChatHandoff.d.ts +19 -0
- package/dist/types/useChatReadAloud.d.ts +16 -0
- package/dist/types/useChatSound.d.ts +7 -0
- package/dist/types/useChatSpeech.d.ts +7 -0
- package/dist/types/useLauncherAvoid.d.ts +1 -0
- package/dist/types/useReducedMotion.d.ts +1 -0
- package/dist/types/useTranscriptActions.d.ts +12 -0
- package/package.json +18 -20
- package/README.md +0 -320
- package/dist/guidance.json +0 -216
- package/dist/types/ChatMarkdown.meta.d.ts +0 -31
- package/dist/types/components/ActionCard.d.ts +0 -27
- package/dist/types/components/ActionCard.meta.d.ts +0 -89
- package/dist/types/components/ChatComposer.d.ts +0 -38
- package/dist/types/components/ChatComposer.meta.d.ts +0 -56
- package/dist/types/components/ChatConversationList.d.ts +0 -20
- package/dist/types/components/ChatConversationList.meta.d.ts +0 -37
- package/dist/types/components/ChatLauncher.d.ts +0 -31
- package/dist/types/components/ChatLauncher.meta.d.ts +0 -50
- package/dist/types/components/ChatMessage.d.ts +0 -61
- package/dist/types/components/ChatMessage.meta.d.ts +0 -173
- package/dist/types/components/ChatPanel.d.ts +0 -74
- package/dist/types/components/ChatPanel.meta.d.ts +0 -228
- package/dist/types/components/ChatThread.d.ts +0 -54
- package/dist/types/components/ChatThread.meta.d.ts +0 -151
- package/dist/types/components/CitationChip.d.ts +0 -15
- package/dist/types/components/CitationChip.meta.d.ts +0 -48
- package/dist/types/components/ComposerAttachments.d.ts +0 -14
- package/dist/types/components/ConfirmCard.d.ts +0 -24
- package/dist/types/components/ConfirmCard.meta.d.ts +0 -43
- package/dist/types/components/ReplyRating.d.ts +0 -16
- package/dist/types/components/ReplyRating.meta.d.ts +0 -34
- package/dist/types/markdown.d.ts +0 -22
- /package/{LICENSE → LICENSE.txt} +0 -0
package/dist/guidance.json
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"format": "webority-guidance/1",
|
|
3
|
-
"package": {
|
|
4
|
-
"name": "@webority/chat-react",
|
|
5
|
-
"version": "0.128.0"
|
|
6
|
-
},
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"name": "ActionCard",
|
|
10
|
-
"usage": {
|
|
11
|
-
"when": [
|
|
12
|
-
"One support action the assistant prepared, shown under its reply for the person to confirm before anything reaches support."
|
|
13
|
-
],
|
|
14
|
-
"whenNot": [],
|
|
15
|
-
"do": [],
|
|
16
|
-
"dont": [],
|
|
17
|
-
"a11y": [
|
|
18
|
-
"The done message is an alert with role status, so it is announced when the ticket is raised.",
|
|
19
|
-
"Confirm and Not now are native buttons with text labels, and Not now is disabled while the request is sending.",
|
|
20
|
-
"A failed confirm shows its message in a danger alert and puts the card back to ready so the person can try again."
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "ChatComposer",
|
|
26
|
-
"usage": {
|
|
27
|
-
"when": [
|
|
28
|
-
"The question box where the person types a question for the assistant: Enter sends it and Shift and Enter starts a new line."
|
|
29
|
-
],
|
|
30
|
-
"whenNot": [],
|
|
31
|
-
"do": [],
|
|
32
|
-
"dont": [],
|
|
33
|
-
"a11y": [
|
|
34
|
-
"The form and its text box are both named by the composer label.",
|
|
35
|
-
"The text box is described by a visually hidden hint, so the Enter and Shift and Enter keys are announced.",
|
|
36
|
-
"Send is a submit button whose only text is the visually hidden send label next to a send icon, and it is disabled while busy, disabled or empty."
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"name": "ChatConversationList",
|
|
42
|
-
"usage": {
|
|
43
|
-
"when": [
|
|
44
|
-
"The person's past chats, newest first, for a past-chats page or a panel."
|
|
45
|
-
],
|
|
46
|
-
"whenNot": [],
|
|
47
|
-
"do": [],
|
|
48
|
-
"dont": [],
|
|
49
|
-
"a11y": [
|
|
50
|
-
"The chats are a list named by the conversations label.",
|
|
51
|
-
"Each chat is a button showing its title and a time element that carries the date, and the delete icon button is named by the delete label.",
|
|
52
|
-
"Deleting asks for confirmation in a dialog first, and the loading skeleton is hidden from assistive technology.",
|
|
53
|
-
"Renaming turns the row into a labelled text field: Enter saves, Escape cancels, and only one row edits at a time."
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"name": "ChatLauncher",
|
|
59
|
-
"usage": {
|
|
60
|
-
"when": [
|
|
61
|
-
"The floating pill that opens the assistant, pinned to a bottom corner."
|
|
62
|
-
],
|
|
63
|
-
"whenNot": [],
|
|
64
|
-
"do": [],
|
|
65
|
-
"dont": [],
|
|
66
|
-
"a11y": [
|
|
67
|
-
"The button announces that it opens a dialog (aria-haspopup) and whether it is open (aria-expanded).",
|
|
68
|
-
"The default pill shows the launcher label as its button text.",
|
|
69
|
-
"The compact circle takes the launcher label as its accessible name and as its tooltip."
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "ChatMarkdown",
|
|
75
|
-
"usage": {
|
|
76
|
-
"when": [
|
|
77
|
-
"A chat reply is written in Markdown and must render as text, never as HTML.",
|
|
78
|
-
"A reply may point at in-app records, and the host decides which links become routes."
|
|
79
|
-
],
|
|
80
|
-
"whenNot": [],
|
|
81
|
-
"do": [],
|
|
82
|
-
"dont": [],
|
|
83
|
-
"a11y": [
|
|
84
|
-
"Lists render as real ordered and unordered lists, and tables render as the markdown table, with a header row.",
|
|
85
|
-
"Code blocks have a Copy button.",
|
|
86
|
-
"A link renders only when the host maps it to a route; any other link shows its label as plain text.",
|
|
87
|
-
"Headings render as bold lines, not heading elements, so a reply does not change the page outline."
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "ChatMessage",
|
|
93
|
-
"usage": {
|
|
94
|
-
"when": [
|
|
95
|
-
"Show one question and its answer inside a chat thread.",
|
|
96
|
-
"Draw a single stored or streaming turn on its own, such as in a history view."
|
|
97
|
-
],
|
|
98
|
-
"whenNot": [
|
|
99
|
-
{
|
|
100
|
-
"text": "Showing the whole conversation, oldest turn first, with the newest text kept in view.",
|
|
101
|
-
"instead": "ChatThread"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"do": [],
|
|
105
|
-
"dont": [],
|
|
106
|
-
"a11y": [
|
|
107
|
-
"The answer sits in a polite live region, so a screen reader reads it once it settles; it is marked busy while it streams.",
|
|
108
|
-
"Visually hidden labels name who is speaking, taken from the You and Assistant labels.",
|
|
109
|
-
"While the first text is awaited, a spinner carries the Thinking label."
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"name": "ChatPanel",
|
|
115
|
-
"usage": {
|
|
116
|
-
"when": [
|
|
117
|
-
"Offer the assistant as a drawer that opens from a launcher.",
|
|
118
|
-
"Show the conversation, the question box, the questions left today and the footnote in one place."
|
|
119
|
-
],
|
|
120
|
-
"whenNot": [
|
|
121
|
-
{
|
|
122
|
-
"text": "Showing only the conversation inside a page.",
|
|
123
|
-
"instead": "ChatThread"
|
|
124
|
-
}
|
|
125
|
-
],
|
|
126
|
-
"do": [],
|
|
127
|
-
"dont": [],
|
|
128
|
-
"a11y": [
|
|
129
|
-
"Focus stays inside the drawer while it is open, Escape closes it, and the question box takes focus when it opens.",
|
|
130
|
-
"The drawer is named by its title.",
|
|
131
|
-
"The questions left note is a status region."
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"name": "ChatThread",
|
|
137
|
-
"usage": {
|
|
138
|
-
"when": [
|
|
139
|
-
"Show a whole conversation, oldest turn first, in a panel or a page.",
|
|
140
|
-
"Let the thread follow the newest text as an answer streams."
|
|
141
|
-
],
|
|
142
|
-
"whenNot": [
|
|
143
|
-
{
|
|
144
|
-
"text": "Showing one turn on its own.",
|
|
145
|
-
"instead": "ChatMessage"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"text": "Showing the full assistant drawer with its header and question box.",
|
|
149
|
-
"instead": "ChatPanel"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"do": [],
|
|
153
|
-
"dont": [],
|
|
154
|
-
"a11y": [
|
|
155
|
-
"The turns are an ordered list named by the thread label.",
|
|
156
|
-
"Each answer is a polite live region; see ChatMessage.",
|
|
157
|
-
"Only the nearest box that scrolls on its own follows the newest text, so the page itself never jumps."
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"name": "CitationChip",
|
|
163
|
-
"usage": {
|
|
164
|
-
"when": [
|
|
165
|
-
"Show a source the assistant named in a reply as a small chip the person can select to open it.",
|
|
166
|
-
"Pair it with splitCitations from @webority/markdown-core (re-exported by @webority/chat-react) to turn [source] runs in reply text into chips."
|
|
167
|
-
],
|
|
168
|
-
"whenNot": [
|
|
169
|
-
{
|
|
170
|
-
"text": "Showing a general label or removable token that is not a source.",
|
|
171
|
-
"instead": "AppChip"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
"do": [],
|
|
175
|
-
"dont": [],
|
|
176
|
-
"a11y": [
|
|
177
|
-
"The chip is a button named by ariaLabel, or by the citation when none is given.",
|
|
178
|
-
"Selecting it by pointer or keyboard calls onOpen with the citation."
|
|
179
|
-
]
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "ConfirmCard",
|
|
184
|
-
"usage": {
|
|
185
|
-
"when": [
|
|
186
|
-
"The assistant has prepared an action and nothing should happen until the person says yes.",
|
|
187
|
-
"The action is one step the person can send now or decline."
|
|
188
|
-
],
|
|
189
|
-
"whenNot": [],
|
|
190
|
-
"do": [],
|
|
191
|
-
"dont": [],
|
|
192
|
-
"a11y": [
|
|
193
|
-
"Confirm and Not now are native buttons, and Confirm shows its loading state while the action is sent.",
|
|
194
|
-
"The done message is a status message.",
|
|
195
|
-
"A failed confirm shows its message in an alert above the buttons and returns the card to ready."
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
"name": "ReplyRating",
|
|
201
|
-
"usage": {
|
|
202
|
-
"when": [
|
|
203
|
-
"A reply can be rated helpful or not helpful, with an optional note after a not helpful rating."
|
|
204
|
-
],
|
|
205
|
-
"whenNot": [],
|
|
206
|
-
"do": [],
|
|
207
|
-
"dont": [],
|
|
208
|
-
"a11y": [
|
|
209
|
-
"Both rating buttons are native buttons that expose their state through aria-pressed.",
|
|
210
|
-
"The thank you line is a status message.",
|
|
211
|
-
"The note field has a visible label and a hint, and the person can send the note or skip it."
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
]
|
|
216
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatMarkdown";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly text: {
|
|
8
|
-
readonly type: "string";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The reply text, written in the supported Markdown subset. It always renders as text, never as HTML.";
|
|
11
|
-
};
|
|
12
|
-
readonly className: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly description: "Extra classes on the wrapper around the rendered reply.";
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
readonly examples: readonly [{
|
|
18
|
-
readonly id: "ChatMarkdown";
|
|
19
|
-
readonly title: "Default";
|
|
20
|
-
readonly props: {
|
|
21
|
-
readonly text: "See [your ticket](ticket:support/42) or [this site](https://evil.example).";
|
|
22
|
-
};
|
|
23
|
-
}];
|
|
24
|
-
readonly usage: {
|
|
25
|
-
readonly when: readonly ["A chat reply is written in Markdown and must render as text, never as HTML.", "A reply may point at in-app records, and the host decides which links become routes."];
|
|
26
|
-
readonly whenNot: readonly [];
|
|
27
|
-
readonly do: readonly [];
|
|
28
|
-
readonly dont: readonly [];
|
|
29
|
-
readonly a11y: readonly ["Lists render as real ordered and unordered lists, and tables render as the markdown table, with a header row.", "Code blocks have a Copy button.", "A link renders only when the host maps it to a route; any other link shows its label as plain text.", "Headings render as bold lines, not heading elements, so a reply does not change the page outline."];
|
|
30
|
-
};
|
|
31
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One support action the assistant prepared, shown under its reply. Nothing reaches support until
|
|
3
|
-
* the person confirms. The card moves from ready to sending to done (with View ticket), or to
|
|
4
|
-
* dismissed when the person says not now. A card whose token has expired (a reopened
|
|
5
|
-
* conversation) still shows what was offered, without a button that could only fail.
|
|
6
|
-
*
|
|
7
|
-
* @param {object} props
|
|
8
|
-
* @param {import('@webority/markdown-core/chat').SupportAction} props.action
|
|
9
|
-
* @param {(token: string) => Promise<{ id: string, number: string }>} props.confirmAction Sends the
|
|
10
|
-
* person's yes, e.g. `supportClient.confirmAction`; resolves to the ticket raised, replied on or
|
|
11
|
-
* reopened. A rejection's `message` is shown when present.
|
|
12
|
-
* @param {(ticket: { id: string, number: string }) => void} [props.onViewTicket] Shows a View
|
|
13
|
-
* ticket button once confirmed.
|
|
14
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
15
|
-
*/
|
|
16
|
-
export default function ActionCard({ action, confirmAction, onViewTicket, labels: labelOverrides }: {
|
|
17
|
-
action: import('@webority/markdown-core/chat').SupportAction;
|
|
18
|
-
confirmAction: (token: string) => Promise<{
|
|
19
|
-
id: string;
|
|
20
|
-
number: string;
|
|
21
|
-
}>;
|
|
22
|
-
onViewTicket?: (ticket: {
|
|
23
|
-
id: string;
|
|
24
|
-
number: string;
|
|
25
|
-
}) => void;
|
|
26
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
27
|
-
}): import("react").JSX.Element;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ActionCard";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly action: {
|
|
8
|
-
readonly type: "object";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The support action to show: its kind, its text and when it expires.";
|
|
11
|
-
readonly fields: {
|
|
12
|
-
readonly token: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly required: true;
|
|
15
|
-
readonly description: "Sent back by the confirm button; nothing happens without it.";
|
|
16
|
-
};
|
|
17
|
-
readonly kind: {
|
|
18
|
-
readonly type: "enum";
|
|
19
|
-
readonly values: readonly ["RaiseTicket", "Reply", "Reopen"];
|
|
20
|
-
readonly required: true;
|
|
21
|
-
readonly description: "What the action does: raise a new ticket, reply on one, or reopen one.";
|
|
22
|
-
};
|
|
23
|
-
readonly ticketId: {
|
|
24
|
-
readonly type: "string";
|
|
25
|
-
readonly required: true;
|
|
26
|
-
readonly nullable: true;
|
|
27
|
-
readonly description: "The ticket the action is about. It is null when the action raises a new ticket.";
|
|
28
|
-
};
|
|
29
|
-
readonly ticketNumber: {
|
|
30
|
-
readonly type: "string";
|
|
31
|
-
readonly required: true;
|
|
32
|
-
readonly nullable: true;
|
|
33
|
-
readonly description: "The number of that ticket, shown in the title of a reply or reopen. It is null when the action raises a new ticket.";
|
|
34
|
-
};
|
|
35
|
-
readonly category: {
|
|
36
|
-
readonly type: "string";
|
|
37
|
-
readonly required: true;
|
|
38
|
-
readonly nullable: true;
|
|
39
|
-
readonly description: "The category of a new ticket, shown under the title. It is null for a reply or reopen.";
|
|
40
|
-
};
|
|
41
|
-
readonly subject: {
|
|
42
|
-
readonly type: "string";
|
|
43
|
-
readonly required: true;
|
|
44
|
-
readonly nullable: true;
|
|
45
|
-
readonly description: "The subject of a new ticket, shown under the title. It is null for a reply or reopen.";
|
|
46
|
-
};
|
|
47
|
-
readonly body: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
readonly required: true;
|
|
50
|
-
readonly nullable: true;
|
|
51
|
-
readonly description: "The text the assistant prepared, shown in the card. A reopen shows none.";
|
|
52
|
-
};
|
|
53
|
-
readonly expiresDateTimeUtc: {
|
|
54
|
-
readonly type: "string";
|
|
55
|
-
readonly required: true;
|
|
56
|
-
readonly description: "When the action stops being confirmable, as a UTC date and time. After it the card shows what was offered without a Confirm button.";
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
readonly labels: {
|
|
61
|
-
readonly type: "object";
|
|
62
|
-
readonly description: "Overrides for the component's text, keyed by label name. A key left out keeps its default.";
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
readonly omit: readonly [];
|
|
66
|
-
readonly examples: readonly [{
|
|
67
|
-
readonly id: "ActionCard";
|
|
68
|
-
readonly title: "Default";
|
|
69
|
-
readonly props: {
|
|
70
|
-
readonly action: {
|
|
71
|
-
readonly token: "example-token";
|
|
72
|
-
readonly kind: "RaiseTicket";
|
|
73
|
-
readonly ticketId: null;
|
|
74
|
-
readonly ticketNumber: null;
|
|
75
|
-
readonly category: "Billing";
|
|
76
|
-
readonly subject: "Invoice address is wrong";
|
|
77
|
-
readonly body: "Please change the address on invoice 12.";
|
|
78
|
-
readonly expiresDateTimeUtc: "2099-12-31T23:59:59Z";
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
}];
|
|
82
|
-
readonly usage: {
|
|
83
|
-
readonly when: readonly ["One support action the assistant prepared, shown under its reply for the person to confirm before anything reaches support."];
|
|
84
|
-
readonly whenNot: readonly [];
|
|
85
|
-
readonly do: readonly [];
|
|
86
|
-
readonly dont: readonly [];
|
|
87
|
-
readonly a11y: readonly ["The done message is an alert with role status, so it is announced when the ticket is raised.", "Confirm and Not now are native buttons with text labels, and Not now is disabled while the request is sending.", "A failed confirm shows its message in a danger alert and puts the card back to ready so the person can try again."];
|
|
88
|
-
};
|
|
89
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The question box. Enter sends; Shift and Enter starts a new line. The box clears once a
|
|
3
|
-
* question is handed on, and stays usable while an answer streams, though sending waits for it.
|
|
4
|
-
* While an answer streams, Stop replaces Send when `onStop` is given. Sending also waits for
|
|
5
|
-
* every attachment to finish uploading.
|
|
6
|
-
*
|
|
7
|
-
* @param {object} props
|
|
8
|
-
* @param {(message: string) => unknown} props.onSubmit Called with the trimmed question.
|
|
9
|
-
* @param {boolean} [props.busy]
|
|
10
|
-
* @param {boolean} [props.disabled]
|
|
11
|
-
* @param {number} [props.maxLength]
|
|
12
|
-
* @param {import('react').Ref<HTMLTextAreaElement>} [props.inputRef] The question box, for focusing it.
|
|
13
|
-
* @param {import('@webority/markdown-core/chat').ComposerAttachment[]} [props.attachments]
|
|
14
|
-
* @param {(files: File[]) => unknown} [props.onAttach] Shows the attach button; called with the picked files.
|
|
15
|
-
* @param {(key: string) => unknown} [props.onRemoveAttachment] Called with an attachment's key.
|
|
16
|
-
* @param {string} [props.accept] The file types the picker offers, as an `accept` string.
|
|
17
|
-
* @param {() => unknown} [props.onStop] Shows Stop in place of Send while busy.
|
|
18
|
-
* @param {{ text: string } | null} [props.editing] When set, the box takes its text and shows the editing notice.
|
|
19
|
-
* @param {() => unknown} [props.onCancelEdit] Shows the Cancel button beside the editing notice.
|
|
20
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
21
|
-
*/
|
|
22
|
-
export default function ChatComposer({ onSubmit, busy, disabled, maxLength, inputRef, attachments, onAttach, onRemoveAttachment, accept, onStop, editing, onCancelEdit, labels: labelOverrides, }: {
|
|
23
|
-
onSubmit: (message: string) => unknown;
|
|
24
|
-
busy?: boolean;
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
maxLength?: number;
|
|
27
|
-
inputRef?: import('react').Ref<HTMLTextAreaElement>;
|
|
28
|
-
attachments?: import('@webority/markdown-core/chat').ComposerAttachment[];
|
|
29
|
-
onAttach?: (files: File[]) => unknown;
|
|
30
|
-
onRemoveAttachment?: (key: string) => unknown;
|
|
31
|
-
accept?: string;
|
|
32
|
-
onStop?: () => unknown;
|
|
33
|
-
editing?: {
|
|
34
|
-
text: string;
|
|
35
|
-
} | null;
|
|
36
|
-
onCancelEdit?: () => unknown;
|
|
37
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
38
|
-
}): import("react").JSX.Element;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatComposer";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly busy: {
|
|
8
|
-
readonly type: "boolean";
|
|
9
|
-
readonly default: false;
|
|
10
|
-
readonly description: "An answer is still arriving, so Send is held.";
|
|
11
|
-
};
|
|
12
|
-
readonly disabled: {
|
|
13
|
-
readonly type: "boolean";
|
|
14
|
-
readonly default: false;
|
|
15
|
-
readonly description: "Nothing can be asked, for example when no questions are left today.";
|
|
16
|
-
};
|
|
17
|
-
readonly maxLength: {
|
|
18
|
-
readonly type: "number";
|
|
19
|
-
readonly default: 4000;
|
|
20
|
-
readonly description: "The longest question the box accepts, matching the server's message limit.";
|
|
21
|
-
};
|
|
22
|
-
readonly attachments: {
|
|
23
|
-
readonly type: "array";
|
|
24
|
-
readonly required: false;
|
|
25
|
-
readonly default: readonly [];
|
|
26
|
-
readonly description: "The files attached to the question being written, each with its upload status. Sending waits while one is uploading.";
|
|
27
|
-
};
|
|
28
|
-
readonly accept: {
|
|
29
|
-
readonly type: "string";
|
|
30
|
-
readonly required: false;
|
|
31
|
-
readonly description: "The file types the picker offers, as an accept string such as image/png,application/pdf.";
|
|
32
|
-
};
|
|
33
|
-
readonly editing: {
|
|
34
|
-
readonly type: "object";
|
|
35
|
-
readonly required: false;
|
|
36
|
-
readonly description: "When set, the box takes its text and shows the editing notice. Shape: { text }.";
|
|
37
|
-
};
|
|
38
|
-
readonly labels: {
|
|
39
|
-
readonly type: "object";
|
|
40
|
-
readonly description: "Overrides for the component's text, keyed by label name. A key left out keeps its default.";
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
readonly omit: readonly ["inputRef"];
|
|
44
|
-
readonly examples: readonly [{
|
|
45
|
-
readonly id: "ChatComposer";
|
|
46
|
-
readonly title: "Default";
|
|
47
|
-
readonly props: {};
|
|
48
|
-
}];
|
|
49
|
-
readonly usage: {
|
|
50
|
-
readonly when: readonly ["The question box where the person types a question for the assistant: Enter sends it and Shift and Enter starts a new line."];
|
|
51
|
-
readonly whenNot: readonly [];
|
|
52
|
-
readonly do: readonly [];
|
|
53
|
-
readonly dont: readonly [];
|
|
54
|
-
readonly a11y: readonly ["The form and its text box are both named by the composer label.", "The text box is described by a visually hidden hint, so the Enter and Shift and Enter keys are announced.", "Send is a submit button whose only text is the visually hidden send label next to a send icon, and it is disabled while busy, disabled or empty."];
|
|
55
|
-
};
|
|
56
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The person's past chats, newest first, for a past-chats page or a panel. It pages with Show
|
|
3
|
-
* more, opens one through `onOpen`, renames one in place, and deletes one after a confirm.
|
|
4
|
-
*
|
|
5
|
-
* @param {object} props
|
|
6
|
-
* @param {import('@webority/markdown-core/chat').ChatClient} props.client
|
|
7
|
-
* @param {(conversation: import('@webority/markdown-core/chat').ConversationSummary) => void} props.onOpen
|
|
8
|
-
* E.g. open the panel and call `chat.openConversation(conversation.publicId)`.
|
|
9
|
-
* @param {(id: string) => void} [props.onDeleted] Called after a chat is deleted, e.g. to start a
|
|
10
|
-
* new chat when the open one was deleted.
|
|
11
|
-
* @param {number} [props.pageSize]
|
|
12
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
13
|
-
*/
|
|
14
|
-
export default function ChatConversationList({ client, onOpen, onDeleted, pageSize, labels: labelOverrides }: {
|
|
15
|
-
client: import('@webority/markdown-core/chat').ChatClient;
|
|
16
|
-
onOpen: (conversation: import('@webority/markdown-core/chat').ConversationSummary) => void;
|
|
17
|
-
onDeleted?: (id: string) => void;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
20
|
-
}): import("react").JSX.Element;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatConversationList";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly client: {
|
|
8
|
-
readonly type: "object";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The chat client the list loads and deletes chats through.";
|
|
11
|
-
};
|
|
12
|
-
readonly pageSize: {
|
|
13
|
-
readonly type: "number";
|
|
14
|
-
readonly default: 20;
|
|
15
|
-
readonly description: "How many chats each load fetches. Show more loads the next page.";
|
|
16
|
-
};
|
|
17
|
-
readonly labels: {
|
|
18
|
-
readonly type: "object";
|
|
19
|
-
readonly description: "Overrides for the component's text, keyed by label name. A key left out keeps its default.";
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
readonly omit: readonly [];
|
|
23
|
-
readonly examples: readonly [{
|
|
24
|
-
readonly id: "ChatConversationList";
|
|
25
|
-
readonly title: "Default";
|
|
26
|
-
readonly props: {
|
|
27
|
-
client: {};
|
|
28
|
-
};
|
|
29
|
-
}];
|
|
30
|
-
readonly usage: {
|
|
31
|
-
readonly when: readonly ["The person's past chats, newest first, for a past-chats page or a panel."];
|
|
32
|
-
readonly whenNot: readonly [];
|
|
33
|
-
readonly do: readonly [];
|
|
34
|
-
readonly dont: readonly [];
|
|
35
|
-
readonly a11y: readonly ["The chats are a list named by the conversations label.", "Each chat is a button showing its title and a time element that carries the date, and the delete icon button is named by the delete label.", "Deleting asks for confirmation in a dialog first, and the loading skeleton is hidden from assistive technology.", "Renaming turns the row into a labelled text field: Enter saves, Escape cancels, and only one row edits at a time."];
|
|
36
|
-
};
|
|
37
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The floating pill that opens the assistant, pinned to a bottom corner. Move it clear of other
|
|
3
|
-
* fixed controls (a report-an-issue button, a cookie banner) with `style`, e.g.
|
|
4
|
-
* `{ bottom: "5rem" }`, or with `className`.
|
|
5
|
-
*
|
|
6
|
-
* `compact` turns it into a 48px icon-only circle that lives in the shared floating stack
|
|
7
|
-
* (`useFloatingStack` from `@webority/ui-react`), the corner container the compact report-an-issue
|
|
8
|
-
* button also uses: the two stack with a gap and never overlap, so neither needs an offset. The
|
|
9
|
-
* label becomes the tooltip and the accessible name. `className` and `style` then land on the item
|
|
10
|
-
* inside the stack, which is not itself fixed.
|
|
11
|
-
*
|
|
12
|
-
* @param {object} props
|
|
13
|
-
* @param {() => void} props.onClick Opens the panel.
|
|
14
|
-
* @param {boolean} [props.open]
|
|
15
|
-
* @param {"end"|"start"} [props.position]
|
|
16
|
-
* @param {string} [props.icon]
|
|
17
|
-
* @param {boolean} [props.compact]
|
|
18
|
-
* @param {string} [props.className]
|
|
19
|
-
* @param {import('react').CSSProperties} [props.style] Merged over the wrapper's own style.
|
|
20
|
-
* @param {Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>} [props.labels]
|
|
21
|
-
*/
|
|
22
|
-
export default function ChatLauncher({ onClick, open, position, icon, compact, className, style, labels: labelOverrides, }: {
|
|
23
|
-
onClick: () => void;
|
|
24
|
-
open?: boolean;
|
|
25
|
-
position?: "end" | "start";
|
|
26
|
-
icon?: string;
|
|
27
|
-
compact?: boolean;
|
|
28
|
-
className?: string;
|
|
29
|
-
style?: import('react').CSSProperties;
|
|
30
|
-
labels?: Partial<typeof import('@webority/markdown-core/chat').DEFAULT_CHAT_LABELS>;
|
|
31
|
-
}): import("react").JSX.Element;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatLauncher";
|
|
3
|
-
readonly marker: null;
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly open: {
|
|
8
|
-
readonly type: "boolean";
|
|
9
|
-
readonly default: false;
|
|
10
|
-
readonly description: "Whether the panel is open. It is announced on the button.";
|
|
11
|
-
};
|
|
12
|
-
readonly position: {
|
|
13
|
-
readonly type: "enum";
|
|
14
|
-
readonly values: readonly ["end", "start"];
|
|
15
|
-
readonly default: "end";
|
|
16
|
-
readonly description: "The bottom corner the launcher sits in.";
|
|
17
|
-
};
|
|
18
|
-
readonly icon: {
|
|
19
|
-
readonly type: "string";
|
|
20
|
-
readonly default: "sparkles";
|
|
21
|
-
readonly description: "A library icon name.";
|
|
22
|
-
};
|
|
23
|
-
readonly compact: {
|
|
24
|
-
readonly type: "boolean";
|
|
25
|
-
readonly default: false;
|
|
26
|
-
readonly description: "Shows an icon-only circle stacked in the shared floating corner container, with the label as its tooltip.";
|
|
27
|
-
};
|
|
28
|
-
readonly className: {
|
|
29
|
-
readonly type: "string";
|
|
30
|
-
readonly description: "Added to the floating wrapper.";
|
|
31
|
-
};
|
|
32
|
-
readonly labels: {
|
|
33
|
-
readonly type: "object";
|
|
34
|
-
readonly description: "Overrides for the component's text, keyed by label name. The launcher key is the button text. A key left out keeps its default.";
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
readonly omit: readonly ["style"];
|
|
38
|
-
readonly examples: readonly [{
|
|
39
|
-
readonly id: "ChatLauncher";
|
|
40
|
-
readonly title: "Default";
|
|
41
|
-
readonly props: {};
|
|
42
|
-
}];
|
|
43
|
-
readonly usage: {
|
|
44
|
-
readonly when: readonly ["The floating pill that opens the assistant, pinned to a bottom corner."];
|
|
45
|
-
readonly whenNot: readonly [];
|
|
46
|
-
readonly do: readonly [];
|
|
47
|
-
readonly dont: readonly [];
|
|
48
|
-
readonly a11y: readonly ["The button announces that it opens a dialog (aria-haspopup) and whether it is open (aria-expanded).", "The default pill shows the launcher label as its button text.", "The compact circle takes the launcher label as its accessible name and as its tooltip."];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* One turn: the person's question on the right, the assistant's answer on the left. The answer
|
|
3
|
-
* is a polite live region, so a screen reader reads it once it settles; while it streams it is
|
|
4
|
-
* marked busy. Support actions show under the answer, and the rating once the reply is stored.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} props
|
|
7
|
-
* @param {import('@webority/markdown-core/chat').ChatTurn} props.turn
|
|
8
|
-
* @param {(turnId: string, rating: "Up"|"Down", note?: string) => Promise<unknown>} [props.onRate]
|
|
9
|
-
* Shows the rating under a stored reply.
|
|
10
|
-
* @param {(turnId: string) => void} [props.onRetry] Offers "Try again" under a failed or stopped turn.
|
|
11
|
-
* @param {(turnId: string) => void} [props.onRegenerate] Offers "New answer" under an answered turn.
|
|
12
|
-
* @param {boolean} [props.canRegenerate] Set on the last turn only, so an older answer has no "New answer".
|
|
13
|
-
* @param {(text: string) => void} [props.onAskSuggestion] Sends a suggested follow-up question; the suggestions show under a settled answer.
|
|
14
|
-
* @param {(inner: string) => boolean} [props.isCitation] Returns true for a run of the answer that is a citation to draw as a chip; see `ChatMarkdown`.
|
|
15
|
-
* @param {(citation: string) => void} [props.onOpenCitation] Called with the citation text when its chip is pressed; see `ChatMarkdown`.
|
|
16
|
-
* @param {(turnId: string) => void} [props.onEdit] Offers an Edit button beside a question that has a `questionId`.
|
|
17
|
-
* @param {(attachment: { publicId: string, fileName: string, contentType: string, length: number }) => void} [props.onOpenAttachment]
|
|
18
|
-
* Makes each attachment chip on the question a button.
|
|
19
|
-
* @param {(href: string) => string|null|undefined} [props.resolveLink] See `ChatMarkdown`.
|
|
20
|
-
* @param {import('react').ElementType} [props.linkComponent] A router link (it receives `to`).
|
|
21
|
-
* @param {(token: string) => Promise<{ id: string, number: string }>} [props.confirmAction] Shows
|
|
22
|
-
* support action cards; see `ActionCard`.
|
|
23
|
-
* @param {(ticket: { id: string, number: string }) => void} [props.onViewTicket]
|
|
24
|
-
* @param {(turn: import('@webority/markdown-core/chat').ChatTurn, state: { streaming: boolean }) => import('react').ReactNode} [props.renderReply]
|
|
25
|
-
* Draws the assistant's answer in place of `ChatMarkdown` (charts, maths). The question, action
|
|
26
|
-
* cards, rating and layout stay the library's.
|
|
27
|
-
* @param {Partial<import('@webority/markdown-core/chat').ChatLabels>} [props.labels]
|
|
28
|
-
*/
|
|
29
|
-
declare function ChatMessage({ turn, onRate, onRetry, onRegenerate, canRegenerate, onEdit, onOpenAttachment, resolveLink, linkComponent, isCitation, onOpenCitation, onAskSuggestion, confirmAction, onViewTicket, renderReply, labels: labelOverrides, }: {
|
|
30
|
-
turn: import('@webority/markdown-core/chat').ChatTurn;
|
|
31
|
-
onRate?: (turnId: string, rating: "Up" | "Down", note?: string) => Promise<unknown>;
|
|
32
|
-
onRetry?: (turnId: string) => void;
|
|
33
|
-
onRegenerate?: (turnId: string) => void;
|
|
34
|
-
canRegenerate?: boolean;
|
|
35
|
-
onAskSuggestion?: (text: string) => void;
|
|
36
|
-
isCitation?: (inner: string) => boolean;
|
|
37
|
-
onOpenCitation?: (citation: string) => void;
|
|
38
|
-
onEdit?: (turnId: string) => void;
|
|
39
|
-
onOpenAttachment?: (attachment: {
|
|
40
|
-
publicId: string;
|
|
41
|
-
fileName: string;
|
|
42
|
-
contentType: string;
|
|
43
|
-
length: number;
|
|
44
|
-
}) => void;
|
|
45
|
-
resolveLink?: (href: string) => string | null | undefined;
|
|
46
|
-
linkComponent?: import('react').ElementType;
|
|
47
|
-
confirmAction?: (token: string) => Promise<{
|
|
48
|
-
id: string;
|
|
49
|
-
number: string;
|
|
50
|
-
}>;
|
|
51
|
-
onViewTicket?: (ticket: {
|
|
52
|
-
id: string;
|
|
53
|
-
number: string;
|
|
54
|
-
}) => void;
|
|
55
|
-
renderReply?: (turn: import('@webority/markdown-core/chat').ChatTurn, state: {
|
|
56
|
-
streaming: boolean;
|
|
57
|
-
}) => import('react').ReactNode;
|
|
58
|
-
labels?: Partial<import('@webority/markdown-core/chat').ChatLabels>;
|
|
59
|
-
}): import("react").JSX.Element;
|
|
60
|
-
declare const _default: import("react").MemoExoticComponent<typeof ChatMessage>;
|
|
61
|
-
export default _default;
|