@ethora/chat-component-rn 26.7.4 → 26.7.5

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 (288) hide show
  1. package/CHANGELOG.md +0 -54
  2. package/README.md +8 -31
  3. package/lib/commonjs/assets/icons.js +2 -7
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
  8. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
  10. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  12. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
  14. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  15. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
  16. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  17. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
  18. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  19. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
  20. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  21. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  22. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
  24. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  25. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
  26. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  27. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
  28. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  30. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  31. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  32. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
  34. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
  36. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
  38. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
  40. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  41. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
  42. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  43. package/lib/commonjs/components/styled/SendInput.js +11 -80
  44. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  45. package/lib/commonjs/components/styled/StyledComponents.js +3 -9
  46. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  47. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  48. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  49. package/lib/commonjs/context/xmppProvider.js +35 -6
  50. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  51. package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
  52. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  53. package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
  54. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  55. package/lib/commonjs/hooks/useLogout.js +5 -0
  56. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  57. package/lib/commonjs/hooks/useSendMessage.js +50 -23
  58. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  59. package/lib/commonjs/i18n/strings.js +1 -121
  60. package/lib/commonjs/i18n/strings.js.map +1 -1
  61. package/lib/commonjs/main.js +0 -6
  62. package/lib/commonjs/main.js.map +1 -1
  63. package/lib/commonjs/networking/api-requests/user.api.js +0 -59
  64. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  65. package/lib/commonjs/networking/outboundQueue.js +18 -0
  66. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  67. package/lib/commonjs/networking/stanzaHandlers.js +10 -1
  68. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  69. package/lib/commonjs/networking/xmppClient.js +107 -7
  70. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  71. package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
  72. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  73. package/lib/commonjs/roomStore/roomsSlice.js +22 -3
  74. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  75. package/lib/module/assets/icons.js +1 -6
  76. package/lib/module/assets/icons.js.map +1 -1
  77. package/lib/module/components/Header/HeaderRoomList.js +6 -20
  78. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  79. package/lib/module/components/MainComponents/ChatRoom.js +14 -36
  80. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  81. package/lib/module/components/MainComponents/MessageList.js +24 -8
  82. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  83. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  84. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  85. package/lib/module/components/MainComponents/RoomList.js +32 -62
  86. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  87. package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
  88. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  89. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
  90. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  91. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
  92. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  93. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  94. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  95. package/lib/module/components/Modals/Modal/Modal.js +1 -9
  96. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  97. package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
  98. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  99. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
  100. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  101. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  102. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  103. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  104. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  105. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
  106. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  107. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
  108. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  109. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
  110. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  111. package/lib/module/components/Modals/styledModalComponents.js +2 -9
  112. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  113. package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
  114. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  115. package/lib/module/components/styled/SendInput.js +12 -81
  116. package/lib/module/components/styled/SendInput.js.map +1 -1
  117. package/lib/module/components/styled/StyledComponents.js +3 -9
  118. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  119. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  120. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  121. package/lib/module/context/xmppProvider.js +35 -6
  122. package/lib/module/context/xmppProvider.js.map +1 -1
  123. package/lib/module/helpers/updateMessagesTillLast.js +41 -13
  124. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  125. package/lib/module/hooks/useChatRoomFocus.js +9 -3
  126. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  127. package/lib/module/hooks/useLogout.js +5 -0
  128. package/lib/module/hooks/useLogout.js.map +1 -1
  129. package/lib/module/hooks/useSendMessage.js +51 -24
  130. package/lib/module/hooks/useSendMessage.js.map +1 -1
  131. package/lib/module/i18n/strings.js +1 -121
  132. package/lib/module/i18n/strings.js.map +1 -1
  133. package/lib/module/main.js +1 -1
  134. package/lib/module/main.js.map +1 -1
  135. package/lib/module/networking/api-requests/user.api.js +0 -56
  136. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  137. package/lib/module/networking/outboundQueue.js +17 -0
  138. package/lib/module/networking/outboundQueue.js.map +1 -1
  139. package/lib/module/networking/stanzaHandlers.js +10 -1
  140. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  141. package/lib/module/networking/xmppClient.js +107 -7
  142. package/lib/module/networking/xmppClient.js.map +1 -1
  143. package/lib/module/roomStore/chatSettingsSlice.js +1 -3
  144. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  145. package/lib/module/roomStore/roomsSlice.js +20 -2
  146. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  147. package/lib/typescript/assets/icons.d.ts +0 -16
  148. package/lib/typescript/assets/icons.d.ts.map +1 -1
  149. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  150. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  151. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  152. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  153. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  154. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
  155. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  156. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
  157. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  158. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
  159. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  160. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  161. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  162. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
  163. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  164. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  165. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  166. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  167. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
  168. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  169. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  170. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
  171. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  172. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
  173. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  174. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  175. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  176. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  177. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  178. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  179. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  180. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  181. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  182. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  183. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  184. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  185. package/lib/typescript/main.d.ts +1 -1
  186. package/lib/typescript/main.d.ts.map +1 -1
  187. package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
  188. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  189. package/lib/typescript/networking/outboundQueue.d.ts +16 -0
  190. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  191. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  192. package/lib/typescript/networking/xmppClient.d.ts +33 -1
  193. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  194. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  195. package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
  196. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  197. package/lib/typescript/types/models/room.model.d.ts +15 -0
  198. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  199. package/lib/typescript/types/types.d.ts +20 -20
  200. package/lib/typescript/types/types.d.ts.map +1 -1
  201. package/package.json +1 -6
  202. package/src/assets/icons.tsx +9 -48
  203. package/src/components/Header/HeaderRoomList.tsx +5 -20
  204. package/src/components/MainComponents/ChatRoom.tsx +20 -38
  205. package/src/components/MainComponents/MessageList.tsx +24 -8
  206. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
  207. package/src/components/MainComponents/RoomList.tsx +34 -65
  208. package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
  209. package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
  210. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
  211. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
  212. package/src/components/Modals/Modal/Modal.tsx +0 -7
  213. package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
  214. package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
  215. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
  216. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
  217. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
  218. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
  219. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
  220. package/src/components/Modals/styledModalComponents.tsx +2 -9
  221. package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
  222. package/src/components/styled/SendInput.tsx +12 -83
  223. package/src/components/styled/StyledComponents.ts +3 -9
  224. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
  225. package/src/context/xmppProvider.tsx +41 -8
  226. package/src/helpers/updateMessagesTillLast.tsx +42 -17
  227. package/src/hooks/useChatRoomFocus.ts +11 -3
  228. package/src/hooks/useLogout.tsx +7 -0
  229. package/src/hooks/useSendMessage.tsx +60 -24
  230. package/src/i18n/strings.ts +1 -121
  231. package/src/main.ts +1 -1
  232. package/src/networking/api-requests/user.api.ts +0 -71
  233. package/src/networking/outboundQueue.ts +29 -0
  234. package/src/networking/stanzaHandlers.ts +9 -1
  235. package/src/networking/xmppClient.ts +118 -7
  236. package/src/roomStore/chatSettingsSlice.ts +1 -3
  237. package/src/roomStore/roomsSlice.ts +20 -2
  238. package/src/types/models/room.model.ts +15 -0
  239. package/src/types/types.ts +20 -22
  240. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
  241. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  242. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
  243. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  244. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
  245. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  246. package/lib/commonjs/helpers/getChatBackground.js +0 -23
  247. package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
  248. package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
  249. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
  250. package/lib/commonjs/helpers/pickImageAsset.js +0 -68
  251. package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
  252. package/lib/commonjs/helpers/sheetGestures.js +0 -32
  253. package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
  254. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
  255. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  256. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
  257. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  258. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
  259. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  260. package/lib/module/helpers/getChatBackground.js +0 -18
  261. package/lib/module/helpers/getChatBackground.js.map +0 -1
  262. package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
  263. package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
  264. package/lib/module/helpers/pickImageAsset.js +0 -63
  265. package/lib/module/helpers/pickImageAsset.js.map +0 -1
  266. package/lib/module/helpers/sheetGestures.js +0 -26
  267. package/lib/module/helpers/sheetGestures.js.map +0 -1
  268. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
  269. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
  270. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
  271. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
  272. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
  273. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
  274. package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
  275. package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
  276. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
  277. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
  278. package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
  279. package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
  280. package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
  281. package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
  282. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
  283. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
  284. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
  285. package/src/helpers/getChatBackground.ts +0 -18
  286. package/src/helpers/mediaLibraryRuntime.ts +0 -25
  287. package/src/helpers/pickImageAsset.ts +0 -68
  288. package/src/helpers/sheetGestures.ts +0 -25
@@ -3,75 +3,34 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.userInitials = exports.profileTabs = exports.default = void 0;
6
+ exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
8
  var _styledModalComponents = require("../styledModalComponents");
10
9
  var _icons = require("../../../assets/icons");
11
- var _hooks = require("../../../hooks/hooks");
12
- var _useChatSettingState = require("../../../hooks/useChatSettingState");
13
- var _xmppProvider = require("../../../context/xmppProvider");
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");
21
- var _LANGUAGE_OPTIONS = require("../../../helpers/constants/LANGUAGE_OPTIONS");
22
- var _MODAL_TYPES = require("../../../helpers/constants/MODAL_TYPES");
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"));
23
14
  var _chatSettingsSlice = require("../../../roomStore/chatSettingsSlice");
24
15
  var _roomsSlice = require("../../../roomStore/roomsSlice");
25
- var _HeaderRoomListMenu = require("../../Menu/HeaderRoomListMenu");
26
- var _useLogout = require("../../../hooks/useLogout");
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
+ var _hooks = require("../../../hooks/hooks");
21
+ var _reactNative = require("react-native");
27
22
  var _rooms = require("../../../networking/api-requests/rooms.api");
28
- var _user = require("../../../networking/api-requests/user.api");
29
23
  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"));
24
+ var _ToastContext = require("../../../context/ToastContext");
25
+ var _LANGUAGE_OPTIONS = require("../../../helpers/constants/LANGUAGE_OPTIONS");
26
+ var _user = require("../../../networking/api-requests/user.api");
27
+ var _useChatSettingState = require("../../../hooks/useChatSettingState");
34
28
  var _jsxRuntime = require("react/jsx-runtime");
35
29
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
36
30
  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;
71
31
  const UserProfileModal = ({
72
32
  handleCloseModal
73
33
  }) => {
74
- const t = (0, _useT.useT)();
75
34
  const dispatch = (0, _hooks.useAppDispatch)();
76
35
  const {
77
36
  client
@@ -85,99 +44,75 @@ const UserProfileModal = ({
85
44
  selectedUser,
86
45
  langSource
87
46
  } = (0, _useChatSettingState.useChatSettingState)();
88
- const fileToken = (0, _useFileToken.useFileToken)();
89
47
  const [isEditing, setIsEditing] = (0, _react.useState)(false);
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;
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);
119
72
  }
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.
126
- (0, _react.useEffect)(() => {
127
- if (!isOwnProfile) {
128
- setFiles([]);
129
- return;
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);
130
83
  }
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]);
84
+ };
85
+ (0, _react.useEffect)(() => {
86
+ handleGetDocs();
87
+ }, []);
151
88
  const handleBackClick = (0, _react.useCallback)(() => {
152
89
  dispatch((0, _chatSettingsSlice.setSelectedUser)(undefined));
153
90
  handleCloseModal();
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)();
91
+ }, []);
159
92
  const handleLogout = (0, _react.useCallback)(() => {
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);
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'
173
104
  }
174
- }, [profileUser]);
105
+ }], []);
106
+ const handleSelect = selected => {
107
+ dispatch((0, _chatSettingsSlice.setLangSource)(selected.id));
108
+ };
109
+ const EditClick = (0, _react.useCallback)(() => {
110
+ setIsEditing(true);
111
+ }, []);
175
112
  const handleRoomCreation = async (newChat, usersArrayLength) => {
176
113
  try {
177
114
  const normalizedChat = (0, _createRoomFromApi.createRoomFromApi)(newChat, config?.xmppSettings?.conference, usersArrayLength);
178
- if (!normalizedChat || !client) {
179
- return;
180
- }
115
+ if (!normalizedChat || !client) return;
181
116
  dispatch((0, _roomsSlice.addRoomViaApi)({
182
117
  room: normalizedChat,
183
118
  xmpp: client
@@ -204,400 +139,202 @@ const UserProfileModal = ({
204
139
  type: 'info',
205
140
  duration: 3000
206
141
  });
142
+ let newRoomJid = '';
207
143
  if (config?.newArch) {
208
144
  const newRoom = await (0, _rooms.postPrivateRoom)(selectedUser?.userJID ?? (selectedUser?.id || ''));
209
145
  handleRoomCreation(newRoom, 2);
146
+ newRoomJid = newRoom.name;
210
147
  } else {
211
148
  const selectedUserUsername = (0, _walletUsername.walletToUsername)(selectedUser?.id || '');
212
149
  const myUsername = (0, _walletUsername.walletToUsername)(user.defaultWallet.walletAddress);
213
- const roomJid = [myUsername, selectedUserUsername].sort().join('.').toLowerCase();
150
+ const combinedWalletAddress = [myUsername, selectedUserUsername].sort().join('.');
151
+ const roomJid = combinedWalletAddress.toLowerCase();
214
152
  const combinedUsersName = [user.firstName, selectedUser?.name?.split(' ')?.[0] || ''].sort().join(' and ');
215
- const newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
153
+ newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
216
154
  if (newRoomJid) {
217
155
  await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
218
156
  await client?.getRoomsStanza();
219
157
  }
220
158
  }
221
159
  dispatch((0, _chatSettingsSlice.setActiveModal)(undefined));
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));
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;
231
168
  };
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
169
+ const showDeleteModal = docId => {
170
+ setDeleteDocumentId(docId);
171
+ setShowDelete(true);
172
+ };
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
+ })]
292
188
  })
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);
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}`
319
197
  })
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
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()
205
+ })
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'
333
220
  },
334
- style: styles.mediaImage,
335
- resizeMode: "cover"
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'
231
+ },
232
+ children: "Copy User Id"
336
233
  })
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
- })]
356
234
  })]
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
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'
444
276
  })
445
277
  })]
446
- }, tab);
447
- })
448
- }), renderTabBody()]
449
- }), isOwnProfile && loadingFiles && files.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
450
- testID: `${PREFIX}-files-loading`
451
- })]
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
+ })
452
285
  })]
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
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
+ })]
334
+ })]
465
335
  })
466
336
  })]
467
337
  });
468
338
  };
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
- });
602
339
  var _default = exports.default = UserProfileModal;
603
340
  //# sourceMappingURL=UserProfileModal.js.map