@ethora/chat-component 25.1.17 → 25.2.1
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/dist/App.d.ts +1 -3
- package/dist/AppWithNav.d.ts +1 -0
- package/dist/assets/icons.d.ts +5 -4
- package/dist/assets/images.d.ts +4 -0
- package/dist/components/MainComponents/VirtualList.d.ts +11 -0
- package/dist/components/MessageBubble/CustomDivider.d.ts +2 -0
- package/dist/components/MessageBubble/MessageReaction.d.ts +1 -0
- package/dist/components/MessageBubble/MessageTranslations.d.ts +5 -7
- package/dist/components/RoomComponents/LastMessageItem.d.ts +8 -0
- package/dist/components/RoomComponents/styled/LastMessageEmoji.d.ts +7 -0
- package/dist/components/RoomComponents/styled/LastMessageFile.d.ts +7 -0
- package/dist/components/RoomComponents/styled/LastMessagePhoto.d.ts +7 -0
- package/dist/components/RoomComponents/styled/LastMessageVideo.d.ts +7 -0
- package/dist/components/RoomComponents/styled/LastTextMessage.d.ts +7 -0
- package/dist/components/RoomComponents/styled/StyledRoomComponents.d.ts +8 -0
- package/dist/components/styled/StyledInputComponents/MediaComponents.d.ts +6 -2
- package/dist/components/styled/StyledInputComponents/StyledInputComponents.d.ts +1 -1
- package/dist/components/styled/UnsupportedType.d.ts +1 -0
- package/dist/context/xmppProvider.d.ts +2 -1
- package/dist/helpers/getBooleanFromString.d.ts +1 -0
- package/dist/helpers/getNumberFromString.d.ts +1 -0
- package/dist/helpers/nanoToMs.d.ts +1 -0
- package/dist/hooks/useMessageQueue.d.ts +5 -0
- package/dist/main.js +34156 -33804
- package/dist/main.js.map +1 -1
- package/dist/networking/stanzaHandlers.d.ts +1 -1
- package/dist/networking/xmpp/getRoomsPaged.xmpp.d.ts +3 -0
- package/dist/networking/xmppClient.d.ts +4 -3
- package/dist/roomStore/Middleware/reactionsMiddleware.d.ts +3 -0
- package/dist/roomStore/roomsSlice.d.ts +3 -11
- package/dist/types/types.d.ts +70 -1
- package/dist/utils/PriorityQueue.d.ts +14 -0
- package/package.json +2 -1
|
@@ -11,7 +11,7 @@ declare const onPresenceInRoom: (stanza: Element | any) => void;
|
|
|
11
11
|
declare const onChatInvite: (stanza: Element, client: any) => Promise<void>;
|
|
12
12
|
declare const onGetMembers: (stanza: Element) => void;
|
|
13
13
|
declare const onGetRoomInfo: (stanza: Element) => void;
|
|
14
|
-
declare const onGetLastMessageArchive: (stanza: Element
|
|
14
|
+
declare const onGetLastMessageArchive: (stanza: Element) => void;
|
|
15
15
|
declare const onNewRoomCreated: (stanza: Element, xmpp: any) => void;
|
|
16
16
|
declare const onGetChatRooms: (stanza: Element, xmpp: any) => void;
|
|
17
17
|
export { onRealtimeMessage, onMessageHistory, onPresenceInRoom, onReactionHistory, onGetLastMessageArchive, handleComposing, onGetChatRooms, onNewRoomCreated, onGetMembers, onGetRoomInfo, onDeleteMessage, onEditMessage, onReactionMessage, onChatInvite, };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client } from '@xmpp/client';
|
|
2
|
-
import { XmppClientInterface } from '../types/types';
|
|
2
|
+
import { XmppClientInterface, xmppSettingsInterface } from '../types/types';
|
|
3
3
|
|
|
4
4
|
export declare class XmppClient implements XmppClientInterface {
|
|
5
5
|
client: Client;
|
|
@@ -14,13 +14,14 @@ export declare class XmppClient implements XmppClientInterface {
|
|
|
14
14
|
maxReconnectAttempts: number;
|
|
15
15
|
reconnectDelay: number;
|
|
16
16
|
checkOnline(): boolean;
|
|
17
|
-
constructor(username: string, password: string,
|
|
17
|
+
constructor(username: string, password: string, xmppSettings?: xmppSettingsInterface);
|
|
18
18
|
initializeClient(): void;
|
|
19
19
|
attachEventListeners(): void;
|
|
20
20
|
scheduleReconnect(): void;
|
|
21
21
|
reconnect(): void;
|
|
22
22
|
close(): Promise<void>;
|
|
23
|
-
getRoomsStanza: () => Promise<void>;
|
|
23
|
+
getRoomsStanza: (disableGetRooms?: boolean) => Promise<void>;
|
|
24
|
+
getRoomsPagedStanza(maxResults?: number, after?: string | null): Promise<void>;
|
|
24
25
|
createRoomStanza(title: string, description: string): Promise<string>;
|
|
25
26
|
inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
|
|
26
27
|
leaveTheRoomStanza: (roomJID: string) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { EditAction, IMessage, IRoom, ReactionAction } from '../types/types';
|
|
2
|
+
import { AddRoomMessageAction, EditAction, IMessage, IRoom, ReactionAction } from '../types/types';
|
|
3
3
|
|
|
4
4
|
interface RoomMessagesState {
|
|
5
5
|
rooms: {
|
|
@@ -35,11 +35,7 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
|
|
|
35
35
|
messageId: string;
|
|
36
36
|
text: string;
|
|
37
37
|
}>): void;
|
|
38
|
-
addRoomMessage(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<
|
|
39
|
-
roomJID: string;
|
|
40
|
-
message: IMessage;
|
|
41
|
-
start?: boolean;
|
|
42
|
-
}>): void;
|
|
38
|
+
addRoomMessage(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<AddRoomMessageAction>): void;
|
|
43
39
|
deleteAllRooms(state: import('immer').WritableDraft<RoomMessagesState>): void;
|
|
44
40
|
setComposing(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
45
41
|
chatJID: string;
|
|
@@ -80,11 +76,7 @@ export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOption
|
|
|
80
76
|
}, "roomMessages/addRoom">, deleteAllRooms: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/deleteAllRooms">, setRoomMessages: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
81
77
|
roomJID: string;
|
|
82
78
|
messages: IMessage[];
|
|
83
|
-
}, "roomMessages/setRoomMessages">, addRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
84
|
-
roomJID: string;
|
|
85
|
-
message: IMessage;
|
|
86
|
-
start?: boolean;
|
|
87
|
-
}, "roomMessages/addRoomMessage">, deleteRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
79
|
+
}, "roomMessages/setRoomMessages">, addRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<AddRoomMessageAction, "roomMessages/addRoomMessage">, deleteRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
88
80
|
roomJID: string;
|
|
89
81
|
messageId: string;
|
|
90
82
|
}, "roomMessages/deleteRoomMessage">, setEditAction: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<EditAction, "roomMessages/setEditAction">, editRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
package/dist/types/types.d.ts
CHANGED
|
@@ -32,8 +32,11 @@ export interface IMessage {
|
|
|
32
32
|
mainMessage?: string;
|
|
33
33
|
reply?: IReply[];
|
|
34
34
|
reaction?: Record<string, ReactionMessage>;
|
|
35
|
+
fileName?: string;
|
|
35
36
|
translations?: TranslationObject;
|
|
36
37
|
langSource?: string;
|
|
38
|
+
originalName?: string;
|
|
39
|
+
size?: string;
|
|
37
40
|
}
|
|
38
41
|
export interface ReactionMessage {
|
|
39
42
|
emoji: string[];
|
|
@@ -50,7 +53,7 @@ export interface IRoom {
|
|
|
50
53
|
isLoading: boolean;
|
|
51
54
|
roomBg: string;
|
|
52
55
|
id?: string;
|
|
53
|
-
lastMessage?:
|
|
56
|
+
lastMessage?: LastMessage;
|
|
54
57
|
lastMessageTimestamp?: number;
|
|
55
58
|
lastRoomMessage?: RoomLastMessage;
|
|
56
59
|
icon?: string;
|
|
@@ -61,6 +64,11 @@ export interface IRoom {
|
|
|
61
64
|
noMessages?: boolean;
|
|
62
65
|
role?: string;
|
|
63
66
|
roomMembers?: RoomMember[];
|
|
67
|
+
messageStats?: {
|
|
68
|
+
lastMessageTimestamp?: number;
|
|
69
|
+
firstMessageTimestamp?: number;
|
|
70
|
+
};
|
|
71
|
+
historyComplete?: boolean;
|
|
64
72
|
}
|
|
65
73
|
export interface RoomMember {
|
|
66
74
|
ban_status: string;
|
|
@@ -154,6 +162,12 @@ export interface IConfig {
|
|
|
154
162
|
enabled: boolean;
|
|
155
163
|
user: User | null;
|
|
156
164
|
};
|
|
165
|
+
customLogin?: {
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
loginFunction: any;
|
|
168
|
+
};
|
|
169
|
+
baseUrl?: string;
|
|
170
|
+
xmppSettings?: xmppSettingsInterface;
|
|
157
171
|
disableRooms?: boolean;
|
|
158
172
|
defaultLogin?: boolean;
|
|
159
173
|
disableInteractions?: boolean;
|
|
@@ -168,7 +182,36 @@ export interface IConfig {
|
|
|
168
182
|
enabled: boolean;
|
|
169
183
|
refreshFunction?: any;
|
|
170
184
|
};
|
|
185
|
+
backgroundChat?: {
|
|
186
|
+
color?: string;
|
|
187
|
+
image?: any;
|
|
188
|
+
};
|
|
189
|
+
bubleMessage?: {
|
|
190
|
+
backgroundMessageUser?: string;
|
|
191
|
+
backgroundMessage?: string;
|
|
192
|
+
colorUser?: string;
|
|
193
|
+
color?: string;
|
|
194
|
+
borderRadius?: number;
|
|
195
|
+
};
|
|
196
|
+
headerLogo?: any;
|
|
197
|
+
headerMenu?: () => void;
|
|
198
|
+
headerChatMenu?: () => void;
|
|
199
|
+
customRooms?: {
|
|
200
|
+
rooms: PartialRoomWithMandatoryKeys[];
|
|
201
|
+
disableGetRooms?: boolean;
|
|
202
|
+
singleRoom: boolean;
|
|
203
|
+
};
|
|
171
204
|
enableTranslates?: boolean;
|
|
205
|
+
disableRoomConfig?: boolean;
|
|
206
|
+
disableProfilesInteractions?: boolean;
|
|
207
|
+
disableUserCount?: boolean;
|
|
208
|
+
clearStoreBeforeInit?: boolean;
|
|
209
|
+
}
|
|
210
|
+
type PartialRoomWithMandatoryKeys = Partial<IRoom> & Pick<IRoom, 'jid' | 'title'>;
|
|
211
|
+
export interface xmppSettingsInterface {
|
|
212
|
+
devServer: string;
|
|
213
|
+
host: string;
|
|
214
|
+
conference?: string;
|
|
172
215
|
}
|
|
173
216
|
interface ConfigRoom {
|
|
174
217
|
jid: string;
|
|
@@ -192,6 +235,11 @@ export interface StorageUser {
|
|
|
192
235
|
isAssetsOpen?: boolean;
|
|
193
236
|
isProfileOpen?: boolean;
|
|
194
237
|
}
|
|
238
|
+
export interface xmppSettingsInterface {
|
|
239
|
+
devServer: string;
|
|
240
|
+
host: string;
|
|
241
|
+
conference?: string;
|
|
242
|
+
}
|
|
195
243
|
export interface MessageProps {
|
|
196
244
|
message: IMessage;
|
|
197
245
|
isUser: boolean;
|
|
@@ -215,6 +263,7 @@ export interface ReactionAction {
|
|
|
215
263
|
messageId: string;
|
|
216
264
|
from: string;
|
|
217
265
|
reactions: string[];
|
|
266
|
+
latestReactionTimestamp?: string;
|
|
218
267
|
data?: Record<string, string>;
|
|
219
268
|
}
|
|
220
269
|
export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
|
|
@@ -228,6 +277,11 @@ export interface ReactionAction {
|
|
|
228
277
|
messageId: string;
|
|
229
278
|
reactions: string[];
|
|
230
279
|
}
|
|
280
|
+
export interface AddRoomMessageAction {
|
|
281
|
+
roomJID: string;
|
|
282
|
+
message: IMessage;
|
|
283
|
+
start?: boolean;
|
|
284
|
+
}
|
|
231
285
|
export interface XmppClientInterface {
|
|
232
286
|
client: Client;
|
|
233
287
|
devServer?: string;
|
|
@@ -267,6 +321,7 @@ export interface XmppClientInterface {
|
|
|
267
321
|
sendMediaMessageStanza(roomJID: string, data: any): void;
|
|
268
322
|
createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
|
|
269
323
|
sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], reactionSymbol?: any): void;
|
|
324
|
+
getRoomsPagedStanza(maxResults: number, after: string | null): void;
|
|
270
325
|
}
|
|
271
326
|
export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
|
|
272
327
|
export interface Language {
|
|
@@ -277,4 +332,18 @@ export type LanguageOptions = {
|
|
|
277
332
|
languages: Array<Language>;
|
|
278
333
|
language?: Iso639_1Codes;
|
|
279
334
|
};
|
|
335
|
+
export type MediaFile = {
|
|
336
|
+
uri: string;
|
|
337
|
+
type: string;
|
|
338
|
+
name: string;
|
|
339
|
+
};
|
|
340
|
+
export interface LastMessage extends Omit<Partial<IMessage>, 'date'> {
|
|
341
|
+
body: string;
|
|
342
|
+
date?: string | Date;
|
|
343
|
+
emoji?: string;
|
|
344
|
+
locationPreview?: string;
|
|
345
|
+
filename?: string;
|
|
346
|
+
mimetype?: string;
|
|
347
|
+
originalName?: string;
|
|
348
|
+
}
|
|
280
349
|
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class PriorityQueue<T> {
|
|
2
|
+
private items;
|
|
3
|
+
private compare;
|
|
4
|
+
constructor(compareFunction: (a: T, b: T) => number);
|
|
5
|
+
push(item: T): void;
|
|
6
|
+
pop(): T | undefined;
|
|
7
|
+
peek(): T | undefined;
|
|
8
|
+
clear(): void;
|
|
9
|
+
isEmpty(): boolean;
|
|
10
|
+
size(): number;
|
|
11
|
+
find(predicate: (item: T) => boolean): T | undefined;
|
|
12
|
+
toArray(): T[];
|
|
13
|
+
contains(predicate: (item: T) => boolean): boolean;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethora/chat-component",
|
|
3
|
-
"version": "25.01
|
|
3
|
+
"version": "25.02.01",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"react-dom": "^18.3.1",
|
|
35
35
|
"react-qr-code": "^2.0.15",
|
|
36
36
|
"react-redux": "^9.1.0",
|
|
37
|
+
"react-router-dom": "^7.1.5",
|
|
37
38
|
"redux": "^5.0.1",
|
|
38
39
|
"redux-persist": "^6.0.0",
|
|
39
40
|
"redux-persist-transform-encrypt": "^5.1.1",
|