@fctc/interface-logic 1.7.8 → 1.7.9
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 +20 -40
- package/dist/environment.d.ts +20 -40
- package/dist/environment.js +63 -76
- package/dist/environment.mjs +63 -75
- package/dist/hooks.js +200 -212
- package/dist/hooks.mjs +200 -212
- package/dist/provider.js +94 -106
- package/dist/provider.mjs +94 -106
- package/dist/services.js +200 -212
- package/dist/services.mjs +200 -212
- package/dist/store-DvWeB4jm.d.mts +294 -0
- package/dist/store-DvWeB4jm.d.ts +294 -0
- package/dist/store.d.mts +18 -569
- package/dist/store.d.ts +18 -569
- package/package.json +1 -1
package/dist/environment.d.mts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { e as envStore } from './store-DvWeB4jm.mjs';
|
|
2
|
+
import '@reduxjs/toolkit';
|
|
3
|
+
import 'redux-thunk';
|
|
4
|
+
import 'redux';
|
|
5
|
+
import 'immer';
|
|
6
|
+
import 'react-redux';
|
|
7
|
+
|
|
1
8
|
declare const localStorageUtils: () => {
|
|
2
9
|
setToken: (access_token: string) => Promise<void>;
|
|
3
10
|
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
@@ -12,47 +19,20 @@ declare const sessionStorageUtils: () => {
|
|
|
12
19
|
};
|
|
13
20
|
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
interface Global {
|
|
17
|
-
envStore?: EnvStore;
|
|
18
|
-
}
|
|
19
|
-
interface Window {
|
|
20
|
-
envStore?: EnvStore;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
interface EnvState {
|
|
24
|
-
baseUrl?: string;
|
|
25
|
-
requests?: any;
|
|
26
|
-
context?: any;
|
|
27
|
-
defaultCompany?: any;
|
|
28
|
-
config?: any;
|
|
29
|
-
companies?: any[];
|
|
30
|
-
user?: any;
|
|
31
|
-
db?: string;
|
|
32
|
-
refreshTokenEndpoint?: string;
|
|
33
|
-
uid?: number;
|
|
34
|
-
lang?: string;
|
|
35
|
-
allowCompanies?: number[];
|
|
36
|
-
}
|
|
37
|
-
declare class EnvStore {
|
|
38
|
-
private static instance;
|
|
39
|
-
private static localStorageUtils?;
|
|
40
|
-
private static sessionStorageUtils?;
|
|
41
|
-
private constructor();
|
|
42
|
-
static getInstance(localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
|
|
43
|
-
static getState(): EnvState;
|
|
44
|
-
static setupEnv(envConfig: Partial<EnvState>): void;
|
|
45
|
-
static setUid(uid: number): void;
|
|
46
|
-
static setLang(lang: string): void;
|
|
47
|
-
static setAllowCompanies(allowCompanies: number[]): void;
|
|
48
|
-
static setCompanies(companies: any[]): void;
|
|
49
|
-
static setDefaultCompany(company: any): void;
|
|
50
|
-
static setUserInfo(userInfo: any): void;
|
|
51
|
-
}
|
|
22
|
+
type EnvStore = ReturnType<typeof envStore.getState>['env'];
|
|
52
23
|
declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
|
|
53
24
|
localStorageUtils?: LocalStorageUtilsType;
|
|
54
25
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
55
|
-
}):
|
|
56
|
-
|
|
26
|
+
}): {
|
|
27
|
+
getEnvData: () => any;
|
|
28
|
+
setupEnv: (envConfig: EnvStore) => void;
|
|
29
|
+
setLangValue: (lang: string) => void;
|
|
30
|
+
setUidValue: (uid: number) => void;
|
|
31
|
+
setAllowCompaniesValue: (allowCompanies: number[]) => void;
|
|
32
|
+
setCompaniesValue: (companies: any[]) => void;
|
|
33
|
+
setDefaultCompanyValue: (company: any) => void;
|
|
34
|
+
setUserInfoValue: (user: any) => void;
|
|
35
|
+
};
|
|
36
|
+
declare function getEnv(): any;
|
|
57
37
|
|
|
58
|
-
export { EnvStore, getEnv, initEnv };
|
|
38
|
+
export { type EnvStore, getEnv, initEnv };
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { e as envStore } from './store-DvWeB4jm.js';
|
|
2
|
+
import '@reduxjs/toolkit';
|
|
3
|
+
import 'redux-thunk';
|
|
4
|
+
import 'redux';
|
|
5
|
+
import 'immer';
|
|
6
|
+
import 'react-redux';
|
|
7
|
+
|
|
1
8
|
declare const localStorageUtils: () => {
|
|
2
9
|
setToken: (access_token: string) => Promise<void>;
|
|
3
10
|
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
@@ -12,47 +19,20 @@ declare const sessionStorageUtils: () => {
|
|
|
12
19
|
};
|
|
13
20
|
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
interface Global {
|
|
17
|
-
envStore?: EnvStore;
|
|
18
|
-
}
|
|
19
|
-
interface Window {
|
|
20
|
-
envStore?: EnvStore;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
interface EnvState {
|
|
24
|
-
baseUrl?: string;
|
|
25
|
-
requests?: any;
|
|
26
|
-
context?: any;
|
|
27
|
-
defaultCompany?: any;
|
|
28
|
-
config?: any;
|
|
29
|
-
companies?: any[];
|
|
30
|
-
user?: any;
|
|
31
|
-
db?: string;
|
|
32
|
-
refreshTokenEndpoint?: string;
|
|
33
|
-
uid?: number;
|
|
34
|
-
lang?: string;
|
|
35
|
-
allowCompanies?: number[];
|
|
36
|
-
}
|
|
37
|
-
declare class EnvStore {
|
|
38
|
-
private static instance;
|
|
39
|
-
private static localStorageUtils?;
|
|
40
|
-
private static sessionStorageUtils?;
|
|
41
|
-
private constructor();
|
|
42
|
-
static getInstance(localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
|
|
43
|
-
static getState(): EnvState;
|
|
44
|
-
static setupEnv(envConfig: Partial<EnvState>): void;
|
|
45
|
-
static setUid(uid: number): void;
|
|
46
|
-
static setLang(lang: string): void;
|
|
47
|
-
static setAllowCompanies(allowCompanies: number[]): void;
|
|
48
|
-
static setCompanies(companies: any[]): void;
|
|
49
|
-
static setDefaultCompany(company: any): void;
|
|
50
|
-
static setUserInfo(userInfo: any): void;
|
|
51
|
-
}
|
|
22
|
+
type EnvStore = ReturnType<typeof envStore.getState>['env'];
|
|
52
23
|
declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
|
|
53
24
|
localStorageUtils?: LocalStorageUtilsType;
|
|
54
25
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
55
|
-
}):
|
|
56
|
-
|
|
26
|
+
}): {
|
|
27
|
+
getEnvData: () => any;
|
|
28
|
+
setupEnv: (envConfig: EnvStore) => void;
|
|
29
|
+
setLangValue: (lang: string) => void;
|
|
30
|
+
setUidValue: (uid: number) => void;
|
|
31
|
+
setAllowCompaniesValue: (allowCompanies: number[]) => void;
|
|
32
|
+
setCompaniesValue: (companies: any[]) => void;
|
|
33
|
+
setDefaultCompanyValue: (company: any) => void;
|
|
34
|
+
setUserInfoValue: (user: any) => void;
|
|
35
|
+
};
|
|
36
|
+
declare function getEnv(): any;
|
|
57
37
|
|
|
58
|
-
export { EnvStore, getEnv, initEnv };
|
|
38
|
+
export { type EnvStore, getEnv, initEnv };
|
package/dist/environment.js
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/environment.ts
|
|
31
31
|
var environment_exports = {};
|
|
32
32
|
__export(environment_exports, {
|
|
33
|
-
EnvStore: () => EnvStore,
|
|
34
33
|
getEnv: () => getEnv,
|
|
35
34
|
initEnv: () => initEnv
|
|
36
35
|
});
|
|
@@ -2998,91 +2997,79 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
2998
2997
|
});
|
|
2999
2998
|
|
|
3000
2999
|
// src/environment/EnvStore.ts
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
}
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
console.log("Creating new EnvStore instance");
|
|
3010
|
-
_EnvStore.instance = new _EnvStore();
|
|
3011
|
-
_EnvStore.localStorageUtils = localStorageUtils2;
|
|
3012
|
-
_EnvStore.sessionStorageUtils = sessionStorageUtils2;
|
|
3013
|
-
} else {
|
|
3014
|
-
console.log("Returning existing EnvStore instance");
|
|
3015
|
-
}
|
|
3016
|
-
return _EnvStore.instance;
|
|
3017
|
-
}
|
|
3018
|
-
static getState() {
|
|
3019
|
-
const state = envStore.getState().env;
|
|
3020
|
-
console.log("Redux env state:", state);
|
|
3021
|
-
return {
|
|
3022
|
-
baseUrl: state?.baseUrl,
|
|
3023
|
-
requests: state?.requests,
|
|
3024
|
-
context: state?.context,
|
|
3025
|
-
defaultCompany: state?.defaultCompany,
|
|
3026
|
-
config: state?.config,
|
|
3027
|
-
companies: state?.companies || [],
|
|
3028
|
-
user: state?.user,
|
|
3029
|
-
db: state?.db,
|
|
3030
|
-
refreshTokenEndpoint: state?.refreshTokenEndpoint,
|
|
3031
|
-
uid: state?.uid,
|
|
3032
|
-
lang: state?.lang,
|
|
3033
|
-
allowCompanies: state?.allowCompanies
|
|
3034
|
-
};
|
|
3035
|
-
}
|
|
3036
|
-
static setupEnv(envConfig) {
|
|
3037
|
-
const dispatch = envStore.dispatch;
|
|
3038
|
-
const env = {
|
|
3039
|
-
..._EnvStore.getState(),
|
|
3000
|
+
function createEnvStore(store, localUtils, sessionUtils) {
|
|
3001
|
+
let envData = store.getState().env;
|
|
3002
|
+
const getEnvData = () => {
|
|
3003
|
+
envData = store.getState().env;
|
|
3004
|
+
return envData;
|
|
3005
|
+
};
|
|
3006
|
+
const setupEnv = (envConfig) => {
|
|
3007
|
+
const requests = axiosClient.init({
|
|
3040
3008
|
...envConfig,
|
|
3041
|
-
localStorageUtils:
|
|
3042
|
-
sessionStorageUtils:
|
|
3043
|
-
};
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
dispatch(setLang(lang));
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
dispatch(
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
dispatch(
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
dispatch(
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
dispatch(
|
|
3072
|
-
|
|
3073
|
-
};
|
|
3009
|
+
localStorageUtils: localUtils,
|
|
3010
|
+
sessionStorageUtils: sessionUtils
|
|
3011
|
+
});
|
|
3012
|
+
store.dispatch(
|
|
3013
|
+
setEnv({
|
|
3014
|
+
...envConfig,
|
|
3015
|
+
requests,
|
|
3016
|
+
localStorageUtils: localUtils,
|
|
3017
|
+
sessionStorageUtils: sessionUtils
|
|
3018
|
+
})
|
|
3019
|
+
);
|
|
3020
|
+
getEnvData();
|
|
3021
|
+
};
|
|
3022
|
+
const setLangValue = (lang) => {
|
|
3023
|
+
store.dispatch(setLang(lang));
|
|
3024
|
+
getEnvData();
|
|
3025
|
+
};
|
|
3026
|
+
const setUidValue = (uid) => {
|
|
3027
|
+
store.dispatch(setUid(uid));
|
|
3028
|
+
getEnvData();
|
|
3029
|
+
};
|
|
3030
|
+
const setAllowCompaniesValue = (allowCompanies) => {
|
|
3031
|
+
store.dispatch(setAllowCompanies(allowCompanies));
|
|
3032
|
+
getEnvData();
|
|
3033
|
+
};
|
|
3034
|
+
const setCompaniesValue = (companies) => {
|
|
3035
|
+
store.dispatch(setCompanies(companies));
|
|
3036
|
+
getEnvData();
|
|
3037
|
+
};
|
|
3038
|
+
const setDefaultCompanyValue = (company) => {
|
|
3039
|
+
store.dispatch(setDefaultCompany(company));
|
|
3040
|
+
getEnvData();
|
|
3041
|
+
};
|
|
3042
|
+
const setUserInfoValue = (user) => {
|
|
3043
|
+
store.dispatch(setUser(user));
|
|
3044
|
+
getEnvData();
|
|
3045
|
+
};
|
|
3046
|
+
return {
|
|
3047
|
+
getEnvData,
|
|
3048
|
+
setupEnv,
|
|
3049
|
+
setLangValue,
|
|
3050
|
+
setUidValue,
|
|
3051
|
+
setAllowCompaniesValue,
|
|
3052
|
+
setCompaniesValue,
|
|
3053
|
+
setDefaultCompanyValue,
|
|
3054
|
+
setUserInfoValue
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
var env = null;
|
|
3074
3058
|
function initEnv({
|
|
3075
3059
|
localStorageUtils: localStorageUtils2,
|
|
3076
3060
|
sessionStorageUtils: sessionStorageUtils2
|
|
3077
3061
|
}) {
|
|
3078
|
-
|
|
3062
|
+
env = createEnvStore(envStore, localStorageUtils2, sessionStorageUtils2);
|
|
3063
|
+
return env;
|
|
3079
3064
|
}
|
|
3080
3065
|
function getEnv() {
|
|
3081
|
-
|
|
3066
|
+
if (!env) {
|
|
3067
|
+
env = createEnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3068
|
+
}
|
|
3069
|
+
return env?.getEnvData();
|
|
3082
3070
|
}
|
|
3083
3071
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3084
3072
|
0 && (module.exports = {
|
|
3085
|
-
EnvStore,
|
|
3086
3073
|
getEnv,
|
|
3087
3074
|
initEnv
|
|
3088
3075
|
});
|
package/dist/environment.mjs
CHANGED
|
@@ -2960,90 +2960,78 @@ var envStore = configureStore({
|
|
|
2960
2960
|
});
|
|
2961
2961
|
|
|
2962
2962
|
// src/environment/EnvStore.ts
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
console.log("Creating new EnvStore instance");
|
|
2972
|
-
_EnvStore.instance = new _EnvStore();
|
|
2973
|
-
_EnvStore.localStorageUtils = localStorageUtils2;
|
|
2974
|
-
_EnvStore.sessionStorageUtils = sessionStorageUtils2;
|
|
2975
|
-
} else {
|
|
2976
|
-
console.log("Returning existing EnvStore instance");
|
|
2977
|
-
}
|
|
2978
|
-
return _EnvStore.instance;
|
|
2979
|
-
}
|
|
2980
|
-
static getState() {
|
|
2981
|
-
const state = envStore.getState().env;
|
|
2982
|
-
console.log("Redux env state:", state);
|
|
2983
|
-
return {
|
|
2984
|
-
baseUrl: state?.baseUrl,
|
|
2985
|
-
requests: state?.requests,
|
|
2986
|
-
context: state?.context,
|
|
2987
|
-
defaultCompany: state?.defaultCompany,
|
|
2988
|
-
config: state?.config,
|
|
2989
|
-
companies: state?.companies || [],
|
|
2990
|
-
user: state?.user,
|
|
2991
|
-
db: state?.db,
|
|
2992
|
-
refreshTokenEndpoint: state?.refreshTokenEndpoint,
|
|
2993
|
-
uid: state?.uid,
|
|
2994
|
-
lang: state?.lang,
|
|
2995
|
-
allowCompanies: state?.allowCompanies
|
|
2996
|
-
};
|
|
2997
|
-
}
|
|
2998
|
-
static setupEnv(envConfig) {
|
|
2999
|
-
const dispatch = envStore.dispatch;
|
|
3000
|
-
const env = {
|
|
3001
|
-
..._EnvStore.getState(),
|
|
2963
|
+
function createEnvStore(store, localUtils, sessionUtils) {
|
|
2964
|
+
let envData = store.getState().env;
|
|
2965
|
+
const getEnvData = () => {
|
|
2966
|
+
envData = store.getState().env;
|
|
2967
|
+
return envData;
|
|
2968
|
+
};
|
|
2969
|
+
const setupEnv = (envConfig) => {
|
|
2970
|
+
const requests = axiosClient.init({
|
|
3002
2971
|
...envConfig,
|
|
3003
|
-
localStorageUtils:
|
|
3004
|
-
sessionStorageUtils:
|
|
3005
|
-
};
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
dispatch(setLang(lang));
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
dispatch(
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
dispatch(
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
dispatch(
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
dispatch(
|
|
3034
|
-
|
|
3035
|
-
};
|
|
2972
|
+
localStorageUtils: localUtils,
|
|
2973
|
+
sessionStorageUtils: sessionUtils
|
|
2974
|
+
});
|
|
2975
|
+
store.dispatch(
|
|
2976
|
+
setEnv({
|
|
2977
|
+
...envConfig,
|
|
2978
|
+
requests,
|
|
2979
|
+
localStorageUtils: localUtils,
|
|
2980
|
+
sessionStorageUtils: sessionUtils
|
|
2981
|
+
})
|
|
2982
|
+
);
|
|
2983
|
+
getEnvData();
|
|
2984
|
+
};
|
|
2985
|
+
const setLangValue = (lang) => {
|
|
2986
|
+
store.dispatch(setLang(lang));
|
|
2987
|
+
getEnvData();
|
|
2988
|
+
};
|
|
2989
|
+
const setUidValue = (uid) => {
|
|
2990
|
+
store.dispatch(setUid(uid));
|
|
2991
|
+
getEnvData();
|
|
2992
|
+
};
|
|
2993
|
+
const setAllowCompaniesValue = (allowCompanies) => {
|
|
2994
|
+
store.dispatch(setAllowCompanies(allowCompanies));
|
|
2995
|
+
getEnvData();
|
|
2996
|
+
};
|
|
2997
|
+
const setCompaniesValue = (companies) => {
|
|
2998
|
+
store.dispatch(setCompanies(companies));
|
|
2999
|
+
getEnvData();
|
|
3000
|
+
};
|
|
3001
|
+
const setDefaultCompanyValue = (company) => {
|
|
3002
|
+
store.dispatch(setDefaultCompany(company));
|
|
3003
|
+
getEnvData();
|
|
3004
|
+
};
|
|
3005
|
+
const setUserInfoValue = (user) => {
|
|
3006
|
+
store.dispatch(setUser(user));
|
|
3007
|
+
getEnvData();
|
|
3008
|
+
};
|
|
3009
|
+
return {
|
|
3010
|
+
getEnvData,
|
|
3011
|
+
setupEnv,
|
|
3012
|
+
setLangValue,
|
|
3013
|
+
setUidValue,
|
|
3014
|
+
setAllowCompaniesValue,
|
|
3015
|
+
setCompaniesValue,
|
|
3016
|
+
setDefaultCompanyValue,
|
|
3017
|
+
setUserInfoValue
|
|
3018
|
+
};
|
|
3019
|
+
}
|
|
3020
|
+
var env = null;
|
|
3036
3021
|
function initEnv({
|
|
3037
3022
|
localStorageUtils: localStorageUtils2,
|
|
3038
3023
|
sessionStorageUtils: sessionStorageUtils2
|
|
3039
3024
|
}) {
|
|
3040
|
-
|
|
3025
|
+
env = createEnvStore(envStore, localStorageUtils2, sessionStorageUtils2);
|
|
3026
|
+
return env;
|
|
3041
3027
|
}
|
|
3042
3028
|
function getEnv() {
|
|
3043
|
-
|
|
3029
|
+
if (!env) {
|
|
3030
|
+
env = createEnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3031
|
+
}
|
|
3032
|
+
return env?.getEnvData();
|
|
3044
3033
|
}
|
|
3045
3034
|
export {
|
|
3046
|
-
EnvStore,
|
|
3047
3035
|
getEnv,
|
|
3048
3036
|
initEnv
|
|
3049
3037
|
};
|