@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.
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 +24 -21
@@ -1,5 +1,10 @@
1
+ import type { ChatLabels } from "@webority/chat-core";
2
+ import { type ChatFullSurfaceProps } from "./ChatPage.jsx";
3
+ export type ChatEmbedProps = Omit<ChatFullSurfaceProps, "layout" | "labelOverrides"> & {
4
+ labels?: Partial<ChatLabels> | undefined;
5
+ };
1
6
  /**
2
7
  * The conversation embedded in a host page's own box. It is always open and takes the same
3
8
  * surface props as the page.
4
9
  */
5
- export default function ChatEmbed(props: any): import("react").JSX.Element;
10
+ export default function ChatEmbed({ labels, ...props }: ChatEmbedProps): import("react").JSX.Element;
@@ -1,16 +1,31 @@
1
+ import { type ChatLabels } from "@webority/chat-core";
2
+ import { type ReactNode } from "react";
3
+ import type useChat from "./useChat.js";
4
+ type ChatHook = ReturnType<typeof useChat>;
5
+ type Placement = "top" | "bottom" | "start" | "end" | "auto";
6
+ type RenderAnswer = (args: {
7
+ answer: unknown;
8
+ labels: ChatLabels;
9
+ close: () => void;
10
+ }) => ReactNode;
11
+ type RenderFoot = (args: {
12
+ close: () => void;
13
+ }) => ReactNode;
14
+ export type ChatExplainProps = {
15
+ chat: ChatHook;
16
+ request: (signal: AbortSignal) => Promise<unknown>;
17
+ renderAnswer: RenderAnswer;
18
+ label: string;
19
+ renderFoot?: RenderFoot | undefined;
20
+ askDraft?: string | undefined;
21
+ labels?: Partial<ChatLabels> | undefined;
22
+ placement?: Placement | undefined;
23
+ className?: string | undefined;
24
+ triggerContent?: ReactNode;
25
+ };
1
26
  /**
2
27
  * A "Why?" control on one figure. It opens a card that loads the explanation on demand; the product
3
28
  * draws the answer and its foot through renderAnswer and renderFoot.
4
29
  */
5
- export default function ChatExplain({ chat, request, renderAnswer, label, renderFoot, askDraft, labels: labelOverrides, placement, className, triggerContent, }: {
6
- askDraft: any;
7
- chat: any;
8
- className: any;
9
- label: any;
10
- labels: any;
11
- placement?: string | undefined;
12
- renderAnswer: any;
13
- renderFoot: any;
14
- request: any;
15
- triggerContent: any;
16
- }): import("react").JSX.Element | null;
30
+ export default function ChatExplain({ chat, request, renderAnswer, label, renderFoot, askDraft, labels: labelOverrides, placement, className, triggerContent, }: ChatExplainProps): import("react").JSX.Element | null;
31
+ export {};
@@ -1,8 +1,10 @@
1
+ import { type ChatLabels, type ChatSessionState } from "@webority/chat-core";
2
+ export type ChatFooterProps = {
3
+ chat: Pick<ChatSessionState, "profile">;
4
+ labels: ChatLabels;
5
+ };
1
6
  /**
2
7
  * The disclaimer line under the composer: the disclaimer, the privacy text and its link, the assurance text and
3
8
  * the reCAPTCHA note with its Google links.
4
9
  */
5
- export default function ChatFooter({ chat, labels }: {
6
- chat: any;
7
- labels: any;
8
- }): import("react").JSX.Element | null;
10
+ export default function ChatFooter({ chat, labels }: ChatFooterProps): import("react").JSX.Element | null;
@@ -1,27 +1,52 @@
1
+ import type { ChatLabels } from "@webority/chat-core";
2
+ import { type ComponentProps, type ContextType, type ReactNode } from "react";
3
+ import ChatComposer from "./ChatComposer.jsx";
4
+ import { type ChatThreadProps } from "./ChatThread.jsx";
5
+ import { ChatLinkContext } from "./renderers/ChatLinkContext.jsx";
6
+ import type { UseChatResult } from "./useChat.js";
7
+ type ChatLinks = ContextType<typeof ChatLinkContext>;
8
+ /** The surface a conversation is drawn in. */
9
+ export type ChatLayout = "launcher" | "docked" | "full-page" | "embedded";
10
+ /** What a host receives when the person moves the conversation between the docked panel and the full page. */
11
+ export type ChatSwitchHandoff = {
12
+ conversationId: string | null;
13
+ draft: string;
14
+ from: ChatLayout;
15
+ to: "docked" | "full-page";
16
+ };
17
+ /** Draws the empty conversation in place of the default starters. defaultEmpty is what it would have drawn. */
18
+ export type ChatRenderEmpty = (context: {
19
+ chat: UseChatResult;
20
+ labels: ChatLabels;
21
+ open: boolean;
22
+ defaultEmpty: ReactNode;
23
+ }) => ReactNode;
24
+ export type ChatFrameProps = {
25
+ chat: UseChatResult;
26
+ labels: ChatLabels;
27
+ layout: ChatLayout;
28
+ onClose?: (() => void) | undefined;
29
+ panelId?: string | undefined;
30
+ inputRef?: ComponentProps<typeof ChatComposer>["inputRef"];
31
+ ariaLabelOverride?: string | undefined;
32
+ renderers?: ChatThreadProps["renderers"];
33
+ layoutParts?: ChatThreadProps["layoutParts"];
34
+ loader?: ChatThreadProps["loader"];
35
+ motion?: ChatThreadProps["motion"];
36
+ onOpenAttachment?: ChatThreadProps["onOpenAttachment"];
37
+ onOpenTarget?: ChatThreadProps["onOpenTarget"];
38
+ onOpenTicket?: ChatThreadProps["onOpenTicket"];
39
+ onNavigate?: ChatThreadProps["onNavigate"];
40
+ resolveLink?: ChatLinks["resolveLink"] | undefined;
41
+ linkComponent?: ChatLinks["linkComponent"] | undefined;
42
+ onSwitch?: (() => void) | undefined;
43
+ open?: boolean | undefined;
44
+ renderEmpty?: ChatRenderEmpty | undefined;
45
+ sendIcon?: string | undefined;
46
+ };
1
47
  /**
2
48
  * The panel of every layout: header, body and foot. The past chats view replaces the body and the
3
49
  * foot until the person returns to the chat.
4
50
  */
5
- export default function ChatFrame({ chat, labels, layout, onClose, panelId, inputRef, ariaLabelOverride, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onOpenTicket, onNavigate, resolveLink, linkComponent, onSwitch, open, renderEmpty, sendIcon, }: {
6
- ariaLabelOverride: any;
7
- chat: any;
8
- inputRef: any;
9
- labels: any;
10
- layout: any;
11
- layoutParts: any;
12
- linkComponent?: null | undefined;
13
- loader: any;
14
- motion: any;
15
- onClose: any;
16
- onNavigate: any;
17
- onOpenAttachment: any;
18
- onOpenTarget: any;
19
- onOpenTicket: any;
20
- onSwitch: any;
21
- open?: boolean | undefined;
22
- panelId: any;
23
- renderEmpty: any;
24
- renderers: any;
25
- resolveLink?: null | undefined;
26
- sendIcon?: string | undefined;
27
- }): import("react").JSX.Element;
51
+ export default function ChatFrame({ chat, labels, layout, onClose, panelId, inputRef, ariaLabelOverride, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onOpenTicket, onNavigate, resolveLink, linkComponent, onSwitch, open, renderEmpty, sendIcon, }: ChatFrameProps): import("react").JSX.Element;
52
+ export {};
@@ -1,9 +1,11 @@
1
+ import { type ChatLabels, type ChatSession, type ChatSessionState } from "@webority/chat-core";
2
+ export type ChatHistoryProps = {
3
+ chat: Pick<ChatSessionState, "conversationId" | "features"> & Pick<ChatSession, "client" | "newConversation" | "openConversation">;
4
+ labels: ChatLabels;
5
+ onOpen: () => void;
6
+ };
1
7
  /**
2
8
  * The past chats view. A row opens its conversation; rename and delete appear only when their
3
9
  * features are on, and delete asks first.
4
10
  */
5
- export default function ChatHistory({ chat, labels, onOpen }: {
6
- chat: any;
7
- labels: any;
8
- onOpen: any;
9
- }): import("react").JSX.Element;
11
+ export default function ChatHistory({ chat, labels, onOpen }: ChatHistoryProps): import("react").JSX.Element;
@@ -1,5 +1,7 @@
1
+ import { type ChatShellProps } from "./ChatShell.jsx";
2
+ export type ChatLauncherProps = Omit<ChatShellProps, "layout" | "panelId">;
1
3
  /**
2
4
  * The floating launcher that opens the chat panel. Auto-open is scheduled here, on the launcher the
3
5
  * shell shares its panel id with.
4
6
  */
5
- export default function ChatLauncher(props: any): import("react").JSX.Element;
7
+ export default function ChatLauncher(props: ChatLauncherProps): import("react").JSX.Element;
@@ -1,4 +1,9 @@
1
- export default function ChatLiveStatus({ chat, labels }: {
2
- chat: any;
3
- labels: any;
4
- }): import("react").JSX.Element | null;
1
+ import type { ChatLabels } from "@webority/chat-core";
2
+ import type useChat from "./useChat.js";
3
+ type ChatHook = ReturnType<typeof useChat>;
4
+ type ChatLiveStatusProps = {
5
+ chat: ChatHook;
6
+ labels: ChatLabels;
7
+ };
8
+ export default function ChatLiveStatus({ chat, labels }: ChatLiveStatusProps): import("react").JSX.Element | null;
9
+ export {};
@@ -1,10 +1,13 @@
1
+ import { type ChatLabels, type ChatLiveMessage, type ChatSession, type ChatSessionState } from "@webority/chat-core";
2
+ type ChatMessageActionsProps = {
3
+ chat: Pick<ChatSessionState, "features" | "messages" | "profile" | "streaming" | "thinking" | "title"> & Pick<ChatSession, "client" | "rate" | "regenerate" | "startEdit">;
4
+ message: ChatLiveMessage;
5
+ labels: ChatLabels;
6
+ isLast: boolean;
7
+ isLastVisitor: boolean;
8
+ };
1
9
  /**
2
10
  * The actions under one message: copy, read aloud, share, print, regenerate, edit and rating.
3
11
  */
4
- export default function ChatMessageActions({ chat, message, labels, isLast, isLastVisitor }: {
5
- chat: any;
6
- isLast: any;
7
- isLastVisitor: any;
8
- labels: any;
9
- message: any;
10
- }): import("react").JSX.Element | null;
12
+ export default function ChatMessageActions({ chat, message, labels, isLast, isLastVisitor }: ChatMessageActionsProps): import("react").JSX.Element | null;
13
+ export {};
@@ -1,10 +1,15 @@
1
+ import { type ChatLabels } from "@webority/chat-core";
2
+ import type useChat from "./useChat.js";
3
+ type ChatHook = ReturnType<typeof useChat>;
4
+ type ChatNudgeProps = {
5
+ chat: ChatHook;
6
+ labels: ChatLabels;
7
+ enabled: boolean;
8
+ onActivate: () => void;
9
+ };
1
10
  /**
2
11
  * The small prompt beside a closed launcher. It appears once after its delay and stays hidden for
3
12
  * the rest of the component's life once dismissed.
4
13
  */
5
- export default function ChatNudge({ chat, labels, enabled, onActivate }: {
6
- chat: any;
7
- enabled: any;
8
- labels: any;
9
- onActivate: any;
10
- }): import("react").JSX.Element | null;
14
+ export default function ChatNudge({ chat, labels, enabled, onActivate }: ChatNudgeProps): import("react").JSX.Element | null;
15
+ export {};
@@ -1,9 +1,14 @@
1
+ import type { ChatLabels, ChatOpenTicket } from "@webority/chat-core";
2
+ import type useChat from "./useChat.js";
3
+ type ChatHook = ReturnType<typeof useChat>;
4
+ export type ChatOpenTicketsProps = {
5
+ chat: ChatHook;
6
+ labels: ChatLabels;
7
+ onOpenTicket?: ((ticket: Pick<ChatOpenTicket, "ticketId" | "number">) => void) | undefined;
8
+ };
1
9
  /**
2
10
  * The person's open tickets on the empty state: the ticket number, the subject and the status. A row opens
3
11
  * its ticket only when the host passes onOpenTicket.
4
12
  */
5
- export default function ChatOpenTickets({ chat, labels, onOpenTicket }: {
6
- chat: any;
7
- labels: any;
8
- onOpenTicket: any;
9
- }): import("react").JSX.Element | null;
13
+ export default function ChatOpenTickets({ chat, labels, onOpenTicket }: ChatOpenTicketsProps): import("react").JSX.Element | null;
14
+ export {};
@@ -1,49 +1,46 @@
1
+ import { type ChatLabels, type ChatLookInput } from "@webority/chat-core";
2
+ import { type CSSProperties } from "react";
3
+ import { type ChatFrameProps, type ChatSwitchHandoff } from "./ChatFrame.jsx";
4
+ import type { ChatTheme } from "./ChatShell.jsx";
5
+ import type { UseChatResult } from "./useChat.js";
6
+ import useChatHandoff from "./useChatHandoff.js";
7
+ type SurfaceProps = {
8
+ chat: UseChatResult;
9
+ renderers?: ChatFrameProps["renderers"];
10
+ layoutParts?: ChatFrameProps["layoutParts"];
11
+ loader?: ChatFrameProps["loader"];
12
+ motion?: ChatFrameProps["motion"];
13
+ onOpenAttachment?: ChatFrameProps["onOpenAttachment"];
14
+ onOpenTarget?: ChatFrameProps["onOpenTarget"];
15
+ onNavigate?: ChatFrameProps["onNavigate"];
16
+ resolveLink?: ChatFrameProps["resolveLink"];
17
+ linkComponent?: ChatFrameProps["linkComponent"];
18
+ className?: string | undefined;
19
+ style?: CSSProperties | undefined;
20
+ theme?: ChatTheme | undefined;
21
+ look?: ChatLookInput | null | undefined;
22
+ onClose?: ChatFrameProps["onClose"];
23
+ renderEmpty?: ChatFrameProps["renderEmpty"];
24
+ };
25
+ export type ChatPageProps = SurfaceProps & {
26
+ labels?: Partial<ChatLabels> | undefined;
27
+ /** Hands the conversation to the docked panel; with the PanelSwitch feature on it adds the switch button. */
28
+ onOpenSidePanel?: ((handoff: ChatSwitchHandoff) => void | Promise<void>) | undefined;
29
+ /** A conversation to open and a draft to fill, read once when the page mounts. */
30
+ handoff?: Parameters<typeof useChatHandoff>[1];
31
+ };
32
+ export type ChatFullSurfaceProps = SurfaceProps & {
33
+ layout: "full-page" | "embedded";
34
+ labelOverrides?: Partial<ChatLabels> | undefined;
35
+ inputRef?: ChatFrameProps["inputRef"];
36
+ onSwitch?: ChatFrameProps["onSwitch"];
37
+ };
1
38
  /**
2
39
  * The full-page conversation. It is always open and draws nothing when VisitorChat is off.
3
40
  */
4
- export default function ChatPage({ chat, labels: labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, look, onOpenSidePanel, onClose, renderEmpty, handoff, }: {
5
- chat: any;
6
- className: any;
7
- handoff: any;
8
- labels: any;
9
- layoutParts: any;
10
- linkComponent: any;
11
- loader: any;
12
- look: any;
13
- motion?: string | undefined;
14
- onClose: any;
15
- onNavigate: any;
16
- onOpenAttachment: any;
17
- onOpenSidePanel: any;
18
- onOpenTarget: any;
19
- renderEmpty: any;
20
- renderers: any;
21
- resolveLink: any;
22
- style: any;
23
- theme: any;
24
- }): import("react").JSX.Element;
41
+ export default function ChatPage({ chat, labels: labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, look, onOpenSidePanel, onClose, renderEmpty, handoff, }: ChatPageProps): import("react").JSX.Element;
25
42
  /**
26
43
  * The always-open surface shared by the full-page and embedded layouts.
27
44
  */
28
- export declare function ChatFullSurface({ layout, chat, labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, look, inputRef, onSwitch, onClose, renderEmpty, }: {
29
- chat: any;
30
- className: any;
31
- inputRef: any;
32
- labelOverrides: any;
33
- layout: any;
34
- layoutParts: any;
35
- linkComponent?: null | undefined;
36
- loader: any;
37
- look: any;
38
- motion: any;
39
- onClose: any;
40
- onNavigate: any;
41
- onOpenAttachment: any;
42
- onOpenTarget: any;
43
- onSwitch: any;
44
- renderEmpty: any;
45
- renderers: any;
46
- resolveLink?: null | undefined;
47
- style: any;
48
- theme: any;
49
- }): import("react").JSX.Element | null;
45
+ export declare function ChatFullSurface({ layout, chat, labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, look, inputRef, onSwitch, onClose, renderEmpty, }: ChatFullSurfaceProps): import("react").JSX.Element | null;
46
+ export {};
@@ -1,9 +1,12 @@
1
+ import { type ChatShellProps, type ChatSwitchConfig } from "./ChatShell.jsx";
2
+ export type ChatPanelProps = Omit<ChatShellProps, "layout" | "switchConfig"> & {
3
+ /** Hands the conversation to the full page; with the PanelSwitch feature on it adds the switch button. */
4
+ onOpenFullScreen?: ChatSwitchConfig["onSwitch"] | undefined;
5
+ /** Warms the full page the first time the panel opens. */
6
+ preloadFullPage?: ChatSwitchConfig["preload"];
7
+ };
1
8
  /**
2
9
  * The docked panel: the same conversation as the launcher, open beside the page's content. With the
3
10
  * PanelSwitch feature on and an onOpenFullScreen callback, the panel hands the conversation to the full page.
4
11
  */
5
- export default function ChatPanel({ onOpenFullScreen, preloadFullPage, ...props }: {
6
- [x: string]: any;
7
- onOpenFullScreen: any;
8
- preloadFullPage: any;
9
- }): import("react").JSX.Element;
12
+ export default function ChatPanel({ onOpenFullScreen, preloadFullPage, ...props }: ChatPanelProps): import("react").JSX.Element;
@@ -1,9 +1,14 @@
1
+ import { type ChatLabels } from "@webority/chat-core";
2
+ import type useChat from "./useChat.js";
3
+ type ChatHook = ReturnType<typeof useChat>;
4
+ export type ChatPastChatsProps = {
5
+ chat: ChatHook;
6
+ labels: ChatLabels;
7
+ open: boolean;
8
+ };
1
9
  /**
2
10
  * The past chats of the empty state. It re-reads the list each time the panel opens, so a chat that
3
11
  * ended while the panel was closed appears.
4
12
  */
5
- export default function ChatPastChats({ chat, labels, open }: {
6
- chat: any;
7
- labels: any;
8
- open: any;
9
- }): import("react").JSX.Element | null;
13
+ export default function ChatPastChats({ chat, labels, open }: ChatPastChatsProps): import("react").JSX.Element | null;
14
+ export {};
@@ -1,8 +1,11 @@
1
+ import { type ChatLabels, type ChatLiveMessage } from "@webority/chat-core";
2
+ import useChatSpeech from "./useChatSpeech.js";
3
+ export type ChatReadAloudButtonProps = {
4
+ chat: Parameters<typeof useChatSpeech>[0];
5
+ labels: ChatLabels;
6
+ message: ChatLiveMessage;
7
+ };
1
8
  /**
2
9
  * The read-aloud action under one reply. It reads the Text parts only, so tables, sources and chips are not spoken.
3
10
  */
4
- export default function ChatReadAloudButton({ chat, labels, message }: {
5
- chat: any;
6
- labels: any;
7
- message: any;
8
- }): import("react").JSX.Element | null;
11
+ export default function ChatReadAloudButton({ chat, labels, message }: ChatReadAloudButtonProps): import("react").JSX.Element | null;
@@ -1,32 +1,46 @@
1
+ import { type ChatLabels, type ChatLookInput } from "@webority/chat-core";
2
+ import { type CSSProperties } from "react";
3
+ import { type ChatFrameProps, type ChatSwitchHandoff } from "./ChatFrame.jsx";
4
+ import type { UseChatResult } from "./useChat.js";
5
+ /** The theme a surface draws in; auto follows the page. */
6
+ export type ChatTheme = "auto" | "light" | "dark";
7
+ /** Where the panel's switch button sends the conversation, and what it runs to get there. */
8
+ export type ChatSwitchConfig = {
9
+ target: ChatSwitchHandoff["to"];
10
+ onSwitch: (handoff: ChatSwitchHandoff) => void | Promise<void>;
11
+ /** Warms the page the switch loads; it runs once, the first time the panel opens. */
12
+ preload?: (() => unknown) | undefined;
13
+ };
14
+ export type ChatShellProps = {
15
+ chat: UseChatResult;
16
+ layout: "launcher" | "docked";
17
+ labels?: Partial<ChatLabels> | undefined;
18
+ renderers?: ChatFrameProps["renderers"];
19
+ layoutParts?: ChatFrameProps["layoutParts"];
20
+ loader?: ChatFrameProps["loader"];
21
+ motion?: ChatFrameProps["motion"];
22
+ onOpenAttachment?: ChatFrameProps["onOpenAttachment"];
23
+ onOpenTarget?: ChatFrameProps["onOpenTarget"];
24
+ onNavigate?: ChatFrameProps["onNavigate"];
25
+ resolveLink?: ChatFrameProps["resolveLink"];
26
+ linkComponent?: ChatFrameProps["linkComponent"];
27
+ className?: string | undefined;
28
+ style?: CSSProperties | undefined;
29
+ theme?: ChatTheme | undefined;
30
+ icon?: string | undefined;
31
+ look?: ChatLookInput | null | undefined;
32
+ open?: boolean | undefined;
33
+ defaultOpen?: boolean | undefined;
34
+ onOpenChange?: ((open: boolean) => void) | undefined;
35
+ position?: "end" | "start" | undefined;
36
+ offsetX?: number | undefined;
37
+ offsetY?: number | undefined;
38
+ panelId?: string | undefined;
39
+ switchConfig?: ChatSwitchConfig | null | undefined;
40
+ renderEmpty?: ChatFrameProps["renderEmpty"];
41
+ };
1
42
  /**
2
43
  * The launcher and docked shell: the floating button, the panel it opens and the nudge. It draws
3
44
  * nothing until the profile loads and while VisitorChat is off.
4
45
  */
5
- export default function ChatShell({ chat, layout, labels: labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, icon, look, open, defaultOpen, onOpenChange, position, offsetX, offsetY, panelId: panelIdProp, switchConfig, renderEmpty, }: {
6
- chat: any;
7
- className: any;
8
- defaultOpen?: boolean | undefined;
9
- icon?: string | undefined;
10
- labels: any;
11
- layout: any;
12
- layoutParts: any;
13
- linkComponent?: null | undefined;
14
- loader: any;
15
- look: any;
16
- motion?: string | undefined;
17
- offsetX?: number | undefined;
18
- offsetY?: number | undefined;
19
- onNavigate: any;
20
- onOpenAttachment: any;
21
- onOpenChange: any;
22
- onOpenTarget: any;
23
- open: any;
24
- panelId: any;
25
- position?: string | undefined;
26
- renderEmpty: any;
27
- renderers: any;
28
- resolveLink?: null | undefined;
29
- style: any;
30
- switchConfig?: null | undefined;
31
- theme: any;
32
- }): import("react").JSX.Element | null;
46
+ export default function ChatShell({ chat, layout, labels: labelOverrides, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onNavigate, resolveLink, linkComponent, className, style, theme, icon, look, open, defaultOpen, onOpenChange, position, offsetX, offsetY, panelId: panelIdProp, switchConfig, renderEmpty, }: ChatShellProps): import("react").JSX.Element | null;
@@ -1,8 +1,15 @@
1
+ import { type ChatLabels } from "@webority/chat-core";
2
+ import type { ComponentProps } from "react";
3
+ import ChatOpenTickets from "./ChatOpenTickets.jsx";
4
+ import type useChat from "./useChat.js";
5
+ type ChatHook = ReturnType<typeof useChat>;
6
+ type ChatStartersProps = {
7
+ chat: ChatHook;
8
+ labels: ChatLabels;
9
+ onOpenTicket?: ComponentProps<typeof ChatOpenTickets>["onOpenTicket"];
10
+ };
1
11
  /**
2
12
  * The empty state: the greeting, the starter questions, the resume row for the last conversation and the open tickets.
3
13
  */
4
- export default function ChatStarters({ chat, labels, onOpenTicket }: {
5
- chat: any;
6
- labels: any;
7
- onOpenTicket: any;
8
- }): import("react").JSX.Element | null;
14
+ export default function ChatStarters({ chat, labels, onOpenTicket }: ChatStartersProps): import("react").JSX.Element | null;
15
+ export {};
@@ -1,15 +1,27 @@
1
+ import { type ChatLabels, type ChatLiveMessage, type ChatLoaderStyle, type ChatMotion, type ChatPart, type ChatProfileView, type ChatSession, type ChatSessionState } from "@webority/chat-core";
2
+ import { type ChatRendererOverrides } from "./renderers/index.js";
3
+ export type ChatThreadProps = {
4
+ chat: Pick<ChatSessionState, "agentTyping" | "features" | "greeting" | "messages" | "pending" | "stopped" | "steps" | "streaming" | "thinking" | "title" | "turnError"> & Pick<ChatSession, "client" | "rate" | "regenerate" | "retry" | "startEdit"> & {
5
+ session: ChatSession;
6
+ profile: ChatProfileView | null;
7
+ onNavigate: ((path: string) => void) | undefined;
8
+ };
9
+ labels: ChatLabels;
10
+ renderers?: ChatRendererOverrides | undefined;
11
+ layoutParts?: ((message: Pick<ChatLiveMessage, "author" | "createdDateTimeUtc" | "id" | "parts" | "restored" | "stored" | "streaming">) => (ChatPart | ChatPart[])[] | null) | undefined;
12
+ loader?: ChatLoaderStyle | undefined;
13
+ motion?: ChatMotion | undefined;
14
+ onOpenAttachment?: ((part: Extract<ChatPart, {
15
+ kind: "File";
16
+ }>) => void) | undefined;
17
+ onOpenTarget?: ((target: string) => void) | undefined;
18
+ onOpenTicket?: ((ticket: {
19
+ ticketId: string;
20
+ number: string;
21
+ }) => void) | undefined;
22
+ onNavigate?: ((path: string) => void) | undefined;
23
+ };
1
24
  /**
2
25
  * The conversation, oldest message first. It keeps the newest text in view while an answer streams.
3
26
  */
4
- export default function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onOpenTicket, onNavigate, }: {
5
- chat: any;
6
- labels: any;
7
- layoutParts: any;
8
- loader: any;
9
- motion: any;
10
- onNavigate: any;
11
- onOpenAttachment: any;
12
- onOpenTarget: any;
13
- onOpenTicket: any;
14
- renderers: any;
15
- }): import("react").JSX.Element;
27
+ export default function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, onOpenAttachment, onOpenTarget, onOpenTicket, onNavigate, }: ChatThreadProps): import("react").JSX.Element;
@@ -1,5 +1,19 @@
1
- export declare function initialsOf(name: any): any;
2
- export declare function ticketTone(status: any): string;
3
- export declare function lastAgentName(messages: any): any;
4
- export declare function liveStatusText(state: any, labels: any): any;
5
- export declare function canOfferHandoff(state: any): any;
1
+ import type { ChatConversationState, ChatLabels, ChatLiveMessage } from "@webority/chat-core";
2
+ import type { AppBadge } from "@webority/ui-react";
3
+ import type { ComponentProps } from "react";
4
+ type TicketTone = NonNullable<ComponentProps<typeof AppBadge>["tone"]>;
5
+ type LiveState = {
6
+ features: {
7
+ HumanHandoff?: boolean;
8
+ };
9
+ conversationState: ChatConversationState;
10
+ messages: readonly Pick<ChatLiveMessage, "author">[];
11
+ streaming: boolean;
12
+ thinking: boolean;
13
+ };
14
+ export declare function initialsOf(name: string | null | undefined): string;
15
+ export declare function ticketTone(status: string): TicketTone;
16
+ export declare function lastAgentName(messages: readonly Pick<ChatLiveMessage, "author">[]): string | null;
17
+ export declare function liveStatusText(state: LiveState, labels: ChatLabels): string | null;
18
+ export declare function canOfferHandoff(state: LiveState): boolean;
19
+ export {};
@@ -1,6 +1,12 @@
1
+ import type { ChatTranscript } from "@webority/chat-core";
2
+ type PrintOptions = {
3
+ lang?: string;
4
+ printedOn?: string | null;
5
+ };
1
6
  /**
2
7
  * Prints a transcript from a hidden iframe built with DOM calls only, so the host page is never printed
3
8
  * and no markup is parsed from transcript text. Returns false when the frame has no document to print into.
4
9
  * The printed date replaces the transcript date when the caller passes printedOn.
5
10
  */
6
- export declare function printTranscript(transcript: any, options?: {}): boolean;
11
+ export declare function printTranscript(transcript: ChatTranscript, options?: PrintOptions): boolean;
12
+ export {};
@@ -1,10 +1,13 @@
1
+ import type { ChatClient, ChatLiveMessage, ChatMotion, ChatPart } from "@webority/chat-core";
1
2
  export declare const webPrefs: {
2
- get(key: any): string | null;
3
- set(key: any, value: any): void;
3
+ get(key: string): string | null;
4
+ set(key: string, value: string): void;
4
5
  };
5
- export declare function copyText(text: any): Promise<boolean>;
6
- export declare function openAttachmentDefault(client: any, part: any): Promise<boolean>;
7
- export declare function openTargetDefault(target: any): void;
8
- export declare function scrollBoxOf(node: any): any;
9
- export declare function messageSignature(message: any): string;
10
- export declare function motionClass(motion: any): "" | "wui-chat--reduced";
6
+ export declare function copyText(text: string): Promise<boolean>;
7
+ export declare function openAttachmentDefault(client: Pick<ChatClient, "getAttachment">, part: Extract<ChatPart, {
8
+ kind: "File";
9
+ }>): Promise<boolean>;
10
+ export declare function openTargetDefault(target: string): void;
11
+ export declare function scrollBoxOf(node: Node | null | undefined): HTMLElement | null;
12
+ export declare function messageSignature(message: Pick<ChatLiveMessage, "id" | "parts">): string;
13
+ export declare function motionClass(motion: ChatMotion): "" | "wui-chat--reduced";
@@ -2,16 +2,11 @@
2
2
  * Places the transcript of a dictation in the composer box. A dictation owns one span of the box and
3
3
  * overwrites it on every call, because the adapter sends the whole transcript so far.
4
4
  *
5
- * @param {object} input
6
- * @param {string} input.value The box text.
7
- * @param {{ start: number, end: number } | null} input.span The part of the box the running dictation owns.
8
- * @param {number} input.selectionStart
9
- * @param {number} input.selectionEnd
10
- * @param {string} input.text The transcript so far.
11
- * @param {number} input.maxLength
12
- * @returns {{ value: string, span: { start: number, end: number }, caret: number }}
5
+ * @param input.value The box text.
6
+ * @param input.span The part of the box the running dictation owns.
7
+ * @param input.text The transcript so far.
13
8
  */
14
- export declare function placeDictation({ value, span, selectionStart, selectionEnd, text, maxLength }: {
9
+ export declare function placeDictation({ value, span, selectionStart, selectionEnd, text, maxLength, }: {
15
10
  value: string;
16
11
  span: {
17
12
  start: number;