@webority/mobile-chat 0.133.0 → 0.135.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/lib/commonjs/AgentByline.js +1 -1
- package/lib/commonjs/ChatAppearanceScope.js +1 -0
- package/lib/commonjs/ChatComposer.js +1 -1
- package/lib/commonjs/ChatConversationActions.js +1 -1
- package/lib/commonjs/ChatDictationButton.js +1 -1
- package/lib/commonjs/ChatEmbed.js +1 -1
- package/lib/commonjs/ChatFooter.js +1 -1
- package/lib/commonjs/ChatFrame.js +1 -1
- package/lib/commonjs/ChatHistory.js +1 -1
- package/lib/commonjs/ChatLauncher.js +1 -0
- package/lib/commonjs/ChatLiveBar.js +1 -1
- package/lib/commonjs/ChatMessageActions.js +1 -1
- package/lib/commonjs/ChatNudge.js +1 -1
- package/lib/commonjs/ChatOpenTickets.js +1 -1
- package/lib/commonjs/ChatPanel.js +1 -0
- package/lib/commonjs/ChatPastChats.js +1 -0
- package/lib/commonjs/ChatScreen.js +1 -1
- package/lib/commonjs/ChatSheet.js +1 -1
- package/lib/commonjs/ChatStarters.js +1 -1
- package/lib/commonjs/ChatThread.js +1 -1
- package/lib/commonjs/ReadAloudButton.js +1 -1
- package/lib/commonjs/chatShared.js +1 -1
- package/lib/commonjs/features.map.json +3 -3
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/loaders/ChatLoader.js +1 -1
- package/lib/commonjs/renderers/ActionPart.js +1 -1
- package/lib/commonjs/renderers/ChartPart.js +1 -1
- package/lib/commonjs/renderers/FigureText.js +1 -1
- package/lib/commonjs/renderers/FiguresPart.js +1 -1
- package/lib/commonjs/renderers/FilePart.js +1 -1
- package/lib/commonjs/renderers/HandoffPart.js +1 -1
- package/lib/commonjs/renderers/ImagePart.js +1 -1
- package/lib/commonjs/renderers/InputRequestPart.js +1 -1
- package/lib/commonjs/renderers/NoticePart.js +1 -1
- package/lib/commonjs/renderers/QuickRepliesPart.js +1 -1
- package/lib/commonjs/renderers/RecordCardPart.js +1 -1
- package/lib/commonjs/renderers/SourcesPart.js +1 -1
- package/lib/commonjs/renderers/TablePart.js +1 -1
- package/lib/commonjs/renderers/TicketPart.js +1 -1
- package/lib/commonjs/renderers/VoiceClipPart.js +1 -1
- package/lib/commonjs/speech/phoneSpeech.js +1 -1
- package/lib/commonjs/speech/speechText.js +1 -1
- package/lib/commonjs/useChat.js +1 -1
- package/lib/commonjs/useChatHaptics.js +1 -1
- package/lib/commonjs/useChatSound.js +1 -0
- package/lib/module/AgentByline.js +1 -1
- package/lib/module/ChatAppearanceScope.js +1 -0
- package/lib/module/ChatComposer.js +1 -1
- package/lib/module/ChatConversationActions.js +1 -1
- package/lib/module/ChatDictationButton.js +1 -1
- package/lib/module/ChatEmbed.js +1 -1
- package/lib/module/ChatFooter.js +1 -1
- package/lib/module/ChatFrame.js +1 -1
- package/lib/module/ChatHistory.js +1 -1
- package/lib/module/ChatLauncher.js +1 -0
- package/lib/module/ChatLiveBar.js +1 -1
- package/lib/module/ChatMessageActions.js +1 -1
- package/lib/module/ChatNudge.js +1 -1
- package/lib/module/ChatOpenTickets.js +1 -1
- package/lib/module/ChatPanel.js +1 -0
- package/lib/module/ChatPastChats.js +1 -0
- package/lib/module/ChatScreen.js +1 -1
- package/lib/module/ChatSheet.js +1 -1
- package/lib/module/ChatStarters.js +1 -1
- package/lib/module/ChatThread.js +1 -1
- package/lib/module/ReadAloudButton.js +1 -1
- package/lib/module/chatShared.js +1 -1
- package/lib/module/features.map.json +3 -3
- package/lib/module/index.js +1 -1
- package/lib/module/loaders/ChatLoader.js +1 -1
- package/lib/module/renderers/ActionPart.js +1 -1
- package/lib/module/renderers/ChartPart.js +1 -1
- package/lib/module/renderers/FigureText.js +1 -1
- package/lib/module/renderers/FiguresPart.js +1 -1
- package/lib/module/renderers/FilePart.js +1 -1
- package/lib/module/renderers/HandoffPart.js +1 -1
- package/lib/module/renderers/ImagePart.js +1 -1
- package/lib/module/renderers/InputRequestPart.js +1 -1
- package/lib/module/renderers/NoticePart.js +1 -1
- package/lib/module/renderers/QuickRepliesPart.js +1 -1
- package/lib/module/renderers/RecordCardPart.js +1 -1
- package/lib/module/renderers/SourcesPart.js +1 -1
- package/lib/module/renderers/TablePart.js +1 -1
- package/lib/module/renderers/TicketPart.js +1 -1
- package/lib/module/renderers/VoiceClipPart.js +1 -1
- package/lib/module/speech/phoneSpeech.js +1 -1
- package/lib/module/speech/speechText.js +1 -1
- package/lib/module/useChat.js +1 -1
- package/lib/module/useChatHaptics.js +1 -1
- package/lib/module/useChatSound.js +1 -0
- package/lib/typescript/commonjs/ChatAppearanceScope.d.ts +11 -0
- package/lib/typescript/commonjs/ChatComposer.d.ts +5 -2
- package/lib/typescript/commonjs/ChatConversationActions.d.ts +1 -1
- package/lib/typescript/commonjs/ChatDictationButton.d.ts +3 -1
- package/lib/typescript/commonjs/ChatEmbed.d.ts +1 -1
- package/lib/typescript/commonjs/ChatFrame.d.ts +15 -4
- package/lib/typescript/commonjs/ChatLauncher.d.ts +22 -0
- package/lib/typescript/commonjs/ChatPanel.d.ts +39 -0
- package/lib/typescript/commonjs/ChatPastChats.d.ts +21 -0
- package/lib/typescript/commonjs/ChatScreen.d.ts +1 -1
- package/lib/typescript/commonjs/ChatSheet.d.ts +1 -6
- package/lib/typescript/commonjs/ChatThread.d.ts +3 -1
- package/lib/typescript/commonjs/chatShared.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/renderers/ChartPart.d.ts +1 -1
- package/lib/typescript/commonjs/renderers/FigureText.d.ts +4 -2
- package/lib/typescript/commonjs/renderers/HandoffPart.d.ts +1 -1
- package/lib/typescript/commonjs/renderers/ImagePart.d.ts +2 -1
- package/lib/typescript/commonjs/renderers/VoiceClipPart.d.ts +1 -1
- package/lib/typescript/commonjs/speech/speechText.d.ts +3 -3
- package/lib/typescript/commonjs/types.d.ts +28 -2
- package/lib/typescript/commonjs/useChat.d.ts +2 -0
- package/lib/typescript/commonjs/useChatSound.d.ts +35 -0
- package/lib/typescript/module/ChatAppearanceScope.d.ts +11 -0
- package/lib/typescript/module/ChatComposer.d.ts +5 -2
- package/lib/typescript/module/ChatConversationActions.d.ts +1 -1
- package/lib/typescript/module/ChatDictationButton.d.ts +3 -1
- package/lib/typescript/module/ChatEmbed.d.ts +1 -1
- package/lib/typescript/module/ChatFrame.d.ts +15 -4
- package/lib/typescript/module/ChatLauncher.d.ts +22 -0
- package/lib/typescript/module/ChatPanel.d.ts +39 -0
- package/lib/typescript/module/ChatPastChats.d.ts +21 -0
- package/lib/typescript/module/ChatScreen.d.ts +1 -1
- package/lib/typescript/module/ChatSheet.d.ts +1 -6
- package/lib/typescript/module/ChatThread.d.ts +3 -1
- package/lib/typescript/module/chatShared.d.ts +2 -0
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/renderers/ChartPart.d.ts +1 -1
- package/lib/typescript/module/renderers/FigureText.d.ts +4 -2
- package/lib/typescript/module/renderers/HandoffPart.d.ts +1 -1
- package/lib/typescript/module/renderers/ImagePart.d.ts +2 -1
- package/lib/typescript/module/renderers/VoiceClipPart.d.ts +1 -1
- package/lib/typescript/module/speech/speechText.d.ts +3 -3
- package/lib/typescript/module/types.d.ts +28 -2
- package/lib/typescript/module/useChat.d.ts +2 -0
- package/lib/typescript/module/useChatSound.d.ts +35 -0
- package/package.json +10 -9
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ChatPart } from "@webority/chat-core";
|
|
2
|
+
import type React from "react";
|
|
2
3
|
import type { ChatPartRendererProps } from "../types.js";
|
|
3
4
|
type ImagePartProps = ChatPartRendererProps<Extract<ChatPart, {
|
|
4
5
|
kind: "Image";
|
|
5
6
|
}>>;
|
|
6
|
-
export declare function ImagePart({ part, turn }: Pick<ImagePartProps, "part" | "turn">):
|
|
7
|
+
export declare function ImagePart({ part, turn }: Pick<ImagePartProps, "part" | "turn">): React.JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=ImagePart.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare const DEFAULT_SPEECH_LANGUAGE = "en-IN";
|
|
2
2
|
export declare const DEFAULT_SPEECH_VOICE = "en-IN-NeerjaNeural";
|
|
3
|
-
export declare const MAX_SPEAK_CHARS =
|
|
4
|
-
export declare const MAX_DICTATION_MS =
|
|
3
|
+
export declare const MAX_SPEAK_CHARS = 6000;
|
|
4
|
+
export declare const MAX_DICTATION_MS = 300000;
|
|
5
5
|
export declare const MIN_DICTATION_MS = 600;
|
|
6
6
|
/** The file extension a recording's bytes stand for. m4a is the fallback, the format the phone records. */
|
|
7
7
|
export declare function audioExtension(bytes: Uint8Array): string;
|
|
8
8
|
export declare function escapeSsml(text: string): string;
|
|
9
9
|
export declare function buildSsml(text: string, language: string, voice: string): string;
|
|
10
|
-
/** Cuts at the last sentence end
|
|
10
|
+
/** Cuts at the last sentence end within the limit, so a long reply is read whole sentences at a time. */
|
|
11
11
|
export declare function clampSpeakText(text: string): string;
|
|
12
12
|
/** Whole seconds as m:ss. A negative or non-finite value reads as 0:00. */
|
|
13
13
|
export declare function formatClipTime(ms: number): string;
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
import type { ChatLiveMessage, ChatPart, ChatPartKind, ChatTurnApi, ChatUploadFile } from "@webority/chat-core";
|
|
2
2
|
import type React from "react";
|
|
3
|
-
|
|
3
|
+
import type { View } from "react-native";
|
|
4
|
+
export type { ChatLookInput, ChatMotion } from "@webority/chat-core";
|
|
5
|
+
/**
|
|
6
|
+
* The web chat's appearance keys that the phone reads, under the names applyAppearance and the
|
|
7
|
+
* CSS variables use on the web. Each key the phone has no part for is left out, never accepted and ignored.
|
|
8
|
+
*/
|
|
9
|
+
export interface ChatAppearance {
|
|
10
|
+
/** Which side the launcher sits on. Default "end". */
|
|
11
|
+
position?: "end" | "start";
|
|
12
|
+
/** Launcher offset from the side edge, in px. */
|
|
13
|
+
offsetX?: number;
|
|
14
|
+
/** Launcher offset from the bottom edge, in px. */
|
|
15
|
+
offsetY?: number;
|
|
16
|
+
/** Accent colour as a hex string, or null for the theme's primary. */
|
|
17
|
+
"--wui-chat-accent"?: string | null;
|
|
18
|
+
/** Corner radius as a px length such as "14px", or null for the theme's radius. */
|
|
19
|
+
"--wui-chat-radius"?: string | null;
|
|
20
|
+
/** A font as the web names it: "var(--wui-font-display)" draws the display face, anything else the theme's UI face. */
|
|
21
|
+
"--wui-chat-font"?: string | null;
|
|
22
|
+
}
|
|
23
|
+
/** Host values the thread adds to each part's turn: the host's link resolver and the source rows a citation focuses. */
|
|
24
|
+
export interface ChatTurnHostApi {
|
|
25
|
+
resolveLink?: (href: string) => string | null;
|
|
26
|
+
registerSourceRow?: (marker: string, row: View | null) => void;
|
|
27
|
+
/** Moves focus to the composer input after a quick reply is chosen. */
|
|
28
|
+
focusComposer?: () => void;
|
|
29
|
+
}
|
|
4
30
|
export type ChatPartRendererProps<P extends ChatPart = ChatPart> = {
|
|
5
31
|
part: P;
|
|
6
32
|
message: ChatLiveMessage;
|
|
7
|
-
turn: ChatTurnApi;
|
|
33
|
+
turn: ChatTurnApi & ChatTurnHostApi;
|
|
8
34
|
pickAttachments?: () => Promise<ChatUploadFile[]>;
|
|
9
35
|
};
|
|
10
36
|
export type ChatRenderers = Partial<{
|
|
@@ -33,6 +33,8 @@ export interface UseChatResult extends ChatSessionState, ChatActions {
|
|
|
33
33
|
emit: (name: string, data: Record<string, unknown>) => void;
|
|
34
34
|
/** The host reports whether the chat is on screen; the live stream runs only while it is and the app is active. */
|
|
35
35
|
setChatVisible: (visible: boolean) => void;
|
|
36
|
+
/** The message of the last hand-off request that failed, cleared by the next request. */
|
|
37
|
+
handoffError: string | null;
|
|
36
38
|
/** Present only when the host passed `onNavigate`; the turn API of each message hands relative links to it. */
|
|
37
39
|
onNavigate?: (path: string) => void;
|
|
38
40
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { UseChatResult } from "./useChat.js";
|
|
2
|
+
/**
|
|
3
|
+
* Plays the open cue when the panel opens, and the sent and reply cues for each new message, as the web chat does
|
|
4
|
+
* (chat-elements/src/WuiChat.js _playSounds). A send, an edit and a retry each add a new visitor message; an assistant,
|
|
5
|
+
* script or agent message plays the reply cue. Restored messages, notices and a history load stay silent, and the
|
|
6
|
+
* visitor message the server's copy replaces after a turn is stored, so it does not play the sent cue again.
|
|
7
|
+
* The phone has no WebAudio, so each cue is a short 16-bit WAV written once to the cache and played from there.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CUES: {
|
|
10
|
+
readonly open: {
|
|
11
|
+
readonly from: 420;
|
|
12
|
+
readonly to: 920;
|
|
13
|
+
readonly seconds: 0.16;
|
|
14
|
+
readonly peak: 0.16;
|
|
15
|
+
};
|
|
16
|
+
readonly reply: {
|
|
17
|
+
readonly from: 680;
|
|
18
|
+
readonly to: 540;
|
|
19
|
+
readonly seconds: 0.11;
|
|
20
|
+
readonly peak: 0.06;
|
|
21
|
+
};
|
|
22
|
+
readonly sent: {
|
|
23
|
+
readonly from: 540;
|
|
24
|
+
readonly to: 760;
|
|
25
|
+
readonly seconds: 0.09;
|
|
26
|
+
readonly peak: 0.05;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Plays one cue at the given volume (0 to 1). The file is written on the first play and reused after that.
|
|
31
|
+
* A failure is logged, never thrown, so a missing sound never breaks the chat.
|
|
32
|
+
*/
|
|
33
|
+
export declare function playCue(name: keyof typeof CUES, volume?: number): void;
|
|
34
|
+
export declare function useChatSound(chat: UseChatResult): void;
|
|
35
|
+
//# sourceMappingURL=useChatSound.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.135.0",
|
|
4
4
|
"description": "Webority Chat for React Native apps: the chat screen, sheet and embedded shells, thread, composer, one renderer per message part kind and the useChat hook, built on @webority/chat-core and @webority/mobile-ui.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -42,9 +42,10 @@
|
|
|
42
42
|
"!**/*.map"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@webority/chat-core": "0.
|
|
46
|
-
"@webority/
|
|
47
|
-
"@webority/mobile-
|
|
45
|
+
"@webority/chat-core": "0.135.0",
|
|
46
|
+
"@webority/markdown-core": "^0.131.0",
|
|
47
|
+
"@webority/mobile-core": "^0.131.0",
|
|
48
|
+
"@webority/mobile-ui": "^0.131.0",
|
|
48
49
|
"expo-audio": ">=57.0.0",
|
|
49
50
|
"expo-file-system": ">=57.0.0",
|
|
50
51
|
"react": "^19.1.0",
|
|
@@ -96,11 +97,11 @@
|
|
|
96
97
|
"@react-native/metro-config": "0.86.3",
|
|
97
98
|
"@testing-library/react-native": "12.9.0",
|
|
98
99
|
"@types/react": "19.2.18",
|
|
99
|
-
"@webority/canvas-kit": "0.
|
|
100
|
-
"@webority/chat-core": "0.
|
|
101
|
-
"@webority/markdown-core": "0.
|
|
102
|
-
"@webority/mobile-core": "0.
|
|
103
|
-
"@webority/mobile-ui": "0.
|
|
100
|
+
"@webority/canvas-kit": "0.131.0",
|
|
101
|
+
"@webority/chat-core": "0.135.0",
|
|
102
|
+
"@webority/markdown-core": "0.131.0",
|
|
103
|
+
"@webority/mobile-core": "0.131.0",
|
|
104
|
+
"@webority/mobile-ui": "0.131.0",
|
|
104
105
|
"babel-jest": "29.7.0",
|
|
105
106
|
"expo": "57.0.31",
|
|
106
107
|
"expo-application": "57.0.3",
|