@webority/chat-react 0.140.5 → 0.142.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 +2 -2
- package/dist/types/ChatAgentTyping.d.ts +6 -4
- package/dist/types/ChatAuthorBadge.d.ts +6 -4
- package/dist/types/ChatComposer.d.ts +12 -7
- package/dist/types/ChatConversationActions.d.ts +9 -4
- package/dist/types/ChatEmbed.d.ts +6 -1
- package/dist/types/ChatExplain.d.ts +27 -12
- package/dist/types/ChatFooter.d.ts +6 -4
- package/dist/types/ChatFrame.d.ts +48 -23
- package/dist/types/ChatHistory.d.ts +7 -5
- package/dist/types/ChatLauncher.d.ts +3 -1
- package/dist/types/ChatLiveStatus.d.ts +9 -4
- package/dist/types/ChatMessageActions.d.ts +10 -7
- package/dist/types/ChatNudge.d.ts +11 -6
- package/dist/types/ChatOpenTickets.d.ts +10 -5
- package/dist/types/ChatPage.d.ts +40 -43
- package/dist/types/ChatPanel.d.ts +8 -5
- package/dist/types/ChatPastChats.d.ts +10 -5
- package/dist/types/ChatReadAloudButton.d.ts +8 -5
- package/dist/types/ChatShell.d.ts +42 -28
- package/dist/types/ChatStarters.d.ts +12 -5
- package/dist/types/ChatThread.d.ts +24 -12
- package/dist/types/chatLive.d.ts +19 -5
- package/dist/types/chatPrint.d.ts +7 -1
- package/dist/types/chatShared.d.ts +11 -8
- package/dist/types/dictationText.d.ts +4 -9
- package/dist/types/index.d.ts +21 -1
- package/dist/types/loaders/ChatLoader.d.ts +15 -16
- package/dist/types/loaders/OrbLoader.d.ts +6 -8
- package/dist/types/loaders/PhrasesLoader.d.ts +8 -10
- package/dist/types/loaders/SkeletonLoader.d.ts +6 -8
- package/dist/types/loaders/StepsLoader.d.ts +6 -8
- package/dist/types/loaders/TypingPill.d.ts +7 -8
- package/dist/types/recaptcha.d.ts +11 -1
- package/dist/types/renderers/ActionPart.d.ts +8 -4
- package/dist/types/renderers/ChartPart.d.ts +8 -4
- package/dist/types/renderers/ChatLinkContext.d.ts +5 -4
- package/dist/types/renderers/FigureText.d.ts +7 -5
- package/dist/types/renderers/FiguresPart.d.ts +8 -4
- package/dist/types/renderers/FilePart.d.ts +8 -4
- package/dist/types/renderers/HandoffPart.d.ts +8 -4
- package/dist/types/renderers/ImagePart.d.ts +8 -4
- package/dist/types/renderers/InputRequestPart.d.ts +12 -5
- package/dist/types/renderers/NoticePart.d.ts +8 -3
- package/dist/types/renderers/QuickRepliesPart.d.ts +11 -4
- package/dist/types/renderers/RecordCardPart.d.ts +8 -4
- package/dist/types/renderers/SourcesPart.d.ts +8 -4
- package/dist/types/renderers/TablePart.d.ts +8 -4
- package/dist/types/renderers/TextPart.d.ts +9 -5
- package/dist/types/renderers/TicketPart.d.ts +8 -4
- package/dist/types/renderers/VoiceClipPart.d.ts +8 -4
- package/dist/types/renderers/index.d.ts +35 -30
- package/dist/types/useAutoOpen.d.ts +10 -8
- package/dist/types/useChat.d.ts +43 -25
- package/dist/types/useChatDictation.d.ts +18 -19
- package/dist/types/useChatExplain.d.ts +14 -41
- package/dist/types/useChatHandoff.d.ts +2 -4
- package/dist/types/useChatReadAloud.d.ts +10 -11
- package/dist/types/useChatSound.d.ts +2 -1
- package/dist/types/useChatSpeech.d.ts +5 -3
- package/dist/types/useLauncherAvoid.d.ts +3 -1
- package/dist/types/useReducedMotion.d.ts +2 -1
- package/dist/types/useTranscriptActions.d.ts +11 -9
- package/package.json +24 -21
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param {object} options
|
|
6
|
-
* @param {import('@webority/chat-core').ChatSpeechAdapter | null} options.speech
|
|
7
|
-
* @param {boolean} options.enabled
|
|
8
|
-
* @param {import('@webority/chat-core').ChatLabels} options.labels
|
|
9
|
-
* @param {(text: string, final: boolean) => void} options.onText Receives the whole transcript so far.
|
|
10
|
-
*/
|
|
11
|
-
export default function useChatDictation({ speech, enabled, labels, onText }: {
|
|
12
|
-
speech: import('@webority/chat-core').ChatSpeechAdapter | null;
|
|
1
|
+
import type { ChatDictationState, ChatLabels, ChatSpeechAdapter } from "@webority/chat-core";
|
|
2
|
+
import { type RefObject } from "react";
|
|
3
|
+
export type UseChatDictationOptions = {
|
|
4
|
+
speech: ChatSpeechAdapter | null;
|
|
13
5
|
enabled: boolean;
|
|
14
|
-
labels:
|
|
6
|
+
labels: ChatLabels;
|
|
7
|
+
/** Receives the whole transcript so far. */
|
|
15
8
|
onText: (text: string, final: boolean) => void;
|
|
16
|
-
}
|
|
9
|
+
};
|
|
10
|
+
export type UseChatDictationResult = {
|
|
17
11
|
available: boolean;
|
|
18
12
|
listening: boolean;
|
|
19
|
-
note:
|
|
20
|
-
noteKind:
|
|
21
|
-
toggle: () =>
|
|
22
|
-
stop: () =>
|
|
23
|
-
buttonRef:
|
|
13
|
+
note: string | null;
|
|
14
|
+
noteKind: Exclude<ChatDictationState["status"], "Idle" | "Listening"> | null;
|
|
15
|
+
toggle: () => void;
|
|
16
|
+
stop: () => void;
|
|
17
|
+
buttonRef: RefObject<HTMLButtonElement | null>;
|
|
24
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The dictation control of the composer: the microphone state, the note after a dictation that could not
|
|
21
|
+
* start or heard nothing, and the actions. The timing rules live in chat-core createDictation.
|
|
22
|
+
*/
|
|
23
|
+
export default function useChatDictation({ speech, enabled, labels, onText }: UseChatDictationOptions): UseChatDictationResult;
|
|
@@ -1,57 +1,30 @@
|
|
|
1
|
+
import { type ChatExplainState } from "@webority/chat-core";
|
|
1
2
|
export type UseChatExplainResult = {
|
|
2
|
-
state:
|
|
3
|
-
/**
|
|
4
|
-
* Set only in the answered state.
|
|
5
|
-
*/
|
|
3
|
+
state: ChatExplainState;
|
|
4
|
+
/** Set only in the answered state. */
|
|
6
5
|
answer: unknown;
|
|
7
|
-
/**
|
|
8
|
-
* True from 300 ms after the request began, and for at least 500 ms.
|
|
9
|
-
*/
|
|
6
|
+
/** True from 300 ms after the request began, and for at least 500 ms. */
|
|
10
7
|
pillVisible: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Set only in the capacity state.
|
|
13
|
-
*/
|
|
8
|
+
/** Set only in the capacity state. */
|
|
14
9
|
resetsDateTimeUtc: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* True while the browser reports no connection.
|
|
17
|
-
*/
|
|
10
|
+
/** True while the browser reports no connection. */
|
|
18
11
|
offline: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Starts a request; supersedes one in flight.
|
|
21
|
-
*/
|
|
12
|
+
/** Starts a request; supersedes one in flight. */
|
|
22
13
|
ask: () => void;
|
|
23
|
-
/**
|
|
24
|
-
* Back to idle; drops any answer in flight.
|
|
25
|
-
*/
|
|
14
|
+
/** Back to idle; drops any answer in flight. */
|
|
26
15
|
reset: () => void;
|
|
27
16
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* @property {string | null} resetsDateTimeUtc Set only in the capacity state.
|
|
34
|
-
* @property {boolean} offline True while the browser reports no connection.
|
|
35
|
-
* @property {() => void} ask Starts a request; supersedes one in flight.
|
|
36
|
-
* @property {() => void} reset Back to idle; drops any answer in flight.
|
|
37
|
-
*/
|
|
17
|
+
export type UseChatExplainOptions = {
|
|
18
|
+
/** Fetches the answer. Read through a ref, so a new function each render is free. */
|
|
19
|
+
request: (signal: AbortSignal) => Promise<unknown>;
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
};
|
|
38
22
|
/**
|
|
39
23
|
* The state of one "Why?" explanation. The timing and the state classification live in the engine
|
|
40
24
|
* (createExplain); this hook only subscribes to it.
|
|
41
|
-
*
|
|
42
|
-
* @param {object} options
|
|
43
|
-
* @param {(signal: AbortSignal) => Promise<unknown>} options.request Fetches the answer. Read through a ref, so a new function each render is free.
|
|
44
|
-
* @param {boolean} [options.enabled]
|
|
45
|
-
* @returns {UseChatExplainResult}
|
|
46
25
|
*/
|
|
47
|
-
export default function useChatExplain({ request, enabled }:
|
|
48
|
-
request: (signal: AbortSignal) => Promise<unknown>;
|
|
49
|
-
enabled?: boolean;
|
|
50
|
-
}): UseChatExplainResult;
|
|
26
|
+
export default function useChatExplain({ request, enabled }: UseChatExplainOptions): UseChatExplainResult;
|
|
51
27
|
/**
|
|
52
28
|
* The reset time of a capacity limit, in the viewer's zone and locale; empty when the value is missing or invalid.
|
|
53
|
-
*
|
|
54
|
-
* @param {string | null | undefined} iso
|
|
55
|
-
* @returns {string}
|
|
56
29
|
*/
|
|
57
30
|
export declare function formatResetTime(iso: string | null | undefined): string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import type { ChatSessionState } from "@webority/chat-core";
|
|
1
2
|
/**
|
|
2
3
|
* Applies a hand-over from the page that opened the chat: a conversation to open and a draft to fill.
|
|
3
4
|
* It is read once, when the chat mounts; a later handoff is not applied. The ref guard keeps a
|
|
4
5
|
* StrictMode replay from applying it twice.
|
|
5
|
-
*
|
|
6
|
-
* @param {import("@webority/chat-core").ChatSessionState & { openConversation: (id: string) => Promise<void>, session: { open: (options: { draft?: string }) => void } }} chat
|
|
7
|
-
* @param {{ conversationId?: string | null, draft?: string | null } | null | undefined} handoff
|
|
8
6
|
*/
|
|
9
|
-
export default function useChatHandoff(chat:
|
|
7
|
+
export default function useChatHandoff(chat: ChatSessionState & {
|
|
10
8
|
openConversation: (id: string) => Promise<void>;
|
|
11
9
|
session: {
|
|
12
10
|
open: (options: {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @param {object} options
|
|
5
|
-
* @param {import('@webority/chat-core').ChatSpeechAdapter | null} options.speech
|
|
6
|
-
* @param {boolean} options.enabled
|
|
7
|
-
*/
|
|
8
|
-
export default function useChatReadAloud({ speech, enabled }: {
|
|
9
|
-
speech: import('@webority/chat-core').ChatSpeechAdapter | null;
|
|
1
|
+
import type { ChatSpeechAdapter } from "@webority/chat-core";
|
|
2
|
+
export type UseChatReadAloudOptions = {
|
|
3
|
+
speech: ChatSpeechAdapter | null;
|
|
10
4
|
enabled: boolean;
|
|
11
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export type UseChatReadAloudResult = {
|
|
12
7
|
available: boolean;
|
|
13
8
|
speaking: boolean;
|
|
14
9
|
failed: boolean;
|
|
15
|
-
toggle: (text:
|
|
10
|
+
toggle: (text: string) => void;
|
|
16
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Read-aloud for one message: speaks its text through the speech adapter and reports whether it is speaking or failed.
|
|
14
|
+
*/
|
|
15
|
+
export default function useChatReadAloud({ speech, enabled }: UseChatReadAloudOptions): UseChatReadAloudResult;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ChatSessionState } from "@webority/chat-core";
|
|
1
2
|
/**
|
|
2
3
|
* Plays the open cue when the panel opens, and the sent and reply cues for each new message, as the web element does:
|
|
3
4
|
* a send, an edit and a retry each add a new visitor message, so each plays the sent cue once; an assistant, script or
|
|
4
5
|
* agent message plays the reply cue and vibrates. Restored messages, notices and a history load stay silent. The
|
|
5
6
|
* visitor message that the server's copy replaces after a turn is stored, so it does not play the sent cue again.
|
|
6
7
|
*/
|
|
7
|
-
export default function useChatSound(chat:
|
|
8
|
+
export default function useChatSound(chat: Pick<ChatSessionState, "features" | "loading" | "messages" | "muted" | "open" | "profile">): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ChatClient, ChatSessionState, ChatSpeechAdapter } from "@webority/chat-core";
|
|
1
2
|
/**
|
|
2
3
|
* The speech adapter for this chat, or null when the profile has no speech package or neither dictation nor read-aloud is on.
|
|
3
4
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @returns {import('@webority/chat-core').ChatSpeechAdapter | null}
|
|
5
|
+
* @param chat The chat state from useChat.
|
|
6
6
|
*/
|
|
7
|
-
export default function useChatSpeech(chat:
|
|
7
|
+
export default function useChatSpeech(chat: Pick<ChatSessionState, "features" | "profile"> & {
|
|
8
|
+
client: ChatClient;
|
|
9
|
+
}): ChatSpeechAdapter | null;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ChatLauncherSettings, ChatLook } from "@webority/chat-core";
|
|
2
|
+
import { type RefObject } from "react";
|
|
3
|
+
export default function useLauncherAvoid(ref: RefObject<HTMLElement | null>, avoid: ChatLook["avoid"], launcher: ChatLauncherSettings | null, enabled: boolean): void;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ChatExperienceSettings, ChatLook } from "@webority/chat-core";
|
|
2
|
+
export default function useReducedMotion(look: ChatLook, experience: ChatExperienceSettings | null): boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
shareReply: (message: any) => Promise<void>;
|
|
9
|
-
printReply: (message: any) => void;
|
|
1
|
+
import type { ChatLabels, ChatLiveMessage, ChatSessionState } from "@webority/chat-core";
|
|
2
|
+
export type UseTranscriptActionsResult = {
|
|
3
|
+
canShare: boolean;
|
|
4
|
+
canPrint: boolean;
|
|
5
|
+
notice: string | null;
|
|
6
|
+
shareReply: (message: ChatLiveMessage) => Promise<void>;
|
|
7
|
+
printReply: (message: ChatLiveMessage) => void;
|
|
10
8
|
shareConversation: () => Promise<void>;
|
|
11
9
|
printConversation: () => void;
|
|
12
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Share and print for one reply or the whole conversation, built from the same transcript model.
|
|
13
|
+
*/
|
|
14
|
+
export default function useTranscriptActions(chat: Pick<ChatSessionState, "features" | "messages" | "profile" | "title">, labels: ChatLabels): UseTranscriptActionsResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/chat-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.142.0",
|
|
4
4
|
"description": "The Webority Chat React screens: launcher, docked, full-page and embedded shells, thread, composer, one renderer per message part kind and the useChat hook, built on @webority/chat-core and @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
@@ -26,39 +26,42 @@
|
|
|
26
26
|
},
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@webority/chat-core": "0.
|
|
30
|
-
"@webority/chat-elements": "0.
|
|
31
|
-
"@webority/markdown-core": "^0.
|
|
32
|
-
"@webority/ui-react": "^0.
|
|
29
|
+
"@webority/chat-core": "0.142.0",
|
|
30
|
+
"@webority/chat-elements": "0.142.0",
|
|
31
|
+
"@webority/markdown-core": "^0.150.0",
|
|
32
|
+
"@webority/ui-react": "^0.150.0",
|
|
33
33
|
"react": "^19.0.0",
|
|
34
|
-
"react-dom": "^19.0.0"
|
|
34
|
+
"react-dom": "^19.0.0",
|
|
35
|
+
"react-router": "^8.5.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@testing-library/dom": "10.4.2",
|
|
38
39
|
"@testing-library/jest-dom": "7.0.1",
|
|
39
40
|
"@testing-library/react": "^16.3.0",
|
|
40
41
|
"@testing-library/user-event": "^14.6.1",
|
|
41
|
-
"@types/react": "^19.
|
|
42
|
-
"@vitejs/plugin-react": "^6.0
|
|
43
|
-
"@vitest/coverage-v8": "5.0
|
|
44
|
-
"@webority/analytics": "0.
|
|
45
|
-
"@webority/chat-core": "0.
|
|
46
|
-
"@webority/chat-elements": "0.
|
|
47
|
-
"@webority/markdown-core": "0.
|
|
48
|
-
"@webority/ui-elements": "0.
|
|
49
|
-
"@webority/ui-react": "0.
|
|
50
|
-
"bootstrap": "5.3.
|
|
42
|
+
"@types/react": "^19.3.0",
|
|
43
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
44
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
45
|
+
"@webority/analytics": "0.38.2",
|
|
46
|
+
"@webority/chat-core": "0.142.0",
|
|
47
|
+
"@webority/chat-elements": "0.142.0",
|
|
48
|
+
"@webority/markdown-core": "0.150.0",
|
|
49
|
+
"@webority/ui-elements": "0.150.0",
|
|
50
|
+
"@webority/ui-react": "0.150.0",
|
|
51
|
+
"bootstrap": "5.3.8",
|
|
51
52
|
"jsdom": "30.1.1",
|
|
52
|
-
"react": "19.
|
|
53
|
+
"react": "19.3.1",
|
|
53
54
|
"react-bootstrap": "^2.10.6",
|
|
54
|
-
"react-dom": "19.
|
|
55
|
+
"react-dom": "19.3.1",
|
|
56
|
+
"react-router": "^8.5.1",
|
|
55
57
|
"typescript": "^7.0.2",
|
|
56
|
-
"vite": "^8.
|
|
57
|
-
"vitest": "5.0
|
|
58
|
+
"vite": "^8.3.6",
|
|
59
|
+
"vitest": "5.1.0"
|
|
58
60
|
},
|
|
59
61
|
"scripts": {
|
|
60
62
|
"build": "vite build && tsc -p tsconfig.json",
|
|
61
|
-
"
|
|
63
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
64
|
+
"test": "tsc -p tsconfig.test.json && vitest run",
|
|
62
65
|
"test:watch": "vitest"
|
|
63
66
|
}
|
|
64
67
|
}
|