@ethora/chat-component 25.4.11 → 25.5.12
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/assets/icons.d.ts +8 -0
- package/dist/helpers/handleXmppError.d.ts +4 -0
- package/dist/helpers/isChatIdPresentInArray.d.ts +4 -2
- package/dist/main.js +2279 -2271
- package/dist/main.js.map +1 -1
- package/dist/types/models/action.model.d.ts +26 -0
- package/dist/types/models/config.model.d.ts +96 -0
- package/dist/types/models/language.model.d.ts +9 -0
- package/dist/types/models/media.model.d.ts +5 -0
- package/dist/types/models/message.model.d.ts +63 -0
- package/dist/types/models/modal.model.d.ts +8 -0
- package/dist/types/models/room.model.d.ts +105 -0
- package/dist/types/models/user.model.d.ts +77 -0
- package/dist/types/models/xmpp.model.d.ts +60 -0
- package/dist/types/types.d.ts +11 -431
- package/package.json +3 -3
package/dist/types/types.d.ts
CHANGED
|
@@ -1,431 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
export interface IMessage {
|
|
13
|
-
id: string;
|
|
14
|
-
user: IUser;
|
|
15
|
-
date: Date | string;
|
|
16
|
-
body: string;
|
|
17
|
-
roomJid: string;
|
|
18
|
-
key?: string;
|
|
19
|
-
coinsInMessage?: string | number;
|
|
20
|
-
numberOfReplies?: number[] | number;
|
|
21
|
-
isSystemMessage?: string;
|
|
22
|
-
isMediafile?: string;
|
|
23
|
-
locationPreview?: string;
|
|
24
|
-
mimetype?: string;
|
|
25
|
-
location?: string;
|
|
26
|
-
pending?: boolean;
|
|
27
|
-
timestamp?: number;
|
|
28
|
-
showInChannel?: string;
|
|
29
|
-
activeMessage?: boolean;
|
|
30
|
-
isReply?: boolean | string;
|
|
31
|
-
isDeleted?: boolean;
|
|
32
|
-
mainMessage?: string;
|
|
33
|
-
reply?: IReply[];
|
|
34
|
-
reaction?: Record<string, ReactionMessage>;
|
|
35
|
-
fileName?: string;
|
|
36
|
-
translations?: TranslationObject;
|
|
37
|
-
langSource?: string;
|
|
38
|
-
originalName?: string;
|
|
39
|
-
size?: string;
|
|
40
|
-
xmppId?: string;
|
|
41
|
-
xmppFrom?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ReactionMessage {
|
|
44
|
-
emoji: string[];
|
|
45
|
-
data: Record<string, string>;
|
|
46
|
-
}
|
|
47
|
-
export interface IReply extends IMessage {
|
|
48
|
-
}
|
|
49
|
-
export interface IRoom {
|
|
50
|
-
name: string;
|
|
51
|
-
jid: string;
|
|
52
|
-
title: string;
|
|
53
|
-
usersCnt: number;
|
|
54
|
-
messages: IMessage[];
|
|
55
|
-
isLoading: boolean;
|
|
56
|
-
roomBg: string;
|
|
57
|
-
members?: RoomMember[];
|
|
58
|
-
type?: 'public' | 'group' | 'private';
|
|
59
|
-
creteadAt?: string;
|
|
60
|
-
appId?: string;
|
|
61
|
-
createdAt?: string;
|
|
62
|
-
createdBy?: string;
|
|
63
|
-
description?: string;
|
|
64
|
-
isAppChat?: boolean;
|
|
65
|
-
picture?: string;
|
|
66
|
-
updatedAt?: string;
|
|
67
|
-
__v?: number | string;
|
|
68
|
-
_id?: string;
|
|
69
|
-
id?: string;
|
|
70
|
-
lastMessage?: LastMessage;
|
|
71
|
-
lastMessageTimestamp?: number;
|
|
72
|
-
lastRoomMessage?: RoomLastMessage;
|
|
73
|
-
icon?: string;
|
|
74
|
-
composing?: boolean;
|
|
75
|
-
composingList?: string[];
|
|
76
|
-
lastViewedTimestamp?: number;
|
|
77
|
-
unreadMessages?: number;
|
|
78
|
-
noMessages?: boolean;
|
|
79
|
-
role?: string;
|
|
80
|
-
messageStats?: {
|
|
81
|
-
lastMessageTimestamp?: number;
|
|
82
|
-
firstMessageTimestamp?: number;
|
|
83
|
-
};
|
|
84
|
-
historyComplete?: boolean;
|
|
85
|
-
}
|
|
86
|
-
export interface ApiRoom {
|
|
87
|
-
name: string;
|
|
88
|
-
type: 'public' | 'group' | 'private';
|
|
89
|
-
title?: string;
|
|
90
|
-
description?: string;
|
|
91
|
-
picture?: string;
|
|
92
|
-
members?: RoomMember[];
|
|
93
|
-
createdBy?: string;
|
|
94
|
-
appId?: any;
|
|
95
|
-
_id?: string;
|
|
96
|
-
isAppChat?: boolean;
|
|
97
|
-
createdAt?: string;
|
|
98
|
-
updatedAt?: string;
|
|
99
|
-
__v?: string;
|
|
100
|
-
}
|
|
101
|
-
export interface PostRoom {
|
|
102
|
-
title: string;
|
|
103
|
-
uuid?: string;
|
|
104
|
-
type: 'public' | 'group';
|
|
105
|
-
description?: string;
|
|
106
|
-
picture?: string;
|
|
107
|
-
members?: string[];
|
|
108
|
-
}
|
|
109
|
-
export interface PostReportRoom {
|
|
110
|
-
chatName: string;
|
|
111
|
-
category: string;
|
|
112
|
-
text?: string;
|
|
113
|
-
}
|
|
114
|
-
export interface PostAddRoomMember {
|
|
115
|
-
chatName: string;
|
|
116
|
-
members: string[];
|
|
117
|
-
}
|
|
118
|
-
export interface DeleteRoomMember {
|
|
119
|
-
roomId: string;
|
|
120
|
-
members: string[];
|
|
121
|
-
}
|
|
122
|
-
export interface IRoomCompressed extends Pick<IRoom, 'jid'> {
|
|
123
|
-
}
|
|
124
|
-
export interface RoomMember {
|
|
125
|
-
firstName: string;
|
|
126
|
-
lastName: string;
|
|
127
|
-
xmppUsername: string;
|
|
128
|
-
_id: string;
|
|
129
|
-
ban_status?: string;
|
|
130
|
-
jid?: string;
|
|
131
|
-
name?: string;
|
|
132
|
-
role?: string;
|
|
133
|
-
last_active?: number;
|
|
134
|
-
}
|
|
135
|
-
export interface RoomLastMessage {
|
|
136
|
-
name: string;
|
|
137
|
-
body: string;
|
|
138
|
-
}
|
|
139
|
-
export interface UserType extends IMessage {
|
|
140
|
-
id: any;
|
|
141
|
-
user: any;
|
|
142
|
-
timestamp: any;
|
|
143
|
-
text: any;
|
|
144
|
-
}
|
|
145
|
-
export interface ConfigUser {
|
|
146
|
-
email: string;
|
|
147
|
-
password: string;
|
|
148
|
-
}
|
|
149
|
-
export interface User {
|
|
150
|
-
walletAddress: string;
|
|
151
|
-
description?: string;
|
|
152
|
-
token: string;
|
|
153
|
-
refreshToken: string;
|
|
154
|
-
defaultWallet: {
|
|
155
|
-
walletAddress: string;
|
|
156
|
-
};
|
|
157
|
-
_id: string;
|
|
158
|
-
firstName: string;
|
|
159
|
-
lastName: string;
|
|
160
|
-
email?: string;
|
|
161
|
-
profileImage?: string;
|
|
162
|
-
emails?: [
|
|
163
|
-
{
|
|
164
|
-
loginType: string;
|
|
165
|
-
email: string;
|
|
166
|
-
verified: boolean;
|
|
167
|
-
_id: string;
|
|
168
|
-
}
|
|
169
|
-
];
|
|
170
|
-
appId: string;
|
|
171
|
-
username: string;
|
|
172
|
-
xmppPassword: string;
|
|
173
|
-
langSource?: Iso639_1Codes;
|
|
174
|
-
homeScreen?: string;
|
|
175
|
-
registrationChannelType?: string;
|
|
176
|
-
updatedAt?: string;
|
|
177
|
-
authMethod?: string;
|
|
178
|
-
resetPasswordExpires?: string;
|
|
179
|
-
resetPasswordToken?: string;
|
|
180
|
-
xmppUsername?: string;
|
|
181
|
-
roles?: string[];
|
|
182
|
-
tags?: string[];
|
|
183
|
-
__v?: number;
|
|
184
|
-
isProfileOpen?: boolean;
|
|
185
|
-
isAssetsOpen?: boolean;
|
|
186
|
-
isAgreeWithTerms?: boolean;
|
|
187
|
-
isSuperAdmin?: any;
|
|
188
|
-
}
|
|
189
|
-
export interface XmppState {
|
|
190
|
-
client: any;
|
|
191
|
-
loading: boolean;
|
|
192
|
-
}
|
|
193
|
-
export interface FBConfig {
|
|
194
|
-
apiKey: string;
|
|
195
|
-
authDomain: string;
|
|
196
|
-
projectId: string;
|
|
197
|
-
storageBucket: string;
|
|
198
|
-
messagingSenderId: string;
|
|
199
|
-
appId: string;
|
|
200
|
-
}
|
|
201
|
-
export interface MessageBubble {
|
|
202
|
-
backgroundMessageUser?: string;
|
|
203
|
-
backgroundMessage?: string;
|
|
204
|
-
colorUser?: string;
|
|
205
|
-
color?: string;
|
|
206
|
-
borderRadius?: number;
|
|
207
|
-
}
|
|
208
|
-
export interface IConfig {
|
|
209
|
-
disableHeader?: boolean;
|
|
210
|
-
disableMedia?: boolean;
|
|
211
|
-
colors?: {
|
|
212
|
-
primary: string;
|
|
213
|
-
secondary: string;
|
|
214
|
-
};
|
|
215
|
-
googleLogin?: {
|
|
216
|
-
enabled: boolean;
|
|
217
|
-
firebaseConfig: FBConfig;
|
|
218
|
-
};
|
|
219
|
-
jwtLogin?: {
|
|
220
|
-
token: string;
|
|
221
|
-
enabled: boolean;
|
|
222
|
-
handleBadlogin?: React.ReactElement;
|
|
223
|
-
};
|
|
224
|
-
userLogin?: {
|
|
225
|
-
enabled: boolean;
|
|
226
|
-
user: User | null;
|
|
227
|
-
};
|
|
228
|
-
customLogin?: {
|
|
229
|
-
enabled: boolean;
|
|
230
|
-
loginFunction: any;
|
|
231
|
-
};
|
|
232
|
-
baseUrl?: string;
|
|
233
|
-
customAppToken?: string;
|
|
234
|
-
xmppSettings?: xmppSettingsInterface;
|
|
235
|
-
disableRooms?: boolean;
|
|
236
|
-
defaultLogin?: boolean;
|
|
237
|
-
disableInteractions?: boolean;
|
|
238
|
-
chatHeaderBurgerMenu?: boolean;
|
|
239
|
-
forceSetRoom?: boolean;
|
|
240
|
-
roomListStyles?: React.CSSProperties;
|
|
241
|
-
chatRoomStyles?: React.CSSProperties;
|
|
242
|
-
setRoomJidInPath?: boolean;
|
|
243
|
-
disableRoomMenu?: boolean;
|
|
244
|
-
defaultRooms?: ConfigRoom[];
|
|
245
|
-
refreshTokens?: {
|
|
246
|
-
enabled: boolean;
|
|
247
|
-
refreshFunction?: any;
|
|
248
|
-
};
|
|
249
|
-
backgroundChat?: {
|
|
250
|
-
color?: string;
|
|
251
|
-
image?: any;
|
|
252
|
-
};
|
|
253
|
-
bubleMessage?: MessageBubble;
|
|
254
|
-
headerLogo?: any;
|
|
255
|
-
headerMenu?: () => void;
|
|
256
|
-
headerChatMenu?: () => void;
|
|
257
|
-
customRooms?: {
|
|
258
|
-
rooms: PartialRoomWithMandatoryKeys[];
|
|
259
|
-
disableGetRooms?: boolean;
|
|
260
|
-
singleRoom: boolean;
|
|
261
|
-
};
|
|
262
|
-
translates?: {
|
|
263
|
-
enabled: boolean;
|
|
264
|
-
translations?: Iso639_1Codes;
|
|
265
|
-
};
|
|
266
|
-
disableRoomConfig?: boolean;
|
|
267
|
-
disableProfilesInteractions?: boolean;
|
|
268
|
-
disableUserCount?: boolean;
|
|
269
|
-
clearStoreBeforeInit?: boolean;
|
|
270
|
-
disableSentLogic?: boolean;
|
|
271
|
-
initBeforeLoad?: boolean;
|
|
272
|
-
newArch?: boolean;
|
|
273
|
-
qrUrl?: string;
|
|
274
|
-
secondarySendButton?: {
|
|
275
|
-
enabled: boolean;
|
|
276
|
-
messageEdit: string;
|
|
277
|
-
buttonText: string;
|
|
278
|
-
buttonStyles?: React.CSSProperties;
|
|
279
|
-
};
|
|
280
|
-
enableRoomsRetry?: {
|
|
281
|
-
enabled: boolean;
|
|
282
|
-
helperText: string;
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
type PartialRoomWithMandatoryKeys = Partial<IRoom> & Pick<IRoom, 'jid' | 'title'>;
|
|
286
|
-
export interface xmppSettingsInterface {
|
|
287
|
-
devServer: string;
|
|
288
|
-
host: string;
|
|
289
|
-
conference?: string;
|
|
290
|
-
}
|
|
291
|
-
interface ConfigRoom {
|
|
292
|
-
jid: string;
|
|
293
|
-
pinned: boolean;
|
|
294
|
-
_id?: string;
|
|
295
|
-
}
|
|
296
|
-
export interface StorageUser {
|
|
297
|
-
appId: string;
|
|
298
|
-
company: any[];
|
|
299
|
-
firstName: string;
|
|
300
|
-
homeScreen: string;
|
|
301
|
-
lastName: string;
|
|
302
|
-
referrerId: string;
|
|
303
|
-
refreshToken: string;
|
|
304
|
-
token: string;
|
|
305
|
-
walletAddress: string;
|
|
306
|
-
xmppPassword: string;
|
|
307
|
-
_id: string;
|
|
308
|
-
isAgreeWithTerms?: boolean;
|
|
309
|
-
isAllowedNewAppCreate?: boolean;
|
|
310
|
-
isAssetsOpen?: boolean;
|
|
311
|
-
isProfileOpen?: boolean;
|
|
312
|
-
}
|
|
313
|
-
export interface xmppSettingsInterface {
|
|
314
|
-
devServer: string;
|
|
315
|
-
host: string;
|
|
316
|
-
conference?: string;
|
|
317
|
-
}
|
|
318
|
-
export interface MessageProps {
|
|
319
|
-
message: IMessage;
|
|
320
|
-
isUser: boolean;
|
|
321
|
-
isReply: boolean;
|
|
322
|
-
}
|
|
323
|
-
export interface MediaMessageType {
|
|
324
|
-
}
|
|
325
|
-
export interface DeleteModal {
|
|
326
|
-
isDeleteModal: boolean;
|
|
327
|
-
roomJid?: string;
|
|
328
|
-
messageId?: string;
|
|
329
|
-
}
|
|
330
|
-
export interface EditAction {
|
|
331
|
-
isEdit: boolean;
|
|
332
|
-
roomJid?: string;
|
|
333
|
-
messageId?: string;
|
|
334
|
-
text?: string;
|
|
335
|
-
}
|
|
336
|
-
export interface ReactionAction {
|
|
337
|
-
roomJID: string;
|
|
338
|
-
messageId: string;
|
|
339
|
-
from: string;
|
|
340
|
-
reactions: string[];
|
|
341
|
-
latestReactionTimestamp?: string;
|
|
342
|
-
data?: Record<string, string>;
|
|
343
|
-
}
|
|
344
|
-
export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
|
|
345
|
-
export interface ModalFile {
|
|
346
|
-
fileName: string;
|
|
347
|
-
fileURL: string;
|
|
348
|
-
mimetype: string;
|
|
349
|
-
}
|
|
350
|
-
export interface ReactionAction {
|
|
351
|
-
roomJID: string;
|
|
352
|
-
messageId: string;
|
|
353
|
-
reactions: string[];
|
|
354
|
-
}
|
|
355
|
-
export interface AddRoomMessageAction {
|
|
356
|
-
roomJID: string;
|
|
357
|
-
message: IMessage;
|
|
358
|
-
start?: boolean;
|
|
359
|
-
}
|
|
360
|
-
export interface XmppClientInterface {
|
|
361
|
-
client: Client;
|
|
362
|
-
devServer?: string;
|
|
363
|
-
host: string;
|
|
364
|
-
service: string;
|
|
365
|
-
conference: string;
|
|
366
|
-
username: string;
|
|
367
|
-
status: string;
|
|
368
|
-
password: string;
|
|
369
|
-
reconnectAttempts: number;
|
|
370
|
-
maxReconnectAttempts: number;
|
|
371
|
-
reconnectDelay: number;
|
|
372
|
-
checkOnline(): boolean;
|
|
373
|
-
initializeClient(): void;
|
|
374
|
-
attachEventListeners(): void;
|
|
375
|
-
reconnect(): Promise<void>;
|
|
376
|
-
close(): Promise<void>;
|
|
377
|
-
ensureConnected(timeout?: number): Promise<void>;
|
|
378
|
-
getRoomsStanza(disableGetRooms?: boolean): Promise<void>;
|
|
379
|
-
createRoomStanza(title: string, description: string, to?: string): Promise<any>;
|
|
380
|
-
inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
|
|
381
|
-
leaveTheRoomStanza(roomJID: string): void;
|
|
382
|
-
presenceInRoomStanza(roomJID: string): void;
|
|
383
|
-
getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string): Promise<any>;
|
|
384
|
-
getLastMessageArchiveStanza(roomJID: string): void;
|
|
385
|
-
setRoomImageStanza(roomJid: string, roomThumbnail: string, type: string, roomBackground?: string): void;
|
|
386
|
-
getRoomInfoStanza(roomJID: string): void;
|
|
387
|
-
getRoomMembersStanza(roomJID: string): void;
|
|
388
|
-
setVCardStanza(xmppUsername: string): void;
|
|
389
|
-
sendMessage(roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string): void;
|
|
390
|
-
deleteMessageStanza(room: string, msgId: string): void;
|
|
391
|
-
editMessageStanza(room: string, msgId: string, text: string): void;
|
|
392
|
-
sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
|
|
393
|
-
getChatsPrivateStoreRequestStanza(): Promise<any>;
|
|
394
|
-
actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number, chats?: string[]): Promise<void>;
|
|
395
|
-
sendMediaMessageStanza(roomJID: string, data: any): void;
|
|
396
|
-
createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
|
|
397
|
-
sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], reactionSymbol?: any): void;
|
|
398
|
-
sendTextMessageWithTranslateTagStanza(roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, langSource?: Iso639_1Codes): void;
|
|
399
|
-
disconnect?(): Promise<void>;
|
|
400
|
-
}
|
|
401
|
-
export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
|
|
402
|
-
export interface Language {
|
|
403
|
-
iso639_1: Iso639_1Codes;
|
|
404
|
-
name: string;
|
|
405
|
-
}
|
|
406
|
-
export type LanguageOptions = {
|
|
407
|
-
languages: Array<Language>;
|
|
408
|
-
language?: Iso639_1Codes;
|
|
409
|
-
};
|
|
410
|
-
export type MediaFile = {
|
|
411
|
-
uri: string;
|
|
412
|
-
type: string;
|
|
413
|
-
name: string;
|
|
414
|
-
};
|
|
415
|
-
export interface LastMessage extends Omit<Partial<IMessage>, 'date'> {
|
|
416
|
-
body: string;
|
|
417
|
-
date?: string | Date;
|
|
418
|
-
emoji?: string;
|
|
419
|
-
locationPreview?: string;
|
|
420
|
-
filename?: string;
|
|
421
|
-
mimetype?: string;
|
|
422
|
-
originalName?: string;
|
|
423
|
-
}
|
|
424
|
-
export type ChatAccessOption = {
|
|
425
|
-
name: 'Public';
|
|
426
|
-
id: 'public';
|
|
427
|
-
} | {
|
|
428
|
-
name: 'Members-only';
|
|
429
|
-
id: 'group';
|
|
430
|
-
};
|
|
431
|
-
export {};
|
|
1
|
+
export * from './models/user.model';
|
|
2
|
+
export * from './models/message.model';
|
|
3
|
+
export * from './models/room.model';
|
|
4
|
+
export * from './models/xmpp.model';
|
|
5
|
+
export * from './models/config.model';
|
|
6
|
+
export * from './models/action.model';
|
|
7
|
+
export * from './models/modal.model';
|
|
8
|
+
export * from './models/language.model';
|
|
9
|
+
export * from './models/media.model';
|
|
10
|
+
export { MODAL_TYPES } from '../helpers/constants/MODAL_TYPES';
|
|
11
|
+
export type { TranslationObject } from '../helpers/transformTranslatations';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethora/chat-component",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.05.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/react-dom": "^18.2.22",
|
|
24
24
|
"@types/styled-components": "^5.1.34",
|
|
25
25
|
"@xmpp/client": "^0.13.1",
|
|
26
|
-
"axios": "^1.7.
|
|
26
|
+
"axios": "^1.7.4",
|
|
27
27
|
"emoji-mart": "^5.6.0",
|
|
28
28
|
"firebase": "^10.13.2",
|
|
29
29
|
"i": "^0.3.7",
|
|
@@ -34,7 +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.
|
|
37
|
+
"react-router-dom": "^7.5.2",
|
|
38
38
|
"redux": "^5.0.1",
|
|
39
39
|
"redux-persist": "^6.0.0",
|
|
40
40
|
"redux-persist-transform-encrypt": "^5.1.1",
|