@poolse/react-ui 2.19.0 → 2.21.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 +30 -0
- package/dist/index.cjs +151 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +152 -62
- package/dist/index.js.map +1 -1
- package/dist/styles.css +184 -43
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -627,6 +627,16 @@ interface MessageBubbleProps {
|
|
|
627
627
|
*/
|
|
628
628
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
629
629
|
|
|
630
|
+
interface CallLogRowProps {
|
|
631
|
+
/** The call-log message. Rows that aren't call logs render nothing. */
|
|
632
|
+
msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & {
|
|
633
|
+
deleted_at?: string | null;
|
|
634
|
+
};
|
|
635
|
+
/** Current user's id — decides whether a missed-call marker is shown. */
|
|
636
|
+
meId: string | null;
|
|
637
|
+
}
|
|
638
|
+
declare function CallLogRow({ msg, meId }: CallLogRowProps): react_jsx_runtime.JSX.Element | null;
|
|
639
|
+
|
|
630
640
|
interface EditableMessageBubbleProps {
|
|
631
641
|
message: Message;
|
|
632
642
|
currentUserId: string | null;
|
|
@@ -974,4 +984,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
974
984
|
*/
|
|
975
985
|
declare function PoolseFonts(): null;
|
|
976
986
|
|
|
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 };
|
|
987
|
+
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, 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
|
@@ -627,6 +627,16 @@ interface MessageBubbleProps {
|
|
|
627
627
|
*/
|
|
628
628
|
declare function MessageBubble({ message, currentUserId, readState, labelFor, onQuotedClick, groupPosition, maxBodyLength, markdown, showSenderName, actionsTrigger, showAttachments, }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
629
629
|
|
|
630
|
+
interface CallLogRowProps {
|
|
631
|
+
/** The call-log message. Rows that aren't call logs render nothing. */
|
|
632
|
+
msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & {
|
|
633
|
+
deleted_at?: string | null;
|
|
634
|
+
};
|
|
635
|
+
/** Current user's id — decides whether a missed-call marker is shown. */
|
|
636
|
+
meId: string | null;
|
|
637
|
+
}
|
|
638
|
+
declare function CallLogRow({ msg, meId }: CallLogRowProps): react_jsx_runtime.JSX.Element | null;
|
|
639
|
+
|
|
630
640
|
interface EditableMessageBubbleProps {
|
|
631
641
|
message: Message;
|
|
632
642
|
currentUserId: string | null;
|
|
@@ -974,4 +984,4 @@ declare function usePoolseFonts(enabled?: boolean): void;
|
|
|
974
984
|
*/
|
|
975
985
|
declare function PoolseFonts(): null;
|
|
976
986
|
|
|
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 };
|
|
987
|
+
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, 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, 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
|
|
|
@@ -1469,6 +1469,35 @@ function computeInitials(name) {
|
|
|
1469
1469
|
const parts = name.trim().split(/\s+/).slice(0, 2);
|
|
1470
1470
|
return parts.map((p) => p.charAt(0).toUpperCase()).join("").slice(0, 2) || "?";
|
|
1471
1471
|
}
|
|
1472
|
+
function CallLogRow({ msg, meId }) {
|
|
1473
|
+
const display = callLogDisplayFor(msg, meId);
|
|
1474
|
+
if (!display) return null;
|
|
1475
|
+
return /* @__PURE__ */ jsx(CallLogLine, { display, insertedAt: msg.inserted_at });
|
|
1476
|
+
}
|
|
1477
|
+
function CallLogLine({ display, insertedAt }) {
|
|
1478
|
+
const time = formatTime(insertedAt);
|
|
1479
|
+
const icon = display.media === "video" ? "video" : "phone";
|
|
1480
|
+
const label = [display.title, display.detail, time].filter(Boolean).join(", ");
|
|
1481
|
+
return /* @__PURE__ */ jsx(
|
|
1482
|
+
"div",
|
|
1483
|
+
{
|
|
1484
|
+
className: `poolse-call-log${display.missed ? " poolse-call-log--missed" : ""}`,
|
|
1485
|
+
role: "note",
|
|
1486
|
+
"aria-label": label,
|
|
1487
|
+
children: /* @__PURE__ */ jsxs("span", { className: "poolse-call-log__chip", children: [
|
|
1488
|
+
/* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 13, label: null, className: "poolse-call-log__icon" }),
|
|
1489
|
+
/* @__PURE__ */ jsx("span", { className: "poolse-call-log__title", children: display.title }),
|
|
1490
|
+
display.detail && /* @__PURE__ */ jsx("span", { className: "poolse-call-log__detail", children: display.detail }),
|
|
1491
|
+
time && /* @__PURE__ */ jsx("span", { className: "poolse-call-log__time", children: time })
|
|
1492
|
+
] })
|
|
1493
|
+
}
|
|
1494
|
+
);
|
|
1495
|
+
}
|
|
1496
|
+
function formatTime(iso) {
|
|
1497
|
+
const d = new Date(iso);
|
|
1498
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
1499
|
+
return d.toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
1500
|
+
}
|
|
1472
1501
|
function AttachmentPreview({ attachment, onClick }) {
|
|
1473
1502
|
const isFullRow = "content_type" in attachment;
|
|
1474
1503
|
const { url, loading, error } = useAttachmentUrl(attachment.id);
|
|
@@ -1632,6 +1661,27 @@ function formatBytes(n) {
|
|
|
1632
1661
|
if (n < 1024 * 1024 * 1024) return `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
|
1633
1662
|
return `${(n / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
1634
1663
|
}
|
|
1664
|
+
|
|
1665
|
+
// src/bubbleText.ts
|
|
1666
|
+
function hasMarkdown(body) {
|
|
1667
|
+
return /[*_~`#>|\\]|\[.*\]|^\s*(?:[-+]|\d+[.)])\s|https?:\/\/|www\./ms.test(body);
|
|
1668
|
+
}
|
|
1669
|
+
function emojiOnlyCount(body) {
|
|
1670
|
+
const text = body.trim();
|
|
1671
|
+
if (!text || text.length > 32) return 0;
|
|
1672
|
+
try {
|
|
1673
|
+
const unit = "(?:\\p{Regional_Indicator}{2}|\\p{Extended_Pictographic})[\\u{1F3FB}-\\u{1F3FF}]?\\uFE0F?(?:\\u200D\\p{Extended_Pictographic}[\\u{1F3FB}-\\u{1F3FF}]?\\uFE0F?)*";
|
|
1674
|
+
const whole = new RegExp(`^(?:${unit}){1,3}$`, "u");
|
|
1675
|
+
if (!whole.test(text)) return 0;
|
|
1676
|
+
const each = new RegExp(unit, "gu");
|
|
1677
|
+
return (text.match(each) ?? []).length;
|
|
1678
|
+
} catch {
|
|
1679
|
+
return 0;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
function emojiFontSize(count) {
|
|
1683
|
+
return count === 1 ? 44 : count === 2 ? 38 : 32;
|
|
1684
|
+
}
|
|
1635
1685
|
function MessageBubble({
|
|
1636
1686
|
message,
|
|
1637
1687
|
currentUserId,
|
|
@@ -1663,6 +1713,9 @@ function MessageBubble({
|
|
|
1663
1713
|
const hasAnyAttachment = imageAttachments.length > 0 || fileAttachments.length > 0;
|
|
1664
1714
|
const hasVisibleBody = !message.deleted_at && rawBody.length > 0;
|
|
1665
1715
|
const metaOverlay = hasAnyAttachment && imageAttachments.length > 0 && !hasVisibleBody && fileAttachments.length === 0;
|
|
1716
|
+
const jumboCount = hasVisibleBody && !hasAnyAttachment && !message.quoted_message_id ? emojiOnlyCount(rawBody) : 0;
|
|
1717
|
+
const trimToggleVisible = shouldTrim || expanded && rawBody.length > maxBodyLength + TRIM_BUFFER;
|
|
1718
|
+
const inlineMeta = hasVisibleBody && jumboCount === 0 && !trimToggleVisible && (!markdown || !hasMarkdown(displayBody));
|
|
1666
1719
|
const className = [
|
|
1667
1720
|
"poolse-message",
|
|
1668
1721
|
isSelf ? "poolse-message--self" : "poolse-message--other",
|
|
@@ -1672,7 +1725,8 @@ function MessageBubble({
|
|
|
1672
1725
|
// Tells the CSS to round the image mosaic's bottom corners to
|
|
1673
1726
|
// match the bubble's outer corner when nothing follows the media.
|
|
1674
1727
|
hasAnyAttachment ? "poolse-message--has-media" : "",
|
|
1675
|
-
metaOverlay ? "poolse-message--media-only" : ""
|
|
1728
|
+
metaOverlay ? "poolse-message--media-only" : "",
|
|
1729
|
+
jumboCount > 0 ? "poolse-message--jumbo" : ""
|
|
1676
1730
|
].filter(Boolean).join(" ");
|
|
1677
1731
|
const time = message.inserted_at ? new Date(message.inserted_at).toLocaleTimeString(void 0, {
|
|
1678
1732
|
hour: "2-digit",
|
|
@@ -1694,62 +1748,83 @@ function MessageBubble({
|
|
|
1694
1748
|
showQuoteCard === "placeholder" && /* @__PURE__ */ jsx(QuotedPlaceholder, { isSelf, quotedMessageId: message.quoted_message_id }),
|
|
1695
1749
|
imageAttachments.length > 0 && /* @__PURE__ */ jsx(ImageMosaic, { images: imageAttachments }),
|
|
1696
1750
|
fileAttachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "poolse-message__files", children: fileAttachments.map((att) => /* @__PURE__ */ jsx(AttachmentPreview, { attachment: att }, att.id)) }),
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
{
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
"
|
|
1712
|
-
{
|
|
1713
|
-
type: "button",
|
|
1714
|
-
className: "poolse-message__read-more",
|
|
1715
|
-
onClick: (e) => {
|
|
1716
|
-
e.stopPropagation();
|
|
1717
|
-
setExpanded(true);
|
|
1718
|
-
},
|
|
1719
|
-
children: "Read more"
|
|
1720
|
-
}
|
|
1721
|
-
),
|
|
1722
|
-
!shouldTrim && expanded && rawBody.length > maxBodyLength + TRIM_BUFFER && /* @__PURE__ */ jsx(
|
|
1723
|
-
"button",
|
|
1751
|
+
(() => {
|
|
1752
|
+
const metaContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1753
|
+
/* @__PURE__ */ jsx("span", { children: time }),
|
|
1754
|
+
message.edited_at && !message.deleted_at ? /* @__PURE__ */ jsx("span", { children: "\xB7 edited" }) : null,
|
|
1755
|
+
isSelf && readState ? /* @__PURE__ */ jsx(
|
|
1756
|
+
PoolseIcon,
|
|
1757
|
+
{
|
|
1758
|
+
name: readState === "read" ? "check-double" : "check",
|
|
1759
|
+
size: 14,
|
|
1760
|
+
label: readState === "read" ? "Read" : "Sent"
|
|
1761
|
+
}
|
|
1762
|
+
) : null
|
|
1763
|
+
] });
|
|
1764
|
+
const body = message.deleted_at ? /* @__PURE__ */ jsx("span", { className: "poolse-message__body--deleted", children: "Message deleted" }) : hasVisibleBody ? /* @__PURE__ */ jsxs(
|
|
1765
|
+
"div",
|
|
1724
1766
|
{
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1767
|
+
className: markdown && !inlineMeta && jumboCount === 0 ? "poolse-message__body poolse-message__body--md" : "poolse-message__body",
|
|
1768
|
+
children: [
|
|
1769
|
+
jumboCount > 0 ? /* @__PURE__ */ jsx(
|
|
1770
|
+
"span",
|
|
1771
|
+
{
|
|
1772
|
+
className: "poolse-message__body--jumbo",
|
|
1773
|
+
style: { fontSize: emojiFontSize(jumboCount) },
|
|
1774
|
+
children: displayBody
|
|
1775
|
+
}
|
|
1776
|
+
) : markdown && !inlineMeta ? /* @__PURE__ */ jsx(
|
|
1777
|
+
ReactMarkdown,
|
|
1778
|
+
{
|
|
1779
|
+
remarkPlugins: [remarkGfm],
|
|
1780
|
+
components: {
|
|
1781
|
+
// Force links to a new tab + no opener — chat content
|
|
1782
|
+
// is user-supplied so security defaults matter.
|
|
1783
|
+
a: ({ node: _node, ...props }) => /* @__PURE__ */ jsx("a", { ...props, target: "_blank", rel: "noopener noreferrer nofollow" })
|
|
1784
|
+
},
|
|
1785
|
+
children: displayBody
|
|
1786
|
+
}
|
|
1787
|
+
) : /* @__PURE__ */ jsx("span", { children: displayBody }),
|
|
1788
|
+
inlineMeta && // Invisible twin of the meta, inline after the text: it
|
|
1789
|
+
// reserves exactly the meta's footprint on the last
|
|
1790
|
+
// line, so the absolutely-positioned real meta never
|
|
1791
|
+
// overlaps a glyph — and when the line is full, the
|
|
1792
|
+
// reservation wraps and the meta drops a line, flush
|
|
1793
|
+
// right. The WhatsApp trick.
|
|
1794
|
+
/* @__PURE__ */ jsx("span", { className: "poolse-message__meta poolse-message__meta--spacer", "aria-hidden": true, children: metaContent }),
|
|
1795
|
+
shouldTrim && /* @__PURE__ */ jsx(
|
|
1796
|
+
"button",
|
|
1797
|
+
{
|
|
1798
|
+
type: "button",
|
|
1799
|
+
className: "poolse-message__read-more",
|
|
1800
|
+
onClick: (e) => {
|
|
1801
|
+
e.stopPropagation();
|
|
1802
|
+
setExpanded(true);
|
|
1803
|
+
},
|
|
1804
|
+
children: "Read more"
|
|
1805
|
+
}
|
|
1806
|
+
),
|
|
1807
|
+
!shouldTrim && expanded && rawBody.length > maxBodyLength + TRIM_BUFFER && /* @__PURE__ */ jsx(
|
|
1808
|
+
"button",
|
|
1809
|
+
{
|
|
1810
|
+
type: "button",
|
|
1811
|
+
className: "poolse-message__read-more",
|
|
1812
|
+
onClick: (e) => {
|
|
1813
|
+
e.stopPropagation();
|
|
1814
|
+
setExpanded(false);
|
|
1815
|
+
},
|
|
1816
|
+
children: "Show less"
|
|
1817
|
+
}
|
|
1818
|
+
)
|
|
1819
|
+
]
|
|
1732
1820
|
}
|
|
1733
|
-
)
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
/* @__PURE__ */ jsx("span", { children: time }),
|
|
1741
|
-
message.edited_at ? /* @__PURE__ */ jsx("span", { children: " \xB7 edited" }) : null,
|
|
1742
|
-
isSelf && readState ? /* @__PURE__ */ jsx(
|
|
1743
|
-
PoolseIcon,
|
|
1744
|
-
{
|
|
1745
|
-
name: readState === "read" ? "check-double" : "check",
|
|
1746
|
-
size: 14,
|
|
1747
|
-
label: readState === "read" ? "Read" : "Sent"
|
|
1748
|
-
}
|
|
1749
|
-
) : null
|
|
1750
|
-
]
|
|
1751
|
-
}
|
|
1752
|
-
)
|
|
1821
|
+
) : null;
|
|
1822
|
+
const metaClass = metaOverlay ? "poolse-message__meta poolse-message__meta--overlay" : inlineMeta ? "poolse-message__meta poolse-message__meta--inline" : "poolse-message__meta poolse-message__meta--block";
|
|
1823
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1824
|
+
body,
|
|
1825
|
+
/* @__PURE__ */ jsx("span", { className: metaClass, children: metaContent })
|
|
1826
|
+
] });
|
|
1827
|
+
})()
|
|
1753
1828
|
] });
|
|
1754
1829
|
}
|
|
1755
1830
|
function isImageContentType(ct) {
|
|
@@ -2081,7 +2156,14 @@ function ActionButton({
|
|
|
2081
2156
|
].filter(Boolean).join(" ");
|
|
2082
2157
|
return /* @__PURE__ */ jsx("button", { type: "button", className: classes, "aria-label": label, title: label, onClick, children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: 16, label: null }) });
|
|
2083
2158
|
}
|
|
2084
|
-
function MessageRow({
|
|
2159
|
+
function MessageRow(props) {
|
|
2160
|
+
const callLog = callLogDisplayFor(props.msg, props.meId);
|
|
2161
|
+
if (callLog !== void 0) {
|
|
2162
|
+
return callLog ? /* @__PURE__ */ jsx(CallLogRow, { msg: props.msg, meId: props.meId }) : null;
|
|
2163
|
+
}
|
|
2164
|
+
return /* @__PURE__ */ jsx(BubbleMessageRow, { ...props });
|
|
2165
|
+
}
|
|
2166
|
+
function BubbleMessageRow({
|
|
2085
2167
|
msg,
|
|
2086
2168
|
meId,
|
|
2087
2169
|
reactions = true,
|
|
@@ -2618,6 +2700,11 @@ function ConversationView({
|
|
|
2618
2700
|
if (el) el.scrollTop = el.scrollHeight;
|
|
2619
2701
|
setNewCountWhileAway(0);
|
|
2620
2702
|
};
|
|
2703
|
+
const meIdForFeed = me?.id ?? null;
|
|
2704
|
+
const visibleMessages = useMemo(
|
|
2705
|
+
() => messages.filter((m) => isMessageVisibleTo(m, meIdForFeed)),
|
|
2706
|
+
[messages, meIdForFeed]
|
|
2707
|
+
);
|
|
2621
2708
|
const maxReadByOthers = useMemo(() => {
|
|
2622
2709
|
if (!readReceipts || !me) return null;
|
|
2623
2710
|
let max = 0;
|
|
@@ -2754,12 +2841,12 @@ function ConversationView({
|
|
|
2754
2841
|
"aria-relevant": "additions",
|
|
2755
2842
|
children: [
|
|
2756
2843
|
hasMore && /* @__PURE__ */ jsx("div", { ref: topSentinelRef, "aria-hidden": "true", style: { height: 1 } }),
|
|
2757
|
-
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." }) :
|
|
2844
|
+
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) => {
|
|
2758
2845
|
if (renderMessage) {
|
|
2759
2846
|
return /* @__PURE__ */ jsx(Fragment$1, { children: renderMessage(msg, me?.id ?? null) }, msg.id);
|
|
2760
2847
|
}
|
|
2761
|
-
const prev = idx > 0 ?
|
|
2762
|
-
const next = idx <
|
|
2848
|
+
const prev = idx > 0 ? visibleMessages[idx - 1] ?? null : null;
|
|
2849
|
+
const next = idx < visibleMessages.length - 1 ? visibleMessages[idx + 1] ?? null : null;
|
|
2763
2850
|
const groupPosition = grouping ? computeGroupPosition(msg, prev, next, groupingWindowMs) : "standalone";
|
|
2764
2851
|
const showDaySeparator = daySeparators && (prev === null || !sameDay(msg.inserted_at, prev.inserted_at));
|
|
2765
2852
|
const enriched = quotations && msg.quoted_message_id && !msg.quoted_message ? (() => {
|
|
@@ -2926,6 +3013,7 @@ function ConversationList({
|
|
|
2926
3013
|
const auto = useConversations();
|
|
2927
3014
|
const { me } = useMe();
|
|
2928
3015
|
const meExternalId = me?.external_id ?? null;
|
|
3016
|
+
const meId = me?.id ?? null;
|
|
2929
3017
|
const isControlled = controlledConversations !== void 0;
|
|
2930
3018
|
const conversations = isControlled ? controlledConversations : auto.conversations;
|
|
2931
3019
|
const loading = isControlled ? controlledLoading ?? false : auto.loading;
|
|
@@ -2950,6 +3038,7 @@ function ConversationList({
|
|
|
2950
3038
|
selected,
|
|
2951
3039
|
unread,
|
|
2952
3040
|
meExternalId,
|
|
3041
|
+
meId,
|
|
2953
3042
|
...labelFor ? { labelFor } : {},
|
|
2954
3043
|
...avatarFor ? { avatarFor } : {}
|
|
2955
3044
|
}
|
|
@@ -2979,6 +3068,7 @@ function DefaultRow({
|
|
|
2979
3068
|
selected: _selected,
|
|
2980
3069
|
unread,
|
|
2981
3070
|
meExternalId,
|
|
3071
|
+
meId = null,
|
|
2982
3072
|
labelFor,
|
|
2983
3073
|
avatarFor
|
|
2984
3074
|
}) {
|
|
@@ -2988,7 +3078,7 @@ function DefaultRow({
|
|
|
2988
3078
|
const avatarUrl = isDirect ? otherExtId ? avatarFor?.(otherExtId) ?? null : conv.avatar_url ?? null : conv.avatar_url ?? null;
|
|
2989
3079
|
const time = conv.last_message_at ? formatRelative(conv.last_message_at) : "";
|
|
2990
3080
|
const hasUnread = unread > 0;
|
|
2991
|
-
const preview = conv.last_message_preview ?? (conv.last_sequence > 0 ? `${conv.last_sequence} message${conv.last_sequence === 1 ? "" : "s"}` : "No messages yet");
|
|
3081
|
+
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");
|
|
2992
3082
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2993
3083
|
/* @__PURE__ */ jsx(Avatar, { src: avatarUrl, name: title, size: "md" }),
|
|
2994
3084
|
/* @__PURE__ */ jsxs("div", { className: "poolse-list__body", children: [
|
|
@@ -3573,6 +3663,6 @@ function PoolseLogo({
|
|
|
3573
3663
|
);
|
|
3574
3664
|
}
|
|
3575
3665
|
|
|
3576
|
-
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 };
|
|
3666
|
+
export { AttachmentPreview, Avatar, CallControlButton, CallDeviceMenu, CallLogRow, 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 };
|
|
3577
3667
|
//# sourceMappingURL=index.js.map
|
|
3578
3668
|
//# sourceMappingURL=index.js.map
|