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