@fctc/interface-logic 1.7.5 → 1.7.7

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.
@@ -1,11 +1,9 @@
1
- import { E as EnvState } from './environment-BtoPepkC.mjs';
2
-
3
1
  declare const axiosClient: {
4
- init(config: EnvState): {
5
- get: (url: string, headers: any) => Promise<any>;
6
- post: (url: string, body: any, headers: any) => Promise<any>;
7
- post_excel: (url: string, body: any, headers: any) => Promise<any>;
8
- put: (url: string, body: any, headers: any) => Promise<any>;
2
+ init(config: any): {
3
+ get: (url: string, headers?: any) => Promise<any>;
4
+ post: (url: string, body: any, headers?: any) => Promise<any>;
5
+ post_excel: (url: string, body: any, headers?: any) => Promise<any>;
6
+ put: (url: string, body: any, headers?: any) => Promise<any>;
9
7
  patch: (url: string, body: any) => Promise<any>;
10
8
  delete: (url: string, body: any) => Promise<any>;
11
9
  };
package/dist/configs.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import { E as EnvState } from './environment-BtoPepkC.js';
2
-
3
1
  declare const axiosClient: {
4
- init(config: EnvState): {
5
- get: (url: string, headers: any) => Promise<any>;
6
- post: (url: string, body: any, headers: any) => Promise<any>;
7
- post_excel: (url: string, body: any, headers: any) => Promise<any>;
8
- put: (url: string, body: any, headers: any) => Promise<any>;
2
+ init(config: any): {
3
+ get: (url: string, headers?: any) => Promise<any>;
4
+ post: (url: string, body: any, headers?: any) => Promise<any>;
5
+ post_excel: (url: string, body: any, headers?: any) => Promise<any>;
6
+ put: (url: string, body: any, headers?: any) => Promise<any>;
9
7
  patch: (url: string, body: any) => Promise<any>;
10
8
  delete: (url: string, body: any) => Promise<any>;
11
9
  };
package/dist/configs.js CHANGED
@@ -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
- 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);
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
@@ -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
- 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);
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);
@@ -1 +1,37 @@
1
- export { a as EnvStore, g as getEnv, i as initEnv } from './environment-BtoPepkC.mjs';
1
+ declare function setupEnv(envConfig: any): any;
2
+ declare function getEnv(): {
3
+ requests: {
4
+ get: (url: string, headers?: any) => Promise<any>;
5
+ post: (url: string, body: any, headers?: any) => Promise<any>;
6
+ post_excel: (url: string, body: any, headers?: any) => Promise<any>;
7
+ put: (url: string, body: any, headers?: any) => Promise<any>;
8
+ patch: (url: string, body: any) => Promise<any>;
9
+ delete: (url: string, body: any) => Promise<any>;
10
+ };
11
+ baseUrl: string;
12
+ companies: never[];
13
+ user: {};
14
+ db: string;
15
+ refreshTokenEndpoint: string;
16
+ config: {
17
+ grantType: string;
18
+ clientId: string;
19
+ clientSecret: string;
20
+ redirectUri: string;
21
+ };
22
+ envFile: null;
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
+ };
35
+ };
36
+
37
+ export { getEnv, setupEnv };
@@ -1 +1,37 @@
1
- export { a as EnvStore, g as getEnv, i as initEnv } from './environment-BtoPepkC.js';
1
+ declare function setupEnv(envConfig: any): any;
2
+ declare function getEnv(): {
3
+ requests: {
4
+ get: (url: string, headers?: any) => Promise<any>;
5
+ post: (url: string, body: any, headers?: any) => Promise<any>;
6
+ post_excel: (url: string, body: any, headers?: any) => Promise<any>;
7
+ put: (url: string, body: any, headers?: any) => Promise<any>;
8
+ patch: (url: string, body: any) => Promise<any>;
9
+ delete: (url: string, body: any) => Promise<any>;
10
+ };
11
+ baseUrl: string;
12
+ companies: never[];
13
+ user: {};
14
+ db: string;
15
+ refreshTokenEndpoint: string;
16
+ config: {
17
+ grantType: string;
18
+ clientId: string;
19
+ clientSecret: string;
20
+ redirectUri: string;
21
+ };
22
+ envFile: null;
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
+ };
35
+ };
36
+
37
+ export { getEnv, setupEnv };