stream-chat-react 12.13.0 → 12.14.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/README.md +27 -30
- package/dist/components/Channel/Channel.d.ts +1 -1
- package/dist/components/Channel/Channel.js +6 -4
- package/dist/components/Chat/hooks/useChat.js +2 -1
- package/dist/components/Message/MessageBlocked.d.ts +2 -0
- package/dist/components/Message/MessageBlocked.js +16 -0
- package/dist/components/Message/MessageSimple.js +6 -2
- package/dist/components/Message/utils.d.ts +1 -0
- package/dist/components/Message/utils.js +3 -0
- package/dist/context/ComponentContext.d.ts +2 -0
- package/dist/css/v2/emoji-mart.css +1 -1
- package/dist/css/v2/index.css +1 -3
- package/dist/css/v2/index.layout.css +1 -3
- package/dist/experimental/index.browser.cjs.map +2 -2
- package/dist/experimental/index.node.cjs.map +2 -2
- package/dist/i18n/Streami18n.d.ts +1 -0
- package/dist/i18n/de.json +1 -0
- package/dist/i18n/en.json +1 -0
- package/dist/i18n/es.json +1 -0
- package/dist/i18n/fr.json +1 -0
- package/dist/i18n/hi.json +1 -0
- package/dist/i18n/it.json +1 -0
- package/dist/i18n/ja.json +1 -0
- package/dist/i18n/ko.json +1 -0
- package/dist/i18n/nl.json +1 -0
- package/dist/i18n/pt.json +1 -0
- package/dist/i18n/ru.json +1 -0
- package/dist/i18n/tr.json +1 -0
- package/dist/index.browser.cjs +1099 -1052
- package/dist/index.browser.cjs.map +4 -4
- package/dist/index.node.cjs +1013 -965
- package/dist/index.node.cjs.map +4 -4
- package/dist/scss/v2/Channel/Channel-layout.scss +2 -1
- package/dist/scss/v2/Message/Message-layout.scss +8 -0
- package/dist/scss/v2/Message/Message-theme.scss +29 -0
- package/dist/scss/v2/vendor/react-image-gallery.scss +3 -1
- package/package.json +8 -11
package/README.md
CHANGED
|
@@ -42,46 +42,35 @@ For complete pricing and details visit our [Chat Pricing Page](https://getstream
|
|
|
42
42
|
|
|
43
43
|
## Installation
|
|
44
44
|
|
|
45
|
-
###
|
|
45
|
+
### With NPM
|
|
46
46
|
|
|
47
|
-
`npm install
|
|
47
|
+
`npm install stream-chat stream-chat-react`
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### With Yarn
|
|
50
50
|
|
|
51
|
-
`yarn add
|
|
51
|
+
`yarn add stream-chat stream-chat-react`
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/react@16.13.1/umd/react.production.min.js"></script>
|
|
57
|
-
<script src="https://cdn.jsdelivr.net/npm/react-dom@16/umd/react-dom.production.min.js"></script>
|
|
58
|
-
<script src="https://cdn.jsdelivr.net/npm/stream-chat"></script>
|
|
59
|
-
<script src="https://cdn.jsdelivr.net/npm/stream-chat-react"></script>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Example Apps
|
|
53
|
+
## Example Applications
|
|
63
54
|
|
|
64
55
|
We have built five demo applications showcasing a variety of chat use cases, including social messaging, team collaboration, customer support, livestream gaming, and virtual event. You can preview these [demos](https://getstream.io/chat/demos/) on our website. Also, the code is [open source](https://github.com/GetStream/website-react-examples/).
|
|
65
56
|
|
|
66
|
-
##
|
|
57
|
+
## Documentation
|
|
67
58
|
|
|
68
59
|
We use a doc generator to build our [component documentation](https://getstream.io/chat/docs/sdk/react/). We provide a brief description of each chat component and define all of the props it accepts.
|
|
69
60
|
|
|
70
|
-
The React components are created using the [stream-chat
|
|
71
|
-
|
|
72
|
-
## TypeScript Support
|
|
61
|
+
The React components are created using the [stream-chat](https://github.com/getstream/stream-chat-js) library. If you're customizing the components, it's likely you'll need to make additional calls to our Chat API using our JavaScript client, which has [documentation](https://getstream.io/chat/docs/javascript/) on our website.
|
|
73
62
|
|
|
74
|
-
|
|
63
|
+
## Component Reusability
|
|
75
64
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
For components that implement significant logic, it's helpful to split the component into two parts: a top-level component which handles functionality and a lower level component which renders the UI. This way you can swap UI without altering the logic that gives the component its functionality. We use this provider/consumer pattern frequently in the library, and the below example shows how to swap out the `Message` UI component with `MessageTeam`, without affecting any logic in the app.
|
|
65
|
+
For components that implement significant logic, it's helpful to split the component into two parts: a top-level component which handles functionality and a lower level component which renders the UI. This way you can swap UI without altering the logic that gives the component its functionality. We use this provider/consumer pattern frequently in the library, and the below example shows how to swap out the `Message` UI component with `CustomMessageUI` (using `WithComponents`), without affecting any logic in the application.
|
|
79
66
|
|
|
80
67
|
```jsx
|
|
81
|
-
<Channel
|
|
68
|
+
<Channel>
|
|
82
69
|
<Window>
|
|
83
70
|
<ChannelHeader />
|
|
84
|
-
<
|
|
71
|
+
<WithComponents overrides={{ Message: CustomMessageUI }}>
|
|
72
|
+
<MessageList />
|
|
73
|
+
</WithComponents>
|
|
85
74
|
<MessageInput />
|
|
86
75
|
</Window>
|
|
87
76
|
<Thread />
|
|
@@ -90,11 +79,18 @@ For components that implement significant logic, it's helpful to split the compo
|
|
|
90
79
|
|
|
91
80
|
### Customizing Styles
|
|
92
81
|
|
|
93
|
-
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into
|
|
82
|
+
The preferred method for overriding the pre-defined styles in the library is to two-step process. First, import our bundled CSS into your main CSS file (or CSS file loaded with your chat application). Second, locate any Stream styles you want to override using either the browser inspector or by viewing the library code. You can then add selectors to your local CSS file to override our defaults (ideally within the stream-overrides layer). Layers (when ordered correctly, see example) ensure that your overrides take precedence even if your overriding selectors are less specific. For example:
|
|
83
|
+
|
|
84
|
+
```css title="index.css"
|
|
85
|
+
@layer stream, stream-overrides;
|
|
94
86
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
import '
|
|
87
|
+
@import 'stream-chat-react/css/v2/index.css' layer(stream);
|
|
88
|
+
/* or */
|
|
89
|
+
@import 'stream-chat-react/dist/css/v2/index.css' layer(stream);
|
|
90
|
+
|
|
91
|
+
@layer stream-overrides {
|
|
92
|
+
/* your overrides */
|
|
93
|
+
}
|
|
98
94
|
```
|
|
99
95
|
|
|
100
96
|
## Internationalization
|
|
@@ -106,6 +102,7 @@ Our library supports auto-translation for various user languages. Please read ou
|
|
|
106
102
|
We welcome code changes that improve this library or fix a problem. Please make sure to follow all best practices and add tests, if applicable, before submitting a pull request on GitHub. We are pleased to merge your code into the official repository if it meets a need. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details.
|
|
107
103
|
|
|
108
104
|
## We are hiring!
|
|
105
|
+
|
|
109
106
|
We recently closed a [$38 million Series B funding round](https://techcrunch.com/2021/03/04/stream-raises-38m-as-its-chat-and-activity-feed-apis-power-communications-for-1b-users/) and are actively growing.
|
|
110
107
|
Our APIs are used by more than a billion end-users, and by working at Stream, you have the chance to make a huge impact on a team of very strong engineers.
|
|
111
108
|
|
|
@@ -113,10 +110,10 @@ Check out our current openings and apply via [Stream's website](https://getstrea
|
|
|
113
110
|
|
|
114
111
|
## Acknowledgements
|
|
115
112
|
|
|
116
|
-
###
|
|
113
|
+
### lamejs
|
|
117
114
|
|
|
118
115
|
This project uses `lamejs` library under the LGPL license to convert the recorded audio to mp3 format.
|
|
119
116
|
The library source code is dynamically imported and used only if audio recording is enabled.
|
|
120
117
|
|
|
121
118
|
You can obtain the source code for `lamejs` from the [lamejs repository](https://github.com/gideonstele/lamejs) that is a fork of [the original JS library](https://github.com/zhuker/lamejs).
|
|
122
|
-
You can find the source code for LAME at https://lame.sourceforge.net
|
|
119
|
+
You can find the source code for LAME at https://lame.sourceforge.net and its license at: https://lame.sourceforge.net/license.txt
|
|
@@ -6,7 +6,7 @@ import type { ChannelQueryOptions, EventAPIResponse, Message, MessageResponse, C
|
|
|
6
6
|
import type { MessageInputProps } from '../MessageInput';
|
|
7
7
|
import type { ChannelUnreadUiState, CustomTrigger, DefaultStreamChatGenerics, GiphyVersions, ImageAttachmentSizeHandler, SendMessageOptions, UpdateMessageOptions, VideoAttachmentSizeHandler } from '../../types/types';
|
|
8
8
|
import type { URLEnrichmentConfig } from '../MessageInput/hooks/useLinkPreviews';
|
|
9
|
-
type ChannelPropsForwardedToComponentContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ComponentContextValue<StreamChatGenerics>, 'Attachment' | 'AttachmentPreviewList' | 'AttachmentSelector' | 'AttachmentSelectorInitiationButtonContents' | 'AudioRecorder' | 'AutocompleteSuggestionItem' | 'AutocompleteSuggestionList' | 'Avatar' | 'BaseImage' | 'CooldownTimer' | 'CustomMessageActionsList' | 'DateSeparator' | 'EditMessageInput' | 'EmojiPicker' | 'emojiSearchIndex' | 'EmptyStateIndicator' | 'FileUploadIcon' | 'GiphyPreviewMessage' | 'HeaderComponent' | 'Input' | 'LinkPreviewList' | 'LoadingIndicator' | 'Message' | 'MessageActions' | 'MessageBouncePrompt' | 'MessageDeleted' | 'MessageListNotifications' | 'MessageListMainPanel' | 'MessageNotification' | 'MessageOptions' | 'MessageRepliesCountButton' | 'MessageStatus' | 'MessageSystem' | 'MessageTimestamp' | 'ModalGallery' | 'PinIndicator' | 'PollActions' | 'PollContent' | 'PollCreationDialog' | 'PollHeader' | 'PollOptionSelector' | 'QuotedMessage' | 'QuotedMessagePreview' | 'QuotedPoll' | 'reactionOptions' | 'ReactionSelector' | 'ReactionsList' | 'ReactionsListModal' | 'SendButton' | 'StartRecordingAudioButton' | 'ThreadHead' | 'ThreadHeader' | 'ThreadStart' | 'Timestamp' | 'TriggerProvider' | 'TypingIndicator' | 'UnreadMessagesNotification' | 'UnreadMessagesSeparator' | 'VirtualMessage' | 'StopAIGenerationButton' | 'StreamedMessageText'>;
|
|
9
|
+
type ChannelPropsForwardedToComponentContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ComponentContextValue<StreamChatGenerics>, 'Attachment' | 'AttachmentPreviewList' | 'AttachmentSelector' | 'AttachmentSelectorInitiationButtonContents' | 'AudioRecorder' | 'AutocompleteSuggestionItem' | 'AutocompleteSuggestionList' | 'Avatar' | 'BaseImage' | 'CooldownTimer' | 'CustomMessageActionsList' | 'DateSeparator' | 'EditMessageInput' | 'EmojiPicker' | 'emojiSearchIndex' | 'EmptyStateIndicator' | 'FileUploadIcon' | 'GiphyPreviewMessage' | 'HeaderComponent' | 'Input' | 'LinkPreviewList' | 'LoadingIndicator' | 'Message' | 'MessageActions' | 'MessageBouncePrompt' | 'MessageBlocked' | 'MessageDeleted' | 'MessageListNotifications' | 'MessageListMainPanel' | 'MessageNotification' | 'MessageOptions' | 'MessageRepliesCountButton' | 'MessageStatus' | 'MessageSystem' | 'MessageTimestamp' | 'ModalGallery' | 'PinIndicator' | 'PollActions' | 'PollContent' | 'PollCreationDialog' | 'PollHeader' | 'PollOptionSelector' | 'QuotedMessage' | 'QuotedMessagePreview' | 'QuotedPoll' | 'reactionOptions' | 'ReactionSelector' | 'ReactionsList' | 'ReactionsListModal' | 'SendButton' | 'StartRecordingAudioButton' | 'ThreadHead' | 'ThreadHeader' | 'ThreadStart' | 'Timestamp' | 'TriggerProvider' | 'TypingIndicator' | 'UnreadMessagesNotification' | 'UnreadMessagesSeparator' | 'VirtualMessage' | 'StopAIGenerationButton' | 'StreamedMessageText'>;
|
|
10
10
|
export type ChannelProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics, V extends CustomTrigger = CustomTrigger> = ChannelPropsForwardedToComponentContext<StreamChatGenerics> & {
|
|
11
11
|
/** List of accepted file types */
|
|
12
12
|
acceptedFiles?: string[];
|
|
@@ -787,6 +787,7 @@ const ChannelInner = (props) => {
|
|
|
787
787
|
LoadingIndicator: props.LoadingIndicator,
|
|
788
788
|
Message: props.Message,
|
|
789
789
|
MessageActions: props.MessageActions,
|
|
790
|
+
MessageBlocked: props.MessageBlocked,
|
|
790
791
|
MessageBouncePrompt: props.MessageBouncePrompt,
|
|
791
792
|
MessageDeleted: props.MessageDeleted,
|
|
792
793
|
MessageListNotifications: props.MessageListNotifications,
|
|
@@ -838,6 +839,7 @@ const ChannelInner = (props) => {
|
|
|
838
839
|
props.DateSeparator,
|
|
839
840
|
props.EditMessageInput,
|
|
840
841
|
props.EmojiPicker,
|
|
842
|
+
props.emojiSearchIndex,
|
|
841
843
|
props.EmptyStateIndicator,
|
|
842
844
|
props.FileUploadIcon,
|
|
843
845
|
props.GiphyPreviewMessage,
|
|
@@ -847,6 +849,7 @@ const ChannelInner = (props) => {
|
|
|
847
849
|
props.LoadingIndicator,
|
|
848
850
|
props.Message,
|
|
849
851
|
props.MessageActions,
|
|
852
|
+
props.MessageBlocked,
|
|
850
853
|
props.MessageBouncePrompt,
|
|
851
854
|
props.MessageDeleted,
|
|
852
855
|
props.MessageListNotifications,
|
|
@@ -866,11 +869,14 @@ const ChannelInner = (props) => {
|
|
|
866
869
|
props.QuotedMessage,
|
|
867
870
|
props.QuotedMessagePreview,
|
|
868
871
|
props.QuotedPoll,
|
|
872
|
+
props.reactionOptions,
|
|
869
873
|
props.ReactionSelector,
|
|
870
874
|
props.ReactionsList,
|
|
871
875
|
props.ReactionsListModal,
|
|
872
876
|
props.SendButton,
|
|
873
877
|
props.StartRecordingAudioButton,
|
|
878
|
+
props.StopAIGenerationButton,
|
|
879
|
+
props.StreamedMessageText,
|
|
874
880
|
props.ThreadHead,
|
|
875
881
|
props.ThreadHeader,
|
|
876
882
|
props.ThreadStart,
|
|
@@ -880,10 +886,6 @@ const ChannelInner = (props) => {
|
|
|
880
886
|
props.UnreadMessagesNotification,
|
|
881
887
|
props.UnreadMessagesSeparator,
|
|
882
888
|
props.VirtualMessage,
|
|
883
|
-
props.StopAIGenerationButton,
|
|
884
|
-
props.StreamedMessageText,
|
|
885
|
-
props.emojiSearchIndex,
|
|
886
|
-
props.reactionOptions,
|
|
887
889
|
]);
|
|
888
890
|
const typingContextValue = useCreateTypingContext({
|
|
889
891
|
typing,
|
|
@@ -24,11 +24,12 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
+
const version = "12.14.0";
|
|
27
28
|
const userAgent = client.getUserAgent();
|
|
28
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
29
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
30
31
|
// the upper-case text between double underscores is replaced with the actual semantic version of the library
|
|
31
|
-
client.setUserAgent(`stream-chat-react
|
|
32
|
+
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|
|
32
33
|
}
|
|
33
34
|
client.threads.registerSubscriptions();
|
|
34
35
|
client.polls.registerSubscriptions();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useUserRole } from './hooks/useUserRole';
|
|
4
|
+
import { useTranslationContext } from '../../context/TranslationContext';
|
|
5
|
+
import { useMessageContext } from '../../context';
|
|
6
|
+
export const MessageBlocked = () => {
|
|
7
|
+
const { message } = useMessageContext();
|
|
8
|
+
const { t } = useTranslationContext('MessageBlocked');
|
|
9
|
+
const { isMyMessage } = useUserRole(message);
|
|
10
|
+
const messageClasses = clsx('str-chat__message str-chat__message-simple str-chat__message--blocked', message.type, {
|
|
11
|
+
'str-chat__message--me str-chat__message-simple--me': isMyMessage,
|
|
12
|
+
'str-chat__message--other': !isMyMessage,
|
|
13
|
+
});
|
|
14
|
+
return (React.createElement("div", { className: messageClasses, "data-testid": 'message-blocked-component', key: message.id },
|
|
15
|
+
React.createElement("div", { className: 'str-chat__message--blocked-inner' }, t('Message was blocked by moderation policies'))));
|
|
16
|
+
};
|
|
@@ -3,12 +3,13 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { MessageErrorIcon } from './icons';
|
|
4
4
|
import { MessageBouncePrompt as DefaultMessageBouncePrompt } from '../MessageBounce';
|
|
5
5
|
import { MessageDeleted as DefaultMessageDeleted } from './MessageDeleted';
|
|
6
|
+
import { MessageBlocked as DefaultMessageBlocked } from './MessageBlocked';
|
|
6
7
|
import { MessageOptions as DefaultMessageOptions } from './MessageOptions';
|
|
7
8
|
import { MessageRepliesCountButton as DefaultMessageRepliesCountButton } from './MessageRepliesCountButton';
|
|
8
9
|
import { MessageStatus as DefaultMessageStatus } from './MessageStatus';
|
|
9
10
|
import { MessageText } from './MessageText';
|
|
10
11
|
import { MessageTimestamp as DefaultMessageTimestamp } from './MessageTimestamp';
|
|
11
|
-
import { areMessageUIPropsEqual, isMessageBounced, isMessageEdited, messageHasAttachments, messageHasReactions, } from './utils';
|
|
12
|
+
import { areMessageUIPropsEqual, isMessageBlocked, isMessageBounced, isMessageEdited, messageHasAttachments, messageHasReactions, } from './utils';
|
|
12
13
|
import { Avatar as DefaultAvatar } from '../Avatar';
|
|
13
14
|
import { Attachment as DefaultAttachment } from '../Attachment';
|
|
14
15
|
import { CUSTOM_MESSAGE_TYPE } from '../../constants/messageTypes';
|
|
@@ -32,7 +33,7 @@ const MessageSimpleWithContext = (props) => {
|
|
|
32
33
|
const { Attachment = DefaultAttachment, Avatar = DefaultAvatar, EditMessageInput = DefaultEditMessageForm, MessageOptions = DefaultMessageOptions,
|
|
33
34
|
// TODO: remove this "passthrough" in the next
|
|
34
35
|
// major release and use the new default instead
|
|
35
|
-
MessageActions = MessageOptions, MessageDeleted = DefaultMessageDeleted, MessageBouncePrompt = DefaultMessageBouncePrompt, MessageRepliesCountButton = DefaultMessageRepliesCountButton, MessageStatus = DefaultMessageStatus, MessageTimestamp = DefaultMessageTimestamp, ReactionsList = DefaultReactionList, StreamedMessageText = DefaultStreamedMessageText, PinIndicator, } = useComponentContext('MessageSimple');
|
|
36
|
+
MessageActions = MessageOptions, MessageBlocked = DefaultMessageBlocked, MessageDeleted = DefaultMessageDeleted, MessageBouncePrompt = DefaultMessageBouncePrompt, MessageRepliesCountButton = DefaultMessageRepliesCountButton, MessageStatus = DefaultMessageStatus, MessageTimestamp = DefaultMessageTimestamp, ReactionsList = DefaultReactionList, StreamedMessageText = DefaultStreamedMessageText, PinIndicator, } = useComponentContext('MessageSimple');
|
|
36
37
|
const hasAttachment = messageHasAttachments(message);
|
|
37
38
|
const hasReactions = messageHasReactions(message);
|
|
38
39
|
const isAIGenerated = useMemo(() => isMessageAIGenerated?.(message), [isMessageAIGenerated, message]);
|
|
@@ -42,6 +43,9 @@ const MessageSimpleWithContext = (props) => {
|
|
|
42
43
|
if (message.deleted_at || message.type === 'deleted') {
|
|
43
44
|
return React.createElement(MessageDeleted, { message: message });
|
|
44
45
|
}
|
|
46
|
+
if (isMessageBlocked(message)) {
|
|
47
|
+
return React.createElement(MessageBlocked, null);
|
|
48
|
+
}
|
|
45
49
|
const showMetadata = !groupedByUser || endOfGroup;
|
|
46
50
|
const showReplyCountButton = !threadList && !!message.reply_count;
|
|
47
51
|
const allowRetry = message.status === 'failed' && message.errorStatusCode !== 403;
|
|
@@ -77,4 +77,5 @@ export declare const mapToUserNameOrId: TooltipUsernameMapper;
|
|
|
77
77
|
export declare const getReadByTooltipText: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(users: UserResponse<StreamChatGenerics>[], t: TFunction, client: StreamChat<StreamChatGenerics>, tooltipUserNameMapper: TooltipUsernameMapper) => string;
|
|
78
78
|
export declare const isOnlyEmojis: (text?: string) => boolean;
|
|
79
79
|
export declare const isMessageBounced: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(message: Pick<StreamMessage<StreamChatGenerics>, 'type' | 'moderation' | 'moderation_details'>) => boolean;
|
|
80
|
+
export declare const isMessageBlocked: (message: Pick<StreamMessage, 'type' | 'moderation' | 'moderation_details'>) => boolean;
|
|
80
81
|
export declare const isMessageEdited: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(message: Pick<StreamMessage<StreamChatGenerics>, 'message_text_updated_at'>) => boolean;
|
|
@@ -310,4 +310,7 @@ export const isOnlyEmojis = (text) => {
|
|
|
310
310
|
export const isMessageBounced = (message) => message.type === 'error' &&
|
|
311
311
|
(message.moderation_details?.action === 'MESSAGE_RESPONSE_ACTION_BOUNCE' ||
|
|
312
312
|
message.moderation?.action === 'bounce');
|
|
313
|
+
export const isMessageBlocked = (message) => message.type === 'error' &&
|
|
314
|
+
(message.moderation_details?.action === 'MESSAGE_RESPONSE_ACTION_REMOVE' ||
|
|
315
|
+
message.moderation?.action === 'remove');
|
|
313
316
|
export const isMessageEdited = (message) => !!message.message_text_updated_at;
|
|
@@ -59,6 +59,8 @@ export type ComponentContextValue<StreamChatGenerics extends DefaultStreamChatGe
|
|
|
59
59
|
MessageActions?: React.ComponentType;
|
|
60
60
|
/** Custom UI component to display the contents of a bounced message modal. Usually it allows to retry, edit, or delete the message. Defaults to and accepts the same props as: [MessageBouncePrompt](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageBounce/MessageBouncePrompt.tsx) */
|
|
61
61
|
MessageBouncePrompt?: React.ComponentType<MessageBouncePromptProps>;
|
|
62
|
+
/** Custom UI component for a moderation-blocked message, defaults to and accepts same props as: [MessageBlocked](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageBlocked.tsx) */
|
|
63
|
+
MessageBlocked?: React.ComponentType;
|
|
62
64
|
/** Custom UI component for a deleted message, defaults to and accepts same props as: [MessageDeleted](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/MessageDeleted.tsx) */
|
|
63
65
|
MessageDeleted?: React.ComponentType<MessageDeletedProps<StreamChatGenerics>>;
|
|
64
66
|
MessageListMainPanel?: React.ComponentType<PropsWithChildrenOnly>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.emoji-mart,.emoji-mart *{box-sizing:border-box;line-height:1.15}.emoji-mart{font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue",sans-serif;font-size:16px;display:inline-block;color:#222427;border:1px solid #d9d9d9;border-radius:5px;background:#fff}.emoji-mart .emoji-mart-emoji{padding:6px}.emoji-mart-bar{border:0 solid #d9d9d9}.emoji-mart-bar:first-child{border-bottom-width:1px;border-top-left-radius:5px;border-top-right-radius:5px}.emoji-mart-bar:last-child{border-top-width:1px;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.emoji-mart-anchors{display:flex;flex-direction:row;justify-content:space-between;padding:0 6px;line-height:0}.emoji-mart-anchor{position:relative;display:block;flex:1 1 auto;color:#858585;text-align:center;padding:12px 4px;overflow:hidden;transition:color .1s ease-out;margin:0;box-shadow:none;background:none;border:none}.emoji-mart-anchor:focus{outline:0}.emoji-mart-anchor:hover,.emoji-mart-anchor:focus,.emoji-mart-anchor-selected{color:#464646}.emoji-mart-anchor-selected .emoji-mart-anchor-bar{bottom:0}.emoji-mart-anchor-bar{position:absolute;bottom:-3px;left:0;width:100%;height:3px;background-color:#464646}.emoji-mart-anchors i{display:inline-block;width:100%;max-width:22px}.emoji-mart-anchors svg,.emoji-mart-anchors img{fill:currentColor;height:18px;width:18px}.emoji-mart-scroll{overflow-y:scroll;overflow-x:hidden;height:270px;padding:0 6px 6px;will-change:transform}.emoji-mart-search{margin-top:6px;padding:0 6px;position:relative}.emoji-mart-search input{font-size:16px;display:block;width:100%;padding:5px 25px 6px 10px;border-radius:5px;border:1px solid #d9d9d9;outline:0}.emoji-mart-search input,.emoji-mart-search input::-webkit-search-decoration,.emoji-mart-search input::-webkit-search-cancel-button,.emoji-mart-search input::-webkit-search-results-button,.emoji-mart-search input::-webkit-search-results-decoration{-webkit-appearance:none}.emoji-mart-search-icon{position:absolute;top:7px;right:11px;z-index:2;padding:2px 5px 1px;border:none;background:none}.emoji-mart-category .emoji-mart-emoji span{z-index:1;position:relative;text-align:center;cursor:default}.emoji-mart-category .emoji-mart-emoji:hover::before{z-index:0;content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f4f4f4;border-radius:100%}.emoji-mart-category-label{z-index:2;position:relative;position:-webkit-sticky;position:sticky;top:0}.emoji-mart-category-label span{display:block;width:100%;font-weight:500;padding:5px 6px;background-color:#fff;background-color:
|
|
1
|
+
.emoji-mart,.emoji-mart *{box-sizing:border-box;line-height:1.15}.emoji-mart{font-family:-apple-system,BlinkMacSystemFont,"Helvetica Neue",sans-serif;font-size:16px;display:inline-block;color:#222427;border:1px solid #d9d9d9;border-radius:5px;background:#fff}.emoji-mart .emoji-mart-emoji{padding:6px}.emoji-mart-bar{border:0 solid #d9d9d9}.emoji-mart-bar:first-child{border-bottom-width:1px;border-top-left-radius:5px;border-top-right-radius:5px}.emoji-mart-bar:last-child{border-top-width:1px;border-bottom-left-radius:5px;border-bottom-right-radius:5px}.emoji-mart-anchors{display:flex;flex-direction:row;justify-content:space-between;padding:0 6px;line-height:0}.emoji-mart-anchor{position:relative;display:block;flex:1 1 auto;color:#858585;text-align:center;padding:12px 4px;overflow:hidden;transition:color .1s ease-out;margin:0;box-shadow:none;background:none;border:none}.emoji-mart-anchor:focus{outline:0}.emoji-mart-anchor:hover,.emoji-mart-anchor:focus,.emoji-mart-anchor-selected{color:#464646}.emoji-mart-anchor-selected .emoji-mart-anchor-bar{bottom:0}.emoji-mart-anchor-bar{position:absolute;bottom:-3px;left:0;width:100%;height:3px;background-color:#464646}.emoji-mart-anchors i{display:inline-block;width:100%;max-width:22px}.emoji-mart-anchors svg,.emoji-mart-anchors img{fill:currentColor;height:18px;width:18px}.emoji-mart-scroll{overflow-y:scroll;overflow-x:hidden;height:270px;padding:0 6px 6px;will-change:transform}.emoji-mart-search{margin-top:6px;padding:0 6px;position:relative}.emoji-mart-search input{font-size:16px;display:block;width:100%;padding:5px 25px 6px 10px;border-radius:5px;border:1px solid #d9d9d9;outline:0}.emoji-mart-search input,.emoji-mart-search input::-webkit-search-decoration,.emoji-mart-search input::-webkit-search-cancel-button,.emoji-mart-search input::-webkit-search-results-button,.emoji-mart-search input::-webkit-search-results-decoration{-webkit-appearance:none}.emoji-mart-search-icon{position:absolute;top:7px;right:11px;z-index:2;padding:2px 5px 1px;border:none;background:none}.emoji-mart-category .emoji-mart-emoji span{z-index:1;position:relative;text-align:center;cursor:default}.emoji-mart-category .emoji-mart-emoji:hover::before{z-index:0;content:"";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#f4f4f4;border-radius:100%}.emoji-mart-category-label{z-index:2;position:relative;position:-webkit-sticky;position:sticky;top:0}.emoji-mart-category-label span{display:block;width:100%;font-weight:500;padding:5px 6px;background-color:#fff;background-color:hsla(0,0%,100%,.95)}.emoji-mart-category-list{margin:0;padding:0}.emoji-mart-category-list li{list-style:none;margin:0;padding:0;display:inline-block}.emoji-mart-emoji{position:relative;display:inline-block;font-size:0;margin:0;padding:0;border:none;background:none;box-shadow:none}.emoji-mart-emoji-native{font-family:"Segoe UI Emoji","Segoe UI Symbol","Segoe UI","Apple Color Emoji","Twemoji Mozilla","Noto Color Emoji","Android Emoji"}.emoji-mart-no-results{font-size:14px;text-align:center;padding-top:70px;color:#858585}.emoji-mart-no-results-img{display:block;margin-left:auto;margin-right:auto;width:50%}.emoji-mart-no-results .emoji-mart-category-label{display:none}.emoji-mart-no-results .emoji-mart-no-results-label{margin-top:.2em}.emoji-mart-no-results .emoji-mart-emoji:hover::before{content:none}.emoji-mart-preview{position:relative;height:70px}.emoji-mart-preview-emoji,.emoji-mart-preview-data,.emoji-mart-preview-skins{position:absolute;top:50%;transform:translateY(-50%)}.emoji-mart-preview-emoji{left:12px}.emoji-mart-preview-data{left:68px;right:12px;word-break:break-all}.emoji-mart-preview-skins{right:30px;text-align:right}.emoji-mart-preview-skins.custom{right:10px;text-align:right}.emoji-mart-preview-name{font-size:14px}.emoji-mart-preview-shortname{font-size:12px;color:#888}.emoji-mart-preview-shortname+.emoji-mart-preview-shortname,.emoji-mart-preview-shortname+.emoji-mart-preview-emoticon,.emoji-mart-preview-emoticon+.emoji-mart-preview-emoticon{margin-left:.5em}.emoji-mart-preview-emoticon{font-size:11px;color:#bbb}.emoji-mart-title span{display:inline-block;vertical-align:middle}.emoji-mart-title .emoji-mart-emoji{padding:0}.emoji-mart-title-label{color:#999a9c;font-size:26px;font-weight:300}.emoji-mart-skin-swatches{font-size:0;padding:2px 0;border:1px solid #d9d9d9;border-radius:12px;background-color:#fff}.emoji-mart-skin-swatches.custom{font-size:0;border:none;background-color:#fff}.emoji-mart-skin-swatches.opened .emoji-mart-skin-swatch{width:16px;padding:0 2px}.emoji-mart-skin-swatches.opened .emoji-mart-skin-swatch.selected::after{opacity:.75}.emoji-mart-skin-swatch{display:inline-block;width:0;vertical-align:middle;transition-property:width,padding;transition-duration:.125s;transition-timing-function:ease-out}.emoji-mart-skin-swatch:nth-child(1){transition-delay:0s}.emoji-mart-skin-swatch:nth-child(2){transition-delay:.03s}.emoji-mart-skin-swatch:nth-child(3){transition-delay:.06s}.emoji-mart-skin-swatch:nth-child(4){transition-delay:.09s}.emoji-mart-skin-swatch:nth-child(5){transition-delay:.12s}.emoji-mart-skin-swatch:nth-child(6){transition-delay:.15s}.emoji-mart-skin-swatch.selected{position:relative;width:16px;padding:0 2px}.emoji-mart-skin-swatch.selected::after{content:"";position:absolute;top:50%;left:50%;width:4px;height:4px;margin:-2px 0 0 -2px;background-color:#fff;border-radius:100%;pointer-events:none;opacity:0;transition:opacity .2s ease-out}.emoji-mart-skin-swatch.custom{display:inline-block;width:0;height:38px;overflow:hidden;vertical-align:middle;transition-property:width,height;transition-duration:.125s;transition-timing-function:ease-out;cursor:default}.emoji-mart-skin-swatch.custom.selected{position:relative;width:36px;height:38px;padding:0 2px 0 0}.emoji-mart-skin-swatch.custom.selected::after{content:"";width:0;height:0}.emoji-mart-skin-swatches.custom .emoji-mart-skin-swatch.custom:hover{background-color:#f4f4f4;border-radius:10%}.emoji-mart-skin-swatches.custom.opened .emoji-mart-skin-swatch.custom{width:36px;height:38px;padding:0 2px 0 0}.emoji-mart-skin-swatches.custom.opened .emoji-mart-skin-swatch.custom.selected::after{opacity:.75}.emoji-mart-skin-text.opened{display:inline-block;vertical-align:middle;text-align:left;color:#888;font-size:11px;padding:5px 2px;width:95px;height:40px;border-radius:10%;background-color:#fff}.emoji-mart-skin{display:inline-block;width:100%;padding-top:100%;max-width:12px;border-radius:100%}.emoji-mart-skin-tone-1{background-color:#ffc93a}.emoji-mart-skin-tone-2{background-color:#fadcbc}.emoji-mart-skin-tone-3{background-color:#e0bb95}.emoji-mart-skin-tone-4{background-color:#bf8f68}.emoji-mart-skin-tone-5{background-color:#9b643d}.emoji-mart-skin-tone-6{background-color:#594539}.emoji-mart-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.emoji-mart-dark{color:#fff;border-color:#555453;background-color:#222}.emoji-mart-dark .emoji-mart-bar{border-color:#555453}.emoji-mart-dark .emoji-mart-search input{color:#fff;border-color:#555453;background-color:#2f2f2f}.emoji-mart-dark .emoji-mart-search-icon svg{fill:#fff}.emoji-mart-dark .emoji-mart-category .emoji-mart-emoji:hover::before{background-color:#444}.emoji-mart-dark .emoji-mart-category-label span{background-color:#222;color:#fff}.emoji-mart-dark .emoji-mart-skin-swatches{border-color:#555453;background-color:#222}.emoji-mart-dark .emoji-mart-anchor:hover,.emoji-mart-dark .emoji-mart-anchor:focus,.emoji-mart-dark .emoji-mart-anchor-selected{color:#bfbfbf}
|