@webority/mobile-chat 0.141.0 → 0.143.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.
Files changed (99) hide show
  1. package/lib/commonjs/AgentByline.js +1 -1
  2. package/lib/commonjs/ChatComposer.js +1 -1
  3. package/lib/commonjs/ChatConversationActions.js +1 -1
  4. package/lib/commonjs/ChatLauncher.js +1 -1
  5. package/lib/commonjs/ChatMessageActions.js +1 -1
  6. package/lib/commonjs/ChatOpenTickets.js +1 -1
  7. package/lib/commonjs/ChatPastChats.js +1 -1
  8. package/lib/commonjs/ChatSheet.js +1 -1
  9. package/lib/commonjs/ChatStarters.js +1 -1
  10. package/lib/commonjs/ChatThread.js +1 -1
  11. package/lib/commonjs/chatShared.js +1 -1
  12. package/lib/commonjs/expoModules.js +1 -0
  13. package/lib/commonjs/iconName.js +1 -0
  14. package/lib/commonjs/loaders/ChatLoader.js +1 -1
  15. package/lib/commonjs/renderers/ActionPart.js +1 -1
  16. package/lib/commonjs/renderers/ChartPart.js +1 -1
  17. package/lib/commonjs/renderers/FigureText.js +1 -1
  18. package/lib/commonjs/renderers/FilePart.js +1 -1
  19. package/lib/commonjs/renderers/HandoffPart.js +1 -1
  20. package/lib/commonjs/renderers/InputRequestPart.js +1 -1
  21. package/lib/commonjs/renderers/NoticePart.js +1 -1
  22. package/lib/commonjs/renderers/QuickRepliesPart.js +1 -1
  23. package/lib/commonjs/renderers/SourcesPart.js +1 -1
  24. package/lib/commonjs/renderers/TextPart.js +1 -1
  25. package/lib/commonjs/renderers/VoiceClipPart.js +1 -1
  26. package/lib/commonjs/speech/azureSpeech.js +1 -1
  27. package/lib/commonjs/speech/expoAudio.js +1 -1
  28. package/lib/commonjs/speech/phoneSpeech.js +1 -1
  29. package/lib/commonjs/useChat.js +1 -1
  30. package/lib/commonjs/useChatSound.js +1 -1
  31. package/lib/commonjs/useTranscriptActions.js +1 -1
  32. package/lib/module/AgentByline.js +1 -1
  33. package/lib/module/ChatComposer.js +1 -1
  34. package/lib/module/ChatConversationActions.js +1 -1
  35. package/lib/module/ChatLauncher.js +1 -1
  36. package/lib/module/ChatMessageActions.js +1 -1
  37. package/lib/module/ChatOpenTickets.js +1 -1
  38. package/lib/module/ChatPastChats.js +1 -1
  39. package/lib/module/ChatSheet.js +1 -1
  40. package/lib/module/ChatStarters.js +1 -1
  41. package/lib/module/ChatThread.js +1 -1
  42. package/lib/module/chatShared.js +1 -1
  43. package/lib/module/expoModules.js +1 -0
  44. package/lib/module/iconName.js +1 -0
  45. package/lib/module/loaders/ChatLoader.js +1 -1
  46. package/lib/module/renderers/ActionPart.js +1 -1
  47. package/lib/module/renderers/ChartPart.js +1 -1
  48. package/lib/module/renderers/FigureText.js +1 -1
  49. package/lib/module/renderers/FilePart.js +1 -1
  50. package/lib/module/renderers/HandoffPart.js +1 -1
  51. package/lib/module/renderers/InputRequestPart.js +1 -1
  52. package/lib/module/renderers/NoticePart.js +1 -1
  53. package/lib/module/renderers/QuickRepliesPart.js +1 -1
  54. package/lib/module/renderers/SourcesPart.js +1 -1
  55. package/lib/module/renderers/TextPart.js +1 -1
  56. package/lib/module/renderers/VoiceClipPart.js +1 -1
  57. package/lib/module/speech/azureSpeech.js +1 -1
  58. package/lib/module/speech/expoAudio.js +1 -1
  59. package/lib/module/speech/phoneSpeech.js +1 -1
  60. package/lib/module/useChat.js +1 -1
  61. package/lib/module/useChatSound.js +1 -1
  62. package/lib/module/useTranscriptActions.js +1 -1
  63. package/lib/typescript/commonjs/ChatAppearanceScope.d.ts +1 -1
  64. package/lib/typescript/commonjs/ChatComposer.d.ts +6 -6
  65. package/lib/typescript/commonjs/ChatFrame.d.ts +17 -17
  66. package/lib/typescript/commonjs/ChatOpenTickets.d.ts +1 -1
  67. package/lib/typescript/commonjs/ChatSheet.d.ts +3 -3
  68. package/lib/typescript/commonjs/ChatStarters.d.ts +1 -1
  69. package/lib/typescript/commonjs/ChatThread.d.ts +13 -13
  70. package/lib/typescript/commonjs/chatShared.d.ts +2 -1
  71. package/lib/typescript/commonjs/expoModules.d.ts +58 -0
  72. package/lib/typescript/commonjs/iconName.d.ts +3 -0
  73. package/lib/typescript/commonjs/renderers/ActionPart.d.ts +6 -1
  74. package/lib/typescript/commonjs/renderers/FilePart.d.ts +4 -1
  75. package/lib/typescript/commonjs/renderers/InputRequestPart.d.ts +6 -1
  76. package/lib/typescript/commonjs/renderers/NoticePart.d.ts +1 -1
  77. package/lib/typescript/commonjs/renderers/index.d.ts +40 -2
  78. package/lib/typescript/commonjs/types.d.ts +1 -1
  79. package/lib/typescript/commonjs/useChat.d.ts +2 -2
  80. package/lib/typescript/commonjs/useChatSound.d.ts +1 -1
  81. package/lib/typescript/module/ChatAppearanceScope.d.ts +1 -1
  82. package/lib/typescript/module/ChatComposer.d.ts +6 -6
  83. package/lib/typescript/module/ChatFrame.d.ts +17 -17
  84. package/lib/typescript/module/ChatOpenTickets.d.ts +1 -1
  85. package/lib/typescript/module/ChatSheet.d.ts +3 -3
  86. package/lib/typescript/module/ChatStarters.d.ts +1 -1
  87. package/lib/typescript/module/ChatThread.d.ts +13 -13
  88. package/lib/typescript/module/chatShared.d.ts +2 -1
  89. package/lib/typescript/module/expoModules.d.ts +58 -0
  90. package/lib/typescript/module/iconName.d.ts +3 -0
  91. package/lib/typescript/module/renderers/ActionPart.d.ts +6 -1
  92. package/lib/typescript/module/renderers/FilePart.d.ts +4 -1
  93. package/lib/typescript/module/renderers/InputRequestPart.d.ts +6 -1
  94. package/lib/typescript/module/renderers/NoticePart.d.ts +1 -1
  95. package/lib/typescript/module/renderers/index.d.ts +40 -2
  96. package/lib/typescript/module/types.d.ts +1 -1
  97. package/lib/typescript/module/useChat.d.ts +2 -2
  98. package/lib/typescript/module/useChatSound.d.ts +1 -1
  99. package/package.json +11 -11
@@ -6,8 +6,8 @@ import type { UseChatResult } from "./useChat.js";
6
6
  export interface ChatThreadProps {
7
7
  chat: UseChatResult;
8
8
  labels: ChatLabels;
9
- renderers?: ChatRenderers;
10
- layoutParts?: ChatLayoutParts;
9
+ renderers?: ChatRenderers | undefined;
10
+ layoutParts?: ChatLayoutParts | undefined;
11
11
  loader?: ChatLoaderStyle;
12
12
  motion?: ChatMotion;
13
13
  /** The assistant's picture, drawn beside its replies. */
@@ -16,18 +16,18 @@ export interface ChatThreadProps {
16
16
  replyAvatars?: boolean;
17
17
  /** A ring turns around the thinking mark and the streaming reply's picture. Off unless the look sets it. */
18
18
  expressive?: boolean;
19
- pickAttachments?: PickAttachments;
20
- onOpenAttachment?: (part: Extract<ChatPart, {
19
+ pickAttachments?: PickAttachments | undefined;
20
+ onOpenAttachment?: ((part: Extract<ChatPart, {
21
21
  kind: "File";
22
- }>) => void;
23
- onOpenTarget?: (target: string) => void;
24
- onNavigate?: (path: string) => void;
25
- openTicket?: ChatOpenTicketHandler;
26
- handoffHosts?: readonly string[];
27
- resolveLink?: (href: string) => string | null;
28
- focusComposer?: () => void;
29
- keyboardAware?: boolean;
30
- keyboardOffset?: number;
22
+ }>) => void) | undefined;
23
+ onOpenTarget?: ((target: string) => void) | undefined;
24
+ onNavigate?: ((path: string) => void) | undefined;
25
+ openTicket?: ChatOpenTicketHandler | undefined;
26
+ handoffHosts?: readonly string[] | undefined;
27
+ resolveLink?: ((href: string) => string | null) | undefined;
28
+ focusComposer?: (() => void) | undefined;
29
+ keyboardAware?: boolean | undefined;
30
+ keyboardOffset?: number | undefined;
31
31
  /** Drawn before the first message. */
32
32
  empty?: React.ReactNode;
33
33
  style?: StyleProp<ViewStyle>;
@@ -1,6 +1,7 @@
1
1
  import type { ChatLiveMessage } from "@webority/chat-core";
2
+ import { findNodeHandle } from "react-native";
2
3
  /** Moves screen-reader focus to a view. findNodeHandle throws on react-native-web, so the browser focuses the element itself. */
3
- export declare function focusForAccessibility(node: unknown): void;
4
+ export declare function focusForAccessibility(node: Parameters<typeof findNodeHandle>[0]): void;
4
5
  export declare function messageSignature(message: ChatLiveMessage): string;
5
6
  export declare function openExternalUrl(url: string): void;
6
7
  export declare function defaultOpenTarget(target: string): void;
@@ -0,0 +1,58 @@
1
+ interface PlaybackStatus {
2
+ currentTime: number;
3
+ duration: number;
4
+ playing: boolean;
5
+ didJustFinish: boolean;
6
+ }
7
+ interface AudioRecorderLike {
8
+ readonly uri: string | null;
9
+ readonly isRecording: boolean;
10
+ prepareToRecordAsync(): Promise<void>;
11
+ record(): void;
12
+ stop(): Promise<void>;
13
+ getStatus(): {
14
+ durationMillis: number;
15
+ };
16
+ }
17
+ interface AudioPlayerLike {
18
+ volume: number;
19
+ play(): void;
20
+ pause(): void;
21
+ remove(): void;
22
+ addListener(event: "playbackStatusUpdate", listener: (status: PlaybackStatus) => void): {
23
+ remove(): void;
24
+ };
25
+ }
26
+ interface AudioModeLike {
27
+ allowsRecording?: boolean;
28
+ playsInSilentMode?: boolean;
29
+ }
30
+ export interface ExpoAudioModule {
31
+ AudioModule: {
32
+ AudioRecorder: new (options: object) => AudioRecorderLike;
33
+ };
34
+ RecordingPresets: {
35
+ HIGH_QUALITY: object;
36
+ };
37
+ setAudioModeAsync(mode: AudioModeLike): Promise<void>;
38
+ createAudioPlayer(source: {
39
+ uri: string;
40
+ }): AudioPlayerLike;
41
+ }
42
+ export interface ExpoFileSystemModule {
43
+ File: new (...args: unknown[]) => {
44
+ readonly uri: string;
45
+ create(options?: {
46
+ overwrite?: boolean;
47
+ }): void;
48
+ write(content: Uint8Array): void;
49
+ delete(): void;
50
+ };
51
+ Paths: {
52
+ readonly cache: unknown;
53
+ };
54
+ }
55
+ export declare const loadExpoAudio: () => ExpoAudioModule;
56
+ export declare const loadExpoFileSystem: () => ExpoFileSystemModule;
57
+ export {};
58
+ //# sourceMappingURL=expoModules.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { AppIconName } from "@webority/mobile-ui";
2
+ export declare function iconNameOf(name: string | null | undefined): AppIconName | null;
3
+ //# sourceMappingURL=iconName.d.ts.map
@@ -1,3 +1,8 @@
1
+ import { type ChatPart } from "@webority/chat-core";
1
2
  import type { ChatPartRendererProps } from "../types.js";
2
- export declare function ActionPart(props: ChatPartRendererProps): import("react").JSX.Element;
3
+ type ActionView = Extract<ChatPart, {
4
+ kind: "Action";
5
+ }>;
6
+ export declare function ActionPart({ part, turn }: ChatPartRendererProps<ActionView>): import("react").JSX.Element;
7
+ export {};
3
8
  //# sourceMappingURL=ActionPart.d.ts.map
@@ -1,3 +1,6 @@
1
+ import type { ChatPart } from "@webority/chat-core";
1
2
  import type { ChatPartRendererProps } from "../types.js";
2
- export declare function FilePart(props: ChatPartRendererProps): import("react").JSX.Element;
3
+ export declare function FilePart({ part, turn }: ChatPartRendererProps<Extract<ChatPart, {
4
+ kind: "File";
5
+ }>>): import("react").JSX.Element;
3
6
  //# sourceMappingURL=FilePart.d.ts.map
@@ -1,3 +1,8 @@
1
+ import type { ChatPart } from "@webority/chat-core";
1
2
  import type { ChatPartRendererProps } from "../types.js";
2
- export declare function InputRequestPart(props: ChatPartRendererProps): import("react").JSX.Element;
3
+ type InputRequestView = Extract<ChatPart, {
4
+ kind: "InputRequest";
5
+ }>;
6
+ export declare function InputRequestPart({ part, turn, pickAttachments }: ChatPartRendererProps<InputRequestView>): import("react").JSX.Element;
7
+ export {};
3
8
  //# sourceMappingURL=InputRequestPart.d.ts.map
@@ -3,6 +3,6 @@ import type { ChatPartRendererProps } from "../types.js";
3
3
  type NoticePartProps = ChatPartRendererProps<Extract<ChatPart, {
4
4
  kind: "Notice";
5
5
  }>>;
6
- export declare function NoticePart({ part }: NoticePartProps): import("react").JSX.Element;
6
+ export declare function NoticePart({ part, turn }: NoticePartProps): import("react").JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=NoticePart.d.ts.map
@@ -1,3 +1,41 @@
1
- import type { ChatRenderers } from "../types.js";
2
- export declare const defaultRenderers: ChatRenderers;
1
+ import type { ChatPart, ChatPartKind } from "@webority/chat-core";
2
+ import type React from "react";
3
+ import type { ChatPartRendererProps } from "../types.js";
4
+ import { ActionPart } from "./ActionPart.js";
5
+ import { ChartPart } from "./ChartPart.js";
6
+ import { FiguresPart } from "./FiguresPart.js";
7
+ import { FilePart } from "./FilePart.js";
8
+ import { HandoffPart } from "./HandoffPart.js";
9
+ import { ImagePart } from "./ImagePart.js";
10
+ import { InputRequestPart } from "./InputRequestPart.js";
11
+ import { NoticePart } from "./NoticePart.js";
12
+ import { QuickRepliesPart } from "./QuickRepliesPart.js";
13
+ import { RecordCardPart } from "./RecordCardPart.js";
14
+ import { SourcesPart } from "./SourcesPart.js";
15
+ import { TablePart } from "./TablePart.js";
16
+ import { TextPart } from "./TextPart.js";
17
+ import { TicketPart } from "./TicketPart.js";
18
+ import { VoiceClipPart } from "./VoiceClipPart.js";
19
+ export type DefaultRenderers = {
20
+ [K in ChatPartKind]: React.ComponentType<ChatPartRendererProps<Extract<ChatPart, {
21
+ kind: K;
22
+ }>>>;
23
+ };
24
+ export declare const defaultRenderers: {
25
+ Text: typeof TextPart;
26
+ Sources: typeof SourcesPart;
27
+ QuickReplies: typeof QuickRepliesPart;
28
+ InputRequest: typeof InputRequestPart;
29
+ Action: typeof ActionPart;
30
+ Notice: typeof NoticePart;
31
+ Table: typeof TablePart;
32
+ Chart: typeof ChartPart;
33
+ Figures: typeof FiguresPart;
34
+ RecordCard: typeof RecordCardPart;
35
+ Image: typeof ImagePart;
36
+ File: typeof FilePart;
37
+ Ticket: typeof TicketPart;
38
+ Handoff: typeof HandoffPart;
39
+ VoiceClip: typeof VoiceClipPart;
40
+ };
3
41
  //# sourceMappingURL=index.d.ts.map
@@ -36,7 +36,7 @@ export type ChatPartRendererProps<P extends ChatPart = ChatPart> = {
36
36
  part: P;
37
37
  message: ChatLiveMessage;
38
38
  turn: ChatTurnApi & ChatTurnHostApi;
39
- pickAttachments?: PickAttachments;
39
+ pickAttachments?: PickAttachments | undefined;
40
40
  };
41
41
  export type ChatRenderers = Partial<{
42
42
  [K in ChatPartKind]: React.ComponentType<ChatPartRendererProps<Extract<ChatPart, {
@@ -23,7 +23,7 @@ export interface UseChatOptions {
23
23
  /** Where the session keeps the mute choice (key wchat:muted). */
24
24
  prefs: ChatPrefs;
25
25
  getCaptchaToken?: (action: string) => Promise<string | null>;
26
- onEvent?: (name: string, data: Record<string, unknown>) => void;
26
+ onEvent?: ((name: string, data: Record<string, unknown>) => void) | undefined;
27
27
  onError?: (error: unknown) => void;
28
28
  /** Receives the path of a relative link in a reply; the host decides how to navigate to it. */
29
29
  onNavigate?: (path: string) => void;
@@ -38,7 +38,7 @@ export interface UseChatResult extends ChatSessionState, ChatActions {
38
38
  /** The message of the last hand-off request that failed, cleared by the next request. */
39
39
  handoffError: string | null;
40
40
  /** Present only when the host passed `onNavigate`; the turn API of each message hands relative links to it. */
41
- onNavigate?: (path: string) => void;
41
+ onNavigate?: ((path: string) => void) | undefined;
42
42
  }
43
43
  /**
44
44
  * The chat's state and actions. The session lives in the component that calls it: one per client,
@@ -1,7 +1,7 @@
1
1
  import type { UseChatResult } from "./useChat.js";
2
2
  /**
3
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,
4
+ * (chat-elements/src/WuiChat.ts _playSounds). A send, an edit and a retry each add a new visitor message; an assistant,
5
5
  * script or agent message plays the reply cue. Restored messages, notices and a history load stay silent, and the
6
6
  * visitor message the server's copy replaces after a turn is stored, so it does not play the sent cue again.
7
7
  * The phone has no WebAudio, so each cue is a short 16-bit WAV written once to the cache and played from there.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-chat",
3
- "version": "0.141.0",
3
+ "version": "0.143.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,10 +42,10 @@
42
42
  "!**/*.map"
43
43
  ],
44
44
  "peerDependencies": {
45
- "@webority/chat-core": "0.141.0",
46
- "@webority/markdown-core": "^0.149.0",
47
- "@webority/mobile-core": "^0.149.0",
48
- "@webority/mobile-ui": "^0.149.0",
45
+ "@webority/chat-core": "0.143.0",
46
+ "@webority/markdown-core": "^0.152.0",
47
+ "@webority/mobile-core": "^0.152.0",
48
+ "@webority/mobile-ui": "^0.152.0",
49
49
  "expo-audio": ">=58.0.0",
50
50
  "expo-file-system": ">=58.0.0",
51
51
  "react": "^19.3.0",
@@ -98,11 +98,11 @@
98
98
  "@testing-library/react-native": "12.9.0",
99
99
  "@types/jest": "29.5.14",
100
100
  "@types/react": "19.3.0",
101
- "@webority/canvas-kit": "0.149.0",
102
- "@webority/chat-core": "0.141.0",
103
- "@webority/markdown-core": "0.149.0",
104
- "@webority/mobile-core": "0.149.0",
105
- "@webority/mobile-ui": "0.149.0",
101
+ "@webority/canvas-kit": "0.152.0",
102
+ "@webority/chat-core": "0.143.0",
103
+ "@webority/markdown-core": "0.152.0",
104
+ "@webority/mobile-core": "0.152.0",
105
+ "@webority/mobile-ui": "0.152.0",
106
106
  "babel-jest": "29.7.0",
107
107
  "expo": "58.0.23",
108
108
  "expo-application": "58.1.2",
@@ -128,7 +128,7 @@
128
128
  "react-native-worklets": "0.13.0",
129
129
  "react-test-renderer": "19.3.0",
130
130
  "terser": "5.49.1",
131
- "typescript": "5.9.3"
131
+ "typescript": "7.0.2"
132
132
  },
133
133
  "scripts": {
134
134
  "build": "bob build && node ../../scripts/minify-lib.mjs",