@ethora/chat-component-rn 26.9.1 → 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 (760) hide show
  1. package/CHANGELOG.md +30 -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 +31 -1
  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 +41 -77
  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 +288 -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 +31 -1
  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 +42 -78
  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 +288 -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.map +1 -1
  505. package/lib/typescript/helpers/audioWaveform.d.ts +54 -0
  506. package/lib/typescript/helpers/audioWaveform.d.ts.map +1 -0
  507. package/lib/typescript/helpers/backgroundJoinSweep.d.ts +14 -0
  508. package/lib/typescript/helpers/backgroundJoinSweep.d.ts.map +1 -0
  509. package/lib/typescript/helpers/bubbleHighlight.d.ts +17 -0
  510. package/lib/typescript/helpers/bubbleHighlight.d.ts.map +1 -0
  511. package/lib/typescript/helpers/checkUniqueUsers.d.ts +2 -2
  512. package/lib/typescript/helpers/checkUniqueUsers.d.ts.map +1 -1
  513. package/lib/typescript/helpers/constants/MODAL_COMPONENTS.d.ts.map +1 -1
  514. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts +2 -0
  515. package/lib/typescript/helpers/constants/MODAL_TYPES.d.ts.map +1 -1
  516. package/lib/typescript/helpers/createRoomFromApi.d.ts +25 -0
  517. package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
  518. package/lib/typescript/helpers/dedupeMembers.d.ts +11 -0
  519. package/lib/typescript/helpers/dedupeMembers.d.ts.map +1 -0
  520. package/lib/typescript/helpers/ethoraLogger.d.ts +13 -0
  521. package/lib/typescript/helpers/ethoraLogger.d.ts.map +1 -0
  522. package/lib/typescript/helpers/getUnnamedUsers.d.ts.map +1 -1
  523. package/lib/typescript/helpers/historyPreloadConfig.d.ts +26 -0
  524. package/lib/typescript/helpers/historyPreloadConfig.d.ts.map +1 -0
  525. package/lib/typescript/helpers/historyPreloadScheduler.d.ts +8 -4
  526. package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
  527. package/lib/typescript/helpers/initRoomsPresence.d.ts +7 -0
  528. package/lib/typescript/helpers/initRoomsPresence.d.ts.map +1 -1
  529. package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
  530. package/lib/typescript/helpers/isLikelyMucJid.d.ts +19 -0
  531. package/lib/typescript/helpers/isLikelyMucJid.d.ts.map +1 -0
  532. package/lib/typescript/helpers/isMessageSearchEnabled.d.ts +12 -0
  533. package/lib/typescript/helpers/isMessageSearchEnabled.d.ts.map +1 -0
  534. package/lib/typescript/helpers/joiningRoom.d.ts +7 -0
  535. package/lib/typescript/helpers/joiningRoom.d.ts.map +1 -0
  536. package/lib/typescript/helpers/jumpThread.d.ts +48 -0
  537. package/lib/typescript/helpers/jumpThread.d.ts.map +1 -0
  538. package/lib/typescript/helpers/jumpToMessage.d.ts +26 -0
  539. package/lib/typescript/helpers/jumpToMessage.d.ts.map +1 -0
  540. package/lib/typescript/helpers/jumpWindow.d.ts +74 -0
  541. package/lib/typescript/helpers/jumpWindow.d.ts.map +1 -0
  542. package/lib/typescript/helpers/loadRoomHistory.d.ts +34 -0
  543. package/lib/typescript/helpers/loadRoomHistory.d.ts.map +1 -0
  544. package/lib/typescript/helpers/notificationPolicy.d.ts +42 -0
  545. package/lib/typescript/helpers/notificationPolicy.d.ts.map +1 -0
  546. package/lib/typescript/helpers/openRoomAtMessage.d.ts +17 -0
  547. package/lib/typescript/helpers/openRoomAtMessage.d.ts.map +1 -0
  548. package/lib/typescript/helpers/openThreadForJump.d.ts +27 -0
  549. package/lib/typescript/helpers/openThreadForJump.d.ts.map +1 -0
  550. package/lib/typescript/helpers/parseMessageReference.d.ts +18 -5
  551. package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -1
  552. package/lib/typescript/helpers/publicChatsEntry.d.ts +11 -0
  553. package/lib/typescript/helpers/publicChatsEntry.d.ts.map +1 -0
  554. package/lib/typescript/helpers/roomActivityScore.d.ts +5 -0
  555. package/lib/typescript/helpers/roomActivityScore.d.ts.map +1 -0
  556. package/lib/typescript/helpers/roomUserCount.d.ts +20 -0
  557. package/lib/typescript/helpers/roomUserCount.d.ts.map +1 -0
  558. package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts +21 -0
  559. package/lib/typescript/helpers/runConfiguredHistoryPreload.d.ts.map +1 -0
  560. package/lib/typescript/helpers/sessionAppId.d.ts +8 -0
  561. package/lib/typescript/helpers/sessionAppId.d.ts.map +1 -0
  562. package/lib/typescript/helpers/timestamp.d.ts +3 -0
  563. package/lib/typescript/helpers/timestamp.d.ts.map +1 -0
  564. package/lib/typescript/helpers/userResolver.d.ts +58 -0
  565. package/lib/typescript/helpers/userResolver.d.ts.map +1 -0
  566. package/lib/typescript/helpers/xmppIdShape.d.ts +10 -0
  567. package/lib/typescript/helpers/xmppIdShape.d.ts.map +1 -0
  568. package/lib/typescript/hooks/useChatWrapperInit.d.ts +2 -0
  569. package/lib/typescript/hooks/useChatWrapperInit.d.ts.map +1 -1
  570. package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
  571. package/lib/typescript/hooks/useJumpToMessage.d.ts +116 -0
  572. package/lib/typescript/hooks/useJumpToMessage.d.ts.map +1 -0
  573. package/lib/typescript/hooks/useMessageLoaderQueue.d.ts.map +1 -1
  574. package/lib/typescript/hooks/useMessageQueue.d.ts.map +1 -1
  575. package/lib/typescript/hooks/useRoomDirectory.d.ts +12 -0
  576. package/lib/typescript/hooks/useRoomDirectory.d.ts.map +1 -0
  577. package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
  578. package/lib/typescript/hooks/useRoomMute.d.ts +8 -0
  579. package/lib/typescript/hooks/useRoomMute.d.ts.map +1 -0
  580. package/lib/typescript/hooks/useRoomState.d.ts +1 -0
  581. package/lib/typescript/hooks/useRoomState.d.ts.map +1 -1
  582. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  583. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  584. package/lib/typescript/networking/api-requests/messageSearch.api.d.ts +57 -0
  585. package/lib/typescript/networking/api-requests/messageSearch.api.d.ts.map +1 -0
  586. package/lib/typescript/networking/api-requests/publicChats.api.d.ts +24 -0
  587. package/lib/typescript/networking/api-requests/publicChats.api.d.ts.map +1 -0
  588. package/lib/typescript/networking/api-requests/roomMembers.api.d.ts +19 -1
  589. package/lib/typescript/networking/api-requests/roomMembers.api.d.ts.map +1 -1
  590. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  591. package/lib/typescript/networking/api-requests/xmppToken.api.d.ts +2 -0
  592. package/lib/typescript/networking/api-requests/xmppToken.api.d.ts.map +1 -0
  593. package/lib/typescript/networking/ethoraEvents.d.ts +45 -0
  594. package/lib/typescript/networking/ethoraEvents.d.ts.map +1 -0
  595. package/lib/typescript/networking/stanzaHandlers.d.ts +1 -1
  596. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  597. package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts +32 -1
  598. package/lib/typescript/networking/xmpp/allRoomPresences.xmpp.d.ts.map +1 -1
  599. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +64 -0
  600. package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
  601. package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
  602. package/lib/typescript/networking/xmpp/historyCursor.d.ts +35 -0
  603. package/lib/typescript/networking/xmpp/historyCursor.d.ts.map +1 -0
  604. package/lib/typescript/networking/xmpp/mamQueryIds.d.ts +10 -0
  605. package/lib/typescript/networking/xmpp/mamQueryIds.d.ts.map +1 -0
  606. package/lib/typescript/networking/xmpp/mamRouter.d.ts +7 -0
  607. package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -1
  608. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +13 -2
  609. package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
  610. package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts +82 -0
  611. package/lib/typescript/networking/xmpp/roomJoinSweep.d.ts.map +1 -0
  612. package/lib/typescript/networking/xmpp/sendMediaMessage.xmpp.d.ts.map +1 -1
  613. package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
  614. package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
  615. package/lib/typescript/networking/xmppClient.d.ts +90 -4
  616. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  617. package/lib/typescript/networking/xmppCredentials.d.ts +12 -0
  618. package/lib/typescript/networking/xmppCredentials.d.ts.map +1 -0
  619. package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts +3 -0
  620. package/lib/typescript/roomStore/Middleware/jumpThreadMiddleware.d.ts.map +1 -0
  621. package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
  622. package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
  623. package/lib/typescript/roomStore/chatSettingsSlice.d.ts +8 -1
  624. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  625. package/lib/typescript/roomStore/index.d.ts +2 -1
  626. package/lib/typescript/roomStore/index.d.ts.map +1 -1
  627. package/lib/typescript/roomStore/persistence.d.ts +8 -0
  628. package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
  629. package/lib/typescript/roomStore/roomsSlice.d.ts +138 -2
  630. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  631. package/lib/typescript/roomStore/safeKey.d.ts +13 -0
  632. package/lib/typescript/roomStore/safeKey.d.ts.map +1 -0
  633. package/lib/typescript/roomStore/usersSetCap.d.ts +16 -0
  634. package/lib/typescript/roomStore/usersSetCap.d.ts.map +1 -0
  635. package/lib/typescript/types/models/media.model.d.ts +2 -0
  636. package/lib/typescript/types/models/media.model.d.ts.map +1 -1
  637. package/lib/typescript/types/models/room.model.d.ts +18 -5
  638. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  639. package/lib/typescript/types/models/xmpp.model.d.ts +8 -1
  640. package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
  641. package/lib/typescript/types/types.d.ts +88 -5
  642. package/lib/typescript/types/types.d.ts.map +1 -1
  643. package/lib/typescript/version.d.ts +1 -1
  644. package/lib/typescript/version.d.ts.map +1 -1
  645. package/package.json +1 -1
  646. package/src/assets/icons.tsx +13 -0
  647. package/src/components/Header/HeaderRoomList.tsx +21 -4
  648. package/src/components/InputComponents/Search.tsx +33 -0
  649. package/src/components/MainComponents/ArchivedMessageCard.tsx +139 -0
  650. package/src/components/MainComponents/ChatHeader.tsx +19 -3
  651. package/src/components/MainComponents/ChatRoom.tsx +60 -23
  652. package/src/components/MainComponents/ChatWrapper.tsx +23 -4
  653. package/src/components/MainComponents/MediaMessage.tsx +17 -0
  654. package/src/components/MainComponents/MessageList.tsx +823 -84
  655. package/src/components/MainComponents/MessageSearchButton.tsx +48 -0
  656. package/src/components/MainComponents/ReduxWrapper.tsx +16 -5
  657. package/src/components/MainComponents/RoomList.tsx +125 -0
  658. package/src/components/Menu/HeaderRoomListMenu.tsx +26 -2
  659. package/src/components/MessageBubble/BubbleHighlight.tsx +106 -0
  660. package/src/components/MessageBubble/Message.tsx +265 -177
  661. package/src/components/MessageBubble/MessageInteractions.tsx +109 -86
  662. package/src/components/MessageBubble/messageMenuLayout.ts +59 -0
  663. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +92 -21
  664. package/src/components/Modals/MessageSearchModal/MessageHitResults.tsx +271 -0
  665. package/src/components/Modals/MessageSearchModal/MessageSearchModal.tsx +487 -0
  666. package/src/components/Modals/MessageSearchModal/openHit.ts +50 -0
  667. package/src/components/Modals/MessageSearchModal/resolveSender.ts +57 -0
  668. package/src/components/Modals/MessageSearchModal/searchFilters.ts +109 -0
  669. package/src/components/Modals/MessageSearchModal/snippet.ts +58 -0
  670. package/src/components/Modals/MessageSearchModal/useMessageSearch.ts +151 -0
  671. package/src/components/Modals/PublicChatsModal/PublicChatsModal.tsx +288 -0
  672. package/src/components/Modals/PublicChatsModal/publicChatsLogic.ts +36 -0
  673. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +8 -1
  674. package/src/components/RoomComponents/ChatRoomItem.tsx +16 -3
  675. package/src/components/RoomComponents/SwipeableRoomRow.tsx +39 -6
  676. package/src/components/Thread/ThreadHeader.tsx +3 -1
  677. package/src/components/Thread/ThreadWrapper.tsx +96 -10
  678. package/src/components/styled/AudioDecoderHost.tsx +351 -0
  679. package/src/components/styled/AudioMessage.tsx +482 -425
  680. package/src/components/styled/SendInput.tsx +42 -4
  681. package/src/context/MessageNotificationContext.tsx +19 -5
  682. package/src/context/xmppProvider.tsx +44 -91
  683. package/src/helpers/audioWaveform.ts +142 -0
  684. package/src/helpers/backgroundJoinSweep.ts +35 -0
  685. package/src/helpers/bubbleHighlight.ts +47 -0
  686. package/src/helpers/checkUniqueUsers.tsx +15 -17
  687. package/src/helpers/constants/MODAL_COMPONENTS.tsx +4 -0
  688. package/src/helpers/constants/MODAL_TYPES.ts +3 -0
  689. package/src/helpers/createRoomFromApi.tsx +45 -4
  690. package/src/helpers/dedupeMembers.ts +29 -0
  691. package/src/helpers/ethoraLogger.ts +50 -0
  692. package/src/helpers/getUnnamedUsers.ts +7 -4
  693. package/src/helpers/historyPreloadConfig.ts +68 -0
  694. package/src/helpers/historyPreloadScheduler.ts +437 -199
  695. package/src/helpers/initRoomsPresence.ts +20 -7
  696. package/src/helpers/insertMessageWithDelimiter.ts +3 -0
  697. package/src/helpers/isLikelyMucJid.ts +72 -0
  698. package/src/helpers/isMessageSearchEnabled.ts +18 -0
  699. package/src/helpers/joiningRoom.ts +13 -0
  700. package/src/helpers/jumpThread.ts +102 -0
  701. package/src/helpers/jumpToMessage.ts +57 -0
  702. package/src/helpers/jumpWindow.ts +212 -0
  703. package/src/helpers/loadRoomHistory.ts +83 -0
  704. package/src/helpers/notificationPolicy.ts +82 -0
  705. package/src/helpers/openRoomAtMessage.ts +38 -0
  706. package/src/helpers/openThreadForJump.ts +96 -0
  707. package/src/helpers/parseMessageReference.ts +37 -8
  708. package/src/helpers/publicChatsEntry.ts +15 -0
  709. package/src/helpers/roomActivityScore.ts +45 -0
  710. package/src/helpers/roomUserCount.ts +44 -0
  711. package/src/helpers/runConfiguredHistoryPreload.ts +76 -0
  712. package/src/helpers/sessionAppId.ts +17 -0
  713. package/src/helpers/timestamp.ts +44 -0
  714. package/src/helpers/userResolver.ts +542 -0
  715. package/src/helpers/xmppIdShape.ts +46 -0
  716. package/src/hooks/useChatWrapperInit.ts +22 -4
  717. package/src/hooks/useHeapSender.tsx +54 -3
  718. package/src/hooks/useJumpToMessage.ts +538 -0
  719. package/src/hooks/useMessageLoaderQueue.tsx +40 -4
  720. package/src/hooks/useMessageQueue.ts +9 -5
  721. package/src/hooks/useRoomDirectory.ts +39 -0
  722. package/src/hooks/useRoomInitialization.tsx +33 -7
  723. package/src/hooks/useRoomMute.ts +42 -0
  724. package/src/hooks/useRoomState.tsx +6 -0
  725. package/src/hooks/useSendMessage.tsx +14 -2
  726. package/src/i18n/strings.ts +282 -0
  727. package/src/networking/api-requests/messageSearch.api.ts +130 -0
  728. package/src/networking/api-requests/publicChats.api.ts +71 -0
  729. package/src/networking/api-requests/roomMembers.api.ts +263 -11
  730. package/src/networking/api-requests/rooms.api.ts +52 -12
  731. package/src/networking/api-requests/xmppToken.api.ts +62 -0
  732. package/src/networking/ethoraEvents.ts +262 -0
  733. package/src/networking/stanzaHandlers.ts +145 -19
  734. package/src/networking/xmpp/allRoomPresences.xmpp.ts +155 -5
  735. package/src/networking/xmpp/getHistory.xmpp.ts +433 -47
  736. package/src/networking/xmpp/handleStanzas.xmpp.ts +8 -0
  737. package/src/networking/xmpp/historyCursor.ts +124 -0
  738. package/src/networking/xmpp/mamQueryIds.ts +11 -0
  739. package/src/networking/xmpp/mamRouter.ts +24 -10
  740. package/src/networking/xmpp/presenceInRoom.xmpp.ts +91 -68
  741. package/src/networking/xmpp/roomJoinSweep.ts +412 -0
  742. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +0 -1
  743. package/src/networking/xmpp/sendTextMessage.xmpp.ts +0 -1
  744. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +0 -1
  745. package/src/networking/xmppClient.ts +323 -47
  746. package/src/networking/xmppCredentials.ts +87 -0
  747. package/src/roomStore/Middleware/jumpThreadMiddleware.ts +163 -0
  748. package/src/roomStore/Middleware/reactionsMiddleware.tsx +4 -0
  749. package/src/roomStore/Middleware/unreadMidlleware.tsx +59 -11
  750. package/src/roomStore/chatSettingsSlice.ts +11 -0
  751. package/src/roomStore/index.ts +10 -3
  752. package/src/roomStore/persistence.ts +54 -0
  753. package/src/roomStore/roomsSlice.ts +547 -65
  754. package/src/roomStore/safeKey.ts +49 -0
  755. package/src/roomStore/usersSetCap.ts +37 -0
  756. package/src/types/models/media.model.ts +4 -0
  757. package/src/types/models/room.model.ts +18 -5
  758. package/src/types/models/xmpp.model.ts +15 -1
  759. package/src/types/types.ts +93 -5
  760. package/src/version.ts +1 -1
@@ -0,0 +1,503 @@
1
+ "use strict";
2
+
3
+ import http from '../networking/apiClient';
4
+ import { lookupUser, resetUserLookupRoute } from '../networking/api-requests/roomMembers.api';
5
+ import { dedupeMembers } from './dedupeMembers';
6
+ import { store } from '../roomStore';
7
+ import { mergeUsersSet } from '../roomStore/roomsSlice';
8
+ import { updateUser } from '../roomStore/chatSettingsSlice';
9
+ import { isSafeKey, hasSafeIdSegments } from '../roomStore/safeKey';
10
+ import { normalizeXmppUsername } from './xmppUsername';
11
+ import { toLocalPart } from './xmppIdShape';
12
+ import { getSessionAppId } from './sessionAppId';
13
+
14
+ // Lazy user resolution.
15
+ //
16
+ // GET /v1/chats/my returns at most 30 members of a big room (plus
17
+ // `usersCnt`), so senders of older messages are unknown to usersSet. The
18
+ // source of truth for a name is the backend user record, fetched here:
19
+ // - one user: GET /v1/apps/users/<appId_userId>, falling back to
20
+ // GET /v2/chats/users?xmppUsername=<appId_userId> when the backend does
21
+ // not take our token on v1 (see lookupUser in roomMembers.api.ts)
22
+ // - GET /v2/chats/users?chatName=<roomLocal>&limit=500 a room directory
23
+ // Results go into rooms.usersSet through mergeUsersSet (names render from
24
+ // usersSet at render time, so nothing else needs rewriting). Only display fields are kept: the
25
+ // endpoint also returns email and tags, which must never reach the
26
+ // persisted usersSet.
27
+
28
+ const DEBOUNCE_MS = 150;
29
+ const CONCURRENCY = 4;
30
+ const SINGLE_FETCH_LIMIT = 10;
31
+ const MAX_PENDING = 200;
32
+ const NOT_FOUND_TTL_MS = 10 * 60_000;
33
+ const BACKOFF_STEPS_MS = [5_000, 30_000];
34
+ const DIRECTORY_PAGE_LIMIT = 500;
35
+ const DIRECTORY_MAX_PAGES = 200;
36
+ const DIRECTORY_MAX_STALE_PAGES = 5;
37
+ const INSERT_BUFFER_MS = 100;
38
+ let generation = 0;
39
+ const pending = new Set();
40
+ const inflight = new Set();
41
+ const negative = new Map();
42
+ let debounceTimer = null;
43
+ let activeWorkers = 0;
44
+ const queue = [];
45
+ let insertBuffer = [];
46
+ const refreshTimers = new Map();
47
+ const refreshAgain = new Set();
48
+ // ids whose in-progress fetch was asked for by refreshUser
49
+ const refreshForced = new Set();
50
+ let insertTimer = null;
51
+ const dirState = new Map();
52
+ const dirInflight = new Map();
53
+ // A failed directory is not retried for a while: without this a dead
54
+ // endpoint turned every debounce pass into another directory request.
55
+ const DIRECTORY_RETRY_MS = 30_000;
56
+ const dirFailedAt = new Map();
57
+ const dirCoolingDown = jid => Date.now() - (dirFailedAt.get(jid) ?? -Infinity) < DIRECTORY_RETRY_MS;
58
+ // The directory members of each room in server order, grown page by page.
59
+ const dirMembers = new Map();
60
+ const listeners = new Set();
61
+ const notify = () => {
62
+ listeners.forEach(l => {
63
+ try {
64
+ l();
65
+ } catch {
66
+ // a broken subscriber must not stop the others
67
+ }
68
+ });
69
+ };
70
+
71
+ /** Re-render hook: called when a directory state or a negative cache entry changes. */
72
+ export const subscribeUserResolver = listener => {
73
+ listeners.add(listener);
74
+ return () => {
75
+ listeners.delete(listener);
76
+ };
77
+ };
78
+ let sessionIdentity = '';
79
+
80
+ /**
81
+ * The signed-in account is the session identity: when another account signs
82
+ * in, every cache and in-flight result of the previous one is dropped (a
83
+ * token refresh for the same account must not). No token (logout, or a
84
+ * transient rehydrate gap) just yields '' and does no work.
85
+ */
86
+ const getToken = () => {
87
+ const u = store.getState().chatSettingStore?.user;
88
+ const token = u?.token || '';
89
+ const identity = String(u?.xmppUsername || u?._id || '');
90
+ if (token && identity && sessionIdentity && identity !== sessionIdentity) {
91
+ resetUserResolver();
92
+ }
93
+ if (token && identity) sessionIdentity = identity;
94
+ return token;
95
+ };
96
+
97
+ /** `appId_userId@host/res`, `appId_userId`, or a doubled prefix -> `appId_userId`. */
98
+ const normalizeId = raw => {
99
+ if (typeof raw !== 'string') return '';
100
+ const local = toLocalPart(raw.split('/')[0]).trim();
101
+ if (!local || local === 'undefined') return '';
102
+ return normalizeXmppUsername(local);
103
+ };
104
+ const isLookupable = id => {
105
+ if (!id || /\s/.test(id) || !isSafeKey(id)) return false;
106
+ // Only appId_userId shaped ids can exist on the backend.
107
+ if (!id.includes('_')) return false;
108
+ if (!hasSafeIdSegments(id)) return false;
109
+ const appId = getSessionAppId();
110
+ if (appId && (id === appId || id === `${appId}_${appId}`)) return false;
111
+ return true;
112
+ };
113
+ const sanitizeUser = (raw, fallbackId) => {
114
+ if (!raw || typeof raw !== 'object') return null;
115
+ const xmppUsername = normalizeId(raw.xmppUsername) || fallbackId || '';
116
+ if (!isSafeKey(xmppUsername)) return null;
117
+ const user = {
118
+ _id: String(raw._id ?? ''),
119
+ xmppUsername,
120
+ firstName: typeof raw.firstName === 'string' ? raw.firstName : '',
121
+ lastName: typeof raw.lastName === 'string' ? raw.lastName : ''
122
+ };
123
+ if (typeof raw.profileImage === 'string' && raw.profileImage) {
124
+ user.profileImage = raw.profileImage;
125
+ }
126
+ return user;
127
+ };
128
+
129
+ // One dispatch for the whole batch. Display fields are laid over whatever the
130
+ // entry already carries (role, jid, ...) so a lookup never strips what the
131
+ // REST member list put there. RN renders names from usersSet at render time,
132
+ // so no message rewrite is needed.
133
+ const insertIntoUsersSet = users => {
134
+ if (!users.length) return;
135
+ const existing = store.getState().rooms?.usersSet || {};
136
+ const members = {};
137
+ for (const u of users) {
138
+ if (!isSafeKey(u?.xmppUsername)) continue;
139
+ members[u.xmppUsername] = {
140
+ ...(existing[u.xmppUsername] || {}),
141
+ ...u
142
+ };
143
+ }
144
+ if (Object.keys(members).length) store.dispatch(mergeUsersSet({
145
+ members
146
+ }));
147
+ };
148
+ const flushInserts = () => {
149
+ if (insertTimer) {
150
+ clearTimeout(insertTimer);
151
+ insertTimer = null;
152
+ }
153
+ if (!insertBuffer.length) return;
154
+ const batch = insertBuffer;
155
+ insertBuffer = [];
156
+ insertIntoUsersSet(batch);
157
+ };
158
+ const bufferInsert = users => {
159
+ if (!users.length) return;
160
+ insertBuffer.push(...users);
161
+ if (!insertTimer) insertTimer = setTimeout(flushInserts, INSERT_BUFFER_MS);
162
+ };
163
+ const markNegative = (id, kind) => {
164
+ const prev = negative.get(id);
165
+ const attempts = (prev?.kind === 'error' ? prev.attempts : 0) + 1;
166
+ const ttl = kind !== 'error' ? NOT_FOUND_TTL_MS : BACKOFF_STEPS_MS[Math.min(attempts - 1, BACKOFF_STEPS_MS.length - 1)];
167
+ negative.set(id, {
168
+ until: Date.now() + ttl,
169
+ kind,
170
+ attempts
171
+ });
172
+ };
173
+ const isNegative = id => {
174
+ const n = negative.get(id);
175
+ if (!n) return false;
176
+ if (n.until <= Date.now()) {
177
+ // keep an expired error entry so attempts keep escalating the backoff
178
+ if (n.kind !== 'error') negative.delete(id);
179
+ return false;
180
+ }
181
+ return true;
182
+ };
183
+
184
+ /**
185
+ * True for an id the backend answered 404 for: the user really is gone.
186
+ * (An id merely not resolved yet is NOT "not found".)
187
+ */
188
+ export const isUserNotFound = rawId => {
189
+ const n = negative.get(normalizeId(rawId));
190
+ return Boolean(n && n.kind === 'notfound' && n.until > Date.now());
191
+ };
192
+
193
+ /**
194
+ * Where a sender's lookup stands, for the display chain:
195
+ * - resolved: in usersSet
196
+ * - pending: queued, in flight, or not requested yet (a bubble just mounted)
197
+ * - notfound / forbidden: the backend answered, nothing to show from it
198
+ * - failed: the last attempt errored (backoff), or the lookup is exhausted
199
+ * - unavailable: this id can never be looked up (plain handle) or there is
200
+ * no session token, so nothing is coming
201
+ */
202
+
203
+ export const getUserLookupStatus = rawId => {
204
+ const id = normalizeId(rawId);
205
+ if (!id) return 'unavailable';
206
+ if (store.getState().rooms?.usersSet?.[id]) return 'resolved';
207
+ const n = negative.get(id);
208
+ // an answer recorded a moment ago wins over the in-flight bookkeeping that
209
+ // is cleared right after it
210
+ if (n && isNegative(id)) return n.kind === 'error' ? 'failed' : n.kind;
211
+ if (pending.has(id) || inflight.has(id) || queue.includes(id)) {
212
+ return 'pending';
213
+ }
214
+ if (n && n.kind === 'error') return 'failed';
215
+ if (!isLookupable(id) || !getToken()) return 'unavailable';
216
+ return 'pending';
217
+ };
218
+
219
+ // A refreshed profile that is the signed-in user's own also updates the
220
+ // session user (chatSettingStore.user), which feeds the own-profile UI.
221
+ // Only the display fields, and only when something actually changed.
222
+ const applyToSessionUser = (id, fresh) => {
223
+ const me = store.getState().chatSettingStore?.user;
224
+ if (!me || normalizeId(me.xmppUsername) !== id) return;
225
+ const updates = {};
226
+ if (fresh.firstName !== undefined && fresh.firstName !== me.firstName) {
227
+ updates.firstName = fresh.firstName;
228
+ }
229
+ if (fresh.lastName !== undefined && fresh.lastName !== me.lastName) {
230
+ updates.lastName = fresh.lastName;
231
+ }
232
+ if (fresh.profileImage && fresh.profileImage !== me.profileImage) {
233
+ updates.profileImage = fresh.profileImage;
234
+ }
235
+ if (Object.keys(updates).length) store.dispatch(updateUser({
236
+ updates
237
+ }));
238
+ };
239
+ const fetchOne = async (id, gen) => {
240
+ const token = getToken();
241
+ if (!token) return;
242
+ const outcome = await lookupUser(id, token);
243
+ if (gen !== generation) return;
244
+ if (outcome.status === 'ok') {
245
+ const user = sanitizeUser(outcome.user, id);
246
+ if (user) {
247
+ negative.delete(id);
248
+ bufferInsert([user]);
249
+ if (refreshForced.delete(id)) applyToSessionUser(id, user);
250
+ return;
251
+ }
252
+ markNegative(id, 'notfound');
253
+ } else {
254
+ markNegative(id, outcome.status);
255
+ }
256
+ notify();
257
+ };
258
+ const pump = gen => {
259
+ while (activeWorkers < CONCURRENCY && queue.length) {
260
+ const id = queue.shift();
261
+ activeWorkers++;
262
+ inflight.add(id);
263
+ fetchOne(id, gen).finally(() => {
264
+ if (gen !== generation) return;
265
+ inflight.delete(id);
266
+ activeWorkers--;
267
+ // a refresh asked for while this fetch was running: its answer may
268
+ // predate the change, so fetch once more
269
+ if (refreshAgain.delete(id) && !queue.includes(id)) queue.push(id);
270
+ if (queue.length) pump(gen);else if (activeWorkers === 0) flushInserts();
271
+ });
272
+ }
273
+ };
274
+ const knownUsers = () => store.getState().rooms?.usersSet || {};
275
+
276
+ /** The room, if any, whose unknown senders among `ids` justify one directory fetch. */
277
+ const pickDirectoryRoom = ids => {
278
+ const idSet = new Set(ids);
279
+ const rooms = store.getState().rooms?.rooms || {};
280
+ let best = null;
281
+ let bestCount = SINGLE_FETCH_LIMIT;
282
+ for (const [jid, room] of Object.entries(rooms)) {
283
+ const cnt = Number(room?.usersCnt || 0);
284
+ const have = Array.isArray(room?.members) ? room.members.length : 0;
285
+ if (!(have < cnt) || dirState.get(jid) === 'done' || dirCoolingDown(jid)) {
286
+ continue;
287
+ }
288
+ const seen = new Set();
289
+ for (const m of room.messages || []) {
290
+ const uid = normalizeId(m?.user?.id);
291
+ if (uid && idSet.has(uid)) seen.add(uid);
292
+ }
293
+ if (seen.size > bestCount) {
294
+ best = jid;
295
+ bestCount = seen.size;
296
+ }
297
+ }
298
+ return best;
299
+ };
300
+ const flush = () => {
301
+ debounceTimer = null;
302
+ const gen = generation;
303
+ const users = knownUsers();
304
+ const ids = [...pending].filter(id => !users[id] && !inflight.has(id) && !isNegative(id));
305
+ pending.clear();
306
+ if (!ids.length) return;
307
+ if (ids.length > SINGLE_FETCH_LIMIT) {
308
+ const roomJid = pickDirectoryRoom(ids);
309
+ if (roomJid) {
310
+ ensureRoomDirectory(roomJid).then(() => {
311
+ if (gen !== generation) return;
312
+ // whoever the directory did not contain (left the room) still gets
313
+ // the per-user lookup
314
+ requestUsers(ids);
315
+ });
316
+ return;
317
+ }
318
+ }
319
+ for (const id of ids) if (!queue.includes(id)) queue.push(id);
320
+ pump(gen);
321
+ };
322
+
323
+ /**
324
+ * Ask for the profiles of these senders. Cheap to call from anywhere (a
325
+ * bubble mounting, a history batch parse): known, in-flight and recently
326
+ * failed ids are dropped, the rest are debounced into one pass.
327
+ */
328
+ export function requestUsers(ids) {
329
+ if (!Array.isArray(ids) || !ids.length) return;
330
+ if (!getToken()) return;
331
+ const users = knownUsers();
332
+ let added = false;
333
+ for (const raw of ids) {
334
+ const id = normalizeId(raw);
335
+ if (!isLookupable(id)) continue;
336
+ if (users[id] || inflight.has(id) || pending.has(id) || isNegative(id)) {
337
+ continue;
338
+ }
339
+ pending.add(id);
340
+ added = true;
341
+ if (pending.size > MAX_PENDING) {
342
+ // drop the oldest
343
+ const oldest = pending.values().next().value;
344
+ pending.delete(oldest);
345
+ }
346
+ }
347
+ if (!added) return;
348
+ if (debounceTimer) clearTimeout(debounceTimer);
349
+ debounceTimer = setTimeout(flush, DEBOUNCE_MS);
350
+ }
351
+ const REFRESH_DEBOUNCE_MS = 500;
352
+
353
+ /**
354
+ * Re-fetch one user's profile even though it is already in usersSet, because
355
+ * the server said it changed (ethora-event user-profile-updated). Bypasses
356
+ * the cache and forgets a negative-cache entry, but shares everything else
357
+ * with requestUsers: the same route chain (lookupUser), the same worker
358
+ * queue and concurrency cap, one request at a time per user. Calls for the
359
+ * same user within REFRESH_DEBOUNCE_MS coalesce into one fetch. The answer
360
+ * goes through mergeUsersSet (display fields only), so existing bubbles are
361
+ * re-named. Never throws.
362
+ */
363
+ export function refreshUser(rawId) {
364
+ const id = normalizeId(rawId);
365
+ if (!isLookupable(id) || !getToken()) return;
366
+ const prior = refreshTimers.get(id);
367
+ if (prior) clearTimeout(prior);
368
+ const gen = generation;
369
+ refreshTimers.set(id, setTimeout(() => {
370
+ refreshTimers.delete(id);
371
+ if (gen !== generation) return;
372
+ negative.delete(id);
373
+ refreshForced.add(id);
374
+ if (inflight.has(id)) {
375
+ refreshAgain.add(id);
376
+ return;
377
+ }
378
+ if (!queue.includes(id)) queue.push(id);
379
+ pump(gen);
380
+ }, REFRESH_DEBOUNCE_MS));
381
+ }
382
+ const EMPTY_DIRECTORY = [];
383
+
384
+ /**
385
+ * Members loaded so far by ensureRoomDirectory for this room (a new array
386
+ * identity after every page, a stable empty array before any).
387
+ */
388
+ export const getRoomDirectoryMembers = roomJID => dirMembers.get(roomJID) || EMPTY_DIRECTORY;
389
+
390
+ /** requestUsers for the senders of a batch of messages (history page, jump window). */
391
+ export function requestSendersOf(messages) {
392
+ if (!messages?.length) return;
393
+ const ids = new Set();
394
+ for (const m of messages) {
395
+ const id = m?.user?.id;
396
+ if (id) ids.add(id);
397
+ }
398
+ if (ids.size) requestUsers([...ids]);
399
+ }
400
+ export const getRoomDirectoryState = roomJID => dirState.get(roomJID) || 'idle';
401
+ const setDirState = (roomJID, state) => {
402
+ if (dirState.get(roomJID) === state) return;
403
+ dirState.set(roomJID, state);
404
+ notify();
405
+ };
406
+
407
+ /**
408
+ * Loads every member of one room into usersSet, once. Pages are not
409
+ * guaranteed to be full, so it stops on an empty page or offset >= total,
410
+ * never on `items.length < limit`.
411
+ */
412
+ export function ensureRoomDirectory(roomJID) {
413
+ if (!roomJID || typeof roomJID !== 'string') return Promise.resolve();
414
+ if (dirState.get(roomJID) === 'done') return Promise.resolve();
415
+ const running = dirInflight.get(roomJID);
416
+ if (running) return running;
417
+ if (dirCoolingDown(roomJID)) return Promise.resolve();
418
+ const token = getToken();
419
+ const chatName = toLocalPart(roomJID);
420
+ if (!token || !chatName) return Promise.resolve();
421
+ const gen = generation;
422
+ setDirState(roomJID, 'loading');
423
+ const job = (async () => {
424
+ let offset = 0;
425
+ let total = Infinity;
426
+ let stale = 0;
427
+ try {
428
+ for (let page = 0; page < DIRECTORY_MAX_PAGES; page++) {
429
+ const res = await http.get('/v2/chats/users', {
430
+ params: {
431
+ chatName,
432
+ limit: DIRECTORY_PAGE_LIMIT,
433
+ offset
434
+ },
435
+ headers: {
436
+ Authorization: token
437
+ }
438
+ });
439
+ if (gen !== generation) return;
440
+ const data = res?.data || {};
441
+ const items = Array.isArray(data.items) ? data.items : Array.isArray(data.results) ? data.results : [];
442
+ if (!items.length) break;
443
+ const batch = items.map(item => sanitizeUser(item)).filter(u => Boolean(u));
444
+ // The backend can repeat the same user across pages (total counts the
445
+ // repeats), so merge by identity: first occurrence wins.
446
+ const before = dirMembers.get(roomJID) || EMPTY_DIRECTORY;
447
+ const merged = dedupeMembers([...before, ...batch]);
448
+ const added = merged.length - before.length;
449
+ if (added > 0) {
450
+ insertIntoUsersSet(batch);
451
+ dirMembers.set(roomJID, merged);
452
+ notify();
453
+ }
454
+ offset += items.length;
455
+ // Pages made only of repeats are normal at the tail (the real
456
+ // 435/11/3/1 shape), but a run of them means the server ignores
457
+ // offset: stop instead of walking to the page cap.
458
+ stale = added > 0 ? 0 : stale + 1;
459
+ if (stale >= DIRECTORY_MAX_STALE_PAGES) break;
460
+ const t = Number(data.total ?? data.pagination?.total);
461
+ if (Number.isFinite(t)) total = t;
462
+ if (offset >= total) break;
463
+ }
464
+ if (gen === generation) setDirState(roomJID, 'done');
465
+ } catch {
466
+ if (gen === generation) {
467
+ dirFailedAt.set(roomJID, Date.now());
468
+ setDirState(roomJID, 'error');
469
+ }
470
+ }
471
+ })().finally(() => {
472
+ if (dirInflight.get(roomJID) === job) dirInflight.delete(roomJID);
473
+ });
474
+ dirInflight.set(roomJID, job);
475
+ return job;
476
+ }
477
+
478
+ /** For tests and logout: drops every cache, timer and in-flight result. */
479
+ export function resetUserResolver() {
480
+ generation++;
481
+ sessionIdentity = '';
482
+ pending.clear();
483
+ inflight.clear();
484
+ negative.clear();
485
+ resetUserLookupRoute();
486
+ queue.length = 0;
487
+ activeWorkers = 0;
488
+ insertBuffer = [];
489
+ refreshTimers.forEach(t => clearTimeout(t));
490
+ refreshTimers.clear();
491
+ refreshAgain.clear();
492
+ refreshForced.clear();
493
+ if (debounceTimer) clearTimeout(debounceTimer);
494
+ debounceTimer = null;
495
+ if (insertTimer) clearTimeout(insertTimer);
496
+ insertTimer = null;
497
+ dirState.clear();
498
+ dirInflight.clear();
499
+ dirFailedAt.clear();
500
+ dirMembers.clear();
501
+ notify();
502
+ }
503
+ //# sourceMappingURL=userResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["http","lookupUser","resetUserLookupRoute","dedupeMembers","store","mergeUsersSet","updateUser","isSafeKey","hasSafeIdSegments","normalizeXmppUsername","toLocalPart","getSessionAppId","DEBOUNCE_MS","CONCURRENCY","SINGLE_FETCH_LIMIT","MAX_PENDING","NOT_FOUND_TTL_MS","BACKOFF_STEPS_MS","DIRECTORY_PAGE_LIMIT","DIRECTORY_MAX_PAGES","DIRECTORY_MAX_STALE_PAGES","INSERT_BUFFER_MS","generation","pending","Set","inflight","negative","Map","debounceTimer","activeWorkers","queue","insertBuffer","refreshTimers","refreshAgain","refreshForced","insertTimer","dirState","dirInflight","DIRECTORY_RETRY_MS","dirFailedAt","dirCoolingDown","jid","Date","now","get","Infinity","dirMembers","listeners","notify","forEach","l","subscribeUserResolver","listener","add","delete","sessionIdentity","getToken","u","getState","chatSettingStore","user","token","identity","String","xmppUsername","_id","resetUserResolver","normalizeId","raw","local","split","trim","isLookupable","id","test","includes","appId","sanitizeUser","fallbackId","firstName","lastName","profileImage","insertIntoUsersSet","users","length","existing","rooms","usersSet","members","Object","keys","dispatch","flushInserts","clearTimeout","batch","bufferInsert","push","setTimeout","markNegative","kind","prev","attempts","ttl","Math","min","set","until","isNegative","n","isUserNotFound","rawId","Boolean","getUserLookupStatus","has","applyToSessionUser","fresh","me","updates","undefined","fetchOne","gen","outcome","status","pump","shift","finally","knownUsers","pickDirectoryRoom","ids","idSet","best","bestCount","room","entries","cnt","Number","usersCnt","have","Array","isArray","seen","m","messages","uid","size","flush","filter","clear","roomJid","ensureRoomDirectory","then","requestUsers","added","oldest","values","next","value","REFRESH_DEBOUNCE_MS","refreshUser","prior","EMPTY_DIRECTORY","getRoomDirectoryMembers","roomJID","requestSendersOf","getRoomDirectoryState","setDirState","state","Promise","resolve","running","chatName","job","offset","total","stale","page","res","params","limit","headers","Authorization","data","items","results","map","item","before","merged","t","pagination","isFinite"],"sourceRoot":"../../../src","sources":["helpers/userResolver.ts"],"mappings":";;AAAA,OAAOA,IAAI,MAAM,yBAAyB;AAC1C,SACEC,UAAU,EACVC,oBAAoB,QACf,4CAA4C;AACnD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,sBAAsB;AACnE,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,eAAe,QAAQ,gBAAgB;;AAGhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMC,WAAW,GAAG,GAAG;AACvB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,kBAAkB,GAAG,EAAE;AAC7B,MAAMC,WAAW,GAAG,GAAG;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a,CAACmH,KAAK,CAAC,CAAC;EACrBlH,YAAY,CAACkH,KAAK,CAAC,CAAC;EACpBjH,aAAa,CAACiH,KAAK,CAAC,CAAC;EACrB,IAAIvH,aAAa,EAAEiE,YAAY,CAACjE,aAAa,CAAC;EAC9CA,aAAa,GAAG,IAAI;EACpB,IAAIO,WAAW,EAAE0D,YAAY,CAAC1D,WAAW,CAAC;EAC1CA,WAAW,GAAG,IAAI;EAClBC,QAAQ,CAAC+G,KAAK,CAAC,CAAC;EAChB9G,WAAW,CAAC8G,KAAK,CAAC,CAAC;EACnB5G,WAAW,CAAC4G,KAAK,CAAC,CAAC;EACnBrG,UAAU,CAACqG,KAAK,CAAC,CAAC;EAClBnG,MAAM,CAAC,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ // Pure string-shape helpers for xmpp local ids/JIDs - no dependency on the
4
+ // redux store. Kept separate from xmppUsername.ts (which imports `store`
5
+ // for normalizeXmppUsername/isSameXmppUsername) so this file can be safely
6
+ // imported from the redux reducer graph itself (roomsSlice.ts,
7
+ // createUserNameFromSetUser.ts): those are pulled in by roomStore/index.ts
8
+ // to build the root reducer, and importing anything that in turn imports
9
+ // `store` from roomStore/index.ts there creates a circular dependency back
10
+ // into the module that is still assembling the store.
11
+
12
+ // Strips a value that the local part of an XMPP JID may carry, leaving
13
+ // just the bare resource (anything before `@`). XMPP allows resources
14
+ // with `@` only in escaped form so the simple split is enough here.
15
+ export const toLocalPart = value => {
16
+ if (!value) return '';
17
+ return String(value).split('@')[0];
18
+ };
19
+
20
+ // A 24-character hex string is a Mongo ObjectId - the shape of both the
21
+ // appId and the userId that make up an Ethora xmpp username.
22
+ const HEX24 = '[0-9a-fA-F]{24}';
23
+ // `<appId>_<userId>` (the normal shape) or a bare id on its own (seen on
24
+ // system/local entries that never went through the appId_userId join).
25
+ // Anchored end to end so a human handle that merely contains 24 hex chars
26
+ // somewhere (unlikely, but not impossible) is never caught by accident.
27
+ const UUID = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
28
+ // `<appId>_<uuid>` or `<appId>_<hex24>`, optionally followed by further
29
+ // `_<token>` segments (appId is hex24 on most deployments, any alphanumeric
30
+ // token on others). A bare id, or a two-segment mongo id, is the original
31
+ // shape.
32
+ const OPAQUE_XMPP_USER_ID_RE = new RegExp(`^(?:${HEX24}(?:_${HEX24})?|[A-Za-z0-9]+_(?:${HEX24}|${UUID})(?:_[0-9A-Za-z-]+)*)$`);
33
+
34
+ /**
35
+ * True when `value` (a full JID or already-bare local part) is a
36
+ * machine-generated Ethora id rather than anything a human would recognize
37
+ * as their own name - `<24 hex>_<24 hex>`, `<appId>_<uuid>` or a bare 24-hex
38
+ * id. Kept narrow on purpose: a handle a person actually picked is never
39
+ * this shape, so it is never mistaken for one.
40
+ */
41
+ export const isOpaqueXmppUserId = value => {
42
+ const local = toLocalPart(value || '').trim();
43
+ if (!local) return false;
44
+ return OPAQUE_XMPP_USER_ID_RE.test(local);
45
+ };
46
+ //# sourceMappingURL=xmppIdShape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["toLocalPart","value","String","split","HEX24","UUID","OPAQUE_XMPP_USER_ID_RE","RegExp","isOpaqueXmppUserId","local","trim","test"],"sourceRoot":"../../../src","sources":["helpers/xmppIdShape.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAIC,KAAc,IAAa;EACrD,IAAI,CAACA,KAAK,EAAE,OAAO,EAAE;EACrB,OAAOC,MAAM,CAACD,KAAK,CAAC,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;;AAED;AACA;AACA,MAAMC,KAAK,GAAG,iBAAiB;AAC/B;AACA;AACA;AACA;AACA,MAAMC,IAAI,GACR,6EAA6E;AAC/E;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAG,IAAIC,MAAM,CACvC,OAAOH,KAAK,OAAOA,KAAK,sBAAsBA,KAAK,IAAIC,IAAI,wBAC7D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,kBAAkB,GAAIP,KAAgC,IAAc;EAC/E,MAAMQ,KAAK,GAAGT,WAAW,CAACC,KAAK,IAAI,EAAE,CAAC,CAACS,IAAI,CAAC,CAAC;EAC7C,IAAI,CAACD,KAAK,EAAE,OAAO,KAAK;EACxB,OAAOH,sBAAsB,CAACK,IAAI,CAACF,KAAK,CAAC;AAC3C,CAAC","ignoreList":[]}
@@ -8,6 +8,7 @@ import { resolveLegacyTranslatesLangSource } from '../helpers/resolveLangSource'
8
8
  import { useXmppClient } from '../context/xmppProvider';
9
9
  import { chatAutoEnterer } from '../helpers/chatAutoEnterer';
10
10
  import { initRoomsPresence } from '../helpers/initRoomsPresence';
11
+ import { loadRoomsThenJoinInBackground, startBackgroundJoinSweep } from '../helpers/backgroundJoinSweep';
11
12
  import { updateMessagesTillLast } from '../helpers/updateMessagesTillLast';
12
13
  import { refreshAuthTokensQuietly } from '../networking/authRefresh';
13
14
  import { setLangSource, setConfig } from '../roomStore/chatSettingsSlice';
@@ -19,6 +20,10 @@ import { isChatIdPresentInArray } from '../helpers/isChatIdPresentInArray';
19
20
  import useGetNewArchRoom from './useGetNewArchRoom';
20
21
  import { getRoomsWithRetry } from '../helpers/getRoomsWithRetry';
21
22
  import { shallowEqual } from '../helpers/shallowEqual';
23
+
24
+ // The room list ends its loading state right after /chats/my; joining every
25
+ // room is a background sweep nobody waits for (see helpers/backgroundJoinSweep).
26
+ export { loadRoomsThenJoinInBackground, startBackgroundJoinSweep };
22
27
  const useChatWrapperInit = ({
23
28
  roomJID,
24
29
  wasAutoSelected,
@@ -82,12 +87,13 @@ const useChatWrapperInit = ({
82
87
  loading: true,
83
88
  loadingText: 'Loading rooms...'
84
89
  }));
85
- const rooms = await syncRooms(client, config);
86
- dispatch(setIsLoading({
90
+ // The list is usable as soon as the rooms fetch returns (rooms come
91
+ // seeded with lastMessage / unread). Joining them all runs in the
92
+ // background, open room first.
93
+ return loadRoomsThenJoinInBackground(client, () => syncRooms(client, config), () => dispatch(setIsLoading({
87
94
  loading: false,
88
95
  loadingText: undefined
89
- }));
90
- return rooms;
96
+ })));
91
97
  };
92
98
  useEffect(() => {
93
99
  let retryTimeout;
@@ -121,7 +127,9 @@ const useChatWrapperInit = ({
121
127
  if (roomsList && Object.keys(roomsList).length > 0) {
122
128
  console.log(' Using existing roomsList', Object.keys(roomsList).length);
123
129
  setInited(true);
124
- await initRoomsPresence(newClient, roomsList);
130
+ // Persisted rooms: join (background sweep) + push subscribe
131
+ // without holding the private-store / unread step behind it.
132
+ initRoomsPresence(newClient, roomsList).catch(() => undefined);
125
133
  } else {
126
134
  if (config?.newArch) {
127
135
  console.log(' Loading rooms with newArch');
@@ -184,6 +192,9 @@ const useChatWrapperInit = ({
184
192
  }
185
193
  }
186
194
  setInited(true);
195
+ // Rooms that appeared since the bootstrap sweep (a /chats/my that
196
+ // returned late) get joined too; a no-op when nothing is left.
197
+ startBackgroundJoinSweep(client);
187
198
  console.log(' Getting chats private store for existing client');
188
199
  try {
189
200
  // See the "new client" branch above: getChatsPrivateStoreRequestStanza