@webority/chat-elements 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.
- package/dist/chat-elements.js +1 -1
- package/dist/chat.css +1 -1
- package/dist/chat.global.js +28 -28
- package/dist/types/WuiChat.d.ts +213 -244
- package/dist/types/agent.d.ts +12 -7
- package/dist/types/composer.d.ts +33 -4
- package/dist/types/dom.d.ts +74 -25
- package/dist/types/elementBase.d.ts +2 -0
- package/dist/types/footer.d.ts +6 -2
- package/dist/types/header.d.ts +26 -4
- package/dist/types/history.d.ts +13 -6
- package/dist/types/http.d.ts +22 -9
- package/dist/types/index.d.ts +6 -0
- package/dist/types/loaders/index.d.ts +14 -1
- package/dist/types/loaders/orb.d.ts +2 -1
- package/dist/types/loaders/phrases.d.ts +2 -1
- package/dist/types/loaders/skeleton.d.ts +2 -1
- package/dist/types/loaders/steps.d.ts +2 -1
- package/dist/types/loaders/typing.d.ts +4 -3
- package/dist/types/nudge.d.ts +10 -3
- package/dist/types/past-chats.d.ts +5 -8
- package/dist/types/razor-globals.d.ts +20 -0
- package/dist/types/recaptcha.d.ts +11 -1
- package/dist/types/renderers/action-part.d.ts +24 -13
- package/dist/types/renderers/cell-format.d.ts +4 -6
- package/dist/types/renderers/chart-engine.d.ts +1 -1
- package/dist/types/renderers/chart-part.d.ts +37 -7
- package/dist/types/renderers/figure-runs.d.ts +5 -4
- package/dist/types/renderers/figures-part.d.ts +15 -0
- package/dist/types/renderers/file-part.d.ts +13 -2
- package/dist/types/renderers/handoff-part.d.ts +14 -3
- package/dist/types/renderers/image-part.d.ts +17 -0
- package/dist/types/renderers/input-request-part.d.ts +16 -8
- package/dist/types/renderers/notice-part.d.ts +17 -2
- package/dist/types/renderers/part-base.d.ts +15 -15
- package/dist/types/renderers/part-turn.d.ts +45 -0
- package/dist/types/renderers/quick-replies-part.d.ts +16 -0
- package/dist/types/renderers/record-card-part.d.ts +16 -0
- package/dist/types/renderers/sources-part.d.ts +16 -0
- package/dist/types/renderers/table-part.d.ts +15 -0
- package/dist/types/renderers/text-part.d.ts +18 -0
- package/dist/types/renderers/ticket-part.d.ts +15 -0
- package/dist/types/renderers/voice-clip-part.d.ts +13 -2
- package/dist/types/share-actions.d.ts +10 -13
- package/dist/types/shell-docked.d.ts +31 -9
- package/dist/types/shell-embed.d.ts +31 -9
- package/dist/types/shell-launcher.d.ts +17 -9
- package/dist/types/shell-page.d.ts +31 -9
- package/dist/types/starters.d.ts +23 -6
- package/dist/types/thread.d.ts +46 -4
- package/dist/types/voice/composer-voice.d.ts +21 -10
- package/dist/types/voice/controller.d.ts +37 -12
- package/dist/types/voice/icons.d.ts +9 -1
- package/dist/types/voice/read-aloud-button.d.ts +15 -10
- package/dist/types/web/autoopen.d.ts +8 -1
- package/dist/types/web/avoid.d.ts +2 -1
- package/dist/types/web/behaviour.d.ts +3 -3
- package/dist/types/web/explain.d.ts +19 -10
- package/dist/types/web/focus.d.ts +2 -2
- package/dist/types/web/haptics.d.ts +1 -1
- package/dist/types/web/moment.d.ts +2 -13
- package/dist/types/web/motion.d.ts +4 -3
- package/dist/types/web/print.d.ts +3 -7
- package/dist/types/web/scrolllock.d.ts +1 -1
- package/dist/types/web/share.d.ts +1 -5
- package/dist/types/web/sound.d.ts +10 -3
- package/dist/types/web/speech-azure.d.ts +81 -18
- package/dist/types/web/speech.d.ts +3 -5
- package/dist/types/web/switch.d.ts +1 -3
- package/dist/types/web/viewport.d.ts +2 -1
- package/dist/web-BqTAYdyz.js +1 -0
- package/dist/web.js +1 -1
- package/package.json +21 -17
- package/dist/web-C3yk2qnK.js +0 -1
|
@@ -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 WuiChatPartSources extends ChatPartElement<Extract<ChatPart, {
|
|
5
|
+
kind: "Sources";
|
|
6
|
+
}>> {
|
|
7
|
+
#private;
|
|
8
|
+
renderPart(part: Extract<ChatPart, {
|
|
9
|
+
kind: "Sources";
|
|
10
|
+
}>, _message: ChatLiveMessage, turn: ChatPartTurn): void;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"wui-chat-part-sources": WuiChatPartSources;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
1
17
|
export {};
|
|
@@ -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 TablePart = Extract<ChatPart, {
|
|
5
|
+
kind: "Table";
|
|
6
|
+
}>;
|
|
7
|
+
declare class WuiChatPartTable extends ChatPartElement<TablePart> {
|
|
8
|
+
#private;
|
|
9
|
+
renderPart(part: TablePart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface HTMLElementTagNameMap {
|
|
13
|
+
"wui-chat-part-table": WuiChatPartTable;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
1
16
|
export {};
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import "@webority/ui-elements/elements/markdown";
|
|
2
2
|
import "@webority/ui-elements/elements/code-block";
|
|
3
|
+
import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
|
|
4
|
+
import { ChatPartElement } from "./part-base.js";
|
|
5
|
+
import type { ChatPartTurn } from "./part-turn.js";
|
|
6
|
+
type TextPart = Extract<ChatPart, {
|
|
7
|
+
kind: "Text";
|
|
8
|
+
}>;
|
|
9
|
+
declare class WuiChatPartText extends ChatPartElement<TextPart> {
|
|
10
|
+
#private;
|
|
11
|
+
constructor();
|
|
12
|
+
renderPart(part: TextPart, message: ChatLiveMessage, _turn: ChatPartTurn): void;
|
|
13
|
+
disposePart(): void;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
"wui-chat-part-text": WuiChatPartText;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -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
|
+
declare class WuiChatPartTicket extends ChatPartElement<Extract<ChatPart, {
|
|
5
|
+
kind: "Ticket";
|
|
6
|
+
}>> {
|
|
7
|
+
renderPart(part: Extract<ChatPart, {
|
|
8
|
+
kind: "Ticket";
|
|
9
|
+
}>, _message: ChatLiveMessage, turn: ChatPartTurn): void;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface HTMLElementTagNameMap {
|
|
13
|
+
"wui-chat-part-ticket": WuiChatPartTicket;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
1
16
|
export {};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
import type { ChatLiveMessage, ChatPart } from "@webority/chat-core";
|
|
1
2
|
import { ChatPartElement } from "./part-base.js";
|
|
2
|
-
|
|
3
|
+
import type { ChatPartTurn } from "./part-turn.js";
|
|
4
|
+
type VoiceClipPart = Extract<ChatPart, {
|
|
5
|
+
kind: "VoiceClip";
|
|
6
|
+
}>;
|
|
7
|
+
export declare class WuiChatPartVoiceClip extends ChatPartElement<VoiceClipPart> {
|
|
3
8
|
#private;
|
|
4
|
-
renderPart(part:
|
|
9
|
+
renderPart(part: VoiceClipPart, _message: ChatLiveMessage, turn: ChatPartTurn): void;
|
|
5
10
|
disposePart(): void;
|
|
6
11
|
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
"wui-chat-part-voice-clip": WuiChatPartVoiceClip;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
+
import type { ChatFeature, ChatLabels, ChatLiveMessage, ChatSessionState } from "@webority/chat-core";
|
|
1
2
|
/**
|
|
2
3
|
* Appends the Share and Print buttons of one reply to its actions container.
|
|
3
|
-
*
|
|
4
|
-
* @param {object} message a ChatLiveMessage whose author is Assistant, Agent or Script
|
|
5
|
-
* @param {{ labels: object, features: object, title: string, assistantName: string | undefined, busy: boolean }} context
|
|
4
|
+
* The container is the div.wui-chat-message-actions; the message is a ChatLiveMessage whose author is Assistant, Agent or Script.
|
|
6
5
|
*/
|
|
7
|
-
export declare function appendReplyActions(container: HTMLElement, message:
|
|
8
|
-
labels:
|
|
9
|
-
features:
|
|
6
|
+
export declare function appendReplyActions(container: HTMLElement, message: ChatLiveMessage, context: {
|
|
7
|
+
labels: ChatLabels;
|
|
8
|
+
features: Readonly<Record<ChatFeature, boolean>>;
|
|
10
9
|
title: string;
|
|
11
10
|
assistantName: string | undefined;
|
|
12
11
|
busy: boolean;
|
|
13
12
|
}): void;
|
|
14
13
|
/**
|
|
15
14
|
* Paints the Share and Print buttons of the whole conversation into the header's container.
|
|
16
|
-
*
|
|
17
|
-
* @param {object} state the ChatSessionState
|
|
18
|
-
* @param {{ labels: object, features: object, title: string, getState: () => object, iconOnly?: boolean }} context iconOnly draws icon buttons
|
|
15
|
+
* The item is the span.wui-chat-header-conversation; the state is the ChatSessionState; iconOnly draws icon buttons.
|
|
19
16
|
*/
|
|
20
|
-
export declare function paintConversationActions(item: HTMLElement, state:
|
|
21
|
-
labels:
|
|
22
|
-
features:
|
|
17
|
+
export declare function paintConversationActions(item: HTMLElement, state: ChatSessionState, context: {
|
|
18
|
+
labels: ChatLabels;
|
|
19
|
+
features: Readonly<Record<ChatFeature, boolean>>;
|
|
23
20
|
title: string;
|
|
24
|
-
getState: () =>
|
|
21
|
+
getState: () => ChatSessionState;
|
|
25
22
|
iconOnly?: boolean;
|
|
26
23
|
}): void;
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
export declare function createDockedShell(options:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare function createDockedShell(options: {
|
|
2
|
+
id: string;
|
|
3
|
+
position: "start" | "end";
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
}): {
|
|
6
|
+
root: HTMLDivElement;
|
|
7
|
+
panel: HTMLElement;
|
|
8
|
+
setLabels: (next: import("@webority/chat-core").ChatLabels) => void;
|
|
9
|
+
nudgeHost: HTMLDivElement | null;
|
|
10
|
+
launcherButton: HTMLButtonElement | null;
|
|
11
|
+
role: string;
|
|
12
|
+
setOpen: (next: boolean) => void;
|
|
13
|
+
setAppearance: (next: Parameters<(options: Parameters<typeof import("./dom.js").applyAppearance>[1] & {
|
|
14
|
+
theme?: "light" | "dark" | "auto";
|
|
15
|
+
launcherStyle?: import("@webority/chat-core").ChatLauncherStyle;
|
|
16
|
+
compact?: boolean;
|
|
17
|
+
labelReveal?: import("@webority/chat-core").ChatLabelReveal;
|
|
18
|
+
entrance?: import("@webority/chat-core").ChatEntrance;
|
|
19
|
+
idle?: import("@webority/chat-core").ChatIdleMotion;
|
|
20
|
+
phone?: boolean;
|
|
21
|
+
hoverLabel?: string | null;
|
|
22
|
+
launcherMark?: import("@webority/chat-core").ChatLauncherMark;
|
|
23
|
+
icon?: string;
|
|
24
|
+
launcherState?: "idle" | "entering" | undefined;
|
|
25
|
+
peek?: boolean | undefined;
|
|
26
|
+
peekSeconds?: number | undefined;
|
|
27
|
+
hideWhileOpen?: boolean | undefined;
|
|
28
|
+
phoneMode?: import("@webority/chat-core").ChatPhoneMode | undefined;
|
|
29
|
+
sheetHeightDvh?: number | undefined;
|
|
30
|
+
sheetMaxHeightPx?: number | undefined;
|
|
31
|
+
}) => void>[0]) => void;
|
|
10
32
|
destroy: () => void;
|
|
11
33
|
};
|
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
export declare function createEmbedShell(options:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare function createEmbedShell(options: {
|
|
2
|
+
id: string;
|
|
3
|
+
position: "start" | "end";
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
}): {
|
|
6
|
+
root: HTMLDivElement;
|
|
7
|
+
panel: HTMLElement;
|
|
8
|
+
setOpen: (next: boolean) => void;
|
|
9
|
+
setLabels: (next: import("@webority/chat-core").ChatLabels) => void;
|
|
10
|
+
setAppearance: (options: Parameters<typeof import("./dom.js").applyAppearance>[1] & {
|
|
11
|
+
theme?: "light" | "dark" | "auto";
|
|
12
|
+
launcherStyle?: import("@webority/chat-core").ChatLauncherStyle;
|
|
13
|
+
compact?: boolean;
|
|
14
|
+
labelReveal?: import("@webority/chat-core").ChatLabelReveal;
|
|
15
|
+
entrance?: import("@webority/chat-core").ChatEntrance;
|
|
16
|
+
idle?: import("@webority/chat-core").ChatIdleMotion;
|
|
17
|
+
phone?: boolean;
|
|
18
|
+
hoverLabel?: string | null;
|
|
19
|
+
launcherMark?: import("@webority/chat-core").ChatLauncherMark;
|
|
20
|
+
icon?: string;
|
|
21
|
+
launcherState?: "idle" | "entering" | undefined;
|
|
22
|
+
peek?: boolean | undefined;
|
|
23
|
+
peekSeconds?: number | undefined;
|
|
24
|
+
hideWhileOpen?: boolean | undefined;
|
|
25
|
+
phoneMode?: import("@webority/chat-core").ChatPhoneMode | undefined;
|
|
26
|
+
sheetHeightDvh?: number | undefined;
|
|
27
|
+
sheetMaxHeightPx?: number | undefined;
|
|
28
|
+
}) => void;
|
|
29
|
+
nudgeHost: HTMLDivElement | null;
|
|
30
|
+
launcherButton: HTMLButtonElement | null;
|
|
31
|
+
role: string;
|
|
10
32
|
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createShellBase } from "./dom.js";
|
|
2
|
+
export declare function createLauncherShell(options: {
|
|
3
|
+
id: string;
|
|
4
|
+
position: "start" | "end";
|
|
5
|
+
onToggle: () => void;
|
|
6
|
+
}): {
|
|
7
|
+
root: HTMLDivElement;
|
|
8
|
+
panel: HTMLElement;
|
|
9
|
+
setLabels: (next: import("@webority/chat-core").ChatLabels) => void;
|
|
10
|
+
role: string;
|
|
11
|
+
nudgeHost: HTMLDivElement;
|
|
12
|
+
launcherButton: HTMLButtonElement;
|
|
13
|
+
setOpen: (next: boolean) => void;
|
|
14
|
+
setAppearance: (options: Parameters<ReturnType<typeof createShellBase>["setAppearance"]>[0] & {
|
|
15
|
+
reduced?: boolean | undefined;
|
|
16
|
+
expressive?: boolean | undefined;
|
|
17
|
+
}) => void;
|
|
10
18
|
};
|
|
@@ -1,10 +1,32 @@
|
|
|
1
|
-
export declare function createPageShell(options:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export declare function createPageShell(options: {
|
|
2
|
+
id: string;
|
|
3
|
+
position: "start" | "end";
|
|
4
|
+
onToggle: () => void;
|
|
5
|
+
}): {
|
|
6
|
+
root: HTMLDivElement;
|
|
7
|
+
panel: HTMLElement;
|
|
8
|
+
setOpen: (next: boolean) => void;
|
|
9
|
+
setLabels: (next: import("@webority/chat-core").ChatLabels) => void;
|
|
10
|
+
setAppearance: (options: Parameters<typeof import("./dom.js").applyAppearance>[1] & {
|
|
11
|
+
theme?: "light" | "dark" | "auto";
|
|
12
|
+
launcherStyle?: import("@webority/chat-core").ChatLauncherStyle;
|
|
13
|
+
compact?: boolean;
|
|
14
|
+
labelReveal?: import("@webority/chat-core").ChatLabelReveal;
|
|
15
|
+
entrance?: import("@webority/chat-core").ChatEntrance;
|
|
16
|
+
idle?: import("@webority/chat-core").ChatIdleMotion;
|
|
17
|
+
phone?: boolean;
|
|
18
|
+
hoverLabel?: string | null;
|
|
19
|
+
launcherMark?: import("@webority/chat-core").ChatLauncherMark;
|
|
20
|
+
icon?: string;
|
|
21
|
+
launcherState?: "idle" | "entering" | undefined;
|
|
22
|
+
peek?: boolean | undefined;
|
|
23
|
+
peekSeconds?: number | undefined;
|
|
24
|
+
hideWhileOpen?: boolean | undefined;
|
|
25
|
+
phoneMode?: import("@webority/chat-core").ChatPhoneMode | undefined;
|
|
26
|
+
sheetHeightDvh?: number | undefined;
|
|
27
|
+
sheetMaxHeightPx?: number | undefined;
|
|
28
|
+
}) => void;
|
|
29
|
+
nudgeHost: HTMLDivElement | null;
|
|
30
|
+
launcherButton: HTMLButtonElement | null;
|
|
31
|
+
role: string;
|
|
10
32
|
};
|
package/dist/types/starters.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type ChatConversationSummary, type ChatFeature, type ChatLabels, type ChatOpenTicket, type ChatStarter } from "@webority/chat-core";
|
|
2
|
+
type StarterView = {
|
|
3
|
+
labels: ChatLabels;
|
|
4
|
+
greeting: string | null;
|
|
5
|
+
intro: string | null;
|
|
6
|
+
starters: ChatStarter[];
|
|
7
|
+
showStarters: boolean;
|
|
8
|
+
resume: ChatConversationSummary | null;
|
|
9
|
+
openTickets: ChatOpenTicket[];
|
|
10
|
+
features: Readonly<Record<ChatFeature, boolean>>;
|
|
11
|
+
ticketsClickable: boolean;
|
|
7
12
|
};
|
|
13
|
+
export declare function createStarters(handlers: {
|
|
14
|
+
onStarter: (starter: ChatStarter) => void;
|
|
15
|
+
onResume: () => void;
|
|
16
|
+
onTicket: (ticket: ChatOpenTicket) => void;
|
|
17
|
+
}): {
|
|
18
|
+
el: HTMLDivElement;
|
|
19
|
+
paint: (view: StarterView) => void;
|
|
20
|
+
intro: (ms: number) => void;
|
|
21
|
+
extraHost: HTMLDivElement;
|
|
22
|
+
pastHost: HTMLDivElement;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
package/dist/types/thread.d.ts
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ChatFeature, ChatLabels, ChatLiveMessage, ChatLoaderStyle, ChatPart, ChatPartKind, ChatRating, ChatTurnApi, ChatTurnError } from "@webority/chat-core";
|
|
2
|
+
import { createReadAloudButton } from "./voice/read-aloud-button.js";
|
|
3
|
+
type ThreadState = {
|
|
4
|
+
conversationId: string | null;
|
|
5
|
+
profile: {
|
|
6
|
+
assistant: {
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
} | null;
|
|
10
|
+
features: Readonly<Record<ChatFeature, boolean>>;
|
|
11
|
+
messages: ChatLiveMessage[];
|
|
12
|
+
greeting: string | null;
|
|
13
|
+
agentTyping: {
|
|
14
|
+
displayName: string | null;
|
|
15
|
+
} | null;
|
|
16
|
+
thinking: boolean;
|
|
17
|
+
steps: string[];
|
|
18
|
+
streaming: boolean;
|
|
19
|
+
turnError: ChatTurnError | null;
|
|
20
|
+
stopped: boolean;
|
|
21
|
+
};
|
|
22
|
+
type ThreadContext = {
|
|
23
|
+
labels: ChatLabels;
|
|
24
|
+
loaderStyle: ChatLoaderStyle;
|
|
25
|
+
reduced?: boolean | undefined;
|
|
26
|
+
phrases: readonly string[];
|
|
27
|
+
intervalMs: number;
|
|
28
|
+
assistantName?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
type Renderers = Readonly<Record<ChatPartKind, string>>;
|
|
31
|
+
export declare function createThread(options: {
|
|
32
|
+
getRenderers: () => Renderers;
|
|
33
|
+
getLayoutParts: () => ((message: ChatLiveMessage) => (ChatPart | ChatPart[])[]) | null;
|
|
34
|
+
makeTurnApi: (messageId: string) => ChatTurnApi;
|
|
35
|
+
onRetry: () => void;
|
|
36
|
+
onRegenerate: () => void;
|
|
37
|
+
onRate: (messageId: string, rating: ChatRating) => Promise<void>;
|
|
38
|
+
getSession: () => {
|
|
39
|
+
startEdit(messageId: string): void;
|
|
40
|
+
};
|
|
41
|
+
getVoice?: () => Parameters<typeof createReadAloudButton>[0]["voice"] | null;
|
|
42
|
+
}): {
|
|
43
|
+
el: HTMLDivElement;
|
|
44
|
+
paint: (state: ThreadState, context: ThreadContext) => void;
|
|
45
|
+
find: (messageId: string) => HTMLLIElement | null;
|
|
5
46
|
destroy: () => void;
|
|
6
47
|
};
|
|
48
|
+
export {};
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { ChatLabels } from "@webority/chat-core";
|
|
2
|
+
import { type createVoiceController } from "./controller.js";
|
|
3
|
+
type VoiceUi = Pick<ReturnType<typeof createVoiceController>, "canDictate" | "getStatus" | "stop" | "subscribe" | "toggleDictation">;
|
|
4
|
+
type ComposerLabels = Pick<ChatLabels, "dictate" | "dictateStop" | "dictateListening" | "dictationBlocked" | "dictationNoMicrophone" | "dictationNotHeard" | "dictationUnavailable" | "dictationFailed" | "readAloudFailed">;
|
|
5
|
+
type ComposerView = {
|
|
6
|
+
state: {
|
|
7
|
+
messagesLeftToday: number | null;
|
|
8
|
+
handoffPause?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function handleTypingKey(event: Pick<KeyboardEvent, "isTrusted" | "key">, voice: Pick<VoiceUi, "getStatus" | "stop">): void;
|
|
12
|
+
export declare function createComposerVoice({ voice, getLabels, textarea, onTextChanged, }: {
|
|
13
|
+
voice: VoiceUi;
|
|
14
|
+
getLabels: () => ComposerLabels;
|
|
15
|
+
textarea: HTMLTextAreaElement;
|
|
16
|
+
onTextChanged: () => void;
|
|
7
17
|
}): {
|
|
8
|
-
buttons:
|
|
9
|
-
note:
|
|
10
|
-
announcer:
|
|
11
|
-
paint: (view:
|
|
18
|
+
buttons: HTMLButtonElement[];
|
|
19
|
+
note: HTMLParagraphElement;
|
|
20
|
+
announcer: HTMLSpanElement;
|
|
21
|
+
paint: (view: ComposerView) => void;
|
|
12
22
|
destroy: () => void;
|
|
13
23
|
};
|
|
24
|
+
export {};
|
|
@@ -1,24 +1,49 @@
|
|
|
1
|
+
import { type ChatLabels, type ChatPart, type ChatProfileView, type ChatSessionState, type ChatSpeechAdapter, type ChatSpeechErrorCode, type ChatSpeechToken } from "@webority/chat-core";
|
|
1
2
|
export declare const VOICE_NOTE_MS = 8000;
|
|
2
3
|
export declare const SPEAK_MAX_CHARS = 6000;
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
type VoiceMode = "Idle" | "Dictating" | "Speaking";
|
|
5
|
+
type VoiceNote = {
|
|
6
|
+
code: ChatSpeechErrorCode | "SpeakFailed";
|
|
7
|
+
source: "Dictation" | "ReadAloud";
|
|
8
|
+
sticky: boolean;
|
|
9
|
+
messageId?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
type VoiceStatus = {
|
|
12
|
+
mode: VoiceMode;
|
|
13
|
+
messageId: string | null;
|
|
14
|
+
startedAtMs: number | null;
|
|
15
|
+
note: VoiceNote | null;
|
|
16
|
+
};
|
|
17
|
+
type VoiceIo = {
|
|
18
|
+
getText: () => string;
|
|
19
|
+
setText: (text: string) => void;
|
|
20
|
+
};
|
|
21
|
+
type VoiceSpeech = Pick<ChatSpeechAdapter, "dictation" | "readAloud" | "startDictation" | "speak">;
|
|
22
|
+
type VoiceState = {
|
|
23
|
+
features: Pick<ChatSessionState["features"], "Dictation" | "ReadAloud">;
|
|
24
|
+
profile: Pick<ChatProfileView, "speechAvailable"> | null;
|
|
25
|
+
};
|
|
26
|
+
type VoiceOptions = {
|
|
27
|
+
getState: () => VoiceState;
|
|
28
|
+
getToken: () => Promise<ChatSpeechToken>;
|
|
29
|
+
speech?: VoiceSpeech;
|
|
30
|
+
};
|
|
31
|
+
type NoteLabels = Pick<ChatLabels, "dictationBlocked" | "dictationNoMicrophone" | "dictationNotHeard" | "dictationUnavailable" | "dictationFailed" | "readAloudFailed">;
|
|
32
|
+
export declare function speakableText(parts: readonly ChatPart[]): string;
|
|
33
|
+
export declare function noteText(note: VoiceNote, labels: NoteLabels): string;
|
|
5
34
|
/**
|
|
6
35
|
* The one object that knows which voice activity runs. Dictation and read-aloud share one slot,
|
|
7
36
|
* so starting one stops the other.
|
|
8
37
|
*/
|
|
9
|
-
export declare function createVoiceController(options:
|
|
38
|
+
export declare function createVoiceController(options: VoiceOptions): {
|
|
10
39
|
canDictate: () => boolean;
|
|
11
40
|
canSpeak: () => boolean;
|
|
12
|
-
getStatus: () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
note: any;
|
|
17
|
-
};
|
|
18
|
-
subscribe: (listener: any) => () => void;
|
|
19
|
-
toggleDictation: (io: any) => Promise<void>;
|
|
20
|
-
toggleSpeak: (id: any, parts: any) => Promise<void>;
|
|
41
|
+
getStatus: () => VoiceStatus;
|
|
42
|
+
subscribe: (listener: (status: VoiceStatus) => void) => () => void;
|
|
43
|
+
toggleDictation: (io: VoiceIo) => Promise<void>;
|
|
44
|
+
toggleSpeak: (id: string, parts: readonly ChatPart[]) => Promise<void>;
|
|
21
45
|
stop: () => void;
|
|
22
46
|
dismissNote: () => void;
|
|
23
47
|
destroy: () => void;
|
|
24
48
|
};
|
|
49
|
+
export {};
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
declare const PATHS: {
|
|
2
|
+
readonly mic: "M12 15a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v6a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-2.08A7 7 0 0 0 19 12z";
|
|
3
|
+
readonly stop: "M6 6h12v12H6z";
|
|
4
|
+
readonly play: "M8 5v14l11-7z";
|
|
5
|
+
readonly pause: "M6 5h4v14H6zm8 0h4v14h-4z";
|
|
6
|
+
readonly speaker: "M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1a7 7 0 0 1 0 13.4v2.1a9 9 0 0 0 0-17.6z";
|
|
7
|
+
};
|
|
8
|
+
export declare function voiceIcon(name: keyof typeof PATHS, size?: number): SVGSVGElement;
|
|
9
|
+
export {};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
getLabels:
|
|
8
|
-
message:
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import type { ChatLabels, ChatLiveMessage } from "@webority/chat-core";
|
|
2
|
+
import { type createVoiceController } from "./controller.js";
|
|
3
|
+
type ReadAloudVoice = Pick<ReturnType<typeof createVoiceController>, "canSpeak" | "getStatus" | "toggleSpeak">;
|
|
4
|
+
type NoteLabels = Pick<ChatLabels, "dictationBlocked" | "dictationNoMicrophone" | "dictationNotHeard" | "dictationUnavailable" | "dictationFailed" | "readAloudFailed">;
|
|
5
|
+
export declare function createReadAloudButton({ voice, getLabels, message, }: {
|
|
6
|
+
voice: ReadAloudVoice;
|
|
7
|
+
getLabels: () => Pick<ChatLabels, "readAloud" | "readAloudStop">;
|
|
8
|
+
message: Pick<ChatLiveMessage, "id" | "streaming" | "parts">;
|
|
9
|
+
}): HTMLButtonElement | null;
|
|
10
|
+
export declare function createReadAloudNote({ voice, getLabels, message, }: {
|
|
11
|
+
voice: Pick<ReadAloudVoice, "getStatus">;
|
|
12
|
+
getLabels: () => NoteLabels;
|
|
13
|
+
message: Pick<ChatLiveMessage, "id">;
|
|
14
|
+
}): HTMLSpanElement | null;
|
|
15
|
+
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ChatAutoOpenSettings, ChatLook } from "@webority/chat-core";
|
|
2
|
+
type AutoOpenHooks = {
|
|
3
|
+
open(): void;
|
|
4
|
+
isOpen(): boolean;
|
|
5
|
+
panelRect(): DOMRectReadOnly | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function watchAutoOpen(settings: ChatAutoOpenSettings, look: Pick<ChatLook, "avoid">, hooks: AutoOpenHooks): {
|
|
2
8
|
cancel(): void;
|
|
3
9
|
};
|
|
10
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ChatLauncherSettings, ChatLook } from "@webority/chat-core";
|
|
2
|
+
export declare function createAvoidance(avoid: ChatLook["avoid"], launcher: Pick<ChatLauncherSettings, "liftAboveFooter" | "stepAsideForMenus" | "switchOnDark">, element: HTMLElement): {
|
|
2
3
|
destroy(): void;
|
|
3
4
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare function createBehaviourCollector(servicePathPrefixes:
|
|
1
|
+
export declare function createBehaviourCollector(servicePathPrefixes: string[]): () => {
|
|
2
2
|
timeOnSiteSeconds: number;
|
|
3
3
|
scrollPercent: number;
|
|
4
|
-
pagesViewed:
|
|
5
|
-
viewedServices:
|
|
4
|
+
pagesViewed: number;
|
|
5
|
+
viewedServices: string[];
|
|
6
6
|
};
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type ChatAbortSignal, type ChatLabels } from "@webority/chat-core";
|
|
2
|
+
type ExplainSession = {
|
|
3
|
+
getState(): {
|
|
4
|
+
features: {
|
|
5
|
+
Explain?: boolean;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
subscribe(listener: () => void): () => void;
|
|
9
|
+
};
|
|
10
|
+
type ExplainOptions = {
|
|
7
11
|
trigger: HTMLElement;
|
|
8
12
|
title?: string;
|
|
9
|
-
request: (signal:
|
|
13
|
+
request: (signal: ChatAbortSignal) => Promise<unknown>;
|
|
10
14
|
isEmpty?: (answer: unknown) => boolean;
|
|
11
15
|
renderAnswer: (answer: unknown, context: object) => Node | null;
|
|
12
16
|
renderFooter?: (context: object) => Node | null;
|
|
13
|
-
labels?:
|
|
17
|
+
labels?: Partial<ChatLabels>;
|
|
14
18
|
showNotCounted?: boolean;
|
|
15
19
|
returnFocusTo?: () => HTMLElement | null;
|
|
16
|
-
session?:
|
|
20
|
+
session?: ExplainSession;
|
|
17
21
|
timings?: object;
|
|
18
22
|
onStateChange?: (state: object) => void;
|
|
19
|
-
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Binds a Why? trigger to an explain controller from chat-core: the thinking pill, the popover, focus into the popover and back, Escape.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createExplainPopover(options: ExplainOptions): {
|
|
20
28
|
open(): void;
|
|
21
29
|
close(closeOptions?: {
|
|
22
30
|
restoreFocus?: boolean;
|
|
@@ -25,3 +33,4 @@ export declare function createExplainPopover(options: {
|
|
|
25
33
|
isOpen(): boolean;
|
|
26
34
|
destroy(): void;
|
|
27
35
|
};
|
|
36
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function trapTab(container:
|
|
2
|
-
export declare function returnFocus(element:
|
|
1
|
+
export declare function trapTab(container: HTMLElement, event: KeyboardEvent): void;
|
|
2
|
+
export declare function returnFocus(element: HTMLElement | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function vibrate(ms:
|
|
1
|
+
export declare function vibrate(ms: number, muted: boolean): void;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A moment as relative text ("5 minutes ago"), or a short date from 48 hours on; "" for invalid input.
|
|
3
|
-
* @param {string} iso
|
|
4
|
-
* @param {number} [now]
|
|
5
|
-
* @param {string} [locale]
|
|
6
|
-
* @returns {string}
|
|
7
|
-
*/
|
|
1
|
+
/** A moment as relative text ("5 minutes ago"), or a short date from 48 hours on; "" for invalid input. */
|
|
8
2
|
export declare function relativeMoment(iso: string, now?: number, locale?: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* A moment as a medium date and short time in the viewer's zone; "" for invalid input.
|
|
11
|
-
* @param {string} iso
|
|
12
|
-
* @param {string} [locale]
|
|
13
|
-
* @returns {string}
|
|
14
|
-
*/
|
|
3
|
+
/** A moment as a medium date and short time in the viewer's zone; "" for invalid input. */
|
|
15
4
|
export declare function fullMoment(iso: string, locale?: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import type { ChatExperienceSettings, ChatLook } from "@webority/chat-core";
|
|
2
|
+
export declare function growFromButton(panel: HTMLElement, button: DOMRectReadOnly): void;
|
|
3
|
+
export declare function watchReducedMotion(look: Pick<ChatLook, "motion">, experience: Pick<ChatExperienceSettings, "motion"> | null): {
|
|
3
4
|
readonly reduced: boolean;
|
|
4
|
-
subscribe(listener:
|
|
5
|
+
subscribe(listener: (reduced: boolean) => void): () => void;
|
|
5
6
|
destroy(): void;
|
|
6
7
|
};
|