stream-chat-react 12.2.0 → 12.2.1
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/index.browser.cjs +22 -11
- package/dist/index.browser.cjs.map +3 -3
- package/dist/index.node.cjs +22 -11
- 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
|
|
@@ -51839,6 +51848,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
51839
51848
|
customQueryChannels,
|
|
51840
51849
|
EmptyStateIndicator: EmptyStateIndicator2 = EmptyStateIndicator,
|
|
51841
51850
|
filters,
|
|
51851
|
+
getLatestMessagePreview: getLatestMessagePreview2,
|
|
51842
51852
|
LoadingErrorIndicator: LoadingErrorIndicator2 = NullComponent,
|
|
51843
51853
|
LoadingIndicator: LoadingIndicator2 = LoadingChannels,
|
|
51844
51854
|
List: List2 = ChannelListMessenger,
|
|
@@ -51971,6 +51981,7 @@ var UnMemoizedChannelList = (props) => {
|
|
|
51971
51981
|
channel: item,
|
|
51972
51982
|
// forces the update of preview component on channel update
|
|
51973
51983
|
channelUpdateCount,
|
|
51984
|
+
getLatestMessagePreview: getLatestMessagePreview2,
|
|
51974
51985
|
key: item.cid,
|
|
51975
51986
|
Preview,
|
|
51976
51987
|
setActiveChannel,
|