@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,56 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import { useChatSettingState } from '../hooks/useChatSettingState';
3
+ import { interpolate, resolveStringTable } from './strings';
4
+
5
+ /**
6
+ * UI translation hook. Reads the active locale + host overrides from
7
+ * `config.i18n` and returns a `t(key, vars?)` function.
8
+ *
9
+ * const t = useT();
10
+ * <SearchInput placeholder={t('search.placeholder')} />
11
+ * <span>{t('presence.onlineCount', { count })}</span>
12
+ *
13
+ * Locale resolves to the base language for captions (region is only used for
14
+ * message translation). Missing keys fall back to English, then to the raw
15
+ * key, so nothing ever renders blank.
16
+ *
17
+ * When the host doesn't set `config.i18n.locale` explicitly, this falls
18
+ * back to `langSource` - the same reader-language state the in-chat globe
19
+ * picker (LanguageSelectorButton) and `config.translates.readerLocale`
20
+ * drive (see useChatWrapperInit's resolveExternalReaderLocaleLangSource).
21
+ * So picking a language in the chat changes both message translations AND
22
+ * static captions together, as one language switch, unless the host is
23
+ * explicitly managing UI locale separately via `config.i18n.locale`.
24
+ */
25
+ /**
26
+ * The locale the UI is currently in, resolved by the same rule useT uses
27
+ * (explicit `config.i18n.locale`, else the reader's `langSource`).
28
+ *
29
+ * For anything Intl already localises - dates, numbers, relative times -
30
+ * where you need the locale itself rather than a string from the table.
31
+ * Without it components reach for a hardcoded 'en-US' and quietly render
32
+ * American dates under a Chinese UI (DateLabel did exactly that).
33
+ * Undefined means "no explicit choice", which Intl reads as the browser's
34
+ * own locale - the right default.
35
+ */
36
+ export const useUiLocale = (): string | undefined => {
37
+ const { config, langSource } = useChatSettingState();
38
+ return config?.i18n?.locale || langSource || undefined;
39
+ };
40
+
41
+ export const useT = () => {
42
+ const { config, langSource } = useChatSettingState();
43
+ const locale = config?.i18n?.locale || langSource;
44
+ const overrides = config?.i18n?.strings;
45
+
46
+ const table = useMemo(
47
+ () => resolveStringTable(locale, overrides),
48
+ [locale, overrides]
49
+ );
50
+
51
+ return useCallback(
52
+ (key: string, vars?: Record<string, string | number>): string =>
53
+ interpolate(table[key] ?? key, vars),
54
+ [table]
55
+ );
56
+ };
package/src/main.ts CHANGED
@@ -32,9 +32,22 @@ export { useChatRoomFocus } from './hooks/useChatRoomFocus';
32
32
  export { logoutService } from './hooks/useLogout';
33
33
  export { useQRCodeChat, handleQRChatId } from './hooks/useQRCodeChatHandler';
34
34
  export { resendMessage } from './utils/resendMessage';
35
- // Font loader — exposed so hosts can also load the font outside <Chat> if needed.
35
+ // Font loader, exposed so hosts can also load the font outside <Chat> if needed.
36
36
  export { useChatFonts } from './hooks/useChatFonts';
37
37
 
38
+ // Static UI i18n. `useT` is the in-component hook; `translateKey` is the
39
+ // one-shot for helpers outside React. Hosts extend or override any caption
40
+ // through `config.i18n.strings`, keyed by the same keys BUILTIN_STRINGS uses.
41
+ export { useT, useUiLocale } from './i18n/useT';
42
+ export {
43
+ BUILTIN_STRINGS,
44
+ DEFAULT_UI_LANGUAGE,
45
+ resolveStringTable,
46
+ toBaseLanguage,
47
+ translateKey,
48
+ } from './i18n/strings';
49
+ export type { UiStringTable } from './i18n/strings';
50
+
38
51
  // Public types — needed so consumers can type their `config` prop and
39
52
  // any event handlers they pass in.
40
53
  export type {
@@ -48,4 +61,8 @@ export type {
48
61
  TypographyConfig,
49
62
  RNFontSource,
50
63
  ChatTextStyle,
64
+ VideoCallsConfig,
65
+ VideoCallIcons,
51
66
  } from './types/types';
67
+ export type { Iso639_1Codes } from './types/models/language.model';
68
+ export type { TranslateMode } from './utils/translateModePolicy';
@@ -2,10 +2,38 @@ import axios from 'axios';
2
2
  import { Platform } from 'react-native';
3
3
  import { store } from '../../roomStore';
4
4
 
5
- const PUSH_API_URL = 'https://push.ethoradev.com/api/v1';
5
+ // Both of these used to be hardcoded to the ethoradev environment
6
+ // (push.ethoradev.com, @xmpp.ethoradev.com). That is a development
7
+ // deployment: shipping it inside the SDK meant every host app, including
8
+ // production ones, registered its device against dev infrastructure and
9
+ // then quietly received no pushes. They are resolved from the host's own
10
+ // config now, with the production cluster as the fallback.
11
+ const DEFAULT_PUSH_API_URL = 'https://push.chat.ethora.com/api/v1';
12
+ const DEFAULT_XMPP_HOST = 'xmpp.chat.ethora.com';
13
+
14
+ /**
15
+ * Push service base URL. `config.pushNotifications.apiUrl` wins, so a
16
+ * self-hosted or enterprise deployment can point at its own service
17
+ * without forking the SDK.
18
+ */
19
+ const resolvePushApiUrl = (): string => {
20
+ const config = store.getState().chatSettingStore?.config;
21
+ return (
22
+ (config?.pushNotifications?.apiUrl || '').trim() || DEFAULT_PUSH_API_URL
23
+ );
24
+ };
25
+
26
+ /**
27
+ * The XMPP host the JID is qualified with. Must match the host the client
28
+ * actually connects to, or the push service files the subscription under a
29
+ * JID nothing ever sends to.
30
+ */
31
+ const resolveXmppHost = (): string => {
32
+ const config = store.getState().chatSettingStore?.config;
33
+ return (config?.xmppSettings?.host || '').trim() || DEFAULT_XMPP_HOST;
34
+ };
6
35
 
7
36
  const pushAxios = axios.create({
8
- baseURL: PUSH_API_URL,
9
37
  headers: {
10
38
  'Content-Type': 'application/json',
11
39
  },
@@ -21,7 +49,7 @@ export interface PushSubscriptionPayload {
21
49
  export async function subscribeToPushNotifications(
22
50
  fcmToken: string,
23
51
  userJid: string,
24
- projectName: string = '',
52
+ projectName: string = ''
25
53
  ): Promise<void> {
26
54
  const deviceType: 'web' | 'android' | 'ios' = Platform.select({
27
55
  ios: 'ios',
@@ -29,27 +57,30 @@ export async function subscribeToPushNotifications(
29
57
  default: 'web',
30
58
  }) as 'web' | 'android' | 'ios';
31
59
 
60
+ // `userJid` arrives as either a bare localpart or an already-qualified
61
+ // JID depending on the caller; don't double-qualify it.
62
+ const jid = userJid.includes('@')
63
+ ? userJid
64
+ : `${userJid}@${resolveXmppHost()}`;
65
+
32
66
  const payload: PushSubscriptionPayload = {
33
67
  projectId: projectName,
34
68
  registrationToken: fcmToken,
35
69
  deviceType,
36
- jid: `${userJid}@xmpp.ethoradev.com`,
70
+ jid,
37
71
  };
38
72
 
39
- console.log('payload', payload);
40
-
41
73
  try {
42
74
  const token = store.getState().chatSettingStore?.user?.token || '';
43
75
 
44
76
  const response = await pushAxios.post('/subscriptions', payload, {
77
+ baseURL: resolvePushApiUrl(),
45
78
  headers: {
46
79
  Authorization: `Bearer ${token}`,
47
80
  },
48
81
  });
49
- console.log('Successfully subscribed to push notifications', response.data);
50
82
  return response.data;
51
83
  } catch (error: any) {
52
84
  console.error('Failed to subscribe to push notifications:', error);
53
85
  }
54
86
  }
55
-
@@ -1,9 +1,66 @@
1
1
  import { ApiRoom, DeleteRoomMember, PostAddRoomMember, PostReportRoom, PostRoom, RoomMember } from '../../types/models/room.model';
2
2
  import { store } from '../../roomStore';
3
- import { addRoom } from '../../roomStore/roomsSlice';
3
+ import { addRoom, mergeUsersSet } from '../../roomStore/roomsSlice';
4
4
  import { IRoom } from '../../types/types';
5
5
  import http from '../apiClient';
6
6
 
7
+ /**
8
+ * Populate `state.rooms.usersSet` (the identity cache Message.tsx resolves
9
+ * sender display names from) from the `members` arrays the REST `/chats/my`
10
+ * response carries. This is how the web SDK hydrates usersSet — it does NOT
11
+ * depend on the XMPP `getRoomMembers` IQ, which errors (`type=error`) on the
12
+ * current backend and left every sender showing a raw JID instead of a name.
13
+ *
14
+ * Keying: a message sender's `user.id` localpart is `<appId>_<userId>`, but
15
+ * a REST member only carries its Mongo `_id` (= `<userId>`). We derive the
16
+ * appId from the logged-in user's own xmppUsername (also `<appId>_<userId>`)
17
+ * and index each member under every id form a lookup might use:
18
+ * - `<appId>_<_id>` (matches the message sender localpart — the key case)
19
+ * - `_id` (fallback)
20
+ * - `xmppUsername` (raw + localpart) when the API does return one
21
+ */
22
+ function dispatchUsersSetFromRestItems(items: ApiRoom[]): void {
23
+ if (!items?.length) {return;}
24
+ const ownXmpp = String(
25
+ store.getState().chatSettingStore?.user?.xmppUsername || ''
26
+ );
27
+ const appId = ownXmpp.includes('_') ? ownXmpp.split('_')[0] : '';
28
+
29
+ const members: Record<string, RoomMember> = {};
30
+ for (const item of items) {
31
+ const list = Array.isArray((item as any)?.members) ? (item as any).members : [];
32
+ for (const m of list) {
33
+ if (!m) {continue;}
34
+ const entry: RoomMember = {
35
+ firstName: m.firstName || '',
36
+ lastName: m.lastName || '',
37
+ xmppUsername: m.xmppUsername || (appId && m._id ? `${appId}_${m._id}` : m._id || ''),
38
+ _id: m._id || '',
39
+ role: m.role,
40
+ ban_status: m.ban_status,
41
+ last_active: m.last_active,
42
+ jid: m.jid,
43
+ name: m.name,
44
+ } as RoomMember;
45
+
46
+ const keys = new Set<string>();
47
+ if (appId && m._id) {keys.add(`${appId}_${m._id}`);}
48
+ if (m._id) {keys.add(m._id);}
49
+ if (m.xmppUsername) {
50
+ keys.add(m.xmppUsername);
51
+ keys.add(String(m.xmppUsername).split('@')[0]);
52
+ }
53
+ keys.forEach((k) => {
54
+ if (k) {members[k] = entry;}
55
+ });
56
+ }
57
+ }
58
+
59
+ if (Object.keys(members).length > 0) {
60
+ store.dispatch(mergeUsersSet({ members }));
61
+ }
62
+ }
63
+
7
64
  interface ApiRoomMember {
8
65
  _id: string;
9
66
  firstName?: string;
@@ -90,6 +147,8 @@ function dispatchRoomsFromRestItems(items: ApiRoom[]): void {
90
147
  };
91
148
  store.dispatch(addRoom({ roomData: room }));
92
149
  }
150
+ // Hydrate the sender-name identity cache from the same REST payload.
151
+ dispatchUsersSetFromRestItems(items);
93
152
  }
94
153
 
95
154
  const GET_ROOMS_CACHE_MS = 60_000;
@@ -273,6 +332,55 @@ export async function deleteRoom(name: string) {
273
332
  }
274
333
  }
275
334
 
335
+ // POST /v1/chats/call/create/{chatName}
336
+ // Swagger documents the body as `additionalProperties: true`, we forward
337
+ // `kind: 'audio' | 'video'` so the server can stamp it on the broadcast
338
+ // call-token stanza for the callee. When the server doesn't recognize the
339
+ // field both sides still fall through to a video call (the default), which
340
+ // matches the prior single-mode behavior.
341
+ // No timeout is set on the shared `http` client (matches web — neither SDK
342
+ // configures one anywhere), so a stalled connection leaves this request
343
+ // hanging indefinitely with nothing surfaced to the caller. Observed live
344
+ // on the iOS Simulator: the same call the backend answers in ~0.6s from a
345
+ // plain curl sat unresolved for 75+ seconds through the Simulator's network
346
+ // stack. The UI's own 30s "no answer" ring timeout (VideoCallOverlay)
347
+ // doesn't touch this request at all — it just gives up and shows an error
348
+ // while the POST keeps sitting there, so a request that DOES eventually
349
+ // resolve races a call the user already dismissed. Bound just this
350
+ // request, not the shared client: file uploads on the same client
351
+ // legitimately take longer than any call-placement call should ever need.
352
+ const CALL_CREATE_TIMEOUT_MS = 15000;
353
+
354
+ export async function createChatCall(
355
+ chatName: string,
356
+ options?: { kind?: 'audio' | 'video' }
357
+ ): Promise<void> {
358
+ const token = store.getState().chatSettingStore.user.token || '';
359
+ const kind = options?.kind || 'video';
360
+
361
+ try {
362
+ await http.post(
363
+ `/chats/call/create/${chatName}`,
364
+ { kind },
365
+ {
366
+ headers: {
367
+ Authorization: token,
368
+ },
369
+ timeout: CALL_CREATE_TIMEOUT_MS,
370
+ }
371
+ );
372
+ } catch (error: any) {
373
+ // Distinguish a timeout from a real server rejection — the caller
374
+ // (CallButtons) surfaces this string directly on the ring/error
375
+ // screen, and "the network is being slow" is a very different thing
376
+ // to tell the user than "the server said no".
377
+ if (error?.code === 'ECONNABORTED' || /timeout/i.test(String(error?.message))) {
378
+ throw new Error('Call request timed out — check your connection and try again');
379
+ }
380
+ throw new Error('Error creating chat call');
381
+ }
382
+ }
383
+
276
384
  export function clearRoomsRestCache() {
277
385
  lastGetRoomsResponse = null;
278
386
  lastGetRoomsResponseAt = 0;