@fctc/interface-logic 3.0.2 → 3.0.3
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 +6 -6
- package/dist/configs.d.ts +6 -6
- package/dist/configs.js +34 -68
- package/dist/configs.mjs +34 -68
- package/dist/constants.d.mts +2 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +1 -0
- package/dist/constants.mjs +1 -0
- package/dist/environment.d.mts +5 -8
- package/dist/environment.d.ts +5 -8
- package/dist/environment.js +36 -70
- package/dist/environment.mjs +36 -70
- package/dist/hooks.d.mts +17 -1
- package/dist/hooks.d.ts +17 -1
- package/dist/hooks.js +110 -1
- package/dist/hooks.mjs +108 -1
- package/dist/provider.d.mts +6 -5
- package/dist/provider.d.ts +6 -5
- package/dist/provider.js +179 -104
- package/dist/provider.mjs +179 -104
- package/dist/services.d.mts +14 -0
- package/dist/services.d.ts +14 -0
- package/dist/services.js +64 -1
- package/dist/services.mjs +64 -1
- package/dist/{local-storage-BPvoMGYJ.d.mts → session-storage-ARp_lhTD.d.mts} +6 -1
- package/dist/{local-storage-BPvoMGYJ.d.ts → session-storage-ARp_lhTD.d.ts} +6 -1
- package/dist/utils.d.mts +1 -15
- package/dist/utils.d.ts +1 -15
- package/dist/utils.js +0 -43
- package/dist/utils.mjs +0 -42
- package/package.json +1 -1
package/dist/configs.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const axiosClient: {
|
|
2
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>;
|
|
7
|
-
patch: (url: string, body: any, headers?: any) => Promise<any>;
|
|
8
|
-
delete: (url: string, headers?: any) => Promise<any>;
|
|
3
|
+
get: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/configs.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const axiosClient: {
|
|
2
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>;
|
|
7
|
-
patch: (url: string, body: any, headers?: any) => Promise<any>;
|
|
8
|
-
delete: (url: string, headers?: any) => Promise<any>;
|
|
3
|
+
get: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
4
|
+
post: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
5
|
+
post_excel: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
6
|
+
put: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
7
|
+
patch: (url: string, body: any, headers?: any, serviceName?: string) => Promise<any>;
|
|
8
|
+
delete: (url: string, headers?: any, serviceName?: string) => Promise<any>;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
package/dist/configs.js
CHANGED
|
@@ -2198,56 +2198,24 @@ var localStorageUtils = () => {
|
|
|
2198
2198
|
};
|
|
2199
2199
|
|
|
2200
2200
|
// src/utils/storage/session-storage.ts
|
|
2201
|
-
var sessionStorageUtils =
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2205
|
-
id: void 0,
|
|
2206
|
-
service: ""
|
|
2207
|
-
};
|
|
2208
|
-
};
|
|
2209
|
-
const setMenuFocus = (menuTree) => {
|
|
2210
|
-
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2211
|
-
};
|
|
2212
|
-
const getActionData = () => {
|
|
2213
|
-
const actionData = sessionStorage.getItem("actionData");
|
|
2214
|
-
return actionData ? JSON.parse(actionData) : {};
|
|
2215
|
-
};
|
|
2216
|
-
const setActionData = (actData) => {
|
|
2217
|
-
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2218
|
-
};
|
|
2219
|
-
const getViewData = () => {
|
|
2220
|
-
const viewData = sessionStorage.getItem("viewData");
|
|
2221
|
-
return viewData ? JSON.parse(viewData) : {};
|
|
2222
|
-
};
|
|
2223
|
-
const getBrowserSession = () => {
|
|
2224
|
-
const actionData = sessionStorage.getItem("browserSession");
|
|
2225
|
-
return actionData ? JSON.parse(actionData) : null;
|
|
2226
|
-
};
|
|
2227
|
-
const setViewData = (viewData) => {
|
|
2228
|
-
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2201
|
+
var sessionStorageUtils = () => {
|
|
2202
|
+
const getBrowserSession = async () => {
|
|
2203
|
+
return sessionStorage.getItem("browserSession");
|
|
2229
2204
|
};
|
|
2230
2205
|
return {
|
|
2231
|
-
getMenuFocus,
|
|
2232
|
-
setMenuFocus,
|
|
2233
|
-
setActionData,
|
|
2234
|
-
getActionData,
|
|
2235
|
-
getViewData,
|
|
2236
|
-
setViewData,
|
|
2237
2206
|
getBrowserSession
|
|
2238
2207
|
};
|
|
2239
|
-
}
|
|
2208
|
+
};
|
|
2240
2209
|
|
|
2241
2210
|
// src/configs/axios-client.ts
|
|
2242
2211
|
var axiosClient = {
|
|
2243
2212
|
init(config) {
|
|
2244
2213
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2245
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2214
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2246
2215
|
const db = config?.db;
|
|
2247
2216
|
const database = config?.config?.database;
|
|
2248
2217
|
let isRefreshing = false;
|
|
2249
2218
|
let failedQueue = [];
|
|
2250
|
-
const xNode = config?.xNode;
|
|
2251
2219
|
const processQueue = (error, token = null) => {
|
|
2252
2220
|
failedQueue?.forEach((prom) => {
|
|
2253
2221
|
if (error) {
|
|
@@ -2402,48 +2370,46 @@ var axiosClient = {
|
|
|
2402
2370
|
function formatUrl(url, db2) {
|
|
2403
2371
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2404
2372
|
}
|
|
2405
|
-
const getBaseUrl = (baseUrl) => {
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
const getHeaders = (header) => {
|
|
2409
|
-
const headers = {
|
|
2410
|
-
...header,
|
|
2411
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2412
|
-
};
|
|
2413
|
-
return headers;
|
|
2373
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2374
|
+
const service = serviceName || config?.default_service;
|
|
2375
|
+
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2414
2376
|
};
|
|
2415
2377
|
const responseBody = (response) => response;
|
|
2416
2378
|
const requests = {
|
|
2417
|
-
get: (url, headers) => instance.get(
|
|
2418
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2419
|
-
|
|
2379
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2380
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2381
|
+
headers
|
|
2420
2382
|
).then(responseBody),
|
|
2421
|
-
post: async (url, body, headers) => instance.post(
|
|
2422
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2383
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2384
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2423
2385
|
body,
|
|
2424
|
-
|
|
2386
|
+
headers
|
|
2425
2387
|
).then(responseBody),
|
|
2426
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2388
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2389
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2390
|
+
body,
|
|
2391
|
+
{
|
|
2392
|
+
responseType: "arraybuffer",
|
|
2393
|
+
headers: {
|
|
2394
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2395
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2396
|
+
...headers
|
|
2397
|
+
}
|
|
2432
2398
|
}
|
|
2433
|
-
|
|
2434
|
-
put: (url, body, headers) => instance.put(
|
|
2435
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2399
|
+
).then(responseBody),
|
|
2400
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2401
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2436
2402
|
body,
|
|
2437
|
-
|
|
2403
|
+
headers
|
|
2438
2404
|
).then(responseBody),
|
|
2439
|
-
patch: (url, body, headers) => instance.patch(
|
|
2440
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2405
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2406
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2441
2407
|
body,
|
|
2442
|
-
|
|
2408
|
+
headers
|
|
2443
2409
|
).then(responseBody),
|
|
2444
|
-
delete: (url, headers) => instance.delete(
|
|
2445
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2446
|
-
|
|
2410
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2411
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2412
|
+
headers
|
|
2447
2413
|
).then(responseBody)
|
|
2448
2414
|
};
|
|
2449
2415
|
return requests;
|
package/dist/configs.mjs
CHANGED
|
@@ -2162,56 +2162,24 @@ var localStorageUtils = () => {
|
|
|
2162
2162
|
};
|
|
2163
2163
|
|
|
2164
2164
|
// src/utils/storage/session-storage.ts
|
|
2165
|
-
var sessionStorageUtils =
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2169
|
-
id: void 0,
|
|
2170
|
-
service: ""
|
|
2171
|
-
};
|
|
2172
|
-
};
|
|
2173
|
-
const setMenuFocus = (menuTree) => {
|
|
2174
|
-
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2175
|
-
};
|
|
2176
|
-
const getActionData = () => {
|
|
2177
|
-
const actionData = sessionStorage.getItem("actionData");
|
|
2178
|
-
return actionData ? JSON.parse(actionData) : {};
|
|
2179
|
-
};
|
|
2180
|
-
const setActionData = (actData) => {
|
|
2181
|
-
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2182
|
-
};
|
|
2183
|
-
const getViewData = () => {
|
|
2184
|
-
const viewData = sessionStorage.getItem("viewData");
|
|
2185
|
-
return viewData ? JSON.parse(viewData) : {};
|
|
2186
|
-
};
|
|
2187
|
-
const getBrowserSession = () => {
|
|
2188
|
-
const actionData = sessionStorage.getItem("browserSession");
|
|
2189
|
-
return actionData ? JSON.parse(actionData) : null;
|
|
2190
|
-
};
|
|
2191
|
-
const setViewData = (viewData) => {
|
|
2192
|
-
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2165
|
+
var sessionStorageUtils = () => {
|
|
2166
|
+
const getBrowserSession = async () => {
|
|
2167
|
+
return sessionStorage.getItem("browserSession");
|
|
2193
2168
|
};
|
|
2194
2169
|
return {
|
|
2195
|
-
getMenuFocus,
|
|
2196
|
-
setMenuFocus,
|
|
2197
|
-
setActionData,
|
|
2198
|
-
getActionData,
|
|
2199
|
-
getViewData,
|
|
2200
|
-
setViewData,
|
|
2201
2170
|
getBrowserSession
|
|
2202
2171
|
};
|
|
2203
|
-
}
|
|
2172
|
+
};
|
|
2204
2173
|
|
|
2205
2174
|
// src/configs/axios-client.ts
|
|
2206
2175
|
var axiosClient = {
|
|
2207
2176
|
init(config) {
|
|
2208
2177
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2209
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2178
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2210
2179
|
const db = config?.db;
|
|
2211
2180
|
const database = config?.config?.database;
|
|
2212
2181
|
let isRefreshing = false;
|
|
2213
2182
|
let failedQueue = [];
|
|
2214
|
-
const xNode = config?.xNode;
|
|
2215
2183
|
const processQueue = (error, token = null) => {
|
|
2216
2184
|
failedQueue?.forEach((prom) => {
|
|
2217
2185
|
if (error) {
|
|
@@ -2366,48 +2334,46 @@ var axiosClient = {
|
|
|
2366
2334
|
function formatUrl(url, db2) {
|
|
2367
2335
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2368
2336
|
}
|
|
2369
|
-
const getBaseUrl = (baseUrl) => {
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
const getHeaders = (header) => {
|
|
2373
|
-
const headers = {
|
|
2374
|
-
...header,
|
|
2375
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2376
|
-
};
|
|
2377
|
-
return headers;
|
|
2337
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2338
|
+
const service = serviceName || config?.default_service;
|
|
2339
|
+
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2378
2340
|
};
|
|
2379
2341
|
const responseBody = (response) => response;
|
|
2380
2342
|
const requests = {
|
|
2381
|
-
get: (url, headers) => instance.get(
|
|
2382
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2383
|
-
|
|
2343
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2344
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2345
|
+
headers
|
|
2384
2346
|
).then(responseBody),
|
|
2385
|
-
post: async (url, body, headers) => instance.post(
|
|
2386
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2347
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2348
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2387
2349
|
body,
|
|
2388
|
-
|
|
2350
|
+
headers
|
|
2389
2351
|
).then(responseBody),
|
|
2390
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2352
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2353
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2354
|
+
body,
|
|
2355
|
+
{
|
|
2356
|
+
responseType: "arraybuffer",
|
|
2357
|
+
headers: {
|
|
2358
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2359
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2360
|
+
...headers
|
|
2361
|
+
}
|
|
2396
2362
|
}
|
|
2397
|
-
|
|
2398
|
-
put: (url, body, headers) => instance.put(
|
|
2399
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2363
|
+
).then(responseBody),
|
|
2364
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2365
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2400
2366
|
body,
|
|
2401
|
-
|
|
2367
|
+
headers
|
|
2402
2368
|
).then(responseBody),
|
|
2403
|
-
patch: (url, body, headers) => instance.patch(
|
|
2404
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2369
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2370
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2405
2371
|
body,
|
|
2406
|
-
|
|
2372
|
+
headers
|
|
2407
2373
|
).then(responseBody),
|
|
2408
|
-
delete: (url, headers) => instance.delete(
|
|
2409
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2410
|
-
|
|
2374
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2375
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2376
|
+
headers
|
|
2411
2377
|
).then(responseBody)
|
|
2412
2378
|
};
|
|
2413
2379
|
return requests;
|
package/dist/constants.d.mts
CHANGED
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -65,6 +65,7 @@ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
|
|
|
65
65
|
MethodConstants2["CREATE"] = "create";
|
|
66
66
|
MethodConstants2["LOAD_DATA"] = "load_data";
|
|
67
67
|
MethodConstants2["CHECK"] = "check";
|
|
68
|
+
MethodConstants2["GET_CLOSING_CONTROL_DATA"] = "get_closing_control_data";
|
|
68
69
|
return MethodConstants2;
|
|
69
70
|
})(MethodConstants || {});
|
|
70
71
|
|
package/dist/constants.mjs
CHANGED
|
@@ -27,6 +27,7 @@ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
|
|
|
27
27
|
MethodConstants2["CREATE"] = "create";
|
|
28
28
|
MethodConstants2["LOAD_DATA"] = "load_data";
|
|
29
29
|
MethodConstants2["CHECK"] = "check";
|
|
30
|
+
MethodConstants2["GET_CLOSING_CONTROL_DATA"] = "get_closing_control_data";
|
|
30
31
|
return MethodConstants2;
|
|
31
32
|
})(MethodConstants || {});
|
|
32
33
|
|
package/dist/environment.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { L as LocalStorageUtilsType } from './
|
|
1
|
+
import { L as LocalStorageUtilsType, S as SessionStorageUtilsType } from './session-storage-ARp_lhTD.mjs';
|
|
2
2
|
|
|
3
3
|
interface EnvConfig {
|
|
4
|
-
env?: any;
|
|
5
4
|
baseUrl?: string;
|
|
6
5
|
requests?: any;
|
|
7
6
|
context?: {
|
|
@@ -16,16 +15,14 @@ interface EnvConfig {
|
|
|
16
15
|
secondary_color?: string;
|
|
17
16
|
primary_color?: string;
|
|
18
17
|
};
|
|
19
|
-
database?: string;
|
|
20
|
-
xNode?: string;
|
|
21
|
-
default_service?: string;
|
|
22
18
|
config?: any;
|
|
23
19
|
companies?: any[];
|
|
24
20
|
user?: any;
|
|
25
21
|
db?: string;
|
|
22
|
+
database?: string;
|
|
26
23
|
refreshTokenEndpoint?: string;
|
|
27
24
|
localStorageUtils?: LocalStorageUtilsType;
|
|
28
|
-
sessionStorageUtils?:
|
|
25
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
29
26
|
envFile?: any;
|
|
30
27
|
}
|
|
31
28
|
declare class EnvStore {
|
|
@@ -33,7 +30,7 @@ declare class EnvStore {
|
|
|
33
30
|
private emitter;
|
|
34
31
|
private localStorageUtil;
|
|
35
32
|
private sessionStorageUtil;
|
|
36
|
-
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?:
|
|
33
|
+
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: SessionStorageUtilsType);
|
|
37
34
|
getEnv(): EnvConfig;
|
|
38
35
|
onUpdate(callback: (env: EnvConfig) => void): void;
|
|
39
36
|
setupEnv(envConfig: Partial<EnvConfig>): EnvConfig;
|
|
@@ -48,7 +45,7 @@ declare class EnvStore {
|
|
|
48
45
|
}
|
|
49
46
|
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
50
47
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
|
-
sessionStorageUtils?:
|
|
48
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
52
49
|
}): EnvStore;
|
|
53
50
|
declare function getEnv(): any;
|
|
54
51
|
|
package/dist/environment.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { L as LocalStorageUtilsType } from './
|
|
1
|
+
import { L as LocalStorageUtilsType, S as SessionStorageUtilsType } from './session-storage-ARp_lhTD.js';
|
|
2
2
|
|
|
3
3
|
interface EnvConfig {
|
|
4
|
-
env?: any;
|
|
5
4
|
baseUrl?: string;
|
|
6
5
|
requests?: any;
|
|
7
6
|
context?: {
|
|
@@ -16,16 +15,14 @@ interface EnvConfig {
|
|
|
16
15
|
secondary_color?: string;
|
|
17
16
|
primary_color?: string;
|
|
18
17
|
};
|
|
19
|
-
database?: string;
|
|
20
|
-
xNode?: string;
|
|
21
|
-
default_service?: string;
|
|
22
18
|
config?: any;
|
|
23
19
|
companies?: any[];
|
|
24
20
|
user?: any;
|
|
25
21
|
db?: string;
|
|
22
|
+
database?: string;
|
|
26
23
|
refreshTokenEndpoint?: string;
|
|
27
24
|
localStorageUtils?: LocalStorageUtilsType;
|
|
28
|
-
sessionStorageUtils?:
|
|
25
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
29
26
|
envFile?: any;
|
|
30
27
|
}
|
|
31
28
|
declare class EnvStore {
|
|
@@ -33,7 +30,7 @@ declare class EnvStore {
|
|
|
33
30
|
private emitter;
|
|
34
31
|
private localStorageUtil;
|
|
35
32
|
private sessionStorageUtil;
|
|
36
|
-
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?:
|
|
33
|
+
constructor(localStorageUtil?: LocalStorageUtilsType, sessionStorageUtil?: SessionStorageUtilsType);
|
|
37
34
|
getEnv(): EnvConfig;
|
|
38
35
|
onUpdate(callback: (env: EnvConfig) => void): void;
|
|
39
36
|
setupEnv(envConfig: Partial<EnvConfig>): EnvConfig;
|
|
@@ -48,7 +45,7 @@ declare class EnvStore {
|
|
|
48
45
|
}
|
|
49
46
|
declare function initEnv({ localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
50
47
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
|
-
sessionStorageUtils?:
|
|
48
|
+
sessionStorageUtils?: SessionStorageUtilsType;
|
|
52
49
|
}): EnvStore;
|
|
53
50
|
declare function getEnv(): any;
|
|
54
51
|
|
package/dist/environment.js
CHANGED
|
@@ -2200,56 +2200,24 @@ var localStorageUtils = () => {
|
|
|
2200
2200
|
};
|
|
2201
2201
|
|
|
2202
2202
|
// src/utils/storage/session-storage.ts
|
|
2203
|
-
var sessionStorageUtils =
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2207
|
-
id: void 0,
|
|
2208
|
-
service: ""
|
|
2209
|
-
};
|
|
2210
|
-
};
|
|
2211
|
-
const setMenuFocus = (menuTree) => {
|
|
2212
|
-
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2213
|
-
};
|
|
2214
|
-
const getActionData = () => {
|
|
2215
|
-
const actionData = sessionStorage.getItem("actionData");
|
|
2216
|
-
return actionData ? JSON.parse(actionData) : {};
|
|
2217
|
-
};
|
|
2218
|
-
const setActionData = (actData) => {
|
|
2219
|
-
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2220
|
-
};
|
|
2221
|
-
const getViewData = () => {
|
|
2222
|
-
const viewData = sessionStorage.getItem("viewData");
|
|
2223
|
-
return viewData ? JSON.parse(viewData) : {};
|
|
2224
|
-
};
|
|
2225
|
-
const getBrowserSession = () => {
|
|
2226
|
-
const actionData = sessionStorage.getItem("browserSession");
|
|
2227
|
-
return actionData ? JSON.parse(actionData) : null;
|
|
2228
|
-
};
|
|
2229
|
-
const setViewData = (viewData) => {
|
|
2230
|
-
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2203
|
+
var sessionStorageUtils = () => {
|
|
2204
|
+
const getBrowserSession = async () => {
|
|
2205
|
+
return sessionStorage.getItem("browserSession");
|
|
2231
2206
|
};
|
|
2232
2207
|
return {
|
|
2233
|
-
getMenuFocus,
|
|
2234
|
-
setMenuFocus,
|
|
2235
|
-
setActionData,
|
|
2236
|
-
getActionData,
|
|
2237
|
-
getViewData,
|
|
2238
|
-
setViewData,
|
|
2239
2208
|
getBrowserSession
|
|
2240
2209
|
};
|
|
2241
|
-
}
|
|
2210
|
+
};
|
|
2242
2211
|
|
|
2243
2212
|
// src/configs/axios-client.ts
|
|
2244
2213
|
var axiosClient = {
|
|
2245
2214
|
init(config) {
|
|
2246
2215
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
2247
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
2216
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
2248
2217
|
const db = config?.db;
|
|
2249
2218
|
const database = config?.config?.database;
|
|
2250
2219
|
let isRefreshing = false;
|
|
2251
2220
|
let failedQueue = [];
|
|
2252
|
-
const xNode = config?.xNode;
|
|
2253
2221
|
const processQueue = (error, token = null) => {
|
|
2254
2222
|
failedQueue?.forEach((prom) => {
|
|
2255
2223
|
if (error) {
|
|
@@ -2404,48 +2372,46 @@ var axiosClient = {
|
|
|
2404
2372
|
function formatUrl(url, db2) {
|
|
2405
2373
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2406
2374
|
}
|
|
2407
|
-
const getBaseUrl = (baseUrl) => {
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
const getHeaders = (header) => {
|
|
2411
|
-
const headers = {
|
|
2412
|
-
...header,
|
|
2413
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2414
|
-
};
|
|
2415
|
-
return headers;
|
|
2375
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2376
|
+
const service = serviceName || config?.default_service;
|
|
2377
|
+
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2416
2378
|
};
|
|
2417
2379
|
const responseBody = (response) => response;
|
|
2418
2380
|
const requests = {
|
|
2419
|
-
get: (url, headers) => instance.get(
|
|
2420
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2421
|
-
|
|
2381
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2382
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2383
|
+
headers
|
|
2422
2384
|
).then(responseBody),
|
|
2423
|
-
post: async (url, body, headers) => instance.post(
|
|
2424
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2385
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2386
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2425
2387
|
body,
|
|
2426
|
-
|
|
2388
|
+
headers
|
|
2427
2389
|
).then(responseBody),
|
|
2428
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2390
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
2391
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2392
|
+
body,
|
|
2393
|
+
{
|
|
2394
|
+
responseType: "arraybuffer",
|
|
2395
|
+
headers: {
|
|
2396
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2397
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
2398
|
+
...headers
|
|
2399
|
+
}
|
|
2434
2400
|
}
|
|
2435
|
-
|
|
2436
|
-
put: (url, body, headers) => instance.put(
|
|
2437
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2401
|
+
).then(responseBody),
|
|
2402
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
2403
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2438
2404
|
body,
|
|
2439
|
-
|
|
2405
|
+
headers
|
|
2440
2406
|
).then(responseBody),
|
|
2441
|
-
patch: (url, body, headers) => instance.patch(
|
|
2442
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2407
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2408
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2443
2409
|
body,
|
|
2444
|
-
|
|
2410
|
+
headers
|
|
2445
2411
|
).then(responseBody),
|
|
2446
|
-
delete: (url, headers) => instance.delete(
|
|
2447
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2448
|
-
|
|
2412
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2413
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2414
|
+
headers
|
|
2449
2415
|
).then(responseBody)
|
|
2450
2416
|
};
|
|
2451
2417
|
return requests;
|
|
@@ -2472,7 +2438,7 @@ var EnvStore = class {
|
|
|
2472
2438
|
emitter;
|
|
2473
2439
|
localStorageUtil;
|
|
2474
2440
|
sessionStorageUtil;
|
|
2475
|
-
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils) {
|
|
2441
|
+
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils()) {
|
|
2476
2442
|
this.state = {
|
|
2477
2443
|
baseUrl: "",
|
|
2478
2444
|
requests: null,
|
|
@@ -2561,7 +2527,7 @@ var EnvStore = class {
|
|
|
2561
2527
|
var env = null;
|
|
2562
2528
|
function initEnv({
|
|
2563
2529
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
2564
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
2530
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
2565
2531
|
}) {
|
|
2566
2532
|
if (!env) {
|
|
2567
2533
|
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|