stream-chat-react 13.1.2 → 13.2.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/ChannelList/ChannelList.js +1 -1
- package/dist/components/ChannelList/hooks/usePaginatedChannels.d.ts +1 -1
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +1 -3
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Message/FixedHeightMessage.js +1 -4
- package/dist/components/Message/MessageSimple.js +0 -2
- package/dist/components/TextareaComposer/TextareaComposer.js +2 -4
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/context/ChannelListContext.d.ts +8 -0
- package/dist/experimental/index.browser.cjs +425 -451
- package/dist/experimental/index.browser.cjs.map +4 -4
- package/dist/experimental/index.node.cjs +384 -410
- package/dist/experimental/index.node.cjs.map +4 -4
- package/dist/index.browser.cjs +2119 -19804
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +1602 -22161
- package/dist/index.node.cjs.map +4 -4
- package/package.json +4 -5
- package/dist/components/MML/MML.d.ts +0 -14
- package/dist/components/MML/MML.js +0 -16
- package/dist/components/MML/index.d.ts +0 -1
- package/dist/components/MML/index.js +0 -1
|
@@ -136,7 +136,7 @@ const UnMemoizedChannelList = (props) => {
|
|
|
136
136
|
[`${baseClass}--open`]: navOpen,
|
|
137
137
|
});
|
|
138
138
|
const showChannelList = (!searchActive && !searchIsActive) || additionalChannelSearchProps?.popupResults;
|
|
139
|
-
return (React.createElement(ChannelListContextProvider, { value: { channels, setChannels } },
|
|
139
|
+
return (React.createElement(ChannelListContextProvider, { value: { channels, hasNextPage, loadNextPage, setChannels } },
|
|
140
140
|
React.createElement("div", { className: className, ref: channelListRef },
|
|
141
141
|
showChannelSearch &&
|
|
142
142
|
(Search ? (React.createElement(Search, { directMessagingChannelType: additionalChannelSearchProps?.channelType, disabled: additionalChannelSearchProps?.disabled, exitSearchOnInputBlur: additionalChannelSearchProps?.clearSearchOnClickOutside, placeholder: additionalChannelSearchProps?.placeholder })) : (React.createElement(ChannelSearch, { onSearch: onSearch, onSearchExit: onSearchExit, setChannels: setChannels, ...additionalChannelSearchProps }))),
|
|
@@ -12,7 +12,7 @@ export type CustomQueryChannelsFn = (params: CustomQueryChannelParams) => Promis
|
|
|
12
12
|
export declare const usePaginatedChannels: (client: StreamChat, filters: ChannelFilters, sort: ChannelSort, options: ChannelOptions, activeChannelHandler: (channels: Array<Channel>, setChannels: React.Dispatch<React.SetStateAction<Array<Channel>>>) => void, recoveryThrottleIntervalMs?: number, customQueryChannels?: CustomQueryChannelsFn) => {
|
|
13
13
|
channels: Channel[];
|
|
14
14
|
hasNextPage: boolean;
|
|
15
|
-
loadNextPage: () => void
|
|
15
|
+
loadNextPage: () => Promise<void>;
|
|
16
16
|
setChannels: import("react").Dispatch<import("react").SetStateAction<Channel[]>>;
|
|
17
17
|
};
|
|
18
18
|
export {};
|
|
@@ -72,9 +72,7 @@ export const usePaginatedChannels = (client, filters, sort, options, activeChann
|
|
|
72
72
|
lastRecoveryTimestamp.current = now;
|
|
73
73
|
queryChannels('reload');
|
|
74
74
|
}, [error, queryChannels, recoveryThrottleInterval]);
|
|
75
|
-
const loadNextPage = () =>
|
|
76
|
-
queryChannels();
|
|
77
|
-
};
|
|
75
|
+
const loadNextPage = () => queryChannels();
|
|
78
76
|
useEffect(() => {
|
|
79
77
|
if (client.recoverStateOnReconnect)
|
|
80
78
|
return;
|
|
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
-
const version = "13.
|
|
27
|
+
const version = "13.2.0";
|
|
28
28
|
const userAgent = client.getUserAgent();
|
|
29
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
30
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useDeleteHandler, useUserRole } from './hooks';
|
|
3
3
|
import { MessageDeleted as DefaultMessageDeleted } from './MessageDeleted';
|
|
4
4
|
import { MessageTimestamp } from './MessageTimestamp';
|
|
5
5
|
import { getMessageActions } from './utils';
|
|
6
6
|
import { Avatar } from '../Avatar';
|
|
7
7
|
import { Gallery } from '../Gallery';
|
|
8
8
|
import { MessageActions } from '../MessageActions';
|
|
9
|
-
import { MML } from '../MML';
|
|
10
9
|
import { useChatContext } from '../../context/ChatContext';
|
|
11
10
|
import { useComponentContext } from '../../context/ComponentContext';
|
|
12
11
|
import { useMessageContext } from '../../context/MessageContext';
|
|
@@ -32,7 +31,6 @@ const UnMemoizedFixedHeightMessage = (props) => {
|
|
|
32
31
|
const { userLanguage } = useTranslationContext('FixedHeightMessage');
|
|
33
32
|
const groupedByUser = propGroupedByUser !== undefined ? propGroupedByUser : contextGroupedByUser;
|
|
34
33
|
const message = propMessage || contextMessage;
|
|
35
|
-
const handleAction = useActionHandler(message);
|
|
36
34
|
const handleDelete = useDeleteHandler(message);
|
|
37
35
|
const role = useUserRole(message);
|
|
38
36
|
const messageTextToRender = message?.i18n?.[`${userLanguage}_text`] ||
|
|
@@ -52,7 +50,6 @@ const UnMemoizedFixedHeightMessage = (props) => {
|
|
|
52
50
|
images && React.createElement(Gallery, { images: images }),
|
|
53
51
|
React.createElement("div", { className: 'str-chat__virtual-message__text', "data-testid": 'msg-text' },
|
|
54
52
|
renderedText,
|
|
55
|
-
message.mml && (React.createElement(MML, { actionHandler: handleAction, align: 'left', source: message.mml })),
|
|
56
53
|
React.createElement("div", { className: 'str-chat__virtual-message__data' },
|
|
57
54
|
React.createElement(MessageActions, { customWrapperClass: 'str-chat__virtual-message__actions', getMessageActions: messageActionsHandler, handleDelete: handleDelete, message: message, mine: () => role.isMyMessage }),
|
|
58
55
|
React.createElement("span", { className: 'str-chat__virtual-message__date' },
|
|
@@ -18,7 +18,6 @@ import { areMessageUIPropsEqual, isMessageBlocked, isMessageBounced, isMessageEd
|
|
|
18
18
|
import { Avatar as DefaultAvatar } from '../Avatar';
|
|
19
19
|
import { Attachment as DefaultAttachment } from '../Attachment';
|
|
20
20
|
import { EditMessageModal } from '../MessageInput';
|
|
21
|
-
import { MML } from '../MML';
|
|
22
21
|
import { Poll } from '../Poll';
|
|
23
22
|
import { ReactionsList as DefaultReactionList } from '../Reactions';
|
|
24
23
|
import { MessageBounceModal } from '../MessageBounce/MessageBounceModal';
|
|
@@ -95,7 +94,6 @@ const MessageSimpleWithContext = (props) => {
|
|
|
95
94
|
poll && React.createElement(Poll, { poll: poll }),
|
|
96
95
|
message.attachments?.length && !message.quoted_message ? (React.createElement(Attachment, { actionHandler: handleAction, attachments: message.attachments })) : null,
|
|
97
96
|
isAIGenerated ? (React.createElement(StreamedMessageText, { message: message, renderText: renderText })) : (React.createElement(MessageText, { message: message, renderText: renderText })),
|
|
98
|
-
message.mml && (React.createElement(MML, { actionHandler: handleAction, align: isMyMessage() ? 'right' : 'left', source: message.mml })),
|
|
99
97
|
React.createElement(MessageErrorIcon, null))),
|
|
100
98
|
showReplyCountButton && (React.createElement(MessageRepliesCountButton, { onClick: handleOpenThread, reply_count: message.reply_count })),
|
|
101
99
|
showIsReplyInChannel && React.createElement(MessageIsThreadReplyInChannelButtonIndicator, null),
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import debounce from 'lodash.debounce';
|
|
2
1
|
import clsx from 'clsx';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
3
|
import Textarea from 'react-textarea-autosize';
|
|
6
4
|
import { useMessageComposer } from '../MessageInput';
|
|
@@ -129,13 +127,13 @@ export const TextareaComposer = ({ className, closeSuggestionsOnClickOutside, co
|
|
|
129
127
|
textComposer.closeSuggestions();
|
|
130
128
|
}
|
|
131
129
|
}, [onScroll, textComposer]);
|
|
132
|
-
const setSelectionDebounced =
|
|
130
|
+
const setSelectionDebounced = useCallback((e) => {
|
|
133
131
|
onSelect?.(e);
|
|
134
132
|
textComposer.setSelection({
|
|
135
133
|
end: e.target.selectionEnd,
|
|
136
134
|
start: e.target.selectionStart,
|
|
137
135
|
});
|
|
138
|
-
},
|
|
136
|
+
}, [onSelect, textComposer]);
|
|
139
137
|
useEffect(() => {
|
|
140
138
|
// FIXME: find the real reason for cursor being set to the end on each change
|
|
141
139
|
// This is a workaround to prevent the cursor from jumping
|
|
@@ -20,7 +20,6 @@ export * from './MessageActions';
|
|
|
20
20
|
export type { MessageBouncePromptProps } from './MessageBounce';
|
|
21
21
|
export * from './MessageInput';
|
|
22
22
|
export * from './MessageList';
|
|
23
|
-
export * from './MML';
|
|
24
23
|
export * from './Modal';
|
|
25
24
|
export * from './Notifications';
|
|
26
25
|
export * from './Poll';
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,14 @@ export type ChannelListContextValue = {
|
|
|
7
7
|
* Channels query is executed by default only by ChannelList component in the SDK.
|
|
8
8
|
*/
|
|
9
9
|
channels: Channel[];
|
|
10
|
+
/**
|
|
11
|
+
* Indicator for channel pagination to determine whether more items can be loaded
|
|
12
|
+
*/
|
|
13
|
+
hasNextPage: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Pagination function to load more channels
|
|
16
|
+
*/
|
|
17
|
+
loadNextPage(): Promise<void>;
|
|
10
18
|
/**
|
|
11
19
|
* Sets the list of Channel objects to be rendered by ChannelList component.
|
|
12
20
|
*/
|