stream-chat-react-native-core 5.24.1-beta.1 → 5.25.0-beta.2
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/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +16 -13
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendButton.js +3 -1
- package/lib/commonjs/components/MessageInput/SendButton.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +13 -11
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/commonjs/emoji-data/compile.js +63 -11
- package/lib/commonjs/emoji-data/compile.js.map +1 -1
- package/lib/commonjs/emoji-data/index.js +9843 -37
- package/lib/commonjs/emoji-data/index.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -1
- package/lib/commonjs/i18n/es.json +34 -34
- package/lib/commonjs/i18n/fr.json +36 -36
- package/lib/commonjs/i18n/he.json +36 -36
- package/lib/commonjs/i18n/hi.json +36 -36
- package/lib/commonjs/i18n/it.json +36 -36
- package/lib/commonjs/i18n/ja.json +36 -36
- package/lib/commonjs/i18n/ko.json +36 -36
- package/lib/commonjs/i18n/nl.json +36 -36
- package/lib/commonjs/i18n/ru.json +35 -35
- package/lib/commonjs/i18n/tr.json +36 -36
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/utils.js +84 -31
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +16 -13
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/MessageInput/SendButton.js +3 -1
- package/lib/module/components/MessageInput/SendButton.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +13 -11
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
- package/lib/module/emoji-data/compile.js +63 -11
- package/lib/module/emoji-data/compile.js.map +1 -1
- package/lib/module/emoji-data/index.js +9843 -37
- package/lib/module/emoji-data/index.js.map +1 -1
- package/lib/module/i18n/en.json +1 -1
- package/lib/module/i18n/es.json +34 -34
- package/lib/module/i18n/fr.json +36 -36
- package/lib/module/i18n/he.json +36 -36
- package/lib/module/i18n/hi.json +36 -36
- package/lib/module/i18n/it.json +36 -36
- package/lib/module/i18n/ja.json +36 -36
- package/lib/module/i18n/ko.json +36 -36
- package/lib/module/i18n/nl.json +36 -36
- package/lib/module/i18n/ru.json +35 -35
- package/lib/module/i18n/tr.json +36 -36
- package/lib/module/index.js +4 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/utils.js +84 -31
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +11 -3
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts +1 -1
- package/lib/typescript/emoji-data/index.d.ts +9 -0
- package/lib/typescript/i18n/en.json +1 -1
- package/lib/typescript/i18n/es.json +34 -34
- package/lib/typescript/i18n/fr.json +36 -36
- package/lib/typescript/i18n/he.json +36 -36
- package/lib/typescript/i18n/hi.json +36 -36
- package/lib/typescript/i18n/it.json +36 -36
- package/lib/typescript/i18n/ja.json +36 -36
- package/lib/typescript/i18n/ko.json +36 -36
- package/lib/typescript/i18n/nl.json +36 -36
- package/lib/typescript/i18n/ru.json +35 -35
- package/lib/typescript/i18n/tr.json +36 -36
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/utils/utils.d.ts +9 -4
- package/package.json +3 -2
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -1
- package/src/components/Channel/Channel.tsx +3 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
- package/src/components/MessageInput/SendButton.tsx +1 -1
- package/src/contexts/messageInputContext/MessageInputContext.tsx +17 -2
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
- package/src/contexts/suggestionsContext/SuggestionsContext.tsx +1 -1
- package/src/emoji-data/compile.js +56 -36
- package/src/emoji-data/index.ts +5178 -0
- package/src/i18n/en.json +1 -1
- package/src/i18n/es.json +34 -34
- package/src/i18n/fr.json +36 -36
- package/src/i18n/he.json +36 -36
- package/src/i18n/hi.json +36 -36
- package/src/i18n/it.json +36 -36
- package/src/i18n/ja.json +36 -36
- package/src/i18n/ko.json +36 -36
- package/src/i18n/nl.json +36 -36
- package/src/i18n/ru.json +35 -35
- package/src/i18n/tr.json +36 -36
- package/src/index.ts +1 -1
- package/src/utils/utils.ts +47 -33
- package/src/version.json +1 -1
- package/lib/commonjs/emoji-data/compiled.js +0 -15587
- package/lib/commonjs/emoji-data/compiled.js.map +0 -1
- package/lib/commonjs/emoji-data/emojiNames.js +0 -4913
- package/lib/commonjs/emoji-data/emojiNames.js.map +0 -1
- package/lib/commonjs/emoji-data/emojis.js +0 -13155
- package/lib/commonjs/emoji-data/emojis.js.map +0 -1
- package/lib/module/emoji-data/compiled.js +0 -15587
- package/lib/module/emoji-data/compiled.js.map +0 -1
- package/lib/module/emoji-data/emojiNames.js +0 -4913
- package/lib/module/emoji-data/emojiNames.js.map +0 -1
- package/lib/module/emoji-data/emojis.js +0 -13155
- package/lib/module/emoji-data/emojis.js.map +0 -1
- package/lib/typescript/emoji-data/compiled.d.ts +0 -20
- package/lib/typescript/emoji-data/emojiNames.d.ts +0 -0
- package/lib/typescript/emoji-data/emojis.d.ts +0 -0
- package/src/emoji-data/compiled.ts +0 -8930
- package/src/emoji-data/emojiNames.ts +0 -6960
- package/src/emoji-data/emojis.ts +0 -14893
- package/src/emoji-data/index.js +0 -38
|
@@ -8,6 +8,7 @@ import { lookup } from 'mime-types';
|
|
|
8
8
|
import {
|
|
9
9
|
Attachment,
|
|
10
10
|
logChatPromiseExecution,
|
|
11
|
+
Message,
|
|
11
12
|
SendFileAPIResponse,
|
|
12
13
|
StreamChat,
|
|
13
14
|
Message as StreamMessage,
|
|
@@ -36,6 +37,7 @@ import type { MoreOptionsButtonProps } from '../../components/MessageInput/MoreO
|
|
|
36
37
|
import type { SendButtonProps } from '../../components/MessageInput/SendButton';
|
|
37
38
|
import type { UploadProgressIndicatorProps } from '../../components/MessageInput/UploadProgressIndicator';
|
|
38
39
|
import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
|
|
40
|
+
import type { Emoji } from '../../emoji-data';
|
|
39
41
|
import { pickDocument } from '../../native';
|
|
40
42
|
import type {
|
|
41
43
|
Asset,
|
|
@@ -68,6 +70,10 @@ import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
|
|
|
68
70
|
import { getDisplayName } from '../utils/getDisplayName';
|
|
69
71
|
import { isTestEnvironment } from '../utils/isTestEnvironment';
|
|
70
72
|
|
|
73
|
+
export type EmojiSearchIndex = {
|
|
74
|
+
search: (query: string) => PromiseLike<Array<Emoji>> | Array<Emoji> | null;
|
|
75
|
+
};
|
|
76
|
+
|
|
71
77
|
export type MentionAllAppUsersQuery<
|
|
72
78
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
73
79
|
> = {
|
|
@@ -159,7 +165,7 @@ export type LocalMessageInputContext<
|
|
|
159
165
|
resetInput: (pendingAttachments?: Attachment<StreamChatGenerics>[]) => void;
|
|
160
166
|
selectedPicker: string | undefined;
|
|
161
167
|
sending: React.MutableRefObject<boolean>;
|
|
162
|
-
sendMessage: () => Promise<void>;
|
|
168
|
+
sendMessage: (customMessageData?: Partial<Message<StreamChatGenerics>>) => Promise<void>;
|
|
163
169
|
sendMessageAsync: (id: string) => void;
|
|
164
170
|
sendThreadMessageInChannel: boolean;
|
|
165
171
|
setAsyncIds: React.Dispatch<React.SetStateAction<string[]>>;
|
|
@@ -338,6 +344,11 @@ export type InputMessageInputContextValue<
|
|
|
338
344
|
*/
|
|
339
345
|
editing?: MessageType<StreamChatGenerics>;
|
|
340
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Prop to override the default emoji search index in auto complete suggestion list.
|
|
349
|
+
*/
|
|
350
|
+
emojiSearchIndex?: EmojiSearchIndex;
|
|
351
|
+
|
|
341
352
|
/** Initial value to set on input */
|
|
342
353
|
initialValue?: string;
|
|
343
354
|
/**
|
|
@@ -696,7 +707,7 @@ export const MessageInputProvider = <
|
|
|
696
707
|
|
|
697
708
|
// TODO: Figure out why this is async, as it doesn't await any promise.
|
|
698
709
|
// eslint-disable-next-line require-await
|
|
699
|
-
const sendMessage = async () => {
|
|
710
|
+
const sendMessage = async (customMessageData?: Partial<Message<StreamChatGenerics>>) => {
|
|
700
711
|
if (sending.current) {
|
|
701
712
|
return;
|
|
702
713
|
}
|
|
@@ -790,6 +801,7 @@ export const MessageInputProvider = <
|
|
|
790
801
|
mentioned_users: mentionedUsers,
|
|
791
802
|
quoted_message: undefined,
|
|
792
803
|
text: prevText,
|
|
804
|
+
...customMessageData,
|
|
793
805
|
} as Parameters<StreamChat<StreamChatGenerics>['updateMessage']>[0];
|
|
794
806
|
|
|
795
807
|
// TODO: Remove this line and show an error when submit fails
|
|
@@ -822,6 +834,7 @@ export const MessageInputProvider = <
|
|
|
822
834
|
typeof value.quotedMessage === 'boolean' ? undefined : value.quotedMessage.id,
|
|
823
835
|
show_in_channel: sendThreadMessageInChannel || undefined,
|
|
824
836
|
text: prevText,
|
|
837
|
+
...customMessageData,
|
|
825
838
|
} as unknown as StreamMessage<StreamChatGenerics>);
|
|
826
839
|
|
|
827
840
|
value.clearQuotedMessageState();
|
|
@@ -891,12 +904,14 @@ export const MessageInputProvider = <
|
|
|
891
904
|
triggerSettings = value.autoCompleteTriggerSettings({
|
|
892
905
|
channel,
|
|
893
906
|
client,
|
|
907
|
+
emojiSearchIndex: value.emojiSearchIndex,
|
|
894
908
|
onMentionSelectItem: onSelectItem,
|
|
895
909
|
});
|
|
896
910
|
} else {
|
|
897
911
|
triggerSettings = ACITriggerSettings<StreamChatGenerics>({
|
|
898
912
|
channel,
|
|
899
913
|
client,
|
|
914
|
+
emojiSearchIndex: value.emojiSearchIndex,
|
|
900
915
|
onMentionSelectItem: onSelectItem,
|
|
901
916
|
});
|
|
902
917
|
}
|
|
@@ -24,6 +24,7 @@ export const useCreateMessageInputContext = <
|
|
|
24
24
|
doImageUploadRequest,
|
|
25
25
|
editing,
|
|
26
26
|
editMessage,
|
|
27
|
+
emojiSearchIndex,
|
|
27
28
|
FileUploadPreview,
|
|
28
29
|
fileUploads,
|
|
29
30
|
giphyActive,
|
|
@@ -127,6 +128,7 @@ export const useCreateMessageInputContext = <
|
|
|
127
128
|
doImageUploadRequest,
|
|
128
129
|
editing,
|
|
129
130
|
editMessage,
|
|
131
|
+
emojiSearchIndex,
|
|
130
132
|
FileUploadPreview,
|
|
131
133
|
fileUploads,
|
|
132
134
|
giphyActive,
|
|
@@ -5,7 +5,7 @@ import type { CommandResponse, UserResponse } from 'stream-chat';
|
|
|
5
5
|
import type { AutoCompleteSuggestionHeaderProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionHeader';
|
|
6
6
|
import type { AutoCompleteSuggestionItemProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionItem';
|
|
7
7
|
import type { AutoCompleteSuggestionListProps } from '../../components/AutoCompleteInput/AutoCompleteSuggestionList';
|
|
8
|
-
import type { Emoji } from '../../emoji-data
|
|
8
|
+
import type { Emoji } from '../../emoji-data';
|
|
9
9
|
import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
|
|
10
10
|
import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
|
|
11
11
|
|
|
@@ -1,41 +1,61 @@
|
|
|
1
1
|
/* eslint-disable no-undef */
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const getEmojis = async () => {
|
|
5
|
+
try {
|
|
6
|
+
const response = await fetch(
|
|
7
|
+
'https://raw.githubusercontent.com/iamcal/emoji-data/master/emoji.json',
|
|
8
|
+
);
|
|
9
|
+
const emojis = await response.json();
|
|
10
|
+
const emojiLib = emojis
|
|
11
|
+
.map((emoji) => ({
|
|
12
|
+
id: emoji.short_name,
|
|
13
|
+
name: emoji.short_name,
|
|
14
|
+
names: emoji.short_names,
|
|
15
|
+
...(emoji.skin_variations
|
|
16
|
+
? {
|
|
17
|
+
skins: Object.values(emoji.skin_variations).map((skin) =>
|
|
18
|
+
String.fromCodePoint.apply(
|
|
19
|
+
null,
|
|
20
|
+
skin.unified.split('-').map((unicode) => `0x${unicode}`),
|
|
21
|
+
),
|
|
22
|
+
),
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
unicode: String.fromCodePoint.apply(
|
|
26
|
+
null,
|
|
27
|
+
emoji.unified.split('-').map((unicode) => `0x${unicode}`),
|
|
28
|
+
),
|
|
29
|
+
}))
|
|
30
|
+
.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
5
31
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}).replace(/(["'])require(?:(?=(\\?))\2.)*?\1/g, (value) => value.replace(/"/g, ''));
|
|
10
|
-
|
|
11
|
-
fs.writeFile(
|
|
12
|
-
'compiled.ts',
|
|
13
|
-
`export type EmojiArrayItem = {
|
|
14
|
-
name: string;
|
|
15
|
-
names: string[];
|
|
32
|
+
return { emojiLib };
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.log(error);
|
|
16
35
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
getEmojis().then(({ emojiLib }) => {
|
|
39
|
+
const stingified = JSON.stringify(emojiLib).replace(
|
|
40
|
+
/(["'])require(?:(?=(\\?))\2.)*?\1/g,
|
|
41
|
+
(value) => value.replace(/"/g, ''),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
fs.writeFile(
|
|
45
|
+
'src/emoji-data/index.ts',
|
|
46
|
+
`export type Emoji = {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
names: string[];
|
|
50
|
+
unicode: string;
|
|
51
|
+
skins?: string[];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type Emojis = Emoji[];
|
|
55
|
+
|
|
56
|
+
export const compiledEmojis: Emojis = ${stingified}`,
|
|
57
|
+
(err) => {
|
|
58
|
+
if (err) throw err;
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
});
|