@fctc/interface-logic 1.7.8 → 1.7.10
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 +4 -1
- package/dist/configs.d.ts +4 -1
- package/dist/configs.js +12 -15
- package/dist/configs.mjs +12 -15
- package/dist/environment.d.mts +18 -21
- package/dist/environment.d.ts +18 -21
- package/dist/environment.js +77 -74
- package/dist/environment.mjs +76 -74
- package/dist/hooks.d.mts +7 -2
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js +352 -323
- package/dist/hooks.mjs +311 -283
- package/dist/provider.d.mts +3 -4
- package/dist/provider.d.ts +3 -4
- package/dist/provider.js +106 -108
- package/dist/provider.mjs +106 -108
- package/dist/services.d.mts +2 -1
- package/dist/services.d.ts +2 -1
- package/dist/services.js +226 -213
- package/dist/services.mjs +226 -213
- 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-D8ukwj_2.d.mts → view-type-BGJfDe73.d.mts} +1 -1
- package/dist/{view-type-D8ukwj_2.d.ts → view-type-BGJfDe73.d.ts} +1 -1
- package/package.json +1 -1
package/dist/configs.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { EnvStore } from './environment.mjs';
|
|
2
|
+
import '@reduxjs/toolkit';
|
|
3
|
+
|
|
1
4
|
declare const axiosClient: {
|
|
2
|
-
init(config:
|
|
5
|
+
init(config: EnvStore): {
|
|
3
6
|
get: (url: string, headers: any) => Promise<any>;
|
|
4
7
|
post: (url: string, body: any, headers: any) => Promise<any>;
|
|
5
8
|
post_excel: (url: string, body: any, headers: any) => Promise<any>;
|
package/dist/configs.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { EnvStore } from './environment.js';
|
|
2
|
+
import '@reduxjs/toolkit';
|
|
3
|
+
|
|
1
4
|
declare const axiosClient: {
|
|
2
|
-
init(config:
|
|
5
|
+
init(config: EnvStore): {
|
|
3
6
|
get: (url: string, headers: any) => Promise<any>;
|
|
4
7
|
post: (url: string, body: any, headers: any) => Promise<any>;
|
|
5
8
|
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,19 +2229,16 @@ var axiosClient = {
|
|
|
2229
2229
|
timeout: 5e4,
|
|
2230
2230
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2231
2231
|
});
|
|
2232
|
-
instance.interceptors.request.use(
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
if (token) {
|
|
2237
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
2238
|
-
}
|
|
2239
|
-
return config2;
|
|
2240
|
-
},
|
|
2241
|
-
(error) => {
|
|
2242
|
-
Promise.reject(error);
|
|
2232
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2233
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2234
|
+
if (useActionToken && actionToken) {
|
|
2235
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2243
2236
|
}
|
|
2244
|
-
|
|
2237
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2238
|
+
const token = await getToken?.();
|
|
2239
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2240
|
+
return config2;
|
|
2241
|
+
}, Promise.reject);
|
|
2245
2242
|
instance.interceptors.response.use(
|
|
2246
2243
|
(response) => {
|
|
2247
2244
|
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,19 +2193,16 @@ var axiosClient = {
|
|
|
2193
2193
|
timeout: 5e4,
|
|
2194
2194
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
2195
|
});
|
|
2196
|
-
instance.interceptors.request.use(
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
if (token) {
|
|
2201
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
2202
|
-
}
|
|
2203
|
-
return config2;
|
|
2204
|
-
},
|
|
2205
|
-
(error) => {
|
|
2206
|
-
Promise.reject(error);
|
|
2196
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2197
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2198
|
+
if (useActionToken && actionToken) {
|
|
2199
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2207
2200
|
}
|
|
2208
|
-
|
|
2201
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2202
|
+
const token = await getToken?.();
|
|
2203
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2204
|
+
return config2;
|
|
2205
|
+
}, Promise.reject);
|
|
2209
2206
|
instance.interceptors.response.use(
|
|
2210
2207
|
(response) => {
|
|
2211
2208
|
return handleResponse(response);
|
package/dist/environment.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
1
3
|
declare const localStorageUtils: () => {
|
|
2
4
|
setToken: (access_token: string) => Promise<void>;
|
|
3
5
|
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
@@ -20,7 +22,8 @@ declare global {
|
|
|
20
22
|
envStore?: EnvStore;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
declare class EnvStore {
|
|
26
|
+
envStore: EnhancedStore | any;
|
|
24
27
|
baseUrl?: string;
|
|
25
28
|
requests?: any;
|
|
26
29
|
context?: any;
|
|
@@ -29,30 +32,24 @@ interface EnvState {
|
|
|
29
32
|
companies?: any[];
|
|
30
33
|
user?: any;
|
|
31
34
|
db?: string;
|
|
35
|
+
localStorageUtils?: any;
|
|
36
|
+
sessionStorageUtils?: any;
|
|
32
37
|
refreshTokenEndpoint?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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;
|
|
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;
|
|
51
47
|
}
|
|
48
|
+
declare let env: EnvStore | null;
|
|
52
49
|
declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
|
|
53
50
|
localStorageUtils?: LocalStorageUtilsType;
|
|
54
51
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
55
52
|
}): EnvStore;
|
|
56
|
-
declare function getEnv():
|
|
53
|
+
declare function getEnv(): EnvStore;
|
|
57
54
|
|
|
58
|
-
export { EnvStore, getEnv, initEnv };
|
|
55
|
+
export { EnvStore, env, getEnv, initEnv };
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
1
3
|
declare const localStorageUtils: () => {
|
|
2
4
|
setToken: (access_token: string) => Promise<void>;
|
|
3
5
|
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
@@ -20,7 +22,8 @@ declare global {
|
|
|
20
22
|
envStore?: EnvStore;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
declare class EnvStore {
|
|
26
|
+
envStore: EnhancedStore | any;
|
|
24
27
|
baseUrl?: string;
|
|
25
28
|
requests?: any;
|
|
26
29
|
context?: any;
|
|
@@ -29,30 +32,24 @@ interface EnvState {
|
|
|
29
32
|
companies?: any[];
|
|
30
33
|
user?: any;
|
|
31
34
|
db?: string;
|
|
35
|
+
localStorageUtils?: any;
|
|
36
|
+
sessionStorageUtils?: any;
|
|
32
37
|
refreshTokenEndpoint?: string;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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;
|
|
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;
|
|
51
47
|
}
|
|
48
|
+
declare let env: EnvStore | null;
|
|
52
49
|
declare function initEnv({ localStorageUtils, sessionStorageUtils, }: {
|
|
53
50
|
localStorageUtils?: LocalStorageUtilsType;
|
|
54
51
|
sessionStorageUtils?: SessionStorageUtilsType;
|
|
55
52
|
}): EnvStore;
|
|
56
|
-
declare function getEnv():
|
|
53
|
+
declare function getEnv(): EnvStore;
|
|
57
54
|
|
|
58
|
-
export { EnvStore, getEnv, initEnv };
|
|
55
|
+
export { EnvStore, env, getEnv, initEnv };
|
package/dist/environment.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var environment_exports = {};
|
|
32
32
|
__export(environment_exports, {
|
|
33
33
|
EnvStore: () => EnvStore,
|
|
34
|
+
env: () => env,
|
|
34
35
|
getEnv: () => getEnv,
|
|
35
36
|
initEnv: () => initEnv
|
|
36
37
|
});
|
|
@@ -2210,9 +2211,9 @@ var sessionStorageUtils = () => {
|
|
|
2210
2211
|
// src/configs/axios-client.ts
|
|
2211
2212
|
var axiosClient = {
|
|
2212
2213
|
init(config) {
|
|
2213
|
-
const localStorage2 = config
|
|
2214
|
-
const sessionStorage2 = config
|
|
2215
|
-
const db = config
|
|
2214
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2215
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2216
|
+
const db = config.db;
|
|
2216
2217
|
let isRefreshing = false;
|
|
2217
2218
|
let failedQueue = [];
|
|
2218
2219
|
const processQueue = (error, token = null) => {
|
|
@@ -2231,19 +2232,16 @@ var axiosClient = {
|
|
|
2231
2232
|
timeout: 5e4,
|
|
2232
2233
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2233
2234
|
});
|
|
2234
|
-
instance.interceptors.request.use(
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
if (token) {
|
|
2239
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
2240
|
-
}
|
|
2241
|
-
return config2;
|
|
2242
|
-
},
|
|
2243
|
-
(error) => {
|
|
2244
|
-
Promise.reject(error);
|
|
2235
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2236
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2237
|
+
if (useActionToken && actionToken) {
|
|
2238
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2245
2239
|
}
|
|
2246
|
-
|
|
2240
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2241
|
+
const token = await getToken?.();
|
|
2242
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2243
|
+
return config2;
|
|
2244
|
+
}, Promise.reject);
|
|
2247
2245
|
instance.interceptors.response.use(
|
|
2248
2246
|
(response) => {
|
|
2249
2247
|
return handleResponse(response);
|
|
@@ -2998,91 +2996,96 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
2998
2996
|
});
|
|
2999
2997
|
|
|
3000
2998
|
// src/environment/EnvStore.ts
|
|
3001
|
-
var EnvStore = class
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
}
|
|
3036
|
-
static setupEnv(envConfig) {
|
|
3037
|
-
const dispatch = envStore.dispatch;
|
|
3038
|
-
const env = {
|
|
3039
|
-
..._EnvStore.getState(),
|
|
2999
|
+
var EnvStore = class {
|
|
3000
|
+
envStore;
|
|
3001
|
+
baseUrl;
|
|
3002
|
+
requests;
|
|
3003
|
+
context;
|
|
3004
|
+
defaultCompany;
|
|
3005
|
+
config;
|
|
3006
|
+
companies;
|
|
3007
|
+
user;
|
|
3008
|
+
db;
|
|
3009
|
+
localStorageUtils;
|
|
3010
|
+
sessionStorageUtils;
|
|
3011
|
+
refreshTokenEndpoint;
|
|
3012
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
3013
|
+
this.envStore = envStore2;
|
|
3014
|
+
this.localStorageUtils = localStorageUtils2;
|
|
3015
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
3016
|
+
this.setup();
|
|
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 = {
|
|
3040
3033
|
...envConfig,
|
|
3041
|
-
localStorageUtils:
|
|
3042
|
-
sessionStorageUtils:
|
|
3034
|
+
localStorageUtils: this.localStorageUtils,
|
|
3035
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3043
3036
|
};
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
dispatch(setEnv({ ...env, requests }));
|
|
3037
|
+
const requests = axiosClient.init(env2);
|
|
3038
|
+
dispatch(setEnv({ ...env2, requests }));
|
|
3039
|
+
this.setup();
|
|
3048
3040
|
}
|
|
3049
|
-
|
|
3050
|
-
const dispatch = envStore.dispatch;
|
|
3041
|
+
setUid(uid) {
|
|
3042
|
+
const dispatch = this.envStore.dispatch;
|
|
3051
3043
|
dispatch(setUid(uid));
|
|
3044
|
+
this.setup();
|
|
3052
3045
|
}
|
|
3053
|
-
|
|
3054
|
-
const dispatch = envStore.dispatch;
|
|
3046
|
+
setLang(lang) {
|
|
3047
|
+
const dispatch = this.envStore.dispatch;
|
|
3055
3048
|
dispatch(setLang(lang));
|
|
3049
|
+
this.setup();
|
|
3056
3050
|
}
|
|
3057
|
-
|
|
3058
|
-
const dispatch = envStore.dispatch;
|
|
3051
|
+
setAllowCompanies(allowCompanies) {
|
|
3052
|
+
const dispatch = this.envStore.dispatch;
|
|
3059
3053
|
dispatch(setAllowCompanies(allowCompanies));
|
|
3054
|
+
this.setup();
|
|
3060
3055
|
}
|
|
3061
|
-
|
|
3062
|
-
const dispatch = envStore.dispatch;
|
|
3056
|
+
setCompanies(companies) {
|
|
3057
|
+
const dispatch = this.envStore.dispatch;
|
|
3063
3058
|
dispatch(setCompanies(companies));
|
|
3059
|
+
this.setup();
|
|
3064
3060
|
}
|
|
3065
|
-
|
|
3066
|
-
const dispatch = envStore.dispatch;
|
|
3061
|
+
setDefaultCompany(company) {
|
|
3062
|
+
const dispatch = this.envStore.dispatch;
|
|
3067
3063
|
dispatch(setDefaultCompany(company));
|
|
3064
|
+
this.setup();
|
|
3068
3065
|
}
|
|
3069
|
-
|
|
3070
|
-
const dispatch = envStore.dispatch;
|
|
3066
|
+
setUserInfo(userInfo) {
|
|
3067
|
+
const dispatch = this.envStore.dispatch;
|
|
3071
3068
|
dispatch(setUser(userInfo));
|
|
3069
|
+
this.setup();
|
|
3072
3070
|
}
|
|
3073
3071
|
};
|
|
3072
|
+
var env = null;
|
|
3074
3073
|
function initEnv({
|
|
3075
3074
|
localStorageUtils: localStorageUtils2,
|
|
3076
3075
|
sessionStorageUtils: sessionStorageUtils2
|
|
3077
3076
|
}) {
|
|
3078
|
-
|
|
3077
|
+
env = new EnvStore(envStore, localStorageUtils2, sessionStorageUtils2);
|
|
3078
|
+
return env;
|
|
3079
3079
|
}
|
|
3080
3080
|
function getEnv() {
|
|
3081
|
-
|
|
3081
|
+
if (!env)
|
|
3082
|
+
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3083
|
+
return env;
|
|
3082
3084
|
}
|
|
3083
3085
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3084
3086
|
0 && (module.exports = {
|
|
3085
3087
|
EnvStore,
|
|
3088
|
+
env,
|
|
3086
3089
|
getEnv,
|
|
3087
3090
|
initEnv
|
|
3088
3091
|
});
|
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,19 +2193,16 @@ var axiosClient = {
|
|
|
2193
2193
|
timeout: 5e4,
|
|
2194
2194
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
2195
|
});
|
|
2196
|
-
instance.interceptors.request.use(
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
if (token) {
|
|
2201
|
-
config2.headers["Authorization"] = "Bearer " + token;
|
|
2202
|
-
}
|
|
2203
|
-
return config2;
|
|
2204
|
-
},
|
|
2205
|
-
(error) => {
|
|
2206
|
-
Promise.reject(error);
|
|
2196
|
+
instance.interceptors.request.use(async (config2) => {
|
|
2197
|
+
const { useRefreshToken, useActionToken, actionToken } = config2;
|
|
2198
|
+
if (useActionToken && actionToken) {
|
|
2199
|
+
config2.headers["Action-Token"] = actionToken;
|
|
2207
2200
|
}
|
|
2208
|
-
|
|
2201
|
+
const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
|
|
2202
|
+
const token = await getToken?.();
|
|
2203
|
+
if (token) config2.headers["Authorization"] = `Bearer ${token}`;
|
|
2204
|
+
return config2;
|
|
2205
|
+
}, Promise.reject);
|
|
2209
2206
|
instance.interceptors.response.use(
|
|
2210
2207
|
(response) => {
|
|
2211
2208
|
return handleResponse(response);
|
|
@@ -2960,90 +2957,95 @@ var envStore = configureStore({
|
|
|
2960
2957
|
});
|
|
2961
2958
|
|
|
2962
2959
|
// src/environment/EnvStore.ts
|
|
2963
|
-
var EnvStore = class
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
}
|
|
2998
|
-
static setupEnv(envConfig) {
|
|
2999
|
-
const dispatch = envStore.dispatch;
|
|
3000
|
-
const env = {
|
|
3001
|
-
..._EnvStore.getState(),
|
|
2960
|
+
var EnvStore = class {
|
|
2961
|
+
envStore;
|
|
2962
|
+
baseUrl;
|
|
2963
|
+
requests;
|
|
2964
|
+
context;
|
|
2965
|
+
defaultCompany;
|
|
2966
|
+
config;
|
|
2967
|
+
companies;
|
|
2968
|
+
user;
|
|
2969
|
+
db;
|
|
2970
|
+
localStorageUtils;
|
|
2971
|
+
sessionStorageUtils;
|
|
2972
|
+
refreshTokenEndpoint;
|
|
2973
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2974
|
+
this.envStore = envStore2;
|
|
2975
|
+
this.localStorageUtils = localStorageUtils2;
|
|
2976
|
+
this.sessionStorageUtils = sessionStorageUtils2;
|
|
2977
|
+
this.setup();
|
|
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 = {
|
|
3002
2994
|
...envConfig,
|
|
3003
|
-
localStorageUtils:
|
|
3004
|
-
sessionStorageUtils:
|
|
2995
|
+
localStorageUtils: this.localStorageUtils,
|
|
2996
|
+
sessionStorageUtils: this.sessionStorageUtils
|
|
3005
2997
|
};
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
dispatch(setEnv({ ...env, requests }));
|
|
2998
|
+
const requests = axiosClient.init(env2);
|
|
2999
|
+
dispatch(setEnv({ ...env2, requests }));
|
|
3000
|
+
this.setup();
|
|
3010
3001
|
}
|
|
3011
|
-
|
|
3012
|
-
const dispatch = envStore.dispatch;
|
|
3002
|
+
setUid(uid) {
|
|
3003
|
+
const dispatch = this.envStore.dispatch;
|
|
3013
3004
|
dispatch(setUid(uid));
|
|
3005
|
+
this.setup();
|
|
3014
3006
|
}
|
|
3015
|
-
|
|
3016
|
-
const dispatch = envStore.dispatch;
|
|
3007
|
+
setLang(lang) {
|
|
3008
|
+
const dispatch = this.envStore.dispatch;
|
|
3017
3009
|
dispatch(setLang(lang));
|
|
3010
|
+
this.setup();
|
|
3018
3011
|
}
|
|
3019
|
-
|
|
3020
|
-
const dispatch = envStore.dispatch;
|
|
3012
|
+
setAllowCompanies(allowCompanies) {
|
|
3013
|
+
const dispatch = this.envStore.dispatch;
|
|
3021
3014
|
dispatch(setAllowCompanies(allowCompanies));
|
|
3015
|
+
this.setup();
|
|
3022
3016
|
}
|
|
3023
|
-
|
|
3024
|
-
const dispatch = envStore.dispatch;
|
|
3017
|
+
setCompanies(companies) {
|
|
3018
|
+
const dispatch = this.envStore.dispatch;
|
|
3025
3019
|
dispatch(setCompanies(companies));
|
|
3020
|
+
this.setup();
|
|
3026
3021
|
}
|
|
3027
|
-
|
|
3028
|
-
const dispatch = envStore.dispatch;
|
|
3022
|
+
setDefaultCompany(company) {
|
|
3023
|
+
const dispatch = this.envStore.dispatch;
|
|
3029
3024
|
dispatch(setDefaultCompany(company));
|
|
3025
|
+
this.setup();
|
|
3030
3026
|
}
|
|
3031
|
-
|
|
3032
|
-
const dispatch = envStore.dispatch;
|
|
3027
|
+
setUserInfo(userInfo) {
|
|
3028
|
+
const dispatch = this.envStore.dispatch;
|
|
3033
3029
|
dispatch(setUser(userInfo));
|
|
3030
|
+
this.setup();
|
|
3034
3031
|
}
|
|
3035
3032
|
};
|
|
3033
|
+
var env = null;
|
|
3036
3034
|
function initEnv({
|
|
3037
3035
|
localStorageUtils: localStorageUtils2,
|
|
3038
3036
|
sessionStorageUtils: sessionStorageUtils2
|
|
3039
3037
|
}) {
|
|
3040
|
-
|
|
3038
|
+
env = new EnvStore(envStore, localStorageUtils2, sessionStorageUtils2);
|
|
3039
|
+
return env;
|
|
3041
3040
|
}
|
|
3042
3041
|
function getEnv() {
|
|
3043
|
-
|
|
3042
|
+
if (!env)
|
|
3043
|
+
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3044
|
+
return env;
|
|
3044
3045
|
}
|
|
3045
3046
|
export {
|
|
3046
3047
|
EnvStore,
|
|
3048
|
+
env,
|
|
3047
3049
|
getEnv,
|
|
3048
3050
|
initEnv
|
|
3049
3051
|
};
|
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, d as SocialTokenBody, F as ForgotPasswordBody, u as updatePasswordBody, V as ViewData, C as ContextApi, c as GetSelectionType, f as GetViewParams } from './view-type-BGJfDe73.mjs';
|
|
3
3
|
|
|
4
4
|
declare const useForgotPassword: () => _tanstack_react_query.UseMutationResult<any, Error, string, unknown>;
|
|
5
5
|
|
|
@@ -36,6 +36,11 @@ 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
|
+
|
|
39
44
|
declare const useGetCompanyInfo: () => _tanstack_react_query.UseMutationResult<any, Error, number, unknown>;
|
|
40
45
|
|
|
41
46
|
declare const useGetCurrentCompany: () => _tanstack_react_query.UseMutationResult<any, Error, void, unknown>;
|
|
@@ -356,4 +361,4 @@ declare const useVerifyTotp: () => _tanstack_react_query.UseMutationResult<any,
|
|
|
356
361
|
code: string;
|
|
357
362
|
}, unknown>;
|
|
358
363
|
|
|
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 };
|
|
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, useValidateActionToken, useVerify2FA, useVerifyTotp };
|