@cometchat/chat-uikit-react-native 4.3.25 → 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 (1184) 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/fileChanges/last-build.bin +0 -0
  4. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/7.4/gc.properties +0 -0
  6. package/android/.gradle/vcs-1/gc.properties +0 -0
  7. package/android/.settings/org.eclipse.buildship.core.prefs +2 -0
  8. package/android/src/main/AndroidManifest.xml +0 -6
  9. package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +29 -44
  10. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +172 -28
  11. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +43 -15
  12. package/ios/CometchatUiKit.mm +27 -14
  13. package/ios/FileManager.m +134 -20
  14. package/ios/SoundPlayer.m +32 -5
  15. package/package.json +18 -59
  16. package/react-native-cometchat-ui-kit.podspec +16 -0
  17. package/src/CometChatConversations/CometChatConversations.tsx +1520 -1293
  18. package/src/CometChatConversations/Skeleton.tsx +186 -0
  19. package/src/CometChatConversations/index.ts +7 -21
  20. package/src/CometChatConversations/resources/index.ts +22 -36
  21. package/src/CometChatConversations/style.ts +230 -60
  22. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +1032 -659
  23. package/src/CometChatGroupMembers/Skeleton.tsx +197 -0
  24. package/src/CometChatGroupMembers/index.ts +2 -8
  25. package/src/CometChatGroupMembers/resources/index.ts +3 -14
  26. package/src/CometChatGroupMembers/style.ts +530 -22
  27. package/src/CometChatGroups/CometChatGroups.tsx +509 -550
  28. package/src/CometChatGroups/GroupsStyle.ts +179 -109
  29. package/src/CometChatGroups/Skeleton.tsx +238 -0
  30. package/src/CometChatGroups/index.ts +3 -11
  31. package/src/CometChatGroups/resources/index.ts +17 -24
  32. package/src/CometChatGroups/style.ts +15 -16
  33. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +730 -1058
  34. package/src/CometChatMessageComposer/index.ts +4 -8
  35. package/src/CometChatMessageComposer/resources/index.ts +21 -31
  36. package/src/CometChatMessageComposer/styles.tsx +152 -0
  37. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +370 -482
  38. package/src/CometChatMessageHeader/index.ts +3 -15
  39. package/src/CometChatMessageHeader/listners.ts +50 -26
  40. package/src/CometChatMessageHeader/styles.ts +57 -10
  41. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +333 -316
  42. package/src/CometChatMessageInformation/Skeleton.tsx +143 -0
  43. package/src/CometChatMessageInformation/index.ts +5 -9
  44. package/src/CometChatMessageInformation/resources/index.ts +1 -4
  45. package/src/CometChatMessageInformation/styles.ts +147 -16
  46. package/src/CometChatMessageList/CometChatMessageList.tsx +2464 -2076
  47. package/src/CometChatMessageList/Skeleton.tsx +98 -0
  48. package/src/CometChatMessageList/index.ts +5 -12
  49. package/src/CometChatMessageList/resources/index.ts +13 -20
  50. package/src/CometChatMessageList/style.ts +989 -51
  51. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +274 -0
  52. package/src/CometChatThreadHeader/Header.tsx +47 -0
  53. package/src/CometChatThreadHeader/index.ts +8 -0
  54. package/src/CometChatThreadHeader/resources/index.ts +14 -0
  55. package/src/CometChatThreadHeader/style.ts +70 -0
  56. package/src/CometChatUsers/CometChatUsers.tsx +436 -122
  57. package/src/CometChatUsers/Skeleton.tsx +210 -0
  58. package/src/CometChatUsers/index.ts +3 -11
  59. package/src/CometChatUsers/style.ts +184 -0
  60. package/src/calls/CallEvents.ts +9 -9
  61. package/src/calls/CallUtils.ts +102 -31
  62. package/src/calls/CallingConfiguration.ts +23 -4
  63. package/src/calls/CallingExtension.tsx +43 -40
  64. package/src/calls/CallingExtensionDecorator.tsx +418 -0
  65. package/src/calls/CallingPackage.ts +11 -12
  66. package/src/calls/CometChatCallBubble/CometChatCallBubble.tsx +121 -52
  67. package/src/calls/CometChatCallBubble/index.ts +8 -13
  68. package/src/calls/CometChatCallBubble/resources/index.ts +1 -8
  69. package/src/calls/CometChatCallBubble/styles.ts +155 -22
  70. package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +19 -36
  71. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +321 -323
  72. package/src/calls/CometChatCallButtons/index.ts +9 -11
  73. package/src/calls/CometChatCallButtons/style.ts +34 -12
  74. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +571 -376
  75. package/src/calls/CometChatCallLogs/Skeleton.tsx +227 -0
  76. package/src/calls/CometChatCallLogs/index.ts +5 -15
  77. package/src/calls/CometChatCallLogs/resources/index.ts +20 -31
  78. package/src/calls/CometChatCallLogs/style.ts +207 -18
  79. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +278 -222
  80. package/src/calls/CometChatIncomingCall/index.ts +7 -9
  81. package/src/calls/CometChatIncomingCall/resources/index.ts +3 -12
  82. package/src/calls/CometChatIncomingCall/style.ts +75 -0
  83. package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +74 -56
  84. package/src/calls/CometChatOngoingCall/index.ts +3 -7
  85. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +225 -176
  86. package/src/calls/CometChatOutgoingCall/OutgoingCallConfiguration.ts +31 -31
  87. package/src/calls/CometChatOutgoingCall/index.ts +5 -11
  88. package/src/calls/CometChatOutgoingCall/resources/index.ts +1 -4
  89. package/src/calls/CometChatOutgoingCall/styles.ts +58 -0
  90. package/src/calls/index.ts +14 -88
  91. package/src/calls/resources/index.ts +1 -8
  92. package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +72 -96
  93. package/src/extensions/CollaborativeBubble/resources/index.ts +2 -4
  94. package/src/extensions/CollaborativeBubble/style.ts +112 -0
  95. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtension.tsx +21 -35
  96. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +246 -189
  97. package/src/extensions/CollaborativeDocument/index.ts +2 -8
  98. package/src/extensions/CollaborativeDocument/resources/index.ts +4 -6
  99. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtension.tsx +25 -35
  100. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +323 -197
  101. package/src/extensions/CollaborativeWhiteboard/index.ts +2 -8
  102. package/src/extensions/CollaborativeWhiteboard/resources/index.ts +4 -6
  103. package/src/extensions/ExtensionConstants.tsx +3 -4
  104. package/src/extensions/ExtensionModerator.tsx +47 -47
  105. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +187 -116
  106. package/src/extensions/LinkPreview/LinkPreviewExtension.tsx +22 -0
  107. package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +94 -0
  108. package/src/extensions/LinkPreview/index.ts +6 -16
  109. package/src/extensions/LinkPreview/resources/index.ts +1 -4
  110. package/src/extensions/LinkPreview/style.ts +100 -0
  111. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +112 -116
  112. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +238 -154
  113. package/src/extensions/MessageTranslation/MessageTranslationExtension.tsx +7 -25
  114. package/src/extensions/MessageTranslation/index.ts +3 -5
  115. package/src/extensions/MessageTranslation/resources/index.ts +2 -3
  116. package/src/extensions/Polls/Header.tsx +56 -21
  117. package/src/extensions/Polls/Polls.tsx +368 -332
  118. package/src/extensions/Polls/PollsBubble.tsx +250 -205
  119. package/src/extensions/Polls/PollsConfigurations.ts +0 -9
  120. package/src/extensions/Polls/PollsDecorator.tsx +164 -72
  121. package/src/extensions/Polls/PollsExtension.tsx +5 -12
  122. package/src/extensions/Polls/index.ts +6 -8
  123. package/src/extensions/Polls/resources/index.ts +6 -12
  124. package/src/extensions/Polls/style.ts +185 -1
  125. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +249 -115
  126. package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +167 -0
  127. package/src/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardConfiguration.ts +2 -6
  128. package/src/extensions/Stickers/CometChatStickerKeyboard/hooks.ts +58 -64
  129. package/src/extensions/Stickers/CometChatStickerKeyboard/index.ts +2 -3
  130. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +67 -41
  131. package/src/extensions/Stickers/StickerConfiguration.ts +5 -9
  132. package/src/extensions/Stickers/StickersBubble.tsx +22 -46
  133. package/src/extensions/Stickers/StickersExtension.ts +5 -6
  134. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +307 -103
  135. package/src/extensions/Stickers/index.ts +7 -9
  136. package/src/extensions/Stickers/resources/index.ts +1 -4
  137. package/src/extensions/Stickers/style.ts +53 -0
  138. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +83 -64
  139. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationExtension.tsx +5 -25
  140. package/src/extensions/ThumbnailGeneration/index.ts +1 -3
  141. package/src/extensions/ThumbnailGeneration/resources/index.ts +1 -4
  142. package/src/extensions/index.ts +11 -50
  143. package/src/index.ts +194 -688
  144. package/src/shared/CometChatUiKit/CometChatUIKit.ts +342 -486
  145. package/src/shared/CometChatUiKit/CometChatUIKitHelper.ts +147 -117
  146. package/src/shared/CometChatUiKit/UIKitSettings.ts +38 -38
  147. package/src/shared/CometChatUiKit/index.ts +2 -6
  148. package/src/shared/assets/images/index.ts +13 -29
  149. package/src/shared/base/BaseStyle.ts +9 -8
  150. package/src/shared/base/BorderStyle.ts +4 -4
  151. package/src/shared/base/FontStyle.ts +25 -3
  152. package/src/shared/base/ShadowStyle.ts +1 -1
  153. package/src/shared/base/Types.ts +45 -26
  154. package/src/shared/base/index.ts +7 -25
  155. package/src/shared/base/vars.ts +5 -5
  156. package/src/shared/constants/UIKitConstants.ts +322 -294
  157. package/src/shared/events/CometChatMessageEvents/index.ts +83 -87
  158. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +260 -238
  159. package/src/shared/events/CometChatUIEventHandler/Listener.ts +412 -377
  160. package/src/shared/events/CometChatUIEvents.ts +15 -16
  161. package/src/shared/events/ListenerInitializer.ts +79 -80
  162. package/src/shared/events/conversations.ts +2 -2
  163. package/src/shared/events/groups.ts +8 -8
  164. package/src/shared/events/index.ts +6 -6
  165. package/src/shared/events/messages.ts +26 -29
  166. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +191 -121
  167. package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +3 -3
  168. package/src/shared/formatters/CometChatMentionsFormatter/index.ts +3 -6
  169. package/src/shared/formatters/CometChatTextFormatter.ts +15 -14
  170. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +127 -131
  171. package/src/shared/formatters/index.ts +7 -8
  172. package/src/shared/framework/ChatConfigurator.ts +3 -4
  173. package/src/shared/framework/DataSource.ts +225 -92
  174. package/src/shared/framework/DataSourceDecorator.tsx +316 -233
  175. package/src/shared/framework/ExtensionsDataSource.tsx +8 -11
  176. package/src/shared/framework/MessageDataSource.tsx +1556 -857
  177. package/src/shared/framework/index.ts +8 -6
  178. package/src/shared/framework/resources/index.ts +37 -57
  179. package/src/shared/helper/Toast.tsx +20 -18
  180. package/src/shared/helper/dateHelper.ts +138 -0
  181. package/src/shared/helper/functions.js +1 -1
  182. package/src/shared/helper/helperFunctions.ts +71 -19
  183. package/src/shared/helper/types/index.ts +49 -15
  184. package/src/shared/helper/useKeyboard.tsx +12 -23
  185. package/src/shared/icons/Icon.tsx +73 -0
  186. package/src/shared/icons/components/ListItemCheck.tsx +18 -0
  187. package/src/shared/icons/components/StickerBase-icon.tsx +16 -0
  188. package/src/shared/icons/components/account-circle-fill.tsx +26 -0
  189. package/src/shared/icons/components/account-circle.tsx +11 -0
  190. package/src/shared/icons/components/activity.tsx +20 -0
  191. package/src/shared/icons/components/add-a-photo-fill.tsx +26 -0
  192. package/src/shared/icons/components/add-a-photo.tsx +11 -0
  193. package/src/shared/icons/components/add-box-fill.tsx +26 -0
  194. package/src/shared/icons/components/add-box.tsx +11 -0
  195. package/src/shared/icons/components/add-call-fill.tsx +26 -0
  196. package/src/shared/icons/components/add-call.tsx +11 -0
  197. package/src/shared/icons/components/add-circle-fill.tsx +11 -0
  198. package/src/shared/icons/components/add-circle.tsx +11 -0
  199. package/src/shared/icons/components/add-comment-fill.tsx +26 -0
  200. package/src/shared/icons/components/add-comment.tsx +11 -0
  201. package/src/shared/icons/components/add-fill.tsx +26 -0
  202. package/src/shared/icons/components/add-reaction-fill.tsx +26 -0
  203. package/src/shared/icons/components/add-reaction.tsx +11 -0
  204. package/src/shared/icons/components/add.tsx +11 -0
  205. package/src/shared/icons/components/ai-conversation-summary-fill.tsx +13 -0
  206. package/src/shared/icons/components/ai-conversation-summary.tsx +13 -0
  207. package/src/shared/icons/components/ai-fill.tsx +11 -0
  208. package/src/shared/icons/components/ai-suggest-reply-fill.tsx +13 -0
  209. package/src/shared/icons/components/ai-suggest-reply.tsx +20 -0
  210. package/src/shared/icons/components/ai.tsx +12 -0
  211. package/src/shared/icons/components/alternate-email-fill.tsx +26 -0
  212. package/src/shared/icons/components/alternate-email.tsx +11 -0
  213. package/src/shared/icons/components/animals-&-nature.tsx +18 -0
  214. package/src/shared/icons/components/archive-fill.tsx +26 -0
  215. package/src/shared/icons/components/archive.tsx +11 -0
  216. package/src/shared/icons/components/arrow-back-fill.tsx +26 -0
  217. package/src/shared/icons/components/arrow-back.tsx +11 -0
  218. package/src/shared/icons/components/arrow-forward-fill.tsx +26 -0
  219. package/src/shared/icons/components/arrow-forward.tsx +11 -0
  220. package/src/shared/icons/components/attach-file-fill.tsx +26 -0
  221. package/src/shared/icons/components/attach-file.tsx +11 -0
  222. package/src/shared/icons/components/audio-file-type.tsx +36 -0
  223. package/src/shared/icons/components/bar-chart-fill.tsx +11 -0
  224. package/src/shared/icons/components/bar-chart.tsx +11 -0
  225. package/src/shared/icons/components/base-icon.tsx +16 -0
  226. package/src/shared/icons/components/bedtime-fill.tsx +26 -0
  227. package/src/shared/icons/components/bedtime.tsx +11 -0
  228. package/src/shared/icons/components/block-fill.tsx +26 -0
  229. package/src/shared/icons/components/block.tsx +11 -0
  230. package/src/shared/icons/components/bookmark-add-fill.tsx +26 -0
  231. package/src/shared/icons/components/bookmark-add.tsx +11 -0
  232. package/src/shared/icons/components/bookmark-fill.tsx +26 -0
  233. package/src/shared/icons/components/bookmark.tsx +11 -0
  234. package/src/shared/icons/components/calendar-add-on-fill.tsx +26 -0
  235. package/src/shared/icons/components/calendar-add-on.tsx +11 -0
  236. package/src/shared/icons/components/calendar-today-fill.tsx +26 -0
  237. package/src/shared/icons/components/calendar-today.tsx +11 -0
  238. package/src/shared/icons/components/call-end-fill.tsx +26 -0
  239. package/src/shared/icons/components/call-end.tsx +11 -0
  240. package/src/shared/icons/components/call-fill.tsx +26 -0
  241. package/src/shared/icons/components/call-log-fill.tsx +26 -0
  242. package/src/shared/icons/components/call-log.tsx +11 -0
  243. package/src/shared/icons/components/call-made-fill.tsx +26 -0
  244. package/src/shared/icons/components/call-made.tsx +11 -0
  245. package/src/shared/icons/components/call-missed-fill.tsx +26 -0
  246. package/src/shared/icons/components/call-missed-outgoing-fill.tsx +26 -0
  247. package/src/shared/icons/components/call-missed-outgoing.tsx +11 -0
  248. package/src/shared/icons/components/call-missed.tsx +11 -0
  249. package/src/shared/icons/components/call-received-fill.tsx +26 -0
  250. package/src/shared/icons/components/call-received.tsx +11 -0
  251. package/src/shared/icons/components/call.tsx +11 -0
  252. package/src/shared/icons/components/cancel-fill.tsx +26 -0
  253. package/src/shared/icons/components/cancel.tsx +11 -0
  254. package/src/shared/icons/components/change-circle-fill.tsx +11 -0
  255. package/src/shared/icons/components/change-circle.tsx +11 -0
  256. package/src/shared/icons/components/chat-bot-fill.tsx +13 -0
  257. package/src/shared/icons/components/chat-bot.tsx +17 -0
  258. package/src/shared/icons/components/chat-fill.tsx +26 -0
  259. package/src/shared/icons/components/chat.tsx +11 -0
  260. package/src/shared/icons/components/check-circle-fill.tsx +11 -0
  261. package/src/shared/icons/components/check-circle.tsx +11 -0
  262. package/src/shared/icons/components/check-fill.tsx +26 -0
  263. package/src/shared/icons/components/check.tsx +11 -0
  264. package/src/shared/icons/components/chevron-left-fill.tsx +26 -0
  265. package/src/shared/icons/components/chevron-left.tsx +11 -0
  266. package/src/shared/icons/components/chevron-right-fill.tsx +26 -0
  267. package/src/shared/icons/components/chevron-right.tsx +11 -0
  268. package/src/shared/icons/components/close-fill.tsx +26 -0
  269. package/src/shared/icons/components/close.tsx +11 -0
  270. package/src/shared/icons/components/collaborative-document-fill.tsx +17 -0
  271. package/src/shared/icons/components/collaborative-document-icon.tsx +11 -0
  272. package/src/shared/icons/components/collaborative-document.tsx +13 -0
  273. package/src/shared/icons/components/collaborative-whiteboard-fill.tsx +15 -0
  274. package/src/shared/icons/components/collaborative-whiteboard-icon.tsx +15 -0
  275. package/src/shared/icons/components/collaborative-whiteboard.tsx +12 -0
  276. package/src/shared/icons/components/content-copy-fill.tsx +26 -0
  277. package/src/shared/icons/components/content-copy.tsx +11 -0
  278. package/src/shared/icons/components/crop-fill.tsx +26 -0
  279. package/src/shared/icons/components/crop.tsx +11 -0
  280. package/src/shared/icons/components/delete-fill.tsx +26 -0
  281. package/src/shared/icons/components/delete.tsx +11 -0
  282. package/src/shared/icons/components/description-fill.tsx +26 -0
  283. package/src/shared/icons/components/description.tsx +11 -0
  284. package/src/shared/icons/components/document-file-type.tsx +38 -0
  285. package/src/shared/icons/components/done-all-fill.tsx +26 -0
  286. package/src/shared/icons/components/done-all.tsx +11 -0
  287. package/src/shared/icons/components/download-fill.tsx +26 -0
  288. package/src/shared/icons/components/download.tsx +11 -0
  289. package/src/shared/icons/components/edit-calendar-fill.tsx +26 -0
  290. package/src/shared/icons/components/edit-calendar.tsx +11 -0
  291. package/src/shared/icons/components/edit-fill.tsx +26 -0
  292. package/src/shared/icons/components/edit-square-fill.tsx +11 -0
  293. package/src/shared/icons/components/edit-square.tsx +11 -0
  294. package/src/shared/icons/components/edit.tsx +11 -0
  295. package/src/shared/icons/components/empty-state.tsx +82 -0
  296. package/src/shared/icons/components/error-fill.tsx +34 -0
  297. package/src/shared/icons/components/error-state.tsx +92 -0
  298. package/src/shared/icons/components/error.tsx +11 -0
  299. package/src/shared/icons/components/event-available-fill.tsx +11 -0
  300. package/src/shared/icons/components/event-available.tsx +11 -0
  301. package/src/shared/icons/components/event-fill.tsx +26 -0
  302. package/src/shared/icons/components/event.tsx +11 -0
  303. package/src/shared/icons/components/favorite-fill.tsx +26 -0
  304. package/src/shared/icons/components/favorite.tsx +11 -0
  305. package/src/shared/icons/components/filter-list-fill.tsx +26 -0
  306. package/src/shared/icons/components/filter-list-off-fill.tsx +26 -0
  307. package/src/shared/icons/components/filter-list-off.tsx +11 -0
  308. package/src/shared/icons/components/filter-list.tsx +11 -0
  309. package/src/shared/icons/components/flags.tsx +13 -0
  310. package/src/shared/icons/components/flip-camera-ios-fill.tsx +26 -0
  311. package/src/shared/icons/components/flip-camera-ios.tsx +11 -0
  312. package/src/shared/icons/components/food-&-drink.tsx +18 -0
  313. package/src/shared/icons/components/forward-fill.tsx +26 -0
  314. package/src/shared/icons/components/forward.tsx +11 -0
  315. package/src/shared/icons/components/gif-fill.tsx +13 -0
  316. package/src/shared/icons/components/gif.tsx +12 -0
  317. package/src/shared/icons/components/graphic-eq-fill.tsx +11 -0
  318. package/src/shared/icons/components/graphic-eq.tsx +11 -0
  319. package/src/shared/icons/components/group-add.tsx +11 -0
  320. package/src/shared/icons/components/group-fill.tsx +26 -0
  321. package/src/shared/icons/components/group.tsx +11 -0
  322. package/src/shared/icons/components/help-fill.tsx +26 -0
  323. package/src/shared/icons/components/help.tsx +11 -0
  324. package/src/shared/icons/components/history-fill.tsx +26 -0
  325. package/src/shared/icons/components/history.tsx +11 -0
  326. package/src/shared/icons/components/image-file-type.tsx +35 -0
  327. package/src/shared/icons/components/incoming-audio-fill.tsx +11 -0
  328. package/src/shared/icons/components/incoming-audio.tsx +13 -0
  329. package/src/shared/icons/components/incoming-video-fill.tsx +28 -0
  330. package/src/shared/icons/components/incoming-video.tsx +15 -0
  331. package/src/shared/icons/components/info-fill.tsx +26 -0
  332. package/src/shared/icons/components/info.tsx +11 -0
  333. package/src/shared/icons/components/keep-fill.tsx +26 -0
  334. package/src/shared/icons/components/keep-off-fill.tsx +26 -0
  335. package/src/shared/icons/components/keep-off.tsx +11 -0
  336. package/src/shared/icons/components/keep.tsx +11 -0
  337. package/src/shared/icons/components/keyboard-arrow-down-fill.tsx +26 -0
  338. package/src/shared/icons/components/keyboard-arrow-down.tsx +11 -0
  339. package/src/shared/icons/components/keyboard-arrow-up-fill.tsx +26 -0
  340. package/src/shared/icons/components/keyboard-arrow-up.tsx +11 -0
  341. package/src/shared/icons/components/keyboard-fill.tsx +26 -0
  342. package/src/shared/icons/components/keyboard.tsx +11 -0
  343. package/src/shared/icons/components/language-fill.tsx +26 -0
  344. package/src/shared/icons/components/language.tsx +11 -0
  345. package/src/shared/icons/components/link-fill.tsx +26 -0
  346. package/src/shared/icons/components/link.tsx +11 -0
  347. package/src/shared/icons/components/loading-fill.tsx +12 -0
  348. package/src/shared/icons/components/loading.tsx +12 -0
  349. package/src/shared/icons/components/location-on-fill.tsx +26 -0
  350. package/src/shared/icons/components/location-on.tsx +11 -0
  351. package/src/shared/icons/components/lock-fill.tsx +26 -0
  352. package/src/shared/icons/components/lock-open-fill.tsx +26 -0
  353. package/src/shared/icons/components/lock-open.tsx +11 -0
  354. package/src/shared/icons/components/lock.tsx +11 -0
  355. package/src/shared/icons/components/logout-fill.tsx +11 -0
  356. package/src/shared/icons/components/logout.tsx +11 -0
  357. package/src/shared/icons/components/mail-fill.tsx +26 -0
  358. package/src/shared/icons/components/mail.tsx +11 -0
  359. package/src/shared/icons/components/mic-fill.tsx +26 -0
  360. package/src/shared/icons/components/mic-off-fill.tsx +26 -0
  361. package/src/shared/icons/components/mic-off.tsx +11 -0
  362. package/src/shared/icons/components/mic.tsx +11 -0
  363. package/src/shared/icons/components/missed-video-call-fill.tsx +26 -0
  364. package/src/shared/icons/components/missed-video-call.tsx +11 -0
  365. package/src/shared/icons/components/mood-fill.tsx +26 -0
  366. package/src/shared/icons/components/mood.tsx +11 -0
  367. package/src/shared/icons/components/more-vert-fill.tsx +26 -0
  368. package/src/shared/icons/components/more-vert.tsx +11 -0
  369. package/src/shared/icons/components/near-me-fill.tsx +11 -0
  370. package/src/shared/icons/components/near-me.tsx +11 -0
  371. package/src/shared/icons/components/no-photography-fill.tsx +26 -0
  372. package/src/shared/icons/components/no-photography.tsx +11 -0
  373. package/src/shared/icons/components/notifications-fill.tsx +26 -0
  374. package/src/shared/icons/components/notifications-off-fill.tsx +26 -0
  375. package/src/shared/icons/components/notifications-off.tsx +11 -0
  376. package/src/shared/icons/components/notifications.tsx +11 -0
  377. package/src/shared/icons/components/objects.tsx +20 -0
  378. package/src/shared/icons/components/outgoing-audio-fill.tsx +15 -0
  379. package/src/shared/icons/components/outgoing-audio.tsx +15 -0
  380. package/src/shared/icons/components/outgoing-video-fill.tsx +28 -0
  381. package/src/shared/icons/components/outgoing-video.tsx +15 -0
  382. package/src/shared/icons/components/pause-fill.tsx +26 -0
  383. package/src/shared/icons/components/pause.tsx +11 -0
  384. package/src/shared/icons/components/pdf-file-type.tsx +36 -0
  385. package/src/shared/icons/components/person-add-fill.tsx +26 -0
  386. package/src/shared/icons/components/person-add.tsx +11 -0
  387. package/src/shared/icons/components/person-fill.tsx +26 -0
  388. package/src/shared/icons/components/person-off.tsx +16 -0
  389. package/src/shared/icons/components/person.tsx +11 -0
  390. package/src/shared/icons/components/phone-in-talk-fill.tsx +26 -0
  391. package/src/shared/icons/components/phone-in-talk.tsx +11 -0
  392. package/src/shared/icons/components/phone-incoming-fill.tsx +11 -0
  393. package/src/shared/icons/components/phone-incoming.tsx +11 -0
  394. package/src/shared/icons/components/phone-missed-fill.tsx +26 -0
  395. package/src/shared/icons/components/phone-missed.tsx +11 -0
  396. package/src/shared/icons/components/phone-outgoing-fill.tsx +15 -0
  397. package/src/shared/icons/components/phone-outgoing.tsx +15 -0
  398. package/src/shared/icons/components/photo-camera-fill.tsx +26 -0
  399. package/src/shared/icons/components/photo-camera.tsx +11 -0
  400. package/src/shared/icons/components/photo-fill.tsx +26 -0
  401. package/src/shared/icons/components/photo.tsx +11 -0
  402. package/src/shared/icons/components/play-arrow-fill.tsx +26 -0
  403. package/src/shared/icons/components/play-arrow.tsx +11 -0
  404. package/src/shared/icons/components/play-circle-fill.tsx +26 -0
  405. package/src/shared/icons/components/play-circle.tsx +11 -0
  406. package/src/shared/icons/components/poll-Icon.tsx +10 -0
  407. package/src/shared/icons/components/poll-fill.tsx +11 -0
  408. package/src/shared/icons/components/poll.tsx +11 -0
  409. package/src/shared/icons/components/presentation-file-type.tsx +38 -0
  410. package/src/shared/icons/components/rearrange-fill.tsx +13 -0
  411. package/src/shared/icons/components/rearrange.tsx +13 -0
  412. package/src/shared/icons/components/refresh-fill.tsx +26 -0
  413. package/src/shared/icons/components/refresh.tsx +11 -0
  414. package/src/shared/icons/components/reply-all-fill.tsx +26 -0
  415. package/src/shared/icons/components/reply-all.tsx +11 -0
  416. package/src/shared/icons/components/reply-fill.tsx +26 -0
  417. package/src/shared/icons/components/reply.tsx +11 -0
  418. package/src/shared/icons/components/retry-fill.tsx +11 -0
  419. package/src/shared/icons/components/retry.tsx +11 -0
  420. package/src/shared/icons/components/schedule-fill.tsx +26 -0
  421. package/src/shared/icons/components/schedule.tsx +11 -0
  422. package/src/shared/icons/components/screen-share-fill.tsx +26 -0
  423. package/src/shared/icons/components/screen-share.tsx +11 -0
  424. package/src/shared/icons/components/search-fill.tsx +26 -0
  425. package/src/shared/icons/components/search.tsx +11 -0
  426. package/src/shared/icons/components/send-fill.tsx +26 -0
  427. package/src/shared/icons/components/send.tsx +11 -0
  428. package/src/shared/icons/components/settings-fill.tsx +26 -0
  429. package/src/shared/icons/components/settings.tsx +11 -0
  430. package/src/shared/icons/components/share-fill.tsx +26 -0
  431. package/src/shared/icons/components/share.tsx +11 -0
  432. package/src/shared/icons/components/shield-fill.tsx +11 -0
  433. package/src/shared/icons/components/shield.tsx +11 -0
  434. package/src/shared/icons/components/smileys-&-people.tsx +18 -0
  435. package/src/shared/icons/components/spreadsheet-file-type.tsx +38 -0
  436. package/src/shared/icons/components/star-fill.tsx +26 -0
  437. package/src/shared/icons/components/star.tsx +11 -0
  438. package/src/shared/icons/components/sticker-fill.tsx +12 -0
  439. package/src/shared/icons/components/sticker.tsx +11 -0
  440. package/src/shared/icons/components/stop-circle-fill.tsx +26 -0
  441. package/src/shared/icons/components/stop-circle.tsx +11 -0
  442. package/src/shared/icons/components/stop-fill.tsx +26 -0
  443. package/src/shared/icons/components/stop-screen-share-fill.tsx +26 -0
  444. package/src/shared/icons/components/stop-screen-share.tsx +11 -0
  445. package/src/shared/icons/components/stop.tsx +11 -0
  446. package/src/shared/icons/components/subdirectory-arrow-left-fill.tsx +26 -0
  447. package/src/shared/icons/components/subdirectory-arrow-left.tsx +11 -0
  448. package/src/shared/icons/components/subdirectory-arrow-right-fill.tsx +26 -0
  449. package/src/shared/icons/components/subdirectory-arrow-right.tsx +11 -0
  450. package/src/shared/icons/components/sunny-fill.tsx +26 -0
  451. package/src/shared/icons/components/sunny.tsx +11 -0
  452. package/src/shared/icons/components/symbols.tsx +15 -0
  453. package/src/shared/icons/components/text-file-type.tsx +35 -0
  454. package/src/shared/icons/components/thumb-down-fill.tsx +26 -0
  455. package/src/shared/icons/components/thumb-down.tsx +11 -0
  456. package/src/shared/icons/components/thumb-up-fill.tsx +26 -0
  457. package/src/shared/icons/components/thumb-up.tsx +11 -0
  458. package/src/shared/icons/components/translate-fill.tsx +11 -0
  459. package/src/shared/icons/components/translate.tsx +11 -0
  460. package/src/shared/icons/components/travel-&-places.tsx +18 -0
  461. package/src/shared/icons/components/unknown-file-type.tsx +38 -0
  462. package/src/shared/icons/components/upload-fill.tsx +11 -0
  463. package/src/shared/icons/components/upload.tsx +11 -0
  464. package/src/shared/icons/components/user-empty-icon.tsx +26 -0
  465. package/src/shared/icons/components/video-call-fill.tsx +26 -0
  466. package/src/shared/icons/components/video-call.tsx +11 -0
  467. package/src/shared/icons/components/video-file-type.tsx +38 -0
  468. package/src/shared/icons/components/videocam-fill.tsx +26 -0
  469. package/src/shared/icons/components/videocam-off-fill.tsx +26 -0
  470. package/src/shared/icons/components/videocam-off.tsx +11 -0
  471. package/src/shared/icons/components/videocam.tsx +11 -0
  472. package/src/shared/icons/components/visibility-off-fill.tsx +11 -0
  473. package/src/shared/icons/components/visibility-off.tsx +11 -0
  474. package/src/shared/icons/components/volume-down-fill.tsx +26 -0
  475. package/src/shared/icons/components/volume-down.tsx +11 -0
  476. package/src/shared/icons/components/volume-mute-fill.tsx +26 -0
  477. package/src/shared/icons/components/volume-mute.tsx +11 -0
  478. package/src/shared/icons/components/volume-off-fill.tsx +26 -0
  479. package/src/shared/icons/components/volume-off.tsx +11 -0
  480. package/src/shared/icons/components/volume-up-fill.tsx +26 -0
  481. package/src/shared/icons/components/volume-up.tsx +11 -0
  482. package/src/shared/icons/components/warning-fill.tsx +26 -0
  483. package/src/shared/icons/components/warning.tsx +11 -0
  484. package/src/shared/icons/components/wifi-fill.tsx +26 -0
  485. package/src/shared/icons/components/wifi.tsx +11 -0
  486. package/src/shared/icons/components/zip-file-type.tsx +38 -0
  487. package/src/shared/icons/components/zoom-in-map-fill.tsx +26 -0
  488. package/src/shared/icons/components/zoom-in-map.tsx +11 -0
  489. package/src/shared/icons/components/zoom-out-map-fill.tsx +26 -0
  490. package/src/shared/icons/components/zoom-out-map.tsx +11 -0
  491. package/src/shared/icons/icon-mapping.tsx +620 -0
  492. package/src/shared/index.ts +116 -337
  493. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +0 -1
  494. package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +19 -26
  495. package/src/shared/libs/ImageZoom/helper.ts +11 -27
  496. package/src/shared/libs/ImageZoom/index.tsx +4 -7
  497. package/src/shared/libs/ImageZoom/types/index.ts +7 -17
  498. package/src/shared/libs/VideoPlayer/VideoResizeMode.js +1 -1
  499. package/src/shared/modals/CometChatMessageOption.ts +11 -8
  500. package/src/shared/modals/CometChatMessageTemplate.ts +180 -140
  501. package/src/shared/modals/index.ts +2 -57
  502. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +153 -151
  503. package/src/shared/resources/CometChatLocalize/index.ts +2 -8
  504. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +446 -316
  505. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +446 -317
  506. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +446 -316
  507. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +446 -317
  508. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +445 -317
  509. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +446 -316
  510. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +445 -316
  511. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +446 -317
  512. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +446 -317
  513. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +446 -317
  514. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +446 -317
  515. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +446 -317
  516. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +446 -317
  517. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +445 -317
  518. package/src/shared/resources/CometChatSoundManager/index.ts +1 -2
  519. package/src/shared/resources/index.ts +1 -9
  520. package/src/shared/utils/CometChatMessageHelper/index.ts +16 -14
  521. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +50 -0
  522. package/src/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +1 -1
  523. package/src/shared/utils/CometChatMessagePreview/index.ts +1 -5
  524. package/src/shared/utils/CometChatMessagePreview/resources/index.ts +1 -4
  525. package/src/shared/utils/CometChatMessagePreview/style.ts +45 -0
  526. package/src/shared/utils/CommonUtils.ts +163 -172
  527. package/src/shared/utils/MessageUtils.tsx +349 -148
  528. package/src/shared/utils/NetworkUtils.tsx +32 -24
  529. package/src/shared/utils/PermissionUtil.ts +30 -30
  530. package/src/shared/utils/conversationUtils.ts +93 -86
  531. package/src/shared/utils/index.ts +4 -25
  532. package/src/shared/views/CometChatAICard/CometChatAICard.tsx +100 -66
  533. package/src/shared/views/CometChatAICard/resources/index.ts +2 -4
  534. package/src/shared/views/CometChatActionSheet/ActionItem.ts +12 -57
  535. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +68 -249
  536. package/src/shared/views/CometChatActionSheet/hooks.ts +5 -3
  537. package/src/shared/views/CometChatActionSheet/index.ts +1 -4
  538. package/src/shared/views/CometChatActionSheet/resources/index.ts +5 -7
  539. package/src/shared/views/CometChatActionSheet/style.ts +2 -41
  540. package/src/shared/views/CometChatAudioBubble/AnimatedAudioWaves.tsx +131 -0
  541. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +211 -189
  542. package/src/shared/views/CometChatAudioBubble/index.ts +10 -10
  543. package/src/shared/views/CometChatAudioBubble/resources/index.ts +2 -7
  544. package/src/shared/views/CometChatAudioBubble/style.ts +203 -27
  545. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +46 -103
  546. package/src/shared/views/CometChatAvatar/index.ts +3 -9
  547. package/src/shared/views/CometChatAvatar/styles.ts +37 -24
  548. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +46 -53
  549. package/src/shared/views/CometChatBadge/index.ts +4 -8
  550. package/src/shared/views/CometChatBadge/styles.ts +29 -16
  551. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +164 -129
  552. package/src/shared/views/CometChatBottomSheet/index.ts +2 -5
  553. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +174 -110
  554. package/src/shared/views/CometChatConfirmDialog/index.ts +2 -9
  555. package/src/shared/views/CometChatConfirmDialog/style.ts +121 -62
  556. package/src/shared/views/CometChatDate/CometChatDate.tsx +43 -169
  557. package/src/shared/views/CometChatDate/index.ts +4 -12
  558. package/src/shared/views/CometChatDate/styles.ts +36 -0
  559. package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +54 -0
  560. package/src/shared/views/CometChatDateSeperator/index.ts +6 -0
  561. package/src/shared/views/CometChatDateSeperator/styles.ts +52 -0
  562. package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +54 -0
  563. package/src/shared/views/CometChatDeletedBubble/index.ts +5 -0
  564. package/src/shared/views/CometChatDeletedBubble/styles.ts +42 -0
  565. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +284 -205
  566. package/src/shared/views/CometChatEmojiKeyboard/Emoji.ts +1 -1
  567. package/src/shared/views/CometChatEmojiKeyboard/EmojiCategory.ts +1 -1
  568. package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +169 -1405
  569. package/src/shared/views/CometChatEmojiKeyboard/index.ts +1 -3
  570. package/src/shared/views/CometChatEmojiKeyboard/resources/index.ts +8 -16
  571. package/src/shared/views/CometChatEmojiKeyboard/style.ts +72 -61
  572. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +227 -167
  573. package/src/shared/views/CometChatFileBubble/index.ts +10 -6
  574. package/src/shared/views/CometChatFileBubble/resources/index.ts +1 -6
  575. package/src/shared/views/CometChatFileBubble/style.ts +120 -47
  576. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +69 -252
  577. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +183 -0
  578. package/src/shared/views/CometChatImageBubble/assets/index.ts +1 -5
  579. package/src/shared/views/CometChatImageBubble/index.ts +7 -9
  580. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +28 -43
  581. package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -1
  582. package/src/shared/views/CometChatImageViewerModal/resources/index.ts +1 -2
  583. package/src/shared/views/CometChatList/CometChatList.tsx +696 -726
  584. package/src/shared/views/CometChatList/Header.tsx +271 -111
  585. package/src/shared/views/CometChatList/index.ts +7 -4
  586. package/src/shared/views/CometChatList/resources/index.ts +4 -13
  587. package/src/shared/views/CometChatList/styles.ts +59 -44
  588. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +221 -261
  589. package/src/shared/views/CometChatListItem/index.ts +3 -15
  590. package/src/shared/views/CometChatListItem/style.ts +25 -29
  591. package/src/shared/views/CometChatMediaRecorder/AnimatingMic.tsx +129 -0
  592. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +115 -0
  593. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +233 -0
  594. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +359 -284
  595. package/src/shared/views/CometChatMediaRecorder/Timer.tsx +83 -0
  596. package/src/shared/views/CometChatMediaRecorder/index.ts +4 -10
  597. package/src/shared/views/CometChatMediaRecorder/style.ts +69 -23
  598. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +135 -126
  599. package/src/shared/views/CometChatMessageBubble/index.ts +2 -5
  600. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +78 -105
  601. package/src/shared/views/CometChatMessageInput/index.ts +10 -3
  602. package/src/shared/views/CometChatMessageInput/styles.ts +2 -2
  603. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +77 -71
  604. package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +33 -33
  605. package/src/shared/views/CometChatQuickReactions/index.ts +4 -5
  606. package/src/shared/views/CometChatQuickReactions/resources/index.ts +1 -2
  607. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +477 -308
  608. package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +152 -64
  609. package/src/shared/views/CometChatReactionList/Skeleton.tsx +143 -0
  610. package/src/shared/views/CometChatReactionList/index.ts +6 -5
  611. package/src/shared/views/CometChatReactionList/resources/index.ts +1 -4
  612. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +132 -172
  613. package/src/shared/views/CometChatReactions/index.ts +7 -14
  614. package/src/shared/views/CometChatReactions/style.ts +193 -41
  615. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +85 -82
  616. package/src/shared/views/CometChatReceipt/index.ts +3 -11
  617. package/src/shared/views/CometChatReceipt/resources/blue-double-tick-icon.png +0 -0
  618. package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
  619. package/src/shared/views/CometChatReceipt/resources/grey-double-tick-icon.png +0 -0
  620. package/src/shared/views/CometChatReceipt/resources/grey-tick-icon.png +0 -0
  621. package/src/shared/views/CometChatReceipt/resources/index.ts +5 -10
  622. package/src/shared/views/CometChatReceipt/resources/sending.png +0 -0
  623. package/src/shared/views/CometChatReceipt/style.ts +50 -9
  624. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +67 -63
  625. package/src/shared/views/CometChatStatusIndicator/index.ts +6 -22
  626. package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
  627. package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
  628. package/src/shared/views/CometChatStatusIndicator/styles.ts +59 -14
  629. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +97 -56
  630. package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +185 -0
  631. package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +44 -46
  632. package/src/shared/views/CometChatSuggestionList/index.ts +3 -7
  633. package/src/shared/views/CometChatSuggestionList/style.ts +69 -0
  634. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +121 -96
  635. package/src/shared/views/CometChatTextBubble/index.ts +8 -7
  636. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +202 -0
  637. package/src/shared/views/CometChatTooltipMenu/index.ts +4 -0
  638. package/src/shared/views/CometChatTooltipMenu/styles.ts +24 -0
  639. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +175 -195
  640. package/src/shared/views/CometChatVideoBubble/index.ts +7 -9
  641. package/src/shared/views/CometChatVideoBubble/resources/index.ts +2 -7
  642. package/src/shared/views/CometChatVideoBubble/style.ts +101 -5
  643. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +154 -91
  644. package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -1
  645. package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +62 -0
  646. package/src/shared/views/index.ts +74 -218
  647. package/src/theme/CometChatThemeHelper.ts +427 -0
  648. package/src/theme/context.ts +20 -0
  649. package/src/theme/default/color/dark.ts +99 -0
  650. package/src/theme/default/color/light.ts +105 -0
  651. package/src/theme/default/index.ts +242 -0
  652. package/src/theme/default/resources/icons/Base_Icon.png +0 -0
  653. package/src/theme/default/resources/icons/collaborative_document_1x.png +0 -0
  654. package/src/theme/default/resources/icons/collaborative_document_2x.png +0 -0
  655. package/src/theme/default/resources/icons/collaborative_document_3x.png +0 -0
  656. package/src/theme/default/resources/icons/collaborative_whiteboard_1x.png +0 -0
  657. package/src/theme/default/resources/icons/collaborative_whiteboard_2x.png +0 -0
  658. package/src/theme/default/resources/icons/collaborative_whiteboard_3x.png +0 -0
  659. package/src/theme/default/resources/icons/dark_error_icon.png +0 -0
  660. package/src/theme/default/resources/icons/index.ts +19 -0
  661. package/src/theme/default/resources/icons/light_error_icon.png +0 -0
  662. package/src/theme/default/resources/icons/thread_replies.png +0 -0
  663. package/src/theme/default/spacing.ts +86 -0
  664. package/src/theme/default/typography.ts +184 -0
  665. package/src/theme/hook.ts +19 -0
  666. package/src/theme/index.ts +3 -0
  667. package/src/theme/provider.tsx +135 -0
  668. package/src/theme/type.ts +446 -0
  669. package/screenshots/logo.png +0 -0
  670. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -166
  671. package/src/AI/AIAssistBot/AIAssistBotExtension.tsx +0 -22
  672. package/src/AI/AIAssistBot/AIAssistBotStyle.ts +0 -43
  673. package/src/AI/AIAssistBot/AIAssistBotView.tsx +0 -297
  674. package/src/AI/AIAssistBot/configuration.ts +0 -23
  675. package/src/AI/AIAssistBot/resources/CloseIcon.png +0 -0
  676. package/src/AI/AIAssistBot/resources/index.ts +0 -6
  677. package/src/AI/AIBaseConfiguration.ts +0 -15
  678. package/src/AI/AIBaseStyle.ts +0 -58
  679. package/src/AI/AIConversationStarter/AIConversationStarter.ts +0 -19
  680. package/src/AI/AIConversationStarter/AIConversationStarterDecorator.tsx +0 -249
  681. package/src/AI/AIConversationStarter/AIConversationStarterStyle.ts +0 -14
  682. package/src/AI/AIConversationStarter/configuration.ts +0 -11
  683. package/src/AI/AIConversationStarter/style.ts +0 -74
  684. package/src/AI/AIConversationSummary/AIConversationSummaryDecorator.tsx +0 -179
  685. package/src/AI/AIConversationSummary/AIConversationSummaryExtension.ts +0 -21
  686. package/src/AI/AIConversationSummary/AIConversationSummaryStyle.tsx +0 -20
  687. package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +0 -195
  688. package/src/AI/AIConversationSummary/configuration.ts +0 -14
  689. package/src/AI/AIConversationSummary/resources/index.ts +0 -6
  690. package/src/AI/AIExtensionDataSource.ts +0 -18
  691. package/src/AI/AIOptionsStyle.ts +0 -14
  692. package/src/AI/AISmartReplies/AISmartReplies.ts +0 -19
  693. package/src/AI/AISmartReplies/AISmartRepliesDecorator.tsx +0 -306
  694. package/src/AI/AISmartReplies/AISmartRepliesStyle.ts +0 -16
  695. package/src/AI/AISmartReplies/configuration.ts +0 -12
  696. package/src/AI/CardView.tsx +0 -83
  697. package/src/AI/CardViewStyle.ts +0 -37
  698. package/src/AI/resources/ai-empty.png +0 -0
  699. package/src/AI/resources/ai-error.png +0 -0
  700. package/src/AI/resources/index.ts +0 -12
  701. package/src/AI/resources/spineer.png +0 -0
  702. package/src/AI/style.ts +0 -165
  703. package/src/AI/utils.ts +0 -39
  704. package/src/CometChatAddMembers/AddMembersConfiguration.tsx +0 -58
  705. package/src/CometChatAddMembers/CometChatAddMembers.tsx +0 -114
  706. package/src/CometChatAddMembers/index.ts +0 -10
  707. package/src/CometChatBannedMembers/BannedMembersConfiguration.tsx +0 -61
  708. package/src/CometChatBannedMembers/CometChatBannedMembers.tsx +0 -148
  709. package/src/CometChatBannedMembers/index.ts +0 -13
  710. package/src/CometChatBannedMembers/resources/clear.png +0 -0
  711. package/src/CometChatBannedMembers/resources/index.ts +0 -4
  712. package/src/CometChatContacts/CometChatContacts.tsx +0 -229
  713. package/src/CometChatContacts/ContactsConfiguration.tsx +0 -69
  714. package/src/CometChatContacts/ContactsStyle.ts +0 -60
  715. package/src/CometChatContacts/Header.tsx +0 -167
  716. package/src/CometChatContacts/index.ts +0 -13
  717. package/src/CometChatContacts/styles.ts +0 -105
  718. package/src/CometChatConversations/ConversationsConfiguration.ts +0 -226
  719. package/src/CometChatConversations/ConversationsStyle.ts +0 -88
  720. package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +0 -229
  721. package/src/CometChatConversationsWithMessages/index.ts +0 -6
  722. package/src/CometChatConversationsWithMessages/resources/index.ts +0 -6
  723. package/src/CometChatConversationsWithMessages/resources/start.png +0 -0
  724. package/src/CometChatConversationsWithMessages/styles.ts +0 -15
  725. package/src/CometChatCreateGroup/CometChatCreateGroup.tsx +0 -382
  726. package/src/CometChatCreateGroup/CreateGroupConfiguration.ts +0 -36
  727. package/src/CometChatCreateGroup/Header.tsx +0 -60
  728. package/src/CometChatCreateGroup/index.ts +0 -15
  729. package/src/CometChatCreateGroup/resources/close.png +0 -0
  730. package/src/CometChatCreateGroup/resources/index.ts +0 -11
  731. package/src/CometChatCreateGroup/resources/rightTick.png +0 -0
  732. package/src/CometChatCreateGroup/resources/warning.png +0 -0
  733. package/src/CometChatCreateGroup/style.ts +0 -44
  734. package/src/CometChatDetails/CometChatDetails.tsx +0 -1026
  735. package/src/CometChatDetails/DetailsConfiguration.tsx +0 -72
  736. package/src/CometChatDetails/Header.tsx +0 -42
  737. package/src/CometChatDetails/index.ts +0 -19
  738. package/src/CometChatDetails/listners.ts +0 -109
  739. package/src/CometChatDetails/resources/close.png +0 -0
  740. package/src/CometChatDetails/resources/index.ts +0 -17
  741. package/src/CometChatDetails/styles.ts +0 -23
  742. package/src/CometChatGroupMembers/GroupMemberConfiguration.ts +0 -118
  743. package/src/CometChatGroupMembers/GroupMemberStyle.ts +0 -91
  744. package/src/CometChatGroupMembers/GroupScopeStyle.ts +0 -68
  745. package/src/CometChatGroups/GroupsConfiguration.ts +0 -93
  746. package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +0 -231
  747. package/src/CometChatGroupsWithMessages/index.ts +0 -6
  748. package/src/CometChatGroupsWithMessages/resources/index.ts +0 -5
  749. package/src/CometChatGroupsWithMessages/resources/write.png +0 -0
  750. package/src/CometChatGroupsWithMessages/styles.ts +0 -15
  751. package/src/CometChatJoinProtectedGroup/CometChatJoinProtectedGroup.tsx +0 -268
  752. package/src/CometChatJoinProtectedGroup/Header.tsx +0 -52
  753. package/src/CometChatJoinProtectedGroup/JoinProtectedGroupConfiguration.ts +0 -30
  754. package/src/CometChatJoinProtectedGroup/index.ts +0 -15
  755. package/src/CometChatJoinProtectedGroup/resources/close.png +0 -0
  756. package/src/CometChatJoinProtectedGroup/resources/index.ts +0 -8
  757. package/src/CometChatJoinProtectedGroup/resources/rightTick.png +0 -0
  758. package/src/CometChatJoinProtectedGroup/style.ts +0 -11
  759. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +0 -96
  760. package/src/CometChatMessageComposer/styles.ts +0 -28
  761. package/src/CometChatMessageHeader/MessageHeaderConfiguration.tsx +0 -62
  762. package/src/CometChatMessageHeader/resources/Back.png +0 -0
  763. package/src/CometChatMessageHeader/resources/index.ts +0 -11
  764. package/src/CometChatMessageHeader/resources/password.png +0 -0
  765. package/src/CometChatMessageHeader/resources/private.png +0 -0
  766. package/src/CometChatMessageInformation/MessageInformationConfiguration.tsx +0 -32
  767. package/src/CometChatMessageInformation/MessageInformationStyle.ts +0 -12
  768. package/src/CometChatMessageList/MessageListConfiguration.ts +0 -250
  769. package/src/CometChatMessageList/MessageListStyle.ts +0 -75
  770. package/src/CometChatMessages/CometChatMessages.tsx +0 -344
  771. package/src/CometChatMessages/MessageStyle.ts +0 -34
  772. package/src/CometChatMessages/MessagesConfiguration.ts +0 -55
  773. package/src/CometChatMessages/index.ts +0 -16
  774. package/src/CometChatMessages/resources/index.ts +0 -6
  775. package/src/CometChatMessages/resources/info.png +0 -0
  776. package/src/CometChatMessages/style.ts +0 -23
  777. package/src/CometChatTabs/CometChatTabs.tsx +0 -178
  778. package/src/CometChatTabs/CometChatTabsStyle.ts +0 -45
  779. package/src/CometChatTabs/TabItemStyle.ts +0 -55
  780. package/src/CometChatTabs/TabItems.ts +0 -11
  781. package/src/CometChatTabs/index.ts +0 -6
  782. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +0 -349
  783. package/src/CometChatThreadedMessages/Header.tsx +0 -57
  784. package/src/CometChatThreadedMessages/ThreadedMessagesConfiguration.ts +0 -45
  785. package/src/CometChatThreadedMessages/index.ts +0 -15
  786. package/src/CometChatThreadedMessages/resources/Back.png +0 -0
  787. package/src/CometChatThreadedMessages/resources/close.png +0 -0
  788. package/src/CometChatThreadedMessages/resources/index.ts +0 -20
  789. package/src/CometChatThreadedMessages/resources/password.png +0 -0
  790. package/src/CometChatThreadedMessages/resources/private.png +0 -0
  791. package/src/CometChatThreadedMessages/resources/right-arrow.png +0 -0
  792. package/src/CometChatThreadedMessages/style.ts +0 -29
  793. package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +0 -145
  794. package/src/CometChatTransferOwnership/TransferOwnershipConfiguration.ts +0 -60
  795. package/src/CometChatTransferOwnership/index.ts +0 -14
  796. package/src/CometChatUsers/UsersConfiguration.tsx +0 -59
  797. package/src/CometChatUsers/UsersStyle.ts +0 -101
  798. package/src/CometChatUsersWithMessages/CometChatUsersWithMessages.tsx +0 -130
  799. package/src/CometChatUsersWithMessages/index.ts +0 -6
  800. package/src/CometChatUsersWithMessages/styles.ts +0 -15
  801. package/src/calls/CallingDetailsUtils.tsx +0 -158
  802. package/src/calls/CallingExtentionDecorator.tsx +0 -222
  803. package/src/calls/CometChatCallBubble/CallBubbleConfiguration.ts +0 -23
  804. package/src/calls/CometChatCallBubble/CallBubbleStyle.ts +0 -47
  805. package/src/calls/CometChatCallButtons/CallButtonStyle.ts +0 -35
  806. package/src/calls/CometChatCallButtons/resources/Call.png +0 -0
  807. package/src/calls/CometChatCallButtons/resources/Video.png +0 -0
  808. package/src/calls/CometChatCallButtons/resources/index.ts +0 -9
  809. package/src/calls/CometChatCallLogDetails/CallLogDetailsConfiguration.ts +0 -118
  810. package/src/calls/CometChatCallLogDetails/CallLogDetailsStyle.ts +0 -36
  811. package/src/calls/CometChatCallLogDetails/CometChatCallLogDetails.tsx +0 -309
  812. package/src/calls/CometChatCallLogDetails/index.ts +0 -23
  813. package/src/calls/CometChatCallLogDetails/resources/CloseIcon.png +0 -0
  814. package/src/calls/CometChatCallLogDetails/resources/index.ts +0 -5
  815. package/src/calls/CometChatCallLogDetails/style.ts +0 -15
  816. package/src/calls/CometChatCallLogHistory/CallLogHistoryConfiguration.ts +0 -67
  817. package/src/calls/CometChatCallLogHistory/CallLogHistoryStyle.ts +0 -46
  818. package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +0 -350
  819. package/src/calls/CometChatCallLogHistory/index.ts +0 -23
  820. package/src/calls/CometChatCallLogHistory/resources/Back.png +0 -0
  821. package/src/calls/CometChatCallLogHistory/resources/Call.png +0 -0
  822. package/src/calls/CometChatCallLogHistory/resources/Info.png +0 -0
  823. package/src/calls/CometChatCallLogHistory/resources/Selection.png +0 -0
  824. package/src/calls/CometChatCallLogHistory/resources/Spineer.png +0 -0
  825. package/src/calls/CometChatCallLogHistory/resources/Video.png +0 -0
  826. package/src/calls/CometChatCallLogHistory/resources/check.png +0 -0
  827. package/src/calls/CometChatCallLogHistory/resources/incomingcall.png +0 -0
  828. package/src/calls/CometChatCallLogHistory/resources/incomingvideo.png +0 -0
  829. package/src/calls/CometChatCallLogHistory/resources/index.ts +0 -42
  830. package/src/calls/CometChatCallLogHistory/resources/missedcall.png +0 -0
  831. package/src/calls/CometChatCallLogHistory/resources/missedvideo.png +0 -0
  832. package/src/calls/CometChatCallLogHistory/resources/outgoingcall.png +0 -0
  833. package/src/calls/CometChatCallLogHistory/resources/outgoingvideo.png +0 -0
  834. package/src/calls/CometChatCallLogHistory/style.ts +0 -24
  835. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsConfiguration.ts +0 -63
  836. package/src/calls/CometChatCallLogParticipants/CallLogParticipantsStyle.ts +0 -59
  837. package/src/calls/CometChatCallLogParticipants/CometChatCallLogParticipants.tsx +0 -221
  838. package/src/calls/CometChatCallLogParticipants/index.ts +0 -23
  839. package/src/calls/CometChatCallLogParticipants/resources/Back.png +0 -0
  840. package/src/calls/CometChatCallLogParticipants/resources/index.ts +0 -5
  841. package/src/calls/CometChatCallLogParticipants/style.ts +0 -24
  842. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsConfiguration.ts +0 -65
  843. package/src/calls/CometChatCallLogRecordings/CallLogRecordingsStyle.ts +0 -63
  844. package/src/calls/CometChatCallLogRecordings/CometChatCallLogRecordings.tsx +0 -254
  845. package/src/calls/CometChatCallLogRecordings/index.ts +0 -23
  846. package/src/calls/CometChatCallLogRecordings/resources/Back.png +0 -0
  847. package/src/calls/CometChatCallLogRecordings/resources/download.png +0 -0
  848. package/src/calls/CometChatCallLogRecordings/resources/index.ts +0 -8
  849. package/src/calls/CometChatCallLogRecordings/style.ts +0 -24
  850. package/src/calls/CometChatCallLogs/CallLogsConfiguration.ts +0 -89
  851. package/src/calls/CometChatCallLogs/CallLogsStyle.ts +0 -95
  852. package/src/calls/CometChatCallLogsWithDetails/CallLogsWithDetailsConfiguration.ts +0 -10
  853. package/src/calls/CometChatCallLogsWithDetails/CometChatCallLogsWithDetails.tsx +0 -56
  854. package/src/calls/CometChatCallLogsWithDetails/index.ts +0 -5
  855. package/src/calls/CometChatCallLogsWithDetails/style.ts +0 -11
  856. package/src/calls/CometChatIncomingCall/IncomingCallStyle.ts +0 -75
  857. package/src/calls/CometChatIncomingCall/styles.ts +0 -10
  858. package/src/calls/CometChatOngoingCall/OngoingCallStyle.ts +0 -25
  859. package/src/calls/CometChatOutgoingCall/OutgoingCallStyle.ts +0 -39
  860. package/src/extensions/CollaborativeBubble/CollaborativeBubbleStyle.ts +0 -97
  861. package/src/extensions/CollaborativeBubble/styles.ts +0 -82
  862. package/src/extensions/CollaborativeDocument/CollaborativeDocumentConfiguration.tsx +0 -26
  863. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardConfiguration.tsx +0 -26
  864. package/src/extensions/ImageModeration/ImageModerationDecorator.tsx +0 -82
  865. package/src/extensions/ImageModeration/ImageModerationExtension.tsx +0 -43
  866. package/src/extensions/ImageModeration/ImageModerationFilter.tsx +0 -145
  867. package/src/extensions/ImageModeration/index.ts +0 -18
  868. package/src/extensions/ImageModeration/resources/index.ts +0 -4
  869. package/src/extensions/ImageModeration/resources/unsafe.png +0 -0
  870. package/src/extensions/LinkPreview/LInkPreviewBubbleStyle.ts +0 -28
  871. package/src/extensions/LinkPreview/LinkPreviewConfiguration.ts +0 -27
  872. package/src/extensions/LinkPreview/LinkPreviewExtention.tsx +0 -25
  873. package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +0 -55
  874. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +0 -144
  875. package/src/extensions/SmartReplies/SmartRepliesExtension.tsx +0 -52
  876. package/src/extensions/SmartReplies/SmartRepliesView.tsx +0 -213
  877. package/src/extensions/SmartReplies/index.ts +0 -7
  878. package/src/extensions/SmartReplies/resources/close.png +0 -0
  879. package/src/extensions/SmartReplies/resources/index.ts +0 -6
  880. package/src/extensions/Stickers/CometChatStickerKeyboard/StickerKeyboardStyle.ts +0 -52
  881. package/src/extensions/Stickers/StickerStyle.ts +0 -15
  882. package/src/extensions/TextModeration/TextModerationConfiguration.tsx +0 -25
  883. package/src/extensions/TextModeration/TextModerationExtension.tsx +0 -51
  884. package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +0 -93
  885. package/src/extensions/TextModeration/index.ts +0 -6
  886. package/src/shared/CometChatContext.tsx +0 -43
  887. package/src/shared/helper/SwipeRow.js +0 -944
  888. package/src/shared/libs/CometChatCalendar/Calendars/BaseCalendar.tsx +0 -229
  889. package/src/shared/libs/CometChatCalendar/Calendars/DateSelectionCalendar.tsx +0 -90
  890. package/src/shared/libs/CometChatCalendar/Calendars/MultiDateSelectionCalendar.tsx +0 -108
  891. package/src/shared/libs/CometChatCalendar/Calendars/Providers.tsx +0 -27
  892. package/src/shared/libs/CometChatCalendar/Calendars/index.ts +0 -3
  893. package/src/shared/libs/CometChatCalendar/Components/Arrow.tsx +0 -46
  894. package/src/shared/libs/CometChatCalendar/Components/Day.tsx +0 -95
  895. package/src/shared/libs/CometChatCalendar/Components/Days.tsx +0 -110
  896. package/src/shared/libs/CometChatCalendar/Components/Month.tsx +0 -47
  897. package/src/shared/libs/CometChatCalendar/Components/Months.tsx +0 -79
  898. package/src/shared/libs/CometChatCalendar/Components/Title.tsx +0 -47
  899. package/src/shared/libs/CometChatCalendar/Components/Weekdays.tsx +0 -29
  900. package/src/shared/libs/CometChatCalendar/Components/index.ts +0 -7
  901. package/src/shared/libs/CometChatCalendar/Constants/View.ts +0 -4
  902. package/src/shared/libs/CometChatCalendar/Constants/index.ts +0 -1
  903. package/src/shared/libs/CometChatCalendar/Contexts/LocaleContext.tsx +0 -7
  904. package/src/shared/libs/CometChatCalendar/Contexts/ThemeContext.tsx +0 -7
  905. package/src/shared/libs/CometChatCalendar/Contexts/index.ts +0 -2
  906. package/src/shared/libs/CometChatCalendar/Entities/ArrowDirections.ts +0 -1
  907. package/src/shared/libs/CometChatCalendar/Entities/Calendar.ts +0 -26
  908. package/src/shared/libs/CometChatCalendar/Entities/Components.ts +0 -13
  909. package/src/shared/libs/CometChatCalendar/Entities/DateProperties.ts +0 -6
  910. package/src/shared/libs/CometChatCalendar/Entities/Locale.ts +0 -12
  911. package/src/shared/libs/CometChatCalendar/Entities/Theme.ts +0 -70
  912. package/src/shared/libs/CometChatCalendar/Entities/index.ts +0 -6
  913. package/src/shared/libs/CometChatCalendar/Hooks/index.ts +0 -1
  914. package/src/shared/libs/CometChatCalendar/Hooks/useSurroundingTimeUnits.ts +0 -63
  915. package/src/shared/libs/CometChatCalendar/Icons/BackArrow.png +0 -0
  916. package/src/shared/libs/CometChatCalendar/Icons/chevron-left-16.png +0 -0
  917. package/src/shared/libs/CometChatCalendar/Icons/index.ts +0 -7
  918. package/src/shared/libs/CometChatCalendar/Locales/index.ts +0 -4
  919. package/src/shared/libs/CometChatCalendar/Themes/Colors.ts +0 -31
  920. package/src/shared/libs/CometChatCalendar/Themes/DarkTheme.ts +0 -79
  921. package/src/shared/libs/CometChatCalendar/Themes/DefaultTheme.ts +0 -164
  922. package/src/shared/libs/CometChatCalendar/Themes/index.ts +0 -3
  923. package/src/shared/libs/CometChatCalendar/Utils/addOpacity.ts +0 -15
  924. package/src/shared/libs/CometChatCalendar/Utils/checkChangedProps.ts +0 -10
  925. package/src/shared/libs/CometChatCalendar/Utils/clamp.ts +0 -5
  926. package/src/shared/libs/CometChatCalendar/Utils/dateRange.ts +0 -23
  927. package/src/shared/libs/CometChatCalendar/Utils/getExtraDays.ts +0 -25
  928. package/src/shared/libs/CometChatCalendar/Utils/getSurroundingTimeUnits.ts +0 -20
  929. package/src/shared/libs/CometChatCalendar/Utils/index.ts +0 -6
  930. package/src/shared/libs/CometChatCalendar/index.ts +0 -5
  931. package/src/shared/libs/VideoPlayer/Video.js +0 -494
  932. package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +0 -43
  933. package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +0 -17
  934. package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +0 -1
  935. package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +0 -512
  936. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  937. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
  938. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
  939. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
  940. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
  941. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
  942. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
  943. package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
  944. package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
  945. package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
  946. package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
  947. package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
  948. package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
  949. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
  950. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
  951. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
  952. package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
  953. package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
  954. package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
  955. package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
  956. package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
  957. package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
  958. package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
  959. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
  960. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
  961. package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
  962. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
  963. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
  964. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
  965. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
  966. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
  967. package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
  968. package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
  969. package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
  970. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +0 -28
  971. package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +0 -1
  972. package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +0 -142
  973. package/src/shared/libs/VideoPlayerControls/components/Control.tsx +0 -45
  974. package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +0 -22
  975. package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +0 -1
  976. package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +0 -21
  977. package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +0 -36
  978. package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +0 -15
  979. package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +0 -1
  980. package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +0 -16
  981. package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +0 -7
  982. package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +0 -23
  983. package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +0 -109
  984. package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +0 -1
  985. package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +0 -21
  986. package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +0 -47
  987. package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +0 -1
  988. package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +0 -37
  989. package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +0 -28
  990. package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +0 -1
  991. package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +0 -12
  992. package/src/shared/libs/VideoPlayerControls/components/Title.tsx +0 -35
  993. package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +0 -110
  994. package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +0 -37
  995. package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +0 -1
  996. package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +0 -31
  997. package/src/shared/libs/VideoPlayerControls/components/index.ts +0 -14
  998. package/src/shared/libs/VideoPlayerControls/components/styles.ts +0 -30
  999. package/src/shared/libs/VideoPlayerControls/hooks/index.ts +0 -3
  1000. package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +0 -68
  1001. package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +0 -67
  1002. package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +0 -96
  1003. package/src/shared/libs/VideoPlayerControls/index.ts +0 -4
  1004. package/src/shared/libs/VideoPlayerControls/styles.ts +0 -19
  1005. package/src/shared/libs/VideoPlayerControls/types.ts +0 -290
  1006. package/src/shared/libs/VideoPlayerControls/utils.ts +0 -76
  1007. package/src/shared/libs/datePickerModal/DateTimePickerModal.android.js +0 -75
  1008. package/src/shared/libs/datePickerModal/DateTimePickerModal.ios.js +0 -363
  1009. package/src/shared/libs/datePickerModal/DateTimePickerModal.js +0 -9
  1010. package/src/shared/libs/datePickerModal/Modal.js +0 -180
  1011. package/src/shared/libs/datePickerModal/index.d.ts +0 -310
  1012. package/src/shared/libs/datePickerModal/index.js +0 -5
  1013. package/src/shared/libs/datePickerModal/utils.js +0 -25
  1014. package/src/shared/libs/luxon/src/datetime.js +0 -2422
  1015. package/src/shared/libs/luxon/src/duration.js +0 -990
  1016. package/src/shared/libs/luxon/src/errors.js +0 -61
  1017. package/src/shared/libs/luxon/src/impl/conversions.js +0 -206
  1018. package/src/shared/libs/luxon/src/impl/diff.js +0 -95
  1019. package/src/shared/libs/luxon/src/impl/digits.js +0 -75
  1020. package/src/shared/libs/luxon/src/impl/english.js +0 -233
  1021. package/src/shared/libs/luxon/src/impl/formats.js +0 -176
  1022. package/src/shared/libs/luxon/src/impl/formatter.js +0 -409
  1023. package/src/shared/libs/luxon/src/impl/invalid.js +0 -14
  1024. package/src/shared/libs/luxon/src/impl/locale.js +0 -542
  1025. package/src/shared/libs/luxon/src/impl/regexParser.js +0 -335
  1026. package/src/shared/libs/luxon/src/impl/tokenParser.js +0 -473
  1027. package/src/shared/libs/luxon/src/impl/util.js +0 -309
  1028. package/src/shared/libs/luxon/src/impl/zoneUtil.js +0 -30
  1029. package/src/shared/libs/luxon/src/info.js +0 -205
  1030. package/src/shared/libs/luxon/src/interval.js +0 -657
  1031. package/src/shared/libs/luxon/src/luxon.js +0 -26
  1032. package/src/shared/libs/luxon/src/package.json +0 -4
  1033. package/src/shared/libs/luxon/src/settings.js +0 -175
  1034. package/src/shared/libs/luxon/src/zone.js +0 -91
  1035. package/src/shared/libs/luxon/src/zones/IANAZone.js +0 -189
  1036. package/src/shared/libs/luxon/src/zones/fixedOffsetZone.js +0 -102
  1037. package/src/shared/libs/luxon/src/zones/invalidZone.js +0 -53
  1038. package/src/shared/libs/luxon/src/zones/systemZone.js +0 -61
  1039. package/src/shared/modals/CometChatCallLogDetailsOptions.ts +0 -23
  1040. package/src/shared/modals/CometChatCallLogDetailsTemplate.ts +0 -16
  1041. package/src/shared/modals/CometChatDetailsOption.ts +0 -24
  1042. package/src/shared/modals/CometChatDetailsTemplate.ts +0 -16
  1043. package/src/shared/modals/CometChatOptions.ts +0 -13
  1044. package/src/shared/modals/InteractiveData/InteractiveActions/APIAction.ts +0 -118
  1045. package/src/shared/modals/InteractiveData/InteractiveActions/CustomAction.ts +0 -19
  1046. package/src/shared/modals/InteractiveData/InteractiveActions/URLNavigationAction.ts +0 -34
  1047. package/src/shared/modals/InteractiveData/InteractiveActions/index.ts +0 -3
  1048. package/src/shared/modals/InteractiveData/InteractiveData/InteractiveCardData.ts +0 -69
  1049. package/src/shared/modals/InteractiveData/InteractiveData/InteractiveFormData.ts +0 -119
  1050. package/src/shared/modals/InteractiveData/InteractiveData/index.ts +0 -2
  1051. package/src/shared/modals/InteractiveData/InteractiveElements/BaseInputElement.ts +0 -102
  1052. package/src/shared/modals/InteractiveData/InteractiveElements/BaseInteractiveElement.ts +0 -45
  1053. package/src/shared/modals/InteractiveData/InteractiveElements/ButtonElement.ts +0 -61
  1054. package/src/shared/modals/InteractiveData/InteractiveElements/CheckboxElement.ts +0 -75
  1055. package/src/shared/modals/InteractiveData/InteractiveElements/DateTimeElement.ts +0 -103
  1056. package/src/shared/modals/InteractiveData/InteractiveElements/DropdownElement.ts +0 -83
  1057. package/src/shared/modals/InteractiveData/InteractiveElements/LabelElement.ts +0 -32
  1058. package/src/shared/modals/InteractiveData/InteractiveElements/OptionElement.ts +0 -39
  1059. package/src/shared/modals/InteractiveData/InteractiveElements/RadioButtonElement.ts +0 -76
  1060. package/src/shared/modals/InteractiveData/InteractiveElements/SingleSelectElement.ts +0 -76
  1061. package/src/shared/modals/InteractiveData/InteractiveElements/TextInputElement.ts +0 -101
  1062. package/src/shared/modals/InteractiveData/InteractiveElements/index.ts +0 -11
  1063. package/src/shared/modals/InteractiveData/InteractiveEntities/ActionEntity.ts +0 -41
  1064. package/src/shared/modals/InteractiveData/InteractiveEntities/ElementEntity.ts +0 -66
  1065. package/src/shared/modals/InteractiveData/InteractiveEntities/index.ts +0 -2
  1066. package/src/shared/modals/InteractiveData/InteractiveMessage/CardMessage.ts +0 -143
  1067. package/src/shared/modals/InteractiveData/InteractiveMessage/CustomInteractiveMessage.ts +0 -39
  1068. package/src/shared/modals/InteractiveData/InteractiveMessage/FormMessage.ts +0 -153
  1069. package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +0 -150
  1070. package/src/shared/modals/InteractiveData/InteractiveMessage/index.ts +0 -4
  1071. package/src/shared/modals/InteractiveData/index.ts +0 -30
  1072. package/src/shared/resources/CometChatTheme/CometChatTheme.ts +0 -28
  1073. package/src/shared/resources/CometChatTheme/Palette.ts +0 -584
  1074. package/src/shared/resources/CometChatTheme/Typography.ts +0 -396
  1075. package/src/shared/resources/CometChatTheme/index.ts +0 -2
  1076. package/src/shared/utils/CometChatLiveReactions/CometChatLiveReaction.tsx +0 -124
  1077. package/src/shared/utils/CometChatLiveReactions/LiveReactionstyles.ts +0 -37
  1078. package/src/shared/utils/CometChatLiveReactions/index.ts +0 -1
  1079. package/src/shared/utils/CometChatLiveReactions/resources/heart.png +0 -0
  1080. package/src/shared/utils/CometChatLiveReactions/resources/index.ts +0 -5
  1081. package/src/shared/utils/CometChatLiveReactions/style.ts +0 -8
  1082. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +0 -109
  1083. package/src/shared/utils/CometChatMessagePreview/MessagePreviewConfiguration.js +0 -30
  1084. package/src/shared/utils/CometChatMessagePreview/style.js +0 -71
  1085. package/src/shared/utils/DetailsUtils/DetailsUtils.tsx +0 -399
  1086. package/src/shared/utils/DetailsUtils/resources/Back.png +0 -0
  1087. package/src/shared/utils/DetailsUtils/resources/banIcon.png +0 -0
  1088. package/src/shared/utils/DetailsUtils/resources/close.png +0 -0
  1089. package/src/shared/utils/DetailsUtils/resources/index.ts +0 -23
  1090. package/src/shared/utils/DetailsUtils/resources/kickIcon.png +0 -0
  1091. package/src/shared/utils/DetailsUtils/resources/password.png +0 -0
  1092. package/src/shared/utils/DetailsUtils/resources/private.png +0 -0
  1093. package/src/shared/utils/DetailsUtils/resources/right-arrow.png +0 -0
  1094. package/src/shared/utils/InteractiveMessageUtils.ts +0 -60
  1095. package/src/shared/utils/SchedulerUtils.ts +0 -198
  1096. package/src/shared/utils/TypeUtils.ts +0 -3
  1097. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +0 -61
  1098. package/src/shared/views/CometChatAudioBubble/AudioBubbleStyle.ts +0 -43
  1099. package/src/shared/views/CometChatAvatar/AvatarConfiguration.ts +0 -27
  1100. package/src/shared/views/CometChatAvatar/AvatarStyle.ts +0 -57
  1101. package/src/shared/views/CometChatAvatar/resources/default.jpg +0 -0
  1102. package/src/shared/views/CometChatAvatar/resources/index.ts +0 -5
  1103. package/src/shared/views/CometChatBadge/BadgeConfiguration.ts +0 -55
  1104. package/src/shared/views/CometChatBadge/BadgeStyle.ts +0 -39
  1105. package/src/shared/views/CometChatBottomSheet/style.ts +0 -50
  1106. package/src/shared/views/CometChatButton/CometChatButton.tsx +0 -76
  1107. package/src/shared/views/CometChatButton/CometChatButtonStyle.ts +0 -47
  1108. package/src/shared/views/CometChatButton/index.ts +0 -5
  1109. package/src/shared/views/CometChatButton/style.ts +0 -8
  1110. package/src/shared/views/CometChatCard/CometChatCard.tsx +0 -77
  1111. package/src/shared/views/CometChatCard/CometChatCardStyle.ts +0 -31
  1112. package/src/shared/views/CometChatCard/index.ts +0 -8
  1113. package/src/shared/views/CometChatCard/style.ts +0 -13
  1114. package/src/shared/views/CometChatCardBubble/CardBubbleStyle.tsx +0 -47
  1115. package/src/shared/views/CometChatCardBubble/CometChatCardBubble.tsx +0 -174
  1116. package/src/shared/views/CometChatCardBubble/index.tsx +0 -2
  1117. package/src/shared/views/CometChatCheckBox/CheckBoxStyle.tsx +0 -43
  1118. package/src/shared/views/CometChatCheckBox/CometChatCheckBox.tsx +0 -79
  1119. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialogStyle.ts +0 -36
  1120. package/src/shared/views/CometChatDate/DateConfiguration.ts +0 -32
  1121. package/src/shared/views/CometChatDate/DateStyle.ts +0 -26
  1122. package/src/shared/views/CometChatDate/style.ts +0 -8
  1123. package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +0 -206
  1124. package/src/shared/views/CometChatDateTimePicker/DateTimePickerStyle.ts +0 -19
  1125. package/src/shared/views/CometChatDateTimePicker/index.ts +0 -3
  1126. package/src/shared/views/CometChatDropDown/CometChatDropDown.tsx +0 -127
  1127. package/src/shared/views/CometChatDropDown/DropDownStyle.tsx +0 -39
  1128. package/src/shared/views/CometChatDropDown/resources/downArrowIcon.png +0 -0
  1129. package/src/shared/views/CometChatDropDown/resources/index.js +0 -5
  1130. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +0 -27
  1131. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +0 -44
  1132. package/src/shared/views/CometChatFileBubble/FileBubbleStyle.ts +0 -58
  1133. package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +0 -542
  1134. package/src/shared/views/CometChatFormBubble/FormBubbleStyle.tsx +0 -96
  1135. package/src/shared/views/CometChatFormBubble/index.tsx +0 -2
  1136. package/src/shared/views/CometChatImageBubble/ImageBubbleStyle.ts +0 -34
  1137. package/src/shared/views/CometChatImageBubble/assets/default_image.png +0 -0
  1138. package/src/shared/views/CometChatLabel/CometChatLabel.tsx +0 -27
  1139. package/src/shared/views/CometChatLabel/LabelStyle.ts +0 -19
  1140. package/src/shared/views/CometChatList/resources/Back.png +0 -0
  1141. package/src/shared/views/CometChatList/resources/Search.png +0 -0
  1142. package/src/shared/views/CometChatListItem/ListItemConfiguration.tsx +0 -21
  1143. package/src/shared/views/CometChatListItem/ListItemStyle.ts +0 -47
  1144. package/src/shared/views/CometChatMediaRecorder/MediaRecorderStyle.ts +0 -63
  1145. package/src/shared/views/CometChatMessageBubble/MessageBubbleStyle.ts +0 -26
  1146. package/src/shared/views/CometChatPanel/CometChatPanel.tsx +0 -51
  1147. package/src/shared/views/CometChatPanel/PanelStyle.tsx +0 -43
  1148. package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
  1149. package/src/shared/views/CometChatPanel/resources/index.ts +0 -6
  1150. package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +0 -13
  1151. package/src/shared/views/CometChatQuickView/CometChatQuickView.tsx +0 -66
  1152. package/src/shared/views/CometChatQuickView/QuickViewStyle.ts +0 -55
  1153. package/src/shared/views/CometChatRadioButton/CometChatRadioButton.tsx +0 -67
  1154. package/src/shared/views/CometChatRadioButton/RadioButtonStyle.tsx +0 -38
  1155. package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +0 -15
  1156. package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +0 -13
  1157. package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +0 -43
  1158. package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +0 -65
  1159. package/src/shared/views/CometChatReceipt/ReceiptStyle.ts +0 -41
  1160. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +0 -1519
  1161. package/src/shared/views/CometChatSchedulerBubble/index.ts +0 -3
  1162. package/src/shared/views/CometChatSchedulerBubble/styles.ts +0 -92
  1163. package/src/shared/views/CometChatSingleSelect/CometChatSingleSelect.tsx +0 -63
  1164. package/src/shared/views/CometChatSingleSelect/SingleStyle.tsx +0 -35
  1165. package/src/shared/views/CometChatStatusIndicator/StatusIndicatorConfiguration.ts +0 -25
  1166. package/src/shared/views/CometChatStatusIndicator/StatusIndicatorStyle.ts +0 -37
  1167. package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +0 -23
  1168. package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -37
  1169. package/src/shared/views/CometChatTextInput/CometChatTextInput.tsx +0 -67
  1170. package/src/shared/views/CometChatTextInput/TextInputStyle.tsx +0 -26
  1171. package/src/shared/views/CometChatTimeSlotSelector/CometChatTimeSlotSelector.tsx +0 -113
  1172. package/src/shared/views/CometChatTimeSlotSelector/index.ts +0 -3
  1173. package/src/shared/views/CometChatTimeSlotSelector/styles.ts +0 -30
  1174. package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +0 -87
  1175. package/src/shared/views/SwipeRow/SwipeRow.tsx +0 -126
  1176. package/src/shared/views/SwipeRow/index.ts +0 -3
  1177. package/src/shared/views/SwipeRow/style.ts +0 -30
  1178. /package/src/{shared/assets/images → CometChatGroups/resources}/search.png +0 -0
  1179. /package/src/{CometChatDetails → CometChatThreadHeader}/resources/Back.png +0 -0
  1180. /package/src/{AI/AIConversationSummary → CometChatThreadHeader}/resources/close.png +0 -0
  1181. /package/src/{CometChatThreadedMessages → CometChatThreadHeader}/resources/more.png +0 -0
  1182. /package/src/{CometChatDetails → CometChatThreadHeader}/resources/password.png +0 -0
  1183. /package/src/{CometChatDetails → CometChatThreadHeader}/resources/private.png +0 -0
  1184. /package/src/{CometChatDetails → CometChatThreadHeader}/resources/right-arrow.png +0 -0
@@ -1,1421 +1,1648 @@
1
- import React, { useContext } from "react";
2
- import { View, Text, TextStyle, ViewProps } from "react-native";
3
- //@ts-ignore
1
+ /*
2
+ * CometChatConversations.tsx
3
+ * ---------------------------------------------------------------------------
4
+ * CometChatConversations is a React Native component that displays a list of conversations
5
+ * It provides features such as message receipt visibility, custom sound notifications,
6
+ * date formatting, and selection modes (none, single, multiple).
7
+ * It also allows for custom rendering of conversation items, error handling, and loading states.
8
+ * The component supports user and group events, message events, and call events.
9
+ * It also provides options for customizing the appearance of the conversation list.
10
+ * ---------------------------------------------------------------------------
11
+ */
4
12
  import { CometChat } from "@cometchat/chat-sdk-react-native";
13
+ import React, { useCallback, useMemo } from "react";
14
+ import { Text, View, GestureResponderEvent } from "react-native";
5
15
  import {
6
- AvatarStyleInterface,
7
- ChatConfigurator,
8
- CometChatConfirmDialog,
9
- CometChatConfirmDialogStyleInterface,
10
- CometChatContext,
11
- CometChatMentionsFormatter,
12
- CometChatTextFormatter,
13
- CometChatUrlsFormatter,
14
- MentionTextStyle,
15
- CometChatListActionsInterface,
16
- localize,
17
- CometChatUIKit,
18
- CometChatUiKitConstants
16
+ ChatConfigurator,
17
+ CometChatAvatar,
18
+ CometChatConversationEvents,
19
+ CometChatList,
20
+ CometChatListActionsInterface,
21
+ CometChatMentionsFormatter,
22
+ CometChatSoundManager,
23
+ CometChatStatusIndicator,
24
+ CometChatTextFormatter,
25
+ CometChatUIKit,
26
+ CometChatUiKitConstants,
27
+ CometChatUrlsFormatter,
28
+ localize,
19
29
  } from "../shared";
20
- import { Style } from "./style";
30
+ import { SelectionMode } from "../shared/base/Types";
21
31
  import {
22
- backIcon, passwordGroupIcon,
23
- privateGroupIcon,
24
- sentIcon, readIcon, deliveredIcon,
25
- rightTickIcon, deleteIcon
26
- } from "./resources";
27
- import { ConversationsStyle, ConversationsStyleInterface } from "./ConversationsStyle";
28
- import { ImageType } from "../shared";
29
- import { ConversationTypeConstants, GroupTypeConstants, MessageCategoryConstants, MessageStatusConstants, PASSWORD_GROUP_COLOR, PRIVATE_GROUP_COLOR, ReceiverTypeConstants } from "../shared/constants/UIKitConstants";
30
- import { AvatarStyle, BadgeStyle, CometChatBadge, CometChatDate, CometChatListItem, CometChatReceipt, DateStyle, StatusIndicatorStyle } from "../shared";
31
- import { ListItemStyle, ListItemStyleInterface } from "../shared";
32
- import { CometChatContextType, MessageReceipt, SelectionMode } from "../shared/base/Types";
33
- import { CometChatSoundManager } from "../shared"
34
- import { CometChatConversationUtils } from "../shared";
35
- import { CometChatList } from "../shared";
36
- import { CometChatOptions } from "../shared";
32
+ ConversationTypeConstants,
33
+ GroupTypeConstants,
34
+ MentionsTargetElement,
35
+ MessageCategoryConstants,
36
+ MessageReceipt,
37
+ MessageStatusConstants,
38
+ ReceiverTypeConstants,
39
+ } from "../shared/constants/UIKitConstants";
37
40
  import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
38
- import { StatusIndicatorStyleInterface } from "../shared/views/CometChatStatusIndicator/StatusIndicatorStyle";
39
- import { DateStyleInterface } from "../shared/views/CometChatDate/DateStyle";
40
- import { BadgeStyleInterface } from "../shared/views/CometChatBadge";
41
- import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
41
+ import { Icon } from "../shared/icons/Icon";
42
42
  import { CommonUtils } from "../shared/utils/CommonUtils";
43
- import { ReceiptStyle, ReceiptStyleInterface } from "../shared/views/CometChatReceipt";
44
-
43
+ import { getMessagePreviewInternal } from "../shared/utils/MessageUtils";
44
+ import { CometChatBadge } from "../shared/views/CometChatBadge";
45
+ import { CometChatConfirmDialog } from "../shared/views/CometChatConfirmDialog";
46
+ import { CometChatDate } from "../shared/views/CometChatDate";
47
+ import { CometChatReceipt } from "../shared/views/CometChatReceipt";
48
+ import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
49
+ import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
50
+ import { useTheme } from "../theme";
51
+ import { Skeleton } from "./Skeleton";
52
+ import { ConversationStyle, Style } from "./style";
53
+ import { deepMerge } from "../shared/helper/helperFunctions";
54
+ import Delete from "../shared/icons/components/delete";
55
+ import { DeepPartial } from "../shared/helper/types";
56
+ import { CometChatTheme } from "../theme/type";
57
+ import { MenuItemInterface } from "../shared/views/CometChatTooltipMenu/CometChatTooltipMenu";
58
+
59
+ // Unique listener IDs for conversation, user, group, message and call events.
45
60
  const conversationListenerId = "chatlist_" + new Date().getTime();
46
61
  const userListenerId = "chatlist_user_" + new Date().getTime();
47
62
  const groupListenerId = "chatlist_group_" + new Date().getTime();
48
63
  const messageListenerId = "chatlist_message_" + new Date().getTime();
49
64
  const callListenerId = "call_" + new Date().getTime();
50
65
 
66
+ /**
67
+ * Interface defining props for the CometChatConversations component.
68
+ */
51
69
  export interface ConversationInterface {
52
- /**
53
- * hide selection icon
54
- */
55
- hideSubmitIcon?: boolean,
56
- /**
57
- * toggle user presence view
58
- */
59
- disableUsersPresence?: boolean,
60
- /**
61
- * @deprecated
62
- *
63
- * This property is deprecated as of version 4.3.18 due to newer property 'hideReceipt'. It will be removed in subsequent versions.
64
- */
65
- disableReceipt?: boolean,
66
- hideReceipt?: boolean,
67
- /**
68
- * toggle typing indicator
69
- */
70
- disableTyping?: boolean,
71
- /**
72
- * toggle sound played when message is received
73
- */
74
- disableSoundForMessages?: boolean,
75
- /**
76
- * custom sound for received messages
77
- */
78
- customSoundForMessages?: string,
79
- /**
80
- * custom icon for protected group
81
- */
82
- protectedGroupIcon?: ImageType,
83
- /**
84
- * custom icon for private group
85
- */
86
- privateGroupIcon?: ImageType,
87
- /**
88
- * custom icon for read message
89
- */
90
- readIcon?: ImageType,
91
- /**
92
- * custom icon for delivered message
93
- */
94
- deliveredIcon?: ImageType,
95
- /**
96
- * custom icon for sent message
97
- */
98
- sentIcon?: ImageType,
99
- /**
100
- * custom icon for error message
101
- */
102
- errorIcon?: ImageType,
103
- /**
104
- * custom icon for waiting message
105
- */
106
- waitingIcon?: ImageType,
107
- /**
108
- * call back function which will get an conversation as an argument and returns an string.
109
- */
110
- datePattern?: (conversation: CometChat.Conversation) => string,
111
- /**
112
- * pass the custom view for list item
113
- */
114
- ListItemView?: (item: CometChat.Conversation) => JSX.Element,
115
- /**
116
- * pass the functional component for options in app bar
117
- */
118
- AppBarOption?: () => JSX.Element,
119
- /**
120
- * Pass array of CometChatOptions type
121
- * Tobe shown on swipe of list item
122
- */
123
- options?: (item: CometChat.Conversation) => CometChatOptions[],
124
- /**
125
- * toggle seperator
126
- */
127
- hideSeparator?: boolean,
128
- /**
129
- * icon for back button
130
- */
131
- backButtonIcon?: ImageType,
132
- /**
133
- * toggle back button view
134
- */
135
- showBackButton?: boolean,
136
- /**
137
- * select items pass "none" | "single" | "multitple"
138
- */
139
- selectionMode?: SelectionMode,
140
- /**
141
- * call back on seleciton is done
142
- */
143
- onSelection?: (item: Array<CometChat.Conversation>) => void,
144
- /**
145
- * title to be shown default "Chats"
146
- */
147
- title?: string,
148
- /**
149
- * Text to be displayed if no conversation found.
150
- */
151
- emptyStateText?: string,
152
- /**
153
- * Custom Functional component for empty state
154
- */
155
- EmptyStateView?: () => JSX.Element,
156
- /**
157
- * Text tobe displayed if there is an error while fetching conversations.
158
- */
159
- errorStateText?: string,
160
- /**
161
- * Custom functional component for error state.
162
- */
163
- ErrorStateView?: () => JSX.Element,
164
- /**
165
- * Custom functional component for loading state.
166
- */
167
- LoadingStateView?: () => JSX.Element,
168
- /**
169
- * Request builder to fetch conversations.
170
- */
171
- conversationsRequestBuilder?: CometChat.ConversationsRequestBuilder,
172
- /**
173
- * Custom subtitle view
174
- */
175
- SubtitleView?: (item: CometChat.Conversation) => JSX.Element,
176
- /**
177
- * toogle error view
178
- */
179
- hideError?: boolean,
180
- /**
181
- * call back function for
182
- */
183
- onItemPress?: (item: CometChat.Conversation) => void,
184
- /**
185
- * callback function for long press
186
- */
187
- onItemLongPress?: (item: CometChat.Conversation) => void,
188
- /**
189
- * callback function will be called when error occured while fetching conversations
190
- */
191
- onError?: (e: CometChat.CometChatException) => void,
192
- /**
193
- * callback function for on back
194
- */
195
- onBack?: () => void,
196
- /**
197
- * style object for conversations
198
- */
199
- conversationsStyle?: ConversationsStyleInterface,
200
- /**
201
- * style object for list item
202
- */
203
- listItemStyle?: ListItemStyleInterface,
204
- /**
205
- * style object for avatar
206
- */
207
- avatarStyle?: AvatarStyleInterface,
208
- /**
209
- * style object for status indicator
210
- */
211
- statusIndicatorStyle?: StatusIndicatorStyleInterface,
212
- /**
213
- * style object for date
214
- */
215
- dateStyle?: DateStyleInterface,
216
- /**
217
- * style object for receipt
218
- */
219
- receiptStyle?: ReceiptStyleInterface,
220
- /**
221
- * style object for badge
222
- */
223
- badgeStyle?: BadgeStyleInterface,
224
- /**
225
- * style object for confirm dialog
226
- */
227
- confirmDialogStyle?: CometChatConfirmDialogStyleInterface,
228
- /**
229
- * if true, mentions will be disabled. Default: false
230
- */
231
- disableMentions?: boolean,
232
- /**
233
- * Collection of text formatter class
234
- * @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
235
- */
236
- textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
70
+ /**
71
+ * Hide the submit (selection) button.
72
+ */
73
+ hideSubmitButton?: boolean;
74
+ /**
75
+ * Toggles message receipts (single/double‑tick) inside the subtitle. When
76
+ * `false`, ticks are not rendered for the last outgoing message.
77
+ */
78
+ receiptsVisibility?: boolean;
79
+ /**
80
+ * Toggle sound playback for received messages.
81
+ */
82
+ disableSoundForMessages?: boolean;
83
+ /**
84
+ * Custom sound file path for received messages.
85
+ */
86
+ customSoundForMessages?: string;
87
+ /**
88
+ * Function to generate a custom date string for a conversation.
89
+ * @param conversation - The conversation object.
90
+ * @returns A string representing the date.
91
+ */
92
+ datePattern?: (conversation: CometChat.Conversation) => string;
93
+ /**
94
+ * Completely overrides the default rendering of each conversation item in the list.
95
+ *
96
+ * **Note:** When `ItemView` is provided, all internal rendering logic – including
97
+ * LeadingView, TitleView, SubtitleView, TrailingView – is ignored.
98
+ *
99
+ * **Important:** If you use `ItemView`, you are also responsible for handling:
100
+ *
101
+ * - **`onItemPress`** — trigger conversation open or custom action.
102
+ * - **`onItemLongPress`** — show tooltip or perform contextual action.
103
+ * - **Selection mode** (`selectionMode: "single" | "multiple"`) — you must manage
104
+ * selection state, checkboxes, and visual feedback yourself.
105
+ */
106
+ ItemView?: (item: CometChat.Conversation) => JSX.Element;
107
+ /**
108
+ * Functional component for rendering options in the app bar.
109
+ */
110
+ AppBarOptions?: () => JSX.Element;
111
+ /**
112
+ * Hide the back button.
113
+ */
114
+ hideBackButton?: boolean;
115
+ /**
116
+ * Selection mode: "none" | "single" | "multiple".
117
+ */
118
+ selectionMode?: SelectionMode;
119
+ /**
120
+ * Callback when conversation selection is complete.
121
+ */
122
+ onSelection?: (conversations: Array<CometChat.Conversation>) => void;
123
+ /**
124
+ * Callback when submit selection button is pressed.
125
+ */
126
+ onSubmit?: (conversation: Array<CometChat.Conversation>) => void;
127
+ /**
128
+ * Custom view for the empty state.
129
+ */
130
+ EmptyView?: () => JSX.Element;
131
+ /**
132
+ * Custom view for the error state.
133
+ */
134
+ ErrorView?: () => JSX.Element;
135
+ /**
136
+ * Custom view for the loading state.
137
+ */
138
+ LoadingView?: () => JSX.Element;
139
+ /**
140
+ * Request builder to fetch conversations.
141
+ */
142
+ conversationsRequestBuilder?: CometChat.ConversationsRequestBuilder;
143
+ /**
144
+ * Custom leading view for a conversation item.
145
+ */
146
+ LeadingView?: (conversation: CometChat.Conversation) => JSX.Element;
147
+ /**
148
+ * Custom title view for a conversation item.
149
+ */
150
+ TitleView?: (conversation: CometChat.Conversation) => JSX.Element;
151
+ /**
152
+ * Custom subtitle view for a conversation item.
153
+ */
154
+ SubtitleView?: (item: CometChat.Conversation) => JSX.Element;
155
+ /**
156
+ * Custom tail view for a conversation item.
157
+ */
158
+ TrailingView?: (item: CometChat.Conversation) => JSX.Element;
159
+ /**
160
+ * Hide error view.
161
+ */
162
+ hideError?: boolean;
163
+ /**
164
+ * Callback for when a conversation item is pressed.
165
+ */
166
+ onItemPress?: (item: CometChat.Conversation) => void;
167
+ /**
168
+ * Callback for when a conversation item is long pressed.
169
+ */
170
+ onItemLongPress?: (item: CometChat.Conversation) => void;
171
+ /**
172
+ * Callback when an error occurs while fetching conversations.
173
+ */
174
+ onError?: (e: CometChat.CometChatException) => void;
175
+ /**
176
+ * Callback for when the back action is triggered.
177
+ */
178
+ onBack?: () => void;
179
+ /**
180
+ * Array of text formatter classes.
181
+ */
182
+ textFormatters?: Array<
183
+ CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter
184
+ >;
185
+ /**
186
+ * Custom styles for the conversation view.
187
+ */
188
+ style?: DeepPartial<ConversationStyle>;
189
+ /**
190
+ * Hide the header of the conversation list.
191
+ */
192
+ hideHeader?: boolean;
193
+ /**
194
+ * Callback triggered when the fetched list is empty.
195
+ */
196
+ onEmpty?: () => void;
197
+ /**
198
+ * Callback triggered once the users have loaded and are not empty.
199
+ */
200
+ onLoad?: (list: CometChat.Conversation[]) => void;
201
+ /**
202
+ * A function to **replace** the default menu items entirely for a users.
203
+ */
204
+ options?: (conversation: CometChat.Conversation) => MenuItemInterface[];
205
+ /**
206
+ * A function to **append** more menu items on top of the default menu items for a users.
207
+ */
208
+ addOptions?: (conversation: CometChat.Conversation) => MenuItemInterface[];
209
+ /**
210
+ * Toggle user status visibilty.
211
+ */
212
+ usersStatusVisibility?: boolean;
213
+ /**
214
+ * Toggle group type visibilty.
215
+ */
216
+ groupTypeVisibility?: boolean;
217
+ /**
218
+ * Toggle delete conversation option visibilty.
219
+ */
220
+ deleteConversationOptionVisibility?: boolean;
237
221
  }
238
222
 
239
223
  /**
240
- *
241
- * @version 1.0.0
242
- * @author CometChatTeam
243
- * @description CometChatConversations is a container component that wraps and
244
- * formats CometChatListBase and CometChatConversationList component, with no behavior of its own.
245
- *
224
+ * CometChatConversations is a container component that wraps and formats the conversation list.
225
+ * It handles events such as new messages, typing indicators, call events, and group events.
246
226
  */
247
227
  export const CometChatConversations = (props: ConversationInterface) => {
248
- /**
249
- * Props destructuring
250
- */
251
- const {
252
- disableUsersPresence = false,
253
- disableReceipt = false,
254
- hideReceipt = false,
255
- disableTyping = false,
256
- disableSoundForMessages = false,
257
- customSoundForMessages,
258
- datePattern,
259
- ListItemView,
260
- AppBarOption,
261
- options,
262
- hideSeparator = true,
263
- hideSubmitIcon = false,
264
- backButtonIcon,
265
- showBackButton = false,
266
- selectionMode = "single",
267
- onSelection,
268
- title = localize("CHATS"),
269
- emptyStateText,
270
- EmptyStateView,
271
- errorStateText,
272
- ErrorStateView,
273
- LoadingStateView,
274
- conversationsRequestBuilder,
275
- SubtitleView,
276
- hideError = false,
277
- onItemPress,
278
- onItemLongPress,
279
- onError,
280
- onBack,
281
- conversationsStyle,
282
- disableMentions,
283
- textFormatters
284
- } = props;
285
-
286
- //context
287
- const { theme } = useContext<CometChatContextType>(CometChatContext);
288
- const activeSwipeRows = React.useRef<any>({});
289
-
290
- const conversationListRef = React.useRef<CometChatListActionsInterface>(null);
291
- const loggedInUser = React.useRef<CometChat.User | null | any>(null);
292
- const [confirmDelete, setConfirmDelete] = React.useState(undefined);
293
- const [selecting, setSelecting] = React.useState(selectionMode === 'none' ? false : true);
294
- const [selectedConversation, setSelectedConversations] = React.useState<any[]>([]);
295
- const onMemberAddedToGroupDebounceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
296
-
297
- const _style = new ConversationsStyle({
298
- backgroundColor: theme?.palette?.getBackgroundColor(),
299
- backIconTint: theme?.palette?.getPrimary(),
300
- emptyTextColor: theme?.palette?.getAccent400(),
301
- emptyTextFont: theme?.typography?.caption2,
302
- errorTextColor: theme?.palette?.getError(),
303
- errorTextFont: theme?.typography?.subtitle1,
304
- lastMessageTextColor: theme?.palette.getAccent600(),
305
- lastMessageTextFont: theme?.typography.subtitle1,
306
- loadingIconTint: theme?.palette.getPrimary(),
307
- separatorColor: theme?.palette.getAccent100(),
308
- titleColor: theme?.palette.getAccent(),
309
- titleFont: theme?.typography.heading,
310
- typingIndictorTextColor: theme?.palette.getAccent600(),
311
- typingIndictorTextFont: theme?.typography.subtitle1,
312
- threadIndicatorTextColor: theme?.palette.getAccent800(),
313
- threadIndicatorTextFont: theme?.typography.text1,
314
- ...conversationsStyle
315
- });
316
- const _statusIndicatorStyle = new StatusIndicatorStyle(props?.statusIndicatorStyle || {});
317
- const _avatarStyle = new AvatarStyle({
318
- backgroundColor: theme?.palette?.getAccent600(),
319
- nameTextColor: theme?.palette?.getAccent(),
320
- nameTextFont: theme?.typography.body,
321
- ...props?.avatarStyle
322
- });
323
-
324
- const _listItemStyle = new ListItemStyle({
325
- backgroundColor: theme?.palette?.getBackgroundColor(),
326
- titleColor: theme?.palette.getAccent(),
327
- titleFont: theme?.typography.name,
328
- ...props?.listItemStyle
329
- });
330
- const _badgeStyle = new BadgeStyle({
331
- backgroundColor: theme?.palette?.getPrimary(),
332
- textColor: theme?.palette?.getSecondary(),
333
- textFont: theme?.typography?.caption2,
334
- ...props?.badgeStyle
335
- });
336
- const _receiptStyle = new ReceiptStyle(props?.receiptStyle || {});
337
- const _dateStyle = new DateStyle({
338
- textColor: theme?.palette?.getAccent600(),
339
- textFont: theme?.typography?.caption1,
340
- ...props?.dateStyle
341
- });
342
-
343
- const _confirmDialogStyle = (props?.confirmDialogStyle || {});
344
-
345
- const ErrorView = () => {
346
- return (
347
- <View style={Style.listContainer}>
348
- <Text style={{ ..._style?.errorTextFont, color: _style?.errorTextColor } as TextStyle}>
349
- {errorStateText || localize("SOMETHING_WRONG")}
350
- </Text>
351
- </View>
352
- );
353
- }
228
+ const {
229
+ receiptsVisibility = true,
230
+ disableSoundForMessages = false,
231
+ hideHeader = false,
232
+ customSoundForMessages,
233
+ datePattern,
234
+ ItemView,
235
+ AppBarOptions,
236
+ hideSubmitButton = false,
237
+ hideBackButton = true,
238
+ selectionMode = "none",
239
+ onSelection,
240
+ onSubmit,
241
+ EmptyView,
242
+ ErrorView,
243
+ LoadingView,
244
+ conversationsRequestBuilder,
245
+ LeadingView,
246
+ TitleView,
247
+ SubtitleView,
248
+ TrailingView,
249
+ hideError = false,
250
+ onItemPress,
251
+ onItemLongPress,
252
+ onError,
253
+ onBack,
254
+ textFormatters,
255
+ style,
256
+ onEmpty,
257
+ onLoad,
258
+ options,
259
+ addOptions,
260
+ usersStatusVisibility = true,
261
+ groupTypeVisibility = true,
262
+ deleteConversationOptionVisibility = true,
263
+ } = props;
264
+
265
+ // Reference for accessing CometChatList methods
266
+ const conversationListRef = React.useRef<CometChatListActionsInterface>(null);
267
+ // Store the logged in user for comparison and event handling.
268
+ const loggedInUser = React.useRef<CometChat.User>();
269
+ // State to control the confirmation dialog for deleting a conversation.
270
+ const [confirmDelete, setConfirmDelete] = React.useState<string | undefined>(undefined);
271
+ // State to control selection mode for conversation items.
272
+ const [selecting, setSelecting] = React.useState(selectionMode === "none" ? false : true);
273
+ const [selectedConversation, setSelectedConversations] = React.useState<
274
+ Array<CometChat.Conversation>
275
+ >([]);
276
+ // Timer for debouncing member-added events.
277
+ const onMemberAddedToGroupDebounceTimer = React.useRef<ReturnType<typeof setTimeout> | null>(
278
+ null
279
+ );
280
+ // Reference to store long press identifier.
281
+ const longPressId = React.useRef<string | undefined>(undefined);
282
+ const longPressedConversation = React.useRef<CometChat.Conversation>(undefined);
283
+
284
+ // Reference to store tooltip position for long press events.
285
+ const tooltipPositon = React.useRef({
286
+ pageX: 0,
287
+ pageY: 0,
288
+ });
289
+ const [tooltipVisible, setTooltipVisible] = React.useState(false);
290
+
291
+ // Merge theme styles with provided style overrides.
292
+ const theme = useTheme();
293
+ const mergedStyles = useMemo(() => {
294
+ return deepMerge(theme.conversationStyles, style ?? {});
295
+ }, [theme.conversationStyles, style]);
354
296
 
355
- const EmptyView = () => {
356
- if (EmptyStateView)
357
- return EmptyStateView();
358
- else
359
- return (
360
- <View style={Style.listContainer}>
361
- <Text style={{ ..._style.emptyTextFont, color: _style.emptyTextColor } as TextStyle}>
362
- {emptyStateText || localize("NO_CHATS_FOUND")}
363
- </Text>
364
- </View>
365
- )
366
- }
367
-
368
- const userEventHandler = (...args: any[]) => {
369
- const { uid } = args[0];
370
- let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) as unknown as CometChat.Conversation || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`) as unknown as CometChat.Conversation;
371
- const user: CometChat.User = item.getConversationWith();
372
- if((user.getBlockedByMe() || user.getHasBlockedMe())) return;
373
- if (item) {
374
- let updatedConversation = CommonUtils.clone(item);
375
- updatedConversation.setConversationWith(args[0]);
376
- conversationListRef.current?.updateList(updatedConversation);
377
- }
378
- }
379
-
380
-
381
- const getConversationRefFromTypingIndicator = (typingIndicator: CometChat.TypingIndicator) => {
382
- let list = conversationListRef.current?.getAllListItems();
383
- return list?.find((item: CometChat.Conversation) => {
384
- return (
385
- (typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
386
- item.getConversationType() == ReceiverTypeConstants.user
387
- && (item.getConversationWith() as CometChat.User).getUid() == typingIndicator.getSender().getUid() && !((item.getConversationWith() as CometChat.User)?.getBlockedByMe() || (item.getConversationWith() as CometChat.User)?.getHasBlockedMe()))
388
- || (typingIndicator.getReceiverType() == ReceiverTypeConstants.group && item.getConversationType() == ReceiverTypeConstants.group
389
- && (item.getConversationWith() as CometChat.Group).getGuid() == typingIndicator.getReceiverId())
390
- )
391
- })
392
- }
297
+ /**
298
+ * ErrorStateView renders a view to show when an error occurs.
299
+ */
300
+ const ErrorStateView = useCallback(() => {
301
+ return (
302
+ <ErrorEmptyView
303
+ title={localize("OOPS")}
304
+ subTitle={localize("SOMETHING_WENT_WRONG")}
305
+ tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
306
+ Icon={
307
+ <Icon
308
+ name='error-state'
309
+ size={theme.spacing.margin.m15 << 1}
310
+ containerStyle={{
311
+ marginBottom: theme.spacing.margin.m5,
312
+ ...mergedStyles?.errorStateStyle?.iconContainerStyle,
313
+ }}
314
+ icon={mergedStyles?.errorStateStyle?.icon}
315
+ imageStyle={mergedStyles?.errorStateStyle?.iconStyle}
316
+ />
317
+ }
318
+ containerStyle={mergedStyles?.errorStateStyle?.containerStyle}
319
+ titleStyle={mergedStyles?.errorStateStyle?.titleStyle}
320
+ subTitleStyle={mergedStyles?.errorStateStyle?.subTitleStyle}
321
+ />
322
+ );
323
+ }, [theme, mergedStyles]);
393
324
 
394
- /**
395
- * Listener callback for typing event
396
- * @param {...any} args
397
- */
398
- const typingEventHandler = (...args: any[]) => {
399
- let conversation: CometChat.Conversation = getConversationRefFromTypingIndicator(args[0]);
400
- if (conversation) {
401
- let isTyping = args[1];
402
- let newConversation = conversation
403
- if (isTyping && !newConversation?.['lastMessage']?.["typing"]) {
404
- newConversation['lastMessage']["typing"] = args[0]?.receiverType === 'group' ?
405
- `${args[0].sender.name.trim()} ${localize("IS_TYPING")}` :
406
- localize("IS_TYPING");
407
- } else {
408
- delete newConversation['lastMessage']['typing'];
409
- }
410
- conversationListRef.current?.updateList(newConversation);
325
+ /**
326
+ * EmptyStateView renders a view when no conversations are available.
327
+ */
328
+ const EmptyStateView = useCallback(() => {
329
+ return (
330
+ <ErrorEmptyView
331
+ title='No Conversations Yet'
332
+ subTitle='Start a new chat or invite others to join the conversation.'
333
+ Icon={
334
+ <Icon
335
+ name='empty-state'
336
+ size={theme.spacing.spacing.s15 << 1}
337
+ containerStyle={{
338
+ marginBottom: theme.spacing.spacing.s5,
339
+ ...mergedStyles?.emptyStateStyle?.iconContainerStyle,
340
+ }}
341
+ icon={mergedStyles?.emptyStateStyle?.icon}
342
+ imageStyle={mergedStyles?.emptyStateStyle?.iconStyle}
343
+ />
411
344
  }
345
+ containerStyle={mergedStyles?.emptyStateStyle?.containerStyle}
346
+ titleStyle={mergedStyles?.emptyStateStyle?.titleStyle}
347
+ subTitleStyle={mergedStyles?.emptyStateStyle?.subTitleStyle}
348
+ />
349
+ );
350
+ }, [theme, mergedStyles]);
412
351
 
352
+ /**
353
+ * Handler for user online/offline events. Finds the corresponding conversation and updates it.
354
+ */
355
+ const userEventHandler = (...args: any[]) => {
356
+ const { uid } = args[0];
357
+ let item: CometChat.Conversation | any =
358
+ (conversationListRef.current?.getListItem(
359
+ `${uid}_user_${loggedInUser.current?.getUid()}`
360
+ ) as unknown as CometChat.Conversation) ||
361
+ (conversationListRef.current?.getListItem(
362
+ `${loggedInUser.current?.getUid()}_user_${uid}`
363
+ ) as unknown as CometChat.Conversation);
364
+ const user: CometChat.User = item.getConversationWith();
365
+ if (user.getBlockedByMe() || user.getHasBlockedMe()) return;
366
+ if (item) {
367
+ let updatedConversation = CommonUtils.clone(item);
368
+ updatedConversation.setConversationWith(args[0]);
369
+ conversationListRef.current?.updateList(updatedConversation);
413
370
  }
371
+ };
414
372
 
415
- /**
416
- * Find conversation from state , check and udpate its last message object.
417
- * conversation list item remains at the same place
418
- *
419
- * @param newMessage message object
373
+ /**
374
+ * Returns a conversation that matches a typing indicator.
420
375
  */
421
- const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage, resetUnreadCount = false) => {
422
- CometChat.CometChatHelper.getConversationFromMessage(newMessage)
423
- .then((conversation: any) => {
424
- let conver: any = conversationListRef.current?.getListItem(conversation.getConversationId())
425
- if (!conver) return;
426
- let lastMessageId = conver['lastMessage']['id']
427
- if (lastMessageId == newMessage['id']) {
428
- if(resetUnreadCount) {
429
- conver.setUnreadMessageCount(0);
430
- }
431
- conver.setLastMessage(newMessage)
432
- conversationListRef.current?.updateList(conver)
433
- }
434
- })
376
+ const getConversationRefFromTypingIndicator = (typingIndicator: CometChat.TypingIndicator) => {
377
+ let list = conversationListRef.current?.getAllListItems();
378
+ return list?.find((item: CometChat.Conversation) => {
379
+ return (
380
+ (typingIndicator.getReceiverType() == ReceiverTypeConstants.user &&
381
+ item.getConversationType() == ReceiverTypeConstants.user &&
382
+ (item.getConversationWith() as CometChat.User).getUid() ==
383
+ typingIndicator.getSender().getUid() &&
384
+ !(
385
+ (item.getConversationWith() as CometChat.User)?.getBlockedByMe() ||
386
+ (item.getConversationWith() as CometChat.User)?.getHasBlockedMe()
387
+ )) ||
388
+ (typingIndicator.getReceiverType() == ReceiverTypeConstants.group &&
389
+ item.getConversationType() == ReceiverTypeConstants.group &&
390
+ (item.getConversationWith() as CometChat.Group).getGuid() ==
391
+ typingIndicator.getReceiverId())
392
+ );
393
+ });
394
+ };
435
395
 
396
+ /**
397
+ * Handler for typing events in conversations.
398
+ * Toggle the *live typing…* indicator on a conversation row.
399
+ */
400
+ const typingEventHandler = (...args: any) => {
401
+ let conversation: CometChat.Conversation = CommonUtils.clone(
402
+ getConversationRefFromTypingIndicator(args[0])
403
+ );
404
+ if (conversation) {
405
+ let isTyping = args[1];
406
+ let newConversation = conversation;
407
+ if (isTyping && !newConversation?.["lastMessage"]?.["typing"]) {
408
+ newConversation["lastMessage"]["typing"] =
409
+ args[0]?.receiverType === "group"
410
+ ? `${args[0].sender.name} ${localize("IS_TYPING")}`
411
+ : localize("IS_TYPING");
412
+ } else {
413
+ delete newConversation["lastMessage"]["typing"];
414
+ }
415
+ conversationListRef.current!.updateList(newConversation);
436
416
  }
417
+ };
437
418
 
419
+ /**
420
+ * Checks and updates the last message in a conversation if it matches the provided message.
421
+ * @param newMessage - The new message object.
422
+ */
423
+ const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
424
+ CometChat.CometChatHelper.getConversationFromMessage(newMessage).then(
425
+ (conversation: CometChat.Conversation) => {
426
+ let conver: CometChat.Conversation = conversationListRef.current!.getListItem(
427
+ conversation.getConversationId()
428
+ );
429
+ if (!conver) return;
430
+ let lastMessageId = conver.getLastMessage().getId();
431
+ if (lastMessageId == newMessage.getId()) {
432
+ conversationListRef.current!.updateList(CommonUtils.clone(conversation));
433
+ }
434
+ }
435
+ );
436
+ };
438
437
 
439
438
  /**
440
- * Check if last message/unread count should be updated
441
- *
442
- * @param newMessage message object
439
+ * Determines whether the last message and unread count should be updated.
440
+ * @param message - The message to check.
441
+ * @returns True if an update is needed.
443
442
  */
444
- const shouldUpdateLastMessageAndUnreadCount = (
445
- message: CometChat.BaseMessage
446
- ) => {
447
- const messageReceiverType = message.getReceiverType();
448
- if (
449
- conversationsRequestBuilder &&
450
- conversationsRequestBuilder.build().getConversationType() &&
451
- conversationsRequestBuilder.build().getConversationType() !=
452
- messageReceiverType
453
- ) {
454
- return false;
455
- }
456
- /****Start: Should Threaded Messages Update Conversation? */
443
+ const shouldUpdateLastMessageAndUnreadCount = (message: CometChat.BaseMessage) => {
444
+ // Do not update for threaded messages if not enabled.
457
445
  if (
458
446
  message.getParentMessageId() &&
459
447
  !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnMessageReplies()
460
448
  ) {
461
449
  return false;
462
450
  }
463
- /****END: Should Threaded Messages Update Conversation? */
464
451
 
465
- /****Start: Should Custom Message Update Conversation? */
466
- if (
467
- message.getCategory() ==
468
- CometChatUiKitConstants.MessageCategoryConstants.custom
469
- ) {
452
+ // Do not update for custom messages if not allowed.
453
+ if (message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.custom) {
470
454
  let customMessage = message as CometChat.CustomMessage;
471
455
  if (
472
456
  !customMessage.willUpdateConversation() &&
473
457
  !(
474
458
  customMessage.getMetadata() &&
475
- (customMessage.getMetadata() as any)['incrementUnreadCount']
459
+ (customMessage.getMetadata() as any)["incrementUnreadCount"]
476
460
  ) &&
477
461
  !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCustomMessages()
478
462
  ) {
479
463
  return false;
480
464
  }
481
465
  }
482
- /****End: Should Custom Message Update Conversation? */
483
466
 
484
- /****Start: Should Group Actions sent update conversation? */
467
+ // Check for group actions.
485
468
  if (
486
- message.getCategory() ==
487
- CometChatUiKitConstants.MessageCategoryConstants.action &&
488
- message.getReceiverType() ==
489
- CometChatUiKitConstants.ReceiverTypeConstants.group
469
+ message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.action &&
470
+ message.getReceiverType() == CometChatUiKitConstants.ReceiverTypeConstants.group
490
471
  ) {
491
472
  return CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions();
492
473
  }
493
- /****End: Should Group Actions sent update conversation? */
494
474
 
495
- /****Start: Should Call Actions sent Update Conversation? */
475
+ // Check for call activities.
496
476
  if (
497
- message.getCategory() ==
498
- CometChatUiKitConstants.MessageCategoryConstants.call &&
477
+ message.getCategory() == CometChatUiKitConstants.MessageCategoryConstants.call &&
499
478
  !CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()
500
479
  ) {
501
480
  return false;
502
481
  }
503
- /****End: Should Call Actions sent Update Conversation */
504
-
505
482
  return true;
506
483
  };
507
484
 
508
- /**
509
- * Find conversation from state and udpate its last message object.
510
- * Also remove from the current location and put it to 1st location.
511
- *
512
- * @param newMessage message object
513
- */
514
- const updateLastMessage = (newMessage: CometChat.BaseMessage) => {
515
-
516
- CometChat.CometChatHelper.getConversationFromMessage(newMessage)
517
- .then((conversation: any) => {
518
- if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
519
- newMessage = InteractiveMessageUtils.convertInteractiveMessage(newMessage);
520
- }
521
- const oldConversation: CometChat.Conversation | any = conversationListRef.current?.getListItem(conversation['conversationId']);
522
- if (oldConversation == undefined) {
523
- CometChat.CometChatHelper.getConversationFromMessage(newMessage)
524
- .then((newConversation: any) => {
525
- if (newConversation?.lastMessage?.sender?.uid !== loggedInUser.current?.['uid'])
526
- newConversation.setUnreadMessageCount(1);
527
- conversationListRef.current?.updateAndMoveToFirst(newConversation);
528
- })
529
- .catch((err: any) => onError && onError(err))
530
- return;
531
- }
532
- oldConversation['lastMessage'] = newMessage;
533
- if ((newMessage as any)['sender']['uid'] != loggedInUser.current?.['uid'])
534
- oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
535
- conversationListRef.current?.updateAndMoveToFirst(oldConversation);
536
- })
537
- .catch((err: any) => {
538
- console.log("Error", err);
485
+ /**
486
+ * Updates the conversation with a new message and moves it to the top of the list.
487
+ * @param newMessage - The new message to update.
488
+ */
489
+ const updateLastMessage = (newMessage: CometChat.BaseMessage) => {
490
+ CometChat.CometChatHelper.getConversationFromMessage(newMessage)
491
+ .then((conversation) => {
492
+ if (newMessage.getCategory() === MessageCategoryConstants.interactive) {
493
+ // TODO: Show unsupported message view.
494
+ }
495
+ const oldConversation: CometChat.Conversation = conversationListRef.current!.getListItem(
496
+ conversation.getConversationId()
497
+ );
498
+ if (oldConversation == undefined) {
499
+ // If conversation not found, add it.
500
+ CometChat.CometChatHelper.getConversationFromMessage(newMessage)
501
+ .then((newConversation) => {
502
+ if (
503
+ newConversation?.getLastMessage().getSender().getUid() !==
504
+ loggedInUser.current?.getUid()
505
+ )
506
+ newConversation.setUnreadMessageCount(1);
507
+ conversationListRef.current!.addItemToList(newConversation, 0);
539
508
  })
540
- }
509
+ .catch((err) => onError && onError(err));
510
+ return;
511
+ }
512
+ // Update last message and unread count.
513
+ oldConversation.setLastMessage(newMessage);
514
+ if (newMessage.getSender().getUid() != loggedInUser.current?.getUid())
515
+ oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
516
+ conversationListRef.current!.updateAndMoveToFirst(CommonUtils.clone(oldConversation));
517
+ })
518
+ .catch((err) => {
519
+ console.log("Error", err);
520
+ });
521
+ };
541
522
 
542
- /**
543
- * play notification sound for incoming messages
544
- */
545
- const playNotificationSound = () => {
546
- // code for playing sound need to be added here.
547
- if (disableSoundForMessages) return;
548
- CometChatSoundManager.play(
549
- customSoundForMessages || CometChatSoundManager.SoundOutput.incomingMessageFromOther
550
- );
551
- }
523
+ /**
524
+ * Plays the notification sound for incoming messages.
525
+ */
526
+ const playNotificationSound = () => {
527
+ if (disableSoundForMessages) return;
528
+ CometChatSoundManager.play(
529
+ customSoundForMessages || CometChatSoundManager.SoundOutput.incomingMessageFromOther
530
+ );
531
+ };
532
+
533
+ /**
534
+ * Determines if a message should be marked as delivered.
535
+ * @param message - The message object.
536
+ * @returns True if the message does not have a "deliveredAt" property.
537
+ */
538
+ const shouldMarkAsDelivered = (message: object) => {
539
+ return !message.hasOwnProperty("deliveredAt");
540
+ };
541
+
542
+ /**
543
+ * Marks a message as delivered and plays notification sound if applicable.
544
+ * @param message - The message to mark as delivered.
545
+ */
546
+ const markMessageAsDelivered = (message: CometChat.BaseMessage) => {
547
+ if (message.hasOwnProperty("deletedAt")) return;
552
548
 
553
- const shouldMarkAsDelivered = (message: object) => {
554
- return !disableReceipt && !message.hasOwnProperty("deliveredAt");
549
+ if (shouldMarkAsDelivered(message)) {
550
+ CometChat.markAsDelivered(message);
551
+ playNotificationSound();
555
552
  }
553
+ };
556
554
 
557
- /**
558
- * marking the incoming messages as delivered
559
- */
560
- const markMessageAsDelivered = (message: object) => {
561
- if (message.hasOwnProperty('deletedAt')) return;
555
+ /**
556
+ * Updates message receipt for the conversation.
557
+ * @param receipt - The message receipt.
558
+ */
559
+ const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
560
+ const conv: CometChat.Conversation | boolean =
561
+ receipt?.getReceiverType() === ReceiverTypeConstants.user
562
+ ? (conversationListRef.current?.getListItem(
563
+ `${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
564
+ ) as unknown as CometChat.Conversation) ||
565
+ (conversationListRef.current?.getListItem(
566
+ `${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
567
+ ) as unknown as CometChat.Conversation)
568
+ : [
569
+ receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT,
570
+ receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT,
571
+ ].includes(receipt?.getReceiptType()) &&
572
+ (conversationListRef.current?.getListItem(
573
+ `group_${receipt?.getReceiver()}`
574
+ ) as unknown as CometChat.Conversation);
562
575
 
563
- if (shouldMarkAsDelivered(message)) {
564
- CometChat.markAsDelivered(message);
565
- playNotificationSound();
566
- }
576
+ if (
577
+ conv &&
578
+ conv.getConversationType() == ConversationTypeConstants.group &&
579
+ conv.getLastMessage().getSender().getUid() !== loggedInUser.current!.getUid()
580
+ ) {
581
+ return;
567
582
  }
568
583
 
569
- const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
570
- const conv: CometChat.Conversation | boolean =
571
- receipt?.getReceiverType() === ReceiverTypeConstants.user
572
- ? conversationListRef.current?.getListItem(
573
- `${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
574
- ) as unknown as CometChat.Conversation ||
575
- conversationListRef.current?.getListItem(
576
- `${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
577
- ) as unknown as CometChat.Conversation
578
- : [receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT, receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT].includes(receipt?.getReceiptType()) &&
579
- conversationListRef.current?.getListItem(
580
- `group_${receipt?.getReceiver()}`
581
- ) as unknown as CometChat.Conversation;
582
-
583
- if (
584
- conv &&
585
- conv.getConversationType() == ConversationTypeConstants.group &&
586
- conv.getLastMessage().getSender().getUid() !== loggedInUser.current.getUid()
587
- ) {
588
- return;
584
+ if (
585
+ conv &&
586
+ conv?.getLastMessage &&
587
+ (conv.getLastMessage().id == receipt.getMessageId() ||
588
+ conv.getLastMessage().messageId == receipt.getMessageId())
589
+ ) {
590
+ let newConversation = CommonUtils.clone(conv);
591
+ if (receipt.getReadAt()) {
592
+ newConversation.getLastMessage().setReadAt(receipt.getReadAt());
589
593
  }
590
-
591
- if (
592
- conv &&
593
- conv?.getLastMessage &&
594
- (conv.getLastMessage().id == receipt.getMessageId() ||
595
- conv.getLastMessage().messageId == receipt.getMessageId())
596
- ) {
597
- let newConversation = CommonUtils.clone(conv);
598
- if (receipt.getReadAt()) {
599
- newConversation.getLastMessage().setReadAt(receipt.getReadAt());
600
- }
601
- if (receipt.getDeliveredAt()) {
602
- newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
603
- }
604
- conversationListRef.current?.updateList(newConversation);
594
+ if (receipt.getDeliveredAt()) {
595
+ newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
605
596
  }
606
- };
607
-
608
-
609
- /**
610
- *
611
- * When a text message / media message / custom message is received
612
- */
613
- const messageEventHandler = (...args: any[]) => {
614
- let message = args[0];
615
- !disableReceipt && markMessageAsDelivered(message);
616
- updateLastMessage(message);
597
+ conversationListRef.current?.updateList(newConversation);
617
598
  }
599
+ };
618
600
 
619
- /**
620
- * callback handler for group Add / Kicked / Banned / Scope Change
621
- * @param {obj} message
622
- */
623
- const groupHandler = (message: any, otherDetails: {action?: string, actionOn?: CometChat.User, actionBy?: CometChat.User, group?: CometChat.Group} = {}) => {
624
- if (
625
- conversationsRequestBuilder &&
626
- conversationsRequestBuilder.build().getConversationType() &&
627
- conversationsRequestBuilder.build().getConversationType() !=
628
- CometChatUiKitConstants.ReceiverTypeConstants.group
629
- ) {
630
- return;
631
- }
632
- let conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
633
- let {action, actionOn, actionBy, group} = otherDetails;
634
- if (conversation) {
635
- if ((action && ["kicked", "banned", "left"].includes(action)) && (actionOn?.getUid() == loggedInUser.current?.getUid())){
636
- conversationListRef.current?.removeItemFromList(message.conversationId);
637
- return;
638
- } else {
639
- if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
640
- return;
641
- }
642
- conversation.setLastMessage(message);
643
- conversationListRef.current?.updateAndMoveToFirst(conversation);
644
- }
645
- } else {
646
- CometChat.CometChatHelper.getConversationFromMessage(message)
647
- .then((newConversation: any) => {
648
- const conversation : CometChat.Conversation = (conversationListRef.current?.getListItem(message['conversationId']) as unknown as CometChat.Conversation);
649
- if (conversation) {
650
- groupHandler(message);
651
- } else {
652
- conversationListRef.current?.addItemToList(newConversation, 0);
653
- }
654
- });
655
- }
656
- }
601
+ /**
602
+ * Handler for when a message (text/media/custom) is received.
603
+ * Marks the message as delivered and updates the conversation.
604
+ * @param args - Contains the new message.
605
+ */
606
+ const messageEventHandler = (...args: any) => {
607
+ let message = args[0];
608
+ markMessageAsDelivered(message);
609
+ updateLastMessage(message);
610
+ };
657
611
 
658
- const conversationClicked = (conversation: any) => {
659
- if (onItemPress) {
660
- onItemPress(conversation);
661
- return;
612
+ /**
613
+ * Handler for various group actions such as member kicked, banned, left, or scope change.
614
+ * @param message - The action message.
615
+ * @param otherDetails - Additional details about the action.
616
+ */
617
+ const groupHandler = (
618
+ message: CometChat.Action,
619
+ otherDetails: {
620
+ action?: string;
621
+ actionOn?: CometChat.User;
622
+ actionBy?: CometChat.User;
623
+ group?: CometChat.Group;
624
+ newScope?: CometChat.GroupMemberScope;
625
+ oldScope?: CometChat.GroupMemberScope;
626
+ } = {}
627
+ ) => {
628
+ let conversation: CometChat.Conversation = conversationListRef.current!.getListItem(
629
+ message.getConversationId()
630
+ ) as unknown as CometChat.Conversation;
631
+ let { action, actionOn, actionBy, group, newScope, oldScope } = otherDetails;
632
+ if (conversation) {
633
+ if (action == "scopeChange" && actionOn?.getUid() !== loggedInUser.current!.getUid()) {
634
+ oldScope = undefined;
635
+ newScope = undefined;
636
+ }
637
+ const oldScopeLocal: any =
638
+ oldScope ?? (conversation.getConversationWith() as CometChat.Group).getScope();
639
+ if (
640
+ action &&
641
+ ["kicked", "banned", "left"].includes(action) &&
642
+ actionOn &&
643
+ actionOn.getUid() == loggedInUser.current!.getUid()
644
+ ) {
645
+ conversationListRef.current!.removeItemFromList(message.getConversationId());
646
+ return;
647
+ } else {
648
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
649
+ return;
662
650
  }
663
- if (!selecting) {
664
- //fire event
665
- return;
651
+ conversation.setLastMessage(message);
652
+ if (group) {
653
+ !group.getScope() && group.setScope(newScope ?? oldScopeLocal);
654
+ conversation.setConversationWith(group);
666
655
  }
667
-
668
- if (selectionMode == "none") return;
669
-
670
- let index = selectedConversation.findIndex((tmpConver: any) => tmpConver.conversationWith.conversationId == conversation.conversationWith.conversationId);
671
- if (index < 0) {
672
- if (selectionMode == "single")
673
- setSelectedConversations([conversation])
674
-
675
- if (selectionMode == "multiple")
676
- setSelectedConversations([...selectedConversation, conversation]);
656
+ conversationListRef.current!.updateList(conversation);
657
+ }
658
+ } else {
659
+ CometChat.CometChatHelper.getConversationFromMessage(message).then((newConversation) => {
660
+ const conversation: CometChat.Conversation = conversationListRef.current!.getListItem(
661
+ message.getConversationId()
662
+ ) as unknown as CometChat.Conversation;
663
+ if (conversation) {
664
+ groupHandler(message);
677
665
  } else {
678
- selectedConversation.splice(index, 1);
679
- setSelectedConversations([...selectedConversation]);
666
+ conversationListRef.current!.addItemToList(newConversation, 0);
680
667
  }
668
+ });
681
669
  }
670
+ };
682
671
 
683
- const conversationLongPressed = (conversation: any) => {
684
- if (onItemLongPress) {
685
- onItemLongPress(conversation);
686
- return;
687
- }
672
+ /**
673
+ * Handles the conversation click event.
674
+ * If an onItemPress callback is provided, it is invoked.
675
+ * Else, toggles selection of the conversation.
676
+ * @param conversation - The conversation object that was clicked.
677
+ */
678
+ const conversationClicked = (conversation: CometChat.Conversation) => {
679
+ if (onItemPress) {
680
+ onItemPress(conversation);
681
+ return;
682
+ }
683
+ if (!selecting) {
684
+ // Fire event if not selecting.
685
+ return;
686
+ }
688
687
 
689
- if (selectionMode == "none") return;
688
+ if (selectionMode == "none") return;
690
689
 
691
- setSelecting(true);
692
- setSelectedConversations([...selectedConversation, conversation]);
693
- }
690
+ let index = selectedConversation.findIndex(
691
+ (tmpConver: CometChat.Conversation) =>
692
+ tmpConver.getConversationId() == conversation.getConversationId()
693
+ );
694
+ if (index < 0) {
695
+ if (selectionMode == "single") setSelectedConversations([conversation]);
694
696
 
695
- const removeItemFromSelectionList = (id: any) => {
696
- if (selecting) {
697
- let index = selectedConversation.find(member => member['uid'] == id);
698
- if (index > -1) {
699
- let tmpSelectedConversations = [...selectedConversation];
700
- tmpSelectedConversations.splice(index, 1);
701
- setSelectedConversations(tmpSelectedConversations);
702
- }
703
- }
697
+ if (selectionMode == "multiple")
698
+ setSelectedConversations([...selectedConversation, conversation]);
699
+ } else {
700
+ selectedConversation.splice(index, 1);
701
+ setSelectedConversations([...selectedConversation]);
704
702
  }
703
+ };
705
704
 
706
- const removeConversation = (id: string | number) => {
707
- let conversation: any = conversationListRef.current?.getListItem(id);
708
- const { conversationWith, conversationType } = conversation;
709
- let conversationWithId = conversationType == "group" ? conversationWith.guid : conversationWith.uid;
710
- CometChat.deleteConversation(conversationWithId, conversationType)
711
- .then((success: any) => {
712
- conversationListRef.current?.removeItemFromList(id);
713
- removeItemFromSelectionList(id);
714
- })
715
- .catch((err: any) => console.log(err))
705
+ /**
706
+ * Removes a conversation from the selection list.
707
+ * @param id - The conversation ID.
708
+ */
709
+ const removeItemFromSelectionList = (id: any) => {
710
+ if (selecting) {
711
+ let index = selectedConversation.findIndex((member) => member.getConversationId() == id);
712
+ if (index > -1) {
713
+ let tmpSelectedConversations = [...selectedConversation];
714
+ tmpSelectedConversations.splice(index, 1);
715
+ setSelectedConversations(tmpSelectedConversations);
716
+ }
716
717
  }
718
+ };
717
719
 
718
- const getMessagePreview = (conversations: CometChat.Conversation, uid: any) => {
720
+ /**
721
+ * Removes a conversation from the list by calling the delete API and then updating the UI.
722
+ * @param id - The conversation ID to remove.
723
+ */
724
+ const removeConversation = (id: string) => {
725
+ let conversation = conversationListRef.current!.getListItem(id);
726
+ const { conversationWith, conversationType } = conversation;
727
+ let conversationWithId =
728
+ conversationType == "group" ? conversationWith.guid : conversationWith.uid;
729
+ CometChat.deleteConversation(conversationWithId, conversationType)
730
+ .then((success) => {
731
+ CometChatUIEventHandler.emitConversationEvent(
732
+ CometChatConversationEvents.ccConversationDeleted,
733
+ { conversation: conversation }
734
+ );
735
+ conversationListRef.current!.removeItemFromList(id);
736
+ removeItemFromSelectionList(id);
737
+ })
738
+ .catch((err) => console.log(err));
739
+ };
719
740
 
720
- let lastMessage: CometChat.BaseMessage = conversations?.getLastMessage && conversations.getLastMessage();
721
- if (!lastMessage) return null;
722
- let messageText: string;
723
- if (lastMessage.getDeletedAt() !== undefined) {
724
- messageText = localize("THIS_MESSAGE_DELETED");
725
- } else {
726
- messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations);
741
+ /**
742
+ * Returns a formatted preview for the last message in a conversation.
743
+ * @param conversations - The conversation object.
744
+ * @param theme - The theme object.
745
+ * @returns A JSX.Element containing the preview.
746
+ */
747
+ const getMessagePreview = (conversations: CometChat.Conversation, theme?: CometChatTheme) => {
748
+ const loggedInUserId = CometChatUIKit.loggedInUser!.getUid();
749
+ let lastMessage: CometChat.BaseMessage =
750
+ conversations?.getLastMessage && conversations.getLastMessage();
751
+ if (!lastMessage) return null;
752
+ let messageText: string | JSX.Element = "";
753
+ messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
727
754
 
728
- if (lastMessage) {
729
- messageText = getFormattedText(lastMessage, messageText?.trim());
730
- }
731
- }
732
- let groupText = "";
733
- if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
734
- if (lastMessage.getSender().getUid() == uid) {
735
- groupText = localize("YOU") + ": "
736
- } else {
737
- groupText = (lastMessage.getSender()?.getName() || "").trim() + ": ";
738
- }
739
- }
755
+ if (lastMessage && typeof messageText === "string") {
756
+ messageText = getFormattedText(lastMessage, messageText?.trim());
740
757
 
741
- return (
742
- <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
743
- color: theme.palette.getAccent600(), fontSize: theme.typography.subtitle1.fontSize,
744
- fontWeight: theme.typography.subtitle1.fontWeight
745
- }] as TextStyle[]}>
746
- {groupText}{messageText}
747
- </Text>
748
- )
758
+ if (
759
+ lastMessage instanceof CometChat.TextMessage &&
760
+ lastMessage.getCategory() === "message" &&
761
+ lastMessage
762
+ .getText()
763
+ .substr(0, 50)
764
+ .match(/http[s]{0,1}:\/\//)
765
+ ) {
766
+ messageText = getMessagePreviewInternal("link-fill", localize("LINK"), { theme });
767
+ } else {
768
+ // Ensure ellipsis is applied if the text is too long.
769
+ messageText = (
770
+ <Text
771
+ style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 2 }]}
772
+ numberOfLines={1}
773
+ ellipsizeMode='tail'
774
+ >
775
+ {messageText}
776
+ </Text>
777
+ );
778
+ }
749
779
  }
750
780
 
751
- function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
752
- let messageTextTmp = subtitle;
753
- let allFormatters = [...(textFormatters ?? [])];
754
-
755
- if (!disableMentions && message.getMentionedUsers().length) {
756
- let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
757
- CometChatUIKit.loggedInUser && mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser);
758
- mentionsFormatter.setMentionsStyle(
759
- new MentionTextStyle({
760
- loggedInUserTextStyle: {
761
- color: theme.palette.getPrimary(),
762
- ...theme.typography.title2,
763
- } as TextStyle,
764
- textStyle: {
765
- color: theme.palette.getPrimary(),
766
- ...theme.typography.subtitle1,
767
- } as TextStyle
768
- })
769
- );
770
-
771
- mentionsFormatter.setMessage(message);
772
- allFormatters.push(mentionsFormatter);
781
+ let groupText = "";
782
+ if (!(lastMessage instanceof CometChat.Action)) {
783
+ if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
784
+ if (lastMessage.getSender().getUid() == loggedInUserId) {
785
+ groupText = localize("YOU") + ": ";
786
+ } else {
787
+ groupText = lastMessage.getSender().getName() + ": ";
773
788
  }
789
+ }
790
+ }
774
791
 
775
- if (allFormatters && allFormatters.length) {
776
- for (let i = 0; i < allFormatters.length; i++) {
777
- let suggestionUsers = allFormatters[i].getSuggestionItems();
778
- allFormatters[i].setMessage(message);
779
- suggestionUsers.length > 0 && allFormatters[i].setSuggestionItems(suggestionUsers);
780
- let _formatter = CommonUtils.clone(allFormatters[i]);
781
- (messageTextTmp as string | JSX.Element) = _formatter.getFormattedText(messageTextTmp);
782
- }
783
- }
792
+ return (
793
+ <>
794
+ {groupText && (
795
+ <Text
796
+ style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 1 }]}
797
+ numberOfLines={1}
798
+ ellipsizeMode='middle'
799
+ >
800
+ {groupText}
801
+ </Text>
802
+ )}
803
+ {messageText}
804
+ </>
805
+ );
806
+ };
784
807
 
785
- return messageTextTmp;
808
+ /**
809
+ * Applies text formatters to the message text.
810
+ * @param message - The message object.
811
+ * @param subtitle - The raw text to format.
812
+ * @returns The formatted text.
813
+ */
814
+ function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
815
+ let messageTextTmp: string | JSX.Element = subtitle;
816
+ let allFormatters = [...(textFormatters || [])];
817
+
818
+ if (message.getMentionedUsers().length) {
819
+ let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
820
+ mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
821
+ mentionsFormatter.setMentionsStyle(mergedStyles.mentionsStyles);
822
+ mentionsFormatter.setTargetElement(MentionsTargetElement.conversation);
823
+
824
+ mentionsFormatter.setMessage(message);
825
+ allFormatters.push(mentionsFormatter);
786
826
  }
787
827
 
788
- const LastMessageView = (params: {
789
- conversations: CometChat.Conversation,
790
- typingText: string
791
- }) => {
792
- const lastMessage = params['conversations']['lastMessage'];
793
- if (!lastMessage) return null;
794
- let readReceipt;
795
- if (params.typingText) {
796
- return <View style={Style.row}>
797
- <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, {
798
- color: theme.palette.getPrimary(),
799
- fontSize: theme.typography.subtitle1.fontSize, fontWeight: theme.typography.subtitle1.fontWeight
800
- }] as TextStyle[]} >{params.typingText}</Text>
801
- </View>
802
- }
828
+ if (
829
+ message instanceof CometChat.TextMessage &&
830
+ message.getCategory() === "message" &&
831
+ message
832
+ .getText()
833
+ .substr(0, 50)
834
+ .match(/http[s]{0,1}:\/\//)
835
+ ) {
836
+ // For link messages, simply return the text.
837
+ return messageTextTmp;
838
+ }
803
839
 
804
- if (lastMessage && lastMessage['sender']['uid'] == loggedInUser.current?.uid && !lastMessage.getDeletedAt()) {
805
- let status: MessageReceipt = "ERROR";
806
- if (lastMessage?.hasOwnProperty('readAt'))
807
- status = "READ";
808
- else if (lastMessage?.hasOwnProperty("deliveredAt"))
809
- status = "DELIVERED";
810
- else if (lastMessage?.hasOwnProperty("sentAt"))
811
- status = "SENT";
812
- readReceipt = (disableReceipt || hideReceipt) ? null : <CometChatReceipt
813
- receipt={status}
814
- deliveredIcon={props.deliveredIcon}
815
- errorIcon={props.errorIcon}
816
- readIcon={props.readIcon}
817
- sentIcon={props.sentIcon}
818
- waitIcon={props.waitingIcon}
819
- style={_receiptStyle}
820
- />;
821
- }
840
+ if (allFormatters && allFormatters.length) {
841
+ for (let i = 0; i < allFormatters.length; i++) {
842
+ let suggestionUsers = allFormatters[i].getSuggestionItems();
843
+ allFormatters[i].setMessage(message);
844
+ suggestionUsers.length > 0 && allFormatters[i].setSuggestionItems(suggestionUsers);
845
+ let _formatter = CommonUtils.clone(allFormatters[i]);
846
+ messageTextTmp = _formatter.getFormattedText(
847
+ messageTextTmp,
848
+ mergedStyles.itemStyle.subtitleStyle
849
+ );
850
+ }
851
+ }
822
852
 
823
- let threadView;
853
+ return messageTextTmp;
854
+ }
824
855
 
825
- if (lastMessage?.getParentMessageId()) {
826
- threadView = <Text numberOfLines={1} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600() }]} >{localize("IN_A_THREAD")}</Text>
827
- }
856
+ /**
857
+ * Component to render the last message view for a conversation item.
858
+ * @param params - Contains conversation and typing indicator text.
859
+ * @returns A JSX.Element rendering the last message.
860
+ */
861
+ const LastMessageView = (params: {
862
+ conversations: CometChat.Conversation;
863
+ typingText: string;
864
+ }) => {
865
+ const lastMessage = params.conversations.getLastMessage();
866
+ if (!lastMessage)
867
+ return (
868
+ <Text
869
+ style={[mergedStyles.itemStyle.subtitleStyle]}
870
+ numberOfLines={1}
871
+ ellipsizeMode={"tail"}
872
+ >
873
+ {localize("TAP_TO_START_CONVERSATION")}
874
+ </Text>
875
+ );
876
+ let readReceipt;
877
+ if (params.typingText) {
878
+ return (
879
+ <View style={Style.row}>
880
+ <Text
881
+ numberOfLines={1}
882
+ ellipsizeMode={"tail"}
883
+ style={[mergedStyles.typingIndicatorStyle]}
884
+ >
885
+ {params.typingText}
886
+ </Text>
887
+ </View>
888
+ );
889
+ }
828
890
 
829
- return (
830
- <View style={Style.column}>
831
- {threadView}
832
- <View style={Style.row}>
833
- {readReceipt}
834
- {getMessagePreview(params['conversations'], loggedInUser.current?.uid)}
835
- </View>
836
- </View>
891
+ if (
892
+ lastMessage &&
893
+ lastMessage.getSender().getUid() == loggedInUser.current!.getUid() &&
894
+ !lastMessage.getDeletedAt()
895
+ ) {
896
+ let status: MessageReceipt = MessageReceipt.ERROR;
897
+ if (lastMessage?.hasOwnProperty("readAt")) status = MessageReceipt.READ;
898
+ else if (lastMessage?.hasOwnProperty("deliveredAt")) status = MessageReceipt.DELIVERED;
899
+ else if (lastMessage?.hasOwnProperty("sentAt")) status = MessageReceipt.SENT;
900
+ readReceipt = !receiptsVisibility ? null : (
901
+ <CometChatReceipt receipt={status} style={mergedStyles.itemStyle.receiptStyles} />
902
+ );
903
+ }
837
904
 
838
- )
905
+ let threadView: JSX.Element | null = null;
906
+
907
+ if (lastMessage?.getParentMessageId()) {
908
+ threadView = (
909
+ <>
910
+ <Icon
911
+ name='subdirectory-arrow-right-fill'
912
+ size={theme.spacing.spacing.s4}
913
+ color={mergedStyles.itemStyle.subtitleStyle.color}
914
+ />
915
+ {/* Optional: Add text for thread indicator */}
916
+ </>
917
+ );
839
918
  }
840
919
 
841
- const TailView = (params: {
842
- timestamp: number,
843
- unreadCount: number,
844
- customPattern: Function,
845
- }) => {
846
- return <View style={{ alignItems: "flex-end" }}>
847
- <CometChatDate
848
- timeStamp={(params.timestamp) * 1000}
849
- style={_dateStyle}
850
- customDateString={params.customPattern && params.customPattern()}
851
- pattern={"dayDateTimeFormat"}
852
- />
853
- <CometChatBadge
854
- count={params.unreadCount}
855
- style={_badgeStyle}
856
- />
920
+ return (
921
+ <View style={[Style.row, { gap: 2, alignItems: "center" }]}>
922
+ {threadView}
923
+ <View style={[Style.row, { gap: 2, alignItems: "center" }]}>
924
+ {!["call", "action"].includes(params["conversations"].getLastMessage().getCategory())
925
+ ? readReceipt
926
+ : null}
927
+ {getMessagePreview(params["conversations"], theme)}
857
928
  </View>
858
- }
929
+ </View>
930
+ );
931
+ };
859
932
 
860
- const ConfirmDeletionDialog = () => {
861
-
862
- if (confirmDelete == undefined) return null;
863
-
864
- return <CometChatConfirmDialog
865
- title={localize("CONFIRM")}
866
- cancelButtonText={localize("CANCEL")}
867
- confirmButtonText={localize("DELETE")}
868
- messageText={localize("DELETE_CONFIRM_MESSAGE")}
869
- isOpen={true}
870
- onCancel={() => setConfirmDelete(undefined)}
871
- onConfirm={() => {
872
- {
873
- removeConversation(confirmDelete);
874
- setConfirmDelete(undefined);
875
- }
876
- }}
877
- style={_confirmDialogStyle}
878
- />
879
- }
933
+ /**
934
+ * Returns the trailing view (date and badge) for a conversation item.
935
+ * @param conversation - The conversation object.
936
+ * @returns A JSX.Element for the trailing view.
937
+ */
938
+ const getTrailingView = useCallback(
939
+ (conversation: CometChat.Conversation) => {
940
+ const customPattern = () => datePattern?.(conversation);
941
+ const timestamp = conversation.getLastMessage()?.getSentAt();
942
+ if (!timestamp) return <></>;
943
+ return (
944
+ <View
945
+ style={[
946
+ { marginHorizontal: 6, justifyContent: "center", alignItems: "flex-end" },
947
+ mergedStyles.itemStyle.trailingViewContainerStyle,
948
+ ]}
949
+ >
950
+ <CometChatDate
951
+ timeStamp={timestamp * 1000}
952
+ customDateString={customPattern && customPattern()}
953
+ pattern={"dayWeekDayDateTimeFormat"}
954
+ style={mergedStyles?.itemStyle?.dateStyle}
955
+ />
956
+ <CometChatBadge
957
+ count={conversation.getUnreadMessageCount()}
958
+ style={mergedStyles?.itemStyle?.badgeStyle}
959
+ />
960
+ </View>
961
+ );
962
+ },
963
+ [mergedStyles, datePattern]
964
+ );
880
965
 
881
- const getDefaultOptions = (conversation: any) => {
882
- let _defaultOptions = CometChatConversationUtils.getDefaultOptions();
883
- _defaultOptions[0].backgroundColor = theme?.palette.getError();
884
- _defaultOptions[0].icon = deleteIcon;
885
- _defaultOptions[0].title = localize("DELETE");
886
- _defaultOptions[0].titleStyle = { fontSize: 14, color: theme?.palette.getSecondary() };
887
- _defaultOptions[0].iconTint = theme?.palette.getSecondary();
888
- _defaultOptions[0].onPress = (id: any) => {
889
- setConfirmDelete(id);
890
- };
891
- return _defaultOptions
966
+ /**
967
+ * Updates the conversation's last message for a group conversation.
968
+ * @param message - The new message.
969
+ * @param group - The group the conversation belongs to.
970
+ */
971
+ const updateConversationLastMessage = (
972
+ message: CometChat.BaseMessage,
973
+ group: CometChat.Group
974
+ ) => {
975
+ try {
976
+ let conversation: CometChat.Conversation = conversationListRef.current?.getListItem(
977
+ message.getConversationId()
978
+ );
979
+ if (conversation) {
980
+ conversation = CommonUtils.clone(conversation);
981
+ conversation.setLastMessage(message);
982
+ conversation.setConversationWith(group);
983
+ conversationListRef.current?.updateAndMoveToFirst(conversation);
984
+ } else {
985
+ CometChat.CometChatHelper.getConversationFromMessage(message)
986
+ .then((newConversation) => {
987
+ if (
988
+ newConversation?.getLastMessage().getSender().getUid() !==
989
+ loggedInUser.current?.getUid()
990
+ )
991
+ newConversation.setUnreadMessageCount(1);
992
+ conversationListRef.current!.addItemToList(newConversation, 0);
993
+ })
994
+ .catch((err) => onError && onError(err));
995
+ }
996
+ } catch (error: any) {
997
+ onError && onError(error);
892
998
  }
999
+ };
893
1000
 
894
- const updateConversationLastMessage = (message: any) => {
895
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnGroupActions()) {
896
- return;
897
- }
898
- try {
899
- let conversation: CometChat.Conversation | any = conversationListRef.current?.getListItem(message.conversationId)
900
- conversation.lastMessage = message
901
- conversationListRef.current?.updateAndMoveToFirst(conversation);
902
- } catch (error: any) {
903
- onError && onError(error)
904
- }
1001
+ /**
1002
+ * Increments the unread message count for a conversation.
1003
+ * @param conversation - The conversation to update.
1004
+ * @returns The updated conversation.
1005
+ */
1006
+ const updateUnreadMessageCount = (conversation: CometChat.Conversation) => {
1007
+ const oldConversation: CometChat.Conversation = conversationListRef.current!.getListItem(
1008
+ conversation["conversationId"]
1009
+ ) as unknown as CometChat.Conversation;
1010
+ if (oldConversation == undefined) {
1011
+ conversation.setUnreadMessageCount(1);
1012
+ return conversation;
905
1013
  }
1014
+ oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
1015
+ return oldConversation;
1016
+ };
906
1017
 
907
- const updateUnreadMessageCount = (conversation: CometChat.Conversation) => {
908
- const oldConversation: CometChat.Conversation = (conversationListRef.current?.getListItem(conversation['conversationId']) as unknown as CometChat.Conversation);
909
- if (oldConversation == undefined) {
910
- conversation.setUnreadMessageCount(1);
911
- return conversation;
912
- }
913
- oldConversation.setUnreadMessageCount(oldConversation.getUnreadMessageCount() + 1);
914
- return oldConversation;
915
- }
1018
+ // Set up event listeners for user, call, group and message events.
1019
+ React.useEffect(() => {
1020
+ // Get logged in user.
1021
+ CometChat.getLoggedinUser()
1022
+ .then((u) => {
1023
+ loggedInUser.current = u!;
1024
+ })
1025
+ .catch((err) => console.log(err));
1026
+
1027
+ // Listen for user online/offline changes.
1028
+ CometChat.addUserListener(
1029
+ userListenerId,
1030
+ new CometChat.UserListener({
1031
+ onUserOnline: (onlineUser: any) => {
1032
+ userEventHandler(onlineUser);
1033
+ },
1034
+ onUserOffline: (offlineUser: any) => {
1035
+ userEventHandler(offlineUser);
1036
+ },
1037
+ })
1038
+ );
916
1039
 
917
- React.useEffect(() => {
918
- CometChat.getLoggedinUser()
919
- .then((u: any) => { loggedInUser.current = u })
920
- .catch((err: any) => console.log(err));
921
-
922
- CometChat.addUserListener(
923
- userListenerId,
924
- new CometChat.UserListener({
925
- onUserOnline: (onlineUser: any) => {
926
- console.log(onlineUser);
927
- userEventHandler(onlineUser);
928
- },
929
- onUserOffline: (offlineUser: any) => {
930
- console.log(offlineUser);
931
- userEventHandler(offlineUser);
932
- },
1040
+ // Listen for call events.
1041
+ CometChat.addCallListener(
1042
+ callListenerId,
1043
+ new CometChat.CallListener({
1044
+ onIncomingCallReceived: (call: CometChat.Call) => {
1045
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1046
+ .then((conversation) => {
1047
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1048
+ return;
1049
+ }
1050
+ conversation = updateUnreadMessageCount(conversation);
1051
+ conversation.setLastMessage(call);
1052
+ conversationListRef.current!.updateList(conversation);
933
1053
  })
934
- );
935
-
936
- CometChat.addCallListener(
937
- callListenerId,
938
- new CometChat.CallListener({
939
- onIncomingCallReceived: (call: any) => {
940
- CometChat.CometChatHelper.getConversationFromMessage(call)
941
- .then((conversation: any) => {
942
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
943
- return;
944
- }
945
- conversation = updateUnreadMessageCount(conversation);
946
- conversation.setLastMessage(call);
947
- conversationListRef.current?.updateList(conversation);
948
- })
949
- .catch((e: any) => {
950
- onError && onError(e);
951
- })
952
- },
953
- onOutgoingCallAccepted: (call: any) => {
954
- CometChat.CometChatHelper.getConversationFromMessage(call)
955
- .then((conversation: any) => {
956
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
957
- return;
958
- }
959
- conversation = updateUnreadMessageCount(conversation);
960
- conversation.setLastMessage(call);
961
- conversationListRef.current?.updateList(conversation);
962
- })
963
- .catch((e: any) => {
964
- onError && onError(e);
965
- })
966
- },
967
- onOutgoingCallRejected: (call: any) => {
968
- CometChat.CometChatHelper.getConversationFromMessage(call)
969
- .then((conversation: any) => {
970
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
971
- return;
972
- }
973
- conversation = updateUnreadMessageCount(conversation);
974
- conversation.setLastMessage(call);
975
- conversationListRef.current?.updateList(conversation);
976
- })
977
- .catch((e: any) => {
978
- onError && onError(e);
979
- })
980
- },
981
- onIncomingCallCancelled: (call: any) => {
982
- CometChat.CometChatHelper.getConversationFromMessage(call)
983
- .then((conversation: any) => {
984
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
985
- return;
986
- }
987
- conversation = updateUnreadMessageCount(conversation);
988
- conversation.setLastMessage(call);
989
- conversationListRef.current?.updateList(conversation);
990
- })
991
- .catch((e: any) => {
992
- onError && onError(e);
993
- })
994
- }
1054
+ .catch((e) => {
1055
+ onError && onError(e);
1056
+ });
1057
+ },
1058
+ onOutgoingCallAccepted: (call: any) => {
1059
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1060
+ .then((conversation) => {
1061
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1062
+ return;
1063
+ }
1064
+ conversation = updateUnreadMessageCount(conversation);
1065
+ conversation.setLastMessage(call);
1066
+ conversationListRef.current!.updateList(conversation);
995
1067
  })
996
- );
997
-
998
- CometChat.addGroupListener(
999
- groupListenerId,
1000
- new CometChat.GroupListener({
1001
- onGroupMemberScopeChanged: (message: any) => {
1002
- groupHandler(
1003
- message
1004
- );
1005
- },
1006
- onGroupMemberKicked: (
1007
- message: CometChat.Action,
1008
- kickedUser: CometChat.User,
1009
- kickedBy: CometChat.User,
1010
- kickedFrom: CometChat.Group) => {
1011
- groupHandler(
1012
- message,
1013
- { action: 'kicked', actionOn: kickedUser, actionBy: kickedBy, group: kickedFrom }
1014
- );
1015
- },
1016
- onGroupMemberLeft: (message: CometChat.Action, leavingUser: CometChat.User, group: CometChat.Group) => {
1017
- groupHandler(message,
1018
- { action: 'left', actionOn: leavingUser, group }
1019
- );
1020
- },
1021
- onGroupMemberUnbanned: (message: any) => {
1022
- groupHandler(message);
1023
- },
1024
- onGroupMemberBanned: (
1025
- message: CometChat.Action,
1026
- bannedUser: CometChat.User,
1027
- bannedBy: CometChat.User,
1028
- bannedFrom: CometChat.Group) => {
1029
- groupHandler(
1030
- message,
1031
- { action: 'banned', actionOn: bannedUser, actionBy: bannedBy, group: bannedFrom }
1032
- );
1033
- },
1034
- onMemberAddedToGroup: (
1035
- message: CometChat.Action,
1036
- userAdded: CometChat.User,
1037
- userAddedBy: CometChat.User,
1038
- userAddedIn: CometChat.Group) => {
1039
- if (onMemberAddedToGroupDebounceTimer.current) {
1040
- clearTimeout(onMemberAddedToGroupDebounceTimer.current);
1041
- }
1042
- onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
1043
- groupHandler(
1044
- message,
1045
- { action: 'joined', actionOn: userAdded, actionBy: userAddedBy, group: userAddedIn }
1046
- );
1047
- }, 50)
1048
- },
1049
- onGroupMemberJoined: (message: any) => {
1050
- groupHandler(
1051
- message
1052
- );
1053
- }
1068
+ .catch((e) => {
1069
+ onError && onError(e);
1070
+ });
1071
+ },
1072
+ onOutgoingCallRejected: (call: any) => {
1073
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1074
+ .then((conversation) => {
1075
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1076
+ return;
1077
+ }
1078
+ conversation = updateUnreadMessageCount(conversation);
1079
+ conversation.setLastMessage(call);
1080
+ conversationListRef.current!.updateList(conversation);
1054
1081
  })
1055
- );
1082
+ .catch((e) => {
1083
+ onError && onError(e);
1084
+ });
1085
+ },
1086
+ onIncomingCallCancelled: (call: any) => {
1087
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1088
+ .then((conversation) => {
1089
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1090
+ return;
1091
+ }
1092
+ conversation = updateUnreadMessageCount(conversation);
1093
+ conversation.setLastMessage(call);
1094
+ conversationListRef.current!.updateList(conversation);
1095
+ })
1096
+ .catch((e) => {
1097
+ onError && onError(e);
1098
+ });
1099
+ },
1100
+ })
1101
+ );
1056
1102
 
1057
- CometChatUIEventHandler.addConversationListener(
1058
- conversationListenerId,
1059
- {
1060
- ccConversationDeleted:
1061
- ({ conversation }: { conversation: CometChat.Conversation | any }) => {
1062
- conversationListRef.current?.removeItemFromList(conversation.getConversationId());
1063
- removeItemFromSelectionList(conversation.getConversationId())
1064
- }
1065
- }
1066
- );
1067
- CometChatUIEventHandler.addMessageListener(
1068
- messageListenerId,
1069
- {
1070
- ccMessageSent: ({ message, status }: any) => {
1071
- if (status == MessageStatusConstants.success) {
1072
- if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1073
- return;
1074
- }
1075
- updateLastMessage(message);
1076
- }
1077
- },
1078
- ccMessageRead: ({ message }: any) => {
1079
- checkAndUpdateLastMessage(message, true)
1080
- },
1081
- ccMessageDeleted: ({ message }: any) => {
1082
- checkAndUpdateLastMessage(message, true)
1083
- },
1084
- ccMessageEdited: ({ message }: any) => {
1085
- checkAndUpdateLastMessage(message, true)
1086
- },
1087
- onTextMessageReceived: (textMessage: any) => {
1088
- if(!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
1089
- return;
1090
- }
1091
- messageEventHandler(textMessage);
1092
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1093
- },
1094
- onMediaMessageReceived: (mediaMessage: any) => {
1095
- if(!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
1096
- return;
1097
- }
1098
- messageEventHandler(mediaMessage);
1099
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1100
- },
1101
- onCustomMessageReceived: (customMessage: any) => {
1102
- if(!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
1103
- return;
1104
- }
1105
- messageEventHandler(customMessage);
1106
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1107
- },
1108
- onMessageDeleted: (deletedMessage: any) => {
1109
- checkAndUpdateLastMessage(deletedMessage, false)
1110
- },
1111
- onMessageEdited: (editedMessage: any) => {
1112
- checkAndUpdateLastMessage(editedMessage, false)
1113
- },
1114
- onMessagesRead: (messageReceipt: any) => {
1115
- updateMessageReceipt(messageReceipt);
1116
- },
1117
- onMessagesDelivered: (messageReceipt: any) => {
1118
- updateMessageReceipt(messageReceipt);
1119
- },
1120
- onMessagesDeliveredToAll: (messageReceipt: CometChat.MessageReceipt) => {
1121
- updateMessageReceipt(messageReceipt);
1122
- },
1123
- onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
1124
- updateMessageReceipt(messageReceipt);
1125
- },
1126
- onTypingStarted: (typingIndicator: any) => {
1127
- typingEventHandler(typingIndicator, true);
1128
- },
1129
- onTypingEnded: (typingIndicator: any) => {
1130
- typingEventHandler(typingIndicator, false);
1131
- },
1132
- onFormMessageReceived: (formMessage: any) => {
1133
- if(!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
1134
- return;
1135
- }
1136
- messageEventHandler(formMessage);
1137
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1138
- },
1139
- onCardMessageReceived: (cardMessage: any) => {
1140
- if(!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
1141
- return;
1142
- }
1143
- messageEventHandler(cardMessage);
1144
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1145
- },
1146
- onSchedulerMessageReceived: (schedulerMessage: any) => {
1147
- if(!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
1148
- return;
1149
- }
1150
- messageEventHandler(schedulerMessage);
1151
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1152
- },
1153
- onCustomInteractiveMessageReceived: (customInteractiveMessage: any) => {
1154
- if(!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
1155
- return;
1156
- }
1157
- messageEventHandler(customInteractiveMessage);
1158
- !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1159
- }
1160
- }
1161
- );
1162
- CometChatUIEventHandler.addGroupListener(
1163
- groupListenerId,
1164
- {
1165
- ccGroupCreated: ({ group }: any) => {
1166
- CometChat.getConversation(group.getGuid(), CometChatUiKitConstants.ConversationTypeConstants.group).then(
1167
- (conversation: any) => {
1168
- conversationListRef.current?.addItemToList(conversation, 0);
1169
- }
1170
- )
1171
- },
1172
- ccGroupDeleted: ({ group }: any) => {
1173
- conversationListRef.current?.removeItemFromList(group['conversationId']);
1174
- removeItemFromSelectionList(group['conversationId'])
1175
- },
1176
- ccGroupLeft: ({ leftGroup }: any) => {
1177
- conversationListRef.current?.removeItemFromList(leftGroup['conversationId']);
1178
- removeItemFromSelectionList(leftGroup['conversationId'])
1179
- },
1180
- ccGroupMemberKicked: ({ message, kickedFrom }: { message: CometChat.BaseMessage, kickedFrom: CometChat.Group }) => {
1181
- if (!(shouldUpdateLastMessageAndUnreadCount(message))) {
1182
- return;
1183
- }
1184
- updateConversationLastMessage(message)
1185
- },
1186
- ccGroupMemberBanned: ({ message }: any) => {
1187
- if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
1188
- return;
1189
- }
1190
- groupHandler(message);
1191
- },
1192
- ccGroupMemberUnBanned: ({ message }: any) => {
1193
- if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
1194
- return;
1195
- }
1196
- groupHandler(message)
1197
- },
1198
- ccOwnershipChanged: ({ message }: any) => {
1199
- if(!(shouldUpdateLastMessageAndUnreadCount(message))) {
1200
- return;
1201
- }
1202
- CometChat.CometChatHelper.getConversationFromMessage(message)
1203
- .then((conversation: any) => {
1204
- conversationListRef.current?.updateList(conversation);
1205
- })
1206
- .catch((e: any) => {
1207
- onError && onError(e);
1208
- })
1209
- },
1210
- ccGroupMemberAdded: ({ message }: { message: CometChat.BaseMessage }) => {
1211
- updateConversationLastMessage(message)
1212
- }
1213
- }
1214
- )
1215
-
1216
- CometChatUIEventHandler.addUserListener(
1217
- userListenerId,
1218
- {
1219
- ccUserBlocked: ({ user }: {user: CometChat.User}) => {
1220
- const uid = user.getUid();
1221
- let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) as unknown as CometChat.Conversation || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`) as unknown as CometChat.Conversation;
1222
- if(conversationsRequestBuilder && conversationsRequestBuilder.build().isIncludeBlockedUsers()) {
1223
- if(item) {
1224
- let updatedConversation = CommonUtils.clone(item);
1225
- updatedConversation.setConversationWith(user);
1226
- conversationListRef.current?.updateList(updatedConversation);
1227
- }
1228
- return;
1229
- }
1230
- conversationListRef?.current?.removeItemFromList(user['conversationId']);
1231
- removeItemFromSelectionList(user['conversationId']);
1232
- },
1233
- ccUserUnBlocked: ({ user }: {user: CometChat.User}) => {
1234
- /**unblocked handling is required to enable user presence listener for the user**/
1235
- const uid = user.getUid();
1236
- let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) as unknown as CometChat.Conversation || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`) as unknown as CometChat.Conversation;
1237
- if(item) {
1238
- let updatedConversation = CommonUtils.clone(item);
1239
- updatedConversation.setConversationWith(user);
1240
- conversationListRef.current?.updateList(updatedConversation);
1241
- }
1242
- }
1243
- }
1244
- )
1245
-
1246
- CometChatUIEventHandler.addCallListener(
1247
- callListenerId,
1248
- {
1249
- ccOutgoingCall: ({ call }: any) => {
1250
- CometChat.CometChatHelper.getConversationFromMessage(call)
1251
- .then((conversation: any) => {
1252
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1253
- return;
1254
- }
1255
- conversation = updateUnreadMessageCount(conversation);
1256
- conversationListRef.current?.updateList(conversation);
1257
- })
1258
- .catch((e: any) => {
1259
- onError && onError(e);
1260
- })
1261
- },
1262
- ccCallAccepted: ({ call }: any) => {
1263
- CometChat.CometChatHelper.getConversationFromMessage(call)
1264
- .then((conversation: any) => {
1265
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1266
- return;
1267
- }
1268
- conversation = updateUnreadMessageCount(conversation);
1269
- conversationListRef.current?.updateList(conversation);
1270
- })
1271
- .catch((e: any) => {
1272
- onError && onError(e);
1273
- })
1274
- },
1275
- ccCallRejected: ({ call }: any) => {
1276
- CometChat.CometChatHelper.getConversationFromMessage(call)
1277
- .then((conversation: any) => {
1278
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1279
- return;
1280
- }
1281
- conversation = updateUnreadMessageCount(conversation);
1282
- conversationListRef.current?.updateList(conversation);
1283
- })
1284
- .catch((e: any) => {
1285
- onError && onError(e);
1286
- })
1287
- },
1288
- ccCallEnded: ({ call }: any) => {
1289
- CometChat.CometChatHelper.getConversationFromMessage(call)
1290
- .then((conversation: any) => {
1291
- if(!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1292
- return;
1293
- }
1294
- conversation = updateUnreadMessageCount(conversation);
1295
- conversationListRef.current?.updateList(conversation);
1296
- })
1297
- .catch((e: any) => {
1298
- onError && onError(e);
1299
- })
1300
- }
1301
- }
1302
- )
1303
-
1304
- return () => {
1305
- CometChat.removeUserListener(userListenerId);
1306
- CometChat.removeCallListener(callListenerId);
1307
- CometChat.removeGroupListener(groupListenerId);
1308
- CometChatUIEventHandler.removeMessageListener(messageListenerId);
1309
- CometChatUIEventHandler.removeConversationListener(conversationListenerId);
1310
- CometChatUIEventHandler.removeGroupListener(groupListenerId);
1311
- CometChatUIEventHandler.removeUserListener(userListenerId);
1103
+ // Listen for group events.
1104
+ CometChat.addGroupListener(
1105
+ groupListenerId,
1106
+ new CometChat.GroupListener({
1107
+ onGroupMemberScopeChanged: (
1108
+ message: CometChat.Action,
1109
+ changedUser: CometChat.GroupMember,
1110
+ newScope: CometChat.GroupMemberScope,
1111
+ oldScope: CometChat.GroupMemberScope,
1112
+ changedGroup: CometChat.Group
1113
+ ) => {
1114
+ groupHandler(message, {
1115
+ action: "scopeChange",
1116
+ actionOn: changedUser,
1117
+ newScope: newScope,
1118
+ oldScope: oldScope,
1119
+ group: changedGroup,
1120
+ });
1121
+ },
1122
+ onGroupMemberKicked: (
1123
+ message: CometChat.Action,
1124
+ kickedUser: CometChat.User,
1125
+ kickedBy: CometChat.User,
1126
+ kickedFrom: CometChat.Group
1127
+ ) => {
1128
+ groupHandler(message, {
1129
+ action: "kicked",
1130
+ actionOn: kickedUser,
1131
+ actionBy: kickedBy,
1132
+ group: kickedFrom,
1133
+ });
1134
+ },
1135
+ onGroupMemberLeft: (
1136
+ message: CometChat.Action,
1137
+ leavingUser: CometChat.User,
1138
+ group: CometChat.Group
1139
+ ) => {
1140
+ groupHandler(message, { action: "left", actionOn: leavingUser, group });
1141
+ },
1142
+ onGroupMemberUnbanned: (message: CometChat.Action) => {
1143
+ groupHandler(message);
1144
+ },
1145
+ onGroupMemberBanned: (
1146
+ message: CometChat.Action,
1147
+ bannedUser: CometChat.User,
1148
+ bannedBy: CometChat.User,
1149
+ bannedFrom: CometChat.Group
1150
+ ) => {
1151
+ groupHandler(message, {
1152
+ action: "banned",
1153
+ actionOn: bannedUser,
1154
+ actionBy: bannedBy,
1155
+ group: bannedFrom,
1156
+ });
1157
+ },
1158
+ onMemberAddedToGroup: (
1159
+ message: CometChat.Action,
1160
+ userAdded: CometChat.User,
1161
+ userAddedBy: CometChat.User,
1162
+ userAddedIn: CometChat.Group
1163
+ ) => {
1164
+ if (onMemberAddedToGroupDebounceTimer.current) {
1165
+ clearTimeout(onMemberAddedToGroupDebounceTimer.current);
1166
+ }
1167
+ onMemberAddedToGroupDebounceTimer.current = setTimeout(() => {
1168
+ groupHandler(message, {
1169
+ action: "joined",
1170
+ actionOn: userAdded,
1171
+ actionBy: userAddedBy,
1172
+ group: userAddedIn,
1173
+ });
1174
+ }, 50);
1175
+ },
1176
+ onGroupMemberJoined: (message: CometChat.Action) => {
1177
+ groupHandler(message);
1178
+ },
1179
+ })
1180
+ );
1181
+
1182
+ // Listen for conversation deletion events.
1183
+ CometChatUIEventHandler.addConversationListener(conversationListenerId, {
1184
+ ccConversationDeleted: ({ conversation }: { conversation: CometChat.Conversation }) => {
1185
+ conversationListRef.current!.removeItemFromList(conversation.getConversationId());
1186
+ removeItemFromSelectionList(conversation.getConversationId());
1187
+ },
1188
+ });
1189
+ // Listen for message events.
1190
+ CometChatUIEventHandler.addMessageListener(messageListenerId, {
1191
+ ccMessageSent: ({ message, status }: any) => {
1192
+ if (status == MessageStatusConstants.success) {
1193
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1194
+ return;
1195
+ }
1196
+ updateLastMessage(message);
1312
1197
  }
1313
- }, []);
1314
-
1315
- const ConversationItemView = ({ item: conversation }: {item: CometChat.Conversation}) => {
1316
- if (!conversation) return null;
1317
- //custom view check
1318
- if (ListItemView)
1319
- return ListItemView(conversation);
1320
- const conversationWith = conversation.getConversationWith();
1321
- const conversationType = conversation.getConversationType();
1322
- const lastMessage = CometChatConversationUtils.getLastMessage(conversation);
1323
- const name = conversationWith.getName();
1324
- const conversationId = conversation.getConversationId();
1325
- let type: string;
1326
- if(conversationWith instanceof CometChat.Group) {
1327
- type = conversationWith.getType();
1198
+ },
1199
+ ccMessageRead: ({ message }: { message: CometChat.BaseMessage }) => {
1200
+ checkAndUpdateLastMessage(message);
1201
+ },
1202
+ ccMessageDeleted: ({ message }: { message: CometChat.BaseMessage }) => {
1203
+ checkAndUpdateLastMessage(message);
1204
+ },
1205
+ ccMessageEdited: ({ message }: { message: CometChat.BaseMessage }) => {
1206
+ checkAndUpdateLastMessage(message);
1207
+ },
1208
+ onTextMessageReceived: (textMessage: CometChat.TextMessage) => {
1209
+ if (!shouldUpdateLastMessageAndUnreadCount(textMessage)) {
1210
+ return;
1328
1211
  }
1329
-
1330
- let image!: ImageType, backgroundColor!: string, avatarIcon = conversationWith[conversationType == "group" ? 'icon' : "avatar"];
1331
- if (type == GroupTypeConstants.password) {
1332
- image = props?.protectedGroupIcon || passwordGroupIcon;
1333
- backgroundColor = PASSWORD_GROUP_COLOR;
1212
+ messageEventHandler(textMessage);
1213
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1214
+ },
1215
+ onMediaMessageReceived: (mediaMessage: CometChat.MediaMessage) => {
1216
+ if (!shouldUpdateLastMessageAndUnreadCount(mediaMessage)) {
1217
+ return;
1334
1218
  }
1335
- if (type == GroupTypeConstants.private) {
1336
- image = props?.privateGroupIcon || privateGroupIcon;
1337
- backgroundColor = PRIVATE_GROUP_COLOR;
1219
+ messageEventHandler(mediaMessage);
1220
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1221
+ },
1222
+ onCustomMessageReceived: (customMessage: CometChat.CustomMessage) => {
1223
+ if (!shouldUpdateLastMessageAndUnreadCount(customMessage)) {
1224
+ return;
1338
1225
  }
1339
- if (conversationWith instanceof CometChat.User && conversationWith.getStatus() == CometChatUiKitConstants.UserStatusConstants.online && !(conversationWith?.getBlockedByMe() || conversationWith?.getHasBlockedMe())) {
1340
- backgroundColor = theme.palette.getSuccess();
1226
+ messageEventHandler(customMessage);
1227
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1228
+ },
1229
+ onMessageDeleted: (deletedMessage: CometChat.BaseMessage) => {
1230
+ checkAndUpdateLastMessage(deletedMessage);
1231
+ },
1232
+ onMessageEdited: (editedMessage: CometChat.BaseMessage) => {
1233
+ checkAndUpdateLastMessage(editedMessage);
1234
+ },
1235
+ onMessagesRead: (messageReceipt: CometChat.MessageReceipt) => {
1236
+ updateMessageReceipt(messageReceipt);
1237
+ },
1238
+ onMessagesDelivered: (messageReceipt: CometChat.MessageReceipt) => {
1239
+ updateMessageReceipt(messageReceipt);
1240
+ },
1241
+ onMessagesDeliveredToAll: (messageReceipt: CometChat.MessageReceipt) => {
1242
+ updateMessageReceipt(messageReceipt);
1243
+ },
1244
+ onMessagesReadByAll: (messageReceipt: CometChat.MessageReceipt) => {
1245
+ updateMessageReceipt(messageReceipt);
1246
+ },
1247
+ onTypingStarted: (typingIndicator: CometChat.TypingIndicator) => {
1248
+ typingEventHandler(typingIndicator, true);
1249
+ },
1250
+ onTypingEnded: (typingIndicator: CometChat.TypingIndicator) => {
1251
+ typingEventHandler(typingIndicator, false);
1252
+ },
1253
+ onFormMessageReceived: (formMessage: any) => {
1254
+ if (!shouldUpdateLastMessageAndUnreadCount(formMessage)) {
1255
+ return;
1341
1256
  }
1342
- if (selecting) {
1343
- let index: number = selectedConversation.findIndex((value) => value.conversationWith.conversationId == conversationId);
1344
- if (index >= 0) {
1345
- image = rightTickIcon;
1346
- backgroundColor = theme?.palette.getPrimary();
1347
- }
1257
+ messageEventHandler(formMessage);
1258
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1259
+ },
1260
+ onCardMessageReceived: (cardMessage: any) => {
1261
+ if (!shouldUpdateLastMessageAndUnreadCount(cardMessage)) {
1262
+ return;
1263
+ }
1264
+ messageEventHandler(cardMessage);
1265
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1266
+ },
1267
+ onSchedulerMessageReceived: (schedulerMessage: any) => {
1268
+ if (!shouldUpdateLastMessageAndUnreadCount(schedulerMessage)) {
1269
+ return;
1348
1270
  }
1271
+ messageEventHandler(schedulerMessage);
1272
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1273
+ },
1274
+ onCustomInteractiveMessageReceived: (customInteractiveMessage: any) => {
1275
+ if (!shouldUpdateLastMessageAndUnreadCount(customInteractiveMessage)) {
1276
+ return;
1277
+ }
1278
+ messageEventHandler(customInteractiveMessage);
1279
+ !disableSoundForMessages && CometChatSoundManager.play("incomingMessage");
1280
+ },
1281
+ });
1282
+ // Listen for additional group events.
1283
+ CometChatUIEventHandler.addGroupListener(groupListenerId, {
1284
+ ccGroupCreated: ({ group }: { group: CometChat.Group }) => {
1285
+ CometChat.getConversation(
1286
+ group.getGuid(),
1287
+ CometChatUiKitConstants.ConversationTypeConstants.group
1288
+ ).then((conversation) => {
1289
+ conversationListRef.current?.addItemToList(conversation, 0);
1290
+ });
1291
+ },
1292
+ ccGroupDeleted: ({ group }: { group: CometChat.Group }) => {
1293
+ CometChat.getConversation(
1294
+ group.getGuid(),
1295
+ CometChatUiKitConstants.ConversationTypeConstants.group
1296
+ ).then((conversation) => {
1297
+ conversationListRef.current?.removeItemFromList(conversation.getConversationId());
1298
+ removeItemFromSelectionList(conversation.getConversationId());
1299
+ });
1300
+ },
1301
+ ccGroupLeft: ({ leftGroup }: { leftGroup: CometChat.Group }) => {
1302
+ const foundConversation = conversationListRef.current?.getAllListItems().find((conv) => {
1303
+ const convWith = conv.getConversationWith();
1304
+ return convWith instanceof CometChat.Group && convWith.getGuid() === leftGroup.getGuid();
1305
+ });
1306
+ if (foundConversation) {
1307
+ conversationListRef.current?.removeItemFromList(foundConversation.getConversationId());
1308
+ removeItemFromSelectionList(foundConversation.getConversationId());
1309
+ }
1310
+ },
1311
+ ccGroupMemberKicked: ({
1312
+ message,
1313
+ kickedFrom,
1314
+ }: {
1315
+ message: CometChat.Action;
1316
+ kickedFrom: CometChat.Group;
1317
+ }) => {
1318
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1319
+ return;
1320
+ }
1321
+ updateConversationLastMessage(message, kickedFrom);
1322
+ },
1323
+ ccGroupMemberBanned: ({ message }: { message: CometChat.Action }) => {
1324
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1325
+ return;
1326
+ }
1327
+ groupHandler(message);
1328
+ },
1329
+ ccGroupMemberUnBanned: ({ message }: { message: CometChat.Action }) => {
1330
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1331
+ return;
1332
+ }
1333
+ groupHandler(message);
1334
+ },
1335
+ ccOwnershipChanged: ({ message }: { message: CometChat.Action }) => {
1336
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1337
+ return;
1338
+ }
1339
+ CometChat.CometChatHelper.getConversationFromMessage(message)
1340
+ .then((conversation) => {
1341
+ conversationListRef.current?.updateList(conversation);
1342
+ })
1343
+ .catch((e) => {
1344
+ onError && onError(e);
1345
+ });
1346
+ },
1347
+ ccGroupMemberAdded: ({
1348
+ message,
1349
+ userAddedIn,
1350
+ }: {
1351
+ message: CometChat.Action;
1352
+ userAddedIn: CometChat.Group;
1353
+ }) => {
1354
+ if (!shouldUpdateLastMessageAndUnreadCount(message)) {
1355
+ return;
1356
+ }
1357
+ updateConversationLastMessage(message, userAddedIn);
1358
+ },
1359
+ });
1360
+
1361
+ // Listen for user block events.
1362
+ CometChatUIEventHandler.addUserListener(userListenerId, {
1363
+ ccUserBlocked: ({ user }: { user: CometChat.User }) => {
1364
+ const uid = user.getUid();
1365
+ let item: CometChat.Conversation | any =
1366
+ (conversationListRef.current?.getListItem(
1367
+ `${uid}_user_${loggedInUser.current?.getUid()}`
1368
+ ) as unknown as CometChat.Conversation) ||
1369
+ (conversationListRef.current?.getListItem(
1370
+ `${loggedInUser.current?.getUid()}_user_${uid}`
1371
+ ) as unknown as CometChat.Conversation);
1372
+ if (
1373
+ conversationsRequestBuilder &&
1374
+ conversationsRequestBuilder.build().isIncludeBlockedUsers()
1375
+ ) {
1376
+ if (item) {
1377
+ let updatedConversation = CommonUtils.clone(item);
1378
+ updatedConversation.setConversationWith(user);
1379
+ conversationListRef.current?.updateList(updatedConversation);
1380
+ }
1381
+ return;
1382
+ }
1383
+ conversationListRef?.current?.removeItemFromList(item.getConversationId());
1384
+ removeItemFromSelectionList(item.getConversationId());
1385
+ },
1386
+ ccUserUnBlocked: ({ user }: { user: CometChat.User }) => {
1387
+ /**unblocked handling is required to enable user presence listener for the user**/
1388
+ const uid = user.getUid();
1389
+ let item: CometChat.Conversation | any =
1390
+ (conversationListRef.current?.getListItem(
1391
+ `${uid}_user_${loggedInUser.current?.getUid()}`
1392
+ ) as unknown as CometChat.Conversation) ||
1393
+ (conversationListRef.current?.getListItem(
1394
+ `${loggedInUser.current?.getUid()}_user_${uid}`
1395
+ ) as unknown as CometChat.Conversation);
1396
+ if (item) {
1397
+ let updatedConversation = CommonUtils.clone(item);
1398
+ updatedConversation.setConversationWith(user);
1399
+ conversationListRef.current?.updateList(updatedConversation);
1400
+ }
1401
+ },
1402
+ });
1349
1403
 
1350
- return <CometChatListItem
1351
- id={conversation.getConversationId()}
1352
- avatarName={name}
1353
- avatarURL={avatarIcon}
1354
- hideSeparator={hideSeparator}
1355
- SubtitleView={(SubtitleView && SubtitleView.bind(this, conversation)) || (() => <LastMessageView conversations={conversation} typingText={conversation?.['lastMessage']?.['typing']} />)
1404
+ // Listen for call events via UI event handler.
1405
+ CometChatUIEventHandler.addCallListener(callListenerId, {
1406
+ ccOutgoingCall: ({ call }: any) => {
1407
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1408
+ .then((conversation) => {
1409
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1410
+ return;
1356
1411
  }
1357
- title={name}
1358
- statusIndicatorIcon={image}
1359
- statusIndicatorColor={disableUsersPresence ? "transparent" : backgroundColor}
1360
- listItemStyle={_listItemStyle}
1361
- TailView={() => <TailView
1362
- customPattern={() => datePattern && datePattern(conversation)}
1363
- timestamp={lastMessage && lastMessage['sentAt'] || conversationWith['createdAt']}
1364
- unreadCount={conversation.getUnreadMessageCount()}
1365
- />}
1366
- avatarStyle={_avatarStyle}
1367
- statusIndicatorStyle={_statusIndicatorStyle as ViewProps}
1368
- onPress={conversationClicked.bind(this, conversation)}
1369
- onLongPress={conversationLongPressed.bind(this, conversation)}
1370
- options={() => options ? options(conversation) : getDefaultOptions(conversation)}
1371
- activeSwipeRows={activeSwipeRows.current}
1372
- rowOpens={(id) => {
1373
- Object.keys(activeSwipeRows.current).forEach(key => {
1374
- if (id !== key && activeSwipeRows.current[key]) {
1375
- activeSwipeRows.current[key]?.current?.closeRow?.()
1376
- delete activeSwipeRows.current[key]
1377
- }
1378
- })
1379
- }}
1380
- />
1412
+ conversation = updateUnreadMessageCount(conversation);
1413
+ conversationListRef.current!.updateList(conversation);
1414
+ })
1415
+ .catch((e) => {
1416
+ onError && onError(e);
1417
+ });
1418
+ },
1419
+ ccCallAccepted: ({ call }: any) => {
1420
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1421
+ .then((conversation) => {
1422
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1423
+ return;
1424
+ }
1425
+ conversation = updateUnreadMessageCount(conversation);
1426
+ conversationListRef.current!.updateList(conversation);
1427
+ })
1428
+ .catch((e) => {
1429
+ onError && onError(e);
1430
+ });
1431
+ },
1432
+ ccCallRejected: ({ call }: any) => {
1433
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1434
+ .then((conversation) => {
1435
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1436
+ return;
1437
+ }
1438
+ conversation = updateUnreadMessageCount(conversation);
1439
+ conversationListRef.current!.updateList(conversation);
1440
+ })
1441
+ .catch((e) => {
1442
+ onError && onError(e);
1443
+ });
1444
+ },
1445
+ ccCallEnded: ({ call }: any) => {
1446
+ CometChat.CometChatHelper.getConversationFromMessage(call)
1447
+ .then((conversation) => {
1448
+ if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
1449
+ return;
1450
+ }
1451
+ conversation = updateUnreadMessageCount(conversation);
1452
+ conversationListRef.current!.updateList(conversation);
1453
+ })
1454
+ .catch((e) => {
1455
+ onError && onError(e);
1456
+ });
1457
+ },
1458
+ });
1459
+
1460
+ // Cleanup all listeners on unmount.
1461
+ return () => {
1462
+ CometChat.removeUserListener(userListenerId);
1463
+ CometChat.removeCallListener(callListenerId);
1464
+ CometChat.removeGroupListener(groupListenerId);
1465
+ CometChatUIEventHandler.removeMessageListener(messageListenerId);
1466
+ CometChatUIEventHandler.removeConversationListener(conversationListenerId);
1467
+ CometChatUIEventHandler.removeGroupListener(groupListenerId);
1468
+ CometChatUIEventHandler.removeUserListener(userListenerId);
1469
+ };
1470
+ }, []);
1471
+
1472
+ const getStatusIndicator = (conv: CometChat.Conversation) => {
1473
+ const withObj = conv.getConversationWith();
1474
+
1475
+ if (groupTypeVisibility) {
1476
+ if (withObj instanceof CometChat.Group) {
1477
+ if (withObj.getType() === GroupTypeConstants.password) return "protected";
1478
+ if (withObj.getType() === GroupTypeConstants.private) return "private";
1479
+ }
1480
+ } else {
1481
+ return undefined;
1381
1482
  }
1382
1483
 
1383
- /**
1384
- * Component template
1385
- */
1386
- return (
1387
- <View style={Style.container}>
1388
- <ConfirmDeletionDialog />
1389
- <CometChatList
1390
- AppBarOptions={AppBarOption}
1391
- onError={onError}
1392
- ref={conversationListRef}
1393
- requestBuilder={conversationsRequestBuilder || new CometChat.ConversationsRequestBuilder().setLimit(30)}
1394
- title={title}
1395
- hideSearch={true}
1396
- hideSubmitIcon={hideSubmitIcon}
1397
- listItemKey={"conversationId"}
1398
- LoadingStateView={LoadingStateView}
1399
- ListItemView={ConversationItemView}
1400
- EmptyStateView={EmptyStateView ? EmptyStateView : () => <EmptyView />}
1401
- ErrorStateView={ErrorStateView ? ErrorStateView : () => <ErrorView />}
1402
- onBack={onBack}
1403
- backButtonIcon={backButtonIcon}
1404
- showBackButton={showBackButton}
1405
- onSelection={() => {
1406
- if(!selectedConversation.length) return
1407
- onSelection && onSelection(selectedConversation);
1408
- setSelecting(false);
1409
- setSelectedConversations([]);
1410
- }}
1411
- SubtitleView={props.SubtitleView}
1412
- disableUsersPresence={disableUsersPresence}
1413
- options={options}
1414
- hideSeparator={hideSeparator}
1415
- listStyle={{ ..._style, background: _style.backgroundColor }}
1416
- selectionMode={selecting ? selectionMode : "none"}
1417
- hideError={hideError}
1418
- />
1419
- </View>
1420
- );
1421
- }
1484
+ if (usersStatusVisibility) {
1485
+ if (
1486
+ withObj instanceof CometChat.User &&
1487
+ withObj.getStatus() === CometChatUiKitConstants.UserStatusConstants.online &&
1488
+ !withObj.getHasBlockedMe() &&
1489
+ !withObj.getBlockedByMe()
1490
+ ) {
1491
+ return "online";
1492
+ }
1493
+ return "offline";
1494
+ } else {
1495
+ return undefined;
1496
+ }
1497
+ };
1498
+
1499
+ const LeadingViewRaw = useCallback(
1500
+ (conv: CometChat.Conversation) => {
1501
+ const withObj = conv.getConversationWith();
1502
+ const avatarURL = withObj instanceof CometChat.User ? withObj.getAvatar() : withObj.getIcon();
1503
+ const name = withObj.getName();
1504
+
1505
+ return (
1506
+ <>
1507
+ <CometChatAvatar
1508
+ image={{ uri: avatarURL }}
1509
+ name={name}
1510
+ style={mergedStyles.itemStyle.avatarStyle}
1511
+ />
1512
+ <CometChatStatusIndicator
1513
+ type={getStatusIndicator(conv)}
1514
+ style={mergedStyles?.itemStyle?.statusIndicatorStyle}
1515
+ />
1516
+ </>
1517
+ );
1518
+ },
1519
+ [mergedStyles]
1520
+ );
1521
+
1522
+ const TitleViewRaw = useCallback(
1523
+ (conv: CometChat.Conversation) => (
1524
+ <Text numberOfLines={1} ellipsizeMode='tail' style={mergedStyles.itemStyle.titleStyle}>
1525
+ {conv.getConversationWith().getName()}
1526
+ </Text>
1527
+ ),
1528
+ [mergedStyles]
1529
+ );
1530
+
1531
+ const SubtitleViewRaw = (conv: CometChat.Conversation) => (
1532
+ <LastMessageView conversations={conv} typingText={conv?.["lastMessage"]?.["typing"]} />
1533
+ );
1534
+
1535
+ const TrailingViewRaw = useCallback((conv: CometChat.Conversation) => getTrailingView(conv), []);
1536
+
1537
+ return (
1538
+ <View style={mergedStyles.containerStyle}>
1539
+ <CometChatTooltipMenu
1540
+ visible={tooltipVisible}
1541
+ onClose={() => {
1542
+ setTooltipVisible(false);
1543
+ }}
1544
+ event={{
1545
+ nativeEvent: tooltipPositon.current,
1546
+ }}
1547
+ menuItems={
1548
+ options
1549
+ ? options(longPressedConversation.current!)
1550
+ : [
1551
+ ...[
1552
+ ...(deleteConversationOptionVisibility
1553
+ ? [
1554
+ {
1555
+ text: "Delete",
1556
+ onPress: () => {
1557
+ setConfirmDelete(longPressId.current);
1558
+ setTooltipVisible(false);
1559
+ },
1560
+ icon: (
1561
+ <Delete
1562
+ color={theme.color.error}
1563
+ height={theme.spacing.spacing.s6}
1564
+ width={theme.spacing.spacing.s6}
1565
+ />
1566
+ ),
1567
+ textStyle: { color: theme.color.error },
1568
+ },
1569
+ ]
1570
+ : []),
1571
+ ],
1572
+ ...(addOptions ? addOptions(longPressedConversation.current!) : []),
1573
+ ]
1574
+ }
1575
+ />
1576
+ <CometChatConfirmDialog
1577
+ titleText={localize("DELETE_THIS_CONVERSATION")}
1578
+ icon={<Icon name='delete' size={theme.spacing.spacing.s12} color={theme.color.error} />}
1579
+ cancelButtonText={localize("CANCEL")}
1580
+ confirmButtonText={localize("DELETE")}
1581
+ messageText={localize("SURE_TO_DELETE_CHAT")}
1582
+ isOpen={confirmDelete != undefined}
1583
+ onCancel={() => setConfirmDelete(undefined)}
1584
+ onConfirm={() => {
1585
+ removeConversation(confirmDelete!);
1586
+ setConfirmDelete(undefined);
1587
+ }}
1588
+ {...mergedStyles.confirmDialogStyle}
1589
+ />
1590
+ <CometChatList
1591
+ AppBarOptions={AppBarOptions}
1592
+ onError={onError}
1593
+ ref={conversationListRef}
1594
+ LeadingView={LeadingView ? LeadingView : LeadingViewRaw}
1595
+ TitleView={TitleView ? TitleView : TitleViewRaw}
1596
+ SubtitleView={SubtitleView ? SubtitleView : SubtitleViewRaw}
1597
+ TrailingView={TrailingView ? TrailingView : TrailingViewRaw}
1598
+ requestBuilder={
1599
+ conversationsRequestBuilder || new CometChat.ConversationsRequestBuilder().setLimit(30)
1600
+ }
1601
+ hideStickyHeader={true}
1602
+ title={localize("CHATS")}
1603
+ listStyle={mergedStyles}
1604
+ hideSearch={true}
1605
+ hideSubmitButton={hideSubmitButton}
1606
+ onItemPress={(conversation) =>
1607
+ selectionMode === "none" ? conversationClicked(conversation) : null
1608
+ }
1609
+ onItemLongPress={(conversation: CometChat.Conversation, e?: GestureResponderEvent) => {
1610
+ if (selectionMode === "none") {
1611
+ if (onItemLongPress) {
1612
+ onItemLongPress(conversation);
1613
+ return;
1614
+ }
1615
+ if (e && "nativeEvent" in e) {
1616
+ longPressId.current = conversation.getConversationId();
1617
+ longPressedConversation.current = conversation;
1618
+ tooltipPositon.current = {
1619
+ pageX: e.nativeEvent.pageX,
1620
+ pageY: e.nativeEvent.pageY,
1621
+ };
1622
+ setTooltipVisible(true);
1623
+ }
1624
+ }
1625
+ }}
1626
+ listItemKey={"conversationId"}
1627
+ LoadingView={LoadingView ?? (() => <Skeleton style={mergedStyles.skeletonStyle} />)}
1628
+ ItemView={ItemView}
1629
+ EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
1630
+ ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
1631
+ onBack={onBack}
1632
+ hideBackButton={hideBackButton}
1633
+ onSelection={onSelection}
1634
+ onSubmit={onSubmit}
1635
+ selectionMode={selectionMode}
1636
+ hideError={hideError}
1637
+ hideHeader={hideHeader}
1638
+ onListFetched={(conversations: CometChat.Conversation[]) => {
1639
+ if (conversations.length === 0) {
1640
+ onEmpty?.();
1641
+ } else {
1642
+ onLoad?.(conversations);
1643
+ }
1644
+ }}
1645
+ />
1646
+ </View>
1647
+ );
1648
+ };