@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/provider.js
CHANGED
|
@@ -2892,74 +2892,6 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
2892
2892
|
return originalRequest.data;
|
|
2893
2893
|
};
|
|
2894
2894
|
|
|
2895
|
-
// src/utils/storage/local-storage.ts
|
|
2896
|
-
var localStorageUtils = () => {
|
|
2897
|
-
const setToken = async (access_token) => {
|
|
2898
|
-
localStorage.setItem("accessToken", access_token);
|
|
2899
|
-
};
|
|
2900
|
-
const setRefreshToken = async (refresh_token) => {
|
|
2901
|
-
localStorage.setItem("refreshToken", refresh_token);
|
|
2902
|
-
};
|
|
2903
|
-
const getAccessToken = async () => {
|
|
2904
|
-
return localStorage.getItem("accessToken");
|
|
2905
|
-
};
|
|
2906
|
-
const getRefreshToken = async () => {
|
|
2907
|
-
return localStorage.getItem("refreshToken");
|
|
2908
|
-
};
|
|
2909
|
-
const clearToken = async () => {
|
|
2910
|
-
localStorage.removeItem("accessToken");
|
|
2911
|
-
localStorage.removeItem("refreshToken");
|
|
2912
|
-
};
|
|
2913
|
-
return {
|
|
2914
|
-
setToken,
|
|
2915
|
-
setRefreshToken,
|
|
2916
|
-
getAccessToken,
|
|
2917
|
-
getRefreshToken,
|
|
2918
|
-
clearToken
|
|
2919
|
-
};
|
|
2920
|
-
};
|
|
2921
|
-
|
|
2922
|
-
// src/utils/storage/session-storage.ts
|
|
2923
|
-
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
2924
|
-
const getMenuFocus = () => {
|
|
2925
|
-
const menuFocus = sessionStorage.getItem("menuFocus");
|
|
2926
|
-
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2927
|
-
id: void 0,
|
|
2928
|
-
service: ""
|
|
2929
|
-
};
|
|
2930
|
-
};
|
|
2931
|
-
const setMenuFocus2 = (menuTree) => {
|
|
2932
|
-
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2933
|
-
};
|
|
2934
|
-
const getActionData = () => {
|
|
2935
|
-
const actionData = sessionStorage.getItem("actionData");
|
|
2936
|
-
return actionData ? JSON.parse(actionData) : {};
|
|
2937
|
-
};
|
|
2938
|
-
const setActionData = (actData) => {
|
|
2939
|
-
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2940
|
-
};
|
|
2941
|
-
const getViewData = () => {
|
|
2942
|
-
const viewData = sessionStorage.getItem("viewData");
|
|
2943
|
-
return viewData ? JSON.parse(viewData) : {};
|
|
2944
|
-
};
|
|
2945
|
-
const getBrowserSession = () => {
|
|
2946
|
-
const actionData = sessionStorage.getItem("browserSession");
|
|
2947
|
-
return actionData ? JSON.parse(actionData) : null;
|
|
2948
|
-
};
|
|
2949
|
-
const setViewData = (viewData) => {
|
|
2950
|
-
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2951
|
-
};
|
|
2952
|
-
return {
|
|
2953
|
-
getMenuFocus,
|
|
2954
|
-
setMenuFocus: setMenuFocus2,
|
|
2955
|
-
setActionData,
|
|
2956
|
-
getActionData,
|
|
2957
|
-
getViewData,
|
|
2958
|
-
setViewData,
|
|
2959
|
-
getBrowserSession
|
|
2960
|
-
};
|
|
2961
|
-
})();
|
|
2962
|
-
|
|
2963
2895
|
// src/services/action-service/index.ts
|
|
2964
2896
|
function useActionService() {
|
|
2965
2897
|
const { env } = useEnv();
|
|
@@ -5212,6 +5144,61 @@ function useViewService() {
|
|
|
5212
5144
|
},
|
|
5213
5145
|
[env]
|
|
5214
5146
|
);
|
|
5147
|
+
const getDataCloseSession = (0, import_react10.useCallback)(
|
|
5148
|
+
({
|
|
5149
|
+
model,
|
|
5150
|
+
ids,
|
|
5151
|
+
xNode,
|
|
5152
|
+
service
|
|
5153
|
+
}) => {
|
|
5154
|
+
const jsonData = {
|
|
5155
|
+
model,
|
|
5156
|
+
ids,
|
|
5157
|
+
method: "get_closing_control_data" /* GET_CLOSING_CONTROL_DATA */
|
|
5158
|
+
};
|
|
5159
|
+
return env?.requests.post(
|
|
5160
|
+
"/call" /* CALL_PATH */,
|
|
5161
|
+
jsonData,
|
|
5162
|
+
{
|
|
5163
|
+
headers: {
|
|
5164
|
+
"Content-Type": "application/json",
|
|
5165
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
5166
|
+
}
|
|
5167
|
+
},
|
|
5168
|
+
service
|
|
5169
|
+
);
|
|
5170
|
+
},
|
|
5171
|
+
[env]
|
|
5172
|
+
);
|
|
5173
|
+
const getDetailEntity = (0, import_react10.useCallback)(
|
|
5174
|
+
({
|
|
5175
|
+
model,
|
|
5176
|
+
ids,
|
|
5177
|
+
method,
|
|
5178
|
+
xNode,
|
|
5179
|
+
service,
|
|
5180
|
+
kwargs
|
|
5181
|
+
}) => {
|
|
5182
|
+
const jsonData = {
|
|
5183
|
+
model,
|
|
5184
|
+
ids,
|
|
5185
|
+
method,
|
|
5186
|
+
kwargs
|
|
5187
|
+
};
|
|
5188
|
+
return env?.requests.post(
|
|
5189
|
+
"/call" /* CALL_PATH */,
|
|
5190
|
+
jsonData,
|
|
5191
|
+
{
|
|
5192
|
+
headers: {
|
|
5193
|
+
"Content-Type": "application/json",
|
|
5194
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
5195
|
+
}
|
|
5196
|
+
},
|
|
5197
|
+
service
|
|
5198
|
+
);
|
|
5199
|
+
},
|
|
5200
|
+
[env]
|
|
5201
|
+
);
|
|
5215
5202
|
return {
|
|
5216
5203
|
getView,
|
|
5217
5204
|
getMenu,
|
|
@@ -5243,7 +5230,9 @@ function useViewService() {
|
|
|
5243
5230
|
getOrderLine,
|
|
5244
5231
|
getProductImage,
|
|
5245
5232
|
addEntity,
|
|
5246
|
-
checkPayment
|
|
5233
|
+
checkPayment,
|
|
5234
|
+
getDataCloseSession,
|
|
5235
|
+
getDetailEntity
|
|
5247
5236
|
};
|
|
5248
5237
|
}
|
|
5249
5238
|
|
|
@@ -5288,16 +5277,53 @@ var import_react12 = require("react");
|
|
|
5288
5277
|
|
|
5289
5278
|
// src/configs/axios-client.ts
|
|
5290
5279
|
var import_axios = __toESM(require("axios"));
|
|
5280
|
+
|
|
5281
|
+
// src/utils/storage/local-storage.ts
|
|
5282
|
+
var localStorageUtils = () => {
|
|
5283
|
+
const setToken = async (access_token) => {
|
|
5284
|
+
localStorage.setItem("accessToken", access_token);
|
|
5285
|
+
};
|
|
5286
|
+
const setRefreshToken = async (refresh_token) => {
|
|
5287
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
5288
|
+
};
|
|
5289
|
+
const getAccessToken = async () => {
|
|
5290
|
+
return localStorage.getItem("accessToken");
|
|
5291
|
+
};
|
|
5292
|
+
const getRefreshToken = async () => {
|
|
5293
|
+
return localStorage.getItem("refreshToken");
|
|
5294
|
+
};
|
|
5295
|
+
const clearToken = async () => {
|
|
5296
|
+
localStorage.removeItem("accessToken");
|
|
5297
|
+
localStorage.removeItem("refreshToken");
|
|
5298
|
+
};
|
|
5299
|
+
return {
|
|
5300
|
+
setToken,
|
|
5301
|
+
setRefreshToken,
|
|
5302
|
+
getAccessToken,
|
|
5303
|
+
getRefreshToken,
|
|
5304
|
+
clearToken
|
|
5305
|
+
};
|
|
5306
|
+
};
|
|
5307
|
+
|
|
5308
|
+
// src/utils/storage/session-storage.ts
|
|
5309
|
+
var sessionStorageUtils = () => {
|
|
5310
|
+
const getBrowserSession = async () => {
|
|
5311
|
+
return sessionStorage.getItem("browserSession");
|
|
5312
|
+
};
|
|
5313
|
+
return {
|
|
5314
|
+
getBrowserSession
|
|
5315
|
+
};
|
|
5316
|
+
};
|
|
5317
|
+
|
|
5318
|
+
// src/configs/axios-client.ts
|
|
5291
5319
|
var axiosClient = {
|
|
5292
5320
|
init(config) {
|
|
5293
5321
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
5294
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
5322
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
5295
5323
|
const db = config?.db;
|
|
5296
5324
|
const database = config?.config?.database;
|
|
5297
5325
|
let isRefreshing = false;
|
|
5298
5326
|
let failedQueue = [];
|
|
5299
|
-
const xNode = config?.xNode;
|
|
5300
|
-
const service = sessionStorage2.getMenuFocus().service || config?.default_service;
|
|
5301
5327
|
const processQueue = (error, token = null) => {
|
|
5302
5328
|
failedQueue?.forEach((prom) => {
|
|
5303
5329
|
if (error) {
|
|
@@ -5452,48 +5478,46 @@ var axiosClient = {
|
|
|
5452
5478
|
function formatUrl(url, db2) {
|
|
5453
5479
|
return url + (db2 ? "?db=" + db2 : "");
|
|
5454
5480
|
}
|
|
5455
|
-
const getBaseUrl = (baseUrl) => {
|
|
5481
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
5482
|
+
const service = serviceName || config?.default_service;
|
|
5456
5483
|
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
5457
5484
|
};
|
|
5458
|
-
const getHeaders = (header) => {
|
|
5459
|
-
const headers = {
|
|
5460
|
-
...header,
|
|
5461
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
5462
|
-
};
|
|
5463
|
-
return headers;
|
|
5464
|
-
};
|
|
5465
5485
|
const responseBody = (response) => response;
|
|
5466
5486
|
const requests = {
|
|
5467
|
-
get: (url, headers) => instance.get(
|
|
5468
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5469
|
-
|
|
5487
|
+
get: (url, headers, serviceName) => instance.get(
|
|
5488
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5489
|
+
headers
|
|
5470
5490
|
).then(responseBody),
|
|
5471
|
-
post: async (url, body, headers) => instance.post(
|
|
5472
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5491
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
5492
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5473
5493
|
body,
|
|
5474
|
-
|
|
5494
|
+
headers
|
|
5475
5495
|
).then(responseBody),
|
|
5476
|
-
post_excel: (url, body, headers) => instance.post(
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5496
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
5497
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5498
|
+
body,
|
|
5499
|
+
{
|
|
5500
|
+
responseType: "arraybuffer",
|
|
5501
|
+
headers: {
|
|
5502
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
5503
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5504
|
+
...headers
|
|
5505
|
+
}
|
|
5482
5506
|
}
|
|
5483
|
-
|
|
5484
|
-
put: (url, body, headers) => instance.put(
|
|
5485
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5507
|
+
).then(responseBody),
|
|
5508
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
5509
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5486
5510
|
body,
|
|
5487
|
-
|
|
5511
|
+
headers
|
|
5488
5512
|
).then(responseBody),
|
|
5489
|
-
patch: (url, body, headers) => instance.patch(
|
|
5490
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5513
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
5514
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5491
5515
|
body,
|
|
5492
|
-
|
|
5516
|
+
headers
|
|
5493
5517
|
).then(responseBody),
|
|
5494
|
-
delete: (url, headers) => instance.delete(
|
|
5495
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5496
|
-
|
|
5518
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
5519
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5520
|
+
headers
|
|
5497
5521
|
).then(responseBody)
|
|
5498
5522
|
};
|
|
5499
5523
|
return requests;
|
|
@@ -5527,7 +5551,7 @@ var EnvContext = (0, import_react12.createContext)(null);
|
|
|
5527
5551
|
function EnvProvider({
|
|
5528
5552
|
children,
|
|
5529
5553
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
5530
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
5554
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
5531
5555
|
}) {
|
|
5532
5556
|
const [env, setEnvState] = (0, import_react12.useState)({
|
|
5533
5557
|
...initialEnvState,
|
|
@@ -7403,6 +7427,54 @@ var useCheckPayment = () => {
|
|
|
7403
7427
|
};
|
|
7404
7428
|
var use_check_payment_default = useCheckPayment;
|
|
7405
7429
|
|
|
7430
|
+
// src/hooks/view/use-get-data-close-session.ts
|
|
7431
|
+
var import_react_query87 = require("@tanstack/react-query");
|
|
7432
|
+
var useGetDataCloseSession = () => {
|
|
7433
|
+
const { getDataCloseSession } = useViewService();
|
|
7434
|
+
return (0, import_react_query87.useMutation)({
|
|
7435
|
+
mutationFn: ({
|
|
7436
|
+
model,
|
|
7437
|
+
ids,
|
|
7438
|
+
xNode,
|
|
7439
|
+
service
|
|
7440
|
+
}) => {
|
|
7441
|
+
return getDataCloseSession({
|
|
7442
|
+
model,
|
|
7443
|
+
ids,
|
|
7444
|
+
xNode,
|
|
7445
|
+
service
|
|
7446
|
+
});
|
|
7447
|
+
}
|
|
7448
|
+
});
|
|
7449
|
+
};
|
|
7450
|
+
var use_get_data_close_session_default = useGetDataCloseSession;
|
|
7451
|
+
|
|
7452
|
+
// src/hooks/view/use-get-detail-entity.ts
|
|
7453
|
+
var import_react_query88 = require("@tanstack/react-query");
|
|
7454
|
+
var useGetDetailEntity = () => {
|
|
7455
|
+
const { getDetailEntity } = useViewService();
|
|
7456
|
+
return (0, import_react_query88.useMutation)({
|
|
7457
|
+
mutationFn: ({
|
|
7458
|
+
model,
|
|
7459
|
+
ids,
|
|
7460
|
+
method,
|
|
7461
|
+
xNode,
|
|
7462
|
+
service,
|
|
7463
|
+
kwargs
|
|
7464
|
+
}) => {
|
|
7465
|
+
return getDetailEntity({
|
|
7466
|
+
model,
|
|
7467
|
+
ids,
|
|
7468
|
+
method,
|
|
7469
|
+
xNode,
|
|
7470
|
+
service,
|
|
7471
|
+
kwargs
|
|
7472
|
+
});
|
|
7473
|
+
}
|
|
7474
|
+
});
|
|
7475
|
+
};
|
|
7476
|
+
var use_get_detail_entity_default = useGetDetailEntity;
|
|
7477
|
+
|
|
7406
7478
|
// src/provider/service-provider.tsx
|
|
7407
7479
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
7408
7480
|
var ServiceContext = (0, import_react13.createContext)(null);
|
|
@@ -7495,7 +7567,9 @@ var ServiceProvider = ({
|
|
|
7495
7567
|
useGetOrderLine: use_get_order_line_default,
|
|
7496
7568
|
useGetProductImage: use_get_product_image_default,
|
|
7497
7569
|
useAddEntity: use_add_entity_default,
|
|
7498
|
-
useCheckPayment: use_check_payment_default
|
|
7570
|
+
useCheckPayment: use_check_payment_default,
|
|
7571
|
+
useGetDataCloseSession: use_get_data_close_session_default,
|
|
7572
|
+
useGetDetailEntity: use_get_detail_entity_default
|
|
7499
7573
|
};
|
|
7500
7574
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ServiceContext.Provider, { value: services, children });
|
|
7501
7575
|
};
|
package/dist/provider.mjs
CHANGED
|
@@ -2849,74 +2849,6 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
2849
2849
|
return originalRequest.data;
|
|
2850
2850
|
};
|
|
2851
2851
|
|
|
2852
|
-
// src/utils/storage/local-storage.ts
|
|
2853
|
-
var localStorageUtils = () => {
|
|
2854
|
-
const setToken = async (access_token) => {
|
|
2855
|
-
localStorage.setItem("accessToken", access_token);
|
|
2856
|
-
};
|
|
2857
|
-
const setRefreshToken = async (refresh_token) => {
|
|
2858
|
-
localStorage.setItem("refreshToken", refresh_token);
|
|
2859
|
-
};
|
|
2860
|
-
const getAccessToken = async () => {
|
|
2861
|
-
return localStorage.getItem("accessToken");
|
|
2862
|
-
};
|
|
2863
|
-
const getRefreshToken = async () => {
|
|
2864
|
-
return localStorage.getItem("refreshToken");
|
|
2865
|
-
};
|
|
2866
|
-
const clearToken = async () => {
|
|
2867
|
-
localStorage.removeItem("accessToken");
|
|
2868
|
-
localStorage.removeItem("refreshToken");
|
|
2869
|
-
};
|
|
2870
|
-
return {
|
|
2871
|
-
setToken,
|
|
2872
|
-
setRefreshToken,
|
|
2873
|
-
getAccessToken,
|
|
2874
|
-
getRefreshToken,
|
|
2875
|
-
clearToken
|
|
2876
|
-
};
|
|
2877
|
-
};
|
|
2878
|
-
|
|
2879
|
-
// src/utils/storage/session-storage.ts
|
|
2880
|
-
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
2881
|
-
const getMenuFocus = () => {
|
|
2882
|
-
const menuFocus = sessionStorage.getItem("menuFocus");
|
|
2883
|
-
return menuFocus ? JSON.parse(menuFocus) : {
|
|
2884
|
-
id: void 0,
|
|
2885
|
-
service: ""
|
|
2886
|
-
};
|
|
2887
|
-
};
|
|
2888
|
-
const setMenuFocus2 = (menuTree) => {
|
|
2889
|
-
sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
|
|
2890
|
-
};
|
|
2891
|
-
const getActionData = () => {
|
|
2892
|
-
const actionData = sessionStorage.getItem("actionData");
|
|
2893
|
-
return actionData ? JSON.parse(actionData) : {};
|
|
2894
|
-
};
|
|
2895
|
-
const setActionData = (actData) => {
|
|
2896
|
-
sessionStorage.setItem("actionData", JSON.stringify(actData));
|
|
2897
|
-
};
|
|
2898
|
-
const getViewData = () => {
|
|
2899
|
-
const viewData = sessionStorage.getItem("viewData");
|
|
2900
|
-
return viewData ? JSON.parse(viewData) : {};
|
|
2901
|
-
};
|
|
2902
|
-
const getBrowserSession = () => {
|
|
2903
|
-
const actionData = sessionStorage.getItem("browserSession");
|
|
2904
|
-
return actionData ? JSON.parse(actionData) : null;
|
|
2905
|
-
};
|
|
2906
|
-
const setViewData = (viewData) => {
|
|
2907
|
-
sessionStorage.setItem("viewData", JSON.stringify(viewData));
|
|
2908
|
-
};
|
|
2909
|
-
return {
|
|
2910
|
-
getMenuFocus,
|
|
2911
|
-
setMenuFocus: setMenuFocus2,
|
|
2912
|
-
setActionData,
|
|
2913
|
-
getActionData,
|
|
2914
|
-
getViewData,
|
|
2915
|
-
setViewData,
|
|
2916
|
-
getBrowserSession
|
|
2917
|
-
};
|
|
2918
|
-
})();
|
|
2919
|
-
|
|
2920
2852
|
// src/services/action-service/index.ts
|
|
2921
2853
|
function useActionService() {
|
|
2922
2854
|
const { env } = useEnv();
|
|
@@ -5169,6 +5101,61 @@ function useViewService() {
|
|
|
5169
5101
|
},
|
|
5170
5102
|
[env]
|
|
5171
5103
|
);
|
|
5104
|
+
const getDataCloseSession = useCallback9(
|
|
5105
|
+
({
|
|
5106
|
+
model,
|
|
5107
|
+
ids,
|
|
5108
|
+
xNode,
|
|
5109
|
+
service
|
|
5110
|
+
}) => {
|
|
5111
|
+
const jsonData = {
|
|
5112
|
+
model,
|
|
5113
|
+
ids,
|
|
5114
|
+
method: "get_closing_control_data" /* GET_CLOSING_CONTROL_DATA */
|
|
5115
|
+
};
|
|
5116
|
+
return env?.requests.post(
|
|
5117
|
+
"/call" /* CALL_PATH */,
|
|
5118
|
+
jsonData,
|
|
5119
|
+
{
|
|
5120
|
+
headers: {
|
|
5121
|
+
"Content-Type": "application/json",
|
|
5122
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
5123
|
+
}
|
|
5124
|
+
},
|
|
5125
|
+
service
|
|
5126
|
+
);
|
|
5127
|
+
},
|
|
5128
|
+
[env]
|
|
5129
|
+
);
|
|
5130
|
+
const getDetailEntity = useCallback9(
|
|
5131
|
+
({
|
|
5132
|
+
model,
|
|
5133
|
+
ids,
|
|
5134
|
+
method,
|
|
5135
|
+
xNode,
|
|
5136
|
+
service,
|
|
5137
|
+
kwargs
|
|
5138
|
+
}) => {
|
|
5139
|
+
const jsonData = {
|
|
5140
|
+
model,
|
|
5141
|
+
ids,
|
|
5142
|
+
method,
|
|
5143
|
+
kwargs
|
|
5144
|
+
};
|
|
5145
|
+
return env?.requests.post(
|
|
5146
|
+
"/call" /* CALL_PATH */,
|
|
5147
|
+
jsonData,
|
|
5148
|
+
{
|
|
5149
|
+
headers: {
|
|
5150
|
+
"Content-Type": "application/json",
|
|
5151
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
5152
|
+
}
|
|
5153
|
+
},
|
|
5154
|
+
service
|
|
5155
|
+
);
|
|
5156
|
+
},
|
|
5157
|
+
[env]
|
|
5158
|
+
);
|
|
5172
5159
|
return {
|
|
5173
5160
|
getView,
|
|
5174
5161
|
getMenu,
|
|
@@ -5200,7 +5187,9 @@ function useViewService() {
|
|
|
5200
5187
|
getOrderLine,
|
|
5201
5188
|
getProductImage,
|
|
5202
5189
|
addEntity,
|
|
5203
|
-
checkPayment
|
|
5190
|
+
checkPayment,
|
|
5191
|
+
getDataCloseSession,
|
|
5192
|
+
getDetailEntity
|
|
5204
5193
|
};
|
|
5205
5194
|
}
|
|
5206
5195
|
|
|
@@ -5245,16 +5234,53 @@ import { createContext, useContext, useState as useState3, useCallback as useCal
|
|
|
5245
5234
|
|
|
5246
5235
|
// src/configs/axios-client.ts
|
|
5247
5236
|
import axios from "axios";
|
|
5237
|
+
|
|
5238
|
+
// src/utils/storage/local-storage.ts
|
|
5239
|
+
var localStorageUtils = () => {
|
|
5240
|
+
const setToken = async (access_token) => {
|
|
5241
|
+
localStorage.setItem("accessToken", access_token);
|
|
5242
|
+
};
|
|
5243
|
+
const setRefreshToken = async (refresh_token) => {
|
|
5244
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
5245
|
+
};
|
|
5246
|
+
const getAccessToken = async () => {
|
|
5247
|
+
return localStorage.getItem("accessToken");
|
|
5248
|
+
};
|
|
5249
|
+
const getRefreshToken = async () => {
|
|
5250
|
+
return localStorage.getItem("refreshToken");
|
|
5251
|
+
};
|
|
5252
|
+
const clearToken = async () => {
|
|
5253
|
+
localStorage.removeItem("accessToken");
|
|
5254
|
+
localStorage.removeItem("refreshToken");
|
|
5255
|
+
};
|
|
5256
|
+
return {
|
|
5257
|
+
setToken,
|
|
5258
|
+
setRefreshToken,
|
|
5259
|
+
getAccessToken,
|
|
5260
|
+
getRefreshToken,
|
|
5261
|
+
clearToken
|
|
5262
|
+
};
|
|
5263
|
+
};
|
|
5264
|
+
|
|
5265
|
+
// src/utils/storage/session-storage.ts
|
|
5266
|
+
var sessionStorageUtils = () => {
|
|
5267
|
+
const getBrowserSession = async () => {
|
|
5268
|
+
return sessionStorage.getItem("browserSession");
|
|
5269
|
+
};
|
|
5270
|
+
return {
|
|
5271
|
+
getBrowserSession
|
|
5272
|
+
};
|
|
5273
|
+
};
|
|
5274
|
+
|
|
5275
|
+
// src/configs/axios-client.ts
|
|
5248
5276
|
var axiosClient = {
|
|
5249
5277
|
init(config) {
|
|
5250
5278
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
5251
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
5279
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
|
|
5252
5280
|
const db = config?.db;
|
|
5253
5281
|
const database = config?.config?.database;
|
|
5254
5282
|
let isRefreshing = false;
|
|
5255
5283
|
let failedQueue = [];
|
|
5256
|
-
const xNode = config?.xNode;
|
|
5257
|
-
const service = sessionStorage2.getMenuFocus().service || config?.default_service;
|
|
5258
5284
|
const processQueue = (error, token = null) => {
|
|
5259
5285
|
failedQueue?.forEach((prom) => {
|
|
5260
5286
|
if (error) {
|
|
@@ -5409,48 +5435,46 @@ var axiosClient = {
|
|
|
5409
5435
|
function formatUrl(url, db2) {
|
|
5410
5436
|
return url + (db2 ? "?db=" + db2 : "");
|
|
5411
5437
|
}
|
|
5412
|
-
const getBaseUrl = (baseUrl) => {
|
|
5438
|
+
const getBaseUrl = (baseUrl, serviceName) => {
|
|
5439
|
+
const service = serviceName || config?.default_service;
|
|
5413
5440
|
return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
|
|
5414
5441
|
};
|
|
5415
|
-
const getHeaders = (header) => {
|
|
5416
|
-
const headers = {
|
|
5417
|
-
...header,
|
|
5418
|
-
...xNode ? { "X-Node": xNode } : {}
|
|
5419
|
-
};
|
|
5420
|
-
return headers;
|
|
5421
|
-
};
|
|
5422
5442
|
const responseBody = (response) => response;
|
|
5423
5443
|
const requests = {
|
|
5424
|
-
get: (url, headers) => instance.get(
|
|
5425
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5426
|
-
|
|
5444
|
+
get: (url, headers, serviceName) => instance.get(
|
|
5445
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5446
|
+
headers
|
|
5427
5447
|
).then(responseBody),
|
|
5428
|
-
post: async (url, body, headers) => instance.post(
|
|
5429
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5448
|
+
post: async (url, body, headers, serviceName) => instance.post(
|
|
5449
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5430
5450
|
body,
|
|
5431
|
-
|
|
5451
|
+
headers
|
|
5432
5452
|
).then(responseBody),
|
|
5433
|
-
post_excel: (url, body, headers) => instance.post(
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5453
|
+
post_excel: (url, body, headers, serviceName) => instance.post(
|
|
5454
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5455
|
+
body,
|
|
5456
|
+
{
|
|
5457
|
+
responseType: "arraybuffer",
|
|
5458
|
+
headers: {
|
|
5459
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
5460
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5461
|
+
...headers
|
|
5462
|
+
}
|
|
5439
5463
|
}
|
|
5440
|
-
|
|
5441
|
-
put: (url, body, headers) => instance.put(
|
|
5442
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5464
|
+
).then(responseBody),
|
|
5465
|
+
put: (url, body, headers, serviceName) => instance.put(
|
|
5466
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5443
5467
|
body,
|
|
5444
|
-
|
|
5468
|
+
headers
|
|
5445
5469
|
).then(responseBody),
|
|
5446
|
-
patch: (url, body, headers) => instance.patch(
|
|
5447
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5470
|
+
patch: (url, body, headers, serviceName) => instance.patch(
|
|
5471
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5448
5472
|
body,
|
|
5449
|
-
|
|
5473
|
+
headers
|
|
5450
5474
|
).then(responseBody),
|
|
5451
|
-
delete: (url, headers) => instance.delete(
|
|
5452
|
-
formatUrl(getBaseUrl(config?.baseUrl) + url, db),
|
|
5453
|
-
|
|
5475
|
+
delete: (url, headers, serviceName) => instance.delete(
|
|
5476
|
+
formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
|
|
5477
|
+
headers
|
|
5454
5478
|
).then(responseBody)
|
|
5455
5479
|
};
|
|
5456
5480
|
return requests;
|
|
@@ -5484,7 +5508,7 @@ var EnvContext = createContext(null);
|
|
|
5484
5508
|
function EnvProvider({
|
|
5485
5509
|
children,
|
|
5486
5510
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
5487
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
5511
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
5488
5512
|
}) {
|
|
5489
5513
|
const [env, setEnvState] = useState3({
|
|
5490
5514
|
...initialEnvState,
|
|
@@ -7360,6 +7384,54 @@ var useCheckPayment = () => {
|
|
|
7360
7384
|
};
|
|
7361
7385
|
var use_check_payment_default = useCheckPayment;
|
|
7362
7386
|
|
|
7387
|
+
// src/hooks/view/use-get-data-close-session.ts
|
|
7388
|
+
import { useMutation as useMutation65 } from "@tanstack/react-query";
|
|
7389
|
+
var useGetDataCloseSession = () => {
|
|
7390
|
+
const { getDataCloseSession } = useViewService();
|
|
7391
|
+
return useMutation65({
|
|
7392
|
+
mutationFn: ({
|
|
7393
|
+
model,
|
|
7394
|
+
ids,
|
|
7395
|
+
xNode,
|
|
7396
|
+
service
|
|
7397
|
+
}) => {
|
|
7398
|
+
return getDataCloseSession({
|
|
7399
|
+
model,
|
|
7400
|
+
ids,
|
|
7401
|
+
xNode,
|
|
7402
|
+
service
|
|
7403
|
+
});
|
|
7404
|
+
}
|
|
7405
|
+
});
|
|
7406
|
+
};
|
|
7407
|
+
var use_get_data_close_session_default = useGetDataCloseSession;
|
|
7408
|
+
|
|
7409
|
+
// src/hooks/view/use-get-detail-entity.ts
|
|
7410
|
+
import { useMutation as useMutation66 } from "@tanstack/react-query";
|
|
7411
|
+
var useGetDetailEntity = () => {
|
|
7412
|
+
const { getDetailEntity } = useViewService();
|
|
7413
|
+
return useMutation66({
|
|
7414
|
+
mutationFn: ({
|
|
7415
|
+
model,
|
|
7416
|
+
ids,
|
|
7417
|
+
method,
|
|
7418
|
+
xNode,
|
|
7419
|
+
service,
|
|
7420
|
+
kwargs
|
|
7421
|
+
}) => {
|
|
7422
|
+
return getDetailEntity({
|
|
7423
|
+
model,
|
|
7424
|
+
ids,
|
|
7425
|
+
method,
|
|
7426
|
+
xNode,
|
|
7427
|
+
service,
|
|
7428
|
+
kwargs
|
|
7429
|
+
});
|
|
7430
|
+
}
|
|
7431
|
+
});
|
|
7432
|
+
};
|
|
7433
|
+
var use_get_detail_entity_default = useGetDetailEntity;
|
|
7434
|
+
|
|
7363
7435
|
// src/provider/service-provider.tsx
|
|
7364
7436
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
7365
7437
|
var ServiceContext = createContext2(null);
|
|
@@ -7452,7 +7524,9 @@ var ServiceProvider = ({
|
|
|
7452
7524
|
useGetOrderLine: use_get_order_line_default,
|
|
7453
7525
|
useGetProductImage: use_get_product_image_default,
|
|
7454
7526
|
useAddEntity: use_add_entity_default,
|
|
7455
|
-
useCheckPayment: use_check_payment_default
|
|
7527
|
+
useCheckPayment: use_check_payment_default,
|
|
7528
|
+
useGetDataCloseSession: use_get_data_close_session_default,
|
|
7529
|
+
useGetDetailEntity: use_get_detail_entity_default
|
|
7456
7530
|
};
|
|
7457
7531
|
return /* @__PURE__ */ jsx6(ServiceContext.Provider, { value: services, children });
|
|
7458
7532
|
};
|