@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.
- package/README.md +44 -2
- package/dist/{ChatProfileModal-DKuxJsdM.js → ChatProfileModal-3UH0H5Ec.js} +571 -567
- package/dist/{FilePreviewModal-BcaSoO3-.js → FilePreviewModal-Cgj1iHry.js} +168 -168
- package/dist/{ManageDataModal-Dw4dCQll.js → ManageDataModal-BblTuE9g.js} +14 -14
- package/dist/{MarkdownBody-xtKDMR0h.js → MarkdownBody-RMEx8yW2.js} +1 -1
- package/dist/{MessageSearchModal-BVKU6H3v.js → MessageSearchModal-CrYR2EH8.js} +105 -113
- package/dist/{PublicChatsModal-CscOnVaQ.js → PublicChatsModal-Bi5r4mrV.js} +13 -13
- package/dist/{SideDrawer-WneDrrWG.js → SideDrawer-CDAoobvX.js} +16 -16
- package/dist/{UserProfileModal-CMHFq1I9.js → UserProfileModal-4Frgvam-.js} +3 -3
- package/dist/{UserSettingsModal-BoZXZ0oR.js → UserSettingsModal-C-mb-9cb.js} +2 -2
- package/dist/{VideoCallOverlay-CQNi7wp5.js → VideoCallOverlay-92dFLb9U.js} +1 -1
- package/dist/{VisibilityModal-BPsNiMzJ.js → VisibilityModal-zIAV6dAP.js} +9 -9
- package/dist/components/InputComponents/MentionDropdown.d.ts +2 -0
- package/dist/components/MainComponents/scrollAnchor.d.ts +19 -0
- package/dist/components/MainComponents/useJumpToMessage.d.ts +42 -11
- package/dist/components/MainComponents/useScrollAnchor.d.ts +29 -0
- package/dist/components/Modals/MessageSearchModal/MessageHitResults.d.ts +5 -0
- package/dist/components/Modals/styledModalComponents.d.ts +0 -8
- package/dist/{handleCopyClick-B70vLjJD.js → handleCopyClick-BtXos0AJ.js} +1 -1
- package/dist/helpers/checkUniqueUsers.d.ts +2 -2
- package/dist/helpers/dedupeMembers.d.ts +10 -0
- package/dist/helpers/historyPreloadConfig.d.ts +25 -0
- package/dist/helpers/historyPreloadScheduler.d.ts +3 -0
- package/dist/helpers/insertMessageWithDelimiter.d.ts +1 -0
- package/dist/helpers/isMessageSearchEnabled.d.ts +9 -0
- package/dist/helpers/jumpThread.d.ts +56 -0
- package/dist/helpers/jumpWindow.d.ts +73 -0
- package/dist/helpers/openThreadForJump.d.ts +26 -0
- package/dist/helpers/pdf/loadPdfjs.d.ts +8 -1
- package/dist/helpers/roomUserCount.d.ts +19 -0
- package/dist/helpers/userResolver.d.ts +57 -0
- package/dist/helpers/xmppIdShape.d.ts +1 -1
- package/dist/hooks/useChatWrapperInit.d.ts +6 -0
- package/dist/hooks/usePdfThumbnail.d.ts +2 -1
- package/dist/hooks/useRoomDirectory.d.ts +11 -0
- package/dist/{main-rJpE4hh-.js → main-BnLtessp.js} +22850 -21155
- package/dist/main.css +1 -1
- package/dist/main.js +11 -11
- package/dist/networking/api-requests/roomMembers.api.d.ts +18 -0
- package/dist/networking/ethoraEvents.d.ts +44 -0
- package/dist/networking/stanzaHandlers.d.ts +2 -2
- package/dist/networking/xmpp/allRoomPresences.xmpp.d.ts +18 -1
- package/dist/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -1
- package/dist/networking/xmppClient.d.ts +56 -2
- package/dist/roomStore/Middleware/jumpThreadMiddleware.d.ts +2 -0
- package/dist/roomStore/index.d.ts +12 -0
- package/dist/roomStore/roomsSlice.d.ts +33 -1
- package/dist/roomStore/safeKey.d.ts +12 -0
- package/dist/roomStore/usersSetCap.d.ts +15 -0
- package/dist/types/models/config.model.d.ts +70 -3
- package/dist/types/models/room.model.d.ts +14 -0
- package/dist/types/models/xmpp.model.d.ts +21 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -1
- package/dist/components/MainComponents/computeAnchoredScrollTop.d.ts +0 -9
- package/dist/components/Modals/NewChatModal/UpdNewChatModal.d.ts +0 -3
- 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>`
|
|
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
|
+
};
|