@fctc/interface-logic 1.8.3 → 1.8.4
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 +1 -4
- package/dist/configs.d.ts +1 -4
- package/dist/configs.js +15 -12
- package/dist/configs.mjs +15 -12
- package/dist/environment.d.mts +15 -17
- package/dist/environment.d.ts +15 -17
- package/dist/environment.js +81 -92
- package/dist/environment.mjs +81 -90
- package/dist/hooks.d.mts +2 -7
- package/dist/hooks.d.ts +2 -7
- package/dist/hooks.js +195 -229
- package/dist/hooks.mjs +155 -188
- package/dist/provider.d.mts +4 -3
- package/dist/provider.d.ts +4 -3
- package/dist/provider.js +87 -88
- package/dist/provider.mjs +87 -88
- package/dist/services.d.mts +1 -2
- package/dist/services.d.ts +1 -2
- package/dist/services.js +82 -103
- package/dist/services.mjs +82 -103
- package/dist/store.d.mts +14 -280
- package/dist/store.d.ts +14 -280
- package/dist/store.js +4 -4
- package/dist/store.mjs +4 -4
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{view-type-BGJfDe73.d.mts → view-type-D8ukwj_2.d.mts} +1 -1
- package/dist/{view-type-BGJfDe73.d.ts → view-type-D8ukwj_2.d.ts} +1 -1
- package/package.json +1 -1
package/dist/configs.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { EnvStore } from './environment.mjs';
|
|
2
|
-
import '@reduxjs/toolkit';
|
|
3
|
-
|
|
4
1
|
declare const axiosClient: {
|
|
5
|
-
init(config:
|
|
2
|
+
init(config: any): {
|
|
6
3
|
get: (url: string, headers: any) => Promise<any>;
|
|
7
4
|
post: (url: string, body: any, headers: any) => Promise<any>;
|
|
8
5
|
post_excel: (url: string, body: any, headers: any) => Promise<any>;
|
package/dist/configs.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { EnvStore } from './environment.js';
|
|
2
|
-
import '@reduxjs/toolkit';
|
|
3
|
-
|
|
4
1
|
declare const axiosClient: {
|
|
5
|
-
init(config:
|
|
2
|
+
init(config: any): {
|
|
6
3
|
get: (url: string, headers: any) => Promise<any>;
|
|
7
4
|
post: (url: string, body: any, headers: any) => Promise<any>;
|
|
8
5
|
post_excel: (url: string, body: any, headers: any) => Promise<any>;
|
package/dist/configs.js
CHANGED
|
@@ -2208,9 +2208,9 @@ var sessionStorageUtils = () => {
|
|
|
2208
2208
|
// src/configs/axios-client.ts
|
|
2209
2209
|
var axiosClient = {
|
|
2210
2210
|
init(config) {
|
|
2211
|
-
const localStorage2 = config
|
|
2212
|
-
const sessionStorage2 = config
|
|
2213
|
-
const db = config
|
|
2211
|
+
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2212
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2213
|
+
const db = config?.db;
|
|
2214
2214
|
let isRefreshing = false;
|
|
2215
2215
|
let failedQueue = [];
|
|
2216
2216
|
const processQueue = (error, token = null) => {
|
|
@@ -2229,16 +2229,19 @@ var axiosClient = {
|
|
|
2229
2229
|
timeout: 5e4,
|
|
2230
2230
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2231
2231
|
});
|
|
2232
|
-
instance.interceptors.request.use(
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2232
|
+
instance.interceptors.request.use(
|
|
2233
|
+
async (config2) => {
|
|
2234
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2235
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2236
|
+
if (token) {
|
|
2237
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2238
|
+
}
|
|
2239
|
+
return config2;
|
|
2240
|
+
},
|
|
2241
|
+
(error) => {
|
|
2242
|
+
Promise.reject(error);
|
|
2236
2243
|
}
|
|
2237
|
-
|
|
2238
|
-
const token = await getToken?.();
|
|
2239
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2240
|
-
return config2;
|
|
2241
|
-
}, Promise.reject);
|
|
2244
|
+
);
|
|
2242
2245
|
instance.interceptors.response.use(
|
|
2243
2246
|
(response) => {
|
|
2244
2247
|
return handleResponse(response);
|
package/dist/configs.mjs
CHANGED
|
@@ -2172,9 +2172,9 @@ var sessionStorageUtils = () => {
|
|
|
2172
2172
|
// src/configs/axios-client.ts
|
|
2173
2173
|
var axiosClient = {
|
|
2174
2174
|
init(config) {
|
|
2175
|
-
const localStorage2 = config
|
|
2176
|
-
const sessionStorage2 = config
|
|
2177
|
-
const db = config
|
|
2175
|
+
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2176
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2177
|
+
const db = config?.db;
|
|
2178
2178
|
let isRefreshing = false;
|
|
2179
2179
|
let failedQueue = [];
|
|
2180
2180
|
const processQueue = (error, token = null) => {
|
|
@@ -2193,16 +2193,19 @@ var axiosClient = {
|
|
|
2193
2193
|
timeout: 5e4,
|
|
2194
2194
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
2195
|
});
|
|
2196
|
-
instance.interceptors.request.use(
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2196
|
+
instance.interceptors.request.use(
|
|
2197
|
+
async (config2) => {
|
|
2198
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2199
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2200
|
+
if (token) {
|
|
2201
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2202
|
+
}
|
|
2203
|
+
return config2;
|
|
2204
|
+
},
|
|
2205
|
+
(error) => {
|
|
2206
|
+
Promise.reject(error);
|
|
2200
2207
|
}
|
|
2201
|
-
|
|
2202
|
-
const token = await getToken?.();
|
|
2203
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2204
|
-
return config2;
|
|
2205
|
-
}, Promise.reject);
|
|
2208
|
+
);
|
|
2206
2209
|
instance.interceptors.response.use(
|
|
2207
2210
|
(response) => {
|
|
2208
2211
|
return handleResponse(response);
|
package/dist/environment.d.mts
CHANGED
|
@@ -22,8 +22,7 @@ declare global {
|
|
|
22
22
|
envStore?: EnvStore;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
envStore: EnhancedStore | any;
|
|
25
|
+
interface EnvConfig {
|
|
27
26
|
baseUrl?: string;
|
|
28
27
|
requests?: any;
|
|
29
28
|
context?: any;
|
|
@@ -32,24 +31,23 @@ declare class EnvStore {
|
|
|
32
31
|
companies?: any[];
|
|
33
32
|
user?: any;
|
|
34
33
|
db?: string;
|
|
35
|
-
localStorageUtils?: any;
|
|
36
|
-
sessionStorageUtils?: any;
|
|
37
34
|
refreshTokenEndpoint?: string;
|
|
38
|
-
constructor(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any);
|
|
39
|
-
setup(): void;
|
|
40
|
-
setupEnv(envConfig: EnvStore): void;
|
|
41
|
-
setUid(uid: number): void;
|
|
42
|
-
setLang(lang: string): void;
|
|
43
|
-
setAllowCompanies(allowCompanies: number[]): void;
|
|
44
|
-
setCompanies(companies: any[]): void;
|
|
45
|
-
setDefaultCompany(company: any): void;
|
|
46
|
-
setUserInfo(userInfo: any): void;
|
|
47
35
|
}
|
|
48
|
-
declare
|
|
49
|
-
|
|
36
|
+
declare function createEnvStore(store: EnhancedStore, localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: SessionStorageUtilsType): {
|
|
37
|
+
getEnvConfig: () => EnvConfig;
|
|
38
|
+
setupEnv: (envConfig: EnvConfig) => EnvConfig;
|
|
39
|
+
setUid: (uid: number) => EnvConfig;
|
|
40
|
+
setLang: (lang: string) => EnvConfig;
|
|
41
|
+
setAllowCompanies: (allowCompanies: number[]) => EnvConfig;
|
|
42
|
+
setCompanies: (companies: any[]) => EnvConfig;
|
|
43
|
+
setDefaultCompany: (company: any) => EnvConfig;
|
|
44
|
+
setUserInfo: (userInfo: any) => EnvConfig;
|
|
45
|
+
};
|
|
46
|
+
type EnvStore = ReturnType<typeof createEnvStore>;
|
|
47
|
+
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
50
48
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
49
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
52
50
|
}): EnvStore;
|
|
53
|
-
declare function getEnv():
|
|
51
|
+
declare function getEnv(): any;
|
|
54
52
|
|
|
55
|
-
export { EnvStore,
|
|
53
|
+
export { type EnvStore, getEnv, initEnv };
|
package/dist/environment.d.ts
CHANGED
|
@@ -22,8 +22,7 @@ declare global {
|
|
|
22
22
|
envStore?: EnvStore;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
envStore: EnhancedStore | any;
|
|
25
|
+
interface EnvConfig {
|
|
27
26
|
baseUrl?: string;
|
|
28
27
|
requests?: any;
|
|
29
28
|
context?: any;
|
|
@@ -32,24 +31,23 @@ declare class EnvStore {
|
|
|
32
31
|
companies?: any[];
|
|
33
32
|
user?: any;
|
|
34
33
|
db?: string;
|
|
35
|
-
localStorageUtils?: any;
|
|
36
|
-
sessionStorageUtils?: any;
|
|
37
34
|
refreshTokenEndpoint?: string;
|
|
38
|
-
constructor(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any);
|
|
39
|
-
setup(): void;
|
|
40
|
-
setupEnv(envConfig: EnvStore): void;
|
|
41
|
-
setUid(uid: number): void;
|
|
42
|
-
setLang(lang: string): void;
|
|
43
|
-
setAllowCompanies(allowCompanies: number[]): void;
|
|
44
|
-
setCompanies(companies: any[]): void;
|
|
45
|
-
setDefaultCompany(company: any): void;
|
|
46
|
-
setUserInfo(userInfo: any): void;
|
|
47
35
|
}
|
|
48
|
-
declare
|
|
49
|
-
|
|
36
|
+
declare function createEnvStore(store: EnhancedStore, localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: SessionStorageUtilsType): {
|
|
37
|
+
getEnvConfig: () => EnvConfig;
|
|
38
|
+
setupEnv: (envConfig: EnvConfig) => EnvConfig;
|
|
39
|
+
setUid: (uid: number) => EnvConfig;
|
|
40
|
+
setLang: (lang: string) => EnvConfig;
|
|
41
|
+
setAllowCompanies: (allowCompanies: number[]) => EnvConfig;
|
|
42
|
+
setCompanies: (companies: any[]) => EnvConfig;
|
|
43
|
+
setDefaultCompany: (company: any) => EnvConfig;
|
|
44
|
+
setUserInfo: (userInfo: any) => EnvConfig;
|
|
45
|
+
};
|
|
46
|
+
type EnvStore = ReturnType<typeof createEnvStore>;
|
|
47
|
+
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
50
48
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
49
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
52
50
|
}): EnvStore;
|
|
53
|
-
declare function getEnv():
|
|
51
|
+
declare function getEnv(): any;
|
|
54
52
|
|
|
55
|
-
export { EnvStore,
|
|
53
|
+
export { type EnvStore, getEnv, initEnv };
|
package/dist/environment.js
CHANGED
|
@@ -30,8 +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
|
-
env: () => env,
|
|
35
33
|
getEnv: () => getEnv,
|
|
36
34
|
initEnv: () => initEnv
|
|
37
35
|
});
|
|
@@ -2211,9 +2209,9 @@ var sessionStorageUtils = () => {
|
|
|
2211
2209
|
// src/configs/axios-client.ts
|
|
2212
2210
|
var axiosClient = {
|
|
2213
2211
|
init(config) {
|
|
2214
|
-
const localStorage2 = config
|
|
2215
|
-
const sessionStorage2 = config
|
|
2216
|
-
const db = config
|
|
2212
|
+
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2213
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2214
|
+
const db = config?.db;
|
|
2217
2215
|
let isRefreshing = false;
|
|
2218
2216
|
let failedQueue = [];
|
|
2219
2217
|
const processQueue = (error, token = null) => {
|
|
@@ -2232,16 +2230,19 @@ var axiosClient = {
|
|
|
2232
2230
|
timeout: 5e4,
|
|
2233
2231
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2234
2232
|
});
|
|
2235
|
-
instance.interceptors.request.use(
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2233
|
+
instance.interceptors.request.use(
|
|
2234
|
+
async (config2) => {
|
|
2235
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2236
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2237
|
+
if (token) {
|
|
2238
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2239
|
+
}
|
|
2240
|
+
return config2;
|
|
2241
|
+
},
|
|
2242
|
+
(error) => {
|
|
2243
|
+
Promise.reject(error);
|
|
2239
2244
|
}
|
|
2240
|
-
|
|
2241
|
-
const token = await getToken?.();
|
|
2242
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2243
|
-
return config2;
|
|
2244
|
-
}, Promise.reject);
|
|
2245
|
+
);
|
|
2245
2246
|
instance.interceptors.response.use(
|
|
2246
2247
|
(response) => {
|
|
2247
2248
|
return handleResponse(response);
|
|
@@ -2996,96 +2997,84 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
2996
2997
|
});
|
|
2997
2998
|
|
|
2998
2999
|
// src/environment/EnvStore.ts
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
setup() {
|
|
3019
|
-
const env2 = this.envStore.getState().env;
|
|
3020
|
-
this.baseUrl = env2?.baseUrl;
|
|
3021
|
-
this.requests = env2?.requests;
|
|
3022
|
-
this.context = env2?.context;
|
|
3023
|
-
this.defaultCompany = env2?.defaultCompany;
|
|
3024
|
-
this.config = env2?.config;
|
|
3025
|
-
this.companies = env2?.companies || [];
|
|
3026
|
-
this.user = env2?.user;
|
|
3027
|
-
this.db = env2?.db;
|
|
3028
|
-
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
|
3029
|
-
}
|
|
3030
|
-
setupEnv(envConfig) {
|
|
3031
|
-
const dispatch = this.envStore.dispatch;
|
|
3032
|
-
const env2 = {
|
|
3000
|
+
function createEnvStore(store, localStorageUtil, sessionStorageUtil) {
|
|
3001
|
+
const getEnvState = () => store.getState().env;
|
|
3002
|
+
const setupEnvConfig = () => {
|
|
3003
|
+
const env2 = getEnvState();
|
|
3004
|
+
return {
|
|
3005
|
+
baseUrl: env2?.baseUrl,
|
|
3006
|
+
requests: env2?.requests,
|
|
3007
|
+
context: env2?.context,
|
|
3008
|
+
defaultCompany: env2?.defaultCompany,
|
|
3009
|
+
config: env2?.config,
|
|
3010
|
+
companies: env2?.companies || [],
|
|
3011
|
+
user: env2?.user,
|
|
3012
|
+
db: env2?.db,
|
|
3013
|
+
refreshTokenEndpoint: env2?.refreshTokenEndpoint
|
|
3014
|
+
};
|
|
3015
|
+
};
|
|
3016
|
+
const setupEnv = (envConfig) => {
|
|
3017
|
+
const dispatch = store.dispatch;
|
|
3018
|
+
const updatedEnv = {
|
|
3033
3019
|
...envConfig,
|
|
3034
|
-
localStorageUtils:
|
|
3035
|
-
sessionStorageUtils:
|
|
3020
|
+
localStorageUtils: localStorageUtil,
|
|
3021
|
+
sessionStorageUtils: sessionStorageUtil
|
|
3036
3022
|
};
|
|
3037
|
-
const requests = axiosClient.init(
|
|
3038
|
-
dispatch(setEnv({ ...
|
|
3039
|
-
|
|
3040
|
-
}
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
dispatch(
|
|
3059
|
-
|
|
3060
|
-
}
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3023
|
+
const requests = axiosClient.init(updatedEnv);
|
|
3024
|
+
dispatch(setEnv({ ...updatedEnv, requests }));
|
|
3025
|
+
return setupEnvConfig();
|
|
3026
|
+
};
|
|
3027
|
+
const setupUid = (uid) => {
|
|
3028
|
+
store.dispatch(setUid(uid));
|
|
3029
|
+
return setupEnvConfig();
|
|
3030
|
+
};
|
|
3031
|
+
const setupLang = (lang) => {
|
|
3032
|
+
store.dispatch(setLang(lang));
|
|
3033
|
+
return setupEnvConfig();
|
|
3034
|
+
};
|
|
3035
|
+
const setupAllowCompanies = (allowCompanies) => {
|
|
3036
|
+
store.dispatch(setAllowCompanies(allowCompanies));
|
|
3037
|
+
return setupEnvConfig();
|
|
3038
|
+
};
|
|
3039
|
+
const setupCompanies = (companies) => {
|
|
3040
|
+
store.dispatch(setCompanies(companies));
|
|
3041
|
+
return setupEnvConfig();
|
|
3042
|
+
};
|
|
3043
|
+
const setupDefaultCompany = (company) => {
|
|
3044
|
+
store.dispatch(setDefaultCompany(company));
|
|
3045
|
+
return setupEnvConfig();
|
|
3046
|
+
};
|
|
3047
|
+
const setUserInfo = (userInfo) => {
|
|
3048
|
+
store.dispatch(setUser(userInfo));
|
|
3049
|
+
return setupEnvConfig();
|
|
3050
|
+
};
|
|
3051
|
+
return {
|
|
3052
|
+
getEnvConfig: setupEnvConfig,
|
|
3053
|
+
setupEnv,
|
|
3054
|
+
setUid: setupUid,
|
|
3055
|
+
setLang: setupLang,
|
|
3056
|
+
setAllowCompanies: setupAllowCompanies,
|
|
3057
|
+
setCompanies: setupCompanies,
|
|
3058
|
+
setDefaultCompany: setupDefaultCompany,
|
|
3059
|
+
setUserInfo
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3072
3062
|
var env = null;
|
|
3073
3063
|
function initEnv({
|
|
3074
|
-
localStorageUtils:
|
|
3075
|
-
sessionStorageUtils:
|
|
3064
|
+
localStorageUtils: localStorageUtil,
|
|
3065
|
+
sessionStorageUtils: sessionStorageUtil
|
|
3076
3066
|
}) {
|
|
3077
|
-
env =
|
|
3067
|
+
env = createEnvStore(envStore, localStorageUtil, sessionStorageUtil);
|
|
3078
3068
|
return env;
|
|
3079
3069
|
}
|
|
3080
3070
|
function getEnv() {
|
|
3081
|
-
if (!env)
|
|
3082
|
-
env =
|
|
3071
|
+
if (!env) {
|
|
3072
|
+
env = createEnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3073
|
+
}
|
|
3083
3074
|
return env;
|
|
3084
3075
|
}
|
|
3085
3076
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3086
3077
|
0 && (module.exports = {
|
|
3087
|
-
EnvStore,
|
|
3088
|
-
env,
|
|
3089
3078
|
getEnv,
|
|
3090
3079
|
initEnv
|
|
3091
3080
|
});
|
package/dist/environment.mjs
CHANGED
|
@@ -2172,9 +2172,9 @@ var sessionStorageUtils = () => {
|
|
|
2172
2172
|
// src/configs/axios-client.ts
|
|
2173
2173
|
var axiosClient = {
|
|
2174
2174
|
init(config) {
|
|
2175
|
-
const localStorage2 = config
|
|
2176
|
-
const sessionStorage2 = config
|
|
2177
|
-
const db = config
|
|
2175
|
+
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2176
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2177
|
+
const db = config?.db;
|
|
2178
2178
|
let isRefreshing = false;
|
|
2179
2179
|
let failedQueue = [];
|
|
2180
2180
|
const processQueue = (error, token = null) => {
|
|
@@ -2193,16 +2193,19 @@ var axiosClient = {
|
|
|
2193
2193
|
timeout: 5e4,
|
|
2194
2194
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
2195
|
});
|
|
2196
|
-
instance.interceptors.request.use(
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2196
|
+
instance.interceptors.request.use(
|
|
2197
|
+
async (config2) => {
|
|
2198
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2199
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2200
|
+
if (token) {
|
|
2201
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2202
|
+
}
|
|
2203
|
+
return config2;
|
|
2204
|
+
},
|
|
2205
|
+
(error) => {
|
|
2206
|
+
Promise.reject(error);
|
|
2200
2207
|
}
|
|
2201
|
-
|
|
2202
|
-
const token = await getToken?.();
|
|
2203
|
-
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2204
|
-
return config2;
|
|
2205
|
-
}, Promise.reject);
|
|
2208
|
+
);
|
|
2206
2209
|
instance.interceptors.response.use(
|
|
2207
2210
|
(response) => {
|
|
2208
2211
|
return handleResponse(response);
|
|
@@ -2957,95 +2960,83 @@ var envStore = configureStore({
|
|
|
2957
2960
|
});
|
|
2958
2961
|
|
|
2959
2962
|
// src/environment/EnvStore.ts
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
setup() {
|
|
2980
|
-
const env2 = this.envStore.getState().env;
|
|
2981
|
-
this.baseUrl = env2?.baseUrl;
|
|
2982
|
-
this.requests = env2?.requests;
|
|
2983
|
-
this.context = env2?.context;
|
|
2984
|
-
this.defaultCompany = env2?.defaultCompany;
|
|
2985
|
-
this.config = env2?.config;
|
|
2986
|
-
this.companies = env2?.companies || [];
|
|
2987
|
-
this.user = env2?.user;
|
|
2988
|
-
this.db = env2?.db;
|
|
2989
|
-
this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
|
|
2990
|
-
}
|
|
2991
|
-
setupEnv(envConfig) {
|
|
2992
|
-
const dispatch = this.envStore.dispatch;
|
|
2993
|
-
const env2 = {
|
|
2963
|
+
function createEnvStore(store, localStorageUtil, sessionStorageUtil) {
|
|
2964
|
+
const getEnvState = () => store.getState().env;
|
|
2965
|
+
const setupEnvConfig = () => {
|
|
2966
|
+
const env2 = getEnvState();
|
|
2967
|
+
return {
|
|
2968
|
+
baseUrl: env2?.baseUrl,
|
|
2969
|
+
requests: env2?.requests,
|
|
2970
|
+
context: env2?.context,
|
|
2971
|
+
defaultCompany: env2?.defaultCompany,
|
|
2972
|
+
config: env2?.config,
|
|
2973
|
+
companies: env2?.companies || [],
|
|
2974
|
+
user: env2?.user,
|
|
2975
|
+
db: env2?.db,
|
|
2976
|
+
refreshTokenEndpoint: env2?.refreshTokenEndpoint
|
|
2977
|
+
};
|
|
2978
|
+
};
|
|
2979
|
+
const setupEnv = (envConfig) => {
|
|
2980
|
+
const dispatch = store.dispatch;
|
|
2981
|
+
const updatedEnv = {
|
|
2994
2982
|
...envConfig,
|
|
2995
|
-
localStorageUtils:
|
|
2996
|
-
sessionStorageUtils:
|
|
2983
|
+
localStorageUtils: localStorageUtil,
|
|
2984
|
+
sessionStorageUtils: sessionStorageUtil
|
|
2997
2985
|
};
|
|
2998
|
-
const requests = axiosClient.init(
|
|
2999
|
-
dispatch(setEnv({ ...
|
|
3000
|
-
|
|
3001
|
-
}
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
dispatch(
|
|
3020
|
-
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
2986
|
+
const requests = axiosClient.init(updatedEnv);
|
|
2987
|
+
dispatch(setEnv({ ...updatedEnv, requests }));
|
|
2988
|
+
return setupEnvConfig();
|
|
2989
|
+
};
|
|
2990
|
+
const setupUid = (uid) => {
|
|
2991
|
+
store.dispatch(setUid(uid));
|
|
2992
|
+
return setupEnvConfig();
|
|
2993
|
+
};
|
|
2994
|
+
const setupLang = (lang) => {
|
|
2995
|
+
store.dispatch(setLang(lang));
|
|
2996
|
+
return setupEnvConfig();
|
|
2997
|
+
};
|
|
2998
|
+
const setupAllowCompanies = (allowCompanies) => {
|
|
2999
|
+
store.dispatch(setAllowCompanies(allowCompanies));
|
|
3000
|
+
return setupEnvConfig();
|
|
3001
|
+
};
|
|
3002
|
+
const setupCompanies = (companies) => {
|
|
3003
|
+
store.dispatch(setCompanies(companies));
|
|
3004
|
+
return setupEnvConfig();
|
|
3005
|
+
};
|
|
3006
|
+
const setupDefaultCompany = (company) => {
|
|
3007
|
+
store.dispatch(setDefaultCompany(company));
|
|
3008
|
+
return setupEnvConfig();
|
|
3009
|
+
};
|
|
3010
|
+
const setUserInfo = (userInfo) => {
|
|
3011
|
+
store.dispatch(setUser(userInfo));
|
|
3012
|
+
return setupEnvConfig();
|
|
3013
|
+
};
|
|
3014
|
+
return {
|
|
3015
|
+
getEnvConfig: setupEnvConfig,
|
|
3016
|
+
setupEnv,
|
|
3017
|
+
setUid: setupUid,
|
|
3018
|
+
setLang: setupLang,
|
|
3019
|
+
setAllowCompanies: setupAllowCompanies,
|
|
3020
|
+
setCompanies: setupCompanies,
|
|
3021
|
+
setDefaultCompany: setupDefaultCompany,
|
|
3022
|
+
setUserInfo
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3033
3025
|
var env = null;
|
|
3034
3026
|
function initEnv({
|
|
3035
|
-
localStorageUtils:
|
|
3036
|
-
sessionStorageUtils:
|
|
3027
|
+
localStorageUtils: localStorageUtil,
|
|
3028
|
+
sessionStorageUtils: sessionStorageUtil
|
|
3037
3029
|
}) {
|
|
3038
|
-
env =
|
|
3030
|
+
env = createEnvStore(envStore, localStorageUtil, sessionStorageUtil);
|
|
3039
3031
|
return env;
|
|
3040
3032
|
}
|
|
3041
3033
|
function getEnv() {
|
|
3042
|
-
if (!env)
|
|
3043
|
-
env =
|
|
3034
|
+
if (!env) {
|
|
3035
|
+
env = createEnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3036
|
+
}
|
|
3044
3037
|
return env;
|
|
3045
3038
|
}
|
|
3046
3039
|
export {
|
|
3047
|
-
EnvStore,
|
|
3048
|
-
env,
|
|
3049
3040
|
getEnv,
|
|
3050
3041
|
initEnv
|
|
3051
3042
|
};
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { L as LoginCredentialBody,
|
|
2
|
+
import { L as LoginCredentialBody, S as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, G as GetSelectionType, a as GetViewParams } from './view-type-D8ukwj_2.mjs';
|
|
3
3
|
|
|
4
4
|
declare const useForgotPassword: () => _tanstack_react_query.UseMutationResult<any, Error, string, unknown>;
|
|
5
5
|
|
|
@@ -36,11 +36,6 @@ declare const useGetAccessByCode: () => _tanstack_react_query.UseMutationResult<
|
|
|
36
36
|
code: string;
|
|
37
37
|
}, unknown>;
|
|
38
38
|
|
|
39
|
-
declare const useValidateActionToken: () => _tanstack_react_query.UseMutationResult<any, Error, {
|
|
40
|
-
actionToken: string;
|
|
41
|
-
path: string;
|
|
42
|
-
}, unknown>;
|
|
43
|
-
|
|
44
39
|
declare const useGetCompanyInfo: () => _tanstack_react_query.UseMutationResult<any, Error, number, unknown>;
|
|
45
40
|
|
|
46
41
|
declare const useGetCurrentCompany: () => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
|
|
@@ -361,4 +356,4 @@ declare const useVerifyTotp: () => _tanstack_react_query.UseMutationResult<any,
|
|
|
361
356
|
code: string;
|
|
362
357
|
}, unknown>;
|
|
363
358
|
|
|
364
|
-
export { useButton, useChangeStatus, useDelete, useDeleteComment, useDuplicateRecord, useExecuteImport, useExportExcel, useForgotPassword, useForgotPasswordSSO, useGet2FAMethods, useGetAccessByCode, useGetActionDetail, useGetAll, useGetCalendar, useGetComment, useGetCompanyInfo, useGetConversionRate, useGetCurrency, useGetCurrentCompany, useGetDetail, useGetFieldExport, useGetFieldOnChange, useGetFieldsViewSecurity, useGetFileExcel, useGetFormView, useGetGroups, useGetImage, useGetListCompany, useGetListData, useGetListMyBankAccount, useGetMenu, useGetPrintReport, useGetProGressBar, useGetProfile, useGetProvider, useGetResequence, useGetSelection, useGetUser, useGetView, useGrantAccess, useIsValidToken, useLoadAction, useLoadMessage, useLoginCredential, useLoginSocial, useLogout, useModel, useOdooDataTransform, useOnChangeForm, useParsePreview, usePrint, useRemoveRow, useRemoveTotpSetup, useRequestSetupTotp, useResetPassword, useResetPasswordSSO, useRunAction, useSave, useSendComment, useSettingsWebRead2fa, useSignInSSO, useSwitchLocale, useUpdatePassword, useUploadFile, useUploadIdFile, useUploadImage,
|
|
359
|
+
export { useButton, useChangeStatus, useDelete, useDeleteComment, useDuplicateRecord, useExecuteImport, useExportExcel, useForgotPassword, useForgotPasswordSSO, useGet2FAMethods, useGetAccessByCode, useGetActionDetail, useGetAll, useGetCalendar, useGetComment, useGetCompanyInfo, useGetConversionRate, useGetCurrency, useGetCurrentCompany, useGetDetail, useGetFieldExport, useGetFieldOnChange, useGetFieldsViewSecurity, useGetFileExcel, useGetFormView, useGetGroups, useGetImage, useGetListCompany, useGetListData, useGetListMyBankAccount, useGetMenu, useGetPrintReport, useGetProGressBar, useGetProfile, useGetProvider, useGetResequence, useGetSelection, useGetUser, useGetView, useGrantAccess, useIsValidToken, useLoadAction, useLoadMessage, useLoginCredential, useLoginSocial, useLogout, useModel, useOdooDataTransform, useOnChangeForm, useParsePreview, usePrint, useRemoveRow, useRemoveTotpSetup, useRequestSetupTotp, useResetPassword, useResetPasswordSSO, useRunAction, useSave, useSendComment, useSettingsWebRead2fa, useSignInSSO, useSwitchLocale, useUpdatePassword, useUploadFile, useUploadIdFile, useUploadImage, useVerify2FA, useVerifyTotp };
|