@fctc/interface-logic 3.0.3 → 3.0.4
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 +68 -34
- package/dist/configs.mjs +68 -34
- package/dist/constants.d.mts +1 -2
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +0 -1
- package/dist/constants.mjs +0 -1
- package/dist/environment.d.mts +8 -5
- package/dist/environment.d.ts +8 -5
- package/dist/environment.js +70 -36
- package/dist/environment.mjs +70 -36
- package/dist/hooks.d.mts +5 -19
- package/dist/hooks.d.ts +5 -19
- package/dist/hooks.js +29 -127
- package/dist/hooks.mjs +29 -125
- package/dist/{session-storage-ARp_lhTD.d.mts → local-storage-BPvoMGYJ.d.mts} +1 -6
- package/dist/{session-storage-ARp_lhTD.d.ts → local-storage-BPvoMGYJ.d.ts} +1 -6
- package/dist/provider.d.mts +5 -6
- package/dist/provider.d.ts +5 -6
- package/dist/provider.js +132 -196
- package/dist/provider.mjs +132 -196
- package/dist/services.d.mts +2 -16
- package/dist/services.d.ts +2 -16
- package/dist/services.js +25 -77
- package/dist/services.mjs +25 -77
- package/dist/utils.d.mts +15 -1
- package/dist/utils.d.ts +15 -1
- package/dist/utils.js +43 -0
- package/dist/utils.mjs +42 -0
- package/package.json +1 -1
|
@@ -7,9 +7,4 @@ declare const localStorageUtils: () => {
|
|
|
7
7
|
};
|
|
8
8
|
type LocalStorageUtilsType = ReturnType<typeof localStorageUtils>;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
getBrowserSession: () => Promise<string | null>;
|
|
12
|
-
};
|
|
13
|
-
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
14
|
-
|
|
15
|
-
export type { LocalStorageUtilsType as L, SessionStorageUtilsType as S };
|
|
10
|
+
export type { LocalStorageUtilsType as L };
|
|
@@ -7,9 +7,4 @@ declare const localStorageUtils: () => {
|
|
|
7
7
|
};
|
|
8
8
|
type LocalStorageUtilsType = ReturnType<typeof localStorageUtils>;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
getBrowserSession: () => Promise<string | null>;
|
|
12
|
-
};
|
|
13
|
-
type SessionStorageUtilsType = ReturnType<typeof sessionStorageUtils>;
|
|
14
|
-
|
|
15
|
-
export type { LocalStorageUtilsType as L, SessionStorageUtilsType as S };
|
|
10
|
+
export type { LocalStorageUtilsType as L };
|
package/dist/provider.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { L as LocalStorageUtilsType
|
|
4
|
-
import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFileExcel, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp, useUploadFile, useCreateEntity, useGetASession, useCreateSession, useDeleteEntity, useGetList, useGetPos, useHandleClosingSession, useManageSession, useUpdateClosedSession, useUpdateEntity, useLoadDataPosSession, useManageOnChange, useGenSerialNumber, useGetOrderLine, useGetProductImage, useAddEntity, useCheckPayment
|
|
3
|
+
import { L as LocalStorageUtilsType } from './local-storage-BPvoMGYJ.mjs';
|
|
4
|
+
import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFileExcel, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp, useUploadFile, useCreateEntity, useGetASession, useCreateSession, useDeleteEntity, useGetList, useGetPos, useHandleClosingSession, useManageSession, useUpdateClosedSession, useUpdateEntity, useLoadDataPosSession, useManageOnChange, useGenSerialNumber, useGetOrderLine, useGetProductImage, useAddEntity, useCheckPayment } from './hooks.mjs';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
6
|
import './view-type-xxw9OeSR.mjs';
|
|
7
7
|
import './base-model-type-DD8uZnDP.mjs';
|
|
@@ -42,13 +42,14 @@ interface EnvConfig {
|
|
|
42
42
|
db?: string;
|
|
43
43
|
refreshTokenEndpoint?: string;
|
|
44
44
|
localStorageUtils?: LocalStorageUtilsType;
|
|
45
|
-
sessionStorageUtils?:
|
|
45
|
+
sessionStorageUtils?: any;
|
|
46
46
|
envFile?: any;
|
|
47
|
+
xNode?: string;
|
|
47
48
|
}
|
|
48
49
|
declare function EnvProvider({ children, localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
49
50
|
children: React.ReactNode;
|
|
50
51
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
|
-
sessionStorageUtils?:
|
|
52
|
+
sessionStorageUtils?: any;
|
|
52
53
|
}): react_jsx_runtime.JSX.Element;
|
|
53
54
|
declare function useEnv(): {
|
|
54
55
|
env: EnvConfig;
|
|
@@ -150,8 +151,6 @@ interface ServiceContextType {
|
|
|
150
151
|
useGetProductImage: typeof useGetProductImage;
|
|
151
152
|
useAddEntity: typeof useAddEntity;
|
|
152
153
|
useCheckPayment: typeof useCheckPayment;
|
|
153
|
-
useGetDataCloseSession: typeof useGetDataCloseSession;
|
|
154
|
-
useGetDetailEntity: typeof useGetDetailEntity;
|
|
155
154
|
}
|
|
156
155
|
declare const ServiceProvider: ({ children, }: {
|
|
157
156
|
children: React.ReactNode;
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { L as LocalStorageUtilsType
|
|
4
|
-
import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFileExcel, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp, useUploadFile, useCreateEntity, useGetASession, useCreateSession, useDeleteEntity, useGetList, useGetPos, useHandleClosingSession, useManageSession, useUpdateClosedSession, useUpdateEntity, useLoadDataPosSession, useManageOnChange, useGenSerialNumber, useGetOrderLine, useGetProductImage, useAddEntity, useCheckPayment
|
|
3
|
+
import { L as LocalStorageUtilsType } from './local-storage-BPvoMGYJ.js';
|
|
4
|
+
import { useForgotPassword, useForgotPasswordSSO, useGetProvider, useIsValidToken, useLoginCredential, useLoginSocial, useResetPassword, useResetPasswordSSO, useUpdatePassword, useLogout, useGetAccessByCode, useValidateActionToken, useGetCompanyInfo, useGetCurrentCompany, useGetListCompany, useExecuteImport, useExportExcel, useGetFieldExport, useGetFileExcel, useParsePreview, useUploadFileExcel, useUploadIdFile, useChangeStatus, useDeleteComment, useGetComment, useGetFormView, useGetImage, useSendComment, useUploadImage, useDelete, useGetAll, useGetConversionRate, useGetCurrency, useGetDetail, useGetFieldOnChange, useGetListMyBankAccount, useModel, useOdooDataTransform, useOnChangeForm, useSave, useGetProfile, useGetUser, useSwitchLocale, useButton, useDuplicateRecord, useGet2FAMethods, useGetActionDetail, useGetCalendar, useGetGroups, useGetListData, useGetMenu, useGetPrintReport, useGetProGressBar, useGetResequence, useGetSelection, useGetView, useLoadAction, useLoadMessage, usePrint, useRemoveRow, useRunAction, useSignInSSO, useVerify2FA, useGrantAccess, useRemoveTotpSetup, useRequestSetupTotp, useSettingsWebRead2fa, useVerifyTotp, useUploadFile, useCreateEntity, useGetASession, useCreateSession, useDeleteEntity, useGetList, useGetPos, useHandleClosingSession, useManageSession, useUpdateClosedSession, useUpdateEntity, useLoadDataPosSession, useManageOnChange, useGenSerialNumber, useGetOrderLine, useGetProductImage, useAddEntity, useCheckPayment } from './hooks.js';
|
|
5
5
|
import '@tanstack/react-query';
|
|
6
6
|
import './view-type-xxw9OeSR.js';
|
|
7
7
|
import './base-model-type-DD8uZnDP.js';
|
|
@@ -42,13 +42,14 @@ interface EnvConfig {
|
|
|
42
42
|
db?: string;
|
|
43
43
|
refreshTokenEndpoint?: string;
|
|
44
44
|
localStorageUtils?: LocalStorageUtilsType;
|
|
45
|
-
sessionStorageUtils?:
|
|
45
|
+
sessionStorageUtils?: any;
|
|
46
46
|
envFile?: any;
|
|
47
|
+
xNode?: string;
|
|
47
48
|
}
|
|
48
49
|
declare function EnvProvider({ children, localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
|
|
49
50
|
children: React.ReactNode;
|
|
50
51
|
localStorageUtils?: LocalStorageUtilsType;
|
|
51
|
-
sessionStorageUtils?:
|
|
52
|
+
sessionStorageUtils?: any;
|
|
52
53
|
}): react_jsx_runtime.JSX.Element;
|
|
53
54
|
declare function useEnv(): {
|
|
54
55
|
env: EnvConfig;
|
|
@@ -150,8 +151,6 @@ interface ServiceContextType {
|
|
|
150
151
|
useGetProductImage: typeof useGetProductImage;
|
|
151
152
|
useAddEntity: typeof useAddEntity;
|
|
152
153
|
useCheckPayment: typeof useCheckPayment;
|
|
153
|
-
useGetDataCloseSession: typeof useGetDataCloseSession;
|
|
154
|
-
useGetDetailEntity: typeof useGetDetailEntity;
|
|
155
154
|
}
|
|
156
155
|
declare const ServiceProvider: ({ children, }: {
|
|
157
156
|
children: React.ReactNode;
|
package/dist/provider.js
CHANGED
|
@@ -2892,6 +2892,74 @@ 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
|
+
|
|
2895
2963
|
// src/services/action-service/index.ts
|
|
2896
2964
|
function useActionService() {
|
|
2897
2965
|
const { env } = useEnv();
|
|
@@ -3318,13 +3386,20 @@ function useAuthService() {
|
|
|
3318
3386
|
var import_react4 = require("react");
|
|
3319
3387
|
function useCompanyService() {
|
|
3320
3388
|
const { env } = useEnv();
|
|
3321
|
-
const getCurrentCompany = (0, import_react4.useCallback)(
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
"
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3389
|
+
const getCurrentCompany = (0, import_react4.useCallback)(
|
|
3390
|
+
async (service) => {
|
|
3391
|
+
return await env.requests.get(
|
|
3392
|
+
"/company" /* COMPANY_PATH */,
|
|
3393
|
+
{
|
|
3394
|
+
headers: {
|
|
3395
|
+
"Content-Type": "application/json"
|
|
3396
|
+
}
|
|
3397
|
+
},
|
|
3398
|
+
service
|
|
3399
|
+
);
|
|
3400
|
+
},
|
|
3401
|
+
[env]
|
|
3402
|
+
);
|
|
3328
3403
|
const getInfoCompany = (0, import_react4.useCallback)(
|
|
3329
3404
|
async (id) => {
|
|
3330
3405
|
const jsonData = {
|
|
@@ -4185,12 +4260,16 @@ var import_react9 = require("react");
|
|
|
4185
4260
|
function useUserService() {
|
|
4186
4261
|
const { env } = useEnv();
|
|
4187
4262
|
const getProfile = (0, import_react9.useCallback)(
|
|
4188
|
-
async (path) => {
|
|
4189
|
-
return env?.requests?.get(
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4263
|
+
async (path, service) => {
|
|
4264
|
+
return env?.requests?.get(
|
|
4265
|
+
path ?? "/userinfo" /* PROFILE_PATH */,
|
|
4266
|
+
{
|
|
4267
|
+
headers: {
|
|
4268
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4269
|
+
}
|
|
4270
|
+
},
|
|
4271
|
+
service
|
|
4272
|
+
);
|
|
4194
4273
|
},
|
|
4195
4274
|
[env]
|
|
4196
4275
|
);
|
|
@@ -5144,61 +5223,6 @@ function useViewService() {
|
|
|
5144
5223
|
},
|
|
5145
5224
|
[env]
|
|
5146
5225
|
);
|
|
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
|
-
);
|
|
5202
5226
|
return {
|
|
5203
5227
|
getView,
|
|
5204
5228
|
getMenu,
|
|
@@ -5230,9 +5254,7 @@ function useViewService() {
|
|
|
5230
5254
|
getOrderLine,
|
|
5231
5255
|
getProductImage,
|
|
5232
5256
|
addEntity,
|
|
5233
|
-
checkPayment
|
|
5234
|
-
getDataCloseSession,
|
|
5235
|
-
getDetailEntity
|
|
5257
|
+
checkPayment
|
|
5236
5258
|
};
|
|
5237
5259
|
}
|
|
5238
5260
|
|
|
@@ -5277,53 +5299,15 @@ var import_react12 = require("react");
|
|
|
5277
5299
|
|
|
5278
5300
|
// src/configs/axios-client.ts
|
|
5279
5301
|
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
|
|
5319
5302
|
var axiosClient = {
|
|
5320
5303
|
init(config) {
|
|
5321
5304
|
const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
|
|
5322
|
-
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils
|
|
5305
|
+
const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils;
|
|
5323
5306
|
const db = config?.db;
|
|
5324
5307
|
const database = config?.config?.database;
|
|
5325
5308
|
let isRefreshing = false;
|
|
5326
5309
|
let failedQueue = [];
|
|
5310
|
+
const xNode = config?.xNode;
|
|
5327
5311
|
const processQueue = (error, token = null) => {
|
|
5328
5312
|
failedQueue?.forEach((prom) => {
|
|
5329
5313
|
if (error) {
|
|
@@ -5478,46 +5462,48 @@ var axiosClient = {
|
|
|
5478
5462
|
function formatUrl(url, db2) {
|
|
5479
5463
|
return url + (db2 ? "?db=" + db2 : "");
|
|
5480
5464
|
}
|
|
5481
|
-
const getBaseUrl = (baseUrl,
|
|
5482
|
-
|
|
5483
|
-
|
|
5465
|
+
const getBaseUrl = (baseUrl, hardService) => {
|
|
5466
|
+
return `${baseUrl.replace(/\/$/, "")}/${hardService ?? (sessionStorage2.getMenuFocus().service || config?.default_service)}/api/v2`;
|
|
5467
|
+
};
|
|
5468
|
+
const getHeaders = (header) => {
|
|
5469
|
+
const headers = {
|
|
5470
|
+
...header,
|
|
5471
|
+
...xNode ? { "X-Node": xNode } : {}
|
|
5472
|
+
};
|
|
5473
|
+
return headers;
|
|
5484
5474
|
};
|
|
5485
5475
|
const responseBody = (response) => response;
|
|
5486
5476
|
const requests = {
|
|
5487
|
-
get: (url, headers,
|
|
5488
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
5489
|
-
headers
|
|
5477
|
+
get: (url, headers, hardService) => instance.get(
|
|
5478
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
5479
|
+
getHeaders(headers)
|
|
5490
5480
|
).then(responseBody),
|
|
5491
|
-
post: async (url, body, headers,
|
|
5492
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
5481
|
+
post: async (url, body, headers, hardService) => instance.post(
|
|
5482
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
5493
5483
|
body,
|
|
5494
|
-
headers
|
|
5484
|
+
getHeaders(headers)
|
|
5495
5485
|
).then(responseBody),
|
|
5496
|
-
post_excel: (url, body, headers
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
headers
|
|
5502
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
5503
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5504
|
-
...headers
|
|
5505
|
-
}
|
|
5486
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(getBaseUrl(config?.baseUrl) + url, db), body, {
|
|
5487
|
+
responseType: "arraybuffer",
|
|
5488
|
+
headers: {
|
|
5489
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
5490
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5491
|
+
...headers
|
|
5506
5492
|
}
|
|
5507
|
-
).then(responseBody),
|
|
5508
|
-
put: (url, body, headers,
|
|
5509
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
5493
|
+
}).then(responseBody),
|
|
5494
|
+
put: (url, body, headers, hardService) => instance.put(
|
|
5495
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
5510
5496
|
body,
|
|
5511
|
-
headers
|
|
5497
|
+
getHeaders(headers)
|
|
5512
5498
|
).then(responseBody),
|
|
5513
|
-
patch: (url, body, headers,
|
|
5514
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
5499
|
+
patch: (url, body, headers, hardService) => instance.patch(
|
|
5500
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
5515
5501
|
body,
|
|
5516
|
-
headers
|
|
5502
|
+
getHeaders(headers)
|
|
5517
5503
|
).then(responseBody),
|
|
5518
|
-
delete: (url, headers,
|
|
5519
|
-
formatUrl(getBaseUrl(config?.baseUrl,
|
|
5520
|
-
headers
|
|
5504
|
+
delete: (url, headers, hardService) => instance.delete(
|
|
5505
|
+
formatUrl(getBaseUrl(config?.baseUrl, hardService) + url, db),
|
|
5506
|
+
getHeaders(headers)
|
|
5521
5507
|
).then(responseBody)
|
|
5522
5508
|
};
|
|
5523
5509
|
return requests;
|
|
@@ -5551,7 +5537,7 @@ var EnvContext = (0, import_react12.createContext)(null);
|
|
|
5551
5537
|
function EnvProvider({
|
|
5552
5538
|
children,
|
|
5553
5539
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
5554
|
-
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
5540
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils
|
|
5555
5541
|
}) {
|
|
5556
5542
|
const [env, setEnvState] = (0, import_react12.useState)({
|
|
5557
5543
|
...initialEnvState,
|
|
@@ -5821,10 +5807,10 @@ var use_get_company_info_default = useGetCompanyInfo;
|
|
|
5821
5807
|
|
|
5822
5808
|
// src/hooks/company/use-get-current-company.ts
|
|
5823
5809
|
var import_react_query16 = require("@tanstack/react-query");
|
|
5824
|
-
var useGetCurrentCompany = () => {
|
|
5810
|
+
var useGetCurrentCompany = ({ service }) => {
|
|
5825
5811
|
const { getCurrentCompany } = useCompanyService();
|
|
5826
5812
|
return (0, import_react_query16.useMutation)({
|
|
5827
|
-
mutationFn: () => getCurrentCompany()
|
|
5813
|
+
mutationFn: () => getCurrentCompany(service)
|
|
5828
5814
|
});
|
|
5829
5815
|
};
|
|
5830
5816
|
var use_get_current_company_default = useGetCurrentCompany;
|
|
@@ -6467,10 +6453,10 @@ var use_save_default = useSave;
|
|
|
6467
6453
|
|
|
6468
6454
|
// src/hooks/user/use-get-profile.ts
|
|
6469
6455
|
var import_react_query42 = require("@tanstack/react-query");
|
|
6470
|
-
var useGetProfile = (path) => {
|
|
6456
|
+
var useGetProfile = (path, service) => {
|
|
6471
6457
|
const { getProfile } = useUserService();
|
|
6472
6458
|
return (0, import_react_query42.useMutation)({
|
|
6473
|
-
mutationFn: () => getProfile(path)
|
|
6459
|
+
mutationFn: () => getProfile(path, service)
|
|
6474
6460
|
});
|
|
6475
6461
|
};
|
|
6476
6462
|
var use_get_profile_default = useGetProfile;
|
|
@@ -7427,54 +7413,6 @@ var useCheckPayment = () => {
|
|
|
7427
7413
|
};
|
|
7428
7414
|
var use_check_payment_default = useCheckPayment;
|
|
7429
7415
|
|
|
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
|
-
|
|
7478
7416
|
// src/provider/service-provider.tsx
|
|
7479
7417
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
7480
7418
|
var ServiceContext = (0, import_react13.createContext)(null);
|
|
@@ -7567,9 +7505,7 @@ var ServiceProvider = ({
|
|
|
7567
7505
|
useGetOrderLine: use_get_order_line_default,
|
|
7568
7506
|
useGetProductImage: use_get_product_image_default,
|
|
7569
7507
|
useAddEntity: use_add_entity_default,
|
|
7570
|
-
useCheckPayment: use_check_payment_default
|
|
7571
|
-
useGetDataCloseSession: use_get_data_close_session_default,
|
|
7572
|
-
useGetDetailEntity: use_get_detail_entity_default
|
|
7508
|
+
useCheckPayment: use_check_payment_default
|
|
7573
7509
|
};
|
|
7574
7510
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ServiceContext.Provider, { value: services, children });
|
|
7575
7511
|
};
|