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