@espejo/browser 0.1.0 → 0.3.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/agent.cjs +3 -3
- package/dist/agent.d.cts +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +1 -1
- package/dist/chat.cjs +540 -357
- package/dist/chat.d.cts +98 -25
- package/dist/chat.d.ts +98 -25
- package/dist/chat.js +537 -354
- package/dist/chunk-5KPTJYDE.js +49 -0
- package/dist/{chunk-54OEDPVD.js → chunk-HP3BBKZO.js} +1 -1
- package/dist/{index-Djj7dbiY.d.cts → index-DsYc9zWf.d.cts} +1 -1
- package/dist/{index-Djj7dbiY.d.ts → index-DsYc9zWf.d.ts} +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +8 -8
- package/dist/{shadow-scaffold-DUJmxf_n.d.cts → shadow-scaffold-BsadRTCW.d.cts} +1 -1
- package/dist/{shadow-scaffold-DUJmxf_n.d.ts → shadow-scaffold-BsadRTCW.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/chunk-MJUVVQNB.js +0 -49
package/dist/chat.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentActionType, a as AgentToolDefinition, b as ActResult, C as ConfirmRequest, E as EspejoAgent } from './index-
|
|
2
|
-
import { W as
|
|
1
|
+
import { A as AgentActionType, a as AgentToolDefinition, b as ActResult, R as RingSource, C as ConfirmRequest, E as EspejoAgent } from './index-DsYc9zWf.cjs';
|
|
2
|
+
import { W as WidgetTheme, a as WidgetCorner } from './shadow-scaffold-BsadRTCW.cjs';
|
|
3
3
|
|
|
4
4
|
interface AgentChatToolCall {
|
|
5
5
|
id: string;
|
|
@@ -7,13 +7,36 @@ interface AgentChatToolCall {
|
|
|
7
7
|
input: Record<string, unknown>;
|
|
8
8
|
}
|
|
9
9
|
type AgentChatErrorCode = 'provider_auth' | 'provider_rate_limited' | 'provider_error' | 'timeout' | 'iteration_limit' | 'internal';
|
|
10
|
+
interface AgentConversationSummary {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
interface AgentConversationMessage {
|
|
17
|
+
role: 'user' | 'assistant';
|
|
18
|
+
text: string;
|
|
19
|
+
at?: string;
|
|
20
|
+
}
|
|
21
|
+
interface AgentConversationDetail {
|
|
22
|
+
id: string;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
messages: AgentConversationMessage[];
|
|
26
|
+
}
|
|
10
27
|
type AgentWidgetTheme = 'auto' | 'light' | 'dark';
|
|
28
|
+
type AgentGreetingMode = 'default' | 'custom' | 'agent';
|
|
11
29
|
interface AgentPublicConfig {
|
|
12
30
|
enabled: boolean;
|
|
13
31
|
allowed_actions: AgentActionType[];
|
|
14
32
|
theme: AgentWidgetTheme;
|
|
15
33
|
name: string | null;
|
|
16
34
|
icon: string | null;
|
|
35
|
+
sticky_container_id?: string | null;
|
|
36
|
+
accent_color?: string | null;
|
|
37
|
+
greeting_mode?: AgentGreetingMode;
|
|
38
|
+
greeting_text?: string | null;
|
|
39
|
+
history_enabled?: boolean;
|
|
17
40
|
sections: AgentWidgetSection[];
|
|
18
41
|
}
|
|
19
42
|
type AgentWidgetSection = 'home' | 'support' | 'tickets' | 'guides';
|
|
@@ -21,12 +44,17 @@ type AgentWidgetSection = 'home' | 'support' | 'tickets' | 'guides';
|
|
|
21
44
|
interface ChatIdentity {
|
|
22
45
|
email: string;
|
|
23
46
|
hash: string;
|
|
47
|
+
name?: string;
|
|
24
48
|
}
|
|
25
49
|
interface ChatQueueItem {
|
|
26
50
|
id: number;
|
|
27
51
|
text: string;
|
|
28
52
|
}
|
|
29
|
-
type ChatErrorCode = 'no_agent' | 'daily_cap' | 'rate_limited' | 'conversation_limit' | 'conversation_expired' | 'conversation_busy' | 'identity_changed' | 'conflict' | 'forbidden' | 'bad_request' | 'unavailable' | 'network' | AgentChatErrorCode;
|
|
53
|
+
type ChatErrorCode = 'no_agent' | 'daily_cap' | 'rate_limited' | 'conversation_limit' | 'conversation_expired' | 'conversation_busy' | 'identity_changed' | 'conflict' | 'identity_required' | 'history_disabled' | 'conversation_not_found' | 'greeting_disabled' | 'greeting_not_allowed' | 'bad_response' | 'forbidden' | 'bad_request' | 'unavailable' | 'network' | AgentChatErrorCode;
|
|
54
|
+
type ChatError = Error & {
|
|
55
|
+
code: ChatErrorCode;
|
|
56
|
+
};
|
|
57
|
+
type ChatGreetResult = 'done' | 'greeting_disabled' | 'greeting_not_allowed' | 'failed';
|
|
30
58
|
type ChatClientEvent = {
|
|
31
59
|
type: 'text';
|
|
32
60
|
delta: string;
|
|
@@ -62,8 +90,15 @@ type ChatClientEvent = {
|
|
|
62
90
|
id: number;
|
|
63
91
|
message: string;
|
|
64
92
|
};
|
|
93
|
+
interface ChatEspejo {
|
|
94
|
+
snapshot(): ReturnType<RingSource['snapshot']>;
|
|
95
|
+
readonly lastReportId: string | null;
|
|
96
|
+
canOpenReport(): boolean;
|
|
97
|
+
openReport(): boolean;
|
|
98
|
+
}
|
|
65
99
|
interface ChatClientOptions {
|
|
66
100
|
key: string;
|
|
101
|
+
espejo?: ChatEspejo;
|
|
67
102
|
baseUrl?: string;
|
|
68
103
|
onConfirm?: (req: ConfirmRequest) => boolean | Promise<boolean>;
|
|
69
104
|
onEvent?: (event: ChatClientEvent) => void;
|
|
@@ -72,6 +107,8 @@ interface ChatClientOptions {
|
|
|
72
107
|
fetch?: typeof fetch;
|
|
73
108
|
storage?: Storage | null;
|
|
74
109
|
identity?: ChatIdentity | null;
|
|
110
|
+
conversationId?: string;
|
|
111
|
+
lang?: string;
|
|
75
112
|
}
|
|
76
113
|
interface ChatClient {
|
|
77
114
|
send(message: string): Promise<void>;
|
|
@@ -86,6 +123,13 @@ interface ChatClient {
|
|
|
86
123
|
identify(identity: ChatIdentity | null): void;
|
|
87
124
|
destroy(): void;
|
|
88
125
|
getConfig(): Promise<AgentPublicConfig | null>;
|
|
126
|
+
listConversations(): Promise<AgentConversationSummary[]>;
|
|
127
|
+
loadConversation(id: string): Promise<AgentConversationDetail>;
|
|
128
|
+
openConversation(id: string): Promise<AgentConversationDetail>;
|
|
129
|
+
greet(options?: {
|
|
130
|
+
lang?: string;
|
|
131
|
+
title?: string;
|
|
132
|
+
}): Promise<ChatGreetResult>;
|
|
89
133
|
readonly conversationId: string;
|
|
90
134
|
readonly busy: boolean;
|
|
91
135
|
readonly queue: ChatQueueItem[];
|
|
@@ -185,6 +229,8 @@ declare const DEFAULT_CHAT_TEXT: {
|
|
|
185
229
|
askTitle: string;
|
|
186
230
|
askHint: string;
|
|
187
231
|
continueTitle: string;
|
|
232
|
+
historyTitle: string;
|
|
233
|
+
errorHistory: string;
|
|
188
234
|
agoNow: string;
|
|
189
235
|
agoMinutes: string;
|
|
190
236
|
agoHours: string;
|
|
@@ -225,6 +271,29 @@ declare const DEFAULT_CHAT_TEXT: {
|
|
|
225
271
|
ticketsEmpty: string;
|
|
226
272
|
openTicket: string;
|
|
227
273
|
ticketsWaiting: string;
|
|
274
|
+
ticketsReload: string;
|
|
275
|
+
minimize: string;
|
|
276
|
+
expand: string;
|
|
277
|
+
collapse: string;
|
|
278
|
+
dock: string;
|
|
279
|
+
undock: string;
|
|
280
|
+
more: string;
|
|
281
|
+
copy: string;
|
|
282
|
+
copied: string;
|
|
283
|
+
copyCode: string;
|
|
284
|
+
regenerate: string;
|
|
285
|
+
regenerateShort: string;
|
|
286
|
+
goodResponse: string;
|
|
287
|
+
badResponse: string;
|
|
288
|
+
notSent: string;
|
|
289
|
+
resend: string;
|
|
290
|
+
stopped: string;
|
|
291
|
+
jumpLatest: string;
|
|
292
|
+
hintSend: string;
|
|
293
|
+
hintQueue: string;
|
|
294
|
+
hintNewline: string;
|
|
295
|
+
helloNamed: string;
|
|
296
|
+
errorUnavailable: string;
|
|
228
297
|
};
|
|
229
298
|
type ChatText = typeof DEFAULT_CHAT_TEXT;
|
|
230
299
|
type ChatLang = 'en' | 'es' | 'pt';
|
|
@@ -238,19 +307,42 @@ declare function describeAction(TEXT: ChatText, phase: 'confirm' | 'done' | 'fai
|
|
|
238
307
|
declare function describeError(TEXT: ChatText, code: string | undefined): string;
|
|
239
308
|
declare function describeValue(TEXT: ChatText, value: string): string;
|
|
240
309
|
|
|
310
|
+
declare const PRESENCE_HOST_ATTRIBUTE = "data-espejo-presence";
|
|
311
|
+
interface PresenceOptions {
|
|
312
|
+
lang?: string;
|
|
313
|
+
text?: Partial<Pick<ChatText, 'presenceNotice' | 'presenceNoticeNamed' | 'stop'>>;
|
|
314
|
+
name?: string;
|
|
315
|
+
theme?: WidgetTheme;
|
|
316
|
+
onStop?: () => void;
|
|
317
|
+
idleMs?: number;
|
|
318
|
+
glow?: boolean;
|
|
319
|
+
cursor?: boolean;
|
|
320
|
+
doc?: Document;
|
|
321
|
+
}
|
|
322
|
+
interface PresenceHandle {
|
|
323
|
+
start(): void;
|
|
324
|
+
end(): void;
|
|
325
|
+
stop(): void;
|
|
326
|
+
destroy(): void;
|
|
327
|
+
readonly active: boolean;
|
|
328
|
+
}
|
|
329
|
+
declare function installPresence(agent: EspejoAgent, options?: PresenceOptions): PresenceHandle | null;
|
|
330
|
+
|
|
241
331
|
interface ChatWidgetOptions {
|
|
242
332
|
key: string;
|
|
243
333
|
baseUrl?: string;
|
|
244
334
|
position?: WidgetCorner;
|
|
335
|
+
stickyContainerId?: string;
|
|
245
336
|
theme?: WidgetTheme;
|
|
246
337
|
lang?: string;
|
|
247
338
|
title?: string;
|
|
248
339
|
greeting?: string;
|
|
249
340
|
suggestions?: string[];
|
|
250
341
|
text?: Partial<ChatText>;
|
|
342
|
+
espejo?: ChatEspejo;
|
|
251
343
|
agent?: EspejoAgent;
|
|
252
344
|
allow?: AgentActionType[];
|
|
253
|
-
presence?: boolean
|
|
345
|
+
presence?: boolean | Pick<PresenceOptions, 'glow' | 'cursor'>;
|
|
254
346
|
identity?: ChatIdentity | null;
|
|
255
347
|
fetch?: typeof fetch;
|
|
256
348
|
storage?: Storage | null;
|
|
@@ -260,29 +352,10 @@ interface ChatWidgetHandle {
|
|
|
260
352
|
open(): void;
|
|
261
353
|
close(): void;
|
|
262
354
|
destroy(): void;
|
|
263
|
-
identify(email: string | null, hash?: string): void;
|
|
355
|
+
identify(email: string | null, hash?: string, name?: string): void;
|
|
264
356
|
readonly client: ChatClient;
|
|
265
357
|
}
|
|
266
358
|
declare const CHAT_HOST_ATTRIBUTE = "data-espejo-chat";
|
|
267
359
|
declare function installChatWidget(options: ChatWidgetOptions): ChatWidgetHandle | null;
|
|
268
360
|
|
|
269
|
-
|
|
270
|
-
interface PresenceOptions {
|
|
271
|
-
lang?: string;
|
|
272
|
-
text?: Partial<Pick<ChatText, 'presenceNotice' | 'presenceNoticeNamed' | 'stop'>>;
|
|
273
|
-
name?: string;
|
|
274
|
-
theme?: WidgetTheme;
|
|
275
|
-
onStop?: () => void;
|
|
276
|
-
idleMs?: number;
|
|
277
|
-
doc?: Document;
|
|
278
|
-
}
|
|
279
|
-
interface PresenceHandle {
|
|
280
|
-
start(): void;
|
|
281
|
-
end(): void;
|
|
282
|
-
stop(): void;
|
|
283
|
-
destroy(): void;
|
|
284
|
-
readonly active: boolean;
|
|
285
|
-
}
|
|
286
|
-
declare function installPresence(agent: EspejoAgent, options?: PresenceOptions): PresenceHandle | null;
|
|
287
|
-
|
|
288
|
-
export { type ActionParts, CHAT_HOST_ATTRIBUTE, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatErrorCode, type ChatIdentity, type ChatLang, type ChatQueueItem, type ChatText, type ChatWidgetHandle, type ChatWidgetOptions, DEFAULT_CHAT_TEXT, PRESENCE_HOST_ATTRIBUTE, type PresenceHandle, type PresenceOptions, chatTextFor, createChatClient, describeAction, describeError, describeValue, installChatWidget, installPresence };
|
|
361
|
+
export { type ActionParts, type AgentConversationDetail, type AgentConversationMessage, type AgentConversationSummary, type AgentGreetingMode, CHAT_HOST_ATTRIBUTE, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatError, type ChatErrorCode, type ChatEspejo, type ChatGreetResult, type ChatIdentity, type ChatLang, type ChatQueueItem, type ChatText, type ChatWidgetHandle, type ChatWidgetOptions, DEFAULT_CHAT_TEXT, PRESENCE_HOST_ATTRIBUTE, type PresenceHandle, type PresenceOptions, chatTextFor, createChatClient, describeAction, describeError, describeValue, installChatWidget, installPresence };
|
package/dist/chat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AgentActionType, a as AgentToolDefinition, b as ActResult, C as ConfirmRequest, E as EspejoAgent } from './index-
|
|
2
|
-
import { W as
|
|
1
|
+
import { A as AgentActionType, a as AgentToolDefinition, b as ActResult, R as RingSource, C as ConfirmRequest, E as EspejoAgent } from './index-DsYc9zWf.js';
|
|
2
|
+
import { W as WidgetTheme, a as WidgetCorner } from './shadow-scaffold-BsadRTCW.js';
|
|
3
3
|
|
|
4
4
|
interface AgentChatToolCall {
|
|
5
5
|
id: string;
|
|
@@ -7,13 +7,36 @@ interface AgentChatToolCall {
|
|
|
7
7
|
input: Record<string, unknown>;
|
|
8
8
|
}
|
|
9
9
|
type AgentChatErrorCode = 'provider_auth' | 'provider_rate_limited' | 'provider_error' | 'timeout' | 'iteration_limit' | 'internal';
|
|
10
|
+
interface AgentConversationSummary {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
}
|
|
16
|
+
interface AgentConversationMessage {
|
|
17
|
+
role: 'user' | 'assistant';
|
|
18
|
+
text: string;
|
|
19
|
+
at?: string;
|
|
20
|
+
}
|
|
21
|
+
interface AgentConversationDetail {
|
|
22
|
+
id: string;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
messages: AgentConversationMessage[];
|
|
26
|
+
}
|
|
10
27
|
type AgentWidgetTheme = 'auto' | 'light' | 'dark';
|
|
28
|
+
type AgentGreetingMode = 'default' | 'custom' | 'agent';
|
|
11
29
|
interface AgentPublicConfig {
|
|
12
30
|
enabled: boolean;
|
|
13
31
|
allowed_actions: AgentActionType[];
|
|
14
32
|
theme: AgentWidgetTheme;
|
|
15
33
|
name: string | null;
|
|
16
34
|
icon: string | null;
|
|
35
|
+
sticky_container_id?: string | null;
|
|
36
|
+
accent_color?: string | null;
|
|
37
|
+
greeting_mode?: AgentGreetingMode;
|
|
38
|
+
greeting_text?: string | null;
|
|
39
|
+
history_enabled?: boolean;
|
|
17
40
|
sections: AgentWidgetSection[];
|
|
18
41
|
}
|
|
19
42
|
type AgentWidgetSection = 'home' | 'support' | 'tickets' | 'guides';
|
|
@@ -21,12 +44,17 @@ type AgentWidgetSection = 'home' | 'support' | 'tickets' | 'guides';
|
|
|
21
44
|
interface ChatIdentity {
|
|
22
45
|
email: string;
|
|
23
46
|
hash: string;
|
|
47
|
+
name?: string;
|
|
24
48
|
}
|
|
25
49
|
interface ChatQueueItem {
|
|
26
50
|
id: number;
|
|
27
51
|
text: string;
|
|
28
52
|
}
|
|
29
|
-
type ChatErrorCode = 'no_agent' | 'daily_cap' | 'rate_limited' | 'conversation_limit' | 'conversation_expired' | 'conversation_busy' | 'identity_changed' | 'conflict' | 'forbidden' | 'bad_request' | 'unavailable' | 'network' | AgentChatErrorCode;
|
|
53
|
+
type ChatErrorCode = 'no_agent' | 'daily_cap' | 'rate_limited' | 'conversation_limit' | 'conversation_expired' | 'conversation_busy' | 'identity_changed' | 'conflict' | 'identity_required' | 'history_disabled' | 'conversation_not_found' | 'greeting_disabled' | 'greeting_not_allowed' | 'bad_response' | 'forbidden' | 'bad_request' | 'unavailable' | 'network' | AgentChatErrorCode;
|
|
54
|
+
type ChatError = Error & {
|
|
55
|
+
code: ChatErrorCode;
|
|
56
|
+
};
|
|
57
|
+
type ChatGreetResult = 'done' | 'greeting_disabled' | 'greeting_not_allowed' | 'failed';
|
|
30
58
|
type ChatClientEvent = {
|
|
31
59
|
type: 'text';
|
|
32
60
|
delta: string;
|
|
@@ -62,8 +90,15 @@ type ChatClientEvent = {
|
|
|
62
90
|
id: number;
|
|
63
91
|
message: string;
|
|
64
92
|
};
|
|
93
|
+
interface ChatEspejo {
|
|
94
|
+
snapshot(): ReturnType<RingSource['snapshot']>;
|
|
95
|
+
readonly lastReportId: string | null;
|
|
96
|
+
canOpenReport(): boolean;
|
|
97
|
+
openReport(): boolean;
|
|
98
|
+
}
|
|
65
99
|
interface ChatClientOptions {
|
|
66
100
|
key: string;
|
|
101
|
+
espejo?: ChatEspejo;
|
|
67
102
|
baseUrl?: string;
|
|
68
103
|
onConfirm?: (req: ConfirmRequest) => boolean | Promise<boolean>;
|
|
69
104
|
onEvent?: (event: ChatClientEvent) => void;
|
|
@@ -72,6 +107,8 @@ interface ChatClientOptions {
|
|
|
72
107
|
fetch?: typeof fetch;
|
|
73
108
|
storage?: Storage | null;
|
|
74
109
|
identity?: ChatIdentity | null;
|
|
110
|
+
conversationId?: string;
|
|
111
|
+
lang?: string;
|
|
75
112
|
}
|
|
76
113
|
interface ChatClient {
|
|
77
114
|
send(message: string): Promise<void>;
|
|
@@ -86,6 +123,13 @@ interface ChatClient {
|
|
|
86
123
|
identify(identity: ChatIdentity | null): void;
|
|
87
124
|
destroy(): void;
|
|
88
125
|
getConfig(): Promise<AgentPublicConfig | null>;
|
|
126
|
+
listConversations(): Promise<AgentConversationSummary[]>;
|
|
127
|
+
loadConversation(id: string): Promise<AgentConversationDetail>;
|
|
128
|
+
openConversation(id: string): Promise<AgentConversationDetail>;
|
|
129
|
+
greet(options?: {
|
|
130
|
+
lang?: string;
|
|
131
|
+
title?: string;
|
|
132
|
+
}): Promise<ChatGreetResult>;
|
|
89
133
|
readonly conversationId: string;
|
|
90
134
|
readonly busy: boolean;
|
|
91
135
|
readonly queue: ChatQueueItem[];
|
|
@@ -185,6 +229,8 @@ declare const DEFAULT_CHAT_TEXT: {
|
|
|
185
229
|
askTitle: string;
|
|
186
230
|
askHint: string;
|
|
187
231
|
continueTitle: string;
|
|
232
|
+
historyTitle: string;
|
|
233
|
+
errorHistory: string;
|
|
188
234
|
agoNow: string;
|
|
189
235
|
agoMinutes: string;
|
|
190
236
|
agoHours: string;
|
|
@@ -225,6 +271,29 @@ declare const DEFAULT_CHAT_TEXT: {
|
|
|
225
271
|
ticketsEmpty: string;
|
|
226
272
|
openTicket: string;
|
|
227
273
|
ticketsWaiting: string;
|
|
274
|
+
ticketsReload: string;
|
|
275
|
+
minimize: string;
|
|
276
|
+
expand: string;
|
|
277
|
+
collapse: string;
|
|
278
|
+
dock: string;
|
|
279
|
+
undock: string;
|
|
280
|
+
more: string;
|
|
281
|
+
copy: string;
|
|
282
|
+
copied: string;
|
|
283
|
+
copyCode: string;
|
|
284
|
+
regenerate: string;
|
|
285
|
+
regenerateShort: string;
|
|
286
|
+
goodResponse: string;
|
|
287
|
+
badResponse: string;
|
|
288
|
+
notSent: string;
|
|
289
|
+
resend: string;
|
|
290
|
+
stopped: string;
|
|
291
|
+
jumpLatest: string;
|
|
292
|
+
hintSend: string;
|
|
293
|
+
hintQueue: string;
|
|
294
|
+
hintNewline: string;
|
|
295
|
+
helloNamed: string;
|
|
296
|
+
errorUnavailable: string;
|
|
228
297
|
};
|
|
229
298
|
type ChatText = typeof DEFAULT_CHAT_TEXT;
|
|
230
299
|
type ChatLang = 'en' | 'es' | 'pt';
|
|
@@ -238,19 +307,42 @@ declare function describeAction(TEXT: ChatText, phase: 'confirm' | 'done' | 'fai
|
|
|
238
307
|
declare function describeError(TEXT: ChatText, code: string | undefined): string;
|
|
239
308
|
declare function describeValue(TEXT: ChatText, value: string): string;
|
|
240
309
|
|
|
310
|
+
declare const PRESENCE_HOST_ATTRIBUTE = "data-espejo-presence";
|
|
311
|
+
interface PresenceOptions {
|
|
312
|
+
lang?: string;
|
|
313
|
+
text?: Partial<Pick<ChatText, 'presenceNotice' | 'presenceNoticeNamed' | 'stop'>>;
|
|
314
|
+
name?: string;
|
|
315
|
+
theme?: WidgetTheme;
|
|
316
|
+
onStop?: () => void;
|
|
317
|
+
idleMs?: number;
|
|
318
|
+
glow?: boolean;
|
|
319
|
+
cursor?: boolean;
|
|
320
|
+
doc?: Document;
|
|
321
|
+
}
|
|
322
|
+
interface PresenceHandle {
|
|
323
|
+
start(): void;
|
|
324
|
+
end(): void;
|
|
325
|
+
stop(): void;
|
|
326
|
+
destroy(): void;
|
|
327
|
+
readonly active: boolean;
|
|
328
|
+
}
|
|
329
|
+
declare function installPresence(agent: EspejoAgent, options?: PresenceOptions): PresenceHandle | null;
|
|
330
|
+
|
|
241
331
|
interface ChatWidgetOptions {
|
|
242
332
|
key: string;
|
|
243
333
|
baseUrl?: string;
|
|
244
334
|
position?: WidgetCorner;
|
|
335
|
+
stickyContainerId?: string;
|
|
245
336
|
theme?: WidgetTheme;
|
|
246
337
|
lang?: string;
|
|
247
338
|
title?: string;
|
|
248
339
|
greeting?: string;
|
|
249
340
|
suggestions?: string[];
|
|
250
341
|
text?: Partial<ChatText>;
|
|
342
|
+
espejo?: ChatEspejo;
|
|
251
343
|
agent?: EspejoAgent;
|
|
252
344
|
allow?: AgentActionType[];
|
|
253
|
-
presence?: boolean
|
|
345
|
+
presence?: boolean | Pick<PresenceOptions, 'glow' | 'cursor'>;
|
|
254
346
|
identity?: ChatIdentity | null;
|
|
255
347
|
fetch?: typeof fetch;
|
|
256
348
|
storage?: Storage | null;
|
|
@@ -260,29 +352,10 @@ interface ChatWidgetHandle {
|
|
|
260
352
|
open(): void;
|
|
261
353
|
close(): void;
|
|
262
354
|
destroy(): void;
|
|
263
|
-
identify(email: string | null, hash?: string): void;
|
|
355
|
+
identify(email: string | null, hash?: string, name?: string): void;
|
|
264
356
|
readonly client: ChatClient;
|
|
265
357
|
}
|
|
266
358
|
declare const CHAT_HOST_ATTRIBUTE = "data-espejo-chat";
|
|
267
359
|
declare function installChatWidget(options: ChatWidgetOptions): ChatWidgetHandle | null;
|
|
268
360
|
|
|
269
|
-
|
|
270
|
-
interface PresenceOptions {
|
|
271
|
-
lang?: string;
|
|
272
|
-
text?: Partial<Pick<ChatText, 'presenceNotice' | 'presenceNoticeNamed' | 'stop'>>;
|
|
273
|
-
name?: string;
|
|
274
|
-
theme?: WidgetTheme;
|
|
275
|
-
onStop?: () => void;
|
|
276
|
-
idleMs?: number;
|
|
277
|
-
doc?: Document;
|
|
278
|
-
}
|
|
279
|
-
interface PresenceHandle {
|
|
280
|
-
start(): void;
|
|
281
|
-
end(): void;
|
|
282
|
-
stop(): void;
|
|
283
|
-
destroy(): void;
|
|
284
|
-
readonly active: boolean;
|
|
285
|
-
}
|
|
286
|
-
declare function installPresence(agent: EspejoAgent, options?: PresenceOptions): PresenceHandle | null;
|
|
287
|
-
|
|
288
|
-
export { type ActionParts, CHAT_HOST_ATTRIBUTE, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatErrorCode, type ChatIdentity, type ChatLang, type ChatQueueItem, type ChatText, type ChatWidgetHandle, type ChatWidgetOptions, DEFAULT_CHAT_TEXT, PRESENCE_HOST_ATTRIBUTE, type PresenceHandle, type PresenceOptions, chatTextFor, createChatClient, describeAction, describeError, describeValue, installChatWidget, installPresence };
|
|
361
|
+
export { type ActionParts, type AgentConversationDetail, type AgentConversationMessage, type AgentConversationSummary, type AgentGreetingMode, CHAT_HOST_ATTRIBUTE, type ChatClient, type ChatClientEvent, type ChatClientOptions, type ChatError, type ChatErrorCode, type ChatEspejo, type ChatGreetResult, type ChatIdentity, type ChatLang, type ChatQueueItem, type ChatText, type ChatWidgetHandle, type ChatWidgetOptions, DEFAULT_CHAT_TEXT, PRESENCE_HOST_ATTRIBUTE, type PresenceHandle, type PresenceOptions, chatTextFor, createChatClient, describeAction, describeError, describeValue, installChatWidget, installPresence };
|