stream-chat-react-native-core 5.25.0-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.
Files changed (128) hide show
  1. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  2. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  3. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  4. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  5. package/lib/commonjs/components/Channel/Channel.js +16 -13
  6. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  8. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  9. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +4 -2
  10. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  11. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  12. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  13. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  14. package/lib/commonjs/emoji-data/compile.js +63 -11
  15. package/lib/commonjs/emoji-data/compile.js.map +1 -1
  16. package/lib/commonjs/emoji-data/index.js +9843 -37
  17. package/lib/commonjs/emoji-data/index.js.map +1 -1
  18. package/lib/commonjs/i18n/en.json +1 -1
  19. package/lib/commonjs/i18n/es.json +46 -46
  20. package/lib/commonjs/i18n/fr.json +46 -46
  21. package/lib/commonjs/i18n/he.json +46 -46
  22. package/lib/commonjs/i18n/hi.json +46 -46
  23. package/lib/commonjs/i18n/it.json +46 -46
  24. package/lib/commonjs/i18n/ja.json +46 -46
  25. package/lib/commonjs/i18n/ko.json +46 -46
  26. package/lib/commonjs/i18n/nl.json +46 -46
  27. package/lib/commonjs/i18n/ru.json +47 -47
  28. package/lib/commonjs/i18n/tr.json +46 -46
  29. package/lib/commonjs/index.js +4 -4
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/utils/utils.js +84 -31
  32. package/lib/commonjs/utils/utils.js.map +1 -1
  33. package/lib/commonjs/version.json +1 -1
  34. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  35. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js.map +1 -1
  36. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  37. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js.map +1 -1
  38. package/lib/module/components/Channel/Channel.js +16 -13
  39. package/lib/module/components/Channel/Channel.js.map +1 -1
  40. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  41. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  42. package/lib/module/contexts/messageInputContext/MessageInputContext.js +4 -2
  43. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  44. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -0
  45. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  46. package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  47. package/lib/module/emoji-data/compile.js +63 -11
  48. package/lib/module/emoji-data/compile.js.map +1 -1
  49. package/lib/module/emoji-data/index.js +9843 -37
  50. package/lib/module/emoji-data/index.js.map +1 -1
  51. package/lib/module/i18n/en.json +1 -1
  52. package/lib/module/i18n/es.json +46 -46
  53. package/lib/module/i18n/fr.json +46 -46
  54. package/lib/module/i18n/he.json +46 -46
  55. package/lib/module/i18n/hi.json +46 -46
  56. package/lib/module/i18n/it.json +46 -46
  57. package/lib/module/i18n/ja.json +46 -46
  58. package/lib/module/i18n/ko.json +46 -46
  59. package/lib/module/i18n/nl.json +46 -46
  60. package/lib/module/i18n/ru.json +47 -47
  61. package/lib/module/i18n/tr.json +46 -46
  62. package/lib/module/index.js +4 -4
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/utils/utils.js +84 -31
  65. package/lib/module/utils/utils.js.map +1 -1
  66. package/lib/module/version.json +1 -1
  67. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  68. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +9 -1
  69. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  70. package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts +1 -1
  71. package/lib/typescript/emoji-data/index.d.ts +9 -0
  72. package/lib/typescript/i18n/en.json +1 -1
  73. package/lib/typescript/i18n/es.json +46 -46
  74. package/lib/typescript/i18n/fr.json +46 -46
  75. package/lib/typescript/i18n/he.json +46 -46
  76. package/lib/typescript/i18n/hi.json +46 -46
  77. package/lib/typescript/i18n/it.json +46 -46
  78. package/lib/typescript/i18n/ja.json +46 -46
  79. package/lib/typescript/i18n/ko.json +46 -46
  80. package/lib/typescript/i18n/nl.json +46 -46
  81. package/lib/typescript/i18n/ru.json +47 -47
  82. package/lib/typescript/i18n/tr.json +46 -46
  83. package/lib/typescript/index.d.ts +1 -1
  84. package/lib/typescript/utils/utils.d.ts +9 -4
  85. package/package.json +3 -2
  86. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
  87. package/src/components/AutoCompleteInput/AutoCompleteSuggestionItem.tsx +1 -1
  88. package/src/components/AutoCompleteInput/AutoCompleteSuggestionList.tsx +1 -1
  89. package/src/components/Channel/Channel.tsx +3 -0
  90. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  91. package/src/contexts/messageInputContext/MessageInputContext.tsx +12 -0
  92. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -0
  93. package/src/contexts/suggestionsContext/SuggestionsContext.tsx +1 -1
  94. package/src/emoji-data/compile.js +56 -36
  95. package/src/emoji-data/index.ts +5178 -0
  96. package/src/i18n/en.json +1 -1
  97. package/src/i18n/es.json +46 -46
  98. package/src/i18n/fr.json +46 -46
  99. package/src/i18n/he.json +46 -46
  100. package/src/i18n/hi.json +46 -46
  101. package/src/i18n/it.json +46 -46
  102. package/src/i18n/ja.json +46 -46
  103. package/src/i18n/ko.json +46 -46
  104. package/src/i18n/nl.json +46 -46
  105. package/src/i18n/ru.json +47 -47
  106. package/src/i18n/tr.json +46 -46
  107. package/src/index.ts +1 -1
  108. package/src/utils/utils.ts +47 -33
  109. package/src/version.json +1 -1
  110. package/lib/commonjs/emoji-data/compiled.js +0 -15587
  111. package/lib/commonjs/emoji-data/compiled.js.map +0 -1
  112. package/lib/commonjs/emoji-data/emojiNames.js +0 -4913
  113. package/lib/commonjs/emoji-data/emojiNames.js.map +0 -1
  114. package/lib/commonjs/emoji-data/emojis.js +0 -13155
  115. package/lib/commonjs/emoji-data/emojis.js.map +0 -1
  116. package/lib/module/emoji-data/compiled.js +0 -15587
  117. package/lib/module/emoji-data/compiled.js.map +0 -1
  118. package/lib/module/emoji-data/emojiNames.js +0 -4913
  119. package/lib/module/emoji-data/emojiNames.js.map +0 -1
  120. package/lib/module/emoji-data/emojis.js +0 -13155
  121. package/lib/module/emoji-data/emojis.js.map +0 -1
  122. package/lib/typescript/emoji-data/compiled.d.ts +0 -20
  123. package/lib/typescript/emoji-data/emojiNames.d.ts +0 -0
  124. package/lib/typescript/emoji-data/emojis.d.ts +0 -0
  125. package/src/emoji-data/compiled.ts +0 -8930
  126. package/src/emoji-data/emojiNames.ts +0 -6960
  127. package/src/emoji-data/emojis.ts +0 -14893
  128. package/src/emoji-data/index.js +0 -38
@@ -84,6 +84,7 @@ import { patchMessageTextCommand } from '../../utils/patchMessageTextCommand';
84
84
  import { removeReactionFromLocalState } from '../../utils/removeReactionFromLocalState';
85
85
  import { removeReservedFields } from '../../utils/removeReservedFields';
86
86
  import {
87
+ defaultEmojiSearchIndex,
87
88
  generateRandomId,
88
89
  isBouncedMessage,
89
90
  isLocalUrl,
@@ -440,6 +441,7 @@ const ChannelWithContext = <
440
441
  doMarkReadRequest,
441
442
  doSendMessageRequest,
442
443
  doUpdateMessageRequest,
444
+ emojiSearchIndex = defaultEmojiSearchIndex,
443
445
  EmptyStateIndicator = EmptyStateIndicatorDefault,
444
446
  enableMessageGroupingByUser = true,
445
447
  enableOfflineSupport,
@@ -2149,6 +2151,7 @@ const ChannelWithContext = <
2149
2151
  doImageUploadRequest,
2150
2152
  editing,
2151
2153
  editMessage,
2154
+ emojiSearchIndex,
2152
2155
  FileUploadPreview,
2153
2156
  hasCommands,
2154
2157
  hasFilePicker,
@@ -20,6 +20,7 @@ export const useCreateInputMessageInputContext = <
20
20
  doImageUploadRequest,
21
21
  editing,
22
22
  editMessage,
23
+ emojiSearchIndex,
23
24
  FileUploadPreview,
24
25
  hasCommands,
25
26
  hasFilePicker,
@@ -75,6 +76,7 @@ export const useCreateInputMessageInputContext = <
75
76
  doImageUploadRequest,
76
77
  editing,
77
78
  editMessage,
79
+ emojiSearchIndex,
78
80
  FileUploadPreview,
79
81
  hasCommands,
80
82
  hasFilePicker,
@@ -37,6 +37,7 @@ import type { MoreOptionsButtonProps } from '../../components/MessageInput/MoreO
37
37
  import type { SendButtonProps } from '../../components/MessageInput/SendButton';
38
38
  import type { UploadProgressIndicatorProps } from '../../components/MessageInput/UploadProgressIndicator';
39
39
  import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
40
+ import type { Emoji } from '../../emoji-data';
40
41
  import { pickDocument } from '../../native';
41
42
  import type {
42
43
  Asset,
@@ -69,6 +70,10 @@ import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
69
70
  import { getDisplayName } from '../utils/getDisplayName';
70
71
  import { isTestEnvironment } from '../utils/isTestEnvironment';
71
72
 
73
+ export type EmojiSearchIndex = {
74
+ search: (query: string) => PromiseLike<Array<Emoji>> | Array<Emoji> | null;
75
+ };
76
+
72
77
  export type MentionAllAppUsersQuery<
73
78
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
74
79
  > = {
@@ -339,6 +344,11 @@ export type InputMessageInputContextValue<
339
344
  */
340
345
  editing?: MessageType<StreamChatGenerics>;
341
346
 
347
+ /**
348
+ * Prop to override the default emoji search index in auto complete suggestion list.
349
+ */
350
+ emojiSearchIndex?: EmojiSearchIndex;
351
+
342
352
  /** Initial value to set on input */
343
353
  initialValue?: string;
344
354
  /**
@@ -894,12 +904,14 @@ export const MessageInputProvider = <
894
904
  triggerSettings = value.autoCompleteTriggerSettings({
895
905
  channel,
896
906
  client,
907
+ emojiSearchIndex: value.emojiSearchIndex,
897
908
  onMentionSelectItem: onSelectItem,
898
909
  });
899
910
  } else {
900
911
  triggerSettings = ACITriggerSettings<StreamChatGenerics>({
901
912
  channel,
902
913
  client,
914
+ emojiSearchIndex: value.emojiSearchIndex,
903
915
  onMentionSelectItem: onSelectItem,
904
916
  });
905
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/compiled';
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 { emojiArray, emojiLib } = require('./index.js');
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
- const stingified = JSON.stringify({
7
- emojiArray,
8
- emojiLib,
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
- export type EmojiArray = EmojiArrayItem[];
19
-
20
- export type Emoji = {
21
- name: string;
22
- names: string[];
23
- sort_order: number;
24
- unicode: string;
25
- skin_variations?: string[];
26
- };
27
-
28
- export type EmojiLib = {
29
- [key: string]: Emoji;
30
- };
31
-
32
- export type CompiledEmojis = {
33
- emojiArray: EmojiArray;
34
- emojiLib: EmojiLib;
35
- };
36
-
37
- export const compiledEmojis: CompiledEmojis = ${stingified}`,
38
- (err) => {
39
- if (err) throw err;
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
+ });