stream-chat-react 12.2.0 → 12.2.2
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/components/ChannelList/ChannelList.d.ts +3 -0
- package/dist/components/ChannelList/ChannelList.js +2 -1
- package/dist/components/ChannelPreview/ChannelPreview.d.ts +6 -1
- package/dist/components/ChannelPreview/ChannelPreview.js +11 -9
- package/dist/components/ChannelPreview/ChannelPreviewMessenger.js +2 -2
- package/dist/components/ChannelPreview/utils.js +2 -3
- package/dist/components/MessageList/MessageList.js +4 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +4 -1
- package/dist/index.browser.cjs +26 -13
- package/dist/index.browser.cjs.map +3 -3
- package/dist/index.node.cjs +26 -13
- package/dist/index.node.cjs.map +3 -3
- package/package.json +1 -1
package/dist/index.node.cjs
CHANGED
|
@@ -43586,7 +43586,7 @@ var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
|
43586
43586
|
className: customClassName = "",
|
|
43587
43587
|
displayImage,
|
|
43588
43588
|
displayTitle,
|
|
43589
|
-
|
|
43589
|
+
latestMessagePreview,
|
|
43590
43590
|
onSelect: customOnSelectChannel,
|
|
43591
43591
|
setActiveChannel,
|
|
43592
43592
|
unread,
|
|
@@ -43628,7 +43628,7 @@ var UnMemoizedChannelPreviewMessenger = (props) => {
|
|
|
43628
43628
|
name: avatarName
|
|
43629
43629
|
}
|
|
43630
43630
|
)),
|
|
43631
|
-
/* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-end" }, /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-end-first-row" }, /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-messenger--name" }, /* @__PURE__ */ import_react83.default.createElement("span", null, displayTitle)), !!unread && /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-unread-badge", "data-testid": "unread-badge" }, unread)), /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-messenger--last-message" },
|
|
43631
|
+
/* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-end" }, /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-end-first-row" }, /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-messenger--name" }, /* @__PURE__ */ import_react83.default.createElement("span", null, displayTitle)), !!unread && /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-unread-badge", "data-testid": "unread-badge" }, unread)), /* @__PURE__ */ import_react83.default.createElement("div", { className: "str-chat__channel-preview-messenger--last-message" }, latestMessagePreview))
|
|
43632
43632
|
);
|
|
43633
43633
|
};
|
|
43634
43634
|
var ChannelPreviewMessenger = import_react83.default.memo(
|
|
@@ -43655,7 +43655,7 @@ var import_react86 = require("react");
|
|
|
43655
43655
|
var import_react85 = __toESM(require("react"));
|
|
43656
43656
|
var renderPreviewText = (text5) => /* @__PURE__ */ import_react85.default.createElement(ReactMarkdown, { skipHtml: true }, text5);
|
|
43657
43657
|
var getLatestMessagePreview = (channel, t2, userLanguage = "en") => {
|
|
43658
|
-
const latestMessage = channel.state.
|
|
43658
|
+
const latestMessage = channel.state.latestMessages[channel.state.latestMessages.length - 1];
|
|
43659
43659
|
const previewTextToRender = latestMessage?.i18n?.[`${userLanguage}_text`] || latestMessage?.text;
|
|
43660
43660
|
if (!latestMessage) {
|
|
43661
43661
|
return t2("Nothing yet...");
|
|
@@ -43664,8 +43664,7 @@ var getLatestMessagePreview = (channel, t2, userLanguage = "en") => {
|
|
|
43664
43664
|
return t2("Message deleted");
|
|
43665
43665
|
}
|
|
43666
43666
|
if (previewTextToRender) {
|
|
43667
|
-
|
|
43668
|
-
return renderedText;
|
|
43667
|
+
return renderPreviewText(previewTextToRender);
|
|
43669
43668
|
}
|
|
43670
43669
|
if (latestMessage.command) {
|
|
43671
43670
|
return `/${latestMessage.command}`;
|
|
@@ -43773,7 +43772,12 @@ var useMessageDeliveryStatus = ({
|
|
|
43773
43772
|
|
|
43774
43773
|
// src/components/ChannelPreview/ChannelPreview.tsx
|
|
43775
43774
|
var ChannelPreview = (props) => {
|
|
43776
|
-
const {
|
|
43775
|
+
const {
|
|
43776
|
+
channel,
|
|
43777
|
+
Preview = ChannelPreviewMessenger,
|
|
43778
|
+
channelUpdateCount,
|
|
43779
|
+
getLatestMessagePreview: getLatestMessagePreview2 = getLatestMessagePreview
|
|
43780
|
+
} = props;
|
|
43777
43781
|
const { channel: activeChannel, client, setActiveChannel } = useChatContext(
|
|
43778
43782
|
"ChannelPreview"
|
|
43779
43783
|
);
|
|
@@ -43820,21 +43824,25 @@ var ChannelPreview = (props) => {
|
|
|
43820
43824
|
);
|
|
43821
43825
|
(0, import_react88.useEffect)(() => {
|
|
43822
43826
|
refreshUnreadCount();
|
|
43823
|
-
const handleEvent = (
|
|
43824
|
-
|
|
43827
|
+
const handleEvent = () => {
|
|
43828
|
+
setLastMessage(channel.state.latestMessages[channel.state.latestMessages.length - 1]);
|
|
43825
43829
|
refreshUnreadCount();
|
|
43826
43830
|
};
|
|
43827
43831
|
channel.on("message.new", handleEvent);
|
|
43828
43832
|
channel.on("message.updated", handleEvent);
|
|
43829
43833
|
channel.on("message.deleted", handleEvent);
|
|
43834
|
+
channel.on("message.undeleted", handleEvent);
|
|
43835
|
+
channel.on("channel.truncated", handleEvent);
|
|
43830
43836
|
return () => {
|
|
43831
43837
|
channel.off("message.new", handleEvent);
|
|
43832
43838
|
channel.off("message.updated", handleEvent);
|
|
43833
43839
|
channel.off("message.deleted", handleEvent);
|
|
43840
|
+
channel.off("message.undeleted", handleEvent);
|
|
43841
|
+
channel.off("channel.truncated", handleEvent);
|
|
43834
43842
|
};
|
|
43835
|
-
}, [refreshUnreadCount, channelUpdateCount]);
|
|
43843
|
+
}, [channel, refreshUnreadCount, channelUpdateCount]);
|
|
43836
43844
|
if (!Preview) return null;
|
|
43837
|
-
const
|
|
43845
|
+
const latestMessagePreview = getLatestMessagePreview2(channel, t2, userLanguage);
|
|
43838
43846
|
return /* @__PURE__ */ import_react88.default.createElement(
|
|
43839
43847
|
Preview,
|
|
43840
43848
|
{
|
|
@@ -43843,7 +43851,8 @@ var ChannelPreview = (props) => {
|
|
|
43843
43851
|
displayImage,
|
|
43844
43852
|
displayTitle,
|
|
43845
43853
|
lastMessage,
|
|
43846
|
-
latestMessage,
|
|
43854
|
+
latestMessage: latestMessagePreview,
|
|
43855
|
+
latestMessagePreview,
|
|
43847
43856
|
messageDeliveryStatus,
|
|
43848
43857
|
setActiveChannel,
|
|
43849
43858
|
unread
|
|
@@ -48825,7 +48834,8 @@ var MessageListWithContext = (props) => {
|
|
|
48825
48834
|
}
|
|
48826
48835
|
}, [highlightedMessageId]);
|
|
48827
48836
|
const showEmptyStateIndicator = elements.length === 0 && !threadList;
|
|
48828
|
-
|
|
48837
|
+
const dialogManagerId = threadList ? "message-list-dialog-manager-thread" : "message-list-dialog-manager";
|
|
48838
|
+
return /* @__PURE__ */ import_react175.default.createElement(MessageListContextProvider, { value: { listElement, scrollToBottom } }, /* @__PURE__ */ import_react175.default.createElement(MessageListMainPanel2, null, /* @__PURE__ */ import_react175.default.createElement(DialogManagerProvider, { id: dialogManagerId }, !threadList && showUnreadMessagesNotification && /* @__PURE__ */ import_react175.default.createElement(UnreadMessagesNotification2, { unreadCount: channelUnreadUiState?.unread_messages }), /* @__PURE__ */ import_react175.default.createElement(
|
|
48829
48839
|
"div",
|
|
48830
48840
|
{
|
|
48831
48841
|
className: (0, import_clsx38.default)(messageListClass, customClasses?.threadList),
|
|
@@ -49538,7 +49548,8 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49538
49548
|
};
|
|
49539
49549
|
}, [highlightedMessageId, processedMessages]);
|
|
49540
49550
|
if (!processedMessages) return null;
|
|
49541
|
-
|
|
49551
|
+
const dialogManagerId = threadList ? "virtualized-message-list-dialog-manager-thread" : "virtualized-message-list-dialog-manager";
|
|
49552
|
+
return /* @__PURE__ */ import_react185.default.createElement(import_react185.default.Fragment, null, /* @__PURE__ */ import_react185.default.createElement(MessageListMainPanel2, null, /* @__PURE__ */ import_react185.default.createElement(DialogManagerProvider, { id: dialogManagerId }, !threadList && showUnreadMessagesNotification && /* @__PURE__ */ import_react185.default.createElement(UnreadMessagesNotification2, { unreadCount: channelUnreadUiState?.unread_messages }), /* @__PURE__ */ import_react185.default.createElement("div", { className: customClasses?.virtualizedMessageList || "str-chat__virtual-list" }, /* @__PURE__ */ import_react185.default.createElement(
|
|
49542
49553
|
import_react_virtuoso2.Virtuoso,
|
|
49543
49554
|
{
|
|
49544
49555
|
atBottomStateChange,
|
|
@@ -51839,6 +51850,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
51839
51850
|
customQueryChannels,
|
|
51840
51851
|
EmptyStateIndicator: EmptyStateIndicator2 = EmptyStateIndicator,
|
|
51841
51852
|
filters,
|
|
51853
|
+
getLatestMessagePreview: getLatestMessagePreview2,
|
|
51842
51854
|
LoadingErrorIndicator: LoadingErrorIndicator2 = NullComponent,
|
|
51843
51855
|
LoadingIndicator: LoadingIndicator2 = LoadingChannels,
|
|
51844
51856
|
List: List2 = ChannelListMessenger,
|
|
@@ -51971,6 +51983,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
51971
51983
|
channel: item,
|
|
51972
51984
|
// forces the update of preview component on channel update
|
|
51973
51985
|
channelUpdateCount,
|
|
51986
|
+
getLatestMessagePreview: getLatestMessagePreview2,
|
|
51974
51987
|
key: item.cid,
|
|
51975
51988
|
Preview,
|
|
51976
51989
|
setActiveChannel,
|