@cometchat/chat-uikit-react-native 5.4.1 → 5.5.1

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 (105) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/CometChatClipboardModule.kt +34 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +562 -5
  3. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +28 -1
  4. package/ios/CometChatClipboardModule.m +5 -0
  5. package/ios/CometChatClipboardModule.swift +22 -0
  6. package/ios/RichTextEditorView.swift +636 -31
  7. package/ios/RichTextEditorViewManager.m +3 -0
  8. package/ios/RichTextEditorViewManager.swift +24 -0
  9. package/package.json +5 -2
  10. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +283 -64
  11. package/src/CometChatCompactMessageComposer/index.ts +2 -0
  12. package/src/CometChatConversations/CometChatConversations.tsx +299 -15
  13. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +2 -2
  14. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +15 -3
  15. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +181 -12
  16. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +10 -1
  17. package/src/CometChatMessageList/CometChatMessageList.tsx +572 -16
  18. package/src/CometChatMessageList/components/MessageModals.tsx +30 -0
  19. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +21 -9
  20. package/src/CometChatMessageList/components/MessageQuickActions.tsx +162 -0
  21. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +964 -0
  22. package/src/CometChatPinnedMessages/index.ts +5 -0
  23. package/src/CometChatPinnedMessages/style.ts +216 -0
  24. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +5 -0
  25. package/src/CometChatRichTextEditor/index.tsx +31 -1
  26. package/src/CometChatRichTextEditor/types.ts +21 -1
  27. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +871 -0
  28. package/src/CometChatSavedMessages/index.ts +5 -0
  29. package/src/CometChatSavedMessages/style.ts +159 -0
  30. package/src/CometChatSearch/CometChatSearch.tsx +71 -341
  31. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +22 -2
  32. package/src/index.ts +60 -0
  33. package/src/shared/CometChatUiKit/CometChatUIKit.ts +18 -1
  34. package/src/shared/base/Types.ts +5 -0
  35. package/src/shared/constants/UIKitConstants.ts +16 -17
  36. package/src/shared/constants/textPatterns.ts +27 -0
  37. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +25 -225
  38. package/src/shared/events/CometChatUIEventHandler/Listener.ts +37 -0
  39. package/src/shared/events/ListenerInitializer.ts +20 -1
  40. package/src/shared/events/messages.ts +18 -0
  41. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +123 -25
  42. package/src/shared/formatters/CometChatTextFormatter.ts +22 -0
  43. package/src/shared/formatters/applyRawFormatters.ts +31 -0
  44. package/src/shared/formatters/index.ts +14 -0
  45. package/src/shared/formatters/richTextWireFormat.ts +165 -0
  46. package/src/shared/framework/MessageDataSource.tsx +309 -10
  47. package/src/shared/icons/components/thread-follow.tsx +13 -0
  48. package/src/shared/icons/components/thread-unfollow.tsx +13 -0
  49. package/src/shared/icons/components/unsave.tsx +13 -0
  50. package/src/shared/icons/icon-mapping.tsx +6 -0
  51. package/src/shared/index.ts +37 -0
  52. package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +15 -30
  53. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +138 -19
  54. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -1
  55. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +54 -1
  56. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +54 -1
  57. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +54 -1
  58. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +54 -1
  59. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +54 -1
  60. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +54 -1
  61. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +54 -1
  62. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +54 -1
  63. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +54 -1
  64. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +54 -1
  65. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +54 -1
  66. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +54 -1
  67. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +54 -1
  68. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +54 -1
  69. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +54 -1
  70. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +54 -1
  71. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +54 -1
  72. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +11 -0
  73. package/src/shared/utils/MarkdownUtils.ts +57 -6
  74. package/src/shared/utils/MessageUtils.tsx +80 -5
  75. package/src/shared/utils/PinConversationHelper.ts +245 -0
  76. package/src/shared/utils/PinSaveFeatureGates.ts +178 -0
  77. package/src/shared/utils/PinSaveHelper.ts +549 -0
  78. package/src/shared/utils/PinnedMessagesHelper.ts +65 -0
  79. package/src/shared/utils/SavedMessagesHelper.ts +267 -0
  80. package/src/shared/utils/ThreadSubscriptionHelper.ts +427 -0
  81. package/src/shared/utils/__testUtils__/messagesRequestBuilderMock.ts +37 -0
  82. package/src/shared/utils/cloneRequestBuilder.ts +25 -0
  83. package/src/shared/utils/conversationUtils.ts +8 -1
  84. package/src/shared/utils/stripRichText.ts +7 -0
  85. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +32 -0
  86. package/src/shared/views/ClipboardPasteHandler/NativeCometChatClipboardModule.ts +6 -0
  87. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +4 -0
  88. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +5 -0
  89. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +17 -5
  90. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +5 -1
  91. package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +8 -1
  92. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +2 -0
  93. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +91 -20
  94. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +5 -0
  95. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +5 -0
  96. package/src/shared/views/CometChatList/CometChatList.tsx +6 -1
  97. package/src/shared/views/CometChatList/Header.tsx +8 -2
  98. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +4 -0
  99. package/src/shared/views/CometChatRetryButton/CometChatRetryButton.tsx +1 -0
  100. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +4 -0
  101. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +5 -0
  102. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +5 -0
  103. package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +4 -1
  104. package/src/theme/default/default.ts +6 -0
  105. package/src/theme/type.ts +4 -0
@@ -7,6 +7,7 @@ import {
7
7
  CometChatUrlsFormatter,
8
8
  CometChatRichTextFormatter,
9
9
  } from "../..";
10
+ import { applyRawFormatters } from "../formatters/applyRawFormatters";
10
11
  import { CometChatTheme } from "../../theme/type";
11
12
  import {
12
13
  AdditionalAttachmentOptionsParams,
@@ -28,6 +29,11 @@ import { CometChatUiKitConstants } from "../index";
28
29
  import { CometChatMessageComposerAction } from "../helper/types";
29
30
  import { Icon, IconName } from "../icons/Icon";
30
31
  import { getMessagePreviewInternal } from "../utils/MessageUtils";
32
+ import { canPin, isPinned, isPinSaveEligible, isSaved, PinSaveConfig } from "../utils/PinSaveHelper";
33
+ import {
34
+ isThreadSubscribed,
35
+ ThreadSubscriptionConfig,
36
+ } from "../utils/ThreadSubscriptionHelper";
31
37
  import { CometChatMessageOption } from "../modals/CometChatMessageOption";
32
38
  import { CometChatMessageTemplate } from "../modals/CometChatMessageTemplate";
33
39
  import { CometChatConversationUtils, attachmentCountLabel } from "../utils/conversationUtils";
@@ -53,7 +59,8 @@ import { CometChatVideosBubble } from "../views/CometChatVideosBubble";
53
59
  import { CometChatFilesBubble } from "../views/CometChatFilesBubble";
54
60
  import { CometChatAudiosBubble } from "../views/CometChatAudiosBubble";
55
61
  import { CometChatVoiceNoteBubble } from "../views/CometChatVoiceNoteBubble";
56
- import Clipboard from "@react-native-clipboard/clipboard";
62
+ import { ClipboardPasteHandler } from "../views/ClipboardPasteHandler/ClipboardPasteHandler";
63
+ import { stripMarkdown } from "../utils/MarkdownUtils";
57
64
  import { getCometChatTranslation } from "../resources/CometChatLocalizeNew/LocalizationManager";
58
65
 
59
66
  const t = getCometChatTranslation();
@@ -183,7 +190,7 @@ export class MessageDataSource implements DataSource {
183
190
  return <CometChatStreamMessageBubble key={message.getId() + message.getType()} message={message} theme={theme} />;
184
191
  }
185
192
 
186
- handleCopy = (message: CometChat.BaseMessage) => {
193
+ handleCopy = (message: CometChat.BaseMessage, textFormatters?: Array<CometChatTextFormatter>) => {
187
194
  try {
188
195
  let textToCopy = "";
189
196
 
@@ -197,8 +204,10 @@ export class MessageDataSource implements DataSource {
197
204
  messageData.content || "";
198
205
  }
199
206
 
207
+ // Clean plain text for every other app; colour preserved in a private representation
208
+ // that only our own composer reads back on paste.
200
209
  if (textToCopy?.trim()) {
201
- Clipboard.setString(textToCopy);
210
+ ClipboardPasteHandler.copyMessageText(textToCopy, textFormatters);
202
211
  }
203
212
  } catch (err) {
204
213
  console.error(err);
@@ -227,7 +236,7 @@ export class MessageDataSource implements DataSource {
227
236
  options: undefined,
228
237
 
229
238
  FooterView: (message: CometChat.BaseMessage) => (
230
- <TouchableOpacity onPress={() => this.handleCopy(message as CometChat.AIAssistantMessage)}>
239
+ <TouchableOpacity onPress={() => this.handleCopy(message as CometChat.AIAssistantMessage, additionalParams?.textFormatters)}>
231
240
  <Icon name="ai-copy-option" width={24} height={24} containerStyle={styles.aiCopyIcon} color={theme.color.textSecondary} />
232
241
  </TouchableOpacity>
233
242
  ),
@@ -285,6 +294,137 @@ export class MessageDataSource implements DataSource {
285
294
  },
286
295
  };
287
296
  }
297
+ /**
298
+ * Pin / Unpin (§6.1). Two option ids rather than one that flips its title,
299
+ * because a consumer can legitimately hide one and not the other, and because
300
+ * the press handler needs to know which direction it is going without
301
+ * re-deriving state that may have changed since the sheet opened.
302
+ */
303
+ getPinOption(theme: CometChatTheme): CometChatMessageOption {
304
+ return {
305
+ id: MessageOptionConstants.pinMessage,
306
+ title: t("PIN_MESSAGE"),
307
+ icon: (
308
+ <Icon
309
+ name='keep'
310
+ color={
311
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
312
+ }
313
+ height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
314
+ width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
315
+ containerStyle={
316
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
317
+ }
318
+ ></Icon>
319
+ ),
320
+ };
321
+ }
322
+
323
+ getUnpinOption(theme: CometChatTheme): CometChatMessageOption {
324
+ return {
325
+ id: MessageOptionConstants.unpinMessage,
326
+ title: t("UNPIN_MESSAGE"),
327
+ icon: (
328
+ <Icon
329
+ name='keep-off'
330
+ color={
331
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
332
+ }
333
+ height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
334
+ width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
335
+ containerStyle={
336
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
337
+ }
338
+ ></Icon>
339
+ ),
340
+ };
341
+ }
342
+
343
+ /** Save / Unsave (§6.1). No role gate — a save is private to the acting user. */
344
+ getSaveOption(theme: CometChatTheme): CometChatMessageOption {
345
+ return {
346
+ id: MessageOptionConstants.saveMessage,
347
+ title: t("SAVE_MESSAGE"),
348
+ icon: (
349
+ <Icon
350
+ name='bookmark'
351
+ color={
352
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
353
+ }
354
+ height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
355
+ width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
356
+ containerStyle={
357
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
358
+ }
359
+ ></Icon>
360
+ ),
361
+ };
362
+ }
363
+
364
+ getUnsaveOption(theme: CometChatTheme): CometChatMessageOption {
365
+ return {
366
+ id: MessageOptionConstants.unsaveMessage,
367
+ title: t("UNSAVE_MESSAGE"),
368
+ icon: (
369
+ // Bookmark-with-a-cross, the design's own glyph for the unsave ACTION. Distinct from
370
+ // 'bookmark-fill', which stays the saved-STATE indicator beside the timestamp.
371
+ <Icon
372
+ name='unsave'
373
+ color={
374
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
375
+ }
376
+ height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
377
+ width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
378
+ containerStyle={
379
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
380
+ }
381
+ ></Icon>
382
+ ),
383
+ };
384
+ }
385
+
386
+ /**
387
+ * Pushes whichever of the pin/save pair applies to the message's CURRENT state.
388
+ * Shared by getTextMessageOptions and getCommonOptions so every eligible
389
+ * category gets the same four options in the same position — right after the
390
+ * message's own actions and before the destructive ones.
391
+ */
392
+ pushPinSaveOptions(
393
+ optionsList: CometChatMessageOption[],
394
+ loggedInUser: CometChat.User,
395
+ messageObject: CometChat.BaseMessage,
396
+ theme: CometChatTheme,
397
+ group?: CometChat.Group,
398
+ additionalParams?: AdditionalParams
399
+ ): void {
400
+ const pinned = isPinned(messageObject);
401
+ const saved = isSaved(messageObject);
402
+
403
+ if (
404
+ this.validateOption(
405
+ loggedInUser,
406
+ messageObject,
407
+ pinned ? MessageOptionConstants.unpinMessage : MessageOptionConstants.pinMessage,
408
+ group,
409
+ additionalParams
410
+ )
411
+ ) {
412
+ optionsList.push(pinned ? this.getUnpinOption(theme) : this.getPinOption(theme));
413
+ }
414
+
415
+ if (
416
+ this.validateOption(
417
+ loggedInUser,
418
+ messageObject,
419
+ saved ? MessageOptionConstants.unsaveMessage : MessageOptionConstants.saveMessage,
420
+ group,
421
+ additionalParams
422
+ )
423
+ ) {
424
+ optionsList.push(saved ? this.getUnsaveOption(theme) : this.getSaveOption(theme));
425
+ }
426
+ }
427
+
288
428
  getReplyOption(theme: CometChatTheme): CometChatMessageOption {
289
429
  return {
290
430
  id: MessageOptionConstants.replyMessage,
@@ -324,6 +464,41 @@ export class MessageDataSource implements DataSource {
324
464
  };
325
465
  }
326
466
 
467
+ /**
468
+ * Follow / unfollow the thread rooted at this message — "tell me when replies
469
+ * arrive here in future". One option id; the title flips on the current state.
470
+ *
471
+ * Deliberately NOT gated on replyCount: following a message before anyone has
472
+ * answered it is the whole point. Offered on a reply too — inside a thread the
473
+ * user reaches for the same control — and there it targets the PARENT thread,
474
+ * via getThreadIdFor, so no subscription is ever rooted at a reply id.
475
+ */
476
+ getThreadSubscriptionOption(
477
+ theme: CometChatTheme,
478
+ messageObject?: CometChat.BaseMessage
479
+ ): CometChatMessageOption {
480
+ const subscribed = messageObject ? isThreadSubscribed(messageObject) : false;
481
+ return {
482
+ id: MessageOptionConstants.threadSubscription,
483
+ title: subscribed
484
+ ? t("THREAD_SUBSCRIPTION_UNSUBSCRIBE")
485
+ : t("THREAD_SUBSCRIPTION_SUBSCRIBE"),
486
+ icon: (
487
+ <Icon
488
+ name={subscribed ? "notifications-off" : "notifications"}
489
+ color={
490
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
491
+ }
492
+ height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
493
+ width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
494
+ containerStyle={
495
+ theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
496
+ }
497
+ ></Icon>
498
+ ),
499
+ };
500
+ }
501
+
327
502
  getReportOption(theme: CometChatTheme): CometChatMessageOption {
328
503
  return {
329
504
  id: MessageOptionConstants.reportMessage,
@@ -474,6 +649,20 @@ export class MessageDataSource implements DataSource {
474
649
  messageOptionList.push(this.getReplyInThreadOption(theme));
475
650
  }
476
651
 
652
+ // follow / unfollow thread — placed straight after "Reply in thread" so the
653
+ // two thread actions sit together (§6.3, locked so five kits don't diverge)
654
+ if (
655
+ this.validateOption(
656
+ loggedInUser,
657
+ messageObject,
658
+ MessageOptionConstants.threadSubscription,
659
+ group,
660
+ additionalParams
661
+ )
662
+ ) {
663
+ messageOptionList.push(this.getThreadSubscriptionOption(theme, messageObject));
664
+ }
665
+
477
666
  // reply
478
667
  if (
479
668
  this.validateOption(
@@ -576,6 +765,17 @@ export class MessageDataSource implements DataSource {
576
765
  messageOptionList.push(this.getInformationOption(theme));
577
766
  }
578
767
 
768
+ // Before delete: pin/save are non-destructive, so they should not sit below
769
+ // the one option the user must not hit by accident.
770
+ this.pushPinSaveOptions(
771
+ messageOptionList,
772
+ loggedInUser,
773
+ messageObject,
774
+ theme,
775
+ group,
776
+ additionalParams
777
+ );
778
+
579
779
  if (
580
780
  this.validateOption(
581
781
  loggedInUser,
@@ -861,6 +1061,21 @@ export class MessageDataSource implements DataSource {
861
1061
  return true;
862
1062
  }
863
1063
 
1064
+ // Shown on a root message AND on a reply — inside a thread the user reaches for the
1065
+ // same control, so hiding it there is a dead end. On a reply it acts on the PARENT
1066
+ // thread (getThreadIdFor), which is what kept the old gate necessary: the server will
1067
+ // accept a subscription rooted at a reply id and write a /threads row nobody can open,
1068
+ // so the fix is to never send that id, not to hide the option.
1069
+ // NOT gated on replyCount either: following a message before anyone answers is the
1070
+ // entire point. Only the feature gate applies, and it is off until the integrator opts in.
1071
+ if (
1072
+ MessageOptionConstants.threadSubscription === optionId &&
1073
+ ThreadSubscriptionConfig.isEnabled() &&
1074
+ !additionalParams?.hideThreadSubscriptionOption
1075
+ ) {
1076
+ return true;
1077
+ }
1078
+
864
1079
  if (
865
1080
  MessageOptionConstants.shareMessage === optionId &&
866
1081
  (messageObject instanceof CometChat.TextMessage ||
@@ -936,6 +1151,58 @@ export class MessageDataSource implements DataSource {
936
1151
  return true;
937
1152
  }
938
1153
 
1154
+ // Pin / Unpin (§6.1, §6.5). Role-gated via canPin, which is NOT the delete
1155
+ // gate: delete also allows isSentByMe, but a participant may not pin their
1156
+ // own message — pinning is a conversation-wide act on shared state.
1157
+ //
1158
+ // Offered on a thread REPLY too (Q9). Unlike thread subscription there is no
1159
+ // parent-redirect here: a reply is pinned as itself, and the pinned list
1160
+ // returns the parent for context.
1161
+ // isPinSaveEligible gates all four: no server id yet, deleted, or any
1162
+ // moderation verdict. The backend refuses those outright, so offering the
1163
+ // option means walking the user through a confirm modal to earn an error
1164
+ // toast. Applies to save as well as pin — an unsent message has no id to
1165
+ // save against either.
1166
+ if (
1167
+ MessageOptionConstants.pinMessage === optionId &&
1168
+ PinSaveConfig.isPinEnabled() &&
1169
+ isPinSaveEligible(messageObject) &&
1170
+ canPin(loggedInUser, group) &&
1171
+ !additionalParams?.hidePinMessageOption
1172
+ ) {
1173
+ return true;
1174
+ }
1175
+
1176
+ if (
1177
+ MessageOptionConstants.unpinMessage === optionId &&
1178
+ PinSaveConfig.isPinEnabled() &&
1179
+ isPinSaveEligible(messageObject) &&
1180
+ canPin(loggedInUser, group) &&
1181
+ !additionalParams?.hideUnpinMessageOption
1182
+ ) {
1183
+ return true;
1184
+ }
1185
+
1186
+ // Save / Unsave (§6.1). No role gate at all — the save is private to this
1187
+ // user, so there is no shared state for a scope to protect.
1188
+ if (
1189
+ MessageOptionConstants.saveMessage === optionId &&
1190
+ PinSaveConfig.isSaveEnabled() &&
1191
+ isPinSaveEligible(messageObject) &&
1192
+ !additionalParams?.hideSaveMessageOption
1193
+ ) {
1194
+ return true;
1195
+ }
1196
+
1197
+ if (
1198
+ MessageOptionConstants.unsaveMessage === optionId &&
1199
+ PinSaveConfig.isSaveEnabled() &&
1200
+ isPinSaveEligible(messageObject) &&
1201
+ !additionalParams?.hideUnsaveMessageOption
1202
+ ) {
1203
+ return true;
1204
+ }
1205
+
939
1206
  return false;
940
1207
  }
941
1208
 
@@ -973,6 +1240,19 @@ export class MessageDataSource implements DataSource {
973
1240
  messageOptionList.push(this.getReplyInThreadOption(theme));
974
1241
  }
975
1242
 
1243
+ // follow / unfollow thread — same placement as the other assembler (§6.3)
1244
+ if (
1245
+ this.validateOption(
1246
+ loggedInUser,
1247
+ messageObject,
1248
+ MessageOptionConstants.threadSubscription,
1249
+ group,
1250
+ additionalParams
1251
+ )
1252
+ ) {
1253
+ messageOptionList.push(this.getThreadSubscriptionOption(theme, messageObject));
1254
+ }
1255
+
976
1256
  if (
977
1257
  this.validateOption(
978
1258
  loggedInUser,
@@ -997,6 +1277,16 @@ export class MessageDataSource implements DataSource {
997
1277
  messageOptionList.push(this.getInformationOption(theme));
998
1278
  }
999
1279
 
1280
+ // Same position as in getTextMessageOptions — above the destructive actions.
1281
+ this.pushPinSaveOptions(
1282
+ messageOptionList,
1283
+ loggedInUser,
1284
+ messageObject,
1285
+ theme,
1286
+ group,
1287
+ additionalParams
1288
+ );
1289
+
1000
1290
  if (
1001
1291
  this.validateOption(
1002
1292
  loggedInUser,
@@ -1242,6 +1532,7 @@ export class MessageDataSource implements DataSource {
1242
1532
  <CometChatMessagePreview
1243
1533
  message={hasQuotedMessage}
1244
1534
  theme={replyTheme}
1535
+ textFormatters={additionalParams?.textFormatters}
1245
1536
  style={{
1246
1537
  backgroundColor: isOutgoingMessage ? theme.color.extendedPrimary800 : theme.color.neutral400,
1247
1538
  borderRadius: 8,
@@ -1322,6 +1613,10 @@ export class MessageDataSource implements DataSource {
1322
1613
  let loggedInUser = CometChatUIKit.loggedInUser;
1323
1614
  let mentionedUsers = message.getMentionedUsers();
1324
1615
  let textFormatters = [...(additionalParams?.textFormatters || [])];
1616
+ // A consumer's own wire token becomes UI Kit markup here, before markdown, mentions or
1617
+ // links parse the text — once the rich-text formatter has built elements out of it, a
1618
+ // pattern that spans any of that markup can no longer be matched.
1619
+ messageText = applyRawFormatters(messageText, textFormatters);
1325
1620
  const isMessageSentByLoggedInUser = message.getSender()?.getUid() === loggedInUser?.getUid();
1326
1621
  const _style: Partial<CometChatTheme["textBubbleStyles"]> = isMessageSentByLoggedInUser
1327
1622
  ? (theme.messageListStyles.outgoingMessageBubbleStyles
@@ -1643,12 +1938,12 @@ export class MessageDataSource implements DataSource {
1643
1938
  const audioType = (message.getMetadata?.() as Record<string, any> | undefined)?.audioType;
1644
1939
  if (audioType !== "voice_note") {
1645
1940
  // shared/picked audio file(s) → headphone + filename cards
1646
- return <CometChatAudiosBubble message={message} theme={theme} />;
1941
+ return <CometChatAudiosBubble message={message} theme={theme} additionalParams={additionalParams} />;
1647
1942
  }
1648
1943
  // DD §8.1a — recorded voice note → waveform: a STACK (2+) uses CometChatVoiceNoteBubble; a SINGLE
1649
1944
  // recording (the usual case — voice notes are recorded one at a time) uses the single-audio bubble.
1650
1945
  if (isGalleryMessage(message)) {
1651
- return <CometChatVoiceNoteBubble message={message} theme={theme} />;
1946
+ return <CometChatVoiceNoteBubble message={message} theme={theme} additionalParams={additionalParams} />;
1652
1947
  }
1653
1948
  const attachment = message.getAttachment();
1654
1949
  return ChatConfigurator.dataSource.getAudioMessageBubble(
@@ -1675,7 +1970,7 @@ export class MessageDataSource implements DataSource {
1675
1970
  // A VIDEO message ALWAYS renders the video grid — no fallback to a file list. Any attachment that
1676
1971
  // isn't a video (image / audio / file) shows a "no preview" placeholder cell inside the grid, and
1677
1972
  // a "No preview available" fullscreen on tap (see CometChatVideosBubble + CometChatMediaViewer).
1678
- return <CometChatVideosBubble message={message} theme={theme} />;
1973
+ return <CometChatVideosBubble message={message} theme={theme} additionalParams={additionalParams} />;
1679
1974
  }
1680
1975
  getImageMessageContentView(
1681
1976
  message: CometChat.MediaMessage,
@@ -1694,7 +1989,7 @@ export class MessageDataSource implements DataSource {
1694
1989
  // An IMAGE message ALWAYS renders the image grid — no fallback to a file list. Any attachment that
1695
1990
  // can't be previewed (unsupported format / load error) shows a "no preview" placeholder cell inside
1696
1991
  // the grid instead (see CometChatImagesBubble's ImageCell).
1697
- return <CometChatImagesBubble message={message} theme={theme} />;
1992
+ return <CometChatImagesBubble message={message} theme={theme} additionalParams={additionalParams} />;
1698
1993
  }
1699
1994
  getFileMessageContentView(
1700
1995
  message: CometChat.MediaMessage,
@@ -1710,7 +2005,7 @@ export class MessageDataSource implements DataSource {
1710
2005
  );
1711
2006
  }
1712
2007
  // DD §9 (flag=true, default): the new FilesBubble renders 1..N — including a single file.
1713
- return <CometChatFilesBubble message={message} theme={theme} />;
2008
+ return <CometChatFilesBubble message={message} theme={theme} additionalParams={additionalParams} />;
1714
2009
  }
1715
2010
 
1716
2011
  getTextMessageTemplate(
@@ -2451,7 +2746,11 @@ export class MessageDataSource implements DataSource {
2451
2746
  const count = isBatch ? batchTotalCount : (lastMessage.getAttachments?.() ?? []).length;
2452
2747
  if (count > 1) {
2453
2748
  const { icon, label } = kindPreview(lastMessage.getType(), count);
2454
- const caption = (lastMessage.getCaption?.() ?? '').trim();
2749
+ // Captions carry the same wire markup a text message does, and this branch returns a
2750
+ // JSX element — so the conversation list's own stripMarkdown pass, which only runs for
2751
+ // string subtitles, never sees it. Strip here or `<color=…>`/`**bold**` render verbatim
2752
+ // in the row (ENG-38258).
2753
+ const caption = stripMarkdown((lastMessage.getCaption?.() ?? '').trim()).trim();
2455
2754
  return getMessagePreviewInternal(icon, caption ? `${label} · ${caption}` : label, { theme });
2456
2755
  }
2457
2756
  }
@@ -0,0 +1,13 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import type { SvgProps } from "react-native-svg";
3
+ // Followed state for the thread subscription control. Design's own 19x23 artboard, kept as the
4
+ // viewBox so the glyph is not re-scaled; `color` replaces the exported fill.
5
+ const SvgComponent = ({ height, width, color }: SvgProps) => (
6
+ <Svg width={width} height={height} fill='none' viewBox='0 0 19 23'>
7
+ <Path
8
+ fill={color}
9
+ d='M0.91875 19.4833C0.659556 19.4833 0.441583 19.3948 0.264833 19.2176C0.0882778 19.0403 0 18.8215 0 18.5614C0 18.301 0.0882778 18.0818 0.264833 17.9037C0.441583 17.7254 0.659556 17.6362 0.91875 17.6362H2.23621V9.17788C2.23621 7.55757 2.72057 6.10731 3.68929 4.82708C4.65801 3.54706 5.92521 2.72718 7.49088 2.36746V1.71033C7.49088 1.2353 7.65703 0.831541 7.98933 0.499041C8.32164 0.166347 8.72511 0 9.19975 0C9.67439 0 10.0786 0.166347 10.4125 0.499041C10.7464 0.831541 10.9133 1.2353 10.9133 1.71033V2.36746C12.4817 2.72718 13.7512 3.54706 14.7219 4.82708C15.6925 6.10731 16.1779 7.55757 16.1779 9.17788V17.6362H17.4904C17.7435 17.6362 17.9607 17.7264 18.142 17.9069C18.3232 18.0875 18.4138 18.3079 18.4138 18.5681C18.4138 18.8283 18.3239 19.0458 18.144 19.2208C17.9641 19.3958 17.7446 19.4833 17.4854 19.4833H0.91875ZM9.20208 22.9008C8.57014 22.9008 8.02978 22.6764 7.581 22.2276C7.13203 21.7787 6.90754 21.2382 6.90754 20.6063H11.4966C11.4966 21.2382 11.2721 21.7787 10.8232 22.2276C10.3744 22.6764 9.83403 22.9008 9.20208 22.9008ZM4.08333 17.6362H14.3305V9.17788C14.3305 7.76057 13.8294 6.55307 12.8272 5.55537C11.825 4.55787 10.6155 4.05912 9.19858 4.05912C7.78147 4.05912 6.57465 4.55787 5.57813 5.55537C4.5816 6.55307 4.08333 7.76057 4.08333 9.17788V17.6362Z'
10
+ />
11
+ </Svg>
12
+ );
13
+ export default SvgComponent;
@@ -0,0 +1,13 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import type { SvgProps } from "react-native-svg";
3
+ // Un-followed state for the thread subscription control — the slash reads as "no reply
4
+ // notifications". 22x23 artboard (wider than thread-follow, the slash overhangs).
5
+ const SvgComponent = ({ height, width, color }: SvgProps) => (
6
+ <Svg width={width} height={height} fill='none' viewBox='0 0 22 23'>
7
+ <Path
8
+ fill={color}
9
+ d='M16.8487 19.4833H3.12083C2.85833 19.4833 2.63958 19.3958 2.46458 19.2208C2.28958 19.0458 2.20208 18.8271 2.20208 18.5646C2.20208 18.3021 2.28958 18.0818 2.46458 17.9037C2.63958 17.7254 2.85833 17.6362 3.12083 17.6362H4.43829V9.17788C4.43829 8.52979 4.5185 7.89221 4.67892 7.26512C4.83933 6.63804 5.09124 6.04255 5.43463 5.47867L6.81538 6.85912C6.64038 7.22215 6.50825 7.59908 6.419 7.98992C6.32994 8.38075 6.28542 8.77674 6.28542 9.17788V17.6362H15.0596L0.277083 2.89246C0.0923611 2.71415 0 2.50269 0 2.25808C0 2.01347 0.0907084 1.79715 0.272125 1.60912C0.453736 1.4211 0.667625 1.32631 0.913792 1.32475C1.16015 1.32319 1.37735 1.41312 1.56538 1.59454L21.2558 21.3045C21.4353 21.484 21.5242 21.6976 21.5227 21.9453C21.5209 22.193 21.4325 22.4078 21.2575 22.5896C21.073 22.7679 20.8576 22.857 20.6112 22.857C20.3648 22.857 20.1525 22.7679 19.9742 22.5896L16.8487 19.4833ZM13.1154 2.36746C14.6935 2.71415 15.9654 3.53043 16.9313 4.81629C17.8971 6.10215 18.38 7.55601 18.38 9.17788V13.5529C18.38 13.8624 18.2846 14.0946 18.0938 14.2494C17.9033 14.404 17.6918 14.4813 17.4595 14.4813C17.2273 14.4813 17.0148 14.4045 16.8219 14.2511C16.629 14.0975 16.5325 13.8664 16.5325 13.5578V9.17788C16.5325 7.76057 16.0317 6.55307 15.0299 5.55537C14.0279 4.55787 12.8193 4.05912 11.4042 4.05912C10.9245 4.05912 10.4586 4.12475 10.0065 4.256C9.55442 4.38725 9.13238 4.57605 8.74038 4.82242C8.49071 4.97797 8.22335 5.04437 7.93829 5.02162C7.65304 4.99887 7.42292 4.87482 7.24792 4.64946C7.08595 4.45365 7.00817 4.24151 7.01458 4.01304C7.021 3.78457 7.12474 3.59576 7.32579 3.44662C7.67677 3.19715 8.05127 2.98005 8.44929 2.79533C8.84752 2.61061 9.26207 2.46731 9.69296 2.36542V1.70946C9.69296 1.23501 9.85911 0.831541 10.1914 0.499041C10.5237 0.166347 10.9272 0 11.4018 0C11.8765 0 12.2807 0.166347 12.6146 0.499041C12.9484 0.831541 13.1154 1.2353 13.1154 1.71033V2.36746ZM11.4024 22.9008C10.8169 22.9008 10.299 22.733 9.84871 22.3974C9.39818 22.0618 9.17292 21.6159 9.17292 21.0598C9.17292 20.926 9.21929 20.817 9.31204 20.7328C9.40479 20.6484 9.52311 20.6063 9.667 20.6063H13.1513C13.286 20.6063 13.402 20.6484 13.4992 20.7328C13.5964 20.817 13.645 20.926 13.645 21.0598C13.645 21.6159 13.4176 22.0618 12.9628 22.3974C12.508 22.733 11.9879 22.9008 11.4024 22.9008Z'
10
+ />
11
+ </Svg>
12
+ );
13
+ export default SvgComponent;
@@ -0,0 +1,13 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import type { SvgProps } from "react-native-svg";
3
+ // Unsave — a bookmark with a cross. The design's own 16x17 artboard, kept as the viewBox so the
4
+ // glyph is not re-scaled; `color` replaces the exported #252B37 fill so it follows the theme.
5
+ const SvgComponent = ({ height, width, color }: SvgProps) => (
6
+ <Svg width={width} height={height} fill='none' viewBox='0 0 16 17'>
7
+ <Path
8
+ fill={color}
9
+ d='M6.871 14.8L2.2125 16.7875C1.682 17.0152 1.18067 16.9733 0.7085 16.6618C0.236167 16.3501 0 15.9058 0 15.329V1.58325C0 1.15608 0.157167 0.785418 0.4715 0.471251C0.785667 0.157084 1.15633 0 1.5835 0H7.6125C7.82833 0 8.01358 0.0775833 8.16825 0.23275C8.32275 0.38775 8.4 0.573584 8.4 0.790251C8.4 1.01342 8.32275 1.20133 8.16825 1.354C8.01358 1.50683 7.82833 1.58325 7.6125 1.58325H1.5835V15.3333L6.86675 13.0805L12.15 15.3333V8.2875C12.15 8.07167 12.2274 7.88642 12.3823 7.73175C12.5369 7.57725 12.7244 7.5 12.9448 7.5C13.1649 7.5 13.3514 7.57725 13.5043 7.73175C13.6571 7.88642 13.7335 8.07167 13.7335 8.2875V15.329C13.7335 15.9058 13.4973 16.3501 13.025 16.6618C12.5528 16.9733 12.0542 17.0152 11.5293 16.7875L6.871 14.8ZM6.86675 1.58325H1.5835H8.4H6.86675ZM11.822 2.95825L10.8528 1.98898C10.6957 1.83189 10.6174 1.64409 10.6178 1.4256C10.6182 1.20722 10.6963 1.02013 10.8521 0.86433C11.0078 0.708649 11.1941 0.63128 11.4112 0.632222C11.6283 0.633165 11.8154 0.712185 11.9725 0.869281L12.9418 1.83855L13.9169 0.863447C14.0695 0.71083 14.2552 0.63458 14.4741 0.634698C14.6927 0.634816 14.8799 0.712774 15.0357 0.868573C15.1914 1.02425 15.2686 1.21075 15.2674 1.42807C15.2661 1.64551 15.1892 1.83053 15.0366 1.98315L14.0615 2.95825L15.0366 3.93335C15.1892 4.08597 15.2653 4.27182 15.2649 4.4909C15.2645 4.70987 15.1876 4.89596 15.0344 5.04917C14.8767 5.20685 14.6892 5.2851 14.4719 5.28392C14.2545 5.28263 14.0695 5.20567 13.9169 5.05305L12.9418 4.07795L11.9725 5.04722C11.8154 5.20432 11.6275 5.28251 11.4087 5.2818C11.19 5.2811 11.004 5.20414 10.8508 5.05093C10.6931 4.89325 10.6148 4.70586 10.6157 4.48878C10.6167 4.2717 10.6957 4.08461 10.8528 3.92752L11.822 2.95825Z'
10
+ />
11
+ </Svg>
12
+ );
13
+ export default SvgComponent;
@@ -268,6 +268,8 @@ import rightArrow from "./components/right-arrow";
268
268
  import Sunny from "./components/sunny";
269
269
  import SunnyFill from "./components/sunny-fill";
270
270
  import Symbols from "./components/symbols";
271
+ import ThreadFollow from "./components/thread-follow";
272
+ import ThreadUnfollow from "./components/thread-unfollow";
271
273
  import ThumbDown from "./components/thumb-down";
272
274
  import ThumbDownFill from "./components/thumb-down-fill";
273
275
  import ThumbUp from "./components/thumb-up";
@@ -322,6 +324,7 @@ import AIChatHistory from "./components/ai-chat-history";
322
324
  import AICopyOption from "./components/ai-copy-option";
323
325
  import EmptySearch from "./components/empty-search";
324
326
  import Unread from "./components/unread";
327
+ import Unsave from "./components/unsave";
325
328
  import DocumentIcon from "./components/documents";
326
329
 
327
330
  import MessageBlocked from "./components/message-blocked";
@@ -588,6 +591,8 @@ export const ICONS = {
588
591
  "right-arrow": rightArrow,
589
592
  sunny: Sunny,
590
593
  "sunny-fill": SunnyFill,
594
+ "thread-follow": ThreadFollow,
595
+ "thread-unfollow": ThreadUnfollow,
591
596
  "thumb-down": ThumbDown,
592
597
  "thumb-down-fill": ThumbDownFill,
593
598
  "thumb-up": ThumbUp,
@@ -657,6 +662,7 @@ export const ICONS = {
657
662
 
658
663
  "empty-search": EmptySearch,
659
664
  "unread":Unread,
665
+ unsave: Unsave,
660
666
  "documents":DocumentIcon,
661
667
  "message-blocked": MessageBlocked,
662
668
 
@@ -146,6 +146,43 @@ export { CometChatUIKit, CometChatUIKitHelper, UIKitSettings } from "./CometChat
146
146
  export type { CometChatMessageComposerAction } from "./helper/types";
147
147
 
148
148
  export { messageStatus } from "./utils/CometChatMessageHelper/index";
149
+ export {
150
+ ThreadSubscriptionConfig,
151
+ applyIncomingReply,
152
+ applyEditedMessage,
153
+ applySentMessage,
154
+ applyOwnIncomingMessage,
155
+ isThreadSubscribed,
156
+ stampThreadSubscribed,
157
+ toggleThreadSubscription,
158
+ } from "./utils/ThreadSubscriptionHelper";
159
+
160
+ /**
161
+ * Pin & Save. PinSaveConfig is the opt-in gate and MUST be exported — without it
162
+ * the feature is unreachable and therefore permanently off for every integrator.
163
+ * The read helpers come too, so a custom bubble can render its own indicator
164
+ * without re-deriving "presence is the boolean" and getting it wrong.
165
+ */
166
+ export {
167
+ PinConversationConfig,
168
+ isConversationPinned,
169
+ isSystemPinnedConversation,
170
+ } from "./utils/PinConversationHelper";
171
+ export {
172
+ resolvePinSaveFeatures,
173
+ refreshPinSaveFeatures,
174
+ getPinSaveFeatures,
175
+ resetPinSaveFeatures,
176
+ PIN_SAVE_FEATURES_DISABLED,
177
+ } from "./utils/PinSaveFeatureGates";
178
+
179
+ export {
180
+ PinSaveConfig,
181
+ isPinned,
182
+ isSaved,
183
+ isSystemPin,
184
+ SYSTEM_PINNER,
185
+ } from "./utils/PinSaveHelper";
149
186
 
150
187
  export { getCometChatTranslation, getCurrentLanguage} from "./resources/CometChatLocalizeNew/LocalizationManager";
151
188
  export { useLocalizedDate } from "./helper/useLocalizedDateHook";