@ethora/chat-component-rn 26.5.21 → 26.6.10

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 (352) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +3 -3
  3. package/index.js +1 -1
  4. package/lib/commonjs/components/MainComponents/ChatHeader.js +20 -8
  5. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  6. package/lib/commonjs/components/MainComponents/ChatWrapper.js +17 -0
  7. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  8. package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js +62 -0
  9. package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js.map +1 -0
  10. package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js +253 -0
  11. package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js.map +1 -0
  12. package/lib/commonjs/components/MainComponents/RoomList.js +23 -9
  13. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  14. package/lib/commonjs/components/MessageBubble/Message.js +72 -11
  15. package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
  16. package/lib/commonjs/components/MessageBubble/MessageTranslate.js +160 -0
  17. package/lib/commonjs/components/MessageBubble/MessageTranslate.js.map +1 -0
  18. package/lib/commonjs/components/MessageBubble/TranslatedMessageBody.js +59 -0
  19. package/lib/commonjs/components/MessageBubble/TranslatedMessageBody.js.map +1 -0
  20. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +3 -3
  21. package/lib/commonjs/components/UsersList/UsersList.js +3 -1
  22. package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
  23. package/lib/commonjs/components/VideoCalls/CallButtons.js +159 -0
  24. package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -0
  25. package/lib/commonjs/components/VideoCalls/CallIcons.js +328 -0
  26. package/lib/commonjs/components/VideoCalls/CallIcons.js.map +1 -0
  27. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +550 -0
  28. package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -0
  29. package/lib/commonjs/components/VideoCalls/VideoCallSession.js +636 -0
  30. package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -0
  31. package/lib/commonjs/components/VideoCalls/livekitRuntime.js +91 -0
  32. package/lib/commonjs/components/VideoCalls/livekitRuntime.js.map +1 -0
  33. package/lib/commonjs/components/VideoCalls/useCallKeep.js +215 -0
  34. package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -0
  35. package/lib/commonjs/components/styled/AudioMessage.js +91 -33
  36. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  37. package/lib/commonjs/components/styled/RoomListComponents/index.js +13 -1
  38. package/lib/commonjs/components/styled/RoomListComponents/index.js.map +1 -1
  39. package/lib/commonjs/components/styled/SendInput.js +83 -49
  40. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  41. package/lib/commonjs/components/styled/StyledComponents.js +9 -4
  42. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  43. package/lib/commonjs/components/styled/StyledInputComponents/Composing.js +2 -0
  44. package/lib/commonjs/components/styled/StyledInputComponents/Composing.js.map +1 -1
  45. package/lib/commonjs/context/xmppProvider.js +10 -3
  46. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  47. package/lib/commonjs/helpers/callLogMessage.js +162 -0
  48. package/lib/commonjs/helpers/callLogMessage.js.map +1 -0
  49. package/lib/commonjs/helpers/callPush.js +61 -0
  50. package/lib/commonjs/helpers/callPush.js.map +1 -0
  51. package/lib/commonjs/helpers/constants/LANGUAGE_OPTIONS.js +24 -12
  52. package/lib/commonjs/helpers/constants/LANGUAGE_OPTIONS.js.map +1 -1
  53. package/lib/commonjs/helpers/createUserNameFromSetUser.js +51 -2
  54. package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
  55. package/lib/commonjs/helpers/getDataFromXml.js +19 -1
  56. package/lib/commonjs/helpers/getDataFromXml.js.map +1 -1
  57. package/lib/commonjs/helpers/incomingCallFromPush.js +74 -0
  58. package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -0
  59. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +13 -1
  60. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  61. package/lib/commonjs/helpers/isUnresolvedSenderId.js +32 -0
  62. package/lib/commonjs/helpers/isUnresolvedSenderId.js.map +1 -0
  63. package/lib/commonjs/hooks/useChatSettingState.js +2 -0
  64. package/lib/commonjs/hooks/useChatSettingState.js.map +1 -1
  65. package/lib/commonjs/hooks/useMessageTranslation.js +51 -0
  66. package/lib/commonjs/hooks/useMessageTranslation.js.map +1 -0
  67. package/lib/commonjs/hooks/usePushNotifications.js +13 -3
  68. package/lib/commonjs/hooks/usePushNotifications.js.map +1 -1
  69. package/lib/commonjs/hooks/useSendMessage.js +12 -2
  70. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  71. package/lib/commonjs/i18n/strings.js +1308 -0
  72. package/lib/commonjs/i18n/strings.js.map +1 -0
  73. package/lib/commonjs/i18n/useT.js +60 -0
  74. package/lib/commonjs/i18n/useT.js.map +1 -0
  75. package/lib/commonjs/main.js +44 -0
  76. package/lib/commonjs/main.js.map +1 -1
  77. package/lib/commonjs/networking/api-requests/push.api.js +34 -5
  78. package/lib/commonjs/networking/api-requests/push.api.js.map +1 -1
  79. package/lib/commonjs/networking/api-requests/rooms.api.js +108 -0
  80. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  81. package/lib/commonjs/networking/callTokenStanza.js +531 -0
  82. package/lib/commonjs/networking/callTokenStanza.js.map +1 -0
  83. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  84. package/lib/commonjs/networking/stanzaHandlers.js +75 -8
  85. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  86. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +47 -11
  87. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  88. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +2 -1
  89. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  90. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +42 -5
  91. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  92. package/lib/commonjs/networking/xmppClient.js +78 -16
  93. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  94. package/lib/commonjs/roomStore/callSlice.js +144 -0
  95. package/lib/commonjs/roomStore/callSlice.js.map +1 -0
  96. package/lib/commonjs/roomStore/chatSettingsSlice.js +8 -2
  97. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  98. package/lib/commonjs/roomStore/index.js +7 -1
  99. package/lib/commonjs/roomStore/index.js.map +1 -1
  100. package/lib/commonjs/roomStore/persistence.js +69 -5
  101. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  102. package/lib/commonjs/roomStore/roomsSlice.js +136 -6
  103. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  104. package/lib/commonjs/utils/translateModePolicy.js +33 -0
  105. package/lib/commonjs/utils/translateModePolicy.js.map +1 -0
  106. package/lib/module/components/MainComponents/ChatHeader.js +20 -8
  107. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  108. package/lib/module/components/MainComponents/ChatWrapper.js +17 -0
  109. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  110. package/lib/module/components/MainComponents/LanguageSelectorButton.js +57 -0
  111. package/lib/module/components/MainComponents/LanguageSelectorButton.js.map +1 -0
  112. package/lib/module/components/MainComponents/LanguageSelectorModal.js +246 -0
  113. package/lib/module/components/MainComponents/LanguageSelectorModal.js.map +1 -0
  114. package/lib/module/components/MainComponents/RoomList.js +23 -9
  115. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  116. package/lib/module/components/MessageBubble/Message.js +73 -12
  117. package/lib/module/components/MessageBubble/Message.js.map +1 -1
  118. package/lib/module/components/MessageBubble/MessageTranslate.js +155 -0
  119. package/lib/module/components/MessageBubble/MessageTranslate.js.map +1 -0
  120. package/lib/module/components/MessageBubble/TranslatedMessageBody.js +53 -0
  121. package/lib/module/components/MessageBubble/TranslatedMessageBody.js.map +1 -0
  122. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +3 -3
  123. package/lib/module/components/UsersList/UsersList.js +3 -1
  124. package/lib/module/components/UsersList/UsersList.js.map +1 -1
  125. package/lib/module/components/VideoCalls/CallButtons.js +154 -0
  126. package/lib/module/components/VideoCalls/CallButtons.js.map +1 -0
  127. package/lib/module/components/VideoCalls/CallIcons.js +309 -0
  128. package/lib/module/components/VideoCalls/CallIcons.js.map +1 -0
  129. package/lib/module/components/VideoCalls/VideoCallOverlay.js +544 -0
  130. package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -0
  131. package/lib/module/components/VideoCalls/VideoCallSession.js +630 -0
  132. package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -0
  133. package/lib/module/components/VideoCalls/livekitRuntime.js +83 -0
  134. package/lib/module/components/VideoCalls/livekitRuntime.js.map +1 -0
  135. package/lib/module/components/VideoCalls/useCallKeep.js +210 -0
  136. package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -0
  137. package/lib/module/components/styled/AudioMessage.js +91 -33
  138. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  139. package/lib/module/components/styled/RoomListComponents/index.js +13 -1
  140. package/lib/module/components/styled/RoomListComponents/index.js.map +1 -1
  141. package/lib/module/components/styled/SendInput.js +83 -49
  142. package/lib/module/components/styled/SendInput.js.map +1 -1
  143. package/lib/module/components/styled/StyledComponents.js +9 -4
  144. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  145. package/lib/module/components/styled/StyledInputComponents/Composing.js +2 -0
  146. package/lib/module/components/styled/StyledInputComponents/Composing.js.map +1 -1
  147. package/lib/module/context/xmppProvider.js +11 -4
  148. package/lib/module/context/xmppProvider.js.map +1 -1
  149. package/lib/module/helpers/callLogMessage.js +152 -0
  150. package/lib/module/helpers/callLogMessage.js.map +1 -0
  151. package/lib/module/helpers/callPush.js +55 -0
  152. package/lib/module/helpers/callPush.js.map +1 -0
  153. package/lib/module/helpers/constants/LANGUAGE_OPTIONS.js +24 -12
  154. package/lib/module/helpers/constants/LANGUAGE_OPTIONS.js.map +1 -1
  155. package/lib/module/helpers/createUserNameFromSetUser.js +49 -1
  156. package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
  157. package/lib/module/helpers/getDataFromXml.js +20 -1
  158. package/lib/module/helpers/getDataFromXml.js.map +1 -1
  159. package/lib/module/helpers/incomingCallFromPush.js +70 -0
  160. package/lib/module/helpers/incomingCallFromPush.js.map +1 -0
  161. package/lib/module/helpers/insertMessageWithDelimiter.js +13 -1
  162. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  163. package/lib/module/helpers/isUnresolvedSenderId.js +27 -0
  164. package/lib/module/helpers/isUnresolvedSenderId.js.map +1 -0
  165. package/lib/module/hooks/useChatSettingState.js +2 -0
  166. package/lib/module/hooks/useChatSettingState.js.map +1 -1
  167. package/lib/module/hooks/useMessageTranslation.js +46 -0
  168. package/lib/module/hooks/useMessageTranslation.js.map +1 -0
  169. package/lib/module/hooks/usePushNotifications.js +13 -3
  170. package/lib/module/hooks/usePushNotifications.js.map +1 -1
  171. package/lib/module/hooks/useSendMessage.js +12 -2
  172. package/lib/module/hooks/useSendMessage.js.map +1 -1
  173. package/lib/module/i18n/strings.js +1300 -0
  174. package/lib/module/i18n/strings.js.map +1 -0
  175. package/lib/module/i18n/useT.js +55 -0
  176. package/lib/module/i18n/useT.js.map +1 -0
  177. package/lib/module/main.js +7 -1
  178. package/lib/module/main.js.map +1 -1
  179. package/lib/module/networking/api-requests/push.api.js +35 -5
  180. package/lib/module/networking/api-requests/push.api.js.map +1 -1
  181. package/lib/module/networking/api-requests/rooms.api.js +109 -1
  182. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  183. package/lib/module/networking/callTokenStanza.js +526 -0
  184. package/lib/module/networking/callTokenStanza.js.map +1 -0
  185. package/lib/module/networking/outboundQueue.js.map +1 -1
  186. package/lib/module/networking/stanzaHandlers.js +76 -9
  187. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  188. package/lib/module/networking/xmpp/handleStanzas.xmpp.js +48 -11
  189. package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  190. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +1 -1
  191. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  192. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +43 -5
  193. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  194. package/lib/module/networking/xmppClient.js +78 -16
  195. package/lib/module/networking/xmppClient.js.map +1 -1
  196. package/lib/module/roomStore/callSlice.js +130 -0
  197. package/lib/module/roomStore/callSlice.js.map +1 -0
  198. package/lib/module/roomStore/chatSettingsSlice.js +6 -1
  199. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  200. package/lib/module/roomStore/index.js +6 -1
  201. package/lib/module/roomStore/index.js.map +1 -1
  202. package/lib/module/roomStore/persistence.js +69 -5
  203. package/lib/module/roomStore/persistence.js.map +1 -1
  204. package/lib/module/roomStore/roomsSlice.js +134 -5
  205. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  206. package/lib/module/utils/translateModePolicy.js +27 -0
  207. package/lib/module/utils/translateModePolicy.js.map +1 -0
  208. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  209. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  210. package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts +12 -0
  211. package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts.map +1 -0
  212. package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts +31 -0
  213. package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts.map +1 -0
  214. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  215. package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
  216. package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts +44 -0
  217. package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts.map +1 -0
  218. package/lib/typescript/components/MessageBubble/TranslatedMessageBody.d.ts +24 -0
  219. package/lib/typescript/components/MessageBubble/TranslatedMessageBody.d.ts.map +1 -0
  220. package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
  221. package/lib/typescript/components/VideoCalls/CallButtons.d.ts +16 -0
  222. package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -0
  223. package/lib/typescript/components/VideoCalls/CallIcons.d.ts +30 -0
  224. package/lib/typescript/components/VideoCalls/CallIcons.d.ts.map +1 -0
  225. package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts +10 -0
  226. package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -0
  227. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +38 -0
  228. package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -0
  229. package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts +52 -0
  230. package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts.map +1 -0
  231. package/lib/typescript/components/VideoCalls/useCallKeep.d.ts +32 -0
  232. package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -0
  233. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  234. package/lib/typescript/components/styled/RoomListComponents/index.d.ts.map +1 -1
  235. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  236. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  237. package/lib/typescript/components/styled/StyledInputComponents/Composing.d.ts.map +1 -1
  238. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  239. package/lib/typescript/helpers/callLogMessage.d.ts +34 -0
  240. package/lib/typescript/helpers/callLogMessage.d.ts.map +1 -0
  241. package/lib/typescript/helpers/callPush.d.ts +23 -0
  242. package/lib/typescript/helpers/callPush.d.ts.map +1 -0
  243. package/lib/typescript/helpers/constants/LANGUAGE_OPTIONS.d.ts +14 -0
  244. package/lib/typescript/helpers/constants/LANGUAGE_OPTIONS.d.ts.map +1 -1
  245. package/lib/typescript/helpers/createUserNameFromSetUser.d.ts +33 -1
  246. package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
  247. package/lib/typescript/helpers/getDataFromXml.d.ts.map +1 -1
  248. package/lib/typescript/helpers/incomingCallFromPush.d.ts +14 -0
  249. package/lib/typescript/helpers/incomingCallFromPush.d.ts.map +1 -0
  250. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  251. package/lib/typescript/helpers/isUnresolvedSenderId.d.ts +2 -0
  252. package/lib/typescript/helpers/isUnresolvedSenderId.d.ts.map +1 -0
  253. package/lib/typescript/hooks/useChatSettingState.d.ts +2 -1
  254. package/lib/typescript/hooks/useChatSettingState.d.ts.map +1 -1
  255. package/lib/typescript/hooks/useMessageTranslation.d.ts +25 -0
  256. package/lib/typescript/hooks/useMessageTranslation.d.ts.map +1 -0
  257. package/lib/typescript/hooks/usePushNotifications.d.ts.map +1 -1
  258. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  259. package/lib/typescript/i18n/strings.d.ts +16 -0
  260. package/lib/typescript/i18n/strings.d.ts.map +1 -0
  261. package/lib/typescript/i18n/useT.d.ts +34 -0
  262. package/lib/typescript/i18n/useT.d.ts.map +1 -0
  263. package/lib/typescript/main.d.ts +6 -1
  264. package/lib/typescript/main.d.ts.map +1 -1
  265. package/lib/typescript/networking/api-requests/push.api.d.ts.map +1 -1
  266. package/lib/typescript/networking/api-requests/rooms.api.d.ts +3 -0
  267. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  268. package/lib/typescript/networking/callTokenStanza.d.ts +14 -0
  269. package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -0
  270. package/lib/typescript/networking/outboundQueue.d.ts +1 -0
  271. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  272. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  273. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
  274. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts +10 -0
  275. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
  276. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +16 -1
  277. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
  278. package/lib/typescript/networking/xmppClient.d.ts +1 -1
  279. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  280. package/lib/typescript/roomStore/callSlice.d.ts +39 -0
  281. package/lib/typescript/roomStore/callSlice.d.ts.map +1 -0
  282. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +10 -1
  283. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  284. package/lib/typescript/roomStore/index.d.ts +4 -0
  285. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  286. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  287. package/lib/typescript/roomStore/roomsSlice.d.ts +6 -1
  288. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  289. package/lib/typescript/types/models/language.model.d.ts +1 -1
  290. package/lib/typescript/types/models/language.model.d.ts.map +1 -1
  291. package/lib/typescript/types/models/message.model.d.ts +7 -0
  292. package/lib/typescript/types/models/message.model.d.ts.map +1 -1
  293. package/lib/typescript/types/types.d.ts +135 -1
  294. package/lib/typescript/types/types.d.ts.map +1 -1
  295. package/lib/typescript/utils/translateModePolicy.d.ts +20 -0
  296. package/lib/typescript/utils/translateModePolicy.d.ts.map +1 -0
  297. package/package.json +20 -4
  298. package/src/components/MainComponents/ChatHeader.tsx +30 -9
  299. package/src/components/MainComponents/ChatWrapper.tsx +15 -0
  300. package/src/components/MainComponents/LanguageSelectorButton.tsx +53 -0
  301. package/src/components/MainComponents/LanguageSelectorModal.tsx +276 -0
  302. package/src/components/MainComponents/RoomList.tsx +27 -9
  303. package/src/components/MessageBubble/Message.tsx +109 -17
  304. package/src/components/MessageBubble/MessageTranslate.tsx +182 -0
  305. package/src/components/MessageBubble/TranslatedMessageBody.tsx +59 -0
  306. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +3 -3
  307. package/src/components/UsersList/UsersList.tsx +3 -1
  308. package/src/components/VideoCalls/CallButtons.tsx +171 -0
  309. package/src/components/VideoCalls/CallIcons.tsx +246 -0
  310. package/src/components/VideoCalls/VideoCallOverlay.tsx +627 -0
  311. package/src/components/VideoCalls/VideoCallSession.tsx +675 -0
  312. package/src/components/VideoCalls/livekitRuntime.ts +100 -0
  313. package/src/components/VideoCalls/useCallKeep.ts +252 -0
  314. package/src/components/styled/AudioMessage.tsx +97 -37
  315. package/src/components/styled/RoomListComponents/index.tsx +15 -3
  316. package/src/components/styled/SendInput.tsx +94 -51
  317. package/src/components/styled/StyledComponents.ts +9 -6
  318. package/src/components/styled/StyledInputComponents/Composing.tsx +7 -1
  319. package/src/context/xmppProvider.tsx +14 -1
  320. package/src/helpers/callLogMessage.ts +174 -0
  321. package/src/helpers/callPush.ts +90 -0
  322. package/src/helpers/constants/LANGUAGE_OPTIONS.ts +20 -5
  323. package/src/helpers/createUserNameFromSetUser.ts +68 -2
  324. package/src/helpers/getDataFromXml.ts +40 -4
  325. package/src/helpers/incomingCallFromPush.ts +83 -0
  326. package/src/helpers/insertMessageWithDelimiter.ts +27 -9
  327. package/src/helpers/isUnresolvedSenderId.ts +25 -0
  328. package/src/hooks/useChatSettingState.tsx +4 -0
  329. package/src/hooks/useMessageTranslation.ts +70 -0
  330. package/src/hooks/usePushNotifications.ts +15 -3
  331. package/src/hooks/useSendMessage.tsx +15 -2
  332. package/src/i18n/strings.ts +1322 -0
  333. package/src/i18n/useT.ts +56 -0
  334. package/src/main.ts +18 -1
  335. package/src/networking/api-requests/push.api.ts +39 -8
  336. package/src/networking/api-requests/rooms.api.ts +109 -1
  337. package/src/networking/callTokenStanza.ts +636 -0
  338. package/src/networking/outboundQueue.ts +1 -0
  339. package/src/networking/stanzaHandlers.ts +74 -15
  340. package/src/networking/xmpp/handleStanzas.xmpp.ts +52 -11
  341. package/src/networking/xmpp/sendTextMessage.xmpp.ts +1 -1
  342. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +41 -5
  343. package/src/networking/xmppClient.ts +97 -28
  344. package/src/roomStore/callSlice.ts +190 -0
  345. package/src/roomStore/chatSettingsSlice.ts +16 -0
  346. package/src/roomStore/index.ts +5 -0
  347. package/src/roomStore/persistence.ts +103 -3
  348. package/src/roomStore/roomsSlice.ts +149 -4
  349. package/src/types/models/language.model.ts +17 -1
  350. package/src/types/models/message.model.ts +9 -0
  351. package/src/types/types.ts +142 -2
  352. package/src/utils/translateModePolicy.ts +31 -0
@@ -0,0 +1,182 @@
1
+ import React, { FC, useCallback, useState } from 'react';
2
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
+ import { IConfig, IMessage } from '../../types/types';
4
+ import { CustomDivider } from './CustomDivider';
5
+ import { CustomMessageText } from '../styled/StyledComponents';
6
+ import { useT } from '../../i18n/useT';
7
+ import { toBaseLanguage } from '../../i18n/strings';
8
+ import { useMessageTranslation } from '../../hooks/useMessageTranslation';
9
+
10
+ interface MessageTranslateProps {
11
+ message: IMessage;
12
+ isUser: boolean;
13
+ config?: IConfig;
14
+ /**
15
+ * The reader's target language, resolved ONCE by the parent (Message.tsx)
16
+ * and shared with auto mode, so the two can never ask for different
17
+ * languages.
18
+ */
19
+ readerLocale?: string;
20
+ }
21
+
22
+ type HostPhase = 'idle' | 'loading' | 'done' | 'error';
23
+
24
+ /**
25
+ * Manual-mode message translation (LinkedIn-style "Translate" link).
26
+ *
27
+ * Manual is AUTO BEHIND A TAP — the same translation, revealed on press,
28
+ * not a second mechanism. Both read what the stanza already carries on
29
+ * `message.translations`; neither calls a translation service.
30
+ *
31
+ * That is enforced by sharing `useMessageTranslation` with auto rather than
32
+ * re-deriving the lookup here. The previous copy (ported verbatim from web,
33
+ * which still has it) drifted in two ways that both pointed the same
34
+ * direction — a link that could not deliver:
35
+ *
36
+ * - its target language ended at the literal `'en'` instead of the
37
+ * reader's own `langSource`, so for every host that lets the reader
38
+ * pick — the normal case — a French reader's tap asked the message for
39
+ * an ENGLISH translation and fell into `translation.failed`;
40
+ * - it offered the link on a source-vs-target language compare alone,
41
+ * without checking a translation was actually attached, so even with
42
+ * the right locale a never-translated message showed a dead link.
43
+ *
44
+ * The link now appears only when there is something to reveal, which makes
45
+ * the failure state unreachable on this path.
46
+ *
47
+ * A host-supplied `config.translates.onTranslate` is the one asynchronous
48
+ * case: it can produce a translation nothing on the stanza predicts, so
49
+ * there the link is offered on the language compare and loading/error still
50
+ * apply.
51
+ */
52
+ const MessageTranslate: FC<MessageTranslateProps> = ({
53
+ message,
54
+ isUser,
55
+ config,
56
+ readerLocale,
57
+ }) => {
58
+ const t = useT();
59
+ const translates = config?.translates;
60
+ const hasHostTranslator = typeof translates?.onTranslate === 'function';
61
+
62
+ const originalText = String(message?.body || '');
63
+ const sourceLocale = (message as { langSource?: string })?.langSource;
64
+ const targetLocale =
65
+ readerLocale || translates?.readerLocale || config?.i18n?.locale || 'en';
66
+
67
+ // The exact call auto mode makes, with the exact same locale.
68
+ const attached = useMessageTranslation(message, targetLocale, true);
69
+
70
+ const [revealed, setRevealed] = useState(false);
71
+ const [showOriginal, setShowOriginal] = useState(false);
72
+ const [hostPhase, setHostPhase] = useState<HostPhase>('idle');
73
+ const [hostText, setHostText] = useState<string | null>(null);
74
+ const linkColor = config?.colors?.primary || '#0052CD';
75
+
76
+ // Region ignored on purpose: en-US vs en-CA is the same language, not a
77
+ // translation job. The FULL locale is still what `onTranslate` receives.
78
+ const languagesDiffer =
79
+ !!originalText.trim() &&
80
+ !!sourceLocale &&
81
+ toBaseLanguage(sourceLocale) !== toBaseLanguage(targetLocale);
82
+
83
+ const shouldShow = (() => {
84
+ if (isUser) {
85
+ return false;
86
+ }
87
+ // A host that supplies this keeps the locale logic and just tells us
88
+ // yes/no.
89
+ if (typeof translates?.showTranslateForMessage === 'function') {
90
+ return translates.showTranslateForMessage(message);
91
+ }
92
+ // Host translator: the outcome isn't knowable until it runs.
93
+ if (hasHostTranslator) {
94
+ return languagesDiffer;
95
+ }
96
+ // Stanza-attached: only offer what we can actually deliver.
97
+ return attached.hasTranslation;
98
+ })();
99
+
100
+ const runHostTranslate = useCallback(async () => {
101
+ if (!originalText.trim()) {
102
+ return;
103
+ }
104
+ setHostPhase('loading');
105
+ try {
106
+ const result = await translates?.onTranslate?.(originalText, {
107
+ sourceLocale,
108
+ targetLocale,
109
+ message,
110
+ });
111
+ if (result && result.trim()) {
112
+ setHostText(result);
113
+ setHostPhase('done');
114
+ } else {
115
+ setHostPhase('error');
116
+ }
117
+ } catch {
118
+ setHostPhase('error');
119
+ }
120
+ }, [originalText, translates, sourceLocale, targetLocale, message]);
121
+
122
+ if (!shouldShow) {
123
+ return null;
124
+ }
125
+
126
+ const renderLink = (label: string, onPress: () => void) => (
127
+ <TouchableOpacity onPress={onPress} hitSlop={6}>
128
+ <Text style={[styles.link, { color: linkColor }]}>{label}</Text>
129
+ </TouchableOpacity>
130
+ );
131
+
132
+ const renderRevealed = (translatedText: string) => (
133
+ <View>
134
+ <CustomDivider
135
+ configColor={
136
+ isUser ? config?.colors?.secondary : config?.colors?.primary
137
+ }
138
+ />
139
+ <CustomMessageText colorUser="">
140
+ {showOriginal ? originalText : translatedText}
141
+ </CustomMessageText>
142
+ {renderLink(
143
+ showOriginal ? t('action.translate') : t('action.showOriginal'),
144
+ () => setShowOriginal((v) => !v)
145
+ )}
146
+ </View>
147
+ );
148
+
149
+ // Host-provided translator: asynchronous, and can genuinely fail.
150
+ if (hasHostTranslator) {
151
+ if (hostPhase === 'loading') {
152
+ return (
153
+ <Text style={[styles.link, { color: linkColor }]}>
154
+ {t('translation.translating')}
155
+ </Text>
156
+ );
157
+ }
158
+ if (hostPhase === 'error') {
159
+ return renderLink(t('translation.failed'), runHostTranslate);
160
+ }
161
+ if (hostPhase === 'done' && hostText) {
162
+ return renderRevealed(hostText);
163
+ }
164
+ return renderLink(t('action.translate'), runHostTranslate);
165
+ }
166
+
167
+ // Stanza-attached: nothing to await, nothing to fail.
168
+ if (!revealed) {
169
+ return renderLink(t('action.translate'), () => setRevealed(true));
170
+ }
171
+ return renderRevealed(attached.displayText);
172
+ };
173
+
174
+ const styles = StyleSheet.create({
175
+ link: {
176
+ marginTop: 4,
177
+ fontSize: 12,
178
+ fontWeight: '600',
179
+ },
180
+ });
181
+
182
+ export default MessageTranslate;
@@ -0,0 +1,59 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { StyleSheet, Text, View } from 'react-native';
3
+
4
+ interface TranslatedMessageBodyProps {
5
+ /** Text as sent, in the sender's language. */
6
+ originalText: string;
7
+ accentColor?: string;
8
+ /** Renders the translated text (the parsed message body). */
9
+ children: ReactNode;
10
+ /**
11
+ * Whether this message was sent by the current user. The sender already
12
+ * knows what they wrote, so their own messages skip the quote-plus-
13
+ * translation treatment and just show the original (never translated).
14
+ */
15
+ isUser: boolean;
16
+ }
17
+
18
+ /**
19
+ * A message body that is showing a translation: the translated text reads
20
+ * as the primary content, with the original quoted above it (accent bar,
21
+ * dimmed) for reference — the same visual language MessageReply uses.
22
+ * Ported from the web SDK's TranslatedMessageBody. Own messages (`isUser`)
23
+ * show only the original.
24
+ */
25
+ export const TranslatedMessageBody: React.FC<TranslatedMessageBodyProps> = ({
26
+ originalText,
27
+ accentColor = '#0052CD',
28
+ children,
29
+ isUser,
30
+ }) => {
31
+ if (isUser) {
32
+ return <View>{children}</View>;
33
+ }
34
+ return (
35
+ <View>
36
+ <View style={[styles.quote, { borderLeftColor: accentColor }]}>
37
+ <Text style={styles.quoteText}>{originalText}</Text>
38
+ </View>
39
+ <View>{children}</View>
40
+ </View>
41
+ );
42
+ };
43
+
44
+ const styles = StyleSheet.create({
45
+ quote: {
46
+ borderLeftWidth: 2,
47
+ paddingLeft: 8,
48
+ marginBottom: 6,
49
+ },
50
+ quoteText: {
51
+ fontSize: 13,
52
+ lineHeight: 19,
53
+ // Dimmed relative to the translated body — matches the web quote's
54
+ // opacity:0.6 look without depending on the (variable) text colour.
55
+ color: '#71717A',
56
+ },
57
+ });
58
+
59
+ export default TranslatedMessageBody;
@@ -50,8 +50,8 @@ const isGviewPreviewable = (mime: string | undefined | null) => {
50
50
  return GVIEW_PREVIEWABLE.has(mime.toLowerCase().split(';')[0]!.trim());
51
51
  };
52
52
 
53
- // Full-screen video preview on expo-video (expo-av <Video> is deprecated
54
- // and rendered blank on Android). `contentFit: contain` fits the clip to
53
+ // Full-screen video preview on expo-video (the discontinued expo-av
54
+ // <Video> rendered blank on Android). `contentFit: contain` fits the clip to
55
55
  // the area with the surrounding letterbox painted as the view's own
56
56
  // (transparent → theme) background, NOT black. `textureView` so the play
57
57
  // overlay composites on top and nothing is clipped on Android.
@@ -409,7 +409,7 @@ const FilePreviewModal: React.FC<FilePreviewModalProps> = ({
409
409
  flex: 1,
410
410
  justifyContent: 'center',
411
411
  // NOTE: do NOT set overflow:'hidden' here — on Android it clips
412
- // hardware-accelerated children (expo-av Video TextureView and
412
+ // hardware-accelerated children (expo-video TextureView and
413
413
  // react-native-webview) to nothing, so video/PDF/doc previews
414
414
  // render blank while plain <Image> survives.
415
415
  overflow: 'visible',
@@ -19,6 +19,7 @@ import { debounce } from '../../helpers/debounce';
19
19
  import { StyledInput } from '../styled/StyledInputComponents/StyledInputComponents';
20
20
  import { useRoomState } from '../../hooks/useRoomState';
21
21
  import { Text, View } from 'react-native';
22
+ import { useT } from '../../i18n/useT';
22
23
 
23
24
  interface UsersListProps {
24
25
  selectedUsers: RoomMember[];
@@ -36,6 +37,7 @@ const UsersList: React.FC<UsersListProps> = ({
36
37
  filter,
37
38
  }) => {
38
39
  const { usersSet } = useRoomState();
40
+ const t = useT();
39
41
  const [searchTerm, setSearchTerm] = useState('');
40
42
  const [filteredUsers, setFilteredUsers] = useState<RoomMember[]>([]);
41
43
 
@@ -80,7 +82,7 @@ const UsersList: React.FC<UsersListProps> = ({
80
82
  )}
81
83
 
82
84
  <StyledInput
83
- placeholder="Search users..."
85
+ placeholder={t('modal.selectUsers.searchPlaceholder')}
84
86
  value={searchTerm}
85
87
  onChangeText={setSearchTerm}
86
88
  style={{ width: '100%' }}
@@ -0,0 +1,171 @@
1
+ import React, { FC, useCallback } from 'react';
2
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { RootState } from '../../roomStore';
5
+ import { setCallError, startOutgoingCall } from '../../roomStore/callSlice';
6
+ import { sendCallInviteSignal } from '../../networking/callTokenStanza';
7
+ import { createChatCall } from '../../networking/api-requests/rooms.api';
8
+ import { useChatSettingState } from '../../hooks/useChatSettingState';
9
+ import { AudioCallIcon, VideoCallIcon } from './CallIcons';
10
+ import { useT } from '../../i18n/useT';
11
+ import { getIconColor } from '../../helpers/getIconColor';
12
+
13
+ /**
14
+ * The audio / video call entry points for the chat header.
15
+ *
16
+ * Kept as its own component (rather than inlined into ChatHeader like the
17
+ * web SDK does) so the whole call feature stays inside components/VideoCalls
18
+ * and ChatHeader gains exactly one line. It renders nothing at all when
19
+ * calls are off, which is the common case.
20
+ *
21
+ * Gating mirrors the web rules: calls need `config.videoCalls.enabled`, a
22
+ * `livekitUrl`, a 1:1 (private) room, and no other call already running.
23
+ * Audio is a second opt-in on top of that (`enableAudioCalls`).
24
+ */
25
+ export const CallButtons: FC = () => {
26
+ const dispatch = useDispatch();
27
+ const t = useT();
28
+ const { config, user } = useChatSettingState();
29
+ const call = useSelector((state: RootState) => state.call);
30
+ const currentRoom = useSelector((state: RootState) => {
31
+ const jid = state.rooms.activeRoomJID;
32
+ return jid ? state.rooms.rooms[jid] : null;
33
+ });
34
+
35
+ const videoCallsConfig = config?.videoCalls;
36
+ const allowedRoomTypes = videoCallsConfig?.allowedRoomTypes || ['private'];
37
+ const isVideoCallsEnabled = videoCallsConfig?.enabled === true;
38
+ const isPrivateRoom = currentRoom?.type === 'private';
39
+ const isRoomAllowed = isPrivateRoom && allowedRoomTypes.includes('private');
40
+ const hasLivekitUrl = Boolean(videoCallsConfig?.livekitUrl?.trim());
41
+ const isCallBusy = call.phase !== 'idle';
42
+ const canCall = isVideoCallsEnabled && isRoomAllowed && hasLivekitUrl;
43
+ const isAudioCallsEnabled =
44
+ canCall && videoCallsConfig?.enableAudioCalls === true;
45
+
46
+ const iconColor = getIconColor(config);
47
+
48
+ const placeCall = useCallback(
49
+ async (kind: 'audio' | 'video') => {
50
+ if (!canCall || isCallBusy || !currentRoom?.jid) {
51
+ return;
52
+ }
53
+
54
+ // The call API expects the bare room name (e.g. "${appId}_<uuid>"),
55
+ // which createRoomFromApi stores as the JID localpart.
56
+ // `currentRoom.name` looks tempting but actually holds the display
57
+ // title (the other party's "First Last"), so passing it produces
58
+ // nonsense URLs like /v1/chats/call/create/test2%20test2.
59
+ const chatName = currentRoom.jid.split('@')[0];
60
+ if (!chatName) {return;}
61
+
62
+ // Resolve the peer xmpp localpart so we can XMPP-signal them when we
63
+ // hang up or cancel, without this they'd keep ringing forever.
64
+ const selfLocal = String(user?.xmppUsername || '').split('@')[0];
65
+ const peer = (currentRoom.members || []).find((member: any) => {
66
+ const mLocal = String(member?.xmppUsername || '').split('@')[0];
67
+ return mLocal && mLocal !== selfLocal;
68
+ });
69
+ const peerXmppUsername = peer?.xmppUsername || null;
70
+
71
+ // Don't show "deleted" / "Deleted User" / "Unknown" as the dial
72
+ // screen title when the chat title is one of the server sentinels.
73
+ // Prefer the peer's first+last name, falling back to the bare chat name.
74
+ const rawTitle = String(currentRoom.name || '').trim();
75
+ const isBadTitle =
76
+ !rawTitle ||
77
+ ['deleted', 'deleted user', 'unknown', 'null'].includes(
78
+ rawTitle.toLowerCase()
79
+ );
80
+ const peerDisplay = peer
81
+ ? `${peer.firstName || ''} ${peer.lastName || ''}`.trim() ||
82
+ (peer as any).name ||
83
+ ''
84
+ : '';
85
+ const dialName =
86
+ (isBadTitle ? peerDisplay : rawTitle) || peerDisplay || chatName;
87
+
88
+ dispatch(
89
+ startOutgoingCall({
90
+ roomJid: currentRoom.jid,
91
+ roomName: dialName,
92
+ roomBareName: chatName,
93
+ kind,
94
+ peerXmppUsername,
95
+ })
96
+ );
97
+
98
+ // Server's broadcast call-token currently drops the `kind` attribute,
99
+ // so signal it directly to the peer first. Direct chat is fast
100
+ // (~50ms) and almost always lands before the server-relayed token
101
+ // (~200-300ms), so the callee enters the right UI mode.
102
+ if (peerXmppUsername) {
103
+ sendCallInviteSignal(kind, {
104
+ peerXmppUsername,
105
+ roomBareName: chatName,
106
+ });
107
+ }
108
+
109
+ try {
110
+ await createChatCall(chatName, { kind });
111
+ } catch (error) {
112
+ const message =
113
+ error instanceof Error
114
+ ? error.message
115
+ : t('call.error.connectFailed');
116
+ dispatch(setCallError(message));
117
+ }
118
+ },
119
+ [canCall, isCallBusy, currentRoom, user?.xmppUsername, dispatch, t]
120
+ );
121
+
122
+ if (!canCall || isCallBusy) {
123
+ return null;
124
+ }
125
+
126
+ return (
127
+ <View style={styles.row}>
128
+ {isAudioCallsEnabled && (
129
+ <TouchableOpacity
130
+ accessibilityRole="button"
131
+ accessibilityLabel={t('call.action.startAudioCall')}
132
+ onPress={() => {
133
+ void placeCall('audio');
134
+ }}
135
+ style={styles.button}
136
+ hitSlop={8}
137
+ >
138
+ <AudioCallIcon color={iconColor} size={22} />
139
+ </TouchableOpacity>
140
+ )}
141
+ <TouchableOpacity
142
+ accessibilityRole="button"
143
+ accessibilityLabel={t('call.action.startVideoCall')}
144
+ onPress={() => {
145
+ void placeCall('video');
146
+ }}
147
+ style={styles.button}
148
+ hitSlop={8}
149
+ >
150
+ <VideoCallIcon color={iconColor} size={22} />
151
+ </TouchableOpacity>
152
+ </View>
153
+ );
154
+ };
155
+
156
+ const styles = StyleSheet.create({
157
+ row: {
158
+ flexDirection: 'row',
159
+ alignItems: 'center',
160
+ gap: 4,
161
+ },
162
+ button: {
163
+ width: 36,
164
+ height: 36,
165
+ borderRadius: 18,
166
+ alignItems: 'center',
167
+ justifyContent: 'center',
168
+ },
169
+ });
170
+
171
+ export default CallButtons;