@ethora/chat-component 26.2.2 → 26.2.4

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.
@@ -1,4 +1,8 @@
1
1
  import { User } from '../../types/types';
2
+ interface GetMyUserOptions {
3
+ token?: string;
4
+ endpoint?: string;
5
+ }
2
6
  export declare function getDocuments(walletAddress: string): Promise<import('axios').AxiosResponse<any, any>>;
3
7
  export declare function getExportMyData(): Promise<import('axios').AxiosResponse<any, any>>;
4
8
  export declare function deleteMe(): Promise<import('axios').AxiosResponse<any, any>>;
@@ -6,3 +10,5 @@ export declare function updateMe(data: any): Promise<import('axios').AxiosRespon
6
10
  export declare function updateProfile(fd: FormData): Promise<{
7
11
  user: User;
8
12
  }>;
13
+ export declare function getMyUser(options?: GetMyUserOptions): Promise<User>;
14
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { Client } from '@xmpp/client';
2
2
  import { Iso639_1Codes, XmppClientInterface, xmppSettingsInterface, IMessage } from '../types/types';
3
3
  import { AllRoomPresenceSummary } from './xmpp/allRoomPresences.xmpp';
4
+ type HistorySource = 'active' | 'send_ack' | 'background' | 'default';
4
5
  export declare class XmppClient implements XmppClientInterface {
5
6
  client: Client;
6
7
  devServer: string | undefined;
@@ -27,6 +28,20 @@ export declare class XmppClient implements XmppClientInterface {
27
28
  private recoveryRoomJid;
28
29
  private joinedRooms;
29
30
  private roomPresenceInFlight;
31
+ private historyPreloadInFlight;
32
+ private mamRequestRegistry;
33
+ private historyQueue;
34
+ private historyQueueInFlight;
35
+ private historyQueueInFlightHigh;
36
+ private historyQueueWorkerScheduled;
37
+ private roomHistoryEpoch;
38
+ private criticalSendUntil;
39
+ private activeRoomBoostUntil;
40
+ private sendStartedAtById;
41
+ private pendingSendIdsByRoom;
42
+ private maxInFlightHistory;
43
+ private softPauseAfterSendMs;
44
+ private activeRoomBoostTtlMs;
30
45
  checkOnline(): boolean;
31
46
  pingInterval: any;
32
47
  pingTimeout: any;
@@ -56,6 +71,28 @@ export declare class XmppClient implements XmppClientInterface {
56
71
  ensureConnected(timeout?: number): Promise<void>;
57
72
  close(): Promise<void>;
58
73
  wrapWithConnectionCheck<T>(operation: () => Promise<T>): Promise<T>;
74
+ private clearMamRegistry;
75
+ private clearHistoryQueue;
76
+ private getRoomEpoch;
77
+ private getHistoryPriority;
78
+ private nextHistoryTaskId;
79
+ private scheduleHistoryQueue;
80
+ private pickNextHistoryTask;
81
+ private processHistoryQueue;
82
+ private executeHistoryTask;
83
+ private parseMamMessages;
84
+ private routeMamStanza;
85
+ private requestMamHistory;
86
+ promoteRoomHistory(roomJID: string): void;
87
+ onCriticalSend(roomJID: string, messageId?: string): void;
88
+ acknowledgeSentMessage(roomJID: string, messageId?: string): void;
89
+ enqueueHistoryTask(params: {
90
+ chatJID: string;
91
+ max: number;
92
+ before?: number;
93
+ id?: string;
94
+ source?: HistorySource;
95
+ }): Promise<IMessage[] | undefined>;
59
96
  private enqueue;
60
97
  private processQueue;
61
98
  private withIdLock;
@@ -74,7 +111,11 @@ export declare class XmppClient implements XmppClientInterface {
74
111
  private ensureRoomPresence;
75
112
  presenceInRoomStanza: (roomJID: string, settleDelay?: number, timeoutMs?: number, waitForJoin?: boolean) => Promise<boolean>;
76
113
  prioritizeRoomPresence: (roomJID: string) => Promise<boolean>;
77
- getHistoryStanza: (chatJID: string, max: number, before?: number, otherStanzaId?: string) => Promise<IMessage[]>;
114
+ getHistoryStanza: (chatJID: string, max: number, before?: number, otherStanzaId?: string, options?: {
115
+ coalesceRoom?: boolean;
116
+ skipIfPreloaded?: boolean;
117
+ source?: HistorySource;
118
+ }) => Promise<any>;
78
119
  getLastMessageArchiveStanza(roomJID: string): void;
79
120
  setRoomImageStanza: (roomJid: string, roomThumbnail: string, type: string, roomBackground?: string) => void;
80
121
  getRoomInfoStanza: (roomJID: string) => void;
@@ -1,26 +1,25 @@
1
1
  import { Reducer, AnyAction } from '@reduxjs/toolkit';
2
- import { roomHeapSliceState } from './roomHeapSlice';
3
2
  import { IRoom } from '../types/types';
4
3
  declare const rootReducer: Reducer<{
5
4
  chatSettingStore: any;
6
5
  rooms: any;
7
- roomHeapSlice: roomHeapSliceState & import('redux-persist/es/persistReducer').PersistPartial;
6
+ roomHeapSlice: any;
8
7
  }, import('redux').UnknownAction, Partial<{
9
8
  chatSettingStore: any;
10
9
  rooms: any;
11
- roomHeapSlice: roomHeapSliceState & import('redux-persist/es/persistReducer').PersistPartial;
10
+ roomHeapSlice: any;
12
11
  }>>;
13
12
  export type RootState = ReturnType<typeof rootReducer>;
14
13
  export declare const getActiveRoom: (state: RootState) => IRoom | null;
15
14
  export declare const store: import('@reduxjs/toolkit').EnhancedStore<{
16
15
  chatSettingStore: any;
17
16
  rooms: any;
18
- roomHeapSlice: roomHeapSliceState & import('redux-persist/es/persistReducer').PersistPartial;
17
+ roomHeapSlice: any;
19
18
  }, AnyAction, import('@reduxjs/toolkit').Tuple<[import('redux').StoreEnhancer<{
20
19
  dispatch: import('redux-thunk').ThunkDispatch<{
21
20
  chatSettingStore: any;
22
21
  rooms: any;
23
- roomHeapSlice: roomHeapSliceState & import('redux-persist/es/persistReducer').PersistPartial;
22
+ roomHeapSlice: any;
24
23
  }, undefined, import('redux').UnknownAction>;
25
24
  }>, import('redux').StoreEnhancer]>>;
26
25
  export type AppDispatch = typeof store.dispatch;
@@ -16,6 +16,12 @@ interface RoomMessagesState {
16
16
  pushSubscriptionStatus: Record<string, 'pending' | 'subscribed' | 'error' | 'blocked'>;
17
17
  loadingText?: string;
18
18
  }
19
+ interface PreloadRoomUpdate {
20
+ jid: string;
21
+ messages?: IMessage[];
22
+ unreadCapped?: boolean;
23
+ historyPreloadState?: 'idle' | 'loading' | 'done' | 'error';
24
+ }
19
25
  export declare const addRoomViaApi: import('@reduxjs/toolkit').AsyncThunk<void, {
20
26
  room: IRoom;
21
27
  xmpp: XmppClient;
@@ -96,6 +102,9 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
96
102
  addRoomFromApi: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
97
103
  room: IRoom;
98
104
  }>) => void;
105
+ applyRoomsPreloadBatch: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
106
+ rooms: PreloadRoomUpdate[];
107
+ }>) => void;
99
108
  updateUsersSet: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
100
109
  rooms: ApiRoom[];
101
110
  }>) => void;
@@ -159,6 +168,8 @@ export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOption
159
168
  }, "roomMessages/insertUsers">, setPushSubscriptionStatus: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
160
169
  jid: string;
161
170
  status: "pending" | "subscribed" | "error" | "blocked";
162
- }, "roomMessages/setPushSubscriptionStatus">, clearPushSubscriptions: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/clearPushSubscriptions">;
171
+ }, "roomMessages/setPushSubscriptionStatus">, clearPushSubscriptions: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/clearPushSubscriptions">, applyRoomsPreloadBatch: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
172
+ rooms: PreloadRoomUpdate[];
173
+ }, "roomMessages/applyRoomsPreloadBatch">;
163
174
  declare const _default: import('redux').Reducer<RoomMessagesState>;
164
175
  export default _default;
@@ -81,6 +81,9 @@ export interface IConfig {
81
81
  clearStoreBeforeInit?: boolean;
82
82
  disableSentLogic?: boolean;
83
83
  initBeforeLoad?: boolean;
84
+ initBeforeLoadAuth?: {
85
+ myEndpoint?: string;
86
+ };
84
87
  newArch?: boolean;
85
88
  qrUrl?: string;
86
89
  secondarySendButton?: {
@@ -160,6 +163,11 @@ export interface IConfig {
160
163
  hideSearch?: boolean;
161
164
  };
162
165
  useStoreConsoleEnabled?: boolean;
166
+ historyQoS?: {
167
+ maxInFlightHistory?: number;
168
+ softPauseAfterSendMs?: number;
169
+ activeRoomBoostTtlMs?: number;
170
+ };
163
171
  inAppNotifications?: {
164
172
  enabled?: boolean;
165
173
  showInContext?: boolean;
@@ -53,6 +53,8 @@ export interface IRoom {
53
53
  firstMessageTimestamp?: number;
54
54
  };
55
55
  historyComplete?: boolean;
56
+ historyPreloadState?: 'idle' | 'loading' | 'done' | 'error';
57
+ unreadCapped?: boolean;
56
58
  }
57
59
  export interface ApiRoom {
58
60
  name: string;
@@ -7,10 +7,15 @@ export interface XmppState {
7
7
  loading: boolean;
8
8
  }
9
9
  export interface xmppSettingsInterface {
10
- devServer: string;
11
- host: string;
10
+ devServer?: string;
11
+ host?: string;
12
12
  conference?: string;
13
13
  xmppPingOnSendEnabled?: boolean;
14
+ historyQoS?: {
15
+ maxInFlightHistory?: number;
16
+ softPauseAfterSendMs?: number;
17
+ activeRoomBoostTtlMs?: number;
18
+ };
14
19
  }
15
20
  export interface MediaUploadData {
16
21
  file: File;
@@ -43,7 +48,20 @@ export interface XmppClientInterface {
43
48
  presenceInRoomStanza(roomJID: string, settleDelay?: number, timeoutMs?: number, waitForJoin?: boolean): Promise<boolean>;
44
49
  prioritizeRoomPresence(roomJID: string): Promise<boolean>;
45
50
  recoverRoomPresenceOnly(roomJID: string): Promise<boolean>;
46
- getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string): Promise<IMessage[]>;
51
+ getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string, options?: {
52
+ coalesceRoom?: boolean;
53
+ skipIfPreloaded?: boolean;
54
+ source?: 'active' | 'send_ack' | 'background' | 'default';
55
+ }): Promise<IMessage[] | undefined>;
56
+ promoteRoomHistory(roomJID: string): void;
57
+ onCriticalSend(roomJID: string, messageId?: string): void;
58
+ enqueueHistoryTask(params: {
59
+ chatJID: string;
60
+ max: number;
61
+ before?: number;
62
+ id?: string;
63
+ source?: 'active' | 'send_ack' | 'background' | 'default';
64
+ }): Promise<IMessage[] | undefined>;
47
65
  getLastMessageArchiveStanza(roomJID: string): void;
48
66
  setRoomImageStanza(roomJid: string, roomThumbnail: string, type: string, roomBackground?: string): void;
49
67
  getRoomInfoStanza(roomJID: string): void;
@@ -7,9 +7,13 @@ declare class MessageNotificationManager {
7
7
  private pending;
8
8
  private maxPending;
9
9
  private pendingTtlMs;
10
+ private dedupeWindowMs;
11
+ private recentlyDelivered;
10
12
  addCallback(callback: MessageNotificationCallback): () => void;
11
13
  getCallbackCount(): number;
12
14
  private flushPending;
15
+ private buildDedupeKey;
16
+ private shouldSkipDuplicate;
13
17
  showNotification(message: IMessage, roomName: string, senderName: string, roomJID: string): void;
14
18
  }
15
19
  export declare const messageNotificationManager: MessageNotificationManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethora/chat-component",
3
- "version": "26.02.02",
3
+ "version": "26.02.04",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",