@ethora/chat-component 26.1.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.
- package/README.md +5 -0
- package/dist/components/MainComponents/ConnectionBanner.d.ts +4 -1
- package/dist/firebase-config.d.ts +1 -0
- package/dist/firebase-messaging-sw.js +261 -156
- package/dist/helpers/authStorage.d.ts +6 -0
- package/dist/helpers/cacheScope.d.ts +8 -0
- package/dist/helpers/constants/LOCAL_STORAGE.d.ts +4 -0
- package/dist/helpers/historyPreloadScheduler.d.ts +12 -0
- package/dist/helpers/localStorageUser.d.ts +1 -2
- package/dist/helpers/resolveInitBeforeLoadUser.d.ts +8 -0
- package/dist/helpers/storeConsole.d.ts +1 -2
- package/dist/hooks/useLogout.d.ts +1 -1
- package/dist/hooks/useMessageHeapState.d.ts +2 -2
- package/dist/hooks/useUnreadMessagesCounter.d.ts +5 -0
- package/dist/main.js +34244 -33151
- package/dist/main.js.map +1 -1
- package/dist/networking/api-requests/roomMembers.api.d.ts +1 -1
- package/dist/networking/api-requests/user.api.d.ts +6 -0
- package/dist/networking/xmppClient.d.ts +42 -1
- package/dist/roomStore/index.d.ts +4 -5
- package/dist/roomStore/roomsSlice.d.ts +12 -1
- package/dist/types/models/config.model.d.ts +19 -0
- package/dist/types/models/room.model.d.ts +2 -0
- package/dist/types/models/xmpp.model.d.ts +21 -3
- package/dist/utils/messageNotificationManager.d.ts +4 -0
- package/dist/version.d.ts +1 -1
- package/package.json +4 -3
- package/public/firebase-messaging-sw.js +261 -156
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RoomMember } from '../../types/types';
|
|
2
|
-
export declare function getUserByXmppUsername(xmppUsername: string, token: string): Promise<RoomMember | null>;
|
|
2
|
+
export declare function getUserByXmppUsername(xmppUsername: string | undefined, token: string): Promise<RoomMember | null>;
|
|
@@ -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
|
|
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:
|
|
6
|
+
roomHeapSlice: any;
|
|
8
7
|
}, import('redux').UnknownAction, Partial<{
|
|
9
8
|
chatSettingStore: any;
|
|
10
9
|
rooms: any;
|
|
11
|
-
roomHeapSlice:
|
|
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:
|
|
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:
|
|
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;
|
|
@@ -191,5 +199,16 @@ export interface IConfig {
|
|
|
191
199
|
serviceWorkerPath?: string;
|
|
192
200
|
serviceWorkerScope?: string;
|
|
193
201
|
softAsk?: boolean;
|
|
202
|
+
onClick?: (params: {
|
|
203
|
+
roomJID?: string;
|
|
204
|
+
messageId?: string;
|
|
205
|
+
url?: string;
|
|
206
|
+
data?: Record<string, any>;
|
|
207
|
+
notification?: {
|
|
208
|
+
title?: string;
|
|
209
|
+
body?: string;
|
|
210
|
+
};
|
|
211
|
+
source?: 'service_worker' | 'foreground';
|
|
212
|
+
}) => void | Promise<void>;
|
|
194
213
|
};
|
|
195
214
|
}
|
|
@@ -7,10 +7,15 @@ export interface XmppState {
|
|
|
7
7
|
loading: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface xmppSettingsInterface {
|
|
10
|
-
devServer
|
|
11
|
-
host
|
|
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
|
|
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/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ETHORA_CHAT_COMPONENT_VERSION = "26.
|
|
1
|
+
export declare const ETHORA_CHAT_COMPONENT_VERSION = "26.02.01";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethora/chat-component",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.02.04",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
"dev": "vite",
|
|
17
17
|
"build": "tsc && vite build",
|
|
18
18
|
"build:lib": "tsc --p ./tsconfig-build.json && vite build",
|
|
19
|
-
"lint": "eslint . --
|
|
19
|
+
"lint": "eslint . --quiet --report-unused-disable-directives",
|
|
20
|
+
"lint:full": "eslint . --report-unused-disable-directives --max-warnings 0",
|
|
20
21
|
"preview": "vite preview",
|
|
21
|
-
"lint:fix": "
|
|
22
|
+
"lint:fix": "eslint . --fix && prettier . --write"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@emoji-mart/data": "^1.2.1",
|