@fctc/interface-logic 3.0.1 → 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 +33 -68
- package/dist/configs.mjs +33 -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 +35 -70
- package/dist/environment.mjs +35 -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 +178 -104
- package/dist/provider.mjs +178 -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,57 +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
|
-
const service = sessionStorage2.getMenuFocus().service || config?.default_service;
|
|
2252
2219
|
const processQueue = (error, token = null) => {
|
|
2253
2220
|
failedQueue?.forEach((prom) => {
|
|
2254
2221
|
if (error) {
|
|
@@ -2403,48 +2370,46 @@ var axiosClient = {
|
|
|
2403
2370
|
function formatUrl(url, db2) {
|
|
2404
2371
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2405
2372
|
}
|
|
2406
|
-
const getBaseUrl = (baseUrl) => {
|
|
2373
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2374
|
+
const service = serviceName || config?.default_service;
|
|
2407
2375
|
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2408
2376
|
};
|
|
2409
|
-
const getHeaders = (header) => {
|
|
2410
|
-
const headers = {
|
|
2411
|
-
...header,
|
|
2412
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2413
|
-
};
|
|
2414
|
-
return headers;
|
|
2415
|
-
};
|
|
2416
2377
|
const responseBody = (response) => response;
|
|
2417
2378
|
const requests = {
|
|
2418
|
-
get: (url, headers) => instance.get(
|
|
2419
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2420
|
-
|
|
2379
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2380
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2381
|
+
headers
|
|
2421
2382
|
).then(responseBody),
|
|
2422
|
-
post: async (url, body, headers) => instance.post(
|
|
2423
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2383
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2384
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2424
2385
|
body,
|
|
2425
|
-
|
|
2386
|
+
headers
|
|
2426
2387
|
).then(responseBody),
|
|
2427
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
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
|
+
}
|
|
2433
2398
|
}
|
|
2434
|
-
|
|
2435
|
-
put: (url, body, headers) => instance.put(
|
|
2436
|
-
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),
|
|
2437
2402
|
body,
|
|
2438
|
-
|
|
2403
|
+
headers
|
|
2439
2404
|
).then(responseBody),
|
|
2440
|
-
patch: (url, body, headers) => instance.patch(
|
|
2441
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2405
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2406
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2442
2407
|
body,
|
|
2443
|
-
|
|
2408
|
+
headers
|
|
2444
2409
|
).then(responseBody),
|
|
2445
|
-
delete: (url, headers) => instance.delete(
|
|
2446
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2447
|
-
|
|
2410
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2411
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2412
|
+
headers
|
|
2448
2413
|
).then(responseBody)
|
|
2449
2414
|
};
|
|
2450
2415
|
return requests;
|
package/dist/configs.mjs
CHANGED
|
@@ -2162,57 +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
|
-
const service = sessionStorage2.getMenuFocus().service || config?.default_service;
|
|
2216
2183
|
const processQueue = (error, token = null) => {
|
|
2217
2184
|
failedQueue?.forEach((prom) => {
|
|
2218
2185
|
if (error) {
|
|
@@ -2367,48 +2334,46 @@ var axiosClient = {
|
|
|
2367
2334
|
function formatUrl(url, db2) {
|
|
2368
2335
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2369
2336
|
}
|
|
2370
|
-
const getBaseUrl = (baseUrl) => {
|
|
2337
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2338
|
+
const service = serviceName || config?.default_service;
|
|
2371
2339
|
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2372
2340
|
};
|
|
2373
|
-
const getHeaders = (header) => {
|
|
2374
|
-
const headers = {
|
|
2375
|
-
...header,
|
|
2376
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2377
|
-
};
|
|
2378
|
-
return headers;
|
|
2379
|
-
};
|
|
2380
2341
|
const responseBody = (response) => response;
|
|
2381
2342
|
const requests = {
|
|
2382
|
-
get: (url, headers) => instance.get(
|
|
2383
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2384
|
-
|
|
2343
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2344
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2345
|
+
headers
|
|
2385
2346
|
).then(responseBody),
|
|
2386
|
-
post: async (url, body, headers) => instance.post(
|
|
2387
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2347
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2348
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2388
2349
|
body,
|
|
2389
|
-
|
|
2350
|
+
headers
|
|
2390
2351
|
).then(responseBody),
|
|
2391
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
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
|
+
}
|
|
2397
2362
|
}
|
|
2398
|
-
|
|
2399
|
-
put: (url, body, headers) => instance.put(
|
|
2400
|
-
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),
|
|
2401
2366
|
body,
|
|
2402
|
-
|
|
2367
|
+
headers
|
|
2403
2368
|
).then(responseBody),
|
|
2404
|
-
patch: (url, body, headers) => instance.patch(
|
|
2405
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2369
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2370
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2406
2371
|
body,
|
|
2407
|
-
|
|
2372
|
+
headers
|
|
2408
2373
|
).then(responseBody),
|
|
2409
|
-
delete: (url, headers) => instance.delete(
|
|
2410
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2411
|
-
|
|
2374
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2375
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2376
|
+
headers
|
|
2412
2377
|
).then(responseBody)
|
|
2413
2378
|
};
|
|
2414
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,57 +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
|
-
const service = sessionStorage2.getMenuFocus().service || config?.default_service;
|
|
2254
2221
|
const processQueue = (error, token = null) => {
|
|
2255
2222
|
failedQueue?.forEach((prom) => {
|
|
2256
2223
|
if (error) {
|
|
@@ -2405,48 +2372,46 @@ var axiosClient = {
|
|
|
2405
2372
|
function formatUrl(url, db2) {
|
|
2406
2373
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2407
2374
|
}
|
|
2408
|
-
const getBaseUrl = (baseUrl) => {
|
|
2375
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
2376
|
+
const service = serviceName || config?.default_service;
|
|
2409
2377
|
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
2410
2378
|
};
|
|
2411
|
-
const getHeaders = (header) => {
|
|
2412
|
-
const headers = {
|
|
2413
|
-
...header,
|
|
2414
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
2415
|
-
};
|
|
2416
|
-
return headers;
|
|
2417
|
-
};
|
|
2418
2379
|
const responseBody = (response) => response;
|
|
2419
2380
|
const requests = {
|
|
2420
|
-
get: (url, headers) => instance.get(
|
|
2421
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2422
|
-
|
|
2381
|
+
get: (url, headers, serviceName) => instance.get(
|
|
2382
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2383
|
+
headers
|
|
2423
2384
|
).then(responseBody),
|
|
2424
|
-
post: async (url, body, headers) => instance.post(
|
|
2425
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2385
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
2386
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2426
2387
|
body,
|
|
2427
|
-
|
|
2388
|
+
headers
|
|
2428
2389
|
).then(responseBody),
|
|
2429
|
-
post_excel: (url, body, headers) => instance.post(
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
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
|
+
}
|
|
2435
2400
|
}
|
|
2436
|
-
|
|
2437
|
-
put: (url, body, headers) => instance.put(
|
|
2438
|
-
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),
|
|
2439
2404
|
body,
|
|
2440
|
-
|
|
2405
|
+
headers
|
|
2441
2406
|
).then(responseBody),
|
|
2442
|
-
patch: (url, body, headers) => instance.patch(
|
|
2443
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2407
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
2408
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2444
2409
|
body,
|
|
2445
|
-
|
|
2410
|
+
headers
|
|
2446
2411
|
).then(responseBody),
|
|
2447
|
-
delete: (url, headers) => instance.delete(
|
|
2448
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
2449
|
-
|
|
2412
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
2413
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
2414
|
+
headers
|
|
2450
2415
|
).then(responseBody)
|
|
2451
2416
|
};
|
|
2452
2417
|
return requests;
|
|
@@ -2473,7 +2438,7 @@ var EnvStore = class {
|
|
|
2473
2438
|
emitter;
|
|
2474
2439
|
localStorageUtil;
|
|
2475
2440
|
sessionStorageUtil;
|
|
2476
|
-
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils) {
|
|
2441
|
+
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils()) {
|
|
2477
2442
|
this.state = {
|
|
2478
2443
|
baseUrl: "",
|
|
2479
2444
|
requests: null,
|
|
@@ -2562,7 +2527,7 @@ var EnvStore = class {
|
|
|
2562
2527
|
var env = null;
|
|
2563
2528
|
function initEnv({
|
|
2564
2529
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
2565
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
2530
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
2566
2531
|
}) {
|
|
2567
2532
|
if (!env) {
|
|
2568
2533
|
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|