@ethora/chat-component-rn 26.5.11 → 26.5.12

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 (135) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -0
  3. package/lib/commonjs/assets/icons.js +7 -1
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/MainComponents/ChatRoom.js +17 -1
  6. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/MediaMessage.js +288 -5
  8. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  9. package/lib/commonjs/components/MessageBubble/MessageInteractions.js +23 -3
  10. package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
  11. package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js +5 -44
  12. package/lib/commonjs/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -1
  13. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +36 -3
  14. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  15. package/lib/commonjs/components/Modals/FilePreviewModal/GViewWebView.js +149 -0
  16. package/lib/commonjs/components/Modals/FilePreviewModal/GViewWebView.js.map +1 -0
  17. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -17
  18. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  19. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +19 -33
  20. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  21. package/lib/commonjs/components/styled/AudioMessage.js +643 -66
  22. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  23. package/lib/commonjs/components/styled/Button.js +9 -3
  24. package/lib/commonjs/components/styled/Button.js.map +1 -1
  25. package/lib/commonjs/components/styled/SendInput.js +239 -40
  26. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  27. package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js +31 -18
  28. package/lib/commonjs/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
  29. package/lib/commonjs/components/styled/UnsupportedType.js +47 -5
  30. package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
  31. package/lib/commonjs/context/xmppProvider.js +5 -2
  32. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  33. package/lib/commonjs/helpers/keyboardLayout.js +5 -3
  34. package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
  35. package/lib/commonjs/helpers/mimeToExtension.js +70 -3
  36. package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
  37. package/lib/commonjs/hooks/useEventHandlers.js +1 -1
  38. package/lib/commonjs/hooks/useEventHandlers.js.map +1 -1
  39. package/lib/commonjs/hooks/useSendMessage.js +6 -3
  40. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  41. package/lib/commonjs/roomStore/roomsSlice.js +6 -0
  42. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  43. package/lib/module/assets/icons.js +7 -1
  44. package/lib/module/assets/icons.js.map +1 -1
  45. package/lib/module/components/MainComponents/ChatRoom.js +18 -2
  46. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  47. package/lib/module/components/MainComponents/MediaMessage.js +290 -7
  48. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  49. package/lib/module/components/MessageBubble/MessageInteractions.js +24 -4
  50. package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
  51. package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js +5 -45
  52. package/lib/module/components/Modals/FilePreviewModal/DocumentViewer.js.map +1 -1
  53. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +36 -3
  54. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  55. package/lib/module/components/Modals/FilePreviewModal/GViewWebView.js +144 -0
  56. package/lib/module/components/Modals/FilePreviewModal/GViewWebView.js.map +1 -0
  57. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +3 -17
  58. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  59. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +20 -34
  60. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  61. package/lib/module/components/styled/AudioMessage.js +644 -67
  62. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  63. package/lib/module/components/styled/Button.js +9 -3
  64. package/lib/module/components/styled/Button.js.map +1 -1
  65. package/lib/module/components/styled/SendInput.js +240 -42
  66. package/lib/module/components/styled/SendInput.js.map +1 -1
  67. package/lib/module/components/styled/StyledInputComponents/MediaComponents.js +31 -18
  68. package/lib/module/components/styled/StyledInputComponents/MediaComponents.js.map +1 -1
  69. package/lib/module/components/styled/UnsupportedType.js +47 -5
  70. package/lib/module/components/styled/UnsupportedType.js.map +1 -1
  71. package/lib/module/context/xmppProvider.js +5 -2
  72. package/lib/module/context/xmppProvider.js.map +1 -1
  73. package/lib/module/helpers/keyboardLayout.js +4 -2
  74. package/lib/module/helpers/keyboardLayout.js.map +1 -1
  75. package/lib/module/helpers/mimeToExtension.js +67 -3
  76. package/lib/module/helpers/mimeToExtension.js.map +1 -1
  77. package/lib/module/hooks/useEventHandlers.js +1 -1
  78. package/lib/module/hooks/useEventHandlers.js.map +1 -1
  79. package/lib/module/hooks/useSendMessage.js +6 -3
  80. package/lib/module/hooks/useSendMessage.js.map +1 -1
  81. package/lib/module/roomStore/roomsSlice.js +6 -0
  82. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  83. package/lib/typescript/assets/icons.d.ts.map +1 -1
  84. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  85. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  86. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
  87. package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts +0 -7
  88. package/lib/typescript/components/Modals/FilePreviewModal/DocumentViewer.d.ts.map +1 -1
  89. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  90. package/lib/typescript/components/Modals/FilePreviewModal/GViewWebView.d.ts +8 -0
  91. package/lib/typescript/components/Modals/FilePreviewModal/GViewWebView.d.ts.map +1 -0
  92. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  93. package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
  94. package/lib/typescript/components/styled/AudioMessage.d.ts +8 -2
  95. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  96. package/lib/typescript/components/styled/Button.d.ts.map +1 -1
  97. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  98. package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts +5 -1
  99. package/lib/typescript/components/styled/StyledInputComponents/MediaComponents.d.ts.map +1 -1
  100. package/lib/typescript/components/styled/UnsupportedType.d.ts +5 -0
  101. package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
  102. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  103. package/lib/typescript/helpers/keyboardLayout.d.ts +3 -1
  104. package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
  105. package/lib/typescript/helpers/mimeToExtension.d.ts +31 -1
  106. package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
  107. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  108. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  109. package/lib/typescript/types/models/modal.model.d.ts +3 -0
  110. package/lib/typescript/types/models/modal.model.d.ts.map +1 -1
  111. package/lib/typescript/types/types.d.ts +13 -0
  112. package/lib/typescript/types/types.d.ts.map +1 -1
  113. package/package.json +5 -1
  114. package/src/assets/icons.tsx +30 -25
  115. package/src/components/MainComponents/ChatRoom.tsx +21 -0
  116. package/src/components/MainComponents/MediaMessage.tsx +295 -5
  117. package/src/components/MessageBubble/MessageInteractions.tsx +35 -3
  118. package/src/components/Modals/FilePreviewModal/DocumentViewer.tsx +3 -40
  119. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +39 -3
  120. package/src/components/Modals/FilePreviewModal/GViewWebView.tsx +142 -0
  121. package/src/components/Modals/FilePreviewModal/PdfView.tsx +2 -18
  122. package/src/components/RoomComponents/styled/LastAudioMessage.tsx +20 -35
  123. package/src/components/styled/AudioMessage.tsx +724 -59
  124. package/src/components/styled/Button.tsx +20 -11
  125. package/src/components/styled/SendInput.tsx +255 -46
  126. package/src/components/styled/StyledInputComponents/MediaComponents.tsx +29 -18
  127. package/src/components/styled/UnsupportedType.tsx +60 -6
  128. package/src/context/xmppProvider.tsx +6 -2
  129. package/src/helpers/keyboardLayout.ts +5 -1
  130. package/src/helpers/mimeToExtension.ts +116 -2
  131. package/src/hooks/useEventHandlers.tsx +1 -1
  132. package/src/hooks/useSendMessage.tsx +12 -6
  133. package/src/roomStore/roomsSlice.ts +7 -0
  134. package/src/types/models/modal.model.ts +3 -0
  135. package/src/types/types.ts +13 -0
package/CHANGELOG.md CHANGED
@@ -76,6 +76,12 @@ Lifecycle hardening on top of 26.5.9, driven by live on-device testing: a full r
76
76
  - **White text.** The label sits on a dark pill but rendered in the (often blue) primary color — unreadable. It's now white.
77
77
  - **Removed when you leave the chat** (tab switch / navigation / app background) and **spliced out rather than tombstoned**, so it correctly re-appears for the next batch of unread — previously it was a one-shot (the tombstone blocked every future divider).
78
78
 
79
+ #### Voice messages (new — opt-in, matches the web UX)
80
+
81
+ - **Tap-to-record voice messages from the input bar.** Behind a new opt-in `config.enableAudio: true` (default off — set `true` to enable). The right-side action button swaps between **mic** (when input is empty) and **send** (when there's text or attachments) — same single-button pattern as the web app. Tap the mic → recording overlay with a live timer + cancel + stop&send. Recording uses `expo-av`'s `Audio.Recording` (HIGH_QUALITY preset: AAC in an M4A container on both iOS and Android), and on stop ships through the same `sendMedia` pipeline with `mimetype: "audio/m4a"` and `filename: "voice-<timestamp>.m4a"`. Receivers route it through `MediaMessage`'s audio branch directly.
82
+ - **Incoming audio always plays** — independent of `enableAudio`. The 26.5.10 `isLikelyAudio` heuristic still catches octet-stream voicemails coming from older web senders.
83
+ - **iOS apps need `NSMicrophoneUsageDescription`** in `Info.plist`. The bundled `expo-av` plugin block in `app.json` adds it on `expo prebuild`; standalone apps should configure it the same way.
84
+
79
85
  #### Customer-reported bugs (this round)
80
86
 
81
87
  - **#19 — `useUnread()` always 0 in tab-mounted hosts.** `ChatRoom`'s visibility effect had `client` in its dep array, so any `client` identity change (reconnect, provider re-render) re-fired setup → `dispatch(setVisibleRoom(activeRoomJID))` ~one tick after the host cleared visibility via the `isVisible` prop on `<Chat>`, clobbering it. Effect now splits setup (deps without `client`) from cleanup (reads client through a ref). `<Chat isVisible={...} />` now works as documented.
package/README.md CHANGED
@@ -280,6 +280,7 @@ Why awaitable: the persistence layer debounces writes by 200 ms, and the chat sl
280
280
  | `disableChatInfo.disableChatHeaderMenu` | Disables the **chat-info modal entry point** in the header (tapping the chat title / icon). Use this when you want the header purely informational. The chat-info modal itself has further granular flags (`disableDescription`, `disableType`, `disableMembers`, `hideMembers`, `disableIconEdit`). |
281
281
  | `disableChatInfo.disableIconEdit` | Makes the chat icon read-only in the chat-info modal — hides the press-to-pick picker AND the remove affordance regardless of the user's role. The icon still renders. |
282
282
  | `disableChatHeaderBurgerMenuIcon` | Hides the burger icon in the chat header (the icon that opens the room-list dropdown). `chatHeaderBurgerMenu` controls only the dropdown — set this when you want neither rendered. |
283
+ | `enableAudio` | Opt-in voice messages. **Off by default.** When `true`, an idle input (no text, no attachments) shows a mic icon in the send-button slot — tap → start recording → stop & send. iOS apps need `NSMicrophoneUsageDescription` in Info.plist (add via `expo-av`'s plugin block in `app.json`). Receiving voice messages from other clients (incl. legacy web `.bin` voicemails) is **independent of this flag** — incoming audio plays regardless. |
283
284
  | `disableMemberProfileActions` | Hides the whole "Message / Copy User Id" action block **inside** the chat-info member-profile popup. The popup itself still opens — to block the tap entirely, use `disableChatInfo.disableMemberTap`. |
284
285
  | `disableChatInfo.disableMemberTap` | Disables the tap on a member row in the chat-info list — the user-profile popup never opens. Set when no per-member interaction is appropriate (e.g. patient-facing apps). |
285
286
  | `hideMemberSendMessageAction` | Hides only the "Message" button, keeps everything else. |