@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
package/dist/types/WuiChat.d.ts
CHANGED
|
@@ -1,279 +1,248 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ChatAttribution, ChatFeature, ChatLabels, ChatLiveMessage, ChatLook, ChatPart, ChatPartKind, ChatProfileView, ChatSession, ChatSessionState, ChatTurnApi, ConversationList } from "@webority/chat-core";
|
|
2
|
+
import { createComposer } from "./composer.js";
|
|
3
|
+
import { ElementBase } from "./elementBase.js";
|
|
4
|
+
import { createFooter } from "./footer.js";
|
|
5
|
+
import { createHeader } from "./header.js";
|
|
6
|
+
import { createHistory } from "./history.js";
|
|
7
|
+
import { createNudge } from "./nudge.js";
|
|
8
|
+
import { createPastChats } from "./past-chats.js";
|
|
9
|
+
import { createDockedShell } from "./shell-docked.js";
|
|
10
|
+
import { createStarters } from "./starters.js";
|
|
11
|
+
import { createThread } from "./thread.js";
|
|
12
|
+
import { createVoiceController } from "./voice/controller.js";
|
|
13
|
+
import { createAvoidance, createBehaviourCollector, createSound, fitToViewport, lockPageScroll, watchAutoOpen, watchReducedMotion } from "./web/index.js";
|
|
14
|
+
type Layout = (typeof LAYOUTS)[number];
|
|
15
|
+
type Position = "end" | "start";
|
|
16
|
+
type BooleanAttribute = boolean | "" | "true" | "false";
|
|
17
|
+
type FilePart = Extract<ChatPart, {
|
|
18
|
+
kind: "File";
|
|
19
|
+
}>;
|
|
20
|
+
type OpenTicket = {
|
|
21
|
+
ticketId: string;
|
|
22
|
+
number: string;
|
|
3
23
|
};
|
|
4
|
-
|
|
5
|
-
|
|
24
|
+
type ResolveLink = (href: string) => string | null | undefined;
|
|
25
|
+
type OpenTrigger = "manual" | "auto";
|
|
26
|
+
type PanelSwitchPayload = {
|
|
27
|
+
from: string;
|
|
28
|
+
to: "docked" | "full-page";
|
|
29
|
+
conversationId: string | null;
|
|
30
|
+
draft: string | null;
|
|
31
|
+
};
|
|
32
|
+
type LayoutParts = (message: ChatLiveMessage) => (ChatPart | ChatPart[])[];
|
|
33
|
+
type RendererApi = {
|
|
34
|
+
define: (kind: string, tagName: string) => void;
|
|
35
|
+
map: Record<ChatPartKind, string>;
|
|
36
|
+
};
|
|
37
|
+
type Shell = Pick<ReturnType<typeof createDockedShell>, "root" | "panel" | "setLabels" | "nudgeHost" | "launcherButton" | "role" | "setOpen" | "setAppearance"> & {
|
|
38
|
+
destroy?: () => void;
|
|
39
|
+
};
|
|
40
|
+
/** Every attribute `<wui-chat>` reads. Values are strings, as the DOM stores them; a closed set lists its words in lower case, which the element also takes in any case. */
|
|
41
|
+
export type WuiChatAttributes = {
|
|
42
|
+
base: string;
|
|
43
|
+
layout?: "launcher" | "docked" | "full-page" | "embedded";
|
|
44
|
+
position?: Position;
|
|
45
|
+
"offset-x"?: `${number}`;
|
|
46
|
+
"offset-y"?: `${number}`;
|
|
47
|
+
loader?: "steps" | "phrases" | "orb" | "skeleton";
|
|
48
|
+
screen?: string;
|
|
49
|
+
motion?: "on" | "reduced";
|
|
50
|
+
theme?: "auto" | "light" | "dark";
|
|
51
|
+
icon?: string;
|
|
52
|
+
avatar?: string;
|
|
53
|
+
narrow?: string;
|
|
54
|
+
compact?: BooleanAttribute;
|
|
55
|
+
expressive?: BooleanAttribute;
|
|
56
|
+
open?: BooleanAttribute;
|
|
57
|
+
labels?: string;
|
|
58
|
+
"page-context"?: string;
|
|
59
|
+
"conversation-id"?: string;
|
|
60
|
+
"launcher-style"?: "round" | "pill";
|
|
61
|
+
entrance?: "slide-up" | "bounce-in" | "fade-in-pulse" | "spin-scale" | "wiggle-in" | "elastic-in" | "rise" | "none";
|
|
62
|
+
idle?: "float-and-pulse" | "ring" | "none";
|
|
63
|
+
"label-reveal"?: "bubble" | "expand";
|
|
64
|
+
"launcher-mark"?: "icon" | "avatar" | "orb";
|
|
65
|
+
"panel-height"?: "fixed" | "content";
|
|
66
|
+
"reply-avatars"?: BooleanAttribute;
|
|
67
|
+
"greeting-loader-ms"?: `${number}`;
|
|
68
|
+
"panel-motion"?: "spring" | "gentle" | "none";
|
|
69
|
+
"panel-width"?: `${number}`;
|
|
70
|
+
"panel-max-height"?: `${number}`;
|
|
71
|
+
"panel-bottom-gap"?: `${number}`;
|
|
72
|
+
"phone-max-width"?: `${number}`;
|
|
73
|
+
"phone-mode"?: "full-screen" | "sheet";
|
|
74
|
+
"sheet-height-dvh"?: `${number}`;
|
|
75
|
+
"sheet-max-height"?: `${number}`;
|
|
76
|
+
"input-ring"?: BooleanAttribute;
|
|
77
|
+
"send-reveal"?: "on-text" | "always";
|
|
78
|
+
"send-icon"?: string;
|
|
79
|
+
"lift-selectors"?: string;
|
|
80
|
+
"menu-selectors"?: string;
|
|
81
|
+
"dark-selectors"?: string;
|
|
82
|
+
"autoopen-busy-selectors"?: string;
|
|
83
|
+
"autoopen-optout-selector"?: string;
|
|
84
|
+
};
|
|
85
|
+
/** Every CustomEvent `<wui-chat>` dispatches, by event name, with the type of its detail. */
|
|
86
|
+
export type WuiChatEventMap = {
|
|
87
|
+
"wui-chat-event": {
|
|
88
|
+
name: string;
|
|
89
|
+
data: Record<string, unknown>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
declare const LAYOUTS: readonly ["launcher", "docked", "full-page", "embedded"];
|
|
93
|
+
export declare function defineDefaultRenderer(kind: string, tagName: string): void;
|
|
94
|
+
/** The `<wui-chat>` element: the chat panel, launcher and page shells over one chat session. */
|
|
95
|
+
export declare class WuiChat extends ElementBase {
|
|
96
|
+
base: string;
|
|
97
|
+
screen: string;
|
|
98
|
+
icon: string;
|
|
99
|
+
layout: string;
|
|
100
|
+
position: string;
|
|
6
101
|
_uid: string;
|
|
7
102
|
_built: boolean;
|
|
8
|
-
_session:
|
|
9
|
-
_unsubscribe:
|
|
10
|
-
_voice:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_labelsProp: any;
|
|
29
|
-
_pageContextProp: any;
|
|
30
|
-
_layoutParts: any;
|
|
31
|
-
_renderers: {
|
|
32
|
-
Text: string;
|
|
33
|
-
Sources: string;
|
|
34
|
-
QuickReplies: string;
|
|
35
|
-
InputRequest: string;
|
|
36
|
-
Action: string;
|
|
37
|
-
Notice: string;
|
|
38
|
-
Table: string;
|
|
39
|
-
Chart: string;
|
|
40
|
-
Figures: string;
|
|
41
|
-
RecordCard: string;
|
|
42
|
-
Image: string;
|
|
43
|
-
File: string;
|
|
44
|
-
Ticket: string;
|
|
45
|
-
Handoff: string;
|
|
46
|
-
VoiceClip: string;
|
|
47
|
-
};
|
|
48
|
-
_rendererApi: {
|
|
49
|
-
define: (kind: any, tagName: any) => void;
|
|
50
|
-
map: {
|
|
51
|
-
Text: string;
|
|
52
|
-
Sources: string;
|
|
53
|
-
QuickReplies: string;
|
|
54
|
-
InputRequest: string;
|
|
55
|
-
Action: string;
|
|
56
|
-
Notice: string;
|
|
57
|
-
Table: string;
|
|
58
|
-
Chart: string;
|
|
59
|
-
Figures: string;
|
|
60
|
-
RecordCard: string;
|
|
61
|
-
Image: string;
|
|
62
|
-
File: string;
|
|
63
|
-
Ticket: string;
|
|
64
|
-
Handoff: string;
|
|
65
|
-
VoiceClip: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
_captchaToken: any;
|
|
69
|
-
_attribution: any;
|
|
70
|
-
_openAttachmentProp: any;
|
|
71
|
-
_openCitationProp: any;
|
|
72
|
-
_openTargetProp: any;
|
|
73
|
-
_resolveLinkProp: any;
|
|
74
|
-
_openTicketProp: any;
|
|
75
|
-
_emptyContentProp: any;
|
|
76
|
-
_onPanelSwitchProp: any;
|
|
77
|
-
_preloadPanelSwitchProp: any;
|
|
103
|
+
_session: ChatSession | null;
|
|
104
|
+
_unsubscribe: (() => void) | null;
|
|
105
|
+
_voice: ReturnType<typeof createVoiceController> | null;
|
|
106
|
+
_voiceConversationId: string | null | undefined;
|
|
107
|
+
_shell: Shell;
|
|
108
|
+
_labelsProp: Partial<ChatLabels> | undefined;
|
|
109
|
+
_pageContextProp: unknown;
|
|
110
|
+
_layoutParts: LayoutParts | null;
|
|
111
|
+
_renderers: Record<ChatPartKind, string>;
|
|
112
|
+
_rendererApi: RendererApi;
|
|
113
|
+
_captchaToken: ((action: string) => Promise<string | null>) | null;
|
|
114
|
+
_attribution: (() => ChatAttribution | null) | null;
|
|
115
|
+
_openAttachmentProp: ((part: FilePart) => void) | null;
|
|
116
|
+
_openCitationProp: ((messageId: string, marker: number) => void) | null;
|
|
117
|
+
_openTargetProp: ((target: string) => void) | null;
|
|
118
|
+
_resolveLinkProp: ResolveLink | null;
|
|
119
|
+
_openTicketProp: ((ticket: OpenTicket) => void) | undefined;
|
|
120
|
+
_emptyContentProp: Node | null;
|
|
121
|
+
_onPanelSwitchProp: ((payload: PanelSwitchPayload) => Promise<void>) | null;
|
|
122
|
+
_preloadPanelSwitchProp: (() => Promise<void>) | null;
|
|
78
123
|
_preloaded: boolean;
|
|
79
|
-
_pastList:
|
|
80
|
-
_past:
|
|
81
|
-
el: HTMLElement;
|
|
82
|
-
refresh(): void;
|
|
83
|
-
paint(): void;
|
|
84
|
-
dispose(): void;
|
|
85
|
-
} | null;
|
|
124
|
+
_pastList: ConversationList | null;
|
|
125
|
+
_past: ReturnType<typeof createPastChats> | null;
|
|
86
126
|
_pastRefreshed: boolean;
|
|
87
127
|
_historyShown: boolean;
|
|
88
|
-
_openedConversation:
|
|
128
|
+
_openedConversation: string | null;
|
|
89
129
|
_lastOpen: boolean;
|
|
90
|
-
_openTrigger:
|
|
91
|
-
_focusTimer:
|
|
130
|
+
_openTrigger: OpenTrigger;
|
|
131
|
+
_focusTimer: ReturnType<typeof setTimeout> | null;
|
|
92
132
|
_nudgeArmed: boolean;
|
|
93
133
|
_seeded: boolean;
|
|
94
134
|
_wasLoading: boolean;
|
|
95
|
-
_seen: Set<
|
|
96
|
-
_sound:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
} | null;
|
|
102
|
-
_behaviour: (() => {
|
|
103
|
-
timeOnSiteSeconds: number;
|
|
104
|
-
scrollPercent: number;
|
|
105
|
-
pagesViewed: any;
|
|
106
|
-
viewedServices: any;
|
|
107
|
-
}) | null;
|
|
108
|
-
_autoOpen: {
|
|
109
|
-
cancel(): void;
|
|
110
|
-
} | null;
|
|
111
|
-
_avoid: {
|
|
112
|
-
destroy(): void;
|
|
113
|
-
} | null;
|
|
114
|
-
_motion: {
|
|
115
|
-
readonly reduced: boolean;
|
|
116
|
-
subscribe(listener: any): () => void;
|
|
117
|
-
destroy(): void;
|
|
118
|
-
} | null;
|
|
135
|
+
_seen: Set<string>;
|
|
136
|
+
_sound: ReturnType<typeof createSound> | null;
|
|
137
|
+
_behaviour: ReturnType<typeof createBehaviourCollector> | null;
|
|
138
|
+
_autoOpen: ReturnType<typeof watchAutoOpen> | null;
|
|
139
|
+
_avoid: ReturnType<typeof createAvoidance> | null;
|
|
140
|
+
_motion: ReturnType<typeof watchReducedMotion> | null;
|
|
119
141
|
_phone: {
|
|
120
|
-
fit:
|
|
121
|
-
|
|
122
|
-
};
|
|
123
|
-
unlock: () => void;
|
|
142
|
+
fit: ReturnType<typeof fitToViewport>;
|
|
143
|
+
unlock: ReturnType<typeof lockPageScroll>;
|
|
124
144
|
} | null;
|
|
125
145
|
_requesting: boolean;
|
|
126
|
-
_onKeyDown: (event:
|
|
127
|
-
_onNavigateProp:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
paint: (view: any) => void;
|
|
149
|
-
focus: () => void;
|
|
150
|
-
destroy: () => void;
|
|
151
|
-
getDraft: () => any;
|
|
152
|
-
} | undefined;
|
|
153
|
-
_footer: {
|
|
154
|
-
el: any;
|
|
155
|
-
paint: (view: any) => void;
|
|
156
|
-
} | undefined;
|
|
157
|
-
_history: {
|
|
158
|
-
el: any;
|
|
159
|
-
show: () => void;
|
|
160
|
-
hide: () => void;
|
|
161
|
-
paint: () => void;
|
|
162
|
-
dispose: () => void;
|
|
163
|
-
} | undefined;
|
|
164
|
-
_nudge: {
|
|
165
|
-
el: any;
|
|
166
|
-
schedule: (options: any) => void;
|
|
167
|
-
cancel: () => void;
|
|
168
|
-
dismiss: () => void;
|
|
169
|
-
isShown: () => boolean;
|
|
170
|
-
destroy: () => void;
|
|
171
|
-
} | undefined;
|
|
172
|
-
_status: any;
|
|
173
|
-
_errorEl: any;
|
|
174
|
-
_liveStatus: any;
|
|
175
|
-
_talk: any;
|
|
176
|
-
_liveRetry: any;
|
|
177
|
-
_liveError: any;
|
|
178
|
-
_live: any;
|
|
179
|
-
_body: any;
|
|
180
|
-
_foot: any;
|
|
181
|
-
_launcherPlayed: boolean | undefined;
|
|
182
|
-
_openApplied: boolean | undefined;
|
|
183
|
-
hidden: boolean | undefined;
|
|
184
|
-
_introPlayed: boolean | undefined;
|
|
185
|
-
static get observedAttributes(): (string | ((raw: any) => any))[];
|
|
146
|
+
_onKeyDown: (event: KeyboardEvent) => void;
|
|
147
|
+
_onNavigateProp: ((path: string) => void) | undefined;
|
|
148
|
+
_openApplied?: boolean;
|
|
149
|
+
_launcherPlayed?: boolean;
|
|
150
|
+
_introPlayed?: boolean;
|
|
151
|
+
_header: ReturnType<typeof createHeader>;
|
|
152
|
+
_starters: ReturnType<typeof createStarters>;
|
|
153
|
+
_thread: ReturnType<typeof createThread>;
|
|
154
|
+
_composer: ReturnType<typeof createComposer>;
|
|
155
|
+
_footer: ReturnType<typeof createFooter>;
|
|
156
|
+
_history: ReturnType<typeof createHistory>;
|
|
157
|
+
_nudge: ReturnType<typeof createNudge>;
|
|
158
|
+
_status: HTMLElement;
|
|
159
|
+
_errorEl: HTMLElement;
|
|
160
|
+
_liveStatus: HTMLElement;
|
|
161
|
+
_talk: HTMLButtonElement;
|
|
162
|
+
_liveRetry: HTMLButtonElement;
|
|
163
|
+
_liveError: HTMLElement;
|
|
164
|
+
_live: HTMLElement;
|
|
165
|
+
_body: HTMLElement;
|
|
166
|
+
_foot: HTMLElement;
|
|
167
|
+
static get observedAttributes(): string[];
|
|
186
168
|
constructor();
|
|
187
|
-
get session():
|
|
188
|
-
get conversationId():
|
|
189
|
-
get labels():
|
|
190
|
-
set labels(value:
|
|
191
|
-
get pageContext():
|
|
192
|
-
set pageContext(value:
|
|
193
|
-
get compact():
|
|
194
|
-
set compact(value:
|
|
195
|
-
get expressive():
|
|
196
|
-
set expressive(value:
|
|
197
|
-
get open():
|
|
198
|
-
set open(value:
|
|
199
|
-
get renderers():
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
set attribution(value: any);
|
|
225
|
-
get openAttachment(): any;
|
|
226
|
-
set openAttachment(value: any);
|
|
227
|
-
get openCitation(): any;
|
|
228
|
-
set openCitation(value: any);
|
|
229
|
-
get openTarget(): any;
|
|
230
|
-
set openTarget(value: any);
|
|
231
|
-
get openTicket(): any;
|
|
232
|
-
set openTicket(value: any);
|
|
233
|
-
get onNavigate(): any;
|
|
234
|
-
set onNavigate(value: any);
|
|
235
|
-
get resolveLink(): any;
|
|
236
|
-
set resolveLink(value: any);
|
|
237
|
-
get emptyContent(): any;
|
|
238
|
-
set emptyContent(value: any);
|
|
239
|
-
get onPanelSwitch(): any;
|
|
240
|
-
set onPanelSwitch(value: any);
|
|
241
|
-
get preloadPanelSwitch(): any;
|
|
242
|
-
set preloadPanelSwitch(value: any);
|
|
169
|
+
get session(): ChatSession | null;
|
|
170
|
+
get conversationId(): string | null;
|
|
171
|
+
get labels(): ChatLabels;
|
|
172
|
+
set labels(value: Partial<ChatLabels> | null | undefined);
|
|
173
|
+
get pageContext(): unknown;
|
|
174
|
+
set pageContext(value: unknown);
|
|
175
|
+
get compact(): boolean;
|
|
176
|
+
set compact(value: BooleanAttribute);
|
|
177
|
+
get expressive(): boolean;
|
|
178
|
+
set expressive(value: BooleanAttribute);
|
|
179
|
+
get open(): boolean;
|
|
180
|
+
set open(value: BooleanAttribute);
|
|
181
|
+
get renderers(): RendererApi;
|
|
182
|
+
get layoutParts(): LayoutParts | null;
|
|
183
|
+
set layoutParts(value: LayoutParts | null | undefined);
|
|
184
|
+
get getCaptchaToken(): ((action: string) => Promise<string | null>) | null;
|
|
185
|
+
set getCaptchaToken(value: ((action: string) => Promise<string | null>) | null | undefined);
|
|
186
|
+
get attribution(): (() => ChatAttribution | null) | null;
|
|
187
|
+
set attribution(value: (() => ChatAttribution | null) | null | undefined);
|
|
188
|
+
get openAttachment(): (part: FilePart) => void;
|
|
189
|
+
set openAttachment(value: ((part: FilePart) => void) | null | undefined);
|
|
190
|
+
get openCitation(): (messageId: string, marker: number) => void;
|
|
191
|
+
set openCitation(value: ((messageId: string, marker: number) => void) | null | undefined);
|
|
192
|
+
get openTarget(): (target: string) => void;
|
|
193
|
+
set openTarget(value: ((target: string) => void) | null | undefined);
|
|
194
|
+
get openTicket(): ((ticket: OpenTicket) => void) | undefined;
|
|
195
|
+
set openTicket(value: ((ticket: OpenTicket) => void) | null | undefined);
|
|
196
|
+
get onNavigate(): ((path: string) => void) | undefined;
|
|
197
|
+
set onNavigate(value: ((path: string) => void) | null | undefined);
|
|
198
|
+
get resolveLink(): ResolveLink | null;
|
|
199
|
+
set resolveLink(value: ResolveLink | null | undefined);
|
|
200
|
+
get emptyContent(): Node | null;
|
|
201
|
+
set emptyContent(value: Node | null);
|
|
202
|
+
get onPanelSwitch(): ((payload: PanelSwitchPayload) => Promise<void>) | null;
|
|
203
|
+
set onPanelSwitch(value: ((payload: PanelSwitchPayload) => Promise<void>) | null | undefined);
|
|
204
|
+
get preloadPanelSwitch(): (() => Promise<void>) | null;
|
|
205
|
+
set preloadPanelSwitch(value: (() => Promise<void>) | null | undefined);
|
|
243
206
|
connectedCallback(): void;
|
|
244
207
|
_adoptEarlyProperties(): void;
|
|
245
208
|
disconnectedCallback(): void;
|
|
246
|
-
attributeChangedCallback(name:
|
|
209
|
+
attributeChangedCallback(name: string, previous: string | null, next: string | null): void;
|
|
247
210
|
toggle(): void;
|
|
248
211
|
close(): void;
|
|
249
212
|
newConversation(): void;
|
|
250
213
|
reset(): void;
|
|
251
|
-
_setOpen(open:
|
|
252
|
-
_assertLayout():
|
|
214
|
+
_setOpen(open: boolean, trigger: OpenTrigger): void;
|
|
215
|
+
_assertLayout(): Layout;
|
|
253
216
|
_assertPosition(): void;
|
|
217
|
+
private get _position();
|
|
254
218
|
_isLauncherLike(): boolean;
|
|
219
|
+
private requireSession;
|
|
220
|
+
private requireVoice;
|
|
221
|
+
private requireMotion;
|
|
222
|
+
private requirePastList;
|
|
223
|
+
private requireNudgeHost;
|
|
255
224
|
_build(): void;
|
|
256
|
-
_buildShell(): void;
|
|
225
|
+
_buildShell(layout: Layout): void;
|
|
257
226
|
_createSession(): void;
|
|
258
227
|
_createPast(): void;
|
|
259
228
|
_disposePast(): void;
|
|
260
229
|
_applyEmptyContent(): void;
|
|
261
230
|
_switchPanel(): void;
|
|
262
231
|
_requestHandoff(): Promise<void>;
|
|
263
|
-
_paintLive(state:
|
|
232
|
+
_paintLive(state: ChatSessionState, labels: ChatLabels, viewingHistory: boolean): void;
|
|
264
233
|
_resetSession(): void;
|
|
265
234
|
_toggleHistory(show?: boolean): void;
|
|
266
|
-
_makeTurnApi(messageId:
|
|
267
|
-
_defaultOpenAttachment(part:
|
|
268
|
-
_defaultOpenCitation(messageId:
|
|
269
|
-
_defaultOpenTarget(target:
|
|
235
|
+
_makeTurnApi(messageId: string): ChatTurnApi;
|
|
236
|
+
_defaultOpenAttachment(part: FilePart): void;
|
|
237
|
+
_defaultOpenCitation(messageId: string, marker: number): void;
|
|
238
|
+
_defaultOpenTarget(target: string): void;
|
|
270
239
|
_render(): void;
|
|
271
|
-
_paint(state:
|
|
272
|
-
_ensureRuntime(state:
|
|
273
|
-
_syncOpen(state:
|
|
274
|
-
_onOpenChange(open:
|
|
275
|
-
_syncConversation(state:
|
|
276
|
-
_playSounds(state:
|
|
277
|
-
_announce(message:
|
|
240
|
+
_paint(state: ChatSessionState): void;
|
|
241
|
+
_ensureRuntime(state: ChatSessionState, profile: ChatProfileView, look: ChatLook, labels: ChatLabels): void;
|
|
242
|
+
_syncOpen(state: ChatSessionState, profile: ChatProfileView, features: Readonly<Record<ChatFeature, boolean>>, labels: ChatLabels, launcherLike: boolean): void;
|
|
243
|
+
_onOpenChange(open: boolean): void;
|
|
244
|
+
_syncConversation(state: ChatSessionState): void;
|
|
245
|
+
_playSounds(state: ChatSessionState): void;
|
|
246
|
+
_announce(message: ChatLiveMessage): void;
|
|
278
247
|
}
|
|
279
248
|
export {};
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
1
|
+
import type { ChatAuthor, ChatLabels } from "@webority/chat-core";
|
|
2
|
+
declare const TICKET_TONES: Readonly<Record<string, "info" | "warning" | "success" | "neutral">>;
|
|
3
|
+
export declare function usableAvatarUrl(url: unknown): boolean;
|
|
4
|
+
export declare function initialsOf(name: unknown): string;
|
|
5
|
+
export declare function avatarNode(participant: Pick<ChatAuthor, "displayName" | "avatarUrl"> | null | undefined, fallbackName: string): HTMLSpanElement;
|
|
6
|
+
export declare function createAgentHead(author: ChatAuthor | null | undefined, labels: ChatLabels): HTMLDivElement;
|
|
7
|
+
export declare function createTypingRow(agentTyping: {
|
|
8
|
+
displayName: string | null;
|
|
9
|
+
}, labels: ChatLabels): HTMLLIElement;
|
|
10
|
+
export declare function ticketTone(status: unknown): (typeof TICKET_TONES)[string] | null;
|
|
11
|
+
export declare function ticketStatusLabel(status: string, labels: ChatLabels): string;
|
|
12
|
+
export {};
|
package/dist/types/composer.d.ts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ChatFeature, ChatLabels, ChatSessionState, ComposerAttachment } from "@webority/chat-core";
|
|
2
|
+
import type { createVoiceController } from "./voice/controller.js";
|
|
3
|
+
type ComposerState = Pick<ChatSessionState, "streaming" | "messagesLeftToday" | "editing" | "messages" | "handoffPause"> & {
|
|
4
|
+
attachments: Pick<ComposerAttachment, "key" | "fileName" | "status" | "progress" | "error">[];
|
|
5
|
+
features: Readonly<Partial<Record<ChatFeature, boolean>>>;
|
|
6
|
+
profile: {
|
|
7
|
+
limits: {
|
|
8
|
+
maxAttachments: number;
|
|
9
|
+
};
|
|
10
|
+
} | null;
|
|
11
|
+
};
|
|
12
|
+
type ComposerView = {
|
|
13
|
+
state: ComposerState;
|
|
14
|
+
labels: ChatLabels;
|
|
15
|
+
maxLength: number;
|
|
16
|
+
accept?: string;
|
|
17
|
+
draft?: string | null;
|
|
18
|
+
sendIcon?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function createComposer(handlers: {
|
|
21
|
+
voice?: ReturnType<typeof createVoiceController>;
|
|
22
|
+
onSubmit(text: string): void;
|
|
23
|
+
onStop(): void;
|
|
24
|
+
onAttach(files: File[]): void;
|
|
25
|
+
onRemove(key: string): void;
|
|
26
|
+
onCancelEdit(): void;
|
|
27
|
+
onTyping?(): void;
|
|
28
|
+
onDraftApplied?(): void;
|
|
29
|
+
}): {
|
|
30
|
+
nodes: HTMLElement[];
|
|
31
|
+
paint: (view: ComposerView) => void;
|
|
4
32
|
focus: () => void;
|
|
5
33
|
destroy: () => void;
|
|
6
|
-
getDraft: () =>
|
|
34
|
+
getDraft: () => string;
|
|
7
35
|
};
|
|
36
|
+
export {};
|
package/dist/types/dom.d.ts
CHANGED
|
@@ -1,31 +1,80 @@
|
|
|
1
|
+
import type { ChatEntrance, ChatIdleMotion, ChatLabelReveal, ChatLabels, ChatLauncherMark, ChatLauncherStyle, ChatPanelHeight, ChatPanelMotion, ChatPhoneMode, ChatSendReveal } from "@webority/chat-core";
|
|
1
2
|
export declare const APP_BUTTON_MARKER = "AppButton";
|
|
2
3
|
export declare const OPEN_MS = 620;
|
|
3
4
|
export declare const CLOSE_MS = 300;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare function
|
|
5
|
+
declare const BUTTON_VARIANTS: {
|
|
6
|
+
readonly primary: "btn-primary";
|
|
7
|
+
readonly secondary: "btn-soft-primary";
|
|
8
|
+
readonly ghost: "btn-ghost-primary";
|
|
9
|
+
readonly outline: "btn-outline-primary";
|
|
10
|
+
readonly neutral: "btn-soft-neutral";
|
|
11
|
+
readonly danger: "btn-danger";
|
|
12
|
+
};
|
|
13
|
+
export declare function el<K extends keyof HTMLElementTagNameMap>(tag: K, className?: string | null, attrs?: Readonly<Record<string, string | null | undefined>> | null): HTMLElementTagNameMap[K];
|
|
14
|
+
export declare function iconNode(name: string, size?: number): Element;
|
|
15
|
+
export declare function buttonClass(variant?: keyof typeof BUTTON_VARIANTS, size?: "md" | "sm"): string;
|
|
16
|
+
export declare function textButton(variant: keyof typeof BUTTON_VARIANTS, label: string, icon: string | null | undefined, onClick: (event: MouseEvent) => void): HTMLButtonElement;
|
|
17
|
+
export declare function iconButton(label: string, icon: string, onClick: (event: MouseEvent) => void): HTMLButtonElement;
|
|
18
|
+
export declare function parseJsonAttribute(element: Element, name: string): unknown;
|
|
19
|
+
export declare function clear<T extends ParentNode>(node: T): T;
|
|
20
|
+
export declare function createOpenState(root: HTMLElement): (open: boolean) => void;
|
|
21
|
+
export declare function applyAppearance(root: HTMLElement, options: {
|
|
22
|
+
position?: "start" | "end";
|
|
23
|
+
reduced?: boolean;
|
|
24
|
+
expressive?: boolean;
|
|
25
|
+
sendReveal?: ChatSendReveal;
|
|
26
|
+
inputRing?: boolean;
|
|
27
|
+
panelMotion?: ChatPanelMotion;
|
|
28
|
+
offsetX?: number | undefined;
|
|
29
|
+
offsetY?: number | undefined;
|
|
30
|
+
width?: string;
|
|
31
|
+
maxHeight?: number;
|
|
32
|
+
bottomGap?: number;
|
|
33
|
+
panelHeight?: ChatPanelHeight;
|
|
34
|
+
avatar?: string | null;
|
|
35
|
+
replyAvatars?: boolean;
|
|
36
|
+
}): void;
|
|
13
37
|
export declare const PART_KINDS: string[];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
declare const LAYOUT_CLASS: {
|
|
39
|
+
readonly launcher: "wui-chat--launcher";
|
|
40
|
+
readonly docked: "wui-chat--docked";
|
|
41
|
+
readonly "full-page": "wui-chat--full-page";
|
|
42
|
+
readonly embedded: "wui-chat--embedded";
|
|
43
|
+
};
|
|
44
|
+
export declare function kebab(name: string): string;
|
|
45
|
+
export declare function createShellBase({ id, layout, position, role, launcher, onToggle, }: {
|
|
46
|
+
id: string;
|
|
47
|
+
layout: keyof typeof LAYOUT_CLASS;
|
|
48
|
+
position: "start" | "end";
|
|
49
|
+
role: string;
|
|
50
|
+
launcher: boolean;
|
|
51
|
+
onToggle: () => void;
|
|
22
52
|
}): {
|
|
23
|
-
root:
|
|
24
|
-
panel:
|
|
25
|
-
setOpen: (next:
|
|
26
|
-
setLabels: (next:
|
|
27
|
-
setAppearance: (options:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
53
|
+
root: HTMLDivElement;
|
|
54
|
+
panel: HTMLElement;
|
|
55
|
+
setOpen: (next: boolean) => void;
|
|
56
|
+
setLabels: (next: ChatLabels) => void;
|
|
57
|
+
setAppearance: (options: Parameters<typeof applyAppearance>[1] & {
|
|
58
|
+
theme?: "light" | "dark" | "auto";
|
|
59
|
+
launcherStyle?: ChatLauncherStyle;
|
|
60
|
+
compact?: boolean;
|
|
61
|
+
labelReveal?: ChatLabelReveal;
|
|
62
|
+
entrance?: ChatEntrance;
|
|
63
|
+
idle?: ChatIdleMotion;
|
|
64
|
+
phone?: boolean;
|
|
65
|
+
hoverLabel?: string | null;
|
|
66
|
+
launcherMark?: ChatLauncherMark;
|
|
67
|
+
icon?: string;
|
|
68
|
+
launcherState?: "idle" | "entering" | undefined;
|
|
69
|
+
peek?: boolean | undefined;
|
|
70
|
+
peekSeconds?: number | undefined;
|
|
71
|
+
hideWhileOpen?: boolean | undefined;
|
|
72
|
+
phoneMode?: ChatPhoneMode | undefined;
|
|
73
|
+
sheetHeightDvh?: number | undefined;
|
|
74
|
+
sheetMaxHeightPx?: number | undefined;
|
|
75
|
+
}) => void;
|
|
76
|
+
nudgeHost: HTMLDivElement | null;
|
|
77
|
+
launcherButton: HTMLButtonElement | null;
|
|
78
|
+
role: string;
|
|
31
79
|
};
|
|
80
|
+
export {};
|