@ethora/chat-component 24.10.22 → 24.11.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/README.md +9 -4
- package/dist/assets/icons.d.ts +44 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +16 -0
- package/dist/components/InputComponents/AudioInput.d.ts +9 -0
- package/dist/components/InputComponents/MediaInput.d.ts +11 -0
- package/dist/components/InputComponents/RecordingIndicator.d.ts +2 -0
- package/dist/components/InputComponents/Search.d.ts +1 -1
- package/dist/components/InputComponents/TextInput.d.ts +14 -0
- package/dist/components/MainComponents/ChatRoom.d.ts +0 -2
- package/dist/components/MainComponents/RoomList.d.ts +0 -1
- package/dist/components/{Message.d.ts → MessageBubble/Message.d.ts} +1 -1
- package/dist/components/MessageBubble/MessageInteractions.d.ts +18 -0
- package/dist/components/Modals/Modal/Modal.d.ts +9 -0
- package/dist/components/Modals/NewChatModal/NewChatModal.d.ts +4 -0
- package/dist/components/Modals/UserProfileModal/UserProfileModal.d.ts +7 -0
- package/dist/components/styled/ActionButton.d.ts +7 -0
- package/dist/components/styled/AudioMessage.d.ts +7 -0
- package/dist/components/styled/Button.d.ts +1 -0
- package/dist/components/styled/StyledComponents.d.ts +1 -0
- package/dist/components/styled/StyledInputComponents/StyledInputComponents.d.ts +1 -0
- package/dist/components/styled/UnsupportedType.d.ts +2 -0
- package/dist/helpers/constants/LOCAL_STORAGE.d.ts +3 -0
- package/dist/helpers/constants/MESSAGE_INTERACTIONS.d.ts +34 -0
- package/dist/helpers/insertMessageWithDelimiter.d.ts +6 -0
- package/dist/helpers/localStorageUser.d.ts +3 -0
- package/dist/main.js +11698 -10138
- package/dist/main.js.map +1 -1
- package/dist/networking/api-requests/auth.api.d.ts +22 -0
- package/dist/networking/apiClient.d.ts +2 -22
- package/dist/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.d.ts +1 -0
- package/dist/networking/xmpp/createTimeoutPromise.xmpp.d.ts +4 -0
- package/dist/networking/xmpp/deleteMessage.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/getChatsPrivateStoreRequest.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/getHistory.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/getLastMessageArchive.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/presenceInRoom.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/sendMediaMessage.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/sendTextMessage.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/sendTypingRequest.xmpp.d.ts +3 -0
- package/dist/networking/xmpp/setChatsPrivateStoreRequest.xmpp.d.ts +3 -0
- package/dist/networking/xmppClient.d.ts +9 -10
- package/dist/roomStore/chatSettingsSlice.d.ts +11 -3
- package/dist/roomStore/roomsSlice.d.ts +9 -1
- package/dist/types/types.d.ts +10 -1
- package/package.json +9 -4
- package/dist/roomStore/loginSlice.d.ts +0 -36
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { User } from '../../types/types';
|
|
2
|
+
import { User as FirebaseUser } from 'firebase/auth';
|
|
3
|
+
|
|
4
|
+
export declare function loginEmail(email: string, password: string): Promise<import('axios').AxiosResponse<{
|
|
5
|
+
user: User;
|
|
6
|
+
refreshToken: string;
|
|
7
|
+
token: string;
|
|
8
|
+
}, any>>;
|
|
9
|
+
export declare function loginSocial(idToken: string, accessToken: string, loginType: string, authToken?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
10
|
+
export declare function registerSocial(idToken: string, accessToken: string, authToken: string, loginType: string, signUpPlan?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
11
|
+
export declare function checkEmailExist(email: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
12
|
+
export declare function loginViaJwt(clientToken: string): Promise<User>;
|
|
13
|
+
export declare const signInWithGoogle: () => Promise<{
|
|
14
|
+
user: FirebaseUser;
|
|
15
|
+
idToken: string;
|
|
16
|
+
credential: import('@firebase/auth').OAuthCredential;
|
|
17
|
+
} | {
|
|
18
|
+
user?: undefined;
|
|
19
|
+
idToken?: undefined;
|
|
20
|
+
credential?: undefined;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function uploadFile(formData: FormData): Promise<import('axios').AxiosResponse<any, any>>;
|
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { User as FirebaseUser } from 'firebase/auth';
|
|
3
|
-
|
|
1
|
+
declare const http: import('axios').AxiosInstance;
|
|
4
2
|
export declare function refresh(): Promise<{
|
|
5
3
|
data: {
|
|
6
4
|
refreshToken: string;
|
|
7
5
|
token: string;
|
|
8
6
|
};
|
|
9
7
|
}>;
|
|
10
|
-
export
|
|
11
|
-
export declare function loginEmail(email: string, password: string): Promise<import('axios').AxiosResponse<{
|
|
12
|
-
user: User;
|
|
13
|
-
refreshToken: string;
|
|
14
|
-
token: string;
|
|
15
|
-
}, any>>;
|
|
16
|
-
export declare const signInWithGoogle: () => Promise<{
|
|
17
|
-
user: FirebaseUser;
|
|
18
|
-
idToken: string;
|
|
19
|
-
credential: import('@firebase/auth').OAuthCredential;
|
|
20
|
-
} | {
|
|
21
|
-
user?: undefined;
|
|
22
|
-
idToken?: undefined;
|
|
23
|
-
credential?: undefined;
|
|
24
|
-
}>;
|
|
25
|
-
export declare function loginSocial(idToken: string, accessToken: string, loginType: string, authToken?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
26
|
-
export declare function registerSocial(idToken: string, accessToken: string, authToken: string, loginType: string, signUpPlan?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
27
|
-
export declare function checkEmailExist(email: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
28
|
-
export declare function loginViaJwt(clientToken: string): Promise<User>;
|
|
8
|
+
export default http;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function actionSetTimestampToPrivateStore(client: any, chatId: string, timestamp: number): Promise<boolean>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Client } from '@xmpp/client';
|
|
2
|
-
import { Element } from 'ltx';
|
|
3
2
|
|
|
4
3
|
export declare class XmppClient {
|
|
5
4
|
client: Client;
|
|
@@ -15,20 +14,20 @@ export declare class XmppClient {
|
|
|
15
14
|
resource: string;
|
|
16
15
|
checkOnline(): boolean;
|
|
17
16
|
constructor(username: string, password: string);
|
|
17
|
+
close(): void;
|
|
18
18
|
joinBySendingPresence(chatJID: string): Promise<unknown>;
|
|
19
19
|
unsubscribe: (address: string) => void;
|
|
20
20
|
getRooms: () => Promise<unknown>;
|
|
21
21
|
leaveTheRoom: (roomJID: string) => void;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
getLastMessageArchive(roomJID: string): void;
|
|
22
|
+
presenceInRoomStanza: (roomJID: string) => void;
|
|
23
|
+
getHistoryStanza: (chatJID: string, max: number, before?: number) => Promise<void>;
|
|
24
|
+
getLastMessageArchiveStanza(roomJID: string): void;
|
|
26
25
|
sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string) => void;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
deleteMessageStanza(room: string, msgId: string): void;
|
|
27
|
+
sendTypingRequestStanza(chatId: string, fullName: string, start: boolean): void;
|
|
28
|
+
getChatsPrivateStoreRequestStanza: () => Promise<unknown>;
|
|
29
|
+
setChatsPrivateStoreRequestStanza(jsonObj: string): Promise<void>;
|
|
30
|
+
actionSetTimestampToPrivateStoreStanza(chatId: string, timestamp: number): Promise<void>;
|
|
32
31
|
sendMediaMessageStanza(roomJID: string, data: any): void;
|
|
33
32
|
}
|
|
34
33
|
export default XmppClient;
|
|
@@ -3,14 +3,22 @@ import { IConfig, User } from '../types/types';
|
|
|
3
3
|
|
|
4
4
|
interface ChatState {
|
|
5
5
|
user: User;
|
|
6
|
-
defaultChatRooms: any[];
|
|
7
6
|
config?: IConfig;
|
|
7
|
+
activeModal?: 'settings' | 'profile' | undefined;
|
|
8
8
|
}
|
|
9
9
|
export declare const chatSlice: import('@reduxjs/toolkit').Slice<ChatState, {
|
|
10
10
|
setUser: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<User>) => void;
|
|
11
|
-
setDefaultChatRooms: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<any[]>) => void;
|
|
12
11
|
setConfig: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<IConfig | undefined>) => void;
|
|
12
|
+
setActiveModal: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<"settings" | "profile" | undefined>) => void;
|
|
13
|
+
refreshTokens: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<{
|
|
14
|
+
token: string;
|
|
15
|
+
refreshToken: string;
|
|
16
|
+
}>) => void;
|
|
17
|
+
logout: (state: import('immer').WritableDraft<ChatState>) => void;
|
|
13
18
|
}, "chat", "chat", import('@reduxjs/toolkit').SliceSelectors<ChatState>>;
|
|
14
|
-
export declare const setUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<User, "chat/setUser">,
|
|
19
|
+
export declare const setUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<User, "chat/setUser">, setConfig: import('@reduxjs/toolkit').ActionCreatorWithNonInferrablePayload<"chat/setConfig">, refreshTokens: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
20
|
+
token: string;
|
|
21
|
+
refreshToken: string;
|
|
22
|
+
}, "chat/refreshTokens">, logout: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"chat/logout">, setActiveModal: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<"settings" | "profile", "chat/setActiveModal">;
|
|
15
23
|
declare const _default: import('redux').Reducer<ChatState>;
|
|
16
24
|
export default _default;
|
|
@@ -38,6 +38,10 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
|
|
|
38
38
|
chatJID: string;
|
|
39
39
|
timestamp: number;
|
|
40
40
|
}>) => void;
|
|
41
|
+
setRoomRole: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
42
|
+
chatJID: string;
|
|
43
|
+
role: string;
|
|
44
|
+
}>) => void;
|
|
41
45
|
setRoomNoMessages: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
42
46
|
value: boolean;
|
|
43
47
|
chatJID?: string;
|
|
@@ -45,6 +49,7 @@ export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesSt
|
|
|
45
49
|
setCurrentRoom: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
46
50
|
roomJID: string;
|
|
47
51
|
}>) => void;
|
|
52
|
+
setLogoutState: (state: import('immer').WritableDraft<RoomMessagesState>) => void;
|
|
48
53
|
}, "roomMessages", "roomMessages", import('@reduxjs/toolkit').SliceSelectors<RoomMessagesState>>;
|
|
49
54
|
export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
50
55
|
roomData: IRoom;
|
|
@@ -72,6 +77,9 @@ export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOption
|
|
|
72
77
|
chatJID?: string;
|
|
73
78
|
}, "roomMessages/setRoomNoMessages">, setCurrentRoom: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
74
79
|
roomJID: string;
|
|
75
|
-
}, "roomMessages/setCurrentRoom"
|
|
80
|
+
}, "roomMessages/setCurrentRoom">, setRoomRole: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
81
|
+
chatJID: string;
|
|
82
|
+
role: string;
|
|
83
|
+
}, "roomMessages/setRoomRole">, setLogoutState: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/setLogoutState">;
|
|
76
84
|
declare const _default: import('redux').Reducer<RoomMessagesState>;
|
|
77
85
|
export default _default;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface IRoom {
|
|
|
32
32
|
usersCnt: number;
|
|
33
33
|
messages: IMessage[];
|
|
34
34
|
isLoading: boolean;
|
|
35
|
+
roomBg: string;
|
|
35
36
|
lastMessage?: string;
|
|
36
37
|
lastRoomMessage?: RoomLastMessage;
|
|
37
38
|
icon?: string;
|
|
@@ -40,7 +41,7 @@ export interface IRoom {
|
|
|
40
41
|
lastViewedTimestamp?: number;
|
|
41
42
|
unreadMessages?: number;
|
|
42
43
|
noMessages?: boolean;
|
|
43
|
-
|
|
44
|
+
role?: string;
|
|
44
45
|
}
|
|
45
46
|
export interface RoomLastMessage {
|
|
46
47
|
name: string;
|
|
@@ -122,6 +123,12 @@ export interface IConfig {
|
|
|
122
123
|
};
|
|
123
124
|
disableRooms?: boolean;
|
|
124
125
|
defaultLogin?: boolean;
|
|
126
|
+
disableInteractions?: boolean;
|
|
127
|
+
chatHeaderBurgerMenu?: boolean;
|
|
128
|
+
forceSetRoom?: boolean;
|
|
129
|
+
roomListStiles?: React.CSSProperties;
|
|
130
|
+
chatRoomStyles?: React.CSSProperties;
|
|
131
|
+
setRoomJidInPath?: boolean;
|
|
125
132
|
}
|
|
126
133
|
export interface StorageUser {
|
|
127
134
|
appId: string;
|
|
@@ -144,3 +151,5 @@ export interface MessageProps {
|
|
|
144
151
|
message: IMessage;
|
|
145
152
|
isUser: boolean;
|
|
146
153
|
}
|
|
154
|
+
export interface MediaMessageType {
|
|
155
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethora/chat-component",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.11.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build": "tsc && vite build",
|
|
13
13
|
"build:lib": "tsc --p ./tsconfig-build.json && vite build",
|
|
14
14
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
15
|
-
"preview": "vite preview"
|
|
15
|
+
"preview": "vite preview",
|
|
16
|
+
"lint:fix": "npx eslint --fix && prettier . --write"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@reduxjs/toolkit": "^2.2.1",
|
|
@@ -30,10 +31,11 @@
|
|
|
30
31
|
"redux-saga": "^1.3.0",
|
|
31
32
|
"styled-components": "^6.1.8",
|
|
32
33
|
"uuid": "^9.0.1",
|
|
33
|
-
"
|
|
34
|
+
"wavesurfer.js": "^7.8.8"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/node": "^20.14.9",
|
|
38
|
+
"vite-plugin-dts": "^3.9.1",
|
|
37
39
|
"@types/react": "^18.3.3",
|
|
38
40
|
"@types/react-dom": "^18.3.0",
|
|
39
41
|
"@types/xmpp__client": "^0.13.3",
|
|
@@ -44,7 +46,10 @@
|
|
|
44
46
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
45
47
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
46
48
|
"typescript": "^5.2.2",
|
|
47
|
-
"vite": "^5.3.1"
|
|
49
|
+
"vite": "^5.3.1",
|
|
50
|
+
"prettier": "3.2.5",
|
|
51
|
+
"eslint-config-prettier": "^9.1.0",
|
|
52
|
+
"eslint-plugin-prettier": "^5.1.3"
|
|
48
53
|
},
|
|
49
54
|
"description": "1. npm create vite@latest 2. select name of project, select type (react/js) 3. cd project-name 4. npm i 5. npm i @ethora/chat-component 6. go to file src/App.tsx and replace it with this code",
|
|
50
55
|
"directories": {
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { IUser } from '../types/types';
|
|
3
|
-
|
|
4
|
-
interface LoginState {
|
|
5
|
-
isAuthenticated: boolean;
|
|
6
|
-
user: IUser;
|
|
7
|
-
}
|
|
8
|
-
export declare const loginSlice: import('@reduxjs/toolkit').Slice<LoginState, {
|
|
9
|
-
login: (state: import('immer').WritableDraft<LoginState>, action: PayloadAction<{
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
token: "";
|
|
13
|
-
refreshToken: "";
|
|
14
|
-
}>) => void;
|
|
15
|
-
logout: (state: import('immer').WritableDraft<LoginState>) => void;
|
|
16
|
-
getInfo: (state: import('immer').WritableDraft<LoginState>, action: PayloadAction<{
|
|
17
|
-
id: string;
|
|
18
|
-
}>) => void;
|
|
19
|
-
refreshTokens: (state: import('immer').WritableDraft<LoginState>, action: PayloadAction<{
|
|
20
|
-
token: string;
|
|
21
|
-
refreshToken: string;
|
|
22
|
-
}>) => void;
|
|
23
|
-
}, "login", "login", import('@reduxjs/toolkit').SliceSelectors<LoginState>>;
|
|
24
|
-
export declare const login: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
token: "";
|
|
28
|
-
refreshToken: "";
|
|
29
|
-
}, "login/login">, logout: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"login/logout">, getInfo: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
30
|
-
id: string;
|
|
31
|
-
}, "login/getInfo">, refreshTokens: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
32
|
-
token: string;
|
|
33
|
-
refreshToken: string;
|
|
34
|
-
}, "login/refreshTokens">;
|
|
35
|
-
declare const _default: import('redux').Reducer<LoginState>;
|
|
36
|
-
export default _default;
|