@poolse/react-ui 3.2.0-dev.5 → 3.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/CHANGELOG.md +28 -0
- package/README.md +10 -1
- package/dist/index.cjs +107 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -90
- package/dist/index.d.ts +129 -90
- package/dist/index.js +107 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +27 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,34 @@ 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
|
+
## [3.3.0] - 2026-11-20
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `ConversationView` props: `focusMessageId` (load older pages until the
|
|
12
|
+
message is there, scroll to it and flash it) with `onFocusMessageNotFound`;
|
|
13
|
+
`onSenderPress(user)` and `onAvatarPress(user)` (`MessageUser`, exported);
|
|
14
|
+
`composer={false}` / `readOnly` hide the composer (and quote-reply and
|
|
15
|
+
file dropping with it).
|
|
16
|
+
- `MessageRow` `onSenderPress` / `onAvatarPress`, `MessageBubble`
|
|
17
|
+
`onSenderPress`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- After `ConversationView` marks a conversation read, its badge clears in
|
|
22
|
+
every `ConversationList` under the same provider (shared state in
|
|
23
|
+
`@poolse/react`), not just through `onMarkedRead`.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- `MessageRow` resolved the avatar's profile by the poolse user id instead of
|
|
28
|
+
your user id (`external_id`), so avatars next to group messages fell back to
|
|
29
|
+
initials.
|
|
30
|
+
|
|
31
|
+
## [3.2.0] — 2026-11-17
|
|
32
|
+
|
|
33
|
+
Stable release of everything in the 3.2.0 prereleases below (streaming agent replies, screen sharing, full screen, the redesigned call screen, screen sharing from iOS).
|
|
34
|
+
|
|
7
35
|
## [3.2.0-dev.5] — 2026-11-17 (prerelease, npm tag `dev`)
|
|
8
36
|
|
|
9
37
|
No changes; released with the other packages.
|
package/README.md
CHANGED
|
@@ -46,7 +46,16 @@ export function Chat({ conversationId }: { conversationId: string }) {
|
|
|
46
46
|
`labelFor`, `renderMessage`, `emptyState`, `loadFonts`, `maxBodyLength`
|
|
47
47
|
(200), `groupingWindowMs` (300000), `senderLabels` and `avatars`
|
|
48
48
|
(`'auto' | 'always' | 'never'`), `onMarkedRead`, `onCallBack`,
|
|
49
|
-
`onJoinCall`, `currentCallId
|
|
49
|
+
`onJoinCall`, `currentCallId`, `focusMessageId` and
|
|
50
|
+
`onFocusMessageNotFound`, `onSenderPress` and `onAvatarPress` (receive a
|
|
51
|
+
`MessageUser`: `{ userId, externalId, displayName, avatarUrl }`), and
|
|
52
|
+
`composer={false}` (or `readOnly`) to hide the composer.
|
|
53
|
+
|
|
54
|
+
The view marks the latest message read while it's in view; once the server
|
|
55
|
+
accepts, every `ConversationList` / `useConversations()` under the same
|
|
56
|
+
provider drops that conversation's badge. `focusMessageId` loads older pages
|
|
57
|
+
until the message is there, scrolls to it and flashes it; a message it can't
|
|
58
|
+
find shows a short notice and calls `onFocusMessageNotFound`.
|
|
50
59
|
|
|
51
60
|
## Components
|
|
52
61
|
|
package/dist/index.cjs
CHANGED
|
@@ -1642,6 +1642,7 @@ function MessageBubble({
|
|
|
1642
1642
|
maxBodyLength = 0,
|
|
1643
1643
|
markdown = false,
|
|
1644
1644
|
showSenderName = false,
|
|
1645
|
+
onSenderPress,
|
|
1645
1646
|
actionsTrigger,
|
|
1646
1647
|
showAttachments = true
|
|
1647
1648
|
}) {
|
|
@@ -1685,7 +1686,16 @@ function MessageBubble({
|
|
|
1685
1686
|
const showQuoteCard = message.quoted_message !== void 0 && message.quoted_message !== null ? "full" : message.quoted_message_id ? "placeholder" : null;
|
|
1686
1687
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, children: [
|
|
1687
1688
|
actionsTrigger,
|
|
1688
|
-
renderSenderName && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1689
|
+
renderSenderName && (onSenderPress ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1690
|
+
"button",
|
|
1691
|
+
{
|
|
1692
|
+
type: "button",
|
|
1693
|
+
className: "poolse-message__sender poolse-message__sender--button",
|
|
1694
|
+
style: { color: senderColorHex },
|
|
1695
|
+
onClick: onSenderPress,
|
|
1696
|
+
children: senderName
|
|
1697
|
+
}
|
|
1698
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-message__sender", style: { color: senderColorHex }, children: senderName })),
|
|
1689
1699
|
showQuoteCard === "full" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1690
1700
|
QuotedCard,
|
|
1691
1701
|
{
|
|
@@ -2142,12 +2152,20 @@ function BubbleMessageRow({
|
|
|
2142
2152
|
maxBodyLength = 0,
|
|
2143
2153
|
markdown = false,
|
|
2144
2154
|
showSenderName = false,
|
|
2145
|
-
showAvatar = false
|
|
2155
|
+
showAvatar = false,
|
|
2156
|
+
onSenderPress,
|
|
2157
|
+
onAvatarPress
|
|
2146
2158
|
}) {
|
|
2147
|
-
const { profile: senderProfile } = react$1.useUser(msg.
|
|
2148
|
-
const senderFallbackName = msg.sender_id ? `User ${msg.sender_id.slice(0, 6)}` : "Unknown";
|
|
2159
|
+
const { profile: senderProfile } = react$1.useUser(msg.sender_external_id);
|
|
2160
|
+
const senderFallbackName = msg.sender_external_id ?? (msg.sender_id ? `User ${msg.sender_id.slice(0, 6)}` : "Unknown");
|
|
2149
2161
|
const senderName = senderProfile?.displayName ?? senderFallbackName;
|
|
2150
2162
|
const isSelf = meId !== null && msg.sender_id === meId;
|
|
2163
|
+
const sender = {
|
|
2164
|
+
userId: msg.sender_id,
|
|
2165
|
+
externalId: msg.sender_external_id,
|
|
2166
|
+
displayName: senderName,
|
|
2167
|
+
avatarUrl: senderProfile?.avatarUrl ?? null
|
|
2168
|
+
};
|
|
2151
2169
|
const reactionsHook = react$1.useReactions(reactions ? msg.id : "", {
|
|
2152
2170
|
conversationId: msg.conversation_id,
|
|
2153
2171
|
initialReactions: msg.reactions,
|
|
@@ -2214,6 +2232,7 @@ function BubbleMessageRow({
|
|
|
2214
2232
|
groupPosition,
|
|
2215
2233
|
senderName,
|
|
2216
2234
|
avatarUrl: senderProfile?.avatarUrl ?? null,
|
|
2235
|
+
...onAvatarPress ? { onAvatarPress: () => onAvatarPress(sender) } : {},
|
|
2217
2236
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2218
2237
|
MessageBubble,
|
|
2219
2238
|
{
|
|
@@ -2223,6 +2242,7 @@ function BubbleMessageRow({
|
|
|
2223
2242
|
maxBodyLength,
|
|
2224
2243
|
markdown,
|
|
2225
2244
|
showSenderName,
|
|
2245
|
+
...onSenderPress ? { onSenderPress: () => onSenderPress(sender) } : {},
|
|
2226
2246
|
showAttachments: attachments,
|
|
2227
2247
|
...readState ? { readState } : {},
|
|
2228
2248
|
...labelFor ? { labelFor } : {},
|
|
@@ -2338,12 +2358,22 @@ function BubbleWithAvatar({
|
|
|
2338
2358
|
groupPosition,
|
|
2339
2359
|
senderName,
|
|
2340
2360
|
avatarUrl,
|
|
2361
|
+
onAvatarPress,
|
|
2341
2362
|
children
|
|
2342
2363
|
}) {
|
|
2343
2364
|
if (isSelf || !showAvatar) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2344
2365
|
const isLastOfCluster = groupPosition === "last" || groupPosition === "standalone";
|
|
2345
2366
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-bubble-shell", children: [
|
|
2346
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-bubble-shell__avatar", children: isLastOfCluster ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2367
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-bubble-shell__avatar", children: !isLastOfCluster ? null : onAvatarPress ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2368
|
+
"button",
|
|
2369
|
+
{
|
|
2370
|
+
type: "button",
|
|
2371
|
+
className: "poolse-bubble-shell__avatar-button",
|
|
2372
|
+
"aria-label": senderName,
|
|
2373
|
+
onClick: onAvatarPress,
|
|
2374
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: senderName, size: "sm" })
|
|
2375
|
+
}
|
|
2376
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, name: senderName, size: "sm" }) }),
|
|
2347
2377
|
children
|
|
2348
2378
|
] });
|
|
2349
2379
|
}
|
|
@@ -2555,11 +2585,20 @@ function ConversationView({
|
|
|
2555
2585
|
senderLabels = "auto",
|
|
2556
2586
|
avatars = "auto",
|
|
2557
2587
|
onMarkedRead,
|
|
2588
|
+
focusMessageId = null,
|
|
2589
|
+
onFocusMessageNotFound,
|
|
2590
|
+
onSenderPress,
|
|
2591
|
+
onAvatarPress,
|
|
2592
|
+
composer = TRUE,
|
|
2593
|
+
readOnly = false,
|
|
2558
2594
|
onCallBack,
|
|
2559
2595
|
onJoinCall,
|
|
2560
2596
|
currentCallId = null
|
|
2561
2597
|
}) {
|
|
2562
2598
|
usePoolseFonts(loadFonts);
|
|
2599
|
+
const showComposer = composer && !readOnly;
|
|
2600
|
+
const canQuote = quotations && showComposer;
|
|
2601
|
+
const canDrop = attachments && showComposer;
|
|
2563
2602
|
const { me } = react$1.useMe();
|
|
2564
2603
|
const {
|
|
2565
2604
|
messages,
|
|
@@ -2567,6 +2606,7 @@ function ConversationView({
|
|
|
2567
2606
|
error,
|
|
2568
2607
|
hasMore,
|
|
2569
2608
|
loadMore,
|
|
2609
|
+
loadUntil,
|
|
2570
2610
|
send,
|
|
2571
2611
|
edit,
|
|
2572
2612
|
delete: deleteMsg,
|
|
@@ -2680,6 +2720,49 @@ function ConversationView({
|
|
|
2680
2720
|
() => messages.filter((m) => react$1.isMessageVisibleTo(m, meIdForFeed)),
|
|
2681
2721
|
[messages, meIdForFeed]
|
|
2682
2722
|
);
|
|
2723
|
+
const [pendingFocusId, setPendingFocusId] = react.useState(null);
|
|
2724
|
+
const [focusMissing, setFocusMissing] = react.useState(false);
|
|
2725
|
+
const onFocusNotFoundRef = react.useRef(onFocusMessageNotFound);
|
|
2726
|
+
onFocusNotFoundRef.current = onFocusMessageNotFound;
|
|
2727
|
+
const conversationIdRef = react.useRef(conversationId);
|
|
2728
|
+
conversationIdRef.current = conversationId;
|
|
2729
|
+
const focusMiss = react.useCallback((id) => {
|
|
2730
|
+
setFocusMissing(true);
|
|
2731
|
+
onFocusNotFoundRef.current?.(id);
|
|
2732
|
+
}, []);
|
|
2733
|
+
react.useEffect(() => {
|
|
2734
|
+
setPendingFocusId(null);
|
|
2735
|
+
setFocusMissing(false);
|
|
2736
|
+
if (!focusMessageId || loading) return;
|
|
2737
|
+
const forConversation = conversationId;
|
|
2738
|
+
let current = true;
|
|
2739
|
+
loadUntil(focusMessageId).then((found) => {
|
|
2740
|
+
if (!current || conversationIdRef.current !== forConversation) return;
|
|
2741
|
+
if (found) setPendingFocusId(focusMessageId);
|
|
2742
|
+
else focusMiss(focusMessageId);
|
|
2743
|
+
}).catch(() => {
|
|
2744
|
+
if (current) focusMiss(focusMessageId);
|
|
2745
|
+
});
|
|
2746
|
+
return () => {
|
|
2747
|
+
current = false;
|
|
2748
|
+
};
|
|
2749
|
+
}, [focusMessageId, conversationId, loading, loadUntil, focusMiss]);
|
|
2750
|
+
react.useEffect(() => {
|
|
2751
|
+
if (!pendingFocusId) return;
|
|
2752
|
+
const root = listRef.current;
|
|
2753
|
+
const el = root?.querySelector(`[data-message-id="${pendingFocusId}"]`);
|
|
2754
|
+
setPendingFocusId(null);
|
|
2755
|
+
if (!(el instanceof HTMLElement)) {
|
|
2756
|
+
focusMiss(pendingFocusId);
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2759
|
+
highlightRow(el);
|
|
2760
|
+
}, [pendingFocusId, visibleMessages, focusMiss]);
|
|
2761
|
+
react.useEffect(() => {
|
|
2762
|
+
if (!focusMissing) return;
|
|
2763
|
+
const t = setTimeout(() => setFocusMissing(false), 4e3);
|
|
2764
|
+
return () => clearTimeout(t);
|
|
2765
|
+
}, [focusMissing]);
|
|
2683
2766
|
const receiptsVisible = react$1.receiptsOf(me).visible;
|
|
2684
2767
|
const showReadState = readReceipts && receiptsVisible;
|
|
2685
2768
|
const maxReadByOthers = react.useMemo(() => {
|
|
@@ -2716,33 +2799,31 @@ function ConversationView({
|
|
|
2716
2799
|
if (!root) return;
|
|
2717
2800
|
const el = root.querySelector(`[data-message-id="${id}"]`);
|
|
2718
2801
|
if (!(el instanceof HTMLElement)) return;
|
|
2719
|
-
el
|
|
2720
|
-
el.classList.add("poolse-message-row--highlight");
|
|
2721
|
-
setTimeout(() => el.classList.remove("poolse-message-row--highlight"), 1600);
|
|
2802
|
+
highlightRow(el);
|
|
2722
2803
|
};
|
|
2723
2804
|
const composerRef = react.useRef(null);
|
|
2724
2805
|
const [dragActive, setDragActive] = react.useState(false);
|
|
2725
2806
|
const dragDepthRef = react.useRef(0);
|
|
2726
2807
|
const isFileDrag = (e) => Array.from(e.dataTransfer?.types ?? []).includes("Files");
|
|
2727
2808
|
const onDragEnter = (e) => {
|
|
2728
|
-
if (!
|
|
2809
|
+
if (!canDrop || !isFileDrag(e)) return;
|
|
2729
2810
|
e.preventDefault();
|
|
2730
2811
|
dragDepthRef.current += 1;
|
|
2731
2812
|
setDragActive(true);
|
|
2732
2813
|
};
|
|
2733
2814
|
const onDragOver = (e) => {
|
|
2734
|
-
if (!
|
|
2815
|
+
if (!canDrop || !isFileDrag(e)) return;
|
|
2735
2816
|
e.preventDefault();
|
|
2736
2817
|
if (e.dataTransfer) e.dataTransfer.dropEffect = "copy";
|
|
2737
2818
|
};
|
|
2738
2819
|
const onDragLeave = (e) => {
|
|
2739
|
-
if (!
|
|
2820
|
+
if (!canDrop || !isFileDrag(e)) return;
|
|
2740
2821
|
e.preventDefault();
|
|
2741
2822
|
dragDepthRef.current = Math.max(0, dragDepthRef.current - 1);
|
|
2742
2823
|
if (dragDepthRef.current === 0) setDragActive(false);
|
|
2743
2824
|
};
|
|
2744
2825
|
const onDrop = (e) => {
|
|
2745
|
-
if (!
|
|
2826
|
+
if (!canDrop || !isFileDrag(e)) return;
|
|
2746
2827
|
e.preventDefault();
|
|
2747
2828
|
dragDepthRef.current = 0;
|
|
2748
2829
|
setDragActive(false);
|
|
@@ -2770,7 +2851,7 @@ function ConversationView({
|
|
|
2770
2851
|
onTyping: signalTyping,
|
|
2771
2852
|
attachments,
|
|
2772
2853
|
...labelFor ? { labelFor } : {},
|
|
2773
|
-
...
|
|
2854
|
+
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
2774
2855
|
}
|
|
2775
2856
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2776
2857
|
MessageComposer,
|
|
@@ -2780,7 +2861,7 @@ function ConversationView({
|
|
|
2780
2861
|
onTyping: signalTyping,
|
|
2781
2862
|
attachments,
|
|
2782
2863
|
...labelFor ? { labelFor } : {},
|
|
2783
|
-
...
|
|
2864
|
+
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
2784
2865
|
}
|
|
2785
2866
|
);
|
|
2786
2867
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation-shell", children: [
|
|
@@ -2816,6 +2897,7 @@ function ConversationView({
|
|
|
2816
2897
|
]
|
|
2817
2898
|
}
|
|
2818
2899
|
),
|
|
2900
|
+
focusMissing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__status", role: "status", "aria-live": "polite", children: "That message isn't available." }),
|
|
2819
2901
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2820
2902
|
"div",
|
|
2821
2903
|
{
|
|
@@ -2863,12 +2945,14 @@ function ConversationView({
|
|
|
2863
2945
|
attachments,
|
|
2864
2946
|
actions,
|
|
2865
2947
|
threads,
|
|
2866
|
-
quotations,
|
|
2948
|
+
quotations: canQuote,
|
|
2867
2949
|
groupPosition,
|
|
2868
2950
|
maxBodyLength,
|
|
2869
2951
|
markdown,
|
|
2870
2952
|
showSenderName: showSenderLabelsResolved,
|
|
2871
2953
|
showAvatar: showAvatarsResolved,
|
|
2954
|
+
...onSenderPress ? { onSenderPress } : {},
|
|
2955
|
+
...onAvatarPress ? { onAvatarPress } : {},
|
|
2872
2956
|
...readState ? { readState } : {},
|
|
2873
2957
|
...labelFor ? { labelFor } : {},
|
|
2874
2958
|
editing: editingId === msg.id,
|
|
@@ -2933,7 +3017,7 @@ function ConversationView({
|
|
|
2933
3017
|
}
|
|
2934
3018
|
),
|
|
2935
3019
|
/* @__PURE__ */ jsxRuntime.jsx(TypingIndicator, { typing, ...labelFor ? { labelFor } : {} }),
|
|
2936
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__composer-row", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__composer-flex", children: Composer }) }),
|
|
3020
|
+
showComposer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__composer-row", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__composer-flex", children: Composer }) }),
|
|
2937
3021
|
dragActive && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__drop-overlay", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "poolse-conversation__drop-overlay-inner", children: [
|
|
2938
3022
|
/* @__PURE__ */ jsxRuntime.jsx(PoolseIcon, { name: "attachment", size: 40, label: null }),
|
|
2939
3023
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "poolse-conversation__drop-overlay-title", children: "Drop files to upload" }),
|
|
@@ -2952,6 +3036,13 @@ function ConversationView({
|
|
|
2952
3036
|
) })
|
|
2953
3037
|
] });
|
|
2954
3038
|
}
|
|
3039
|
+
function highlightRow(el) {
|
|
3040
|
+
if (typeof el.scrollIntoView === "function") {
|
|
3041
|
+
el.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
3042
|
+
}
|
|
3043
|
+
el.classList.add("poolse-message-row--highlight");
|
|
3044
|
+
setTimeout(() => el.classList.remove("poolse-message-row--highlight"), 1600);
|
|
3045
|
+
}
|
|
2955
3046
|
function JoinBanner({
|
|
2956
3047
|
conversationId,
|
|
2957
3048
|
meId,
|