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