@arbidocs/react 0.3.148 → 0.3.150
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/index.cjs +350 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +163 -6
- package/dist/index.d.ts +163 -6
- package/dist/index.js +339 -118
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
|
|
4
3
|
var chunkZMTLGO3K_cjs = require('./chunk-ZMTLGO3K.cjs');
|
|
4
|
+
var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -1336,7 +1336,7 @@ function ArbiChat({
|
|
|
1336
1336
|
) }) });
|
|
1337
1337
|
}
|
|
1338
1338
|
var TypingIndicator = React2.memo(function TypingIndicator2() {
|
|
1339
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
|
|
1339
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", "data-testid": "dm-typing-indicator", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
|
|
1340
1340
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]" }),
|
|
1341
1341
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]" }),
|
|
1342
1342
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]" })
|
|
@@ -1350,23 +1350,35 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1350
1350
|
read,
|
|
1351
1351
|
onDelete,
|
|
1352
1352
|
isLastOfRun = true,
|
|
1353
|
+
senderName,
|
|
1354
|
+
classNames,
|
|
1353
1355
|
renderMessage = (m) => m,
|
|
1354
|
-
formatTimestamp = (t) => t
|
|
1356
|
+
formatTimestamp = (t) => t,
|
|
1357
|
+
"data-testid": testId
|
|
1355
1358
|
}) {
|
|
1356
1359
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
1357
1360
|
const [isFocused, setIsFocused] = React2.useState(false);
|
|
1358
1361
|
const showDeleteButton = isHovered || isFocused;
|
|
1359
1362
|
if (deleted) {
|
|
1360
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1363
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
|
+
"div",
|
|
1365
|
+
{
|
|
1366
|
+
"data-testid": testId,
|
|
1367
|
+
className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
|
|
1368
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1361
1371
|
}
|
|
1362
1372
|
const bubbleRadius = chunkZBZKHBDS_cjs.cn(
|
|
1363
1373
|
"rounded-2xl",
|
|
1364
|
-
isSent && isLastOfRun && "rounded-br-
|
|
1365
|
-
!isSent && isLastOfRun && "rounded-bl-
|
|
1374
|
+
isSent && isLastOfRun && "rounded-br-sm",
|
|
1375
|
+
!isSent && isLastOfRun && "rounded-bl-sm"
|
|
1366
1376
|
);
|
|
1377
|
+
const bubbleSurface = isSent ? chunkZBZKHBDS_cjs.cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
|
|
1367
1378
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1368
1379
|
"div",
|
|
1369
1380
|
{
|
|
1381
|
+
"data-testid": testId,
|
|
1370
1382
|
className: chunkZBZKHBDS_cjs.cn(
|
|
1371
1383
|
"flex w-full items-end",
|
|
1372
1384
|
isLastOfRun ? "mb-2" : "mb-0.5",
|
|
@@ -1389,41 +1401,23 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1389
1401
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
|
|
1390
1402
|
}
|
|
1391
1403
|
),
|
|
1392
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1393
|
-
"div",
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
"
|
|
1404
|
-
{
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
children: [
|
|
1410
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1411
|
-
"span",
|
|
1412
|
-
{
|
|
1413
|
-
className: chunkZBZKHBDS_cjs.cn(
|
|
1414
|
-
"text-[11px] leading-none",
|
|
1415
|
-
isSent ? "text-primary-foreground/70" : "text-muted-foreground"
|
|
1416
|
-
),
|
|
1417
|
-
children: formatTimestamp(timestamp)
|
|
1418
|
-
}
|
|
1419
|
-
),
|
|
1420
|
-
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 text-primary-foreground/80 flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 text-primary-foreground/60 flex-shrink-0" }))
|
|
1421
|
-
]
|
|
1422
|
-
}
|
|
1423
|
-
)
|
|
1424
|
-
]
|
|
1425
|
-
}
|
|
1426
|
-
) }),
|
|
1404
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkZBZKHBDS_cjs.cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
|
|
1405
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1406
|
+
isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1407
|
+
"div",
|
|
1408
|
+
{
|
|
1409
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
1410
|
+
"flex items-center gap-1.5 mt-0.5",
|
|
1411
|
+
isSent ? "justify-end" : "justify-start"
|
|
1412
|
+
),
|
|
1413
|
+
children: [
|
|
1414
|
+
senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
|
|
1415
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1416
|
+
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1417
|
+
]
|
|
1418
|
+
}
|
|
1419
|
+
)
|
|
1420
|
+
] }) }),
|
|
1427
1421
|
!isSent && onDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1428
1422
|
"button",
|
|
1429
1423
|
{
|
|
@@ -4406,6 +4400,13 @@ var presencePositionClasses = {
|
|
|
4406
4400
|
md: "-right-1.5 -bottom-0.5",
|
|
4407
4401
|
lg: "-right-1.5 -bottom-0.5"
|
|
4408
4402
|
};
|
|
4403
|
+
var PRESENCE_LABELS = {
|
|
4404
|
+
connected: "Online",
|
|
4405
|
+
connecting: "Connecting",
|
|
4406
|
+
disconnected: "Offline",
|
|
4407
|
+
error: "Connection problem",
|
|
4408
|
+
hidden: "Status hidden"
|
|
4409
|
+
};
|
|
4409
4410
|
var presenceColorClasses = {
|
|
4410
4411
|
connected: "bg-status-online",
|
|
4411
4412
|
connecting: "bg-status-connecting",
|
|
@@ -4426,6 +4427,7 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4426
4427
|
colorClass = "",
|
|
4427
4428
|
isAgent = false,
|
|
4428
4429
|
agentStyle,
|
|
4430
|
+
avatarStyle,
|
|
4429
4431
|
isMe = false,
|
|
4430
4432
|
displayStatus,
|
|
4431
4433
|
onClick,
|
|
@@ -4445,6 +4447,7 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4445
4447
|
const agentBadge = isAgent ? /* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { className: "w-3.5 h-3.5 text-muted-foreground" }) : void 0;
|
|
4446
4448
|
const canMessage = interactive && !isMe && !isAgent;
|
|
4447
4449
|
const showUnread = hasUnreadMessages && !isMe && !isAgent;
|
|
4450
|
+
const surfaceStyle = avatarStyle ?? agentStyle;
|
|
4448
4451
|
const avatarCore = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4449
4452
|
chunkZBZKHBDS_cjs.Avatar,
|
|
4450
4453
|
{
|
|
@@ -4452,7 +4455,7 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4452
4455
|
sizeClasses[size],
|
|
4453
4456
|
isAgent ? "rounded-full border-2 border-dashed" : "border border-white"
|
|
4454
4457
|
),
|
|
4455
|
-
style:
|
|
4458
|
+
style: surfaceStyle,
|
|
4456
4459
|
"data-testid": "user-entity",
|
|
4457
4460
|
children: [
|
|
4458
4461
|
picture && /* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.AvatarImage, { src: picture, alt: initials }),
|
|
@@ -4464,7 +4467,7 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4464
4467
|
"font-semibold leading-none",
|
|
4465
4468
|
isAgent ? "rounded-full bg-transparent" : `text-white ${colorClass}`
|
|
4466
4469
|
),
|
|
4467
|
-
style:
|
|
4470
|
+
style: surfaceStyle,
|
|
4468
4471
|
children: initials
|
|
4469
4472
|
}
|
|
4470
4473
|
)
|
|
@@ -4481,7 +4484,10 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4481
4484
|
!showUnread && displayStatus ? presenceColorClasses[displayStatus] : ""
|
|
4482
4485
|
),
|
|
4483
4486
|
style: showUnread ? { backgroundColor: "#00adef" } : void 0,
|
|
4484
|
-
"data-testid": "user-entity-presence"
|
|
4487
|
+
"data-testid": "user-entity-presence",
|
|
4488
|
+
role: "img",
|
|
4489
|
+
"aria-label": showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus],
|
|
4490
|
+
title: showUnread ? "Unread messages" : PRESENCE_LABELS[displayStatus]
|
|
4485
4491
|
}
|
|
4486
4492
|
) : null;
|
|
4487
4493
|
const avatarElement = statusDot ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4558,6 +4564,59 @@ var UserEntity = React2.memo(function UserEntity2({
|
|
|
4558
4564
|
}
|
|
4559
4565
|
return avatarElement;
|
|
4560
4566
|
});
|
|
4567
|
+
function AgentBadge({ className }) {
|
|
4568
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4569
|
+
"span",
|
|
4570
|
+
{
|
|
4571
|
+
"data-testid": "agent-badge",
|
|
4572
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
4573
|
+
"inline-flex shrink-0 items-center gap-1 rounded-full border border-ai-accent/50",
|
|
4574
|
+
"bg-ai-accent-soft px-2 py-0.5 text-[11px] font-bold uppercase tracking-wider text-ai-accent",
|
|
4575
|
+
className
|
|
4576
|
+
),
|
|
4577
|
+
children: [
|
|
4578
|
+
/* @__PURE__ */ jsxRuntime.jsx(ArbiBotHeadIcon, { size: 14, className: "text-ai-accent" }),
|
|
4579
|
+
"Agent"
|
|
4580
|
+
]
|
|
4581
|
+
}
|
|
4582
|
+
);
|
|
4583
|
+
}
|
|
4584
|
+
var PRESENCE_WORDS = {
|
|
4585
|
+
connected: "Online",
|
|
4586
|
+
connecting: "Connecting",
|
|
4587
|
+
disconnected: "Offline",
|
|
4588
|
+
error: "Connection problem",
|
|
4589
|
+
hidden: null
|
|
4590
|
+
};
|
|
4591
|
+
function PresenceLabel({
|
|
4592
|
+
status,
|
|
4593
|
+
className
|
|
4594
|
+
}) {
|
|
4595
|
+
if (!status) return null;
|
|
4596
|
+
const word = PRESENCE_WORDS[status];
|
|
4597
|
+
if (!word) return null;
|
|
4598
|
+
const online = status === "connected";
|
|
4599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4600
|
+
"span",
|
|
4601
|
+
{
|
|
4602
|
+
"data-testid": "presence-label",
|
|
4603
|
+
className: chunkZBZKHBDS_cjs.cn("inline-flex shrink-0 items-center gap-1 text-xs", className),
|
|
4604
|
+
children: [
|
|
4605
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4606
|
+
"span",
|
|
4607
|
+
{
|
|
4608
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
4609
|
+
"size-1.5 rounded-full",
|
|
4610
|
+
online ? "bg-status-online" : "bg-muted-foreground/50"
|
|
4611
|
+
),
|
|
4612
|
+
"aria-hidden": "true"
|
|
4613
|
+
}
|
|
4614
|
+
),
|
|
4615
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: online ? "font-medium text-status-online" : "text-muted-foreground", children: word })
|
|
4616
|
+
]
|
|
4617
|
+
}
|
|
4618
|
+
);
|
|
4619
|
+
}
|
|
4561
4620
|
var PACKAGE_BADGE_VARIANTS = [
|
|
4562
4621
|
"default",
|
|
4563
4622
|
"accent",
|
|
@@ -5177,6 +5236,9 @@ function userDisplayName(user) {
|
|
|
5177
5236
|
const name = [user.given_name, user.family_name].filter(Boolean).join(" ").trim();
|
|
5178
5237
|
return name || user.email?.split("@")[0] || "Unknown";
|
|
5179
5238
|
}
|
|
5239
|
+
function isAgentUser(user) {
|
|
5240
|
+
return user.external_id.startsWith("agt-");
|
|
5241
|
+
}
|
|
5180
5242
|
var RELATIVE = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
|
|
5181
5243
|
var DIVISIONS = [
|
|
5182
5244
|
{ amount: 60, unit: "seconds" },
|
|
@@ -5425,101 +5487,235 @@ function useDirectMessages(options) {
|
|
|
5425
5487
|
markRead: (messageIds) => markReadMutation.mutateAsync(messageIds)
|
|
5426
5488
|
};
|
|
5427
5489
|
}
|
|
5428
|
-
function DmAvatar({ user, className }) {
|
|
5429
|
-
const
|
|
5430
|
-
const
|
|
5431
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5490
|
+
function DmAvatar({ user, className, size = "lg" }) {
|
|
5491
|
+
const presence = useArbiWsStore((s) => s.presence[user.external_id]);
|
|
5492
|
+
const displayStatus = presence === void 0 ? void 0 : presence === "online" ? "connected" : "disconnected";
|
|
5493
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5494
|
+
UserEntity,
|
|
5495
|
+
{
|
|
5496
|
+
variant: "icon",
|
|
5497
|
+
size,
|
|
5498
|
+
className,
|
|
5499
|
+
interactive: false,
|
|
5500
|
+
showTooltip: false,
|
|
5501
|
+
initials: userInitials(user),
|
|
5502
|
+
displayName: userDisplayName(user),
|
|
5503
|
+
picture: user.picture,
|
|
5504
|
+
avatarStyle: getEntityColorStyles(user.external_id),
|
|
5505
|
+
isAgent: isAgentUser(user),
|
|
5506
|
+
displayStatus
|
|
5507
|
+
}
|
|
5508
|
+
);
|
|
5435
5509
|
}
|
|
5436
5510
|
function ConversationList({
|
|
5437
5511
|
conversations,
|
|
5438
5512
|
selectedPeerId,
|
|
5439
5513
|
onSelect,
|
|
5440
5514
|
classNames,
|
|
5441
|
-
emptyState
|
|
5515
|
+
emptyState,
|
|
5516
|
+
header,
|
|
5517
|
+
className
|
|
5442
5518
|
}) {
|
|
5443
5519
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5444
5520
|
"aside",
|
|
5445
5521
|
{
|
|
5446
|
-
className:
|
|
5522
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5523
|
+
"flex min-h-0 flex-col border-b border-border md:w-80 md:shrink-0 md:border-b-0 md:border-r",
|
|
5524
|
+
className
|
|
5525
|
+
),
|
|
5447
5526
|
"data-testid": "arbi-dm-list",
|
|
5448
5527
|
children: [
|
|
5449
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
|
|
5528
|
+
header === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
|
|
5450
5529
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Conversations" }),
|
|
5451
5530
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
5452
5531
|
conversations.length,
|
|
5453
5532
|
" ",
|
|
5454
5533
|
conversations.length === 1 ? "colleague" : "colleagues"
|
|
5455
5534
|
] })
|
|
5456
|
-
] }),
|
|
5457
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c) => {
|
|
5535
|
+
] }) : header,
|
|
5536
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c, i) => {
|
|
5458
5537
|
const { peer, lastMessage, unreadCount } = c;
|
|
5538
|
+
const newSection = c.sectionLabel && c.sectionLabel !== conversations[i - 1]?.sectionLabel;
|
|
5459
5539
|
const active = peer.external_id === selectedPeerId;
|
|
5460
|
-
const preview = lastMessage
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
{
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5540
|
+
const preview = lastMessage?.body ?? "No messages yet \u2014 say hello";
|
|
5541
|
+
const unread = unreadCount > 0;
|
|
5542
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5543
|
+
c.leading ?? /* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer }),
|
|
5544
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
5545
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5546
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
5547
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5548
|
+
"span",
|
|
5549
|
+
{
|
|
5550
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5551
|
+
"truncate text-sm text-foreground",
|
|
5552
|
+
unread ? "font-bold" : "font-semibold"
|
|
5553
|
+
),
|
|
5554
|
+
children: userDisplayName(peer)
|
|
5555
|
+
}
|
|
5556
|
+
),
|
|
5557
|
+
c.badge ?? (isAgentUser(peer) ? /* @__PURE__ */ jsxRuntime.jsx(AgentBadge, {}) : null)
|
|
5558
|
+
] }),
|
|
5559
|
+
c.statusLabel ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5560
|
+
chunkZBZKHBDS_cjs.Badge,
|
|
5561
|
+
{
|
|
5562
|
+
variant: "outline",
|
|
5563
|
+
className: "shrink-0 rounded-full px-2 py-0 text-[10px] font-medium text-muted-foreground",
|
|
5564
|
+
children: c.statusLabel
|
|
5565
|
+
}
|
|
5566
|
+
) : unreadCount > 0 ? (
|
|
5567
|
+
// Quiet by default: a filled brand pill with a shadow
|
|
5568
|
+
// shouted louder than the message it was counting.
|
|
5569
|
+
// Enough to catch the eye scanning the list, no more.
|
|
5570
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5571
|
+
chunkZBZKHBDS_cjs.Badge,
|
|
5572
|
+
{
|
|
5573
|
+
variant: "accent",
|
|
5574
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5575
|
+
"min-w-[1.125rem] justify-center rounded-full px-1 py-0 text-[10px] font-medium leading-[1.125rem] shadow-none",
|
|
5576
|
+
classNames?.unreadBadge
|
|
5577
|
+
),
|
|
5578
|
+
children: unreadCount
|
|
5579
|
+
}
|
|
5580
|
+
)
|
|
5581
|
+
) : null
|
|
5582
|
+
] }),
|
|
5583
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-1.5", children: [
|
|
5584
|
+
lastMessage?.isMine ? lastMessage.read ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5585
|
+
lucideReact.CheckCheck,
|
|
5586
|
+
{
|
|
5587
|
+
className: "size-3.5 shrink-0 text-ai-accent",
|
|
5588
|
+
"aria-label": "Read"
|
|
5589
|
+
}
|
|
5590
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5591
|
+
lucideReact.Check,
|
|
5592
|
+
{
|
|
5593
|
+
className: "size-3.5 shrink-0 text-muted-foreground",
|
|
5594
|
+
"aria-label": "Sent"
|
|
5595
|
+
}
|
|
5596
|
+
) : null,
|
|
5597
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5598
|
+
"p",
|
|
5599
|
+
{
|
|
5600
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5601
|
+
"min-w-0 flex-1 truncate text-xs",
|
|
5602
|
+
unread ? "font-medium text-foreground" : "text-muted-foreground"
|
|
5603
|
+
),
|
|
5604
|
+
children: c.subtitle ?? preview
|
|
5605
|
+
}
|
|
5606
|
+
),
|
|
5607
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: lastMessage ? formatRelativeTime(lastMessage.createdAt) : "" })
|
|
5608
|
+
] })
|
|
5609
|
+
] })
|
|
5610
|
+
] });
|
|
5611
|
+
const rowClass = chunkZBZKHBDS_cjs.cn(
|
|
5612
|
+
// Each row is its own opaque surface. Left transparent it takes
|
|
5613
|
+
// the panel's colour, and the chips stop reading as cards at all
|
|
5614
|
+
// — which is the whole point of them.
|
|
5615
|
+
"flex w-full items-start gap-3 border-b border-border/60 bg-card px-4 py-3 text-left transition-colors",
|
|
5616
|
+
c.disabled ? "cursor-default" : active ? "bg-ai-accent-soft" : "hover:bg-accent/40"
|
|
5617
|
+
);
|
|
5618
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5619
|
+
newSection && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5620
|
+
"p",
|
|
5621
|
+
{
|
|
5622
|
+
className: "bg-muted/40 px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
5623
|
+
"data-testid": "arbi-dm-section",
|
|
5624
|
+
children: c.sectionLabel
|
|
5625
|
+
}
|
|
5626
|
+
),
|
|
5627
|
+
c.disabled ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5628
|
+
"div",
|
|
5629
|
+
{
|
|
5630
|
+
"data-testid": `arbi-dm-conversation-${peer.external_id}`,
|
|
5631
|
+
className: rowClass,
|
|
5632
|
+
children: [
|
|
5633
|
+
body,
|
|
5634
|
+
c.trailing
|
|
5635
|
+
]
|
|
5636
|
+
}
|
|
5637
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5638
|
+
"button",
|
|
5639
|
+
{
|
|
5640
|
+
type: "button",
|
|
5641
|
+
onClick: () => onSelect(peer.external_id),
|
|
5642
|
+
"data-testid": `arbi-dm-conversation-${peer.external_id}`,
|
|
5643
|
+
className: rowClass,
|
|
5644
|
+
children: body
|
|
5645
|
+
}
|
|
5646
|
+
)
|
|
5647
|
+
] }, peer.external_id);
|
|
5486
5648
|
}) }) })
|
|
5487
5649
|
]
|
|
5488
5650
|
}
|
|
5489
5651
|
);
|
|
5490
5652
|
}
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5653
|
+
|
|
5654
|
+
// src/directmessages/grouping.ts
|
|
5655
|
+
var RUN_WINDOW_MS = 2 * 60 * 1e3;
|
|
5656
|
+
function dayKey(iso) {
|
|
5657
|
+
const d = new Date(iso);
|
|
5658
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
5659
|
+
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
|
5660
|
+
}
|
|
5661
|
+
function annotateThread(messages, accessors, runWindowMs = RUN_WINDOW_MS) {
|
|
5662
|
+
const { senderId, createdAt } = accessors;
|
|
5663
|
+
return messages.map((message, i) => {
|
|
5664
|
+
const next = messages[i + 1];
|
|
5665
|
+
const prev = messages[i - 1];
|
|
5666
|
+
const day = dayKey(createdAt(message));
|
|
5667
|
+
const continuesIntoNext = !!next && senderId(next) === senderId(message) && dayKey(createdAt(next)) === day && Date.parse(createdAt(next)) - Date.parse(createdAt(message)) < runWindowMs;
|
|
5668
|
+
return {
|
|
5669
|
+
message,
|
|
5670
|
+
isLastOfRun: !continuesIntoNext,
|
|
5671
|
+
isFirstOfDay: !prev || dayKey(createdAt(prev)) !== day
|
|
5672
|
+
};
|
|
5673
|
+
});
|
|
5674
|
+
}
|
|
5675
|
+
function DateSeparator({ children }) {
|
|
5676
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-3 flex justify-center", "data-testid": "dm-date-separator", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-background/80 px-2 py-0.5 text-xs text-muted-foreground", children }) });
|
|
5677
|
+
}
|
|
5678
|
+
function MessageBubble2({
|
|
5679
|
+
message,
|
|
5680
|
+
classNames,
|
|
5681
|
+
isLastOfRun = true,
|
|
5682
|
+
onDelete,
|
|
5683
|
+
deleted
|
|
5684
|
+
}) {
|
|
5685
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5686
|
+
ChatBubble,
|
|
5496
5687
|
{
|
|
5497
5688
|
"data-testid": "arbi-dm-message",
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
"max-w-[80%] rounded-2xl px-3.5 py-2 text-sm shadow-sm",
|
|
5509
|
-
isMine ? chunkZBZKHBDS_cjs.cn("rounded-br-sm bg-accent text-accent-foreground", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn(
|
|
5510
|
-
"rounded-bl-sm border border-border bg-card text-card-foreground",
|
|
5511
|
-
classNames?.peerBubble
|
|
5512
|
-
)
|
|
5513
|
-
),
|
|
5514
|
-
children: message.body
|
|
5515
|
-
}
|
|
5516
|
-
)
|
|
5517
|
-
]
|
|
5689
|
+
message: message.body,
|
|
5690
|
+
timestamp: message.createdAt,
|
|
5691
|
+
isSent: message.isMine,
|
|
5692
|
+
read: message.read,
|
|
5693
|
+
deleted,
|
|
5694
|
+
onDelete,
|
|
5695
|
+
isLastOfRun,
|
|
5696
|
+
senderName: message.isMine ? "You" : userDisplayName(message.sender),
|
|
5697
|
+
classNames,
|
|
5698
|
+
formatTimestamp: formatRelativeTime
|
|
5518
5699
|
}
|
|
5519
5700
|
);
|
|
5520
5701
|
}
|
|
5521
|
-
|
|
5702
|
+
var THREAD_ACCESSORS = {
|
|
5703
|
+
senderId: (m) => m.sender.external_id,
|
|
5704
|
+
createdAt: (m) => m.createdAt
|
|
5705
|
+
};
|
|
5706
|
+
function MessageThread({
|
|
5707
|
+
conversation,
|
|
5708
|
+
classNames,
|
|
5709
|
+
emptyState,
|
|
5710
|
+
formatDay,
|
|
5711
|
+
onDeleteMessage,
|
|
5712
|
+
deletedIds
|
|
5713
|
+
}) {
|
|
5522
5714
|
const bottomRef = React2.useRef(null);
|
|
5715
|
+
const items = React2.useMemo(
|
|
5716
|
+
() => annotateThread(conversation?.messages ?? [], THREAD_ACCESSORS),
|
|
5717
|
+
[conversation?.messages]
|
|
5718
|
+
);
|
|
5523
5719
|
React2.useEffect(() => {
|
|
5524
5720
|
bottomRef.current?.scrollIntoView({ block: "end" });
|
|
5525
5721
|
}, [conversation?.peer.external_id, conversation?.messages.length]);
|
|
@@ -5532,7 +5728,7 @@ function MessageThread({ conversation, classNames, emptyState }) {
|
|
|
5532
5728
|
] })
|
|
5533
5729
|
] }) });
|
|
5534
5730
|
}
|
|
5535
|
-
const { peer
|
|
5731
|
+
const { peer } = conversation;
|
|
5536
5732
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5537
5733
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-center gap-3 border-b border-border px-4 py-3", children: [
|
|
5538
5734
|
/* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer, className: "size-9" }),
|
|
@@ -5541,20 +5737,42 @@ function MessageThread({ conversation, classNames, emptyState }) {
|
|
|
5541
5737
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-muted-foreground", children: peer.email })
|
|
5542
5738
|
] })
|
|
5543
5739
|
] }),
|
|
5544
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col
|
|
5545
|
-
|
|
5740
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4 py-4", "data-testid": "arbi-dm-thread", children: [
|
|
5741
|
+
items.map(({ message: m, isLastOfRun, isFirstOfDay }) => /* @__PURE__ */ jsxRuntime.jsxs(React2.Fragment, { children: [
|
|
5742
|
+
isFirstOfDay && formatDay && /* @__PURE__ */ jsxRuntime.jsx(DateSeparator, { children: formatDay(m.createdAt) }),
|
|
5743
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5744
|
+
MessageBubble2,
|
|
5745
|
+
{
|
|
5746
|
+
message: m,
|
|
5747
|
+
classNames,
|
|
5748
|
+
isLastOfRun,
|
|
5749
|
+
deleted: deletedIds?.has(m.externalId),
|
|
5750
|
+
onDelete: onDeleteMessage ? () => onDeleteMessage(m) : void 0
|
|
5751
|
+
}
|
|
5752
|
+
)
|
|
5753
|
+
] }, m.externalId)),
|
|
5546
5754
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: bottomRef })
|
|
5547
5755
|
] }) })
|
|
5548
5756
|
] });
|
|
5549
5757
|
}
|
|
5550
|
-
function DmComposer({
|
|
5758
|
+
function DmComposer({
|
|
5759
|
+
placeholder,
|
|
5760
|
+
disabled,
|
|
5761
|
+
busy,
|
|
5762
|
+
onSend,
|
|
5763
|
+
error,
|
|
5764
|
+
children,
|
|
5765
|
+
classNames
|
|
5766
|
+
}) {
|
|
5551
5767
|
const [draft, setDraft] = React2.useState("");
|
|
5768
|
+
const inputRef = React2.useRef(null);
|
|
5552
5769
|
const submit = async () => {
|
|
5553
5770
|
const text = draft.trim();
|
|
5554
|
-
if (!text || disabled) return;
|
|
5771
|
+
if (!text || disabled || busy) return;
|
|
5555
5772
|
setDraft("");
|
|
5556
5773
|
try {
|
|
5557
5774
|
await onSend(text);
|
|
5775
|
+
inputRef.current?.focus();
|
|
5558
5776
|
} catch {
|
|
5559
5777
|
setDraft(text);
|
|
5560
5778
|
}
|
|
@@ -5566,10 +5784,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
|
|
|
5566
5784
|
}
|
|
5567
5785
|
};
|
|
5568
5786
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-3", children: [
|
|
5787
|
+
children,
|
|
5569
5788
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
5570
5789
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5571
5790
|
chunkZBZKHBDS_cjs.Textarea,
|
|
5572
5791
|
{
|
|
5792
|
+
ref: inputRef,
|
|
5573
5793
|
value: draft,
|
|
5574
5794
|
onChange: (e) => setDraft(e.target.value),
|
|
5575
5795
|
onKeyDown,
|
|
@@ -5585,11 +5805,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
|
|
|
5585
5805
|
{
|
|
5586
5806
|
type: "button",
|
|
5587
5807
|
onClick: () => void submit(),
|
|
5588
|
-
disabled: disabled || !draft.trim(),
|
|
5808
|
+
disabled: disabled || busy || !draft.trim(),
|
|
5589
5809
|
className: chunkZBZKHBDS_cjs.cn(classNames?.sendButton),
|
|
5590
5810
|
"data-testid": "arbi-dm-send",
|
|
5811
|
+
"aria-label": "Send message",
|
|
5591
5812
|
children: [
|
|
5592
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
|
|
5813
|
+
busy ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
|
|
5593
5814
|
" Send"
|
|
5594
5815
|
]
|
|
5595
5816
|
}
|
|
@@ -6793,6 +7014,14 @@ function DocumentGallery({
|
|
|
6793
7014
|
);
|
|
6794
7015
|
}
|
|
6795
7016
|
|
|
7017
|
+
Object.defineProperty(exports, "ArbiProvider", {
|
|
7018
|
+
enumerable: true,
|
|
7019
|
+
get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
|
|
7020
|
+
});
|
|
7021
|
+
Object.defineProperty(exports, "useArbi", {
|
|
7022
|
+
enumerable: true,
|
|
7023
|
+
get: function () { return chunkZMTLGO3K_cjs.useArbi; }
|
|
7024
|
+
});
|
|
6796
7025
|
Object.defineProperty(exports, "AiMarkdown", {
|
|
6797
7026
|
enumerable: true,
|
|
6798
7027
|
get: function () { return chunkZBZKHBDS_cjs.AiMarkdown; }
|
|
@@ -7217,14 +7446,6 @@ Object.defineProperty(exports, "toggleVariants", {
|
|
|
7217
7446
|
enumerable: true,
|
|
7218
7447
|
get: function () { return chunkZBZKHBDS_cjs.toggleVariants; }
|
|
7219
7448
|
});
|
|
7220
|
-
Object.defineProperty(exports, "ArbiProvider", {
|
|
7221
|
-
enumerable: true,
|
|
7222
|
-
get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
|
|
7223
|
-
});
|
|
7224
|
-
Object.defineProperty(exports, "useArbi", {
|
|
7225
|
-
enumerable: true,
|
|
7226
|
-
get: function () { return chunkZMTLGO3K_cjs.useArbi; }
|
|
7227
|
-
});
|
|
7228
7449
|
Object.defineProperty(exports, "Arbi", {
|
|
7229
7450
|
enumerable: true,
|
|
7230
7451
|
get: function () { return browser.Arbi; }
|
|
@@ -7242,6 +7463,7 @@ Object.defineProperty(exports, "toast", {
|
|
|
7242
7463
|
get: function () { return sonner.toast; }
|
|
7243
7464
|
});
|
|
7244
7465
|
exports.ActivityFeed = ActivityFeed;
|
|
7466
|
+
exports.AgentBadge = AgentBadge;
|
|
7245
7467
|
exports.AiActionCard = AiActionCard;
|
|
7246
7468
|
exports.AiAnswer = AiAnswer;
|
|
7247
7469
|
exports.AppleIcon = AppleIcon;
|
|
@@ -7262,6 +7484,7 @@ exports.CommandPaletteProvider = CommandPaletteProvider;
|
|
|
7262
7484
|
exports.ConversationList = ConversationList;
|
|
7263
7485
|
exports.DEFAULT_ASPECT_OPTIONS = DEFAULT_ASPECT_OPTIONS;
|
|
7264
7486
|
exports.DEFAULT_NOTIFY_TONE = DEFAULT_NOTIFY_TONE;
|
|
7487
|
+
exports.DateSeparator = DateSeparator;
|
|
7265
7488
|
exports.DirectMessages = DirectMessages;
|
|
7266
7489
|
exports.DmAvatar = DmAvatar;
|
|
7267
7490
|
exports.DmComposer = DmComposer;
|
|
@@ -7298,8 +7521,10 @@ exports.OpenAIIcon = OpenAIIcon;
|
|
|
7298
7521
|
exports.PLACEHOLDER_COLOR = PLACEHOLDER_COLOR;
|
|
7299
7522
|
exports.PassageCard = PassageCard;
|
|
7300
7523
|
exports.PdfIcon = PdfIcon;
|
|
7524
|
+
exports.PresenceLabel = PresenceLabel;
|
|
7301
7525
|
exports.ProjectEntity = ProjectEntity;
|
|
7302
7526
|
exports.ProviderIcon = ProviderIcon;
|
|
7527
|
+
exports.RUN_WINDOW_MS = RUN_WINDOW_MS;
|
|
7303
7528
|
exports.RagDot = RagDot;
|
|
7304
7529
|
exports.RelevanceDot = RelevanceDot;
|
|
7305
7530
|
exports.SemanticSearch = SemanticSearch;
|
|
@@ -7316,11 +7541,13 @@ exports.VISIBILITY_ICONS = VISIBILITY_ICONS;
|
|
|
7316
7541
|
exports.VidIcon = VidIcon;
|
|
7317
7542
|
exports.VisibilityIcon = VisibilityIcon;
|
|
7318
7543
|
exports.XlsIcon = XlsIcon;
|
|
7544
|
+
exports.annotateThread = annotateThread;
|
|
7319
7545
|
exports.arbiQueryKeys = arbiQueryKeys;
|
|
7320
7546
|
exports.configureEntityRegistry = configureEntityRegistry;
|
|
7321
7547
|
exports.configureRagLabels = configureRagLabels;
|
|
7322
7548
|
exports.configureStatusRegistry = configureStatusRegistry;
|
|
7323
7549
|
exports.cropImage = cropImage;
|
|
7550
|
+
exports.dayKey = dayKey;
|
|
7324
7551
|
exports.describeActivity = describeActivity;
|
|
7325
7552
|
exports.formatRelativeTime = formatRelativeTime;
|
|
7326
7553
|
exports.getEntityColor = getEntityColor2;
|