@ethora/chat-component-rn 26.8.6 → 26.8.8

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 (537) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +64 -2
  3. package/lib/commonjs/assets/icons.js +4 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/MainComponents/ChatHeader.js +28 -6
  6. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatRoom.js +9 -1
  8. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatWrapper.js +5 -3
  10. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js +47 -0
  12. package/lib/commonjs/components/MainComponents/EncryptedSendNotice.js.map +1 -0
  13. package/lib/commonjs/components/MainComponents/EncryptionCard.js +286 -0
  14. package/lib/commonjs/components/MainComponents/EncryptionCard.js.map +1 -0
  15. package/lib/commonjs/components/MainComponents/MediaMessage.js +7 -0
  16. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/ReduxWrapper.js +13 -0
  18. package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/SealedAttachment.js +231 -0
  20. package/lib/commonjs/components/MainComponents/SealedAttachment.js.map +1 -0
  21. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +26 -13
  22. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  23. package/lib/commonjs/components/MenuRoom/MenuRoom.js +5 -3
  24. package/lib/commonjs/components/MenuRoom/MenuRoom.js.map +1 -1
  25. package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js +2 -1
  26. package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js.map +1 -1
  27. package/lib/commonjs/components/MessageBubble/Message.js +69 -9
  28. package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
  29. package/lib/commonjs/components/MessageBubble/MessageInteractions.js +7 -4
  30. package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
  31. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +8 -5
  32. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +2 -2
  34. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +166 -21
  36. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +4 -0
  38. package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  39. package/lib/commonjs/components/Modals/Modal/Modal.js +33 -11
  40. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  41. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +8 -8
  42. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  43. package/lib/commonjs/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js +279 -0
  44. package/lib/commonjs/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js.map +1 -0
  45. package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +10 -8
  46. package/lib/commonjs/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js +13 -11
  48. package/lib/commonjs/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
  49. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +50 -15
  50. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  51. package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js +121 -0
  52. package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -0
  53. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +10 -1
  54. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  55. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +32 -9
  56. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  57. package/lib/commonjs/components/RoomComponents/LastMessageItem.js +6 -0
  58. package/lib/commonjs/components/RoomComponents/LastMessageItem.js.map +1 -1
  59. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js +2 -2
  60. package/lib/commonjs/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +4 -6
  62. package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  63. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
  64. package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  65. package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js +41 -0
  66. package/lib/commonjs/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
  67. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +2 -2
  68. package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  69. package/lib/commonjs/components/Thread/ThreadWrapper.js +56 -46
  70. package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
  71. package/lib/commonjs/components/UsersList/UsersList.js +2 -1
  72. package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
  73. package/lib/commonjs/components/styled/SendInput.js +4 -2
  74. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  75. package/lib/commonjs/e2ee/crypto.js +207 -0
  76. package/lib/commonjs/e2ee/crypto.js.map +1 -0
  77. package/lib/commonjs/e2ee/deviceStore.js +84 -0
  78. package/lib/commonjs/e2ee/deviceStore.js.map +1 -0
  79. package/lib/commonjs/e2ee/fileCipher.js +95 -0
  80. package/lib/commonjs/e2ee/fileCipher.js.map +1 -0
  81. package/lib/commonjs/e2ee/fileEnvelope.js +79 -0
  82. package/lib/commonjs/e2ee/fileEnvelope.js.map +1 -0
  83. package/lib/commonjs/e2ee/index.js +210 -0
  84. package/lib/commonjs/e2ee/index.js.map +1 -0
  85. package/lib/commonjs/e2ee/limits.js +9 -0
  86. package/lib/commonjs/e2ee/limits.js.map +1 -0
  87. package/lib/commonjs/e2ee/ns.js +8 -0
  88. package/lib/commonjs/e2ee/ns.js.map +1 -0
  89. package/lib/commonjs/e2ee/omemo.js +622 -0
  90. package/lib/commonjs/e2ee/omemo.js.map +1 -0
  91. package/lib/commonjs/e2ee/protobuf.js +149 -0
  92. package/lib/commonjs/e2ee/protobuf.js.map +1 -0
  93. package/lib/commonjs/e2ee/ratchet.js +238 -0
  94. package/lib/commonjs/e2ee/ratchet.js.map +1 -0
  95. package/lib/commonjs/e2ee/sealedBody.js +23 -0
  96. package/lib/commonjs/e2ee/sealedBody.js.map +1 -0
  97. package/lib/commonjs/e2ee/sealedFiles.js +174 -0
  98. package/lib/commonjs/e2ee/sealedFiles.js.map +1 -0
  99. package/lib/commonjs/e2ee/send.js +54 -0
  100. package/lib/commonjs/e2ee/send.js.map +1 -0
  101. package/lib/commonjs/e2ee/stanza.js +114 -0
  102. package/lib/commonjs/e2ee/stanza.js.map +1 -0
  103. package/lib/commonjs/e2ee/store.js +43 -0
  104. package/lib/commonjs/e2ee/store.js.map +1 -0
  105. package/lib/commonjs/helpers/accountName.js +23 -0
  106. package/lib/commonjs/helpers/accountName.js.map +1 -0
  107. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +2 -0
  108. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  109. package/lib/commonjs/helpers/constants/MODAL_TYPES.js +1 -0
  110. package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
  111. package/lib/commonjs/helpers/createMessageFromXml.js +19 -4
  112. package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
  113. package/lib/commonjs/helpers/createUserNameFromSetUser.js +2 -1
  114. package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
  115. package/lib/commonjs/helpers/displayName.js +16 -0
  116. package/lib/commonjs/helpers/displayName.js.map +1 -0
  117. package/lib/commonjs/helpers/persistCrypto.js +5 -0
  118. package/lib/commonjs/helpers/persistCrypto.js.map +1 -1
  119. package/lib/commonjs/helpers/preferencesStorage.js.map +1 -1
  120. package/lib/commonjs/helpers/secureKeyValue.js +20 -0
  121. package/lib/commonjs/helpers/secureKeyValue.js.map +1 -1
  122. package/lib/commonjs/helpers/videoCache.js +136 -0
  123. package/lib/commonjs/helpers/videoCache.js.map +1 -0
  124. package/lib/commonjs/hooks/useChatSettingState.js +2 -0
  125. package/lib/commonjs/hooks/useChatSettingState.js.map +1 -1
  126. package/lib/commonjs/hooks/useChatWrapperInit.js +4 -0
  127. package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
  128. package/lib/commonjs/hooks/useLogout.js +8 -0
  129. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  130. package/lib/commonjs/hooks/useSendMessage.js +71 -7
  131. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  132. package/lib/commonjs/i18n/strings.js +367 -1
  133. package/lib/commonjs/i18n/strings.js.map +1 -1
  134. package/lib/commonjs/i18n/useT.js +8 -4
  135. package/lib/commonjs/i18n/useT.js.map +1 -1
  136. package/lib/commonjs/main.js +13 -0
  137. package/lib/commonjs/main.js.map +1 -1
  138. package/lib/commonjs/networking/api-requests/auth.api.js +4 -1
  139. package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
  140. package/lib/commonjs/networking/api-requests/rooms.api.js +111 -17
  141. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  142. package/lib/commonjs/networking/api-requests/user.api.js +13 -0
  143. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  144. package/lib/commonjs/networking/stanzaHandlers.js +1 -1
  145. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  146. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +40 -0
  147. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  148. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
  149. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  150. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +13 -6
  151. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  152. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
  153. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  154. package/lib/commonjs/networking/xmppClient.js +6 -0
  155. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  156. package/lib/commonjs/roomStore/chatSettingsSlice.js +7 -2
  157. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  158. package/lib/commonjs/roomStore/persistBackend.js +9 -12
  159. package/lib/commonjs/roomStore/persistBackend.js.map +1 -1
  160. package/lib/commonjs/roomStore/persistence.js +8 -1
  161. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  162. package/lib/commonjs/services/languageSettings.js +177 -0
  163. package/lib/commonjs/services/languageSettings.js.map +1 -0
  164. package/lib/commonjs/version.js +1 -1
  165. package/lib/module/assets/icons.js +3 -1
  166. package/lib/module/assets/icons.js.map +1 -1
  167. package/lib/module/components/MainComponents/ChatHeader.js +29 -7
  168. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  169. package/lib/module/components/MainComponents/ChatRoom.js +9 -1
  170. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  171. package/lib/module/components/MainComponents/ChatWrapper.js +5 -3
  172. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  173. package/lib/module/components/MainComponents/EncryptedSendNotice.js +42 -0
  174. package/lib/module/components/MainComponents/EncryptedSendNotice.js.map +1 -0
  175. package/lib/module/components/MainComponents/EncryptionCard.js +281 -0
  176. package/lib/module/components/MainComponents/EncryptionCard.js.map +1 -0
  177. package/lib/module/components/MainComponents/MediaMessage.js +7 -0
  178. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  179. package/lib/module/components/MainComponents/ReduxWrapper.js +14 -1
  180. package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
  181. package/lib/module/components/MainComponents/SealedAttachment.js +224 -0
  182. package/lib/module/components/MainComponents/SealedAttachment.js.map +1 -0
  183. package/lib/module/components/Menu/HeaderRoomListMenu.js +26 -13
  184. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  185. package/lib/module/components/MenuRoom/MenuRoom.js +5 -3
  186. package/lib/module/components/MenuRoom/MenuRoom.js.map +1 -1
  187. package/lib/module/components/MessageBubble/BottomReplyContainer.js +2 -1
  188. package/lib/module/components/MessageBubble/BottomReplyContainer.js.map +1 -1
  189. package/lib/module/components/MessageBubble/Message.js +72 -12
  190. package/lib/module/components/MessageBubble/Message.js.map +1 -1
  191. package/lib/module/components/MessageBubble/MessageInteractions.js +7 -4
  192. package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
  193. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +8 -5
  194. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  195. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +2 -2
  196. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
  197. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +168 -23
  198. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  199. package/lib/module/components/Modals/FilePreviewModal/PdfView.js +4 -0
  200. package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
  201. package/lib/module/components/Modals/Modal/Modal.js +33 -11
  202. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  203. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +8 -8
  204. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  205. package/lib/module/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js +274 -0
  206. package/lib/module/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.js.map +1 -0
  207. package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js +10 -8
  208. package/lib/module/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.js.map +1 -1
  209. package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js +13 -11
  210. package/lib/module/components/Modals/SettingsModals/Visibility/VisibilityModal.js.map +1 -1
  211. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +54 -18
  212. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  213. package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js +116 -0
  214. package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -0
  215. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +10 -1
  216. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  217. package/lib/module/components/RoomComponents/ChatRoomItem.js +32 -9
  218. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  219. package/lib/module/components/RoomComponents/LastMessageItem.js +6 -0
  220. package/lib/module/components/RoomComponents/LastMessageItem.js.map +1 -1
  221. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js +2 -2
  222. package/lib/module/components/RoomComponents/styled/LastAudioMessage.js.map +1 -1
  223. package/lib/module/components/RoomComponents/styled/LastMessageFile.js +4 -6
  224. package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
  225. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +2 -2
  226. package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
  227. package/lib/module/components/RoomComponents/styled/LastMessageSealed.js +36 -0
  228. package/lib/module/components/RoomComponents/styled/LastMessageSealed.js.map +1 -0
  229. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +2 -2
  230. package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
  231. package/lib/module/components/Thread/ThreadWrapper.js +57 -47
  232. package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
  233. package/lib/module/components/UsersList/UsersList.js +2 -1
  234. package/lib/module/components/UsersList/UsersList.js.map +1 -1
  235. package/lib/module/components/styled/SendInput.js +4 -2
  236. package/lib/module/components/styled/SendInput.js.map +1 -1
  237. package/lib/module/e2ee/crypto.js +170 -0
  238. package/lib/module/e2ee/crypto.js.map +1 -0
  239. package/lib/module/e2ee/deviceStore.js +77 -0
  240. package/lib/module/e2ee/deviceStore.js.map +1 -0
  241. package/lib/module/e2ee/fileCipher.js +90 -0
  242. package/lib/module/e2ee/fileCipher.js.map +1 -0
  243. package/lib/module/e2ee/fileEnvelope.js +66 -0
  244. package/lib/module/e2ee/fileEnvelope.js.map +1 -0
  245. package/lib/module/e2ee/index.js +185 -0
  246. package/lib/module/e2ee/index.js.map +1 -0
  247. package/lib/module/e2ee/limits.js +5 -0
  248. package/lib/module/e2ee/limits.js.map +1 -0
  249. package/lib/module/e2ee/ns.js +4 -0
  250. package/lib/module/e2ee/ns.js.map +1 -0
  251. package/lib/module/e2ee/omemo.js +610 -0
  252. package/lib/module/e2ee/omemo.js.map +1 -0
  253. package/lib/module/e2ee/protobuf.js +140 -0
  254. package/lib/module/e2ee/protobuf.js.map +1 -0
  255. package/lib/module/e2ee/ratchet.js +228 -0
  256. package/lib/module/e2ee/ratchet.js.map +1 -0
  257. package/lib/module/e2ee/sealedBody.js +19 -0
  258. package/lib/module/e2ee/sealedBody.js.map +1 -0
  259. package/lib/module/e2ee/sealedFiles.js +154 -0
  260. package/lib/module/e2ee/sealedFiles.js.map +1 -0
  261. package/lib/module/e2ee/send.js +48 -0
  262. package/lib/module/e2ee/send.js.map +1 -0
  263. package/lib/module/e2ee/stanza.js +107 -0
  264. package/lib/module/e2ee/stanza.js.map +1 -0
  265. package/lib/module/e2ee/store.js +35 -0
  266. package/lib/module/e2ee/store.js.map +1 -0
  267. package/lib/module/helpers/accountName.js +18 -0
  268. package/lib/module/helpers/accountName.js.map +1 -0
  269. package/lib/module/helpers/constants/MODAL_COMPONENTS.js +2 -0
  270. package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  271. package/lib/module/helpers/constants/MODAL_TYPES.js +1 -0
  272. package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
  273. package/lib/module/helpers/createMessageFromXml.js +19 -4
  274. package/lib/module/helpers/createMessageFromXml.js.map +1 -1
  275. package/lib/module/helpers/createUserNameFromSetUser.js +3 -1
  276. package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
  277. package/lib/module/helpers/displayName.js +11 -0
  278. package/lib/module/helpers/displayName.js.map +1 -0
  279. package/lib/module/helpers/persistCrypto.js +4 -0
  280. package/lib/module/helpers/persistCrypto.js.map +1 -1
  281. package/lib/module/helpers/preferencesStorage.js.map +1 -1
  282. package/lib/module/helpers/secureKeyValue.js +19 -0
  283. package/lib/module/helpers/secureKeyValue.js.map +1 -1
  284. package/lib/module/helpers/videoCache.js +125 -0
  285. package/lib/module/helpers/videoCache.js.map +1 -0
  286. package/lib/module/hooks/useChatSettingState.js +2 -0
  287. package/lib/module/hooks/useChatSettingState.js.map +1 -1
  288. package/lib/module/hooks/useChatWrapperInit.js +4 -0
  289. package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
  290. package/lib/module/hooks/useLogout.js +8 -0
  291. package/lib/module/hooks/useLogout.js.map +1 -1
  292. package/lib/module/hooks/useSendMessage.js +71 -7
  293. package/lib/module/hooks/useSendMessage.js.map +1 -1
  294. package/lib/module/i18n/strings.js +367 -1
  295. package/lib/module/i18n/strings.js.map +1 -1
  296. package/lib/module/i18n/useT.js +8 -4
  297. package/lib/module/i18n/useT.js.map +1 -1
  298. package/lib/module/main.js +1 -0
  299. package/lib/module/main.js.map +1 -1
  300. package/lib/module/networking/api-requests/auth.api.js +4 -1
  301. package/lib/module/networking/api-requests/auth.api.js.map +1 -1
  302. package/lib/module/networking/api-requests/rooms.api.js +109 -18
  303. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  304. package/lib/module/networking/api-requests/user.api.js +12 -0
  305. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  306. package/lib/module/networking/stanzaHandlers.js +1 -1
  307. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  308. package/lib/module/networking/xmpp/handleStanzas.xmpp.js +38 -0
  309. package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  310. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +16 -3
  311. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  312. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +13 -6
  313. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  314. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +14 -6
  315. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  316. package/lib/module/networking/xmppClient.js +6 -0
  317. package/lib/module/networking/xmppClient.js.map +1 -1
  318. package/lib/module/roomStore/chatSettingsSlice.js +5 -1
  319. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  320. package/lib/module/roomStore/persistBackend.js +10 -13
  321. package/lib/module/roomStore/persistBackend.js.map +1 -1
  322. package/lib/module/roomStore/persistence.js +8 -1
  323. package/lib/module/roomStore/persistence.js.map +1 -1
  324. package/lib/module/services/languageSettings.js +164 -0
  325. package/lib/module/services/languageSettings.js.map +1 -0
  326. package/lib/module/version.js +1 -1
  327. package/lib/typescript/assets/icons.d.ts +8 -0
  328. package/lib/typescript/assets/icons.d.ts.map +1 -1
  329. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  330. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  331. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  332. package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts +4 -0
  333. package/lib/typescript/components/MainComponents/EncryptedSendNotice.d.ts.map +1 -0
  334. package/lib/typescript/components/MainComponents/EncryptionCard.d.ts +10 -0
  335. package/lib/typescript/components/MainComponents/EncryptionCard.d.ts.map +1 -0
  336. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  337. package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
  338. package/lib/typescript/components/MainComponents/SealedAttachment.d.ts +13 -0
  339. package/lib/typescript/components/MainComponents/SealedAttachment.d.ts.map +1 -0
  340. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +7 -1
  341. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  342. package/lib/typescript/components/MenuRoom/MenuRoom.d.ts.map +1 -1
  343. package/lib/typescript/components/MessageBubble/BottomReplyContainer.d.ts.map +1 -1
  344. package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
  345. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
  346. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  347. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  348. package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
  349. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  350. package/lib/typescript/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.d.ts +15 -0
  351. package/lib/typescript/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.d.ts.map +1 -0
  352. package/lib/typescript/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.d.ts.map +1 -1
  353. package/lib/typescript/components/Modals/SettingsModals/Visibility/VisibilityModal.d.ts.map +1 -1
  354. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  355. package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts +14 -0
  356. package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts.map +1 -0
  357. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  358. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  359. package/lib/typescript/components/RoomComponents/LastMessageItem.d.ts.map +1 -1
  360. package/lib/typescript/components/RoomComponents/styled/LastAudioMessage.d.ts.map +1 -1
  361. package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts +7 -0
  362. package/lib/typescript/components/RoomComponents/styled/LastMessageSealed.d.ts.map +1 -0
  363. package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
  364. package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
  365. package/lib/typescript/components/styled/SendInput.d.ts +1 -0
  366. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  367. package/lib/typescript/e2ee/crypto.d.ts +28 -0
  368. package/lib/typescript/e2ee/crypto.d.ts.map +1 -0
  369. package/lib/typescript/e2ee/deviceStore.d.ts +4 -0
  370. package/lib/typescript/e2ee/deviceStore.d.ts.map +1 -0
  371. package/lib/typescript/e2ee/fileCipher.d.ts +7 -0
  372. package/lib/typescript/e2ee/fileCipher.d.ts.map +1 -0
  373. package/lib/typescript/e2ee/fileEnvelope.d.ts +27 -0
  374. package/lib/typescript/e2ee/fileEnvelope.d.ts.map +1 -0
  375. package/lib/typescript/e2ee/index.d.ts +23 -0
  376. package/lib/typescript/e2ee/index.d.ts.map +1 -0
  377. package/lib/typescript/e2ee/limits.d.ts +3 -0
  378. package/lib/typescript/e2ee/limits.d.ts.map +1 -0
  379. package/lib/typescript/e2ee/ns.d.ts +2 -0
  380. package/lib/typescript/e2ee/ns.d.ts.map +1 -0
  381. package/lib/typescript/e2ee/omemo.d.ts +64 -0
  382. package/lib/typescript/e2ee/omemo.d.ts.map +1 -0
  383. package/lib/typescript/e2ee/protobuf.d.ts +25 -0
  384. package/lib/typescript/e2ee/protobuf.d.ts.map +1 -0
  385. package/lib/typescript/e2ee/ratchet.d.ts +39 -0
  386. package/lib/typescript/e2ee/ratchet.d.ts.map +1 -0
  387. package/lib/typescript/e2ee/sealedBody.d.ts +2 -0
  388. package/lib/typescript/e2ee/sealedBody.d.ts.map +1 -0
  389. package/lib/typescript/e2ee/sealedFiles.d.ts +31 -0
  390. package/lib/typescript/e2ee/sealedFiles.d.ts.map +1 -0
  391. package/lib/typescript/e2ee/send.d.ts +6 -0
  392. package/lib/typescript/e2ee/send.d.ts.map +1 -0
  393. package/lib/typescript/e2ee/stanza.d.ts +8 -0
  394. package/lib/typescript/e2ee/stanza.d.ts.map +1 -0
  395. package/lib/typescript/e2ee/store.d.ts +16 -0
  396. package/lib/typescript/e2ee/store.d.ts.map +1 -0
  397. package/lib/typescript/helpers/accountName.d.ts +7 -0
  398. package/lib/typescript/helpers/accountName.d.ts.map +1 -0
  399. package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
  400. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +1 -0
  401. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
  402. package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
  403. package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
  404. package/lib/typescript/helpers/displayName.d.ts +2 -0
  405. package/lib/typescript/helpers/displayName.d.ts.map +1 -0
  406. package/lib/typescript/helpers/persistCrypto.d.ts +1 -0
  407. package/lib/typescript/helpers/persistCrypto.d.ts.map +1 -1
  408. package/lib/typescript/helpers/preferencesStorage.d.ts +4 -0
  409. package/lib/typescript/helpers/preferencesStorage.d.ts.map +1 -1
  410. package/lib/typescript/helpers/secureKeyValue.d.ts +4 -0
  411. package/lib/typescript/helpers/secureKeyValue.d.ts.map +1 -1
  412. package/lib/typescript/helpers/videoCache.d.ts +19 -0
  413. package/lib/typescript/helpers/videoCache.d.ts.map +1 -0
  414. package/lib/typescript/hooks/useChatSettingState.d.ts +1 -0
  415. package/lib/typescript/hooks/useChatSettingState.d.ts.map +1 -1
  416. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  417. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  418. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  419. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  420. package/lib/typescript/i18n/useT.d.ts.map +1 -1
  421. package/lib/typescript/main.d.ts +2 -0
  422. package/lib/typescript/main.d.ts.map +1 -1
  423. package/lib/typescript/networking/api-requests/auth.api.d.ts +4 -1
  424. package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
  425. package/lib/typescript/networking/api-requests/rooms.api.d.ts +22 -1
  426. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  427. package/lib/typescript/networking/api-requests/user.api.d.ts +6 -0
  428. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  429. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  430. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts +1 -0
  431. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
  432. package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
  433. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
  434. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
  435. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  436. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
  437. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  438. package/lib/typescript/roomStore/persistBackend.d.ts.map +1 -1
  439. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  440. package/lib/typescript/services/languageSettings.d.ts +29 -0
  441. package/lib/typescript/services/languageSettings.d.ts.map +1 -0
  442. package/lib/typescript/types/models/message.model.d.ts +5 -0
  443. package/lib/typescript/types/models/message.model.d.ts.map +1 -1
  444. package/lib/typescript/types/models/room.model.d.ts +5 -0
  445. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  446. package/lib/typescript/types/models/user.model.d.ts +4 -0
  447. package/lib/typescript/types/models/user.model.d.ts.map +1 -1
  448. package/lib/typescript/types/types.d.ts +25 -0
  449. package/lib/typescript/types/types.d.ts.map +1 -1
  450. package/lib/typescript/version.d.ts +1 -1
  451. package/package.json +8 -4
  452. package/src/assets/icons.tsx +27 -0
  453. package/src/components/MainComponents/ChatHeader.tsx +30 -9
  454. package/src/components/MainComponents/ChatRoom.tsx +11 -1
  455. package/src/components/MainComponents/ChatWrapper.tsx +5 -3
  456. package/src/components/MainComponents/EncryptedSendNotice.tsx +35 -0
  457. package/src/components/MainComponents/EncryptionCard.tsx +287 -0
  458. package/src/components/MainComponents/MediaMessage.tsx +5 -0
  459. package/src/components/MainComponents/ReduxWrapper.tsx +11 -0
  460. package/src/components/MainComponents/SealedAttachment.tsx +251 -0
  461. package/src/components/Menu/HeaderRoomListMenu.tsx +40 -13
  462. package/src/components/MenuRoom/MenuRoom.tsx +5 -3
  463. package/src/components/MessageBubble/BottomReplyContainer.tsx +2 -1
  464. package/src/components/MessageBubble/Message.tsx +99 -9
  465. package/src/components/MessageBubble/MessageInteractions.tsx +7 -6
  466. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +8 -5
  467. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +2 -2
  468. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +188 -40
  469. package/src/components/Modals/FilePreviewModal/PdfView.tsx +4 -0
  470. package/src/components/Modals/Modal/Modal.tsx +44 -16
  471. package/src/components/Modals/NewChatModal/NewChatModal.tsx +8 -8
  472. package/src/components/Modals/SettingsModals/ChangePassword/ChangePasswordModal.tsx +316 -0
  473. package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +10 -15
  474. package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +13 -14
  475. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +72 -20
  476. package/src/components/Modals/UserSettingsModal/LanguageCard.tsx +144 -0
  477. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +13 -1
  478. package/src/components/RoomComponents/ChatRoomItem.tsx +23 -11
  479. package/src/components/RoomComponents/LastMessageItem.tsx +5 -0
  480. package/src/components/RoomComponents/styled/LastAudioMessage.tsx +3 -1
  481. package/src/components/RoomComponents/styled/LastMessageFile.tsx +2 -2
  482. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +1 -1
  483. package/src/components/RoomComponents/styled/LastMessageSealed.tsx +31 -0
  484. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +1 -1
  485. package/src/components/Thread/ThreadWrapper.tsx +17 -2
  486. package/src/components/UsersList/UsersList.tsx +2 -1
  487. package/src/components/styled/SendInput.tsx +5 -2
  488. package/src/e2ee/crypto.ts +194 -0
  489. package/src/e2ee/deviceStore.ts +80 -0
  490. package/src/e2ee/fileCipher.ts +86 -0
  491. package/src/e2ee/fileEnvelope.ts +115 -0
  492. package/src/e2ee/index.ts +192 -0
  493. package/src/e2ee/limits.ts +2 -0
  494. package/src/e2ee/ns.ts +1 -0
  495. package/src/e2ee/omemo.ts +802 -0
  496. package/src/e2ee/protobuf.ts +188 -0
  497. package/src/e2ee/ratchet.ts +271 -0
  498. package/src/e2ee/sealedBody.ts +17 -0
  499. package/src/e2ee/sealedFiles.ts +181 -0
  500. package/src/e2ee/send.ts +70 -0
  501. package/src/e2ee/stanza.ts +133 -0
  502. package/src/e2ee/store.ts +54 -0
  503. package/src/helpers/accountName.ts +15 -0
  504. package/src/helpers/constants/MODAL_COMPONENTS.tsx +2 -0
  505. package/src/helpers/constants/MODAL_TYPES.ts +1 -0
  506. package/src/helpers/createMessageFromXml.ts +31 -6
  507. package/src/helpers/createUserNameFromSetUser.ts +2 -1
  508. package/src/helpers/displayName.ts +9 -0
  509. package/src/helpers/persistCrypto.ts +5 -0
  510. package/src/helpers/preferencesStorage.ts +4 -0
  511. package/src/helpers/secureKeyValue.ts +15 -0
  512. package/src/helpers/videoCache.ts +138 -0
  513. package/src/hooks/useChatSettingState.tsx +4 -0
  514. package/src/hooks/useChatWrapperInit.ts +4 -0
  515. package/src/hooks/useLogout.tsx +9 -0
  516. package/src/hooks/useSendMessage.tsx +71 -5
  517. package/src/i18n/strings.ts +367 -1
  518. package/src/i18n/useT.ts +6 -4
  519. package/src/main.ts +2 -0
  520. package/src/networking/api-requests/auth.api.ts +9 -1
  521. package/src/networking/api-requests/rooms.api.ts +121 -18
  522. package/src/networking/api-requests/user.api.ts +9 -0
  523. package/src/networking/stanzaHandlers.ts +1 -0
  524. package/src/networking/xmpp/handleStanzas.xmpp.ts +49 -0
  525. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +19 -1
  526. package/src/networking/xmpp/sendTextMessage.xmpp.ts +17 -10
  527. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +23 -10
  528. package/src/networking/xmppClient.ts +6 -0
  529. package/src/roomStore/chatSettingsSlice.ts +13 -0
  530. package/src/roomStore/persistBackend.ts +8 -11
  531. package/src/roomStore/persistence.ts +15 -0
  532. package/src/services/languageSettings.ts +143 -0
  533. package/src/types/models/message.model.ts +5 -0
  534. package/src/types/models/room.model.ts +5 -0
  535. package/src/types/models/user.model.ts +4 -0
  536. package/src/types/types.ts +25 -0
  537. package/src/version.ts +1 -1
@@ -0,0 +1,143 @@
1
+ // The user's two languages, as the backend keeps them on the profile:
2
+ //
3
+ // appLanguage - the interface: the chat's captions (`uiLocale`).
4
+ // chatLanguage - what incoming messages are translated into, and the
5
+ // language declared on the user's own messages (`langSource`).
6
+ //
7
+ // Both are per account, not per device: a choice made here is written to the
8
+ // profile with `PUT /v1/users` - one field per request, as the web app does,
9
+ // so writing one never rewrites the other - and the profile's values are
10
+ // applied when a session starts. The last choice is also kept on the device,
11
+ // so the interface comes up in the right language before the profile loads.
12
+ //
13
+ // Translation itself happens on the server, per the reader's chatLanguage:
14
+ // that is why the choice has to reach the profile for a translation to ever
15
+ // arrive on a message.
16
+
17
+ import { store } from '../roomStore';
18
+ import { setLangSource, setUiLocale, updateUser } from '../roomStore/chatSettingsSlice';
19
+ import { savePreferences } from '../helpers/preferencesStorage';
20
+ import { updateMe } from '../networking/api-requests/user.api';
21
+ import { LANGUAGE_OPTIONS } from '../helpers/constants/LANGUAGE_OPTIONS';
22
+ import type { IConfig } from '../types/types';
23
+
24
+ export interface LanguageChoice {
25
+ /** BCP-47 tag, e.g. "fr-CA". */
26
+ id: string;
27
+ /** The language's own name for itself. */
28
+ name: string;
29
+ }
30
+
31
+ const AUTONYMS: Record<string, string> = {
32
+ en: 'English',
33
+ es: 'Español',
34
+ fr: 'Français',
35
+ pt: 'Português',
36
+ ht: 'Kreyòl ayisyen',
37
+ zh: '中文',
38
+ de: 'Deutsch',
39
+ it: 'Italiano',
40
+ uk: 'Українська',
41
+ ru: 'Русский',
42
+ pl: 'Polski',
43
+ tr: 'Türkçe',
44
+ ar: 'العربية',
45
+ hi: 'हिन्दी',
46
+ ja: '日本語',
47
+ ko: '한국어',
48
+ nl: 'Nederlands',
49
+ sv: 'Svenska',
50
+ };
51
+
52
+ /** "en-ca" -> "en-CA"; anything that is not a language tag -> undefined. */
53
+ export const canonicalLocale = (value: unknown): string | undefined => {
54
+ const raw = String(value ?? '').trim();
55
+ const match = /^([A-Za-z]{2,3})(?:[-_]([A-Za-z0-9]{2,8}))?$/.exec(raw);
56
+ if (!match) {return undefined;}
57
+ const [, language, region] = match;
58
+ const base = language!.toLowerCase();
59
+ if (!region) {return base;}
60
+ return `${base}-${region.length === 2 ? region.toUpperCase() : region}`;
61
+ };
62
+
63
+ export const languageLabel = (id: string): string => {
64
+ const exact = LANGUAGE_OPTIONS.find((o) => o.id.toLowerCase() === id.toLowerCase());
65
+ if (exact) {return exact.name;}
66
+ return AUTONYMS[id.split('-')[0]!.toLowerCase()] || id;
67
+ };
68
+
69
+ const toChoices = (ids: string[] | undefined): LanguageChoice[] | undefined => {
70
+ const list = (ids || []).map(canonicalLocale).filter((id): id is string => !!id);
71
+ return list.length ? list.map((id) => ({ id, name: languageLabel(id) })) : undefined;
72
+ };
73
+
74
+ export const languagesEnabled = (config?: IConfig | null): boolean =>
75
+ config?.settings?.languages?.enabled === true;
76
+
77
+ /** What the interface can be shown in. */
78
+ export const appLanguageChoices = (config?: IConfig | null): LanguageChoice[] =>
79
+ toChoices(config?.settings?.languages?.appLanguages) ??
80
+ LANGUAGE_OPTIONS.map((o) => ({ id: o.id, name: o.name }));
81
+
82
+ /** What messages can be translated into. */
83
+ export const chatLanguageChoices = (config?: IConfig | null): LanguageChoice[] =>
84
+ toChoices(config?.settings?.languages?.chatLanguages) ??
85
+ LANGUAGE_OPTIONS.map((o) => ({ id: o.id, name: o.name }));
86
+
87
+ async function writeToProfile(field: 'appLanguage' | 'chatLanguage', value: string) {
88
+ try {
89
+ await updateMe({ [field]: value });
90
+ // The field alone: replacing the whole user with the backend's profile
91
+ // would drop what only this side holds (tokens, the XMPP password).
92
+ store.dispatch(updateUser({ updates: { [field]: value } }));
93
+ return true;
94
+ } catch (error) {
95
+ // The local choice stands: a flaky network degrades to a device-only
96
+ // setting rather than silently reverting what the user just picked.
97
+ console.warn(`[languages] could not save ${field}`, error);
98
+ return false;
99
+ }
100
+ }
101
+
102
+ /** The interface language. Applied at once; written to the profile behind. */
103
+ export async function setAppLanguage(id: string): Promise<boolean> {
104
+ const locale = canonicalLocale(id);
105
+ if (!locale) {return false;}
106
+ store.dispatch(setUiLocale(locale));
107
+ void savePreferences({ uiLocale: locale });
108
+ if (!languagesEnabled(store.getState().chatSettingStore.config)) {return true;}
109
+ return writeToProfile('appLanguage', locale);
110
+ }
111
+
112
+ /** The language messages are translated into. */
113
+ export async function setChatLanguage(id: string): Promise<boolean> {
114
+ const locale = canonicalLocale(id);
115
+ if (!locale) {return false;}
116
+ store.dispatch(setLangSource(locale as any));
117
+ void savePreferences({ chatLanguage: locale });
118
+ if (!languagesEnabled(store.getState().chatSettingStore.config)) {return true;}
119
+ return writeToProfile('chatLanguage', locale);
120
+ }
121
+
122
+ /**
123
+ * The profile's languages, applied when a session starts. The profile is the
124
+ * account's truth; what the device remembered only bridged the gap until
125
+ * now. A profile that has never chosen leaves the device's value alone.
126
+ */
127
+ export function applyProfileLanguages(
128
+ user: { appLanguage?: string | null; chatLanguage?: string | null } | null | undefined,
129
+ config?: IConfig | null
130
+ ): void {
131
+ if (!user || !languagesEnabled(config)) {return;}
132
+ const app = canonicalLocale(user.appLanguage);
133
+ if (app && app !== store.getState().chatSettingStore.uiLocale) {
134
+ store.dispatch(setUiLocale(app));
135
+ void savePreferences({ uiLocale: app });
136
+ }
137
+ // Unset means "follow the app language" - the backend's own rule.
138
+ const chat = canonicalLocale(user.chatLanguage) || app;
139
+ if (chat && chat !== store.getState().chatSettingStore.langSource) {
140
+ store.dispatch(setLangSource(chat as any));
141
+ void savePreferences({ chatLanguage: chat });
142
+ }
143
+ }
@@ -17,6 +17,11 @@ export interface IMessage {
17
17
  mimetype?: string;
18
18
  location?: string;
19
19
  pending?: boolean;
20
+ unencrypted?: boolean;
21
+ undecryptable?: string;
22
+ e2eeError?: string;
23
+ e2eeKeys?: string[];
24
+ clientEncrypted?: string;
20
25
  timestamp?: number;
21
26
  showInChannel?: string;
22
27
  activeMessage?: boolean;
@@ -11,6 +11,8 @@ export interface RoomMember {
11
11
  name?: string;
12
12
  role?: string;
13
13
  last_active?: number;
14
+ profileImage?: string;
15
+ description?: string;
14
16
  }
15
17
 
16
18
  export interface RoomLastMessage {
@@ -29,6 +31,7 @@ export interface IRoom {
29
31
 
30
32
  members?: RoomMember[];
31
33
  type?: 'public' | 'group' | 'private';
34
+ e2ee?: boolean;
32
35
  creteadAt?: string; // Typo? Should it be createdAt?
33
36
 
34
37
  appId?: string;
@@ -79,6 +82,7 @@ export interface ApiRoom {
79
82
  name: string;
80
83
  type: 'public' | 'group' | 'private';
81
84
 
85
+ e2ee?: boolean;
82
86
  title?: string;
83
87
  description?: string;
84
88
  picture?: string;
@@ -93,6 +97,7 @@ export interface ApiRoom {
93
97
  __v?: string;
94
98
  jid?: string;
95
99
  participants?: number;
100
+ usersCnt?: number;
96
101
  icon?: string;
97
102
  muted?: boolean;
98
103
  /** See ApiRoomLastMessage. */
@@ -54,6 +54,10 @@ export interface User {
54
54
  isAssetsOpen?: boolean;
55
55
  isAgreeWithTerms?: boolean;
56
56
  isSuperAdmin?: boolean;
57
+ /** Interface language on the profile (BCP-47). */
58
+ appLanguage?: string | null;
59
+ /** Language messages are translated into (BCP-47); unset = follow appLanguage. */
60
+ chatLanguage?: string | null;
57
61
  }
58
62
 
59
63
  export interface ConfigUser {
@@ -47,6 +47,7 @@ export interface IRoom {
47
47
  // in ChatProfileModal under Description / Chat type fields.
48
48
  description?: string;
49
49
  type?: string;
50
+ e2ee?: boolean;
50
51
 
51
52
  roomMembers?: RoomMember[];
52
53
  members?: RoomMember[];
@@ -358,6 +359,9 @@ export interface TypographyConfig {
358
359
  export interface IConfig {
359
360
  // ----- identity / network -----
360
361
  appId?: string;
362
+ e2ee?: {
363
+ enabled: boolean;
364
+ };
361
365
  baseUrl?: string;
362
366
  customAppToken?: string;
363
367
  projectName?: string;
@@ -807,6 +811,27 @@ export interface IConfig {
807
811
  hideAppearance?: boolean;
808
812
  /** Hide the push-notifications toggle. */
809
813
  hidePushToggle?: boolean;
814
+ /**
815
+ * A "Language" card with two pickers, off by default: the interface
816
+ * language (the backend's `user.appLanguage`) and the language messages
817
+ * are translated into (`user.chatLanguage`). A choice is applied at
818
+ * once, kept on the device, and written to the profile with
819
+ * `PUT /v1/users`, one field per request; the profile's values are
820
+ * applied when a session starts. Translation itself is the server's,
821
+ * per the reader's chat language - so `translates.enabled` is what
822
+ * shows the result. Options default to the built-in list (en-CA, es-US,
823
+ * fr-CA); pass BCP-47 tags to offer others.
824
+ */
825
+ languages?: {
826
+ enabled: boolean;
827
+ appLanguages?: string[];
828
+ chatLanguages?: string[];
829
+ };
830
+ /**
831
+ * A "Change password" screen, off by default: the current password and
832
+ * the new one, sent to `PUT /v2/users/me/password`.
833
+ */
834
+ changePassword?: boolean;
810
835
  };
811
836
 
812
837
  // ----- event hooks -----
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/sync-version.mjs on `npm version`.
2
2
  // Edit package.json's version instead of this file.
3
- export const ETHORA_CHAT_COMPONENT_VERSION = '26.8.6';
3
+ export const ETHORA_CHAT_COMPONENT_VERSION = '26.8.8';