@esvndev/es-react-template-chat 0.0.11 → 0.0.13
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/index.js +18 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
require('@styles/base/pages/app-chat.scss');
|
|
8
8
|
require('@styles/base/pages/app-chat-list.scss');
|
|
9
9
|
require('react-dom');
|
|
10
|
-
var
|
|
10
|
+
var configureStore = require('@src/redux/configureStore');
|
|
11
11
|
var toolkit = require('@reduxjs/toolkit');
|
|
12
12
|
var require$$1 = require('util');
|
|
13
13
|
var stream = require('stream');
|
|
@@ -20502,43 +20502,6 @@ var dayjs_min = {exports: {}};
|
|
|
20502
20502
|
!function(t,n){module.exports=n(dayjs_min.exports);}(commonjsGlobal,(function(t){function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var h=n(t),_={name:"vi",weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),weekStart:1,weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),ordinal:function(t){return t},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"}};return h.default.locale(_,null,!0),_}));
|
|
20503
20503
|
}(vi));
|
|
20504
20504
|
|
|
20505
|
-
/**
|
|
20506
|
-
* Store Registry - Cho phép project bên ngoài inject Redux hooks vào library
|
|
20507
|
-
*
|
|
20508
|
-
* Pattern này giúp thư viện (library) có thể truy cập Redux Store của ứng dụng chính (Host App)
|
|
20509
|
-
* mà không cần phụ thuộc cứng vào cấu trúc, đường dẫn hay types của Store đó.
|
|
20510
|
-
*
|
|
20511
|
-
* 1. Cách đăng ký (Tại Host App - file index.tsx hoặc App.tsx):
|
|
20512
|
-
* -----------------------------------------------------------
|
|
20513
|
-
* import { registerStore } from '@esvndev/es-template-chat' // hoặc path tới file này
|
|
20514
|
-
* import { useAppDispatch, useAppSelector } from './redux/hooks' // Hooks của App
|
|
20515
|
-
*
|
|
20516
|
-
* // Inject hooks của App vào Library trước khi render
|
|
20517
|
-
* registerStore({
|
|
20518
|
-
* useAppDispatch,
|
|
20519
|
-
* useAppSelector
|
|
20520
|
-
* })
|
|
20521
|
-
*
|
|
20522
|
-
* 2. Cách sử dụng (Trong Library Components):
|
|
20523
|
-
* -----------------------------------------------------------
|
|
20524
|
-
* // Thay vì import từ react-redux, hãy import từ storeRegistry
|
|
20525
|
-
* import { useAppSelector, useAppDispatch } from './shared/storeRegistry'
|
|
20526
|
-
*
|
|
20527
|
-
* const MyComponent = () => {
|
|
20528
|
-
* const dispatch = useAppDispatch()
|
|
20529
|
-
* const data = useAppSelector(state => state.some.data) // state là RootState của Host App
|
|
20530
|
-
* ...
|
|
20531
|
-
* }
|
|
20532
|
-
*/
|
|
20533
|
-
// Default fallback sử dụng react-redux trực tiếp
|
|
20534
|
-
let registry = {
|
|
20535
|
-
useAppDispatch: () => reactRedux.useDispatch(),
|
|
20536
|
-
useAppSelector: (selector) => reactRedux.useSelector(selector)
|
|
20537
|
-
};
|
|
20538
|
-
// Export hooks wrapper để sử dụng trực tiếp trong components
|
|
20539
|
-
const useAppDispatch = () => registry.useAppDispatch();
|
|
20540
|
-
const useAppSelector = (selector) => registry.useAppSelector(selector);
|
|
20541
|
-
|
|
20542
20505
|
var moment = {exports: {}};
|
|
20543
20506
|
|
|
20544
20507
|
(function (module, exports) {
|
|
@@ -47247,8 +47210,8 @@ const { selectChat, selectContact, selectType, selectActive, selectLoadChat, sel
|
|
|
47247
47210
|
getNotification, removeChatRoom, setListChatType, setArchive, setApproveStatus, setHistory, editGroupName, setScroll, updateMemberGroup, setMessageByGroup, leaveGroup, getGeneralGroup, setGeneralGroup, editGroupAvatar, editGroupTag, addPinnedMessage, userTyping } = appChatSlice.actions;
|
|
47248
47211
|
|
|
47249
47212
|
const useChat = () => {
|
|
47250
|
-
const dispatch = useAppDispatch();
|
|
47251
|
-
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = useAppSelector((state) => state.chat);
|
|
47213
|
+
const dispatch = configureStore.useAppDispatch();
|
|
47214
|
+
const { active, checkInit, chatRoomId, userLogin, listContact, contactId, typeChat, loadChat, messageByGroup, listHistory, listChatType, archiveStore, checkScroll, listGeneralGroup, pinnedMessages, typingUsers } = configureStore.useAppSelector((state) => state.chat);
|
|
47252
47215
|
const getHistoryApi = (params) => {
|
|
47253
47216
|
return dispatch(get_history(params));
|
|
47254
47217
|
};
|
|
@@ -47374,7 +47337,21 @@ const useChat = () => {
|
|
|
47374
47337
|
};
|
|
47375
47338
|
|
|
47376
47339
|
const AppChat = () => {
|
|
47377
|
-
|
|
47340
|
+
const { active,
|
|
47341
|
+
// contactId,
|
|
47342
|
+
// typeChat,
|
|
47343
|
+
// chatRoomId,
|
|
47344
|
+
// messageByGroup,
|
|
47345
|
+
// listHistory,
|
|
47346
|
+
// checkInit,
|
|
47347
|
+
// setScroll,
|
|
47348
|
+
// getHistoryApi,
|
|
47349
|
+
// getProfileApi,
|
|
47350
|
+
// getInfoApi,
|
|
47351
|
+
// getContactApi,
|
|
47352
|
+
// senMessageApi
|
|
47353
|
+
} = useChat();
|
|
47354
|
+
console.log('active', active);
|
|
47378
47355
|
// const {
|
|
47379
47356
|
// connection
|
|
47380
47357
|
// } = useAppSelector((state: any) => state.hubNotification)
|