@webority/chat-react 0.127.0 → 0.133.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 +5 -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/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 +5 -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
|
@@ -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;
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
export declare const meta: {
|
|
2
|
-
readonly name: "ChatMessage";
|
|
3
|
-
readonly marker: "ChatMessage";
|
|
4
|
-
readonly platforms: readonly ["web"];
|
|
5
|
-
readonly acceptsChildren: false;
|
|
6
|
-
readonly props: {
|
|
7
|
-
readonly turn: {
|
|
8
|
-
readonly type: "object";
|
|
9
|
-
readonly required: true;
|
|
10
|
-
readonly description: "The turn to show: the person's question and the assistant's answer.";
|
|
11
|
-
readonly fields: {
|
|
12
|
-
readonly id: {
|
|
13
|
-
readonly type: "string";
|
|
14
|
-
readonly required: true;
|
|
15
|
-
readonly description: "Local key for the turn; for a reopened conversation, the stored message's id.";
|
|
16
|
-
};
|
|
17
|
-
readonly question: {
|
|
18
|
-
readonly type: "string";
|
|
19
|
-
readonly required: true;
|
|
20
|
-
readonly description: "What the person asked. Left empty, no question bubble shows.";
|
|
21
|
-
};
|
|
22
|
-
readonly answer: {
|
|
23
|
-
readonly type: "string";
|
|
24
|
-
readonly required: true;
|
|
25
|
-
readonly description: "The answer shown: the streamed text so far, then the reply of record.";
|
|
26
|
-
};
|
|
27
|
-
readonly streaming: {
|
|
28
|
-
readonly type: "boolean";
|
|
29
|
-
readonly required: true;
|
|
30
|
-
readonly description: "True while the answer is still arriving.";
|
|
31
|
-
};
|
|
32
|
-
readonly step: {
|
|
33
|
-
readonly type: "string";
|
|
34
|
-
readonly required: false;
|
|
35
|
-
readonly description: "The name of the tool the assistant is running. Unset when none is.";
|
|
36
|
-
};
|
|
37
|
-
readonly error: {
|
|
38
|
-
readonly type: "object";
|
|
39
|
-
readonly required: false;
|
|
40
|
-
readonly description: "Set when the turn failed; its message shows in an alert.";
|
|
41
|
-
readonly fields: {
|
|
42
|
-
readonly code: {
|
|
43
|
-
readonly type: "string";
|
|
44
|
-
readonly required: true;
|
|
45
|
-
readonly description: "A short code for the failure.";
|
|
46
|
-
};
|
|
47
|
-
readonly message: {
|
|
48
|
-
readonly type: "string";
|
|
49
|
-
readonly required: true;
|
|
50
|
-
readonly description: "Written for the person.";
|
|
51
|
-
};
|
|
52
|
-
readonly resetsAtUtc: {
|
|
53
|
-
readonly type: "string";
|
|
54
|
-
readonly required: false;
|
|
55
|
-
readonly description: "When a limit resets, as an ISO time.";
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
readonly actions: {
|
|
60
|
-
readonly type: "array";
|
|
61
|
-
readonly required: true;
|
|
62
|
-
readonly description: "Support actions the assistant prepared for this turn.";
|
|
63
|
-
};
|
|
64
|
-
readonly messageId: {
|
|
65
|
-
readonly type: "string";
|
|
66
|
-
readonly required: false;
|
|
67
|
-
readonly description: "The stored reply's id. The rating needs it.";
|
|
68
|
-
};
|
|
69
|
-
readonly rating: {
|
|
70
|
-
readonly type: "enum";
|
|
71
|
-
readonly values: readonly ["Up", "Down"];
|
|
72
|
-
readonly required: false;
|
|
73
|
-
readonly description: "The rating already given to the reply.";
|
|
74
|
-
};
|
|
75
|
-
readonly ratingNote: {
|
|
76
|
-
readonly type: "string";
|
|
77
|
-
readonly required: false;
|
|
78
|
-
readonly description: "The note saved with the rating.";
|
|
79
|
-
};
|
|
80
|
-
readonly questionId: {
|
|
81
|
-
readonly type: "string";
|
|
82
|
-
readonly required: false;
|
|
83
|
-
readonly description: "The stored question's id. Edit needs it; unset until the server answers.";
|
|
84
|
-
};
|
|
85
|
-
readonly attachments: {
|
|
86
|
-
readonly type: "array";
|
|
87
|
-
readonly required: false;
|
|
88
|
-
readonly description: "Files attached to the question, shown as chips under it.";
|
|
89
|
-
};
|
|
90
|
-
readonly stopped: {
|
|
91
|
-
readonly type: "boolean";
|
|
92
|
-
readonly required: false;
|
|
93
|
-
readonly description: "True when the person stopped the turn. Shows the stopped notice where the answer goes.";
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
readonly canRegenerate: {
|
|
98
|
-
readonly type: "boolean";
|
|
99
|
-
readonly required: false;
|
|
100
|
-
readonly description: "Set on the last turn only, so an older answer has no New answer button.";
|
|
101
|
-
};
|
|
102
|
-
readonly labels: {
|
|
103
|
-
readonly type: "object";
|
|
104
|
-
readonly required: false;
|
|
105
|
-
readonly description: "Replacements for the built-in wording, such as the labels for You, Assistant and Thinking.";
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
readonly examples: readonly [{
|
|
109
|
-
readonly id: "ChatMessage";
|
|
110
|
-
readonly title: "Default";
|
|
111
|
-
readonly props: {
|
|
112
|
-
readonly turn: {
|
|
113
|
-
readonly id: "t1";
|
|
114
|
-
readonly question: "Where is my order?";
|
|
115
|
-
readonly answer: "Your order ships today.";
|
|
116
|
-
readonly streaming: false;
|
|
117
|
-
readonly actions: readonly [];
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
readonly wrap: {
|
|
121
|
-
readonly component: "ul";
|
|
122
|
-
readonly props: {
|
|
123
|
-
readonly className: "list-unstyled mb-0";
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
}, {
|
|
127
|
-
readonly id: "ChatMessage.user";
|
|
128
|
-
readonly title: "Question only";
|
|
129
|
-
readonly props: {
|
|
130
|
-
readonly turn: {
|
|
131
|
-
readonly id: "message-user";
|
|
132
|
-
readonly question: "How do I turn on two-step sign-in?";
|
|
133
|
-
readonly answer: "";
|
|
134
|
-
readonly streaming: false;
|
|
135
|
-
readonly actions: readonly [];
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
readonly wrap: {
|
|
139
|
-
readonly component: "ul";
|
|
140
|
-
readonly props: {
|
|
141
|
-
readonly className: "list-unstyled mb-0";
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
}, {
|
|
145
|
-
readonly id: "ChatMessage.assistant";
|
|
146
|
-
readonly title: "Answer only";
|
|
147
|
-
readonly props: {
|
|
148
|
-
readonly turn: {
|
|
149
|
-
readonly id: "message-assistant";
|
|
150
|
-
readonly question: "";
|
|
151
|
-
readonly answer: "Open the security settings and choose two-step sign-in.";
|
|
152
|
-
readonly streaming: false;
|
|
153
|
-
readonly actions: readonly [];
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
readonly wrap: {
|
|
157
|
-
readonly component: "ul";
|
|
158
|
-
readonly props: {
|
|
159
|
-
readonly className: "list-unstyled mb-0";
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
}];
|
|
163
|
-
readonly usage: {
|
|
164
|
-
readonly when: readonly ["Show one question and its answer inside a chat thread.", "Draw a single stored or streaming turn on its own, such as in a history view."];
|
|
165
|
-
readonly whenNot: readonly [{
|
|
166
|
-
readonly text: "Showing the whole conversation, oldest turn first, with the newest text kept in view.";
|
|
167
|
-
readonly instead: "ChatThread";
|
|
168
|
-
}];
|
|
169
|
-
readonly do: readonly [];
|
|
170
|
-
readonly dont: readonly [];
|
|
171
|
-
readonly a11y: readonly ["The answer sits in a polite live region, so a screen reader reads it once it settles; it is marked busy while it streams.", "Visually hidden labels name who is speaking, taken from the You and Assistant labels.", "While the first text is awaited, a spinner carries the Thinking label."];
|
|
172
|
-
};
|
|
173
|
-
};
|