@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/configs.d.mts +3 -2
- package/dist/configs.d.ts +3 -2
- package/dist/environment.d.mts +57 -1
- package/dist/environment.d.ts +57 -1
- package/dist/environment.js +670 -53
- package/dist/environment.mjs +670 -53
- package/dist/hooks.js +668 -52
- package/dist/hooks.mjs +668 -52
- package/dist/provider.js +54 -52
- package/dist/provider.mjs +54 -52
- package/dist/services.js +668 -52
- package/dist/services.mjs +668 -52
- package/package.json +1 -1
- package/dist/environment-BtoPepkC.d.mts +0 -72
- package/dist/environment-BtoPepkC.d.ts +0 -72
package/dist/environment.mjs
CHANGED
|
@@ -2345,100 +2345,717 @@ 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
|
+
|
|
2348
2962
|
// src/environment/EnvStore.ts
|
|
2349
2963
|
var EnvStore = class _EnvStore {
|
|
2350
2964
|
static instance = null;
|
|
2351
|
-
|
|
2965
|
+
envStore;
|
|
2966
|
+
baseUrl;
|
|
2967
|
+
requests;
|
|
2968
|
+
context;
|
|
2969
|
+
defaultCompany;
|
|
2970
|
+
config;
|
|
2971
|
+
companies;
|
|
2972
|
+
user;
|
|
2973
|
+
db;
|
|
2352
2974
|
localStorageUtils;
|
|
2353
2975
|
sessionStorageUtils;
|
|
2354
|
-
|
|
2976
|
+
refreshTokenEndpoint;
|
|
2977
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2978
|
+
this.envStore = envStore2;
|
|
2355
2979
|
this.localStorageUtils = localStorageUtils2;
|
|
2356
2980
|
this.sessionStorageUtils = sessionStorageUtils2;
|
|
2981
|
+
this.setup();
|
|
2357
2982
|
}
|
|
2358
|
-
static getInstance(localStorageUtils2, sessionStorageUtils2) {
|
|
2983
|
+
static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2359
2984
|
if (!_EnvStore.instance) {
|
|
2360
2985
|
console.log("Creating new EnvStore instance");
|
|
2361
|
-
_EnvStore.instance = new _EnvStore(localStorageUtils2, sessionStorageUtils2);
|
|
2986
|
+
_EnvStore.instance = new _EnvStore(envStore2, localStorageUtils2, sessionStorageUtils2);
|
|
2362
2987
|
} else {
|
|
2363
2988
|
console.log("Returning existing EnvStore instance");
|
|
2364
2989
|
}
|
|
2365
2990
|
return _EnvStore.instance;
|
|
2366
2991
|
}
|
|
2992
|
+
setup() {
|
|
2993
|
+
const env = this.envStore.getState().env;
|
|
2994
|
+
console.log("Redux env state in A1:", 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 in A1:", this);
|
|
3005
|
+
}
|
|
2367
3006
|
setupEnv(envConfig) {
|
|
2368
|
-
|
|
2369
|
-
|
|
3007
|
+
const dispatch = this.envStore.dispatch;
|
|
3008
|
+
const env = {
|
|
2370
3009
|
...envConfig,
|
|
2371
3010
|
localStorageUtils: this.localStorageUtils,
|
|
2372
3011
|
sessionStorageUtils: this.sessionStorageUtils
|
|
2373
3012
|
};
|
|
2374
3013
|
console.log("Setting up env with config:", envConfig);
|
|
2375
|
-
|
|
2376
|
-
console.log("axiosClient.init result:",
|
|
3014
|
+
const requests = axiosClient.init(env);
|
|
3015
|
+
console.log("axiosClient.init result:", requests);
|
|
3016
|
+
dispatch(setEnv({ ...env, requests }));
|
|
3017
|
+
this.setup();
|
|
2377
3018
|
}
|
|
2378
3019
|
setUid(uid) {
|
|
2379
|
-
this.
|
|
3020
|
+
const dispatch = this.envStore.dispatch;
|
|
3021
|
+
dispatch(setUid(uid));
|
|
3022
|
+
this.setup();
|
|
2380
3023
|
}
|
|
2381
3024
|
setLang(lang) {
|
|
2382
|
-
this.
|
|
3025
|
+
const dispatch = this.envStore.dispatch;
|
|
3026
|
+
dispatch(setLang(lang));
|
|
3027
|
+
this.setup();
|
|
2383
3028
|
}
|
|
2384
3029
|
setAllowCompanies(allowCompanies) {
|
|
2385
|
-
this.
|
|
3030
|
+
const dispatch = this.envStore.dispatch;
|
|
3031
|
+
dispatch(setAllowCompanies(allowCompanies));
|
|
3032
|
+
this.setup();
|
|
2386
3033
|
}
|
|
2387
3034
|
setCompanies(companies) {
|
|
2388
|
-
this.
|
|
3035
|
+
const dispatch = this.envStore.dispatch;
|
|
3036
|
+
dispatch(setCompanies(companies));
|
|
3037
|
+
this.setup();
|
|
2389
3038
|
}
|
|
2390
3039
|
setDefaultCompany(company) {
|
|
2391
|
-
this.
|
|
3040
|
+
const dispatch = this.envStore.dispatch;
|
|
3041
|
+
dispatch(setDefaultCompany(company));
|
|
3042
|
+
this.setup();
|
|
2392
3043
|
}
|
|
2393
3044
|
setUserInfo(userInfo) {
|
|
2394
|
-
this.
|
|
2395
|
-
|
|
2396
|
-
|
|
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;
|
|
3045
|
+
const dispatch = this.envStore.dispatch;
|
|
3046
|
+
dispatch(setUser(userInfo));
|
|
3047
|
+
this.setup();
|
|
2432
3048
|
}
|
|
2433
3049
|
};
|
|
2434
3050
|
function initEnv({
|
|
3051
|
+
envStore: envStore2,
|
|
2435
3052
|
localStorageUtils: localStorageUtils2,
|
|
2436
3053
|
sessionStorageUtils: sessionStorageUtils2
|
|
2437
3054
|
}) {
|
|
2438
|
-
return EnvStore.getInstance(localStorageUtils2, sessionStorageUtils2);
|
|
3055
|
+
return EnvStore.getInstance(envStore2, localStorageUtils2, sessionStorageUtils2);
|
|
2439
3056
|
}
|
|
2440
3057
|
function getEnv() {
|
|
2441
|
-
const instance = EnvStore.getInstance();
|
|
3058
|
+
const instance = EnvStore.getInstance(envStore);
|
|
2442
3059
|
if (!instance) {
|
|
2443
3060
|
throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
|
|
2444
3061
|
}
|