@poolse/react-ui 1.1.0 → 2.0.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/CHANGELOG.md +26 -0
- package/README.md +2 -0
- package/dist/index.cjs +37 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -32
- package/dist/index.d.ts +44 -32
- package/dist/index.js +37 -28
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@ All notable changes to `@poolse/react-ui` are documented here. Format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[semver](https://semver.org).
|
|
6
6
|
|
|
7
|
+
## [2.0.0] — 2026-06-03
|
|
8
|
+
|
|
9
|
+
Lockstep release with `@poolse/sdk@2.0.0` and `@poolse/react@2.0.0`.
|
|
10
|
+
|
|
11
|
+
### Breaking
|
|
12
|
+
|
|
13
|
+
- **`UserNameProps.externalId`** — was `userId`. Same applies to
|
|
14
|
+
`useDisplayName(externalId, …)`.
|
|
15
|
+
- **`MemberListProps.labelFor: (externalId) => string`** — was keyed
|
|
16
|
+
by uuid. Same change to `avatarFor`.
|
|
17
|
+
- **`MemberListProps.onlineExternalIds`** — was `onlineUserIds`.
|
|
18
|
+
- **`TypingIndicatorProps.labelFor: (externalId) => string`**.
|
|
19
|
+
- **`MessageBubbleProps.labelFor: (externalId) => string`** — both
|
|
20
|
+
the main `labelFor` and the QuotedCard's. The bubble reads
|
|
21
|
+
`message.sender_external_id` to drive `useUser`.
|
|
22
|
+
- **`MessageComposerProps.labelFor: (externalId) => string`**.
|
|
23
|
+
- **`MentionInputProps.labelFor: (externalId) => string`**. The
|
|
24
|
+
dropdown filters and inserts by external_id; the wire `mentions`
|
|
25
|
+
array stays uuid-keyed (backend storage hasn't changed there).
|
|
26
|
+
- **`ConversationViewProps.labelFor: (externalId) => string`** —
|
|
27
|
+
passes through to every consuming child.
|
|
28
|
+
|
|
29
|
+
### Migration
|
|
30
|
+
|
|
31
|
+
See `MIGRATING.md` at the repo root.
|
|
32
|
+
|
|
7
33
|
## [1.1.0] — 2026-06-02
|
|
8
34
|
|
|
9
35
|
Lockstep release with `@poolse/sdk@1.1.0` and `@poolse/react@1.1.0`.
|
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ React components for [poolse](https://poolse.dev). A composed `<ConversationView
|
|
|
4
4
|
|
|
5
5
|
Sits on top of [`@poolse/react`](https://www.npmjs.com/package/@poolse/react) (hooks) and [`@poolse/sdk`](https://www.npmjs.com/package/@poolse/sdk) (client).
|
|
6
6
|
|
|
7
|
+
> **⚠️ Upgrading from 1.x?** See [MIGRATING.md](https://github.com/poolse-hq/js-sdk/blob/main/MIGRATING.md). Every `labelFor` / `avatarFor` / `onlineUserIds` prop is now keyed by `external_id`. `<UserName>` and `useDisplayName` switched from `userId` to `externalId`.
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
package/dist/index.cjs
CHANGED
|
@@ -389,24 +389,24 @@ function UploadChip({
|
|
|
389
389
|
}
|
|
390
390
|
var MAX_NAME_CHARS = 24;
|
|
391
391
|
function UserName({
|
|
392
|
-
|
|
392
|
+
externalId,
|
|
393
393
|
labelFor,
|
|
394
394
|
emptyFallback = "Unknown",
|
|
395
395
|
className
|
|
396
396
|
}) {
|
|
397
|
-
const { profile } = react$1.useUser(labelFor ? null :
|
|
398
|
-
const name = resolveDisplayName(
|
|
397
|
+
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
398
|
+
const name = resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
399
399
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className, children: truncate(name) });
|
|
400
400
|
}
|
|
401
|
-
function useDisplayName(
|
|
402
|
-
const { profile } = react$1.useUser(labelFor ? null :
|
|
403
|
-
return resolveDisplayName(
|
|
401
|
+
function useDisplayName(externalId, labelFor, emptyFallback = "Unknown") {
|
|
402
|
+
const { profile } = react$1.useUser(labelFor ? null : externalId);
|
|
403
|
+
return resolveDisplayName(externalId, profile?.displayName, labelFor, emptyFallback);
|
|
404
404
|
}
|
|
405
|
-
function resolveDisplayName(
|
|
406
|
-
if (!
|
|
407
|
-
if (labelFor) return labelFor(
|
|
405
|
+
function resolveDisplayName(externalId, resolved, labelFor, emptyFallback) {
|
|
406
|
+
if (!externalId) return emptyFallback;
|
|
407
|
+
if (labelFor) return labelFor(externalId);
|
|
408
408
|
if (resolved) return resolved;
|
|
409
|
-
return
|
|
409
|
+
return externalId;
|
|
410
410
|
}
|
|
411
411
|
function truncate(s) {
|
|
412
412
|
if (s.length <= MAX_NAME_CHARS) return s;
|
|
@@ -458,8 +458,10 @@ var MentionInput = react.forwardRef(
|
|
|
458
458
|
});
|
|
459
459
|
};
|
|
460
460
|
react.useImperativeHandle(ref, () => ({ addFiles }), [addFiles, attachments]);
|
|
461
|
-
const label = labelFor ?? ((id) => id
|
|
462
|
-
const filtered = mention ? members.filter(
|
|
461
|
+
const label = labelFor ?? ((id) => id);
|
|
462
|
+
const filtered = mention ? members.filter(
|
|
463
|
+
(m) => label(m.external_id).toLowerCase().includes(mention.query.toLowerCase())
|
|
464
|
+
) : [];
|
|
463
465
|
react.useEffect(() => {
|
|
464
466
|
setActiveIdx(0);
|
|
465
467
|
}, [filtered.length, mention?.query]);
|
|
@@ -486,7 +488,7 @@ var MentionInput = react.forwardRef(
|
|
|
486
488
|
};
|
|
487
489
|
const insertMention = (m) => {
|
|
488
490
|
if (!mention) return;
|
|
489
|
-
const name = label(m.
|
|
491
|
+
const name = label(m.external_id);
|
|
490
492
|
const before = value.slice(0, mention.start);
|
|
491
493
|
const after = value.slice(mention.start + 1 + mention.query.length);
|
|
492
494
|
const inserted = `@${name} `;
|
|
@@ -568,7 +570,7 @@ var MentionInput = react.forwardRef(
|
|
|
568
570
|
onCancelReply();
|
|
569
571
|
}
|
|
570
572
|
};
|
|
571
|
-
const replyLabel = replyingTo?.
|
|
573
|
+
const replyLabel = replyingTo?.sender_external_id ? labelFor?.(replyingTo.sender_external_id) ?? replyingTo.sender_external_id : "Unknown";
|
|
572
574
|
const canSend = !disabled && !sending && !uploading && (value.trim() !== "" || readyCount > 0);
|
|
573
575
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
574
576
|
"form",
|
|
@@ -688,7 +690,7 @@ var MentionInput = react.forwardRef(
|
|
|
688
690
|
},
|
|
689
691
|
children: [
|
|
690
692
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "@" }),
|
|
691
|
-
/* @__PURE__ */ jsxRuntime.jsx(UserName, {
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserName, { externalId: m.external_id, ...labelFor ? { labelFor } : {} })
|
|
692
694
|
]
|
|
693
695
|
},
|
|
694
696
|
m.id
|
|
@@ -867,7 +869,7 @@ function ReplyChip({
|
|
|
867
869
|
labelFor,
|
|
868
870
|
onCancel
|
|
869
871
|
}) {
|
|
870
|
-
const senderLabel = message.
|
|
872
|
+
const senderLabel = message.sender_external_id ? labelFor?.(message.sender_external_id) ?? message.sender_external_id : "Unknown";
|
|
871
873
|
const preview = message.body ?? "";
|
|
872
874
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__reply", role: "status", children: [
|
|
873
875
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-composer__reply-body", children: [
|
|
@@ -1113,10 +1115,11 @@ function MessageBubble({
|
|
|
1113
1115
|
}) {
|
|
1114
1116
|
const isSelf = currentUserId !== null && message.sender_id === currentUserId;
|
|
1115
1117
|
const [expanded, setExpanded] = react.useState(false);
|
|
1116
|
-
const { profile: sender } = react$1.useUser(!isSelf ? message.
|
|
1117
|
-
const senderFallbackName = message.
|
|
1118
|
+
const { profile: sender } = react$1.useUser(!isSelf ? message.sender_external_id : null);
|
|
1119
|
+
const senderFallbackName = message.sender_external_id ?? "Unknown";
|
|
1118
1120
|
const senderName = sender?.displayName ?? senderFallbackName;
|
|
1119
|
-
const
|
|
1121
|
+
const senderColorKey = message.sender_external_id ?? message.sender_id ?? "";
|
|
1122
|
+
const senderColorHex = senderColorKey ? userColor(senderColorKey) : "currentColor";
|
|
1120
1123
|
const renderSenderName = showSenderName && !isSelf && (groupPosition === "first" || groupPosition === "standalone");
|
|
1121
1124
|
const rawBody = message.body ?? "";
|
|
1122
1125
|
const TRIM_BUFFER = 40;
|
|
@@ -1265,7 +1268,7 @@ function QuotedCard({
|
|
|
1265
1268
|
labelFor,
|
|
1266
1269
|
onClick
|
|
1267
1270
|
}) {
|
|
1268
|
-
const senderLabel = quoted.
|
|
1271
|
+
const senderLabel = quoted.sender_external_id ? labelFor?.(quoted.sender_external_id) ?? quoted.sender_external_id : "Unknown";
|
|
1269
1272
|
const isDeleted = !!quoted.deleted_at;
|
|
1270
1273
|
const handleClick = onClick ? () => onClick(quoted.id) : void 0;
|
|
1271
1274
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1934,7 +1937,10 @@ function TypingIndicator({ typing, labelFor }) {
|
|
|
1934
1937
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "poolse-typing__label", role: "status", "aria-live": "polite", "aria-atomic": "true", children: isTyping ? /* @__PURE__ */ jsxRuntime.jsx(TypingLabel, { ids, ...labelFor ? { labelFor } : {} }) : "" })
|
|
1935
1938
|
] });
|
|
1936
1939
|
}
|
|
1937
|
-
function TypingLabel({
|
|
1940
|
+
function TypingLabel({
|
|
1941
|
+
ids,
|
|
1942
|
+
labelFor
|
|
1943
|
+
}) {
|
|
1938
1944
|
const id1 = ids[0] ?? null;
|
|
1939
1945
|
const id2 = ids[1] ?? null;
|
|
1940
1946
|
const name1 = useDisplayName(id1, labelFor);
|
|
@@ -2232,6 +2238,7 @@ function ConversationView({
|
|
|
2232
2238
|
quoted_message: {
|
|
2233
2239
|
id: original.id,
|
|
2234
2240
|
sender_id: original.sender_id,
|
|
2241
|
+
sender_external_id: original.sender_external_id,
|
|
2235
2242
|
body: original.body,
|
|
2236
2243
|
deleted_at: original.deleted_at,
|
|
2237
2244
|
inserted_at: original.inserted_at
|
|
@@ -2405,14 +2412,16 @@ function MemberList({
|
|
|
2405
2412
|
conversationId,
|
|
2406
2413
|
labelFor,
|
|
2407
2414
|
avatarFor,
|
|
2408
|
-
|
|
2415
|
+
onlineExternalIds,
|
|
2409
2416
|
canRemove,
|
|
2410
2417
|
renderItem,
|
|
2411
2418
|
emptyState
|
|
2412
2419
|
}) {
|
|
2413
2420
|
const { members, loading, error, removeMember } = react$1.useMembers(conversationId);
|
|
2414
|
-
const { online: presenceOnline } = react$1.usePresence(
|
|
2415
|
-
|
|
2421
|
+
const { online: presenceOnline } = react$1.usePresence(
|
|
2422
|
+
onlineExternalIds === void 0 ? conversationId : ""
|
|
2423
|
+
);
|
|
2424
|
+
const effectiveOnline = onlineExternalIds ?? presenceOnline;
|
|
2416
2425
|
if (loading && members.length === 0) {
|
|
2417
2426
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-list poolse-list--placeholder", children: "Loading members\u2026" });
|
|
2418
2427
|
}
|
|
@@ -2430,11 +2439,11 @@ function MemberList({
|
|
|
2430
2439
|
DefaultMemberRow,
|
|
2431
2440
|
{
|
|
2432
2441
|
membership: m,
|
|
2433
|
-
avatarUrl: avatarFor?.(m.
|
|
2434
|
-
online: effectiveOnline.has(m.
|
|
2442
|
+
avatarUrl: avatarFor?.(m.external_id) ?? null,
|
|
2443
|
+
online: effectiveOnline.has(m.external_id),
|
|
2435
2444
|
removable: canRemove?.(m) ?? false,
|
|
2436
2445
|
onRemove: () => {
|
|
2437
|
-
void removeMember(m.
|
|
2446
|
+
void removeMember(m.external_id);
|
|
2438
2447
|
},
|
|
2439
2448
|
...labelFor ? { labelFor } : {}
|
|
2440
2449
|
}
|
|
@@ -2450,7 +2459,7 @@ function DefaultMemberRow({
|
|
|
2450
2459
|
onRemove,
|
|
2451
2460
|
labelFor
|
|
2452
2461
|
}) {
|
|
2453
|
-
const name = useDisplayName(membership.
|
|
2462
|
+
const name = useDisplayName(membership.external_id, labelFor);
|
|
2454
2463
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row", children: [
|
|
2455
2464
|
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name, online, size: "md" }),
|
|
2456
2465
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-member-row__body", children: [
|