@fctc/interface-logic 1.7.4 → 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 +4 -1
- package/dist/configs.d.ts +4 -1
- package/dist/configs.js +12 -9
- package/dist/configs.mjs +12 -9
- package/dist/environment.d.mts +55 -35
- package/dist/environment.d.ts +55 -35
- package/dist/environment.js +1311 -1232
- package/dist/environment.mjs +1309 -1231
- package/dist/hooks.d.mts +2 -7
- package/dist/hooks.d.ts +2 -7
- package/dist/hooks.js +2175 -1896
- package/dist/hooks.mjs +2960 -2680
- package/dist/provider.js +329 -19
- package/dist/provider.mjs +329 -19
- package/dist/services.d.mts +1 -2
- package/dist/services.d.ts +1 -2
- package/dist/services.js +2001 -1706
- package/dist/services.mjs +2001 -1706
- package/dist/store.d.mts +28 -224
- package/dist/store.d.ts +28 -224
- package/dist/store.js +6 -20
- package/dist/store.mjs +6 -20
- 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 +81 -81
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
|
@@ -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
|
@@ -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
|
@@ -1,37 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
envFile: null;
|
|
15
|
-
requests: {
|
|
16
|
-
get: (url: string, headers?: any) => Promise<any>;
|
|
17
|
-
post: (url: string, body: any, headers?: any) => Promise<any>;
|
|
18
|
-
post_excel: (url: string, body: any, headers?: any) => Promise<any>;
|
|
19
|
-
put: (url: string, body: any, headers?: any) => Promise<any>;
|
|
20
|
-
patch: (url: string, body: any) => Promise<any>;
|
|
21
|
-
delete: (url: string, body: any) => Promise<any>;
|
|
22
|
-
};
|
|
23
|
-
defaultCompany: {
|
|
24
|
-
id: null;
|
|
25
|
-
logo: string;
|
|
26
|
-
secondary_color: string;
|
|
27
|
-
primary_color: string;
|
|
28
|
-
};
|
|
29
|
-
context: {
|
|
30
|
-
uid: null;
|
|
31
|
-
allowed_company_ids: never[];
|
|
32
|
-
lang: string;
|
|
33
|
-
tz: string;
|
|
34
|
-
};
|
|
1
|
+
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
declare const localStorageUtils: () => {
|
|
4
|
+
setToken: (access_token: string) => Promise<void>;
|
|
5
|
+
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
6
|
+
getAccessToken: () => Promise<string | null>;
|
|
7
|
+
getRefreshToken: () => Promise<string | null>;
|
|
8
|
+
clearToken: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
type LocalStorageUtilsType = ReturnType<typeof localStorageUtils>;
|
|
11
|
+
|
|
12
|
+
declare const sessionStorageUtils: () => {
|
|
13
|
+
getBrowserSession: () => Promise<string | null>;
|
|
35
14
|
};
|
|
15
|
+
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
interface Global {
|
|
19
|
+
envStore?: EnvStore;
|
|
20
|
+
}
|
|
21
|
+
interface Window {
|
|
22
|
+
envStore?: EnvStore;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
declare class EnvStore {
|
|
26
|
+
private static instance;
|
|
27
|
+
envStore: EnhancedStore | any;
|
|
28
|
+
baseUrl?: string;
|
|
29
|
+
requests?: any;
|
|
30
|
+
context?: any;
|
|
31
|
+
defaultCompany?: any;
|
|
32
|
+
config?: any;
|
|
33
|
+
companies?: any[];
|
|
34
|
+
user?: any;
|
|
35
|
+
db?: string;
|
|
36
|
+
localStorageUtils?: any;
|
|
37
|
+
sessionStorageUtils?: any;
|
|
38
|
+
refreshTokenEndpoint?: string;
|
|
39
|
+
private constructor();
|
|
40
|
+
static getInstance(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
|
|
41
|
+
setup(): void;
|
|
42
|
+
setupEnv(envConfig: Partial<EnvStore>): void;
|
|
43
|
+
setUid(uid: number): void;
|
|
44
|
+
setLang(lang: string): void;
|
|
45
|
+
setAllowCompanies(allowCompanies: number[]): void;
|
|
46
|
+
setCompanies(companies: any[]): void;
|
|
47
|
+
setDefaultCompany(company: any): void;
|
|
48
|
+
setUserInfo(userInfo: any): void;
|
|
49
|
+
}
|
|
50
|
+
declare function initEnv({ envStore, localStorageUtils, sessionStorageUtils, }: {
|
|
51
|
+
envStore: EnhancedStore;
|
|
52
|
+
localStorageUtils?: LocalStorageUtilsType;
|
|
53
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
54
|
+
}): EnvStore;
|
|
55
|
+
declare function getEnv(): EnvStore;
|
|
36
56
|
|
|
37
|
-
export { getEnv,
|
|
57
|
+
export { EnvStore, getEnv, initEnv };
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,37 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
envFile: null;
|
|
15
|
-
requests: {
|
|
16
|
-
get: (url: string, headers?: any) => Promise<any>;
|
|
17
|
-
post: (url: string, body: any, headers?: any) => Promise<any>;
|
|
18
|
-
post_excel: (url: string, body: any, headers?: any) => Promise<any>;
|
|
19
|
-
put: (url: string, body: any, headers?: any) => Promise<any>;
|
|
20
|
-
patch: (url: string, body: any) => Promise<any>;
|
|
21
|
-
delete: (url: string, body: any) => Promise<any>;
|
|
22
|
-
};
|
|
23
|
-
defaultCompany: {
|
|
24
|
-
id: null;
|
|
25
|
-
logo: string;
|
|
26
|
-
secondary_color: string;
|
|
27
|
-
primary_color: string;
|
|
28
|
-
};
|
|
29
|
-
context: {
|
|
30
|
-
uid: null;
|
|
31
|
-
allowed_company_ids: never[];
|
|
32
|
-
lang: string;
|
|
33
|
-
tz: string;
|
|
34
|
-
};
|
|
1
|
+
import { EnhancedStore } from '@reduxjs/toolkit';
|
|
2
|
+
|
|
3
|
+
declare const localStorageUtils: () => {
|
|
4
|
+
setToken: (access_token: string) => Promise<void>;
|
|
5
|
+
setRefreshToken: (refresh_token: string) => Promise<void>;
|
|
6
|
+
getAccessToken: () => Promise<string | null>;
|
|
7
|
+
getRefreshToken: () => Promise<string | null>;
|
|
8
|
+
clearToken: () => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
type LocalStorageUtilsType = ReturnType<typeof localStorageUtils>;
|
|
11
|
+
|
|
12
|
+
declare const sessionStorageUtils: () => {
|
|
13
|
+
getBrowserSession: () => Promise<string | null>;
|
|
35
14
|
};
|
|
15
|
+
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
interface Global {
|
|
19
|
+
envStore?: EnvStore;
|
|
20
|
+
}
|
|
21
|
+
interface Window {
|
|
22
|
+
envStore?: EnvStore;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
declare class EnvStore {
|
|
26
|
+
private static instance;
|
|
27
|
+
envStore: EnhancedStore | any;
|
|
28
|
+
baseUrl?: string;
|
|
29
|
+
requests?: any;
|
|
30
|
+
context?: any;
|
|
31
|
+
defaultCompany?: any;
|
|
32
|
+
config?: any;
|
|
33
|
+
companies?: any[];
|
|
34
|
+
user?: any;
|
|
35
|
+
db?: string;
|
|
36
|
+
localStorageUtils?: any;
|
|
37
|
+
sessionStorageUtils?: any;
|
|
38
|
+
refreshTokenEndpoint?: string;
|
|
39
|
+
private constructor();
|
|
40
|
+
static getInstance(envStore: EnhancedStore, localStorageUtils?: any, sessionStorageUtils?: any): EnvStore;
|
|
41
|
+
setup(): void;
|
|
42
|
+
setupEnv(envConfig: Partial<EnvStore>): void;
|
|
43
|
+
setUid(uid: number): void;
|
|
44
|
+
setLang(lang: string): void;
|
|
45
|
+
setAllowCompanies(allowCompanies: number[]): void;
|
|
46
|
+
setCompanies(companies: any[]): void;
|
|
47
|
+
setDefaultCompany(company: any): void;
|
|
48
|
+
setUserInfo(userInfo: any): void;
|
|
49
|
+
}
|
|
50
|
+
declare function initEnv({ envStore, localStorageUtils, sessionStorageUtils, }: {
|
|
51
|
+
envStore: EnhancedStore;
|
|
52
|
+
localStorageUtils?: LocalStorageUtilsType;
|
|
53
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
54
|
+
}): EnvStore;
|
|
55
|
+
declare function getEnv(): EnvStore;
|
|
36
56
|
|
|
37
|
-
export { getEnv,
|
|
57
|
+
export { EnvStore, getEnv, initEnv };
|