stream-chat-react 12.2.2 → 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.
@@ -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 }) => [!!dialogsById[id]?.isOpen],
20726
+ ({ dialogsById }) => ({ isOpen: !!dialogsById[id]?.isOpen }),
20727
20727
  [id]
20728
20728
  );
20729
- return useStateStore(dialogManager.state, dialogIsOpenSelector)[0];
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)[0];
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 = (nextValue) => [nextValue.unreadThreadCount];
43923
+ var selector = ({ unreadThreadCount }) => ({
43924
+ unreadThreadCount
43925
+ });
43924
43926
  var ChatViewSelector = () => {
43925
43927
  const { client } = useChatContext();
43926
- const [unreadThreadCount] = useStateStore(client.threads.state, selector);
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.replies.at(-1),
43991
- client.userID && nextValue.read[client.userID]?.unreadMessageCount || 0,
43992
- nextValue.parentMessage,
43993
- nextValue.channel,
43994
- nextValue.deletedAt
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 [latestReply, ownUnreadMessageCount, parentMessage, channel, deletedAt] = useStateStore(
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) => [nextValue.unseenThreadIds];
44039
+ var selector2 = (nextValue) => ({
44040
+ unseenThreadIds: nextValue.unseenThreadIds
44041
+ });
44038
44042
  var ThreadListUnseenThreadsBanner = () => {
44039
44043
  const { client } = useChatContext();
44040
- const [unseenThreadIds] = useStateStore(client.threads.state, selector2);
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) => [nextValue.pagination.isLoadingNext];
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 [isLoadingNext] = useStateStore(client.threads.state, selector3);
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) => [nextValue.threads];
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 [threads] = useStateStore(client.threads.state, selector4);
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,
@@ -52356,12 +52362,12 @@ var Thread = (props) => {
52356
52362
  /* @__PURE__ */ import_react221.default.createElement(ThreadInner, { ...props, key: `thread-${(thread ?? threadInstance)?.id}-${channel?.cid}` })
52357
52363
  );
52358
52364
  };
52359
- var selector5 = (nextValue) => [
52360
- nextValue.replies,
52361
- nextValue.pagination.isLoadingPrev,
52362
- nextValue.pagination.isLoadingNext,
52363
- nextValue.parentMessage
52364
- ];
52365
+ var selector5 = (nextValue) => ({
52366
+ isLoadingNext: nextValue.pagination.isLoadingNext,
52367
+ isLoadingPrev: nextValue.pagination.isLoadingPrev,
52368
+ parentMessage: nextValue.parentMessage,
52369
+ replies: nextValue.replies
52370
+ });
52365
52371
  var ThreadInner = (props) => {
52366
52372
  const {
52367
52373
  additionalMessageInputProps,
@@ -52376,7 +52382,7 @@ var ThreadInner = (props) => {
52376
52382
  virtualized
52377
52383
  } = props;
52378
52384
  const threadInstance = useThreadContext();
52379
- const [latestReplies, isLoadingPrev, isLoadingNext, parentMessage] = useStateStore(threadInstance?.state, selector5) ?? [];
52385
+ const { isLoadingNext, isLoadingPrev, parentMessage, replies } = useStateStore(threadInstance?.state, selector5) ?? {};
52380
52386
  const {
52381
52387
  thread,
52382
52388
  threadHasMore,
@@ -52408,7 +52414,7 @@ var ThreadInner = (props) => {
52408
52414
  loadingMoreNewer: isLoadingNext,
52409
52415
  loadMore: threadInstance.loadPrevPage,
52410
52416
  loadMoreNewer: threadInstance.loadNextPage,
52411
- messages: latestReplies
52417
+ messages: replies
52412
52418
  } : {
52413
52419
  hasMore: threadHasMore,
52414
52420
  loadingMore: threadLoadingMore,