@ethora/chat-component 26.9.6 → 26.9.8

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 (57) hide show
  1. package/README.md +44 -2
  2. package/dist/{ChatProfileModal-DKuxJsdM.js → ChatProfileModal-3UH0H5Ec.js} +571 -567
  3. package/dist/{FilePreviewModal-BcaSoO3-.js → FilePreviewModal-Cgj1iHry.js} +168 -168
  4. package/dist/{ManageDataModal-Dw4dCQll.js → ManageDataModal-BblTuE9g.js} +14 -14
  5. package/dist/{MarkdownBody-xtKDMR0h.js → MarkdownBody-RMEx8yW2.js} +1 -1
  6. package/dist/{MessageSearchModal-BVKU6H3v.js → MessageSearchModal-CrYR2EH8.js} +105 -113
  7. package/dist/{PublicChatsModal-CscOnVaQ.js → PublicChatsModal-Bi5r4mrV.js} +13 -13
  8. package/dist/{SideDrawer-WneDrrWG.js → SideDrawer-CDAoobvX.js} +16 -16
  9. package/dist/{UserProfileModal-CMHFq1I9.js → UserProfileModal-4Frgvam-.js} +3 -3
  10. package/dist/{UserSettingsModal-BoZXZ0oR.js → UserSettingsModal-C-mb-9cb.js} +2 -2
  11. package/dist/{VideoCallOverlay-CQNi7wp5.js → VideoCallOverlay-92dFLb9U.js} +1 -1
  12. package/dist/{VisibilityModal-BPsNiMzJ.js → VisibilityModal-zIAV6dAP.js} +9 -9
  13. package/dist/components/InputComponents/MentionDropdown.d.ts +2 -0
  14. package/dist/components/MainComponents/scrollAnchor.d.ts +19 -0
  15. package/dist/components/MainComponents/useJumpToMessage.d.ts +42 -11
  16. package/dist/components/MainComponents/useScrollAnchor.d.ts +29 -0
  17. package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +5 -0
  18. package/dist/components/Modals/styledModalComponents.d.ts +0 -8
  19. package/dist/{handleCopyClick-B70vLjJD.js → handleCopyClick-BtXos0AJ.js} +1 -1
  20. package/dist/helpers/checkUniqueUsers.d.ts +2 -2
  21. package/dist/helpers/dedupeMembers.d.ts +10 -0
  22. package/dist/helpers/historyPreloadConfig.d.ts +25 -0
  23. package/dist/helpers/historyPreloadScheduler.d.ts +3 -0
  24. package/dist/helpers/insertMessageWithDelimiter.d.ts +1 -0
  25. package/dist/helpers/isMessageSearchEnabled.d.ts +9 -0
  26. package/dist/helpers/jumpThread.d.ts +56 -0
  27. package/dist/helpers/jumpWindow.d.ts +73 -0
  28. package/dist/helpers/openThreadForJump.d.ts +26 -0
  29. package/dist/helpers/pdf/loadPdfjs.d.ts +8 -1
  30. package/dist/helpers/roomUserCount.d.ts +19 -0
  31. package/dist/helpers/userResolver.d.ts +57 -0
  32. package/dist/helpers/xmppIdShape.d.ts +1 -1
  33. package/dist/hooks/useChatWrapperInit.d.ts +6 -0
  34. package/dist/hooks/usePdfThumbnail.d.ts +2 -1
  35. package/dist/hooks/useRoomDirectory.d.ts +11 -0
  36. package/dist/{main-rJpE4hh-.js → main-BnLtessp.js} +22850 -21155
  37. package/dist/main.css +1 -1
  38. package/dist/main.js +11 -11
  39. package/dist/networking/api-requests/roomMembers.api.d.ts +18 -0
  40. package/dist/networking/ethoraEvents.d.ts +44 -0
  41. package/dist/networking/stanzaHandlers.d.ts +2 -2
  42. package/dist/networking/xmpp/allRoomPresences.xmpp.d.ts +18 -1
  43. package/dist/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -1
  44. package/dist/networking/xmppClient.d.ts +56 -2
  45. package/dist/roomStore/Middleware/jumpThreadMiddleware.d.ts +2 -0
  46. package/dist/roomStore/index.d.ts +12 -0
  47. package/dist/roomStore/roomsSlice.d.ts +33 -1
  48. package/dist/roomStore/safeKey.d.ts +12 -0
  49. package/dist/roomStore/usersSetCap.d.ts +15 -0
  50. package/dist/types/models/config.model.d.ts +70 -3
  51. package/dist/types/models/room.model.d.ts +14 -0
  52. package/dist/types/models/xmpp.model.d.ts +21 -1
  53. package/dist/version.d.ts +1 -1
  54. package/package.json +2 -1
  55. package/dist/components/MainComponents/computeAnchoredScrollTop.d.ts +0 -9
  56. package/dist/components/Modals/NewChatModal/UpdNewChatModal.d.ts +0 -3
  57. package/dist/components/SortDropDown/index.d.ts +0 -8
@@ -0,0 +1,19 @@
1
+ import { IRoom } from '../types/types';
2
+ type CountSource = Pick<IRoom, 'members' | 'usersCnt'> | {
3
+ members?: unknown;
4
+ usersCnt?: unknown;
5
+ } | null | undefined;
6
+ /**
7
+ * User count to DISPLAY for a room. /chats/my returns `usersCnt` (the true
8
+ * total) but at most 30 members for big public rooms, so the truncated
9
+ * members array must never win over usersCnt.
10
+ */
11
+ export declare const getRoomUserCount: (room: CountSource) => number;
12
+ /** True when the room is known to have more users than members loaded. */
13
+ export declare const isRoomMembersTruncated: (room: CountSource) => boolean;
14
+ /**
15
+ * Next usersCnt after a live join (+1) or leave (-1). Adjusts the CURRENT
16
+ * count instead of recomputing from the (possibly truncated) members array.
17
+ */
18
+ export declare const adjustUsersCnt: (room: CountSource, delta: 1 | -1, nextMembersLength: number) => number;
19
+ export {};
@@ -0,0 +1,57 @@
1
+ import { RoomMember } from '../types/types';
2
+ export type RoomDirectoryState = 'idle' | 'loading' | 'done' | 'error';
3
+ /** Re-render hook: called when a directory state or a negative cache entry changes. */
4
+ export declare const subscribeUserResolver: (listener: () => void) => (() => void);
5
+ /**
6
+ * True for an id the backend answered 404 for: the user really is gone.
7
+ * (An id merely not resolved yet is NOT "not found".)
8
+ */
9
+ export declare const isUserNotFound: (rawId: string) => boolean;
10
+ /**
11
+ * Where a sender's lookup stands, for the display chain:
12
+ * - resolved: in usersSet
13
+ * - pending: queued, in flight, or not requested yet (a bubble just mounted)
14
+ * - notfound / forbidden: the backend answered, nothing to show from it
15
+ * - failed: the last attempt errored (backoff), or the lookup is exhausted
16
+ * - unavailable: this id can never be looked up (plain handle) or there is
17
+ * no session token, so nothing is coming
18
+ */
19
+ export type UserLookupStatus = 'resolved' | 'pending' | 'notfound' | 'forbidden' | 'failed' | 'unavailable';
20
+ export declare const getUserLookupStatus: (rawId: string) => UserLookupStatus;
21
+ /**
22
+ * Ask for the profiles of these senders. Cheap to call from anywhere (a
23
+ * bubble mounting, a history batch parse): known, in-flight and recently
24
+ * failed ids are dropped, the rest are debounced into one pass.
25
+ */
26
+ export declare function requestUsers(ids: string[]): void;
27
+ /**
28
+ * Re-fetch one user's profile even though it is already in usersSet, because
29
+ * the server said it changed (ethora-event user-profile-updated). Bypasses
30
+ * the cache and forgets a negative-cache entry, but shares everything else
31
+ * with requestUsers: the same route chain (lookupUser), the same worker
32
+ * queue and concurrency cap, one request at a time per user. Calls for the
33
+ * same user within REFRESH_DEBOUNCE_MS coalesce into one fetch. The answer
34
+ * goes through insertUsers (display fields only), so existing bubbles are
35
+ * re-named. Never throws.
36
+ */
37
+ export declare function refreshUser(rawId: string): void;
38
+ /**
39
+ * Members loaded so far by ensureRoomDirectory for this room (a new array
40
+ * identity after every page, a stable empty array before any).
41
+ */
42
+ export declare const getRoomDirectoryMembers: (roomJID: string) => RoomMember[];
43
+ /** requestUsers for the senders of a batch of messages (history page, jump window). */
44
+ export declare function requestSendersOf(messages: ReadonlyArray<{
45
+ user?: {
46
+ id?: string;
47
+ };
48
+ } | null | undefined> | undefined): void;
49
+ export declare const getRoomDirectoryState: (roomJID: string) => RoomDirectoryState;
50
+ /**
51
+ * Loads every member of one room into usersSet, once. Pages are not
52
+ * guaranteed to be full, so it stops on an empty page or offset >= total,
53
+ * never on `items.length < limit`.
54
+ */
55
+ export declare function ensureRoomDirectory(roomJID: string): Promise<void>;
56
+ /** For tests and logout: drops every cache, timer and in-flight result. */
57
+ export declare function resetUserResolver(): void;
@@ -2,7 +2,7 @@ export declare const toLocalPart: (value?: string) => string;
2
2
  /**
3
3
  * True when `value` (a full JID or already-bare local part) is a
4
4
  * machine-generated Ethora id rather than anything a human would recognize
5
- * as their own name - `<24 hex>_<24 hex>` (appId_userId) or a bare 24-hex
5
+ * as their own name - `<24 hex>_<24 hex>`, `<appId>_<uuid>` or a bare 24-hex
6
6
  * id. Kept narrow on purpose: a handle a person actually picked is never
7
7
  * this shape, so it is never mistaken for one.
8
8
  */
@@ -22,5 +22,11 @@ export declare const hasHostRefreshedSession: (user: {
22
22
  xmppUsername?: string;
23
23
  xmppPassword?: string;
24
24
  }) => boolean;
25
+ export declare const startBackgroundJoinSweep: (client: {
26
+ sendAllPresencesAndMarkReady: () => Promise<unknown>;
27
+ }) => void;
28
+ export declare const loadRoomsThenJoinInBackground: <T>(client: {
29
+ sendAllPresencesAndMarkReady: () => Promise<unknown>;
30
+ }, fetchRooms: () => Promise<T>, onListReady: () => void) => Promise<T>;
25
31
  declare const useChatWrapperInit: ({ roomJID, wasAutoSelected, config, }: useChatWrapperInitProps) => useChatWrapperInitResult;
26
32
  export default useChatWrapperInit;
@@ -9,6 +9,7 @@ interface UsePdfThumbnailParams {
9
9
  maxBytes?: number;
10
10
  sizeInBytes?: number;
11
11
  workerSrc?: string;
12
+ libUrl?: string;
12
13
  }
13
14
  interface UsePdfThumbnailResult {
14
15
  status: PdfThumbnailStatus;
@@ -18,5 +19,5 @@ interface UsePdfThumbnailResult {
18
19
  /** Re-runs a render that failed or was skipped for being too big. */
19
20
  retry: () => void;
20
21
  }
21
- export declare const usePdfThumbnail: ({ url, enabled, width, maxBytes, sizeInBytes, workerSrc, }: UsePdfThumbnailParams) => UsePdfThumbnailResult;
22
+ export declare const usePdfThumbnail: ({ url, enabled, width, maxBytes, sizeInBytes, workerSrc, libUrl, }: UsePdfThumbnailParams) => UsePdfThumbnailResult;
22
23
  export {};
@@ -0,0 +1,11 @@
1
+ import { RoomDirectoryState } from '../helpers/userResolver';
2
+ import { RoomMember } from '../types/types';
3
+ /**
4
+ * Directory of a big room (usersCnt > the members the API returned).
5
+ * `enabled` starts the (once per room, deduplicated) load; the result grows
6
+ * page by page. Rooms that are not truncated never trigger a request.
7
+ */
8
+ export declare const useRoomDirectory: (roomJid: string | undefined, enabled: boolean) => {
9
+ members: RoomMember[];
10
+ state: RoomDirectoryState;
11
+ };