stream-chat-react 12.15.8 → 12.16.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.
@@ -83,32 +83,31 @@ export class ReactTextareaAutocomplete extends React.Component<any, any, any> {
83
83
  }
84
84
  export namespace ReactTextareaAutocomplete {
85
85
  namespace propTypes {
86
- export let className: PropTypes.Requireable<string>;
87
- export let closeOnClickOutside: PropTypes.Requireable<boolean>;
88
- export let containerClassName: PropTypes.Requireable<string>;
89
- export let containerStyle: PropTypes.Requireable<object>;
90
- export let disableMentions: PropTypes.Requireable<boolean>;
91
- export let dropdownClassName: PropTypes.Requireable<string>;
92
- export let dropdownStyle: PropTypes.Requireable<object>;
93
- export let itemClassName: PropTypes.Requireable<string>;
94
- export let itemStyle: PropTypes.Requireable<object>;
95
- export let listClassName: PropTypes.Requireable<string>;
96
- export let listStyle: PropTypes.Requireable<object>;
97
- export let loaderClassName: PropTypes.Requireable<string>;
98
- export let loaderStyle: PropTypes.Requireable<object>;
99
- export let loadingComponent: PropTypes.Requireable<PropTypes.ReactComponentLike>;
100
- export let minChar: PropTypes.Requireable<number>;
101
- export let onBlur: PropTypes.Requireable<(...args: any[]) => any>;
102
- export let onCaretPositionChange: PropTypes.Requireable<(...args: any[]) => any>;
103
- export let onChange: PropTypes.Requireable<(...args: any[]) => any>;
104
- export let onSelect: PropTypes.Requireable<(...args: any[]) => any>;
105
- export let shouldSubmit: PropTypes.Requireable<(...args: any[]) => any>;
106
- export let style: PropTypes.Requireable<object>;
107
- export let SuggestionList: PropTypes.Requireable<PropTypes.ReactComponentLike>;
86
+ export let className: any;
87
+ export let closeOnClickOutside: any;
88
+ export let containerClassName: any;
89
+ export let containerStyle: any;
90
+ export let disableMentions: any;
91
+ export let dropdownClassName: any;
92
+ export let dropdownStyle: any;
93
+ export let itemClassName: any;
94
+ export let itemStyle: any;
95
+ export let listClassName: any;
96
+ export let listStyle: any;
97
+ export let loaderClassName: any;
98
+ export let loaderStyle: any;
99
+ export let loadingComponent: any;
100
+ export let minChar: any;
101
+ export let onBlur: any;
102
+ export let onCaretPositionChange: any;
103
+ export let onChange: any;
104
+ export let onSelect: any;
105
+ export let shouldSubmit: any;
106
+ export let style: any;
107
+ export let SuggestionList: any;
108
108
  export { triggerPropsCheck as trigger };
109
- export let value: PropTypes.Requireable<string>;
109
+ export let value: any;
110
110
  }
111
111
  }
112
112
  import React from 'react';
113
- import PropTypes from 'prop-types';
114
113
  import { triggerPropsCheck } from './utils';
@@ -1,6 +1,5 @@
1
1
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, } from 'react';
2
2
  import debounce from 'lodash.debounce';
3
- import defaultsDeep from 'lodash.defaultsdeep';
4
3
  import throttle from 'lodash.throttle';
5
4
  import { nanoid } from 'nanoid';
6
5
  import clsx from 'clsx';
@@ -15,7 +14,7 @@ import { LoadingChannel as DefaultLoadingIndicator } from './LoadingChannel';
15
14
  import { DropzoneProvider } from '../MessageInput/DropzoneProvider';
16
15
  import { ChannelActionProvider, ChannelStateProvider, TypingProvider, useChatContext, useTranslationContext, WithComponents, } from '../../context';
17
16
  import { CHANNEL_CONTAINER_ID } from './constants';
18
- import { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_INITIAL_CHANNEL_PAGE_SIZE, DEFAULT_JUMP_TO_PAGE_SIZE, DEFAULT_NEXT_CHANNEL_PAGE_SIZE, DEFAULT_THREAD_PAGE_SIZE, } from '../../constants/limits';
17
+ import { DEFAULT_HIGHLIGHT_DURATION, DEFAULT_JUMP_TO_PAGE_SIZE, DEFAULT_NEXT_CHANNEL_PAGE_SIZE, DEFAULT_THREAD_PAGE_SIZE, } from '../../constants/limits';
19
18
  import { hasMoreMessagesProbably } from '../MessageList';
20
19
  import { getChatContainerClass, useChannelContainerClasses, useImageFlagEmojisOnWindowsClass, } from './hooks/useChannelContainerClasses';
21
20
  import { findInMsgSetByDate, findInMsgSetById, makeAddNotifications } from './utils';
@@ -50,10 +49,7 @@ const UnMemoizedChannel = (props) => {
50
49
  return React.createElement(ChannelInner, { ...props, channel: channel, key: channel.cid });
51
50
  };
52
51
  const ChannelInner = (props) => {
53
- const { acceptedFiles, activeUnreadHandler, channel, channelQueryOptions: propChannelQueryOptions, children, doDeleteMessageRequest, doMarkReadRequest, doSendMessageRequest, doUpdateMessageRequest, dragAndDropWindow = false, enrichURLForPreviewConfig, initializeOnMount = true, LoadingErrorIndicator = DefaultLoadingErrorIndicator, LoadingIndicator = DefaultLoadingIndicator, markReadOnMount = true, maxNumberOfFiles, multipleUploads = true, onMentionsClick, onMentionsHover, optionalMessageInputProps = {}, skipMessageDataMemoization, } = props;
54
- const channelQueryOptions = useMemo(() => defaultsDeep(propChannelQueryOptions, {
55
- messages: { limit: DEFAULT_INITIAL_CHANNEL_PAGE_SIZE },
56
- }), [propChannelQueryOptions]);
52
+ const { acceptedFiles, activeUnreadHandler, channel, channelQueryOptions, children, doDeleteMessageRequest, doMarkReadRequest, doSendMessageRequest, doUpdateMessageRequest, dragAndDropWindow = false, enrichURLForPreviewConfig, initializeOnMount = true, LoadingErrorIndicator = DefaultLoadingErrorIndicator, LoadingIndicator = DefaultLoadingIndicator, markReadOnMount = true, maxNumberOfFiles, multipleUploads = true, onMentionsClick, onMentionsHover, optionalMessageInputProps = {}, skipMessageDataMemoization, } = props;
57
53
  const { client, customClasses, latestMessageDatesByChannels, mutes, searchController } = useChatContext('Channel');
58
54
  const { t } = useTranslationContext('Channel');
59
55
  const chatContainerClass = getChatContainerClass(customClasses?.chatContainer);
@@ -5,7 +5,7 @@ import { useConnectionRecoveredListener } from './hooks/useConnectionRecoveredLi
5
5
  import { useMobileNavigation } from './hooks/useMobileNavigation';
6
6
  import { usePaginatedChannels, } from './hooks/usePaginatedChannels';
7
7
  import { useChannelListShape, usePrepareShapeHandlers, } from './hooks/useChannelListShape';
8
- import { MAX_QUERY_CHANNELS_LIMIT, moveChannelUpwards } from './utils';
8
+ import { moveChannelUpwards } from './utils';
9
9
  import { Avatar as DefaultAvatar } from '../Avatar';
10
10
  import { ChannelPreview, } from '../ChannelPreview/ChannelPreview';
11
11
  import { ChannelSearch as DefaultChannelSearch, } from '../ChannelSearch/ChannelSearch';
@@ -36,8 +36,7 @@ const UnMemoizedChannelList = (props) => {
36
36
  * If customActiveChannel prop is absent, then set the first channel in list as active channel.
37
37
  */
38
38
  const activeChannelHandler = async (channels, setChannels) => {
39
- if (!channels.length ||
40
- channels.length > (options?.limit || MAX_QUERY_CHANNELS_LIMIT)) {
39
+ if (!channels.length) {
41
40
  return;
42
41
  }
43
42
  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);
@@ -1,7 +1,6 @@
1
1
  import type { Channel, ChannelSort, ChannelSortBase, ExtendableGenerics } from 'stream-chat';
2
2
  import type { DefaultStreamChatGenerics } from '../../types/types';
3
3
  import type { ChannelListProps } from './ChannelList';
4
- export declare const MAX_QUERY_CHANNELS_LIMIT = 30;
5
4
  type MoveChannelUpParams<SCG extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
6
5
  channels: Array<Channel<SCG>>;
7
6
  cid: string;
@@ -40,7 +39,7 @@ export declare const extractSortValue: <SCG extends ExtendableGenerics>({ atInde
40
39
  atIndex: number;
41
40
  targetKey: keyof ChannelSortBase<SCG>;
42
41
  sort?: ChannelListProps<SCG>['sort'];
43
- }) => NonNullable<ChannelSortBase<SCG>["created_at" | "pinned_at" | "updated_at" | keyof SCG["channelType"] | "has_unread" | "last_message_at" | "last_updated" | "member_count" | "unread_count"]> | null;
42
+ }) => NonNullable<ChannelSortBase<SCG>["created_at" | "pinned_at" | "updated_at" | "last_message_at" | "member_count" | keyof SCG["channelType"] | "has_unread" | "last_updated" | "unread_count"]> | null;
44
43
  /**
45
44
  * Returns `true` only if `archived` property is of type `boolean` within `filters` object.
46
45
  */
@@ -1,5 +1,4 @@
1
1
  import uniqBy from 'lodash.uniqby';
2
- export const MAX_QUERY_CHANNELS_LIMIT = 30;
3
2
  /**
4
3
  * @deprecated
5
4
  */
@@ -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 = "12.15.8";
27
+ const version = "12.16.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'
@@ -19,7 +19,5 @@ export const ModalGallery = (props) => {
19
19
  source: imageSrc,
20
20
  };
21
21
  }), [images, t]);
22
- return (
23
- // @ts-expect-error ignore the TS error as react-image-gallery was on @types/react@18 while stream-chat-react being upgraded to React 19 (https://github.com/xiaolin/react-image-gallery/issues/809)
24
- React.createElement(ImageGallery, { items: formattedArray, renderItem: renderItem, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
22
+ return (React.createElement(ImageGallery, { items: formattedArray, renderItem: renderItem, showIndex: true, showPlayButton: false, showThumbnails: false, startIndex: index }));
25
23
  };
@@ -1,4 +1,4 @@
1
- import React, { ComponentType } from 'react';
1
+ import { ComponentType, JSX } from 'react';
2
2
  import { MentionProps } from './componentRenderers';
3
3
  import type { Options } from 'react-markdown/lib';
4
4
  import type { UserResponse } from 'stream-chat';
@@ -16,4 +16,4 @@ export type RenderTextOptions<StreamChatGenerics extends DefaultStreamChatGeneri
16
16
  getRehypePlugins?: RenderTextPluginConfigurator;
17
17
  getRemarkPlugins?: RenderTextPluginConfigurator;
18
18
  };
19
- export declare const renderText: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(text?: string, mentionedUsers?: UserResponse<StreamChatGenerics>[], { allowedTagNames, customMarkDownRenderers, getRehypePlugins, getRemarkPlugins, }?: RenderTextOptions) => React.JSX.Element | null;
19
+ export declare const renderText: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(text?: string, mentionedUsers?: UserResponse<StreamChatGenerics>[], { allowedTagNames, customMarkDownRenderers, getRehypePlugins, getRemarkPlugins, }?: RenderTextOptions) => JSX.Element | null;
@@ -1,7 +1,6 @@
1
- export declare const DEFAULT_INITIAL_CHANNEL_PAGE_SIZE = 25;
2
- export declare const DEFAULT_NEXT_CHANNEL_PAGE_SIZE = 100;
3
- export declare const DEFAULT_JUMP_TO_PAGE_SIZE = 100;
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
5
  export declare const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES: number;
7
6
  export declare const DEFAULT_HIGHLIGHT_DURATION = 500;
@@ -1,7 +1,6 @@
1
- export const DEFAULT_INITIAL_CHANNEL_PAGE_SIZE = 25;
2
- export const DEFAULT_NEXT_CHANNEL_PAGE_SIZE = 100;
3
- export const DEFAULT_JUMP_TO_PAGE_SIZE = 100;
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
5
  export const DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024; // 100 MB
7
6
  export const DEFAULT_HIGHLIGHT_DURATION = 500;
@@ -513,7 +513,7 @@ var useMessageContext = (_componentName) => {
513
513
  };
514
514
 
515
515
  // src/constants/limits.ts
516
- var DEFAULT_JUMP_TO_PAGE_SIZE = 100;
516
+ var DEFAULT_JUMP_TO_PAGE_SIZE = 25;
517
517
  var DEFAULT_LOAD_PAGE_SCROLL_THRESHOLD = 250;
518
518
  var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
519
519