@ethora/chat-component 25.4.12 → 25.5.14

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.
@@ -0,0 +1,3 @@
1
+ import { RoomMember } from '../../types/types';
2
+
3
+ export declare function getUserByXmppUsername(xmppUsername: string, token: string): Promise<RoomMember | null>;
@@ -43,6 +43,9 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
43
43
  }>): void;
44
44
  addRoomMessage(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<AddRoomMessageAction>): void;
45
45
  deleteAllRooms(state: import('immer').WritableDraft<RoomMessagesState>): void;
46
+ insertUsers(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
47
+ newUsers: RoomMember[];
48
+ }>): void;
46
49
  setComposing(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
47
50
  chatJID: string;
48
51
  composing: boolean;
@@ -136,6 +139,8 @@ export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOption
136
139
  rooms: ApiRoom[];
137
140
  }, "roomMessages/updateUsersSet">, setOpenReportModal: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
138
141
  isOpen: boolean;
139
- }, "roomMessages/setOpenReportModal">;
142
+ }, "roomMessages/setOpenReportModal">, insertUsers: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
143
+ newUsers: RoomMember[];
144
+ }, "roomMessages/insertUsers">;
140
145
  declare const _default: import('redux').Reducer<RoomMessagesState>;
141
146
  export default _default;
@@ -0,0 +1,26 @@
1
+ import { IMessage } from './message.model';
2
+
3
+ export interface DeleteModal {
4
+ isDeleteModal: boolean;
5
+ roomJid?: string;
6
+ messageId?: string;
7
+ }
8
+ export interface EditAction {
9
+ isEdit: boolean;
10
+ roomJid?: string;
11
+ messageId?: string;
12
+ text?: string;
13
+ }
14
+ export interface ReactionAction {
15
+ roomJID: string;
16
+ messageId: string;
17
+ from: string;
18
+ reactions: string[];
19
+ latestReactionTimestamp?: string;
20
+ data?: Record<string, string>;
21
+ }
22
+ export interface AddRoomMessageAction {
23
+ roomJID: string;
24
+ message: IMessage;
25
+ start?: boolean;
26
+ }
@@ -0,0 +1,100 @@
1
+ import { User } from './user.model';
2
+ import { xmppSettingsInterface } from './xmpp.model';
3
+ import { PartialRoomWithMandatoryKeys, ConfigRoom } from './room.model';
4
+ import { MessageBubble } from './message.model';
5
+ import { Iso639_1Codes } from './language.model';
6
+ import { default as React } from 'react';
7
+
8
+ export interface FBConfig {
9
+ apiKey: string;
10
+ authDomain: string;
11
+ projectId: string;
12
+ storageBucket: string;
13
+ messagingSenderId: string;
14
+ appId: string;
15
+ }
16
+ export interface IConfig {
17
+ disableHeader?: boolean;
18
+ disableMedia?: boolean;
19
+ colors?: {
20
+ primary: string;
21
+ secondary: string;
22
+ };
23
+ googleLogin?: {
24
+ enabled: boolean;
25
+ firebaseConfig: FBConfig;
26
+ };
27
+ jwtLogin?: {
28
+ token: string;
29
+ enabled: boolean;
30
+ handleBadlogin?: React.ReactElement;
31
+ };
32
+ userLogin?: {
33
+ enabled: boolean;
34
+ user: User | null;
35
+ };
36
+ customLogin?: {
37
+ enabled: boolean;
38
+ loginFunction: () => Promise<User | null>;
39
+ };
40
+ baseUrl?: string;
41
+ customAppToken?: string;
42
+ xmppSettings?: xmppSettingsInterface;
43
+ disableRooms?: boolean;
44
+ defaultLogin?: boolean;
45
+ disableInteractions?: boolean;
46
+ chatHeaderBurgerMenu?: boolean;
47
+ forceSetRoom?: boolean;
48
+ roomListStyles?: React.CSSProperties;
49
+ chatRoomStyles?: React.CSSProperties;
50
+ setRoomJidInPath?: boolean;
51
+ disableRoomMenu?: boolean;
52
+ defaultRooms?: ConfigRoom[];
53
+ refreshTokens?: {
54
+ enabled: boolean;
55
+ refreshFunction?: () => Promise<{
56
+ accessToken: string;
57
+ refreshToken?: string;
58
+ } | null>;
59
+ };
60
+ backgroundChat?: {
61
+ color?: string;
62
+ image?: string | File;
63
+ };
64
+ bubleMessage?: MessageBubble;
65
+ headerLogo?: string | React.ReactElement;
66
+ headerMenu?: () => void;
67
+ headerChatMenu?: () => void;
68
+ customRooms?: {
69
+ rooms: PartialRoomWithMandatoryKeys[];
70
+ disableGetRooms?: boolean;
71
+ singleRoom: boolean;
72
+ };
73
+ translates?: {
74
+ enabled: boolean;
75
+ translations?: Iso639_1Codes;
76
+ };
77
+ disableRoomConfig?: boolean;
78
+ disableProfilesInteractions?: boolean;
79
+ disableUserCount?: boolean;
80
+ clearStoreBeforeInit?: boolean;
81
+ disableSentLogic?: boolean;
82
+ initBeforeLoad?: boolean;
83
+ newArch?: boolean;
84
+ qrUrl?: string;
85
+ secondarySendButton?: {
86
+ enabled: boolean;
87
+ messageEdit: string;
88
+ buttonText: string;
89
+ buttonStyles?: React.CSSProperties;
90
+ };
91
+ enableRoomsRetry?: {
92
+ enabled: boolean;
93
+ helperText: string;
94
+ };
95
+ disableNewChatButton?: boolean;
96
+ chatHeaderAdditional?: {
97
+ enabled: boolean;
98
+ element: any;
99
+ };
100
+ }
@@ -0,0 +1,9 @@
1
+ export type Iso639_1Codes = 'en' | 'es' | 'pt' | 'ht' | 'zh';
2
+ export interface Language {
3
+ iso639_1: Iso639_1Codes;
4
+ name: string;
5
+ }
6
+ export type LanguageOptions = {
7
+ languages: Array<Language>;
8
+ language?: Iso639_1Codes;
9
+ };
@@ -0,0 +1,5 @@
1
+ export type MediaFile = {
2
+ uri: string;
3
+ type: string;
4
+ name: string;
5
+ };
@@ -0,0 +1,63 @@
1
+ import { IUser } from './user.model';
2
+ import { TranslationObject } from '../types';
3
+
4
+ export interface IMessage {
5
+ id: string;
6
+ user: IUser;
7
+ date: Date | string;
8
+ body: string;
9
+ roomJid: string;
10
+ key?: string;
11
+ coinsInMessage?: string | number;
12
+ numberOfReplies?: number[] | number;
13
+ isSystemMessage?: string;
14
+ isMediafile?: string;
15
+ locationPreview?: string;
16
+ mimetype?: string;
17
+ location?: string;
18
+ pending?: boolean;
19
+ timestamp?: number;
20
+ showInChannel?: string;
21
+ activeMessage?: boolean;
22
+ isReply?: boolean | string;
23
+ isDeleted?: boolean;
24
+ mainMessage?: string;
25
+ reply?: IReply[];
26
+ reaction?: Record<string, ReactionMessage>;
27
+ fileName?: string;
28
+ translations?: TranslationObject;
29
+ langSource?: string;
30
+ originalName?: string;
31
+ size?: string;
32
+ xmppId?: string;
33
+ xmppFrom?: string;
34
+ }
35
+ export interface ReactionMessage {
36
+ emoji: string[];
37
+ data: Record<string, string>;
38
+ }
39
+ export interface IReply extends IMessage {
40
+ }
41
+ export interface MessageBubble {
42
+ backgroundMessageUser?: string;
43
+ backgroundMessage?: string;
44
+ colorUser?: string;
45
+ color?: string;
46
+ borderRadius?: number;
47
+ }
48
+ export interface MessageProps {
49
+ message: IMessage;
50
+ isUser: boolean;
51
+ isReply: boolean;
52
+ }
53
+ export interface MediaMessageType {
54
+ }
55
+ export interface LastMessage extends Omit<Partial<IMessage>, 'date'> {
56
+ body: string;
57
+ date?: string | Date;
58
+ emoji?: string;
59
+ locationPreview?: string;
60
+ filename?: string;
61
+ mimetype?: string;
62
+ originalName?: string;
63
+ }
@@ -0,0 +1,8 @@
1
+ import { MODAL_TYPES } from '../types';
2
+
3
+ export type ModalType = (typeof MODAL_TYPES)[keyof typeof MODAL_TYPES];
4
+ export interface ModalFile {
5
+ fileName: string;
6
+ fileURL: string;
7
+ mimetype: string;
8
+ }
@@ -0,0 +1,105 @@
1
+ import { IMessage, LastMessage } from './message.model';
2
+
3
+ export interface RoomMember {
4
+ firstName: string;
5
+ lastName: string;
6
+ xmppUsername: string;
7
+ _id: string;
8
+ ban_status?: string;
9
+ jid?: string;
10
+ name?: string;
11
+ role?: string;
12
+ last_active?: number;
13
+ }
14
+ export interface RoomLastMessage {
15
+ name: string;
16
+ body: string;
17
+ }
18
+ export interface IRoom {
19
+ name: string;
20
+ jid: string;
21
+ title: string;
22
+ usersCnt: number;
23
+ messages: IMessage[];
24
+ isLoading: boolean;
25
+ roomBg: string;
26
+ members?: RoomMember[];
27
+ type?: 'public' | 'group' | 'private';
28
+ creteadAt?: string;
29
+ appId?: string;
30
+ createdAt?: string;
31
+ createdBy?: string;
32
+ description?: string;
33
+ isAppChat?: boolean;
34
+ picture?: string;
35
+ updatedAt?: string;
36
+ __v?: number | string;
37
+ _id?: string;
38
+ id?: string;
39
+ lastMessage?: LastMessage;
40
+ lastMessageTimestamp?: number;
41
+ lastRoomMessage?: RoomLastMessage;
42
+ icon?: string;
43
+ composing?: boolean;
44
+ composingList?: string[];
45
+ lastViewedTimestamp?: number;
46
+ unreadMessages?: number;
47
+ noMessages?: boolean;
48
+ role?: string;
49
+ messageStats?: {
50
+ lastMessageTimestamp?: number;
51
+ firstMessageTimestamp?: number;
52
+ };
53
+ historyComplete?: boolean;
54
+ }
55
+ export interface ApiRoom {
56
+ name: string;
57
+ type: 'public' | 'group' | 'private';
58
+ title?: string;
59
+ description?: string;
60
+ picture?: string;
61
+ members?: RoomMember[];
62
+ createdBy?: string;
63
+ appId?: any;
64
+ _id?: string;
65
+ isAppChat?: boolean;
66
+ createdAt?: string;
67
+ updatedAt?: string;
68
+ __v?: string;
69
+ }
70
+ export interface PostRoom {
71
+ title: string;
72
+ uuid?: string;
73
+ type: 'public' | 'group';
74
+ description?: string;
75
+ picture?: string;
76
+ members?: string[];
77
+ }
78
+ export interface PostReportRoom {
79
+ chatName: string;
80
+ category: string;
81
+ text?: string;
82
+ }
83
+ export interface PostAddRoomMember {
84
+ chatName: string;
85
+ members: string[];
86
+ }
87
+ export interface DeleteRoomMember {
88
+ roomId: string;
89
+ members: string[];
90
+ }
91
+ export interface IRoomCompressed extends Pick<IRoom, 'jid'> {
92
+ }
93
+ export type PartialRoomWithMandatoryKeys = Partial<IRoom> & Pick<IRoom, 'jid' | 'title'>;
94
+ export interface ConfigRoom {
95
+ jid: string;
96
+ pinned: boolean;
97
+ _id?: string;
98
+ }
99
+ export type ChatAccessOption = {
100
+ name: 'Public';
101
+ id: 'public';
102
+ } | {
103
+ name: 'Members-only';
104
+ id: 'group';
105
+ };
@@ -0,0 +1,77 @@
1
+ import { Iso639_1Codes } from './language.model';
2
+ import { IMessage } from './message.model';
3
+
4
+ export interface IUser extends Partial<User> {
5
+ id: string;
6
+ name?: string;
7
+ userJID?: string | null;
8
+ token?: string;
9
+ refreshToken?: string;
10
+ }
11
+ export interface User {
12
+ walletAddress: string;
13
+ description?: string;
14
+ token: string;
15
+ refreshToken: string;
16
+ defaultWallet: {
17
+ walletAddress: string;
18
+ };
19
+ _id: string;
20
+ firstName: string;
21
+ lastName: string;
22
+ email?: string;
23
+ profileImage?: string;
24
+ emails?: [
25
+ {
26
+ loginType: string;
27
+ email: string;
28
+ verified: boolean;
29
+ _id: string;
30
+ }
31
+ ];
32
+ appId: string;
33
+ username: string;
34
+ xmppPassword: string;
35
+ langSource?: Iso639_1Codes;
36
+ homeScreen?: string;
37
+ registrationChannelType?: string;
38
+ updatedAt?: string;
39
+ authMethod?: string;
40
+ resetPasswordExpires?: string;
41
+ resetPasswordToken?: string;
42
+ xmppUsername?: string;
43
+ roles?: string[];
44
+ tags?: string[];
45
+ __v?: number;
46
+ isProfileOpen?: boolean;
47
+ isAssetsOpen?: boolean;
48
+ isAgreeWithTerms?: boolean;
49
+ isSuperAdmin?: boolean;
50
+ }
51
+ export interface ConfigUser {
52
+ email: string;
53
+ password: string;
54
+ }
55
+ export interface StorageUser {
56
+ appId: string;
57
+ company: any[];
58
+ firstName: string;
59
+ homeScreen: string;
60
+ lastName: string;
61
+ referrerId: string;
62
+ refreshToken: string;
63
+ token: string;
64
+ walletAddress: string;
65
+ xmppPassword: string;
66
+ _id: string;
67
+ isAgreeWithTerms?: boolean;
68
+ isAllowedNewAppCreate?: boolean;
69
+ isAssetsOpen?: boolean;
70
+ isProfileOpen?: boolean;
71
+ }
72
+ export interface UserType extends IMessage {
73
+ id: any;
74
+ user: any;
75
+ timestamp: any;
76
+ text: any;
77
+ }
@@ -0,0 +1,60 @@
1
+ import { Client } from '@xmpp/client';
2
+ import { Iso639_1Codes } from './language.model';
3
+ import { default as XmppClient } from '../../networking/xmppClient';
4
+ import { IMessage } from './message.model';
5
+
6
+ export interface XmppState {
7
+ client: XmppClient | null;
8
+ loading: boolean;
9
+ }
10
+ export interface xmppSettingsInterface {
11
+ devServer: string;
12
+ host: string;
13
+ conference?: string;
14
+ }
15
+ export interface MediaUploadData {
16
+ file: File;
17
+ type: string;
18
+ name?: string;
19
+ }
20
+ export interface XmppClientInterface {
21
+ client: Client;
22
+ devServer?: string;
23
+ host: string;
24
+ service: string;
25
+ conference: string;
26
+ username: string;
27
+ status: string;
28
+ password: string;
29
+ reconnectAttempts: number;
30
+ maxReconnectAttempts: number;
31
+ reconnectDelay: number;
32
+ checkOnline(): boolean;
33
+ initializeClient(): void;
34
+ attachEventListeners(): void;
35
+ reconnect(): Promise<void>;
36
+ close(): Promise<void>;
37
+ ensureConnected(timeout?: number): Promise<void>;
38
+ getRoomsStanza(disableGetRooms?: boolean): Promise<void>;
39
+ createRoomStanza(title: string, description: string, to?: string): Promise<string | object>;
40
+ inviteRoomRequestStanza(to: string, roomJid: string): Promise<void>;
41
+ leaveTheRoomStanza(roomJID: string): void;
42
+ presenceInRoomStanza(roomJID: string): void;
43
+ getHistoryStanza(chatJID: string, max: number, before?: number, otherStanzaId?: string): Promise<IMessage[]>;
44
+ getLastMessageArchiveStanza(roomJID: string): void;
45
+ setRoomImageStanza(roomJid: string, roomThumbnail: string, type: string, roomBackground?: string): void;
46
+ getRoomInfoStanza(roomJID: string): void;
47
+ getRoomMembersStanza(roomJID: string): void;
48
+ setVCardStanza(xmppUsername: string): void;
49
+ sendMessage(roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string, isReply?: boolean, showInChannel?: boolean, mainMessage?: string, customId?: string): void;
50
+ deleteMessageStanza(room: string, msgId: string): void;
51
+ editMessageStanza(room: string, msgId: string, text: string): void;
52
+ sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
53
+ getChatsPrivateStoreRequestStanza(): Promise<any>;
54
+ actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number, chats?: string[]): Promise<void>;
55
+ sendMediaMessageStanza(roomJID: string, data: MediaUploadData): void;
56
+ createPrivateRoomStanza(title: string, description: string, to: string): Promise<string>;
57
+ sendMessageReactionStanza(messageId: string, roomJid: string, reactionsList: string[], reactionSymbol?: string): void;
58
+ 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;
59
+ disconnect?(): Promise<void>;
60
+ }