@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.
Files changed (761) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +19 -0
  3. package/lib/commonjs/assets/icons.js +2 -2
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +22 -6
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/InputComponents/Search.js +38 -1
  8. package/lib/commonjs/components/InputComponents/Search.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js +166 -0
  10. package/lib/commonjs/components/MainComponents/ArchivedMessageCard.js.map +1 -0
  11. package/lib/commonjs/components/MainComponents/ChatHeader.js +22 -5
  12. package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/ChatRoom.js +56 -25
  14. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  15. package/lib/commonjs/components/MainComponents/ChatWrapper.js +53 -4
  16. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  17. package/lib/commonjs/components/MainComponents/MediaMessage.js +18 -3
  18. package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
  19. package/lib/commonjs/components/MainComponents/MessageList.js +739 -42
  20. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  21. package/lib/commonjs/components/MainComponents/MessageSearchButton.js +58 -0
  22. package/lib/commonjs/components/MainComponents/MessageSearchButton.js.map +1 -0
  23. package/lib/commonjs/components/MainComponents/ReduxWrapper.js +15 -6
  24. package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
  25. package/lib/commonjs/components/MainComponents/RoomList.js +110 -1
  26. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  27. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +14 -3
  28. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  29. package/lib/commonjs/components/MessageBubble/BubbleHighlight.js +112 -0
  30. package/lib/commonjs/components/MessageBubble/BubbleHighlight.js.map +1 -0
  31. package/lib/commonjs/components/MessageBubble/Message.js +169 -125
  32. package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
  33. package/lib/commonjs/components/MessageBubble/MessageInteractions.js +98 -78
  34. package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
  35. package/lib/commonjs/components/MessageBubble/messageMenuLayout.js +50 -0
  36. package/lib/commonjs/components/MessageBubble/messageMenuLayout.js.map +1 -0
  37. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +73 -37
  38. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js +253 -0
  40. package/lib/commonjs/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
  41. package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js +488 -0
  42. package/lib/commonjs/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
  43. package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js +51 -0
  44. package/lib/commonjs/components/Modals/MessageSearchModal/openHit.js.map +1 -0
  45. package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js +47 -0
  46. package/lib/commonjs/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
  47. package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js +83 -0
  48. package/lib/commonjs/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
  49. package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js +61 -0
  50. package/lib/commonjs/components/Modals/MessageSearchModal/snippet.js.map +1 -0
  51. package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js +136 -0
  52. package/lib/commonjs/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
  53. package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js +306 -0
  54. package/lib/commonjs/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
  55. package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js +36 -0
  56. package/lib/commonjs/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
  57. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
  58. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  59. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +13 -2
  60. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  61. package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js +38 -6
  62. package/lib/commonjs/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
  63. package/lib/commonjs/components/Thread/ThreadHeader.js +3 -1
  64. package/lib/commonjs/components/Thread/ThreadHeader.js.map +1 -1
  65. package/lib/commonjs/components/Thread/ThreadWrapper.js +90 -10
  66. package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
  67. package/lib/commonjs/components/styled/AudioDecoderHost.js +338 -0
  68. package/lib/commonjs/components/styled/AudioDecoderHost.js.map +1 -0
  69. package/lib/commonjs/components/styled/AudioMessage.js +493 -420
  70. package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
  71. package/lib/commonjs/components/styled/SendInput.js +31 -5
  72. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  73. package/lib/commonjs/context/MessageNotificationContext.js +14 -4
  74. package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
  75. package/lib/commonjs/context/xmppProvider.js +54 -79
  76. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  77. package/lib/commonjs/helpers/audioWaveform.js +165 -0
  78. package/lib/commonjs/helpers/audioWaveform.js.map +1 -0
  79. package/lib/commonjs/helpers/backgroundJoinSweep.js +36 -0
  80. package/lib/commonjs/helpers/backgroundJoinSweep.js.map +1 -0
  81. package/lib/commonjs/helpers/bubbleHighlight.js +44 -0
  82. package/lib/commonjs/helpers/bubbleHighlight.js.map +1 -0
  83. package/lib/commonjs/helpers/checkUniqueUsers.js +14 -12
  84. package/lib/commonjs/helpers/checkUniqueUsers.js.map +1 -1
  85. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js +5 -1
  86. package/lib/commonjs/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  87. package/lib/commonjs/helpers/constants/MODAL_TYPES.js +3 -1
  88. package/lib/commonjs/helpers/constants/MODAL_TYPES.js.map +1 -1
  89. package/lib/commonjs/helpers/createRoomFromApi.js +40 -3
  90. package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
  91. package/lib/commonjs/helpers/dedupeMembers.js +34 -0
  92. package/lib/commonjs/helpers/dedupeMembers.js.map +1 -0
  93. package/lib/commonjs/helpers/ethoraLogger.js +56 -0
  94. package/lib/commonjs/helpers/ethoraLogger.js.map +1 -0
  95. package/lib/commonjs/helpers/getUnnamedUsers.js +9 -4
  96. package/lib/commonjs/helpers/getUnnamedUsers.js.map +1 -1
  97. package/lib/commonjs/helpers/historyPreloadConfig.js +44 -0
  98. package/lib/commonjs/helpers/historyPreloadConfig.js.map +1 -0
  99. package/lib/commonjs/helpers/historyPreloadScheduler.js +372 -137
  100. package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
  101. package/lib/commonjs/helpers/initRoomsPresence.js +17 -5
  102. package/lib/commonjs/helpers/initRoomsPresence.js.map +1 -1
  103. package/lib/commonjs/helpers/insertMessageWithDelimiter.js +5 -0
  104. package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
  105. package/lib/commonjs/helpers/isLikelyMucJid.js +67 -0
  106. package/lib/commonjs/helpers/isLikelyMucJid.js.map +1 -0
  107. package/lib/commonjs/helpers/isMessageSearchEnabled.js +18 -0
  108. package/lib/commonjs/helpers/isMessageSearchEnabled.js.map +1 -0
  109. package/lib/commonjs/helpers/joiningRoom.js +14 -0
  110. package/lib/commonjs/helpers/joiningRoom.js.map +1 -0
  111. package/lib/commonjs/helpers/jumpThread.js +100 -0
  112. package/lib/commonjs/helpers/jumpThread.js.map +1 -0
  113. package/lib/commonjs/helpers/jumpToMessage.js +58 -0
  114. package/lib/commonjs/helpers/jumpToMessage.js.map +1 -0
  115. package/lib/commonjs/helpers/jumpWindow.js +187 -0
  116. package/lib/commonjs/helpers/jumpWindow.js.map +1 -0
  117. package/lib/commonjs/helpers/loadRoomHistory.js +75 -0
  118. package/lib/commonjs/helpers/loadRoomHistory.js.map +1 -0
  119. package/lib/commonjs/helpers/notificationPolicy.js +77 -0
  120. package/lib/commonjs/helpers/notificationPolicy.js.map +1 -0
  121. package/lib/commonjs/helpers/openRoomAtMessage.js +47 -0
  122. package/lib/commonjs/helpers/openRoomAtMessage.js.map +1 -0
  123. package/lib/commonjs/helpers/openThreadForJump.js +72 -0
  124. package/lib/commonjs/helpers/openThreadForJump.js.map +1 -0
  125. package/lib/commonjs/helpers/parseMessageReference.js +27 -8
  126. package/lib/commonjs/helpers/parseMessageReference.js.map +1 -1
  127. package/lib/commonjs/helpers/publicChatsEntry.js +17 -0
  128. package/lib/commonjs/helpers/publicChatsEntry.js.map +1 -0
  129. package/lib/commonjs/helpers/roomActivityScore.js +37 -0
  130. package/lib/commonjs/helpers/roomActivityScore.js.map +1 -0
  131. package/lib/commonjs/helpers/roomUserCount.js +36 -0
  132. package/lib/commonjs/helpers/roomUserCount.js.map +1 -0
  133. package/lib/commonjs/helpers/runConfiguredHistoryPreload.js +68 -0
  134. package/lib/commonjs/helpers/runConfiguredHistoryPreload.js.map +1 -0
  135. package/lib/commonjs/helpers/sessionAppId.js +24 -0
  136. package/lib/commonjs/helpers/sessionAppId.js.map +1 -0
  137. package/lib/commonjs/helpers/timestamp.js +43 -0
  138. package/lib/commonjs/helpers/timestamp.js.map +1 -0
  139. package/lib/commonjs/helpers/userResolver.js +517 -0
  140. package/lib/commonjs/helpers/userResolver.js.map +1 -0
  141. package/lib/commonjs/helpers/xmppIdShape.js +52 -0
  142. package/lib/commonjs/helpers/xmppIdShape.js.map +1 -0
  143. package/lib/commonjs/hooks/useChatWrapperInit.js +27 -5
  144. package/lib/commonjs/hooks/useChatWrapperInit.js.map +1 -1
  145. package/lib/commonjs/hooks/useHeapSender.js +54 -3
  146. package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
  147. package/lib/commonjs/hooks/useJumpToMessage.js +411 -0
  148. package/lib/commonjs/hooks/useJumpToMessage.js.map +1 -0
  149. package/lib/commonjs/hooks/useMessageLoaderQueue.js +32 -5
  150. package/lib/commonjs/hooks/useMessageLoaderQueue.js.map +1 -1
  151. package/lib/commonjs/hooks/useMessageQueue.js +13 -5
  152. package/lib/commonjs/hooks/useMessageQueue.js.map +1 -1
  153. package/lib/commonjs/hooks/useRoomDirectory.js +29 -0
  154. package/lib/commonjs/hooks/useRoomDirectory.js.map +1 -0
  155. package/lib/commonjs/hooks/useRoomInitialization.js +27 -5
  156. package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
  157. package/lib/commonjs/hooks/useRoomMute.js +62 -0
  158. package/lib/commonjs/hooks/useRoomMute.js.map +1 -0
  159. package/lib/commonjs/hooks/useRoomState.js +3 -1
  160. package/lib/commonjs/hooks/useRoomState.js.map +1 -1
  161. package/lib/commonjs/hooks/useSendMessage.js +13 -3
  162. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  163. package/lib/commonjs/i18n/strings.js +318 -6
  164. package/lib/commonjs/i18n/strings.js.map +1 -1
  165. package/lib/commonjs/networking/api-requests/messageSearch.api.js +87 -0
  166. package/lib/commonjs/networking/api-requests/messageSearch.api.js.map +1 -0
  167. package/lib/commonjs/networking/api-requests/publicChats.api.js +48 -0
  168. package/lib/commonjs/networking/api-requests/publicChats.api.js.map +1 -0
  169. package/lib/commonjs/networking/api-requests/roomMembers.api.js +253 -4
  170. package/lib/commonjs/networking/api-requests/roomMembers.api.js.map +1 -1
  171. package/lib/commonjs/networking/api-requests/rooms.api.js +48 -12
  172. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  173. package/lib/commonjs/networking/api-requests/xmppToken.api.js +71 -0
  174. package/lib/commonjs/networking/api-requests/xmppToken.api.js.map +1 -0
  175. package/lib/commonjs/networking/ethoraEvents.js +227 -0
  176. package/lib/commonjs/networking/ethoraEvents.js.map +1 -0
  177. package/lib/commonjs/networking/stanzaHandlers.js +153 -16
  178. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  179. package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js +124 -3
  180. package/lib/commonjs/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
  181. package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +319 -35
  182. package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
  183. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +7 -0
  184. package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  185. package/lib/commonjs/networking/xmpp/historyCursor.js +101 -0
  186. package/lib/commonjs/networking/xmpp/historyCursor.js.map +1 -0
  187. package/lib/commonjs/networking/xmpp/mamQueryIds.js +17 -0
  188. package/lib/commonjs/networking/xmpp/mamQueryIds.js.map +1 -0
  189. package/lib/commonjs/networking/xmpp/mamRouter.js +24 -9
  190. package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -1
  191. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +70 -65
  192. package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  193. package/lib/commonjs/networking/xmpp/roomJoinSweep.js +389 -0
  194. package/lib/commonjs/networking/xmpp/roomJoinSweep.js.map +1 -0
  195. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
  196. package/lib/commonjs/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  197. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +0 -1
  198. package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  199. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
  200. package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  201. package/lib/commonjs/networking/xmppClient.js +269 -41
  202. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  203. package/lib/commonjs/networking/xmppCredentials.js +80 -0
  204. package/lib/commonjs/networking/xmppCredentials.js.map +1 -0
  205. package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js +158 -0
  206. package/lib/commonjs/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
  207. package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +6 -0
  208. package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
  209. package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +45 -7
  210. package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
  211. package/lib/commonjs/roomStore/chatSettingsSlice.js +15 -1
  212. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  213. package/lib/commonjs/roomStore/index.js +13 -3
  214. package/lib/commonjs/roomStore/index.js.map +1 -1
  215. package/lib/commonjs/roomStore/persistence.js +48 -1
  216. package/lib/commonjs/roomStore/persistence.js.map +1 -1
  217. package/lib/commonjs/roomStore/roomsSlice.js +474 -60
  218. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  219. package/lib/commonjs/roomStore/safeKey.js +44 -0
  220. package/lib/commonjs/roomStore/safeKey.js.map +1 -0
  221. package/lib/commonjs/roomStore/usersSetCap.js +37 -0
  222. package/lib/commonjs/roomStore/usersSetCap.js.map +1 -0
  223. package/lib/commonjs/version.js +1 -1
  224. package/lib/commonjs/version.js.map +1 -1
  225. package/lib/module/assets/icons.js +1 -1
  226. package/lib/module/assets/icons.js.map +1 -1
  227. package/lib/module/components/Header/HeaderRoomList.js +23 -7
  228. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  229. package/lib/module/components/InputComponents/Search.js +39 -2
  230. package/lib/module/components/InputComponents/Search.js.map +1 -1
  231. package/lib/module/components/MainComponents/ArchivedMessageCard.js +161 -0
  232. package/lib/module/components/MainComponents/ArchivedMessageCard.js.map +1 -0
  233. package/lib/module/components/MainComponents/ChatHeader.js +22 -5
  234. package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
  235. package/lib/module/components/MainComponents/ChatRoom.js +57 -26
  236. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  237. package/lib/module/components/MainComponents/ChatWrapper.js +54 -5
  238. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  239. package/lib/module/components/MainComponents/MediaMessage.js +18 -3
  240. package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
  241. package/lib/module/components/MainComponents/MessageList.js +740 -42
  242. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  243. package/lib/module/components/MainComponents/MessageSearchButton.js +48 -0
  244. package/lib/module/components/MainComponents/MessageSearchButton.js.map +1 -0
  245. package/lib/module/components/MainComponents/ReduxWrapper.js +15 -7
  246. package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
  247. package/lib/module/components/MainComponents/RoomList.js +111 -2
  248. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  249. package/lib/module/components/Menu/HeaderRoomListMenu.js +15 -4
  250. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  251. package/lib/module/components/MessageBubble/BubbleHighlight.js +106 -0
  252. package/lib/module/components/MessageBubble/BubbleHighlight.js.map +1 -0
  253. package/lib/module/components/MessageBubble/Message.js +172 -127
  254. package/lib/module/components/MessageBubble/Message.js.map +1 -1
  255. package/lib/module/components/MessageBubble/MessageInteractions.js +98 -78
  256. package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
  257. package/lib/module/components/MessageBubble/messageMenuLayout.js +45 -0
  258. package/lib/module/components/MessageBubble/messageMenuLayout.js.map +1 -0
  259. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +74 -38
  260. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  261. package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js +243 -0
  262. package/lib/module/components/Modals/MessageSearchModal/MessageHitResults.js.map +1 -0
  263. package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js +482 -0
  264. package/lib/module/components/Modals/MessageSearchModal/MessageSearchModal.js.map +1 -0
  265. package/lib/module/components/Modals/MessageSearchModal/openHit.js +45 -0
  266. package/lib/module/components/Modals/MessageSearchModal/openHit.js.map +1 -0
  267. package/lib/module/components/Modals/MessageSearchModal/resolveSender.js +41 -0
  268. package/lib/module/components/Modals/MessageSearchModal/resolveSender.js.map +1 -0
  269. package/lib/module/components/Modals/MessageSearchModal/searchFilters.js +74 -0
  270. package/lib/module/components/Modals/MessageSearchModal/searchFilters.js.map +1 -0
  271. package/lib/module/components/Modals/MessageSearchModal/snippet.js +57 -0
  272. package/lib/module/components/Modals/MessageSearchModal/snippet.js.map +1 -0
  273. package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js +131 -0
  274. package/lib/module/components/Modals/MessageSearchModal/useMessageSearch.js.map +1 -0
  275. package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js +300 -0
  276. package/lib/module/components/Modals/PublicChatsModal/PublicChatsModal.js.map +1 -0
  277. package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js +30 -0
  278. package/lib/module/components/Modals/PublicChatsModal/publicChatsLogic.js.map +1 -0
  279. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +8 -1
  280. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  281. package/lib/module/components/RoomComponents/ChatRoomItem.js +14 -3
  282. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  283. package/lib/module/components/RoomComponents/SwipeableRoomRow.js +39 -7
  284. package/lib/module/components/RoomComponents/SwipeableRoomRow.js.map +1 -1
  285. package/lib/module/components/Thread/ThreadHeader.js +3 -1
  286. package/lib/module/components/Thread/ThreadHeader.js.map +1 -1
  287. package/lib/module/components/Thread/ThreadWrapper.js +89 -9
  288. package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
  289. package/lib/module/components/styled/AudioDecoderHost.js +332 -0
  290. package/lib/module/components/styled/AudioDecoderHost.js.map +1 -0
  291. package/lib/module/components/styled/AudioMessage.js +495 -422
  292. package/lib/module/components/styled/AudioMessage.js.map +1 -1
  293. package/lib/module/components/styled/SendInput.js +32 -6
  294. package/lib/module/components/styled/SendInput.js.map +1 -1
  295. package/lib/module/context/MessageNotificationContext.js +15 -5
  296. package/lib/module/context/MessageNotificationContext.js.map +1 -1
  297. package/lib/module/context/xmppProvider.js +54 -79
  298. package/lib/module/context/xmppProvider.js.map +1 -1
  299. package/lib/module/helpers/audioWaveform.js +153 -0
  300. package/lib/module/helpers/audioWaveform.js.map +1 -0
  301. package/lib/module/helpers/backgroundJoinSweep.js +30 -0
  302. package/lib/module/helpers/backgroundJoinSweep.js.map +1 -0
  303. package/lib/module/helpers/bubbleHighlight.js +38 -0
  304. package/lib/module/helpers/bubbleHighlight.js.map +1 -0
  305. package/lib/module/helpers/checkUniqueUsers.js +15 -13
  306. package/lib/module/helpers/checkUniqueUsers.js.map +1 -1
  307. package/lib/module/helpers/constants/MODAL_COMPONENTS.js +5 -1
  308. package/lib/module/helpers/constants/MODAL_COMPONENTS.js.map +1 -1
  309. package/lib/module/helpers/constants/MODAL_TYPES.js +3 -1
  310. package/lib/module/helpers/constants/MODAL_TYPES.js.map +1 -1
  311. package/lib/module/helpers/createRoomFromApi.js +37 -3
  312. package/lib/module/helpers/createRoomFromApi.js.map +1 -1
  313. package/lib/module/helpers/dedupeMembers.js +28 -0
  314. package/lib/module/helpers/dedupeMembers.js.map +1 -0
  315. package/lib/module/helpers/ethoraLogger.js +52 -0
  316. package/lib/module/helpers/ethoraLogger.js.map +1 -0
  317. package/lib/module/helpers/getUnnamedUsers.js +9 -4
  318. package/lib/module/helpers/getUnnamedUsers.js.map +1 -1
  319. package/lib/module/helpers/historyPreloadConfig.js +39 -0
  320. package/lib/module/helpers/historyPreloadConfig.js.map +1 -0
  321. package/lib/module/helpers/historyPreloadScheduler.js +368 -134
  322. package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
  323. package/lib/module/helpers/initRoomsPresence.js +18 -5
  324. package/lib/module/helpers/initRoomsPresence.js.map +1 -1
  325. package/lib/module/helpers/insertMessageWithDelimiter.js +5 -0
  326. package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
  327. package/lib/module/helpers/isLikelyMucJid.js +60 -0
  328. package/lib/module/helpers/isLikelyMucJid.js.map +1 -0
  329. package/lib/module/helpers/isMessageSearchEnabled.js +13 -0
  330. package/lib/module/helpers/isMessageSearchEnabled.js.map +1 -0
  331. package/lib/module/helpers/joiningRoom.js +9 -0
  332. package/lib/module/helpers/joiningRoom.js.map +1 -0
  333. package/lib/module/helpers/jumpThread.js +83 -0
  334. package/lib/module/helpers/jumpThread.js.map +1 -0
  335. package/lib/module/helpers/jumpToMessage.js +52 -0
  336. package/lib/module/helpers/jumpToMessage.js.map +1 -0
  337. package/lib/module/helpers/jumpWindow.js +177 -0
  338. package/lib/module/helpers/jumpWindow.js.map +1 -0
  339. package/lib/module/helpers/loadRoomHistory.js +69 -0
  340. package/lib/module/helpers/loadRoomHistory.js.map +1 -0
  341. package/lib/module/helpers/notificationPolicy.js +70 -0
  342. package/lib/module/helpers/notificationPolicy.js.map +1 -0
  343. package/lib/module/helpers/openRoomAtMessage.js +41 -0
  344. package/lib/module/helpers/openRoomAtMessage.js.map +1 -0
  345. package/lib/module/helpers/openThreadForJump.js +68 -0
  346. package/lib/module/helpers/openThreadForJump.js.map +1 -0
  347. package/lib/module/helpers/parseMessageReference.js +26 -6
  348. package/lib/module/helpers/parseMessageReference.js.map +1 -1
  349. package/lib/module/helpers/publicChatsEntry.js +12 -0
  350. package/lib/module/helpers/publicChatsEntry.js.map +1 -0
  351. package/lib/module/helpers/roomActivityScore.js +30 -0
  352. package/lib/module/helpers/roomActivityScore.js.map +1 -0
  353. package/lib/module/helpers/roomUserCount.js +29 -0
  354. package/lib/module/helpers/roomUserCount.js.map +1 -0
  355. package/lib/module/helpers/runConfiguredHistoryPreload.js +63 -0
  356. package/lib/module/helpers/runConfiguredHistoryPreload.js.map +1 -0
  357. package/lib/module/helpers/sessionAppId.js +20 -0
  358. package/lib/module/helpers/sessionAppId.js.map +1 -0
  359. package/lib/module/helpers/timestamp.js +37 -0
  360. package/lib/module/helpers/timestamp.js.map +1 -0
  361. package/lib/module/helpers/userResolver.js +503 -0
  362. package/lib/module/helpers/userResolver.js.map +1 -0
  363. package/lib/module/helpers/xmppIdShape.js +46 -0
  364. package/lib/module/helpers/xmppIdShape.js.map +1 -0
  365. package/lib/module/hooks/useChatWrapperInit.js +16 -5
  366. package/lib/module/hooks/useChatWrapperInit.js.map +1 -1
  367. package/lib/module/hooks/useHeapSender.js +54 -3
  368. package/lib/module/hooks/useHeapSender.js.map +1 -1
  369. package/lib/module/hooks/useJumpToMessage.js +389 -0
  370. package/lib/module/hooks/useJumpToMessage.js.map +1 -0
  371. package/lib/module/hooks/useMessageLoaderQueue.js +32 -5
  372. package/lib/module/hooks/useMessageLoaderQueue.js.map +1 -1
  373. package/lib/module/hooks/useMessageQueue.js +13 -5
  374. package/lib/module/hooks/useMessageQueue.js.map +1 -1
  375. package/lib/module/hooks/useRoomDirectory.js +24 -0
  376. package/lib/module/hooks/useRoomDirectory.js.map +1 -0
  377. package/lib/module/hooks/useRoomInitialization.js +29 -7
  378. package/lib/module/hooks/useRoomInitialization.js.map +1 -1
  379. package/lib/module/hooks/useRoomMute.js +58 -0
  380. package/lib/module/hooks/useRoomMute.js.map +1 -0
  381. package/lib/module/hooks/useRoomState.js +3 -1
  382. package/lib/module/hooks/useRoomState.js.map +1 -1
  383. package/lib/module/hooks/useSendMessage.js +13 -3
  384. package/lib/module/hooks/useSendMessage.js.map +1 -1
  385. package/lib/module/i18n/strings.js +318 -6
  386. package/lib/module/i18n/strings.js.map +1 -1
  387. package/lib/module/networking/api-requests/messageSearch.api.js +81 -0
  388. package/lib/module/networking/api-requests/messageSearch.api.js.map +1 -0
  389. package/lib/module/networking/api-requests/publicChats.api.js +43 -0
  390. package/lib/module/networking/api-requests/publicChats.api.js.map +1 -0
  391. package/lib/module/networking/api-requests/roomMembers.api.js +248 -4
  392. package/lib/module/networking/api-requests/roomMembers.api.js.map +1 -1
  393. package/lib/module/networking/api-requests/rooms.api.js +48 -12
  394. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  395. package/lib/module/networking/api-requests/xmppToken.api.js +66 -0
  396. package/lib/module/networking/api-requests/xmppToken.api.js.map +1 -0
  397. package/lib/module/networking/ethoraEvents.js +220 -0
  398. package/lib/module/networking/ethoraEvents.js.map +1 -0
  399. package/lib/module/networking/stanzaHandlers.js +155 -18
  400. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  401. package/lib/module/networking/xmpp/allRoomPresences.xmpp.js +125 -3
  402. package/lib/module/networking/xmpp/allRoomPresences.xmpp.js.map +1 -1
  403. package/lib/module/networking/xmpp/getHistory.xmpp.js +318 -35
  404. package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
  405. package/lib/module/networking/xmpp/handleStanzas.xmpp.js +7 -0
  406. package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
  407. package/lib/module/networking/xmpp/historyCursor.js +95 -0
  408. package/lib/module/networking/xmpp/historyCursor.js.map +1 -0
  409. package/lib/module/networking/xmpp/mamQueryIds.js +12 -0
  410. package/lib/module/networking/xmpp/mamQueryIds.js.map +1 -0
  411. package/lib/module/networking/xmpp/mamRouter.js +22 -8
  412. package/lib/module/networking/xmpp/mamRouter.js.map +1 -1
  413. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +68 -62
  414. package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
  415. package/lib/module/networking/xmpp/roomJoinSweep.js +385 -0
  416. package/lib/module/networking/xmpp/roomJoinSweep.js.map +1 -0
  417. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js +0 -1
  418. package/lib/module/networking/xmpp/sendMediaMessage.xmpp.js.map +1 -1
  419. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +0 -1
  420. package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
  421. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +0 -1
  422. package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
  423. package/lib/module/networking/xmppClient.js +269 -41
  424. package/lib/module/networking/xmppClient.js.map +1 -1
  425. package/lib/module/networking/xmppCredentials.js +76 -0
  426. package/lib/module/networking/xmppCredentials.js.map +1 -0
  427. package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js +153 -0
  428. package/lib/module/roomStore/Middleware/jumpThreadMiddleware.js.map +1 -0
  429. package/lib/module/roomStore/Middleware/reactionsMiddleware.js +6 -0
  430. package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
  431. package/lib/module/roomStore/Middleware/unreadMidlleware.js +46 -7
  432. package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
  433. package/lib/module/roomStore/chatSettingsSlice.js +13 -0
  434. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  435. package/lib/module/roomStore/index.js +7 -3
  436. package/lib/module/roomStore/index.js.map +1 -1
  437. package/lib/module/roomStore/persistence.js +46 -1
  438. package/lib/module/roomStore/persistence.js.map +1 -1
  439. package/lib/module/roomStore/roomsSlice.js +459 -58
  440. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  441. package/lib/module/roomStore/safeKey.js +37 -0
  442. package/lib/module/roomStore/safeKey.js.map +1 -0
  443. package/lib/module/roomStore/usersSetCap.js +32 -0
  444. package/lib/module/roomStore/usersSetCap.js.map +1 -0
  445. package/lib/module/version.js +1 -1
  446. package/lib/module/version.js.map +1 -1
  447. package/lib/typescript/assets/icons.d.ts +4 -0
  448. package/lib/typescript/assets/icons.d.ts.map +1 -1
  449. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  450. package/lib/typescript/components/InputComponents/Search.d.ts.map +1 -1
  451. package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts +12 -0
  452. package/lib/typescript/components/MainComponents/ArchivedMessageCard.d.ts.map +1 -0
  453. package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
  454. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  455. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  456. package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
  457. package/lib/typescript/components/MainComponents/MessageList.d.ts +22 -1
  458. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  459. package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts +7 -0
  460. package/lib/typescript/components/MainComponents/MessageSearchButton.d.ts.map +1 -0
  461. package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
  462. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  463. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  464. package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts +12 -0
  465. package/lib/typescript/components/MessageBubble/BubbleHighlight.d.ts.map +1 -0
  466. package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
  467. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +5 -0
  468. package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
  469. package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts +29 -0
  470. package/lib/typescript/components/MessageBubble/messageMenuLayout.d.ts.map +1 -0
  471. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +2 -0
  472. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  473. package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts +44 -0
  474. package/lib/typescript/components/Modals/MessageSearchModal/MessageHitResults.d.ts.map +1 -0
  475. package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts +12 -0
  476. package/lib/typescript/components/Modals/MessageSearchModal/MessageSearchModal.d.ts.map +1 -0
  477. package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts +15 -0
  478. package/lib/typescript/components/Modals/MessageSearchModal/openHit.d.ts.map +1 -0
  479. package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts +34 -0
  480. package/lib/typescript/components/Modals/MessageSearchModal/resolveSender.d.ts.map +1 -0
  481. package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts +41 -0
  482. package/lib/typescript/components/Modals/MessageSearchModal/searchFilters.d.ts.map +1 -0
  483. package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts +15 -0
  484. package/lib/typescript/components/Modals/MessageSearchModal/snippet.d.ts.map +1 -0
  485. package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts +23 -0
  486. package/lib/typescript/components/Modals/MessageSearchModal/useMessageSearch.d.ts.map +1 -0
  487. package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts +16 -0
  488. package/lib/typescript/components/Modals/PublicChatsModal/PublicChatsModal.d.ts.map +1 -0
  489. package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts +14 -0
  490. package/lib/typescript/components/Modals/PublicChatsModal/publicChatsLogic.d.ts.map +1 -0
  491. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  492. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  493. package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts +5 -1
  494. package/lib/typescript/components/RoomComponents/SwipeableRoomRow.d.ts.map +1 -1
  495. package/lib/typescript/components/Thread/ThreadHeader.d.ts.map +1 -1
  496. package/lib/typescript/components/Thread/ThreadWrapper.d.ts +1 -0
  497. package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
  498. package/lib/typescript/components/styled/AudioDecoderHost.d.ts +39 -0
  499. package/lib/typescript/components/styled/AudioDecoderHost.d.ts.map +1 -0
  500. package/lib/typescript/components/styled/AudioMessage.d.ts +14 -1
  501. package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
  502. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  503. package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
  504. package/lib/typescript/context/xmppProvider.d.ts +2 -0
  505. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  506. package/lib/typescript/helpers/audioWaveform.d.ts +54 -0
  507. package/lib/typescript/helpers/audioWaveform.d.ts.map +1 -0
  508. package/lib/typescript/helpers/backgroundJoinSweep.d.ts +14 -0
  509. package/lib/typescript/helpers/backgroundJoinSweep.d.ts.map +1 -0
  510. package/lib/typescript/helpers/bubbleHighlight.d.ts +17 -0
  511. package/lib/typescript/helpers/bubbleHighlight.d.ts.map +1 -0
  512. package/lib/typescript/helpers/checkUniqueUsers.d.ts +2 -2
  513. package/lib/typescript/helpers/checkUniqueUsers.d.ts.map +1 -1
  514. package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
  515. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
  516. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
  517. package/lib/typescript/helpers/createRoomFromApi.d.ts +25 -0
  518. package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
  519. package/lib/typescript/helpers/dedupeMembers.d.ts +11 -0
  520. package/lib/typescript/helpers/dedupeMembers.d.ts.map +1 -0
  521. package/lib/typescript/helpers/ethoraLogger.d.ts +13 -0
  522. package/lib/typescript/helpers/ethoraLogger.d.ts.map +1 -0
  523. package/lib/typescript/helpers/getUnnamedUsers.d.ts.map +1 -1
  524. package/lib/typescript/helpers/historyPreloadConfig.d.ts +26 -0
  525. package/lib/typescript/helpers/historyPreloadConfig.d.ts.map +1 -0
  526. package/lib/typescript/helpers/historyPreloadScheduler.d.ts +8 -4
  527. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  528. package/lib/typescript/helpers/initRoomsPresence.d.ts +7 -0
  529. package/lib/typescript/helpers/initRoomsPresence.d.ts.map +1 -1
  530. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  531. package/lib/typescript/helpers/isLikelyMucJid.d.ts +19 -0
  532. package/lib/typescript/helpers/isLikelyMucJid.d.ts.map +1 -0
  533. package/lib/typescript/helpers/isMessageSearchEnabled.d.ts +12 -0
  534. package/lib/typescript/helpers/isMessageSearchEnabled.d.ts.map +1 -0
  535. package/lib/typescript/helpers/joiningRoom.d.ts +7 -0
  536. package/lib/typescript/helpers/joiningRoom.d.ts.map +1 -0
  537. package/lib/typescript/helpers/jumpThread.d.ts +48 -0
  538. package/lib/typescript/helpers/jumpThread.d.ts.map +1 -0
  539. package/lib/typescript/helpers/jumpToMessage.d.ts +26 -0
  540. package/lib/typescript/helpers/jumpToMessage.d.ts.map +1 -0
  541. package/lib/typescript/helpers/jumpWindow.d.ts +74 -0
  542. package/lib/typescript/helpers/jumpWindow.d.ts.map +1 -0
  543. package/lib/typescript/helpers/loadRoomHistory.d.ts +34 -0
  544. package/lib/typescript/helpers/loadRoomHistory.d.ts.map +1 -0
  545. package/lib/typescript/helpers/notificationPolicy.d.ts +42 -0
  546. package/lib/typescript/helpers/notificationPolicy.d.ts.map +1 -0
  547. package/lib/typescript/helpers/openRoomAtMessage.d.ts +17 -0
  548. package/lib/typescript/helpers/openRoomAtMessage.d.ts.map +1 -0
  549. package/lib/typescript/helpers/openThreadForJump.d.ts +27 -0
  550. package/lib/typescript/helpers/openThreadForJump.d.ts.map +1 -0
  551. package/lib/typescript/helpers/parseMessageReference.d.ts +18 -5
  552. package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -1
  553. package/lib/typescript/helpers/publicChatsEntry.d.ts +11 -0
  554. package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -0
  555. package/lib/typescript/helpers/roomActivityScore.d.ts +5 -0
  556. package/lib/typescript/helpers/roomActivityScore.d.ts.map +1 -0
  557. package/lib/typescript/helpers/roomUserCount.d.ts +20 -0
  558. package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -0
  559. package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts +21 -0
  560. package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts.map +1 -0
  561. package/lib/typescript/helpers/sessionAppId.d.ts +8 -0
  562. package/lib/typescript/helpers/sessionAppId.d.ts.map +1 -0
  563. package/lib/typescript/helpers/timestamp.d.ts +3 -0
  564. package/lib/typescript/helpers/timestamp.d.ts.map +1 -0
  565. package/lib/typescript/helpers/userResolver.d.ts +58 -0
  566. package/lib/typescript/helpers/userResolver.d.ts.map +1 -0
  567. package/lib/typescript/helpers/xmppIdShape.d.ts +10 -0
  568. package/lib/typescript/helpers/xmppIdShape.d.ts.map +1 -0
  569. package/lib/typescript/hooks/useChatWrapperInit.d.ts +2 -0
  570. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  571. package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
  572. package/lib/typescript/hooks/useJumpToMessage.d.ts +116 -0
  573. package/lib/typescript/hooks/useJumpToMessage.d.ts.map +1 -0
  574. package/lib/typescript/hooks/useMessageLoaderQueue.d.ts.map +1 -1
  575. package/lib/typescript/hooks/useMessageQueue.d.ts.map +1 -1
  576. package/lib/typescript/hooks/useRoomDirectory.d.ts +12 -0
  577. package/lib/typescript/hooks/useRoomDirectory.d.ts.map +1 -0
  578. package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
  579. package/lib/typescript/hooks/useRoomMute.d.ts +8 -0
  580. package/lib/typescript/hooks/useRoomMute.d.ts.map +1 -0
  581. package/lib/typescript/hooks/useRoomState.d.ts +1 -0
  582. package/lib/typescript/hooks/useRoomState.d.ts.map +1 -1
  583. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  584. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  585. package/lib/typescript/networking/api-requests/messageSearch.api.d.ts +57 -0
  586. package/lib/typescript/networking/api-requests/messageSearch.api.d.ts.map +1 -0
  587. package/lib/typescript/networking/api-requests/publicChats.api.d.ts +24 -0
  588. package/lib/typescript/networking/api-requests/publicChats.api.d.ts.map +1 -0
  589. package/lib/typescript/networking/api-requests/roomMembers.api.d.ts +19 -1
  590. package/lib/typescript/networking/api-requests/roomMembers.api.d.ts.map +1 -1
  591. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  592. package/lib/typescript/networking/api-requests/xmppToken.api.d.ts +2 -0
  593. package/lib/typescript/networking/api-requests/xmppToken.api.d.ts.map +1 -0
  594. package/lib/typescript/networking/ethoraEvents.d.ts +45 -0
  595. package/lib/typescript/networking/ethoraEvents.d.ts.map +1 -0
  596. package/lib/typescript/networking/stanzaHandlers.d.ts +1 -1
  597. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  598. package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts +32 -1
  599. package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts.map +1 -1
  600. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +64 -0
  601. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
  602. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
  603. package/lib/typescript/networking/xmpp/historyCursor.d.ts +35 -0
  604. package/lib/typescript/networking/xmpp/historyCursor.d.ts.map +1 -0
  605. package/lib/typescript/networking/xmpp/mamQueryIds.d.ts +10 -0
  606. package/lib/typescript/networking/xmpp/mamQueryIds.d.ts.map +1 -0
  607. package/lib/typescript/networking/xmpp/mamRouter.d.ts +7 -0
  608. package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -1
  609. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +13 -2
  610. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  611. package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts +82 -0
  612. package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts.map +1 -0
  613. package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
  614. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
  615. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
  616. package/lib/typescript/networking/xmppClient.d.ts +90 -4
  617. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  618. package/lib/typescript/networking/xmppCredentials.d.ts +12 -0
  619. package/lib/typescript/networking/xmppCredentials.d.ts.map +1 -0
  620. package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts +3 -0
  621. package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts.map +1 -0
  622. package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
  623. package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
  624. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
  625. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  626. package/lib/typescript/roomStore/index.d.ts +2 -1
  627. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  628. package/lib/typescript/roomStore/persistence.d.ts +8 -0
  629. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  630. package/lib/typescript/roomStore/roomsSlice.d.ts +138 -2
  631. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  632. package/lib/typescript/roomStore/safeKey.d.ts +13 -0
  633. package/lib/typescript/roomStore/safeKey.d.ts.map +1 -0
  634. package/lib/typescript/roomStore/usersSetCap.d.ts +16 -0
  635. package/lib/typescript/roomStore/usersSetCap.d.ts.map +1 -0
  636. package/lib/typescript/types/models/media.model.d.ts +2 -0
  637. package/lib/typescript/types/models/media.model.d.ts.map +1 -1
  638. package/lib/typescript/types/models/room.model.d.ts +18 -5
  639. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  640. package/lib/typescript/types/models/xmpp.model.d.ts +8 -1
  641. package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
  642. package/lib/typescript/types/types.d.ts +90 -5
  643. package/lib/typescript/types/types.d.ts.map +1 -1
  644. package/lib/typescript/version.d.ts +1 -1
  645. package/lib/typescript/version.d.ts.map +1 -1
  646. package/package.json +1 -1
  647. package/src/assets/icons.tsx +13 -0
  648. package/src/components/Header/HeaderRoomList.tsx +21 -4
  649. package/src/components/InputComponents/Search.tsx +33 -0
  650. package/src/components/MainComponents/ArchivedMessageCard.tsx +139 -0
  651. package/src/components/MainComponents/ChatHeader.tsx +19 -3
  652. package/src/components/MainComponents/ChatRoom.tsx +60 -23
  653. package/src/components/MainComponents/ChatWrapper.tsx +50 -9
  654. package/src/components/MainComponents/MediaMessage.tsx +17 -0
  655. package/src/components/MainComponents/MessageList.tsx +823 -84
  656. package/src/components/MainComponents/MessageSearchButton.tsx +48 -0
  657. package/src/components/MainComponents/ReduxWrapper.tsx +16 -5
  658. package/src/components/MainComponents/RoomList.tsx +125 -0
  659. package/src/components/Menu/HeaderRoomListMenu.tsx +26 -2
  660. package/src/components/MessageBubble/BubbleHighlight.tsx +106 -0
  661. package/src/components/MessageBubble/Message.tsx +265 -177
  662. package/src/components/MessageBubble/MessageInteractions.tsx +109 -86
  663. package/src/components/MessageBubble/messageMenuLayout.ts +59 -0
  664. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +92 -21
  665. package/src/components/Modals/MessageSearchModal/MessageHitResults.tsx +271 -0
  666. package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +487 -0
  667. package/src/components/Modals/MessageSearchModal/openHit.ts +50 -0
  668. package/src/components/Modals/MessageSearchModal/resolveSender.ts +57 -0
  669. package/src/components/Modals/MessageSearchModal/searchFilters.ts +109 -0
  670. package/src/components/Modals/MessageSearchModal/snippet.ts +58 -0
  671. package/src/components/Modals/MessageSearchModal/useMessageSearch.ts +151 -0
  672. package/src/components/Modals/PublicChatsModal/PublicChatsModal.tsx +288 -0
  673. package/src/components/Modals/PublicChatsModal/publicChatsLogic.ts +36 -0
  674. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +8 -1
  675. package/src/components/RoomComponents/ChatRoomItem.tsx +16 -3
  676. package/src/components/RoomComponents/SwipeableRoomRow.tsx +39 -6
  677. package/src/components/Thread/ThreadHeader.tsx +3 -1
  678. package/src/components/Thread/ThreadWrapper.tsx +96 -10
  679. package/src/components/styled/AudioDecoderHost.tsx +351 -0
  680. package/src/components/styled/AudioMessage.tsx +482 -425
  681. package/src/components/styled/SendInput.tsx +42 -4
  682. package/src/context/MessageNotificationContext.tsx +19 -5
  683. package/src/context/xmppProvider.tsx +56 -91
  684. package/src/helpers/audioWaveform.ts +142 -0
  685. package/src/helpers/backgroundJoinSweep.ts +35 -0
  686. package/src/helpers/bubbleHighlight.ts +47 -0
  687. package/src/helpers/checkUniqueUsers.tsx +15 -17
  688. package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -0
  689. package/src/helpers/constants/MODAL_TYPES.ts +3 -0
  690. package/src/helpers/createRoomFromApi.tsx +45 -4
  691. package/src/helpers/dedupeMembers.ts +29 -0
  692. package/src/helpers/ethoraLogger.ts +50 -0
  693. package/src/helpers/getUnnamedUsers.ts +7 -4
  694. package/src/helpers/historyPreloadConfig.ts +68 -0
  695. package/src/helpers/historyPreloadScheduler.ts +437 -199
  696. package/src/helpers/initRoomsPresence.ts +20 -7
  697. package/src/helpers/insertMessageWithDelimiter.ts +3 -0
  698. package/src/helpers/isLikelyMucJid.ts +72 -0
  699. package/src/helpers/isMessageSearchEnabled.ts +18 -0
  700. package/src/helpers/joiningRoom.ts +13 -0
  701. package/src/helpers/jumpThread.ts +102 -0
  702. package/src/helpers/jumpToMessage.ts +57 -0
  703. package/src/helpers/jumpWindow.ts +212 -0
  704. package/src/helpers/loadRoomHistory.ts +83 -0
  705. package/src/helpers/notificationPolicy.ts +82 -0
  706. package/src/helpers/openRoomAtMessage.ts +38 -0
  707. package/src/helpers/openThreadForJump.ts +96 -0
  708. package/src/helpers/parseMessageReference.ts +37 -8
  709. package/src/helpers/publicChatsEntry.ts +15 -0
  710. package/src/helpers/roomActivityScore.ts +45 -0
  711. package/src/helpers/roomUserCount.ts +44 -0
  712. package/src/helpers/runConfiguredHistoryPreload.ts +76 -0
  713. package/src/helpers/sessionAppId.ts +17 -0
  714. package/src/helpers/timestamp.ts +44 -0
  715. package/src/helpers/userResolver.ts +542 -0
  716. package/src/helpers/xmppIdShape.ts +46 -0
  717. package/src/hooks/useChatWrapperInit.ts +22 -4
  718. package/src/hooks/useHeapSender.tsx +54 -3
  719. package/src/hooks/useJumpToMessage.ts +538 -0
  720. package/src/hooks/useMessageLoaderQueue.tsx +40 -4
  721. package/src/hooks/useMessageQueue.ts +9 -5
  722. package/src/hooks/useRoomDirectory.ts +39 -0
  723. package/src/hooks/useRoomInitialization.tsx +33 -7
  724. package/src/hooks/useRoomMute.ts +42 -0
  725. package/src/hooks/useRoomState.tsx +6 -0
  726. package/src/hooks/useSendMessage.tsx +14 -2
  727. package/src/i18n/strings.ts +312 -0
  728. package/src/networking/api-requests/messageSearch.api.ts +130 -0
  729. package/src/networking/api-requests/publicChats.api.ts +71 -0
  730. package/src/networking/api-requests/roomMembers.api.ts +263 -11
  731. package/src/networking/api-requests/rooms.api.ts +52 -12
  732. package/src/networking/api-requests/xmppToken.api.ts +62 -0
  733. package/src/networking/ethoraEvents.ts +262 -0
  734. package/src/networking/stanzaHandlers.ts +145 -19
  735. package/src/networking/xmpp/allRoomPresences.xmpp.ts +155 -5
  736. package/src/networking/xmpp/getHistory.xmpp.ts +433 -47
  737. package/src/networking/xmpp/handleStanzas.xmpp.ts +8 -0
  738. package/src/networking/xmpp/historyCursor.ts +124 -0
  739. package/src/networking/xmpp/mamQueryIds.ts +11 -0
  740. package/src/networking/xmpp/mamRouter.ts +24 -10
  741. package/src/networking/xmpp/presenceInRoom.xmpp.ts +91 -68
  742. package/src/networking/xmpp/roomJoinSweep.ts +412 -0
  743. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +0 -1
  744. package/src/networking/xmpp/sendTextMessage.xmpp.ts +0 -1
  745. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +0 -1
  746. package/src/networking/xmppClient.ts +323 -47
  747. package/src/networking/xmppCredentials.ts +87 -0
  748. package/src/roomStore/Middleware/jumpThreadMiddleware.ts +163 -0
  749. package/src/roomStore/Middleware/reactionsMiddleware.tsx +4 -0
  750. package/src/roomStore/Middleware/unreadMidlleware.tsx +59 -11
  751. package/src/roomStore/chatSettingsSlice.ts +11 -0
  752. package/src/roomStore/index.ts +10 -3
  753. package/src/roomStore/persistence.ts +54 -0
  754. package/src/roomStore/roomsSlice.ts +547 -65
  755. package/src/roomStore/safeKey.ts +49 -0
  756. package/src/roomStore/usersSetCap.ts +37 -0
  757. package/src/types/models/media.model.ts +4 -0
  758. package/src/types/models/room.model.ts +18 -5
  759. package/src/types/models/xmpp.model.ts +15 -1
  760. package/src/types/types.ts +95 -5
  761. package/src/version.ts +1 -1
@@ -4,12 +4,25 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ Object.defineProperty(exports, "loadRoomsThenJoinInBackground", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _backgroundJoinSweep.loadRoomsThenJoinInBackground;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "startBackgroundJoinSweep", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _backgroundJoinSweep.startBackgroundJoinSweep;
17
+ }
18
+ });
7
19
  var _react = require("react");
8
20
  var _reactRedux = require("react-redux");
9
21
  var _resolveLangSource = require("../helpers/resolveLangSource");
10
22
  var _xmppProvider = require("../context/xmppProvider");
11
23
  var _chatAutoEnterer = require("../helpers/chatAutoEnterer");
12
24
  var _initRoomsPresence = require("../helpers/initRoomsPresence");
25
+ var _backgroundJoinSweep = require("../helpers/backgroundJoinSweep");
13
26
  var _updateMessagesTillLast = require("../helpers/updateMessagesTillLast");
14
27
  var _authRefresh = require("../networking/authRefresh");
15
28
  var _chatSettingsSlice = require("../roomStore/chatSettingsSlice");
@@ -24,6 +37,9 @@ var _shallowEqual = require("../helpers/shallowEqual");
24
37
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
25
38
  /** @format */
26
39
 
40
+ // The room list ends its loading state right after /chats/my; joining every
41
+ // room is a background sweep nobody waits for (see helpers/backgroundJoinSweep).
42
+
27
43
  const useChatWrapperInit = ({
28
44
  roomJID,
29
45
  wasAutoSelected,
@@ -87,12 +103,13 @@ const useChatWrapperInit = ({
87
103
  loading: true,
88
104
  loadingText: 'Loading rooms...'
89
105
  }));
90
- const rooms = await syncRooms(client, config);
91
- dispatch((0, _roomsSlice.setIsLoading)({
106
+ // The list is usable as soon as the rooms fetch returns (rooms come
107
+ // seeded with lastMessage / unread). Joining them all runs in the
108
+ // background, open room first.
109
+ return (0, _backgroundJoinSweep.loadRoomsThenJoinInBackground)(client, () => syncRooms(client, config), () => dispatch((0, _roomsSlice.setIsLoading)({
92
110
  loading: false,
93
111
  loadingText: undefined
94
- }));
95
- return rooms;
112
+ })));
96
113
  };
97
114
  (0, _react.useEffect)(() => {
98
115
  let retryTimeout;
@@ -126,7 +143,9 @@ const useChatWrapperInit = ({
126
143
  if (roomsList && Object.keys(roomsList).length > 0) {
127
144
  console.log(' Using existing roomsList', Object.keys(roomsList).length);
128
145
  setInited(true);
129
- await (0, _initRoomsPresence.initRoomsPresence)(newClient, roomsList);
146
+ // Persisted rooms: join (background sweep) + push subscribe
147
+ // without holding the private-store / unread step behind it.
148
+ (0, _initRoomsPresence.initRoomsPresence)(newClient, roomsList).catch(() => undefined);
130
149
  } else {
131
150
  if (config?.newArch) {
132
151
  console.log(' Loading rooms with newArch');
@@ -189,6 +208,9 @@ const useChatWrapperInit = ({
189
208
  }
190
209
  }
191
210
  setInited(true);
211
+ // Rooms that appeared since the bootstrap sweep (a /chats/my that
212
+ // returned late) get joined too; a no-op when nothing is left.
213
+ (0, _backgroundJoinSweep.startBackgroundJoinSweep)(client);
192
214
  console.log(' Getting chats private store for existing client');
193
215
  try {
194
216
  // See the "new client" branch above: getChatsPrivateStoreRequestStanza
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactRedux","_resolveLangSource","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","_updateMessagesTillLast","_authRefresh","_chatSettingsSlice","_languageSettings","_roomsSlice","_useRoomState","_useChatSettingState","_isChatIdPresentInArray","_useGetNewArchRoom","_interopRequireDefault","_getRoomsWithRetry","_shallowEqual","e","__esModule","default","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","useDispatch","inited","setInited","useState","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","useRef","client","initializeClient","setClient","useXmppClient","syncRooms","useGetNewArchRoom","rooms","useSelector","state","roomsList","useRoomState","user","useChatSettingState","useEffect","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","shallowEqual","current","setConfig","getRoomsWithRertyRequest","retryRooms","getRoomsWithRetry","loadRooms","disableLoad","setIsLoading","loading","loadingText","retryTimeout","initXmmpClient","legacyLangSource","resolveLegacyTranslatesLangSource","translates","setLangSource","applyProfileLanguages","xmppUsername","error","chatAutoEnterer","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","initRoomsPresence","newArch","loadedRooms","enableRoomsRetry","enabled","isSelectedRoomPresent","isChatIdPresentInArray","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","updateMessagesTillLast","err","warn","refreshTokens","refreshAuthTokensQuiet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QAAM,CAAC,CAAC,CAAC;MAC5C,CAAC,CAAC,OAAOU,KAAK,EAAE;QACdxB,OAAO,CAACwB,KAAK,CAAC,cAAc,EAAEA,KAAK,CAAC;QACpC9C,YAAY,CAAC,KAAK,CAAC;QACnBE,iBAAiB,CAAC,IAAI,CAAC;QACvBL,SAAS,CAAC,KAAK,CAAC;QAChBH,QAAQ,CAAC,IAAAyC,wBAAY,EAAC;UAAEC,OAAO,EAAE;QAAM,CAAC,CAAC,CAAC;QAC1CE,YAAY,GAAGiC,UAAU,CAAChC,cAAc,EAAE,IAAI,CAAC;MACjD;IACF,CAAC;IAEDA,cAAc,CAAC,CAAC;IAEhB,OAAO,MAAM;MACXiC,YAAY,CAAClC,YAAY,CAAC;IAC5B,CAAC;EACH,CAAC,EAAE,CAACpB,IAAI,CAACG,YAAY,EAAEH,IAAI,CAAC2B,YAAY,CAAC,CAAC;EAE1C,OAAO;IACLtC,MAAM;IACNX,MAAM;IACNO,UAAU;IACVJ,SAAS;IACTE,gBAAgB;IAChBQ,SAAS,EAAEA,SAAgB;IAC3BZ,SAAS;IACTG;EACF,CAAC;AACH,CAAC;AAAC,IAAAyE,QAAA,GAAAC,OAAA,CAAArF,OAAA,GAEaC,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactRedux","_resolveLangSource","_xmppProvider","_chatAutoEnterer","_initRoomsPresence","_backgroundJoinSweep","_updateMessagesTillLast","_authRefresh","_chatSettingsSlice","_languageSettings","_roomsSlice","_useRoomState","_useChatSettingState","_isChatIdPresentInArray","_useGetNewArchRoom","_interopRequireDefault","_getRoomsWithRetry","_shallowEqual","e","__esModule","default","useChatWrapperInit","roomJID","wasAutoSelected","config","dispatch","useDispatch","inited","setInited","useState","showModal","setShowModal","isConnectionLost","setConnectionLost","isRetrying","setIsRetrying","hasSyncedHistoryRef","useRef","client","initializeClient","setClient","useXmppClient","syncRooms","useGetNewArchRoom","rooms","useSelector","state","roomsList","useRoomState","user","useChatSettingState","useEffect","xmppPassword","console","log","close","lastSyncedConfigRef","undefined","shallowEqual","current","setConfig","getRoomsWithRertyRequest","retryRooms","getRoomsWithRetry","loadRooms","disableLoad","setIsLoading","loading","loadingText","loadRoomsThenJoinInBackground","retryTimeout","initXmmpClient","legacyLangSource","resolveLegacyTranslatesLangSource","translates","setLangSource","applyProfileLanguages","xmppUsername","error","chatAutoEnterer","newClient","defaultWallet","walletAddress","xmppSettings","status","Object","keys","length","initRoomsPresence","catch","newArch","loadedRooms","enableRoomsRetry","enabled","isSelectedRoomPresent","isChatIdPresentInArray","getRoomsStanza","roomTimestampObject","getChatsPrivateStoreRequestStanza","updateMessagesTillLast","err","warn","refreshTokens","refreshAuthTokensQuietly","setTimeout","startBackgroundJoinSweep","clearTimeout","_default","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatWrapperInit.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAGA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAIA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,WAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAZ,OAAA;AACA,IAAAa,oBAAA,GAAAb,OAAA;AACA,IAAAc,uBAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAC,sBAAA,CAAAhB,OAAA;AACA,IAAAiB,kBAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA;AAAuD,SAAAgB,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CA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M;IACNO,UAAU;IACVJ,SAAS;IACTE,gBAAgB;IAChBQ,SAAS,EAAEA,SAAgB;IAC3BZ,SAAS;IACTG;EACF,CAAC;AACH,CAAC;AAAC,IAAA4E,QAAA,GAAAC,OAAA,CAAAxF,OAAA,GAEaC,kBAAkB","ignoreList":[]}
@@ -7,6 +7,22 @@ exports.useHeapSender = void 0;
7
7
  var _react = require("react");
8
8
  var _reactRedux = require("react-redux");
9
9
  var _useMessageHeapState = require("./useMessageHeapState");
10
+ // "Joining works" is enough to drain the heap: the first wave of the join
11
+ // sweep (open room + one pool width). Waiting for the WHOLE sweep would hold
12
+ // queued messages behind joins of rooms nobody is writing to. Clients that
13
+ // do not expose the priority flag fall back to the full-sweep flag.
14
+ const isJoinReady = client => {
15
+ if (!client) {
16
+ return false;
17
+ }
18
+ const priority = client.priorityPresencesReady;
19
+ return typeof priority === 'boolean' ? priority : !!client.presencesReady;
20
+ };
21
+
22
+ // The flags are plain fields on the client (no re-render when they flip), so
23
+ // a drain that finds the gate closed, or a room it could not join, tries
24
+ // again on its own.
25
+ const RETRY_MS = 1000;
10
26
  const useHeapSender = client => {
11
27
  const dispatch = (0, _reactRedux.useDispatch)();
12
28
  const {
@@ -14,12 +30,24 @@ const useHeapSender = client => {
14
30
  } = (0, _useMessageHeapState.useMessageHeapState)();
15
31
  const sendingRef = (0, _react.useRef)(false);
16
32
  const inFlightRef = (0, _react.useRef)(new Map());
33
+ const retryTimerRef = (0, _react.useRef)(null);
34
+ const sendRef = (0, _react.useRef)(async () => {});
35
+ const scheduleRetry = () => {
36
+ if (retryTimerRef.current) {
37
+ return;
38
+ }
39
+ retryTimerRef.current = setTimeout(() => {
40
+ retryTimerRef.current = null;
41
+ sendRef.current().catch(() => undefined);
42
+ }, RETRY_MS);
43
+ };
17
44
  const sendHeapMessages = (0, _react.useCallback)(async () => {
18
45
  if (!client || queue.length === 0) {
19
46
  return;
20
47
  }
21
- if (!client.presencesReady) {
48
+ if (!isJoinReady(client)) {
22
49
  console.warn('Presences not ready, delaying heap send');
50
+ scheduleRetry();
23
51
  return;
24
52
  }
25
53
  if (sendingRef.current) {
@@ -32,6 +60,19 @@ const useHeapSender = client => {
32
60
  if (lastAttempt && Date.now() - lastAttempt < 15000) {
33
61
  continue;
34
62
  }
63
+ // Join the message's own room first (deduped, a no-op for a room the
64
+ // sweep already joined). A room that cannot be joined keeps the
65
+ // message queued; it is retried on the next pass.
66
+ let joined = true;
67
+ try {
68
+ joined = await client.presenceInRoomStanza?.(msg.roomJid);
69
+ } catch {
70
+ joined = false;
71
+ }
72
+ if (joined === false) {
73
+ scheduleRetry();
74
+ continue;
75
+ }
35
76
  inFlightRef.current.set(msg.id, Date.now());
36
77
  try {
37
78
  if (msg.langSource) {
@@ -50,15 +91,25 @@ const useHeapSender = client => {
50
91
  sendingRef.current = false;
51
92
  }
52
93
  }, [client, queue, dispatch]);
94
+ sendRef.current = sendHeapMessages;
95
+ (0, _react.useEffect)(() => () => {
96
+ if (retryTimerRef.current) {
97
+ clearTimeout(retryTimerRef.current);
98
+ }
99
+ retryTimerRef.current = null;
100
+ }, []);
53
101
  const prevReadyRef = (0, _react.useRef)(false);
54
102
  (0, _react.useEffect)(() => {
55
- const nowReady = !!client?.presencesReady;
103
+ const nowReady = isJoinReady(client);
56
104
  const wasReady = prevReadyRef.current;
57
105
  prevReadyRef.current = nowReady;
58
106
  if (!wasReady && nowReady && queue.length > 0) {
59
107
  sendHeapMessages();
108
+ } else if (!nowReady && queue.length > 0) {
109
+ // The ready flag flips on the client without a re-render: poll.
110
+ scheduleRetry();
60
111
  }
61
- }, [client?.presencesReady, queue.length, sendHeapMessages]);
112
+ }, [client?.presencesReady, client?.priorityPresencesReady, queue.length, sendHeapMessages]);
62
113
  (0, _react.useEffect)(() => {
63
114
  const currentIds = new Set(queue.map(m => m.id));
64
115
  for (const id of Array.from(inFlightRef.current.keys())) {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","useHeapSender","client","dispatch","useDispatch","queue","useMessageHeapState","sendingRef","useRef","inFlightRef","Map","sendHeapMessages","useCallback","length","presencesReady","console","warn","current","msg","lastAttempt","get","id","Date","now","set","langSource","sendTextMessageWithTranslateTagStanza","roomJid","user","firstName","name","split","lastName","walletAddress","body","isReply","showInChannel","mainMessage","sendMessage","String","err","delete","prevReadyRef","useEffect","nowReady","wasReady","currentIds","Set","map","m","Array","from","keys","has","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeapSender.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAIO,MAAMG,aAAa,GAAIC,MAAyB,IAAK;EAC1D,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,wCAAmB,EAAC,CAAC;EACvC,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAChC,MAAMC,WAAW,GAAG,IAAAD,aAAM,EAAsB,IAAIE,GAAG,CAAC,CAAC,CAAC;EAE1D,MAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,YAAY;IAC/C,IAAI,CAACV,MAAM,IAAIG,KAAK,CAACQ,MAAM,KAAK,CAAC,EAAE;MAAC;IAAO;IAC3C,IAAI,CAACX,MAAM,CAACY,cAAc,EAAE;MAC1BC,OAAO,CAACC,IAAI,CAAC,yCAAyC,CAAC;MACvD;IACF;IACA,IAAIT,UAAU,CAACU,OAAO,EAAE;MAAC;IAAO;IAChCV,UAAU,CAACU,OAAO,GAAG,IAAI;IACzB,IAAI;MACF,KAAK,MAAMC,GAAG,IAAIb,KAAK,EAAE;QACvB,MAAMc,WAAW,GAAGV,WAAW,CAACQ,OAAO,CAACG,GAAG,CAACF,GAAG,CAACG,EAAE,CAAC;QACnD,IAAIF,WAAW,IAAIG,IAAI,CAACC,GAAG,CAAC,CAAC,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,CAAC,CAAC,EAAE;MACvD,IAAI,CAACN,UAAU,CAACO,GAAG,CAAChC,EAAE,CAAC,EAAE;QACvBZ,WAAW,CAACQ,OAAO,CAACwB,MAAM,CAACpB,EAAE,CAAC;MAChC;IACF;EACF,CAAC,EAAE,CAAChB,KAAK,CAAC,CAAC;EAEX,OAAO;IAAEM;EAAiB,CAAC;AAC7B,CAAC;AAAC2C,OAAA,CAAArD,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactRedux","_useMessageHeapState","isJoinReady","client","priority","priorityPresencesReady","presencesReady","RETRY_MS","useHeapSender","dispatch","useDispatch","queue","useMessageHeapState","sendingRef","useRef","inFlightRef","Map","retryTimerRef","sendRef","scheduleRetry","current","setTimeout","catch","undefined","sendHeapMessages","useCallback","length","console","warn","msg","lastAttempt","get","id","Date","now","joined","presenceInRoomStanza","roomJid","set","langSource","sendTextMessageWithTranslateTagStanza","user","firstName","name","split","lastName","walletAddress","body","isReply","showInChannel","mainMessage","sendMessage","String","err","delete","useEffect","clearTimeout","prevReadyRef","nowReady","wasReady","currentIds","Set","map","m","Array","from","keys","has","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeapSender.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAIA;AACA;AACA;AACA;AACA,MAAMG,WAAW,GAAIC,MAAyB,IAAc;EAC1D,IAAI,CAACA,MAAM,EAAE;IAAC,OAAO,KAAK;EAAC;EAC3B,MAAMC,QAAQ,GAAID,MAAM,CAASE,sBAAsB;EACvD,OAAO,OAAOD,QAAQ,KAAK,SAAS,GAAGA,QAAQ,GAAG,CAAC,CAACD,MAAM,CAACG,cAAc;AAC3E,CAAC;;AAED;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,IAAI;AAEd,MAAMC,aAAa,GAAIL,MAAyB,IAAK;EAC1D,MAAMM,QAA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ACrC,OAAO,GAAGsC,QAAQ;IAC/B,IAAI,CAACC,QAAQ,IAAID,QAAQ,IAAI/C,KAAK,CAACe,MAAM,GAAG,CAAC,EAAE;MAC7CF,gBAAgB,CAAC,CAAC;IACpB,CAAC,MAAM,IAAI,CAACkC,QAAQ,IAAI/C,KAAK,CAACe,MAAM,GAAG,CAAC,EAAE;MACxC;MACAP,aAAa,CAAC,CAAC;IACjB;EACF,CAAC,EAAE,CAAChB,MAAM,EAAEG,cAAc,EAAEH,MAAM,EAAEE,sBAAsB,EAAEM,KAAK,CAACe,MAAM,EAAEF,gBAAgB,CAAC,CAAC;EAE5F,IAAA+B,gBAAS,EAAC,MAAM;IACd,MAAMK,UAAU,GAAG,IAAIC,GAAG,CAAClD,KAAK,CAACmD,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAAC/B,EAAE,CAAC,CAAC;IAClD,KAAK,MAAMA,EAAE,IAAIgC,KAAK,CAACC,IAAI,CAAClD,WAAW,CAACK,OAAO,CAAC8C,IAAI,CAAC,CAAC,CAAC,EAAE;MACvD,IAAI,CAACN,UAAU,CAACO,GAAG,CAACnC,EAAE,CAAC,EAAE;QACvBjB,WAAW,CAACK,OAAO,CAACkC,MAAM,CAACtB,EAAE,CAAC;MAChC;IACF;EACF,CAAC,EAAE,CAACrB,KAAK,CAAC,CAAC;EAEX,OAAO;IAAEa;EAAiB,CAAC;AAC7B,CAAC;AAAC4C,OAAA,CAAA5D,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -0,0 +1,411 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "HIGHLIGHT_MS", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _bubbleHighlight.HIGHLIGHT_MS;
10
+ }
11
+ });
12
+ exports.JUMP_PAGE_SIZE = exports.HIGHLIGHT_SETTLE_MS = void 0;
13
+ Object.defineProperty(exports, "JUMP_TTL_MS", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _jumpThread.JUMP_TTL_MS;
17
+ }
18
+ });
19
+ exports.ROOM_OPENING_POLL_MS = exports.ROOM_OPENING_GRACE_MS = exports.NEAR_LIVE_MESSAGES = exports.MAX_WINDOW_RETRIES = exports.MAX_PAGE_FAILURES = exports.MAX_HISTORY_PAGES = void 0;
20
+ Object.defineProperty(exports, "findMessageIndex", {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _jumpThread.findMessageIndex;
24
+ }
25
+ });
26
+ exports.useJumpToMessage = useJumpToMessage;
27
+ var _react = require("react");
28
+ var _reactRedux = require("react-redux");
29
+ var _roomsSlice = require("../roomStore/roomsSlice");
30
+ var _toastEmitter = require("../utils/toastEmitter");
31
+ var _useT = require("../i18n/useT");
32
+ var _jumpThread = require("../helpers/jumpThread");
33
+ var _bubbleHighlight = require("../helpers/bubbleHighlight");
34
+ // How far back the paging fallback goes before giving up. A request may stay
35
+ // alive for JUMP_TTL_MS at all (a room that never finishes opening must not
36
+ // leave one armed to fire at some unrelated later moment).
37
+ const MAX_HISTORY_PAGES = exports.MAX_HISTORY_PAGES = 40;
38
+ const JUMP_PAGE_SIZE = exports.JUMP_PAGE_SIZE = 100;
39
+ // A page request that fails is retried this many times in a row before the
40
+ // history is treated as unreachable.
41
+ const MAX_PAGE_FAILURES = exports.MAX_PAGE_FAILURES = 3;
42
+ // A target already in the store and at most this far from the newest message
43
+ // is reached by scrolling the live list. Anything farther is fetched as a
44
+ // small window around it instead: re-merging a thousand rows to reach it is
45
+ // what made a far jump lag.
46
+ const NEAR_LIVE_MESSAGES = exports.NEAR_LIVE_MESSAGES = 300;
47
+ // A jump into a room that is still opening waits this long for its live list
48
+ // before it stops waiting for it and asks the archive directly.
49
+ const ROOM_OPENING_GRACE_MS = exports.ROOM_OPENING_GRACE_MS = 4000;
50
+ // Pause between checks while waiting for a room that is still opening, and
51
+ // how many times a window request that could not be asked is repeated.
52
+ const ROOM_OPENING_POLL_MS = exports.ROOM_OPENING_POLL_MS = 700;
53
+ const MAX_WINDOW_RETRIES = exports.MAX_WINDOW_RETRIES = 6;
54
+ // The highlight starts once the list has laid out the rows around the target
55
+ // and the scroll (with its retries, see MessageList) has settled.
56
+ const HIGHLIGHT_SETTLE_MS = exports.HIGHLIGHT_SETTLE_MS = 450;
57
+
58
+ /**
59
+ * How the attempt to open a window around the target went:
60
+ * - found: the window is in the store; the list now renders it;
61
+ * - missing: the server answered and the target is not in its archive;
62
+ * - unavailable: could not ask (no archive id, request failed): page instead.
63
+ */
64
+
65
+ /** What the server said about one page of older history. */
66
+
67
+ /**
68
+ * Fulfils a pending "scroll to this message" request for this room.
69
+ *
70
+ * The target can be in one of three places, tried in this order:
71
+ * 1. in the list (virtualised, so mounted or not does not matter) and not
72
+ * far from the newest message: scroll to its row, then highlight its
73
+ * bubble;
74
+ * 2. not loaded, or loaded but far back: fetch a short window of the archive
75
+ * around it (the list shows that instead of the live list) and scroll to
76
+ * it there;
77
+ * 3. no window possible (no archive id, request failed): page older history
78
+ * by the server's own cursor until it shows up or the history ends.
79
+ * If the server says the message is not in its archive, show the message
80
+ * itself in a card (a search hit always ends with the message on screen); a
81
+ * request with nothing to show says it could not be found.
82
+ *
83
+ * Exactly one list owns a request (see `scope`).
84
+ */
85
+ function useJumpToMessage({
86
+ roomJID,
87
+ messages,
88
+ listData,
89
+ scrollToIndex,
90
+ onHighlight,
91
+ loadMoreMessages,
92
+ fetchOlderPage,
93
+ historyComplete,
94
+ isUserAtBottomRef,
95
+ jumpWindowActive = false,
96
+ fetchWindow,
97
+ scope = 'main',
98
+ allMessages,
99
+ resolveReply,
100
+ roomOpening = false
101
+ }) {
102
+ const dispatch = (0, _reactRedux.useDispatch)();
103
+ const reduxStore = (0, _reactRedux.useStore)();
104
+ const t = (0, _useT.useT)();
105
+ const jump = (0, _reactRedux.useSelector)(state => state.rooms.pendingJump);
106
+ const jumpThread = (0, _jumpThread.useJumpThread)();
107
+ const ownerThreadId = (0, _jumpThread.ownerThreadFor)(jumpThread, jump?.at);
108
+ const scopeThreadId = scope === 'main' ? null : scope.threadId;
109
+ const isOwner = scopeThreadId === null ? ownerThreadId === null : ownerThreadId === scopeThreadId;
110
+ const attemptsRef = (0, _react.useRef)(0);
111
+ const loadingRef = (0, _react.useRef)(false);
112
+ // Callbacks that change identity on render live in a ref so they do not
113
+ // retrigger the effect below.
114
+ const latest = (0, _react.useRef)({
115
+ t,
116
+ loadMoreMessages,
117
+ fetchOlderPage,
118
+ scrollToIndex,
119
+ onHighlight,
120
+ fetchWindow,
121
+ resolveReply,
122
+ allMessages,
123
+ roomOpening
124
+ });
125
+ latest.current = {
126
+ t,
127
+ loadMoreMessages,
128
+ fetchOlderPage,
129
+ scrollToIndex,
130
+ onHighlight,
131
+ fetchWindow,
132
+ resolveReply,
133
+ allMessages,
134
+ roomOpening
135
+ };
136
+ const replyResolvedAtRef = (0, _react.useRef)(null);
137
+ const windowRetriesRef = (0, _react.useRef)(0);
138
+ // Per request: whether a window was already tried, and whether the server
139
+ // said the target does not exist.
140
+ const windowTriedAtRef = (0, _react.useRef)(null);
141
+ const windowMissingAtRef = (0, _react.useRef)(null);
142
+ const currentJumpAtRef = (0, _react.useRef)(null);
143
+ currentJumpAtRef.current = jump?.at ?? null;
144
+ // The request whose scroll is already scheduled. Re-runs of the effect must
145
+ // not schedule it a second time.
146
+ const scheduledAtRef = (0, _react.useRef)(null);
147
+ // Where the next page of older history starts: the server's cursor from the
148
+ // previous page, or (first page) the oldest of what the room already knows.
149
+ const cursorRef = (0, _react.useRef)(null);
150
+ // The server has nothing older, or paging stopped making progress.
151
+ const exhaustedRef = (0, _react.useRef)(false);
152
+ const failuresRef = (0, _react.useRef)(0);
153
+ const timersRef = (0, _react.useRef)({});
154
+ const [tick, setTick] = (0, _react.useState)(0);
155
+ (0, _react.useEffect)(() => () => {
156
+ const timers = timersRef.current;
157
+ if (timers.scroll) {
158
+ clearTimeout(timers.scroll);
159
+ }
160
+ if (timers.settle) {
161
+ clearTimeout(timers.settle);
162
+ }
163
+ if (timers.clear) {
164
+ clearTimeout(timers.clear);
165
+ }
166
+ if (timers.retry) {
167
+ clearTimeout(timers.retry);
168
+ }
169
+ }, []);
170
+
171
+ // A new request starts its own page budget.
172
+ (0, _react.useEffect)(() => {
173
+ attemptsRef.current = 0;
174
+ cursorRef.current = null;
175
+ exhaustedRef.current = false;
176
+ failuresRef.current = 0;
177
+ windowRetriesRef.current = 0;
178
+ }, [jump?.at]);
179
+ (0, _react.useEffect)(() => {
180
+ if (!jump || jump.roomJID !== roomJID || !isOwner) {
181
+ return;
182
+ }
183
+ isUserAtBottomRef.current = false;
184
+ const finish = reached => {
185
+ dispatch((0, _roomsSlice.clearPendingJump)());
186
+ if (reached) {
187
+ return;
188
+ }
189
+
190
+ // Not reachable in the transcript. If the request knows what the
191
+ // message says (every search hit does), show IT, so the tap always ends
192
+ // with the message in front of the reader and nothing that reads as an
193
+ // error. Only a jump with no message to show (a notification or a link)
194
+ // falls back to saying it could not be found.
195
+ if (jump.preview) {
196
+ dispatch((0, _roomsSlice.showArchivedMessage)(jump.preview));
197
+ return;
198
+ }
199
+ const {
200
+ t: tr
201
+ } = latest.current;
202
+ _toastEmitter.toastEmitter.emit({
203
+ id: `jump-to-message-missing-${Date.now()}`,
204
+ title: tr('search.messages.title'),
205
+ message: tr('search.messages.notFound'),
206
+ type: 'info'
207
+ });
208
+ };
209
+ if (Date.now() - jump.at > _jumpThread.JUMP_TTL_MS) {
210
+ // Expired, but the message is in the list: nothing is missing, so no
211
+ // "archived" card.
212
+ finish((0, _jumpThread.findMessageIndex)(messages, jump.ids, {
213
+ createdAt: jump.createdAt,
214
+ body: jump.body
215
+ }) >= 0);
216
+ return;
217
+ }
218
+
219
+ // Waiting on something the store will not announce (a room still opening):
220
+ // look again shortly. The TTL above bounds how long this can go on.
221
+ const recheckSoon = () => {
222
+ if (timersRef.current.retry) {
223
+ clearTimeout(timersRef.current.retry);
224
+ }
225
+ timersRef.current.retry = setTimeout(() => setTick(value => value + 1), ROOM_OPENING_POLL_MS);
226
+ };
227
+ const content = {
228
+ createdAt: jump.createdAt,
229
+ body: jump.body
230
+ };
231
+
232
+ // A target that is a thread reply is not in this (main) list at all: it
233
+ // lives in its parent's thread. Open that thread, which takes the jump over.
234
+ if (scopeThreadId === null && latest.current.resolveReply && replyResolvedAtRef.current !== jump.at) {
235
+ const pool = latest.current.allMessages ?? messages;
236
+ const rawIndex = (0, _jumpThread.findMessageIndex)(pool, jump.ids, content);
237
+ const raw = rawIndex >= 0 ? pool[rawIndex] : null;
238
+ if (raw && (0, _jumpThread.replyParentId)(raw)) {
239
+ replyResolvedAtRef.current = jump.at;
240
+ loadingRef.current = true;
241
+ const requestedAt = jump.at;
242
+ latest.current.resolveReply(jump, raw).catch(() => false).then(opened => {
243
+ loadingRef.current = false;
244
+ if (currentJumpAtRef.current !== requestedAt) {
245
+ return;
246
+ }
247
+ if (!opened) {
248
+ finish(false);
249
+ } else {
250
+ setTick(value => value + 1);
251
+ }
252
+ });
253
+ return;
254
+ }
255
+ }
256
+ const index = (0, _jumpThread.findMessageIndex)(messages, jump.ids, content);
257
+ const windowAvailable = Boolean(latest.current.fetchWindow) && windowTriedAtRef.current !== jump.at;
258
+ if (index >= 0 && (jumpWindowActive || messages.length - index <= NEAR_LIVE_MESSAGES || !windowAvailable)) {
259
+ const targetId = String(messages[index].id);
260
+ const rowIndex = listData.findIndex(message => String(message.id) === targetId);
261
+ // The list has not caught up with the messages yet: look again when it
262
+ // has (this effect re-runs with it).
263
+ if (rowIndex < 0) {
264
+ return;
265
+ }
266
+ if (scheduledAtRef.current === jump.at) {
267
+ return;
268
+ }
269
+ scheduledAtRef.current = jump.at;
270
+
271
+ // Next tick: let the list lay out whatever the room switch, page load or
272
+ // window just handed it before measuring against it. The highlight
273
+ // starts only after the scroll has settled, and its clock starts then.
274
+ timersRef.current.scroll = setTimeout(() => {
275
+ latest.current.scrollToIndex(rowIndex);
276
+ timersRef.current.settle = setTimeout(() => {
277
+ latest.current.onHighlight(targetId);
278
+ timersRef.current.clear = setTimeout(() => latest.current.onHighlight(null), _bubbleHighlight.HIGHLIGHT_MS);
279
+ }, HIGHLIGHT_SETTLE_MS);
280
+ }, 0);
281
+ finish(true);
282
+ return;
283
+ }
284
+
285
+ // A new request for a message outside the window now on screen: go back
286
+ // to the live list first (this effect re-runs with it).
287
+ if (jumpWindowActive) {
288
+ dispatch((0, _roomsSlice.clearJumpWindow)());
289
+ return;
290
+ }
291
+
292
+ // Not loaded, or loaded but far back. An empty list means the room is
293
+ // still opening: give its live list a moment (the target is usually in it),
294
+ // then ask the archive directly rather than wait for a history that can
295
+ // take ten seconds. The TTL above bounds all of it.
296
+ if (loadingRef.current) {
297
+ return;
298
+ }
299
+ if (messages.length === 0 && (!latest.current.fetchWindow || latest.current.roomOpening && Date.now() - jump.at < ROOM_OPENING_GRACE_MS)) {
300
+ recheckSoon();
301
+ return;
302
+ }
303
+ if (windowMissingAtRef.current === jump.at && index < 0) {
304
+ finish(false);
305
+ return;
306
+ }
307
+
308
+ // Fetch only a window around the target instead of paging the whole
309
+ // stretch of history between it and the live tail.
310
+ if (windowAvailable && latest.current.fetchWindow) {
311
+ windowTriedAtRef.current = jump.at;
312
+ loadingRef.current = true;
313
+ const requestedAt = jump.at;
314
+ latest.current.fetchWindow(jump).catch(() => 'unavailable').then(result => {
315
+ loadingRef.current = false;
316
+ if (currentJumpAtRef.current !== requestedAt) {
317
+ return;
318
+ }
319
+ if (result === 'missing') {
320
+ windowMissingAtRef.current = requestedAt;
321
+ }
322
+ if (result === 'unavailable' && latest.current.roomOpening && windowRetriesRef.current < MAX_WINDOW_RETRIES) {
323
+ // Could not ask yet (connection or room still coming up): ask
324
+ // again, instead of falling back to paging a room with no history.
325
+ windowRetriesRef.current += 1;
326
+ windowTriedAtRef.current = null;
327
+ recheckSoon();
328
+ return;
329
+ }
330
+ setTick(value => value + 1);
331
+ });
332
+ return;
333
+ }
334
+ if (messages.length === 0) {
335
+ recheckSoon();
336
+ return;
337
+ }
338
+ const firstReal = messages.find(message => !String(message.id).startsWith('delimiter-new'));
339
+ if (!firstReal) {
340
+ return;
341
+ }
342
+ if (exhaustedRef.current || historyComplete || attemptsRef.current >= MAX_HISTORY_PAGES) {
343
+ finish(false);
344
+ return;
345
+ }
346
+
347
+ // Page back through the archive by the server's own cursor. Each request
348
+ // resolves only once its page is in the store, so there is nothing to wait
349
+ // out and no guessing from the list: the answer to "is there more" is the
350
+ // server's, not "did the oldest displayed message change". The first page
351
+ // starts from the server cursor the room already holds when that is
352
+ // older than the oldest displayed message (a page of receipts displays
353
+ // nothing but still moved the cursor).
354
+ const oldestDisplayed = Number(firstReal.id);
355
+ const roomCursor = reduxStore.getState().rooms.rooms?.[roomJID]?.messageStats?.firstMessageTimestamp;
356
+ const startFrom = typeof roomCursor === 'number' && Number.isFinite(roomCursor) && (!Number.isFinite(oldestDisplayed) || roomCursor < oldestDisplayed) ? roomCursor : oldestDisplayed;
357
+ const before = cursorRef.current ?? startFrom;
358
+ if (!Number.isFinite(before)) {
359
+ finish(false);
360
+ return;
361
+ }
362
+ attemptsRef.current += 1;
363
+ loadingRef.current = true;
364
+ const fetchPage = latest.current.fetchOlderPage ?? (async (jid, from, max) => {
365
+ const loadMore = latest.current.loadMoreMessages;
366
+ if (!loadMore) {
367
+ return {
368
+ ok: false
369
+ };
370
+ }
371
+ await loadMore(jid, max, from);
372
+ const room = reduxStore.getState().rooms.rooms?.[jid];
373
+ return {
374
+ ok: true,
375
+ cursor: room?.messageStats?.firstMessageTimestamp,
376
+ complete: Boolean(room?.historyComplete)
377
+ };
378
+ });
379
+ fetchPage(roomJID, before, JUMP_PAGE_SIZE).catch(() => ({
380
+ ok: false
381
+ })).then(page => {
382
+ loadingRef.current = false;
383
+ if (!page.ok) {
384
+ // A room that is still opening cannot answer yet: that is not the
385
+ // history being unreachable, so it does not count.
386
+ if (latest.current.roomOpening) {
387
+ recheckSoon();
388
+ return;
389
+ }
390
+ failuresRef.current += 1;
391
+ if (failuresRef.current >= MAX_PAGE_FAILURES) {
392
+ exhaustedRef.current = true;
393
+ }
394
+ } else {
395
+ failuresRef.current = 0;
396
+ if (page.complete) {
397
+ exhaustedRef.current = true;
398
+ }
399
+ if (typeof page.cursor === 'number' && page.cursor < before) {
400
+ cursorRef.current = page.cursor;
401
+ } else if (!page.complete) {
402
+ // Same cursor back: this page made no progress, and asking again
403
+ // would repeat it forever.
404
+ exhaustedRef.current = true;
405
+ }
406
+ }
407
+ setTick(value => value + 1);
408
+ });
409
+ }, [jump, roomJID, messages, listData, historyComplete, jumpWindowActive, tick, isOwner, scopeThreadId, isUserAtBottomRef, dispatch, reduxStore]);
410
+ }
411
+ //# sourceMappingURL=useJumpToMessage.js.map