@fctc/interface-logic 1.10.5 → 1.10.7
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/{view-type-D8ukwj_2.d.mts → api-type-DfAFCfCw.d.mts} +1 -15
- package/dist/{view-type-D8ukwj_2.d.ts → api-type-DfAFCfCw.d.ts} +1 -15
- package/dist/hooks.d.mts +4 -227
- package/dist/hooks.d.ts +4 -227
- package/dist/hooks.js +19 -35
- package/dist/hooks.mjs +6 -22
- package/dist/provider.d.mts +55 -2
- package/dist/provider.d.ts +55 -2
- package/dist/provider.js +1817 -56
- package/dist/provider.mjs +1814 -55
- package/dist/services.d.mts +2 -1
- package/dist/services.d.ts +2 -1
- package/dist/types.d.mts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/use-switch-locale-BFEf9mtg.d.mts +229 -0
- package/dist/use-switch-locale-y3Oki_i5.d.ts +229 -0
- package/dist/view-type-C6Eej-Ij.d.mts +15 -0
- package/dist/view-type-C6Eej-Ij.d.ts +15 -0
- package/package.json +1 -1
package/dist/provider.mjs
CHANGED
|
@@ -653,8 +653,47 @@ import { useQueryClient } from "@tanstack/react-query";
|
|
|
653
653
|
|
|
654
654
|
// src/services/view-service/backup.ts
|
|
655
655
|
import { useCallback } from "react";
|
|
656
|
+
|
|
657
|
+
// src/constants/api/uri-constant.ts
|
|
658
|
+
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
659
|
+
UriConstants2["AUTH_TOKEN_PATH"] = "/authentication/oauth2/token";
|
|
660
|
+
UriConstants2["GENTOKEN_SOCIAL"] = "/token/generate";
|
|
661
|
+
UriConstants2["CALL_PATH"] = "/call";
|
|
662
|
+
UriConstants2["COMPANY_PATH"] = "/company";
|
|
663
|
+
UriConstants2["PROFILE_PATH"] = "/userinfo";
|
|
664
|
+
UriConstants2["RESET_PASSWORD_PATH"] = "/reset_password";
|
|
665
|
+
UriConstants2["CHANGE_PASSWORD_PATH"] = "/change_password";
|
|
666
|
+
UriConstants2["UPDATE_PASSWORD_PATH"] = "/change_password_parent";
|
|
667
|
+
UriConstants2["LOAD_ACTION"] = `/load_action`;
|
|
668
|
+
UriConstants2["REPORT_PATH"] = `/report`;
|
|
669
|
+
UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
|
|
670
|
+
UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
|
|
671
|
+
UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
|
|
672
|
+
UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
|
|
673
|
+
UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
|
|
674
|
+
UriConstants2["DELETE_MESSAGE"] = `/chatter/message/update_content`;
|
|
675
|
+
UriConstants2["IMAGE_PATH"] = `/web/image`;
|
|
676
|
+
UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
|
|
677
|
+
UriConstants2["TOKEN"] = `/check_token`;
|
|
678
|
+
UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
|
|
679
|
+
UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
|
|
680
|
+
UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
|
|
681
|
+
UriConstants2["GRANT_ACCESS"] = "/grant-access";
|
|
682
|
+
UriConstants2["TOKEN_BY_CODE"] = "/token";
|
|
683
|
+
UriConstants2["LOGOUT"] = "/logout";
|
|
684
|
+
return UriConstants2;
|
|
685
|
+
})(UriConstants || {});
|
|
686
|
+
|
|
687
|
+
// src/constants/widget/widget-avatar-constant.ts
|
|
688
|
+
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
689
|
+
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
690
|
+
WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
|
|
691
|
+
return WIDGETAVATAR2;
|
|
692
|
+
})(WIDGETAVATAR || {});
|
|
693
|
+
|
|
694
|
+
// src/services/view-service/backup.ts
|
|
656
695
|
function useViewService() {
|
|
657
|
-
const { env } = useEnv();
|
|
696
|
+
const { env: env2 } = useEnv();
|
|
658
697
|
const getView = useCallback(
|
|
659
698
|
async ({ model, views, context = {}, options = {}, aid }) => {
|
|
660
699
|
const defaultOptions = {
|
|
@@ -671,13 +710,13 @@ function useViewService() {
|
|
|
671
710
|
},
|
|
672
711
|
with_context: context
|
|
673
712
|
};
|
|
674
|
-
return
|
|
713
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
|
|
675
714
|
headers: {
|
|
676
715
|
"Content-Type": "application/json"
|
|
677
716
|
}
|
|
678
717
|
});
|
|
679
718
|
},
|
|
680
|
-
[
|
|
719
|
+
[env2]
|
|
681
720
|
);
|
|
682
721
|
const getMenu = useCallback(
|
|
683
722
|
async (context) => {
|
|
@@ -784,13 +823,13 @@ function useViewService() {
|
|
|
784
823
|
]
|
|
785
824
|
}
|
|
786
825
|
};
|
|
787
|
-
return
|
|
826
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
788
827
|
headers: {
|
|
789
828
|
"Content-Type": "application/json"
|
|
790
829
|
}
|
|
791
830
|
});
|
|
792
831
|
},
|
|
793
|
-
[
|
|
832
|
+
[env2]
|
|
794
833
|
);
|
|
795
834
|
const getActionDetail = useCallback(
|
|
796
835
|
async (aid, context) => {
|
|
@@ -814,13 +853,13 @@ function useViewService() {
|
|
|
814
853
|
}
|
|
815
854
|
}
|
|
816
855
|
};
|
|
817
|
-
return
|
|
856
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
818
857
|
headers: {
|
|
819
858
|
"Content-Type": "application/json"
|
|
820
859
|
}
|
|
821
860
|
});
|
|
822
861
|
},
|
|
823
|
-
[
|
|
862
|
+
[env2]
|
|
824
863
|
);
|
|
825
864
|
const getResequence = useCallback(
|
|
826
865
|
async ({ model, ids, context, offset }) => {
|
|
@@ -831,13 +870,13 @@ function useViewService() {
|
|
|
831
870
|
field: "sequence",
|
|
832
871
|
...offset > 0 ? { offset } : {}
|
|
833
872
|
};
|
|
834
|
-
return
|
|
873
|
+
return env2?.requests.post("/web/dataset/resequence", jsonData, {
|
|
835
874
|
headers: {
|
|
836
875
|
"Content-Type": "application/json"
|
|
837
876
|
}
|
|
838
877
|
});
|
|
839
878
|
},
|
|
840
|
-
[
|
|
879
|
+
[env2]
|
|
841
880
|
);
|
|
842
881
|
const getSelectionItem = useCallback(
|
|
843
882
|
async ({ data }) => {
|
|
@@ -858,17 +897,17 @@ function useViewService() {
|
|
|
858
897
|
}
|
|
859
898
|
}
|
|
860
899
|
};
|
|
861
|
-
return
|
|
900
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
862
901
|
headers: {
|
|
863
902
|
"Content-Type": "application/json"
|
|
864
903
|
}
|
|
865
904
|
});
|
|
866
905
|
},
|
|
867
|
-
[
|
|
906
|
+
[env2]
|
|
868
907
|
);
|
|
869
908
|
const loadMessages = useCallback(
|
|
870
909
|
async () => {
|
|
871
|
-
return
|
|
910
|
+
return env2.requests.post(
|
|
872
911
|
"/load_message_failures" /* LOAD_MESSAGE */,
|
|
873
912
|
{},
|
|
874
913
|
{
|
|
@@ -878,18 +917,18 @@ function useViewService() {
|
|
|
878
917
|
}
|
|
879
918
|
);
|
|
880
919
|
},
|
|
881
|
-
[
|
|
920
|
+
[env2]
|
|
882
921
|
);
|
|
883
922
|
const getVersion = useCallback(
|
|
884
923
|
async () => {
|
|
885
|
-
console.log("env?.requests",
|
|
886
|
-
return
|
|
924
|
+
console.log("env?.requests", env2, env2?.requests);
|
|
925
|
+
return env2?.requests?.get("", {
|
|
887
926
|
headers: {
|
|
888
927
|
"Content-Type": "application/json"
|
|
889
928
|
}
|
|
890
929
|
});
|
|
891
930
|
},
|
|
892
|
-
[
|
|
931
|
+
[env2]
|
|
893
932
|
);
|
|
894
933
|
return {
|
|
895
934
|
getView,
|
|
@@ -3019,6 +3058,21 @@ function matchDomain(record, domain) {
|
|
|
3019
3058
|
|
|
3020
3059
|
// src/utils/function.ts
|
|
3021
3060
|
import { useEffect, useState } from "react";
|
|
3061
|
+
var isBase64File = (str) => {
|
|
3062
|
+
try {
|
|
3063
|
+
const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
|
|
3064
|
+
if (dataUriPattern.test(str)) {
|
|
3065
|
+
return true;
|
|
3066
|
+
}
|
|
3067
|
+
const base64Pattern = (
|
|
3068
|
+
// eslint-disable-next-line no-useless-escape
|
|
3069
|
+
/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)?$/
|
|
3070
|
+
);
|
|
3071
|
+
return base64Pattern.test(str);
|
|
3072
|
+
} catch (e) {
|
|
3073
|
+
return false;
|
|
3074
|
+
}
|
|
3075
|
+
};
|
|
3022
3076
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
3023
3077
|
if (!originalRequest.data) return originalRequest.data;
|
|
3024
3078
|
if (typeof originalRequest.data === "string") {
|
|
@@ -3249,14 +3303,1070 @@ var axiosClient = {
|
|
|
3249
3303
|
}
|
|
3250
3304
|
};
|
|
3251
3305
|
|
|
3306
|
+
// src/environment/EnvStore.ts
|
|
3307
|
+
var EventEmitter = class {
|
|
3308
|
+
listeners = {};
|
|
3309
|
+
on(event, callback) {
|
|
3310
|
+
if (!this.listeners[event]) {
|
|
3311
|
+
this.listeners[event] = [];
|
|
3312
|
+
}
|
|
3313
|
+
this.listeners[event].push(callback);
|
|
3314
|
+
}
|
|
3315
|
+
emit(event, data) {
|
|
3316
|
+
if (this.listeners[event]) {
|
|
3317
|
+
this.listeners[event].forEach((callback) => callback(data));
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3321
|
+
var EnvStore = class {
|
|
3322
|
+
state;
|
|
3323
|
+
emitter;
|
|
3324
|
+
localStorageUtil;
|
|
3325
|
+
sessionStorageUtil;
|
|
3326
|
+
constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils()) {
|
|
3327
|
+
this.state = {
|
|
3328
|
+
baseUrl: "",
|
|
3329
|
+
requests: null,
|
|
3330
|
+
companies: [],
|
|
3331
|
+
user: {},
|
|
3332
|
+
config: null,
|
|
3333
|
+
envFile: null,
|
|
3334
|
+
defaultCompany: {
|
|
3335
|
+
id: null,
|
|
3336
|
+
logo: "",
|
|
3337
|
+
secondary_color: "",
|
|
3338
|
+
primary_color: ""
|
|
3339
|
+
},
|
|
3340
|
+
context: {
|
|
3341
|
+
uid: null,
|
|
3342
|
+
allowed_company_ids: [],
|
|
3343
|
+
lang: "vi_VN",
|
|
3344
|
+
tz: "Asia/Saigon"
|
|
3345
|
+
},
|
|
3346
|
+
localStorageUtils: localStorageUtil,
|
|
3347
|
+
sessionStorageUtils: sessionStorageUtil
|
|
3348
|
+
};
|
|
3349
|
+
this.emitter = new EventEmitter();
|
|
3350
|
+
this.localStorageUtil = localStorageUtil;
|
|
3351
|
+
this.sessionStorageUtil = sessionStorageUtil;
|
|
3352
|
+
}
|
|
3353
|
+
getEnv() {
|
|
3354
|
+
return { ...this.state };
|
|
3355
|
+
}
|
|
3356
|
+
onUpdate(callback) {
|
|
3357
|
+
this.emitter.on("update", callback);
|
|
3358
|
+
}
|
|
3359
|
+
setupEnv(envConfig) {
|
|
3360
|
+
this.state = {
|
|
3361
|
+
...this.state,
|
|
3362
|
+
...envConfig,
|
|
3363
|
+
localStorageUtils: this.localStorageUtil,
|
|
3364
|
+
sessionStorageUtils: this.sessionStorageUtil
|
|
3365
|
+
};
|
|
3366
|
+
this.state.requests = axiosClient.init(this.state);
|
|
3367
|
+
this.emitter.emit("update", this.getEnv());
|
|
3368
|
+
return this.getEnv();
|
|
3369
|
+
}
|
|
3370
|
+
setUid(uid) {
|
|
3371
|
+
this.state = {
|
|
3372
|
+
...this.state,
|
|
3373
|
+
context: { ...this.state.context, uid }
|
|
3374
|
+
};
|
|
3375
|
+
this.emitter.emit("update", this.getEnv());
|
|
3376
|
+
}
|
|
3377
|
+
setLang(lang) {
|
|
3378
|
+
this.state = {
|
|
3379
|
+
...this.state,
|
|
3380
|
+
context: { ...this.state.context, lang }
|
|
3381
|
+
};
|
|
3382
|
+
this.emitter.emit("update", this.getEnv());
|
|
3383
|
+
}
|
|
3384
|
+
setAllowCompanies(allowed_company_ids) {
|
|
3385
|
+
this.state = {
|
|
3386
|
+
...this.state,
|
|
3387
|
+
context: { ...this.state.context, allowed_company_ids }
|
|
3388
|
+
};
|
|
3389
|
+
this.emitter.emit("update", this.getEnv());
|
|
3390
|
+
}
|
|
3391
|
+
setCompanies(companies) {
|
|
3392
|
+
this.state = { ...this.state, companies };
|
|
3393
|
+
this.emitter.emit("update", this.getEnv());
|
|
3394
|
+
}
|
|
3395
|
+
setDefaultCompany(defaultCompany) {
|
|
3396
|
+
this.state = { ...this.state, defaultCompany };
|
|
3397
|
+
this.emitter.emit("update", this.getEnv());
|
|
3398
|
+
}
|
|
3399
|
+
setUserInfo(user) {
|
|
3400
|
+
this.state = { ...this.state, user };
|
|
3401
|
+
this.emitter.emit("update", this.getEnv());
|
|
3402
|
+
}
|
|
3403
|
+
setConfig(config) {
|
|
3404
|
+
this.state = { ...this.state, config };
|
|
3405
|
+
this.emitter.emit("update", this.getEnv());
|
|
3406
|
+
}
|
|
3407
|
+
setEnvFile(envFile) {
|
|
3408
|
+
this.state = { ...this.state, envFile };
|
|
3409
|
+
this.emitter.emit("update", this.getEnv());
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
var env = null;
|
|
3413
|
+
function initEnv({
|
|
3414
|
+
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
3415
|
+
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
3416
|
+
}) {
|
|
3417
|
+
if (!env) {
|
|
3418
|
+
env = new EnvStore(localStorageUtil, sessionStorageUtil);
|
|
3419
|
+
}
|
|
3420
|
+
return env;
|
|
3421
|
+
}
|
|
3422
|
+
function getEnv() {
|
|
3423
|
+
if (!env) {
|
|
3424
|
+
env = initEnv({});
|
|
3425
|
+
}
|
|
3426
|
+
return env?.getEnv();
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
// src/services/auth-service/index.ts
|
|
3430
|
+
var AuthService = {
|
|
3431
|
+
async login(body) {
|
|
3432
|
+
const env2 = getEnv();
|
|
3433
|
+
const payload = Object.fromEntries(
|
|
3434
|
+
Object.entries({
|
|
3435
|
+
username: body.email,
|
|
3436
|
+
password: body.password,
|
|
3437
|
+
grant_type: env2?.config?.grantType || "",
|
|
3438
|
+
client_id: env2?.config?.clientId || "",
|
|
3439
|
+
client_secret: env2?.config?.clientSecret || ""
|
|
3440
|
+
}).filter(([_, value]) => !!value)
|
|
3441
|
+
);
|
|
3442
|
+
const encodedData = new URLSearchParams(payload).toString();
|
|
3443
|
+
return env2?.requests?.post(body.path, encodedData, {
|
|
3444
|
+
headers: {
|
|
3445
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3446
|
+
}
|
|
3447
|
+
});
|
|
3448
|
+
},
|
|
3449
|
+
async forgotPassword(email) {
|
|
3450
|
+
const env2 = getEnv();
|
|
3451
|
+
const bodyData = {
|
|
3452
|
+
login: email,
|
|
3453
|
+
url: `${window.location.origin}/reset-password`
|
|
3454
|
+
};
|
|
3455
|
+
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3456
|
+
headers: {
|
|
3457
|
+
"Content-Type": "application/json"
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
},
|
|
3461
|
+
async forgotPasswordSSO({
|
|
3462
|
+
email,
|
|
3463
|
+
with_context,
|
|
3464
|
+
method
|
|
3465
|
+
}) {
|
|
3466
|
+
const env2 = getEnv();
|
|
3467
|
+
const body = {
|
|
3468
|
+
method,
|
|
3469
|
+
kwargs: {
|
|
3470
|
+
vals: {
|
|
3471
|
+
email
|
|
3472
|
+
}
|
|
3473
|
+
},
|
|
3474
|
+
with_context
|
|
3475
|
+
};
|
|
3476
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3477
|
+
headers: {
|
|
3478
|
+
"Content-Type": "application/json"
|
|
3479
|
+
}
|
|
3480
|
+
});
|
|
3481
|
+
},
|
|
3482
|
+
async resetPassword(data, token) {
|
|
3483
|
+
const env2 = getEnv();
|
|
3484
|
+
const bodyData = {
|
|
3485
|
+
token,
|
|
3486
|
+
password: data.password,
|
|
3487
|
+
new_password: data.confirmPassword
|
|
3488
|
+
};
|
|
3489
|
+
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3490
|
+
headers: {
|
|
3491
|
+
"Content-Type": "application/json"
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
},
|
|
3495
|
+
async resetPasswordSSO({
|
|
3496
|
+
method,
|
|
3497
|
+
password,
|
|
3498
|
+
with_context
|
|
3499
|
+
}) {
|
|
3500
|
+
const env2 = getEnv();
|
|
3501
|
+
const bodyData = {
|
|
3502
|
+
method,
|
|
3503
|
+
kwargs: {
|
|
3504
|
+
vals: {
|
|
3505
|
+
password
|
|
3506
|
+
}
|
|
3507
|
+
},
|
|
3508
|
+
with_context
|
|
3509
|
+
};
|
|
3510
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3511
|
+
headers: {
|
|
3512
|
+
"Content-Type": "application/json"
|
|
3513
|
+
}
|
|
3514
|
+
});
|
|
3515
|
+
},
|
|
3516
|
+
async updatePassword(data, token) {
|
|
3517
|
+
const env2 = getEnv();
|
|
3518
|
+
const bodyData = {
|
|
3519
|
+
token,
|
|
3520
|
+
old_password: data.oldPassword,
|
|
3521
|
+
new_password: data.newPassword
|
|
3522
|
+
};
|
|
3523
|
+
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3524
|
+
headers: {
|
|
3525
|
+
"Content-Type": "application/json"
|
|
3526
|
+
}
|
|
3527
|
+
});
|
|
3528
|
+
},
|
|
3529
|
+
async isValidToken(token) {
|
|
3530
|
+
const env2 = getEnv();
|
|
3531
|
+
const bodyData = {
|
|
3532
|
+
token
|
|
3533
|
+
};
|
|
3534
|
+
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3535
|
+
headers: {
|
|
3536
|
+
"Content-Type": "application/json"
|
|
3537
|
+
}
|
|
3538
|
+
});
|
|
3539
|
+
},
|
|
3540
|
+
async isValidActionToken(actionToken, path) {
|
|
3541
|
+
const env2 = getEnv();
|
|
3542
|
+
return env2?.requests?.post(
|
|
3543
|
+
path,
|
|
3544
|
+
{},
|
|
3545
|
+
{
|
|
3546
|
+
headers: {
|
|
3547
|
+
"Content-Type": "application/json"
|
|
3548
|
+
},
|
|
3549
|
+
useActionToken: true,
|
|
3550
|
+
actionToken
|
|
3551
|
+
}
|
|
3552
|
+
);
|
|
3553
|
+
},
|
|
3554
|
+
async loginSocial({
|
|
3555
|
+
db,
|
|
3556
|
+
state,
|
|
3557
|
+
access_token
|
|
3558
|
+
}) {
|
|
3559
|
+
const env2 = getEnv();
|
|
3560
|
+
return env2?.requests?.post(
|
|
3561
|
+
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3562
|
+
{ state, access_token },
|
|
3563
|
+
{
|
|
3564
|
+
headers: {
|
|
3565
|
+
"Content-Type": "application/json"
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
);
|
|
3569
|
+
},
|
|
3570
|
+
async getProviders(db) {
|
|
3571
|
+
const env2 = getEnv();
|
|
3572
|
+
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
3573
|
+
},
|
|
3574
|
+
async getAccessByCode(code) {
|
|
3575
|
+
const env2 = getEnv();
|
|
3576
|
+
const data = new URLSearchParams();
|
|
3577
|
+
data.append("code", code);
|
|
3578
|
+
data.append("grant_type", "authorization_code");
|
|
3579
|
+
data.append("client_id", env2?.config?.clientId || "");
|
|
3580
|
+
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
3581
|
+
return env2?.requests?.post(
|
|
3582
|
+
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3583
|
+
data,
|
|
3584
|
+
{
|
|
3585
|
+
headers: {
|
|
3586
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
);
|
|
3590
|
+
},
|
|
3591
|
+
async logout(data) {
|
|
3592
|
+
const env2 = getEnv();
|
|
3593
|
+
console.log(data);
|
|
3594
|
+
return env2?.requests?.post(
|
|
3595
|
+
"/logout" /* LOGOUT */,
|
|
3596
|
+
{},
|
|
3597
|
+
{
|
|
3598
|
+
headers: {
|
|
3599
|
+
"Content-Type": "application/json"
|
|
3600
|
+
},
|
|
3601
|
+
withCredentials: true,
|
|
3602
|
+
useRefreshToken: true
|
|
3603
|
+
}
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3606
|
+
};
|
|
3607
|
+
var auth_service_default = AuthService;
|
|
3608
|
+
|
|
3609
|
+
// src/services/company-service/index.ts
|
|
3610
|
+
var CompanyService = {
|
|
3611
|
+
async getCurrentCompany() {
|
|
3612
|
+
const env2 = getEnv();
|
|
3613
|
+
return await env2.requests.get("/company" /* COMPANY_PATH */, {
|
|
3614
|
+
headers: {
|
|
3615
|
+
"Content-Type": "application/json"
|
|
3616
|
+
}
|
|
3617
|
+
});
|
|
3618
|
+
},
|
|
3619
|
+
async getInfoCompany(id) {
|
|
3620
|
+
const env2 = getEnv();
|
|
3621
|
+
const jsonData = {
|
|
3622
|
+
ids: [id],
|
|
3623
|
+
model: "res.company" /* COMPANY */,
|
|
3624
|
+
method: "web_read" /* WEB_READ */,
|
|
3625
|
+
kwargs: {
|
|
3626
|
+
specification: {
|
|
3627
|
+
primary_color: {},
|
|
3628
|
+
secondary_color: {},
|
|
3629
|
+
logo: {},
|
|
3630
|
+
display_name: {},
|
|
3631
|
+
secondary_logo: {}
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
};
|
|
3635
|
+
return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
3636
|
+
headers: {
|
|
3637
|
+
"Content-Type": "application/json"
|
|
3638
|
+
}
|
|
3639
|
+
});
|
|
3640
|
+
}
|
|
3641
|
+
};
|
|
3642
|
+
var company_service_default = CompanyService;
|
|
3643
|
+
|
|
3644
|
+
// src/services/excel-service/index.ts
|
|
3645
|
+
var ExcelService = {
|
|
3646
|
+
async uploadFile({ formData }) {
|
|
3647
|
+
const env2 = getEnv();
|
|
3648
|
+
return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
|
|
3649
|
+
headers: {
|
|
3650
|
+
"Content-Type": "multipart/form-data"
|
|
3651
|
+
}
|
|
3652
|
+
});
|
|
3653
|
+
},
|
|
3654
|
+
async uploadIdFile({ formData }) {
|
|
3655
|
+
const env2 = getEnv();
|
|
3656
|
+
return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
|
|
3657
|
+
headers: {
|
|
3658
|
+
"Content-Type": "multipart/form-data"
|
|
3659
|
+
}
|
|
3660
|
+
});
|
|
3661
|
+
},
|
|
3662
|
+
async parsePreview({
|
|
3663
|
+
id,
|
|
3664
|
+
selectedSheet,
|
|
3665
|
+
isHeader,
|
|
3666
|
+
context
|
|
3667
|
+
}) {
|
|
3668
|
+
const env2 = getEnv();
|
|
3669
|
+
const jsonData = {
|
|
3670
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3671
|
+
method: "parse_preview",
|
|
3672
|
+
ids: [id],
|
|
3673
|
+
kwargs: {
|
|
3674
|
+
options: {
|
|
3675
|
+
import_skip_records: [],
|
|
3676
|
+
import_set_empty_fields: [],
|
|
3677
|
+
fallback_values: {},
|
|
3678
|
+
name_create_enabled_fields: {},
|
|
3679
|
+
encoding: "",
|
|
3680
|
+
separator: "",
|
|
3681
|
+
quoting: '"',
|
|
3682
|
+
date_format: "",
|
|
3683
|
+
datetime_format: "",
|
|
3684
|
+
float_thousand_separator: ",",
|
|
3685
|
+
float_decimal_separator: ".",
|
|
3686
|
+
advanced: true,
|
|
3687
|
+
has_headers: isHeader,
|
|
3688
|
+
keep_matches: false,
|
|
3689
|
+
limit: 2e3,
|
|
3690
|
+
sheets: [],
|
|
3691
|
+
sheet: selectedSheet,
|
|
3692
|
+
skip: 0,
|
|
3693
|
+
tracking_disable: true
|
|
3694
|
+
}
|
|
3695
|
+
},
|
|
3696
|
+
with_context: context
|
|
3697
|
+
};
|
|
3698
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3699
|
+
headers: {
|
|
3700
|
+
"Content-Type": "multipart/form-data"
|
|
3701
|
+
}
|
|
3702
|
+
});
|
|
3703
|
+
},
|
|
3704
|
+
async executeImport({
|
|
3705
|
+
columns,
|
|
3706
|
+
fields,
|
|
3707
|
+
idFile,
|
|
3708
|
+
options,
|
|
3709
|
+
dryrun,
|
|
3710
|
+
context
|
|
3711
|
+
}) {
|
|
3712
|
+
const env2 = getEnv();
|
|
3713
|
+
const jsonData = {
|
|
3714
|
+
model: "base_import.import" /* BASE_IMPORT */,
|
|
3715
|
+
method: "execute_import",
|
|
3716
|
+
ids: [idFile],
|
|
3717
|
+
kwargs: {
|
|
3718
|
+
fields,
|
|
3719
|
+
columns,
|
|
3720
|
+
options,
|
|
3721
|
+
dryrun
|
|
3722
|
+
},
|
|
3723
|
+
with_context: context
|
|
3724
|
+
};
|
|
3725
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3726
|
+
headers: {
|
|
3727
|
+
"Content-Type": "multipart/form-data"
|
|
3728
|
+
}
|
|
3729
|
+
});
|
|
3730
|
+
},
|
|
3731
|
+
async getFileExcel({ model }) {
|
|
3732
|
+
const env2 = getEnv();
|
|
3733
|
+
const jsonData = {
|
|
3734
|
+
model,
|
|
3735
|
+
method: "get_import_templates" /* GET_IMPORT */,
|
|
3736
|
+
args: []
|
|
3737
|
+
};
|
|
3738
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData);
|
|
3739
|
+
},
|
|
3740
|
+
async getFieldExport({
|
|
3741
|
+
ids,
|
|
3742
|
+
model,
|
|
3743
|
+
isShow,
|
|
3744
|
+
parentField,
|
|
3745
|
+
fieldType,
|
|
3746
|
+
parentName,
|
|
3747
|
+
prefix,
|
|
3748
|
+
name,
|
|
3749
|
+
context,
|
|
3750
|
+
importCompat
|
|
3751
|
+
}) {
|
|
3752
|
+
const env2 = getEnv();
|
|
3753
|
+
const jsonData = {
|
|
3754
|
+
model,
|
|
3755
|
+
import_compat: importCompat,
|
|
3756
|
+
domain: [["id", "in", ids]],
|
|
3757
|
+
with_context: context
|
|
3758
|
+
};
|
|
3759
|
+
if (isShow) {
|
|
3760
|
+
jsonData.parent_field = parentField;
|
|
3761
|
+
jsonData.parent_field_type = fieldType;
|
|
3762
|
+
jsonData.parent_name = parentName;
|
|
3763
|
+
jsonData.name = name;
|
|
3764
|
+
jsonData.prefix = prefix;
|
|
3765
|
+
jsonData.exclude = [null];
|
|
3766
|
+
}
|
|
3767
|
+
return env2.requests.post("/export/get_fields", jsonData);
|
|
3768
|
+
},
|
|
3769
|
+
async exportExcel({
|
|
3770
|
+
model,
|
|
3771
|
+
domain,
|
|
3772
|
+
ids,
|
|
3773
|
+
fields,
|
|
3774
|
+
type,
|
|
3775
|
+
importCompat,
|
|
3776
|
+
context,
|
|
3777
|
+
groupby
|
|
3778
|
+
}) {
|
|
3779
|
+
const env2 = getEnv();
|
|
3780
|
+
const jsonData = {
|
|
3781
|
+
model,
|
|
3782
|
+
domain,
|
|
3783
|
+
ids,
|
|
3784
|
+
import_compat: importCompat,
|
|
3785
|
+
fields,
|
|
3786
|
+
with_context: context,
|
|
3787
|
+
groupby: groupby ?? []
|
|
3788
|
+
};
|
|
3789
|
+
return env2.requests.post_excel(`/export/${type}`, jsonData);
|
|
3790
|
+
}
|
|
3791
|
+
};
|
|
3792
|
+
var excel_service_default = ExcelService;
|
|
3793
|
+
|
|
3794
|
+
// src/services/form-service/index.ts
|
|
3795
|
+
var FormService = {
|
|
3796
|
+
async getComment({ data }) {
|
|
3797
|
+
try {
|
|
3798
|
+
const env2 = getEnv();
|
|
3799
|
+
const jsonData = {
|
|
3800
|
+
thread_id: data.thread_id,
|
|
3801
|
+
thread_model: data.thread_model,
|
|
3802
|
+
limit: 100,
|
|
3803
|
+
with_context: {
|
|
3804
|
+
lang: data.lang
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
|
|
3808
|
+
headers: {
|
|
3809
|
+
"Content-Type": "application/json"
|
|
3810
|
+
}
|
|
3811
|
+
});
|
|
3812
|
+
} catch (error) {
|
|
3813
|
+
console.error("Error when sending message:", error);
|
|
3814
|
+
throw error;
|
|
3815
|
+
}
|
|
3816
|
+
},
|
|
3817
|
+
async sentComment({ data }) {
|
|
3818
|
+
try {
|
|
3819
|
+
const env2 = getEnv();
|
|
3820
|
+
const jsonData = {
|
|
3821
|
+
context: {
|
|
3822
|
+
tz: "Asia/Saigon",
|
|
3823
|
+
uid: 2,
|
|
3824
|
+
allowed_company_ids: [1],
|
|
3825
|
+
mail_post_autofollow: false,
|
|
3826
|
+
temporary_id: 142183.01
|
|
3827
|
+
},
|
|
3828
|
+
post_data: {
|
|
3829
|
+
body: data.message,
|
|
3830
|
+
message_type: "comment",
|
|
3831
|
+
attachment_ids: data.attachment_ids,
|
|
3832
|
+
attachment_tokens: [],
|
|
3833
|
+
subtype_xmlid: data.subtype
|
|
3834
|
+
},
|
|
3835
|
+
thread_id: Number(data.thread_id),
|
|
3836
|
+
thread_model: data.thread_model
|
|
3837
|
+
};
|
|
3838
|
+
return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
|
|
3839
|
+
headers: {
|
|
3840
|
+
"Content-Type": "application/json"
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
} catch (error) {
|
|
3844
|
+
console.error("Error when sent message:", error);
|
|
3845
|
+
throw error;
|
|
3846
|
+
}
|
|
3847
|
+
},
|
|
3848
|
+
async deleteComment({ data }) {
|
|
3849
|
+
try {
|
|
3850
|
+
const env2 = getEnv();
|
|
3851
|
+
const jsonData = {
|
|
3852
|
+
attachment_ids: [],
|
|
3853
|
+
attachment_tokens: [],
|
|
3854
|
+
body: "",
|
|
3855
|
+
message_id: data.message_id
|
|
3856
|
+
};
|
|
3857
|
+
return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
|
|
3858
|
+
headers: {
|
|
3859
|
+
"Content-Type": "application/json"
|
|
3860
|
+
}
|
|
3861
|
+
});
|
|
3862
|
+
} catch (error) {
|
|
3863
|
+
console.error("Error when sent message:", error);
|
|
3864
|
+
throw error;
|
|
3865
|
+
}
|
|
3866
|
+
},
|
|
3867
|
+
async getImage({ data }) {
|
|
3868
|
+
try {
|
|
3869
|
+
const env2 = getEnv();
|
|
3870
|
+
return env2.requests.get(
|
|
3871
|
+
`${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
|
|
3872
|
+
{
|
|
3873
|
+
headers: {
|
|
3874
|
+
"Content-Type": "application/json"
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
);
|
|
3878
|
+
} catch (error) {
|
|
3879
|
+
console.error("Error when sent message:", error);
|
|
3880
|
+
throw error;
|
|
3881
|
+
}
|
|
3882
|
+
},
|
|
3883
|
+
async uploadImage({ data }) {
|
|
3884
|
+
try {
|
|
3885
|
+
const env2 = getEnv();
|
|
3886
|
+
return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
|
|
3887
|
+
headers: {
|
|
3888
|
+
"Content-Type": "multipart/form-data"
|
|
3889
|
+
}
|
|
3890
|
+
});
|
|
3891
|
+
} catch (error) {
|
|
3892
|
+
console.error("Error when sent message:", error);
|
|
3893
|
+
throw error;
|
|
3894
|
+
}
|
|
3895
|
+
},
|
|
3896
|
+
async getFormView({ data }) {
|
|
3897
|
+
try {
|
|
3898
|
+
const env2 = getEnv();
|
|
3899
|
+
const jsonData = {
|
|
3900
|
+
model: data.model,
|
|
3901
|
+
method: "get_formview_action",
|
|
3902
|
+
ids: data.id ? [data.id] : [],
|
|
3903
|
+
with_context: data.context
|
|
3904
|
+
};
|
|
3905
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3906
|
+
headers: {
|
|
3907
|
+
"Content-Type": "application/json"
|
|
3908
|
+
}
|
|
3909
|
+
});
|
|
3910
|
+
} catch (error) {
|
|
3911
|
+
console.error("Error when fetching form view:", error);
|
|
3912
|
+
throw error;
|
|
3913
|
+
}
|
|
3914
|
+
},
|
|
3915
|
+
async changeStatus({ data }) {
|
|
3916
|
+
const env2 = getEnv();
|
|
3917
|
+
const vals = {
|
|
3918
|
+
[data.name]: data.stage_id
|
|
3919
|
+
};
|
|
3920
|
+
const jsonData = {
|
|
3921
|
+
model: data.model,
|
|
3922
|
+
method: "web_save",
|
|
3923
|
+
with_context: {
|
|
3924
|
+
lang: data.lang,
|
|
3925
|
+
allowed_company_ids: [1],
|
|
3926
|
+
uid: 2,
|
|
3927
|
+
search_default_my_ticket: true,
|
|
3928
|
+
search_default_is_open: true
|
|
3929
|
+
},
|
|
3930
|
+
ids: [data.id],
|
|
3931
|
+
kwargs: {
|
|
3932
|
+
vals,
|
|
3933
|
+
specification: {}
|
|
3934
|
+
}
|
|
3935
|
+
};
|
|
3936
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3937
|
+
headers: {
|
|
3938
|
+
"Content-Type": "application/json"
|
|
3939
|
+
}
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
var form_service_default = FormService;
|
|
3944
|
+
|
|
3945
|
+
// src/services/model-service/index.ts
|
|
3946
|
+
var OBJECT_POSITION = 2;
|
|
3947
|
+
var ModelService = {
|
|
3948
|
+
async getListMyBankAccount({
|
|
3949
|
+
domain,
|
|
3950
|
+
spectification,
|
|
3951
|
+
model
|
|
3952
|
+
}) {
|
|
3953
|
+
const env2 = getEnv();
|
|
3954
|
+
const jsonData = {
|
|
3955
|
+
model,
|
|
3956
|
+
method: "web_search_read",
|
|
3957
|
+
kwargs: {
|
|
3958
|
+
specification: spectification,
|
|
3959
|
+
domain,
|
|
3960
|
+
limit: 100,
|
|
3961
|
+
offset: 0
|
|
3962
|
+
}
|
|
3963
|
+
};
|
|
3964
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3965
|
+
headers: {
|
|
3966
|
+
"Content-Type": "application/json"
|
|
3967
|
+
}
|
|
3968
|
+
});
|
|
3969
|
+
},
|
|
3970
|
+
async getCurrency() {
|
|
3971
|
+
const env2 = getEnv();
|
|
3972
|
+
const jsonData = {
|
|
3973
|
+
model: "res.currency",
|
|
3974
|
+
method: "web_search_read",
|
|
3975
|
+
kwargs: {
|
|
3976
|
+
specification: {
|
|
3977
|
+
icon_url: {},
|
|
3978
|
+
name: {}
|
|
3979
|
+
},
|
|
3980
|
+
domain: [["active", "=", true]],
|
|
3981
|
+
limit: 100,
|
|
3982
|
+
offset: 0
|
|
3983
|
+
}
|
|
3984
|
+
};
|
|
3985
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
3986
|
+
headers: {
|
|
3987
|
+
"Content-Type": "application/json"
|
|
3988
|
+
}
|
|
3989
|
+
});
|
|
3990
|
+
},
|
|
3991
|
+
async getConversionRate() {
|
|
3992
|
+
const env2 = getEnv();
|
|
3993
|
+
const jsonData = {
|
|
3994
|
+
model: "res.currency",
|
|
3995
|
+
method: "web_search_read",
|
|
3996
|
+
kwargs: {
|
|
3997
|
+
specification: {
|
|
3998
|
+
name: {},
|
|
3999
|
+
icon_url: {},
|
|
4000
|
+
rate_ids: {
|
|
4001
|
+
fields: {
|
|
4002
|
+
company_rate: {},
|
|
4003
|
+
sell: {}
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
},
|
|
4007
|
+
domain: [["active", "=", true]],
|
|
4008
|
+
limit: 100,
|
|
4009
|
+
offset: 0
|
|
4010
|
+
}
|
|
4011
|
+
};
|
|
4012
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4013
|
+
headers: {
|
|
4014
|
+
"Content-Type": "application/json"
|
|
4015
|
+
}
|
|
4016
|
+
});
|
|
4017
|
+
},
|
|
4018
|
+
async getAll({ data }) {
|
|
4019
|
+
const env2 = getEnv();
|
|
4020
|
+
const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
4021
|
+
fields: data.fields,
|
|
4022
|
+
groupby: data.groupby
|
|
4023
|
+
} : {
|
|
4024
|
+
count_limit: 10001,
|
|
4025
|
+
order: data.sort,
|
|
4026
|
+
specification: data.specification
|
|
4027
|
+
};
|
|
4028
|
+
const jsonData = {
|
|
4029
|
+
model: String(data.model),
|
|
4030
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
4031
|
+
ids: data.ids,
|
|
4032
|
+
with_context: data.context,
|
|
4033
|
+
kwargs: {
|
|
4034
|
+
domain: data.domain,
|
|
4035
|
+
limit: data.limit,
|
|
4036
|
+
offset: data.offset,
|
|
4037
|
+
...jsonReadGroup
|
|
4038
|
+
}
|
|
4039
|
+
};
|
|
4040
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4041
|
+
headers: {
|
|
4042
|
+
"Content-Type": "application/json"
|
|
4043
|
+
}
|
|
4044
|
+
});
|
|
4045
|
+
},
|
|
4046
|
+
async getListCalendar({ data }) {
|
|
4047
|
+
const env2 = getEnv();
|
|
4048
|
+
const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
|
|
4049
|
+
fields: data.fields,
|
|
4050
|
+
groupby: data.groupby
|
|
4051
|
+
} : {
|
|
4052
|
+
count_limit: 10001,
|
|
4053
|
+
order: data.sort,
|
|
4054
|
+
specification: data.specification
|
|
4055
|
+
};
|
|
4056
|
+
const jsonData = {
|
|
4057
|
+
model: String(data.model),
|
|
4058
|
+
method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
|
|
4059
|
+
ids: data.ids,
|
|
4060
|
+
with_context: data.context,
|
|
4061
|
+
kwargs: {
|
|
4062
|
+
domain: data.domain,
|
|
4063
|
+
limit: data.limit,
|
|
4064
|
+
offset: data.offset,
|
|
4065
|
+
fields: data.fields,
|
|
4066
|
+
...jsonReadGroup
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4069
|
+
return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4070
|
+
headers: {
|
|
4071
|
+
"Content-Type": "application/json"
|
|
4072
|
+
}
|
|
4073
|
+
});
|
|
4074
|
+
},
|
|
4075
|
+
async getList({
|
|
4076
|
+
model,
|
|
4077
|
+
ids = [],
|
|
4078
|
+
specification = {},
|
|
4079
|
+
domain = [],
|
|
4080
|
+
offset,
|
|
4081
|
+
order,
|
|
4082
|
+
context = {},
|
|
4083
|
+
limit = 10
|
|
4084
|
+
}) {
|
|
4085
|
+
const env2 = getEnv();
|
|
4086
|
+
const jsonData = {
|
|
4087
|
+
model,
|
|
4088
|
+
method: "web_search_read" /* WEB_SEARCH_READ */,
|
|
4089
|
+
ids,
|
|
4090
|
+
with_context: context,
|
|
4091
|
+
kwargs: {
|
|
4092
|
+
specification,
|
|
4093
|
+
domain,
|
|
4094
|
+
limit,
|
|
4095
|
+
offset,
|
|
4096
|
+
order
|
|
4097
|
+
}
|
|
4098
|
+
};
|
|
4099
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4100
|
+
headers: {
|
|
4101
|
+
"Content-Type": "application/json"
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
},
|
|
4105
|
+
async getDetail({
|
|
4106
|
+
ids = [],
|
|
4107
|
+
model,
|
|
4108
|
+
specification,
|
|
4109
|
+
context
|
|
4110
|
+
}) {
|
|
4111
|
+
const env2 = getEnv();
|
|
4112
|
+
const jsonData = {
|
|
4113
|
+
model,
|
|
4114
|
+
method: "web_read" /* WEB_READ */,
|
|
4115
|
+
ids,
|
|
4116
|
+
with_context: context,
|
|
4117
|
+
kwargs: {
|
|
4118
|
+
specification
|
|
4119
|
+
}
|
|
4120
|
+
};
|
|
4121
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4122
|
+
headers: {
|
|
4123
|
+
"Content-Type": "application/json"
|
|
4124
|
+
}
|
|
4125
|
+
});
|
|
4126
|
+
},
|
|
4127
|
+
async save({
|
|
4128
|
+
model,
|
|
4129
|
+
ids = [],
|
|
4130
|
+
data = {},
|
|
4131
|
+
specification = {},
|
|
4132
|
+
context = {},
|
|
4133
|
+
path
|
|
4134
|
+
}) {
|
|
4135
|
+
const env2 = getEnv();
|
|
4136
|
+
const jsonData = {
|
|
4137
|
+
model,
|
|
4138
|
+
method: "web_save" /* WEB_SAVE */,
|
|
4139
|
+
with_context: context,
|
|
4140
|
+
ids,
|
|
4141
|
+
kwargs: {
|
|
4142
|
+
vals: data,
|
|
4143
|
+
specification
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
|
|
4147
|
+
headers: {
|
|
4148
|
+
"Content-Type": "application/json"
|
|
4149
|
+
}
|
|
4150
|
+
});
|
|
4151
|
+
},
|
|
4152
|
+
async delete({ ids = [], model }) {
|
|
4153
|
+
const env2 = getEnv();
|
|
4154
|
+
const jsonData = {
|
|
4155
|
+
model,
|
|
4156
|
+
method: "unlink" /* UNLINK */,
|
|
4157
|
+
ids
|
|
4158
|
+
};
|
|
4159
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4160
|
+
headers: {
|
|
4161
|
+
"Content-Type": "application/json"
|
|
4162
|
+
}
|
|
4163
|
+
});
|
|
4164
|
+
},
|
|
4165
|
+
async onChange({
|
|
4166
|
+
ids = [],
|
|
4167
|
+
model,
|
|
4168
|
+
object,
|
|
4169
|
+
specification,
|
|
4170
|
+
context,
|
|
4171
|
+
fieldChange
|
|
4172
|
+
}) {
|
|
4173
|
+
const env2 = getEnv();
|
|
4174
|
+
const jsonData = {
|
|
4175
|
+
model,
|
|
4176
|
+
method: "onchange" /* ONCHANGE */,
|
|
4177
|
+
ids,
|
|
4178
|
+
with_context: context,
|
|
4179
|
+
args: [
|
|
4180
|
+
object ? object : {},
|
|
4181
|
+
fieldChange ? fieldChange : [],
|
|
4182
|
+
specification
|
|
4183
|
+
]
|
|
4184
|
+
};
|
|
4185
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4186
|
+
headers: {
|
|
4187
|
+
"Content-Type": "application/json"
|
|
4188
|
+
}
|
|
4189
|
+
});
|
|
4190
|
+
},
|
|
4191
|
+
async getListFieldsOnchange({ model }) {
|
|
4192
|
+
const env2 = getEnv();
|
|
4193
|
+
const jsonData = {
|
|
4194
|
+
model,
|
|
4195
|
+
method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
|
|
4196
|
+
};
|
|
4197
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
|
|
4198
|
+
headers: {
|
|
4199
|
+
"Content-Type": "application/json"
|
|
4200
|
+
}
|
|
4201
|
+
});
|
|
4202
|
+
},
|
|
4203
|
+
parseORMOdoo(data) {
|
|
4204
|
+
for (const key in data) {
|
|
4205
|
+
if (key === "display_name") {
|
|
4206
|
+
delete data[key];
|
|
4207
|
+
}
|
|
4208
|
+
if (!data[key] && data[key] !== 0) {
|
|
4209
|
+
data[key] = false;
|
|
4210
|
+
} else if (data[key] === "Draft") {
|
|
4211
|
+
data[key] = "/";
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
return { ...data };
|
|
4215
|
+
},
|
|
4216
|
+
toDataJS(data, viewData, model) {
|
|
4217
|
+
for (const key in data) {
|
|
4218
|
+
if (data[key] === false) {
|
|
4219
|
+
if (viewData && model) {
|
|
4220
|
+
if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
|
|
4221
|
+
data[key] = null;
|
|
4222
|
+
}
|
|
4223
|
+
} else {
|
|
4224
|
+
data[key] = null;
|
|
4225
|
+
}
|
|
4226
|
+
} else if (data[key] === "/") {
|
|
4227
|
+
data[key] = "Draft";
|
|
4228
|
+
} else if (data[key] !== false) {
|
|
4229
|
+
if (model !== void 0) {
|
|
4230
|
+
if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
|
|
4231
|
+
data[key] = (data[key] ??= [])?.map((item) => {
|
|
4232
|
+
const relation = viewData?.models?.[model]?.[key]?.relation;
|
|
4233
|
+
if (relation !== void 0) {
|
|
4234
|
+
if (viewData?.models?.[relation]) {
|
|
4235
|
+
if (item?.length >= 3) {
|
|
4236
|
+
return ModelService.toDataJS(
|
|
4237
|
+
item[OBJECT_POSITION],
|
|
4238
|
+
viewData,
|
|
4239
|
+
relation
|
|
4240
|
+
);
|
|
4241
|
+
} else {
|
|
4242
|
+
return ModelService.toDataJS(item, viewData, relation);
|
|
4243
|
+
}
|
|
4244
|
+
} else {
|
|
4245
|
+
if (item?.length >= 3) {
|
|
4246
|
+
return item[OBJECT_POSITION];
|
|
4247
|
+
} else {
|
|
4248
|
+
return item;
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
});
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
}
|
|
4257
|
+
return { ...data };
|
|
4258
|
+
}
|
|
4259
|
+
};
|
|
4260
|
+
var model_service_default = ModelService;
|
|
4261
|
+
|
|
4262
|
+
// src/services/user-service/index.ts
|
|
4263
|
+
var UserService = {
|
|
4264
|
+
async getProfile(path) {
|
|
4265
|
+
const env2 = getEnv();
|
|
4266
|
+
return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
|
|
4267
|
+
headers: {
|
|
4268
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
},
|
|
4272
|
+
async getUser({ context, id }) {
|
|
4273
|
+
const env2 = getEnv();
|
|
4274
|
+
const jsonData = {
|
|
4275
|
+
model: "res.users",
|
|
4276
|
+
method: "web_read",
|
|
4277
|
+
ids: [id],
|
|
4278
|
+
with_context: context,
|
|
4279
|
+
kwargs: {
|
|
4280
|
+
specification: {
|
|
4281
|
+
display_name: {},
|
|
4282
|
+
image_1920: {},
|
|
4283
|
+
name: {},
|
|
4284
|
+
login: {},
|
|
4285
|
+
email: {},
|
|
4286
|
+
password: {},
|
|
4287
|
+
visible_group_id: {
|
|
4288
|
+
fields: {
|
|
4289
|
+
id: {},
|
|
4290
|
+
display_name: {}
|
|
4291
|
+
}
|
|
4292
|
+
},
|
|
4293
|
+
company_id: {
|
|
4294
|
+
fields: {
|
|
4295
|
+
id: {},
|
|
4296
|
+
display_name: {}
|
|
4297
|
+
}
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
};
|
|
4302
|
+
return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
|
|
4303
|
+
headers: {
|
|
4304
|
+
"Content-Type": "application/json"
|
|
4305
|
+
}
|
|
4306
|
+
});
|
|
4307
|
+
},
|
|
4308
|
+
switchUserLocale: async ({ id, values }) => {
|
|
4309
|
+
const env2 = getEnv();
|
|
4310
|
+
const jsonData = {
|
|
4311
|
+
model: "res.users",
|
|
4312
|
+
domain: [["id", "=", id]],
|
|
4313
|
+
values
|
|
4314
|
+
};
|
|
4315
|
+
return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
|
|
4316
|
+
headers: {
|
|
4317
|
+
"Content-Type": "application/json"
|
|
4318
|
+
}
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
};
|
|
4322
|
+
var user_service_default = UserService;
|
|
4323
|
+
|
|
4324
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
4325
|
+
var useForgotPassword = () => {
|
|
4326
|
+
return useMutation({
|
|
4327
|
+
mutationFn: (email) => {
|
|
4328
|
+
return auth_service_default.forgotPassword(email);
|
|
4329
|
+
}
|
|
4330
|
+
});
|
|
4331
|
+
};
|
|
4332
|
+
var use_forgot_password_default = useForgotPassword;
|
|
4333
|
+
|
|
3252
4334
|
// src/hooks/auth/use-forgotpassword-sso.ts
|
|
3253
4335
|
import { useMutation as useMutation2 } from "@tanstack/react-query";
|
|
4336
|
+
var useForgotPasswordSSO = () => {
|
|
4337
|
+
return useMutation2({
|
|
4338
|
+
mutationFn: ({
|
|
4339
|
+
email,
|
|
4340
|
+
with_context,
|
|
4341
|
+
method
|
|
4342
|
+
}) => {
|
|
4343
|
+
return auth_service_default.forgotPasswordSSO({ email, with_context, method });
|
|
4344
|
+
}
|
|
4345
|
+
});
|
|
4346
|
+
};
|
|
4347
|
+
var use_forgotpassword_sso_default = useForgotPasswordSSO;
|
|
3254
4348
|
|
|
3255
4349
|
// src/hooks/auth/use-get-provider.ts
|
|
3256
4350
|
import { useMutation as useMutation3 } from "@tanstack/react-query";
|
|
4351
|
+
var useGetProvider = () => {
|
|
4352
|
+
return useMutation3({
|
|
4353
|
+
mutationFn: (data) => {
|
|
4354
|
+
return auth_service_default.getProviders(data?.db);
|
|
4355
|
+
}
|
|
4356
|
+
});
|
|
4357
|
+
};
|
|
4358
|
+
var use_get_provider_default = useGetProvider;
|
|
3257
4359
|
|
|
3258
4360
|
// src/hooks/auth/use-isvalid-token.ts
|
|
3259
4361
|
import { useMutation as useMutation4 } from "@tanstack/react-query";
|
|
4362
|
+
var useIsValidToken = () => {
|
|
4363
|
+
return useMutation4({
|
|
4364
|
+
mutationFn: (token) => {
|
|
4365
|
+
return auth_service_default.isValidToken(token);
|
|
4366
|
+
}
|
|
4367
|
+
});
|
|
4368
|
+
};
|
|
4369
|
+
var use_isvalid_token_default = useIsValidToken;
|
|
3260
4370
|
|
|
3261
4371
|
// src/hooks/auth/use-login-credential.tsx
|
|
3262
4372
|
import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
@@ -3264,26 +4374,26 @@ import { useMutation as useMutation5 } from "@tanstack/react-query";
|
|
|
3264
4374
|
// src/services/auth-service/backup.ts
|
|
3265
4375
|
import { useCallback as useCallback2 } from "react";
|
|
3266
4376
|
function useAuthService() {
|
|
3267
|
-
const { env } = useEnv();
|
|
4377
|
+
const { env: env2 } = useEnv();
|
|
3268
4378
|
const login = useCallback2(
|
|
3269
4379
|
async (body) => {
|
|
3270
4380
|
const payload = Object.fromEntries(
|
|
3271
4381
|
Object.entries({
|
|
3272
4382
|
username: body.email,
|
|
3273
4383
|
password: body.password,
|
|
3274
|
-
grant_type:
|
|
3275
|
-
client_id:
|
|
3276
|
-
client_secret:
|
|
4384
|
+
grant_type: env2?.config?.grantType || "",
|
|
4385
|
+
client_id: env2?.config?.clientId || "",
|
|
4386
|
+
client_secret: env2?.config?.clientSecret || ""
|
|
3277
4387
|
}).filter(([_, value]) => !!value)
|
|
3278
4388
|
);
|
|
3279
4389
|
const encodedData = new URLSearchParams(payload).toString();
|
|
3280
|
-
return
|
|
4390
|
+
return env2?.requests?.post(body.path, encodedData, {
|
|
3281
4391
|
headers: {
|
|
3282
4392
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
3283
4393
|
}
|
|
3284
4394
|
});
|
|
3285
4395
|
},
|
|
3286
|
-
[
|
|
4396
|
+
[env2]
|
|
3287
4397
|
);
|
|
3288
4398
|
const forgotPassword = useCallback2(
|
|
3289
4399
|
async (email) => {
|
|
@@ -3291,13 +4401,13 @@ function useAuthService() {
|
|
|
3291
4401
|
login: email,
|
|
3292
4402
|
url: `${window.location.origin}/reset-password`
|
|
3293
4403
|
};
|
|
3294
|
-
return
|
|
4404
|
+
return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
|
|
3295
4405
|
headers: {
|
|
3296
4406
|
"Content-Type": "application/json"
|
|
3297
4407
|
}
|
|
3298
4408
|
});
|
|
3299
4409
|
},
|
|
3300
|
-
[
|
|
4410
|
+
[env2]
|
|
3301
4411
|
);
|
|
3302
4412
|
const forgotPasswordSSO = useCallback2(
|
|
3303
4413
|
async ({
|
|
@@ -3314,13 +4424,13 @@ function useAuthService() {
|
|
|
3314
4424
|
},
|
|
3315
4425
|
with_context
|
|
3316
4426
|
};
|
|
3317
|
-
return
|
|
4427
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, body, {
|
|
3318
4428
|
headers: {
|
|
3319
4429
|
"Content-Type": "application/json"
|
|
3320
4430
|
}
|
|
3321
4431
|
});
|
|
3322
4432
|
},
|
|
3323
|
-
[
|
|
4433
|
+
[env2]
|
|
3324
4434
|
);
|
|
3325
4435
|
const resetPassword = useCallback2(
|
|
3326
4436
|
async (data, token) => {
|
|
@@ -3329,13 +4439,13 @@ function useAuthService() {
|
|
|
3329
4439
|
password: data.password,
|
|
3330
4440
|
new_password: data.confirmPassword
|
|
3331
4441
|
};
|
|
3332
|
-
return
|
|
4442
|
+
return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
|
|
3333
4443
|
headers: {
|
|
3334
4444
|
"Content-Type": "application/json"
|
|
3335
4445
|
}
|
|
3336
4446
|
});
|
|
3337
4447
|
},
|
|
3338
|
-
[
|
|
4448
|
+
[env2]
|
|
3339
4449
|
);
|
|
3340
4450
|
const resetPasswordSSO = useCallback2(
|
|
3341
4451
|
async ({
|
|
@@ -3352,13 +4462,13 @@ function useAuthService() {
|
|
|
3352
4462
|
},
|
|
3353
4463
|
with_context
|
|
3354
4464
|
};
|
|
3355
|
-
return
|
|
4465
|
+
return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
|
|
3356
4466
|
headers: {
|
|
3357
4467
|
"Content-Type": "application/json"
|
|
3358
4468
|
}
|
|
3359
4469
|
});
|
|
3360
4470
|
},
|
|
3361
|
-
[
|
|
4471
|
+
[env2]
|
|
3362
4472
|
);
|
|
3363
4473
|
const updatePassword = useCallback2(
|
|
3364
4474
|
async (data, token) => {
|
|
@@ -3367,30 +4477,30 @@ function useAuthService() {
|
|
|
3367
4477
|
old_password: data.oldPassword,
|
|
3368
4478
|
new_password: data.newPassword
|
|
3369
4479
|
};
|
|
3370
|
-
return
|
|
4480
|
+
return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
|
|
3371
4481
|
headers: {
|
|
3372
4482
|
"Content-Type": "application/json"
|
|
3373
4483
|
}
|
|
3374
4484
|
});
|
|
3375
4485
|
},
|
|
3376
|
-
[
|
|
4486
|
+
[env2]
|
|
3377
4487
|
);
|
|
3378
4488
|
const isValidToken = useCallback2(
|
|
3379
4489
|
async (token) => {
|
|
3380
4490
|
const bodyData = {
|
|
3381
4491
|
token
|
|
3382
4492
|
};
|
|
3383
|
-
return
|
|
4493
|
+
return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
|
|
3384
4494
|
headers: {
|
|
3385
4495
|
"Content-Type": "application/json"
|
|
3386
4496
|
}
|
|
3387
4497
|
});
|
|
3388
4498
|
},
|
|
3389
|
-
[
|
|
4499
|
+
[env2]
|
|
3390
4500
|
);
|
|
3391
4501
|
const isValidActionToken = useCallback2(
|
|
3392
4502
|
async (actionToken, path) => {
|
|
3393
|
-
return
|
|
4503
|
+
return env2?.requests?.post(
|
|
3394
4504
|
path,
|
|
3395
4505
|
{},
|
|
3396
4506
|
{
|
|
@@ -3402,7 +4512,7 @@ function useAuthService() {
|
|
|
3402
4512
|
}
|
|
3403
4513
|
);
|
|
3404
4514
|
},
|
|
3405
|
-
[
|
|
4515
|
+
[env2]
|
|
3406
4516
|
);
|
|
3407
4517
|
const loginSocial = useCallback2(
|
|
3408
4518
|
async ({
|
|
@@ -3410,7 +4520,7 @@ function useAuthService() {
|
|
|
3410
4520
|
state,
|
|
3411
4521
|
access_token
|
|
3412
4522
|
}) => {
|
|
3413
|
-
return
|
|
4523
|
+
return env2?.requests?.post(
|
|
3414
4524
|
"/token/generate" /* GENTOKEN_SOCIAL */,
|
|
3415
4525
|
{ state, access_token },
|
|
3416
4526
|
{
|
|
@@ -3420,23 +4530,23 @@ function useAuthService() {
|
|
|
3420
4530
|
}
|
|
3421
4531
|
);
|
|
3422
4532
|
},
|
|
3423
|
-
[
|
|
4533
|
+
[env2]
|
|
3424
4534
|
);
|
|
3425
4535
|
const getProviders = useCallback2(
|
|
3426
4536
|
async (db) => {
|
|
3427
|
-
return
|
|
4537
|
+
return env2?.requests?.get("/oauth/providers", { params: { db } });
|
|
3428
4538
|
},
|
|
3429
|
-
[
|
|
4539
|
+
[env2]
|
|
3430
4540
|
);
|
|
3431
4541
|
const getAccessByCode = useCallback2(
|
|
3432
4542
|
async (code) => {
|
|
3433
4543
|
const data = new URLSearchParams();
|
|
3434
4544
|
data.append("code", code);
|
|
3435
4545
|
data.append("grant_type", "authorization_code");
|
|
3436
|
-
data.append("client_id",
|
|
3437
|
-
data.append("redirect_uri",
|
|
3438
|
-
return
|
|
3439
|
-
`${
|
|
4546
|
+
data.append("client_id", env2?.config?.clientId || "");
|
|
4547
|
+
data.append("redirect_uri", env2?.config?.redirectUri || "");
|
|
4548
|
+
return env2?.requests?.post(
|
|
4549
|
+
`${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
|
|
3440
4550
|
data,
|
|
3441
4551
|
{
|
|
3442
4552
|
headers: {
|
|
@@ -3445,12 +4555,12 @@ function useAuthService() {
|
|
|
3445
4555
|
}
|
|
3446
4556
|
);
|
|
3447
4557
|
},
|
|
3448
|
-
[
|
|
4558
|
+
[env2]
|
|
3449
4559
|
);
|
|
3450
4560
|
const logout = useCallback2(
|
|
3451
4561
|
async (data) => {
|
|
3452
4562
|
console.log(data);
|
|
3453
|
-
return
|
|
4563
|
+
return env2?.requests?.post(
|
|
3454
4564
|
"/logout" /* LOGOUT */,
|
|
3455
4565
|
{},
|
|
3456
4566
|
{
|
|
@@ -3462,7 +4572,7 @@ function useAuthService() {
|
|
|
3462
4572
|
}
|
|
3463
4573
|
);
|
|
3464
4574
|
},
|
|
3465
|
-
[
|
|
4575
|
+
[env2]
|
|
3466
4576
|
);
|
|
3467
4577
|
return {
|
|
3468
4578
|
login,
|
|
@@ -3510,7 +4620,7 @@ function EnvProvider({
|
|
|
3510
4620
|
localStorageUtils: localStorageUtil = localStorageUtils(),
|
|
3511
4621
|
sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
|
|
3512
4622
|
}) {
|
|
3513
|
-
const [
|
|
4623
|
+
const [env2, setEnvState] = useState2({
|
|
3514
4624
|
...initialEnvState,
|
|
3515
4625
|
localStorageUtils: localStorageUtil,
|
|
3516
4626
|
sessionStorageUtils: sessionStorageUtil
|
|
@@ -3518,7 +4628,7 @@ function EnvProvider({
|
|
|
3518
4628
|
const setupEnv = useCallback3(
|
|
3519
4629
|
(envConfig) => {
|
|
3520
4630
|
const updatedEnv = {
|
|
3521
|
-
...
|
|
4631
|
+
...env2,
|
|
3522
4632
|
...envConfig,
|
|
3523
4633
|
localStorageUtils: localStorageUtil,
|
|
3524
4634
|
sessionStorageUtils: sessionStorageUtil
|
|
@@ -3527,7 +4637,7 @@ function EnvProvider({
|
|
|
3527
4637
|
setEnvState({ ...updatedEnv, requests });
|
|
3528
4638
|
return updatedEnv;
|
|
3529
4639
|
},
|
|
3530
|
-
[
|
|
4640
|
+
[env2, localStorageUtil, sessionStorageUtil]
|
|
3531
4641
|
);
|
|
3532
4642
|
const setUid2 = useCallback3((uid) => {
|
|
3533
4643
|
setEnvState((prev) => ({
|
|
@@ -3584,7 +4694,7 @@ function EnvProvider({
|
|
|
3584
4694
|
EnvContext.Provider,
|
|
3585
4695
|
{
|
|
3586
4696
|
value: {
|
|
3587
|
-
env,
|
|
4697
|
+
env: env2,
|
|
3588
4698
|
setupEnv,
|
|
3589
4699
|
setUid: setUid2,
|
|
3590
4700
|
setLang: setLang2,
|
|
@@ -3602,15 +4712,15 @@ function EnvProvider({
|
|
|
3602
4712
|
function useEnv() {
|
|
3603
4713
|
const context = useContext(EnvContext);
|
|
3604
4714
|
if (!context) {
|
|
3605
|
-
|
|
4715
|
+
throw new Error("useEnv must be used within an EnvProvider");
|
|
3606
4716
|
}
|
|
3607
4717
|
return context;
|
|
3608
4718
|
}
|
|
3609
4719
|
|
|
3610
4720
|
// src/hooks/auth/use-login-credential.tsx
|
|
3611
4721
|
var useLoginCredential = () => {
|
|
3612
|
-
const { env } = useEnv();
|
|
3613
|
-
console.log("useLoginCredential called",
|
|
4722
|
+
const { env: env2 } = useEnv();
|
|
4723
|
+
console.log("useLoginCredential called", env2, new Error().stack);
|
|
3614
4724
|
const { login } = useAuthService();
|
|
3615
4725
|
return useMutation5({
|
|
3616
4726
|
mutationFn: (data) => {
|
|
@@ -3622,111 +4732,696 @@ var use_login_credential_default = useLoginCredential;
|
|
|
3622
4732
|
|
|
3623
4733
|
// src/hooks/auth/use-login-socical.ts
|
|
3624
4734
|
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
4735
|
+
var useLoginSocial = () => {
|
|
4736
|
+
return useMutation6({
|
|
4737
|
+
mutationFn: (data) => {
|
|
4738
|
+
return auth_service_default.loginSocial(data);
|
|
4739
|
+
}
|
|
4740
|
+
});
|
|
4741
|
+
};
|
|
4742
|
+
var use_login_socical_default = useLoginSocial;
|
|
3625
4743
|
|
|
3626
4744
|
// src/hooks/auth/use-reset-password.ts
|
|
3627
4745
|
import { useMutation as useMutation7 } from "@tanstack/react-query";
|
|
4746
|
+
var useResetPassword = () => {
|
|
4747
|
+
return useMutation7({
|
|
4748
|
+
mutationFn: (request) => {
|
|
4749
|
+
return auth_service_default.resetPassword(request.data, request.token);
|
|
4750
|
+
}
|
|
4751
|
+
});
|
|
4752
|
+
};
|
|
4753
|
+
var use_reset_password_default = useResetPassword;
|
|
3628
4754
|
|
|
3629
4755
|
// src/hooks/auth/use-reset-password-sso.ts
|
|
3630
4756
|
import { useMutation as useMutation8 } from "@tanstack/react-query";
|
|
4757
|
+
var useResetPasswordSSO = () => {
|
|
4758
|
+
return useMutation8({
|
|
4759
|
+
mutationFn: ({
|
|
4760
|
+
method,
|
|
4761
|
+
password,
|
|
4762
|
+
with_context
|
|
4763
|
+
}) => {
|
|
4764
|
+
return auth_service_default.resetPasswordSSO({
|
|
4765
|
+
method,
|
|
4766
|
+
password,
|
|
4767
|
+
with_context
|
|
4768
|
+
});
|
|
4769
|
+
}
|
|
4770
|
+
});
|
|
4771
|
+
};
|
|
4772
|
+
var use_reset_password_sso_default = useResetPasswordSSO;
|
|
3631
4773
|
|
|
3632
4774
|
// src/hooks/auth/use-update-password.ts
|
|
3633
4775
|
import { useMutation as useMutation9 } from "@tanstack/react-query";
|
|
4776
|
+
var useUpdatePassword = () => {
|
|
4777
|
+
return useMutation9({
|
|
4778
|
+
mutationFn: (request) => {
|
|
4779
|
+
return auth_service_default.updatePassword(request.data, request.token);
|
|
4780
|
+
}
|
|
4781
|
+
});
|
|
4782
|
+
};
|
|
4783
|
+
var use_update_password_default = useUpdatePassword;
|
|
3634
4784
|
|
|
3635
4785
|
// src/hooks/auth/use-logout.ts
|
|
3636
4786
|
import { useMutation as useMutation10 } from "@tanstack/react-query";
|
|
4787
|
+
var useLogout = () => {
|
|
4788
|
+
return useMutation10({
|
|
4789
|
+
mutationFn: (data) => {
|
|
4790
|
+
return auth_service_default.logout(data);
|
|
4791
|
+
}
|
|
4792
|
+
});
|
|
4793
|
+
};
|
|
4794
|
+
var use_logout_default = useLogout;
|
|
3637
4795
|
|
|
3638
4796
|
// src/hooks/auth/use-get-access-by-code.ts
|
|
3639
4797
|
import { useMutation as useMutation11 } from "@tanstack/react-query";
|
|
4798
|
+
var useGetAccessByCode = () => {
|
|
4799
|
+
return useMutation11({
|
|
4800
|
+
mutationFn: ({ code }) => {
|
|
4801
|
+
return auth_service_default.getAccessByCode(code);
|
|
4802
|
+
}
|
|
4803
|
+
});
|
|
4804
|
+
};
|
|
4805
|
+
var use_get_access_by_code_default = useGetAccessByCode;
|
|
3640
4806
|
|
|
3641
4807
|
// src/hooks/auth/use-validate-action-token.ts
|
|
3642
4808
|
import { useMutation as useMutation12 } from "@tanstack/react-query";
|
|
4809
|
+
var useValidateActionToken = () => {
|
|
4810
|
+
return useMutation12({
|
|
4811
|
+
mutationFn: ({
|
|
4812
|
+
actionToken,
|
|
4813
|
+
path
|
|
4814
|
+
}) => {
|
|
4815
|
+
return auth_service_default.isValidActionToken(actionToken, path);
|
|
4816
|
+
}
|
|
4817
|
+
});
|
|
4818
|
+
};
|
|
4819
|
+
var use_validate_action_token_default = useValidateActionToken;
|
|
3643
4820
|
|
|
3644
4821
|
// src/hooks/company/use-get-company-info.ts
|
|
3645
4822
|
import { useMutation as useMutation13 } from "@tanstack/react-query";
|
|
4823
|
+
var useGetCompanyInfo = () => {
|
|
4824
|
+
return useMutation13({
|
|
4825
|
+
mutationFn: (id) => company_service_default.getInfoCompany(id)
|
|
4826
|
+
});
|
|
4827
|
+
};
|
|
4828
|
+
var use_get_company_info_default = useGetCompanyInfo;
|
|
3646
4829
|
|
|
3647
4830
|
// src/hooks/company/use-get-current-company.ts
|
|
3648
4831
|
import { useMutation as useMutation14 } from "@tanstack/react-query";
|
|
4832
|
+
var useGetCurrentCompany = () => {
|
|
4833
|
+
return useMutation14({
|
|
4834
|
+
mutationFn: () => company_service_default.getCurrentCompany()
|
|
4835
|
+
});
|
|
4836
|
+
};
|
|
4837
|
+
var use_get_current_company_default = useGetCurrentCompany;
|
|
3649
4838
|
|
|
3650
4839
|
// src/hooks/company/use-get-list-company.ts
|
|
3651
4840
|
import { useQuery } from "@tanstack/react-query";
|
|
4841
|
+
var useGetListCompany = (companyIDs = []) => {
|
|
4842
|
+
const companySpec = {
|
|
4843
|
+
id: {},
|
|
4844
|
+
name: {}
|
|
4845
|
+
};
|
|
4846
|
+
const getListParams = {
|
|
4847
|
+
model: "res.company" /* COMPANY */,
|
|
4848
|
+
ids: companyIDs,
|
|
4849
|
+
specification: companySpec
|
|
4850
|
+
};
|
|
4851
|
+
return useQuery({
|
|
4852
|
+
queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
|
|
4853
|
+
queryFn: () => model_service_default.getList(getListParams),
|
|
4854
|
+
refetchOnWindowFocus: false
|
|
4855
|
+
});
|
|
4856
|
+
};
|
|
4857
|
+
var use_get_list_company_default = useGetListCompany;
|
|
3652
4858
|
|
|
3653
4859
|
// src/hooks/excel/use-export-excel.ts
|
|
3654
4860
|
import { useMutation as useMutation15 } from "@tanstack/react-query";
|
|
4861
|
+
var useExportExcel = () => {
|
|
4862
|
+
return useMutation15({
|
|
4863
|
+
mutationFn: ({
|
|
4864
|
+
model,
|
|
4865
|
+
domain,
|
|
4866
|
+
ids,
|
|
4867
|
+
fields,
|
|
4868
|
+
type,
|
|
4869
|
+
importCompat,
|
|
4870
|
+
context,
|
|
4871
|
+
groupby
|
|
4872
|
+
}) => excel_service_default.exportExcel({
|
|
4873
|
+
model,
|
|
4874
|
+
domain,
|
|
4875
|
+
ids,
|
|
4876
|
+
fields,
|
|
4877
|
+
type,
|
|
4878
|
+
importCompat,
|
|
4879
|
+
context,
|
|
4880
|
+
groupby
|
|
4881
|
+
})
|
|
4882
|
+
});
|
|
4883
|
+
};
|
|
4884
|
+
var use_export_excel_default = useExportExcel;
|
|
3655
4885
|
|
|
3656
4886
|
// src/hooks/excel/use-get-field-export.ts
|
|
3657
4887
|
import { useMutation as useMutation16 } from "@tanstack/react-query";
|
|
4888
|
+
var useGetFieldExport = () => {
|
|
4889
|
+
return useMutation16({
|
|
4890
|
+
mutationFn: ({
|
|
4891
|
+
ids,
|
|
4892
|
+
model,
|
|
4893
|
+
isShow,
|
|
4894
|
+
parentField,
|
|
4895
|
+
fieldType,
|
|
4896
|
+
parentName,
|
|
4897
|
+
prefix,
|
|
4898
|
+
name,
|
|
4899
|
+
context,
|
|
4900
|
+
importCompat
|
|
4901
|
+
}) => excel_service_default.getFieldExport({
|
|
4902
|
+
ids,
|
|
4903
|
+
model,
|
|
4904
|
+
isShow,
|
|
4905
|
+
parentField,
|
|
4906
|
+
fieldType,
|
|
4907
|
+
parentName,
|
|
4908
|
+
prefix,
|
|
4909
|
+
name,
|
|
4910
|
+
context,
|
|
4911
|
+
importCompat
|
|
4912
|
+
})
|
|
4913
|
+
});
|
|
4914
|
+
};
|
|
4915
|
+
var use_get_field_export_default = useGetFieldExport;
|
|
3658
4916
|
|
|
3659
4917
|
// src/hooks/excel/use-get-file-excel.ts
|
|
3660
4918
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
4919
|
+
var useGetFileExcel = ({ model }) => {
|
|
4920
|
+
return useQuery2({
|
|
4921
|
+
queryKey: [],
|
|
4922
|
+
queryFn: () => excel_service_default.getFileExcel({
|
|
4923
|
+
model
|
|
4924
|
+
}).then((res) => {
|
|
4925
|
+
if (res) {
|
|
4926
|
+
return res;
|
|
4927
|
+
}
|
|
4928
|
+
return [];
|
|
4929
|
+
}),
|
|
4930
|
+
refetchOnWindowFocus: false
|
|
4931
|
+
});
|
|
4932
|
+
};
|
|
4933
|
+
var use_get_file_excel_default = useGetFileExcel;
|
|
3661
4934
|
|
|
3662
4935
|
// src/hooks/excel/use-parse-preview.ts
|
|
3663
4936
|
import { useMutation as useMutation17 } from "@tanstack/react-query";
|
|
4937
|
+
var useParsePreview = () => {
|
|
4938
|
+
return useMutation17({
|
|
4939
|
+
mutationFn: ({
|
|
4940
|
+
id,
|
|
4941
|
+
selectedSheet,
|
|
4942
|
+
isHeader,
|
|
4943
|
+
context
|
|
4944
|
+
}) => excel_service_default.parsePreview({
|
|
4945
|
+
id,
|
|
4946
|
+
selectedSheet,
|
|
4947
|
+
isHeader,
|
|
4948
|
+
context
|
|
4949
|
+
})
|
|
4950
|
+
});
|
|
4951
|
+
};
|
|
4952
|
+
var use_parse_preview_default = useParsePreview;
|
|
3664
4953
|
|
|
3665
4954
|
// src/hooks/excel/use-upload-file.ts
|
|
3666
4955
|
import { useMutation as useMutation18 } from "@tanstack/react-query";
|
|
4956
|
+
var useUploadFile = () => {
|
|
4957
|
+
return useMutation18({
|
|
4958
|
+
mutationFn: ({ formData }) => excel_service_default.uploadFile({
|
|
4959
|
+
formData
|
|
4960
|
+
})
|
|
4961
|
+
});
|
|
4962
|
+
};
|
|
4963
|
+
var use_upload_file_default = useUploadFile;
|
|
3667
4964
|
|
|
3668
4965
|
// src/hooks/excel/use-upload-id-file.ts
|
|
3669
4966
|
import { useMutation as useMutation19 } from "@tanstack/react-query";
|
|
4967
|
+
var useUploadIdFile = () => {
|
|
4968
|
+
return useMutation19({
|
|
4969
|
+
mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
|
|
4970
|
+
formData
|
|
4971
|
+
})
|
|
4972
|
+
});
|
|
4973
|
+
};
|
|
4974
|
+
var use_upload_id_file_default = useUploadIdFile;
|
|
3670
4975
|
|
|
3671
4976
|
// src/hooks/excel/uss-execute-import.ts
|
|
3672
4977
|
import { useMutation as useMutation20 } from "@tanstack/react-query";
|
|
4978
|
+
var useExecuteImport = () => {
|
|
4979
|
+
return useMutation20({
|
|
4980
|
+
mutationFn: ({
|
|
4981
|
+
fields,
|
|
4982
|
+
columns,
|
|
4983
|
+
idFile,
|
|
4984
|
+
options,
|
|
4985
|
+
dryrun,
|
|
4986
|
+
context
|
|
4987
|
+
}) => excel_service_default.executeImport({
|
|
4988
|
+
fields,
|
|
4989
|
+
columns,
|
|
4990
|
+
idFile,
|
|
4991
|
+
options,
|
|
4992
|
+
dryrun,
|
|
4993
|
+
context
|
|
4994
|
+
})
|
|
4995
|
+
});
|
|
4996
|
+
};
|
|
4997
|
+
var uss_execute_import_default = useExecuteImport;
|
|
3673
4998
|
|
|
3674
4999
|
// src/hooks/form/use-change-status.ts
|
|
3675
5000
|
import { useMutation as useMutation21 } from "@tanstack/react-query";
|
|
5001
|
+
var useChangeStatus = () => {
|
|
5002
|
+
return useMutation21({
|
|
5003
|
+
mutationFn: ({ data }) => {
|
|
5004
|
+
return form_service_default.changeStatus({
|
|
5005
|
+
data
|
|
5006
|
+
});
|
|
5007
|
+
}
|
|
5008
|
+
});
|
|
5009
|
+
};
|
|
5010
|
+
var use_change_status_default = useChangeStatus;
|
|
3676
5011
|
|
|
3677
5012
|
// src/hooks/form/use-delete-comment.ts
|
|
3678
5013
|
import { useMutation as useMutation22 } from "@tanstack/react-query";
|
|
5014
|
+
var useDeleteComment = () => {
|
|
5015
|
+
return useMutation22({
|
|
5016
|
+
mutationFn: ({ data }) => form_service_default.deleteComment({
|
|
5017
|
+
data
|
|
5018
|
+
})
|
|
5019
|
+
});
|
|
5020
|
+
};
|
|
5021
|
+
var use_delete_comment_default = useDeleteComment;
|
|
3679
5022
|
|
|
3680
5023
|
// src/hooks/form/use-get-comment.ts
|
|
3681
5024
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
5025
|
+
var useGetComment = ({ data, queryKey }) => {
|
|
5026
|
+
return useQuery3({
|
|
5027
|
+
queryKey,
|
|
5028
|
+
queryFn: () => form_service_default.getComment({ data }).then((res) => {
|
|
5029
|
+
if (res) {
|
|
5030
|
+
return res;
|
|
5031
|
+
}
|
|
5032
|
+
}),
|
|
5033
|
+
enabled: !!data.thread_id && !isNaN(data.thread_id),
|
|
5034
|
+
refetchOnWindowFocus: false
|
|
5035
|
+
});
|
|
5036
|
+
};
|
|
5037
|
+
var use_get_comment_default = useGetComment;
|
|
3682
5038
|
|
|
3683
5039
|
// src/hooks/form/use-get-form-view.ts
|
|
3684
5040
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
5041
|
+
var useGetFormView = ({
|
|
5042
|
+
data,
|
|
5043
|
+
queryKey,
|
|
5044
|
+
enabled
|
|
5045
|
+
}) => {
|
|
5046
|
+
return useQuery4({
|
|
5047
|
+
queryKey,
|
|
5048
|
+
queryFn: () => form_service_default.getFormView({ data }).then((res) => {
|
|
5049
|
+
if (res) {
|
|
5050
|
+
return res;
|
|
5051
|
+
}
|
|
5052
|
+
}),
|
|
5053
|
+
enabled,
|
|
5054
|
+
refetchOnWindowFocus: false
|
|
5055
|
+
});
|
|
5056
|
+
};
|
|
5057
|
+
var use_get_form_view_default = useGetFormView;
|
|
3685
5058
|
|
|
3686
5059
|
// src/hooks/form/use-get-image.ts
|
|
3687
5060
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
5061
|
+
var useGetImage = ({
|
|
5062
|
+
data,
|
|
5063
|
+
queryKey,
|
|
5064
|
+
src
|
|
5065
|
+
}) => {
|
|
5066
|
+
return useQuery5({
|
|
5067
|
+
queryKey,
|
|
5068
|
+
queryFn: () => form_service_default.getImage({ data }).then((res) => {
|
|
5069
|
+
if (res) {
|
|
5070
|
+
return res;
|
|
5071
|
+
}
|
|
5072
|
+
}),
|
|
5073
|
+
enabled: !src && !isBase64File(src),
|
|
5074
|
+
refetchOnWindowFocus: false
|
|
5075
|
+
});
|
|
5076
|
+
};
|
|
5077
|
+
var use_get_image_default = useGetImage;
|
|
3688
5078
|
|
|
3689
5079
|
// src/hooks/form/use-send-comment.ts
|
|
3690
5080
|
import { useMutation as useMutation23 } from "@tanstack/react-query";
|
|
5081
|
+
var useSendComment = () => {
|
|
5082
|
+
return useMutation23({
|
|
5083
|
+
mutationFn: ({ data }) => form_service_default.sentComment({
|
|
5084
|
+
data
|
|
5085
|
+
})
|
|
5086
|
+
});
|
|
5087
|
+
};
|
|
5088
|
+
var use_send_comment_default = useSendComment;
|
|
3691
5089
|
|
|
3692
5090
|
// src/hooks/form/use-upload-image.ts
|
|
3693
5091
|
import { useMutation as useMutation24 } from "@tanstack/react-query";
|
|
5092
|
+
var useUploadImage = () => {
|
|
5093
|
+
return useMutation24({
|
|
5094
|
+
mutationFn: ({ data }) => form_service_default.uploadImage({
|
|
5095
|
+
data
|
|
5096
|
+
})
|
|
5097
|
+
});
|
|
5098
|
+
};
|
|
5099
|
+
var use_upload_image_default = useUploadImage;
|
|
3694
5100
|
|
|
3695
5101
|
// src/hooks/model/use-delete.ts
|
|
3696
5102
|
import { useMutation as useMutation25 } from "@tanstack/react-query";
|
|
5103
|
+
var useDelete = () => {
|
|
5104
|
+
return useMutation25({
|
|
5105
|
+
mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
|
|
5106
|
+
});
|
|
5107
|
+
};
|
|
5108
|
+
var use_delete_default = useDelete;
|
|
3697
5109
|
|
|
3698
5110
|
// src/hooks/model/use-get-all.ts
|
|
3699
5111
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5112
|
+
var useGetAll = ({ data, queryKey, viewResponse }) => {
|
|
5113
|
+
return useQuery6({
|
|
5114
|
+
queryKey,
|
|
5115
|
+
queryFn: () => model_service_default.getAll({ data }).then((res) => {
|
|
5116
|
+
if (res) {
|
|
5117
|
+
return res;
|
|
5118
|
+
}
|
|
5119
|
+
}),
|
|
5120
|
+
enabled: !!data.specification && !!data.model && !!data.domain && !!viewResponse,
|
|
5121
|
+
refetchOnWindowFocus: false
|
|
5122
|
+
// placeholderData: keepPreviousData,
|
|
5123
|
+
});
|
|
5124
|
+
};
|
|
5125
|
+
var use_get_all_default = useGetAll;
|
|
3700
5126
|
|
|
3701
5127
|
// src/hooks/model/use-get-conversion-rate.ts
|
|
3702
5128
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
5129
|
+
var useGetConversionRate = () => {
|
|
5130
|
+
return useQuery7({
|
|
5131
|
+
queryKey: ["currency-rate"],
|
|
5132
|
+
queryFn: () => model_service_default.getConversionRate().then((res) => {
|
|
5133
|
+
if (res) {
|
|
5134
|
+
return res;
|
|
5135
|
+
}
|
|
5136
|
+
}),
|
|
5137
|
+
enabled: true
|
|
5138
|
+
});
|
|
5139
|
+
};
|
|
5140
|
+
var use_get_conversion_rate_default = useGetConversionRate;
|
|
3703
5141
|
|
|
3704
5142
|
// src/hooks/model/use-get-currency.ts
|
|
3705
5143
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
5144
|
+
var useGetCurrency = () => {
|
|
5145
|
+
return useQuery8({
|
|
5146
|
+
queryKey: ["currency"],
|
|
5147
|
+
queryFn: () => model_service_default.getCurrency().then((res) => {
|
|
5148
|
+
if (res) {
|
|
5149
|
+
return res;
|
|
5150
|
+
}
|
|
5151
|
+
}),
|
|
5152
|
+
enabled: true
|
|
5153
|
+
});
|
|
5154
|
+
};
|
|
5155
|
+
var use_get_currency_default = useGetCurrency;
|
|
3706
5156
|
|
|
3707
5157
|
// src/hooks/model/use-get-detail.ts
|
|
3708
5158
|
import { useMutation as useMutation26 } from "@tanstack/react-query";
|
|
5159
|
+
var useGetDetail = () => {
|
|
5160
|
+
return useMutation26({
|
|
5161
|
+
mutationFn: ({
|
|
5162
|
+
model,
|
|
5163
|
+
ids,
|
|
5164
|
+
specification,
|
|
5165
|
+
context
|
|
5166
|
+
}) => model_service_default.getDetail({
|
|
5167
|
+
model,
|
|
5168
|
+
ids,
|
|
5169
|
+
specification,
|
|
5170
|
+
context
|
|
5171
|
+
})
|
|
5172
|
+
});
|
|
5173
|
+
};
|
|
5174
|
+
var use_get_detail_default = useGetDetail;
|
|
3709
5175
|
|
|
3710
5176
|
// src/hooks/model/use-get-field-onchange.ts
|
|
3711
5177
|
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
5178
|
+
var useGetFieldOnChange = ({ model }) => {
|
|
5179
|
+
return useQuery9({
|
|
5180
|
+
queryKey: [`field-onchange-${model}`, model],
|
|
5181
|
+
queryFn: () => model_service_default.getListFieldsOnchange({
|
|
5182
|
+
model
|
|
5183
|
+
}).then((res) => {
|
|
5184
|
+
if (res) {
|
|
5185
|
+
return res;
|
|
5186
|
+
}
|
|
5187
|
+
}),
|
|
5188
|
+
refetchOnWindowFocus: false,
|
|
5189
|
+
staleTime: Infinity
|
|
5190
|
+
});
|
|
5191
|
+
};
|
|
5192
|
+
var use_get_field_onchange_default = useGetFieldOnChange;
|
|
3712
5193
|
|
|
3713
5194
|
// src/hooks/model/use-get-list-my-bank-account.ts
|
|
3714
5195
|
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
5196
|
+
var useGetListMyBankAccount = ({
|
|
5197
|
+
domain,
|
|
5198
|
+
spectification,
|
|
5199
|
+
model
|
|
5200
|
+
}) => {
|
|
5201
|
+
return useQuery10({
|
|
5202
|
+
queryKey: ["bank-account", model, domain],
|
|
5203
|
+
queryFn: () => model_service_default.getListMyBankAccount({
|
|
5204
|
+
domain,
|
|
5205
|
+
spectification,
|
|
5206
|
+
model
|
|
5207
|
+
}).then((res) => {
|
|
5208
|
+
if (res) {
|
|
5209
|
+
return res;
|
|
5210
|
+
}
|
|
5211
|
+
}),
|
|
5212
|
+
enabled: true
|
|
5213
|
+
});
|
|
5214
|
+
};
|
|
5215
|
+
var use_get_list_my_bank_account_default = useGetListMyBankAccount;
|
|
5216
|
+
|
|
5217
|
+
// src/models/base-model/index.ts
|
|
5218
|
+
var BaseModel = class {
|
|
5219
|
+
name;
|
|
5220
|
+
view;
|
|
5221
|
+
actContext;
|
|
5222
|
+
fields;
|
|
5223
|
+
constructor(init) {
|
|
5224
|
+
this.name = init.name;
|
|
5225
|
+
this.view = init.view;
|
|
5226
|
+
this.actContext = init.actContext;
|
|
5227
|
+
this.fields = init.fields;
|
|
5228
|
+
}
|
|
5229
|
+
getSpecificationByFields({
|
|
5230
|
+
fields = [],
|
|
5231
|
+
specification = {},
|
|
5232
|
+
modelsData,
|
|
5233
|
+
model,
|
|
5234
|
+
modelRoot
|
|
5235
|
+
}) {
|
|
5236
|
+
if (Array.isArray(fields)) {
|
|
5237
|
+
let spec = { ...specification };
|
|
5238
|
+
fields.forEach((field) => {
|
|
5239
|
+
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
5240
|
+
if (modelsData?.[model]?.[field?.name]) {
|
|
5241
|
+
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
5242
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
5243
|
+
const modelRelation = modelsData?.[relation];
|
|
5244
|
+
if (modelRelation) {
|
|
5245
|
+
spec[field?.name] = {
|
|
5246
|
+
fields: {}
|
|
5247
|
+
};
|
|
5248
|
+
if (modelRoot && modelRoot === relation) {
|
|
5249
|
+
spec[field?.name].fields = { id: {} };
|
|
5250
|
+
} else {
|
|
5251
|
+
spec[field?.name].fields = this.getSpecificationByFields({
|
|
5252
|
+
fields: Object.values(modelRelation),
|
|
5253
|
+
specification: {},
|
|
5254
|
+
modelsData,
|
|
5255
|
+
model: relation,
|
|
5256
|
+
modelRoot: model
|
|
5257
|
+
});
|
|
5258
|
+
}
|
|
5259
|
+
} else {
|
|
5260
|
+
spec[field?.name] = {
|
|
5261
|
+
fields: {
|
|
5262
|
+
id: {},
|
|
5263
|
+
display_name: {}
|
|
5264
|
+
}
|
|
5265
|
+
};
|
|
5266
|
+
}
|
|
5267
|
+
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
5268
|
+
spec[field?.name] = {
|
|
5269
|
+
fields: {
|
|
5270
|
+
id: {},
|
|
5271
|
+
display_name: {},
|
|
5272
|
+
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
5273
|
+
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
5274
|
+
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
5275
|
+
}
|
|
5276
|
+
};
|
|
5277
|
+
} else {
|
|
5278
|
+
spec[field?.name] = {};
|
|
5279
|
+
}
|
|
5280
|
+
}
|
|
5281
|
+
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
5282
|
+
const specGroup = this.getSpecificationByFields({
|
|
5283
|
+
fields: field?.fields,
|
|
5284
|
+
specification: spec,
|
|
5285
|
+
modelsData,
|
|
5286
|
+
model
|
|
5287
|
+
});
|
|
5288
|
+
spec = { ...spec, ...specGroup };
|
|
5289
|
+
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
5290
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
5291
|
+
const specTreee = this.getSpecificationByFields({
|
|
5292
|
+
fields: field?.fields,
|
|
5293
|
+
specification: {},
|
|
5294
|
+
modelsData,
|
|
5295
|
+
model: relation,
|
|
5296
|
+
modelRoot: model
|
|
5297
|
+
});
|
|
5298
|
+
spec = { ...spec, [field?.name]: { fields: specTreee } };
|
|
5299
|
+
}
|
|
5300
|
+
});
|
|
5301
|
+
return spec;
|
|
5302
|
+
} else {
|
|
5303
|
+
console.warn("fields is not array");
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
getTreeProps() {
|
|
5307
|
+
const props = this.view?.views?.list || {};
|
|
5308
|
+
return props;
|
|
5309
|
+
}
|
|
5310
|
+
getTreeFields() {
|
|
5311
|
+
const fields = this.view?.views?.list?.fields || [];
|
|
5312
|
+
return fields;
|
|
5313
|
+
}
|
|
5314
|
+
getSpecification() {
|
|
5315
|
+
const specInit = {};
|
|
5316
|
+
const modelData = this.view?.models || {};
|
|
5317
|
+
const specification = this.getSpecificationByFields({
|
|
5318
|
+
fields: this.fields,
|
|
5319
|
+
specification: specInit,
|
|
5320
|
+
modelsData: modelData,
|
|
5321
|
+
model: this.name,
|
|
5322
|
+
modelRoot: ""
|
|
5323
|
+
});
|
|
5324
|
+
return specification;
|
|
5325
|
+
}
|
|
5326
|
+
};
|
|
5327
|
+
var base_model_default = BaseModel;
|
|
5328
|
+
|
|
5329
|
+
// src/hooks/model/use-model.ts
|
|
5330
|
+
var useModel = () => {
|
|
5331
|
+
const initModel = (modelData) => {
|
|
5332
|
+
switch (modelData?.name) {
|
|
5333
|
+
default:
|
|
5334
|
+
return new base_model_default(modelData);
|
|
5335
|
+
}
|
|
5336
|
+
};
|
|
5337
|
+
return {
|
|
5338
|
+
initModel
|
|
5339
|
+
};
|
|
5340
|
+
};
|
|
5341
|
+
var use_model_default = useModel;
|
|
5342
|
+
|
|
5343
|
+
// src/hooks/model/use-odoo-data-transform.ts
|
|
5344
|
+
var useOdooDataTransform = () => {
|
|
5345
|
+
return {
|
|
5346
|
+
toDataJS: model_service_default.toDataJS,
|
|
5347
|
+
parseORM: model_service_default.parseORMOdoo
|
|
5348
|
+
};
|
|
5349
|
+
};
|
|
5350
|
+
var use_odoo_data_transform_default = useOdooDataTransform;
|
|
3715
5351
|
|
|
3716
5352
|
// src/hooks/model/use-onchange-form.ts
|
|
3717
5353
|
import { useMutation as useMutation27 } from "@tanstack/react-query";
|
|
5354
|
+
var useOnChangeForm = () => {
|
|
5355
|
+
return useMutation27({
|
|
5356
|
+
mutationFn: ({
|
|
5357
|
+
ids,
|
|
5358
|
+
model,
|
|
5359
|
+
specification,
|
|
5360
|
+
context,
|
|
5361
|
+
object,
|
|
5362
|
+
fieldChange
|
|
5363
|
+
}) => model_service_default.onChange({
|
|
5364
|
+
ids,
|
|
5365
|
+
model,
|
|
5366
|
+
specification,
|
|
5367
|
+
context,
|
|
5368
|
+
object,
|
|
5369
|
+
fieldChange
|
|
5370
|
+
})
|
|
5371
|
+
});
|
|
5372
|
+
};
|
|
5373
|
+
var use_onchange_form_default = useOnChangeForm;
|
|
3718
5374
|
|
|
3719
5375
|
// src/hooks/model/use-save.ts
|
|
3720
5376
|
import { useMutation as useMutation28 } from "@tanstack/react-query";
|
|
5377
|
+
var useSave = () => {
|
|
5378
|
+
return useMutation28({
|
|
5379
|
+
mutationFn: ({
|
|
5380
|
+
ids,
|
|
5381
|
+
model,
|
|
5382
|
+
data,
|
|
5383
|
+
specification,
|
|
5384
|
+
context,
|
|
5385
|
+
path
|
|
5386
|
+
}) => model_service_default.save({ ids, model, data, specification, context, path })
|
|
5387
|
+
});
|
|
5388
|
+
};
|
|
5389
|
+
var use_save_default = useSave;
|
|
3721
5390
|
|
|
3722
5391
|
// src/hooks/user/use-get-profile.ts
|
|
3723
5392
|
import { useMutation as useMutation29 } from "@tanstack/react-query";
|
|
5393
|
+
var useGetProfile = (path) => {
|
|
5394
|
+
return useMutation29({
|
|
5395
|
+
mutationFn: () => user_service_default.getProfile(path)
|
|
5396
|
+
});
|
|
5397
|
+
};
|
|
5398
|
+
var use_get_profile_default = useGetProfile;
|
|
3724
5399
|
|
|
3725
5400
|
// src/hooks/user/use-get-user.ts
|
|
3726
5401
|
import { useMutation as useMutation30 } from "@tanstack/react-query";
|
|
5402
|
+
var useGetUser = () => {
|
|
5403
|
+
return useMutation30({
|
|
5404
|
+
mutationFn: ({ id, context }) => user_service_default.getUser({
|
|
5405
|
+
id,
|
|
5406
|
+
context
|
|
5407
|
+
})
|
|
5408
|
+
});
|
|
5409
|
+
};
|
|
5410
|
+
var use_get_user_default = useGetUser;
|
|
3727
5411
|
|
|
3728
5412
|
// src/hooks/user/use-switch-locale.ts
|
|
3729
5413
|
import { useMutation as useMutation31 } from "@tanstack/react-query";
|
|
5414
|
+
var useSwitchLocale = () => {
|
|
5415
|
+
return useMutation31({
|
|
5416
|
+
mutationFn: ({ data }) => {
|
|
5417
|
+
return user_service_default.switchUserLocale({
|
|
5418
|
+
id: data.id,
|
|
5419
|
+
values: data.values
|
|
5420
|
+
});
|
|
5421
|
+
}
|
|
5422
|
+
});
|
|
5423
|
+
};
|
|
5424
|
+
var use_switch_locale_default = useSwitchLocale;
|
|
3730
5425
|
|
|
3731
5426
|
// src/hooks/view/use-button.ts
|
|
3732
5427
|
import { useMutation as useMutation32 } from "@tanstack/react-query";
|
|
@@ -3842,10 +5537,74 @@ var VersionGate = ({ children }) => {
|
|
|
3842
5537
|
}, [queryClient]);
|
|
3843
5538
|
return ready ? /* @__PURE__ */ jsx5(Fragment, { children }) : null;
|
|
3844
5539
|
};
|
|
5540
|
+
|
|
5541
|
+
// src/provider/service-provider.tsx
|
|
5542
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
5543
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
5544
|
+
var ServiceContext = createContext2(null);
|
|
5545
|
+
var ServiceProvider = ({
|
|
5546
|
+
children
|
|
5547
|
+
}) => {
|
|
5548
|
+
const services = {
|
|
5549
|
+
useForgotPassword: use_forgot_password_default,
|
|
5550
|
+
useForgotPasswordSSO: use_forgotpassword_sso_default,
|
|
5551
|
+
useGetProvider: use_get_provider_default,
|
|
5552
|
+
useIsValidToken: use_isvalid_token_default,
|
|
5553
|
+
useLoginCredential: use_login_credential_default,
|
|
5554
|
+
useLoginSocial: use_login_socical_default,
|
|
5555
|
+
useResetPassword: use_reset_password_default,
|
|
5556
|
+
useResetPasswordSSO: use_reset_password_sso_default,
|
|
5557
|
+
useUpdatePassword: use_update_password_default,
|
|
5558
|
+
useLogout: use_logout_default,
|
|
5559
|
+
useGetAccessByCode: use_get_access_by_code_default,
|
|
5560
|
+
useValidateActionToken: use_validate_action_token_default,
|
|
5561
|
+
useGetCompanyInfo: use_get_company_info_default,
|
|
5562
|
+
useGetCurrentCompany: use_get_current_company_default,
|
|
5563
|
+
useGetListCompany: use_get_list_company_default,
|
|
5564
|
+
useExecuteImport: uss_execute_import_default,
|
|
5565
|
+
useExportExcel: use_export_excel_default,
|
|
5566
|
+
useGetFieldExport: use_get_field_export_default,
|
|
5567
|
+
useGetFileExcel: use_get_file_excel_default,
|
|
5568
|
+
useParsePreview: use_parse_preview_default,
|
|
5569
|
+
useUploadFile: use_upload_file_default,
|
|
5570
|
+
useUploadIdFile: use_upload_id_file_default,
|
|
5571
|
+
useChangeStatus: use_change_status_default,
|
|
5572
|
+
useDeleteComment: use_delete_comment_default,
|
|
5573
|
+
useGetComment: use_get_comment_default,
|
|
5574
|
+
useGetFormView: use_get_form_view_default,
|
|
5575
|
+
useGetImage: use_get_image_default,
|
|
5576
|
+
useSendComment: use_send_comment_default,
|
|
5577
|
+
useUploadImage: use_upload_image_default,
|
|
5578
|
+
useDelete: use_delete_default,
|
|
5579
|
+
useGetAll: use_get_all_default,
|
|
5580
|
+
useGetConversionRate: use_get_conversion_rate_default,
|
|
5581
|
+
useGetCurrency: use_get_currency_default,
|
|
5582
|
+
useGetDetail: use_get_detail_default,
|
|
5583
|
+
useGetFieldOnChange: use_get_field_onchange_default,
|
|
5584
|
+
useGetListMyBankAccount: use_get_list_my_bank_account_default,
|
|
5585
|
+
useModel: use_model_default,
|
|
5586
|
+
useOdooDataTransform: use_odoo_data_transform_default,
|
|
5587
|
+
useOnChangeForm: use_onchange_form_default,
|
|
5588
|
+
useSave: use_save_default,
|
|
5589
|
+
useGetProfile: use_get_profile_default,
|
|
5590
|
+
useGetUser: use_get_user_default,
|
|
5591
|
+
useSwitchLocale: use_switch_locale_default
|
|
5592
|
+
};
|
|
5593
|
+
return /* @__PURE__ */ jsx6(ServiceContext.Provider, { value: services, children });
|
|
5594
|
+
};
|
|
5595
|
+
var useService = () => {
|
|
5596
|
+
const context = useContext2(ServiceContext);
|
|
5597
|
+
if (!context) {
|
|
5598
|
+
throw new Error("useService must be used within a ServiceProvider");
|
|
5599
|
+
}
|
|
5600
|
+
return context;
|
|
5601
|
+
};
|
|
3845
5602
|
export {
|
|
3846
5603
|
EnvProvider,
|
|
3847
5604
|
MainProvider,
|
|
3848
5605
|
ReactQueryProvider,
|
|
5606
|
+
ServiceProvider,
|
|
3849
5607
|
VersionGate,
|
|
3850
|
-
useEnv
|
|
5608
|
+
useEnv,
|
|
5609
|
+
useService
|
|
3851
5610
|
};
|