@cometchat/chat-uikit-react-native 5.3.9 → 5.4.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 (136) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/CometChatClipboardModule.kt +52 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
  8. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +95 -8
  9. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +237 -6
  10. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +2 -1
  11. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +85 -47
  12. package/ios/CometChatClipboardModule.m +11 -0
  13. package/ios/CometChatClipboardModule.swift +41 -0
  14. package/ios/FileManager.m +201 -39
  15. package/ios/RichTextEditorView.swift +312 -4
  16. package/ios/RichTextEditorViewManager.m +1 -0
  17. package/ios/SoundPlayer.m +18 -6
  18. package/package.json +9 -7
  19. package/react-native-cometchat-ui-kit.podspec +1 -0
  20. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +692 -107
  21. package/src/CometChatConversations/CometChatConversations.tsx +28 -6
  22. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +649 -49
  23. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +23 -4
  24. package/src/CometChatMessageList/CometChatMessageList.tsx +530 -58
  25. package/src/CometChatMessageList/MANUAL_TEST_CASES.md +154 -0
  26. package/src/CometChatMessageList/components/MessageListItem.tsx +30 -17
  27. package/src/CometChatMessageList/style.ts +33 -5
  28. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +13 -0
  29. package/src/CometChatRichTextEditor/index.tsx +25 -0
  30. package/src/CometChatSearch/CometChatSearch.tsx +296 -154
  31. package/src/calls/CallingExtension.tsx +19 -13
  32. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +20 -1
  33. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +20 -9
  34. package/src/index.ts +39 -0
  35. package/src/shared/CometChatUiKit/CometChatUIKit.ts +40 -34
  36. package/src/shared/base/Types.ts +3 -0
  37. package/src/shared/constants/UIKitConstants.ts +15 -1
  38. package/src/shared/framework/DataSource.ts +14 -4
  39. package/src/shared/framework/DataSourceDecorator.tsx +17 -8
  40. package/src/shared/framework/MessageDataSource.tsx +321 -62
  41. package/src/shared/helper/useToast.tsx +29 -0
  42. package/src/shared/icons/components/audio-file-type.tsx +11 -22
  43. package/src/shared/icons/components/document-file-type.tsx +11 -24
  44. package/src/shared/icons/components/image-file-type.tsx +12 -21
  45. package/src/shared/icons/components/link-file-type.tsx +25 -0
  46. package/src/shared/icons/components/pdf-file-type.tsx +11 -22
  47. package/src/shared/icons/components/presentation-file-type.tsx +11 -24
  48. package/src/shared/icons/components/spreadsheet-file-type.tsx +11 -24
  49. package/src/shared/icons/components/text-file-type.tsx +11 -21
  50. package/src/shared/icons/components/unknown-file-type.tsx +21 -25
  51. package/src/shared/icons/components/video-file-type.tsx +11 -24
  52. package/src/shared/icons/components/zip-file-type.tsx +11 -24
  53. package/src/shared/icons/icon-mapping.tsx +2 -0
  54. package/src/shared/index.ts +28 -0
  55. package/src/shared/modals/AttachmentPickerConfiguration.ts +13 -0
  56. package/src/shared/modals/SelectedAttachment.ts +65 -0
  57. package/src/shared/modals/UploadState.ts +10 -0
  58. package/src/shared/modals/index.ts +4 -0
  59. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +43 -1
  60. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +43 -1
  61. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +44 -2
  62. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +44 -2
  63. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +44 -2
  64. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +44 -2
  65. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +44 -2
  66. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +44 -2
  67. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +44 -2
  68. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +44 -2
  69. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +44 -2
  70. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +44 -2
  71. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +44 -2
  72. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +44 -2
  73. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +44 -2
  74. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +44 -2
  75. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +44 -2
  76. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +44 -2
  77. package/src/shared/services/UploadQueueService.ts +145 -0
  78. package/src/shared/services/index.ts +2 -0
  79. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +42 -18
  80. package/src/shared/utils/MessageUtils.tsx +13 -4
  81. package/src/shared/utils/attachmentLimits.ts +156 -0
  82. package/src/shared/utils/audioPlaybackCoordinator.ts +28 -0
  83. package/src/shared/utils/batchMediaContext.tsx +30 -0
  84. package/src/shared/utils/conversationUtils.ts +44 -4
  85. package/src/shared/utils/groupAttachments.ts +93 -0
  86. package/src/shared/utils/index.ts +8 -0
  87. package/src/shared/utils/openMultiFileChooser.ts +123 -0
  88. package/src/shared/utils/partitionAttachmentsByKind.ts +44 -0
  89. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +28 -0
  90. package/src/shared/views/ClipboardPasteHandler/NativeCometChatClipboardModule.ts +16 -0
  91. package/src/shared/views/ClipboardPasteHandler/index.ts +2 -0
  92. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
  93. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +32 -0
  94. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.tsx +90 -0
  95. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +276 -0
  96. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +827 -0
  97. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTray.tsx +110 -0
  98. package/src/shared/views/CometChatAttachmentPreview/StagedVideoDurationProbe.tsx +53 -0
  99. package/src/shared/views/CometChatAttachmentPreview/index.ts +8 -0
  100. package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +305 -0
  101. package/src/shared/views/CometChatAttachmentViewer/index.ts +2 -0
  102. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +71 -74
  103. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +587 -0
  104. package/src/shared/views/CometChatAudiosBubble/index.ts +2 -0
  105. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +5 -7
  106. package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +182 -0
  107. package/src/shared/views/CometChatCaptionText/index.ts +2 -0
  108. package/src/shared/views/CometChatComposerErrorBanner.tsx +83 -0
  109. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +141 -0
  110. package/src/shared/views/CometChatConversationStarter/index.ts +2 -0
  111. package/src/shared/views/CometChatConversationSummary/CometChatConversationSummary.tsx +155 -0
  112. package/src/shared/views/CometChatConversationSummary/index.ts +2 -0
  113. package/src/shared/views/CometChatFileBubble/style.ts +6 -4
  114. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +316 -0
  115. package/src/shared/views/CometChatFilesBubble/index.ts +2 -0
  116. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +323 -0
  117. package/src/shared/views/CometChatImagesBubble/index.ts +2 -0
  118. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +425 -0
  119. package/src/shared/views/CometChatMediaViewer/index.ts +2 -0
  120. package/src/shared/views/CometChatMediaViewer/mediaViewerUtils.ts +30 -0
  121. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
  122. package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +1 -0
  123. package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +172 -0
  124. package/src/shared/views/CometChatSmartReplies/index.ts +2 -0
  125. package/src/shared/views/CometChatVideoBubble/style.ts +3 -3
  126. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +441 -0
  127. package/src/shared/views/CometChatVideosBubble/index.ts +2 -0
  128. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +78 -0
  129. package/src/shared/views/CometChatVoiceNoteBubble/index.ts +2 -0
  130. package/src/shared/views/index.ts +37 -1
  131. package/src/theme/CometChatThemeHelper.ts +8 -0
  132. package/src/theme/default/color/dark.ts +9 -0
  133. package/src/theme/default/color/light.ts +10 -0
  134. package/src/theme/type.ts +73 -0
  135. package/src/CometChatMessageList/PERFORMANCE_ARCHITECTURE.md +0 -478
  136. package/src/CometChatMessageList/SEARCH_NAV_PERF_PLAN.md +0 -613
@@ -7,6 +7,7 @@ import {
7
7
  CometChatVideoBubble,
8
8
  } from "../../shared/views";
9
9
  import React, { JSX } from "react";
10
+ import { Text, View } from "react-native";
10
11
  import { CometChatTheme } from "../../theme/type";
11
12
  import { CometChatUIKit } from "../../shared";
12
13
 
@@ -123,16 +124,26 @@ export class ThumbnailGenerationExtensionDecorator extends DataSourceDecorator {
123
124
  ): JSX.Element {
124
125
  const image = this.checkThumbnail(message);
125
126
  const loggedInUser = CometChatUIKit.loggedInUser;
126
- const _style =
127
- message.getSender()?.getUid() === loggedInUser?.getUid()
128
- ? theme.messageListStyles.outgoingMessageBubbleStyles?.imageBubbleStyles
129
- : theme.messageListStyles.incomingMessageBubbleStyles?.imageBubbleStyles;
127
+ const isSentByMe = message.getSender()?.getUid() === loggedInUser?.getUid();
128
+ const _style = isSentByMe
129
+ ? theme.messageListStyles.outgoingMessageBubbleStyles?.imageBubbleStyles
130
+ : theme.messageListStyles.incomingMessageBubbleStyles?.imageBubbleStyles;
130
131
  return (
131
- <CometChatImageBubble
132
- imageUrl={imageUrl ? { uri: imageUrl } : image}
133
- thumbnailUrl={image}
134
- style={_style?.imageStyle}
135
- />
132
+ <View>
133
+ <CometChatImageBubble
134
+ imageUrl={imageUrl ? { uri: imageUrl } : image}
135
+ thumbnailUrl={image}
136
+ style={_style?.imageStyle}
137
+ />
138
+ {Boolean(caption) && (
139
+ <Text style={{
140
+ color: isSentByMe ? theme.color.staticWhite : theme.color.neutral900,
141
+ paddingHorizontal: 8,
142
+ paddingTop: 6,
143
+ paddingBottom: 4,
144
+ }}>{caption}</Text>
145
+ )}
146
+ </View>
136
147
  );
137
148
  }
138
149
  }
package/src/index.ts CHANGED
@@ -141,6 +141,12 @@ import {
141
141
  } from "./CometChatCompactMessageComposer";
142
142
 
143
143
  import { CometChatAIAssistantChatHistory } from "./CometChatAIAssistantChatHistory";
144
+ import CometChatConversationStarter from "./shared/views/CometChatConversationStarter/CometChatConversationStarter";
145
+ import CometChatSmartReplies from "./shared/views/CometChatSmartReplies/CometChatSmartReplies";
146
+ import CometChatConversationSummary from "./shared/views/CometChatConversationSummary/CometChatConversationSummary";
147
+ import type { CometChatConversationStarterProps } from "./shared/views/CometChatConversationStarter/CometChatConversationStarter";
148
+ import type { CometChatSmartRepliesProps } from "./shared/views/CometChatSmartReplies/CometChatSmartReplies";
149
+ import type { CometChatConversationSummaryProps } from "./shared/views/CometChatConversationSummary/CometChatConversationSummary";
144
150
 
145
151
  import { CometChatThreadHeader, CometChatThreadHeaderInterface } from "./CometChatThreadHeader";
146
152
 
@@ -229,6 +235,9 @@ export {
229
235
  CometChatGroupsEvents,
230
236
  CometChatGroupMembers,
231
237
  CometChatAIAssistantChatHistory,
238
+ CometChatConversationStarter,
239
+ CometChatSmartReplies,
240
+ CometChatConversationSummary,
232
241
  CometChatImageBubble,
233
242
  CometChatIncomingCall,
234
243
  CometChatInlineAudioRecorder,
@@ -292,6 +301,9 @@ export {
292
301
  getCometChatTranslation,
293
302
  getCurrentLanguage,
294
303
  CometChatAIAssistantTools,
304
+ type CometChatConversationStarterProps,
305
+ type CometChatSmartRepliesProps,
306
+ type CometChatConversationSummaryProps,
295
307
  StreamMessage,
296
308
  stopStreamingForRunId,
297
309
  startStreamingForRunId,
@@ -316,6 +328,33 @@ export {
316
328
  };
317
329
  export { CometChatThemeProvider, useTheme } from "./theme";
318
330
 
331
+ // Multiple Attachment Support — public exports (PR review B1)
332
+ export {
333
+ CometChatAttachmentTray,
334
+ CometChatAttachmentTile,
335
+ CometChatAttachmentPreview,
336
+ CometChatAttachmentPreviewItem,
337
+ getAttachmentPreviewStyle,
338
+ CometChatImagesBubble,
339
+ CometChatVideosBubble,
340
+ CometChatFilesBubble,
341
+ CometChatAudiosBubble,
342
+ CometChatVoiceNoteBubble,
343
+ CometChatMediaViewer,
344
+ CometChatAttachmentViewer,
345
+ } from "./shared";
346
+ export type {
347
+ CometChatAttachmentTrayProps,
348
+ CometChatAttachmentTileProps,
349
+ CometChatAttachmentPreviewProps,
350
+ CometChatAttachmentPreviewItemProps,
351
+ CometChatFilesBubbleProps,
352
+ CometChatAudiosBubbleProps,
353
+ CometChatVoiceNoteBubbleProps,
354
+ CometChatMediaViewerProps,
355
+ CometChatAttachmentViewerProps,
356
+ } from "./shared";
357
+
319
358
  export {CometChatI18nProvider,useCometChatTranslation} from "./shared/resources/CometChatLocalizeNew"
320
359
  export {localizedDateHelperInstance,LocalizedDateHelper} from "./shared/helper/LocalizedDateHelper"
321
360
  export { useLocalizedDate } from "./shared/helper/useLocalizedDateHook";
@@ -20,6 +20,11 @@ import { UIKitSettings } from "./UIKitSettings";
20
20
  export class CometChatUIKit {
21
21
  static uiKitSettings: UIKitSettings;
22
22
  static loggedInUser: null | CometChat.User = null;
23
+ /**
24
+ * Raw settings captured on the initFromSettings() (ai-agent) path; routes the
25
+ * Calls SDK through CometChatCalls.initFromSettings() too. Null on plain init().
26
+ */
27
+ static callsInitSettings: CometChat.CometChatSettings | null = null;
23
28
  static conversationUpdateSettings: CometChat.ConversationUpdateSettings =
24
29
  new CometChat.ConversationUpdateSettings();
25
30
  private static loginListenerID: string = ``;
@@ -29,6 +34,8 @@ export class CometChatUIKit {
29
34
  CometChatUIKit.uiKitSettings = {
30
35
  ...uiKitSettings,
31
36
  };
37
+ // Plain init(): clear any ai-agent settings so the Calls SDK uses plain init().
38
+ CometChatUIKit.callsInitSettings = null;
32
39
  var appSetting = new CometChat.AppSettingsBuilder()
33
40
  .autoEstablishSocketConnection(uiKitSettings.autoEstablishSocketConnection)
34
41
  .overrideAdminHost(uiKitSettings?.overrideAdminHost || "")
@@ -100,6 +107,9 @@ export class CometChatUIKit {
100
107
  : undefined,
101
108
  };
102
109
 
110
+ // Capture raw settings so the Calls SDK routes through initFromSettings (ai-agent).
111
+ CometChatUIKit.callsInitSettings = settings;
112
+
103
113
  CometChatUIKit.attachListener();
104
114
 
105
115
  // CRITICAL: Call initFromSettings — NOT init(). Only initFromSettings writes "ai-agent".
@@ -217,7 +227,7 @@ export class CometChatUIKit {
217
227
  }
218
228
 
219
229
  static async getLoggedInUser(): Promise<CometChat.User> {
220
- if (CometChatUIKit.checkAuthSettings(Promise.reject)) null;
230
+ CometChatUIKit.assertInitialized();
221
231
  let user = await CometChat.getLoggedinUser().catch((e) => Promise.reject(e));
222
232
  if (user == null) {
223
233
  throw new CometChat.CometChatException({
@@ -264,7 +274,7 @@ export class CometChatUIKit {
264
274
  uid?: string;
265
275
  authToken?: string;
266
276
  }): Promise<CometChat.User> {
267
- if (CometChatUIKit.checkAuthSettings(Promise.reject)) null;
277
+ CometChatUIKit.assertInitialized();
268
278
  if (uid) {
269
279
  let user = await CometChat.login(uid, CometChatUIKit.uiKitSettings?.authKey).catch((e) =>
270
280
  Promise.reject(e)
@@ -290,13 +300,8 @@ export class CometChatUIKit {
290
300
  }
291
301
 
292
302
  static logout(): Promise<Object> {
293
- if (this.checkAuthSettings(Promise.reject)) {
294
- return Promise.reject(
295
- new CometChat.CometChatException({
296
- code: "ERR",
297
- message: "UIKit not initialized. Call CometChatUIKit.init() first.",
298
- })
299
- );
303
+ if (!this.checkAuthSettings()) {
304
+ return Promise.reject(this.authError());
300
305
  }
301
306
 
302
307
  return CometChat.logout().then(() => {
@@ -306,47 +311,48 @@ export class CometChatUIKit {
306
311
  }
307
312
 
308
313
  static createUser(user: CometChat.User): Promise<CometChat.User> {
309
- if (this.checkAuthSettings(Promise.reject)) {
314
+ if (!this.checkAuthSettings()) {
315
+ return Promise.reject(this.authError());
310
316
  }
311
317
 
312
318
  return CometChat.createUser(user, this.uiKitSettings.authKey as string);
313
319
  }
314
320
 
315
321
  static updateUser(user: CometChat.User): Promise<CometChat.User> {
316
- if (this.checkAuthSettings(Promise.reject)) {
322
+ if (!this.checkAuthSettings()) {
323
+ return Promise.reject(this.authError());
317
324
  }
318
325
 
319
326
  return CometChat.updateUser(user, this.uiKitSettings.authKey as string);
320
327
  }
321
328
 
322
329
  //Error handling to give better logs
323
- static checkAuthSettings(onError: (e: CometChat.CometChatException) => void): boolean {
330
+ /** Pure predicate: is the UIKit configured well enough to make authenticated calls? */
331
+ static checkAuthSettings(): boolean {
332
+ return this.uiKitSettings != null && !!this.uiKitSettings.appId;
333
+ }
334
+
335
+ /** Single source of truth for the "not initialized" exception (preserves the specific code). */
336
+ private static authError(): CometChat.CometChatException {
324
337
  if (this.uiKitSettings == null) {
325
- if (onError != null) {
326
- onError(
327
- new CometChat.CometChatException({
328
- code: "ERR",
329
- name: "Authentication null",
330
- message: "Populate authSettings before initializing",
331
- })
332
- );
333
- }
334
- return false;
338
+ return new CometChat.CometChatException({
339
+ code: "ERR",
340
+ name: "Authentication null",
341
+ message: "Populate authSettings before initializing. Call CometChatUIKit.init() first.",
342
+ });
335
343
  }
344
+ return new CometChat.CometChatException({
345
+ code: "appIdErr",
346
+ name: "APP ID null",
347
+ message: "Populate appId in authSettings before initializing.",
348
+ });
349
+ }
336
350
 
337
- if (!this.uiKitSettings?.appId) {
338
- if (onError != null) {
339
- onError(
340
- new CometChat.CometChatException({
341
- code: "appIdErr",
342
- name: "APP ID null",
343
- message: "Populate appId in authSettings before initializing",
344
- })
345
- );
346
- }
347
- return false;
351
+ /** Throws the right exception when unconfigured. Works in sync (caught) and async methods. */
352
+ private static assertInitialized(): void {
353
+ if (!this.checkAuthSettings()) {
354
+ throw this.authError();
348
355
  }
349
- return true;
350
356
  }
351
357
 
352
358
  //---------- Helper methods to send messages ----------
@@ -32,6 +32,9 @@ export type AdditionalParams = {
32
32
  hideMarkAsUnreadOption?: boolean,
33
33
  hideGroupActionMessages?: boolean,
34
34
  onReplyClick?: (messageId: string) => void;
35
+ /** DD §9 — message-list rendering. true (default) → new per-type bubbles (render 1..N tiles, incl. a
36
+ * single attachment); false → deprecated single-attachment Image/Video/Audio/File bubbles. */
37
+ enableMultipleAttachments?: boolean;
35
38
  };
36
39
 
37
40
  export type AdditionalAttachmentOptionsParams = {
@@ -241,6 +241,8 @@ export const MessageOptionConstants = {
241
241
  replyMessagePrivately: "replyMessagePrivately",
242
242
  reportMessage: "reportMessage",
243
243
  markAsUnread: "markAsUnread",
244
+ // §8.5 — multi-attachment download all
245
+ downloadAll: "downloadAll",
244
246
  };
245
247
 
246
248
  export const CometChatMessageTypes = Object.freeze({
@@ -390,7 +392,7 @@ export enum MentionsVisibility {
390
392
  const FILE_EXTENSION = {
391
393
  doc: "document-file-type",
392
394
  docx: "document-file-type",
393
- md: "document-file-type",
395
+ md: "text-file-type", // markdown is plain text — not a Word doc (was wrongly showing the Word "W" logo)
394
396
  csv: "spreadsheet-file-type",
395
397
  xls: "spreadsheet-file-type",
396
398
  xlsx: "spreadsheet-file-type",
@@ -467,3 +469,15 @@ export enum EnterKeyBehavior {
467
469
  SendMessage = "sendMessage",
468
470
  NewLine = "newLine",
469
471
  }
472
+
473
+ /**
474
+ * Opacity applied to composer buttons (attach/aux/voice) when they are disabled,
475
+ * e.g. while editing a media caption. Shared by both message composers.
476
+ */
477
+ export const DISABLED_BUTTON_OPACITY = 0.4;
478
+
479
+ /**
480
+ * Multi-attachment collections (files, audios) collapse to this many items and
481
+ * reveal the rest behind a "Show N more" toggle. Shared by the files/audios bubbles.
482
+ */
483
+ export const ATTACHMENT_COLLAPSED_LIMIT = 3;
@@ -68,6 +68,12 @@ export interface DataSource {
68
68
  group?: CometChat.Group,
69
69
  additionalParams?: AdditionalParams
70
70
  ): Array<CometChatMessageOption>;
71
+ /**
72
+ * §8.5 — "Download all" option shown on multi-attachment messages.
73
+ * Optional so external `DataSource` implementers aren't forced to implement it (PR review B2);
74
+ * the default `MessageDataSource` still provides an implementation.
75
+ */
76
+ getDownloadAllOption?(theme: CometChatTheme): CometChatMessageOption | undefined;
71
77
 
72
78
  //views
73
79
  getBottomView(
@@ -126,22 +132,26 @@ export interface DataSource {
126
132
  getAudioMessageContentView(
127
133
  message: CometChat.BaseMessage,
128
134
  alignment: MessageBubbleAlignmentType,
129
- theme: CometChatTheme
135
+ theme: CometChatTheme,
136
+ additionalParams?: AdditionalParams
130
137
  ): JSX.Element;
131
138
  getVideoMessageContentView(
132
139
  message: CometChat.BaseMessage,
133
140
  alignment: MessageBubbleAlignmentType,
134
- theme: CometChatTheme
141
+ theme: CometChatTheme,
142
+ additionalParams?: AdditionalParams
135
143
  ): JSX.Element | null;
136
144
  getImageMessageContentView(
137
145
  message: CometChat.BaseMessage,
138
146
  alignment: MessageBubbleAlignmentType,
139
- theme: CometChatTheme
147
+ theme: CometChatTheme,
148
+ additionalParams?: AdditionalParams
140
149
  ): JSX.Element | null;
141
150
  getFileMessageContentView(
142
151
  message: CometChat.BaseMessage,
143
152
  alignment: MessageBubbleAlignmentType,
144
- theme: CometChatTheme
153
+ theme: CometChatTheme,
154
+ additionalParams?: AdditionalParams
145
155
  ): JSX.Element;
146
156
 
147
157
  //templates
@@ -92,6 +92,11 @@ export class DataSourceDecorator implements DataSource {
92
92
  return this.dataSource.getCommonOptions(loggedInUser, messageObject, theme, group, additionalParams);
93
93
  }
94
94
 
95
+ getDownloadAllOption(theme: CometChatTheme): CometChatMessageOption | undefined {
96
+ // Optional on the DataSource interface (PR review B2) — proxy only if the wrapped source provides it.
97
+ return this.dataSource.getDownloadAllOption?.(theme);
98
+ }
99
+
95
100
  getBottomView(message: CometChat.BaseMessage, alignment: MessageBubbleAlignmentType) {
96
101
  return this.dataSource.getBottomView(message, alignment);
97
102
  }
@@ -177,33 +182,37 @@ export class DataSourceDecorator implements DataSource {
177
182
  getAudioMessageContentView(
178
183
  message: CometChat.BaseMessage,
179
184
  alignment: MessageBubbleAlignmentType,
180
- theme: CometChatTheme
185
+ theme: CometChatTheme,
186
+ additionalParams?: AdditionalParams
181
187
  ) {
182
- return this.dataSource.getAudioMessageContentView(message, alignment, theme);
188
+ return this.dataSource.getAudioMessageContentView(message, alignment, theme, additionalParams);
183
189
  }
184
190
 
185
191
  getVideoMessageContentView(
186
192
  message: CometChat.BaseMessage,
187
193
  alignment: MessageBubbleAlignmentType,
188
- theme: CometChatTheme
194
+ theme: CometChatTheme,
195
+ additionalParams?: AdditionalParams
189
196
  ) {
190
- return this.dataSource.getVideoMessageContentView(message, alignment, theme);
197
+ return this.dataSource.getVideoMessageContentView(message, alignment, theme, additionalParams);
191
198
  }
192
199
 
193
200
  getImageMessageContentView(
194
201
  message: CometChat.BaseMessage,
195
202
  alignment: MessageBubbleAlignmentType,
196
- theme: CometChatTheme
203
+ theme: CometChatTheme,
204
+ additionalParams?: AdditionalParams
197
205
  ) {
198
- return this.dataSource.getImageMessageContentView(message, alignment, theme);
206
+ return this.dataSource.getImageMessageContentView(message, alignment, theme, additionalParams);
199
207
  }
200
208
 
201
209
  getFileMessageContentView(
202
210
  message: CometChat.BaseMessage,
203
211
  alignment: MessageBubbleAlignmentType,
204
- theme: CometChatTheme
212
+ theme: CometChatTheme,
213
+ additionalParams?: AdditionalParams
205
214
  ) {
206
- return this.dataSource.getFileMessageContentView(message, alignment, theme);
215
+ return this.dataSource.getFileMessageContentView(message, alignment, theme, additionalParams);
207
216
  }
208
217
 
209
218
  getTextMessageTemplate(