stream-chat-react 13.13.6 → 13.14.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/Channel/Channel.js +2 -6
- package/dist/components/ChannelList/ChannelList.js +2 -3
- package/dist/components/ChannelList/hooks/usePaginatedChannels.js +1 -5
- package/dist/components/ChannelList/utils.d.ts +0 -1
- package/dist/components/ChannelList/utils.js +0 -1
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/MessageInput/SendButton.d.ts +1 -2
- package/dist/components/MessageInput/hooks/useMessageInputControls.d.ts +1 -2
- package/dist/constants/limits.d.ts +3 -5
- package/dist/constants/limits.js +3 -5
- package/dist/experimental/index.browser.cjs +6 -5
- package/dist/experimental/index.browser.cjs.map +3 -3
- package/dist/experimental/index.node.cjs +6 -5
- package/dist/experimental/index.node.cjs.map +3 -3
- package/dist/index.browser.cjs +100 -111
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +100 -112
- package/dist/index.node.cjs.map +4 -4
- package/package.json +1 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import debounce from 'lodash.debounce';
|
|
4
|
-
import defaultsDeep from 'lodash.defaultsdeep';
|
|
5
4
|
import throttle from 'lodash.throttle';
|
|
6
5
|
import { localMessageToNewMessagePayload } from 'stream-chat';
|
|
7
6
|
import { initialState, makeChannelReducer } from './channelState';
|
|
@@ -13,7 +12,7 @@ import { useMentionsHandlers } from './hooks/useMentionsHandlers';
|
|
|
13
12
|
import { LoadingErrorIndicator as DefaultLoadingErrorIndicator, LoadingChannel as DefaultLoadingIndicator, } from '../Loading';
|
|
14
13
|
import { ChannelActionProvider, ChannelStateProvider, TypingProvider, useChatContext, useTranslationContext, WithComponents, } from '../../context';
|
|
15
14
|
import { CHANNEL_CONTAINER_ID } from './constants';
|
|
16
|
-
import { DEFAULT_HIGHLIGHT_DURATION,
|
|
15
|
+
import { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_JUMP_TO_PAGE_SIZE, DEFAULT_NEXT_CHANNEL_PAGE_SIZE, DEFAULT_THREAD_PAGE_SIZE, } from '../../constants/limits';
|
|
17
16
|
import { hasMoreMessagesProbably } from '../MessageList';
|
|
18
17
|
import { getChatContainerClass, useChannelContainerClasses, useImageFlagEmojisOnWindowsClass, } from './hooks/useChannelContainerClasses';
|
|
19
18
|
import { findInMsgSetByDate, findInMsgSetById, makeAddNotifications } from './utils';
|
|
@@ -48,10 +47,7 @@ const UnMemoizedChannel = (props) => {
|
|
|
48
47
|
return React.createElement(ChannelInner, { ...props, channel: channel, key: channel.cid });
|
|
49
48
|
};
|
|
50
49
|
const ChannelInner = (props) => {
|
|
51
|
-
const { activeUnreadHandler, allowConcurrentAudioPlayback, channel, channelQueryOptions
|
|
52
|
-
const channelQueryOptions = useMemo(() => defaultsDeep(propChannelQueryOptions, {
|
|
53
|
-
messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE },
|
|
54
|
-
}), [propChannelQueryOptions]);
|
|
50
|
+
const { activeUnreadHandler, allowConcurrentAudioPlayback, channel, channelQueryOptions, children, doDeleteMessageRequest, doMarkReadRequest, doSendMessageRequest, doUpdateMessageRequest, initializeOnMount = true, LoadingErrorIndicator = DefaultLoadingErrorIndicator, LoadingIndicator = DefaultLoadingIndicator, markReadOnMount = true, onMentionsClick, onMentionsHover, skipMessageDataMemoization, } = props;
|
|
55
51
|
const { client, customClasses, latestMessageDatesByChannels, mutes, searchController } = useChatContext('Channel');
|
|
56
52
|
const { t } = useTranslationContext('Channel');
|
|
57
53
|
const chatContainerClass = getChatContainerClass(customClasses?.chatContainer);
|
|
@@ -14,7 +14,7 @@ import { LoadingChannels } from '../Loading/LoadingChannels';
|
|
|
14
14
|
import { LoadMorePaginator } from '../LoadMore/LoadMorePaginator';
|
|
15
15
|
import { ChannelListContextProvider, useChatContext, useComponentContext, } from '../../context';
|
|
16
16
|
import { NullComponent } from '../UtilityComponents';
|
|
17
|
-
import {
|
|
17
|
+
import { moveChannelUpwards } from './utils';
|
|
18
18
|
const DEFAULT_FILTERS = {};
|
|
19
19
|
const DEFAULT_OPTIONS = {};
|
|
20
20
|
const DEFAULT_SORT = {};
|
|
@@ -35,8 +35,7 @@ const UnMemoizedChannelList = (props) => {
|
|
|
35
35
|
* If customActiveChannel prop is absent, then set the first channel in list as active channel.
|
|
36
36
|
*/
|
|
37
37
|
const activeChannelHandler = async (channels, setChannels) => {
|
|
38
|
-
if (!channels.length
|
|
39
|
-
channels.length > (options?.limit || MAX_QUERY_CHANNELS_LIMIT)) {
|
|
38
|
+
if (!channels.length) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
41
|
if (customActiveChannel) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import uniqBy from 'lodash.uniqby';
|
|
3
|
-
import { MAX_QUERY_CHANNELS_LIMIT } from '../utils';
|
|
4
3
|
import { useChatContext } from '../../../context/ChatContext';
|
|
5
|
-
import { DEFAULT_INITIAL_CHANNEL_PAGE_SIZE } from '../../../constants/limits';
|
|
6
4
|
const RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS = 5000;
|
|
7
5
|
const MIN_RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS = 2000;
|
|
8
6
|
export const usePaginatedChannels = (client, filters, sort, options, activeChannelHandler, recoveryThrottleIntervalMs = RECOVER_LOADED_CHANNELS_THROTTLE_INTERVAL_IN_MS, customQueryChannels) => {
|
|
@@ -35,8 +33,6 @@ export const usePaginatedChannels = (client, filters, sort, options, activeChann
|
|
|
35
33
|
else {
|
|
36
34
|
const offset = queryType === 'reload' ? 0 : channels.length;
|
|
37
35
|
const newOptions = {
|
|
38
|
-
limit: options?.limit ?? MAX_QUERY_CHANNELS_LIMIT,
|
|
39
|
-
message_limit: options?.message_limit ?? DEFAULT_INITIAL_CHANNEL_PAGE_SIZE,
|
|
40
36
|
offset,
|
|
41
37
|
...options,
|
|
42
38
|
};
|
|
@@ -45,7 +41,7 @@ export const usePaginatedChannels = (client, filters, sort, options, activeChann
|
|
|
45
41
|
? channelQueryResponse
|
|
46
42
|
: uniqBy([...channels, ...channelQueryResponse], 'cid');
|
|
47
43
|
setChannels(newChannels);
|
|
48
|
-
setHasNextPage(channelQueryResponse.length >= newOptions.limit);
|
|
44
|
+
setHasNextPage(channelQueryResponse.length >= (newOptions.limit ?? 1));
|
|
49
45
|
// Set active channel only on load of first page
|
|
50
46
|
if (!offset && activeChannelHandler) {
|
|
51
47
|
activeChannelHandler(newChannels, setChannels);
|
|
@@ -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.14.1";
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UpdatedMessage } from 'stream-chat';
|
|
3
2
|
export type SendButtonProps = {
|
|
4
|
-
sendMessage: (event: React.BaseSyntheticEvent
|
|
3
|
+
sendMessage: (event: React.BaseSyntheticEvent) => void;
|
|
5
4
|
} & React.ComponentProps<'button'>;
|
|
6
5
|
export declare const SendButton: ({ sendMessage, ...rest }: SendButtonProps) => React.JSX.Element;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { RecordingController } from '../../MediaRecorder/hooks/useMediaRecorder';
|
|
3
|
-
import type { UpdatedMessage } from 'stream-chat';
|
|
4
3
|
import type { MessageInputProps } from '../MessageInput';
|
|
5
4
|
export type MessageInputHookProps = {
|
|
6
|
-
handleSubmit: (event?: React.BaseSyntheticEvent
|
|
5
|
+
handleSubmit: (event?: React.BaseSyntheticEvent) => void;
|
|
7
6
|
onPaste: (event: React.ClipboardEvent<HTMLTextAreaElement>) => void;
|
|
8
7
|
recordingController: RecordingController;
|
|
9
8
|
textareaRef: React.MutableRefObject<HTMLTextAreaElement | null | undefined>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const DEFAULT_THREAD_PAGE_SIZE = 50;
|
|
1
|
+
export declare const DEFAULT_NEXT_CHANNEL_PAGE_SIZE = 25;
|
|
2
|
+
export declare const DEFAULT_JUMP_TO_PAGE_SIZE = 25;
|
|
3
|
+
export declare const DEFAULT_THREAD_PAGE_SIZE = 25;
|
|
5
4
|
export declare const DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
6
|
-
export declare const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES: number;
|
|
7
5
|
export declare const DEFAULT_HIGHLIGHT_DURATION = 500;
|
package/dist/constants/limits.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
4
|
-
export const DEFAULT_THREAD_PAGE_SIZE = 50;
|
|
1
|
+
export const DEFAULT_NEXT_CHANNEL_PAGE_SIZE = 25;
|
|
2
|
+
export const DEFAULT_JUMP_TO_PAGE_SIZE = 25;
|
|
3
|
+
export const DEFAULT_THREAD_PAGE_SIZE = 25;
|
|
5
4
|
export const DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
6
|
-
export const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024; // 100 MB
|
|
7
5
|
export const DEFAULT_HIGHLIGHT_DURATION = 500;
|
|
@@ -793,11 +793,6 @@ var import_clsx3 = __toESM(require("clsx"));
|
|
|
793
793
|
var import_react17 = __toESM(require("react"));
|
|
794
794
|
var import_clsx2 = __toESM(require("clsx"));
|
|
795
795
|
|
|
796
|
-
// src/constants/limits.ts
|
|
797
|
-
var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
|
|
798
|
-
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
799
|
-
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
800
|
-
|
|
801
796
|
// src/components/ChannelList/hooks/useSelectedChannelState.ts
|
|
802
797
|
var import_react15 = require("react");
|
|
803
798
|
var import_shim2 = require("use-sync-external-store/shim");
|
|
@@ -14452,6 +14447,12 @@ var ReactionSelectorWithButton = ({
|
|
|
14452
14447
|
var import_clsx8 = __toESM(require("clsx"));
|
|
14453
14448
|
var import_lodash = __toESM(require("lodash.debounce"));
|
|
14454
14449
|
var import_react32 = __toESM(require("react"));
|
|
14450
|
+
|
|
14451
|
+
// src/constants/limits.ts
|
|
14452
|
+
var DEFAULT_JUMP_TO_PAGE_SIZE = 25;
|
|
14453
|
+
var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
|
|
14454
|
+
|
|
14455
|
+
// src/components/InfiniteScrollPaginator/InfiniteScrollPaginator.tsx
|
|
14455
14456
|
var mousewheelListener = (event) => {
|
|
14456
14457
|
if (event instanceof WheelEvent && event.deltaY === 1) {
|
|
14457
14458
|
event.preventDefault();
|