@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
@@ -560,5 +560,58 @@
560
560
  "ai_smart_replies_empty": "Öneri yok",
561
561
  "ai_conversation_summary_title": "Konuşma Özeti",
562
562
  "ai_conversation_summary_error": "Özet yüklenemedi. Lütfen tekrar deneyin.",
563
- "ai_conversation_summary_empty": "Özet yok"
563
+ "ai_conversation_summary_empty": "Özet yok",
564
+ "THREAD_SUBSCRIPTION_SUBSCRIBE": "Konuya abone ol",
565
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBE": "Konu aboneliğinden çık",
566
+ "THREAD_SUBSCRIPTION_SUBSCRIBED_TOAST": "Abone olundu. Bu konudaki yeni yanıtlar size bildirilecek.",
567
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBED_TOAST": "Abonelikten çıkıldı. Siz yanıtlayana veya sizden bahsedilene kadar bildirimler kapalı.",
568
+ "THREAD_SUBSCRIPTION_SUBSCRIBED": "Abone olundu",
569
+ "THREAD_SUBSCRIPTION_FAILED": "Güncellenemedi. Lütfen tekrar deneyin.",
570
+ "THREAD_UNAVAILABLE": "Bu konuya artık erişiminiz yok.",
571
+ "PIN_MESSAGE": "Mesajı sabitle",
572
+ "UNPIN_MESSAGE": "Mesaj sabitlemesini kaldır",
573
+ "SAVE_MESSAGE": "Mesajı kaydet",
574
+ "UNSAVE_MESSAGE": "Kaydedilenlerden kaldır",
575
+ "PIN_MESSAGE_TITLE": "Mesajı Sabitle",
576
+ "PIN_MESSAGE_CONFIRM": "Bu mesajı bu sohbete sabitlemek istiyor musunuz?",
577
+ "UNPIN_MESSAGE_TITLE": "Mesaj Sabitlemesini Kaldır",
578
+ "UNPIN_MESSAGE_CONFIRM": "Bu mesajın bu sohbetteki sabitlemesini kaldırmak istiyor musunuz?",
579
+ "SAVE_MESSAGE_TITLE": "Mesajı Kaydet",
580
+ "SAVE_MESSAGE_CONFIRM": "Bu mesajı kaydetmek istiyor musunuz?",
581
+ "UNSAVE_MESSAGE_TITLE": "Kaydedilenlerden Kaldır",
582
+ "UNSAVE_MESSAGE_CONFIRM": "Bu mesajı kaydedilen mesajlarınızdan kaldırmak istiyor musunuz?",
583
+ "PIN": "Sabitle",
584
+ "UNPIN": "Sabitlemeyi kaldır",
585
+ "UNSAVE": "Kaydedilenlerden kaldır",
586
+ "MESSAGE_PINNED": "Mesaj sabitlendi",
587
+ "MESSAGE_UNPINNED": "Mesaj sabitlemesi kaldırıldı",
588
+ "MESSAGE_SAVED": "Mesaj kaydedildi",
589
+ "MESSAGE_UNSAVED": "Mesaj kaydedilenlerden kaldırıldı",
590
+ "PINNED": "Sabitlendi",
591
+ "SAVED": "Kaydedildi",
592
+ "SAVED_MESSAGES": "Kaydedilen Mesajlar",
593
+ "PINNED_MESSAGES": "Sabitlenen Mesajlar",
594
+ "PIN_CONVERSATION": "Sabitle",
595
+ "UNPIN_CONVERSATION": "Sabitlemeyi kaldır",
596
+ "CONVERSATION_PINNED": "Sohbet sabitlendi",
597
+ "CONVERSATION_UNPINNED": "Sohbet sabitlemesi kaldırıldı",
598
+ "PIN_CONVERSATION_LIMIT_REACHED": "Yalnızca {limit} sohbeti sabitleyebilirsiniz. Başka birini sabitlemek için birinin sabitlemesini kaldırın.",
599
+ "PIN_CONVERSATION_LIMIT_REACHED_NO_COUNT": "Sabitlenen sohbet sınırınıza ulaştınız. Başka birini sabitlemek için birinin sabitlemesini kaldırın.",
600
+ "CONVERSATION_NOT_PINNABLE": "Bu sohbet henüz sabitlenemiyor.",
601
+ "UNPIN_CONVERSATION_TITLE": "Sohbet Sabitlemesini Kaldır",
602
+ "UNPIN_CONVERSATION_CONFIRM": "Bu sohbeti listenizin en üstünden kaldırmak istiyor musunuz?",
603
+ "NO_SAVED_MESSAGES": "Henüz kaydedilen mesaj yok",
604
+ "NO_SAVED_MESSAGES_SUBTITLE": "İhtiyacınız olduğunda elinizin altında olması için mesajları kaydedin.",
605
+ "BACK": "Geri",
606
+ "NO_PINNED_MESSAGES": "Henüz sabitlenen mesaj yok",
607
+ "NO_PINNED_MESSAGES_SUBTITLE": "Kolayca bulabilmek için önemli mesajları sabitleyin.",
608
+ "PIN_LIMIT_REACHED": "Yalnızca {limit} mesajı sabitleyebilirsiniz. Başka birini sabitlemek için birinin sabitlemesini kaldırın.",
609
+ "SAVE_LIMIT_REACHED": "En fazla {limit} mesaj kaydedebilirsiniz.",
610
+ "PIN_LIMIT_REACHED_NO_COUNT": "Sabitlenen mesaj sınırınıza ulaştınız. Başka birini sabitlemek için birinin sabitlemesini kaldırın.",
611
+ "SAVE_LIMIT_REACHED_NO_COUNT": "Kaydedilen mesaj sınırınıza ulaştınız.",
612
+ "PIN_NOT_ALLOWED": "Burada mesaj sabitleme izniniz yok.",
613
+ "PIN_SAVE_MODERATION_PENDING": "Bu mesaj hâlâ kontrol ediliyor. Birazdan tekrar deneyin.",
614
+ "PIN_SAVE_FEATURE_OFF": "Bu özellik bu uygulama için kullanılamıyor.",
615
+ "PIN_SAVE_GENERIC_ERROR": "Bir şeyler yanlış gitti. Lütfen tekrar deneyin.",
616
+ "MESSAGE_NO_LONGER_AVAILABLE": "Bu mesaj artık kullanılamıyor."
564
617
  }
@@ -560,5 +560,58 @@
560
560
  "ai_smart_replies_empty": "暂无建议",
561
561
  "ai_conversation_summary_title": "对话摘要",
562
562
  "ai_conversation_summary_error": "无法加载摘要,请重试。",
563
- "ai_conversation_summary_empty": "暂无摘要"
563
+ "ai_conversation_summary_empty": "暂无摘要",
564
+ "THREAD_SUBSCRIPTION_SUBSCRIBE": "订阅话题",
565
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBE": "退订话题",
566
+ "THREAD_SUBSCRIPTION_SUBSCRIBED_TOAST": "已订阅。该话题有新回复时将通知你。",
567
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBED_TOAST": "已退订。在你回复或被提及之前,通知将保持关闭。",
568
+ "THREAD_SUBSCRIPTION_SUBSCRIBED": "已订阅",
569
+ "THREAD_SUBSCRIPTION_FAILED": "更新失败。请再试一次。",
570
+ "THREAD_UNAVAILABLE": "你已无法访问此话题。",
571
+ "PIN_MESSAGE": "置顶消息",
572
+ "UNPIN_MESSAGE": "取消置顶消息",
573
+ "SAVE_MESSAGE": "保存消息",
574
+ "UNSAVE_MESSAGE": "从保存中移除",
575
+ "PIN_MESSAGE_TITLE": "置顶消息",
576
+ "PIN_MESSAGE_CONFIRM": "你要将此消息置顶到该对话吗?",
577
+ "UNPIN_MESSAGE_TITLE": "取消置顶消息",
578
+ "UNPIN_MESSAGE_CONFIRM": "你要取消此消息在该对话中的置顶吗?",
579
+ "SAVE_MESSAGE_TITLE": "保存消息",
580
+ "SAVE_MESSAGE_CONFIRM": "你要保存此消息吗?",
581
+ "UNSAVE_MESSAGE_TITLE": "从保存中移除",
582
+ "UNSAVE_MESSAGE_CONFIRM": "你要将此消息从已保存的消息中移除吗?",
583
+ "PIN": "置顶",
584
+ "UNPIN": "取消置顶",
585
+ "UNSAVE": "从保存中移除",
586
+ "MESSAGE_PINNED": "消息已置顶",
587
+ "MESSAGE_UNPINNED": "消息已取消置顶",
588
+ "MESSAGE_SAVED": "消息已保存",
589
+ "MESSAGE_UNSAVED": "消息已从保存中移除",
590
+ "PINNED": "已置顶",
591
+ "SAVED": "已保存",
592
+ "SAVED_MESSAGES": "已保存的消息",
593
+ "PINNED_MESSAGES": "置顶消息",
594
+ "PIN_CONVERSATION": "置顶",
595
+ "UNPIN_CONVERSATION": "取消置顶",
596
+ "CONVERSATION_PINNED": "对话已置顶",
597
+ "CONVERSATION_UNPINNED": "对话已取消置顶",
598
+ "PIN_CONVERSATION_LIMIT_REACHED": "你最多只能置顶 {limit} 个聊天。取消置顶一个后才能置顶另一个。",
599
+ "PIN_CONVERSATION_LIMIT_REACHED_NO_COUNT": "你已达到置顶聊天的上限。取消置顶一个后才能置顶另一个。",
600
+ "CONVERSATION_NOT_PINNABLE": "此对话暂时无法置顶。",
601
+ "UNPIN_CONVERSATION_TITLE": "取消置顶对话",
602
+ "UNPIN_CONVERSATION_CONFIRM": "你要将此对话从列表顶部取消置顶吗?",
603
+ "NO_SAVED_MESSAGES": "还没有已保存的消息",
604
+ "NO_SAVED_MESSAGES_SUBTITLE": "保存消息,以便随时取用。",
605
+ "BACK": "返回",
606
+ "NO_PINNED_MESSAGES": "还没有置顶的消息",
607
+ "NO_PINNED_MESSAGES_SUBTITLE": "置顶重要消息,方便快速找到。",
608
+ "PIN_LIMIT_REACHED": "你最多只能置顶 {limit} 条消息。取消置顶一条后才能置顶另一条。",
609
+ "SAVE_LIMIT_REACHED": "你最多可以保存 {limit} 条消息。",
610
+ "PIN_LIMIT_REACHED_NO_COUNT": "你已达到置顶消息的上限。取消置顶一条后才能置顶另一条。",
611
+ "SAVE_LIMIT_REACHED_NO_COUNT": "你已达到保存消息的上限。",
612
+ "PIN_NOT_ALLOWED": "你没有权限在此置顶消息。",
613
+ "PIN_SAVE_MODERATION_PENDING": "此消息仍在审核中。请稍后再试。",
614
+ "PIN_SAVE_FEATURE_OFF": "此应用无法使用该功能。",
615
+ "PIN_SAVE_GENERIC_ERROR": "出了点问题。请再试一次。",
616
+ "MESSAGE_NO_LONGER_AVAILABLE": "此消息已不可用。"
564
617
  }
@@ -560,5 +560,58 @@
560
560
  "ai_smart_replies_empty": "暫無建議",
561
561
  "ai_conversation_summary_title": "對話摘要",
562
562
  "ai_conversation_summary_error": "無法載入摘要,請重試。",
563
- "ai_conversation_summary_empty": "暫無摘要"
563
+ "ai_conversation_summary_empty": "暫無摘要",
564
+ "THREAD_SUBSCRIPTION_SUBSCRIBE": "訂閱討論串",
565
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBE": "取消訂閱討論串",
566
+ "THREAD_SUBSCRIPTION_SUBSCRIBED_TOAST": "已訂閱。此討論串有新回覆時會通知你。",
567
+ "THREAD_SUBSCRIPTION_UNSUBSCRIBED_TOAST": "已取消訂閱。在你回覆或被提及之前,通知將保持關閉。",
568
+ "THREAD_SUBSCRIPTION_SUBSCRIBED": "已訂閱",
569
+ "THREAD_SUBSCRIPTION_FAILED": "更新失敗。請再試一次。",
570
+ "THREAD_UNAVAILABLE": "你已無法存取此討論串。",
571
+ "PIN_MESSAGE": "釘選訊息",
572
+ "UNPIN_MESSAGE": "取消釘選訊息",
573
+ "SAVE_MESSAGE": "儲存訊息",
574
+ "UNSAVE_MESSAGE": "從已儲存中移除",
575
+ "PIN_MESSAGE_TITLE": "釘選訊息",
576
+ "PIN_MESSAGE_CONFIRM": "你要將此訊息釘選到這個對話嗎?",
577
+ "UNPIN_MESSAGE_TITLE": "取消釘選訊息",
578
+ "UNPIN_MESSAGE_CONFIRM": "你要取消此訊息在這個對話中的釘選嗎?",
579
+ "SAVE_MESSAGE_TITLE": "儲存訊息",
580
+ "SAVE_MESSAGE_CONFIRM": "你要儲存此訊息嗎?",
581
+ "UNSAVE_MESSAGE_TITLE": "從已儲存中移除",
582
+ "UNSAVE_MESSAGE_CONFIRM": "你要將此訊息從已儲存的訊息中移除嗎?",
583
+ "PIN": "釘選",
584
+ "UNPIN": "取消釘選",
585
+ "UNSAVE": "從已儲存中移除",
586
+ "MESSAGE_PINNED": "訊息已釘選",
587
+ "MESSAGE_UNPINNED": "訊息已取消釘選",
588
+ "MESSAGE_SAVED": "訊息已儲存",
589
+ "MESSAGE_UNSAVED": "訊息已從已儲存中移除",
590
+ "PINNED": "已釘選",
591
+ "SAVED": "已儲存",
592
+ "SAVED_MESSAGES": "已儲存的訊息",
593
+ "PINNED_MESSAGES": "釘選的訊息",
594
+ "PIN_CONVERSATION": "釘選",
595
+ "UNPIN_CONVERSATION": "取消釘選",
596
+ "CONVERSATION_PINNED": "對話已釘選",
597
+ "CONVERSATION_UNPINNED": "對話已取消釘選",
598
+ "PIN_CONVERSATION_LIMIT_REACHED": "你最多只能釘選 {limit} 個聊天。取消釘選一個後才能釘選另一個。",
599
+ "PIN_CONVERSATION_LIMIT_REACHED_NO_COUNT": "你已達到釘選聊天的上限。取消釘選一個後才能釘選另一個。",
600
+ "CONVERSATION_NOT_PINNABLE": "此對話暫時無法釘選。",
601
+ "UNPIN_CONVERSATION_TITLE": "取消釘選對話",
602
+ "UNPIN_CONVERSATION_CONFIRM": "你要將此對話從清單頂端取消釘選嗎?",
603
+ "NO_SAVED_MESSAGES": "尚未有已儲存的訊息",
604
+ "NO_SAVED_MESSAGES_SUBTITLE": "儲存訊息,方便隨時取用。",
605
+ "BACK": "返回",
606
+ "NO_PINNED_MESSAGES": "尚未有釘選的訊息",
607
+ "NO_PINNED_MESSAGES_SUBTITLE": "釘選重要訊息,方便快速找到。",
608
+ "PIN_LIMIT_REACHED": "你最多只能釘選 {limit} 則訊息。取消釘選一則後才能釘選另一則。",
609
+ "SAVE_LIMIT_REACHED": "你最多可以儲存 {limit} 則訊息。",
610
+ "PIN_LIMIT_REACHED_NO_COUNT": "你已達到釘選訊息的上限。取消釘選一則後才能釘選另一則。",
611
+ "SAVE_LIMIT_REACHED_NO_COUNT": "你已達到儲存訊息的上限。",
612
+ "PIN_NOT_ALLOWED": "你沒有權限在此釘選訊息。",
613
+ "PIN_SAVE_MODERATION_PENDING": "此訊息仍在審核中。請稍後再試。",
614
+ "PIN_SAVE_FEATURE_OFF": "此應用程式無法使用該功能。",
615
+ "PIN_SAVE_GENERIC_ERROR": "出了什麼問題請再試一次。",
616
+ "MESSAGE_NO_LONGER_AVAILABLE": "此訊息已無法使用。"
564
617
  }
@@ -7,6 +7,8 @@ import { getCometChatTranslation } from "../../resources/CometChatLocalizeNew/Lo
7
7
  import { Icon } from "../../icons/Icon";
8
8
  import { stripMarkdown, preparePreviewText } from "../MarkdownUtils";
9
9
  import { CometChatRichTextFormatter } from "../../formatters/CometChatRichTextFormatter";
10
+ import { CometChatTextFormatter } from "../../formatters/CometChatTextFormatter";
11
+ import { applyRawFormatters } from "../../formatters/applyRawFormatters";
10
12
  import { applyMentionsFormatting } from "../MessageUtils";
11
13
  import { attachmentCountLabel } from "../conversationUtils";
12
14
  import { isViewElement } from "../elementType";
@@ -50,6 +52,10 @@ interface CometChatMessagePreviewProps {
50
52
 
51
53
  // Mentions style override for reply preview context
52
54
  mentionsStyle?: any;
55
+
56
+ // Consumer-supplied formatters. Only `formatRawText` is used here: the preview renders the
57
+ // message's own text, so a consumer's wire token has to be rewritten before it is flattened.
58
+ textFormatters?: Array<CometChatTextFormatter>;
53
59
  }
54
60
 
55
61
  /**
@@ -73,6 +79,7 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
73
79
  titleStyle,
74
80
  isDeletedMessage = false,
75
81
  mentionsStyle,
82
+ textFormatters,
76
83
  } = props;
77
84
 
78
85
  const theme = useTheme();
@@ -122,6 +129,10 @@ const CometChatMessagePreview = (props: CometChatMessagePreviewProps) => {
122
129
  const textMessage = message as CometChat.TextMessage;
123
130
  let text = (typeof textMessage.getText === 'function' ? textMessage.getText() : (textMessage as any).text) || "";
124
131
 
132
+ // A consumer's own wire token first — `preparePreviewText` strips markup it does not
133
+ // recognise, so anything left until after it is gone.
134
+ text = applyRawFormatters(text, textFormatters);
135
+
125
136
  // Prepare text for preview: collapse code blocks, strip block markers, flatten to single line
126
137
  const previewResult = preparePreviewText(text);
127
138
  const cleanText = previewResult.text;
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Utility functions for markdown text processing.
3
3
  */
4
+ import { stripColorTags } from "../formatters/richTextWireFormat";
5
+ import { urlPattern, emailPattern } from "../constants/textPatterns";
4
6
 
5
7
  /**
6
8
  * Strips markdown syntax characters from text, returning clean readable content.
@@ -17,12 +19,38 @@
17
19
  * - Numbered lists: 1. text → text
18
20
  *
19
21
  * @param text - The markdown text to strip
22
+ * @param keepColorTags - Keep the `<color=#rrggbb>…</color>` wire tokens instead of removing
23
+ * them, for sinks that render colour themselves (search previews) rather than plain text.
20
24
  * @returns Clean text without markdown syntax characters
21
25
  */
22
- export function stripMarkdown(text: string): string {
26
+ export function stripMarkdown(text: string, keepColorTags = false): string {
23
27
  if (!text) return text;
24
28
 
25
- let result = text;
29
+ // 0a. Stash URLs before any rule below runs, the same protection
30
+ // CometChatRichTextFormatter got in ENG-38182. Without it, markers that PAIR inside a
31
+ // single URL are eaten and the address silently changes: a search row rendered
32
+ // https://example.com/a__b__c as https://example.com/abc, and /docs/_sources/index_page_
33
+ // as /docs/sources/index_page. The bubble was fixed; every plain-text sink fed by this
34
+ // function — search rows, saved rows, the preview tray, share — was not.
35
+ const protectedUrls: string[] = [];
36
+ let staged = text;
37
+ try {
38
+ const keep = (match: string) => {
39
+ protectedUrls.push(match);
40
+ return `\x00U${protectedUrls.length - 1}\x00`;
41
+ };
42
+ // Emails first — the url pattern matches only an address's domain, leaving the local
43
+ // part's underscores exposed to the markdown rules below.
44
+ staged = text.replace(new RegExp(emailPattern, "gi"), keep);
45
+ staged = staged.replace(new RegExp(urlPattern, "gi"), keep);
46
+ } catch {
47
+ // A bad pattern must not cost the caller their text; fall back to stripping unprotected.
48
+ }
49
+
50
+ // 0b. Remove the rich-text wire format's colour tokens. Not markdown and not HTML, so no
51
+ // rule below matches them — without this they reach every plain-text sink verbatim
52
+ // (share sheet, search subtitles, previews).
53
+ let result = keepColorTags ? staged : stripColorTags(staged);
26
54
 
27
55
  // 1. Remove code block fences (``` on their own lines or inline ```)
28
56
  result = result.replace(/```[\s\S]*?```/g, (match) => {
@@ -63,11 +91,28 @@ export function stripMarkdown(text: string): string {
63
91
  // 10. Strip HTML tags (e.g., <u>, <b>, <i>, <s>, <em>, <strong>, <del>, <br>, etc.)
64
92
  // Preserve CometChat mention tokens <@uid:xxx> and <@all:xxx> which look like HTML tags
65
93
  result = result.replace(/<br\s*\/?>/gi, '\n');
66
- result = result.replace(/<(?!@(?:uid|all):)[^>]+>/g, '');
94
+ // Require something that actually looks like a tag name after the `<`. The old `<[^>]+>` ate any
95
+ // `<`…`>` pair, so ordinary prose lost text: "a < b and c > d" became "a d". Captions and message
96
+ // previews are user text and legitimately contain comparisons and "<3". A tag must now start with
97
+ // a letter (optionally after `/`), which still strips <u>/<b>/<br>/<div class="x">/</strong> and
98
+ // still leaves CometChat's <@uid:…> / <@all:…> mention tokens alone — those start with `@`.
99
+ // `</color>` looks exactly like a closing HTML tag, so it is exempted when the caller asked
100
+ // to keep the colour tokens (`<color=…>` never matches — `=` follows the tag name).
101
+ result = result.replace(
102
+ keepColorTags
103
+ ? /<(?!\/color>)\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s[^>]*)?\/?>/g
104
+ : /<\/?[a-zA-Z][a-zA-Z0-9-]*(?:\s[^>]*)?\/?>/g,
105
+ ''
106
+ );
67
107
 
68
108
  // 11. Remove any remaining backslash escapes (e.g., \* \_ \` \~)
69
109
  result = result.replace(/\\([*_`~>\\])/g, '$1');
70
110
 
111
+ // 12. Put the URLs back exactly as they arrived.
112
+ if (protectedUrls.length) {
113
+ result = result.replace(/\x00U(\d+)\x00/g, (_m, i) => protectedUrls[Number(i)] ?? "");
114
+ }
115
+
71
116
  return result;
72
117
  }
73
118
 
@@ -112,7 +157,10 @@ export function preparePreviewText(text: string): PreviewTextResult {
112
157
  const afterOpen = trimmed.substring(3);
113
158
  const closeIdx = afterOpen.indexOf('```');
114
159
  let firstLine: string;
115
- if (closeIdx > 0) {
160
+ // `>= 0`, not `> 0`: an empty code block (six backticks) closes at offset 0. Treating it as
161
+ // unterminated made the preview scan ON to the next line and show text that is not in the
162
+ // code block at all (ENG-38253).
163
+ if (closeIdx >= 0) {
116
164
  firstLine = afterOpen.substring(0, closeIdx).trim();
117
165
  } else {
118
166
  firstLine = '';
@@ -130,9 +178,12 @@ export function preparePreviewText(text: string): PreviewTextResult {
130
178
  return { text: orderedMatch[2].trim(), isBlockquote: false, codeBlockFirstLine: null, listPrefix: `${orderedMatch[1]}. ` };
131
179
  }
132
180
 
133
- // Bullet list — content only, prefix in listPrefix
181
+ // Bullet list — content only, prefix in listPrefix.
182
+ // The DISPLAY marker, not the markdown source character: the row showed a literal "- " while
183
+ // the message bubble renders the same list with "‧ ". BULLET_MARKER in the rich text formatter
184
+ // is the same glyph, so a preview and its bubble now agree.
134
185
  if (trimmed.startsWith('- ')) {
135
- return { text: trimmed.substring(2).trim(), isBlockquote: false, codeBlockFirstLine: null, listPrefix: '- ' };
186
+ return { text: trimmed.substring(2).trim(), isBlockquote: false, codeBlockFirstLine: null, listPrefix: '‧ ' };
136
187
  }
137
188
 
138
189
  // Plain text — collapse any inline code blocks
@@ -21,7 +21,12 @@ import { deepMerge } from "../helper/helperFunctions";
21
21
  import { CometChatDate } from "../views/CometChatDate";
22
22
  import { CometChatAvatar, CometChatReceipt } from "../views";
23
23
  import { useCometChatTranslation } from "../resources/CometChatLocalizeNew";
24
+ import { getCometChatTranslation } from "../resources/CometChatLocalizeNew/LocalizationManager";
24
25
  import { useTheme } from "../../theme";
26
+ import { isPinned, isSaved } from "./PinSaveHelper";
27
+
28
+ /** Module-scope translator — getStatusInfoView is a plain function, not a component. */
29
+ const translate = getCometChatTranslation();
25
30
 
26
31
  type MessageViewParamsType = {
27
32
  message: CometChat.BaseMessage;
@@ -32,6 +37,13 @@ type MessageViewParamsType = {
32
37
  datePattern?: (message: CometChat.BaseMessage) => string;
33
38
  receiptsVisibility?: boolean;
34
39
  avatarVisibility?: boolean;
40
+ /**
41
+ * Sender-name header inside the bubble. Symmetric with `avatarVisibility`, and
42
+ * exists for the same reason: a surface that already names the sender above the
43
+ * bubble (the pinned/saved panels) would otherwise print it twice on group
44
+ * messages, since both views are group-only.
45
+ */
46
+ headerVisibility?: boolean;
35
47
  };
36
48
 
37
49
  const getOverridenBubbleStyles = (theme: CometChatTheme) => {
@@ -49,14 +61,43 @@ const getOverridenBubbleStyles = (theme: CometChatTheme) => {
49
61
  outgoing: deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.imageBubbleStyles ?? {}),
50
62
  });
51
63
 
64
+ /**
65
+ * File and audio bubbles carry a FIXED containerStyle.height sized to the player
66
+ * alone. CometChatMessageBubble renders the content wrapper with `overflow:
67
+ * hidden`, and the StatusInfoView sits after ContentView inside it — so the fixed
68
+ * height clips the whole meta row away: no pin indicator, no saved indicator, no
69
+ * timestamp, on every audio and file bubble.
70
+ *
71
+ * CometChatMessageList already drops the height for exactly these two types
72
+ * (its own overridenBubbleStyles), which is why the main chat looks right and
73
+ * every surface going through MessageUtils — both pin/save panels and
74
+ * CometChatMessageInformation — did not. Kept in sync deliberately; the two
75
+ * copies of this map are a standing hazard.
76
+ */
77
+ const fileIncoming = deepMerge(incomingBubbleStyles, incomingBubbleStyles.fileBubbleStyles ?? {});
78
+ if (fileIncoming.containerStyle) fileIncoming.containerStyle.height = undefined;
79
+ const fileOutgoing = deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.fileBubbleStyles ?? {});
80
+ if (fileOutgoing.containerStyle) fileOutgoing.containerStyle.height = undefined;
81
+
52
82
  styleCache.set(MessageTypeConstants.file, {
53
- incoming: deepMerge(incomingBubbleStyles, incomingBubbleStyles.fileBubbleStyles ?? {}),
54
- outgoing: deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.fileBubbleStyles ?? {}),
83
+ incoming: fileIncoming,
84
+ outgoing: fileOutgoing,
55
85
  });
56
86
 
87
+ const audioIncoming = deepMerge(
88
+ incomingBubbleStyles,
89
+ incomingBubbleStyles.audioBubbleStyles ?? {}
90
+ );
91
+ if (audioIncoming.containerStyle) audioIncoming.containerStyle.height = undefined;
92
+ const audioOutgoing = deepMerge(
93
+ outgoingBubbleStyles,
94
+ outgoingBubbleStyles.audioBubbleStyles ?? {}
95
+ );
96
+ if (audioOutgoing.containerStyle) audioOutgoing.containerStyle.height = undefined;
97
+
57
98
  styleCache.set(MessageTypeConstants.audio, {
58
- incoming: deepMerge(incomingBubbleStyles, incomingBubbleStyles.audioBubbleStyles ?? {}),
59
- outgoing: deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.audioBubbleStyles ?? {}),
99
+ incoming: audioIncoming,
100
+ outgoing: audioOutgoing,
60
101
  });
61
102
 
62
103
  styleCache.set(MessageTypeConstants.messageDeleted, {
@@ -246,10 +287,41 @@ const getStatusInfoView = (
246
287
  flexDirection: "row",
247
288
  justifyContent: "flex-end",
248
289
  alignSelf: "flex-end",
290
+ // Media bubbles size their content to the attachment, which left this row
291
+ // baseline-misaligned against the glyphs below on an audio/file bubble.
292
+ alignItems: "center",
249
293
  },
250
294
  _style.dateReceiptContainerStyle,
251
295
  ]}
252
296
  >
297
+ {/* Pin & Save indicators (§6.2), before the timestamp in the same meta-row
298
+ slot the message list uses. CometChatMessageList has its OWN copy of this
299
+ view and the indicators were added only there, so every surface rendering
300
+ through MessageUtils — both panels and CometChatMessageInformation —
301
+ silently showed media and text bubbles with no pin/save state at all.
302
+ Icon-only, matching the design, so each needs an accessibilityLabel or a
303
+ screen reader announces nothing (§6.8). Colour comes from the date token so
304
+ the group reads as one piece of metadata rather than as an action. */}
305
+ {isPinned(item) && (
306
+ <View accessible={true} accessibilityLabel={translate("PINNED") ?? "Pinned"}>
307
+ <Icon
308
+ name='keep-fill'
309
+ color={_style.dateStyles?.textStyle?.color}
310
+ height={14}
311
+ width={14}
312
+ />
313
+ </View>
314
+ )}
315
+ {isSaved(item) && (
316
+ <View accessible={true} accessibilityLabel={translate("SAVED") ?? "Saved"}>
317
+ <Icon
318
+ name='bookmark-fill'
319
+ color={_style.dateStyles?.textStyle?.color}
320
+ height={14}
321
+ width={14}
322
+ />
323
+ </View>
324
+ )}
253
325
  <CometChatDate
254
326
  timeStamp={(item.getDeletedAt() || item.getSentAt()) * 1000 || getSentAtTimestamp(item)}
255
327
  pattern={"timeFormat"}
@@ -285,6 +357,7 @@ export const MessageUtils = {
285
357
  datePattern,
286
358
  receiptsVisibility,
287
359
  avatarVisibility,
360
+ headerVisibility = true,
288
361
  } = params;
289
362
  const templatesMap = getTemplatesMap(templates ?? []);
290
363
  const baseStyle = getBubbleStyle(message, theme);
@@ -331,7 +404,9 @@ export const MessageUtils = {
331
404
  : undefined
332
405
  }
333
406
  HeaderView={
334
- message.getReceiverType() === "group" ? getHeaderView(message, theme) : undefined
407
+ headerVisibility && message.getReceiverType() === "group"
408
+ ? getHeaderView(message, theme)
409
+ : undefined
335
410
  }
336
411
  BottomView={
337
412
  DefaultModerationBottomView ||