@webority/chat-react 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 (64) hide show
  1. package/dist/chat-react.js +2 -2
  2. package/dist/types/ChatAgentTyping.d.ts +6 -4
  3. package/dist/types/ChatAuthorBadge.d.ts +6 -4
  4. package/dist/types/ChatComposer.d.ts +12 -7
  5. package/dist/types/ChatConversationActions.d.ts +9 -4
  6. package/dist/types/ChatEmbed.d.ts +6 -1
  7. package/dist/types/ChatExplain.d.ts +27 -12
  8. package/dist/types/ChatFooter.d.ts +6 -4
  9. package/dist/types/ChatFrame.d.ts +48 -23
  10. package/dist/types/ChatHistory.d.ts +7 -5
  11. package/dist/types/ChatLauncher.d.ts +3 -1
  12. package/dist/types/ChatLiveStatus.d.ts +9 -4
  13. package/dist/types/ChatMessageActions.d.ts +10 -7
  14. package/dist/types/ChatNudge.d.ts +11 -6
  15. package/dist/types/ChatOpenTickets.d.ts +10 -5
  16. package/dist/types/ChatPage.d.ts +40 -43
  17. package/dist/types/ChatPanel.d.ts +8 -5
  18. package/dist/types/ChatPastChats.d.ts +10 -5
  19. package/dist/types/ChatReadAloudButton.d.ts +8 -5
  20. package/dist/types/ChatShell.d.ts +42 -28
  21. package/dist/types/ChatStarters.d.ts +12 -5
  22. package/dist/types/ChatThread.d.ts +24 -12
  23. package/dist/types/chatLive.d.ts +19 -5
  24. package/dist/types/chatPrint.d.ts +7 -1
  25. package/dist/types/chatShared.d.ts +11 -8
  26. package/dist/types/dictationText.d.ts +4 -9
  27. package/dist/types/index.d.ts +21 -1
  28. package/dist/types/loaders/ChatLoader.d.ts +15 -16
  29. package/dist/types/loaders/OrbLoader.d.ts +6 -8
  30. package/dist/types/loaders/PhrasesLoader.d.ts +8 -10
  31. package/dist/types/loaders/SkeletonLoader.d.ts +6 -8
  32. package/dist/types/loaders/StepsLoader.d.ts +6 -8
  33. package/dist/types/loaders/TypingPill.d.ts +7 -8
  34. package/dist/types/recaptcha.d.ts +11 -1
  35. package/dist/types/renderers/ActionPart.d.ts +8 -4
  36. package/dist/types/renderers/ChartPart.d.ts +8 -4
  37. package/dist/types/renderers/ChatLinkContext.d.ts +5 -4
  38. package/dist/types/renderers/FigureText.d.ts +7 -5
  39. package/dist/types/renderers/FiguresPart.d.ts +8 -4
  40. package/dist/types/renderers/FilePart.d.ts +8 -4
  41. package/dist/types/renderers/HandoffPart.d.ts +8 -4
  42. package/dist/types/renderers/ImagePart.d.ts +8 -4
  43. package/dist/types/renderers/InputRequestPart.d.ts +12 -5
  44. package/dist/types/renderers/NoticePart.d.ts +8 -3
  45. package/dist/types/renderers/QuickRepliesPart.d.ts +11 -4
  46. package/dist/types/renderers/RecordCardPart.d.ts +8 -4
  47. package/dist/types/renderers/SourcesPart.d.ts +8 -4
  48. package/dist/types/renderers/TablePart.d.ts +8 -4
  49. package/dist/types/renderers/TextPart.d.ts +9 -5
  50. package/dist/types/renderers/TicketPart.d.ts +8 -4
  51. package/dist/types/renderers/VoiceClipPart.d.ts +8 -4
  52. package/dist/types/renderers/index.d.ts +35 -30
  53. package/dist/types/useAutoOpen.d.ts +10 -8
  54. package/dist/types/useChat.d.ts +43 -25
  55. package/dist/types/useChatDictation.d.ts +18 -19
  56. package/dist/types/useChatExplain.d.ts +14 -41
  57. package/dist/types/useChatHandoff.d.ts +2 -4
  58. package/dist/types/useChatReadAloud.d.ts +10 -11
  59. package/dist/types/useChatSound.d.ts +2 -1
  60. package/dist/types/useChatSpeech.d.ts +5 -3
  61. package/dist/types/useLauncherAvoid.d.ts +3 -1
  62. package/dist/types/useReducedMotion.d.ts +2 -1
  63. package/dist/types/useTranscriptActions.d.ts +11 -9
  64. package/package.json +22 -19
@@ -1,20 +1,40 @@
1
+ export type { ChatComposerProps } from "./ChatComposer.jsx";
1
2
  export { default as ChatComposer } from "./ChatComposer.jsx";
3
+ export type { ChatConversationActionsProps } from "./ChatConversationActions.jsx";
2
4
  export { default as ChatConversationActions } from "./ChatConversationActions.jsx";
5
+ export type { ChatEmbedProps } from "./ChatEmbed.jsx";
3
6
  export { default as ChatEmbed } from "./ChatEmbed.jsx";
7
+ export type { ChatExplainProps } from "./ChatExplain.jsx";
4
8
  export { default as ChatExplain } from "./ChatExplain.jsx";
9
+ export type { ChatFooterProps } from "./ChatFooter.jsx";
5
10
  export { default as ChatFooter } from "./ChatFooter.jsx";
11
+ export type { ChatLauncherProps } from "./ChatLauncher.jsx";
6
12
  export { default as ChatLauncher } from "./ChatLauncher.jsx";
13
+ export type { ChatOpenTicketsProps } from "./ChatOpenTickets.jsx";
7
14
  export { default as ChatOpenTickets } from "./ChatOpenTickets.jsx";
15
+ export type { ChatPageProps } from "./ChatPage.jsx";
8
16
  export { default as ChatPage } from "./ChatPage.jsx";
17
+ export type { ChatPanelProps } from "./ChatPanel.jsx";
9
18
  export { default as ChatPanel } from "./ChatPanel.jsx";
19
+ export type { ChatPastChatsProps } from "./ChatPastChats.jsx";
10
20
  export { default as ChatPastChats } from "./ChatPastChats.jsx";
21
+ export type { ChatReadAloudButtonProps } from "./ChatReadAloudButton.jsx";
11
22
  export { default as ChatReadAloudButton } from "./ChatReadAloudButton.jsx";
23
+ export type { ChatThreadProps } from "./ChatThread.jsx";
12
24
  export { default as ChatThread } from "./ChatThread.jsx";
13
- export { default as ChatLoader } from "./loaders/ChatLoader.jsx";
25
+ export type { ChatLoaderProps } from "./loaders/ChatLoader.jsx";
26
+ export { assertChatLoaderStyle, default as ChatLoader } from "./loaders/ChatLoader.jsx";
27
+ export type { ChatRendererOverrides } from "./renderers/index.js";
14
28
  export { defaultRenderers } from "./renderers/index.js";
29
+ export type { UseAutoOpenOptions } from "./useAutoOpen.js";
30
+ export type { UseChatOptions, UseChatResult } from "./useChat.js";
15
31
  export { default as useChat } from "./useChat.js";
32
+ export type { UseChatDictationOptions, UseChatDictationResult } from "./useChatDictation.js";
16
33
  export { default as useChatDictation } from "./useChatDictation.js";
34
+ export type { UseChatExplainOptions, UseChatExplainResult } from "./useChatExplain.js";
17
35
  export { default as useChatExplain, formatResetTime } from "./useChatExplain.js";
18
36
  export { default as useChatHandoff } from "./useChatHandoff.js";
37
+ export type { UseChatReadAloudOptions, UseChatReadAloudResult } from "./useChatReadAloud.js";
19
38
  export { default as useChatReadAloud } from "./useChatReadAloud.js";
39
+ export type { UseTranscriptActionsResult } from "./useTranscriptActions.js";
20
40
  export { default as useTranscriptActions } from "./useTranscriptActions.js";
@@ -1,21 +1,20 @@
1
+ import type { ChatLoaderStyle, ChatMotion } from "@webority/chat-core";
2
+ export declare function assertChatLoaderStyle(style: string): asserts style is ChatLoaderStyle;
3
+ export type ChatLoaderProps = {
4
+ style?: ChatLoaderStyle;
5
+ /** Server step labels of the reply in progress. */
6
+ steps?: string[];
7
+ /** The thinking phrases (the profile's thinking phrases). */
8
+ phrases: string[];
9
+ /** The rotation interval (the profile's phrase interval), in milliseconds. */
10
+ intervalMs: number;
11
+ /** The sentence a screen reader hears once, for example "Assistant is preparing an answer". */
12
+ announce: string;
13
+ motion?: ChatMotion;
14
+ };
1
15
  /**
2
16
  * The loader a reply shows while it is prepared. The rotation advances every intervalMs (the profile's phrase
3
17
  * interval) and restarts when the style changes; under reduced motion it never advances, so the first phrase
4
18
  * stays. The announce sentence is read once, 500 ms after mount.
5
- *
6
- * @param {object} props
7
- * @param {"Steps" | "Phrases" | "Orb" | "Skeleton"} [props.style]
8
- * @param {string[]} [props.steps] Server step labels of the reply in progress.
9
- * @param {string[]} props.phrases The thinking phrases (the profile's thinking phrases).
10
- * @param {number} props.intervalMs The rotation interval (the profile's phrase interval), in milliseconds.
11
- * @param {string} props.announce The sentence a screen reader hears once, for example "Assistant is preparing an answer".
12
- * @param {"On" | "Reduced"} [props.motion]
13
19
  */
14
- export default function ChatLoader({ style, steps, phrases, intervalMs, announce, motion }: {
15
- style?: "Steps" | "Phrases" | "Orb" | "Skeleton";
16
- steps?: string[];
17
- phrases: string[];
18
- intervalMs: number;
19
- announce: string;
20
- motion?: "On" | "Reduced";
21
- }): import("react").JSX.Element;
20
+ export default function ChatLoader({ style, steps, phrases, intervalMs, announce, motion }: ChatLoaderProps): import("react").JSX.Element;
@@ -1,11 +1,9 @@
1
- /**
2
- * The breathing orb a reply's loader shows while the answer is prepared. Decorative; the label is the only text.
3
- *
4
- * @param {object} props
5
- * @param {{ label: string }} props.view
6
- */
7
- export default function OrbLoader({ view }: {
1
+ export type OrbLoaderProps = {
8
2
  view: {
9
3
  label: string;
10
4
  };
11
- }): import("react").JSX.Element;
5
+ };
6
+ /**
7
+ * The breathing orb a reply's loader shows while the answer is prepared. Decorative; the label is the only text.
8
+ */
9
+ export default function OrbLoader({ view }: OrbLoaderProps): import("react").JSX.Element;
@@ -1,14 +1,12 @@
1
+ import type { ChatMotion } from "@webority/chat-core";
2
+ export type PhrasesLoaderProps = {
3
+ view: {
4
+ label: string;
5
+ };
6
+ motion: ChatMotion;
7
+ };
1
8
  /**
2
9
  * A thinking word that cross-fades to the next one. The previous word stays for the cross-fade and is
3
10
  * dropped at once under reduced motion.
4
- *
5
- * @param {object} props
6
- * @param {{ label: string }} props.view
7
- * @param {"On" | "Reduced"} props.motion
8
11
  */
9
- export default function PhrasesLoader({ view, motion }: {
10
- view: {
11
- label: string;
12
- };
13
- motion: "On" | "Reduced";
14
- }): import("react").JSX.Element;
12
+ export default function PhrasesLoader({ view, motion }: PhrasesLoaderProps): import("react").JSX.Element;
@@ -1,11 +1,9 @@
1
- /**
2
- * A content-shaped placeholder for a reply that is still loading: the label, then four lines and a table block.
3
- *
4
- * @param {object} props
5
- * @param {{ label: string }} props.view
6
- */
7
- export default function SkeletonLoader({ view }: {
1
+ export type SkeletonLoaderProps = {
8
2
  view: {
9
3
  label: string;
10
4
  };
11
- }): import("react").JSX.Element;
5
+ };
6
+ /**
7
+ * A content-shaped placeholder for a reply that is still loading: the label, then four lines and a table block.
8
+ */
9
+ export default function SkeletonLoader({ view }: SkeletonLoaderProps): import("react").JSX.Element;
@@ -1,12 +1,10 @@
1
- /**
2
- * The step list of a reply in progress: finished steps tick, the active one is ringed, later ones wait as dots.
3
- *
4
- * @param {object} props
5
- * @param {{ steps: string[], activeIndex: number }} props.view
6
- */
7
- export default function StepsLoader({ view }: {
1
+ export type StepsLoaderProps = {
8
2
  view: {
9
3
  steps: string[];
10
4
  activeIndex: number;
11
5
  };
12
- }): import("react").JSX.Element;
6
+ };
7
+ /**
8
+ * The step list of a reply in progress: finished steps tick, the active one is ringed, later ones wait as dots.
9
+ */
10
+ export default function StepsLoader({ view }: StepsLoaderProps): import("react").JSX.Element;
@@ -1,12 +1,11 @@
1
+ import type { ChatMotion } from "@webority/chat-core";
2
+ export type TypingPillProps = {
3
+ motion: ChatMotion;
4
+ /** "None" draws the dots alone, as a human agent's pill does. */
5
+ mark: "Orb" | "Assistant" | "None";
6
+ };
1
7
  /**
2
8
  * The pill shown while a paced reply is held back: the mark with three dots bouncing. Under reduced motion
3
9
  * the dots stay still through the loader's reduced class.
4
- *
5
- * @param {object} props
6
- * @param {"On" | "Reduced"} props.motion
7
- * @param {"Orb" | "Assistant" | "None"} props.mark "None" draws the dots alone, as a human agent's pill does.
8
10
  */
9
- export default function TypingPill({ motion, mark }: {
10
- motion: "On" | "Reduced";
11
- mark: "Orb" | "Assistant" | "None";
12
- }): import("react").JSX.Element;
11
+ export default function TypingPill({ motion, mark }: TypingPillProps): import("react").JSX.Element;
@@ -1,2 +1,12 @@
1
- export declare function recaptchaToken(siteKey: any, action: any): Promise<any>;
1
+ type Grecaptcha = {
2
+ ready(callback: () => void): void;
3
+ execute(siteKey: string, options: {
4
+ action: string;
5
+ }): Promise<string>;
6
+ };
7
+ declare global {
8
+ var grecaptcha: Grecaptcha | undefined;
9
+ }
10
+ export declare function recaptchaToken(siteKey: string, action: string): Promise<string>;
2
11
  export declare function resetRecaptchaForTests(): void;
12
+ export {};
@@ -1,4 +1,8 @@
1
- export default function ActionPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type ActionPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Action";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function ActionPart({ part, turn }: ActionPartProps): import("react").JSX.Element;
@@ -1,4 +1,8 @@
1
- export default function ChartPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type ChartPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Chart";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function ChartPart({ part, turn }: ChartPartProps): import("react").JSX.Element;
@@ -1,8 +1,9 @@
1
+ import type { AppLinkComponent } from "@webority/ui-react";
1
2
  export declare const ChatLinkContext: import("react").Context<{
2
- resolveLink: null;
3
- linkComponent: null;
3
+ resolveLink: ((href: string) => string | null | undefined) | null;
4
+ linkComponent: AppLinkComponent | undefined;
4
5
  }>;
5
6
  export declare function useChatLinks(): {
6
- resolveLink: null;
7
- linkComponent: null;
7
+ resolveLink: ((href: string) => string | null | undefined) | null;
8
+ linkComponent: AppLinkComponent | undefined;
8
9
  };
@@ -1,5 +1,7 @@
1
- export default function FigureText({ text, enabled }: {
2
- enabled: any;
3
- text: any;
4
- }): any;
5
- export declare function figurePlain(text: any, enabled: any): any;
1
+ import type { ReactNode } from "react";
2
+ export type FigureTextProps = {
3
+ text: ReactNode;
4
+ enabled: boolean;
5
+ };
6
+ export default function FigureText({ text, enabled }: FigureTextProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
7
+ export declare function figurePlain<T>(text: T, enabled: boolean): T | string;
@@ -1,4 +1,8 @@
1
- export default function FiguresPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element | null;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type FiguresPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Figures";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function FiguresPart({ part, turn }: FiguresPartProps): import("react").JSX.Element | null;
@@ -1,4 +1,8 @@
1
- export default function FilePart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type FilePartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "File";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function FilePart({ part, turn }: FilePartProps): import("react").JSX.Element;
@@ -1,4 +1,8 @@
1
- export default function HandoffPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element | null;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type HandoffPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Handoff";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function HandoffPart({ part, turn }: HandoffPartProps): import("react").JSX.Element | null;
@@ -1,4 +1,8 @@
1
- export default function ImagePart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type ImagePartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Image";
5
+ }>;
6
+ turn: Pick<ChatTurnApi, "labels"> & Partial<Pick<ChatTurnApi, "loadAttachmentUrl">>;
7
+ };
8
+ export default function ImagePart({ part, turn }: ImagePartProps): import("react").JSX.Element;
@@ -1,5 +1,12 @@
1
- export default function InputRequestPart({ part, message, turn }: {
2
- message: any;
3
- part: any;
4
- turn: any;
5
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type InputRequestPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "InputRequest";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export type OpenFormProps = {
9
+ part: InputRequestPartProps["part"];
10
+ turn: ChatTurnApi;
11
+ };
12
+ export default function InputRequestPart({ part, turn }: InputRequestPartProps): import("react").JSX.Element;
@@ -1,3 +1,8 @@
1
- export default function NoticePart({ part }: {
2
- part: any;
3
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type NoticePartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Notice";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function NoticePart({ part, turn }: NoticePartProps): import("react").JSX.Element;
@@ -1,4 +1,11 @@
1
- export default function QuickRepliesPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element | null;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ import type { ComponentProps, ReactElement } from "react";
3
+ type GroupElement = ReactElement<ComponentProps<"div">>;
4
+ export type QuickRepliesPartProps = {
5
+ part: Extract<ChatPart, {
6
+ kind: "QuickReplies";
7
+ }>;
8
+ turn: ChatTurnApi;
9
+ };
10
+ export default function QuickRepliesPart({ part, turn }: QuickRepliesPartProps): GroupElement | null;
11
+ export {};
@@ -1,4 +1,8 @@
1
- export default function RecordCardPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type RecordCardPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "RecordCard";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function RecordCardPart({ part, turn }: RecordCardPartProps): import("react").JSX.Element;
@@ -1,4 +1,8 @@
1
- export default function SourcesPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element | null;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type SourcesPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Sources";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function SourcesPart({ part, turn }: SourcesPartProps): import("react").JSX.Element | null;
@@ -1,4 +1,8 @@
1
- export default function TablePart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type TablePartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Table";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function TablePart({ part, turn }: TablePartProps): import("react").JSX.Element;
@@ -1,5 +1,9 @@
1
- export default function TextPart({ part, message, turn }: {
2
- message: any;
3
- part: any;
4
- turn: any;
5
- }): import("react").JSX.Element;
1
+ import type { ChatLiveMessage, ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type TextPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Text";
5
+ }>;
6
+ message: ChatLiveMessage;
7
+ turn: ChatTurnApi;
8
+ };
9
+ export default function TextPart({ part, message, turn }: TextPartProps): import("react").JSX.Element;
@@ -1,4 +1,8 @@
1
- export default function TicketPart({ part, turn }: {
2
- part: any;
3
- turn: any;
4
- }): import("react").JSX.Element;
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type TicketPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "Ticket";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
8
+ export default function TicketPart({ part, turn }: TicketPartProps): import("react").JSX.Element;
@@ -1,7 +1,11 @@
1
+ import type { ChatPart, ChatTurnApi } from "@webority/chat-core";
2
+ export type VoiceClipPartProps = {
3
+ part: Extract<ChatPart, {
4
+ kind: "VoiceClip";
5
+ }>;
6
+ turn: ChatTurnApi;
7
+ };
1
8
  /**
2
9
  * A recorded voice message: a play control, a waveform that fills as it plays, the time and an optional transcript.
3
10
  */
4
- export default function VoiceClipPart({ part, turn }: {
5
- part: any;
6
- turn: any;
7
- }): import("react").JSX.Element | null;
11
+ export default function VoiceClipPart({ part, turn }: VoiceClipPartProps): import("react").JSX.Element | null;
@@ -1,32 +1,37 @@
1
- import Action from "./ActionPart.jsx";
2
- import Chart from "./ChartPart.jsx";
3
- import Figures from "./FiguresPart.jsx";
4
- import File from "./FilePart.jsx";
5
- import Handoff from "./HandoffPart.jsx";
6
- import Image from "./ImagePart.jsx";
7
- import InputRequest from "./InputRequestPart.jsx";
8
- import Notice from "./NoticePart.jsx";
9
- import QuickReplies from "./QuickRepliesPart.jsx";
10
- import RecordCard from "./RecordCardPart.jsx";
11
- import Sources from "./SourcesPart.jsx";
12
- import Table from "./TablePart.jsx";
13
- import Text from "./TextPart.jsx";
14
- import Ticket from "./TicketPart.jsx";
15
- import VoiceClip from "./VoiceClipPart.jsx";
1
+ import type { ChatLiveMessage, ChatPart, ChatPartKind, ChatTurnApi } from "@webority/chat-core";
2
+ import type { ComponentType } from "react";
3
+ type ChatPartRendererProps = {
4
+ part: ChatPart;
5
+ message: ChatLiveMessage;
6
+ turn: ChatTurnApi;
7
+ };
8
+ type ChatPartRenderer = ComponentType<ChatPartRendererProps>;
9
+ type OverrideRenderer<K extends ChatPartKind> = ComponentType<{
10
+ part: Extract<ChatPart, {
11
+ kind: K;
12
+ }>;
13
+ message: Pick<ChatLiveMessage, "author" | "createdDateTimeUtc" | "id" | "parts" | "restored" | "stored" | "streaming">;
14
+ turn: ChatTurnApi;
15
+ }>;
16
16
  export declare const defaultRenderers: {
17
- Text: typeof Text;
18
- Sources: typeof Sources;
19
- QuickReplies: typeof QuickReplies;
20
- InputRequest: typeof InputRequest;
21
- Action: typeof Action;
22
- Notice: typeof Notice;
23
- Table: typeof Table;
24
- Chart: typeof Chart;
25
- Figures: typeof Figures;
26
- RecordCard: typeof RecordCard;
27
- Image: typeof Image;
28
- File: typeof File;
29
- Ticket: typeof Ticket;
30
- Handoff: typeof Handoff;
31
- VoiceClip: typeof VoiceClip;
17
+ Text: ChatPartRenderer;
18
+ Sources: ChatPartRenderer;
19
+ QuickReplies: ChatPartRenderer;
20
+ InputRequest: ChatPartRenderer;
21
+ Action: ChatPartRenderer;
22
+ Notice: ChatPartRenderer;
23
+ Table: ChatPartRenderer;
24
+ Chart: ChatPartRenderer;
25
+ Figures: ChatPartRenderer;
26
+ RecordCard: ChatPartRenderer;
27
+ Image: ChatPartRenderer;
28
+ File: ChatPartRenderer;
29
+ Ticket: ChatPartRenderer;
30
+ Handoff: ChatPartRenderer;
31
+ VoiceClip: ChatPartRenderer;
32
+ };
33
+ export type ChatRendererOverrides = {
34
+ [K in ChatPartKind]?: OverrideRenderer<K>;
32
35
  };
36
+ export declare function resolveRenderers(overrides: ChatRendererOverrides | undefined): Record<ChatPartKind, ChatPartRenderer>;
37
+ export {};
@@ -1,11 +1,13 @@
1
+ import type { ChatAutoOpenSettings, ChatLook, ChatSession } from "@webority/chat-core";
2
+ export type UseAutoOpenOptions = {
3
+ enabled: boolean;
4
+ settings: ChatAutoOpenSettings | null;
5
+ look: ChatLook;
6
+ session: Pick<ChatSession, "open">;
7
+ isOpen: boolean;
8
+ panelId: string;
9
+ };
1
10
  /**
2
11
  * Opens the panel automatically after the configured delay. The timer is cancelled on unmount.
3
12
  */
4
- export default function useAutoOpen({ enabled, settings, look, session, isOpen, panelId }: {
5
- enabled: any;
6
- isOpen: any;
7
- look: any;
8
- panelId: any;
9
- session: any;
10
- settings: any;
11
- }): void;
13
+ export default function useAutoOpen({ enabled, settings, look, session, isOpen, panelId }: UseAutoOpenOptions): void;
@@ -1,38 +1,56 @@
1
- /**
2
- * The chat's state and actions. One session per client, screen, layout and narrowing, created in a mount effect
3
- * (StrictMode runs effects twice and a disposed session never loads again) and disposed when any of them changes
4
- * or the component unmounts. Until it exists, the state is idle and the actions do nothing.
5
- *
6
- * @param {object} options
7
- * @param {import('@webority/chat-core').ChatClient} options.client
8
- * @param {string} [options.screen]
9
- * @param {string} [options.layout] The surface the host draws, named in the chatOpened and chatClosed events.
10
- * @param {Record<string, boolean>} [options.narrow]
11
- * @param {string} [options.conversationId] Opened once after the profile loads.
12
- * @param {() => import('@webority/chat-core').ChatBehaviour | null} [options.behaviour] Replaces the page collector.
13
- * @param {() => import('@webority/chat-core').ChatAttribution | null} [options.attribution]
14
- * @param {{ get(key: string): string | null, set(key: string, value: string): void }} [options.prefs]
15
- * @param {unknown} [options.pageContext] Sent with each message; read at the moment of sending.
16
- * @param {(action: string) => Promise<string | null> | string | null} [options.getCaptchaToken]
17
- * @param {(name: string, data: object) => void} [options.onEvent]
18
- * @param {(error: unknown) => void} [options.onError]
19
- * @param {(path: string) => void} [options.onNavigate] Receives a relative link clicked in a reply.
20
- */
21
- export default function useChat(options: {
22
- client: import('@webority/chat-core').ChatClient;
1
+ import { type ChatAttribution, type ChatBehaviour, type ChatClient, type ChatInputOutcome, type ChatQuickReply, type ChatRating, type ChatSession, type ChatSessionState, type ChatUploadFile } from "@webority/chat-core";
2
+ export type UseChatOptions = {
3
+ client: ChatClient;
23
4
  screen?: string;
5
+ /** The surface the host draws, named in the chatOpened and chatClosed events. */
24
6
  layout?: string;
25
7
  narrow?: Record<string, boolean>;
8
+ /** Opened once after the profile loads. */
26
9
  conversationId?: string;
27
- behaviour?: () => import('@webority/chat-core').ChatBehaviour | null;
28
- attribution?: () => import('@webority/chat-core').ChatAttribution | null;
10
+ /** Replaces the page collector. */
11
+ behaviour?: () => ChatBehaviour | null;
12
+ attribution?: () => ChatAttribution | null;
29
13
  prefs?: {
30
14
  get(key: string): string | null;
31
15
  set(key: string, value: string): void;
32
16
  };
17
+ /** Sent with each message; read at the moment of sending. */
33
18
  pageContext?: unknown;
34
19
  getCaptchaToken?: (action: string) => Promise<string | null> | string | null;
35
20
  onEvent?: (name: string, data: object) => void;
36
21
  onError?: (error: unknown) => void;
22
+ /** Receives a relative link clicked in a reply. */
37
23
  onNavigate?: (path: string) => void;
38
- }): any;
24
+ };
25
+ export type UseChatResult = ChatSessionState & {
26
+ load: () => Promise<void>;
27
+ submit: (text: string) => Promise<void>;
28
+ chooseQuickReply: (reply: ChatQuickReply) => Promise<void>;
29
+ answerInput: (requestId: string, values: Record<string, string>) => Promise<ChatInputOutcome>;
30
+ confirmAction: (actionId: string) => Promise<void>;
31
+ rejectAction: (actionId: string, reason?: string) => Promise<void>;
32
+ stop: () => void;
33
+ retry: () => Promise<void>;
34
+ regenerate: () => Promise<void>;
35
+ notifyTyping: () => void;
36
+ requestHandoff: (reason?: string) => Promise<void>;
37
+ startEdit: (messageId: string) => void;
38
+ cancelEdit: () => void;
39
+ attach: (files: ChatUploadFile[]) => Promise<void>;
40
+ removeAttachment: (key: string) => Promise<void>;
41
+ openConversation: (id: string) => Promise<void>;
42
+ resumeLast: () => Promise<void>;
43
+ newConversation: () => void;
44
+ rate: (messageId: string, rating: ChatRating, note?: string) => Promise<void>;
45
+ reset: () => void;
46
+ session: ChatSession;
47
+ client: ChatClient;
48
+ emit: (name: string, data: object) => void;
49
+ onNavigate: ((path: string) => void) | undefined;
50
+ };
51
+ /**
52
+ * The chat's state and actions. One session per client, screen, layout and narrowing, created in a mount effect
53
+ * (StrictMode runs effects twice and a disposed session never loads again) and disposed when any of them changes
54
+ * or the component unmounts. Until it exists, the state is idle and the actions do nothing.
55
+ */
56
+ export default function useChat(options: UseChatOptions): UseChatResult;