@esvndev/es-react-template-chat 0.0.30 → 0.0.32
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/store/index.d.ts +145 -3
- package/dist/index.js +41 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -28
- package/dist/index.mjs.map +1 -1
- package/dist/utility/stores/uploadFile.d.ts +15 -5
- package/package.json +4 -2
|
@@ -1,3 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
interface IUser {
|
|
2
|
+
id: string;
|
|
3
|
+
code?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
address?: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
gender?: string;
|
|
10
|
+
lastLogin?: string;
|
|
11
|
+
currentSession?: string;
|
|
12
|
+
status?: number;
|
|
13
|
+
isFriend?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface IFState {
|
|
16
|
+
checkInit: boolean;
|
|
17
|
+
chatRoomId?: string;
|
|
18
|
+
contactId?: string;
|
|
19
|
+
userLogin?: IUser;
|
|
20
|
+
listContact?: any;
|
|
21
|
+
typeChat: string;
|
|
22
|
+
active?: string;
|
|
23
|
+
loadChat?: number;
|
|
24
|
+
messageByGroup: any;
|
|
25
|
+
listHistory: any;
|
|
26
|
+
listChatType: any;
|
|
27
|
+
archiveStore: any[];
|
|
28
|
+
checkScroll: boolean;
|
|
29
|
+
listGeneralGroup: any;
|
|
30
|
+
pinnedMessages: any[];
|
|
31
|
+
typingUsers: any;
|
|
32
|
+
}
|
|
33
|
+
export declare const get_history: import("@reduxjs/toolkit").AsyncThunk<any, any, import("@reduxjs/toolkit/dist/createAsyncThunk").AsyncThunkConfig>;
|
|
34
|
+
export declare const appChatSlice: import("@reduxjs/toolkit").Slice<IFState, {
|
|
35
|
+
selectChat(state: import("immer").WritableDraft<IFState>, action: {
|
|
36
|
+
payload: any;
|
|
37
|
+
type: string;
|
|
38
|
+
}): void;
|
|
39
|
+
selectContact(state: import("immer").WritableDraft<IFState>, action: {
|
|
40
|
+
payload: any;
|
|
41
|
+
type: string;
|
|
42
|
+
}): void;
|
|
43
|
+
selectType(state: import("immer").WritableDraft<IFState>, action: {
|
|
44
|
+
payload: any;
|
|
45
|
+
type: string;
|
|
46
|
+
}): void;
|
|
47
|
+
selectActive(state: import("immer").WritableDraft<IFState>, action: {
|
|
48
|
+
payload: any;
|
|
49
|
+
type: string;
|
|
50
|
+
}): void;
|
|
51
|
+
selectLoadChat(state: import("immer").WritableDraft<IFState>, action: {
|
|
52
|
+
payload: any;
|
|
53
|
+
type: string;
|
|
54
|
+
}): void;
|
|
55
|
+
selectByGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
56
|
+
payload: any;
|
|
57
|
+
type: string;
|
|
58
|
+
}): void;
|
|
59
|
+
setScroll(state: import("immer").WritableDraft<IFState>, action: {
|
|
60
|
+
payload: any;
|
|
61
|
+
type: string;
|
|
62
|
+
}): void;
|
|
63
|
+
addNewMessage(state: import("immer").WritableDraft<IFState>, action: {
|
|
64
|
+
payload: any;
|
|
65
|
+
type: string;
|
|
66
|
+
}): void;
|
|
67
|
+
addPinnedMessage(state: import("immer").WritableDraft<IFState>, action: {
|
|
68
|
+
payload: any;
|
|
69
|
+
type: string;
|
|
70
|
+
}): void;
|
|
71
|
+
deleteMessage(state: import("immer").WritableDraft<IFState>, action: {
|
|
72
|
+
payload: any;
|
|
73
|
+
type: string;
|
|
74
|
+
}): void;
|
|
75
|
+
setCountUnread(state: import("immer").WritableDraft<IFState>, action: {
|
|
76
|
+
payload: any;
|
|
77
|
+
type: string;
|
|
78
|
+
}): void;
|
|
79
|
+
setHistory(state: import("immer").WritableDraft<IFState>, action: {
|
|
80
|
+
payload: any;
|
|
81
|
+
type: string;
|
|
82
|
+
}): void;
|
|
83
|
+
setMessageByGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
84
|
+
payload: any;
|
|
85
|
+
type: string;
|
|
86
|
+
}): void;
|
|
87
|
+
updateMemberGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
88
|
+
payload: any;
|
|
89
|
+
type: string;
|
|
90
|
+
}): void;
|
|
91
|
+
removeChatRoom(state: import("immer").WritableDraft<IFState>, action: {
|
|
92
|
+
payload: any;
|
|
93
|
+
type: string;
|
|
94
|
+
}): void;
|
|
95
|
+
leaveGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
96
|
+
payload: any;
|
|
97
|
+
type: string;
|
|
98
|
+
}): void;
|
|
99
|
+
getGeneralGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
100
|
+
payload: any;
|
|
101
|
+
type: string;
|
|
102
|
+
}): void;
|
|
103
|
+
setGeneralGroup(state: import("immer").WritableDraft<IFState>, action: {
|
|
104
|
+
payload: any;
|
|
105
|
+
type: string;
|
|
106
|
+
}): void;
|
|
107
|
+
getNotification(state: import("immer").WritableDraft<IFState>, action: {
|
|
108
|
+
payload: any;
|
|
109
|
+
type: string;
|
|
110
|
+
}): void;
|
|
111
|
+
setListChatType(state: import("immer").WritableDraft<IFState>, action: {
|
|
112
|
+
payload: any;
|
|
113
|
+
type: string;
|
|
114
|
+
}): void;
|
|
115
|
+
setArchive(state: import("immer").WritableDraft<IFState>, action: {
|
|
116
|
+
payload: any;
|
|
117
|
+
type: string;
|
|
118
|
+
}): void;
|
|
119
|
+
setApproveStatus(state: import("immer").WritableDraft<IFState>, action: {
|
|
120
|
+
payload: any;
|
|
121
|
+
type: string;
|
|
122
|
+
}): void;
|
|
123
|
+
editGroupName(state: import("immer").WritableDraft<IFState>, action: {
|
|
124
|
+
payload: any;
|
|
125
|
+
type: string;
|
|
126
|
+
}): void;
|
|
127
|
+
editGroupAvatar(state: import("immer").WritableDraft<IFState>, action: {
|
|
128
|
+
payload: any;
|
|
129
|
+
type: string;
|
|
130
|
+
}): void;
|
|
131
|
+
editGroupTag(state: import("immer").WritableDraft<IFState>, action: {
|
|
132
|
+
payload: any;
|
|
133
|
+
type: string;
|
|
134
|
+
}): void;
|
|
135
|
+
userTyping(state: import("immer").WritableDraft<IFState>, action: {
|
|
136
|
+
payload: any;
|
|
137
|
+
type: string;
|
|
138
|
+
}): void;
|
|
139
|
+
recallMessage(state: import("immer").WritableDraft<IFState>, action: {
|
|
140
|
+
payload: any;
|
|
141
|
+
type: string;
|
|
142
|
+
}): void;
|
|
143
|
+
}, "appChat", "appChat", import("@reduxjs/toolkit").SliceSelectors<IFState>>;
|
|
144
|
+
export declare const selectChat: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectChat">, selectContact: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectContact">, selectType: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectType">, selectActive: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectActive">, selectLoadChat: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectLoadChat">, selectByGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/selectByGroup">, addNewMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/addNewMessage">, setCountUnread: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setCountUnread">, deleteMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/deleteMessage">, recallMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/recallMessage">, getNotification: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/getNotification">, removeChatRoom: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/removeChatRoom">, setListChatType: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setListChatType">, setArchive: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setArchive">, setApproveStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setApproveStatus">, setHistory: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setHistory">, editGroupName: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/editGroupName">, setScroll: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setScroll">, updateMemberGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/updateMemberGroup">, setMessageByGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setMessageByGroup">, leaveGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/leaveGroup">, getGeneralGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/getGeneralGroup">, setGeneralGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/setGeneralGroup">, editGroupAvatar: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/editGroupAvatar">, editGroupTag: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/editGroupTag">, addPinnedMessage: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/addPinnedMessage">, userTyping: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, "appChat/userTyping">;
|
|
145
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -26824,9 +26824,9 @@ const appChatSlice = toolkit.createSlice({
|
|
|
26824
26824
|
// builder.addCase(update_chat_room_member.fulfilled, (state: IFState) => {
|
|
26825
26825
|
// state.checkInit = !state.checkInit
|
|
26826
26826
|
// })
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26827
|
+
builder.addCase(get_history.fulfilled, (state, action) => {
|
|
26828
|
+
state.listHistory = action.payload?.items;
|
|
26829
|
+
});
|
|
26830
26830
|
// builder.addCase(getPinMessageChatRoomApi.fulfilled, (state: IFState, action) => {
|
|
26831
26831
|
// // Backend trả về danh sách PinMessage (mảng / items / data)
|
|
26832
26832
|
// const payload = action.payload as any
|
|
@@ -26857,12 +26857,27 @@ const appChatSlice = toolkit.createSlice({
|
|
|
26857
26857
|
});
|
|
26858
26858
|
appChatSlice.actions;
|
|
26859
26859
|
|
|
26860
|
+
//import * as chatStore from '../store'
|
|
26860
26861
|
const useChat = () => {
|
|
26861
26862
|
const dispatch = configureStore.useAppDispatch();
|
|
26862
26863
|
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = configureStore.useAppSelector((state) => state.chat);
|
|
26863
26864
|
const getHistoryApi = (params) => {
|
|
26864
26865
|
return dispatch(get_history(params));
|
|
26865
26866
|
};
|
|
26867
|
+
// const getHistoryApi = async (params: any) => {
|
|
26868
|
+
// const queryString = new URLSearchParams(params).toString()
|
|
26869
|
+
// const response = await fetch(`${CHAT.URL_API.GET_HISTORY_API}?${queryString}`, {
|
|
26870
|
+
// method: 'GET',
|
|
26871
|
+
// headers: {
|
|
26872
|
+
// 'Authorization': `Bearer ${getToken()}`,
|
|
26873
|
+
// 'Content-Type': 'application/json'
|
|
26874
|
+
// }
|
|
26875
|
+
// })
|
|
26876
|
+
// if (!response.ok) {
|
|
26877
|
+
// throw new Error(`HTTP error! status: ${response.status}`)
|
|
26878
|
+
// }
|
|
26879
|
+
// return response.json()
|
|
26880
|
+
// }
|
|
26866
26881
|
// const get_message_by_group_cursor_api = (params: any) => {
|
|
26867
26882
|
// return dispatch(chatStore.get_message_by_group_cursor(params))
|
|
26868
26883
|
// }
|
|
@@ -26985,15 +27000,15 @@ const useChat = () => {
|
|
|
26985
27000
|
};
|
|
26986
27001
|
|
|
26987
27002
|
const AppChat = () => {
|
|
26988
|
-
const { active,
|
|
27003
|
+
const { active,
|
|
26989
27004
|
// contactId,
|
|
26990
|
-
|
|
27005
|
+
typeChat,
|
|
26991
27006
|
// chatRoomId,
|
|
26992
27007
|
// messageByGroup,
|
|
26993
27008
|
// listHistory,
|
|
26994
27009
|
// checkInit,
|
|
26995
27010
|
// setScroll,
|
|
26996
|
-
|
|
27011
|
+
getHistoryApi,
|
|
26997
27012
|
// getProfileApi,
|
|
26998
27013
|
// getInfoApi,
|
|
26999
27014
|
// getContactApi,
|
|
@@ -27009,27 +27024,27 @@ const AppChat = () => {
|
|
|
27009
27024
|
// const [dataProfile, setDataProfile] = useState({})
|
|
27010
27025
|
// const [sidebarRight, setSidebarRight] = useState(false)
|
|
27011
27026
|
// const handleSidebarRight = () => setSidebarRight(!sidebarRight)
|
|
27012
|
-
|
|
27013
|
-
|
|
27027
|
+
const [tagFilter] = React.useState('');
|
|
27028
|
+
const [filterTab] = React.useState('all');
|
|
27014
27029
|
// const [openModalGroupInfo, setOpenModalGroupInfo] = useState(false)
|
|
27015
27030
|
// const [openModalAddUserGroup, setOpenModalAddUserGroup] = useState(false)
|
|
27016
27031
|
// const [windowSize, setWindowSize] = useState(getWindowSize())
|
|
27017
|
-
|
|
27032
|
+
const [search] = React.useState('');
|
|
27018
27033
|
// const [contact, setContact] = useState([])
|
|
27019
27034
|
// // ** Set user function for Right Sidebar
|
|
27020
27035
|
// const handleModalAddUserGroup = () => setOpenModalAddUserGroup(!openModalAddUserGroup)
|
|
27021
27036
|
// const handleModalGroupInfo = () => setOpenModalGroupInfo(!openModalGroupInfo)
|
|
27022
|
-
|
|
27023
|
-
|
|
27024
|
-
|
|
27025
|
-
|
|
27026
|
-
|
|
27027
|
-
|
|
27028
|
-
|
|
27029
|
-
|
|
27030
|
-
|
|
27031
|
-
|
|
27032
|
-
|
|
27037
|
+
const getData = () => {
|
|
27038
|
+
const paging = {
|
|
27039
|
+
keyword: search,
|
|
27040
|
+
filter: filterTab === 'unread' ? 'unread' : '',
|
|
27041
|
+
order: '',
|
|
27042
|
+
pageNumber: 1,
|
|
27043
|
+
pageSize: 20,
|
|
27044
|
+
tag: tagFilter || undefined
|
|
27045
|
+
};
|
|
27046
|
+
getHistoryApi(paging);
|
|
27047
|
+
};
|
|
27033
27048
|
// const getContact = () => {
|
|
27034
27049
|
// getContactApi({
|
|
27035
27050
|
// keyword: search,
|
|
@@ -27046,14 +27061,12 @@ const AppChat = () => {
|
|
|
27046
27061
|
// .then((rs: any) => setDataProfile(rs))
|
|
27047
27062
|
// .catch((ex: any) => console.log(ex))
|
|
27048
27063
|
// }
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
// getDataProfile()
|
|
27056
|
-
// }, [typeChat, search, checkInit, tagFilter, filterTab])
|
|
27064
|
+
React.useEffect(() => {
|
|
27065
|
+
if (typeChat !== 'CONTACT') {
|
|
27066
|
+
getData();
|
|
27067
|
+
}
|
|
27068
|
+
//getDataProfile()
|
|
27069
|
+
}, [typeChat, search, tagFilter, filterTab]);
|
|
27057
27070
|
// useEffect(() => {
|
|
27058
27071
|
// const handleWindowResize = () => {
|
|
27059
27072
|
// setWindowSize(getWindowSize())
|