@fctc/interface-logic 1.10.1 → 1.10.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/provider.js +492 -47
- package/dist/provider.mjs +498 -53
- package/package.json +1 -1
package/dist/provider.js
CHANGED
|
@@ -690,8 +690,8 @@ var MainProvider = ({ children }) => {
|
|
|
690
690
|
};
|
|
691
691
|
|
|
692
692
|
// src/provider/version-gate-provider.tsx
|
|
693
|
-
var
|
|
694
|
-
var
|
|
693
|
+
var import_react5 = require("react");
|
|
694
|
+
var import_react_query69 = require("@tanstack/react-query");
|
|
695
695
|
|
|
696
696
|
// src/services/view-service/backup.ts
|
|
697
697
|
var import_react = require("react");
|
|
@@ -944,45 +944,8 @@ function useViewService() {
|
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
-
// src/
|
|
948
|
-
var
|
|
949
|
-
var VersionGate = ({ children }) => {
|
|
950
|
-
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
951
|
-
const [ready, setReady] = (0, import_react2.useState)(false);
|
|
952
|
-
const { getVersion } = useViewService();
|
|
953
|
-
(0, import_react2.useEffect)(() => {
|
|
954
|
-
const clearVersion = () => {
|
|
955
|
-
queryClient.clear();
|
|
956
|
-
localStorage.removeItem("__api_version__");
|
|
957
|
-
};
|
|
958
|
-
const validateVersion = async () => {
|
|
959
|
-
const serverVersion = await getVersion();
|
|
960
|
-
console.log("serverVersion", serverVersion);
|
|
961
|
-
const cached = localStorage.getItem("__api_version__");
|
|
962
|
-
if (cached !== serverVersion?.api_version) {
|
|
963
|
-
clearVersion();
|
|
964
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
965
|
-
} else {
|
|
966
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
967
|
-
}
|
|
968
|
-
setReady(true);
|
|
969
|
-
};
|
|
970
|
-
validateVersion();
|
|
971
|
-
if (typeof window !== "undefined") {
|
|
972
|
-
const onKey = (e) => {
|
|
973
|
-
const key = e.key.toLowerCase();
|
|
974
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
975
|
-
if (isHardRefresh) clearVersion();
|
|
976
|
-
};
|
|
977
|
-
window.addEventListener("keydown", onKey);
|
|
978
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
979
|
-
}
|
|
980
|
-
}, [queryClient]);
|
|
981
|
-
return ready ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children }) : null;
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
// src/provider/env-provider.tsx
|
|
985
|
-
var import_react4 = require("react");
|
|
947
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
948
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
986
949
|
|
|
987
950
|
// src/configs/axios-client.ts
|
|
988
951
|
var import_axios = __toESM(require("axios"));
|
|
@@ -3097,7 +3060,7 @@ function matchDomain(record, domain) {
|
|
|
3097
3060
|
}
|
|
3098
3061
|
|
|
3099
3062
|
// src/utils/function.ts
|
|
3100
|
-
var
|
|
3063
|
+
var import_react2 = require("react");
|
|
3101
3064
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
3102
3065
|
if (!originalRequest.data) return originalRequest.data;
|
|
3103
3066
|
if (typeof originalRequest.data === "string") {
|
|
@@ -3328,8 +3291,241 @@ var axiosClient = {
|
|
|
3328
3291
|
}
|
|
3329
3292
|
};
|
|
3330
3293
|
|
|
3294
|
+
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
3295
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
3296
|
+
|
|
3297
|
+
// src/hooks/auth/use-get-provider.ts
|
|
3298
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
3299
|
+
|
|
3300
|
+
// src/hooks/auth/use-isvalid-token.ts
|
|
3301
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
3302
|
+
|
|
3303
|
+
// src/hooks/auth/use-login-credential.tsx
|
|
3304
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
3305
|
+
|
|
3306
|
+
// src/services/auth-service/backup.ts
|
|
3307
|
+
var import_react3 = require("react");
|
|
3308
|
+
function useAuthService() {
|
|
3309
|
+
const { env } = useEnv();
|
|
3310
|
+
console.log("auth env", env);
|
|
3311
|
+
const login = (0, import_react3.useCallback)(
|
|
3312
|
+
async (body) => {
|
|
3313
|
+
const payload = Object.fromEntries(
|
|
3314
|
+
Object.entries({
|
|
3315
|
+
username: body.email,
|
|
3316
|
+
password: body.password,
|
|
3317
|
+
grant_type: env?.config?.grantType || "",
|
|
3318
|
+
client_id: env?.config?.clientId || "",
|
|
3319
|
+
client_secret: env?.config?.clientSecret || ""
|
|
3320
|
+
}).filter(([_, value]) => !!value)
|
|
3321
|
+
);
|
|
3322
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
3323
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
3324
|
+
headers: {
|
|
3325
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3326
|
+
}
|
|
3327
|
+
});
|
|
3328
|
+
},
|
|
3329
|
+
[env]
|
|
3330
|
+
);
|
|
3331
|
+
const forgotPassword = (0, import_react3.useCallback)(
|
|
3332
|
+
async (email) => {
|
|
3333
|
+
const bodyData = {
|
|
3334
|
+
login: email,
|
|
3335
|
+
url: `${window.location.origin}/reset-password`
|
|
3336
|
+
};
|
|
3337
|
+
return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3338
|
+
headers: {
|
|
3339
|
+
"Content-Type": "application/json"
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
},
|
|
3343
|
+
[env]
|
|
3344
|
+
);
|
|
3345
|
+
const forgotPasswordSSO = (0, import_react3.useCallback)(
|
|
3346
|
+
async ({
|
|
3347
|
+
email,
|
|
3348
|
+
with_context,
|
|
3349
|
+
method
|
|
3350
|
+
}) => {
|
|
3351
|
+
const body = {
|
|
3352
|
+
method,
|
|
3353
|
+
kwargs: {
|
|
3354
|
+
vals: {
|
|
3355
|
+
email
|
|
3356
|
+
}
|
|
3357
|
+
},
|
|
3358
|
+
with_context
|
|
3359
|
+
};
|
|
3360
|
+
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3361
|
+
headers: {
|
|
3362
|
+
"Content-Type": "application/json"
|
|
3363
|
+
}
|
|
3364
|
+
});
|
|
3365
|
+
},
|
|
3366
|
+
[env]
|
|
3367
|
+
);
|
|
3368
|
+
const resetPassword = (0, import_react3.useCallback)(
|
|
3369
|
+
async (data, token) => {
|
|
3370
|
+
const bodyData = {
|
|
3371
|
+
token,
|
|
3372
|
+
password: data.password,
|
|
3373
|
+
new_password: data.confirmPassword
|
|
3374
|
+
};
|
|
3375
|
+
return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3376
|
+
headers: {
|
|
3377
|
+
"Content-Type": "application/json"
|
|
3378
|
+
}
|
|
3379
|
+
});
|
|
3380
|
+
},
|
|
3381
|
+
[env]
|
|
3382
|
+
);
|
|
3383
|
+
const resetPasswordSSO = (0, import_react3.useCallback)(
|
|
3384
|
+
async ({
|
|
3385
|
+
method,
|
|
3386
|
+
password,
|
|
3387
|
+
with_context
|
|
3388
|
+
}) => {
|
|
3389
|
+
const bodyData = {
|
|
3390
|
+
method,
|
|
3391
|
+
kwargs: {
|
|
3392
|
+
vals: {
|
|
3393
|
+
password
|
|
3394
|
+
}
|
|
3395
|
+
},
|
|
3396
|
+
with_context
|
|
3397
|
+
};
|
|
3398
|
+
return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3399
|
+
headers: {
|
|
3400
|
+
"Content-Type": "application/json"
|
|
3401
|
+
}
|
|
3402
|
+
});
|
|
3403
|
+
},
|
|
3404
|
+
[env]
|
|
3405
|
+
);
|
|
3406
|
+
const updatePassword = (0, import_react3.useCallback)(
|
|
3407
|
+
async (data, token) => {
|
|
3408
|
+
const bodyData = {
|
|
3409
|
+
token,
|
|
3410
|
+
old_password: data.oldPassword,
|
|
3411
|
+
new_password: data.newPassword
|
|
3412
|
+
};
|
|
3413
|
+
return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3414
|
+
headers: {
|
|
3415
|
+
"Content-Type": "application/json"
|
|
3416
|
+
}
|
|
3417
|
+
});
|
|
3418
|
+
},
|
|
3419
|
+
[env]
|
|
3420
|
+
);
|
|
3421
|
+
const isValidToken = (0, import_react3.useCallback)(
|
|
3422
|
+
async (token) => {
|
|
3423
|
+
const bodyData = {
|
|
3424
|
+
token
|
|
3425
|
+
};
|
|
3426
|
+
return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3427
|
+
headers: {
|
|
3428
|
+
"Content-Type": "application/json"
|
|
3429
|
+
}
|
|
3430
|
+
});
|
|
3431
|
+
},
|
|
3432
|
+
[env]
|
|
3433
|
+
);
|
|
3434
|
+
const isValidActionToken = (0, import_react3.useCallback)(
|
|
3435
|
+
async (actionToken, path) => {
|
|
3436
|
+
return env?.requests?.post(
|
|
3437
|
+
path,
|
|
3438
|
+
{},
|
|
3439
|
+
{
|
|
3440
|
+
headers: {
|
|
3441
|
+
"Content-Type": "application/json"
|
|
3442
|
+
},
|
|
3443
|
+
useActionToken: true,
|
|
3444
|
+
actionToken
|
|
3445
|
+
}
|
|
3446
|
+
);
|
|
3447
|
+
},
|
|
3448
|
+
[env]
|
|
3449
|
+
);
|
|
3450
|
+
const loginSocial = (0, import_react3.useCallback)(
|
|
3451
|
+
async ({
|
|
3452
|
+
db,
|
|
3453
|
+
state,
|
|
3454
|
+
access_token
|
|
3455
|
+
}) => {
|
|
3456
|
+
return env?.requests?.post(
|
|
3457
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3458
|
+
{ state, access_token },
|
|
3459
|
+
{
|
|
3460
|
+
headers: {
|
|
3461
|
+
"Content-Type": "application/json"
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
);
|
|
3465
|
+
},
|
|
3466
|
+
[env]
|
|
3467
|
+
);
|
|
3468
|
+
const getProviders = (0, import_react3.useCallback)(
|
|
3469
|
+
async (db) => {
|
|
3470
|
+
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
3471
|
+
},
|
|
3472
|
+
[env]
|
|
3473
|
+
);
|
|
3474
|
+
const getAccessByCode = (0, import_react3.useCallback)(
|
|
3475
|
+
async (code) => {
|
|
3476
|
+
const data = new URLSearchParams();
|
|
3477
|
+
data.append("code", code);
|
|
3478
|
+
data.append("grant_type", "authorization_code");
|
|
3479
|
+
data.append("client_id", env?.config?.clientId || "");
|
|
3480
|
+
data.append("redirect_uri", env?.config?.redirectUri || "");
|
|
3481
|
+
return env?.requests?.post(
|
|
3482
|
+
`${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3483
|
+
data,
|
|
3484
|
+
{
|
|
3485
|
+
headers: {
|
|
3486
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
);
|
|
3490
|
+
},
|
|
3491
|
+
[env]
|
|
3492
|
+
);
|
|
3493
|
+
const logout = (0, import_react3.useCallback)(
|
|
3494
|
+
async (data) => {
|
|
3495
|
+
console.log(data);
|
|
3496
|
+
return env?.requests?.post(
|
|
3497
|
+
"/logout" /* LOGOUT */,
|
|
3498
|
+
{},
|
|
3499
|
+
{
|
|
3500
|
+
headers: {
|
|
3501
|
+
"Content-Type": "application/json"
|
|
3502
|
+
},
|
|
3503
|
+
withCredentials: true,
|
|
3504
|
+
useRefreshToken: true
|
|
3505
|
+
}
|
|
3506
|
+
);
|
|
3507
|
+
},
|
|
3508
|
+
[env]
|
|
3509
|
+
);
|
|
3510
|
+
return {
|
|
3511
|
+
login,
|
|
3512
|
+
forgotPassword,
|
|
3513
|
+
forgotPasswordSSO,
|
|
3514
|
+
resetPassword,
|
|
3515
|
+
resetPasswordSSO,
|
|
3516
|
+
updatePassword,
|
|
3517
|
+
isValidToken,
|
|
3518
|
+
isValidActionToken,
|
|
3519
|
+
loginSocial,
|
|
3520
|
+
getProviders,
|
|
3521
|
+
getAccessByCode,
|
|
3522
|
+
logout
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3331
3526
|
// src/provider/env-provider.tsx
|
|
3332
|
-
var
|
|
3527
|
+
var import_react4 = require("react");
|
|
3528
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3333
3529
|
var initialEnvState = {
|
|
3334
3530
|
env: null,
|
|
3335
3531
|
baseUrl: "",
|
|
@@ -3427,7 +3623,7 @@ function EnvProvider({
|
|
|
3427
3623
|
envFile
|
|
3428
3624
|
}));
|
|
3429
3625
|
}, []);
|
|
3430
|
-
return /* @__PURE__ */ (0,
|
|
3626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3431
3627
|
EnvContext.Provider,
|
|
3432
3628
|
{
|
|
3433
3629
|
value: {
|
|
@@ -3455,10 +3651,259 @@ function useEnv() {
|
|
|
3455
3651
|
return context;
|
|
3456
3652
|
}
|
|
3457
3653
|
|
|
3654
|
+
// src/hooks/auth/use-login-credential.tsx
|
|
3655
|
+
var useLoginCredential = () => {
|
|
3656
|
+
const { env } = useEnv();
|
|
3657
|
+
console.log("useLoginCredential called", env, new Error().stack);
|
|
3658
|
+
const { login } = useAuthService();
|
|
3659
|
+
return (0, import_react_query6.useMutation)({
|
|
3660
|
+
mutationFn: (data) => {
|
|
3661
|
+
return login(data);
|
|
3662
|
+
}
|
|
3663
|
+
});
|
|
3664
|
+
};
|
|
3665
|
+
var use_login_credential_default = useLoginCredential;
|
|
3666
|
+
|
|
3667
|
+
// src/hooks/auth/use-login-socical.ts
|
|
3668
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
3669
|
+
|
|
3670
|
+
// src/hooks/auth/use-reset-password.ts
|
|
3671
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
3672
|
+
|
|
3673
|
+
// src/hooks/auth/use-reset-password-sso.ts
|
|
3674
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
3675
|
+
|
|
3676
|
+
// src/hooks/auth/use-update-password.ts
|
|
3677
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
3678
|
+
|
|
3679
|
+
// src/hooks/auth/use-logout.ts
|
|
3680
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
3681
|
+
|
|
3682
|
+
// src/hooks/auth/use-get-access-by-code.ts
|
|
3683
|
+
var import_react_query12 = require("@tanstack/react-query");
|
|
3684
|
+
|
|
3685
|
+
// src/hooks/auth/use-validate-action-token.ts
|
|
3686
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
3687
|
+
|
|
3688
|
+
// src/hooks/company/use-get-company-info.ts
|
|
3689
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
3690
|
+
|
|
3691
|
+
// src/hooks/company/use-get-current-company.ts
|
|
3692
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
3693
|
+
|
|
3694
|
+
// src/hooks/company/use-get-list-company.ts
|
|
3695
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
3696
|
+
|
|
3697
|
+
// src/hooks/excel/use-export-excel.ts
|
|
3698
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
3699
|
+
|
|
3700
|
+
// src/hooks/excel/use-get-field-export.ts
|
|
3701
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
3702
|
+
|
|
3703
|
+
// src/hooks/excel/use-get-file-excel.ts
|
|
3704
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
3705
|
+
|
|
3706
|
+
// src/hooks/excel/use-parse-preview.ts
|
|
3707
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
3708
|
+
|
|
3709
|
+
// src/hooks/excel/use-upload-file.ts
|
|
3710
|
+
var import_react_query21 = require("@tanstack/react-query");
|
|
3711
|
+
|
|
3712
|
+
// src/hooks/excel/use-upload-id-file.ts
|
|
3713
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
3714
|
+
|
|
3715
|
+
// src/hooks/excel/uss-execute-import.ts
|
|
3716
|
+
var import_react_query23 = require("@tanstack/react-query");
|
|
3717
|
+
|
|
3718
|
+
// src/hooks/form/use-change-status.ts
|
|
3719
|
+
var import_react_query24 = require("@tanstack/react-query");
|
|
3720
|
+
|
|
3721
|
+
// src/hooks/form/use-delete-comment.ts
|
|
3722
|
+
var import_react_query25 = require("@tanstack/react-query");
|
|
3723
|
+
|
|
3724
|
+
// src/hooks/form/use-get-comment.ts
|
|
3725
|
+
var import_react_query26 = require("@tanstack/react-query");
|
|
3726
|
+
|
|
3727
|
+
// src/hooks/form/use-get-form-view.ts
|
|
3728
|
+
var import_react_query27 = require("@tanstack/react-query");
|
|
3729
|
+
|
|
3730
|
+
// src/hooks/form/use-get-image.ts
|
|
3731
|
+
var import_react_query28 = require("@tanstack/react-query");
|
|
3732
|
+
|
|
3733
|
+
// src/hooks/form/use-send-comment.ts
|
|
3734
|
+
var import_react_query29 = require("@tanstack/react-query");
|
|
3735
|
+
|
|
3736
|
+
// src/hooks/form/use-upload-image.ts
|
|
3737
|
+
var import_react_query30 = require("@tanstack/react-query");
|
|
3738
|
+
|
|
3739
|
+
// src/hooks/model/use-delete.ts
|
|
3740
|
+
var import_react_query31 = require("@tanstack/react-query");
|
|
3741
|
+
|
|
3742
|
+
// src/hooks/model/use-get-all.ts
|
|
3743
|
+
var import_react_query32 = require("@tanstack/react-query");
|
|
3744
|
+
|
|
3745
|
+
// src/hooks/model/use-get-conversion-rate.ts
|
|
3746
|
+
var import_react_query33 = require("@tanstack/react-query");
|
|
3747
|
+
|
|
3748
|
+
// src/hooks/model/use-get-currency.ts
|
|
3749
|
+
var import_react_query34 = require("@tanstack/react-query");
|
|
3750
|
+
|
|
3751
|
+
// src/hooks/model/use-get-detail.ts
|
|
3752
|
+
var import_react_query35 = require("@tanstack/react-query");
|
|
3753
|
+
|
|
3754
|
+
// src/hooks/model/use-get-field-onchange.ts
|
|
3755
|
+
var import_react_query36 = require("@tanstack/react-query");
|
|
3756
|
+
|
|
3757
|
+
// src/hooks/model/use-get-list-my-bank-account.ts
|
|
3758
|
+
var import_react_query37 = require("@tanstack/react-query");
|
|
3759
|
+
|
|
3760
|
+
// src/hooks/model/use-onchange-form.ts
|
|
3761
|
+
var import_react_query38 = require("@tanstack/react-query");
|
|
3762
|
+
|
|
3763
|
+
// src/hooks/model/use-save.ts
|
|
3764
|
+
var import_react_query39 = require("@tanstack/react-query");
|
|
3765
|
+
|
|
3766
|
+
// src/hooks/user/use-get-profile.ts
|
|
3767
|
+
var import_react_query40 = require("@tanstack/react-query");
|
|
3768
|
+
|
|
3769
|
+
// src/hooks/user/use-get-user.ts
|
|
3770
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
3771
|
+
|
|
3772
|
+
// src/hooks/user/use-switch-locale.ts
|
|
3773
|
+
var import_react_query42 = require("@tanstack/react-query");
|
|
3774
|
+
|
|
3775
|
+
// src/hooks/view/use-button.ts
|
|
3776
|
+
var import_react_query43 = require("@tanstack/react-query");
|
|
3777
|
+
|
|
3778
|
+
// src/hooks/view/use-duplicate-record.ts
|
|
3779
|
+
var import_react_query44 = require("@tanstack/react-query");
|
|
3780
|
+
|
|
3781
|
+
// src/hooks/view/use-get-action-detail.ts
|
|
3782
|
+
var import_react_query45 = require("@tanstack/react-query");
|
|
3783
|
+
|
|
3784
|
+
// src/hooks/view/use-get-calendar.ts
|
|
3785
|
+
var import_react_query46 = require("@tanstack/react-query");
|
|
3786
|
+
|
|
3787
|
+
// src/hooks/view/use-get-groups.ts
|
|
3788
|
+
var import_react_query47 = require("@tanstack/react-query");
|
|
3789
|
+
|
|
3790
|
+
// src/hooks/view/use-get-list-data.ts
|
|
3791
|
+
var import_react_query48 = require("@tanstack/react-query");
|
|
3792
|
+
|
|
3793
|
+
// src/hooks/view/use-get-menu.ts
|
|
3794
|
+
var import_react_query49 = require("@tanstack/react-query");
|
|
3795
|
+
|
|
3796
|
+
// src/hooks/view/use-get-print-report.ts
|
|
3797
|
+
var import_react_query50 = require("@tanstack/react-query");
|
|
3798
|
+
|
|
3799
|
+
// src/hooks/view/use-get-progress-bar.ts
|
|
3800
|
+
var import_react_query51 = require("@tanstack/react-query");
|
|
3801
|
+
|
|
3802
|
+
// src/hooks/view/use-get-selection.ts
|
|
3803
|
+
var import_react_query52 = require("@tanstack/react-query");
|
|
3804
|
+
|
|
3805
|
+
// src/hooks/view/use-get-view.ts
|
|
3806
|
+
var import_react_query53 = require("@tanstack/react-query");
|
|
3807
|
+
|
|
3808
|
+
// src/hooks/view/use-load-action.ts
|
|
3809
|
+
var import_react_query54 = require("@tanstack/react-query");
|
|
3810
|
+
|
|
3811
|
+
// src/hooks/view/use-load-message.ts
|
|
3812
|
+
var import_react_query55 = require("@tanstack/react-query");
|
|
3813
|
+
|
|
3814
|
+
// src/hooks/view/use-print.ts
|
|
3815
|
+
var import_react_query56 = require("@tanstack/react-query");
|
|
3816
|
+
|
|
3817
|
+
// src/hooks/view/use-remove-row.ts
|
|
3818
|
+
var import_react_query57 = require("@tanstack/react-query");
|
|
3819
|
+
|
|
3820
|
+
// src/hooks/view/use-resequence.ts
|
|
3821
|
+
var import_react_query58 = require("@tanstack/react-query");
|
|
3822
|
+
|
|
3823
|
+
// src/hooks/view/use-run-action.ts
|
|
3824
|
+
var import_react_query59 = require("@tanstack/react-query");
|
|
3825
|
+
|
|
3826
|
+
// src/hooks/view/use-signin-sso.ts
|
|
3827
|
+
var import_react_query60 = require("@tanstack/react-query");
|
|
3828
|
+
|
|
3829
|
+
// src/hooks/view/use-verify-2FA.ts
|
|
3830
|
+
var import_react_query61 = require("@tanstack/react-query");
|
|
3831
|
+
|
|
3832
|
+
// src/hooks/view/uset-get-2FA-method.ts
|
|
3833
|
+
var import_react_query62 = require("@tanstack/react-query");
|
|
3834
|
+
|
|
3835
|
+
// src/hooks/view/use-get-fields-view-security.ts
|
|
3836
|
+
var import_react_query63 = require("@tanstack/react-query");
|
|
3837
|
+
|
|
3838
|
+
// src/hooks/view/use-grant-access.ts
|
|
3839
|
+
var import_react_query64 = require("@tanstack/react-query");
|
|
3840
|
+
|
|
3841
|
+
// src/hooks/view/use-remove-totp-setup.ts
|
|
3842
|
+
var import_react_query65 = require("@tanstack/react-query");
|
|
3843
|
+
|
|
3844
|
+
// src/hooks/view/use-request-setup-totp.ts
|
|
3845
|
+
var import_react_query66 = require("@tanstack/react-query");
|
|
3846
|
+
|
|
3847
|
+
// src/hooks/view/use-settings-web-read-2fa.ts
|
|
3848
|
+
var import_react_query67 = require("@tanstack/react-query");
|
|
3849
|
+
|
|
3850
|
+
// src/hooks/view/use-verify-totp.ts
|
|
3851
|
+
var import_react_query68 = require("@tanstack/react-query");
|
|
3852
|
+
|
|
3853
|
+
// src/provider/version-gate-provider.tsx
|
|
3854
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3855
|
+
var VersionGate = ({ children }) => {
|
|
3856
|
+
const queryClient = (0, import_react_query69.useQueryClient)();
|
|
3857
|
+
const [ready, setReady] = (0, import_react5.useState)(false);
|
|
3858
|
+
const { getVersion } = useViewService();
|
|
3859
|
+
const login = use_login_credential_default();
|
|
3860
|
+
(0, import_react5.useEffect)(() => {
|
|
3861
|
+
const clearVersion = () => {
|
|
3862
|
+
queryClient.clear();
|
|
3863
|
+
localStorage.removeItem("__api_version__");
|
|
3864
|
+
};
|
|
3865
|
+
const validateVersion = async () => {
|
|
3866
|
+
const serverVersion = await getVersion();
|
|
3867
|
+
console.log("serverVersion", serverVersion);
|
|
3868
|
+
login.mutate(
|
|
3869
|
+
{
|
|
3870
|
+
email: "admin",
|
|
3871
|
+
password: "admin",
|
|
3872
|
+
path: "/authentication/oauth2/token"
|
|
3873
|
+
},
|
|
3874
|
+
{
|
|
3875
|
+
onSuccess: (res) => {
|
|
3876
|
+
console.log("res login", res);
|
|
3877
|
+
}
|
|
3878
|
+
}
|
|
3879
|
+
);
|
|
3880
|
+
const cached = localStorage.getItem("__api_version__");
|
|
3881
|
+
if (cached !== serverVersion?.api_version) {
|
|
3882
|
+
clearVersion();
|
|
3883
|
+
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
3884
|
+
} else {
|
|
3885
|
+
console.log("Api version:", serverVersion?.api_version);
|
|
3886
|
+
}
|
|
3887
|
+
setReady(true);
|
|
3888
|
+
};
|
|
3889
|
+
validateVersion();
|
|
3890
|
+
if (typeof window !== "undefined") {
|
|
3891
|
+
const onKey = (e) => {
|
|
3892
|
+
const key = e.key.toLowerCase();
|
|
3893
|
+
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
3894
|
+
if (isHardRefresh) clearVersion();
|
|
3895
|
+
};
|
|
3896
|
+
window.addEventListener("keydown", onKey);
|
|
3897
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
3898
|
+
}
|
|
3899
|
+
}, [queryClient]);
|
|
3900
|
+
return ready ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children }) : null;
|
|
3901
|
+
};
|
|
3902
|
+
|
|
3458
3903
|
// src/provider/env-share.tsx
|
|
3459
|
-
var
|
|
3904
|
+
var import_react6 = require("react");
|
|
3460
3905
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3461
|
-
var EnvShareContext = (0,
|
|
3906
|
+
var EnvShareContext = (0, import_react6.createContext)(null);
|
|
3462
3907
|
function EnvShareProvider({
|
|
3463
3908
|
children,
|
|
3464
3909
|
env
|
|
@@ -3466,7 +3911,7 @@ function EnvShareProvider({
|
|
|
3466
3911
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EnvShareContext.Provider, { value: env, children });
|
|
3467
3912
|
}
|
|
3468
3913
|
function useSharedEnv() {
|
|
3469
|
-
const env = (0,
|
|
3914
|
+
const env = (0, import_react6.useContext)(EnvShareContext);
|
|
3470
3915
|
if (!env) {
|
|
3471
3916
|
throw new Error("useSharedEnv must be used within an EnvShareProvider");
|
|
3472
3917
|
}
|
package/dist/provider.mjs
CHANGED
|
@@ -648,7 +648,7 @@ var MainProvider = ({ children }) => {
|
|
|
648
648
|
};
|
|
649
649
|
|
|
650
650
|
// src/provider/version-gate-provider.tsx
|
|
651
|
-
import { useEffect, useState } from "react";
|
|
651
|
+
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
652
652
|
import { useQueryClient } from "@tanstack/react-query";
|
|
653
653
|
|
|
654
654
|
// src/services/view-service/backup.ts
|
|
@@ -902,45 +902,8 @@ function useViewService() {
|
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
904
|
|
|
905
|
-
// src/
|
|
906
|
-
import {
|
|
907
|
-
var VersionGate = ({ children }) => {
|
|
908
|
-
const queryClient = useQueryClient();
|
|
909
|
-
const [ready, setReady] = useState(false);
|
|
910
|
-
const { getVersion } = useViewService();
|
|
911
|
-
useEffect(() => {
|
|
912
|
-
const clearVersion = () => {
|
|
913
|
-
queryClient.clear();
|
|
914
|
-
localStorage.removeItem("__api_version__");
|
|
915
|
-
};
|
|
916
|
-
const validateVersion = async () => {
|
|
917
|
-
const serverVersion = await getVersion();
|
|
918
|
-
console.log("serverVersion", serverVersion);
|
|
919
|
-
const cached = localStorage.getItem("__api_version__");
|
|
920
|
-
if (cached !== serverVersion?.api_version) {
|
|
921
|
-
clearVersion();
|
|
922
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
923
|
-
} else {
|
|
924
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
925
|
-
}
|
|
926
|
-
setReady(true);
|
|
927
|
-
};
|
|
928
|
-
validateVersion();
|
|
929
|
-
if (typeof window !== "undefined") {
|
|
930
|
-
const onKey = (e) => {
|
|
931
|
-
const key = e.key.toLowerCase();
|
|
932
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
933
|
-
if (isHardRefresh) clearVersion();
|
|
934
|
-
};
|
|
935
|
-
window.addEventListener("keydown", onKey);
|
|
936
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
937
|
-
}
|
|
938
|
-
}, [queryClient]);
|
|
939
|
-
return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
// src/provider/env-provider.tsx
|
|
943
|
-
import { createContext, useContext, useState as useState3, useCallback as useCallback2 } from "react";
|
|
905
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
906
|
+
import { useMutation } from "@tanstack/react-query";
|
|
944
907
|
|
|
945
908
|
// src/configs/axios-client.ts
|
|
946
909
|
import axios from "axios";
|
|
@@ -3055,7 +3018,7 @@ function matchDomain(record, domain) {
|
|
|
3055
3018
|
}
|
|
3056
3019
|
|
|
3057
3020
|
// src/utils/function.ts
|
|
3058
|
-
import { useEffect
|
|
3021
|
+
import { useEffect, useState } from "react";
|
|
3059
3022
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
3060
3023
|
if (!originalRequest.data) return originalRequest.data;
|
|
3061
3024
|
if (typeof originalRequest.data === "string") {
|
|
@@ -3286,8 +3249,241 @@ var axiosClient = {
|
|
|
3286
3249
|
}
|
|
3287
3250
|
};
|
|
3288
3251
|
|
|
3252
|
+
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
3253
|
+
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
3254
|
+
|
|
3255
|
+
// src/hooks/auth/use-get-provider.ts
|
|
3256
|
+
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
3257
|
+
|
|
3258
|
+
// src/hooks/auth/use-isvalid-token.ts
|
|
3259
|
+
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
3260
|
+
|
|
3261
|
+
// src/hooks/auth/use-login-credential.tsx
|
|
3262
|
+
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
3263
|
+
|
|
3264
|
+
// src/services/auth-service/backup.ts
|
|
3265
|
+
import { useCallback as useCallback2 } from "react";
|
|
3266
|
+
function useAuthService() {
|
|
3267
|
+
const { env } = useEnv();
|
|
3268
|
+
console.log("auth env", env);
|
|
3269
|
+
const login = useCallback2(
|
|
3270
|
+
async (body) => {
|
|
3271
|
+
const payload = Object.fromEntries(
|
|
3272
|
+
Object.entries({
|
|
3273
|
+
username: body.email,
|
|
3274
|
+
password: body.password,
|
|
3275
|
+
grant_type: env?.config?.grantType || "",
|
|
3276
|
+
client_id: env?.config?.clientId || "",
|
|
3277
|
+
client_secret: env?.config?.clientSecret || ""
|
|
3278
|
+
}).filter(([_, value]) => !!value)
|
|
3279
|
+
);
|
|
3280
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
3281
|
+
return env?.requests?.post(body.path, encodedData, {
|
|
3282
|
+
headers: {
|
|
3283
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3284
|
+
}
|
|
3285
|
+
});
|
|
3286
|
+
},
|
|
3287
|
+
[env]
|
|
3288
|
+
);
|
|
3289
|
+
const forgotPassword = useCallback2(
|
|
3290
|
+
async (email) => {
|
|
3291
|
+
const bodyData = {
|
|
3292
|
+
login: email,
|
|
3293
|
+
url: `${window.location.origin}/reset-password`
|
|
3294
|
+
};
|
|
3295
|
+
return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3296
|
+
headers: {
|
|
3297
|
+
"Content-Type": "application/json"
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
},
|
|
3301
|
+
[env]
|
|
3302
|
+
);
|
|
3303
|
+
const forgotPasswordSSO = useCallback2(
|
|
3304
|
+
async ({
|
|
3305
|
+
email,
|
|
3306
|
+
with_context,
|
|
3307
|
+
method
|
|
3308
|
+
}) => {
|
|
3309
|
+
const body = {
|
|
3310
|
+
method,
|
|
3311
|
+
kwargs: {
|
|
3312
|
+
vals: {
|
|
3313
|
+
email
|
|
3314
|
+
}
|
|
3315
|
+
},
|
|
3316
|
+
with_context
|
|
3317
|
+
};
|
|
3318
|
+
return env?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3319
|
+
headers: {
|
|
3320
|
+
"Content-Type": "application/json"
|
|
3321
|
+
}
|
|
3322
|
+
});
|
|
3323
|
+
},
|
|
3324
|
+
[env]
|
|
3325
|
+
);
|
|
3326
|
+
const resetPassword = useCallback2(
|
|
3327
|
+
async (data, token) => {
|
|
3328
|
+
const bodyData = {
|
|
3329
|
+
token,
|
|
3330
|
+
password: data.password,
|
|
3331
|
+
new_password: data.confirmPassword
|
|
3332
|
+
};
|
|
3333
|
+
return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3334
|
+
headers: {
|
|
3335
|
+
"Content-Type": "application/json"
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
},
|
|
3339
|
+
[env]
|
|
3340
|
+
);
|
|
3341
|
+
const resetPasswordSSO = useCallback2(
|
|
3342
|
+
async ({
|
|
3343
|
+
method,
|
|
3344
|
+
password,
|
|
3345
|
+
with_context
|
|
3346
|
+
}) => {
|
|
3347
|
+
const bodyData = {
|
|
3348
|
+
method,
|
|
3349
|
+
kwargs: {
|
|
3350
|
+
vals: {
|
|
3351
|
+
password
|
|
3352
|
+
}
|
|
3353
|
+
},
|
|
3354
|
+
with_context
|
|
3355
|
+
};
|
|
3356
|
+
return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3357
|
+
headers: {
|
|
3358
|
+
"Content-Type": "application/json"
|
|
3359
|
+
}
|
|
3360
|
+
});
|
|
3361
|
+
},
|
|
3362
|
+
[env]
|
|
3363
|
+
);
|
|
3364
|
+
const updatePassword = useCallback2(
|
|
3365
|
+
async (data, token) => {
|
|
3366
|
+
const bodyData = {
|
|
3367
|
+
token,
|
|
3368
|
+
old_password: data.oldPassword,
|
|
3369
|
+
new_password: data.newPassword
|
|
3370
|
+
};
|
|
3371
|
+
return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3372
|
+
headers: {
|
|
3373
|
+
"Content-Type": "application/json"
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3376
|
+
},
|
|
3377
|
+
[env]
|
|
3378
|
+
);
|
|
3379
|
+
const isValidToken = useCallback2(
|
|
3380
|
+
async (token) => {
|
|
3381
|
+
const bodyData = {
|
|
3382
|
+
token
|
|
3383
|
+
};
|
|
3384
|
+
return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3385
|
+
headers: {
|
|
3386
|
+
"Content-Type": "application/json"
|
|
3387
|
+
}
|
|
3388
|
+
});
|
|
3389
|
+
},
|
|
3390
|
+
[env]
|
|
3391
|
+
);
|
|
3392
|
+
const isValidActionToken = useCallback2(
|
|
3393
|
+
async (actionToken, path) => {
|
|
3394
|
+
return env?.requests?.post(
|
|
3395
|
+
path,
|
|
3396
|
+
{},
|
|
3397
|
+
{
|
|
3398
|
+
headers: {
|
|
3399
|
+
"Content-Type": "application/json"
|
|
3400
|
+
},
|
|
3401
|
+
useActionToken: true,
|
|
3402
|
+
actionToken
|
|
3403
|
+
}
|
|
3404
|
+
);
|
|
3405
|
+
},
|
|
3406
|
+
[env]
|
|
3407
|
+
);
|
|
3408
|
+
const loginSocial = useCallback2(
|
|
3409
|
+
async ({
|
|
3410
|
+
db,
|
|
3411
|
+
state,
|
|
3412
|
+
access_token
|
|
3413
|
+
}) => {
|
|
3414
|
+
return env?.requests?.post(
|
|
3415
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3416
|
+
{ state, access_token },
|
|
3417
|
+
{
|
|
3418
|
+
headers: {
|
|
3419
|
+
"Content-Type": "application/json"
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
);
|
|
3423
|
+
},
|
|
3424
|
+
[env]
|
|
3425
|
+
);
|
|
3426
|
+
const getProviders = useCallback2(
|
|
3427
|
+
async (db) => {
|
|
3428
|
+
return env?.requests?.get("/oauth/providers", { params: { db } });
|
|
3429
|
+
},
|
|
3430
|
+
[env]
|
|
3431
|
+
);
|
|
3432
|
+
const getAccessByCode = useCallback2(
|
|
3433
|
+
async (code) => {
|
|
3434
|
+
const data = new URLSearchParams();
|
|
3435
|
+
data.append("code", code);
|
|
3436
|
+
data.append("grant_type", "authorization_code");
|
|
3437
|
+
data.append("client_id", env?.config?.clientId || "");
|
|
3438
|
+
data.append("redirect_uri", env?.config?.redirectUri || "");
|
|
3439
|
+
return env?.requests?.post(
|
|
3440
|
+
`${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3441
|
+
data,
|
|
3442
|
+
{
|
|
3443
|
+
headers: {
|
|
3444
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
);
|
|
3448
|
+
},
|
|
3449
|
+
[env]
|
|
3450
|
+
);
|
|
3451
|
+
const logout = useCallback2(
|
|
3452
|
+
async (data) => {
|
|
3453
|
+
console.log(data);
|
|
3454
|
+
return env?.requests?.post(
|
|
3455
|
+
"/logout" /* LOGOUT */,
|
|
3456
|
+
{},
|
|
3457
|
+
{
|
|
3458
|
+
headers: {
|
|
3459
|
+
"Content-Type": "application/json"
|
|
3460
|
+
},
|
|
3461
|
+
withCredentials: true,
|
|
3462
|
+
useRefreshToken: true
|
|
3463
|
+
}
|
|
3464
|
+
);
|
|
3465
|
+
},
|
|
3466
|
+
[env]
|
|
3467
|
+
);
|
|
3468
|
+
return {
|
|
3469
|
+
login,
|
|
3470
|
+
forgotPassword,
|
|
3471
|
+
forgotPasswordSSO,
|
|
3472
|
+
resetPassword,
|
|
3473
|
+
resetPasswordSSO,
|
|
3474
|
+
updatePassword,
|
|
3475
|
+
isValidToken,
|
|
3476
|
+
isValidActionToken,
|
|
3477
|
+
loginSocial,
|
|
3478
|
+
getProviders,
|
|
3479
|
+
getAccessByCode,
|
|
3480
|
+
logout
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
|
|
3289
3484
|
// src/provider/env-provider.tsx
|
|
3290
|
-
import {
|
|
3485
|
+
import { createContext, useContext, useState as useState2, useCallback as useCallback3 } from "react";
|
|
3486
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
3291
3487
|
var initialEnvState = {
|
|
3292
3488
|
env: null,
|
|
3293
3489
|
baseUrl: "",
|
|
@@ -3315,12 +3511,12 @@ function EnvProvider({
|
|
|
3315
3511
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
3316
3512
|
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
3317
3513
|
}) {
|
|
3318
|
-
const [env, setEnvState] =
|
|
3514
|
+
const [env, setEnvState] = useState2({
|
|
3319
3515
|
...initialEnvState,
|
|
3320
3516
|
localStorageUtils: localStorageUtil,
|
|
3321
3517
|
sessionStorageUtils: sessionStorageUtil
|
|
3322
3518
|
});
|
|
3323
|
-
const setupEnv =
|
|
3519
|
+
const setupEnv = useCallback3(
|
|
3324
3520
|
(envConfig) => {
|
|
3325
3521
|
const updatedEnv = {
|
|
3326
3522
|
...env,
|
|
@@ -3334,31 +3530,31 @@ function EnvProvider({
|
|
|
3334
3530
|
},
|
|
3335
3531
|
[env, localStorageUtil, sessionStorageUtil]
|
|
3336
3532
|
);
|
|
3337
|
-
const setUid2 =
|
|
3533
|
+
const setUid2 = useCallback3((uid) => {
|
|
3338
3534
|
setEnvState((prev) => ({
|
|
3339
3535
|
...prev,
|
|
3340
3536
|
context: { ...prev.context, uid }
|
|
3341
3537
|
}));
|
|
3342
3538
|
}, []);
|
|
3343
|
-
const setLang2 =
|
|
3539
|
+
const setLang2 = useCallback3((lang) => {
|
|
3344
3540
|
setEnvState((prev) => ({
|
|
3345
3541
|
...prev,
|
|
3346
3542
|
context: { ...prev.context, lang }
|
|
3347
3543
|
}));
|
|
3348
3544
|
}, []);
|
|
3349
|
-
const setAllowCompanies2 =
|
|
3545
|
+
const setAllowCompanies2 = useCallback3((allowed_company_ids) => {
|
|
3350
3546
|
setEnvState((prev) => ({
|
|
3351
3547
|
...prev,
|
|
3352
3548
|
context: { ...prev.context, allowed_company_ids }
|
|
3353
3549
|
}));
|
|
3354
3550
|
}, []);
|
|
3355
|
-
const setCompanies2 =
|
|
3551
|
+
const setCompanies2 = useCallback3((companies) => {
|
|
3356
3552
|
setEnvState((prev) => ({
|
|
3357
3553
|
...prev,
|
|
3358
3554
|
companies
|
|
3359
3555
|
}));
|
|
3360
3556
|
}, []);
|
|
3361
|
-
const setDefaultCompany2 =
|
|
3557
|
+
const setDefaultCompany2 = useCallback3(
|
|
3362
3558
|
(defaultCompany) => {
|
|
3363
3559
|
setEnvState((prev) => ({
|
|
3364
3560
|
...prev,
|
|
@@ -3367,25 +3563,25 @@ function EnvProvider({
|
|
|
3367
3563
|
},
|
|
3368
3564
|
[]
|
|
3369
3565
|
);
|
|
3370
|
-
const setUserInfo =
|
|
3566
|
+
const setUserInfo = useCallback3((user) => {
|
|
3371
3567
|
setEnvState((prev) => ({
|
|
3372
3568
|
...prev,
|
|
3373
3569
|
user
|
|
3374
3570
|
}));
|
|
3375
3571
|
}, []);
|
|
3376
|
-
const setConfig2 =
|
|
3572
|
+
const setConfig2 = useCallback3((config) => {
|
|
3377
3573
|
setEnvState((prev) => ({
|
|
3378
3574
|
...prev,
|
|
3379
3575
|
config
|
|
3380
3576
|
}));
|
|
3381
3577
|
}, []);
|
|
3382
|
-
const setEnvFile2 =
|
|
3578
|
+
const setEnvFile2 = useCallback3((envFile) => {
|
|
3383
3579
|
setEnvState((prev) => ({
|
|
3384
3580
|
...prev,
|
|
3385
3581
|
envFile
|
|
3386
3582
|
}));
|
|
3387
3583
|
}, []);
|
|
3388
|
-
return /* @__PURE__ */
|
|
3584
|
+
return /* @__PURE__ */ jsx4(
|
|
3389
3585
|
EnvContext.Provider,
|
|
3390
3586
|
{
|
|
3391
3587
|
value: {
|
|
@@ -3413,6 +3609,255 @@ function useEnv() {
|
|
|
3413
3609
|
return context;
|
|
3414
3610
|
}
|
|
3415
3611
|
|
|
3612
|
+
// src/hooks/auth/use-login-credential.tsx
|
|
3613
|
+
var useLoginCredential = () => {
|
|
3614
|
+
const { env } = useEnv();
|
|
3615
|
+
console.log("useLoginCredential called", env, new Error().stack);
|
|
3616
|
+
const { login } = useAuthService();
|
|
3617
|
+
return useMutation5({
|
|
3618
|
+
mutationFn: (data) => {
|
|
3619
|
+
return login(data);
|
|
3620
|
+
}
|
|
3621
|
+
});
|
|
3622
|
+
};
|
|
3623
|
+
var use_login_credential_default = useLoginCredential;
|
|
3624
|
+
|
|
3625
|
+
// src/hooks/auth/use-login-socical.ts
|
|
3626
|
+
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
3627
|
+
|
|
3628
|
+
// src/hooks/auth/use-reset-password.ts
|
|
3629
|
+
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
3630
|
+
|
|
3631
|
+
// src/hooks/auth/use-reset-password-sso.ts
|
|
3632
|
+
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
3633
|
+
|
|
3634
|
+
// src/hooks/auth/use-update-password.ts
|
|
3635
|
+
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
3636
|
+
|
|
3637
|
+
// src/hooks/auth/use-logout.ts
|
|
3638
|
+
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
3639
|
+
|
|
3640
|
+
// src/hooks/auth/use-get-access-by-code.ts
|
|
3641
|
+
import { useMutation as useMutation11 } from "@tanstack/react-query";
|
|
3642
|
+
|
|
3643
|
+
// src/hooks/auth/use-validate-action-token.ts
|
|
3644
|
+
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
3645
|
+
|
|
3646
|
+
// src/hooks/company/use-get-company-info.ts
|
|
3647
|
+
import { useMutation as useMutation13 } from "@tanstack/react-query";
|
|
3648
|
+
|
|
3649
|
+
// src/hooks/company/use-get-current-company.ts
|
|
3650
|
+
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
3651
|
+
|
|
3652
|
+
// src/hooks/company/use-get-list-company.ts
|
|
3653
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3654
|
+
|
|
3655
|
+
// src/hooks/excel/use-export-excel.ts
|
|
3656
|
+
import { useMutation as useMutation15 } from "@tanstack/react-query";
|
|
3657
|
+
|
|
3658
|
+
// src/hooks/excel/use-get-field-export.ts
|
|
3659
|
+
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
3660
|
+
|
|
3661
|
+
// src/hooks/excel/use-get-file-excel.ts
|
|
3662
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3663
|
+
|
|
3664
|
+
// src/hooks/excel/use-parse-preview.ts
|
|
3665
|
+
import { useMutation as useMutation17 } from "@tanstack/react-query";
|
|
3666
|
+
|
|
3667
|
+
// src/hooks/excel/use-upload-file.ts
|
|
3668
|
+
import { useMutation as useMutation18 } from "@tanstack/react-query";
|
|
3669
|
+
|
|
3670
|
+
// src/hooks/excel/use-upload-id-file.ts
|
|
3671
|
+
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
3672
|
+
|
|
3673
|
+
// src/hooks/excel/uss-execute-import.ts
|
|
3674
|
+
import { useMutation as useMutation20 } from "@tanstack/react-query";
|
|
3675
|
+
|
|
3676
|
+
// src/hooks/form/use-change-status.ts
|
|
3677
|
+
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
3678
|
+
|
|
3679
|
+
// src/hooks/form/use-delete-comment.ts
|
|
3680
|
+
import { useMutation as useMutation22 } from "@tanstack/react-query";
|
|
3681
|
+
|
|
3682
|
+
// src/hooks/form/use-get-comment.ts
|
|
3683
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
3684
|
+
|
|
3685
|
+
// src/hooks/form/use-get-form-view.ts
|
|
3686
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
3687
|
+
|
|
3688
|
+
// src/hooks/form/use-get-image.ts
|
|
3689
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3690
|
+
|
|
3691
|
+
// src/hooks/form/use-send-comment.ts
|
|
3692
|
+
import { useMutation as useMutation23 } from "@tanstack/react-query";
|
|
3693
|
+
|
|
3694
|
+
// src/hooks/form/use-upload-image.ts
|
|
3695
|
+
import { useMutation as useMutation24 } from "@tanstack/react-query";
|
|
3696
|
+
|
|
3697
|
+
// src/hooks/model/use-delete.ts
|
|
3698
|
+
import { useMutation as useMutation25 } from "@tanstack/react-query";
|
|
3699
|
+
|
|
3700
|
+
// src/hooks/model/use-get-all.ts
|
|
3701
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3702
|
+
|
|
3703
|
+
// src/hooks/model/use-get-conversion-rate.ts
|
|
3704
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
3705
|
+
|
|
3706
|
+
// src/hooks/model/use-get-currency.ts
|
|
3707
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
3708
|
+
|
|
3709
|
+
// src/hooks/model/use-get-detail.ts
|
|
3710
|
+
import { useMutation as useMutation26 } from "@tanstack/react-query";
|
|
3711
|
+
|
|
3712
|
+
// src/hooks/model/use-get-field-onchange.ts
|
|
3713
|
+
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
3714
|
+
|
|
3715
|
+
// src/hooks/model/use-get-list-my-bank-account.ts
|
|
3716
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
3717
|
+
|
|
3718
|
+
// src/hooks/model/use-onchange-form.ts
|
|
3719
|
+
import { useMutation as useMutation27 } from "@tanstack/react-query";
|
|
3720
|
+
|
|
3721
|
+
// src/hooks/model/use-save.ts
|
|
3722
|
+
import { useMutation as useMutation28 } from "@tanstack/react-query";
|
|
3723
|
+
|
|
3724
|
+
// src/hooks/user/use-get-profile.ts
|
|
3725
|
+
import { useMutation as useMutation29 } from "@tanstack/react-query";
|
|
3726
|
+
|
|
3727
|
+
// src/hooks/user/use-get-user.ts
|
|
3728
|
+
import { useMutation as useMutation30 } from "@tanstack/react-query";
|
|
3729
|
+
|
|
3730
|
+
// src/hooks/user/use-switch-locale.ts
|
|
3731
|
+
import { useMutation as useMutation31 } from "@tanstack/react-query";
|
|
3732
|
+
|
|
3733
|
+
// src/hooks/view/use-button.ts
|
|
3734
|
+
import { useMutation as useMutation32 } from "@tanstack/react-query";
|
|
3735
|
+
|
|
3736
|
+
// src/hooks/view/use-duplicate-record.ts
|
|
3737
|
+
import { useMutation as useMutation33 } from "@tanstack/react-query";
|
|
3738
|
+
|
|
3739
|
+
// src/hooks/view/use-get-action-detail.ts
|
|
3740
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
3741
|
+
|
|
3742
|
+
// src/hooks/view/use-get-calendar.ts
|
|
3743
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
3744
|
+
|
|
3745
|
+
// src/hooks/view/use-get-groups.ts
|
|
3746
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
3747
|
+
|
|
3748
|
+
// src/hooks/view/use-get-list-data.ts
|
|
3749
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
3750
|
+
|
|
3751
|
+
// src/hooks/view/use-get-menu.ts
|
|
3752
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
3753
|
+
|
|
3754
|
+
// src/hooks/view/use-get-print-report.ts
|
|
3755
|
+
import { useMutation as useMutation34 } from "@tanstack/react-query";
|
|
3756
|
+
|
|
3757
|
+
// src/hooks/view/use-get-progress-bar.ts
|
|
3758
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
3759
|
+
|
|
3760
|
+
// src/hooks/view/use-get-selection.ts
|
|
3761
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
3762
|
+
|
|
3763
|
+
// src/hooks/view/use-get-view.ts
|
|
3764
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
3765
|
+
|
|
3766
|
+
// src/hooks/view/use-load-action.ts
|
|
3767
|
+
import { useMutation as useMutation35 } from "@tanstack/react-query";
|
|
3768
|
+
|
|
3769
|
+
// src/hooks/view/use-load-message.ts
|
|
3770
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
3771
|
+
|
|
3772
|
+
// src/hooks/view/use-print.ts
|
|
3773
|
+
import { useMutation as useMutation36 } from "@tanstack/react-query";
|
|
3774
|
+
|
|
3775
|
+
// src/hooks/view/use-remove-row.ts
|
|
3776
|
+
import { useMutation as useMutation37 } from "@tanstack/react-query";
|
|
3777
|
+
|
|
3778
|
+
// src/hooks/view/use-resequence.ts
|
|
3779
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
3780
|
+
|
|
3781
|
+
// src/hooks/view/use-run-action.ts
|
|
3782
|
+
import { useMutation as useMutation38 } from "@tanstack/react-query";
|
|
3783
|
+
|
|
3784
|
+
// src/hooks/view/use-signin-sso.ts
|
|
3785
|
+
import { useMutation as useMutation39 } from "@tanstack/react-query";
|
|
3786
|
+
|
|
3787
|
+
// src/hooks/view/use-verify-2FA.ts
|
|
3788
|
+
import { useMutation as useMutation40 } from "@tanstack/react-query";
|
|
3789
|
+
|
|
3790
|
+
// src/hooks/view/uset-get-2FA-method.ts
|
|
3791
|
+
import { useMutation as useMutation41 } from "@tanstack/react-query";
|
|
3792
|
+
|
|
3793
|
+
// src/hooks/view/use-get-fields-view-security.ts
|
|
3794
|
+
import { useMutation as useMutation42 } from "@tanstack/react-query";
|
|
3795
|
+
|
|
3796
|
+
// src/hooks/view/use-grant-access.ts
|
|
3797
|
+
import { useMutation as useMutation43 } from "@tanstack/react-query";
|
|
3798
|
+
|
|
3799
|
+
// src/hooks/view/use-remove-totp-setup.ts
|
|
3800
|
+
import { useMutation as useMutation44 } from "@tanstack/react-query";
|
|
3801
|
+
|
|
3802
|
+
// src/hooks/view/use-request-setup-totp.ts
|
|
3803
|
+
import { useMutation as useMutation45 } from "@tanstack/react-query";
|
|
3804
|
+
|
|
3805
|
+
// src/hooks/view/use-settings-web-read-2fa.ts
|
|
3806
|
+
import { useMutation as useMutation46 } from "@tanstack/react-query";
|
|
3807
|
+
|
|
3808
|
+
// src/hooks/view/use-verify-totp.ts
|
|
3809
|
+
import { useMutation as useMutation47 } from "@tanstack/react-query";
|
|
3810
|
+
|
|
3811
|
+
// src/provider/version-gate-provider.tsx
|
|
3812
|
+
import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
|
|
3813
|
+
var VersionGate = ({ children }) => {
|
|
3814
|
+
const queryClient = useQueryClient();
|
|
3815
|
+
const [ready, setReady] = useState3(false);
|
|
3816
|
+
const { getVersion } = useViewService();
|
|
3817
|
+
const login = use_login_credential_default();
|
|
3818
|
+
useEffect2(() => {
|
|
3819
|
+
const clearVersion = () => {
|
|
3820
|
+
queryClient.clear();
|
|
3821
|
+
localStorage.removeItem("__api_version__");
|
|
3822
|
+
};
|
|
3823
|
+
const validateVersion = async () => {
|
|
3824
|
+
const serverVersion = await getVersion();
|
|
3825
|
+
console.log("serverVersion", serverVersion);
|
|
3826
|
+
login.mutate(
|
|
3827
|
+
{
|
|
3828
|
+
email: "admin",
|
|
3829
|
+
password: "admin",
|
|
3830
|
+
path: "/authentication/oauth2/token"
|
|
3831
|
+
},
|
|
3832
|
+
{
|
|
3833
|
+
onSuccess: (res) => {
|
|
3834
|
+
console.log("res login", res);
|
|
3835
|
+
}
|
|
3836
|
+
}
|
|
3837
|
+
);
|
|
3838
|
+
const cached = localStorage.getItem("__api_version__");
|
|
3839
|
+
if (cached !== serverVersion?.api_version) {
|
|
3840
|
+
clearVersion();
|
|
3841
|
+
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
3842
|
+
} else {
|
|
3843
|
+
console.log("Api version:", serverVersion?.api_version);
|
|
3844
|
+
}
|
|
3845
|
+
setReady(true);
|
|
3846
|
+
};
|
|
3847
|
+
validateVersion();
|
|
3848
|
+
if (typeof window !== "undefined") {
|
|
3849
|
+
const onKey = (e) => {
|
|
3850
|
+
const key = e.key.toLowerCase();
|
|
3851
|
+
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
3852
|
+
if (isHardRefresh) clearVersion();
|
|
3853
|
+
};
|
|
3854
|
+
window.addEventListener("keydown", onKey);
|
|
3855
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
3856
|
+
}
|
|
3857
|
+
}, [queryClient]);
|
|
3858
|
+
return ready ? /* @__PURE__ */ jsx5(Fragment, { children }) : null;
|
|
3859
|
+
};
|
|
3860
|
+
|
|
3416
3861
|
// src/provider/env-share.tsx
|
|
3417
3862
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
3418
3863
|
import { jsx as jsx6 } from "react/jsx-runtime";
|