@ethora/chat-component-rn 26.9.0 → 26.10.0
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 +34 -0
- package/README.md +19 -0
- package/lib/commonjs/assets/icons.js +2 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +22 -6
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/InputComponents/Search.js +38 -1
- package/lib/commonjs/components/InputComponents/Search.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js +166 -0
- package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ChatHeader.js +22 -5
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +56 -25
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +53 -4
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js +18 -3
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +739 -42
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js +58 -0
- package/lib/commonjs/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +15 -6
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +110 -1
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +14 -3
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js +112 -0
- package/lib/commonjs/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +169 -125
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js +50 -0
- package/lib/commonjs/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +73 -37
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js +253 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +488 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js +51 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js +47 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js +83 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js +61 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js +136 -0
- package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js +306 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js +36 -0
- package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +13 -2
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js +38 -6
- package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js +3 -1
- package/lib/commonjs/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +90 -10
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/styled/AudioDecoderHost.js +338 -0
- package/lib/commonjs/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/commonjs/components/styled/AudioMessage.js +493 -420
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +31 -5
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +14 -4
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +54 -79
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/audioWaveform.js +165 -0
- package/lib/commonjs/helpers/audioWaveform.js.map +1 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js +36 -0
- package/lib/commonjs/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/commonjs/helpers/bubbleHighlight.js +44 -0
- package/lib/commonjs/helpers/bubbleHighlight.js.map +1 -0
- package/lib/commonjs/helpers/checkUniqueUsers.js +14 -12
- package/lib/commonjs/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/commonjs/helpers/createRoomFromApi.js +40 -3
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/dedupeMembers.js +34 -0
- package/lib/commonjs/helpers/dedupeMembers.js.map +1 -0
- package/lib/commonjs/helpers/ethoraLogger.js +56 -0
- package/lib/commonjs/helpers/ethoraLogger.js.map +1 -0
- package/lib/commonjs/helpers/getUnnamedUsers.js +9 -4
- package/lib/commonjs/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/commonjs/helpers/historyPreloadConfig.js +44 -0
- package/lib/commonjs/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +372 -137
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/initRoomsPresence.js +17 -5
- package/lib/commonjs/helpers/initRoomsPresence.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isLikelyMucJid.js +67 -0
- package/lib/commonjs/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js +18 -0
- package/lib/commonjs/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/commonjs/helpers/joiningRoom.js +14 -0
- package/lib/commonjs/helpers/joiningRoom.js.map +1 -0
- package/lib/commonjs/helpers/jumpThread.js +100 -0
- package/lib/commonjs/helpers/jumpThread.js.map +1 -0
- package/lib/commonjs/helpers/jumpToMessage.js +58 -0
- package/lib/commonjs/helpers/jumpToMessage.js.map +1 -0
- package/lib/commonjs/helpers/jumpWindow.js +187 -0
- package/lib/commonjs/helpers/jumpWindow.js.map +1 -0
- package/lib/commonjs/helpers/loadRoomHistory.js +75 -0
- package/lib/commonjs/helpers/loadRoomHistory.js.map +1 -0
- package/lib/commonjs/helpers/notificationPolicy.js +77 -0
- package/lib/commonjs/helpers/notificationPolicy.js.map +1 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js +47 -0
- package/lib/commonjs/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/commonjs/helpers/openThreadForJump.js +72 -0
- package/lib/commonjs/helpers/openThreadForJump.js.map +1 -0
- package/lib/commonjs/helpers/parseMessageReference.js +27 -8
- package/lib/commonjs/helpers/parseMessageReference.js.map +1 -1
- package/lib/commonjs/helpers/publicChatsEntry.js +17 -0
- package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -0
- package/lib/commonjs/helpers/roomActivityScore.js +37 -0
- package/lib/commonjs/helpers/roomActivityScore.js.map +1 -0
- package/lib/commonjs/helpers/roomUserCount.js +36 -0
- package/lib/commonjs/helpers/roomUserCount.js.map +1 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js +68 -0
- package/lib/commonjs/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/commonjs/helpers/sessionAppId.js +24 -0
- package/lib/commonjs/helpers/sessionAppId.js.map +1 -0
- package/lib/commonjs/helpers/timestamp.js +43 -0
- package/lib/commonjs/helpers/timestamp.js.map +1 -0
- package/lib/commonjs/helpers/userResolver.js +517 -0
- package/lib/commonjs/helpers/userResolver.js.map +1 -0
- package/lib/commonjs/helpers/xmppIdShape.js +52 -0
- package/lib/commonjs/helpers/xmppIdShape.js.map +1 -0
- package/lib/commonjs/hooks/useChatWrapperInit.js +27 -5
- package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/commonjs/hooks/useHeapSender.js +54 -3
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useJumpToMessage.js +411 -0
- package/lib/commonjs/hooks/useJumpToMessage.js.map +1 -0
- package/lib/commonjs/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/commonjs/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/commonjs/hooks/useMessageQueue.js +13 -5
- package/lib/commonjs/hooks/useMessageQueue.js.map +1 -1
- package/lib/commonjs/hooks/useRoomDirectory.js +29 -0
- package/lib/commonjs/hooks/useRoomDirectory.js.map +1 -0
- package/lib/commonjs/hooks/useRoomInitialization.js +27 -5
- package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
- package/lib/commonjs/hooks/useRoomMute.js +62 -0
- package/lib/commonjs/hooks/useRoomMute.js.map +1 -0
- package/lib/commonjs/hooks/useRoomState.js +3 -1
- package/lib/commonjs/hooks/useRoomState.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +13 -3
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +318 -6
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/messageSearch.api.js +87 -0
- package/lib/commonjs/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js +48 -0
- package/lib/commonjs/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/roomMembers.api.js +253 -4
- package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +48 -12
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/xmppToken.api.js +71 -0
- package/lib/commonjs/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/commonjs/networking/ethoraEvents.js +227 -0
- package/lib/commonjs/networking/ethoraEvents.js.map +1 -0
- package/lib/commonjs/networking/stanzaHandlers.js +153 -16
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js +124 -3
- package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +319 -35
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/historyCursor.js +101 -0
- package/lib/commonjs/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js +17 -0
- package/lib/commonjs/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/commonjs/networking/xmpp/mamRouter.js +24 -9
- package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +70 -65
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js +389 -0
- package/lib/commonjs/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +269 -41
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/networking/xmppCredentials.js +80 -0
- package/lib/commonjs/networking/xmppCredentials.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js +158 -0
- package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +45 -7
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +15 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +13 -3
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +48 -1
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +474 -60
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/safeKey.js +44 -0
- package/lib/commonjs/roomStore/safeKey.js.map +1 -0
- package/lib/commonjs/roomStore/usersSetCap.js +37 -0
- package/lib/commonjs/roomStore/usersSetCap.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +23 -7
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/InputComponents/Search.js +39 -2
- package/lib/module/components/InputComponents/Search.js.map +1 -1
- package/lib/module/components/MainComponents/ArchivedMessageCard.js +161 -0
- package/lib/module/components/MainComponents/ArchivedMessageCard.js.map +1 -0
- package/lib/module/components/MainComponents/ChatHeader.js +22 -5
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +57 -26
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +54 -5
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MediaMessage.js +18 -3
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +740 -42
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/MessageSearchButton.js +48 -0
- package/lib/module/components/MainComponents/MessageSearchButton.js.map +1 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js +15 -7
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +111 -2
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +15 -4
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/MessageBubble/BubbleHighlight.js +106 -0
- package/lib/module/components/MessageBubble/BubbleHighlight.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +172 -127
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +98 -78
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/MessageBubble/messageMenuLayout.js +45 -0
- package/lib/module/components/MessageBubble/messageMenuLayout.js.map +1 -0
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +74 -38
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js +243 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +482 -0
- package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js +45 -0
- package/lib/module/components/Modals/MessageSearchModal/openHit.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js +41 -0
- package/lib/module/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js +74 -0
- package/lib/module/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js +57 -0
- package/lib/module/components/Modals/MessageSearchModal/snippet.js.map +1 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js +131 -0
- package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js +300 -0
- package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js +30 -0
- package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +14 -3
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js +39 -7
- package/lib/module/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
- package/lib/module/components/Thread/ThreadHeader.js +3 -1
- package/lib/module/components/Thread/ThreadHeader.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +89 -9
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/styled/AudioDecoderHost.js +332 -0
- package/lib/module/components/styled/AudioDecoderHost.js.map +1 -0
- package/lib/module/components/styled/AudioMessage.js +495 -422
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +32 -6
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +15 -5
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +54 -79
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/audioWaveform.js +153 -0
- package/lib/module/helpers/audioWaveform.js.map +1 -0
- package/lib/module/helpers/backgroundJoinSweep.js +30 -0
- package/lib/module/helpers/backgroundJoinSweep.js.map +1 -0
- package/lib/module/helpers/bubbleHighlight.js +38 -0
- package/lib/module/helpers/bubbleHighlight.js.map +1 -0
- package/lib/module/helpers/checkUniqueUsers.js +15 -13
- package/lib/module/helpers/checkUniqueUsers.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js +5 -1
- package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js +3 -1
- package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
- package/lib/module/helpers/createRoomFromApi.js +37 -3
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/dedupeMembers.js +28 -0
- package/lib/module/helpers/dedupeMembers.js.map +1 -0
- package/lib/module/helpers/ethoraLogger.js +52 -0
- package/lib/module/helpers/ethoraLogger.js.map +1 -0
- package/lib/module/helpers/getUnnamedUsers.js +9 -4
- package/lib/module/helpers/getUnnamedUsers.js.map +1 -1
- package/lib/module/helpers/historyPreloadConfig.js +39 -0
- package/lib/module/helpers/historyPreloadConfig.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +368 -134
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/initRoomsPresence.js +18 -5
- package/lib/module/helpers/initRoomsPresence.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +5 -0
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isLikelyMucJid.js +60 -0
- package/lib/module/helpers/isLikelyMucJid.js.map +1 -0
- package/lib/module/helpers/isMessageSearchEnabled.js +13 -0
- package/lib/module/helpers/isMessageSearchEnabled.js.map +1 -0
- package/lib/module/helpers/joiningRoom.js +9 -0
- package/lib/module/helpers/joiningRoom.js.map +1 -0
- package/lib/module/helpers/jumpThread.js +83 -0
- package/lib/module/helpers/jumpThread.js.map +1 -0
- package/lib/module/helpers/jumpToMessage.js +52 -0
- package/lib/module/helpers/jumpToMessage.js.map +1 -0
- package/lib/module/helpers/jumpWindow.js +177 -0
- package/lib/module/helpers/jumpWindow.js.map +1 -0
- package/lib/module/helpers/loadRoomHistory.js +69 -0
- package/lib/module/helpers/loadRoomHistory.js.map +1 -0
- package/lib/module/helpers/notificationPolicy.js +70 -0
- package/lib/module/helpers/notificationPolicy.js.map +1 -0
- package/lib/module/helpers/openRoomAtMessage.js +41 -0
- package/lib/module/helpers/openRoomAtMessage.js.map +1 -0
- package/lib/module/helpers/openThreadForJump.js +68 -0
- package/lib/module/helpers/openThreadForJump.js.map +1 -0
- package/lib/module/helpers/parseMessageReference.js +26 -6
- package/lib/module/helpers/parseMessageReference.js.map +1 -1
- package/lib/module/helpers/publicChatsEntry.js +12 -0
- package/lib/module/helpers/publicChatsEntry.js.map +1 -0
- package/lib/module/helpers/roomActivityScore.js +30 -0
- package/lib/module/helpers/roomActivityScore.js.map +1 -0
- package/lib/module/helpers/roomUserCount.js +29 -0
- package/lib/module/helpers/roomUserCount.js.map +1 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js +63 -0
- package/lib/module/helpers/runConfiguredHistoryPreload.js.map +1 -0
- package/lib/module/helpers/sessionAppId.js +20 -0
- package/lib/module/helpers/sessionAppId.js.map +1 -0
- package/lib/module/helpers/timestamp.js +37 -0
- package/lib/module/helpers/timestamp.js.map +1 -0
- package/lib/module/helpers/userResolver.js +503 -0
- package/lib/module/helpers/userResolver.js.map +1 -0
- package/lib/module/helpers/xmppIdShape.js +46 -0
- package/lib/module/helpers/xmppIdShape.js.map +1 -0
- package/lib/module/hooks/useChatWrapperInit.js +16 -5
- package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
- package/lib/module/hooks/useHeapSender.js +54 -3
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useJumpToMessage.js +389 -0
- package/lib/module/hooks/useJumpToMessage.js.map +1 -0
- package/lib/module/hooks/useMessageLoaderQueue.js +32 -5
- package/lib/module/hooks/useMessageLoaderQueue.js.map +1 -1
- package/lib/module/hooks/useMessageQueue.js +13 -5
- package/lib/module/hooks/useMessageQueue.js.map +1 -1
- package/lib/module/hooks/useRoomDirectory.js +24 -0
- package/lib/module/hooks/useRoomDirectory.js.map +1 -0
- package/lib/module/hooks/useRoomInitialization.js +29 -7
- package/lib/module/hooks/useRoomInitialization.js.map +1 -1
- package/lib/module/hooks/useRoomMute.js +58 -0
- package/lib/module/hooks/useRoomMute.js.map +1 -0
- package/lib/module/hooks/useRoomState.js +3 -1
- package/lib/module/hooks/useRoomState.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +13 -3
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +318 -6
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/messageSearch.api.js +81 -0
- package/lib/module/networking/api-requests/messageSearch.api.js.map +1 -0
- package/lib/module/networking/api-requests/publicChats.api.js +43 -0
- package/lib/module/networking/api-requests/publicChats.api.js.map +1 -0
- package/lib/module/networking/api-requests/roomMembers.api.js +248 -4
- package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +48 -12
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/xmppToken.api.js +66 -0
- package/lib/module/networking/api-requests/xmppToken.api.js.map +1 -0
- package/lib/module/networking/ethoraEvents.js +220 -0
- package/lib/module/networking/ethoraEvents.js.map +1 -0
- package/lib/module/networking/stanzaHandlers.js +155 -18
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js +125 -3
- package/lib/module/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/getHistory.xmpp.js +318 -35
- package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +7 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/historyCursor.js +95 -0
- package/lib/module/networking/xmpp/historyCursor.js.map +1 -0
- package/lib/module/networking/xmpp/mamQueryIds.js +12 -0
- package/lib/module/networking/xmpp/mamQueryIds.js.map +1 -0
- package/lib/module/networking/xmpp/mamRouter.js +22 -8
- package/lib/module/networking/xmpp/mamRouter.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +68 -62
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/roomJoinSweep.js +385 -0
- package/lib/module/networking/xmpp/roomJoinSweep.js.map +1 -0
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +269 -41
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/networking/xmppCredentials.js +76 -0
- package/lib/module/networking/xmppCredentials.js.map +1 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js +153 -0
- package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js +6 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +46 -7
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +13 -0
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +7 -3
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +46 -1
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +459 -58
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/roomStore/safeKey.js +37 -0
- package/lib/module/roomStore/safeKey.js.map +1 -0
- package/lib/module/roomStore/usersSetCap.js +32 -0
- package/lib/module/roomStore/usersSetCap.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +4 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/InputComponents/Search.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts +12 -0
- package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts.map +1 -0
- 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/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts +22 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts +7 -0
- package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts +12 -0
- package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +5 -0
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts +29 -0
- package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +2 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts +44 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +12 -0
- package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts +34 -0
- package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts +41 -0
- package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts +15 -0
- package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts.map +1 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts +23 -0
- package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +16 -0
- package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts +14 -0
- package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts +5 -1
- package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadHeader.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts +1 -0
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts +39 -0
- package/lib/typescript/components/styled/AudioDecoderHost.d.ts.map +1 -0
- package/lib/typescript/components/styled/AudioMessage.d.ts +14 -1
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts +2 -0
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/audioWaveform.d.ts +54 -0
- package/lib/typescript/helpers/audioWaveform.d.ts.map +1 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts +14 -0
- package/lib/typescript/helpers/backgroundJoinSweep.d.ts.map +1 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts +17 -0
- package/lib/typescript/helpers/bubbleHighlight.d.ts.map +1 -0
- package/lib/typescript/helpers/checkUniqueUsers.d.ts +2 -2
- package/lib/typescript/helpers/checkUniqueUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
- package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
- package/lib/typescript/helpers/createRoomFromApi.d.ts +25 -0
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/dedupeMembers.d.ts +11 -0
- package/lib/typescript/helpers/dedupeMembers.d.ts.map +1 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts +13 -0
- package/lib/typescript/helpers/ethoraLogger.d.ts.map +1 -0
- package/lib/typescript/helpers/getUnnamedUsers.d.ts.map +1 -1
- package/lib/typescript/helpers/historyPreloadConfig.d.ts +26 -0
- package/lib/typescript/helpers/historyPreloadConfig.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts +8 -4
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/initRoomsPresence.d.ts +7 -0
- package/lib/typescript/helpers/initRoomsPresence.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isLikelyMucJid.d.ts +19 -0
- package/lib/typescript/helpers/isLikelyMucJid.d.ts.map +1 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts +12 -0
- package/lib/typescript/helpers/isMessageSearchEnabled.d.ts.map +1 -0
- package/lib/typescript/helpers/joiningRoom.d.ts +7 -0
- package/lib/typescript/helpers/joiningRoom.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpThread.d.ts +48 -0
- package/lib/typescript/helpers/jumpThread.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts +26 -0
- package/lib/typescript/helpers/jumpToMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/jumpWindow.d.ts +74 -0
- package/lib/typescript/helpers/jumpWindow.d.ts.map +1 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts +34 -0
- package/lib/typescript/helpers/loadRoomHistory.d.ts.map +1 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts +42 -0
- package/lib/typescript/helpers/notificationPolicy.d.ts.map +1 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts +17 -0
- package/lib/typescript/helpers/openRoomAtMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts +27 -0
- package/lib/typescript/helpers/openThreadForJump.d.ts.map +1 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts +18 -5
- package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -1
- package/lib/typescript/helpers/publicChatsEntry.d.ts +11 -0
- package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts +5 -0
- package/lib/typescript/helpers/roomActivityScore.d.ts.map +1 -0
- package/lib/typescript/helpers/roomUserCount.d.ts +20 -0
- package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts +21 -0
- package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts.map +1 -0
- package/lib/typescript/helpers/sessionAppId.d.ts +8 -0
- package/lib/typescript/helpers/sessionAppId.d.ts.map +1 -0
- package/lib/typescript/helpers/timestamp.d.ts +3 -0
- package/lib/typescript/helpers/timestamp.d.ts.map +1 -0
- package/lib/typescript/helpers/userResolver.d.ts +58 -0
- package/lib/typescript/helpers/userResolver.d.ts.map +1 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts +10 -0
- package/lib/typescript/helpers/xmppIdShape.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts +2 -0
- package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useJumpToMessage.d.ts +116 -0
- package/lib/typescript/hooks/useJumpToMessage.d.ts.map +1 -0
- package/lib/typescript/hooks/useMessageLoaderQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageQueue.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomDirectory.d.ts +12 -0
- package/lib/typescript/hooks/useRoomDirectory.d.ts.map +1 -0
- package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomMute.d.ts +8 -0
- package/lib/typescript/hooks/useRoomMute.d.ts.map +1 -0
- package/lib/typescript/hooks/useRoomState.d.ts +1 -0
- package/lib/typescript/hooks/useRoomState.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts +57 -0
- package/lib/typescript/networking/api-requests/messageSearch.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts +24 -0
- package/lib/typescript/networking/api-requests/publicChats.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts +19 -1
- package/lib/typescript/networking/api-requests/roomMembers.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts +2 -0
- package/lib/typescript/networking/api-requests/xmppToken.api.d.ts.map +1 -0
- package/lib/typescript/networking/ethoraEvents.d.ts +45 -0
- package/lib/typescript/networking/ethoraEvents.d.ts.map +1 -0
- package/lib/typescript/networking/stanzaHandlers.d.ts +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts +32 -1
- package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +64 -0
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/historyCursor.d.ts +35 -0
- package/lib/typescript/networking/xmpp/historyCursor.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts +10 -0
- package/lib/typescript/networking/xmpp/mamQueryIds.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts +7 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +13 -2
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts +82 -0
- package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +90 -4
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/networking/xmppCredentials.d.ts +12 -0
- package/lib/typescript/networking/xmppCredentials.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts +3 -0
- package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts +2 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts +8 -0
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +138 -2
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/safeKey.d.ts +13 -0
- package/lib/typescript/roomStore/safeKey.d.ts.map +1 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts +16 -0
- package/lib/typescript/roomStore/usersSetCap.d.ts.map +1 -0
- package/lib/typescript/types/models/media.model.d.ts +2 -0
- package/lib/typescript/types/models/media.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +18 -5
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +8 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +90 -5
- 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 +1 -1
- package/src/assets/icons.tsx +13 -0
- package/src/components/Header/HeaderRoomList.tsx +21 -4
- package/src/components/InputComponents/Search.tsx +33 -0
- package/src/components/MainComponents/ArchivedMessageCard.tsx +139 -0
- package/src/components/MainComponents/ChatHeader.tsx +19 -3
- package/src/components/MainComponents/ChatRoom.tsx +60 -23
- package/src/components/MainComponents/ChatWrapper.tsx +50 -9
- package/src/components/MainComponents/MediaMessage.tsx +17 -0
- package/src/components/MainComponents/MessageList.tsx +823 -84
- package/src/components/MainComponents/MessageSearchButton.tsx +48 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +16 -5
- package/src/components/MainComponents/RoomList.tsx +125 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +26 -2
- package/src/components/MessageBubble/BubbleHighlight.tsx +106 -0
- package/src/components/MessageBubble/Message.tsx +265 -177
- package/src/components/MessageBubble/MessageInteractions.tsx +109 -86
- package/src/components/MessageBubble/messageMenuLayout.ts +59 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +92 -21
- package/src/components/Modals/MessageSearchModal/MessageHitResults.tsx +271 -0
- package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +487 -0
- package/src/components/Modals/MessageSearchModal/openHit.ts +50 -0
- package/src/components/Modals/MessageSearchModal/resolveSender.ts +57 -0
- package/src/components/Modals/MessageSearchModal/searchFilters.ts +109 -0
- package/src/components/Modals/MessageSearchModal/snippet.ts +58 -0
- package/src/components/Modals/MessageSearchModal/useMessageSearch.ts +151 -0
- package/src/components/Modals/PublicChatsModal/PublicChatsModal.tsx +288 -0
- package/src/components/Modals/PublicChatsModal/publicChatsLogic.ts +36 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +8 -1
- package/src/components/RoomComponents/ChatRoomItem.tsx +16 -3
- package/src/components/RoomComponents/SwipeableRoomRow.tsx +39 -6
- package/src/components/Thread/ThreadHeader.tsx +3 -1
- package/src/components/Thread/ThreadWrapper.tsx +96 -10
- package/src/components/styled/AudioDecoderHost.tsx +351 -0
- package/src/components/styled/AudioMessage.tsx +482 -425
- package/src/components/styled/SendInput.tsx +42 -4
- package/src/context/MessageNotificationContext.tsx +19 -5
- package/src/context/xmppProvider.tsx +56 -91
- package/src/helpers/audioWaveform.ts +142 -0
- package/src/helpers/backgroundJoinSweep.ts +35 -0
- package/src/helpers/bubbleHighlight.ts +47 -0
- package/src/helpers/checkUniqueUsers.tsx +15 -17
- package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -0
- package/src/helpers/constants/MODAL_TYPES.ts +3 -0
- package/src/helpers/createRoomFromApi.tsx +45 -4
- package/src/helpers/dedupeMembers.ts +29 -0
- package/src/helpers/ethoraLogger.ts +50 -0
- package/src/helpers/getUnnamedUsers.ts +7 -4
- package/src/helpers/historyPreloadConfig.ts +68 -0
- package/src/helpers/historyPreloadScheduler.ts +437 -199
- package/src/helpers/initRoomsPresence.ts +20 -7
- package/src/helpers/insertMessageWithDelimiter.ts +3 -0
- package/src/helpers/isLikelyMucJid.ts +72 -0
- package/src/helpers/isMessageSearchEnabled.ts +18 -0
- package/src/helpers/joiningRoom.ts +13 -0
- package/src/helpers/jumpThread.ts +102 -0
- package/src/helpers/jumpToMessage.ts +57 -0
- package/src/helpers/jumpWindow.ts +212 -0
- package/src/helpers/loadRoomHistory.ts +83 -0
- package/src/helpers/notificationPolicy.ts +82 -0
- package/src/helpers/openRoomAtMessage.ts +38 -0
- package/src/helpers/openThreadForJump.ts +96 -0
- package/src/helpers/parseMessageReference.ts +37 -8
- package/src/helpers/publicChatsEntry.ts +15 -0
- package/src/helpers/roomActivityScore.ts +45 -0
- package/src/helpers/roomUserCount.ts +44 -0
- package/src/helpers/runConfiguredHistoryPreload.ts +76 -0
- package/src/helpers/sessionAppId.ts +17 -0
- package/src/helpers/timestamp.ts +44 -0
- package/src/helpers/userResolver.ts +542 -0
- package/src/helpers/xmppIdShape.ts +46 -0
- package/src/hooks/useChatWrapperInit.ts +22 -4
- package/src/hooks/useHeapSender.tsx +54 -3
- package/src/hooks/useJumpToMessage.ts +538 -0
- package/src/hooks/useMessageLoaderQueue.tsx +40 -4
- package/src/hooks/useMessageQueue.ts +9 -5
- package/src/hooks/useRoomDirectory.ts +39 -0
- package/src/hooks/useRoomInitialization.tsx +33 -7
- package/src/hooks/useRoomMute.ts +42 -0
- package/src/hooks/useRoomState.tsx +6 -0
- package/src/hooks/useSendMessage.tsx +14 -2
- package/src/i18n/strings.ts +312 -0
- package/src/networking/api-requests/messageSearch.api.ts +130 -0
- package/src/networking/api-requests/publicChats.api.ts +71 -0
- package/src/networking/api-requests/roomMembers.api.ts +263 -11
- package/src/networking/api-requests/rooms.api.ts +52 -12
- package/src/networking/api-requests/xmppToken.api.ts +62 -0
- package/src/networking/ethoraEvents.ts +262 -0
- package/src/networking/stanzaHandlers.ts +145 -19
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +155 -5
- package/src/networking/xmpp/getHistory.xmpp.ts +433 -47
- package/src/networking/xmpp/handleStanzas.xmpp.ts +8 -0
- package/src/networking/xmpp/historyCursor.ts +124 -0
- package/src/networking/xmpp/mamQueryIds.ts +11 -0
- package/src/networking/xmpp/mamRouter.ts +24 -10
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +91 -68
- package/src/networking/xmpp/roomJoinSweep.ts +412 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +0 -1
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +0 -1
- package/src/networking/xmppClient.ts +323 -47
- package/src/networking/xmppCredentials.ts +87 -0
- package/src/roomStore/Middleware/jumpThreadMiddleware.ts +163 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +4 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +59 -11
- package/src/roomStore/chatSettingsSlice.ts +11 -0
- package/src/roomStore/index.ts +10 -3
- package/src/roomStore/persistence.ts +54 -0
- package/src/roomStore/roomsSlice.ts +547 -65
- package/src/roomStore/safeKey.ts +49 -0
- package/src/roomStore/usersSetCap.ts +37 -0
- package/src/types/models/media.model.ts +4 -0
- package/src/types/models/room.model.ts +18 -5
- package/src/types/models/xmpp.model.ts +15 -1
- package/src/types/types.ts +95 -5
- package/src/version.ts +1 -1
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { presenceInRoom } from '../networking/xmpp/presenceInRoom.xmpp';
|
|
4
4
|
import { pushSubscriptionService } from '../services/pushSubscriptionService';
|
|
5
|
+
import { startBackgroundJoinSweep } from './backgroundJoinSweep';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Joins the known rooms and subscribes them for push. Callers should NOT
|
|
9
|
+
* await it on a path that gates first paint: with a real XmppClient the
|
|
10
|
+
* joins are the shared background sweep (open room first, then recent
|
|
11
|
+
* activity, bounded concurrency), started here and not waited for. Only a
|
|
12
|
+
* bare client without the sweep falls back to joining every room at once.
|
|
13
|
+
*/
|
|
5
14
|
export const initRoomsPresence = async (client, rooms) => {
|
|
6
15
|
console.log('Persisted presence');
|
|
7
16
|
if (!client) {
|
|
@@ -11,11 +20,15 @@ export const initRoomsPresence = async (client, rooms) => {
|
|
|
11
20
|
if (!jids.length) {
|
|
12
21
|
return null;
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
if (typeof client.sendAllPresencesAndMarkReady === 'function') {
|
|
24
|
+
startBackgroundJoinSweep(client);
|
|
25
|
+
} else {
|
|
26
|
+
await Promise.allSettled(jids.map(async jid => {
|
|
27
|
+
try {
|
|
28
|
+
await presenceInRoom(client.client, jid);
|
|
29
|
+
} catch (e) {}
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
19
32
|
if (jids.length > 0 && client.client) {
|
|
20
33
|
const userNick = client.client.jid?.getLocal();
|
|
21
34
|
await pushSubscriptionService.subscribeToRooms(client.client, jids, userNick).catch(error => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["presenceInRoom","pushSubscriptionService","initRoomsPresence","client","rooms","console","log","jids","Object","keys","length","Promise","allSettled","map","jid","e","userNick","getLocal","subscribeToRooms","catch","error"],"sourceRoot":"../../../src","sources":["helpers/initRoomsPresence.ts"],"mappings":";;AAEA,SAASA,cAAc,QAAQ,wCAAwC;AACvE,SAASC,uBAAuB,QAAQ,qCAAqC;
|
|
1
|
+
{"version":3,"names":["presenceInRoom","pushSubscriptionService","startBackgroundJoinSweep","initRoomsPresence","client","rooms","console","log","jids","Object","keys","length","sendAllPresencesAndMarkReady","Promise","allSettled","map","jid","e","userNick","getLocal","subscribeToRooms","catch","error"],"sourceRoot":"../../../src","sources":["helpers/initRoomsPresence.ts"],"mappings":";;AAEA,SAASA,cAAc,QAAQ,wCAAwC;AACvE,SAASC,uBAAuB,QAAQ,qCAAqC;AAC7E,SAASC,wBAAwB,QAAQ,uBAAuB;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,MAAAA,CAC/BC,MAAkB,EAClBC,KAA+B,KAC5B;EACHC,OAAO,CAACC,GAAG,CAAC,oBAAoB,CAAC;EACjC,IAAI,CAACH,MAAM,EAAE;IAAC,OAAO,IAAI;EAAC;EAC1B,MAAMI,IAAI,GAAGC,MAAM,CAACC,IAAI,CAACL,KAAK,IAAI,CAAC,CAAC,CAAC;EACrC,IAAI,CAACG,IAAI,CAACG,MAAM,EAAE;IAAC,OAAO,IAAI;EAAC;EAE/B,IAAI,OAAQP,MAAM,CAASQ,4BAA4B,KAAK,UAAU,EAAE;IACtEV,wBAAwB,CAACE,MAAM,CAAC;EAClC,CAAC,MAAM;IACL,MAAMS,OAAO,CAACC,UAAU,CACtBN,IAAI,CAACO,GAAG,CAAC,MAAOC,GAAG,IAAK;MACtB,IAAI;QACF,MAAMhB,cAAc,CAACI,MAAM,CAACA,MAAM,EAAEY,GAAG,CAAC;MAC1C,CAAC,CAAC,OAAOC,CAAC,EAAE,CAAC;IACf,CAAC,CACH,CAAC;EACH;EAEA,IAAIT,IAAI,CAACG,MAAM,GAAG,CAAC,IAAIP,MAAM,CAACA,MAAM,EAAE;IACpC,MAAMc,QAAQ,GAAGd,MAAM,CAACA,MAAM,CAACY,GAAG,EAAEG,QAAQ,CAAC,CAAC;IAC9C,MAAMlB,uBAAuB,CAACmB,gBAAgB,CAC5ChB,MAAM,CAACA,MAAM,EACbI,IAAI,EACJU,QACF,CAAC,CAACG,KAAK,CAAEC,KAAK,IAAK;MACjBhB,OAAO,CAACgB,KAAK,CAAC,wCAAwC,EAAEA,KAAK,CAAC;IAChE,CAAC,CAAC;EACJ;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { msgSortableMs } from './msgSortableMs';
|
|
4
|
+
import { isSafeKey } from '../roomStore/safeKey';
|
|
4
5
|
|
|
5
6
|
// Robustly resolve a caller-supplied read marker to epoch milliseconds.
|
|
6
7
|
// Callers pass a plain number (the redux read boundary, or a room's
|
|
@@ -34,6 +35,10 @@ function resolveMarkerMs(marker) {
|
|
|
34
35
|
}
|
|
35
36
|
function deepMerge(target, source) {
|
|
36
37
|
for (const key in source) {
|
|
38
|
+
// Never walk into the prototype chain through attacker-shaped keys.
|
|
39
|
+
if (!isSafeKey(key)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
37
42
|
if (source[key] === undefined) {
|
|
38
43
|
// `for...in` visits a key even when its value is `undefined` — every
|
|
39
44
|
// stanza parser (getDataFromXml/createMessageFromXml) returns an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["msgSortableMs","resolveMarkerMs","marker","Number","isFinite","raw","toString","trim","asNumber","parsed","Date","parse","deepMerge","target","source","key","undefined","Array","isArray","insertMessageWithDelimiter","roomMessages","message","lastViewedTimestamp","existingIndex","findIndex","msg","id","xmppId","existing","preservedUserId","user","merged","pending","lastMessage","length","newMs","lastMs","index","keepThread","activeMessage","push","lastViewedMs","newMessageMs","some","delimiterIndex","firstUnreadMs","anchorMs","splice","name","token","refreshToken","date","toISOString","body","roomJid","at"],"sourceRoot":"../../../src","sources":["helpers/insertMessageWithDelimiter.ts"],"mappings":";;AACA,SAASA,aAAa,QAAQ,iBAAiB
|
|
1
|
+
{"version":3,"names":["msgSortableMs","isSafeKey","resolveMarkerMs","marker","Number","isFinite","raw","toString","trim","asNumber","parsed","Date","parse","deepMerge","target","source","key","undefined","Array","isArray","insertMessageWithDelimiter","roomMessages","message","lastViewedTimestamp","existingIndex","findIndex","msg","id","xmppId","existing","preservedUserId","user","merged","pending","lastMessage","length","newMs","lastMs","index","keepThread","activeMessage","push","lastViewedMs","newMessageMs","some","delimiterIndex","firstUnreadMs","anchorMs","splice","name","token","refreshToken","date","toISOString","body","roomJid","at"],"sourceRoot":"../../../src","sources":["helpers/insertMessageWithDelimiter.ts"],"mappings":";;AACA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,eAAeA,CACtBC,MAA8D,EACtD;EACR,IAAIA,MAAM,IAAI,IAAI,EAAE;IAAC,OAAO,CAAC;EAAC;EAC9B,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOC,MAAM,CAACC,QAAQ,CAACF,MAAM,CAAC,GAAGA,MAAM,GAAG,CAAC;EAC7C;EACA,MAAMG,GAAG,GAAGH,MAAM,CAACI,QAAQ,CAAC,CAAC;EAC7B,IAAID,GAAG,CAACE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAMC,QAAQ,GAAGL,MAAM,CAACE,GAAG,CAAC;IAC5B,IAAIF,MAAM,C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ACF,CAAC,MAAM;IACL;IACA;IACA,MAAMC,EAAE,GAAGnC,YAAY,CAACI,SAAS,CAAEC,GAAG,IAAK1B,aAAa,CAAC0B,GAAG,CAAC,GAAGU,KAAK,CAAC;IACtE,IAAIoB,EAAE,KAAK,CAAC,CAAC,EAAE;MACbnC,YAAY,CAACoB,IAAI,CAACnB,OAAO,CAAC;IAC5B,CAAC,MAAM;MACLD,YAAY,CAAC2B,MAAM,CAACQ,EAAE,EAAE,CAAC,EAAElC,OAAO,CAAC;IACrC;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Real MUC room JIDs always look like `<localpart>@conference.<host>`. Various
|
|
4
|
+
// state-map iterations over `rooms.rooms` (history preload, presence sweeps,
|
|
5
|
+
// catch-up sync) can encounter non-room entries - corrupted/legacy persisted
|
|
6
|
+
// state where root-slice keys (`activeRoomJID`, `usersSet`, `subscribedRooms`,
|
|
7
|
+
// `pushSubscriptionStatus`, `rooms` itself) leaked into the rooms map, or a
|
|
8
|
+
// bare app ID without the conference suffix. Treating those as room JIDs sends
|
|
9
|
+
// MAM/presence requests for garbage names, wasting queue slots and network
|
|
10
|
+
// round-trips that could go to real rooms instead. Filter with this before
|
|
11
|
+
// any operation that fans out over "all rooms".
|
|
12
|
+
export const isLikelyMucJid = jid => {
|
|
13
|
+
if (typeof jid !== 'string' || !jid) return false;
|
|
14
|
+
const at = jid.indexOf('@');
|
|
15
|
+
if (at <= 0) return false;
|
|
16
|
+
const domain = jid.slice(at + 1).split('/')[0];
|
|
17
|
+
return domain.includes('.') && domain.startsWith('conference.');
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Root keys of the rooms slice. When a caller fans out over the slice itself
|
|
22
|
+
* instead of `slice.rooms`, these leak through as if they were room ids, and
|
|
23
|
+
* anything that appends the conference domain then produces real-looking but
|
|
24
|
+
* nonexistent JIDs (`usersSet@conference.host`), which the server answers with
|
|
25
|
+
* "Conference room does not exist". Cheap explicit denylist so the failure is
|
|
26
|
+
* named rather than mysterious.
|
|
27
|
+
*/
|
|
28
|
+
const ROOMS_SLICE_ROOT_KEYS = new Set(['rooms', 'activeRoomJID', 'isChatUiVisible', 'isLoading', 'editAction', 'usersSet', 'presenceByRoom', 'reportRoom', 'subscribedRooms', 'pushSubscriptionStatus', 'loadingText']);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* True when `value` can be used as the localpart of a MUC room JID, i.e. it is
|
|
32
|
+
* safe to build `${value}@conference.<host>` from it.
|
|
33
|
+
*
|
|
34
|
+
* Ethora room localparts are always `<appId>_<roomId>`, so the underscore is a
|
|
35
|
+
* reliable discriminator against slice keys, plain flags and stray strings.
|
|
36
|
+
* Callers that already hold a full JID should use `isLikelyMucJid` instead.
|
|
37
|
+
*/
|
|
38
|
+
export const isLikelyRoomLocalpart = value => {
|
|
39
|
+
if (typeof value !== 'string') return false;
|
|
40
|
+
const v = value.trim();
|
|
41
|
+
if (!v || v.includes('@')) return false;
|
|
42
|
+
if (ROOMS_SLICE_ROOT_KEYS.has(v)) return false;
|
|
43
|
+
return v.includes('_');
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Normalise a room reference into a full MUC JID, or return null when the
|
|
48
|
+
* input cannot be one. Use at every point that would otherwise blindly do
|
|
49
|
+
* `chatJID.includes('@') ? chatJID : chatJID + '@' + conference`: that pattern
|
|
50
|
+
* silently manufactures a valid-looking JID out of any garbage handed to it,
|
|
51
|
+
* which is how slice keys ended up being joined as rooms.
|
|
52
|
+
*/
|
|
53
|
+
export const toRoomJid = (chatJID, conference) => {
|
|
54
|
+
if (typeof chatJID !== 'string' || !chatJID) return null;
|
|
55
|
+
if (chatJID.includes('@')) return chatJID;
|
|
56
|
+
if (!conference) return null;
|
|
57
|
+
if (!isLikelyRoomLocalpart(chatJID)) return null;
|
|
58
|
+
return `${chatJID}@${conference}`;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=isLikelyMucJid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isLikelyMucJid","jid","at","indexOf","domain","slice","split","includes","startsWith","ROOMS_SLICE_ROOT_KEYS","Set","isLikelyRoomLocalpart","value","v","trim","has","toRoomJid","chatJID","conference"],"sourceRoot":"../../../src","sources":["helpers/isLikelyMucJid.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,cAAc,GAAIC,GAAY,IAAoB;EAC7D,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE,OAAO,KAAK;EACjD,MAAMC,EAAE,GAAGD,GAAG,CAACE,OAAO,CAAC,GAAG,CAAC;EAC3B,IAAID,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK;EACzB,MAAME,MAAM,GAAGH,GAAG,CAACI,KAAK,CAACH,EAAE,GAAG,CAAC,CAAC,CAACI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC9C,OAAOF,MAAM,CAACG,QAAQ,CAAC,GAAG,CAAC,IAAIH,MAAM,CAACI,UAAU,CAAC,aAAa,CAAC;AACjE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAAC,CACpC,OAAO,EACP,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,CACd,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAIC,KAAc,IAAsB;EACxE,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAO,KAAK;EAC3C,MAAMC,CAAC,GAAGD,KAAK,CAACE,IAAI,CAAC,CAAC;EACtB,IAAI,CAACD,CAAC,IAAIA,CAAC,CAACN,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK;EACvC,IAAIE,qBAAqB,CAACM,GAAG,CAACF,CAAC,CAAC,EAAE,OAAO,KAAK;EAC9C,OAAOA,CAAC,CAACN,QAAQ,CAAC,GAAG,CAAC;AACxB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,SAAS,GAAGA,CACvBC,OAAgB,EAChBC,UAA8B,KACZ;EAClB,IAAI,OAAOD,OAAO,KAAK,QAAQ,IAAI,CAACA,OAAO,EAAE,OAAO,IAAI;EACxD,IAAIA,OAAO,CAACV,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOU,OAAO;EACzC,IAAI,CAACC,UAAU,EAAE,OAAO,IAAI;EAC5B,IAAI,CAACP,qBAAqB,CAACM,OAAO,CAAC,EAAE,OAAO,IAAI;EAChD,OAAO,GAAGA,OAAO,IAAIC,UAAU,EAAE;AACnC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Single gate for every message search entry point (header button, chat
|
|
5
|
+
* profile row, the search screen and its request).
|
|
6
|
+
*
|
|
7
|
+
* Search is opt-in: it needs `enableMessageSearch: true` and an `appId` (the
|
|
8
|
+
* archive it queries is scoped by app). The deprecated `disableMessageSearch`
|
|
9
|
+
* is still honoured as a hard off.
|
|
10
|
+
*/
|
|
11
|
+
export const isMessageSearchEnabled = config => Boolean(config?.enableMessageSearch) && Boolean(config?.appId) && !config?.disableMessageSearch;
|
|
12
|
+
export default isMessageSearchEnabled;
|
|
13
|
+
//# sourceMappingURL=isMessageSearchEnabled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isMessageSearchEnabled","config","Boolean","enableMessageSearch","appId","disableMessageSearch"],"sourceRoot":"../../../src","sources":["helpers/isMessageSearchEnabled.ts"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,sBAAsB,GACjCC,MAAuF,IAEvFC,OAAO,CAACD,MAAM,EAAEE,mBAAmB,CAAC,IACpCD,OAAO,CAACD,MAAM,EAAEG,KAAK,CAAC,IACtB,CAACH,MAAM,EAAEI,oBAAoB;AAE/B,eAAeL,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* True while the pane should say "joining" instead of "choose a chat": the
|
|
5
|
+
* requested room is not in the list yet and a join for exactly that room is
|
|
6
|
+
* in flight (see useRoomInitialization).
|
|
7
|
+
*/
|
|
8
|
+
export const isJoiningRoom = (activeRoomJID, roomsList, joiningRoomJID) => Boolean(activeRoomJID) && !roomsList?.[activeRoomJID] && joiningRoomJID === activeRoomJID;
|
|
9
|
+
//# sourceMappingURL=joiningRoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isJoiningRoom","activeRoomJID","roomsList","joiningRoomJID","Boolean"],"sourceRoot":"../../../src","sources":["helpers/joiningRoom.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAGA,CAC3BC,aAAwC,EACxCC,SAA8C,EAC9CC,cAAyC,KAEzCC,OAAO,CAACH,aAAa,CAAC,IACtB,CAACC,SAAS,GAAGD,aAAa,CAAW,IACrCE,cAAc,KAAKF,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useSyncExternalStore } from 'react';
|
|
4
|
+
import { parseMessageReference } from './parseMessageReference';
|
|
5
|
+
import { findMessageIndex } from './jumpToMessage';
|
|
6
|
+
|
|
7
|
+
// The id/content lookup is shared with the jump-to-message scroll helper.
|
|
8
|
+
export { findMessageIndex };
|
|
9
|
+
|
|
10
|
+
/** How long a jump request may stay pending before it is dropped. */
|
|
11
|
+
export const JUMP_TTL_MS = 60_000;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Where a jump to a thread REPLY lands, and the thread panel's parent message
|
|
15
|
+
* when that message is not in the room's live list.
|
|
16
|
+
*
|
|
17
|
+
* Replies never appear in the main list (it hides them unless they are also
|
|
18
|
+
* shown in the channel), so a jump to one has to open its parent's thread and
|
|
19
|
+
* highlight the reply there. Two things have to be remembered for that:
|
|
20
|
+
* - which list owns the jump: `at` is the pending request this entry serves,
|
|
21
|
+
* `parentId` the thread that owns it. The main list stays inert for a jump
|
|
22
|
+
* that has an owner thread, and a thread list stays inert for any jump that
|
|
23
|
+
* is not its own (see useJumpToMessage);
|
|
24
|
+
* - the parent and the replies when they exist only in a jump window or came
|
|
25
|
+
* from a separate fetch: the thread panel reads them from here, so it does
|
|
26
|
+
* not depend on the window that found them still being on screen.
|
|
27
|
+
*
|
|
28
|
+
* Kept outside redux on purpose: the room slice's thread flag lives on
|
|
29
|
+
* messages of the live list, which is exactly what these messages are not in.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
let state = null;
|
|
33
|
+
const listeners = new Set();
|
|
34
|
+
const emit = () => listeners.forEach(listener => listener());
|
|
35
|
+
export const getJumpThread = () => state;
|
|
36
|
+
export const setJumpThread = next => {
|
|
37
|
+
state = next;
|
|
38
|
+
emit();
|
|
39
|
+
};
|
|
40
|
+
export const clearJumpThread = () => {
|
|
41
|
+
if (state === null) return;
|
|
42
|
+
state = null;
|
|
43
|
+
emit();
|
|
44
|
+
};
|
|
45
|
+
export const subscribeJumpThread = listener => {
|
|
46
|
+
listeners.add(listener);
|
|
47
|
+
return () => {
|
|
48
|
+
listeners.delete(listener);
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export const useJumpThread = () => useSyncExternalStore(subscribeJumpThread, getJumpThread, getJumpThread);
|
|
52
|
+
|
|
53
|
+
/** The thread that owns the jump `at`, or null when the main list does. */
|
|
54
|
+
export const ownerThreadFor = (thread, at) => thread && at !== undefined && thread.at === at ? thread.parentId : null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The parent id of a message that is a thread reply and nothing else, or null:
|
|
58
|
+
* a reply also shown in the channel is in the main list, so it needs no thread.
|
|
59
|
+
*/
|
|
60
|
+
export const replyParentId = message => {
|
|
61
|
+
if (!message || String(message.isReply) !== 'true') return null;
|
|
62
|
+
if (String(message.showInChannel) === 'true') return null;
|
|
63
|
+
const id = parseMessageReference(message.mainMessage)?.id;
|
|
64
|
+
return id ? String(id) : null;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** `a` then `b`, one entry per message id, oldest first. */
|
|
68
|
+
export const mergeById = (a, b) => {
|
|
69
|
+
const seen = new Set();
|
|
70
|
+
const merged = [];
|
|
71
|
+
for (const message of [...a, ...b]) {
|
|
72
|
+
const key = String(message.id);
|
|
73
|
+
if (seen.has(key)) continue;
|
|
74
|
+
seen.add(key);
|
|
75
|
+
merged.push(message);
|
|
76
|
+
}
|
|
77
|
+
const time = message => {
|
|
78
|
+
const value = new Date(message.date).getTime();
|
|
79
|
+
return Number.isNaN(value) ? 0 : value;
|
|
80
|
+
};
|
|
81
|
+
return merged.sort((x, y) => time(x) - time(y));
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=jumpThread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useSyncExternalStore","parseMessageReference","findMessageIndex","JUMP_TTL_MS","state","listeners","Set","emit","forEach","listener","getJumpThread","setJumpThread","next","clearJumpThread","subscribeJumpThread","add","delete","useJumpThread","ownerThreadFor","thread","at","undefined","parentId","replyParentId","message","String","isReply","showInChannel","id","mainMessage","mergeById","a","b","seen","merged","key","has","push","time","value","Date","date","getTime","Number","isNaN","sort","x","y"],"sourceRoot":"../../../src","sources":["helpers/jumpThread.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,OAAO;AAE5C,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D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the archive's timestamp and the transcript's may be for the
|
|
4
|
+
// same message. They are recorded by different components, so they are not
|
|
5
|
+
// identical, but never more than a moment apart.
|
|
6
|
+
export const CONTENT_MATCH_WINDOW_MS = 5000;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Index of the message a jump names.
|
|
10
|
+
*
|
|
11
|
+
* By id first (message.id is the MAM stanza id for history, xmppId the client
|
|
12
|
+
* message id). When the request has no id at all, which is common for archive
|
|
13
|
+
* rows, by content: same text, sent within a few seconds of the same time.
|
|
14
|
+
*/
|
|
15
|
+
export const findMessageIndex = (messages, ids, content) => {
|
|
16
|
+
if (ids.length > 0) {
|
|
17
|
+
const byId = messages.findIndex(message => ids.includes(String(message.id)) || (message.xmppId ? ids.includes(String(message.xmppId)) : false));
|
|
18
|
+
if (byId >= 0) {
|
|
19
|
+
return byId;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!content?.createdAt || !content.body) {
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
const wanted = new Date(content.createdAt).getTime();
|
|
26
|
+
if (Number.isNaN(wanted)) {
|
|
27
|
+
return -1;
|
|
28
|
+
}
|
|
29
|
+
const body = content.body.trim();
|
|
30
|
+
return messages.findIndex(message => {
|
|
31
|
+
if (String(message.body ?? '').trim() !== body) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return Math.abs(new Date(message.date).getTime() - wanted) <= CONTENT_MATCH_WINDOW_MS;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export const MAX_SCROLL_RETRIES = 4;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* FlatList only knows the position of rows it has measured, so
|
|
41
|
+
* scrollToIndex fails for a row far from the rendered window. The usual
|
|
42
|
+
* remedy: scroll to an estimated offset (which renders that region), then
|
|
43
|
+
* try scrollToIndex again. Returns the offset to estimate to, or null once
|
|
44
|
+
* the retry budget is spent.
|
|
45
|
+
*/
|
|
46
|
+
export const scrollRetryOffset = (info, attempt) => {
|
|
47
|
+
if (attempt >= MAX_SCROLL_RETRIES) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return Math.max(0, info.averageItemLength * info.index);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=jumpToMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CONTENT_MATCH_WINDOW_MS","findMessageIndex","messages","ids","content","length","byId","findIndex","message","includes","String","id","xmppId","createdAt","body","wanted","Date","getTime","Number","isNaN","trim","Math","abs","date","MAX_SCROLL_RETRIES","scrollRetryOffset","info","attempt","max","averageItemLength","index"],"sourceRoot":"../../../src","sources":["helpers/jumpToMessage.ts"],"mappings":";;AAEA;AACA;AACA;AACA,OAAO,MAAMA,uBAAuB,GAAG,IAAI;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,QAAoB,EACpBC,GAAa,EACbC,OAA+C,KACpC;EACX,IAAID,GAAG,CAACE,MAAM,GAAG,CAAC,EAAE;IAClB,MAAMC,IAAI,GAAGJ,QAAQ,CAACK,SAAS,CAC5BC,OAAO,IACNL,GAAG,CAACM,QAAQ,CAACC,MAAM,CAACF,OAAO,CAACG,EAAE,CAAC,CAAC,KAC/BH,OAAO,CAACI,MAAM,GAAGT,GAAG,CAACM,QAAQ,CAACC,MAAM,CAACF,OAAO,CAACI,MAAM,CAAC,CAAC,GAAG,KAAK,CAClE,CAAC;IACD,IAAIN,IAAI,IAAI,CAAC,EAAE;MAAC,OAAOA,IAAI;IAAC;EAC9B;EAEA,IAAI,CAACF,OAAO,EAAES,SAAS,IAAI,CAACT,OAAO,CAACU,IAAI,EAAE;IAAC,OAAO,CAAC,CAAC;EAAC;EACrD,MAAMC,MAAM,GAAG,IAAIC,IAAI,CAACZ,OAAO,CAACS,SAAS,CAAC,CAACI,OAAO,CAAC,CAAC;EACpD,IAAIC,MAAM,CAACC,KAAK,CAACJ,MAAM,CAAC,EAAE;IAAC,OAAO,CAAC,CAAC;EAAC;EACrC,MAAMD,IAAI,GAAGV,OAAO,CAACU,IAAI,CAACM,IAAI,CAAC,CAAC;EAChC,OAAOlB,QAAQ,CAACK,SAAS,CAAEC,OAAO,IAAK;IACrC,IAAIE,MAAM,CAACF,OAAO,CAACM,IAAI,IAAI,EAAE,CAAC,CAACM,IAAI,CAAC,CAAC,KAAKN,IAAI,EAAE;MAAC,OAAO,KAAK;IAAC;IAC9D,OACEO,IAAI,CAACC,GAAG,CAAC,IAAIN,IAAI,CAACR,OAAO,CAACe,IAAI,CAAC,CAACN,OAAO,CAAC,CAAC,GAAGF,MAAM,CAAC,IACnDf,uBAAuB;EAE3B,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMwB,kBAAkB,GAAG,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,IAAkD,EAClDC,OAAe,KACG;EAClB,IAAIA,OAAO,IAAIH,kBAAkB,EAAE;IAAC,OAAO,IAAI;EAAC;EAChD,OAAOH,IAAI,CAACO,GAAG,CAAC,CAAC,EAAEF,IAAI,CAACG,iBAAiB,GAAGH,IAAI,CAACI,KAAK,CAAC;AACzD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/** Messages shown above / below the target when a window opens (tunable). */
|
|
4
|
+
export const JUMP_WINDOW_BEFORE = 10;
|
|
5
|
+
export const JUMP_WINDOW_AFTER = 10;
|
|
6
|
+
/** Page size for loading more once the reader scrolls toward either edge. */
|
|
7
|
+
export const JUMP_WINDOW_PAGE = 20;
|
|
8
|
+
|
|
9
|
+
/** The slice of the XMPP client the window helpers need. */
|
|
10
|
+
|
|
11
|
+
// MAM stanza ids are microsecond timestamps (16 digits today).
|
|
12
|
+
const MAM_ID = /^\d{13,}$/;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* How far apart the archive's timestamp and the transcript's may be for the
|
|
16
|
+
* same message. They are recorded by different components, so they are not
|
|
17
|
+
* identical, but never more than a moment apart.
|
|
18
|
+
*/
|
|
19
|
+
export const CONTENT_MATCH_WINDOW_MS = 5000;
|
|
20
|
+
/** Rows asked for per page while locating a row by its time. */
|
|
21
|
+
const TIME_LOOKUP_PAGE = 50;
|
|
22
|
+
/** Pages of the time range read before giving up (a very busy 10 seconds). */
|
|
23
|
+
const TIME_LOOKUP_MAX_PAGES = 4;
|
|
24
|
+
|
|
25
|
+
/** What a hit with no archive id can be located by. */
|
|
26
|
+
|
|
27
|
+
export const mamIdCandidates = ids => Array.from(new Set(ids.map(String).filter(id => MAM_ID.test(id))));
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Fetches about JUMP_WINDOW_BEFORE messages before the target, the target and
|
|
31
|
+
* about JUMP_WINDOW_AFTER after it: two MAM queries in parallel (the target
|
|
32
|
+
* itself comes with the "after" page, asked from one microsecond before it).
|
|
33
|
+
* Nothing is written to the store here.
|
|
34
|
+
*/
|
|
35
|
+
export async function loadJumpWindow(client, roomJID, ids, content) {
|
|
36
|
+
const candidates = mamIdCandidates(ids);
|
|
37
|
+
if (candidates.length === 0) {
|
|
38
|
+
return content?.createdAt && content.body ? loadJumpWindowByTime(client, roomJID, content) : {
|
|
39
|
+
status: 'unavailable'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Almost always one candidate; a second is only tried when the first one is
|
|
44
|
+
// not an archive id after all (the server then simply does not return it).
|
|
45
|
+
for (const candidate of candidates) {
|
|
46
|
+
const id = Number(candidate);
|
|
47
|
+
const [older, newer] = await Promise.all([client.getHistoryWindow(roomJID, JUMP_WINDOW_BEFORE, {
|
|
48
|
+
before: id
|
|
49
|
+
}), client.getHistoryWindow(roomJID, JUMP_WINDOW_AFTER + 1, {
|
|
50
|
+
after: id - 1
|
|
51
|
+
})]);
|
|
52
|
+
if (!older.ok || !newer.ok) return {
|
|
53
|
+
status: 'unavailable'
|
|
54
|
+
};
|
|
55
|
+
const target = newer.messages.find(message => String(message.id) === candidate);
|
|
56
|
+
if (!target) continue;
|
|
57
|
+
return {
|
|
58
|
+
status: 'found',
|
|
59
|
+
window: {
|
|
60
|
+
roomJID,
|
|
61
|
+
messages: [...older.messages, ...newer.messages],
|
|
62
|
+
targetId: String(target.id),
|
|
63
|
+
olderCursor: older.first ?? id,
|
|
64
|
+
hasOlder: !older.complete && older.first !== null,
|
|
65
|
+
newerCursor: newer.last ?? id,
|
|
66
|
+
hasNewer: !newer.complete && newer.last !== null
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// None of the ids was an archive id. A hit that also knows its text and time
|
|
71
|
+
// can still be located by them.
|
|
72
|
+
if (content?.createdAt && content.body) {
|
|
73
|
+
return loadJumpWindowByTime(client, roomJID, content);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
status: 'missing'
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* For a hit with no usable archive id (older archive documents carry neither a
|
|
82
|
+
* stanza id nor a message id): ask the server for the rows within a few
|
|
83
|
+
* seconds of its timestamp (MAM start/end filter), find the one with the same
|
|
84
|
+
* text, and continue exactly as the id-based window does with that row's id.
|
|
85
|
+
* The server's answer is final: 'missing' only when it said the range holds no
|
|
86
|
+
* such row.
|
|
87
|
+
*/
|
|
88
|
+
export async function loadJumpWindowByTime(client, roomJID, content) {
|
|
89
|
+
const wanted = new Date(content.createdAt ?? '').getTime();
|
|
90
|
+
const body = (content.body ?? '').trim();
|
|
91
|
+
if (Number.isNaN(wanted) || !body) return {
|
|
92
|
+
status: 'unavailable'
|
|
93
|
+
};
|
|
94
|
+
const start = new Date(wanted - CONTENT_MATCH_WINDOW_MS).toISOString();
|
|
95
|
+
const end = new Date(wanted + CONTENT_MATCH_WINDOW_MS).toISOString();
|
|
96
|
+
let after;
|
|
97
|
+
let best = null;
|
|
98
|
+
for (let page = 0; page < TIME_LOOKUP_MAX_PAGES; page += 1) {
|
|
99
|
+
const result = await client.getHistoryWindow(roomJID, TIME_LOOKUP_PAGE, after === undefined ? {
|
|
100
|
+
start,
|
|
101
|
+
end
|
|
102
|
+
} : {
|
|
103
|
+
start,
|
|
104
|
+
end,
|
|
105
|
+
after
|
|
106
|
+
});
|
|
107
|
+
if (!result.ok) return {
|
|
108
|
+
status: 'unavailable'
|
|
109
|
+
};
|
|
110
|
+
for (const message of result.messages) {
|
|
111
|
+
if (String(message.body ?? '').trim() !== body) continue;
|
|
112
|
+
const gap = Math.abs(new Date(message.date).getTime() - wanted);
|
|
113
|
+
if (gap > CONTENT_MATCH_WINDOW_MS) continue;
|
|
114
|
+
if (!best || gap < Math.abs(new Date(best.date).getTime() - wanted)) {
|
|
115
|
+
best = message;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (best) break;
|
|
119
|
+
if (result.complete || result.last === null) {
|
|
120
|
+
return {
|
|
121
|
+
status: 'missing'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
after = result.last;
|
|
125
|
+
}
|
|
126
|
+
if (!best) return {
|
|
127
|
+
status: 'unavailable'
|
|
128
|
+
};
|
|
129
|
+
const id = String(best.id);
|
|
130
|
+
if (!MAM_ID.test(id)) return {
|
|
131
|
+
status: 'unavailable'
|
|
132
|
+
};
|
|
133
|
+
return loadJumpWindow(client, roomJID, [id]);
|
|
134
|
+
}
|
|
135
|
+
/** The page above the window; null when the request failed. */
|
|
136
|
+
export async function loadOlderWindowPage(client, window) {
|
|
137
|
+
if (window.olderCursor === null) {
|
|
138
|
+
return {
|
|
139
|
+
messages: [],
|
|
140
|
+
olderCursor: null,
|
|
141
|
+
hasOlder: false
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const page = await client.getHistoryWindow(window.roomJID, JUMP_WINDOW_PAGE, {
|
|
145
|
+
before: window.olderCursor
|
|
146
|
+
});
|
|
147
|
+
if (!page.ok) return null;
|
|
148
|
+
// A page that does not move the cursor would be asked for again forever.
|
|
149
|
+
const progressed = page.first !== null && page.first < window.olderCursor;
|
|
150
|
+
return {
|
|
151
|
+
messages: page.messages,
|
|
152
|
+
olderCursor: progressed ? page.first : window.olderCursor,
|
|
153
|
+
hasOlder: progressed && !page.complete
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The page below the window; null when the request failed. */
|
|
158
|
+
export async function loadNewerWindowPage(client, window) {
|
|
159
|
+
if (window.newerCursor === null) {
|
|
160
|
+
return {
|
|
161
|
+
messages: [],
|
|
162
|
+
newerCursor: null,
|
|
163
|
+
hasNewer: false
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
const page = await client.getHistoryWindow(window.roomJID, JUMP_WINDOW_PAGE, {
|
|
167
|
+
after: window.newerCursor
|
|
168
|
+
});
|
|
169
|
+
if (!page.ok) return null;
|
|
170
|
+
const progressed = page.last !== null && page.last > window.newerCursor;
|
|
171
|
+
return {
|
|
172
|
+
messages: page.messages,
|
|
173
|
+
newerCursor: progressed ? page.last : window.newerCursor,
|
|
174
|
+
hasNewer: progressed && !page.complete
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=jumpWindow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["JUMP_WINDOW_BEFORE","JUMP_WINDOW_AFTER","JUMP_WINDOW_PAGE","MAM_ID","CONTENT_MATCH_WINDOW_MS","TIME_LOOKUP_PAGE","TIME_LOOKUP_MAX_PAGES","mamIdCandidates","ids","Array","from","Set","map","String","filter","id","test","loadJumpWindow","client","roomJID","content","candidates","length","createdAt","body","loadJumpWindowByTime","status","candidate","Number","older","newer","Promise","all","getHistoryWindow","before","after","ok","target","messages","find","message","window","targetId","olderCursor","first","hasOlder","complete","newerCursor","last","hasNewer","wanted","Date","getTime","trim","isNaN","start","toISOString","end","best","page","result","undefined","gap","Math","abs","date","loadOlderWindowPage","progressed","loadNewerWindowPage"],"sourceRoot":"../../../src","sources":["helpers/jumpWindow.ts"],"mappings":";;AAIA;AACA,OAAO,MAAMA,kBAAkB,GAAG,EAAE;AACpC,OAAO,MAAMC,iBAAiB,GAAG,EAAE;AACnC;AACA,OAAO,MAAMC,gBAAgB,GAAG,EAAE;;AAElC;;AAiBA;AACA,MAAMC,MAAM,GAAG,WAAW;;AAE1B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,IAAI;AAC3C;AACA,MAAMC,gBAAgB,GAAG,EAAE;AAC3B;AACA,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;;AAMA,OAAO,MAAMC,eAAe,GAAIC,GAAa,IAC3CC,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAACH,GAAG,CAACI,GAAG,CAACC,MAAM,CAAC,CAACC,MAAM,CAAEC,EAAE,IAAKZ,MAAM,CAACa,IAAI,CAACD,EAAE,CAAC,CAAC,CAAC,CAAC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeE,cAAcA,CAClCC,MAA2B,EAC3BC,OAAe,EACfX,GAAa,EACbY,OAAqB,EACM;EAC3B,MAAMC,UAAU,GAAGd,eAAe,CAACC,GAAG,CAAC;EACvC,IAAIa,UAAU,CAACC,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAOF,OAAO,EAAEG,SAAS,IAAIH,OAAO,CAACI,IAAI,GACrCC,oBAAoB,CAACP,MAAM,EAAEC,OAAO,EAAEC,OAAO,CAAC,GAC9C;MAAEM,MAAM,EAAE;IAAc,CAAC;EAC/B;;EAEA;EACA;EACA,KAAK,MAAMC,SAAS,IAAIN,UAAU,EAAE;IAClC,MAAMN,EAAE,GAAGa,MAAM,CAACD,SAAS,CAAC;IAC5B,MAAM,CAACE,KAAK,EAAEC,KAAK,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CACvCd,MAAM,CAACe,gBAAg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|
|
2
|
+
|
|
3
|
+
/** The slice of the XMPP client the history loader needs. */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where the next page of older history starts when the caller names no
|
|
7
|
+
* anchor: the server's own paging cursor, or the oldest message that carries a
|
|
8
|
+
* numeric archive id, whichever is older. Never a position in the message
|
|
9
|
+
* list: a page made only of receipts or reactions adds nothing to it, so a
|
|
10
|
+
* position keeps pointing at the same message and paging stalls.
|
|
11
|
+
*/
|
|
12
|
+
export const resolveHistoryBefore = (room, explicit) => {
|
|
13
|
+
if (typeof explicit === 'number' && Number.isFinite(explicit)) {
|
|
14
|
+
return explicit;
|
|
15
|
+
}
|
|
16
|
+
if (!room) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const candidates = [];
|
|
20
|
+
const cursor = room.messageStats?.firstMessageTimestamp;
|
|
21
|
+
if (typeof cursor === 'number' && Number.isFinite(cursor)) {
|
|
22
|
+
candidates.push(cursor);
|
|
23
|
+
}
|
|
24
|
+
for (const message of room.messages ?? []) {
|
|
25
|
+
const id = Number(message.id);
|
|
26
|
+
if (Number.isFinite(id) && id > 0) {
|
|
27
|
+
candidates.push(id);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return candidates.length > 0 ? Math.min(...candidates) : undefined;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One page of older history for a room. Always settles and never rejects: a
|
|
34
|
+
* failed page must not leave the room blocked or reject into the caller's
|
|
35
|
+
* chain. Does nothing for a room that is complete, unknown, or already loading.
|
|
36
|
+
*/
|
|
37
|
+
export async function loadRoomHistory({
|
|
38
|
+
client,
|
|
39
|
+
room,
|
|
40
|
+
inFlight,
|
|
41
|
+
chatJID,
|
|
42
|
+
max,
|
|
43
|
+
before,
|
|
44
|
+
onBusyChange
|
|
45
|
+
}) {
|
|
46
|
+
if (!client || !chatJID) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (inFlight.has(chatJID)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!room || room.historyComplete) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const anchor = resolveHistoryBefore(room, before);
|
|
56
|
+
inFlight.add(chatJID);
|
|
57
|
+
onBusyChange?.(true);
|
|
58
|
+
try {
|
|
59
|
+
await client.getHistoryStanza(chatJID, max, anchor, undefined, {
|
|
60
|
+
source: 'active'
|
|
61
|
+
});
|
|
62
|
+
} catch {
|
|
63
|
+
// swallowed on purpose, see above
|
|
64
|
+
} finally {
|
|
65
|
+
inFlight.delete(chatJID);
|
|
66
|
+
onBusyChange?.(inFlight.size > 0);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=loadRoomHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resolveHistoryBefore","room","explicit","Number","isFinite","undefined","candidates","cursor","messageStats","firstMessageTimestamp","push","message","messages","id","length","Math","min","loadRoomHistory","client","inFlight","chatJID","max","before","onBusyChange","has","historyComplete","anchor","add","getHistoryStanza","source","delete","size"],"sourceRoot":"../../../src","sources":["helpers/loadRoomHistory.ts"],"mappings":";;AAEA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGA,CAClCC,IAA0D,EAC1DC,QAAiB,KACM;EACvB,IAAI,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,QAAQ,CAAC,EAAE;IAAC,OAAOA,QAAQ;EAAC;EAChF,IAAI,CAACD,IAAI,EAAE;IAAC,OAAOI,SAAS;EAAC;EAC7B,MAAMC,UAAoB,GAAG,EAAE;EAC/B,MAAMC,MAAM,GAAGN,IAAI,CAACO,YAAY,EAAEC,qBAAqB;EACvD,IAAI,OAAOF,MAAM,KAAK,QAAQ,IAAIJ,MAAM,CAACC,QAAQ,CAACG,MAAM,CAAC,EAAE;IACzDD,UAAU,CAACI,IAAI,CAACH,MA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