@cometchat/chat-uikit-react-native 4.0.2 → 4.1.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 (169) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +164 -0
  4. package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +22 -0
  5. package/src/AI/AIAssistBot/AIAssistBotStyle.ts +43 -0
  6. package/src/AI/AIAssistBot/AIAssistBotView.tsx +294 -0
  7. package/src/AI/AIAssistBot/configuration.ts +22 -0
  8. package/src/AI/AIAssistBot/resources/index.ts +5 -0
  9. package/src/AI/{configuration.ts → AIBaseConfiguration.ts} +3 -6
  10. package/src/AI/AIBaseStyle.ts +58 -0
  11. package/src/AI/AIConversationStarter/AIConversationStarter.ts +5 -19
  12. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +144 -130
  13. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +11 -6
  14. package/src/AI/AIConversationStarter/configuration.ts +10 -17
  15. package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +175 -0
  16. package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +21 -0
  17. package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +20 -0
  18. package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +190 -0
  19. package/src/AI/AIConversationSummary/configuration.ts +14 -0
  20. package/src/AI/AIConversationSummary/resources/close.png +0 -0
  21. package/src/AI/AIConversationSummary/resources/index.ts +5 -0
  22. package/src/AI/AIExtensionDataSource.ts +17 -12
  23. package/src/AI/AIOptionsStyle.ts +14 -0
  24. package/src/AI/AISmartReplies/AISmartReplies.ts +6 -15
  25. package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +302 -0
  26. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +1 -1
  27. package/src/AI/AISmartReplies/configuration.ts +4 -11
  28. package/src/AI/resources/index.ts +0 -2
  29. package/src/AI/utils.ts +3 -3
  30. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +118 -5
  31. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +3 -0
  32. package/src/CometChatMessageComposer/resources/index.ts +2 -0
  33. package/src/CometChatMessageComposer/styles.ts +1 -4
  34. package/src/CometChatMessageList/CometChatMessageList.tsx +33 -24
  35. package/src/CometChatMessages/CometChatMessages.tsx +4 -13
  36. package/src/CometChatMessages/MessagesConfiguration.ts +2 -2
  37. package/src/calls/CallUtils.ts +106 -45
  38. package/src/calls/CallingDetailsUtils.tsx +133 -15
  39. package/src/calls/CallingPackage.ts +16 -2
  40. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +9 -10
  41. package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +116 -0
  42. package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +36 -0
  43. package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +308 -0
  44. package/src/calls/CometChatCallLogDetails/index.ts +12 -0
  45. package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
  46. package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/style.ts +1 -0
  47. package/src/calls/{CometChatCallHistory/CallHistoryConfiguration.ts → CometChatCallLogHistory/CallLogHistoryConfiguration.ts} +15 -27
  48. package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +46 -0
  49. package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +337 -0
  50. package/src/calls/CometChatCallLogHistory/index.ts +12 -0
  51. package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
  52. package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
  53. package/src/calls/CometChatCallLogHistory/resources/index.ts +29 -0
  54. package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
  55. package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
  56. package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
  57. package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
  58. package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/style.ts +2 -1
  59. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +61 -0
  60. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +59 -0
  61. package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +220 -0
  62. package/src/calls/CometChatCallLogParticipants/index.ts +12 -0
  63. package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
  64. package/src/calls/CometChatCallLogParticipants/resources/index.ts +4 -0
  65. package/src/calls/CometChatCallLogParticipants/style.ts +24 -0
  66. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +63 -0
  67. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +63 -0
  68. package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +253 -0
  69. package/src/calls/CometChatCallLogRecordings/index.ts +12 -0
  70. package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
  71. package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
  72. package/src/calls/CometChatCallLogRecordings/resources/index.ts +6 -0
  73. package/src/calls/CometChatCallLogRecordings/style.ts +24 -0
  74. package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +87 -0
  75. package/src/calls/CometChatCallLogs/CallLogsStyle.ts +95 -0
  76. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +482 -0
  77. package/src/calls/CometChatCallLogs/index.ts +12 -0
  78. package/src/calls/CometChatCallLogs/resources/Back.png +0 -0
  79. package/src/calls/CometChatCallLogs/resources/Info.png +0 -0
  80. package/src/calls/CometChatCallLogs/resources/Selection.png +0 -0
  81. package/src/calls/CometChatCallLogs/resources/Spinner.png +0 -0
  82. package/src/calls/CometChatCallLogs/resources/check.png +0 -0
  83. package/src/calls/CometChatCallLogs/resources/incomingcall.png +0 -0
  84. package/src/calls/CometChatCallLogs/resources/incomingvideo.png +0 -0
  85. package/src/calls/CometChatCallLogs/resources/index.ts +25 -0
  86. package/src/calls/CometChatCallLogs/resources/missedcall.png +0 -0
  87. package/src/calls/CometChatCallLogs/resources/missedvideo.png +0 -0
  88. package/src/calls/CometChatCallLogs/resources/outgoingcall.png +0 -0
  89. package/src/calls/CometChatCallLogs/resources/outgoingvideo.png +0 -0
  90. package/src/calls/CometChatCallLogs/style.ts +24 -0
  91. package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +9 -0
  92. package/src/calls/{CometChatCallHistoryWithDetails/CometChatCallHistoryWithDetails.tsx → CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx} +17 -16
  93. package/src/calls/CometChatCallLogsWithDetails/index.ts +7 -0
  94. package/src/calls/index.ts +40 -1
  95. package/src/calls/resources/index.ts +3 -1
  96. package/src/calls/resources/nextarrow.png +0 -0
  97. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +3 -5
  98. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +1 -1
  99. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -3
  100. package/src/extensions/ThumbnailGeneration/resources/empty.png +0 -0
  101. package/src/extensions/ThumbnailGeneration/resources/index.ts +5 -0
  102. package/src/index.ts +79 -4
  103. package/src/shared/CometChatUiKit/CometChatUIKit.ts +154 -130
  104. package/src/shared/CometChatUiKit/UIKitSettings.ts +2 -2
  105. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +1 -1
  106. package/src/shared/framework/DataSource.ts +4 -0
  107. package/src/shared/framework/DataSourceDecorator.tsx +5 -0
  108. package/src/shared/framework/MessageDataSource.tsx +4 -1
  109. package/src/shared/index.ts +4 -0
  110. package/src/shared/modals/CometChatCallLogDetailsOptions.ts +23 -0
  111. package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +16 -0
  112. package/src/shared/modals/index.ts +5 -1
  113. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +19 -5
  114. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +19 -5
  115. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +21 -7
  116. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +19 -5
  117. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +19 -5
  118. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +19 -5
  119. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +19 -5
  120. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +19 -5
  121. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +19 -5
  122. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +19 -5
  123. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +19 -5
  124. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +19 -4
  125. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +19 -5
  126. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  127. package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +1 -1
  128. package/src/shared/views/CometChatAICard/CometChatAICard.tsx +71 -0
  129. package/src/shared/views/CometChatAICard/resources/errormessage.png +0 -0
  130. package/src/shared/views/CometChatAICard/resources/index.ts +4 -0
  131. package/src/shared/views/CometChatAICard/resources/nomessage.png +0 -0
  132. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +4 -0
  133. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +11 -7
  134. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +56 -47
  135. package/src/shared/views/CometChatBottomSheet/style.ts +0 -2
  136. package/src/shared/views/CometChatDate/CometChatDate.tsx +7 -3
  137. package/src/shared/views/CometChatDate/DateConfiguration.ts +4 -0
  138. package/src/shared/views/CometChatDate/style.ts +1 -1
  139. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +31 -19
  140. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +1 -2
  141. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +51 -0
  142. package/src/shared/views/CometChatPanel/PanelStyle.tsx +43 -0
  143. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  144. package/src/shared/views/CometChatPanel/resources/index.ts +5 -0
  145. package/src/AI/AIEnabler.ts +0 -115
  146. package/src/AI/AIEnablerDecorator.tsx +0 -324
  147. package/src/AI/AISmartReplies/AISmartRepliesDecorator.ts +0 -18
  148. package/src/calls/CometChatCallDetails/CallDetailsConfiguration.ts +0 -68
  149. package/src/calls/CometChatCallDetails/CallDetailsStyle.ts +0 -52
  150. package/src/calls/CometChatCallDetails/CometChatCallDetails.tsx +0 -268
  151. package/src/calls/CometChatCallDetails/index.ts +0 -9
  152. package/src/calls/CometChatCallHistory/CallHistoryStyle.ts +0 -34
  153. package/src/calls/CometChatCallHistory/CometChatCallHistory.tsx +0 -422
  154. package/src/calls/CometChatCallHistory/index.ts +0 -9
  155. package/src/calls/CometChatCallHistory/resources/index.ts +0 -17
  156. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsConfiguration.ts +0 -7
  157. package/src/calls/CometChatCallHistoryWithDetails/HistoryWithDetailsStyle.ts +0 -3
  158. package/src/calls/CometChatCallHistoryWithDetails/index.ts +0 -8
  159. /package/src/{calls/CometChatCallDetails → AI/AIAssistBot}/resources/CloseIcon.png +0 -0
  160. /package/src/{AI → CometChatMessageComposer}/resources/ai.png +0 -0
  161. /package/src/calls/{CometChatCallDetails → CometChatCallLogDetails}/resources/index.ts +0 -0
  162. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Back.png +0 -0
  163. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Call.png +0 -0
  164. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Info.png +0 -0
  165. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Selection.png +0 -0
  166. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Spineer.png +0 -0
  167. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/Video.png +0 -0
  168. /package/src/calls/{CometChatCallHistory → CometChatCallLogHistory}/resources/check.png +0 -0
  169. /package/src/calls/{CometChatCallHistoryWithDetails → CometChatCallLogsWithDetails}/style.ts +0 -0
@@ -21,12 +21,15 @@ import { CometChatSoundManager } from "../utils";
21
21
  import { CometChatLocalize } from "../resources";
22
22
  import { CardMessage, CustomInteractiveMessage, FormMessage } from "../modals/InteractiveData";
23
23
  import { ListenerInitializer } from "../events/ListenerInitializer";
24
- import { AIEnabler } from "../../AI/AIEnabler";
25
24
  import { AIConversationStarterExtension } from "../../AI/AIConversationStarter/AIConversationStarter";
25
+ import { AIExtensionDataSource } from "../../AI/AIExtensionDataSource";
26
+ import { AISmartRepliesExtension } from "../../AI/AISmartReplies/AISmartReplies";
27
+ import { AIConversationSummaryExtension } from "../../AI/AIConversationSummary/AIConversationSummaryExtension";
28
+ import { AIAssistBotExtension } from "../../AI/AIAssistBot/AIAssistBotExtension";
26
29
 
27
30
  export class CometChatUIKit {
28
31
  static uiKitSettings: UIKitSettings;
29
- static aiFeatures: AIEnabler
32
+ static aiFeatures:AIExtensionDataSource[]
30
33
  static init(uiKitSettings: UIKitSettings): Promise<boolean> {
31
34
 
32
35
  //perform sdk init taking values from uiKitSettings
@@ -40,8 +43,6 @@ export class CometChatUIKit {
40
43
  .overrideAdminHost(uiKitSettings?.overrideAdminHost)
41
44
  .overrideClientHost(uiKitSettings?.overrideClientHost)
42
45
  .setRegion(uiKitSettings.region)
43
- .overrideAdminHost(uiKitSettings.overrideAdminHost)
44
- .overrideClientHost(uiKitSettings.overrideClientHost)
45
46
 
46
47
 
47
48
  appSetting.subscriptionType = uiKitSettings.subscriptionType;
@@ -68,6 +69,13 @@ export class CometChatUIKit {
68
69
  new PollsExtension(),
69
70
  new ReactionsExtension(),
70
71
  new ImageModerationExtension()
72
+ ]
73
+
74
+ static defaultAIFeatures: AIExtensionDataSource[] = [
75
+ new AISmartRepliesExtension(),
76
+ new AIConversationStarterExtension(),
77
+ new AIConversationSummaryExtension(),
78
+ new AIAssistBotExtension()
71
79
  ]
72
80
 
73
81
  private static enableExtensions() {
@@ -78,18 +86,18 @@ export class CometChatUIKit {
78
86
  new CallingExtension().enable();
79
87
  }
80
88
  let extensionList: ExtensionsDataSource[] = this.uiKitSettings?.extensions || this.defaultExtensions;
89
+ let aiFeaturesList: AIExtensionDataSource[] = this.uiKitSettings?.aiFeatures || this.defaultAIFeatures;
81
90
 
82
- if (extensionList.length > 0) {
83
- extensionList.forEach((extension: ExtensionsDataSource) => {
84
- extension?.enable();
85
- });
86
- }
87
- if (this.uiKitSettings.aiFeatures) {
88
- this.uiKitSettings.aiFeatures?.enable()
89
- }
90
- else {
91
- new AIEnabler().enable()
92
- }
91
+ if (extensionList.length > 0) {
92
+ extensionList.forEach((extension: ExtensionsDataSource) => {
93
+ extension?.enable();
94
+ });
95
+ }
96
+ if(aiFeaturesList.length > 0){
97
+ aiFeaturesList.forEach((aiFeatures: AIExtensionDataSource) => {
98
+ aiFeatures.enable();
99
+ })
100
+ }
93
101
 
94
102
 
95
103
  }
@@ -166,68 +174,75 @@ export class CometChatUIKit {
166
174
 
167
175
  //---------- Helper methods to send messages ----------
168
176
  ///[sendCustomMessage] used to send a custom message
169
- static sendCustomMessage(message: CometChat.CustomMessage, onSuccess?: (msg: CometChat.CustomMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void {
170
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
171
- CometChat.sendCustomMessage(message)
172
- .then(customMessage => {
173
- CometChatUIKitHelper.onMessageSent(customMessage, messageStatus.success);
174
- onSuccess && onSuccess(customMessage);
175
- })
176
- .catch(err => {
177
- CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
178
- onError && onError(err);
179
- })
177
+ static sendCustomMessage(message: CometChat.CustomMessage): Promise<CometChat.CustomMessage | CometChat.BaseMessage> {
178
+ return new Promise((resolve, reject) => {
179
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
180
+ CometChat.sendCustomMessage(message)
181
+ .then(customMessage => {
182
+ CometChatUIKitHelper.onMessageSent(customMessage, messageStatus.success);
183
+ resolve(customMessage);
184
+ })
185
+ .catch(err => {
186
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
187
+ reject(err);
188
+ });
189
+ });
180
190
  }
181
191
 
182
192
  ///[sendMediaMessage] used to send a media message
183
- static sendMediaMessage(message: CometChat.MediaMessage, onSuccess?: (msg: CometChat.MediaMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void {
184
- let hasAttachment;
185
- try {
186
- hasAttachment = message.getAttachment();
187
- } catch (error) {
188
- console.log("no attachment found");
189
- }
190
- if (hasAttachment == undefined) {
191
- let file = message['files'][0];
192
- if (file == undefined) {
193
- onError && onError(new CometChat.CometChatException({
194
- code: "Invalid Media message object",
195
- message: "file object not found."
196
- }))
193
+ static sendMediaMessage(message: CometChat.MediaMessage): Promise<CometChat.MediaMessage | CometChat.BaseMessage> {
194
+ return new Promise((resolve, reject) => {
195
+ let hasAttachment;
196
+ try {
197
+ hasAttachment = message.getAttachment();
198
+ } catch (error) {
199
+ console.log("no attachment found");
200
+ }
201
+ if (hasAttachment == undefined) {
202
+ let file = message['files'][0];
203
+ if (file == undefined) {
204
+ reject(new CometChat.CometChatException({
205
+ code: "Invalid Media message object",
206
+ message: "file object not found."
207
+ }));
208
+ }
209
+
210
+ let attachmentObject: CometChat.Attachment = new CometChat.Attachment(file);
211
+ attachmentObject.setName(file['name']);
212
+ attachmentObject.setExtension((file['name'].lastIndexOf('.') + 1).toString());
213
+ attachmentObject.setMimeType(file['type']);
214
+ attachmentObject.setSize(0);
215
+ attachmentObject.setUrl(file['uri']);
216
+ message.setAttachment(attachmentObject);
197
217
  }
198
- let attachmentObject: CometChat.Attachment = new CometChat.Attachment(file);
199
- attachmentObject.setName(file['name']);
200
- attachmentObject.setExtension((file['name'].lastIndexOf('.') + 1).toString());
201
- attachmentObject.setMimeType(file['type']);
202
- attachmentObject.setSize(0);
203
- attachmentObject.setUrl(file['uri']);
204
- message.setAttachment(attachmentObject);
205
- }
206
218
 
207
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
208
- CometChat.sendMediaMessage(message)
209
- .then(mediaMessage => {
210
- CometChatUIKitHelper.onMessageSent(mediaMessage, messageStatus.success);
211
- onSuccess && onSuccess(mediaMessage);
212
- })
213
- .catch(err => {
214
- CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
215
- onError && onError(err);
216
- })
219
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
220
+ CometChat.sendMediaMessage(message)
221
+ .then(mediaMessage => {
222
+ CometChatUIKitHelper.onMessageSent(mediaMessage, messageStatus.success);
223
+ resolve(mediaMessage);
224
+ })
225
+ .catch(err => {
226
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
227
+ reject(err);
228
+ });
229
+ });
217
230
  }
218
231
 
219
232
  ///[sendTextMessage] used to send a text message
220
- static sendTextMessage(message: CometChat.TextMessage, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void): void {
221
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
222
- CometChat.sendMessage(message)
223
- .then(textMessage => {
224
- CometChatUIKitHelper.onMessageSent(textMessage, messageStatus.success);
225
- onSuccess && onSuccess(textMessage);
226
- })
227
- .catch(err => {
228
- CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
229
- onError && onError(err);
230
- })
233
+ static sendTextMessage(message: CometChat.TextMessage): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
234
+ return new Promise((resolve, reject) => {
235
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
236
+ CometChat.sendMessage(message)
237
+ .then(textMessage => {
238
+ CometChatUIKitHelper.onMessageSent(textMessage, messageStatus.success);
239
+ resolve(textMessage);
240
+ })
241
+ .catch(err => {
242
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
243
+ reject(err);
244
+ });
245
+ });
231
246
  }
232
247
 
233
248
  /**
@@ -235,26 +250,29 @@ export class CometChatUIKit {
235
250
  * @param message - The FormMessage message to be sent.
236
251
  * @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
237
252
  */
238
- static sendFormMessage(message: FormMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
239
- if (!disableLocalEvents) {
240
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
241
- }
242
- CometChat.sendInteractiveMessage(message)
243
- .then((message: CometChat.BaseMessage) => {
244
- console.log("message sent successfully", message.getSentAt())
245
- if (!disableLocalEvents) {
246
- CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
247
- }
248
- onSuccess && onSuccess(message);
249
- })
250
- .catch((error: CometChat.CometChatException) => {
251
- console.log("error while sending message", { error })
252
- message.setMetadata({ error });
253
- // if (!disableLocalEvents) {
254
- // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
255
- // }
256
- onError && onError(error);
257
- });
253
+ static sendFormMessage(message: FormMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
254
+ return new Promise((resolve, reject) => {
255
+ if (!disableLocalEvents) {
256
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
257
+ }
258
+
259
+ CometChat.sendInteractiveMessage(message)
260
+ .then((message: CometChat.BaseMessage) => {
261
+ console.log("message sent successfully", message.getSentAt())
262
+ if (!disableLocalEvents) {
263
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
264
+ }
265
+ resolve(message);
266
+ })
267
+ .catch((error: CometChat.CometChatException) => {
268
+ console.log("error while sending message", { error })
269
+ message.setMetadata({ error });
270
+ // if (!disableLocalEvents) {
271
+ // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
272
+ // }
273
+ reject(error);
274
+ });
275
+ });
258
276
  }
259
277
 
260
278
  /**
@@ -262,27 +280,30 @@ export class CometChatUIKit {
262
280
  * @param message - The Card message to be sent.
263
281
  * @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
264
282
  */
265
- static sendCardMessage(message: CardMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
266
- if (!disableLocalEvents) {
267
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
268
- }
269
- console.log("message", JSON.stringify(message))
270
- CometChat.sendInteractiveMessage(message)
271
- .then((message: CometChat.BaseMessage) => {
272
- console.log("message sent successfully", message.getSentAt())
273
- if (!disableLocalEvents) {
274
- CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
275
- }
276
- onSuccess && onSuccess(message);
277
- })
278
- .catch((error: CometChat.CometChatException) => {
279
- console.log("error while sending message", { error })
280
- message.setMetadata({ error });
281
- // if (!disableLocalEvents) {
282
- // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
283
- // }
284
- onError && onError(error);
285
- });
283
+ static sendCardMessage(message: CardMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
284
+ return new Promise((resolve, reject) => {
285
+ if (!disableLocalEvents) {
286
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
287
+ }
288
+ console.log("message", JSON.stringify(message));
289
+
290
+ CometChat.sendInteractiveMessage(message)
291
+ .then((message: CometChat.BaseMessage) => {
292
+ console.log("message sent successfully", message.getSentAt())
293
+ if (!disableLocalEvents) {
294
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
295
+ }
296
+ resolve(message);
297
+ })
298
+ .catch((error: CometChat.CometChatException) => {
299
+ console.log("error while sending message", { error })
300
+ message.setMetadata({ error });
301
+ // if (!disableLocalEvents) {
302
+ // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
303
+ // }
304
+ reject(error);
305
+ });
306
+ });
286
307
  }
287
308
 
288
309
  /**
@@ -290,26 +311,29 @@ export class CometChatUIKit {
290
311
  * @param message - The Custom Interactive message to be sent.
291
312
  * @param disableLocalEvents - A boolean indicating whether to disable local events or not. Default value is false.
292
313
  */
293
- static sendCustomInteractiveMessage(message: CustomInteractiveMessage, disableLocalEvents: boolean = false, onSuccess?: (msg: CometChat.TextMessage | CometChat.BaseMessage) => void, onError?: (msg: CometChat.CometChatException) => void) {
294
- if (!disableLocalEvents) {
295
- CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
296
- }
297
- CometChat.sendInteractiveMessage(message)
298
- .then((message: CometChat.BaseMessage) => {
299
- console.log("message sent successfully", message.getSentAt())
300
- if (!disableLocalEvents) {
301
- CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
302
- }
303
- onSuccess && onSuccess(message);
304
- })
305
- .catch((error: CometChat.CometChatException) => {
306
- console.log("error while sending message", { error })
307
- message.setMetadata({ error });
308
- // if (!disableLocalEvents) {
309
- // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
310
- // }
311
- onError && onError(error);
312
- });
314
+ static sendCustomInteractiveMessage(message: CustomInteractiveMessage, disableLocalEvents: boolean = false): Promise<CometChat.TextMessage | CometChat.BaseMessage> {
315
+ return new Promise((resolve, reject) => {
316
+ if (!disableLocalEvents) {
317
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.inprogress);
318
+ }
319
+
320
+ CometChat.sendInteractiveMessage(message)
321
+ .then((message: CometChat.BaseMessage) => {
322
+ console.log("message sent successfully", message.getSentAt())
323
+ if (!disableLocalEvents) {
324
+ CometChatUIKitHelper.onMessageSent(message, messageStatus.success);
325
+ }
326
+ resolve(message);
327
+ })
328
+ .catch((error: CometChat.CometChatException) => {
329
+ console.log("error while sending message", { error })
330
+ message.setMetadata({ error });
331
+ // if (!disableLocalEvents) {
332
+ // CometChatUIKitHelper.onMessageSent(message, messageStatus.error);
333
+ // }
334
+ reject(error);
335
+ });
336
+ });
313
337
  }
314
338
 
315
339
  static getDataSource() {
@@ -1,4 +1,4 @@
1
- import { AIEnabler } from "../../AI/AIEnabler"
1
+ import { AIExtensionDataSource } from "../../AI/AIExtensionDataSource"
2
2
  import { ExtensionsDataSource } from "../framework"
3
3
 
4
4
  export type UIKitSettings = {
@@ -12,7 +12,7 @@ export type UIKitSettings = {
12
12
  deviceToken?: string,
13
13
  googleApiKey?: string,
14
14
  disableCalling?: boolean,
15
- aiFeatures?:AIEnabler,
15
+ aiFeatures?:AIExtensionDataSource[],
16
16
  extensions?:ExtensionsDataSource[]
17
17
  }
18
18
 
@@ -10,7 +10,7 @@ import {
10
10
  PanelListener,
11
11
  UserListener,
12
12
  UserUIEventListener,
13
- UIEventListener,
13
+ UIEventListener,
14
14
  UIListener
15
15
  } from "./Listener";
16
16
 
@@ -8,6 +8,8 @@ import { AudioBubbleStyleInterface } from "../views/CometChatAudioBubble";
8
8
  import { FileBubbleStyleInterface } from "../views/CometChatFileBubble";
9
9
  import { ImageBubbleStyleInterface } from "../views/CometChatImageBubble";
10
10
  import { VideoBubbleStyleInterface } from "../views/CometChatVideoBubble";
11
+ import { CometChatMessageComposerActionInterface } from "../helper/types";
12
+ import { AIOptionsStyle } from "../../AI/AIOptionsStyle";
11
13
  import { CardMessage, FormMessage } from "../modals/InteractiveData";
12
14
  import { FormBubbleStyle } from "../views/CometChatFormBubble/FormBubbleStyle";
13
15
  import { CardBubbleStyle } from "../views/CometChatCardBubble/CardBubbleStyle";
@@ -80,4 +82,6 @@ export interface DataSource {
80
82
  getLastConversationMessage(conversation : CometChat.Conversation): string
81
83
 
82
84
  getAuxiliaryHeaderAppbarOptions(user?: CometChat.User, group?: CometChat.Group, theme?: CometChatTheme): JSX.Element
85
+
86
+ getAIOptions(user: CometChat.User | null, group: CometChat.Group | null, theme: CometChatTheme, id?: Map<String, any>, AIOptionsStyle?: AIOptionsStyle): Array<(CometChatMessageComposerActionInterface | CometChatMessageOption)>
83
87
  }
@@ -1,3 +1,4 @@
1
+ import { AIOptionsStyle } from "../../AI/AIOptionsStyle";
1
2
  import { MessageBubbleAlignmentType } from "../constants/UIKitConstants";
2
3
  import { CometChatMessageComposerActionInterface } from "../helper/types";
3
4
  import { CometChatMessageOption, CometChatMessageTemplate } from "../modals";
@@ -196,4 +197,8 @@ export class DataSourceDecorator implements DataSource {
196
197
  getAuxiliaryHeaderAppbarOptions(user?: CometChat.User, group?: CometChat.Group, theme?: CometChatTheme) {
197
198
  return this.dataSource.getAuxiliaryHeaderAppbarOptions(user, group, theme);
198
199
  }
200
+
201
+ getAIOptions(user: CometChat.User | null, group: CometChat.Group | null, theme: CometChatTheme, id?: Map<String, any>, AIOptionsStyle?: AIOptionsStyle): (CometChatMessageComposerActionInterface | CometChatMessageOption)[] {
202
+ return this.dataSource.getAIOptions(user, group, theme, id, AIOptionsStyle);
203
+ }
199
204
  }
@@ -16,6 +16,7 @@ import { ChatConfigurator } from "./ChatConfigurator";
16
16
  import { CometChatMessageComposerActionInterface } from "../helper/types";
17
17
  import { ICONS } from "./resources";
18
18
  import { CometChatConversationUtils } from "../utils/conversationUtils";
19
+ import { AIOptionsStyle } from "../../AI/AIOptionsStyle";
19
20
  import { CometChatFormBubble, CometChatCardBubble } from "../views";
20
21
  import { CardMessage, FormMessage } from "../modals/InteractiveData";
21
22
  import { FormBubbleStyle } from "../views/CometChatFormBubble/FormBubbleStyle";
@@ -692,7 +693,9 @@ export class MessageDataSource implements DataSource {
692
693
  return null;
693
694
  }
694
695
 
695
-
696
+ getAIOptions(user: CometChat.User | null, group: CometChat.Group | null, theme: CometChatTheme, id?: Map<String, any>, AIOptionsStyle?: AIOptionsStyle) {
697
+ return [];
698
+ }
696
699
 
697
700
  getLastConversationMessage(conversation: CometChat.Conversation): string {
698
701
  return CometChatConversationUtils.getMessagePreview(conversation.getLastMessage());
@@ -24,6 +24,8 @@ import {
24
24
  CometChatMessageTemplate,
25
25
  CometChatDetailsTemplate,
26
26
  CometChatDetailsOption,
27
+ CometChatCallLogDetailsTemplate,
28
+ CometChatCallLogDetailsOption,
27
29
  APIAction,
28
30
  ActionEntity,
29
31
  BaseInputElement,
@@ -214,6 +216,8 @@ export {
214
216
  CometChatMessageTemplate,
215
217
  CometChatDetailsTemplate,
216
218
  CometChatDetailsOption,
219
+ CometChatCallLogDetailsTemplate,
220
+ CometChatCallLogDetailsOption,
217
221
  //
218
222
  CometChatLocalize,
219
223
  localize,
@@ -0,0 +1,23 @@
1
+ import { TextStyle } from 'react-native';
2
+ import { ImageType } from '../base';
3
+
4
+ export interface CometChatCallLogDetailsOption {
5
+ id?: string | number;
6
+ ///[title] passes title to option
7
+ title?: string;
8
+ ///to pass icon url
9
+ icon?: ImageType;
10
+ ///[titleStyle] styling property for [title]
11
+ titleStyle?: TextStyle;
12
+ backgroundColor?: string;
13
+ iconTint?: string;
14
+ ///to pass custom view to options
15
+ CustomView?: () => JSX.Element;
16
+ /// to pass tail component for detail option
17
+ Tail?:() => JSX.Element;
18
+ ///to pass height for details
19
+ height?: number;
20
+ ///[onClick] call function which takes 3 parameter , and one of user or group is populated at a time
21
+ onClick?: (callLog: any) => void;
22
+ }
23
+
@@ -0,0 +1,16 @@
1
+ import { TextStyle } from 'react-native';
2
+ import { FontStyleInterface } from '../base';
3
+ import { CometChatCallLogDetailsOption } from './CometChatCallLogDetailsOptions';
4
+
5
+ export interface CometChatCallLogDetailsTemplate {
6
+ id?: string | number;
7
+ title?: string;
8
+ titleColor?: string;
9
+ titleFont?: FontStyleInterface;
10
+ titleStyle?: TextStyle;
11
+ sectionSeparatorColor?: string;
12
+ itemSeparatorColor?: string;
13
+ hideSectionSeparator?: boolean;
14
+ hideItemSeparator?: boolean;
15
+ options?: CometChatCallLogDetailsOption[];
16
+ }
@@ -3,6 +3,8 @@ import { CometChatOptions } from './CometChatOptions';
3
3
  import { CometChatMessageTemplate } from './CometChatMessageTemplate';
4
4
  import { CometChatDetailsTemplate } from './CometChatDetailsTemplate';
5
5
  import { CometChatDetailsOption } from './CometChatDetailsOption';
6
+ import { CometChatCallLogDetailsTemplate } from './CometChatCallLogDetailsTemplate';
7
+ import { CometChatCallLogDetailsOption } from './CometChatCallLogDetailsOptions';
6
8
  import { APIAction, ActionEntity, BaseInputElement, BaseInteractiveElement, ButtonElement, CardMessage, CheckboxElement, CustomAction, CustomInteractiveMessage, DropdownElement, ElementEntity, FormMessage, LabelElement, OptionElement, RadioButtonElement, SingleSelectElement, TextInputElement, URLNavigationAction } from './InteractiveData'
7
9
 
8
10
  export {
@@ -28,5 +30,7 @@ export {
28
30
  RadioButtonElement,
29
31
  SingleSelectElement,
30
32
  TextInputElement,
31
- URLNavigationAction
33
+ URLNavigationAction,
34
+ CometChatCallLogDetailsTemplate,
35
+ CometChatCallLogDetailsOption
32
36
  };
@@ -18,7 +18,7 @@
18
18
  "ONLINE": "عبر الإنترنت",
19
19
  "ADMINISTRATOR": "مدير",
20
20
  "MODERATOR": "مدير الجلسة",
21
- "SUGGEST_A_REPLIES":"اقترح ردًا",
21
+ "SUGGEST_A_REPLY":"اقترح ردًا",
22
22
  "GENERATIONG_ICEBREAKER":"توليد كاسحات الجليد",
23
23
  "GENERATING_REPLIES":"توليد الردود",
24
24
  "PARTICIPANT": "مشارك",
@@ -86,7 +86,7 @@
86
86
  "UNANSWERED_AUDIO_CALL": "مكالمة صوتية لم تتم الإجابة عليها",
87
87
  "UNANSWERED_VIDEO_CALL": "مكالمة فيديو لم تتم الإجابة عليها",
88
88
  "CALL_ENDED": "انتهت المكالمة",
89
- "CALL_CANCELLED": "تم إلغاء المكالمة",
89
+ "CANCELLED_CALL": "مكالمة ملغاة",
90
90
  "CALL_BUSY": "استدعاء مشغول",
91
91
  "CALLING": "الدعوة...",
92
92
  "ADD": "إضافة",
@@ -149,7 +149,7 @@
149
149
  "ADDED": "أضاف",
150
150
  "UNBANNED": "غير محظور",
151
151
  "MADE": "صنع",
152
- "CALL_UNANSWERED": "اتصل دون إجابة",
152
+ "UNANSWERED_CALL": "مكالمة لم يتم الرد عليها",
153
153
  "MISSED_AUDIO_CALL": "مكالمة صوتية فائتة",
154
154
  "ENTER_YOUR_PASSWORD": "أدخل كلمة المرور",
155
155
  "DOCS": "مستندات",
@@ -264,14 +264,28 @@
264
264
  "TEXT": "النص",
265
265
  "INCOMING_CALL": "مكالمة واردة",
266
266
  "OUTGOING_CALL": "مكالمة صادرة",
267
- "CALL_MISSED": "مكالمة فائتة",
267
+ "MISSED_CALL": "مكالمة فائتة",
268
268
  "NEW_CONVERSATION": "دردشة جديدة",
269
269
  "FORWARDING": "إرسال الرسائل..",
270
270
  "READ": "اقرأ",
271
271
  "No_RECIPIENT": "لا يوجد مستلم",
272
272
  "RECEIPT_INFORMATION": "معلومات الاستلام",
273
273
  "MESSAGE": "رسالة",
274
+ "GENERATING_SUMMARY":"ملخص التوليد",
275
+ "CONVERSATION_SUMMARY":"ملخص المحادثة",
276
+ "GENERATE_SUMMARY":"قم بإنشاء ملخص",
277
+ "COMETCHAT_BOT_FIRST_MESSAGE":"كيف يمكنني مساعدتك في هذه المحادثة؟ من فضلك اسألني سؤالاً وسأنصحك 🙂",
278
+ "COMETCHAT_ASK_BOT":"اسأل",
279
+ "COMETCHAT_ASK_AI_BOT":"اسأل روبوتات الذكاء الاصطناعي",
280
+ "COMETCHAT_ASK_BOT_SUBTITLE":"بوت الذكاء الاصطناعي",
274
281
  "FORM_COMPLETION_MESSAGE": "شكرًا لك على ملء النموذج.",
275
282
  "FORM":"نموذج",
276
- "CARD":"بطاقة"
283
+ "CARD":"بطاقة",
284
+ "RECORDINGS":"التسجيلات",
285
+ "PARTICIPANTS":"مشاركون",
286
+ "NO_PARTICIPANTS":"لا يوجد مشاركون",
287
+ "NO_RECORDINGS":"لا توجد تسجيلات",
288
+ "CALL_LOGS":"سجلات المكالمات",
289
+ "CANCELLED_AUDIO_CALL":"مكالمة صوتية ملغاة",
290
+ "CANCELLED_VIDEO_CALL":"مكالمة فيديو ملغاة"
277
291
  }
@@ -22,7 +22,7 @@
22
22
  "PARTICIPANT": "Teilnehmerin",
23
23
  "PUBLIC": "Öffentlich",
24
24
  "PRIVATE": "Privat",
25
- "SUGGEST_A_REPLIES":"Schlage eine Antwort vor",
25
+ "SUGGEST_A_REPLY":"Schlage eine Antwort vor",
26
26
  "GENERATIONG_ICEBREAKER":"Eisbrecher erzeugen",
27
27
  "PASSWORD_PROTECTED": "Passwort-geschützt",
28
28
  "PRIVACY_AND_SECURITY": "Datenschutz und Sicherheit",
@@ -86,7 +86,7 @@
86
86
  "UNANSWERED_AUDIO_CALL": "Unbeantworteter Audioan",
87
87
  "UNANSWERED_VIDEO_CALL": "Unbeantworteter Videoan",
88
88
  "CALL_ENDED": "Anruf endete",
89
- "CALL_CANCELLED": "Anruf wurde abgebrochen",
89
+ "CANCELLED_CALL": "Anruf abgesagt",
90
90
  "CALL_BUSY": "Anruf beschäftigt",
91
91
  "CALLING": "Rufen...",
92
92
  "ADD": "Add",
@@ -149,7 +149,7 @@
149
149
  "ADDED": "hinzugefügt",
150
150
  "UNBANNED": "unverbannt",
151
151
  "MADE": "hergestellt",
152
- "CALL_UNANSWERED": "Anruf unbeantwortet",
152
+ "UNANSWERED_CALL": "Unbeantworteter Anruf",
153
153
  "MISSED_AUDIO_CALL": "Audioanruf verpasst",
154
154
  "ENTER_YOUR_PASSWORD": "Geben Sie Ihr Passwort ein",
155
155
  "DOCS": "docs",
@@ -264,14 +264,28 @@
264
264
  "TEXT": "Text",
265
265
  "INCOMING_CALL": "Eingehender Anruf",
266
266
  "OUTGOING_CALL": "Ausgehender Anruf",
267
- "CALL_MISSED": "Verpasster Anruf",
267
+ "MISSED_CALL": "Verpasster Anruf",
268
268
  "NEW_CONVERSATION": "Neuer Chat",
269
269
  "FORWARDING": "Nachrichten werden gesendet..",
270
270
  "READ": "Lesen",
271
271
  "No_RECIPIENT": "Kein Empfänger",
272
272
  "RECEIPT_INFORMATION": "Informationen zum Zahlungseingang",
273
273
  "MESSAGE": "Nachricht",
274
+ "GENERATING_SUMMARY":"Zusammenfassung wird generiert",
275
+ "CONVERSATION_SUMMARY":"Zusammenfassung der Konversation",
276
+ "GENERATE_SUMMARY":"Generieren Sie eine Zusammenfassung",
277
+ "COMETCHAT_BOT_FIRST_MESSAGE":"Wie kann ich dir bei diesem Gespräch helfen? Bitte stell mir eine Frage und ich berate dich 🙂",
278
+ "COMETCHAT_ASK_BOT":"Frag",
279
+ "COMETCHAT_ASK_AI_BOT":"Fragen Sie KI-Bots",
280
+ "COMETCHAT_ASK_BOT_SUBTITLE":"KI-Bot",
274
281
  "FORM_COMPLETION_MESSAGE": "Vielen Dank für das Ausfüllen des Formulars.",
275
282
  "FORM":"Formular",
276
- "CARD":"Karte"
283
+ "CARD":"Karte",
284
+ "RECORDINGS":"Aufzeichnungen",
285
+ "PARTICIPANTS":"Teilnehmer",
286
+ "NO_PARTICIPANTS":"Keine Teilnehmer",
287
+ "NO_RECORDINGS":"Keine Aufzeichnungen",
288
+ "CALL_LOGS":"Anruflisten",
289
+ "CANCELLED_AUDIO_CALL":"Abgebrochener Audioanruf",
290
+ "CANCELLED_VIDEO_CALL":"Videoanruf abgesagt"
277
291
  }