@cometchat/chat-uikit-react-native 5.0.0-beta.1 → 5.0.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.
Files changed (98) hide show
  1. package/README.md +2 -3
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +29 -44
  5. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +12 -0
  6. package/ios/FileManager.m +26 -9
  7. package/package.json +11 -36
  8. package/src/CometChatConversations/CometChatConversations.tsx +287 -147
  9. package/src/CometChatConversations/Skeleton.tsx +116 -73
  10. package/src/CometChatConversations/style.ts +17 -22
  11. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +439 -227
  12. package/src/CometChatGroupMembers/style.ts +2 -4
  13. package/src/CometChatGroups/CometChatGroups.tsx +239 -135
  14. package/src/CometChatGroups/GroupsStyle.ts +20 -17
  15. package/src/CometChatGroups/Skeleton.tsx +198 -288
  16. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +208 -73
  17. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +97 -43
  18. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +4 -2
  19. package/src/CometChatMessageList/CometChatMessageList.tsx +200 -76
  20. package/src/CometChatMessageList/style.ts +4 -4
  21. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +77 -11
  22. package/src/CometChatThreadHeader/style.ts +2 -2
  23. package/src/CometChatUsers/CometChatUsers.tsx +203 -51
  24. package/src/CometChatUsers/Skeleton.tsx +174 -159
  25. package/src/CometChatUsers/style.ts +21 -18
  26. package/src/calls/CallingConfiguration.ts +4 -3
  27. package/src/calls/CallingExtensionDecorator.tsx +5 -3
  28. package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +4 -2
  29. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +10 -8
  30. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +240 -97
  31. package/src/calls/CometChatCallLogs/Skeleton.tsx +175 -91
  32. package/src/calls/CometChatCallLogs/index.ts +1 -0
  33. package/src/calls/CometChatCallLogs/style.ts +85 -43
  34. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +42 -29
  35. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +36 -10
  36. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +39 -12
  37. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +5 -4
  38. package/src/extensions/Polls/PollsDecorator.tsx +30 -9
  39. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +34 -16
  40. package/src/index.ts +3 -1
  41. package/src/shared/base/Types.ts +31 -1
  42. package/src/shared/framework/DataSource.ts +64 -20
  43. package/src/shared/framework/DataSourceDecorator.tsx +46 -37
  44. package/src/shared/framework/MessageDataSource.tsx +518 -316
  45. package/src/shared/index.ts +3 -1
  46. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +3 -2
  47. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +3 -2
  48. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +3 -2
  49. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +3 -2
  50. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +3 -2
  51. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +3 -2
  52. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +3 -2
  53. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +3 -2
  54. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +3 -2
  55. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +3 -2
  56. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +3 -2
  57. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +3 -2
  58. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +3 -2
  59. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +3 -2
  60. package/src/shared/utils/MessageUtils.tsx +41 -20
  61. package/src/shared/utils/conversationUtils.ts +2 -2
  62. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +22 -1
  63. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +20 -8
  64. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +177 -123
  65. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +76 -10
  66. package/src/shared/views/CometChatConfirmDialog/style.ts +2 -2
  67. package/src/shared/views/CometChatDate/CometChatDate.tsx +26 -18
  68. package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +22 -16
  69. package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +17 -5
  70. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +65 -35
  71. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +22 -11
  72. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +47 -18
  73. package/src/shared/views/CometChatList/CometChatList.tsx +70 -46
  74. package/src/shared/views/CometChatList/Header.tsx +122 -37
  75. package/src/shared/views/CometChatList/styles.ts +1 -0
  76. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +116 -30
  77. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +52 -30
  78. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +36 -22
  79. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +41 -13
  80. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +132 -17
  81. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +30 -2
  82. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +10 -6
  83. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +20 -13
  84. package/src/shared/views/CometChatStatusIndicator/styles.ts +26 -13
  85. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +25 -2
  86. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +94 -14
  87. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +52 -16
  88. package/src/shared/views/CometChatTooltipMenu/index.ts +2 -1
  89. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +29 -9
  90. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +20 -2
  91. package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +29 -14
  92. package/src/shared/views/index.ts +2 -0
  93. package/src/theme/default/index.ts +5 -5
  94. package/src/theme/type.ts +2 -2
  95. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +0 -57
  96. package/src/shared/views/CometChatPanel/PanelStyle.tsx +0 -43
  97. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  98. package/src/shared/views/CometChatPanel/resources/index.ts +0 -3
@@ -2,7 +2,11 @@ import { CometChat } from "@cometchat/chat-sdk-react-native";
2
2
  import React from "react";
3
3
  import { Text, View } from "react-native";
4
4
  import { CometChatUIKit } from "../../shared";
5
- import { AdditionalParams, MessageBubbleAlignmentType } from "../../shared/base/Types";
5
+ import {
6
+ AdditionalAttachmentOptionsParams,
7
+ AdditionalParams,
8
+ MessageBubbleAlignmentType,
9
+ } from "../../shared/base/Types";
6
10
  import {
7
11
  MessageCategoryConstants,
8
12
  MetadataConstants,
@@ -37,7 +41,8 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
37
41
  return "CollaborativeDocument";
38
42
  }
39
43
 
40
- getLastConversationMessage(conversation: CometChat.Conversation,
44
+ getLastConversationMessage(
45
+ conversation: CometChat.Conversation,
41
46
  theme?: CometChatTheme
42
47
  ): string | JSX.Element {
43
48
  if (conversation.getLastMessage() == undefined) {
@@ -46,12 +51,13 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
46
51
 
47
52
  if (
48
53
  conversation.getLastMessage().getType() == ExtensionTypeConstants.document &&
49
- conversation.getLastMessage().getCategory() == MessageCategoryConstants.custom
54
+ conversation.getLastMessage().getCategory() == MessageCategoryConstants.custom &&
55
+ conversation.getLastMessage().getDeletedAt() === undefined
50
56
  ) {
51
57
  return getMessagePreviewInternal(
52
58
  "collaborative-document-fill",
53
59
  localize("CUSTOM_MESSAGE_DOCUMENT"),
54
- {theme}
60
+ { theme }
55
61
  );
56
62
  } else {
57
63
  return super.getLastConversationMessage(conversation, theme);
@@ -76,14 +82,18 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
76
82
  theme: CometChatTheme,
77
83
  user?: any,
78
84
  group?: any,
79
- composerId?: any
85
+ composerId?: any,
86
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
80
87
  ): CometChatMessageComposerAction[] {
81
88
  let attachmentOptions: CometChatMessageComposerAction[] = super.getAttachmentOptions(
82
89
  theme,
83
90
  user,
84
91
  group,
85
- composerId
92
+ composerId,
93
+ additionalAttachmentOptionsParams
86
94
  );
95
+ if (additionalAttachmentOptionsParams?.hideCollaborativeDocumentOption)
96
+ return attachmentOptions;
87
97
  if (
88
98
  composerId == undefined ||
89
99
  (composerId as Map<any, any>).get("parentMessageId") == undefined
@@ -95,9 +105,18 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
95
105
  <Icon
96
106
  name='collaborative-document-icon'
97
107
  color={theme.color.primary}
98
- height={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.height}
99
- width={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width}
100
- containerStyle={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconContainerStyle}
108
+ height={
109
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
110
+ ?.height
111
+ }
112
+ width={
113
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
114
+ ?.width
115
+ }
116
+ containerStyle={
117
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
118
+ ?.iconContainerStyle
119
+ }
101
120
  />
102
121
  ),
103
122
  onPress: (user, group) => {
@@ -167,7 +186,14 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
167
186
  messageObject: CometChat.BaseMessage,
168
187
  theme: CometChatTheme,
169
188
  group?: CometChat.Group
170
- ) => ChatConfigurator.dataSource.getMessageOptions(loggedInUser, messageObject, theme, group),
189
+ ) =>
190
+ ChatConfigurator.dataSource.getMessageOptions(
191
+ loggedInUser,
192
+ messageObject,
193
+ theme,
194
+ group,
195
+ additionalParams
196
+ ),
171
197
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
172
198
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
173
199
  },
@@ -16,7 +16,11 @@ import { getExtensionData } from "../ExtensionModerator";
16
16
  import React from "react";
17
17
  import { Text, View } from "react-native";
18
18
  import { CometChatUIKit } from "../../shared";
19
- import { AdditionalParams, MessageBubbleAlignmentType } from "../../shared/base/Types";
19
+ import {
20
+ AdditionalAttachmentOptionsParams,
21
+ AdditionalParams,
22
+ MessageBubbleAlignmentType,
23
+ } from "../../shared/base/Types";
20
24
  import { CometChatUIEventHandler } from "../../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
21
25
  import { Icon } from "../../shared/icons/Icon";
22
26
  import { getMessagePreviewInternal } from "../../shared/utils/MessageUtils";
@@ -76,12 +80,15 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
76
80
  conversation: CometChat.Conversation,
77
81
  theme?: CometChatTheme
78
82
  ): string | JSX.Element {
79
- if (conversation["lastMessage"] == undefined) {
83
+ if (conversation.getLastMessage() == undefined) {
80
84
  return "";
81
85
  }
82
86
  if (
83
- conversation["lastMessage"]["type"] == ExtensionTypeConstants.whiteboard &&
84
- conversation["lastMessage"]["category"] == MessageCategoryConstants.custom
87
+ (conversation.getLastMessage() as CometChat.BaseMessage).getType() ==
88
+ ExtensionTypeConstants.whiteboard &&
89
+ (conversation.getLastMessage() as CometChat.BaseMessage).getCategory() ==
90
+ MessageCategoryConstants.custom &&
91
+ (conversation.getLastMessage() as CometChat.BaseMessage).getDeletedAt() === undefined
85
92
  ) {
86
93
  return getMessagePreviewInternal(
87
94
  "collaborative-whiteboard-fill",
@@ -130,14 +137,18 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
130
137
  theme: CometChatTheme,
131
138
  user?: any,
132
139
  group?: any,
133
- composerId?: any
140
+ composerId?: any,
141
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
134
142
  ): CometChatMessageComposerAction[] {
135
143
  const attachmentOptions: CometChatMessageComposerAction[] = super.getAttachmentOptions(
136
144
  theme,
137
145
  user,
138
146
  group,
139
- composerId
147
+ composerId,
148
+ additionalAttachmentOptionsParams
140
149
  );
150
+ if (additionalAttachmentOptionsParams?.hideCollaborativeWhiteboardOption)
151
+ return attachmentOptions;
141
152
  if (
142
153
  composerId === undefined ||
143
154
  (composerId as Map<any, any>).get("parentMessageId") === undefined
@@ -147,11 +158,20 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
147
158
  title: localize("COLLABORATIVE_WHITEBOARD"),
148
159
  icon: (
149
160
  <Icon
150
- name="collaborative-whiteboard-icon"
161
+ name='collaborative-whiteboard-icon'
151
162
  color={theme.color.primary}
152
- height={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.height}
153
- width={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle?.width}
154
- containerStyle={theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconContainerStyle}
163
+ height={
164
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
165
+ ?.height
166
+ }
167
+ width={
168
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle?.iconStyle
169
+ ?.width
170
+ }
171
+ containerStyle={
172
+ theme.messageComposerStyles?.attachmentOptionsStyles?.optionsItemStyle
173
+ ?.iconContainerStyle
174
+ }
155
175
  />
156
176
  ),
157
177
  onPress: (user, group) => {
@@ -233,7 +253,14 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
233
253
  messageObject: CometChat.BaseMessage,
234
254
  theme: CometChatTheme,
235
255
  group?: CometChat.Group
236
- ) => ChatConfigurator.dataSource.getMessageOptions(loggedInUser, messageObject, theme, group),
256
+ ) =>
257
+ ChatConfigurator.dataSource.getMessageOptions(
258
+ loggedInUser,
259
+ messageObject,
260
+ theme,
261
+ group,
262
+ additionalParams
263
+ ),
237
264
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
238
265
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
239
266
  },
@@ -277,7 +304,7 @@ export class CollaborativeWhiteboardExtensionDecorator extends DataSourceDecorat
277
304
  buttonText={localize("OPEN_WHITEBOARD")}
278
305
  icon={
279
306
  <Icon
280
- name="collaborative-whiteboard-fill"
307
+ name='collaborative-whiteboard-fill'
281
308
  height={_style?.iconStyle?.height}
282
309
  width={_style?.iconStyle?.width}
283
310
  color={_style?.iconStyle?.tintColor}
@@ -60,17 +60,19 @@ export class MessageTranslationExtensionDecorator extends DataSourceDecorator {
60
60
  loggedInUser: CometChat.User,
61
61
  messageObject: CometChat.BaseMessage,
62
62
  theme: CometChatTheme,
63
- group: CometChat.Group
63
+ group?: CometChat.Group,
64
+ additionalParams?: AdditionalParams
64
65
  ): CometChatMessageOption[] {
65
66
  // Retrieve default text message options from the decorated data source.
66
67
  let optionsList: CometChatMessageOption[] = super.getTextMessageOptions(
67
68
  loggedInUser,
68
69
  messageObject,
69
70
  theme,
70
- group
71
+ group,
72
+ additionalParams
71
73
  );
72
74
  // Add the translate option to the options list.
73
- optionsList.push(this.getTranslateOption(messageObject, theme));
75
+ !additionalParams?.hideTranslateMessageOption && optionsList.push(this.getTranslateOption(messageObject, theme));
74
76
  return optionsList;
75
77
  }
76
78
 
@@ -327,7 +329,6 @@ export class MessageTranslationExtensionDecorator extends DataSourceDecorator {
327
329
  mentionsFormatterExists = true;
328
330
  formatter.setMessage(message);
329
331
  formatter.setTargetElement(MentionsTargetElement.textbubble);
330
- formatter.setMentionsStyle();
331
332
  formatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
332
333
  }
333
334
  formatter.setMessage(message);
@@ -11,7 +11,11 @@ import { PollsConfigurationInterface } from "./PollsConfigurations";
11
11
  import React from "react";
12
12
  import { View } from "react-native";
13
13
  import { CometChatUIKit } from "../../shared";
14
- import { AdditionalParams, MessageBubbleAlignmentType } from "../../shared/base/Types";
14
+ import {
15
+ AdditionalAttachmentOptionsParams,
16
+ AdditionalParams,
17
+ MessageBubbleAlignmentType,
18
+ } from "../../shared/base/Types";
15
19
  import { Icon } from "../../shared/icons/Icon";
16
20
  import { getMessagePreviewInternal } from "../../shared/utils/MessageUtils";
17
21
  import { CometChatTheme } from "../../theme/type";
@@ -68,16 +72,24 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
68
72
  * @returns {string | JSX.Element}
69
73
  * @description Returns the preview text or element for the last conversation message.
70
74
  */
71
- getLastConversationMessage(conversation: CometChat.Conversation, theme?: CometChatTheme): string | JSX.Element {
72
- if (conversation["lastMessage"] == undefined) {
75
+ getLastConversationMessage(
76
+ conversation: CometChat.Conversation,
77
+ theme?: CometChatTheme
78
+ ): string | JSX.Element {
79
+ if (conversation.getLastMessage() == undefined) {
73
80
  return "";
74
81
  }
75
82
 
76
83
  if (
77
- conversation["lastMessage"]["type"] == ExtensionTypeConstants.extensionPoll &&
78
- conversation["lastMessage"]["category"] == MessageCategoryConstants.custom
84
+ (conversation.getLastMessage() as CometChat.BaseMessage).getType() ==
85
+ ExtensionTypeConstants.extensionPoll &&
86
+ (conversation.getLastMessage() as CometChat.BaseMessage).getCategory() ==
87
+ MessageCategoryConstants.custom &&
88
+ (conversation.getLastMessage() as CometChat.BaseMessage).getDeletedAt() === undefined
79
89
  ) {
80
- return getMessagePreviewInternal("bar-chart-fill", localize("CUSTOM_MESSAGE_POLL"), { theme });
90
+ return getMessagePreviewInternal("bar-chart-fill", localize("CUSTOM_MESSAGE_POLL"), {
91
+ theme,
92
+ });
81
93
  } else {
82
94
  return super.getLastConversationMessage(conversation, theme);
83
95
  }
@@ -123,14 +135,17 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
123
135
  theme: CometChatTheme,
124
136
  user?: any,
125
137
  group?: any,
126
- composerId?: any
138
+ composerId?: any,
139
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
127
140
  ): CometChatMessageComposerAction[] {
128
141
  let attachmentOptions: CometChatMessageComposerAction[] = super.getAttachmentOptions(
129
142
  theme,
130
143
  user,
131
144
  group,
132
- composerId
145
+ composerId,
146
+ additionalAttachmentOptionsParams
133
147
  );
148
+ if (additionalAttachmentOptionsParams?.hidePollsAttachmentOption) return attachmentOptions;
134
149
  if (
135
150
  composerId == undefined ||
136
151
  (composerId as Map<any, any>).get("parentMessageId") == undefined
@@ -182,7 +197,13 @@ export class PollsExtensionDecorator extends DataSourceDecorator {
182
197
  }
183
198
  },
184
199
  options: (loggedInUser, messageObject, theme, group) =>
185
- ChatConfigurator.dataSource.getMessageOptions(loggedInUser, messageObject, theme, group),
200
+ ChatConfigurator.dataSource.getMessageOptions(
201
+ loggedInUser,
202
+ messageObject,
203
+ theme,
204
+ group,
205
+ additionalParams
206
+ ),
186
207
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
187
208
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
188
209
  },
@@ -23,6 +23,7 @@ import { ExtensionTypeConstants } from "../ExtensionConstants";
23
23
  import { CometChatStickerKeyboard } from "./CometChatStickerKeyboard";
24
24
  import { CometChatStickerBubble } from "./StickersBubble";
25
25
  import { StickerConfigurationInterface } from "./StickerConfiguration";
26
+ import { AdditionalAuxiliaryOptionsParams } from "../../shared/base/Types";
26
27
 
27
28
  /**
28
29
  * StickerButton Component
@@ -93,8 +94,8 @@ const StickerButton = ({ user, group, id, stickerIconStyle, stickerIcon }: any)
93
94
  let receiverType = user
94
95
  ? CometChat.RECEIVER_TYPE.USER
95
96
  : group
96
- ? CometChat.RECEIVER_TYPE.GROUP
97
- : undefined;
97
+ ? CometChat.RECEIVER_TYPE.GROUP
98
+ : undefined;
98
99
 
99
100
  if (!receiverType) {
100
101
  console.error("Receiver type is undefined.");
@@ -189,7 +190,7 @@ const StickerButton = ({ user, group, id, stickerIconStyle, stickerIcon }: any)
189
190
  //color={!isPanelOpen ? theme.color.iconSecondary : theme.color.primary}
190
191
  color={
191
192
  !isPanelOpen
192
- ? stickerIconStyle.inactive.tintColor ?? theme.color.iconSecondary
193
+ ? (stickerIconStyle.inactive.tintColor ?? theme.color.iconSecondary)
193
194
  : theme.color.primary
194
195
  }
195
196
  />
@@ -239,7 +240,13 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
239
240
  }
240
241
  },
241
242
  options: (loggedInuser, message, theme, group) => {
242
- return ChatConfigurator.dataSource.getMessageOptions(loggedInuser, message, theme, group);
243
+ return ChatConfigurator.dataSource.getMessageOptions(
244
+ loggedInuser,
245
+ message,
246
+ theme,
247
+ group,
248
+ additionalParams
249
+ );
243
250
  },
244
251
  BottomView: (message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) => {
245
252
  return ChatConfigurator.dataSource.getBottomView(message, alignment);
@@ -284,19 +291,26 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
284
291
  user: CometChat.User,
285
292
  group: CometChat.Group,
286
293
  id?: Map<string, any>,
287
- additionalParams?: AdditionalParams
294
+ additionalAuxiliaryParams?: AdditionalAuxiliaryOptionsParams
288
295
  ) {
289
- return [
290
- ...super.getAuxiliaryOptions(user, group, id ?? new Map<string, any>(), additionalParams),
296
+ const auxiliaryOptions = super.getAuxiliaryOptions(
297
+ user,
298
+ group,
299
+ id ?? new Map<string, any>(),
300
+ additionalAuxiliaryParams
301
+ );
302
+ if (additionalAuxiliaryParams?.hideStickersButton) return auxiliaryOptions;
303
+ auxiliaryOptions.push(
291
304
  <StickerButton
292
305
  key='sticker-button'
293
306
  user={user}
294
307
  group={group}
295
308
  id={id}
296
- stickerIcon={additionalParams?.stickerIcon}
297
- stickerIconStyle={additionalParams?.stickerIconStyle}
298
- />,
299
- ];
309
+ stickerIcon={additionalAuxiliaryParams?.stickerIcon}
310
+ stickerIconStyle={additionalAuxiliaryParams?.stickerIconStyle}
311
+ />
312
+ );
313
+ return auxiliaryOptions;
300
314
  }
301
315
 
302
316
  /**
@@ -329,16 +343,20 @@ export class StickersExtensionDecorator extends DataSourceDecorator {
329
343
  /**
330
344
  * Customizes the last conversation message preview for sticker messages.
331
345
  */
332
- getLastConversationMessage(conversation: CometChat.Conversation,
346
+ getLastConversationMessage(
347
+ conversation: CometChat.Conversation,
333
348
  theme?: CometChatTheme
334
349
  ): string | JSX.Element {
335
- const message = conversation["lastMessage"];
350
+ const message = conversation.getLastMessage() as CometChat.BaseMessage;
336
351
  if (
337
352
  message != null &&
338
- message.type === ExtensionTypeConstants.sticker &&
339
- message.category === MessageCategoryConstants.custom
353
+ message.getType() === ExtensionTypeConstants.sticker &&
354
+ message.getCategory() === MessageCategoryConstants.custom &&
355
+ message.getDeletedAt() === undefined
340
356
  ) {
341
- return getMessagePreviewInternal("sticker-fill", localize("CUSTOM_MESSAGE_STICKER"), {theme});
357
+ return getMessagePreviewInternal("sticker-fill", localize("CUSTOM_MESSAGE_STICKER"), {
358
+ theme,
359
+ });
342
360
  } else {
343
361
  return super.getLastConversationMessage(conversation, theme);
344
362
  }
package/src/index.ts CHANGED
@@ -78,6 +78,7 @@ import {
78
78
  localize,
79
79
  messageStatus,
80
80
  Icon,
81
+ MenuItemInterface,
81
82
  } from "./shared";
82
83
 
83
84
  import {
@@ -302,5 +303,6 @@ export type {
302
303
  MessageListAlignmentType,
303
304
  MessageTimeAlignmentType,
304
305
  MessageBubbleAlignmentType,
305
- CometChatTheme
306
+ CometChatTheme,
307
+ MenuItemInterface
306
308
  };
@@ -16,12 +16,42 @@ export type MessageTimeAlignmentType = "top" | "bottom";
16
16
  export type AdditionalParams = {
17
17
  textFormatters?: CometChatTextFormatter[];
18
18
  disableMentions?: boolean;
19
- callButtonStyle?: DeepPartial<CometChatTheme['callButtonStyles']>;
19
+ hideReplyInThreadOption?: boolean,
20
+ hideShareMessageOption?: boolean,
21
+ hideEditMessageOption?: boolean,
22
+ hideTranslateMessageOption?: boolean,
23
+ hideDeleteMessageOption?: boolean,
24
+ hideReactionOption?: boolean,
25
+ hideMessagePrivatelyOption?: boolean,
26
+ hideCopyMessageOption?: boolean,
27
+ hideMessageInfoOption?: boolean,
28
+ hideGroupActionMessages?: boolean,
29
+ };
30
+
31
+ export type AdditionalAttachmentOptionsParams = {
32
+ hideCameraOption?: boolean;
33
+ hideImageAttachmentOption?: boolean;
34
+ hideVideoAttachmentOption?: boolean;
35
+ hideAudioAttachmentOption?: boolean;
36
+ hideFileAttachmentOption?: boolean;
37
+ hidePollsAttachmentOption?: boolean;
38
+ hideCollaborativeDocumentOption?: boolean;
39
+ hideCollaborativeWhiteboardOption?: boolean;
40
+ };
41
+
42
+ export type AdditionalAuxiliaryOptionsParams = {
20
43
  stickerIconStyle?: {
21
44
  active: ImageStyle,
22
45
  inactive: ImageStyle;
23
46
  };
24
47
  stickerIcon?: JSX.Element | ImageSourcePropType;
48
+ hideStickersButton?: boolean;
49
+ };
50
+
51
+ export type AdditionalAuxiliaryHeaderOptionsParams = {
52
+ callButtonStyle?: DeepPartial<CometChatTheme['callButtonStyles']>;
53
+ hideVoiceCallButton?: boolean;
54
+ hideVideoCallButton?: boolean;
25
55
  };
26
56
 
27
57
  //AdditionalParams
@@ -1,6 +1,9 @@
1
1
  import { CometChat } from "@cometchat/chat-sdk-react-native";
2
2
  import { CometChatTheme } from "../../theme/type";
3
3
  import {
4
+ AdditionalAttachmentOptionsParams,
5
+ AdditionalAuxiliaryHeaderOptionsParams,
6
+ AdditionalAuxiliaryOptionsParams,
4
7
  AdditionalParams,
5
8
  MessageBubbleAlignmentType,
6
9
  } from "../base/Types";
@@ -19,47 +22,57 @@ export interface DataSource {
19
22
  loggedInUser: CometChat.User,
20
23
  messageObject: CometChat.BaseMessage,
21
24
  theme: CometChatTheme,
22
- group?: CometChat.Group
25
+ group?: CometChat.Group,
26
+ additionalParams?: AdditionalParams
23
27
  ): Array<CometChatMessageOption>;
24
28
  getAudioMessageOptions(
25
29
  loggedInUser: CometChat.User,
26
30
  messageObject: CometChat.BaseMessage,
27
31
  theme: CometChatTheme,
28
- group?: CometChat.Group
32
+ group?: CometChat.Group,
33
+ additionalParams?: AdditionalParams
29
34
  ): Array<CometChatMessageOption>;
30
35
  getVideoMessageOptions(
31
36
  loggedInUser: CometChat.User,
32
37
  messageObject: CometChat.BaseMessage,
33
38
  theme: CometChatTheme,
34
- group?: CometChat.Group
39
+ group?: CometChat.Group,
40
+ additionalParams?: AdditionalParams
35
41
  ): Array<CometChatMessageOption>;
36
42
  getImageMessageOptions(
37
43
  loggedInUser: CometChat.User,
38
44
  messageObject: CometChat.BaseMessage,
39
45
  theme: CometChatTheme,
40
- group?: CometChat.Group
46
+ group?: CometChat.Group,
47
+ additionalParams?: AdditionalParams
41
48
  ): Array<CometChatMessageOption>;
42
49
  getFileMessageOptions(
43
50
  loggedInUser: CometChat.User,
44
51
  messageObject: CometChat.BaseMessage,
45
52
  theme: CometChatTheme,
46
- group?: CometChat.Group
53
+ group?: CometChat.Group,
54
+ additionalParams?: AdditionalParams
47
55
  ): Array<CometChatMessageOption>;
48
56
  getMessageOptions(
49
57
  loggedInUser: CometChat.User,
50
58
  messageObject: CometChat.BaseMessage,
51
59
  theme: CometChatTheme,
52
- group?: CometChat.Group
60
+ group?: CometChat.Group,
61
+ additionalParams?: AdditionalParams
53
62
  ): Array<CometChatMessageOption>;
54
63
  getCommonOptions(
55
64
  loggedInUser: CometChat.User,
56
65
  messageObject: CometChat.BaseMessage,
57
66
  theme: CometChatTheme,
58
- group?: CometChat.Group
67
+ group?: CometChat.Group,
68
+ additionalParams?: AdditionalParams
59
69
  ): Array<CometChatMessageOption>;
60
70
 
61
71
  //views
62
- getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType): JSX.Element | null;
72
+ getBottomView(
73
+ message: CometChat.BaseMessage,
74
+ alignment: MessageBubbleAlignmentType
75
+ ): JSX.Element | null;
63
76
  getDeleteMessageBubble(message: CometChat.BaseMessage, theme: CometChatTheme): JSX.Element;
64
77
  getVideoMessageBubble(
65
78
  videoUrl: string,
@@ -129,10 +142,22 @@ export interface DataSource {
129
142
  theme: CometChatTheme,
130
143
  additionalParams?: AdditionalParams
131
144
  ): CometChatMessageTemplate;
132
- getAudioMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
133
- getVideoMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
134
- getImageMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
135
- getFileMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
145
+ getAudioMessageTemplate(
146
+ theme: CometChatTheme,
147
+ additionalParams?: AdditionalParams
148
+ ): CometChatMessageTemplate;
149
+ getVideoMessageTemplate(
150
+ theme: CometChatTheme,
151
+ additionalParams?: AdditionalParams
152
+ ): CometChatMessageTemplate;
153
+ getImageMessageTemplate(
154
+ theme: CometChatTheme,
155
+ additionalParams?: AdditionalParams
156
+ ): CometChatMessageTemplate;
157
+ getFileMessageTemplate(
158
+ theme: CometChatTheme,
159
+ additionalParams?: AdditionalParams
160
+ ): CometChatMessageTemplate;
136
161
  getAllMessageTemplates(
137
162
  theme: CometChatTheme,
138
163
  additionalParams?: AdditionalParams
@@ -140,12 +165,25 @@ export interface DataSource {
140
165
  getMessageTemplate(
141
166
  messageType: string,
142
167
  MessageCategory: string,
143
- theme: CometChatTheme
168
+ theme: CometChatTheme,
169
+ additionalParams?: AdditionalParams
144
170
  ): CometChatMessageTemplate | null;
145
- getGroupActionTemplate(theme: CometChatTheme): CometChatMessageTemplate;
146
- getFormMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
147
- getSchedulerMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
148
- getCardMessageTemplate(theme: CometChatTheme): CometChatMessageTemplate;
171
+ getGroupActionTemplate(
172
+ theme: CometChatTheme,
173
+ additionalParams?: AdditionalParams
174
+ ): CometChatMessageTemplate;
175
+ getFormMessageTemplate(
176
+ theme: CometChatTheme,
177
+ additionalParams?: AdditionalParams
178
+ ): CometChatMessageTemplate;
179
+ getSchedulerMessageTemplate(
180
+ theme: CometChatTheme,
181
+ additionalParams?: AdditionalParams
182
+ ): CometChatMessageTemplate;
183
+ getCardMessageTemplate(
184
+ theme: CometChatTheme,
185
+ additionalParams?: AdditionalParams
186
+ ): CometChatMessageTemplate;
149
187
 
150
188
  //attachment options
151
189
  // getAttachmentOptions(theme: CometChatTheme, conversation: CometChat.User | CometChat.Group): Array<CometChatMessageComposerAction>
@@ -158,7 +196,7 @@ export interface DataSource {
158
196
  user?: CometChat.User,
159
197
  group?: CometChat.Group,
160
198
  id?: Map<string, any>,
161
- additionalParams?: AdditionalParams
199
+ additionalAuxiliaryParams?: AdditionalAuxiliaryOptionsParams
162
200
  ): JSX.Element[];
163
201
 
164
202
  getId(): string;
@@ -166,7 +204,13 @@ export interface DataSource {
166
204
  //unknown
167
205
  getMessageTypeToSubtitle(messageType: string): string;
168
206
  //Message Composer
169
- getAttachmentOptions: (theme: CometChatTheme, user?: any, group?: any, composerId?: any) => any;
207
+ getAttachmentOptions: (
208
+ theme: CometChatTheme,
209
+ user?: any,
210
+ group?: any,
211
+ composerId?: any,
212
+ additionalAttachmentOptionsParams?: AdditionalAttachmentOptionsParams
213
+ ) => any;
170
214
  getAuxiliaryButtonOptions: () => any;
171
215
 
172
216
  getLastConversationMessage(
@@ -177,7 +221,7 @@ export interface DataSource {
177
221
  getAuxiliaryHeaderAppbarOptions(
178
222
  user?: CometChat.User,
179
223
  group?: CometChat.Group,
180
- additionalParams?: AdditionalParams
224
+ additionalAuxiliaryHeaderOptionsParams?: AdditionalAuxiliaryHeaderOptionsParams
181
225
  ): JSX.Element | null;
182
226
 
183
227
  getAllTextFormatters(loggedInUser?: CometChat.User): CometChatTextFormatter[];