@ethora/chat-component-rn 26.7.5 → 26.7.7

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 (340) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +31 -8
  3. package/lib/commonjs/assets/icons.js +7 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +26 -7
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatHeader.js +5 -2
  8. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ChatRoom.js +36 -14
  10. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ChatWrapper.js +2 -0
  12. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/MessageList.js +7 -23
  14. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  16. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
  18. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  19. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
  20. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  21. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +320 -110
  22. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  23. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +552 -213
  24. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  25. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
  26. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  27. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  28. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
  30. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  31. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
  32. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  33. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -104
  34. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  36. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +556 -0
  38. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  39. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
  40. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  41. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  42. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  43. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
  44. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  45. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
  46. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  47. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
  48. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  49. package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
  50. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  51. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +17 -7
  52. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  53. package/lib/commonjs/components/styled/SendInput.js +80 -11
  54. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  55. package/lib/commonjs/components/styled/StyledComponents.js +9 -3
  56. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  57. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  58. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  59. package/lib/commonjs/context/xmppProvider.js +32 -39
  60. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  61. package/lib/commonjs/helpers/getChatBackground.js +23 -0
  62. package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
  63. package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
  64. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
  65. package/lib/commonjs/helpers/pickImageAsset.js +68 -0
  66. package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
  67. package/lib/commonjs/helpers/pushPayload.js +71 -0
  68. package/lib/commonjs/helpers/pushPayload.js.map +1 -0
  69. package/lib/commonjs/helpers/sheetGestures.js +32 -0
  70. package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
  71. package/lib/commonjs/helpers/updateMessagesTillLast.js +12 -40
  72. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  73. package/lib/commonjs/hooks/useChatRoomFocus.js +3 -9
  74. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  75. package/lib/commonjs/hooks/useLogout.js +0 -5
  76. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  77. package/lib/commonjs/hooks/usePendingNotification.js +8 -11
  78. package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
  79. package/lib/commonjs/hooks/useSendMessage.js +23 -50
  80. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  81. package/lib/commonjs/i18n/strings.js +121 -1
  82. package/lib/commonjs/i18n/strings.js.map +1 -1
  83. package/lib/commonjs/main.js +19 -0
  84. package/lib/commonjs/main.js.map +1 -1
  85. package/lib/commonjs/networking/api-requests/user.api.js +59 -0
  86. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  87. package/lib/commonjs/networking/authRefresh.js +12 -2
  88. package/lib/commonjs/networking/authRefresh.js.map +1 -1
  89. package/lib/commonjs/networking/outboundQueue.js +0 -18
  90. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  91. package/lib/commonjs/networking/stanzaHandlers.js +1 -10
  92. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  93. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  94. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  95. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  96. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  97. package/lib/commonjs/networking/xmppClient.js +62 -108
  98. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  99. package/lib/commonjs/roomStore/chatSettingsSlice.js +3 -1
  100. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  101. package/lib/commonjs/roomStore/roomsSlice.js +3 -22
  102. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  103. package/lib/commonjs/services/pushSubscriptionService.js +15 -13
  104. package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
  105. package/lib/module/assets/icons.js +6 -1
  106. package/lib/module/assets/icons.js.map +1 -1
  107. package/lib/module/components/Header/HeaderRoomList.js +26 -7
  108. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  109. package/lib/module/components/MainComponents/ChatHeader.js +5 -2
  110. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  111. package/lib/module/components/MainComponents/ChatRoom.js +36 -14
  112. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  113. package/lib/module/components/MainComponents/ChatWrapper.js +2 -0
  114. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  115. package/lib/module/components/MainComponents/MessageList.js +8 -24
  116. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  117. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
  118. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  119. package/lib/module/components/MainComponents/RoomList.js +207 -35
  120. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  121. package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
  122. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  123. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +311 -113
  124. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  125. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +555 -217
  126. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  127. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
  128. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
  129. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
  130. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  131. package/lib/module/components/Modals/Modal/Modal.js +9 -1
  132. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  133. package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
  134. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  135. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -106
  136. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  137. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
  138. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  139. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +548 -0
  140. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
  141. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
  142. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
  143. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
  144. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  145. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
  146. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  147. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
  148. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  149. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
  150. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  151. package/lib/module/components/Modals/styledModalComponents.js +9 -2
  152. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  153. package/lib/module/components/RoomComponents/ChatRoomItem.js +17 -7
  154. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  155. package/lib/module/components/styled/SendInput.js +81 -12
  156. package/lib/module/components/styled/SendInput.js.map +1 -1
  157. package/lib/module/components/styled/StyledComponents.js +9 -3
  158. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  159. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
  160. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  161. package/lib/module/context/xmppProvider.js +32 -39
  162. package/lib/module/context/xmppProvider.js.map +1 -1
  163. package/lib/module/helpers/getChatBackground.js +18 -0
  164. package/lib/module/helpers/getChatBackground.js.map +1 -0
  165. package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
  166. package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
  167. package/lib/module/helpers/pickImageAsset.js +63 -0
  168. package/lib/module/helpers/pickImageAsset.js.map +1 -0
  169. package/lib/module/helpers/pushPayload.js +63 -0
  170. package/lib/module/helpers/pushPayload.js.map +1 -0
  171. package/lib/module/helpers/sheetGestures.js +26 -0
  172. package/lib/module/helpers/sheetGestures.js.map +1 -0
  173. package/lib/module/helpers/updateMessagesTillLast.js +13 -41
  174. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  175. package/lib/module/hooks/useChatRoomFocus.js +3 -9
  176. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  177. package/lib/module/hooks/useLogout.js +0 -5
  178. package/lib/module/hooks/useLogout.js.map +1 -1
  179. package/lib/module/hooks/usePendingNotification.js +8 -11
  180. package/lib/module/hooks/usePendingNotification.js.map +1 -1
  181. package/lib/module/hooks/useSendMessage.js +24 -51
  182. package/lib/module/hooks/useSendMessage.js.map +1 -1
  183. package/lib/module/i18n/strings.js +121 -1
  184. package/lib/module/i18n/strings.js.map +1 -1
  185. package/lib/module/main.js +2 -1
  186. package/lib/module/main.js.map +1 -1
  187. package/lib/module/networking/api-requests/user.api.js +56 -0
  188. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  189. package/lib/module/networking/authRefresh.js +12 -2
  190. package/lib/module/networking/authRefresh.js.map +1 -1
  191. package/lib/module/networking/outboundQueue.js +0 -17
  192. package/lib/module/networking/outboundQueue.js.map +1 -1
  193. package/lib/module/networking/stanzaHandlers.js +1 -10
  194. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  195. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
  196. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  197. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  198. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  199. package/lib/module/networking/xmppClient.js +62 -108
  200. package/lib/module/networking/xmppClient.js.map +1 -1
  201. package/lib/module/roomStore/chatSettingsSlice.js +3 -1
  202. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  203. package/lib/module/roomStore/roomsSlice.js +2 -20
  204. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  205. package/lib/module/services/pushSubscriptionService.js +15 -13
  206. package/lib/module/services/pushSubscriptionService.js.map +1 -1
  207. package/lib/typescript/assets/icons.d.ts +16 -0
  208. package/lib/typescript/assets/icons.d.ts.map +1 -1
  209. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  210. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  211. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  212. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  213. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  214. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  215. package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
  216. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  217. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
  218. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  219. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
  220. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  221. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
  222. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  223. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
  224. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
  225. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  226. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  227. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
  228. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  229. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  230. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  231. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  232. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
  233. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
  234. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
  235. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
  236. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
  237. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  238. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  239. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
  240. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  241. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
  242. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  243. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  244. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  245. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  246. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  247. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  248. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  249. package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
  250. package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
  251. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
  252. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
  253. package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
  254. package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
  255. package/lib/typescript/helpers/pushPayload.d.ts +7 -0
  256. package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
  257. package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
  258. package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
  259. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  260. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  261. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  262. package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
  263. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  264. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  265. package/lib/typescript/main.d.ts +3 -1
  266. package/lib/typescript/main.d.ts.map +1 -1
  267. package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
  268. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  269. package/lib/typescript/networking/authRefresh.d.ts +4 -1
  270. package/lib/typescript/networking/authRefresh.d.ts.map +1 -1
  271. package/lib/typescript/networking/outboundQueue.d.ts +0 -16
  272. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  273. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  274. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  275. package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
  276. package/lib/typescript/networking/xmppClient.d.ts +8 -33
  277. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  278. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  279. package/lib/typescript/roomStore/roomsSlice.d.ts +1 -18
  280. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  281. package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
  282. package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
  283. package/lib/typescript/types/models/room.model.d.ts +0 -15
  284. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  285. package/lib/typescript/types/types.d.ts +31 -20
  286. package/lib/typescript/types/types.d.ts.map +1 -1
  287. package/package.json +6 -1
  288. package/src/assets/icons.tsx +48 -9
  289. package/src/components/Header/HeaderRoomList.tsx +24 -6
  290. package/src/components/MainComponents/ChatHeader.tsx +5 -2
  291. package/src/components/MainComponents/ChatRoom.tsx +38 -20
  292. package/src/components/MainComponents/ChatWrapper.tsx +3 -0
  293. package/src/components/MainComponents/MessageList.tsx +8 -24
  294. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
  295. package/src/components/MainComponents/RoomList.tsx +236 -39
  296. package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
  297. package/src/components/Modals/AttachSheet/AttachSheet.tsx +331 -97
  298. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +598 -279
  299. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
  300. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +4 -2
  301. package/src/components/Modals/Modal/Modal.tsx +7 -0
  302. package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
  303. package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -117
  304. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
  305. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +615 -0
  306. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
  307. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
  308. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
  309. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
  310. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
  311. package/src/components/Modals/styledModalComponents.tsx +9 -2
  312. package/src/components/RoomComponents/ChatRoomItem.tsx +14 -7
  313. package/src/components/styled/SendInput.tsx +83 -12
  314. package/src/components/styled/StyledComponents.ts +9 -3
  315. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
  316. package/src/context/xmppProvider.tsx +36 -47
  317. package/src/helpers/getChatBackground.ts +18 -0
  318. package/src/helpers/mediaLibraryRuntime.ts +25 -0
  319. package/src/helpers/pickImageAsset.ts +68 -0
  320. package/src/helpers/pushPayload.ts +62 -0
  321. package/src/helpers/sheetGestures.ts +25 -0
  322. package/src/helpers/updateMessagesTillLast.tsx +17 -42
  323. package/src/hooks/useChatRoomFocus.ts +3 -11
  324. package/src/hooks/useLogout.tsx +0 -7
  325. package/src/hooks/usePendingNotification.ts +5 -11
  326. package/src/hooks/useSendMessage.tsx +24 -60
  327. package/src/i18n/strings.ts +121 -1
  328. package/src/main.ts +4 -1
  329. package/src/networking/api-requests/user.api.ts +71 -0
  330. package/src/networking/authRefresh.ts +25 -4
  331. package/src/networking/outboundQueue.ts +0 -29
  332. package/src/networking/stanzaHandlers.ts +1 -9
  333. package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
  334. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
  335. package/src/networking/xmppClient.ts +65 -119
  336. package/src/roomStore/chatSettingsSlice.ts +3 -1
  337. package/src/roomStore/roomsSlice.ts +2 -20
  338. package/src/services/pushSubscriptionService.ts +18 -13
  339. package/src/types/models/room.model.ts +0 -15
  340. package/src/types/types.ts +33 -20
@@ -3,34 +3,75 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.userInitials = exports.profileTabs = exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
8
9
  var _styledModalComponents = require("../styledModalComponents");
9
10
  var _icons = require("../../../assets/icons");
10
- var _ModalHeaderComponent = _interopRequireDefault(require("../ModalHeaderComponent"));
11
- var _ProfileImagePlaceholder = require("../../MainComponents/ProfileImagePlaceholder");
12
- var _Button = _interopRequireDefault(require("../../styled/Button"));
13
- var _DropdownMenu = _interopRequireDefault(require("../../DropdownMenu/DropdownMenu"));
14
- var _chatSettingsSlice = require("../../../roomStore/chatSettingsSlice");
15
- var _roomsSlice = require("../../../roomStore/roomsSlice");
16
- var _EditUserModal = _interopRequireDefault(require("./EditUserModal"));
17
- var _walletUsername = require("../../../helpers/walletUsername");
18
- var _xmppProvider = require("../../../context/xmppProvider");
19
- var _Select = _interopRequireDefault(require("../../MainComponents/Select"));
20
11
  var _hooks = require("../../../hooks/hooks");
21
- var _reactNative = require("react-native");
22
- var _rooms = require("../../../networking/api-requests/rooms.api");
23
- var _createRoomFromApi = require("../../../helpers/createRoomFromApi");
12
+ var _useChatSettingState = require("../../../hooks/useChatSettingState");
13
+ var _xmppProvider = require("../../../context/xmppProvider");
24
14
  var _ToastContext = require("../../../context/ToastContext");
15
+ var _useT = require("../../../i18n/useT");
16
+ var _useFileToken = require("../../../hooks/useFileToken");
17
+ var _secureFileUrl = require("../../../helpers/secureFileUrl");
18
+ var _getIconColor = require("../../../helpers/getIconColor");
19
+ var _typography = require("../../../helpers/typography");
20
+ var _getElementFont = require("../../../helpers/getElementFont");
25
21
  var _LANGUAGE_OPTIONS = require("../../../helpers/constants/LANGUAGE_OPTIONS");
22
+ var _MODAL_TYPES = require("../../../helpers/constants/MODAL_TYPES");
23
+ var _chatSettingsSlice = require("../../../roomStore/chatSettingsSlice");
24
+ var _roomsSlice = require("../../../roomStore/roomsSlice");
25
+ var _HeaderRoomListMenu = require("../../Menu/HeaderRoomListMenu");
26
+ var _useLogout = require("../../../hooks/useLogout");
27
+ var _rooms = require("../../../networking/api-requests/rooms.api");
26
28
  var _user = require("../../../networking/api-requests/user.api");
27
- var _useChatSettingState = require("../../../hooks/useChatSettingState");
29
+ var _createRoomFromApi = require("../../../helpers/createRoomFromApi");
30
+ var _walletUsername = require("../../../helpers/walletUsername");
31
+ var _ProfileHeader = require("../ProfileHeader/ProfileHeader");
32
+ var _ProfileMenu = _interopRequireDefault(require("../ProfileHeader/ProfileMenu"));
33
+ var _EditUserModal = _interopRequireDefault(require("./EditUserModal"));
28
34
  var _jsxRuntime = require("react/jsx-runtime");
29
35
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
36
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
37
+ /** @format */
38
+
39
+ const PREFIX = 'user-profile';
40
+ /** Two uppercase letters for a person without a picture. */
41
+ const userInitials = name => {
42
+ const words = (name || '').trim().split(/\s+/).filter(Boolean);
43
+ const letters = (words.length >= 2 ? [words[0][0], words[1][0]] : [words[0]?.[0], words[0]?.[1]]).filter(c => !!c && /[\p{L}\p{N}]/u.test(c));
44
+ return letters.join('').toUpperCase();
45
+ };
46
+
47
+ /**
48
+ * Which tabs a profile shows. Only the signed-in user has tabs at all:
49
+ * `GET /v2/files/` returns the JWT owner's files, so there is nothing to
50
+ * put under Media/Documents for anybody else, and the language picker is
51
+ * a personal setting.
52
+ */
53
+ exports.userInitials = userInitials;
54
+ const profileTabs = opts => {
55
+ if (!opts.isOwnProfile) {
56
+ return [];
57
+ }
58
+ const tabs = [];
59
+ if (opts.translatesEnabled) {
60
+ tabs.push('language');
61
+ }
62
+ if (opts.hasMedia) {
63
+ tabs.push('media');
64
+ }
65
+ if (opts.hasDocuments) {
66
+ tabs.push('documents');
67
+ }
68
+ return tabs;
69
+ };
70
+ exports.profileTabs = profileTabs;
31
71
  const UserProfileModal = ({
32
72
  handleCloseModal
33
73
  }) => {
74
+ const t = (0, _useT.useT)();
34
75
  const dispatch = (0, _hooks.useAppDispatch)();
35
76
  const {
36
77
  client
@@ -44,75 +85,99 @@ const UserProfileModal = ({
44
85
  selectedUser,
45
86
  langSource
46
87
  } = (0, _useChatSettingState.useChatSettingState)();
88
+ const fileToken = (0, _useFileToken.useFileToken)();
47
89
  const [isEditing, setIsEditing] = (0, _react.useState)(false);
48
- const [documents, setDocuments] = (0, _react.useState)([]);
49
- const [deleteDocumentId, setDeleteDocumentId] = (0, _react.useState)('');
50
- const [showDelete, setShowDelete] = (0, _react.useState)(false);
51
- const handleDeleteDocument = async () => {
52
- try {
53
- await (0, _user.deleteDocument)(deleteDocumentId);
54
- setDocuments(documents.filter(doc => doc._id !== deleteDocumentId));
55
- showToast({
56
- id: Date.now().toString(),
57
- title: 'Success',
58
- message: 'Document deleted successfully',
59
- type: 'success'
60
- });
61
- // handleGetDocs();
62
- } catch (error) {
63
- console.error('Error deleting document', error);
64
- showToast({
65
- id: Date.now().toString(),
66
- title: 'Error',
67
- message: 'Failed to delete document',
68
- type: 'error'
69
- });
70
- } finally {
71
- setShowDelete(false);
72
- }
73
- };
74
- const handleGetDocs = async () => {
75
- try {
76
- const {
77
- data
78
- } = await (0, _user.getDocuments)(user?.defaultWallet?.walletAddress);
79
- const items = data.results.filter(el => el.locations[0]);
80
- setDocuments(items);
81
- } catch (error) {
82
- console.error('Error getting docs', error);
90
+ const [files, setFiles] = (0, _react.useState)([]);
91
+ const [loadingFiles, setLoadingFiles] = (0, _react.useState)(false);
92
+ const [activeTab, setActiveTab] = (0, _react.useState)(null);
93
+ const scrollY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
94
+ const scrollRef = (0, _react.useRef)(null);
95
+ const {
96
+ collapseDistance
97
+ } = (0, _ProfileHeader.useHeaderMetrics)();
98
+ const [viewportHeight, setViewportHeight] = (0, _react.useState)(0);
99
+ // `scrollY` is driven natively, so its value can't be read back with
100
+ // addListener; the Animated.event's JS `listener` still fires, which is
101
+ // enough to know which state the header is in.
102
+ const [isCollapsed, setIsCollapsed] = (0, _react.useState)(false);
103
+ const isOwnProfile = !selectedUser;
104
+ const profileUser = selectedUser ?? user;
105
+ const media = (0, _react.useMemo)(() => files.filter(_user.isMediaFile), [files]);
106
+ const documents = (0, _react.useMemo)(() => files.filter(file => !(0, _user.isMediaFile)(file)), [files]);
107
+ const tabs = (0, _react.useMemo)(() => profileTabs({
108
+ isOwnProfile,
109
+ translatesEnabled: !!config?.translates?.enabled,
110
+ hasMedia: media.length > 0,
111
+ hasDocuments: documents.length > 0
112
+ }), [isOwnProfile, config?.translates?.enabled, media.length, documents.length]);
113
+
114
+ // Keep the selected tab valid as the lists load in.
115
+ (0, _react.useEffect)(() => {
116
+ if (tabs.length === 0) {
117
+ setActiveTab(null);
118
+ return;
83
119
  }
84
- };
120
+ setActiveTab(current => current && tabs.includes(current) ? current : tabs[0]);
121
+ }, [tabs]);
122
+
123
+ // One request per visit, and only for one's own profile — the endpoint
124
+ // is scoped to the JWT owner, so it would return *our* files while
125
+ // looking at somebody else's page.
85
126
  (0, _react.useEffect)(() => {
86
- handleGetDocs();
87
- }, []);
127
+ if (!isOwnProfile) {
128
+ setFiles([]);
129
+ return;
130
+ }
131
+ let cancelled = false;
132
+ setLoadingFiles(true);
133
+ (0, _user.getUserFiles)().then(rows => {
134
+ if (!cancelled) {
135
+ setFiles(rows);
136
+ }
137
+ }).catch(error => {
138
+ console.warn('Could not load user files:', error);
139
+ if (!cancelled) {
140
+ setFiles([]);
141
+ }
142
+ }).finally(() => {
143
+ if (!cancelled) {
144
+ setLoadingFiles(false);
145
+ }
146
+ });
147
+ return () => {
148
+ cancelled = true;
149
+ };
150
+ }, [isOwnProfile, user?.token]);
88
151
  const handleBackClick = (0, _react.useCallback)(() => {
89
152
  dispatch((0, _chatSettingsSlice.setSelectedUser)(undefined));
90
153
  handleCloseModal();
91
- }, []);
154
+ }, [dispatch, handleCloseModal]);
155
+
156
+ // Same teardown the room-list menu runs (XMPP, redux, persisted slices,
157
+ // AsyncStorage), including the host's confirm copy and callbacks.
158
+ const performLogout = (0, _useLogout.useLogout)();
92
159
  const handleLogout = (0, _react.useCallback)(() => {
93
- dispatch((0, _chatSettingsSlice.logout)());
94
- dispatch((0, _roomsSlice.setLogoutState)());
95
- }, []);
96
- const menuOptions = (0, _react.useMemo)(() => [{
97
- label: 'Log Out',
98
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LeaveIcon, {}),
99
- onClick: () => {
100
- handleLogout();
101
- },
102
- styles: {
103
- color: 'red'
160
+ (0, _HeaderRoomListMenu.runLogoutFlow)(config?.logout ?? {
161
+ enabled: true
162
+ }, performLogout).catch(() => {});
163
+ }, [config?.logout, performLogout]);
164
+ const handleShare = (0, _react.useCallback)(async () => {
165
+ const name = profileUser?.name || `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim();
166
+ const id = profileUser?.userJID || profileUser?.defaultWallet?.walletAddress || profileUser?.id || '';
167
+ try {
168
+ await _reactNative.Share.share({
169
+ message: id ? `${name}\n${id}` : name
170
+ });
171
+ } catch (error) {
172
+ console.warn('Could not share the profile:', error);
104
173
  }
105
- }], []);
106
- const handleSelect = selected => {
107
- dispatch((0, _chatSettingsSlice.setLangSource)(selected.id));
108
- };
109
- const EditClick = (0, _react.useCallback)(() => {
110
- setIsEditing(true);
111
- }, []);
174
+ }, [profileUser]);
112
175
  const handleRoomCreation = async (newChat, usersArrayLength) => {
113
176
  try {
114
177
  const normalizedChat = (0, _createRoomFromApi.createRoomFromApi)(newChat, config?.xmppSettings?.conference, usersArrayLength);
115
- if (!normalizedChat || !client) return;
178
+ if (!normalizedChat || !client) {
179
+ return;
180
+ }
116
181
  dispatch((0, _roomsSlice.addRoomViaApi)({
117
182
  room: normalizedChat,
118
183
  xmpp: client
@@ -139,202 +204,400 @@ const UserProfileModal = ({
139
204
  type: 'info',
140
205
  duration: 3000
141
206
  });
142
- let newRoomJid = '';
143
207
  if (config?.newArch) {
144
208
  const newRoom = await (0, _rooms.postPrivateRoom)(selectedUser?.userJID ?? (selectedUser?.id || ''));
145
209
  handleRoomCreation(newRoom, 2);
146
- newRoomJid = newRoom.name;
147
210
  } else {
148
211
  const selectedUserUsername = (0, _walletUsername.walletToUsername)(selectedUser?.id || '');
149
212
  const myUsername = (0, _walletUsername.walletToUsername)(user.defaultWallet.walletAddress);
150
- const combinedWalletAddress = [myUsername, selectedUserUsername].sort().join('.');
151
- const roomJid = combinedWalletAddress.toLowerCase();
213
+ const roomJid = [myUsername, selectedUserUsername].sort().join('.').toLowerCase();
152
214
  const combinedUsersName = [user.firstName, selectedUser?.name?.split(' ')?.[0] || ''].sort().join(' and ');
153
- newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
215
+ const newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
154
216
  if (newRoomJid) {
155
217
  await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
156
218
  await client?.getRoomsStanza();
157
219
  }
158
220
  }
159
221
  dispatch((0, _chatSettingsSlice.setActiveModal)(undefined));
160
- }, [selectedUser]);
161
- const modalUser = selectedUser ?? user;
162
- const findLanguage = () => {
163
- if (!langSource) {
164
- return null;
165
- }
166
- const language = _LANGUAGE_OPTIONS.LANGUAGE_OPTIONS.find(lang => lang.id === langSource);
167
- return language || null;
168
- };
169
- const showDeleteModal = docId => {
170
- setDeleteDocumentId(docId);
171
- setShowDelete(true);
222
+ }, [selectedUser]); // eslint-disable-line react-hooks/exhaustive-deps
223
+
224
+ const openFile = file => {
225
+ dispatch((0, _chatSettingsSlice.setActiveFile)({
226
+ fileName: file.name,
227
+ fileURL: file.url,
228
+ mimetype: file.mimetype
229
+ }));
230
+ dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
172
231
  };
173
- const DefaultBody = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
174
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalHeaderComponent.default, {
175
- handleCloseModal: handleBackClick,
176
- headerTitle: 'Profile',
177
- rightMenu: !selectedUser && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
178
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
179
- onPress: EditClick,
180
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.EditIcon, {
181
- color: "#8C8C8C"
182
- })
183
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DropdownMenu.default, {
184
- options: menuOptions,
185
- position: "right",
186
- menuIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.MoreIcon, {})
187
- })]
232
+ const heroActions = (0, _react.useMemo)(() => isOwnProfile ? [{
233
+ key: 'account',
234
+ label: t('action.account'),
235
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ProfileIcon, {
236
+ color: color
237
+ }),
238
+ onPress: () => dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.SETTINGS))
239
+ }, {
240
+ key: 'share',
241
+ label: t('action.share'),
242
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareIcon, {
243
+ color: color
244
+ }),
245
+ onPress: handleShare
246
+ }, {
247
+ key: 'edit',
248
+ label: t('action.edit'),
249
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.EditIcon, {
250
+ color: color
251
+ }),
252
+ onPress: () => setIsEditing(true)
253
+ }, {
254
+ key: 'logout',
255
+ label: t('action.logOut'),
256
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LogoutIcon, {
257
+ color: color
258
+ }),
259
+ onPress: handleLogout
260
+ }] : [...(config?.hideMemberSendMessageAction ? [] : [{
261
+ key: 'message',
262
+ label: t('action.message'),
263
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChatIcon, {
264
+ color: color
265
+ }),
266
+ onPress: handlePrivateMessage
267
+ }]), {
268
+ key: 'share',
269
+ label: t('action.share'),
270
+ icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareIcon, {
271
+ color: color
272
+ }),
273
+ onPress: handleShare
274
+ }], [isOwnProfile, t, handleShare, handlePrivateMessage, handleLogout] // eslint-disable-line react-hooks/exhaustive-deps
275
+ );
276
+
277
+ // Collapsed, the hero's round buttons are gone — the "…" menu carries
278
+ // exactly the same actions so nothing becomes unreachable.
279
+ const menuItems = (0, _react.useMemo)(() => isCollapsed ? heroActions.map(action => ({
280
+ key: action.key,
281
+ label: action.label,
282
+ icon: action.icon('#141414'),
283
+ destructive: action.key === 'logout',
284
+ onPress: action.onPress
285
+ })) : [], [isCollapsed, heroActions]);
286
+ if (isEditing) {
287
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalContainerFullScreen, {
288
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditUserModal.default, {
289
+ setIsEditing: setIsEditing,
290
+ modalUser: profileUser,
291
+ config: config
188
292
  })
189
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.CenterContainer, {
190
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileImagePlaceholder.ProfileImagePlaceholder, {
191
- icon: modalUser?.profileImage ?? null,
192
- name: modalUser?.name ?? modalUser?.firstName,
193
- size: 120
194
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.UserInfo, {
195
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.UserName, {
196
- children: modalUser?.name ? `${modalUser?.name}` : `${modalUser?.firstName} ${modalUser?.lastName}`
197
- })
198
- }), !selectedUser && config?.translates?.enabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.BorderedContainer, {
199
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
200
- options: _LANGUAGE_OPTIONS.LANGUAGE_OPTIONS,
201
- placeholder: 'Select your language',
202
- onSelect: handleSelect,
203
- accentColor: config?.colors?.primary,
204
- selectedValue: findLanguage()
293
+ });
294
+ }
295
+ const displayName = profileUser?.name || `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim() || t('modal.profile.title');
296
+ const heroImage = (0, _secureFileUrl.appendFileToken)(profileUser?.profileImage, fileToken) || null;
297
+ const heroColor = config?.colors?.avatar || (0, _getIconColor.getIconColor)(config);
298
+ const description = profileUser?.description;
299
+ const renderTabBody = () => {
300
+ if (activeTab === 'language') {
301
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
302
+ children: _LANGUAGE_OPTIONS.LANGUAGE_OPTIONS.map(option => {
303
+ const selected = langSource === option.id;
304
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
305
+ testID: `${PREFIX}-language-${option.id}`,
306
+ activeOpacity: 0.7,
307
+ style: styles.languageRow,
308
+ onPress: () => dispatch((0, _chatSettingsSlice.setLangSource)(option.id)),
309
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
310
+ style: styles.languageLabel,
311
+ children: option.name
312
+ }), selected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
313
+ style: [styles.check, {
314
+ color: (0, _getIconColor.getIconColor)(config)
315
+ }],
316
+ children: "\u2713"
317
+ })]
318
+ }, option.id);
205
319
  })
206
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.BorderedContainer, {
207
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.Label, {
208
- children: "About"
209
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.LabelData, {
210
- children: modalUser?.description && modalUser?.description?.length > 4 ? modalUser.description : 'No description'
211
- })]
212
- }), selectedUser && !config?.disableMemberProfileActions && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
213
- children: [!config?.hideMemberSendMessageAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ActionButton, {
214
- StartIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChatIcon, {}),
215
- onPress: handlePrivateMessage,
216
- variant: "filled",
217
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
218
- style: {
219
- color: '#ffffff'
220
- },
221
- children: "Message"
222
- })
223
- }), !config?.hideMemberCopyIdAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ActionButton, {
224
- onPress: () => {}
225
- // onPress={() => handleCopyClick(selectedUser.id)}
226
- ,
227
- variant: "filled",
228
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
229
- style: {
230
- color: '#ffffff'
320
+ });
321
+ }
322
+ if (activeTab === 'media') {
323
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
324
+ style: styles.mediaGrid,
325
+ children: media.map(file => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
326
+ testID: `${PREFIX}-media-${file.id}`,
327
+ activeOpacity: 0.8,
328
+ style: styles.mediaTile,
329
+ onPress: () => openFile(file),
330
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
331
+ source: {
332
+ uri: (0, _secureFileUrl.appendFileToken)(file.url, fileToken) || file.url
231
333
  },
232
- children: "Copy User Id"
334
+ style: styles.mediaImage,
335
+ resizeMode: "cover"
233
336
  })
337
+ }, file.id))
338
+ });
339
+ }
340
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
341
+ children: documents.map(file => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
342
+ testID: `${PREFIX}-document-${file.id}`,
343
+ activeOpacity: 0.7,
344
+ style: styles.documentRow,
345
+ onPress: () => openFile(file),
346
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.IconDoc, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
347
+ style: styles.documentText,
348
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
349
+ numberOfLines: 1,
350
+ style: styles.documentName,
351
+ children: file.name
352
+ }), !!file.createdAt && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
353
+ style: styles.documentDate,
354
+ children: new Date(file.createdAt).toLocaleDateString()
355
+ })]
234
356
  })]
235
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.BorderedContainer, {
236
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
237
- style: {
238
- maxHeight: 400
239
- },
240
- showsVerticalScrollIndicator: true,
241
- nestedScrollEnabled: true,
242
- children: documents.map(doc => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
243
- style: {
244
- flexDirection: 'row',
245
- alignItems: 'center',
246
- justifyContent: 'space-between',
247
- gap: 24,
248
- backgroundColor: '#F3F6FC',
249
- marginBottom: 8,
250
- paddingVertical: 8,
251
- paddingHorizontal: 16,
252
- borderRadius: 8
253
- },
254
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
255
- style: {
256
- flexDirection: 'row',
257
- alignItems: 'center',
258
- gap: 24
259
- },
260
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
261
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.IconDoc, {})
262
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
263
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.Label, {
264
- style: {
265
- paddingBottom: 4
266
- },
267
- children: doc.documentName
268
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.LabelData, {
269
- children: new Date(doc.createdAt).toLocaleDateString('en-GB', {
270
- day: '2-digit',
271
- month: 'short',
272
- year: 'numeric'
273
- }) + ' ' + new Date(doc.createdAt).toLocaleTimeString('en-GB', {
274
- hour: '2-digit',
275
- minute: '2-digit'
357
+ }, file.id))
358
+ });
359
+ };
360
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.ModalContainerFullScreen, {
361
+ style: styles.screen,
362
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.ScrollView, {
363
+ ref: scrollRef,
364
+ style: styles.scroll,
365
+ contentContainerStyle: [styles.scrollContent, viewportHeight > 0 && {
366
+ minHeight: viewportHeight + collapseDistance
367
+ }],
368
+ onLayout: e => setViewportHeight(e.nativeEvent.layout.height),
369
+ showsVerticalScrollIndicator: false,
370
+ scrollEventThrottle: 16,
371
+ onScroll: _reactNative.Animated.event([{
372
+ nativeEvent: {
373
+ contentOffset: {
374
+ y: scrollY
375
+ }
376
+ }
377
+ }], {
378
+ useNativeDriver: true,
379
+ listener: e => {
380
+ const y = e?.nativeEvent?.contentOffset?.y ?? 0;
381
+ setIsCollapsed(y >= collapseDistance - 8);
382
+ }
383
+ }),
384
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileHeader.ProfileHero, {
385
+ testIDPrefix: PREFIX,
386
+ title: displayName,
387
+ imageUri: heroImage,
388
+ fallbackColor: heroColor,
389
+ initials: userInitials(displayName),
390
+ scrollY: scrollY,
391
+ actions: heroActions,
392
+ titleStyle: (0, _typography.chatTextStyle)(config?.typography?.profile?.title),
393
+ titleAccessory: isOwnProfile ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
394
+ testID: `${PREFIX}-logout`,
395
+ activeOpacity: 0.7,
396
+ style: styles.leaveButton,
397
+ onPress: handleLogout,
398
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LeaveIcon, {
399
+ color: "#FFFFFF",
400
+ width: 18,
401
+ height: 18
402
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
403
+ style: styles.leaveLabel,
404
+ children: t('action.leave')
405
+ })]
406
+ }) : undefined
407
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
408
+ style: styles.body,
409
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
410
+ style: styles.card,
411
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
412
+ style: [styles.cardLabel, (0, _getElementFont.getElementFont)(config, 'profileSectionLabel')],
413
+ children: t('modal.profile.about')
414
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
415
+ style: styles.cardValue,
416
+ children: description && description.length > 4 ? description : t('modal.profile.noDescription')
417
+ })]
418
+ }), tabs.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
419
+ style: styles.card,
420
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
421
+ style: styles.tabsRow,
422
+ children: tabs.map(tab => {
423
+ const active = tab === activeTab;
424
+ const count = tab === 'media' ? media.length : tab === 'documents' ? documents.length : 0;
425
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
426
+ testID: `${PREFIX}-tab-${tab}`,
427
+ activeOpacity: 0.7,
428
+ style: [styles.tab, active && {
429
+ borderBottomColor: (0, _getIconColor.getIconColor)(config)
430
+ }],
431
+ onPress: () => setActiveTab(tab),
432
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
433
+ style: [styles.tabLabel, active && {
434
+ color: (0, _getIconColor.getIconColor)(config)
435
+ }],
436
+ children: t(`modal.profile.${tab}`)
437
+ }), count > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
438
+ style: [styles.tabBadge, {
439
+ backgroundColor: (0, _getIconColor.getIconColor)(config)
440
+ }],
441
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
442
+ style: styles.tabBadgeText,
443
+ children: count
276
444
  })
277
445
  })]
278
- })]
279
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
280
- onPress: () => showDeleteModal(doc._id),
281
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.DeleteIcon, {})
282
- })]
283
- }, doc._id))
284
- })
285
- })]
286
- })]
287
- }), [modalUser, documents]);
288
- const EditingBody = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditUserModal.default, {
289
- setIsEditing: setIsEditing,
290
- modalUser: modalUser,
291
- config: config
292
- }), [modalUser]);
293
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
294
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalContainerFullScreen, {
295
- children: !isEditing ? DefaultBody : EditingBody
296
- }), showDelete && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalBackground, {
297
- style: {
298
- position: 'absolute',
299
- zIndex: 9999
300
- },
301
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.ModalContainer, {
302
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.CloseButton, {
303
- onPress: () => setShowDelete(false),
304
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
305
- style: {
306
- fontSize: 24
307
- },
308
- children: "\xD7"
309
- })
310
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalTitle, {
311
- children: "Delete this document?"
312
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.GroupContainer, {
313
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
314
- onPress: () => setShowDelete(false),
315
- text: 'Cancel',
316
- style: {
317
- width: '100%'
318
- },
319
- unstyled: true,
320
- variant: "filled",
321
- color: "white"
322
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
323
- onPress: handleDeleteDocument,
324
- text: 'Delete',
325
- style: {
326
- width: '100%',
327
- borderWidth: 1,
328
- borderColor: 'red'
329
- },
330
- color: "red",
331
- unstyled: true,
332
- variant: "outlined"
333
- })]
446
+ }, tab);
447
+ })
448
+ }), renderTabBody()]
449
+ }), isOwnProfile && loadingFiles && files.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
450
+ testID: `${PREFIX}-files-loading`
334
451
  })]
452
+ })]
453
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileHeader.ProfileTopBar, {
454
+ testIDPrefix: PREFIX,
455
+ title: displayName,
456
+ imageUri: heroImage,
457
+ fallbackColor: heroColor,
458
+ initials: userInitials(displayName),
459
+ scrollY: scrollY,
460
+ onBack: handleBackClick,
461
+ titleStyle: (0, _typography.chatTextStyle)(config?.typography?.profile?.screenTitle),
462
+ menu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileMenu.default, {
463
+ testIDPrefix: PREFIX,
464
+ items: menuItems
335
465
  })
336
466
  })]
337
467
  });
338
468
  };
469
+ const styles = _reactNative.StyleSheet.create({
470
+ screen: {
471
+ position: 'relative',
472
+ backgroundColor: '#F2F3F5'
473
+ },
474
+ scroll: {
475
+ width: '100%',
476
+ flex: 1
477
+ },
478
+ scrollContent: {
479
+ paddingBottom: 32
480
+ },
481
+ body: {
482
+ padding: 12,
483
+ gap: 12
484
+ },
485
+ card: {
486
+ backgroundColor: '#FFFFFF',
487
+ borderRadius: 14,
488
+ padding: 16,
489
+ shadowColor: '#000',
490
+ shadowOffset: {
491
+ width: 0,
492
+ height: 1
493
+ },
494
+ shadowOpacity: 0.05,
495
+ shadowRadius: 4,
496
+ elevation: 1
497
+ },
498
+ cardLabel: {
499
+ color: '#8C8C8C',
500
+ fontSize: 14
501
+ },
502
+ cardValue: {
503
+ color: '#141414',
504
+ fontSize: 16,
505
+ marginTop: 4
506
+ },
507
+ leaveButton: {
508
+ flexDirection: 'row',
509
+ alignItems: 'center',
510
+ gap: 6,
511
+ paddingHorizontal: 12,
512
+ paddingVertical: 7,
513
+ borderRadius: 18,
514
+ backgroundColor: 'rgba(0,0,0,0.35)'
515
+ },
516
+ leaveLabel: {
517
+ color: '#FFFFFF',
518
+ fontSize: 14,
519
+ fontWeight: '500'
520
+ },
521
+ tabsRow: {
522
+ flexDirection: 'row',
523
+ gap: 20,
524
+ borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
525
+ borderBottomColor: '#EFEFF2',
526
+ marginBottom: 12
527
+ },
528
+ tab: {
529
+ flexDirection: 'row',
530
+ alignItems: 'center',
531
+ gap: 6,
532
+ paddingBottom: 10,
533
+ borderBottomWidth: 2,
534
+ borderBottomColor: 'transparent'
535
+ },
536
+ tabLabel: {
537
+ fontSize: 15,
538
+ fontWeight: '500',
539
+ color: '#8C8C8C'
540
+ },
541
+ tabBadge: {
542
+ minWidth: 20,
543
+ paddingHorizontal: 5,
544
+ paddingVertical: 1,
545
+ borderRadius: 10,
546
+ alignItems: 'center'
547
+ },
548
+ tabBadgeText: {
549
+ color: '#FFFFFF',
550
+ fontSize: 11,
551
+ fontWeight: '600'
552
+ },
553
+ languageRow: {
554
+ flexDirection: 'row',
555
+ alignItems: 'center',
556
+ justifyContent: 'space-between',
557
+ paddingVertical: 12
558
+ },
559
+ languageLabel: {
560
+ fontSize: 16,
561
+ color: '#141414'
562
+ },
563
+ check: {
564
+ fontSize: 16,
565
+ fontWeight: '700'
566
+ },
567
+ mediaGrid: {
568
+ flexDirection: 'row',
569
+ flexWrap: 'wrap',
570
+ gap: 6
571
+ },
572
+ mediaTile: {
573
+ width: '31.8%',
574
+ aspectRatio: 1,
575
+ borderRadius: 10,
576
+ overflow: 'hidden',
577
+ backgroundColor: '#EFEFF2'
578
+ },
579
+ mediaImage: {
580
+ width: '100%',
581
+ height: '100%'
582
+ },
583
+ documentRow: {
584
+ flexDirection: 'row',
585
+ alignItems: 'center',
586
+ gap: 14,
587
+ paddingVertical: 12
588
+ },
589
+ documentText: {
590
+ flex: 1
591
+ },
592
+ documentName: {
593
+ fontSize: 16,
594
+ color: '#141414'
595
+ },
596
+ documentDate: {
597
+ fontSize: 13,
598
+ color: '#8C8C8C',
599
+ marginTop: 2
600
+ }
601
+ });
339
602
  var _default = exports.default = UserProfileModal;
340
603
  //# sourceMappingURL=UserProfileModal.js.map