@ethora/chat-component-rn 26.7.10 → 26.8.1
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.
- package/CHANGELOG.md +0 -96
- package/README.md +10 -43
- package/lib/commonjs/assets/icons.js +2 -7
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/AuthForms/Login.js +4 -4
- package/lib/commonjs/components/AuthForms/Login.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +7 -26
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +3 -9
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -150
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +38 -34
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LoginWrapper.js +1 -2
- package/lib/commonjs/components/MainComponents/LoginWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +9 -29
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +1 -5
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +5 -13
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +24 -3
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +35 -208
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -317
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageTranslate.js +16 -7
- package/lib/commonjs/components/MessageBubble/MessageTranslate.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +112 -320
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +215 -556
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/DeleteChatModal.js +9 -7
- package/lib/commonjs/components/Modals/ChatProfileModal/DeleteChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +27 -69
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js +1 -2
- package/lib/commonjs/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +109 -205
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +39 -23
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js +3 -22
- package/lib/commonjs/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js +3 -17
- package/lib/commonjs/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js +3 -17
- package/lib/commonjs/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +3 -6
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/styled/AudioMessage.js +1 -2
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/DateLabel.js +10 -3
- package/lib/commonjs/components/styled/DateLabel.js.map +1 -1
- package/lib/commonjs/components/styled/MessageImage.js +9 -37
- package/lib/commonjs/components/styled/MessageImage.js.map +1 -1
- package/lib/commonjs/components/styled/NewMessageLabel.js +3 -1
- package/lib/commonjs/components/styled/NewMessageLabel.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +17 -86
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +3 -9
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/components/styled/UnsupportedType.js +4 -14
- package/lib/commonjs/components/styled/UnsupportedType.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +61 -119
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +59 -177
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/createMessageFromXml.js +1 -19
- package/lib/commonjs/helpers/createMessageFromXml.js.map +1 -1
- package/lib/commonjs/helpers/ensureScopedChatCache.js +2 -2
- package/lib/commonjs/helpers/ensureScopedChatCache.js.map +1 -1
- package/lib/commonjs/helpers/getDataFromXml.js +24 -1
- package/lib/commonjs/helpers/getDataFromXml.js.map +1 -1
- package/lib/commonjs/helpers/historyPreloadScheduler.js +2 -65
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/initXmppRooms.js +8 -14
- package/lib/commonjs/helpers/initXmppRooms.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +22 -51
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isUnresolvedSenderId.js +6 -1
- package/lib/commonjs/helpers/isUnresolvedSenderId.js.map +1 -1
- package/lib/commonjs/helpers/keyboardLayout.js +2 -12
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
- package/lib/commonjs/helpers/mimeToExtension.js +14 -6
- package/lib/commonjs/helpers/mimeToExtension.js.map +1 -1
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js +17 -130
- package/lib/commonjs/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/commonjs/helpers/resolveLangSource.js +38 -0
- package/lib/commonjs/helpers/resolveLangSource.js.map +1 -0
- package/lib/commonjs/helpers/xmppUsername.js +39 -0
- package/lib/commonjs/helpers/xmppUsername.js.map +1 -0
- package/lib/commonjs/hooks/useChatRoomFocus.js +12 -45
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useChatWrapperInit.js +14 -32
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useComposing.js +0 -27
- package/lib/commonjs/hooks/useComposing.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +7 -23
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/usePendingNotification.js +11 -8
- package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +14 -50
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js +1 -6
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +133 -121
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/i18n/useT.js +1 -1
- package/lib/commonjs/main.js +0 -44
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +60 -134
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/roomMembers.api.js +1 -1
- package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +9 -9
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +9 -68
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/apiClient.js +112 -62
- package/lib/commonjs/networking/apiClient.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +51 -93
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js +8 -46
- package/lib/commonjs/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +1 -8
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +1 -5
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +8 -124
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +7 -26
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +2 -35
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +39 -226
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +38 -151
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/services/pushSubscriptionService.js +13 -15
- package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
- package/lib/commonjs/version.js +3 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/assets/icons.js +1 -6
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/AuthForms/Login.js +4 -4
- package/lib/module/components/AuthForms/Login.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +7 -26
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +3 -9
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +16 -152
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +40 -36
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/LoginWrapper.js +1 -2
- package/lib/module/components/MainComponents/LoginWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +10 -30
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +1 -5
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +5 -13
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +26 -5
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +35 -207
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -319
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageTranslate.js +16 -7
- package/lib/module/components/MessageBubble/MessageTranslate.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +115 -311
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +219 -559
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/DeleteChatModal.js +9 -7
- package/lib/module/components/Modals/ChatProfileModal/DeleteChatModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +28 -70
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js +1 -2
- package/lib/module/components/Modals/FilePreviewModal/PdfView.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +1 -9
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +111 -208
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +2 -9
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +40 -24
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js +3 -22
- package/lib/module/components/RoomComponents/styled/LastMessageFile.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js +3 -17
- package/lib/module/components/RoomComponents/styled/LastMessagePhoto.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js +3 -17
- package/lib/module/components/RoomComponents/styled/LastMessageVideo.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +3 -6
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/styled/AudioMessage.js +1 -2
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/DateLabel.js +10 -3
- package/lib/module/components/styled/DateLabel.js.map +1 -1
- package/lib/module/components/styled/MessageImage.js +9 -37
- package/lib/module/components/styled/MessageImage.js.map +1 -1
- package/lib/module/components/styled/NewMessageLabel.js +3 -1
- package/lib/module/components/styled/NewMessageLabel.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +18 -87
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +3 -9
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/components/styled/UnsupportedType.js +4 -14
- package/lib/module/components/styled/UnsupportedType.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +62 -120
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +60 -177
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/createMessageFromXml.js +1 -19
- package/lib/module/helpers/createMessageFromXml.js.map +1 -1
- package/lib/module/helpers/ensureScopedChatCache.js +2 -2
- package/lib/module/helpers/ensureScopedChatCache.js.map +1 -1
- package/lib/module/helpers/getDataFromXml.js +23 -1
- package/lib/module/helpers/getDataFromXml.js.map +1 -1
- package/lib/module/helpers/historyPreloadScheduler.js +3 -66
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/initXmppRooms.js +8 -14
- package/lib/module/helpers/initXmppRooms.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +22 -52
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isUnresolvedSenderId.js +6 -1
- package/lib/module/helpers/isUnresolvedSenderId.js.map +1 -1
- package/lib/module/helpers/keyboardLayout.js +2 -12
- package/lib/module/helpers/keyboardLayout.js.map +1 -1
- package/lib/module/helpers/mimeToExtension.js +13 -6
- package/lib/module/helpers/mimeToExtension.js.map +1 -1
- package/lib/module/helpers/resolveInitBeforeLoadUser.js +16 -130
- package/lib/module/helpers/resolveInitBeforeLoadUser.js.map +1 -1
- package/lib/module/helpers/resolveLangSource.js +32 -0
- package/lib/module/helpers/resolveLangSource.js.map +1 -0
- package/lib/module/helpers/xmppUsername.js +35 -0
- package/lib/module/helpers/xmppUsername.js.map +1 -0
- package/lib/module/hooks/useChatRoomFocus.js +13 -46
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useChatWrapperInit.js +14 -32
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useComposing.js +1 -28
- package/lib/module/hooks/useComposing.js.map +1 -1
- package/lib/module/hooks/useLogout.js +7 -23
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/usePendingNotification.js +11 -8
- package/lib/module/hooks/usePendingNotification.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +16 -52
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js +1 -6
- package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/module/i18n/strings.js +133 -121
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/i18n/useT.js +1 -1
- package/lib/module/main.js +2 -14
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +59 -131
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/api-requests/roomMembers.api.js +1 -1
- package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +9 -9
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +7 -64
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/apiClient.js +113 -61
- package/lib/module/networking/apiClient.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +52 -94
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js +8 -46
- package/lib/module/networking/xmpp/flushLastViewedToPrivateStore.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +1 -8
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +1 -5
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +8 -124
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +7 -26
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +4 -37
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +38 -223
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +34 -139
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/services/pushSubscriptionService.js +13 -15
- package/lib/module/services/pushSubscriptionService.js.map +1 -1
- package/lib/module/version.js +3 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +0 -16
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/AuthForms/Login.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LoginWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts +1 -10
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts +0 -7
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/DeleteChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/PdfView.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageFile.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessagePhoto.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageVideo.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/DateLabel.d.ts.map +1 -1
- package/lib/typescript/components/styled/MessageImage.d.ts +0 -14
- package/lib/typescript/components/styled/MessageImage.d.ts.map +1 -1
- package/lib/typescript/components/styled/NewMessageLabel.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/UnsupportedType.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts +0 -8
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/createMessageFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/getDataFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/initXmppRooms.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isUnresolvedSenderId.d.ts.map +1 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts +1 -5
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
- package/lib/typescript/helpers/mimeToExtension.d.ts +15 -0
- package/lib/typescript/helpers/mimeToExtension.d.ts.map +1 -1
- package/lib/typescript/helpers/resolveInitBeforeLoadUser.d.ts.map +1 -1
- package/lib/typescript/helpers/resolveLangSource.d.ts +30 -0
- package/lib/typescript/helpers/resolveLangSource.d.ts.map +1 -0
- package/lib/typescript/helpers/xmppUsername.d.ts +13 -0
- package/lib/typescript/helpers/xmppUsername.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatRoomFocus.d.ts +1 -4
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useComposing.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts +0 -1
- package/lib/typescript/hooks/useUnreadMessagesCounter.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/i18n/useT.d.ts +1 -1
- package/lib/typescript/main.d.ts +2 -9
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +1 -3
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/apiClient.d.ts +6 -12
- package/lib/typescript/networking/apiClient.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts +2 -10
- package/lib/typescript/networking/xmpp/flushLastViewedToPrivateStore.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +0 -14
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +0 -16
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +1 -18
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +3 -43
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +5 -50
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +29 -41
- package/src/assets/icons.tsx +9 -48
- package/src/components/AuthForms/Login.tsx +3 -3
- package/src/components/Header/HeaderRoomList.tsx +6 -24
- package/src/components/MainComponents/ChatHeader.tsx +3 -9
- package/src/components/MainComponents/ChatRoom.tsx +15 -161
- package/src/components/MainComponents/ChatWrapper.tsx +53 -36
- package/src/components/MainComponents/LoginWrapper.tsx +0 -1
- package/src/components/MainComponents/MediaMessage.tsx +8 -26
- package/src/components/MainComponents/MessageContainer.tsx +1 -5
- package/src/components/MainComponents/MessageList.tsx +4 -23
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
- package/src/components/MainComponents/ReduxWrapper.tsx +18 -1
- package/src/components/MainComponents/RoomList.tsx +39 -236
- package/src/components/Menu/HeaderRoomListMenu.tsx +75 -328
- package/src/components/MessageBubble/MessageTranslate.tsx +17 -12
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +99 -331
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +293 -611
- package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +9 -7
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +38 -79
- package/src/components/Modals/FilePreviewModal/PdfView.tsx +1 -2
- package/src/components/Modals/Modal/Modal.tsx +0 -7
- package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +126 -223
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
- package/src/components/Modals/styledModalComponents.tsx +2 -9
- package/src/components/RoomComponents/ChatRoomItem.tsx +50 -21
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +4 -28
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +3 -18
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +3 -18
- package/src/components/VideoCalls/VideoCallSession.tsx +3 -8
- package/src/components/styled/AudioMessage.tsx +1 -2
- package/src/components/styled/DateLabel.tsx +10 -3
- package/src/components/styled/MessageImage.tsx +7 -53
- package/src/components/styled/NewMessageLabel.tsx +3 -1
- package/src/components/styled/SendInput.tsx +18 -91
- package/src/components/styled/StyledComponents.ts +3 -9
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
- package/src/components/styled/UnsupportedType.tsx +4 -14
- package/src/components/styled/VideoMessage.tsx +54 -131
- package/src/context/xmppProvider.tsx +57 -209
- package/src/helpers/createMessageFromXml.ts +1 -20
- package/src/helpers/ensureScopedChatCache.ts +2 -2
- package/src/helpers/getDataFromXml.ts +25 -1
- package/src/helpers/historyPreloadScheduler.ts +3 -80
- package/src/helpers/initXmppRooms.tsx +10 -14
- package/src/helpers/insertMessageWithDelimiter.ts +32 -55
- package/src/helpers/isUnresolvedSenderId.ts +9 -1
- package/src/helpers/keyboardLayout.ts +2 -23
- package/src/helpers/mimeToExtension.ts +22 -6
- package/src/helpers/resolveInitBeforeLoadUser.ts +18 -125
- package/src/helpers/resolveLangSource.ts +40 -0
- package/src/helpers/xmppUsername.ts +38 -0
- package/src/hooks/useChatRoomFocus.ts +9 -49
- package/src/hooks/useChatWrapperInit.ts +16 -32
- package/src/hooks/useComposing.tsx +1 -37
- package/src/hooks/useLogout.tsx +9 -29
- package/src/hooks/usePendingNotification.ts +11 -5
- package/src/hooks/useSendMessage.tsx +15 -60
- package/src/hooks/useUnreadMessagesCounter.ts +0 -11
- package/src/i18n/strings.ts +133 -121
- package/src/i18n/useT.ts +1 -1
- package/src/main.ts +2 -26
- package/src/networking/api-requests/auth.api.ts +48 -156
- package/src/networking/api-requests/roomMembers.api.ts +1 -1
- package/src/networking/api-requests/rooms.api.ts +9 -9
- package/src/networking/api-requests/user.api.ts +7 -79
- package/src/networking/apiClient.ts +123 -68
- package/src/networking/stanzaHandlers.ts +51 -92
- package/src/networking/xmpp/flushLastViewedToPrivateStore.ts +10 -71
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +1 -6
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +1 -12
- package/src/networking/xmppClient.ts +9 -141
- package/src/roomStore/chatSettingsSlice.ts +10 -34
- package/src/roomStore/index.ts +4 -40
- package/src/roomStore/persistence.ts +40 -234
- package/src/roomStore/roomsSlice.ts +29 -161
- package/src/services/pushSubscriptionService.ts +13 -18
- package/src/types/types.ts +5 -72
- package/src/version.ts +3 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/commonjs/helpers/getChatBackground.js +0 -23
- package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
- package/lib/commonjs/helpers/getDisplayFileName.js +0 -79
- package/lib/commonjs/helpers/getDisplayFileName.js.map +0 -1
- package/lib/commonjs/helpers/getServerReadTimestamp.js +0 -188
- package/lib/commonjs/helpers/getServerReadTimestamp.js.map +0 -1
- package/lib/commonjs/helpers/isOwnMessage.js +0 -75
- package/lib/commonjs/helpers/isOwnMessage.js.map +0 -1
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/commonjs/helpers/msgSortableMs.js +0 -37
- package/lib/commonjs/helpers/msgSortableMs.js.map +0 -1
- package/lib/commonjs/helpers/persistCrypto.js +0 -122
- package/lib/commonjs/helpers/persistCrypto.js.map +0 -1
- package/lib/commonjs/helpers/pickImageAsset.js +0 -68
- package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
- package/lib/commonjs/helpers/pushPayload.js +0 -71
- package/lib/commonjs/helpers/pushPayload.js.map +0 -1
- package/lib/commonjs/helpers/secureFileUrl.js +0 -101
- package/lib/commonjs/helpers/secureFileUrl.js.map +0 -1
- package/lib/commonjs/helpers/secureKeyValue.js +0 -83
- package/lib/commonjs/helpers/secureKeyValue.js.map +0 -1
- package/lib/commonjs/helpers/secureStoreRuntime.js +0 -59
- package/lib/commonjs/helpers/secureStoreRuntime.js.map +0 -1
- package/lib/commonjs/helpers/secureUserStorage.js +0 -75
- package/lib/commonjs/helpers/secureUserStorage.js.map +0 -1
- package/lib/commonjs/helpers/shallowEqual.js +0 -36
- package/lib/commonjs/helpers/shallowEqual.js.map +0 -1
- package/lib/commonjs/helpers/sheetGestures.js +0 -32
- package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
- package/lib/commonjs/hooks/useFileToken.js +0 -10
- package/lib/commonjs/hooks/useFileToken.js.map +0 -1
- package/lib/commonjs/networking/authRefresh.js +0 -332
- package/lib/commonjs/networking/authRefresh.js.map +0 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/module/helpers/getChatBackground.js +0 -18
- package/lib/module/helpers/getChatBackground.js.map +0 -1
- package/lib/module/helpers/getDisplayFileName.js +0 -73
- package/lib/module/helpers/getDisplayFileName.js.map +0 -1
- package/lib/module/helpers/getServerReadTimestamp.js +0 -181
- package/lib/module/helpers/getServerReadTimestamp.js.map +0 -1
- package/lib/module/helpers/isOwnMessage.js +0 -70
- package/lib/module/helpers/isOwnMessage.js.map +0 -1
- package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
- package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/module/helpers/msgSortableMs.js +0 -32
- package/lib/module/helpers/msgSortableMs.js.map +0 -1
- package/lib/module/helpers/persistCrypto.js +0 -115
- package/lib/module/helpers/persistCrypto.js.map +0 -1
- package/lib/module/helpers/pickImageAsset.js +0 -63
- package/lib/module/helpers/pickImageAsset.js.map +0 -1
- package/lib/module/helpers/pushPayload.js +0 -63
- package/lib/module/helpers/pushPayload.js.map +0 -1
- package/lib/module/helpers/secureFileUrl.js +0 -91
- package/lib/module/helpers/secureFileUrl.js.map +0 -1
- package/lib/module/helpers/secureKeyValue.js +0 -75
- package/lib/module/helpers/secureKeyValue.js.map +0 -1
- package/lib/module/helpers/secureStoreRuntime.js +0 -52
- package/lib/module/helpers/secureStoreRuntime.js.map +0 -1
- package/lib/module/helpers/secureUserStorage.js +0 -72
- package/lib/module/helpers/secureUserStorage.js.map +0 -1
- package/lib/module/helpers/shallowEqual.js +0 -31
- package/lib/module/helpers/shallowEqual.js.map +0 -1
- package/lib/module/helpers/sheetGestures.js +0 -26
- package/lib/module/helpers/sheetGestures.js.map +0 -1
- package/lib/module/hooks/useFileToken.js +0 -5
- package/lib/module/hooks/useFileToken.js.map +0 -1
- package/lib/module/networking/authRefresh.js +0 -321
- package/lib/module/networking/authRefresh.js.map +0 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
- package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
- package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
- package/lib/typescript/helpers/getDisplayFileName.d.ts +0 -49
- package/lib/typescript/helpers/getDisplayFileName.d.ts.map +0 -1
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts +0 -108
- package/lib/typescript/helpers/getServerReadTimestamp.d.ts.map +0 -1
- package/lib/typescript/helpers/isOwnMessage.d.ts +0 -36
- package/lib/typescript/helpers/isOwnMessage.d.ts.map +0 -1
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
- package/lib/typescript/helpers/msgSortableMs.d.ts +0 -2
- package/lib/typescript/helpers/msgSortableMs.d.ts.map +0 -1
- package/lib/typescript/helpers/persistCrypto.d.ts +0 -13
- package/lib/typescript/helpers/persistCrypto.d.ts.map +0 -1
- package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
- package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
- package/lib/typescript/helpers/pushPayload.d.ts +0 -7
- package/lib/typescript/helpers/pushPayload.d.ts.map +0 -1
- package/lib/typescript/helpers/secureFileUrl.d.ts +0 -7
- package/lib/typescript/helpers/secureFileUrl.d.ts.map +0 -1
- package/lib/typescript/helpers/secureKeyValue.d.ts +0 -13
- package/lib/typescript/helpers/secureKeyValue.d.ts.map +0 -1
- package/lib/typescript/helpers/secureStoreRuntime.d.ts +0 -29
- package/lib/typescript/helpers/secureStoreRuntime.d.ts.map +0 -1
- package/lib/typescript/helpers/secureUserStorage.d.ts +0 -23
- package/lib/typescript/helpers/secureUserStorage.d.ts.map +0 -1
- package/lib/typescript/helpers/shallowEqual.d.ts +0 -11
- package/lib/typescript/helpers/shallowEqual.d.ts.map +0 -1
- package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
- package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
- package/lib/typescript/hooks/useFileToken.d.ts +0 -2
- package/lib/typescript/hooks/useFileToken.d.ts.map +0 -1
- package/lib/typescript/networking/authRefresh.d.ts +0 -95
- package/lib/typescript/networking/authRefresh.d.ts.map +0 -1
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
- package/src/helpers/getChatBackground.ts +0 -18
- package/src/helpers/getDisplayFileName.ts +0 -87
- package/src/helpers/getServerReadTimestamp.ts +0 -197
- package/src/helpers/isOwnMessage.ts +0 -90
- package/src/helpers/mediaLibraryRuntime.ts +0 -25
- package/src/helpers/msgSortableMs.ts +0 -25
- package/src/helpers/persistCrypto.ts +0 -127
- package/src/helpers/pickImageAsset.ts +0 -68
- package/src/helpers/pushPayload.ts +0 -62
- package/src/helpers/secureFileUrl.ts +0 -103
- package/src/helpers/secureKeyValue.ts +0 -80
- package/src/helpers/secureStoreRuntime.ts +0 -62
- package/src/helpers/secureUserStorage.ts +0 -80
- package/src/helpers/shallowEqual.ts +0 -33
- package/src/helpers/sheetGestures.ts +0 -25
- package/src/hooks/useFileToken.ts +0 -7
- package/src/networking/authRefresh.ts +0 -451
|
@@ -18,9 +18,8 @@ export async function loginEmail(email: string, password: string) {
|
|
|
18
18
|
user: User;
|
|
19
19
|
refreshToken: string;
|
|
20
20
|
token: string;
|
|
21
|
-
fileToken?: string;
|
|
22
21
|
}>(
|
|
23
|
-
'/
|
|
22
|
+
'/users/login-with-email',
|
|
24
23
|
{
|
|
25
24
|
email,
|
|
26
25
|
password,
|
|
@@ -30,16 +29,6 @@ export async function loginEmail(email: string, password: string) {
|
|
|
30
29
|
|
|
31
30
|
console.log('loginEmail res', res.data);
|
|
32
31
|
|
|
33
|
-
// The fileToken arrives at the TOP level of the login response, next to
|
|
34
|
-
// token/refreshToken — not inside `user`. Folding it in here is what
|
|
35
|
-
// makes secure media (`secure-files.*`, uploaded via /v2/files/secure)
|
|
36
|
-
// render at all: without it every such image 403s and the bubble comes
|
|
37
|
-
// up blank.
|
|
38
|
-
res.data.user = {
|
|
39
|
-
...res.data.user,
|
|
40
|
-
fileToken: res.data.fileToken || '',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
32
|
return res;
|
|
44
33
|
}
|
|
45
34
|
|
|
@@ -50,7 +39,7 @@ export function loginSocial(
|
|
|
50
39
|
authToken: string = 'authToken'
|
|
51
40
|
) {
|
|
52
41
|
return http.post<any>(
|
|
53
|
-
'/
|
|
42
|
+
'/users/login',
|
|
54
43
|
{
|
|
55
44
|
idToken,
|
|
56
45
|
accessToken,
|
|
@@ -69,7 +58,7 @@ export function registerSocial(
|
|
|
69
58
|
signUpPlan?: string
|
|
70
59
|
) {
|
|
71
60
|
return http.post(
|
|
72
|
-
'/
|
|
61
|
+
'/users',
|
|
73
62
|
{
|
|
74
63
|
idToken,
|
|
75
64
|
accessToken,
|
|
@@ -83,7 +72,7 @@ export function registerSocial(
|
|
|
83
72
|
|
|
84
73
|
export function checkEmailExist(email: string) {
|
|
85
74
|
return http.get(
|
|
86
|
-
'/
|
|
75
|
+
'/users/checkEmail/' + email,
|
|
87
76
|
|
|
88
77
|
{ headers: { Authorization: getCurrentAppToken() } }
|
|
89
78
|
);
|
|
@@ -95,8 +84,7 @@ export async function loginViaJwt(clientToken: string): Promise<User> {
|
|
|
95
84
|
user: User;
|
|
96
85
|
refreshToken: string;
|
|
97
86
|
token: string;
|
|
98
|
-
|
|
99
|
-
}>('/v1/users/client', null, { headers: { 'x-custom-token': clientToken } });
|
|
87
|
+
}>('/users/client', null, { headers: { 'x-custom-token': clientToken } });
|
|
100
88
|
|
|
101
89
|
console.log('✅ loginViaJwt: Received response', {
|
|
102
90
|
hasUser: !!response.data.user,
|
|
@@ -115,8 +103,6 @@ export async function loginViaJwt(clientToken: string): Promise<User> {
|
|
|
115
103
|
...response.data.user,
|
|
116
104
|
refreshToken: response.data.refreshToken,
|
|
117
105
|
token: response.data.token,
|
|
118
|
-
// Top-level, same as loginEmail — see the note there.
|
|
119
|
-
fileToken: response.data.fileToken || '',
|
|
120
106
|
};
|
|
121
107
|
|
|
122
108
|
return user;
|
|
@@ -145,7 +131,7 @@ export async function loginViaJwt(clientToken: string): Promise<User> {
|
|
|
145
131
|
|
|
146
132
|
export function uploadFile(formData: FormData) {
|
|
147
133
|
const token = store.getState().chatSettingStore?.user?.token ?? '';
|
|
148
|
-
return http.post('/
|
|
134
|
+
return http.post('/files/', formData, {
|
|
149
135
|
headers: {
|
|
150
136
|
Authorization: token,
|
|
151
137
|
Accept: '*/*',
|
|
@@ -158,149 +144,55 @@ export function uploadFile(formData: FormData) {
|
|
|
158
144
|
});
|
|
159
145
|
}
|
|
160
146
|
|
|
161
|
-
|
|
162
|
-
const LEGACY_UPLOAD_PATH = '/v1/files/';
|
|
163
|
-
|
|
164
|
-
const cloneFormData = (formData: FormData): FormData => {
|
|
165
|
-
const copy = new FormData();
|
|
166
|
-
const source = formData as any;
|
|
167
|
-
|
|
168
|
-
if (Array.isArray(source?._parts)) {
|
|
169
|
-
for (const [key, value] of source._parts) {
|
|
170
|
-
copy.append(key, value);
|
|
171
|
-
}
|
|
172
|
-
return copy;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (typeof source?.forEach === 'function') {
|
|
176
|
-
source.forEach((value: any, key: string) => copy.append(key, value));
|
|
177
|
-
return copy;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
if (typeof source?.getParts === 'function') {
|
|
181
|
-
for (const part of source.getParts()) {
|
|
182
|
-
// `headers` is derived by getParts() and must not be copied back —
|
|
183
|
-
// RN regenerates it from the value.
|
|
184
|
-
const { fieldName, string, headers: _headers, ...file } = part;
|
|
185
|
-
copy.append(fieldName, string !== undefined ? string : file);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return copy;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
function postMultipart(
|
|
193
|
-
url: string,
|
|
194
|
-
body: FormData,
|
|
195
|
-
path: string
|
|
196
|
-
): Promise<{ data: any }> {
|
|
147
|
+
export async function uploadFileViaFetch(formData: FormData): Promise<{ data: any }> {
|
|
197
148
|
const token = store.getState().chatSettingStore?.user?.token ?? '';
|
|
149
|
+
const baseUrl = getCurrentBaseURL();
|
|
150
|
+
const url = `${baseUrl.replace(/\/$/, '')}/files/`;
|
|
198
151
|
|
|
199
|
-
pushLog('http', `→ POST ${url} (
|
|
200
|
-
|
|
201
|
-
baseUrl: getCurrentBaseURL() || '[empty]',
|
|
202
|
-
headers: {
|
|
203
|
-
Authorization: token ? token.slice(0, 16) + '…' : '[empty]',
|
|
204
|
-
Accept: '*/*',
|
|
205
|
-
},
|
|
152
|
+
pushLog('http', `→ POST ${url} (fetch)`, {
|
|
153
|
+
headers: { Authorization: token ? token.slice(0, 16) + '…' : '[empty]', Accept: '*/*' },
|
|
206
154
|
});
|
|
207
155
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const err: any = new Error(`Upload failed: ${status}`);
|
|
231
|
-
// Shaped like an axios error so callers' `err.response.status`
|
|
232
|
-
// checks keep working — notably useSendMessage's retry with the
|
|
233
|
-
// singular "file" field on 500.
|
|
234
|
-
err.response = { status, statusText: xhr.statusText, data: responseBody };
|
|
235
|
-
err.config = { url: path };
|
|
236
|
-
reject(err);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
pushLog('http', `← ${status} POST ${path} (xhr)`, {
|
|
241
|
-
resultsCount: Array.isArray(responseBody?.results)
|
|
242
|
-
? responseBody.results.length
|
|
243
|
-
: 'n/a',
|
|
244
|
-
});
|
|
245
|
-
resolve({ data: responseBody });
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
xhr.onerror = () => failNetwork('Network request failed');
|
|
249
|
-
xhr.ontimeout = () => failNetwork('Upload timed out');
|
|
250
|
-
xhr.onabort = () => failNetwork('Upload aborted');
|
|
251
|
-
|
|
252
|
-
xhr.open('POST', url);
|
|
253
|
-
xhr.setRequestHeader('Authorization', token);
|
|
254
|
-
xhr.setRequestHeader('Accept', '*/*');
|
|
255
|
-
// Deliberately no Content-Type — see the note above.
|
|
256
|
-
xhr.send(body as any);
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const canFallBackToLegacyUpload = (error: unknown): boolean => {
|
|
261
|
-
const status = (error as { response?: { status?: number } })?.response
|
|
262
|
-
?.status;
|
|
263
|
-
if (typeof status !== 'number') {return true;}
|
|
264
|
-
return status !== 401 && status !== 413;
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
let secureUploadUnavailable = false;
|
|
268
|
-
|
|
269
|
-
export async function uploadFileV2(
|
|
270
|
-
formData: FormData,
|
|
271
|
-
activeRoomJID: string
|
|
272
|
-
): Promise<{ data: any }> {
|
|
273
|
-
const chatName = (activeRoomJID || '').split('@')[0];
|
|
274
|
-
const apiRoot = getCurrentBaseURL().replace(/\/$/, '');
|
|
275
|
-
|
|
276
|
-
if (!secureUploadUnavailable && chatName) {
|
|
277
|
-
const body = cloneFormData(formData);
|
|
278
|
-
body.append('chatName', chatName);
|
|
156
|
+
let res: Response;
|
|
157
|
+
try {
|
|
158
|
+
res = await fetch(url, {
|
|
159
|
+
method: 'POST',
|
|
160
|
+
headers: {
|
|
161
|
+
Authorization: token,
|
|
162
|
+
Accept: '*/*',
|
|
163
|
+
},
|
|
164
|
+
body: formData as any,
|
|
165
|
+
});
|
|
166
|
+
} catch (e: any) {
|
|
167
|
+
pushLog('http', `← ERR fetch /files/`, {
|
|
168
|
+
name: e?.name,
|
|
169
|
+
message: e?.message,
|
|
170
|
+
stack: e?.stack,
|
|
171
|
+
});
|
|
172
|
+
const err: any = new Error(e?.message || 'Network request failed');
|
|
173
|
+
err.code = 'ERR_NETWORK';
|
|
174
|
+
err.cause = e;
|
|
175
|
+
err.config = { url: '/files/' };
|
|
176
|
+
throw err;
|
|
177
|
+
}
|
|
279
178
|
|
|
179
|
+
if (!res.ok) {
|
|
180
|
+
let body: any = null;
|
|
280
181
|
try {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
SECURE_UPLOAD_PATH
|
|
285
|
-
);
|
|
286
|
-
} catch (error) {
|
|
287
|
-
if (!canFallBackToLegacyUpload(error)) {throw error;}
|
|
288
|
-
|
|
289
|
-
secureUploadUnavailable = true;
|
|
290
|
-
console.warn(
|
|
291
|
-
`[chat] ${SECURE_UPLOAD_PATH} unreachable, falling back to ${LEGACY_UPLOAD_PATH} for this session`,
|
|
292
|
-
error
|
|
293
|
-
);
|
|
182
|
+
body = await res.json();
|
|
183
|
+
} catch {
|
|
184
|
+
try { body = await res.text(); } catch { body = null; }
|
|
294
185
|
}
|
|
186
|
+
pushLog('http', `← ${res.status} POST /files/ (fetch)`, body);
|
|
187
|
+
const err: any = new Error(`Upload failed: ${res.status}`);
|
|
188
|
+
err.response = { status: res.status, statusText: res.statusText, data: body };
|
|
189
|
+
err.config = { url: '/files/' };
|
|
190
|
+
throw err;
|
|
295
191
|
}
|
|
296
192
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
193
|
+
const data = await res.json();
|
|
194
|
+
pushLog('http', `← ${res.status} POST /files/ (fetch)`, {
|
|
195
|
+
resultsCount: Array.isArray(data?.results) ? data.results.length : 'n/a',
|
|
196
|
+
});
|
|
197
|
+
return { data };
|
|
302
198
|
}
|
|
303
|
-
|
|
304
|
-
export const __resetSecureUploadLatchForTests = (): void => {
|
|
305
|
-
secureUploadUnavailable = false;
|
|
306
|
-
};
|
|
@@ -181,7 +181,7 @@ export async function getRooms(): Promise<{ items: ApiRoom[] }> {
|
|
|
181
181
|
|
|
182
182
|
getRoomsInFlightToken = token;
|
|
183
183
|
getRoomsInFlight = (async () => {
|
|
184
|
-
const response = await http.get('/
|
|
184
|
+
const response = await http.get('/chats/my', {
|
|
185
185
|
headers: { Authorization: token },
|
|
186
186
|
});
|
|
187
187
|
lastGetRoomsResponse = response.data;
|
|
@@ -206,7 +206,7 @@ export async function getRoomByName(chatName: string): Promise<ApiRoom> {
|
|
|
206
206
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
207
207
|
|
|
208
208
|
try {
|
|
209
|
-
const response = await http.get(`/
|
|
209
|
+
const response = await http.get(`/chats/my/${chatName}`, {
|
|
210
210
|
headers: {
|
|
211
211
|
Authorization: token,
|
|
212
212
|
},
|
|
@@ -221,7 +221,7 @@ export async function postRoom(data: PostRoom) {
|
|
|
221
221
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
222
222
|
|
|
223
223
|
try {
|
|
224
|
-
const response = await http.post('/
|
|
224
|
+
const response = await http.post('/chats', data, {
|
|
225
225
|
headers: {
|
|
226
226
|
Authorization: token,
|
|
227
227
|
},
|
|
@@ -240,7 +240,7 @@ export async function postPrivateRoom(
|
|
|
240
240
|
|
|
241
241
|
try {
|
|
242
242
|
const response = await http.post(
|
|
243
|
-
'/
|
|
243
|
+
'/chats/private',
|
|
244
244
|
{ username },
|
|
245
245
|
{
|
|
246
246
|
headers: {
|
|
@@ -260,7 +260,7 @@ export async function postReportRoom(data: PostReportRoom) {
|
|
|
260
260
|
|
|
261
261
|
try {
|
|
262
262
|
const response = await http.post(
|
|
263
|
-
`/
|
|
263
|
+
`/chats/reports/${chatName}`,
|
|
264
264
|
{ category, text },
|
|
265
265
|
{
|
|
266
266
|
headers: {
|
|
@@ -282,7 +282,7 @@ export async function postAddRoomMember(
|
|
|
282
282
|
|
|
283
283
|
try {
|
|
284
284
|
const response = await http.post(
|
|
285
|
-
`/
|
|
285
|
+
`/chats/users-access`,
|
|
286
286
|
{ chatName, members },
|
|
287
287
|
{
|
|
288
288
|
headers: {
|
|
@@ -301,7 +301,7 @@ export async function deleteRoomMember(data: DeleteRoomMember) {
|
|
|
301
301
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
302
302
|
|
|
303
303
|
try {
|
|
304
|
-
const response = await http.delete(`/
|
|
304
|
+
const response = await http.delete(`/chats/users-access`, {
|
|
305
305
|
headers: {
|
|
306
306
|
Authorization: token,
|
|
307
307
|
},
|
|
@@ -320,7 +320,7 @@ export async function deleteRoom(name: string) {
|
|
|
320
320
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
321
321
|
|
|
322
322
|
try {
|
|
323
|
-
const response = await http.delete('/
|
|
323
|
+
const response = await http.delete('/chats', {
|
|
324
324
|
headers: {
|
|
325
325
|
Authorization: token,
|
|
326
326
|
},
|
|
@@ -360,7 +360,7 @@ export async function createChatCall(
|
|
|
360
360
|
|
|
361
361
|
try {
|
|
362
362
|
await http.post(
|
|
363
|
-
`/
|
|
363
|
+
`/chats/call/create/${chatName}`,
|
|
364
364
|
{ kind },
|
|
365
365
|
{
|
|
366
366
|
headers: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import http from '../apiClient';
|
|
2
|
-
import { normalizeApiPath } from '../apiClient';
|
|
3
2
|
import { store } from '../../roomStore';
|
|
4
3
|
import { User } from '../../types/types';
|
|
5
4
|
|
|
@@ -11,7 +10,7 @@ interface GetMyUserOptions {
|
|
|
11
10
|
export async function getMyUser(options?: GetMyUserOptions): Promise<User> {
|
|
12
11
|
const token =
|
|
13
12
|
options?.token || store.getState().chatSettingStore.user.token || '';
|
|
14
|
-
const endpoint =
|
|
13
|
+
const endpoint = options?.endpoint || '/users/my';
|
|
15
14
|
|
|
16
15
|
const response = await http.get(endpoint, {
|
|
17
16
|
headers: { Authorization: token },
|
|
@@ -25,7 +24,7 @@ export async function getMyUser(options?: GetMyUserOptions): Promise<User> {
|
|
|
25
24
|
|
|
26
25
|
export function getDocuments(walletAddress: string) {
|
|
27
26
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
28
|
-
return http.get(`/
|
|
27
|
+
return http.get(`/docs/${walletAddress}`, {
|
|
29
28
|
headers: {
|
|
30
29
|
Authorization: `Bearer ${token}`,
|
|
31
30
|
},
|
|
@@ -34,7 +33,7 @@ export function getDocuments(walletAddress: string) {
|
|
|
34
33
|
|
|
35
34
|
export function getExportMyData() {
|
|
36
35
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
37
|
-
return http.get('/
|
|
36
|
+
return http.get('/users/exportData', {
|
|
38
37
|
headers: {
|
|
39
38
|
Authorization: token,
|
|
40
39
|
responseType: 'arraybuffer',
|
|
@@ -44,7 +43,7 @@ export function getExportMyData() {
|
|
|
44
43
|
|
|
45
44
|
export function deleteDocument(fileId: string) {
|
|
46
45
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
47
|
-
return http.delete(`/
|
|
46
|
+
return http.delete(`/files/${fileId}`, {
|
|
48
47
|
headers: {
|
|
49
48
|
Authorization: token,
|
|
50
49
|
},
|
|
@@ -52,18 +51,18 @@ export function deleteDocument(fileId: string) {
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
export function deleteMe() {
|
|
55
|
-
return http.delete('/
|
|
54
|
+
return http.delete('/users');
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
export function updateMe(data: any) {
|
|
59
|
-
return http.put('/
|
|
58
|
+
return http.put('/users', data);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
export async function updateProfile(fd: FormData): Promise<{ user: User }> {
|
|
63
62
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
64
63
|
|
|
65
64
|
try {
|
|
66
|
-
const response = await http.put('/
|
|
65
|
+
const response = await http.put('/users', fd, {
|
|
67
66
|
headers: {
|
|
68
67
|
Authorization: token,
|
|
69
68
|
'Content-Type': 'multipart/form-data',
|
|
@@ -74,74 +73,3 @@ export async function updateProfile(fd: FormData): Promise<{ user: User }> {
|
|
|
74
73
|
throw new Error('Error updating profile');
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
/** One entry of `GET /v2/files/`, normalised for the UI. */
|
|
79
|
-
export interface UserFile {
|
|
80
|
-
id: string;
|
|
81
|
-
name: string;
|
|
82
|
-
url: string;
|
|
83
|
-
mimetype: string;
|
|
84
|
-
createdAt?: string;
|
|
85
|
-
size?: number;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Files uploaded by the signed-in user (the JWT owner) — the profile
|
|
90
|
-
* screen's Media and Documents tabs.
|
|
91
|
-
*
|
|
92
|
-
* v2 answers `{ results, pagination }` and, for backward compatibility,
|
|
93
|
-
* also `{ limit, offset, total, items }`; older deployments only have the
|
|
94
|
-
* legacy shape. Read whichever is there instead of betting on one. Field
|
|
95
|
-
* names vary the same way between deployments (`location` vs `locations[]`,
|
|
96
|
-
* `originalname` vs `filename`), so each one falls through its aliases and
|
|
97
|
-
* anything without a usable URL is dropped rather than rendered as a dead
|
|
98
|
-
* row.
|
|
99
|
-
*/
|
|
100
|
-
export async function getUserFiles(options?: {
|
|
101
|
-
limit?: number;
|
|
102
|
-
offset?: number;
|
|
103
|
-
}): Promise<UserFile[]> {
|
|
104
|
-
const token = store.getState().chatSettingStore.user.token || '';
|
|
105
|
-
const response = await http.get('/v2/files/', {
|
|
106
|
-
params: {
|
|
107
|
-
limit: options?.limit ?? 100,
|
|
108
|
-
offset: options?.offset ?? 0,
|
|
109
|
-
},
|
|
110
|
-
headers: { Authorization: token },
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const payload = response?.data ?? {};
|
|
114
|
-
const rows: any[] = payload.results ?? payload.items ?? [];
|
|
115
|
-
|
|
116
|
-
return rows
|
|
117
|
-
.map((row: any): UserFile | null => {
|
|
118
|
-
const url = row?.location || row?.locations?.[0] || row?.url || '';
|
|
119
|
-
if (!url) {return null;}
|
|
120
|
-
return {
|
|
121
|
-
id: String(row?._id ?? row?.id ?? url),
|
|
122
|
-
name:
|
|
123
|
-
row?.originalname ||
|
|
124
|
-
row?.filename ||
|
|
125
|
-
row?.documentName ||
|
|
126
|
-
row?.name ||
|
|
127
|
-
url.split('/').pop() ||
|
|
128
|
-
'file',
|
|
129
|
-
url,
|
|
130
|
-
mimetype: row?.mimetype || row?.mimeType || row?.type || '',
|
|
131
|
-
createdAt: row?.createdAt || row?.updatedAt,
|
|
132
|
-
size: typeof row?.size === 'number' ? row.size : undefined,
|
|
133
|
-
};
|
|
134
|
-
})
|
|
135
|
-
.filter(Boolean) as UserFile[];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/** Images and video go to the Media tab, everything else to Documents. */
|
|
139
|
-
export const isMediaFile = (file: UserFile): boolean => {
|
|
140
|
-
const mime = (file.mimetype || '').toLowerCase();
|
|
141
|
-
if (mime.startsWith('image/') || mime.startsWith('video/')) {return true;}
|
|
142
|
-
if (mime) {return false;}
|
|
143
|
-
// Deployments that don't store a mimetype still name the file.
|
|
144
|
-
return /\.(jpe?g|png|gif|webp|heic|heif|mp4|mov|m4v|3gp|avi|mkv)$/i.test(
|
|
145
|
-
file.name
|
|
146
|
-
);
|
|
147
|
-
};
|