@ethora/chat-component 0.1.0
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 +74 -0
- package/dist/assets/icons.d.ts +13 -0
- package/dist/components/AuthForms/Login.d.ts +8 -0
- package/dist/components/ContextMenu/ContextMenuComponents.d.ts +4 -0
- package/dist/components/InputComponents/AudioRecorder.d.ts +9 -0
- package/dist/components/MainComponents/ChatHeader.d.ts +8 -0
- package/dist/components/MainComponents/ChatRoom.d.ts +14 -0
- package/dist/components/MainComponents/ChatWrapper.d.ts +16 -0
- package/dist/components/MainComponents/LoginWrapper.d.ts +16 -0
- package/dist/components/MainComponents/MediaMessage.d.ts +11 -0
- package/dist/components/MainComponents/MessageList.d.ts +16 -0
- package/dist/components/MainComponents/ReduxWrapper.d.ts +17 -0
- package/dist/components/MainComponents/SystemMessage.d.ts +7 -0
- package/dist/components/Message.d.ts +9 -0
- package/dist/components/styled/Button.d.ts +9 -0
- package/dist/components/styled/ChatWrapperBox.d.ts +1 -0
- package/dist/components/styled/DateLabel.d.ts +15 -0
- package/dist/components/styled/Loader.d.ts +6 -0
- package/dist/components/styled/MessageImage.d.ts +8 -0
- package/dist/components/styled/Modal.d.ts +2 -0
- package/dist/components/styled/NewMessageLabel.d.ts +8 -0
- package/dist/components/styled/SendInput.d.ts +13 -0
- package/dist/components/styled/StyledComponents.d.ts +34 -0
- package/dist/components/styled/StyledInputComponents/Composing.d.ts +7 -0
- package/dist/components/styled/StyledInputComponents/MediaComponents.d.ts +7 -0
- package/dist/components/styled/StyledInputComponents/StyledInputComponents.d.ts +13 -0
- package/dist/components/styled/UnsupportedType.d.ts +8 -0
- package/dist/components/styled/VideoMessage.d.ts +13 -0
- package/dist/context/xmppProvider.d.ts +13 -0
- package/dist/firebase-config.d.ts +9 -0
- package/dist/helpers/block_scroll.d.ts +2 -0
- package/dist/helpers/dateComparison.d.ts +3 -0
- package/dist/helpers/validator.d.ts +3 -0
- package/dist/helpers/walletUsername.d.ts +2 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +16355 -0
- package/dist/main.js.map +1 -0
- package/dist/networking/apiClient.d.ts +25 -0
- package/dist/networking/stanzaHandlers.d.ts +32 -0
- package/dist/networking/xmppClient.d.ts +34 -0
- package/dist/roomStore/chatSettingsSlice.d.ts +16 -0
- package/dist/roomStore/loginSlice.d.ts +36 -0
- package/dist/roomStore/roomsSlice.d.ts +69 -0
- package/dist/style.css +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { User } from '../types/types';
|
|
2
|
+
import { User as FirebaseUser } from 'firebase/auth';
|
|
3
|
+
|
|
4
|
+
export declare function refresh(): Promise<{
|
|
5
|
+
data: {
|
|
6
|
+
refreshToken: string;
|
|
7
|
+
token: string;
|
|
8
|
+
};
|
|
9
|
+
}>;
|
|
10
|
+
export declare function uploadFile(formData: FormData, token: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
11
|
+
export declare function loginEmail(email: string, password: string): Promise<import('axios').AxiosResponse<{
|
|
12
|
+
user: User;
|
|
13
|
+
}, any>>;
|
|
14
|
+
export declare const signInWithGoogle: () => Promise<{
|
|
15
|
+
user: FirebaseUser;
|
|
16
|
+
idToken: string;
|
|
17
|
+
credential: import('@firebase/auth').OAuthCredential;
|
|
18
|
+
} | {
|
|
19
|
+
user?: undefined;
|
|
20
|
+
idToken?: undefined;
|
|
21
|
+
credential?: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function loginSocial(idToken: string, accessToken: string, loginType: string, authToken?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
24
|
+
export declare function registerSocial(idToken: string, accessToken: string, authToken: string, loginType: string, signUpPlan?: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
25
|
+
export declare function checkEmailExist(email: string): Promise<import('axios').AxiosResponse<any, any>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Element } from 'ltx';
|
|
2
|
+
|
|
3
|
+
export declare const createMessage: (data: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
coinsInMessage?: any;
|
|
6
|
+
numberOfReplies?: any;
|
|
7
|
+
isSystemMessage?: any;
|
|
8
|
+
isMediafile?: any;
|
|
9
|
+
locationPreview?: any;
|
|
10
|
+
mimetype?: any;
|
|
11
|
+
location?: any;
|
|
12
|
+
senderWalletAddress?: any;
|
|
13
|
+
senderFirstName?: any;
|
|
14
|
+
senderLastName?: any;
|
|
15
|
+
photoURL?: any;
|
|
16
|
+
senderJID?: any;
|
|
17
|
+
token?: any;
|
|
18
|
+
refreshToken?: any;
|
|
19
|
+
roomJid?: any;
|
|
20
|
+
tokenAmount?: any;
|
|
21
|
+
quickReplie?: any;
|
|
22
|
+
notDisplayedValue?: any;
|
|
23
|
+
showInChannel?: any;
|
|
24
|
+
}, body: Element | undefined, id: string, from: any) => Promise<any>;
|
|
25
|
+
declare const onRealtimeMessage: (stanza: Element) => Promise<any>;
|
|
26
|
+
declare const onMessageHistory: (stanza: any) => Promise<void>;
|
|
27
|
+
declare const handleComposing: (stanza: Element, currentUser: string) => Promise<void>;
|
|
28
|
+
declare const getListOfRooms: (xmpp: any) => void;
|
|
29
|
+
declare const onPresenceInRoom: (stanza: Element | any) => void;
|
|
30
|
+
declare const onGetLastMessageArchive: (stanza: Element, xmpp: any) => Promise<void>;
|
|
31
|
+
declare const onGetChatRooms: (stanza: Element, xmpp: any) => void;
|
|
32
|
+
export { getListOfRooms, onRealtimeMessage, onMessageHistory, onPresenceInRoom, onGetLastMessageArchive, handleComposing, onGetChatRooms, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Client } from '@xmpp/client';
|
|
2
|
+
import { Element } from 'ltx';
|
|
3
|
+
|
|
4
|
+
export declare class XmppClient {
|
|
5
|
+
client: Client;
|
|
6
|
+
devServer: string | undefined;
|
|
7
|
+
host: string;
|
|
8
|
+
service: string;
|
|
9
|
+
conference: string;
|
|
10
|
+
username: string;
|
|
11
|
+
onclose: () => void;
|
|
12
|
+
onmessage: (data: any) => void;
|
|
13
|
+
password: string;
|
|
14
|
+
resource: string;
|
|
15
|
+
checkOnline(): boolean;
|
|
16
|
+
constructor(username: string, password: string);
|
|
17
|
+
initPresence(): Promise<unknown>;
|
|
18
|
+
unsubscribe: (address: string) => void;
|
|
19
|
+
getRooms: () => Promise<unknown>;
|
|
20
|
+
leaveTheRoom: (roomJID: string) => void;
|
|
21
|
+
presenceInRoom: (roomJID: string) => Promise<unknown>;
|
|
22
|
+
getArchive: (userJID: string) => void;
|
|
23
|
+
getHistory: (chatJID: string, max: number, before?: number) => Promise<unknown>;
|
|
24
|
+
getAndReceiveRoomInfo: (roomJID: string) => Promise<Element>;
|
|
25
|
+
getLastMessageArchive(roomJID: string): void;
|
|
26
|
+
sendMessage: (roomJID: string, firstName: string, lastName: string, photo: string, walletAddress: string, userMessage: string, notDisplayedValue?: string) => void;
|
|
27
|
+
deleteMessage(room: string, msgId: string): void;
|
|
28
|
+
sendTypingRequest(chatId: string, fullName: string, start: boolean): void;
|
|
29
|
+
getChatsPrivateStoreRequest(): Promise<unknown>;
|
|
30
|
+
actionSetTimestampToPrivateStore(chatId: string, timestamp: number): Promise<boolean>;
|
|
31
|
+
setChatsPrivateStoreRequest(jsonObj: string): Promise<unknown>;
|
|
32
|
+
sendMediaMessageStanza(roomJID: string, data: any): void;
|
|
33
|
+
}
|
|
34
|
+
export default XmppClient;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { IConfig, User } from '../types/types';
|
|
3
|
+
|
|
4
|
+
interface ChatState {
|
|
5
|
+
user: User;
|
|
6
|
+
defaultChatRooms: any[];
|
|
7
|
+
config?: IConfig;
|
|
8
|
+
}
|
|
9
|
+
export declare const chatSlice: import('@reduxjs/toolkit').Slice<ChatState, {
|
|
10
|
+
setUser: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<User>) => void;
|
|
11
|
+
setDefaultChatRooms: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<any[]>) => void;
|
|
12
|
+
setConfig: (state: import('immer').WritableDraft<ChatState>, action: PayloadAction<IConfig | undefined>) => void;
|
|
13
|
+
}, "chat", "chat", import('@reduxjs/toolkit').SliceSelectors<ChatState>>;
|
|
14
|
+
export declare const setUser: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<User, "chat/setUser">, setDefaultChatRooms: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<any[], "chat/setDefaultChatRooms">, setConfig: import('@reduxjs/toolkit').ActionCreatorWithNonInferrablePayload<"chat/setConfig">;
|
|
15
|
+
declare const _default: import('redux').Reducer<ChatState>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import { IMessage, IRoom } from '../types/types';
|
|
3
|
+
|
|
4
|
+
interface RoomMessagesState {
|
|
5
|
+
rooms: {
|
|
6
|
+
[jid: string]: IRoom;
|
|
7
|
+
};
|
|
8
|
+
activeRoom: IRoom | null;
|
|
9
|
+
}
|
|
10
|
+
export declare const roomsStore: import('@reduxjs/toolkit').Slice<RoomMessagesState, {
|
|
11
|
+
addRoom(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
12
|
+
roomData: IRoom;
|
|
13
|
+
}>): void;
|
|
14
|
+
setRoomMessages(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
15
|
+
roomJID: string;
|
|
16
|
+
messages: IMessage[];
|
|
17
|
+
}>): void;
|
|
18
|
+
deleteRoomMessage(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
19
|
+
roomJID: string;
|
|
20
|
+
messageId: string;
|
|
21
|
+
}>): void;
|
|
22
|
+
addRoomMessage(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
23
|
+
roomJID: string;
|
|
24
|
+
message: IMessage;
|
|
25
|
+
start?: boolean;
|
|
26
|
+
}>): void;
|
|
27
|
+
deleteAllRooms(state: import('immer').WritableDraft<RoomMessagesState>): void;
|
|
28
|
+
setActiveRoom(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
29
|
+
roomData: IRoom;
|
|
30
|
+
}>): void;
|
|
31
|
+
setComposing(state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
32
|
+
chatJID: string;
|
|
33
|
+
composing: boolean;
|
|
34
|
+
}>): void;
|
|
35
|
+
setIsLoading: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
36
|
+
chatJID: string;
|
|
37
|
+
loading: boolean;
|
|
38
|
+
}>) => void;
|
|
39
|
+
setLastViewedTimestamp: (state: import('immer').WritableDraft<RoomMessagesState>, action: PayloadAction<{
|
|
40
|
+
chatJID: string;
|
|
41
|
+
timestamp: number;
|
|
42
|
+
}>) => void;
|
|
43
|
+
}, "roomMessages", "roomMessages", import('@reduxjs/toolkit').SliceSelectors<RoomMessagesState>>;
|
|
44
|
+
export declare const addRoom: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
45
|
+
roomData: IRoom;
|
|
46
|
+
}, "roomMessages/addRoom">, deleteAllRooms: import('@reduxjs/toolkit').ActionCreatorWithoutPayload<"roomMessages/deleteAllRooms">, setRoomMessages: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
47
|
+
roomJID: string;
|
|
48
|
+
messages: IMessage[];
|
|
49
|
+
}, "roomMessages/setRoomMessages">, addRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
50
|
+
roomJID: string;
|
|
51
|
+
message: IMessage;
|
|
52
|
+
start?: boolean;
|
|
53
|
+
}, "roomMessages/addRoomMessage">, deleteRoomMessage: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
54
|
+
roomJID: string;
|
|
55
|
+
messageId: string;
|
|
56
|
+
}, "roomMessages/deleteRoomMessage">, setActiveRoom: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
57
|
+
roomData: IRoom;
|
|
58
|
+
}, "roomMessages/setActiveRoom">, setComposing: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
59
|
+
chatJID: string;
|
|
60
|
+
composing: boolean;
|
|
61
|
+
}, "roomMessages/setComposing">, setIsLoading: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
62
|
+
chatJID: string;
|
|
63
|
+
loading: boolean;
|
|
64
|
+
}, "roomMessages/setIsLoading">, setLastViewedTimestamp: import('@reduxjs/toolkit').ActionCreatorWithOptionalPayload<{
|
|
65
|
+
chatJID: string;
|
|
66
|
+
timestamp: number;
|
|
67
|
+
}, "roomMessages/setLastViewedTimestamp">;
|
|
68
|
+
declare const _default: import('redux').Reducer<RoomMessagesState>;
|
|
69
|
+
export default _default;
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}html,body,#root{height:100%;margin:0;padding:0}svg{height:50px;width:50px}::-webkit-scrollbar{width:4px}::-webkit-scrollbar-thumb{background-color:#5e3fde;border-radius:6px}::-webkit-scrollbar-track{background-color:#f0f0f0}*{scrollbar-width:thin;scrollbar-color:#5e3fde #f0f0f0}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ethora/chat-component",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/main.js",
|
|
6
|
+
"types": "dist/main.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "tsc && vite build",
|
|
13
|
+
"build:lib": "tsc --p ./tsconfig-build.json && vite build",
|
|
14
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
15
|
+
"preview": "vite preview"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@reduxjs/toolkit": "^2.2.1",
|
|
19
|
+
"@types/react": "^18.2.65",
|
|
20
|
+
"@types/react-dom": "^18.2.22",
|
|
21
|
+
"@types/styled-components": "^5.1.34",
|
|
22
|
+
"@xmpp/client": "^0.13.1",
|
|
23
|
+
"axios": "^1.7.2",
|
|
24
|
+
"firebase": "^10.13.2",
|
|
25
|
+
"ltx": "^3.0.0",
|
|
26
|
+
"react": "^18.3.1",
|
|
27
|
+
"react-dom": "^18.3.1",
|
|
28
|
+
"react-redux": "^9.1.0",
|
|
29
|
+
"redux": "^5.0.1",
|
|
30
|
+
"redux-saga": "^1.3.0",
|
|
31
|
+
"styled-components": "^6.1.8",
|
|
32
|
+
"uuid": "^9.0.1",
|
|
33
|
+
"vite-plugin-dts": "^3.9.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^20.14.9",
|
|
37
|
+
"@types/react": "^18.3.3",
|
|
38
|
+
"@types/react-dom": "^18.3.0",
|
|
39
|
+
"@types/xmpp__client": "^0.13.3",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
41
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
42
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
43
|
+
"eslint": "^8.57.0",
|
|
44
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
45
|
+
"eslint-plugin-react-refresh": "^0.4.7",
|
|
46
|
+
"typescript": "^5.2.2",
|
|
47
|
+
"vite": "^5.3.1"
|
|
48
|
+
},
|
|
49
|
+
"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 projecet-2-ccomp 6. go to file src/App.tsx and replace it with this code",
|
|
50
|
+
"directories": {
|
|
51
|
+
"lib": "lib"
|
|
52
|
+
},
|
|
53
|
+
"author": "Ethora",
|
|
54
|
+
"license": "ISC"
|
|
55
|
+
}
|