@elevasis/ui 2.50.0 → 2.51.1
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/app/index.d.ts +82 -151
- package/dist/app/index.js +5 -4
- package/dist/auth/index.js +3 -3
- package/dist/charts/index.js +3 -3
- package/dist/{chunk-GUKY77FJ.js → chunk-E6NSKXYN.js} +12 -4
- package/dist/chunk-M7WWRZ5Z.js +159 -0
- package/dist/{chunk-SBNC3FRX.js → chunk-V3B26UZR.js} +10 -10
- package/dist/components/chat/index.d.ts +9 -1
- package/dist/components/chat/index.js +1 -1
- package/dist/components/index.d.ts +80 -150
- package/dist/components/index.js +3 -3
- package/dist/components/navigation/index.js +3 -3
- package/dist/features/auth/index.d.ts +80 -150
- package/dist/features/auth/index.js +4 -4
- package/dist/features/clients/index.js +3 -3
- package/dist/features/crm/index.d.ts +80 -150
- package/dist/features/crm/index.js +3 -3
- package/dist/features/dashboard/index.js +3 -3
- package/dist/features/delivery/index.d.ts +80 -150
- package/dist/features/delivery/index.js +3 -3
- package/dist/features/knowledge/index.js +3 -3
- package/dist/features/lead-gen/index.js +3 -3
- package/dist/features/monitoring/index.js +3 -3
- package/dist/features/monitoring/requests/index.js +4 -4
- package/dist/features/operations/index.js +3 -3
- package/dist/features/public-agent-chat/index.d.ts +17 -3
- package/dist/features/public-agent-chat/index.js +313 -113
- package/dist/features/settings/index.d.ts +80 -150
- package/dist/features/settings/index.js +3 -3
- package/dist/hooks/access/index.js +3 -3
- package/dist/hooks/delivery/index.d.ts +80 -150
- package/dist/hooks/delivery/index.js +3 -3
- package/dist/hooks/index.d.ts +97 -151
- package/dist/hooks/index.js +3 -3
- package/dist/hooks/published.d.ts +97 -151
- package/dist/hooks/published.js +3 -3
- package/dist/index.d.ts +97 -151
- package/dist/index.js +3 -3
- package/dist/initialization/index.d.ts +80 -150
- package/dist/knowledge/index.d.ts +48 -2
- package/dist/knowledge/index.js +324 -83
- package/dist/layout/index.js +3 -3
- package/dist/organization/index.js +3 -3
- package/dist/profile/index.d.ts +80 -150
- package/dist/provider/index.d.ts +80 -150
- package/dist/provider/index.js +3 -3
- package/dist/provider/published.d.ts +80 -150
- package/dist/provider/published.js +3 -3
- package/dist/supabase/index.d.ts +159 -292
- package/dist/types/index.d.ts +80 -150
- package/package.json +3 -3
- package/src/knowledge/README.md +4 -2
- package/dist/chunk-EJL4U7OZ.js +0 -79
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { WebSocketSessionTurnSchema } from '../../chunk-
|
|
2
|
-
import { ChatInterface } from '../../chunk-
|
|
1
|
+
import { getWebSocketBaseUrl, createLiveTempMessageIdentity, formatMessageEvent, WebSocketSessionTurnSchema, mergeSessionMessages } from '../../chunk-M7WWRZ5Z.js';
|
|
2
|
+
import { ChatInterface } from '../../chunk-E6NSKXYN.js';
|
|
3
3
|
import { WS_MAX_RETRIES_BEFORE_ERROR, WS_RECONNECT_BASE_DELAY, WS_RECONNECT_MAX_DELAY, validateTokenLimit, TOKEN_LIMITS } from '../../chunk-FVOMKZ7S.js';
|
|
4
4
|
import '../../chunk-TVTSASST.js';
|
|
5
5
|
import '../../chunk-I2KLQ2HA.js';
|
|
6
|
-
import { Center, Loader, Paper, Stack, Group, Title, Alert, PasswordInput, Button, Text } from '@mantine/core';
|
|
7
|
-
import { IconLock, IconAlertCircle, IconSend } from '@tabler/icons-react';
|
|
6
|
+
import { Center, Loader, Paper, Stack, Group, Title, Alert, PasswordInput, Button, Text, Box, Badge, Divider } from '@mantine/core';
|
|
7
|
+
import { IconLock, IconAlertCircle, IconSend, IconMessageCircle } from '@tabler/icons-react';
|
|
8
8
|
import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
|
|
9
9
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
10
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -42,35 +42,6 @@ function usePublicAgentChatMessages(apiUrl, sessionId, capabilityToken) {
|
|
|
42
42
|
staleTime: 0
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
// src/hooks/sessions/sessionWebSocketUtils.ts
|
|
47
|
-
function formatMessageEvent(event) {
|
|
48
|
-
switch (event.type) {
|
|
49
|
-
case "user_message":
|
|
50
|
-
return event.text;
|
|
51
|
-
case "assistant_message":
|
|
52
|
-
return event.text;
|
|
53
|
-
case "agent:started":
|
|
54
|
-
return "Agent started reasoning";
|
|
55
|
-
case "agent:reasoning":
|
|
56
|
-
return `Reasoning (Iteration ${event.iteration})`;
|
|
57
|
-
case "agent:tool_call":
|
|
58
|
-
return `Tool: ${event.toolName}`;
|
|
59
|
-
case "agent:tool_result":
|
|
60
|
-
return event.success ? "Tool Result" : "Tool Result (Failed)";
|
|
61
|
-
case "agent:completed":
|
|
62
|
-
return "Agent completed";
|
|
63
|
-
case "agent:error":
|
|
64
|
-
return `Agent error: ${event.error}`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function getWebSocketBaseUrl(apiUrl) {
|
|
68
|
-
const url = new URL(apiUrl);
|
|
69
|
-
const protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
70
|
-
return `${protocol}//${url.host}`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/features/public-agent-chat/usePublicAgentChatWebSocket.ts
|
|
74
45
|
function usePublicAgentChatWebSocket(sessionId, apiUrl, capabilityToken) {
|
|
75
46
|
const [messages, setMessages] = useState([]);
|
|
76
47
|
const [state, setState] = useState({
|
|
@@ -111,15 +82,16 @@ function usePublicAgentChatWebSocket(sessionId, apiUrl, capabilityToken) {
|
|
|
111
82
|
try {
|
|
112
83
|
const data = JSON.parse(event.data);
|
|
113
84
|
if (data.type && data.type !== "turn:complete" && data.type !== "error") {
|
|
85
|
+
const liveIdentity = createLiveTempMessageIdentity();
|
|
114
86
|
const tempMessage = {
|
|
115
|
-
id:
|
|
87
|
+
id: liveIdentity.id,
|
|
116
88
|
role: data.type === "user_message" ? "user" : "assistant",
|
|
117
89
|
messageType: data.type,
|
|
118
90
|
text: formatMessageEvent(data),
|
|
119
91
|
metadata: data.type.startsWith("agent:") ? data : void 0,
|
|
120
92
|
turnNumber: 999999,
|
|
121
|
-
messageIndex:
|
|
122
|
-
createdAt:
|
|
93
|
+
messageIndex: liveIdentity.messageIndex,
|
|
94
|
+
createdAt: liveIdentity.createdAt
|
|
123
95
|
};
|
|
124
96
|
setMessages((prev) => [...prev, tempMessage]);
|
|
125
97
|
} else if (data.type === "turn:complete") {
|
|
@@ -194,14 +166,15 @@ function usePublicAgentChatWebSocket(sessionId, apiUrl, capabilityToken) {
|
|
|
194
166
|
setState((prev) => ({ ...prev, error: "Input too large" }));
|
|
195
167
|
return;
|
|
196
168
|
}
|
|
169
|
+
const liveIdentity = createLiveTempMessageIdentity();
|
|
197
170
|
const userMessage = {
|
|
198
|
-
id:
|
|
171
|
+
id: liveIdentity.id,
|
|
199
172
|
role: "user",
|
|
200
173
|
messageType: "user_message",
|
|
201
174
|
text: trimmed,
|
|
202
175
|
turnNumber: 999999,
|
|
203
|
-
messageIndex:
|
|
204
|
-
createdAt:
|
|
176
|
+
messageIndex: liveIdentity.messageIndex,
|
|
177
|
+
createdAt: liveIdentity.createdAt
|
|
205
178
|
};
|
|
206
179
|
setMessages((prev) => [...prev, userMessage]);
|
|
207
180
|
const message = WebSocketSessionTurnSchema.parse({
|
|
@@ -231,32 +204,165 @@ async function fetchJson(url, init) {
|
|
|
231
204
|
}
|
|
232
205
|
return await response.json();
|
|
233
206
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
207
|
+
function brandingRecord(value) {
|
|
208
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
209
|
+
}
|
|
210
|
+
function brandingText(value) {
|
|
211
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
212
|
+
}
|
|
213
|
+
function humanizeSlug(slug) {
|
|
214
|
+
return slug.split(/[-_\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
215
|
+
}
|
|
216
|
+
function resolveAgentTitle(title, slug, grant) {
|
|
217
|
+
const branding = brandingRecord(grant?.branding);
|
|
218
|
+
return title ?? brandingText(branding.title) ?? brandingText(branding.displayName) ?? brandingText(branding.agentName) ?? brandingText(branding.name) ?? humanizeSlug(slug);
|
|
219
|
+
}
|
|
220
|
+
function resolveAgentSubtitle(grant) {
|
|
221
|
+
const branding = brandingRecord(grant?.branding);
|
|
222
|
+
return brandingText(branding.subtitle) ?? brandingText(branding.description);
|
|
223
|
+
}
|
|
224
|
+
function statusStyles(tone) {
|
|
225
|
+
if (tone === "ready") {
|
|
226
|
+
return {
|
|
227
|
+
label: "Online",
|
|
228
|
+
background: "color-mix(in srgb, var(--color-success) 14%, transparent)",
|
|
229
|
+
color: "var(--color-success)",
|
|
230
|
+
border: "1px solid color-mix(in srgb, var(--color-success) 26%, var(--color-border))"
|
|
231
|
+
};
|
|
238
232
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
if (existing.text !== message.text) return false;
|
|
247
|
-
if (message.metadata && existing.metadata) {
|
|
248
|
-
return JSON.stringify(existing.metadata) === JSON.stringify(message.metadata);
|
|
249
|
-
}
|
|
250
|
-
return true;
|
|
251
|
-
});
|
|
252
|
-
if (!exists) {
|
|
253
|
-
messageMap.set(message.id, message);
|
|
254
|
-
}
|
|
233
|
+
if (tone === "locked") {
|
|
234
|
+
return {
|
|
235
|
+
label: "Access required",
|
|
236
|
+
background: "color-mix(in srgb, var(--color-warning) 14%, transparent)",
|
|
237
|
+
color: "var(--color-warning)",
|
|
238
|
+
border: "1px solid color-mix(in srgb, var(--color-warning) 26%, var(--color-border))"
|
|
239
|
+
};
|
|
255
240
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
241
|
+
if (tone === "error") {
|
|
242
|
+
return {
|
|
243
|
+
label: "Unavailable",
|
|
244
|
+
background: "color-mix(in srgb, var(--color-error) 14%, transparent)",
|
|
245
|
+
color: "var(--color-error)",
|
|
246
|
+
border: "1px solid color-mix(in srgb, var(--color-error) 28%, var(--color-border))"
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
label: "Connecting",
|
|
251
|
+
background: "color-mix(in srgb, var(--color-primary) 12%, transparent)",
|
|
252
|
+
color: "var(--color-primary)",
|
|
253
|
+
border: "1px solid color-mix(in srgb, var(--color-primary) 24%, var(--color-border))"
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function PublicAgentChatFrame({
|
|
257
|
+
className,
|
|
258
|
+
style,
|
|
259
|
+
title,
|
|
260
|
+
subtitle,
|
|
261
|
+
statusTone,
|
|
262
|
+
children
|
|
263
|
+
}) {
|
|
264
|
+
const status = statusStyles(statusTone);
|
|
265
|
+
return /* @__PURE__ */ jsxs(
|
|
266
|
+
Box,
|
|
267
|
+
{
|
|
268
|
+
className,
|
|
269
|
+
style: {
|
|
270
|
+
height: "100%",
|
|
271
|
+
minHeight: 560,
|
|
272
|
+
display: "flex",
|
|
273
|
+
flexDirection: "column",
|
|
274
|
+
border: "1px solid var(--color-border)",
|
|
275
|
+
borderRadius: 8,
|
|
276
|
+
overflow: "hidden",
|
|
277
|
+
background: "var(--glass-background)",
|
|
278
|
+
backdropFilter: "var(--glass-blur)",
|
|
279
|
+
WebkitBackdropFilter: "var(--glass-blur)",
|
|
280
|
+
boxShadow: "var(--standard-box-shadow)",
|
|
281
|
+
...style
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ jsx(
|
|
285
|
+
Box,
|
|
286
|
+
{
|
|
287
|
+
style: {
|
|
288
|
+
flexShrink: 0,
|
|
289
|
+
padding: "16px clamp(16px, 2.6vw, 24px)",
|
|
290
|
+
background: "color-mix(in srgb, var(--color-surface) 82%, transparent)"
|
|
291
|
+
},
|
|
292
|
+
children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", gap: "md", wrap: "nowrap", children: [
|
|
293
|
+
/* @__PURE__ */ jsxs(Group, { gap: "sm", align: "center", style: { minWidth: 0 }, children: [
|
|
294
|
+
/* @__PURE__ */ jsx(
|
|
295
|
+
Center,
|
|
296
|
+
{
|
|
297
|
+
style: {
|
|
298
|
+
width: 40,
|
|
299
|
+
height: 40,
|
|
300
|
+
flexShrink: 0,
|
|
301
|
+
borderRadius: 8,
|
|
302
|
+
color: "var(--color-primary)",
|
|
303
|
+
background: "color-mix(in srgb, var(--color-primary) 14%, transparent)",
|
|
304
|
+
border: "1px solid color-mix(in srgb, var(--color-primary) 24%, var(--color-border))"
|
|
305
|
+
},
|
|
306
|
+
children: /* @__PURE__ */ jsx(IconMessageCircle, { size: 21 })
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
/* @__PURE__ */ jsxs(Box, { style: { minWidth: 0 }, children: [
|
|
310
|
+
/* @__PURE__ */ jsx(
|
|
311
|
+
Title,
|
|
312
|
+
{
|
|
313
|
+
order: 1,
|
|
314
|
+
style: {
|
|
315
|
+
fontSize: "clamp(18px, 2vw, 24px)",
|
|
316
|
+
lineHeight: 1.15,
|
|
317
|
+
color: "var(--color-text)",
|
|
318
|
+
fontFamily: "var(--mantine-headings-font-family)",
|
|
319
|
+
overflow: "hidden",
|
|
320
|
+
textOverflow: "ellipsis",
|
|
321
|
+
whiteSpace: "nowrap"
|
|
322
|
+
},
|
|
323
|
+
children: title
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
subtitle && /* @__PURE__ */ jsx(Text, { size: "sm", style: { color: "var(--color-text-dimmed)" }, lineClamp: 1, children: subtitle })
|
|
327
|
+
] })
|
|
328
|
+
] }),
|
|
329
|
+
/* @__PURE__ */ jsx(
|
|
330
|
+
Badge,
|
|
331
|
+
{
|
|
332
|
+
variant: "outline",
|
|
333
|
+
size: "md",
|
|
334
|
+
style: {
|
|
335
|
+
flexShrink: 0,
|
|
336
|
+
background: status.background,
|
|
337
|
+
color: status.color,
|
|
338
|
+
border: status.border,
|
|
339
|
+
textTransform: "none",
|
|
340
|
+
letterSpacing: 0
|
|
341
|
+
},
|
|
342
|
+
children: status.label
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
] })
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ jsx(Divider, { color: "var(--color-border)" }),
|
|
349
|
+
/* @__PURE__ */ jsx(
|
|
350
|
+
Box,
|
|
351
|
+
{
|
|
352
|
+
style: {
|
|
353
|
+
flex: "1 1 auto",
|
|
354
|
+
minHeight: 0,
|
|
355
|
+
padding: "12px",
|
|
356
|
+
display: "flex",
|
|
357
|
+
flexDirection: "column",
|
|
358
|
+
overflow: "hidden"
|
|
359
|
+
},
|
|
360
|
+
children
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
);
|
|
260
366
|
}
|
|
261
367
|
function PublicAgentChat({
|
|
262
368
|
apiUrl,
|
|
@@ -266,7 +372,8 @@ function PublicAgentChat({
|
|
|
266
372
|
title,
|
|
267
373
|
className,
|
|
268
374
|
style,
|
|
269
|
-
onSessionReady
|
|
375
|
+
onSessionReady,
|
|
376
|
+
showAgentActivity = false
|
|
270
377
|
}) {
|
|
271
378
|
const [grant, setGrant] = useState(null);
|
|
272
379
|
const [capabilityToken, setCapabilityToken] = useState(null);
|
|
@@ -276,12 +383,15 @@ function PublicAgentChat({
|
|
|
276
383
|
const [accessCode, setAccessCode] = useState("");
|
|
277
384
|
const [input, setInput] = useState("");
|
|
278
385
|
const autoStartedRef = useRef(false);
|
|
386
|
+
const displayTitle = resolveAgentTitle(title, slug, grant);
|
|
387
|
+
const displaySubtitle = resolveAgentSubtitle(grant);
|
|
279
388
|
const { data: historyMessages = [] } = usePublicAgentChatMessages(apiUrl, session?.sessionId ?? null, capabilityToken);
|
|
280
|
-
const {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
389
|
+
const {
|
|
390
|
+
messages: liveMessages,
|
|
391
|
+
state,
|
|
392
|
+
sendMessage,
|
|
393
|
+
clearError
|
|
394
|
+
} = usePublicAgentChatWebSocket(session?.sessionId ?? null, apiUrl, capabilityToken);
|
|
285
395
|
useEffect(() => {
|
|
286
396
|
let cancelled = false;
|
|
287
397
|
autoStartedRef.current = false;
|
|
@@ -333,6 +443,7 @@ function PublicAgentChat({
|
|
|
333
443
|
}
|
|
334
444
|
);
|
|
335
445
|
setSession(createdSession);
|
|
446
|
+
setCapabilityToken(createdSession.capabilityToken ?? authorization.capabilityToken);
|
|
336
447
|
setStatus("ready");
|
|
337
448
|
onSessionReady?.(createdSession);
|
|
338
449
|
} catch (requestError) {
|
|
@@ -349,7 +460,10 @@ function PublicAgentChat({
|
|
|
349
460
|
autoStartedRef.current = true;
|
|
350
461
|
void startSession();
|
|
351
462
|
}, [grant, startSession]);
|
|
352
|
-
const allMessages = useMemo(
|
|
463
|
+
const allMessages = useMemo(
|
|
464
|
+
() => mergeSessionMessages(historyMessages, liveMessages),
|
|
465
|
+
[historyMessages, liveMessages]
|
|
466
|
+
);
|
|
353
467
|
const handleSend = () => {
|
|
354
468
|
const trimmed = input.trim();
|
|
355
469
|
if (!trimmed || state.isProcessing) return;
|
|
@@ -357,57 +471,143 @@ function PublicAgentChat({
|
|
|
357
471
|
setInput("");
|
|
358
472
|
};
|
|
359
473
|
if (status === "loading" || status === "authorizing") {
|
|
360
|
-
return /* @__PURE__ */ jsx(
|
|
474
|
+
return /* @__PURE__ */ jsx(
|
|
475
|
+
PublicAgentChatFrame,
|
|
476
|
+
{
|
|
477
|
+
className,
|
|
478
|
+
style,
|
|
479
|
+
title: displayTitle,
|
|
480
|
+
subtitle: displaySubtitle,
|
|
481
|
+
statusTone: "loading",
|
|
482
|
+
children: /* @__PURE__ */ jsx(Center, { style: { height: "100%" }, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) })
|
|
483
|
+
}
|
|
484
|
+
);
|
|
361
485
|
}
|
|
362
486
|
if (status === "code-required") {
|
|
363
|
-
return /* @__PURE__ */ jsx(
|
|
364
|
-
|
|
487
|
+
return /* @__PURE__ */ jsx(
|
|
488
|
+
PublicAgentChatFrame,
|
|
365
489
|
{
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
490
|
+
className,
|
|
491
|
+
style,
|
|
492
|
+
title: displayTitle,
|
|
493
|
+
subtitle: displaySubtitle,
|
|
494
|
+
statusTone: "locked",
|
|
495
|
+
children: /* @__PURE__ */ jsx(Center, { style: { height: "100%", padding: 16 }, children: /* @__PURE__ */ jsx(
|
|
496
|
+
Paper,
|
|
497
|
+
{
|
|
498
|
+
withBorder: true,
|
|
499
|
+
p: "lg",
|
|
500
|
+
radius: 8,
|
|
501
|
+
style: {
|
|
502
|
+
width: "min(100%, 420px)",
|
|
503
|
+
background: "var(--color-surface)",
|
|
504
|
+
borderColor: "var(--color-border)",
|
|
505
|
+
boxShadow: "var(--card-shadow)"
|
|
506
|
+
},
|
|
507
|
+
children: /* @__PURE__ */ jsx(
|
|
508
|
+
"form",
|
|
509
|
+
{
|
|
510
|
+
onSubmit: (event) => {
|
|
511
|
+
event.preventDefault();
|
|
512
|
+
void startSession(accessCode);
|
|
513
|
+
},
|
|
514
|
+
children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
515
|
+
/* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
|
|
516
|
+
/* @__PURE__ */ jsx(IconLock, { size: 18 }),
|
|
517
|
+
/* @__PURE__ */ jsx(Title, { order: 2, size: "h4", children: "Access code" })
|
|
518
|
+
] }),
|
|
519
|
+
error && /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), children: error }),
|
|
520
|
+
/* @__PURE__ */ jsx(
|
|
521
|
+
PasswordInput,
|
|
522
|
+
{
|
|
523
|
+
label: "Code",
|
|
524
|
+
value: accessCode,
|
|
525
|
+
onChange: (event) => setAccessCode(event.currentTarget.value),
|
|
526
|
+
autoComplete: "one-time-code",
|
|
527
|
+
required: true
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", leftSection: /* @__PURE__ */ jsx(IconSend, { size: 16 }), disabled: !accessCode.trim(), children: "Continue" })
|
|
531
|
+
] })
|
|
532
|
+
}
|
|
533
|
+
)
|
|
534
|
+
}
|
|
535
|
+
) })
|
|
388
536
|
}
|
|
389
|
-
)
|
|
537
|
+
);
|
|
390
538
|
}
|
|
391
539
|
if (status === "error") {
|
|
392
|
-
return /* @__PURE__ */ jsx(
|
|
540
|
+
return /* @__PURE__ */ jsx(
|
|
541
|
+
PublicAgentChatFrame,
|
|
542
|
+
{
|
|
543
|
+
className,
|
|
544
|
+
style,
|
|
545
|
+
title: displayTitle,
|
|
546
|
+
subtitle: displaySubtitle,
|
|
547
|
+
statusTone: "error",
|
|
548
|
+
children: /* @__PURE__ */ jsx(Center, { style: { height: "100%", padding: 16 }, children: /* @__PURE__ */ jsx(Alert, { color: "red", icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), title: displayTitle, children: /* @__PURE__ */ jsx(Text, { size: "sm", children: error ?? "Unable to load agent chat" }) }) })
|
|
549
|
+
}
|
|
550
|
+
);
|
|
393
551
|
}
|
|
394
|
-
return /* @__PURE__ */ jsx(
|
|
395
|
-
|
|
552
|
+
return /* @__PURE__ */ jsx(
|
|
553
|
+
PublicAgentChatFrame,
|
|
554
|
+
{
|
|
555
|
+
className,
|
|
556
|
+
style,
|
|
557
|
+
title: displayTitle,
|
|
558
|
+
subtitle: displaySubtitle,
|
|
559
|
+
statusTone: state.isConnected ? "ready" : "loading",
|
|
560
|
+
children: /* @__PURE__ */ jsx(Box, { style: { flex: "1 1 auto", minHeight: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx(
|
|
561
|
+
ChatInterface,
|
|
562
|
+
{
|
|
563
|
+
messages: allMessages,
|
|
564
|
+
input,
|
|
565
|
+
onInputChange: setInput,
|
|
566
|
+
onSendMessage: handleSend,
|
|
567
|
+
style: { flex: "1 1 auto", minHeight: 0, height: "100%" },
|
|
568
|
+
isProcessing: state.isProcessing,
|
|
569
|
+
isConnected: state.isConnected,
|
|
570
|
+
error: state.error,
|
|
571
|
+
onClearError: clearError,
|
|
572
|
+
emptyStateText: "No messages yet",
|
|
573
|
+
emptyStateSubtext: "Send a message to start the conversation",
|
|
574
|
+
placeholder: "Message the agent...",
|
|
575
|
+
messageAreaVariant: "grid",
|
|
576
|
+
showAgentActivity
|
|
577
|
+
}
|
|
578
|
+
) })
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
function PublicAgentChatRoutePage({ pageStyle, style, ...props }) {
|
|
583
|
+
return /* @__PURE__ */ jsx(
|
|
584
|
+
Box,
|
|
396
585
|
{
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
586
|
+
style: {
|
|
587
|
+
minHeight: "100vh",
|
|
588
|
+
display: "flex",
|
|
589
|
+
justifyContent: "center",
|
|
590
|
+
alignItems: "stretch",
|
|
591
|
+
padding: "clamp(16px, 3vw, 32px)",
|
|
592
|
+
background: "var(--color-background)",
|
|
593
|
+
color: "var(--color-text)",
|
|
594
|
+
...pageStyle
|
|
595
|
+
},
|
|
596
|
+
children: /* @__PURE__ */ jsx(
|
|
597
|
+
PublicAgentChat,
|
|
598
|
+
{
|
|
599
|
+
...props,
|
|
600
|
+
style: {
|
|
601
|
+
width: "min(100%, 980px)",
|
|
602
|
+
height: "calc(100vh - clamp(32px, 6vw, 64px))",
|
|
603
|
+
minHeight: 560,
|
|
604
|
+
maxHeight: "920px",
|
|
605
|
+
...style
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
)
|
|
409
609
|
}
|
|
410
|
-
)
|
|
610
|
+
);
|
|
411
611
|
}
|
|
412
612
|
|
|
413
|
-
export { PublicAgentChat, publicAgentChatKeys, usePublicAgentChatMessages, usePublicAgentChatWebSocket };
|
|
613
|
+
export { PublicAgentChat, PublicAgentChatRoutePage, publicAgentChatKeys, usePublicAgentChatMessages, usePublicAgentChatWebSocket };
|