@webority/chat-elements 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 (74) hide show
  1. package/dist/chat-elements.js +1 -1
  2. package/dist/chat.css +1 -1
  3. package/dist/chat.global.js +28 -28
  4. package/dist/types/WuiChat.d.ts +213 -244
  5. package/dist/types/agent.d.ts +12 -7
  6. package/dist/types/composer.d.ts +33 -4
  7. package/dist/types/dom.d.ts +74 -25
  8. package/dist/types/elementBase.d.ts +2 -0
  9. package/dist/types/footer.d.ts +6 -2
  10. package/dist/types/header.d.ts +26 -4
  11. package/dist/types/history.d.ts +13 -6
  12. package/dist/types/http.d.ts +22 -9
  13. package/dist/types/index.d.ts +6 -0
  14. package/dist/types/loaders/index.d.ts +14 -1
  15. package/dist/types/loaders/orb.d.ts +2 -1
  16. package/dist/types/loaders/phrases.d.ts +2 -1
  17. package/dist/types/loaders/skeleton.d.ts +2 -1
  18. package/dist/types/loaders/steps.d.ts +2 -1
  19. package/dist/types/loaders/typing.d.ts +4 -3
  20. package/dist/types/nudge.d.ts +10 -3
  21. package/dist/types/past-chats.d.ts +5 -8
  22. package/dist/types/razor-globals.d.ts +20 -0
  23. package/dist/types/recaptcha.d.ts +11 -1
  24. package/dist/types/renderers/action-part.d.ts +24 -13
  25. package/dist/types/renderers/cell-format.d.ts +4 -6
  26. package/dist/types/renderers/chart-engine.d.ts +1 -1
  27. package/dist/types/renderers/chart-part.d.ts +37 -7
  28. package/dist/types/renderers/figure-runs.d.ts +5 -4
  29. package/dist/types/renderers/figures-part.d.ts +15 -0
  30. package/dist/types/renderers/file-part.d.ts +13 -2
  31. package/dist/types/renderers/handoff-part.d.ts +14 -3
  32. package/dist/types/renderers/image-part.d.ts +17 -0
  33. package/dist/types/renderers/input-request-part.d.ts +16 -8
  34. package/dist/types/renderers/notice-part.d.ts +17 -2
  35. package/dist/types/renderers/part-base.d.ts +15 -15
  36. package/dist/types/renderers/part-turn.d.ts +45 -0
  37. package/dist/types/renderers/quick-replies-part.d.ts +16 -0
  38. package/dist/types/renderers/record-card-part.d.ts +16 -0
  39. package/dist/types/renderers/sources-part.d.ts +16 -0
  40. package/dist/types/renderers/table-part.d.ts +15 -0
  41. package/dist/types/renderers/text-part.d.ts +18 -0
  42. package/dist/types/renderers/ticket-part.d.ts +15 -0
  43. package/dist/types/renderers/voice-clip-part.d.ts +13 -2
  44. package/dist/types/share-actions.d.ts +10 -13
  45. package/dist/types/shell-docked.d.ts +31 -9
  46. package/dist/types/shell-embed.d.ts +31 -9
  47. package/dist/types/shell-launcher.d.ts +17 -9
  48. package/dist/types/shell-page.d.ts +31 -9
  49. package/dist/types/starters.d.ts +23 -6
  50. package/dist/types/thread.d.ts +46 -4
  51. package/dist/types/voice/composer-voice.d.ts +21 -10
  52. package/dist/types/voice/controller.d.ts +37 -12
  53. package/dist/types/voice/icons.d.ts +9 -1
  54. package/dist/types/voice/read-aloud-button.d.ts +15 -10
  55. package/dist/types/web/autoopen.d.ts +8 -1
  56. package/dist/types/web/avoid.d.ts +2 -1
  57. package/dist/types/web/behaviour.d.ts +3 -3
  58. package/dist/types/web/explain.d.ts +19 -10
  59. package/dist/types/web/focus.d.ts +2 -2
  60. package/dist/types/web/haptics.d.ts +1 -1
  61. package/dist/types/web/moment.d.ts +2 -13
  62. package/dist/types/web/motion.d.ts +4 -3
  63. package/dist/types/web/print.d.ts +3 -7
  64. package/dist/types/web/scrolllock.d.ts +1 -1
  65. package/dist/types/web/share.d.ts +1 -5
  66. package/dist/types/web/sound.d.ts +10 -3
  67. package/dist/types/web/speech-azure.d.ts +81 -18
  68. package/dist/types/web/speech.d.ts +3 -5
  69. package/dist/types/web/switch.d.ts +1 -3
  70. package/dist/types/web/viewport.d.ts +2 -1
  71. package/dist/web-BqTAYdyz.js +1 -0
  72. package/dist/web.js +1 -1
  73. package/package.json +22 -18
  74. package/dist/web-C3yk2qnK.js +0 -1
@@ -0,0 +1,2 @@
1
+ export declare const NO_DOM_MESSAGE = "@webority/chat-elements needs a browser DOM; import @webority/chat-core on the server";
2
+ export declare const ElementBase: typeof HTMLElement;
@@ -1,4 +1,8 @@
1
+ import type { ChatLabels, ChatProfileView } from "@webority/chat-core";
1
2
  export declare function createFooter(): {
2
- el: any;
3
- paint: (view: any) => void;
3
+ el: HTMLParagraphElement;
4
+ paint: (view: {
5
+ labels: ChatLabels;
6
+ profile: ChatProfileView | null;
7
+ }) => void;
4
8
  };
@@ -1,5 +1,27 @@
1
- export declare function createHeader(handlers: any): {
2
- el: any;
3
- conversation: any;
4
- paint: (view: any) => void;
1
+ import type { ChatLabels } from "@webority/chat-core";
2
+ export declare function createHeader(handlers: {
3
+ titleId?: string;
4
+ onHistory(): void;
5
+ onMute(): void;
6
+ onNew(): void;
7
+ onSwitch(): void;
8
+ onClose(): void;
9
+ }): {
10
+ el: HTMLElement;
11
+ conversation: HTMLSpanElement;
12
+ paint: (view: {
13
+ labels: ChatLabels;
14
+ title?: string | null;
15
+ tagline?: string | null;
16
+ status?: string | null;
17
+ showHistory?: boolean;
18
+ viewingHistory?: boolean;
19
+ showMute?: boolean;
20
+ muted?: boolean;
21
+ showNew?: boolean;
22
+ canNew?: boolean;
23
+ showClose?: boolean;
24
+ switchTo?: "full-page" | "docked" | null;
25
+ canSwitch?: boolean;
26
+ }) => void;
5
27
  };
@@ -1,7 +1,14 @@
1
- export declare function createHistory(options: any): {
2
- el: any;
3
- show: () => void;
4
- hide: () => void;
5
- paint: () => void;
6
- dispose: () => void;
1
+ import type { ChatClient, ChatFeature, ChatLabels } from "@webority/chat-core";
2
+ export declare function createHistory(options: {
3
+ getClient(): ChatClient;
4
+ getLabels(): ChatLabels;
5
+ getFeatures(): Readonly<Record<ChatFeature, boolean>>;
6
+ onOpen(id: string): void;
7
+ onDeleted(id: string): void;
8
+ }): {
9
+ el: HTMLDivElement;
10
+ show(): void;
11
+ hide(): void;
12
+ paint(): void;
13
+ dispose(): void;
7
14
  };
@@ -1,12 +1,25 @@
1
- /**
2
- * @param {{ fetch?: typeof fetch }} [options] `fetch` is the transport; tests pass a stub.
3
- * @returns {{ get: Function, post: Function, put: Function, delete: Function }}
4
- */
5
- export declare function createFetchChatHttp({ fetch: transport }?: {
1
+ import type { ChatHttpRequestConfig } from "@webority/chat-core";
2
+ type RequestConfig = Omit<ChatHttpRequestConfig, "signal"> & {
3
+ signal?: AbortSignal;
4
+ };
5
+ export declare function createFetchChatHttp({ fetch: transport, }?: {
6
6
  fetch?: typeof fetch;
7
7
  }): {
8
- get: Function;
9
- post: Function;
10
- put: Function;
11
- delete: Function;
8
+ get: (url: string, config?: RequestConfig) => Promise<{
9
+ data: unknown;
10
+ status: number;
11
+ }>;
12
+ post: (url: string, data?: unknown, config?: RequestConfig) => Promise<{
13
+ data: unknown;
14
+ status: number;
15
+ }>;
16
+ put: (url: string, data?: unknown, config?: RequestConfig) => Promise<{
17
+ data: unknown;
18
+ status: number;
19
+ }>;
20
+ delete: (url: string, config?: RequestConfig) => Promise<{
21
+ data: unknown;
22
+ status: number;
23
+ }>;
12
24
  };
25
+ export {};
@@ -2,4 +2,10 @@ import { defaultRenderers } from "./renderers/index.js";
2
2
  import { WuiChat } from "./WuiChat.js";
3
3
  export declare function defineChat(): void;
4
4
  export { createFetchChatHttp } from "./http.js";
5
+ export type { WuiChatAttributes, WuiChatEventMap } from "./WuiChat.js";
5
6
  export { defaultRenderers, WuiChat };
7
+ declare global {
8
+ interface HTMLElementTagNameMap {
9
+ "wui-chat": WuiChat;
10
+ }
11
+ }
@@ -1,5 +1,18 @@
1
+ import { type ChatLoaderStyle } from "@webority/chat-core";
2
+ type LoaderUpdate = {
3
+ active: false;
4
+ } | {
5
+ active: true;
6
+ style: ChatLoaderStyle;
7
+ steps?: readonly string[] | undefined;
8
+ phrases?: readonly string[] | undefined;
9
+ intervalMs: number;
10
+ reduced?: boolean | undefined;
11
+ announce?: string | undefined;
12
+ };
1
13
  export declare function createLoader(): {
2
14
  el: HTMLDivElement;
3
- update: (next: any) => void;
15
+ update: (next: LoaderUpdate) => void;
4
16
  destroy: () => void;
5
17
  };
18
+ export {};
@@ -1,4 +1,5 @@
1
+ import type { ChatLoaderView } from "@webority/chat-core";
1
2
  export declare function createOrb(): {
2
3
  el: HTMLDivElement;
3
- render(view: any): void;
4
+ render(view: ChatLoaderView): void;
4
5
  };
@@ -1,4 +1,5 @@
1
+ import type { ChatLoaderView } from "@webority/chat-core";
1
2
  export declare function createPhrases(): {
2
3
  el: HTMLDivElement;
3
- render: (view: any) => void;
4
+ render: (view: ChatLoaderView) => void;
4
5
  };
@@ -1,4 +1,5 @@
1
+ import type { ChatLoaderView } from "@webority/chat-core";
1
2
  export declare function createSkeleton(): {
2
3
  el: HTMLDivElement;
3
- render(view: any): void;
4
+ render(view: ChatLoaderView): void;
4
5
  };
@@ -1,4 +1,5 @@
1
+ import type { ChatLoaderView } from "@webority/chat-core";
1
2
  export declare function createSteps(): {
2
3
  el: HTMLDivElement;
3
- render: (view: any) => void;
4
+ render: (view: ChatLoaderView) => void;
4
5
  };
@@ -1,9 +1,10 @@
1
+ import type { ChatAuthorKind } from "@webority/chat-core";
1
2
  export declare function createTypingPill(): {
2
3
  el: HTMLDivElement;
3
4
  update: ({ active, reduced, authorKind }: {
4
- active: any;
5
- authorKind: any;
6
- reduced: any;
5
+ active: boolean;
6
+ reduced?: boolean | undefined;
7
+ authorKind: ChatAuthorKind;
7
8
  }) => void;
8
9
  destroy: () => void;
9
10
  };
@@ -1,6 +1,13 @@
1
- export declare function createNudge(handlers: any): {
2
- el: any;
3
- schedule: (options: any) => void;
1
+ export declare function createNudge(handlers: {
2
+ onActivate: () => void;
3
+ onDismiss: () => void;
4
+ }): {
5
+ el: HTMLDivElement;
6
+ schedule: (options: {
7
+ text: string;
8
+ label: string;
9
+ delaySeconds: number;
10
+ }) => void;
4
11
  cancel: () => void;
5
12
  dismiss: () => void;
6
13
  isShown: () => boolean;
@@ -1,13 +1,10 @@
1
+ import type { ChatFeature, ChatLabels, ConversationList } from "@webority/chat-core";
1
2
  export declare const PAST_CHATS_SHOWN = 20;
2
- /**
3
- * The past chats rows of the empty state, drawn from a chat-core ConversationList.
4
- * @param {{ list: object, getLabels: () => object, getFeatures: () => object, onOpen: (id: string) => void, now?: () => number }} options
5
- * @returns {{ el: HTMLElement, refresh(): void, paint(): void, dispose(): void }}
6
- */
3
+ /** The past chats rows of the empty state, drawn from a chat-core ConversationList. */
7
4
  export declare function createPastChats(options: {
8
- list: object;
9
- getLabels: () => object;
10
- getFeatures: () => object;
5
+ list: ConversationList;
6
+ getLabels: () => ChatLabels;
7
+ getFeatures: () => Readonly<Record<ChatFeature, boolean>>;
11
8
  onOpen: (id: string) => void;
12
9
  now?: () => number;
13
10
  }): {
@@ -0,0 +1,20 @@
1
+ import type { ChatSession } from "@webority/chat-core";
2
+ import type { defineDefaultRenderer, WuiChat } from "./WuiChat.js";
3
+ /** Reads the live session of a `<wui-chat>` element, or null before it connects. */
4
+ export type WeborityChatSession = (element: WuiChat) => ChatSession | null;
5
+ /** Registers a default renderer for one part kind on every chat element created after the call. */
6
+ export type WeborityChatRenderers = {
7
+ define: typeof defineDefaultRenderer;
8
+ };
9
+ /** The page-wide object the `@webority/chat-elements/global` script sets on `window`. */
10
+ export type WeborityChatGlobal = {
11
+ session: WeborityChatSession;
12
+ renderers: WeborityChatRenderers;
13
+ };
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ "wui-chat": WuiChat;
17
+ }
18
+ /** Set by the `@webority/chat-elements/global` script; undefined until that script has run. */
19
+ var WeborityChat: Partial<WeborityChatGlobal> | undefined;
20
+ }
@@ -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,17 +1,28 @@
1
+ import type { ChatInputOption, ChatLabels, ChatLiveMessage, ChatPart } from "@webority/chat-core";
1
2
  import { ChatPartElement } from "./part-base.js";
2
- export declare class WuiChatPartAction extends ChatPartElement {
3
- _part: any;
4
- _turn: any;
5
- _working: any;
6
- _error: any;
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type ActionPart = Extract<ChatPart, {
5
+ kind: "Action";
6
+ }>;
7
+ export declare class WuiChatPartAction extends ChatPartElement<ActionPart> {
8
+ _part: ActionPart | null;
9
+ _turn: ChatPartTurn | null;
10
+ _working: "confirm" | "dismiss" | null;
11
+ _error: string | null;
7
12
  _menuOpen: boolean;
8
13
  constructor();
9
- renderPart(part: any, _message: any, turn: any): void;
10
- _paint(focus?: null): void;
11
- _run(kind: any): Promise<void>;
12
- _view(): any;
13
- _status(part: any, labels: any): any;
14
- _buttons(part: any, labels: any, recap: any, pending: any, editable: any): any;
15
- _menu(options: any, labels: any): any;
16
- _onMenuKey(event: any): void;
14
+ renderPart(part: ActionPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
15
+ _paint(focus?: "first" | "edit" | null): void;
16
+ _run(kind: "confirm" | "dismiss"): Promise<void>;
17
+ _view(part: ActionPart, turn: ChatPartTurn): HTMLElement;
18
+ _status(part: ActionPart, labels: ChatLabels): HTMLParagraphElement;
19
+ _buttons(part: ActionPart, labels: ChatLabels, recap: boolean, pending: boolean, editable: boolean): HTMLDivElement;
20
+ _menu(options: readonly ChatInputOption[], labels: ChatLabels, turn: ChatPartTurn): HTMLUListElement;
21
+ _onMenuKey(event: KeyboardEvent, menu: HTMLElement): void;
17
22
  }
23
+ declare global {
24
+ interface HTMLElementTagNameMap {
25
+ "wui-chat-part-action": WuiChatPartAction;
26
+ }
27
+ }
28
+ export {};
@@ -1,6 +1,4 @@
1
- export declare function isNumericType(type: any): boolean;
2
- export declare function formatCell(type: any, value: any, currency: any, figureText?: boolean): {
3
- kind: string;
4
- text: any;
5
- }[];
6
- export declare function runsText(runs: any): any;
1
+ import type { ChatColumnType, ChatFigureRun } from "@webority/chat-core";
2
+ export declare function isNumericType(type: ChatColumnType): boolean;
3
+ export declare function formatCell(type: ChatColumnType, value: string | number | null | undefined, currency: string | null, figureText?: boolean): ChatFigureRun[];
4
+ export declare function runsText(runs: readonly ChatFigureRun[]): string;
@@ -1 +1 @@
1
- export declare function loadChartEngine(): Promise<any>;
1
+ export declare function loadChartEngine(): Promise<void>;
@@ -1,11 +1,41 @@
1
- export declare function buildChartSpec(part: any, labels: any): {
2
- type: any;
3
- title: any;
1
+ import type { ChatLabels, ChatLiveMessage, ChatPart } from "@webority/chat-core";
2
+ import { ChatPartElement } from "./part-base.js";
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type ChartPart = Extract<ChatPart, {
5
+ kind: "Chart";
6
+ }>;
7
+ type ChartType = "column" | "line" | "donut";
8
+ type ChartRow = Record<string, string | number | null>;
9
+ interface ChartSpec {
10
+ type: ChartType;
11
+ title: string;
4
12
  x: {
5
13
  key: string;
6
- kind: string;
14
+ kind: "category";
15
+ labelFit?: "all";
7
16
  };
8
- series: any;
9
- data: any[];
17
+ y?: {
18
+ label: string;
19
+ };
20
+ series: {
21
+ key: string;
22
+ label: string;
23
+ }[];
24
+ data: ChartRow[];
10
25
  height: number;
11
- };
26
+ valueLabels?: boolean;
27
+ state?: "empty";
28
+ emptyText?: string;
29
+ }
30
+ export declare function buildChartSpec(part: ChartPart, labels: ChatLabels): ChartSpec;
31
+ declare class WuiChatPartChart extends ChatPartElement<ChartPart> {
32
+ #private;
33
+ renderPart(part: ChartPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
34
+ disposePart(): void;
35
+ }
36
+ declare global {
37
+ interface HTMLElementTagNameMap {
38
+ "wui-chat-part-chart": WuiChatPartChart;
39
+ }
40
+ }
41
+ export {};
@@ -1,4 +1,5 @@
1
- export declare function appendRuns(parent: any, runs: any): void;
2
- export declare function setRichText(element: any, text: any): void;
3
- export declare function plainText(text: any): string;
4
- export declare function valueRuns(number: any): import("@webority/chat-core").ChatFigureRun[];
1
+ import type { ChatFigureRun } from "@webority/chat-core";
2
+ export declare function appendRuns(parent: Element, runs: readonly ChatFigureRun[]): void;
3
+ export declare function setRichText(element: Element, text: string | null | undefined): void;
4
+ export declare function plainText(text: string | null | undefined): string;
5
+ export declare function valueRuns(number: number): ChatFigureRun[];
@@ -1 +1,16 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
2
+ import { ChatPartElement } from "./part-base.js";
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type FiguresPart = Extract<ChatPart, {
5
+ kind: "Figures";
6
+ }>;
7
+ declare class WuiChatPartFigures extends ChatPartElement<FiguresPart> {
8
+ #private;
9
+ renderPart(part: FiguresPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
10
+ }
11
+ declare global {
12
+ interface HTMLElementTagNameMap {
13
+ "wui-chat-part-figures": WuiChatPartFigures;
14
+ }
15
+ }
1
16
  export {};
@@ -1,4 +1,15 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
1
2
  import { ChatPartElement } from "./part-base.js";
2
- export declare class WuiChatPartFile extends ChatPartElement {
3
- renderPart(part: any, _message: any, turn: any): void;
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type FilePart = Extract<ChatPart, {
5
+ kind: "File";
6
+ }>;
7
+ export declare class WuiChatPartFile extends ChatPartElement<FilePart> {
8
+ renderPart(part: FilePart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
4
9
  }
10
+ declare global {
11
+ interface HTMLElementTagNameMap {
12
+ "wui-chat-part-file": WuiChatPartFile;
13
+ }
14
+ }
15
+ export {};
@@ -1,6 +1,17 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
1
2
  import { ChatPartElement } from "./part-base.js";
2
- export declare class WuiChatPartHandoff extends ChatPartElement {
3
- _signature: any;
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type HandoffPart = Extract<ChatPart, {
5
+ kind: "Handoff";
6
+ }>;
7
+ export declare class WuiChatPartHandoff extends ChatPartElement<HandoffPart> {
8
+ _signature: string | null;
4
9
  constructor();
5
- renderPart(part: any, _message: any, turn: any): void;
10
+ renderPart(part: HandoffPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
6
11
  }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "wui-chat-part-handoff": WuiChatPartHandoff;
15
+ }
16
+ }
17
+ export {};
@@ -1 +1,18 @@
1
1
  import "@webority/ui-elements/elements/lightbox";
2
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
3
+ import { ChatPartElement } from "./part-base.js";
4
+ import type { ChatPartTurn } from "./part-turn.js";
5
+ type ImagePart = Extract<ChatPart, {
6
+ kind: "Image";
7
+ }>;
8
+ declare class WuiChatPartImage extends ChatPartElement<ImagePart> {
9
+ #private;
10
+ renderPart(part: ImagePart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
11
+ disposePart(): void;
12
+ }
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ "wui-chat-part-image": WuiChatPartImage;
16
+ }
17
+ }
18
+ export {};
@@ -1,12 +1,20 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
1
2
  import { ChatPartElement } from "./part-base.js";
2
- import "./notice-part.js";
3
- export declare class WuiChatPartInputRequest extends ChatPartElement {
4
- _signature: any;
5
- _turn: any;
6
- _notice: HTMLElement | null;
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ type InputPart = Extract<ChatPart, {
5
+ kind: "InputRequest";
6
+ }>;
7
+ export declare class WuiChatPartInputRequest extends ChatPartElement<InputPart> {
8
+ _signature: string | null;
7
9
  _generation: number;
8
10
  constructor();
9
- renderPart(part: any, message: any, turn: any): void;
10
- _content(part: any, message: any, turn: any): any;
11
- _form(part: any, generation: any): any;
11
+ renderPart(part: InputPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
12
+ _content(part: InputPart, turn: ChatPartTurn): HTMLElement;
13
+ _form(part: InputPart, generation: number): HTMLFormElement;
12
14
  }
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ "wui-chat-part-input-request": WuiChatPartInputRequest;
18
+ }
19
+ }
20
+ export {};
@@ -1,4 +1,19 @@
1
+ import type { ChatPart } from "@webority/chat-core";
1
2
  import { ChatPartElement } from "./part-base.js";
2
- export declare class WuiChatPartNotice extends ChatPartElement {
3
- renderPart(part: any): void;
3
+ type NoticePart = Extract<ChatPart, {
4
+ kind: "Notice";
5
+ }> & {
6
+ action?: {
7
+ label: string;
8
+ run: () => void;
9
+ };
10
+ };
11
+ export declare class WuiChatPartNotice extends ChatPartElement<NoticePart> {
12
+ renderPart(part: NoticePart): void;
4
13
  }
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ "wui-chat-part-notice": WuiChatPartNotice;
17
+ }
18
+ }
19
+ export {};
@@ -1,20 +1,20 @@
1
- declare const Base: {
2
- new (): {};
3
- };
4
- export declare class ChatPartElement extends Base {
1
+ import type { ChatLiveMessage } from "@webority/chat-core";
2
+ import { ElementBase } from "../elementBase.js";
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ export declare class ChatPartElement<TPart> extends ElementBase {
5
5
  #private;
6
- get part(): null;
7
- set part(value: null);
8
- get message(): null;
9
- set message(value: null);
10
- get turn(): null;
11
- set turn(value: null);
6
+ get chatPart(): TPart | null;
7
+ set chatPart(value: TPart | null);
8
+ get message(): ChatLiveMessage | null;
9
+ set message(value: ChatLiveMessage | null);
10
+ get turn(): ChatPartTurn | null;
11
+ set turn(value: ChatPartTurn | null);
12
+ protected get activeTurn(): ChatPartTurn;
12
13
  connectedCallback(): void;
13
14
  disconnectedCallback(): void;
14
- renderPart(): void;
15
+ renderPart(_part: TPart, _message: ChatLiveMessage, _turn: ChatPartTurn): void;
15
16
  disposePart(): void;
16
17
  }
17
- export declare function definePart(tag: any, elementClass: any): void;
18
- export declare function makeElement(doc: any, tag: any, className?: null, text?: null): any;
19
- export declare function glyphNode(doc: any, name: any, size: any): any;
20
- export {};
18
+ export declare function definePart(tag: string, elementClass: CustomElementConstructor): void;
19
+ export declare function makeElement<K extends keyof HTMLElementTagNameMap>(doc: Document, tag: K, className?: string | null, text?: string | null): HTMLElementTagNameMap[K];
20
+ export declare function glyphNode(doc: Document, name: string, size: number): Element | null;
@@ -0,0 +1,45 @@
1
+ import type { ChatInputOutcome, ChatLabels, ChatOtpRequest, ChatPart, ChatQuickReply, ChatUploadFile } from "@webority/chat-core";
2
+ export interface ChatPartTurn {
3
+ readonly features: {
4
+ readonly FigureText?: boolean;
5
+ readonly HumanHandoff?: boolean;
6
+ readonly LeadRecap?: boolean;
7
+ readonly LeadShortcuts?: boolean;
8
+ readonly LinkHandoff?: boolean;
9
+ readonly Sources?: boolean;
10
+ readonly SuggestedReplies?: boolean;
11
+ readonly VoiceClips?: boolean;
12
+ };
13
+ readonly labels: ChatLabels;
14
+ readonly isLast: boolean;
15
+ readonly busy: boolean;
16
+ readonly handoffPause: boolean;
17
+ readonly handoffSettled: boolean;
18
+ readonly handoffHosts?: readonly string[];
19
+ readonly resolveLink?: ((href: string) => string | null | undefined) | null;
20
+ isCitation?(inner: string): boolean;
21
+ openCitation?(marker: number): void;
22
+ openTarget?(target: string): void;
23
+ onNavigate?: (path: string) => void;
24
+ openAttachment?(part: Extract<ChatPart, {
25
+ kind: "File";
26
+ }>): void;
27
+ openRecord?(part: Extract<ChatPart, {
28
+ kind: "RecordCard";
29
+ }>): void;
30
+ openTicket?(ticket: {
31
+ ticketId: string;
32
+ number: string;
33
+ }): void;
34
+ chooseQuickReply(reply: ChatQuickReply): void;
35
+ skipInput(requestId: string): void;
36
+ cancelLead(): void;
37
+ answerInput(requestId: string, values: Record<string, string>, codes?: Record<string, string> | null): Promise<ChatInputOutcome>;
38
+ uploadInputFile(file: ChatUploadFile, onProgress?: (fraction: number) => void): Promise<string>;
39
+ sendOtp(requestId: string, request: ChatOtpRequest): Promise<void>;
40
+ confirmAction(actionId: string): Promise<void>;
41
+ rejectAction(actionId: string, reason?: string): Promise<void>;
42
+ beginHandoff?(reply: ChatQuickReply, go: () => void): void;
43
+ readAttachment?(attachmentId: string): Promise<ArrayBuffer>;
44
+ loadAttachmentUrl?(attachmentId: string): Promise<string>;
45
+ }
@@ -1 +1,17 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
2
+ import { ChatPartElement } from "./part-base.js";
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ declare class WuiChatPartQuickReplies extends ChatPartElement<Extract<ChatPart, {
5
+ kind: "QuickReplies";
6
+ }>> {
7
+ #private;
8
+ renderPart(part: Extract<ChatPart, {
9
+ kind: "QuickReplies";
10
+ }>, _message: ChatLiveMessage, turn: ChatPartTurn): void;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "wui-chat-part-quick-replies": WuiChatPartQuickReplies;
15
+ }
16
+ }
1
17
  export {};
@@ -1 +1,17 @@
1
+ import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
2
+ import { ChatPartElement } from "./part-base.js";
3
+ import type { ChatPartTurn } from "./part-turn.js";
4
+ declare class WuiChatPartRecordCard extends ChatPartElement<Extract<ChatPart, {
5
+ kind: "RecordCard";
6
+ }>> {
7
+ #private;
8
+ renderPart(part: Extract<ChatPart, {
9
+ kind: "RecordCard";
10
+ }>, _message: ChatLiveMessage, turn: ChatPartTurn): void;
11
+ }
12
+ declare global {
13
+ interface HTMLElementTagNameMap {
14
+ "wui-chat-part-record-card": WuiChatPartRecordCard;
15
+ }
16
+ }
1
17
  export {};