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