stream-chat-react 12.2.1 → 12.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/dist/components/ChatView/ChatView.js +4 -2
- package/dist/components/Dialog/hooks/useDialog.js +6 -6
- package/dist/components/MessageList/MessageList.js +4 -1
- package/dist/components/MessageList/VirtualizedMessageList.js +4 -1
- package/dist/components/Thread/Thread.js +8 -8
- package/dist/components/Threads/ThreadList/ThreadList.js +2 -2
- package/dist/components/Threads/ThreadList/ThreadListItemUI.js +8 -8
- package/dist/components/Threads/ThreadList/ThreadListLoadingIndicator.js +4 -2
- package/dist/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.js +4 -2
- package/dist/index.browser.cjs +40 -32
- package/dist/index.browser.cjs.map +2 -2
- package/dist/index.node.cjs +40 -32
- package/dist/index.node.cjs.map +2 -2
- package/dist/store/hooks/useStateStore.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.node.cjs
CHANGED
|
@@ -20723,20 +20723,20 @@ var useDialog = ({ id }) => {
|
|
|
20723
20723
|
var useDialogIsOpen = (id) => {
|
|
20724
20724
|
const { dialogManager } = useDialogManager();
|
|
20725
20725
|
const dialogIsOpenSelector = (0, import_react7.useCallback)(
|
|
20726
|
-
({ dialogsById }) =>
|
|
20726
|
+
({ dialogsById }) => ({ isOpen: !!dialogsById[id]?.isOpen }),
|
|
20727
20727
|
[id]
|
|
20728
20728
|
);
|
|
20729
|
-
return useStateStore(dialogManager.state, dialogIsOpenSelector)
|
|
20729
|
+
return useStateStore(dialogManager.state, dialogIsOpenSelector).isOpen;
|
|
20730
20730
|
};
|
|
20731
|
-
var openedDialogCountSelector = (nextValue) =>
|
|
20732
|
-
Object.values(nextValue.dialogsById).reduce((count, dialog) => {
|
|
20731
|
+
var openedDialogCountSelector = (nextValue) => ({
|
|
20732
|
+
openedDialogCount: Object.values(nextValue.dialogsById).reduce((count, dialog) => {
|
|
20733
20733
|
if (dialog.isOpen) return count + 1;
|
|
20734
20734
|
return count;
|
|
20735
20735
|
}, 0)
|
|
20736
|
-
|
|
20736
|
+
});
|
|
20737
20737
|
var useOpenedDialogCount = () => {
|
|
20738
20738
|
const { dialogManager } = useDialogManager();
|
|
20739
|
-
return useStateStore(dialogManager.state, openedDialogCountSelector)
|
|
20739
|
+
return useStateStore(dialogManager.state, openedDialogCountSelector).openedDialogCount;
|
|
20740
20740
|
};
|
|
20741
20741
|
|
|
20742
20742
|
// src/components/Dialog/DialogPortal.tsx
|
|
@@ -43920,10 +43920,12 @@ var ThreadAdapter = ({ children }) => {
|
|
|
43920
43920
|
useActiveThread({ activeThread });
|
|
43921
43921
|
return /* @__PURE__ */ import_react89.default.createElement(ThreadProvider, { thread: activeThread }, children);
|
|
43922
43922
|
};
|
|
43923
|
-
var selector = (
|
|
43923
|
+
var selector = ({ unreadThreadCount }) => ({
|
|
43924
|
+
unreadThreadCount
|
|
43925
|
+
});
|
|
43924
43926
|
var ChatViewSelector = () => {
|
|
43925
43927
|
const { client } = useChatContext();
|
|
43926
|
-
const
|
|
43928
|
+
const { unreadThreadCount } = useStateStore(client.threads.state, selector);
|
|
43927
43929
|
const { activeChatView, setActiveChatView } = (0, import_react89.useContext)(ChatViewContext);
|
|
43928
43930
|
return /* @__PURE__ */ import_react89.default.createElement("div", { className: "str-chat__chat-view__selector" }, /* @__PURE__ */ import_react89.default.createElement(
|
|
43929
43931
|
"button",
|
|
@@ -43986,16 +43988,16 @@ var ThreadListItemUI = (props) => {
|
|
|
43986
43988
|
const { client } = useChatContext();
|
|
43987
43989
|
const thread = useThreadListItemContext();
|
|
43988
43990
|
const selector6 = (0, import_react90.useCallback)(
|
|
43989
|
-
(nextValue) =>
|
|
43990
|
-
nextValue.
|
|
43991
|
-
|
|
43992
|
-
nextValue.
|
|
43993
|
-
nextValue.
|
|
43994
|
-
nextValue.
|
|
43995
|
-
|
|
43991
|
+
(nextValue) => ({
|
|
43992
|
+
channel: nextValue.channel,
|
|
43993
|
+
deletedAt: nextValue.deletedAt,
|
|
43994
|
+
latestReply: nextValue.replies.at(-1),
|
|
43995
|
+
ownUnreadMessageCount: client.userID && nextValue.read[client.userID]?.unreadMessageCount || 0,
|
|
43996
|
+
parentMessage: nextValue.parentMessage
|
|
43997
|
+
}),
|
|
43996
43998
|
[client]
|
|
43997
43999
|
);
|
|
43998
|
-
const
|
|
44000
|
+
const { channel, deletedAt, latestReply, ownUnreadMessageCount, parentMessage } = useStateStore(
|
|
43999
44001
|
thread.state,
|
|
44000
44002
|
selector6
|
|
44001
44003
|
);
|
|
@@ -44034,10 +44036,12 @@ var ThreadListEmptyPlaceholder = () => /* @__PURE__ */ import_react92.default.cr
|
|
|
44034
44036
|
|
|
44035
44037
|
// src/components/Threads/ThreadList/ThreadListUnseenThreadsBanner.tsx
|
|
44036
44038
|
var import_react93 = __toESM(require("react"));
|
|
44037
|
-
var selector2 = (nextValue) =>
|
|
44039
|
+
var selector2 = (nextValue) => ({
|
|
44040
|
+
unseenThreadIds: nextValue.unseenThreadIds
|
|
44041
|
+
});
|
|
44038
44042
|
var ThreadListUnseenThreadsBanner = () => {
|
|
44039
44043
|
const { client } = useChatContext();
|
|
44040
|
-
const
|
|
44044
|
+
const { unseenThreadIds } = useStateStore(client.threads.state, selector2);
|
|
44041
44045
|
if (!unseenThreadIds.length) return null;
|
|
44042
44046
|
return /* @__PURE__ */ import_react93.default.createElement("div", { className: "str-chat__unseen-threads-banner" }, unseenThreadIds.length, " unread threads", /* @__PURE__ */ import_react93.default.createElement(
|
|
44043
44047
|
"button",
|
|
@@ -44051,17 +44055,19 @@ var ThreadListUnseenThreadsBanner = () => {
|
|
|
44051
44055
|
|
|
44052
44056
|
// src/components/Threads/ThreadList/ThreadListLoadingIndicator.tsx
|
|
44053
44057
|
var import_react94 = __toESM(require("react"));
|
|
44054
|
-
var selector3 = (nextValue) =>
|
|
44058
|
+
var selector3 = (nextValue) => ({
|
|
44059
|
+
isLoadingNext: nextValue.pagination.isLoadingNext
|
|
44060
|
+
});
|
|
44055
44061
|
var ThreadListLoadingIndicator = () => {
|
|
44056
44062
|
const { LoadingIndicator: LoadingIndicator2 = LoadingIndicator } = useComponentContext();
|
|
44057
44063
|
const { client } = useChatContext();
|
|
44058
|
-
const
|
|
44064
|
+
const { isLoadingNext } = useStateStore(client.threads.state, selector3);
|
|
44059
44065
|
if (!isLoadingNext) return null;
|
|
44060
44066
|
return /* @__PURE__ */ import_react94.default.createElement("div", { className: "str-chat__thread-list-loading-indicator" }, /* @__PURE__ */ import_react94.default.createElement(LoadingIndicator2, null));
|
|
44061
44067
|
};
|
|
44062
44068
|
|
|
44063
44069
|
// src/components/Threads/ThreadList/ThreadList.tsx
|
|
44064
|
-
var selector4 = (nextValue) =>
|
|
44070
|
+
var selector4 = (nextValue) => ({ threads: nextValue.threads });
|
|
44065
44071
|
var computeItemKey = (_, item) => item.id;
|
|
44066
44072
|
var useThreadList = () => {
|
|
44067
44073
|
const { client } = useChatContext();
|
|
@@ -44090,7 +44096,7 @@ var ThreadList = ({ virtuosoProps }) => {
|
|
|
44090
44096
|
ThreadListLoadingIndicator: ThreadListLoadingIndicator2 = ThreadListLoadingIndicator,
|
|
44091
44097
|
ThreadListUnseenThreadsBanner: ThreadListUnseenThreadsBanner2 = ThreadListUnseenThreadsBanner
|
|
44092
44098
|
} = useComponentContext();
|
|
44093
|
-
const
|
|
44099
|
+
const { threads } = useStateStore(client.threads.state, selector4);
|
|
44094
44100
|
useThreadList();
|
|
44095
44101
|
return /* @__PURE__ */ import_react95.default.createElement("div", { className: "str-chat__thread-list-container" }, /* @__PURE__ */ import_react95.default.createElement(ThreadListUnseenThreadsBanner2, null), /* @__PURE__ */ import_react95.default.createElement(
|
|
44096
44102
|
import_react_virtuoso.Virtuoso,
|
|
@@ -48834,7 +48840,8 @@ var MessageListWithContext = (props) => {
|
|
|
48834
48840
|
}
|
|
48835
48841
|
}, [highlightedMessageId]);
|
|
48836
48842
|
const showEmptyStateIndicator = elements.length === 0 && !threadList;
|
|
48837
|
-
|
|
48843
|
+
const dialogManagerId = threadList ? "message-list-dialog-manager-thread" : "message-list-dialog-manager";
|
|
48844
|
+
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(
|
|
48838
48845
|
"div",
|
|
48839
48846
|
{
|
|
48840
48847
|
className: (0, import_clsx38.default)(messageListClass, customClasses?.threadList),
|
|
@@ -49547,7 +49554,8 @@ var VirtualizedMessageListWithContext = (props) => {
|
|
|
49547
49554
|
};
|
|
49548
49555
|
}, [highlightedMessageId, processedMessages]);
|
|
49549
49556
|
if (!processedMessages) return null;
|
|
49550
|
-
|
|
49557
|
+
const dialogManagerId = threadList ? "virtualized-message-list-dialog-manager-thread" : "virtualized-message-list-dialog-manager";
|
|
49558
|
+
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(
|
|
49551
49559
|
import_react_virtuoso2.Virtuoso,
|
|
49552
49560
|
{
|
|
49553
49561
|
atBottomStateChange,
|
|
@@ -52354,12 +52362,12 @@ var Thread = (props) => {
|
|
|
52354
52362
|
/* @__PURE__ */ import_react221.default.createElement(ThreadInner, { ...props, key: `thread-${(thread ?? threadInstance)?.id}-${channel?.cid}` })
|
|
52355
52363
|
);
|
|
52356
52364
|
};
|
|
52357
|
-
var selector5 = (nextValue) =>
|
|
52358
|
-
nextValue.
|
|
52359
|
-
nextValue.pagination.isLoadingPrev,
|
|
52360
|
-
nextValue.
|
|
52361
|
-
nextValue.
|
|
52362
|
-
|
|
52365
|
+
var selector5 = (nextValue) => ({
|
|
52366
|
+
isLoadingNext: nextValue.pagination.isLoadingNext,
|
|
52367
|
+
isLoadingPrev: nextValue.pagination.isLoadingPrev,
|
|
52368
|
+
parentMessage: nextValue.parentMessage,
|
|
52369
|
+
replies: nextValue.replies
|
|
52370
|
+
});
|
|
52363
52371
|
var ThreadInner = (props) => {
|
|
52364
52372
|
const {
|
|
52365
52373
|
additionalMessageInputProps,
|
|
@@ -52374,7 +52382,7 @@ var ThreadInner = (props) => {
|
|
|
52374
52382
|
virtualized
|
|
52375
52383
|
} = props;
|
|
52376
52384
|
const threadInstance = useThreadContext();
|
|
52377
|
-
const
|
|
52385
|
+
const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state, selector5) ?? {};
|
|
52378
52386
|
const {
|
|
52379
52387
|
thread,
|
|
52380
52388
|
threadHasMore,
|
|
@@ -52406,7 +52414,7 @@ var ThreadInner = (props) => {
|
|
|
52406
52414
|
loadingMoreNewer: isLoadingNext,
|
|
52407
52415
|
loadMore: threadInstance.loadPrevPage,
|
|
52408
52416
|
loadMoreNewer: threadInstance.loadNextPage,
|
|
52409
|
-
messages:
|
|
52417
|
+
messages: replies
|
|
52410
52418
|
} : {
|
|
52411
52419
|
hasMore: threadHasMore,
|
|
52412
52420
|
loadingMore: threadLoadingMore,
|