@ethora/chat-component 25.1.2 → 25.1.11
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/components/MainComponents/Select.d.ts +20 -0
- package/dist/components/MessageBubble/CustomDivider.d.ts +3 -0
- package/dist/components/MessageBubble/MessageTranslations.d.ts +13 -0
- package/dist/helpers/createMessageFromXml.d.ts +5 -32
- package/dist/helpers/getDataFromXml.d.ts +18 -0
- package/dist/helpers/hashcolor.d.ts +0 -1
- package/dist/helpers/initRoomsPresence.d.ts +6 -0
- package/dist/helpers/storeConsole.d.ts +3 -0
- package/dist/helpers/transformTranslatations.d.ts +10 -0
- package/dist/helpers/updateMessagesTillLast.d.ts +6 -0
- package/dist/helpers/updatedChatLastTimestamps.d.ts +1 -0
- package/dist/hooks/useChatSettingState.d.ts +2 -1
- package/dist/hooks/useLocalStorage.d.ts +1 -0
- package/dist/hooks/useMessageLoaderQueue.d.ts +5 -1
- package/dist/main.js +8678 -6349
- package/dist/main.js.map +1 -1
- package/dist/networking/stanzaHandlers.d.ts +1 -1
- package/dist/networking/xmpp/handleStanzas.xmpp.d.ts +4 -1
- package/dist/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +16 -0
- package/dist/networking/xmppClient.d.ts +2 -1
- package/dist/roomStore/Middleware/newMessageMidlleware.d.ts +3 -0
- package/dist/roomStore/chatSettingsSlice.d.ts +8 -5
- package/dist/roomStore/index.d.ts +15 -0
- package/dist/roomStore/roomsSlice.d.ts +1 -0
- package/dist/types/types.d.ts +17 -2
- package/package.json +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Element } from 'ltx';
|
|
2
2
|
|
|
3
|
-
declare const onRealtimeMessage: (stanza: Element) => Promise<
|
|
3
|
+
declare const onRealtimeMessage: (stanza: Element) => Promise<import('../types/types').IMessage>;
|
|
4
4
|
declare const onDeleteMessage: (stanza: Element) => Promise<void>;
|
|
5
5
|
declare const onEditMessage: (stanza: Element) => Promise<void>;
|
|
6
6
|
declare const onMessageHistory: (stanza: any) => Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Client } from '@xmpp/client';
|
|
2
|
+
import { Iso639_1Codes } from '../../types/types';
|
|
3
|
+
|
|
4
|
+
export declare const sendTextMessageWithTranslateTag: (client: Client, stanzaMessage: {
|
|
5
|
+
roomJID: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
photo: string;
|
|
9
|
+
walletAddress: string;
|
|
10
|
+
userMessage: string;
|
|
11
|
+
notDisplayedValue?: string;
|
|
12
|
+
isReply?: boolean;
|
|
13
|
+
showInChannel?: boolean;
|
|
14
|
+
mainMessage?: string;
|
|
15
|
+
devServer?: string;
|
|
16
|
+
}, source: Iso639_1Codes) => void;
|
|
@@ -25,13 +25,14 @@ export declare class XmppClient implements XmppClientInterface {
|
|
|
25
25
|
inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
|
|
26
26
|
leaveTheRoomStanza: (roomJID: string) => void;
|
|
27
27
|
presenceInRoomStanza: (roomJID: string) => void;
|
|
28
|
-
getHistoryStanza: (chatJID: string, max: number, before?: number,
|
|
28
|
+
getHistoryStanza: (chatJID: string, max: number, before?: number, otherStanzaId?: string) => Promise<any>;
|
|
29
29
|
getLastMessageArchiveStanza(roomJID: string): void;
|
|
30
30
|
setRoomImageStanza: (roomJid: string, roomThumbnail: string, type: string, roomBackground?: string) => void;
|
|
31
31
|
getRoomInfoStanza: (roomJID: string) => void;
|
|
32
32
|
getRoomMembersStanza: (roomJID: string) => void;
|
|
33
33
|
setVCardStanza(xmppUsername: string): void;
|
|
34
34
|
sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string) => void;
|
|
35
|
+
sendTextMessageWithTranslateTagStanza: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string) => void;
|
|
35
36
|
deleteMessageStanza(room: string, msgId: string): void;
|
|
36
37
|
editMessageStanza(room: string, msgId: string, text: string): void;
|
|
37
38
|
sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { DeleteModal, IConfig, IUser, ModalFile, ModalType, User } from '../types/types';
|
|
3
|
+
import { default as XmppClient } from '../networking/xmppClient';
|
|
3
4
|
|
|
4
5
|
interface ChatState {
|
|
5
6
|
user: User;
|
|
@@ -8,7 +9,8 @@ interface ChatState {
|
|
|
8
9
|
deleteModal?: DeleteModal;
|
|
9
10
|
selectedUser?: IUser;
|
|
10
11
|
activeFile?: ModalFile;
|
|
11
|
-
client?:
|
|
12
|
+
client?: XmppClient;
|
|
13
|
+
langSource?: string;
|
|
12
14
|
}
|
|
13
15
|
export declare const chatSlice: import('@reduxjs/toolkit').Slice<ChatState, {
|
|
14
16
|
setUser: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<User>) => void;
|
|
@@ -21,17 +23,18 @@ export declare const chatSlice: import('@reduxjs/toolkit').Slice<ChatState, {
|
|
|
21
23
|
setDeleteModal: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<DeleteModal | undefined>) => void;
|
|
22
24
|
setStoreClient: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<any>) => void;
|
|
23
25
|
setSelectedUser: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<IUser | undefined>) => void;
|
|
26
|
+
setLangSource: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<string | undefined>) => void;
|
|
24
27
|
refreshTokens: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<{
|
|
25
28
|
token: string;
|
|
26
29
|
refreshToken: string;
|
|
27
30
|
}>) => void;
|
|
28
31
|
logout: (state: import('immer').WritableDraft<ChatState>) => void;
|
|
29
|
-
}, "
|
|
30
|
-
export declare const setUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<User, "
|
|
32
|
+
}, "chatSettingStore", "chatSettingStore", import('@reduxjs/toolkit').SliceSelectors<ChatState>>;
|
|
33
|
+
export declare const setUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<User, "chatSettingStore/setUser">, setConfig: import('@reduxjs/toolkit').ActionCreatorWithNonInferrablePayload<"chatSettingStore/setConfig">, refreshTokens: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
31
34
|
token: string;
|
|
32
35
|
refreshToken: string;
|
|
33
|
-
}, "
|
|
36
|
+
}, "chatSettingStore/refreshTokens">, logout: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"chatSettingStore/logout">, setActiveModal: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<string, "chatSettingStore/setActiveModal">, setDeleteModal: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<DeleteModal, "chatSettingStore/setDeleteModal">, setSelectedUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<IUser, "chatSettingStore/setSelectedUser">, updateUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
34
37
|
updates: Partial<User>;
|
|
35
|
-
}, "
|
|
38
|
+
}, "chatSettingStore/updateUser">, setActiveFile: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<ModalFile, "chatSettingStore/setActiveFile">, setStoreClient: import('@reduxjs/toolkit').ActionCreatorWithPayload<any, "chatSettingStore/setStoreClient">, setLangSource: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<string, "chatSettingStore/setLangSource">;
|
|
36
39
|
declare const _default: import('redux').Reducer<ChatState>;
|
|
37
40
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as chatSettingsReducer } from './chatSettingsSlice';
|
|
2
|
+
import { default as roomsSlice } from './roomsSlice';
|
|
3
|
+
import { IRoom } from '../types/types';
|
|
4
|
+
import { AnyAction } from 'redux-saga';
|
|
5
|
+
|
|
6
|
+
export declare const getActiveRoom: (state: RootState) => IRoom | null;
|
|
7
|
+
export declare const store: import('@reduxjs/toolkit').EnhancedStore<RootState, AnyAction, import('@reduxjs/toolkit').Tuple<[import('redux').StoreEnhancer<{
|
|
8
|
+
dispatch: import('redux-thunk').ThunkDispatch<RootState, undefined, import('redux').UnknownAction>;
|
|
9
|
+
}>, import('redux').StoreEnhancer]>>;
|
|
10
|
+
export declare const persistor: import('redux-persist').Persistor;
|
|
11
|
+
export type RootState = {
|
|
12
|
+
chatSettingStore: ReturnType<typeof chatSettingsReducer>;
|
|
13
|
+
rooms: ReturnType<typeof roomsSlice>;
|
|
14
|
+
};
|
|
15
|
+
export type AppDispatch = typeof store.dispatch;
|
|
@@ -73,6 +73,7 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
|
|
|
73
73
|
chatJID: string;
|
|
74
74
|
}>) => void;
|
|
75
75
|
}, "roomMessages", "roomMessages", import('@reduxjs/toolkit').SliceSelectors<RoomMessagesState>>;
|
|
76
|
+
export declare const getLastMessageTimestamp: (state: RoomMessagesState, jid: string) => string | null;
|
|
76
77
|
export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
77
78
|
roomData: IRoom;
|
|
78
79
|
}, "roomMessages/addRoom">, deleteAllRooms: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/deleteAllRooms">, setRoomMessages: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client } from '@xmpp/client';
|
|
2
2
|
import { MODAL_TYPES } from '../helpers/constants/MODAL_TYPES';
|
|
3
|
+
import { TranslationObject } from '../helpers/transformTranslatations';
|
|
3
4
|
|
|
4
5
|
export interface IUser extends Partial<User> {
|
|
5
6
|
id: string;
|
|
@@ -30,11 +31,12 @@ export interface IMessage {
|
|
|
30
31
|
isDeleted?: boolean;
|
|
31
32
|
mainMessage?: string;
|
|
32
33
|
reply?: IReply[];
|
|
34
|
+
translations?: TranslationObject;
|
|
35
|
+
langSource?: string;
|
|
33
36
|
}
|
|
34
37
|
export interface IReply extends IMessage {
|
|
35
38
|
}
|
|
36
39
|
export interface IRoom {
|
|
37
|
-
id: string;
|
|
38
40
|
name: string;
|
|
39
41
|
jid: string;
|
|
40
42
|
title: string;
|
|
@@ -42,7 +44,9 @@ export interface IRoom {
|
|
|
42
44
|
messages: IMessage[];
|
|
43
45
|
isLoading: boolean;
|
|
44
46
|
roomBg: string;
|
|
47
|
+
id?: string;
|
|
45
48
|
lastMessage?: string;
|
|
49
|
+
lastMessageTimestamp?: number;
|
|
46
50
|
lastRoomMessage?: RoomLastMessage;
|
|
47
51
|
icon?: string;
|
|
48
52
|
composing?: boolean;
|
|
@@ -98,6 +102,7 @@ export interface User {
|
|
|
98
102
|
];
|
|
99
103
|
appId: string;
|
|
100
104
|
xmppPassword: string;
|
|
105
|
+
langSource?: Iso639_1Codes;
|
|
101
106
|
homeScreen?: string;
|
|
102
107
|
registrationChannelType?: string;
|
|
103
108
|
updatedAt?: string;
|
|
@@ -158,6 +163,7 @@ export interface IConfig {
|
|
|
158
163
|
enabled: boolean;
|
|
159
164
|
refreshFunction?: any;
|
|
160
165
|
};
|
|
166
|
+
enableTranslates?: boolean;
|
|
161
167
|
}
|
|
162
168
|
interface ConfigRoom {
|
|
163
169
|
jid: string;
|
|
@@ -228,7 +234,7 @@ export interface XmppClientInterface {
|
|
|
228
234
|
inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
|
|
229
235
|
leaveTheRoomStanza(roomJID: string): void;
|
|
230
236
|
presenceInRoomStanza(roomJID: string): void;
|
|
231
|
-
getHistoryStanza(chatJID: string, max: number, before?: number,
|
|
237
|
+
getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string): Promise<any>;
|
|
232
238
|
getLastMessageArchiveStanza(roomJID: string): void;
|
|
233
239
|
setRoomImageStanza(roomJid: string, roomThumbnail: string, type: string, roomBackground?: string): void;
|
|
234
240
|
getRoomInfoStanza(roomJID: string): void;
|
|
@@ -243,4 +249,13 @@ export interface XmppClientInterface {
|
|
|
243
249
|
sendMediaMessageStanza(roomJID: string, data: any): void;
|
|
244
250
|
createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
|
|
245
251
|
}
|
|
252
|
+
export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
|
|
253
|
+
export interface Language {
|
|
254
|
+
iso639_1: Iso639_1Codes;
|
|
255
|
+
name: string;
|
|
256
|
+
}
|
|
257
|
+
export type LanguageOptions = {
|
|
258
|
+
languages: Array<Language>;
|
|
259
|
+
language?: Iso639_1Codes;
|
|
260
|
+
};
|
|
246
261
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethora/chat-component",
|
|
3
|
-
"version": "25.01.
|
|
3
|
+
"version": "25.01.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
"react-qr-code": "^2.0.15",
|
|
33
33
|
"react-redux": "^9.1.0",
|
|
34
34
|
"redux": "^5.0.1",
|
|
35
|
+
"redux-persist": "^6.0.0",
|
|
36
|
+
"redux-persist-transform-encrypt": "^5.1.1",
|
|
35
37
|
"redux-saga": "^1.3.0",
|
|
36
38
|
"styled-components": "^6.1.8",
|
|
37
39
|
"uuid": "^9.0.1",
|