@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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createContext, useContext, useState, useEffect, useCallback, useLayoutE
|
|
|
4
4
|
import '@styles/base/pages/app-chat.scss';
|
|
5
5
|
import '@styles/base/pages/app-chat-list.scss';
|
|
6
6
|
import 'react-dom';
|
|
7
|
-
import {
|
|
7
|
+
import { useAppDispatch, useAppSelector } from '@src/redux/configureStore';
|
|
8
8
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
9
9
|
import require$$1 from 'util';
|
|
10
10
|
import stream, { Readable } from 'stream';
|
|
@@ -20464,43 +20464,6 @@ var dayjs_min = {exports: {}};
|
|
|
20464
20464
|
!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),_}));
|
|
20465
20465
|
}(vi));
|
|
20466
20466
|
|
|
20467
|
-
/**
|
|
20468
|
-
* Store Registry - Cho phép project bên ngoài inject Redux hooks vào library
|
|
20469
|
-
*
|
|
20470
|
-
* 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)
|
|
20471
|
-
* mà không cần phụ thuộc cứng vào cấu trúc, đường dẫn hay types của Store đó.
|
|
20472
|
-
*
|
|
20473
|
-
* 1. Cách đăng ký (Tại Host App - file index.tsx hoặc App.tsx):
|
|
20474
|
-
* -----------------------------------------------------------
|
|
20475
|
-
* import { registerStore } from '@esvndev/es-template-chat' // hoặc path tới file này
|
|
20476
|
-
* import { useAppDispatch, useAppSelector } from './redux/hooks' // Hooks của App
|
|
20477
|
-
*
|
|
20478
|
-
* // Inject hooks của App vào Library trước khi render
|
|
20479
|
-
* registerStore({
|
|
20480
|
-
* useAppDispatch,
|
|
20481
|
-
* useAppSelector
|
|
20482
|
-
* })
|
|
20483
|
-
*
|
|
20484
|
-
* 2. Cách sử dụng (Trong Library Components):
|
|
20485
|
-
* -----------------------------------------------------------
|
|
20486
|
-
* // Thay vì import từ react-redux, hãy import từ storeRegistry
|
|
20487
|
-
* import { useAppSelector, useAppDispatch } from './shared/storeRegistry'
|
|
20488
|
-
*
|
|
20489
|
-
* const MyComponent = () => {
|
|
20490
|
-
* const dispatch = useAppDispatch()
|
|
20491
|
-
* const data = useAppSelector(state => state.some.data) // state là RootState của Host App
|
|
20492
|
-
* ...
|
|
20493
|
-
* }
|
|
20494
|
-
*/
|
|
20495
|
-
// Default fallback sử dụng react-redux trực tiếp
|
|
20496
|
-
let registry = {
|
|
20497
|
-
useAppDispatch: () => useDispatch(),
|
|
20498
|
-
useAppSelector: (selector) => useSelector(selector)
|
|
20499
|
-
};
|
|
20500
|
-
// Export hooks wrapper để sử dụng trực tiếp trong components
|
|
20501
|
-
const useAppDispatch = () => registry.useAppDispatch();
|
|
20502
|
-
const useAppSelector = (selector) => registry.useAppSelector(selector);
|
|
20503
|
-
|
|
20504
20467
|
var moment = {exports: {}};
|
|
20505
20468
|
|
|
20506
20469
|
(function (module, exports) {
|
|
@@ -47336,7 +47299,21 @@ const useChat = () => {
|
|
|
47336
47299
|
};
|
|
47337
47300
|
|
|
47338
47301
|
const AppChat = () => {
|
|
47339
|
-
|
|
47302
|
+
const { active,
|
|
47303
|
+
// contactId,
|
|
47304
|
+
// typeChat,
|
|
47305
|
+
// chatRoomId,
|
|
47306
|
+
// messageByGroup,
|
|
47307
|
+
// listHistory,
|
|
47308
|
+
// checkInit,
|
|
47309
|
+
// setScroll,
|
|
47310
|
+
// getHistoryApi,
|
|
47311
|
+
// getProfileApi,
|
|
47312
|
+
// getInfoApi,
|
|
47313
|
+
// getContactApi,
|
|
47314
|
+
// senMessageApi
|
|
47315
|
+
} = useChat();
|
|
47316
|
+
console.log('active', active);
|
|
47340
47317
|
// const {
|
|
47341
47318
|
// connection
|
|
47342
47319
|
// } = useAppSelector((state: any) => state.hubNotification)
|