@fctc/interface-logic 1.7.5 → 1.7.6

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/hooks.js CHANGED
@@ -2508,94 +2508,710 @@ var axiosClient = {
2508
2508
  }
2509
2509
  };
2510
2510
 
2511
+ // src/store/index.ts
2512
+ var import_react_redux = require("react-redux");
2513
+
2514
+ // src/store/reducers/breadcrums-slice/index.ts
2515
+ var import_toolkit = require("@reduxjs/toolkit");
2516
+ var initialState = {
2517
+ breadCrumbs: []
2518
+ };
2519
+ var breadcrumbsSlice = (0, import_toolkit.createSlice)({
2520
+ name: "breadcrumbs",
2521
+ initialState,
2522
+ reducers: {
2523
+ setBreadCrumbs: (state, action) => {
2524
+ state.breadCrumbs = [...state.breadCrumbs, action.payload];
2525
+ }
2526
+ }
2527
+ });
2528
+ var { setBreadCrumbs } = breadcrumbsSlice.actions;
2529
+ var breadcrums_slice_default = breadcrumbsSlice.reducer;
2530
+
2531
+ // src/store/reducers/env-slice/index.ts
2532
+ var import_toolkit2 = require("@reduxjs/toolkit");
2533
+ var initialState2 = {
2534
+ baseUrl: "",
2535
+ requests: null,
2536
+ companies: [],
2537
+ user: {},
2538
+ config: null,
2539
+ envFile: null,
2540
+ defaultCompany: {
2541
+ id: null,
2542
+ logo: "",
2543
+ secondary_color: "",
2544
+ primary_color: ""
2545
+ },
2546
+ context: {
2547
+ uid: null,
2548
+ allowed_company_ids: [],
2549
+ lang: "vi_VN",
2550
+ tz: "Asia/Saigon"
2551
+ }
2552
+ };
2553
+ var envSlice = (0, import_toolkit2.createSlice)({
2554
+ name: "env",
2555
+ initialState: initialState2,
2556
+ reducers: {
2557
+ setEnv: (state, action) => {
2558
+ Object.assign(state, action.payload);
2559
+ },
2560
+ setUid: (state, action) => {
2561
+ state.context.uid = action.payload;
2562
+ },
2563
+ setAllowCompanies: (state, action) => {
2564
+ state.context.allowed_company_ids = action.payload;
2565
+ },
2566
+ setCompanies: (state, action) => {
2567
+ state.companies = action.payload;
2568
+ },
2569
+ setDefaultCompany: (state, action) => {
2570
+ state.defaultCompany = action.payload;
2571
+ },
2572
+ setLang: (state, action) => {
2573
+ state.context.lang = action.payload;
2574
+ },
2575
+ setUser: (state, action) => {
2576
+ state.user = action.payload;
2577
+ },
2578
+ setConfig: (state, action) => {
2579
+ state.config = action.payload;
2580
+ },
2581
+ setEnvFile: (state, action) => {
2582
+ state.envFile = action.payload;
2583
+ }
2584
+ }
2585
+ });
2586
+ var {
2587
+ setEnv,
2588
+ setUid,
2589
+ setLang,
2590
+ setAllowCompanies,
2591
+ setCompanies,
2592
+ setDefaultCompany,
2593
+ setUser,
2594
+ setConfig,
2595
+ setEnvFile
2596
+ } = envSlice.actions;
2597
+ var env_slice_default = envSlice.reducer;
2598
+
2599
+ // src/store/reducers/excel-slice/index.ts
2600
+ var import_toolkit3 = require("@reduxjs/toolkit");
2601
+ var initialState3 = {
2602
+ dataParse: null,
2603
+ idFile: null,
2604
+ isFileLoaded: false,
2605
+ loadingImport: false,
2606
+ selectedFile: null,
2607
+ errorData: null
2608
+ };
2609
+ var excelSlice = (0, import_toolkit3.createSlice)({
2610
+ name: "excel",
2611
+ initialState: initialState3,
2612
+ reducers: {
2613
+ setDataParse: (state, action) => {
2614
+ state.dataParse = action.payload;
2615
+ },
2616
+ setIdFile: (state, action) => {
2617
+ state.idFile = action.payload;
2618
+ },
2619
+ setIsFileLoaded: (state, action) => {
2620
+ state.isFileLoaded = action.payload;
2621
+ },
2622
+ setLoadingImport: (state, action) => {
2623
+ state.loadingImport = action.payload;
2624
+ },
2625
+ setSelectedFile: (state, action) => {
2626
+ state.selectedFile = action.payload;
2627
+ },
2628
+ setErrorData: (state, action) => {
2629
+ state.errorData = action.payload;
2630
+ }
2631
+ }
2632
+ });
2633
+ var {
2634
+ setDataParse,
2635
+ setIdFile,
2636
+ setIsFileLoaded,
2637
+ setLoadingImport,
2638
+ setSelectedFile,
2639
+ setErrorData
2640
+ } = excelSlice.actions;
2641
+ var excel_slice_default = excelSlice.reducer;
2642
+
2643
+ // src/store/reducers/form-slice/index.ts
2644
+ var import_toolkit4 = require("@reduxjs/toolkit");
2645
+ var initialState4 = {
2646
+ viewDataStore: {},
2647
+ isShowingModalDetail: false,
2648
+ isShowModalTranslate: false,
2649
+ formSubmitComponent: {},
2650
+ fieldTranslation: null,
2651
+ listSubject: {},
2652
+ dataUser: {}
2653
+ };
2654
+ var formSlice = (0, import_toolkit4.createSlice)({
2655
+ name: "form",
2656
+ initialState: initialState4,
2657
+ reducers: {
2658
+ setViewDataStore: (state, action) => {
2659
+ state.viewDataStore = action.payload;
2660
+ },
2661
+ setIsShowingModalDetail: (state, action) => {
2662
+ state.isShowingModalDetail = action.payload;
2663
+ },
2664
+ setIsShowModalTranslate: (state, action) => {
2665
+ state.isShowModalTranslate = action.payload;
2666
+ },
2667
+ setFormSubmitComponent: (state, action) => {
2668
+ state.formSubmitComponent[action.payload.key] = action.payload.component;
2669
+ },
2670
+ setFieldTranslate: (state, action) => {
2671
+ state.fieldTranslation = action.payload;
2672
+ },
2673
+ setListSubject: (state, action) => {
2674
+ state.listSubject = action.payload;
2675
+ },
2676
+ setDataUser: (state, action) => {
2677
+ state.dataUser = action.payload;
2678
+ }
2679
+ }
2680
+ });
2681
+ var {
2682
+ setViewDataStore,
2683
+ setIsShowingModalDetail,
2684
+ setIsShowModalTranslate,
2685
+ setFormSubmitComponent,
2686
+ setFieldTranslate,
2687
+ setListSubject,
2688
+ setDataUser
2689
+ } = formSlice.actions;
2690
+ var form_slice_default = formSlice.reducer;
2691
+
2692
+ // src/store/reducers/header-slice/index.ts
2693
+ var import_toolkit5 = require("@reduxjs/toolkit");
2694
+ var headerSlice = (0, import_toolkit5.createSlice)({
2695
+ name: "header",
2696
+ initialState: {
2697
+ value: { allowedCompanyIds: [] }
2698
+ },
2699
+ reducers: {
2700
+ setHeader: (state, action) => {
2701
+ state.value = { ...state.value, ...action.payload };
2702
+ },
2703
+ setAllowedCompanyIds: (state, action) => {
2704
+ state.value.allowedCompanyIds = action.payload;
2705
+ }
2706
+ }
2707
+ });
2708
+ var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
2709
+ var header_slice_default = headerSlice.reducer;
2710
+
2711
+ // src/store/reducers/list-slice/index.ts
2712
+ var import_toolkit6 = require("@reduxjs/toolkit");
2713
+ var initialState5 = {
2714
+ pageLimit: 10,
2715
+ fields: {},
2716
+ order: "",
2717
+ selectedRowKeys: [],
2718
+ selectedRadioKey: 0,
2719
+ indexRowTableModal: -2,
2720
+ isUpdateTableModal: false,
2721
+ footerGroupTable: {},
2722
+ transferDetail: null,
2723
+ page: 0,
2724
+ domainTable: []
2725
+ };
2726
+ var listSlice = (0, import_toolkit6.createSlice)({
2727
+ name: "list",
2728
+ initialState: initialState5,
2729
+ reducers: {
2730
+ setPageLimit: (state, action) => {
2731
+ state.pageLimit = action.payload;
2732
+ },
2733
+ setFields: (state, action) => {
2734
+ state.fields = action.payload;
2735
+ },
2736
+ setOrder: (state, action) => {
2737
+ state.order = action.payload;
2738
+ },
2739
+ setSelectedRowKeys: (state, action) => {
2740
+ state.selectedRowKeys = action.payload;
2741
+ },
2742
+ setSelectedRadioKey: (state, action) => {
2743
+ state.selectedRadioKey = action.payload;
2744
+ },
2745
+ setIndexRowTableModal: (state, action) => {
2746
+ state.indexRowTableModal = action.payload;
2747
+ },
2748
+ setTransferDetail: (state, action) => {
2749
+ state.transferDetail = action.payload;
2750
+ },
2751
+ setIsUpdateTableModal: (state, action) => {
2752
+ state.isUpdateTableModal = action.payload;
2753
+ },
2754
+ setPage: (state, action) => {
2755
+ state.page = action.payload;
2756
+ },
2757
+ setDomainTable: (state, action) => {
2758
+ state.domainTable = action.payload;
2759
+ }
2760
+ }
2761
+ });
2762
+ var {
2763
+ setPageLimit,
2764
+ setFields,
2765
+ setOrder,
2766
+ setSelectedRowKeys,
2767
+ setIndexRowTableModal,
2768
+ setIsUpdateTableModal,
2769
+ setPage,
2770
+ setSelectedRadioKey,
2771
+ setTransferDetail,
2772
+ setDomainTable
2773
+ } = listSlice.actions;
2774
+ var list_slice_default = listSlice.reducer;
2775
+
2776
+ // src/store/reducers/login-slice/index.ts
2777
+ var import_toolkit7 = require("@reduxjs/toolkit");
2778
+ var initialState6 = {
2779
+ db: "",
2780
+ redirectTo: "/",
2781
+ forgotPasswordUrl: "/"
2782
+ };
2783
+ var loginSlice = (0, import_toolkit7.createSlice)({
2784
+ name: "login",
2785
+ initialState: initialState6,
2786
+ reducers: {
2787
+ setDb: (state, action) => {
2788
+ state.db = action.payload;
2789
+ },
2790
+ setRedirectTo: (state, action) => {
2791
+ state.redirectTo = action.payload;
2792
+ },
2793
+ setForgotPasswordUrl: (state, action) => {
2794
+ state.forgotPasswordUrl = action.payload;
2795
+ }
2796
+ }
2797
+ });
2798
+ var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
2799
+ var login_slice_default = loginSlice.reducer;
2800
+
2801
+ // src/store/reducers/navbar-slice/index.ts
2802
+ var import_toolkit8 = require("@reduxjs/toolkit");
2803
+ var initialState7 = {
2804
+ menuFocus: {},
2805
+ menuAction: {},
2806
+ navbarWidth: 250,
2807
+ menuList: []
2808
+ };
2809
+ var navbarSlice = (0, import_toolkit8.createSlice)({
2810
+ name: "navbar",
2811
+ initialState: initialState7,
2812
+ reducers: {
2813
+ setMenuFocus: (state, action) => {
2814
+ state.menuFocus = action.payload;
2815
+ },
2816
+ setMenuFocusAction: (state, action) => {
2817
+ state.menuAction = action.payload;
2818
+ },
2819
+ setNavbarWidth: (state, action) => {
2820
+ state.navbarWidth = action.payload;
2821
+ },
2822
+ setMenuList: (state, action) => {
2823
+ state.menuList = action.payload;
2824
+ }
2825
+ }
2826
+ });
2827
+ var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
2828
+ var navbar_slice_default = navbarSlice.reducer;
2829
+
2830
+ // src/store/reducers/profile-slice/index.ts
2831
+ var import_toolkit9 = require("@reduxjs/toolkit");
2832
+ var initialState8 = {
2833
+ profile: {}
2834
+ };
2835
+ var profileSlice = (0, import_toolkit9.createSlice)({
2836
+ name: "profile",
2837
+ initialState: initialState8,
2838
+ reducers: {
2839
+ setProfile: (state, action) => {
2840
+ state.profile = action.payload;
2841
+ }
2842
+ }
2843
+ });
2844
+ var { setProfile } = profileSlice.actions;
2845
+ var profile_slice_default = profileSlice.reducer;
2846
+
2847
+ // src/store/reducers/search-slice/index.ts
2848
+ var import_toolkit10 = require("@reduxjs/toolkit");
2849
+ var initialState9 = {
2850
+ groupByDomain: null,
2851
+ searchBy: [],
2852
+ searchString: "",
2853
+ hoveredIndexSearchList: null,
2854
+ selectedTags: [],
2855
+ firstDomain: null,
2856
+ searchMap: {},
2857
+ filterBy: [],
2858
+ groupBy: []
2859
+ };
2860
+ var searchSlice = (0, import_toolkit10.createSlice)({
2861
+ name: "search",
2862
+ initialState: initialState9,
2863
+ reducers: {
2864
+ setGroupByDomain: (state, action) => {
2865
+ state.groupByDomain = action.payload;
2866
+ },
2867
+ setSearchBy: (state, action) => {
2868
+ state.searchBy = action.payload;
2869
+ },
2870
+ setSearchString: (state, action) => {
2871
+ state.searchString = action.payload;
2872
+ },
2873
+ setHoveredIndexSearchList: (state, action) => {
2874
+ state.hoveredIndexSearchList = action.payload;
2875
+ },
2876
+ setSelectedTags: (state, action) => {
2877
+ state.selectedTags = action.payload;
2878
+ },
2879
+ setFirstDomain: (state, action) => {
2880
+ state.firstDomain = action.payload;
2881
+ },
2882
+ setFilterBy: (state, action) => {
2883
+ state.filterBy = action.payload;
2884
+ },
2885
+ setGroupBy: (state, action) => {
2886
+ state.groupBy = action.payload;
2887
+ },
2888
+ setSearchMap: (state, action) => {
2889
+ state.searchMap = action.payload;
2890
+ },
2891
+ updateSearchMap: (state, action) => {
2892
+ if (!state.searchMap[action.payload.key]) {
2893
+ state.searchMap[action.payload.key] = [];
2894
+ }
2895
+ state.searchMap[action.payload.key].push(action.payload.value);
2896
+ },
2897
+ removeKeyFromSearchMap: (state, action) => {
2898
+ const { key, item } = action.payload;
2899
+ const values = state.searchMap[key];
2900
+ if (!values) return;
2901
+ if (item) {
2902
+ const filtered = values.filter((value) => value.name !== item.name);
2903
+ if (filtered.length > 0) {
2904
+ state.searchMap[key] = filtered;
2905
+ } else {
2906
+ delete state.searchMap[key];
2907
+ }
2908
+ } else {
2909
+ delete state.searchMap[key];
2910
+ }
2911
+ },
2912
+ clearSearchMap: (state) => {
2913
+ state.searchMap = {};
2914
+ }
2915
+ }
2916
+ });
2917
+ var {
2918
+ setGroupByDomain,
2919
+ setSelectedTags,
2920
+ setSearchString,
2921
+ setHoveredIndexSearchList,
2922
+ setFirstDomain,
2923
+ setSearchBy,
2924
+ setFilterBy,
2925
+ setSearchMap,
2926
+ updateSearchMap,
2927
+ removeKeyFromSearchMap,
2928
+ setGroupBy,
2929
+ clearSearchMap
2930
+ } = searchSlice.actions;
2931
+ var search_slice_default = searchSlice.reducer;
2932
+
2933
+ // src/store/store.ts
2934
+ var import_toolkit11 = require("@reduxjs/toolkit");
2935
+
2936
+ // node_modules/redux/dist/redux.mjs
2937
+ function formatProdErrorMessage(code) {
2938
+ return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
2939
+ }
2940
+ var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
2941
+ var ActionTypes = {
2942
+ INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
2943
+ REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
2944
+ PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
2945
+ };
2946
+ var actionTypes_default = ActionTypes;
2947
+ function isPlainObject(obj) {
2948
+ if (typeof obj !== "object" || obj === null)
2949
+ return false;
2950
+ let proto = obj;
2951
+ while (Object.getPrototypeOf(proto) !== null) {
2952
+ proto = Object.getPrototypeOf(proto);
2953
+ }
2954
+ return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
2955
+ }
2956
+ function miniKindOf(val) {
2957
+ if (val === void 0)
2958
+ return "undefined";
2959
+ if (val === null)
2960
+ return "null";
2961
+ const type = typeof val;
2962
+ switch (type) {
2963
+ case "boolean":
2964
+ case "string":
2965
+ case "number":
2966
+ case "symbol":
2967
+ case "function": {
2968
+ return type;
2969
+ }
2970
+ }
2971
+ if (Array.isArray(val))
2972
+ return "array";
2973
+ if (isDate(val))
2974
+ return "date";
2975
+ if (isError(val))
2976
+ return "error";
2977
+ const constructorName = ctorName(val);
2978
+ switch (constructorName) {
2979
+ case "Symbol":
2980
+ case "Promise":
2981
+ case "WeakMap":
2982
+ case "WeakSet":
2983
+ case "Map":
2984
+ case "Set":
2985
+ return constructorName;
2986
+ }
2987
+ return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
2988
+ }
2989
+ function ctorName(val) {
2990
+ return typeof val.constructor === "function" ? val.constructor.name : null;
2991
+ }
2992
+ function isError(val) {
2993
+ return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
2994
+ }
2995
+ function isDate(val) {
2996
+ if (val instanceof Date)
2997
+ return true;
2998
+ return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
2999
+ }
3000
+ function kindOf(val) {
3001
+ let typeOfVal = typeof val;
3002
+ if (process.env.NODE_ENV !== "production") {
3003
+ typeOfVal = miniKindOf(val);
3004
+ }
3005
+ return typeOfVal;
3006
+ }
3007
+ function warning(message) {
3008
+ if (typeof console !== "undefined" && typeof console.error === "function") {
3009
+ console.error(message);
3010
+ }
3011
+ try {
3012
+ throw new Error(message);
3013
+ } catch (e) {
3014
+ }
3015
+ }
3016
+ function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
3017
+ const reducerKeys = Object.keys(reducers);
3018
+ const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
3019
+ if (reducerKeys.length === 0) {
3020
+ return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
3021
+ }
3022
+ if (!isPlainObject(inputState)) {
3023
+ return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
3024
+ }
3025
+ const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
3026
+ unexpectedKeys.forEach((key) => {
3027
+ unexpectedKeyCache[key] = true;
3028
+ });
3029
+ if (action && action.type === actionTypes_default.REPLACE)
3030
+ return;
3031
+ if (unexpectedKeys.length > 0) {
3032
+ return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
3033
+ }
3034
+ }
3035
+ function assertReducerShape(reducers) {
3036
+ Object.keys(reducers).forEach((key) => {
3037
+ const reducer = reducers[key];
3038
+ const initialState10 = reducer(void 0, {
3039
+ type: actionTypes_default.INIT
3040
+ });
3041
+ if (typeof initialState10 === "undefined") {
3042
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
3043
+ }
3044
+ if (typeof reducer(void 0, {
3045
+ type: actionTypes_default.PROBE_UNKNOWN_ACTION()
3046
+ }) === "undefined") {
3047
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
3048
+ }
3049
+ });
3050
+ }
3051
+ function combineReducers(reducers) {
3052
+ const reducerKeys = Object.keys(reducers);
3053
+ const finalReducers = {};
3054
+ for (let i = 0; i < reducerKeys.length; i++) {
3055
+ const key = reducerKeys[i];
3056
+ if (process.env.NODE_ENV !== "production") {
3057
+ if (typeof reducers[key] === "undefined") {
3058
+ warning(`No reducer provided for key "${key}"`);
3059
+ }
3060
+ }
3061
+ if (typeof reducers[key] === "function") {
3062
+ finalReducers[key] = reducers[key];
3063
+ }
3064
+ }
3065
+ const finalReducerKeys = Object.keys(finalReducers);
3066
+ let unexpectedKeyCache;
3067
+ if (process.env.NODE_ENV !== "production") {
3068
+ unexpectedKeyCache = {};
3069
+ }
3070
+ let shapeAssertionError;
3071
+ try {
3072
+ assertReducerShape(finalReducers);
3073
+ } catch (e) {
3074
+ shapeAssertionError = e;
3075
+ }
3076
+ return function combination(state = {}, action) {
3077
+ if (shapeAssertionError) {
3078
+ throw shapeAssertionError;
3079
+ }
3080
+ if (process.env.NODE_ENV !== "production") {
3081
+ const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
3082
+ if (warningMessage) {
3083
+ warning(warningMessage);
3084
+ }
3085
+ }
3086
+ let hasChanged = false;
3087
+ const nextState = {};
3088
+ for (let i = 0; i < finalReducerKeys.length; i++) {
3089
+ const key = finalReducerKeys[i];
3090
+ const reducer = finalReducers[key];
3091
+ const previousStateForKey = state[key];
3092
+ const nextStateForKey = reducer(previousStateForKey, action);
3093
+ if (typeof nextStateForKey === "undefined") {
3094
+ const actionType = action && action.type;
3095
+ throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
3096
+ }
3097
+ nextState[key] = nextStateForKey;
3098
+ hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
3099
+ }
3100
+ hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
3101
+ return hasChanged ? nextState : state;
3102
+ };
3103
+ }
3104
+
3105
+ // src/store/store.ts
3106
+ var rootReducer = combineReducers({
3107
+ env: env_slice_default,
3108
+ header: header_slice_default,
3109
+ navbar: navbar_slice_default,
3110
+ list: list_slice_default,
3111
+ search: search_slice_default,
3112
+ form: form_slice_default,
3113
+ breadcrumbs: breadcrums_slice_default,
3114
+ login: login_slice_default,
3115
+ excel: excel_slice_default,
3116
+ profile: profile_slice_default
3117
+ });
3118
+ var envStore = (0, import_toolkit11.configureStore)({
3119
+ reducer: rootReducer,
3120
+ middleware: (getDefaultMiddleware) => getDefaultMiddleware({
3121
+ serializableCheck: false
3122
+ })
3123
+ });
3124
+
2511
3125
  // src/environment/EnvStore.ts
2512
3126
  var EnvStore = class _EnvStore {
2513
3127
  static instance = null;
2514
- state = {};
3128
+ envStore;
3129
+ baseUrl;
3130
+ requests;
3131
+ context;
3132
+ defaultCompany;
3133
+ config;
3134
+ companies;
3135
+ user;
3136
+ db;
2515
3137
  localStorageUtils;
2516
3138
  sessionStorageUtils;
2517
- constructor(localStorageUtils2, sessionStorageUtils2) {
3139
+ refreshTokenEndpoint;
3140
+ constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3141
+ this.envStore = envStore2;
2518
3142
  this.localStorageUtils = localStorageUtils2;
2519
3143
  this.sessionStorageUtils = sessionStorageUtils2;
3144
+ this.setup();
2520
3145
  }
2521
- static getInstance(localStorageUtils2, sessionStorageUtils2) {
3146
+ static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
2522
3147
  if (!_EnvStore.instance) {
2523
3148
  console.log("Creating new EnvStore instance");
2524
- _EnvStore.instance = new _EnvStore(localStorageUtils2, sessionStorageUtils2);
3149
+ _EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
2525
3150
  } else {
2526
3151
  console.log("Returning existing EnvStore instance");
2527
3152
  }
2528
3153
  return _EnvStore.instance;
2529
3154
  }
3155
+ setup() {
3156
+ const env = this.envStore.getState().env;
3157
+ console.log("Redux env state in A1:", env);
3158
+ this.baseUrl = env?.baseUrl;
3159
+ this.requests = env?.requests;
3160
+ this.context = env?.context;
3161
+ this.defaultCompany = env?.defaultCompany;
3162
+ this.config = env?.config;
3163
+ this.companies = env?.companies || [];
3164
+ this.user = env?.user;
3165
+ this.db = env?.db;
3166
+ this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
3167
+ console.log("Env setup in A1:", this);
3168
+ }
2530
3169
  setupEnv(envConfig) {
2531
- this.state = {
2532
- ...this.state,
3170
+ const dispatch = this.envStore.dispatch;
3171
+ const env = {
2533
3172
  ...envConfig,
2534
3173
  localStorageUtils: this.localStorageUtils,
2535
3174
  sessionStorageUtils: this.sessionStorageUtils
2536
3175
  };
2537
3176
  console.log("Setting up env with config:", envConfig);
2538
- this.state.requests = axiosClient.init(this.state);
2539
- console.log("axiosClient.init result:", this.state.requests);
3177
+ const requests = axiosClient.init(env);
3178
+ console.log("axiosClient.init result:", requests);
3179
+ dispatch(setEnv({ ...env, requests }));
3180
+ this.setup();
2540
3181
  }
2541
3182
  setUid(uid) {
2542
- this.state.uid = uid;
3183
+ const dispatch = this.envStore.dispatch;
3184
+ dispatch(setUid(uid));
3185
+ this.setup();
2543
3186
  }
2544
3187
  setLang(lang) {
2545
- this.state.lang = lang;
3188
+ const dispatch = this.envStore.dispatch;
3189
+ dispatch(setLang(lang));
3190
+ this.setup();
2546
3191
  }
2547
3192
  setAllowCompanies(allowCompanies) {
2548
- this.state.allowCompanies = allowCompanies;
3193
+ const dispatch = this.envStore.dispatch;
3194
+ dispatch(setAllowCompanies(allowCompanies));
3195
+ this.setup();
2549
3196
  }
2550
3197
  setCompanies(companies) {
2551
- this.state.companies = companies;
3198
+ const dispatch = this.envStore.dispatch;
3199
+ dispatch(setCompanies(companies));
3200
+ this.setup();
2552
3201
  }
2553
3202
  setDefaultCompany(company) {
2554
- this.state.defaultCompany = company;
3203
+ const dispatch = this.envStore.dispatch;
3204
+ dispatch(setDefaultCompany(company));
3205
+ this.setup();
2555
3206
  }
2556
3207
  setUserInfo(userInfo) {
2557
- this.state.user = userInfo;
2558
- }
2559
- // Getters để truy cập trạng thái
2560
- get baseUrl() {
2561
- return this.state.baseUrl;
2562
- }
2563
- get requests() {
2564
- return this.state.requests;
2565
- }
2566
- get context() {
2567
- return this.state.context;
2568
- }
2569
- get defaultCompany() {
2570
- return this.state.defaultCompany;
2571
- }
2572
- get config() {
2573
- return this.state.config;
2574
- }
2575
- get companies() {
2576
- return this.state.companies;
2577
- }
2578
- get user() {
2579
- return this.state.user;
2580
- }
2581
- get db() {
2582
- return this.state.db;
2583
- }
2584
- get refreshTokenEndpoint() {
2585
- return this.state.refreshTokenEndpoint;
2586
- }
2587
- get uid() {
2588
- return this.state.uid;
2589
- }
2590
- get lang() {
2591
- return this.state.lang;
2592
- }
2593
- get allowCompanies() {
2594
- return this.state.allowCompanies;
3208
+ const dispatch = this.envStore.dispatch;
3209
+ dispatch(setUser(userInfo));
3210
+ this.setup();
2595
3211
  }
2596
3212
  };
2597
3213
  function getEnv() {
2598
- const instance = EnvStore.getInstance();
3214
+ const instance = EnvStore.getInstance(envStore);
2599
3215
  if (!instance) {
2600
3216
  throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
2601
3217
  }