@poolse/react-ui 2.20.0 → 2.22.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/index.cjs +126 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +126 -9
- package/dist/index.js.map +1 -1
- package/dist/styles.css +120 -0
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
2
|
+
import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, SVGProps, ReactElement } from 'react';
|
|
5
5
|
import { UploadItem, ReactionMap } from '@poolse/react';
|
|
@@ -440,8 +440,22 @@ interface ConversationViewProps {
|
|
|
440
440
|
* a single handler can switch between rooms.
|
|
441
441
|
*/
|
|
442
442
|
onMarkedRead?: (conversationId: string) => void;
|
|
443
|
+
/**
|
|
444
|
+
* Offer "Call back" on call-log rows the viewer missed or declined,
|
|
445
|
+
* or placed with no answer. Receives the call's media; place the call
|
|
446
|
+
* on this conversation.
|
|
447
|
+
*/
|
|
448
|
+
onCallBack?: (media: 'audio' | 'video') => void;
|
|
449
|
+
/**
|
|
450
|
+
* Show a "Call in progress · Join" banner while a call runs on this
|
|
451
|
+
* conversation that the viewer is not on. Called with the live call
|
|
452
|
+
* when they click Join.
|
|
453
|
+
*/
|
|
454
|
+
onJoinCall?: (call: LiveCall) => void;
|
|
455
|
+
/** The call this client is already on, if any — its banner is hidden. */
|
|
456
|
+
currentCallId?: string | null;
|
|
443
457
|
}
|
|
444
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
445
459
|
|
|
446
460
|
interface ChatHeaderProps {
|
|
447
461
|
/** Conversation id — used to fetch the row + members for the title / presence dot. */
|
|
@@ -627,6 +641,29 @@ interface MessageBubbleProps {
|
|
|
627
641
|
*/
|
|
628
642
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
629
643
|
|
|
644
|
+
interface CallLogRowProps {
|
|
645
|
+
/** The call-log message. Rows that aren't call logs render nothing. */
|
|
646
|
+
msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & {
|
|
647
|
+
deleted_at?: string | null;
|
|
648
|
+
};
|
|
649
|
+
/** Current user's id — decides how the call is worded for them. */
|
|
650
|
+
meId: string | null;
|
|
651
|
+
/**
|
|
652
|
+
* Offer "Call back" on calls the viewer missed or declined, or placed
|
|
653
|
+
* with no answer. Receives the call's media. Omit to show no action.
|
|
654
|
+
*/
|
|
655
|
+
onCallBack?: (media: 'audio' | 'video') => void;
|
|
656
|
+
}
|
|
657
|
+
declare function CallLogRow({ msg, meId, onCallBack }: CallLogRowProps): react_jsx_runtime.JSX.Element | null;
|
|
658
|
+
|
|
659
|
+
interface LiveCallBannerProps {
|
|
660
|
+
call: LiveCall;
|
|
661
|
+
/** How many people are in the room right now. */
|
|
662
|
+
inCall: number;
|
|
663
|
+
onJoin: (call: LiveCall) => void;
|
|
664
|
+
}
|
|
665
|
+
declare function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps): react_jsx_runtime.JSX.Element;
|
|
666
|
+
|
|
630
667
|
interface EditableMessageBubbleProps {
|
|
631
668
|
message: Message;
|
|
632
669
|
currentUserId: string | null;
|
|
@@ -974,4 +1011,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
974
1011
|
*/
|
|
975
1012
|
declare function PoolseFonts(): null;
|
|
976
1013
|
|
|
977
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
|
|
1014
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
2
|
+
import { CallParticipant, CallMedia, LiveKitModule, CallDevice, CallDeviceKind, Uuid, Message, LiveCall, Conversation, Membership, Attachment, MessageCreateRequest } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, SVGProps, ReactElement } from 'react';
|
|
5
5
|
import { UploadItem, ReactionMap } from '@poolse/react';
|
|
@@ -440,8 +440,22 @@ interface ConversationViewProps {
|
|
|
440
440
|
* a single handler can switch between rooms.
|
|
441
441
|
*/
|
|
442
442
|
onMarkedRead?: (conversationId: string) => void;
|
|
443
|
+
/**
|
|
444
|
+
* Offer "Call back" on call-log rows the viewer missed or declined,
|
|
445
|
+
* or placed with no answer. Receives the call's media; place the call
|
|
446
|
+
* on this conversation.
|
|
447
|
+
*/
|
|
448
|
+
onCallBack?: (media: 'audio' | 'video') => void;
|
|
449
|
+
/**
|
|
450
|
+
* Show a "Call in progress · Join" banner while a call runs on this
|
|
451
|
+
* conversation that the viewer is not on. Called with the live call
|
|
452
|
+
* when they click Join.
|
|
453
|
+
*/
|
|
454
|
+
onJoinCall?: (call: LiveCall) => void;
|
|
455
|
+
/** The call this client is already on, if any — its banner is hidden. */
|
|
456
|
+
currentCallId?: string | null;
|
|
443
457
|
}
|
|
444
|
-
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
458
|
+
declare function ConversationView({ conversationId, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, actions, threads, quotations, readReceipts, markdown, maxBodyLength, grouping, groupingWindowMs, daySeparators, senderLabels, avatars, onMarkedRead, onCallBack, onJoinCall, currentCallId, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
445
459
|
|
|
446
460
|
interface ChatHeaderProps {
|
|
447
461
|
/** Conversation id — used to fetch the row + members for the title / presence dot. */
|
|
@@ -627,6 +641,29 @@ interface MessageBubbleProps {
|
|
|
627
641
|
*/
|
|
628
642
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
629
643
|
|
|
644
|
+
interface CallLogRowProps {
|
|
645
|
+
/** The call-log message. Rows that aren't call logs render nothing. */
|
|
646
|
+
msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & {
|
|
647
|
+
deleted_at?: string | null;
|
|
648
|
+
};
|
|
649
|
+
/** Current user's id — decides how the call is worded for them. */
|
|
650
|
+
meId: string | null;
|
|
651
|
+
/**
|
|
652
|
+
* Offer "Call back" on calls the viewer missed or declined, or placed
|
|
653
|
+
* with no answer. Receives the call's media. Omit to show no action.
|
|
654
|
+
*/
|
|
655
|
+
onCallBack?: (media: 'audio' | 'video') => void;
|
|
656
|
+
}
|
|
657
|
+
declare function CallLogRow({ msg, meId, onCallBack }: CallLogRowProps): react_jsx_runtime.JSX.Element | null;
|
|
658
|
+
|
|
659
|
+
interface LiveCallBannerProps {
|
|
660
|
+
call: LiveCall;
|
|
661
|
+
/** How many people are in the room right now. */
|
|
662
|
+
inCall: number;
|
|
663
|
+
onJoin: (call: LiveCall) => void;
|
|
664
|
+
}
|
|
665
|
+
declare function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps): react_jsx_runtime.JSX.Element;
|
|
666
|
+
|
|
630
667
|
interface EditableMessageBubbleProps {
|
|
631
668
|
message: Message;
|
|
632
669
|
currentUserId: string | null;
|
|
@@ -974,4 +1011,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
974
1011
|
*/
|
|
975
1012
|
declare function PoolseFonts(): null;
|
|
976
1013
|
|
|
977
|
-
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
|
|
1014
|
+
export { AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, type CallInvite, CallLogRow, type CallLogRowProps, CallProvider, type CallProviderProps, CallVideoGrid, type CallVideoGridProps, ChatHeader, type ChatHeaderProps, ConversationList, type ConversationListProps, ConversationView, type ConversationViewProps, EditableMessageBubble, type EditableMessageBubbleProps, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, type InboxUser, LiveCallBanner, type LiveCallBannerProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageBubble, type MessageBubbleProps, MessageComposer, type MessageComposerProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, ReactionPicker, ReactionStrip, type ReactionStripProps, ThreadView, type ThreadViewProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, useCallInvite, useDisplayName, usePoolseFonts };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { createContext, forwardRef, useState, useRef, useCallback, useImperativeHandle, useEffect, useMemo, Fragment as Fragment$1, useContext } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, computeGroupPosition, sameDay, formatDayLabel,
|
|
4
|
+
import { useMembers, useAttachmentUpload, useMe, useConversations, useUser, useConversation, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, sameDay, formatDayLabel, formatCallLogPreview, useLiveCall, callLogDisplayFor, useThread, useReactions, useAttachmentUrl, useCalls, useCallRoom, useVoiceRoom } from '@poolse/react';
|
|
5
5
|
import ReactMarkdown from 'react-markdown';
|
|
6
6
|
import remarkGfm from 'remark-gfm';
|
|
7
7
|
|
|
@@ -843,6 +843,26 @@ function PoolseFonts() {
|
|
|
843
843
|
usePoolseFonts(true);
|
|
844
844
|
return null;
|
|
845
845
|
}
|
|
846
|
+
function LiveCallBanner({ call, inCall, onJoin }) {
|
|
847
|
+
const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
|
|
848
|
+
const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
|
|
849
|
+
return /* @__PURE__ */ jsxs("div", { className: "poolse-live-call", role: "status", "aria-label": `${what}, ${who}`, children: [
|
|
850
|
+
/* @__PURE__ */ jsx(
|
|
851
|
+
PoolseIcon,
|
|
852
|
+
{
|
|
853
|
+
name: call.media === "video" ? "video" : "phone",
|
|
854
|
+
size: 16,
|
|
855
|
+
label: null,
|
|
856
|
+
className: "poolse-live-call__icon"
|
|
857
|
+
}
|
|
858
|
+
),
|
|
859
|
+
/* @__PURE__ */ jsxs("span", { className: "poolse-live-call__text", children: [
|
|
860
|
+
/* @__PURE__ */ jsx("span", { className: "poolse-live-call__title", children: what }),
|
|
861
|
+
/* @__PURE__ */ jsx("span", { className: "poolse-live-call__meta", children: who })
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "poolse-live-call__join", onClick: () => onJoin(call), children: "Join" })
|
|
864
|
+
] });
|
|
865
|
+
}
|
|
846
866
|
|
|
847
867
|
// src/listAutocomplete.ts
|
|
848
868
|
var UNORDERED_RE = /^(\s*)([-*+]) (.*)$/;
|
|
@@ -1469,6 +1489,57 @@ function computeInitials(name) {
|
|
|
1469
1489
|
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1470
1490
|
return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
|
|
1471
1491
|
}
|
|
1492
|
+
function CallLogRow({ msg, meId, onCallBack }) {
|
|
1493
|
+
const display = callLogDisplayFor(msg, meId);
|
|
1494
|
+
if (!display) return null;
|
|
1495
|
+
return /* @__PURE__ */ jsx(
|
|
1496
|
+
CallLogLine,
|
|
1497
|
+
{
|
|
1498
|
+
display,
|
|
1499
|
+
insertedAt: msg.inserted_at,
|
|
1500
|
+
...onCallBack ? { onCallBack } : {}
|
|
1501
|
+
}
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
function CallLogLine({
|
|
1505
|
+
display,
|
|
1506
|
+
insertedAt,
|
|
1507
|
+
onCallBack
|
|
1508
|
+
}) {
|
|
1509
|
+
const time = formatTime(insertedAt);
|
|
1510
|
+
const icon = display.media === "video" ? "video" : "phone";
|
|
1511
|
+
const label = [display.title, display.detail, time].filter(Boolean).join(", ");
|
|
1512
|
+
return /* @__PURE__ */ jsxs(
|
|
1513
|
+
"div",
|
|
1514
|
+
{
|
|
1515
|
+
className: `poolse-call-log${display.missed ? " poolse-call-log--missed" : ""}`,
|
|
1516
|
+
role: "note",
|
|
1517
|
+
"aria-label": label,
|
|
1518
|
+
children: [
|
|
1519
|
+
/* @__PURE__ */ jsxs("span", { className: "poolse-call-log__chip", children: [
|
|
1520
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 13, label: null, className: "poolse-call-log__icon" }),
|
|
1521
|
+
/* @__PURE__ */ jsx("span", { className: "poolse-call-log__title", children: display.title }),
|
|
1522
|
+
display.detail && /* @__PURE__ */ jsx("span", { className: "poolse-call-log__detail", children: display.detail }),
|
|
1523
|
+
time && /* @__PURE__ */ jsx("span", { className: "poolse-call-log__time", children: time })
|
|
1524
|
+
] }),
|
|
1525
|
+
display.callBack && onCallBack && /* @__PURE__ */ jsx(
|
|
1526
|
+
"button",
|
|
1527
|
+
{
|
|
1528
|
+
type: "button",
|
|
1529
|
+
className: "poolse-call-log__call-back",
|
|
1530
|
+
onClick: () => onCallBack(display.media),
|
|
1531
|
+
children: "Call back"
|
|
1532
|
+
}
|
|
1533
|
+
)
|
|
1534
|
+
]
|
|
1535
|
+
}
|
|
1536
|
+
);
|
|
1537
|
+
}
|
|
1538
|
+
function formatTime(iso) {
|
|
1539
|
+
const d = new Date(iso);
|
|
1540
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
1541
|
+
return d.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
1542
|
+
}
|
|
1472
1543
|
function AttachmentPreview({ attachment, onClick }) {
|
|
1473
1544
|
const isFullRow = "content_type" in attachment;
|
|
1474
1545
|
const { url, loading, error } = useAttachmentUrl(attachment.id);
|
|
@@ -2127,7 +2198,21 @@ function ActionButton({
|
|
|
2127
2198
|
].filter(Boolean).join(" ");
|
|
2128
2199
|
return /* @__PURE__ */ jsx("button", { type: "button", className: classes, "aria-label": label, title: label, onClick, children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 16, label: null }) });
|
|
2129
2200
|
}
|
|
2130
|
-
function MessageRow({
|
|
2201
|
+
function MessageRow(props) {
|
|
2202
|
+
const callLog = callLogDisplayFor(props.msg, props.meId);
|
|
2203
|
+
if (callLog !== void 0) {
|
|
2204
|
+
return callLog ? /* @__PURE__ */ jsx(
|
|
2205
|
+
CallLogRow,
|
|
2206
|
+
{
|
|
2207
|
+
msg: props.msg,
|
|
2208
|
+
meId: props.meId,
|
|
2209
|
+
...props.onCallBack ? { onCallBack: props.onCallBack } : {}
|
|
2210
|
+
}
|
|
2211
|
+
) : null;
|
|
2212
|
+
}
|
|
2213
|
+
return /* @__PURE__ */ jsx(BubbleMessageRow, { ...props });
|
|
2214
|
+
}
|
|
2215
|
+
function BubbleMessageRow({
|
|
2131
2216
|
msg,
|
|
2132
2217
|
meId,
|
|
2133
2218
|
reactions = true,
|
|
@@ -2561,7 +2646,10 @@ function ConversationView({
|
|
|
2561
2646
|
daySeparators = TRUE,
|
|
2562
2647
|
senderLabels = "auto",
|
|
2563
2648
|
avatars = "auto",
|
|
2564
|
-
onMarkedRead
|
|
2649
|
+
onMarkedRead,
|
|
2650
|
+
onCallBack,
|
|
2651
|
+
onJoinCall,
|
|
2652
|
+
currentCallId = null
|
|
2565
2653
|
}) {
|
|
2566
2654
|
usePoolseFonts(loadFonts);
|
|
2567
2655
|
const { me } = useMe();
|
|
@@ -2664,6 +2752,11 @@ function ConversationView({
|
|
|
2664
2752
|
if (el) el.scrollTop = el.scrollHeight;
|
|
2665
2753
|
setNewCountWhileAway(0);
|
|
2666
2754
|
};
|
|
2755
|
+
const meIdForFeed = me?.id ?? null;
|
|
2756
|
+
const visibleMessages = useMemo(
|
|
2757
|
+
() => messages.filter((m) => isMessageVisibleTo(m, meIdForFeed)),
|
|
2758
|
+
[messages, meIdForFeed]
|
|
2759
|
+
);
|
|
2667
2760
|
const maxReadByOthers = useMemo(() => {
|
|
2668
2761
|
if (!readReceipts || !me) return null;
|
|
2669
2762
|
let max = 0;
|
|
@@ -2775,6 +2868,15 @@ function ConversationView({
|
|
|
2775
2868
|
onDragLeave,
|
|
2776
2869
|
onDrop,
|
|
2777
2870
|
children: [
|
|
2871
|
+
onJoinCall && /* @__PURE__ */ jsx(
|
|
2872
|
+
JoinBanner,
|
|
2873
|
+
{
|
|
2874
|
+
conversationId,
|
|
2875
|
+
meId: me?.id ?? null,
|
|
2876
|
+
currentCallId,
|
|
2877
|
+
onJoin: onJoinCall
|
|
2878
|
+
}
|
|
2879
|
+
),
|
|
2778
2880
|
status !== "connected" && status !== "idle" && /* @__PURE__ */ jsxs(
|
|
2779
2881
|
"div",
|
|
2780
2882
|
{
|
|
@@ -2800,12 +2902,12 @@ function ConversationView({
|
|
|
2800
2902
|
"aria-relevant": "additions",
|
|
2801
2903
|
children: [
|
|
2802
2904
|
hasMore && /* @__PURE__ */ jsx("div", { ref: topSentinelRef, "aria-hidden": "true", style: { height: 1 } }),
|
|
2803
|
-
loading && messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "poolse-conversation__empty", children: "Loading\u2026" }) : messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "poolse-conversation__empty", children: emptyState ?? "No messages yet." }) :
|
|
2905
|
+
loading && messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "poolse-conversation__empty", children: "Loading\u2026" }) : messages.length === 0 ? /* @__PURE__ */ jsx("div", { className: "poolse-conversation__empty", children: emptyState ?? "No messages yet." }) : visibleMessages.map((msg, idx) => {
|
|
2804
2906
|
if (renderMessage) {
|
|
2805
2907
|
return /* @__PURE__ */ jsx(Fragment$1, { children: renderMessage(msg, me?.id ?? null) }, msg.id);
|
|
2806
2908
|
}
|
|
2807
|
-
const prev = idx > 0 ?
|
|
2808
|
-
const next = idx <
|
|
2909
|
+
const prev = idx > 0 ? visibleMessages[idx - 1] ?? null : null;
|
|
2910
|
+
const next = idx < visibleMessages.length - 1 ? visibleMessages[idx + 1] ?? null : null;
|
|
2809
2911
|
const groupPosition = grouping ? computeGroupPosition(msg, prev, next, groupingWindowMs) : "standalone";
|
|
2810
2912
|
const showDaySeparator = daySeparators && (prev === null || !sameDay(msg.inserted_at, prev.inserted_at));
|
|
2811
2913
|
const enriched = quotations && msg.quoted_message_id && !msg.quoted_message ? (() => {
|
|
@@ -2854,7 +2956,8 @@ function ConversationView({
|
|
|
2854
2956
|
onDelete: () => void deleteMsg(msg.id),
|
|
2855
2957
|
onOpenThread: () => setThreadRootId(msg.id),
|
|
2856
2958
|
onQuote: () => setReplyingTo(msg),
|
|
2857
|
-
onQuotedClick: scrollToOriginal
|
|
2959
|
+
onQuotedClick: scrollToOriginal,
|
|
2960
|
+
...onCallBack ? { onCallBack } : {}
|
|
2858
2961
|
}
|
|
2859
2962
|
)
|
|
2860
2963
|
] }, msg.id);
|
|
@@ -2901,6 +3004,17 @@ function ConversationView({
|
|
|
2901
3004
|
) })
|
|
2902
3005
|
] });
|
|
2903
3006
|
}
|
|
3007
|
+
function JoinBanner({
|
|
3008
|
+
conversationId,
|
|
3009
|
+
meId,
|
|
3010
|
+
currentCallId,
|
|
3011
|
+
onJoin
|
|
3012
|
+
}) {
|
|
3013
|
+
const { call, participantIds } = useLiveCall(conversationId);
|
|
3014
|
+
if (!call || call.id === currentCallId) return null;
|
|
3015
|
+
if (meId !== null && participantIds.includes(meId)) return null;
|
|
3016
|
+
return /* @__PURE__ */ jsx(LiveCallBanner, { call, inCall: participantIds.length, onJoin });
|
|
3017
|
+
}
|
|
2904
3018
|
function ChatHeader({
|
|
2905
3019
|
conversationId,
|
|
2906
3020
|
labelFor,
|
|
@@ -2972,6 +3086,7 @@ function ConversationList({
|
|
|
2972
3086
|
const auto = useConversations();
|
|
2973
3087
|
const { me } = useMe();
|
|
2974
3088
|
const meExternalId = me?.external_id ?? null;
|
|
3089
|
+
const meId = me?.id ?? null;
|
|
2975
3090
|
const isControlled = controlledConversations !== void 0;
|
|
2976
3091
|
const conversations = isControlled ? controlledConversations : auto.conversations;
|
|
2977
3092
|
const loading = isControlled ? controlledLoading ?? false : auto.loading;
|
|
@@ -2996,6 +3111,7 @@ function ConversationList({
|
|
|
2996
3111
|
selected,
|
|
2997
3112
|
unread,
|
|
2998
3113
|
meExternalId,
|
|
3114
|
+
meId,
|
|
2999
3115
|
...labelFor ? { labelFor } : {},
|
|
3000
3116
|
...avatarFor ? { avatarFor } : {}
|
|
3001
3117
|
}
|
|
@@ -3025,6 +3141,7 @@ function DefaultRow({
|
|
|
3025
3141
|
selected: _selected,
|
|
3026
3142
|
unread,
|
|
3027
3143
|
meExternalId,
|
|
3144
|
+
meId = null,
|
|
3028
3145
|
labelFor,
|
|
3029
3146
|
avatarFor
|
|
3030
3147
|
}) {
|
|
@@ -3034,7 +3151,7 @@ function DefaultRow({
|
|
|
3034
3151
|
const avatarUrl = isDirect ? otherExtId ? avatarFor?.(otherExtId) ?? null : conv.avatar_url ?? null : conv.avatar_url ?? null;
|
|
3035
3152
|
const time = conv.last_message_at ? formatRelative(conv.last_message_at) : "";
|
|
3036
3153
|
const hasUnread = unread > 0;
|
|
3037
|
-
const preview = conv.last_message_preview ?? (conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet");
|
|
3154
|
+
const preview = formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet");
|
|
3038
3155
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3039
3156
|
/* @__PURE__ */ jsx(Avatar, { src: avatarUrl, name: title, size: "md" }),
|
|
3040
3157
|
/* @__PURE__ */ jsxs("div", { className: "poolse-list__body", children: [
|
|
@@ -3619,6 +3736,6 @@ function PoolseLogo({
|
|
|
3619
3736
|
);
|
|
3620
3737
|
}
|
|
3621
3738
|
|
|
3622
|
-
export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallProvider, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useCallInvite, useDisplayName, usePoolseFonts };
|
|
3739
|
+
export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, CallProvider, CallVideoGrid, ChatHeader, ConversationList, ConversationView, EditableMessageBubble, GroupDetailsSheet, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, PoolseFonts, PoolseIcon, PoolseInbox, PoolseLogo, ReactionPicker, ReactionStrip, ThreadView, TypingIndicator, UploadQueueStrip, UserName, UserPickerSheet, useCallInvite, useDisplayName, usePoolseFonts };
|
|
3623
3740
|
//# sourceMappingURL=index.js.map
|
|
3624
3741
|
//# sourceMappingURL=index.js.map
|