@fctc/interface-logic 1.10.6 → 1.10.8

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.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 env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
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
- [env]
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 env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
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
- [env]
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 env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
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
- [env]
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 env?.requests.post("/web/dataset/resequence", jsonData, {
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
- [env]
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 env?.requests.post("/call" /* CALL_PATH */, jsonData, {
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
- [env]
906
+ [env2]
868
907
  );
869
908
  const loadMessages = useCallback(
870
909
  async () => {
871
- return env.requests.post(
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
- [env]
920
+ [env2]
882
921
  );
883
922
  const getVersion = useCallback(
884
923
  async () => {
885
- console.log("env?.requests", env, env?.requests);
886
- return env?.requests?.get("", {
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
- [env]
931
+ [env2]
893
932
  );
894
933
  return {
895
934
  getView,
@@ -3019,6 +3058,26 @@ function matchDomain(record, domain) {
3019
3058
 
3020
3059
  // src/utils/function.ts
3021
3060
  import { useEffect, useState } from "react";
3061
+ var toQueryString = (params) => {
3062
+ return Object.keys(params).map(
3063
+ (key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
3064
+ ).join("&");
3065
+ };
3066
+ var isBase64File = (str) => {
3067
+ try {
3068
+ const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
3069
+ if (dataUriPattern.test(str)) {
3070
+ return true;
3071
+ }
3072
+ const base64Pattern = (
3073
+ // eslint-disable-next-line no-useless-escape
3074
+ /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)?$/
3075
+ );
3076
+ return base64Pattern.test(str);
3077
+ } catch (e) {
3078
+ return false;
3079
+ }
3080
+ };
3022
3081
  var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
3023
3082
  if (!originalRequest.data) return originalRequest.data;
3024
3083
  if (typeof originalRequest.data === "string") {
@@ -3249,116 +3308,1822 @@ var axiosClient = {
3249
3308
  }
3250
3309
  };
3251
3310
 
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";
3311
+ // src/environment/EnvStore.ts
3312
+ var EventEmitter = class {
3313
+ listeners = {};
3314
+ on(event, callback) {
3315
+ if (!this.listeners[event]) {
3316
+ this.listeners[event] = [];
3317
+ }
3318
+ this.listeners[event].push(callback);
3319
+ }
3320
+ emit(event, data) {
3321
+ if (this.listeners[event]) {
3322
+ this.listeners[event].forEach((callback) => callback(data));
3323
+ }
3324
+ }
3325
+ };
3326
+ var EnvStore = class {
3327
+ state;
3328
+ emitter;
3329
+ localStorageUtil;
3330
+ sessionStorageUtil;
3331
+ constructor(localStorageUtil = localStorageUtils(), sessionStorageUtil = sessionStorageUtils()) {
3332
+ this.state = {
3333
+ baseUrl: "",
3334
+ requests: null,
3335
+ companies: [],
3336
+ user: {},
3337
+ config: null,
3338
+ envFile: null,
3339
+ defaultCompany: {
3340
+ id: null,
3341
+ logo: "",
3342
+ secondary_color: "",
3343
+ primary_color: ""
3344
+ },
3345
+ context: {
3346
+ uid: null,
3347
+ allowed_company_ids: [],
3348
+ lang: "vi_VN",
3349
+ tz: "Asia/Saigon"
3350
+ },
3351
+ localStorageUtils: localStorageUtil,
3352
+ sessionStorageUtils: sessionStorageUtil
3353
+ };
3354
+ this.emitter = new EventEmitter();
3355
+ this.localStorageUtil = localStorageUtil;
3356
+ this.sessionStorageUtil = sessionStorageUtil;
3357
+ }
3358
+ getEnv() {
3359
+ return { ...this.state };
3360
+ }
3361
+ onUpdate(callback) {
3362
+ this.emitter.on("update", callback);
3363
+ }
3364
+ setupEnv(envConfig) {
3365
+ this.state = {
3366
+ ...this.state,
3367
+ ...envConfig,
3368
+ localStorageUtils: this.localStorageUtil,
3369
+ sessionStorageUtils: this.sessionStorageUtil
3370
+ };
3371
+ this.state.requests = axiosClient.init(this.state);
3372
+ this.emitter.emit("update", this.getEnv());
3373
+ return this.getEnv();
3374
+ }
3375
+ setUid(uid) {
3376
+ this.state = {
3377
+ ...this.state,
3378
+ context: { ...this.state.context, uid }
3379
+ };
3380
+ this.emitter.emit("update", this.getEnv());
3381
+ }
3382
+ setLang(lang) {
3383
+ this.state = {
3384
+ ...this.state,
3385
+ context: { ...this.state.context, lang }
3386
+ };
3387
+ this.emitter.emit("update", this.getEnv());
3388
+ }
3389
+ setAllowCompanies(allowed_company_ids) {
3390
+ this.state = {
3391
+ ...this.state,
3392
+ context: { ...this.state.context, allowed_company_ids }
3393
+ };
3394
+ this.emitter.emit("update", this.getEnv());
3395
+ }
3396
+ setCompanies(companies) {
3397
+ this.state = { ...this.state, companies };
3398
+ this.emitter.emit("update", this.getEnv());
3399
+ }
3400
+ setDefaultCompany(defaultCompany) {
3401
+ this.state = { ...this.state, defaultCompany };
3402
+ this.emitter.emit("update", this.getEnv());
3403
+ }
3404
+ setUserInfo(user) {
3405
+ this.state = { ...this.state, user };
3406
+ this.emitter.emit("update", this.getEnv());
3407
+ }
3408
+ setConfig(config) {
3409
+ this.state = { ...this.state, config };
3410
+ this.emitter.emit("update", this.getEnv());
3411
+ }
3412
+ setEnvFile(envFile) {
3413
+ this.state = { ...this.state, envFile };
3414
+ this.emitter.emit("update", this.getEnv());
3415
+ }
3416
+ };
3417
+ var env = null;
3418
+ function initEnv({
3419
+ localStorageUtils: localStorageUtil = localStorageUtils(),
3420
+ sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
3421
+ }) {
3422
+ if (!env) {
3423
+ env = new EnvStore(localStorageUtil, sessionStorageUtil);
3424
+ }
3425
+ return env;
3426
+ }
3427
+ function getEnv() {
3428
+ if (!env) {
3429
+ env = initEnv({});
3430
+ }
3431
+ return env?.getEnv();
3432
+ }
3263
3433
 
3264
- // src/services/auth-service/backup.ts
3265
- import { useCallback as useCallback2 } from "react";
3266
- function useAuthService() {
3267
- const { env } = useEnv();
3268
- const login = useCallback2(
3269
- async (body) => {
3270
- const payload = Object.fromEntries(
3271
- Object.entries({
3272
- username: body.email,
3273
- password: body.password,
3274
- grant_type: env?.config?.grantType || "",
3275
- client_id: env?.config?.clientId || "",
3276
- client_secret: env?.config?.clientSecret || ""
3277
- }).filter(([_, value]) => !!value)
3278
- );
3279
- const encodedData = new URLSearchParams(payload).toString();
3280
- return env?.requests?.post(body.path, encodedData, {
3281
- headers: {
3282
- "Content-Type": "application/x-www-form-urlencoded"
3283
- }
3284
- });
3285
- },
3286
- [env]
3287
- );
3288
- const forgotPassword = useCallback2(
3289
- async (email) => {
3290
- const bodyData = {
3291
- login: email,
3292
- url: `${window.location.origin}/reset-password`
3434
+ // src/services/action-service/index.ts
3435
+ var ActionService = {
3436
+ // Load Action
3437
+ async loadAction({
3438
+ idAction,
3439
+ context
3440
+ }) {
3441
+ const env2 = getEnv();
3442
+ const jsonData = {
3443
+ action_id: idAction,
3444
+ with_context: {
3445
+ ...context
3446
+ }
3447
+ };
3448
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3449
+ headers: {
3450
+ "Content-Type": "application/json"
3451
+ }
3452
+ });
3453
+ },
3454
+ // Call Button
3455
+ async callButton({
3456
+ model,
3457
+ ids = [],
3458
+ context,
3459
+ method
3460
+ }) {
3461
+ try {
3462
+ const env2 = getEnv();
3463
+ const jsonData = {
3464
+ model,
3465
+ method,
3466
+ ids,
3467
+ with_context: context
3293
3468
  };
3294
- return env?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3469
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3295
3470
  headers: {
3296
3471
  "Content-Type": "application/json"
3297
3472
  }
3298
3473
  });
3299
- },
3300
- [env]
3301
- );
3302
- const forgotPasswordSSO = useCallback2(
3303
- async ({
3304
- email,
3305
- with_context,
3306
- method
3307
- }) => {
3308
- const body = {
3309
- method,
3310
- kwargs: {
3311
- vals: {
3312
- email
3313
- }
3474
+ } catch (error) {
3475
+ console.error("Error when calling button action:", error);
3476
+ throw error;
3477
+ }
3478
+ },
3479
+ // remove Row
3480
+ async removeRows({
3481
+ model,
3482
+ ids,
3483
+ context
3484
+ }) {
3485
+ const env2 = getEnv();
3486
+ const jsonData = {
3487
+ model,
3488
+ method: "unlink",
3489
+ ids,
3490
+ with_context: context
3491
+ };
3492
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3493
+ headers: {
3494
+ "Content-Type": "application/json"
3495
+ }
3496
+ });
3497
+ },
3498
+ // Duplicate Model
3499
+ async duplicateRecord({
3500
+ model,
3501
+ id,
3502
+ context
3503
+ }) {
3504
+ const env2 = getEnv();
3505
+ const jsonData = {
3506
+ model,
3507
+ method: "copy",
3508
+ ids: id,
3509
+ with_context: context
3510
+ };
3511
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3512
+ headers: {
3513
+ "Content-Type": "application/json"
3514
+ }
3515
+ });
3516
+ },
3517
+ // Get Print Report
3518
+ async getPrintReportName({ id }) {
3519
+ const env2 = getEnv();
3520
+ const jsonData = {
3521
+ model: "ir.actions.report",
3522
+ method: "web_read",
3523
+ id,
3524
+ kwargs: {
3525
+ specification: {
3526
+ report_name: {}
3527
+ }
3528
+ }
3529
+ };
3530
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3531
+ headers: {
3532
+ "Content-Type": "application/json"
3533
+ }
3534
+ });
3535
+ },
3536
+ //Save Print Invoice
3537
+ async print({ id, report, db }) {
3538
+ const env2 = getEnv();
3539
+ const jsonData = {
3540
+ report,
3541
+ id,
3542
+ type: "pdf",
3543
+ file_response: true,
3544
+ db
3545
+ };
3546
+ const queryString = toQueryString(jsonData);
3547
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3548
+ return env2.requests.get(urlWithParams, {
3549
+ headers: {
3550
+ "Content-Type": "application/json"
3551
+ },
3552
+ responseType: "arraybuffer"
3553
+ });
3554
+ },
3555
+ //Run Action
3556
+ async runAction({
3557
+ idAction,
3558
+ context
3559
+ }) {
3560
+ const env2 = getEnv();
3561
+ const jsonData = {
3562
+ action_id: idAction,
3563
+ with_context: {
3564
+ ...context
3565
+ }
3566
+ // context: {
3567
+ // lang: 'en_US',
3568
+ // tz: 'Asia/Saigon',
3569
+ // uid: 2,
3570
+ // allowed_company_ids: [1],
3571
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3572
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3573
+ // active_model: model,
3574
+ // },
3575
+ };
3576
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3577
+ headers: {
3578
+ "Content-Type": "application/json"
3579
+ }
3580
+ });
3581
+ }
3582
+ };
3583
+ var action_service_default = ActionService;
3584
+
3585
+ // src/services/auth-service/index.ts
3586
+ var AuthService = {
3587
+ async login(body) {
3588
+ const env2 = getEnv();
3589
+ const payload = Object.fromEntries(
3590
+ Object.entries({
3591
+ username: body.email,
3592
+ password: body.password,
3593
+ grant_type: env2?.config?.grantType || "",
3594
+ client_id: env2?.config?.clientId || "",
3595
+ client_secret: env2?.config?.clientSecret || ""
3596
+ }).filter(([_, value]) => !!value)
3597
+ );
3598
+ const encodedData = new URLSearchParams(payload).toString();
3599
+ return env2?.requests?.post(body.path, encodedData, {
3600
+ headers: {
3601
+ "Content-Type": "application/x-www-form-urlencoded"
3602
+ }
3603
+ });
3604
+ },
3605
+ async forgotPassword(email) {
3606
+ const env2 = getEnv();
3607
+ const bodyData = {
3608
+ login: email,
3609
+ url: `${window.location.origin}/reset-password`
3610
+ };
3611
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3612
+ headers: {
3613
+ "Content-Type": "application/json"
3614
+ }
3615
+ });
3616
+ },
3617
+ async forgotPasswordSSO({
3618
+ email,
3619
+ with_context,
3620
+ method
3621
+ }) {
3622
+ const env2 = getEnv();
3623
+ const body = {
3624
+ method,
3625
+ kwargs: {
3626
+ vals: {
3627
+ email
3628
+ }
3629
+ },
3630
+ with_context
3631
+ };
3632
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3633
+ headers: {
3634
+ "Content-Type": "application/json"
3635
+ }
3636
+ });
3637
+ },
3638
+ async resetPassword(data, token) {
3639
+ const env2 = getEnv();
3640
+ const bodyData = {
3641
+ token,
3642
+ password: data.password,
3643
+ new_password: data.confirmPassword
3644
+ };
3645
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3646
+ headers: {
3647
+ "Content-Type": "application/json"
3648
+ }
3649
+ });
3650
+ },
3651
+ async resetPasswordSSO({
3652
+ method,
3653
+ password,
3654
+ with_context
3655
+ }) {
3656
+ const env2 = getEnv();
3657
+ const bodyData = {
3658
+ method,
3659
+ kwargs: {
3660
+ vals: {
3661
+ password
3662
+ }
3663
+ },
3664
+ with_context
3665
+ };
3666
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3667
+ headers: {
3668
+ "Content-Type": "application/json"
3669
+ }
3670
+ });
3671
+ },
3672
+ async updatePassword(data, token) {
3673
+ const env2 = getEnv();
3674
+ const bodyData = {
3675
+ token,
3676
+ old_password: data.oldPassword,
3677
+ new_password: data.newPassword
3678
+ };
3679
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3680
+ headers: {
3681
+ "Content-Type": "application/json"
3682
+ }
3683
+ });
3684
+ },
3685
+ async isValidToken(token) {
3686
+ const env2 = getEnv();
3687
+ const bodyData = {
3688
+ token
3689
+ };
3690
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3691
+ headers: {
3692
+ "Content-Type": "application/json"
3693
+ }
3694
+ });
3695
+ },
3696
+ async isValidActionToken(actionToken, path) {
3697
+ const env2 = getEnv();
3698
+ return env2?.requests?.post(
3699
+ path,
3700
+ {},
3701
+ {
3702
+ headers: {
3703
+ "Content-Type": "application/json"
3314
3704
  },
3315
- with_context
3316
- };
3317
- return env?.requests?.post("/call" /* CALL_PATH */, body, {
3705
+ useActionToken: true,
3706
+ actionToken
3707
+ }
3708
+ );
3709
+ },
3710
+ async loginSocial({
3711
+ db,
3712
+ state,
3713
+ access_token
3714
+ }) {
3715
+ const env2 = getEnv();
3716
+ return env2?.requests?.post(
3717
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3718
+ { state, access_token },
3719
+ {
3318
3720
  headers: {
3319
3721
  "Content-Type": "application/json"
3320
3722
  }
3321
- });
3322
- },
3323
- [env]
3324
- );
3325
- const resetPassword = useCallback2(
3326
- async (data, token) => {
3327
- const bodyData = {
3328
- token,
3329
- password: data.password,
3330
- new_password: data.confirmPassword
3723
+ }
3724
+ );
3725
+ },
3726
+ async getProviders(db) {
3727
+ const env2 = getEnv();
3728
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3729
+ },
3730
+ async getAccessByCode(code) {
3731
+ const env2 = getEnv();
3732
+ const data = new URLSearchParams();
3733
+ data.append("code", code);
3734
+ data.append("grant_type", "authorization_code");
3735
+ data.append("client_id", env2?.config?.clientId || "");
3736
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3737
+ return env2?.requests?.post(
3738
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3739
+ data,
3740
+ {
3741
+ headers: {
3742
+ "Content-Type": "application/x-www-form-urlencoded"
3743
+ }
3744
+ }
3745
+ );
3746
+ },
3747
+ async logout(data) {
3748
+ const env2 = getEnv();
3749
+ console.log(data);
3750
+ return env2?.requests?.post(
3751
+ "/logout" /* LOGOUT */,
3752
+ {},
3753
+ {
3754
+ headers: {
3755
+ "Content-Type": "application/json"
3756
+ },
3757
+ withCredentials: true,
3758
+ useRefreshToken: true
3759
+ }
3760
+ );
3761
+ }
3762
+ };
3763
+ var auth_service_default = AuthService;
3764
+
3765
+ // src/services/company-service/index.ts
3766
+ var CompanyService = {
3767
+ async getCurrentCompany() {
3768
+ const env2 = getEnv();
3769
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3770
+ headers: {
3771
+ "Content-Type": "application/json"
3772
+ }
3773
+ });
3774
+ },
3775
+ async getInfoCompany(id) {
3776
+ const env2 = getEnv();
3777
+ const jsonData = {
3778
+ ids: [id],
3779
+ model: "res.company" /* COMPANY */,
3780
+ method: "web_read" /* WEB_READ */,
3781
+ kwargs: {
3782
+ specification: {
3783
+ primary_color: {},
3784
+ secondary_color: {},
3785
+ logo: {},
3786
+ display_name: {},
3787
+ secondary_logo: {}
3788
+ }
3789
+ }
3790
+ };
3791
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3792
+ headers: {
3793
+ "Content-Type": "application/json"
3794
+ }
3795
+ });
3796
+ }
3797
+ };
3798
+ var company_service_default = CompanyService;
3799
+
3800
+ // src/services/excel-service/index.ts
3801
+ var ExcelService = {
3802
+ async uploadFile({ formData }) {
3803
+ const env2 = getEnv();
3804
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3805
+ headers: {
3806
+ "Content-Type": "multipart/form-data"
3807
+ }
3808
+ });
3809
+ },
3810
+ async uploadIdFile({ formData }) {
3811
+ const env2 = getEnv();
3812
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3813
+ headers: {
3814
+ "Content-Type": "multipart/form-data"
3815
+ }
3816
+ });
3817
+ },
3818
+ async parsePreview({
3819
+ id,
3820
+ selectedSheet,
3821
+ isHeader,
3822
+ context
3823
+ }) {
3824
+ const env2 = getEnv();
3825
+ const jsonData = {
3826
+ model: "base_import.import" /* BASE_IMPORT */,
3827
+ method: "parse_preview",
3828
+ ids: [id],
3829
+ kwargs: {
3830
+ options: {
3831
+ import_skip_records: [],
3832
+ import_set_empty_fields: [],
3833
+ fallback_values: {},
3834
+ name_create_enabled_fields: {},
3835
+ encoding: "",
3836
+ separator: "",
3837
+ quoting: '"',
3838
+ date_format: "",
3839
+ datetime_format: "",
3840
+ float_thousand_separator: ",",
3841
+ float_decimal_separator: ".",
3842
+ advanced: true,
3843
+ has_headers: isHeader,
3844
+ keep_matches: false,
3845
+ limit: 2e3,
3846
+ sheets: [],
3847
+ sheet: selectedSheet,
3848
+ skip: 0,
3849
+ tracking_disable: true
3850
+ }
3851
+ },
3852
+ with_context: context
3853
+ };
3854
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3855
+ headers: {
3856
+ "Content-Type": "multipart/form-data"
3857
+ }
3858
+ });
3859
+ },
3860
+ async executeImport({
3861
+ columns,
3862
+ fields,
3863
+ idFile,
3864
+ options,
3865
+ dryrun,
3866
+ context
3867
+ }) {
3868
+ const env2 = getEnv();
3869
+ const jsonData = {
3870
+ model: "base_import.import" /* BASE_IMPORT */,
3871
+ method: "execute_import",
3872
+ ids: [idFile],
3873
+ kwargs: {
3874
+ fields,
3875
+ columns,
3876
+ options,
3877
+ dryrun
3878
+ },
3879
+ with_context: context
3880
+ };
3881
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3882
+ headers: {
3883
+ "Content-Type": "multipart/form-data"
3884
+ }
3885
+ });
3886
+ },
3887
+ async getFileExcel({ model }) {
3888
+ const env2 = getEnv();
3889
+ const jsonData = {
3890
+ model,
3891
+ method: "get_import_templates" /* GET_IMPORT */,
3892
+ args: []
3893
+ };
3894
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3895
+ },
3896
+ async getFieldExport({
3897
+ ids,
3898
+ model,
3899
+ isShow,
3900
+ parentField,
3901
+ fieldType,
3902
+ parentName,
3903
+ prefix,
3904
+ name,
3905
+ context,
3906
+ importCompat
3907
+ }) {
3908
+ const env2 = getEnv();
3909
+ const jsonData = {
3910
+ model,
3911
+ import_compat: importCompat,
3912
+ domain: [["id", "in", ids]],
3913
+ with_context: context
3914
+ };
3915
+ if (isShow) {
3916
+ jsonData.parent_field = parentField;
3917
+ jsonData.parent_field_type = fieldType;
3918
+ jsonData.parent_name = parentName;
3919
+ jsonData.name = name;
3920
+ jsonData.prefix = prefix;
3921
+ jsonData.exclude = [null];
3922
+ }
3923
+ return env2.requests.post("/export/get_fields", jsonData);
3924
+ },
3925
+ async exportExcel({
3926
+ model,
3927
+ domain,
3928
+ ids,
3929
+ fields,
3930
+ type,
3931
+ importCompat,
3932
+ context,
3933
+ groupby
3934
+ }) {
3935
+ const env2 = getEnv();
3936
+ const jsonData = {
3937
+ model,
3938
+ domain,
3939
+ ids,
3940
+ import_compat: importCompat,
3941
+ fields,
3942
+ with_context: context,
3943
+ groupby: groupby ?? []
3944
+ };
3945
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3946
+ }
3947
+ };
3948
+ var excel_service_default = ExcelService;
3949
+
3950
+ // src/services/form-service/index.ts
3951
+ var FormService = {
3952
+ async getComment({ data }) {
3953
+ try {
3954
+ const env2 = getEnv();
3955
+ const jsonData = {
3956
+ thread_id: data.thread_id,
3957
+ thread_model: data.thread_model,
3958
+ limit: 100,
3959
+ with_context: {
3960
+ lang: data.lang
3961
+ }
3331
3962
  };
3332
- return env?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3963
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3333
3964
  headers: {
3334
3965
  "Content-Type": "application/json"
3335
3966
  }
3336
3967
  });
3337
- },
3338
- [env]
3339
- );
3340
- const resetPasswordSSO = useCallback2(
3341
- async ({
3342
- method,
3343
- password,
3344
- with_context
3345
- }) => {
3346
- const bodyData = {
3347
- method,
3348
- kwargs: {
3349
- vals: {
3350
- password
3351
- }
3968
+ } catch (error) {
3969
+ console.error("Error when sending message:", error);
3970
+ throw error;
3971
+ }
3972
+ },
3973
+ async sentComment({ data }) {
3974
+ try {
3975
+ const env2 = getEnv();
3976
+ const jsonData = {
3977
+ context: {
3978
+ tz: "Asia/Saigon",
3979
+ uid: 2,
3980
+ allowed_company_ids: [1],
3981
+ mail_post_autofollow: false,
3982
+ temporary_id: 142183.01
3352
3983
  },
3353
- with_context
3984
+ post_data: {
3985
+ body: data.message,
3986
+ message_type: "comment",
3987
+ attachment_ids: data.attachment_ids,
3988
+ attachment_tokens: [],
3989
+ subtype_xmlid: data.subtype
3990
+ },
3991
+ thread_id: Number(data.thread_id),
3992
+ thread_model: data.thread_model
3354
3993
  };
3355
- return env?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3994
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3995
+ headers: {
3996
+ "Content-Type": "application/json"
3997
+ }
3998
+ });
3999
+ } catch (error) {
4000
+ console.error("Error when sent message:", error);
4001
+ throw error;
4002
+ }
4003
+ },
4004
+ async deleteComment({ data }) {
4005
+ try {
4006
+ const env2 = getEnv();
4007
+ const jsonData = {
4008
+ attachment_ids: [],
4009
+ attachment_tokens: [],
4010
+ body: "",
4011
+ message_id: data.message_id
4012
+ };
4013
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
4014
+ headers: {
4015
+ "Content-Type": "application/json"
4016
+ }
4017
+ });
4018
+ } catch (error) {
4019
+ console.error("Error when sent message:", error);
4020
+ throw error;
4021
+ }
4022
+ },
4023
+ async getImage({ data }) {
4024
+ try {
4025
+ const env2 = getEnv();
4026
+ return env2.requests.get(
4027
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
4028
+ {
4029
+ headers: {
4030
+ "Content-Type": "application/json"
4031
+ }
4032
+ }
4033
+ );
4034
+ } catch (error) {
4035
+ console.error("Error when sent message:", error);
4036
+ throw error;
4037
+ }
4038
+ },
4039
+ async uploadImage({ data }) {
4040
+ try {
4041
+ const env2 = getEnv();
4042
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
4043
+ headers: {
4044
+ "Content-Type": "multipart/form-data"
4045
+ }
4046
+ });
4047
+ } catch (error) {
4048
+ console.error("Error when sent message:", error);
4049
+ throw error;
4050
+ }
4051
+ },
4052
+ async getFormView({ data }) {
4053
+ try {
4054
+ const env2 = getEnv();
4055
+ const jsonData = {
4056
+ model: data.model,
4057
+ method: "get_formview_action",
4058
+ ids: data.id ? [data.id] : [],
4059
+ with_context: data.context
4060
+ };
4061
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4062
+ headers: {
4063
+ "Content-Type": "application/json"
4064
+ }
4065
+ });
4066
+ } catch (error) {
4067
+ console.error("Error when fetching form view:", error);
4068
+ throw error;
4069
+ }
4070
+ },
4071
+ async changeStatus({ data }) {
4072
+ const env2 = getEnv();
4073
+ const vals = {
4074
+ [data.name]: data.stage_id
4075
+ };
4076
+ const jsonData = {
4077
+ model: data.model,
4078
+ method: "web_save",
4079
+ with_context: {
4080
+ lang: data.lang,
4081
+ allowed_company_ids: [1],
4082
+ uid: 2,
4083
+ search_default_my_ticket: true,
4084
+ search_default_is_open: true
4085
+ },
4086
+ ids: [data.id],
4087
+ kwargs: {
4088
+ vals,
4089
+ specification: {}
4090
+ }
4091
+ };
4092
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4093
+ headers: {
4094
+ "Content-Type": "application/json"
4095
+ }
4096
+ });
4097
+ }
4098
+ };
4099
+ var form_service_default = FormService;
4100
+
4101
+ // src/services/kanban-service/index.ts
4102
+ var KanbanServices = {
4103
+ async getGroups({
4104
+ model,
4105
+ width_context
4106
+ }) {
4107
+ const env2 = getEnv();
4108
+ const jsonDataView = {
4109
+ model,
4110
+ method: "web_read_group",
4111
+ kwargs: {
4112
+ domain: [["stage_id.fold", "=", false]],
4113
+ fields: ["color:sum"],
4114
+ groupby: ["stage_id"]
4115
+ },
4116
+ width_context
4117
+ };
4118
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
4119
+ headers: {
4120
+ "Content-Type": "application/json"
4121
+ }
4122
+ });
4123
+ },
4124
+ async getProgressBar({
4125
+ field,
4126
+ color,
4127
+ model,
4128
+ width_context
4129
+ }) {
4130
+ const env2 = getEnv();
4131
+ const jsonDataView = {
4132
+ model,
4133
+ method: "read_progress_bar",
4134
+ kwargs: {
4135
+ domain: [],
4136
+ group_by: "stage_id",
4137
+ progress_bar: {
4138
+ colors: color,
4139
+ field
4140
+ }
4141
+ },
4142
+ width_context
4143
+ };
4144
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
4145
+ headers: {
4146
+ "Content-Type": "application/json"
4147
+ }
4148
+ });
4149
+ }
4150
+ };
4151
+ var kanban_service_default = KanbanServices;
4152
+
4153
+ // src/services/model-service/index.ts
4154
+ var OBJECT_POSITION = 2;
4155
+ var ModelService = {
4156
+ async getListMyBankAccount({
4157
+ domain,
4158
+ spectification,
4159
+ model
4160
+ }) {
4161
+ const env2 = getEnv();
4162
+ const jsonData = {
4163
+ model,
4164
+ method: "web_search_read",
4165
+ kwargs: {
4166
+ specification: spectification,
4167
+ domain,
4168
+ limit: 100,
4169
+ offset: 0
4170
+ }
4171
+ };
4172
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4173
+ headers: {
4174
+ "Content-Type": "application/json"
4175
+ }
4176
+ });
4177
+ },
4178
+ async getCurrency() {
4179
+ const env2 = getEnv();
4180
+ const jsonData = {
4181
+ model: "res.currency",
4182
+ method: "web_search_read",
4183
+ kwargs: {
4184
+ specification: {
4185
+ icon_url: {},
4186
+ name: {}
4187
+ },
4188
+ domain: [["active", "=", true]],
4189
+ limit: 100,
4190
+ offset: 0
4191
+ }
4192
+ };
4193
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4194
+ headers: {
4195
+ "Content-Type": "application/json"
4196
+ }
4197
+ });
4198
+ },
4199
+ async getConversionRate() {
4200
+ const env2 = getEnv();
4201
+ const jsonData = {
4202
+ model: "res.currency",
4203
+ method: "web_search_read",
4204
+ kwargs: {
4205
+ specification: {
4206
+ name: {},
4207
+ icon_url: {},
4208
+ rate_ids: {
4209
+ fields: {
4210
+ company_rate: {},
4211
+ sell: {}
4212
+ }
4213
+ }
4214
+ },
4215
+ domain: [["active", "=", true]],
4216
+ limit: 100,
4217
+ offset: 0
4218
+ }
4219
+ };
4220
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4221
+ headers: {
4222
+ "Content-Type": "application/json"
4223
+ }
4224
+ });
4225
+ },
4226
+ async getAll({ data }) {
4227
+ const env2 = getEnv();
4228
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4229
+ fields: data.fields,
4230
+ groupby: data.groupby
4231
+ } : {
4232
+ count_limit: 10001,
4233
+ order: data.sort,
4234
+ specification: data.specification
4235
+ };
4236
+ const jsonData = {
4237
+ model: String(data.model),
4238
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4239
+ ids: data.ids,
4240
+ with_context: data.context,
4241
+ kwargs: {
4242
+ domain: data.domain,
4243
+ limit: data.limit,
4244
+ offset: data.offset,
4245
+ ...jsonReadGroup
4246
+ }
4247
+ };
4248
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4249
+ headers: {
4250
+ "Content-Type": "application/json"
4251
+ }
4252
+ });
4253
+ },
4254
+ async getListCalendar({ data }) {
4255
+ const env2 = getEnv();
4256
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4257
+ fields: data.fields,
4258
+ groupby: data.groupby
4259
+ } : {
4260
+ count_limit: 10001,
4261
+ order: data.sort,
4262
+ specification: data.specification
4263
+ };
4264
+ const jsonData = {
4265
+ model: String(data.model),
4266
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4267
+ ids: data.ids,
4268
+ with_context: data.context,
4269
+ kwargs: {
4270
+ domain: data.domain,
4271
+ limit: data.limit,
4272
+ offset: data.offset,
4273
+ fields: data.fields,
4274
+ ...jsonReadGroup
4275
+ }
4276
+ };
4277
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4278
+ headers: {
4279
+ "Content-Type": "application/json"
4280
+ }
4281
+ });
4282
+ },
4283
+ async getList({
4284
+ model,
4285
+ ids = [],
4286
+ specification = {},
4287
+ domain = [],
4288
+ offset,
4289
+ order,
4290
+ context = {},
4291
+ limit = 10
4292
+ }) {
4293
+ const env2 = getEnv();
4294
+ const jsonData = {
4295
+ model,
4296
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4297
+ ids,
4298
+ with_context: context,
4299
+ kwargs: {
4300
+ specification,
4301
+ domain,
4302
+ limit,
4303
+ offset,
4304
+ order
4305
+ }
4306
+ };
4307
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4308
+ headers: {
4309
+ "Content-Type": "application/json"
4310
+ }
4311
+ });
4312
+ },
4313
+ async getDetail({
4314
+ ids = [],
4315
+ model,
4316
+ specification,
4317
+ context
4318
+ }) {
4319
+ const env2 = getEnv();
4320
+ const jsonData = {
4321
+ model,
4322
+ method: "web_read" /* WEB_READ */,
4323
+ ids,
4324
+ with_context: context,
4325
+ kwargs: {
4326
+ specification
4327
+ }
4328
+ };
4329
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4330
+ headers: {
4331
+ "Content-Type": "application/json"
4332
+ }
4333
+ });
4334
+ },
4335
+ async save({
4336
+ model,
4337
+ ids = [],
4338
+ data = {},
4339
+ specification = {},
4340
+ context = {},
4341
+ path
4342
+ }) {
4343
+ const env2 = getEnv();
4344
+ const jsonData = {
4345
+ model,
4346
+ method: "web_save" /* WEB_SAVE */,
4347
+ with_context: context,
4348
+ ids,
4349
+ kwargs: {
4350
+ vals: data,
4351
+ specification
4352
+ }
4353
+ };
4354
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4355
+ headers: {
4356
+ "Content-Type": "application/json"
4357
+ }
4358
+ });
4359
+ },
4360
+ async delete({ ids = [], model }) {
4361
+ const env2 = getEnv();
4362
+ const jsonData = {
4363
+ model,
4364
+ method: "unlink" /* UNLINK */,
4365
+ ids
4366
+ };
4367
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4368
+ headers: {
4369
+ "Content-Type": "application/json"
4370
+ }
4371
+ });
4372
+ },
4373
+ async onChange({
4374
+ ids = [],
4375
+ model,
4376
+ object,
4377
+ specification,
4378
+ context,
4379
+ fieldChange
4380
+ }) {
4381
+ const env2 = getEnv();
4382
+ const jsonData = {
4383
+ model,
4384
+ method: "onchange" /* ONCHANGE */,
4385
+ ids,
4386
+ with_context: context,
4387
+ args: [
4388
+ object ? object : {},
4389
+ fieldChange ? fieldChange : [],
4390
+ specification
4391
+ ]
4392
+ };
4393
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4394
+ headers: {
4395
+ "Content-Type": "application/json"
4396
+ }
4397
+ });
4398
+ },
4399
+ async getListFieldsOnchange({ model }) {
4400
+ const env2 = getEnv();
4401
+ const jsonData = {
4402
+ model,
4403
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4404
+ };
4405
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4406
+ headers: {
4407
+ "Content-Type": "application/json"
4408
+ }
4409
+ });
4410
+ },
4411
+ parseORMOdoo(data) {
4412
+ for (const key in data) {
4413
+ if (key === "display_name") {
4414
+ delete data[key];
4415
+ }
4416
+ if (!data[key] && data[key] !== 0) {
4417
+ data[key] = false;
4418
+ } else if (data[key] === "Draft") {
4419
+ data[key] = "/";
4420
+ }
4421
+ }
4422
+ return { ...data };
4423
+ },
4424
+ toDataJS(data, viewData, model) {
4425
+ for (const key in data) {
4426
+ if (data[key] === false) {
4427
+ if (viewData && model) {
4428
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4429
+ data[key] = null;
4430
+ }
4431
+ } else {
4432
+ data[key] = null;
4433
+ }
4434
+ } else if (data[key] === "/") {
4435
+ data[key] = "Draft";
4436
+ } else if (data[key] !== false) {
4437
+ if (model !== void 0) {
4438
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4439
+ data[key] = (data[key] ??= [])?.map((item) => {
4440
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4441
+ if (relation !== void 0) {
4442
+ if (viewData?.models?.[relation]) {
4443
+ if (item?.length >= 3) {
4444
+ return ModelService.toDataJS(
4445
+ item[OBJECT_POSITION],
4446
+ viewData,
4447
+ relation
4448
+ );
4449
+ } else {
4450
+ return ModelService.toDataJS(item, viewData, relation);
4451
+ }
4452
+ } else {
4453
+ if (item?.length >= 3) {
4454
+ return item[OBJECT_POSITION];
4455
+ } else {
4456
+ return item;
4457
+ }
4458
+ }
4459
+ }
4460
+ });
4461
+ }
4462
+ }
4463
+ }
4464
+ }
4465
+ return { ...data };
4466
+ }
4467
+ };
4468
+ var model_service_default = ModelService;
4469
+
4470
+ // src/services/user-service/index.ts
4471
+ var UserService = {
4472
+ async getProfile(path) {
4473
+ const env2 = getEnv();
4474
+ return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4475
+ headers: {
4476
+ "Content-Type": "application/x-www-form-urlencoded"
4477
+ }
4478
+ });
4479
+ },
4480
+ async getUser({ context, id }) {
4481
+ const env2 = getEnv();
4482
+ const jsonData = {
4483
+ model: "res.users",
4484
+ method: "web_read",
4485
+ ids: [id],
4486
+ with_context: context,
4487
+ kwargs: {
4488
+ specification: {
4489
+ display_name: {},
4490
+ image_1920: {},
4491
+ name: {},
4492
+ login: {},
4493
+ email: {},
4494
+ password: {},
4495
+ visible_group_id: {
4496
+ fields: {
4497
+ id: {},
4498
+ display_name: {}
4499
+ }
4500
+ },
4501
+ company_id: {
4502
+ fields: {
4503
+ id: {},
4504
+ display_name: {}
4505
+ }
4506
+ }
4507
+ }
4508
+ }
4509
+ };
4510
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4511
+ headers: {
4512
+ "Content-Type": "application/json"
4513
+ }
4514
+ });
4515
+ },
4516
+ switchUserLocale: async ({ id, values }) => {
4517
+ const env2 = getEnv();
4518
+ const jsonData = {
4519
+ model: "res.users",
4520
+ domain: [["id", "=", id]],
4521
+ values
4522
+ };
4523
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4524
+ headers: {
4525
+ "Content-Type": "application/json"
4526
+ }
4527
+ });
4528
+ }
4529
+ };
4530
+ var user_service_default = UserService;
4531
+
4532
+ // src/services/view-service/index.ts
4533
+ var ViewService = {
4534
+ async getView({
4535
+ model,
4536
+ views,
4537
+ context = {},
4538
+ options = {},
4539
+ aid
4540
+ }) {
4541
+ const env2 = getEnv();
4542
+ const defaultOptions = {
4543
+ load_filters: true,
4544
+ toolbar: true,
4545
+ action_id: aid
4546
+ };
4547
+ const jsonDataView = {
4548
+ model,
4549
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4550
+ kwargs: {
4551
+ views,
4552
+ options: { ...options, ...defaultOptions }
4553
+ },
4554
+ with_context: context
4555
+ };
4556
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4557
+ headers: {
4558
+ "Content-Type": "application/json"
4559
+ }
4560
+ });
4561
+ },
4562
+ async getMenu(context) {
4563
+ const env2 = getEnv();
4564
+ const jsonData = {
4565
+ model: "ir.ui.menu" /* MENU */,
4566
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4567
+ ids: [],
4568
+ with_context: context,
4569
+ kwargs: {
4570
+ specification: {
4571
+ active: {},
4572
+ name: {},
4573
+ is_display: {},
4574
+ sequence: {},
4575
+ complete_name: {},
4576
+ action: {
4577
+ fields: {
4578
+ display_name: {},
4579
+ type: {},
4580
+ binding_view_types: {}
4581
+ // res_model: {},
4582
+ }
4583
+ },
4584
+ url_icon: {},
4585
+ web_icon: {},
4586
+ web_icon_data: {},
4587
+ groups_id: {
4588
+ fields: {
4589
+ full_name: {}
4590
+ },
4591
+ limit: 40,
4592
+ order: ""
4593
+ },
4594
+ display_name: {},
4595
+ child_id: {
4596
+ fields: {
4597
+ active: {},
4598
+ name: {},
4599
+ is_display: {},
4600
+ sequence: {},
4601
+ complete_name: {},
4602
+ action: {
4603
+ fields: {
4604
+ display_name: {},
4605
+ type: {},
4606
+ binding_view_types: {}
4607
+ // res_model: {},
4608
+ }
4609
+ },
4610
+ url_icon: {},
4611
+ web_icon: {},
4612
+ web_icon_data: {},
4613
+ groups_id: {
4614
+ fields: {
4615
+ full_name: {}
4616
+ },
4617
+ limit: 40,
4618
+ order: ""
4619
+ },
4620
+ display_name: {},
4621
+ child_id: {
4622
+ fields: {
4623
+ active: {},
4624
+ name: {},
4625
+ is_display: {},
4626
+ sequence: {},
4627
+ complete_name: {},
4628
+ action: {
4629
+ fields: {
4630
+ display_name: {},
4631
+ type: {},
4632
+ binding_view_types: {}
4633
+ // res_model: {},
4634
+ }
4635
+ },
4636
+ url_icon: {},
4637
+ web_icon: {},
4638
+ web_icon_data: {},
4639
+ groups_id: {
4640
+ fields: {
4641
+ full_name: {}
4642
+ },
4643
+ limit: 40,
4644
+ order: ""
4645
+ },
4646
+ display_name: {},
4647
+ child_id: {
4648
+ fields: {
4649
+ active: {},
4650
+ name: {},
4651
+ is_display: {},
4652
+ sequence: {},
4653
+ complete_name: {},
4654
+ action: {
4655
+ fields: {
4656
+ display_name: {},
4657
+ type: {},
4658
+ binding_view_types: {}
4659
+ // res_model: {},
4660
+ }
4661
+ },
4662
+ url_icon: {},
4663
+ web_icon: {},
4664
+ web_icon_data: {},
4665
+ groups_id: {
4666
+ fields: {
4667
+ full_name: {}
4668
+ },
4669
+ limit: 40,
4670
+ order: ""
4671
+ },
4672
+ display_name: {},
4673
+ child_id: {
4674
+ fields: {},
4675
+ limit: 40,
4676
+ order: ""
4677
+ }
4678
+ },
4679
+ limit: 40,
4680
+ order: ""
4681
+ }
4682
+ },
4683
+ limit: 40,
4684
+ order: ""
4685
+ }
4686
+ },
4687
+ limit: 40,
4688
+ order: ""
4689
+ }
4690
+ },
4691
+ domain: [
4692
+ "&",
4693
+ ["is_display", "=", true],
4694
+ "&",
4695
+ ["active", "=", true],
4696
+ ["parent_id", "=", false]
4697
+ ]
4698
+ }
4699
+ };
4700
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4701
+ headers: {
4702
+ "Content-Type": "application/json"
4703
+ }
4704
+ });
4705
+ },
4706
+ async getActionDetail(aid, context) {
4707
+ const env2 = getEnv();
4708
+ const jsonData = {
4709
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4710
+ method: "web_read" /* WEB_READ */,
4711
+ ids: [aid],
4712
+ with_context: context,
4713
+ kwargs: {
4714
+ specification: {
4715
+ id: {},
4716
+ name: {},
4717
+ res_model: {},
4718
+ views: {},
4719
+ view_mode: {},
4720
+ mobile_view_mode: {},
4721
+ domain: {},
4722
+ context: {},
4723
+ groups_id: {},
4724
+ search_view_id: {}
4725
+ }
4726
+ }
4727
+ };
4728
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4729
+ headers: {
4730
+ "Content-Type": "application/json"
4731
+ }
4732
+ });
4733
+ },
4734
+ async getResequence({
4735
+ model,
4736
+ ids,
4737
+ context,
4738
+ offset
4739
+ }) {
4740
+ const env2 = getEnv();
4741
+ const jsonData = {
4742
+ model,
4743
+ with_context: context,
4744
+ ids,
4745
+ field: "sequence",
4746
+ ...offset > 0 ? { offset } : {}
4747
+ };
4748
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4749
+ headers: {
4750
+ "Content-Type": "application/json"
4751
+ }
4752
+ });
4753
+ },
4754
+ async getSelectionItem({ data }) {
4755
+ const env2 = getEnv();
4756
+ const jsonData = {
4757
+ model: data.model,
4758
+ ids: [],
4759
+ method: "get_data_select",
4760
+ with_context: data.context,
4761
+ kwargs: {
4762
+ count_limit: 10001,
4763
+ domain: data.domain ? data.domain : [],
4764
+ offset: 0,
4765
+ order: "",
4766
+ specification: data?.specification ?? {
4767
+ id: {},
4768
+ name: {},
4769
+ display_name: {}
4770
+ }
4771
+ }
4772
+ };
4773
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4774
+ headers: {
4775
+ "Content-Type": "application/json"
4776
+ }
4777
+ });
4778
+ },
4779
+ async loadMessages() {
4780
+ const env2 = getEnv();
4781
+ return env2.requests.post(
4782
+ "/load_message_failures" /* LOAD_MESSAGE */,
4783
+ {},
4784
+ {
4785
+ headers: {
4786
+ "Content-Type": "application/json"
4787
+ }
4788
+ }
4789
+ );
4790
+ },
4791
+ async getVersion() {
4792
+ const env2 = getEnv();
4793
+ console.log("env?.requests", env2, env2?.requests);
4794
+ return env2?.requests?.get("", {
4795
+ headers: {
4796
+ "Content-Type": "application/json"
4797
+ }
4798
+ });
4799
+ },
4800
+ async get2FAMethods({
4801
+ method,
4802
+ with_context
4803
+ }) {
4804
+ const env2 = getEnv();
4805
+ const jsonData = {
4806
+ method,
4807
+ with_context
4808
+ };
4809
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4810
+ headers: {
4811
+ "Content-Type": "application/json"
4812
+ }
4813
+ });
4814
+ },
4815
+ async verify2FA({
4816
+ method,
4817
+ with_context,
4818
+ code,
4819
+ device,
4820
+ location
4821
+ }) {
4822
+ const env2 = getEnv();
4823
+ const jsonData = {
4824
+ method,
4825
+ kwargs: {
4826
+ vals: {
4827
+ code,
4828
+ device,
4829
+ location
4830
+ }
4831
+ },
4832
+ with_context
4833
+ };
4834
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4835
+ headers: {
4836
+ "Content-Type": "application/json"
4837
+ },
4838
+ withCredentials: true
4839
+ });
4840
+ },
4841
+ async signInSSO({
4842
+ redirect_uri,
4843
+ state,
4844
+ client_id,
4845
+ response_type,
4846
+ path
4847
+ }) {
4848
+ const env2 = getEnv();
4849
+ const params = new URLSearchParams({
4850
+ response_type,
4851
+ client_id,
4852
+ redirect_uri,
4853
+ state
4854
+ });
4855
+ const url = `${path}?${params.toString()}`;
4856
+ return env2?.requests.get(url, {
4857
+ headers: {
4858
+ "Content-Type": "application/json"
4859
+ },
4860
+ withCredentials: true
4861
+ });
4862
+ },
4863
+ async grantAccess({
4864
+ redirect_uri,
4865
+ state,
4866
+ client_id,
4867
+ scopes
4868
+ }) {
4869
+ const env2 = getEnv();
4870
+ const jsonData = {
4871
+ redirect_uri,
4872
+ state,
4873
+ client_id,
4874
+ scopes
4875
+ };
4876
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4877
+ headers: {
4878
+ "Content-Type": "application/json"
4879
+ },
4880
+ withCredentials: true
4881
+ });
4882
+ },
4883
+ async getFieldsViewSecurity({
4884
+ method,
4885
+ token,
4886
+ views
4887
+ }) {
4888
+ const env2 = getEnv();
4889
+ const jsonData = {
4890
+ method,
4891
+ kwargs: {
4892
+ views
4893
+ },
4894
+ with_context: {
4895
+ token
4896
+ }
4897
+ };
4898
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4899
+ headers: {
4900
+ "Content-Type": "application/json"
4901
+ }
4902
+ });
4903
+ },
4904
+ async settingsWebRead2fa({
4905
+ method,
4906
+ model,
4907
+ kwargs,
4908
+ token
4909
+ }) {
4910
+ const env2 = getEnv();
4911
+ const jsonData = {
4912
+ method,
4913
+ model,
4914
+ kwargs,
4915
+ with_context: {
4916
+ token
4917
+ }
4918
+ };
4919
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4920
+ headers: {
4921
+ "Content-Type": "application/json"
4922
+ }
4923
+ });
4924
+ },
4925
+ async requestSetupTotp({ method, token }) {
4926
+ const env2 = getEnv();
4927
+ const jsonData = {
4928
+ method,
4929
+ with_context: {
4930
+ token
4931
+ }
4932
+ };
4933
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4934
+ headers: {
4935
+ "Content-Type": "application/json"
4936
+ }
4937
+ });
4938
+ },
4939
+ async verifyTotp({
4940
+ method,
4941
+ action_token,
4942
+ code
4943
+ }) {
4944
+ const env2 = getEnv();
4945
+ const jsonData = {
4946
+ method,
4947
+ kwargs: {
4948
+ vals: {
4949
+ code
4950
+ }
4951
+ },
4952
+ with_context: {
4953
+ action_token
4954
+ }
4955
+ };
4956
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4957
+ headers: {
4958
+ "Content-Type": "application/json"
4959
+ }
4960
+ });
4961
+ },
4962
+ async removeTotpSetUp({ method, token }) {
4963
+ const env2 = getEnv();
4964
+ const jsonData = {
4965
+ method,
4966
+ with_context: {
4967
+ token
4968
+ }
4969
+ };
4970
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4971
+ headers: {
4972
+ "Content-Type": "application/json"
4973
+ }
4974
+ });
4975
+ }
4976
+ };
4977
+ var view_service_default = ViewService;
4978
+
4979
+ // src/hooks/auth/use-forgot-password.ts
4980
+ var useForgotPassword = () => {
4981
+ return useMutation({
4982
+ mutationFn: (email) => {
4983
+ return auth_service_default.forgotPassword(email);
4984
+ }
4985
+ });
4986
+ };
4987
+ var use_forgot_password_default = useForgotPassword;
4988
+
4989
+ // src/hooks/auth/use-forgotpassword-sso.ts
4990
+ import { useMutation as useMutation2 } from "@tanstack/react-query";
4991
+ var useForgotPasswordSSO = () => {
4992
+ return useMutation2({
4993
+ mutationFn: ({
4994
+ email,
4995
+ with_context,
4996
+ method
4997
+ }) => {
4998
+ return auth_service_default.forgotPasswordSSO({ email, with_context, method });
4999
+ }
5000
+ });
5001
+ };
5002
+ var use_forgotpassword_sso_default = useForgotPasswordSSO;
5003
+
5004
+ // src/hooks/auth/use-get-provider.ts
5005
+ import { useMutation as useMutation3 } from "@tanstack/react-query";
5006
+ var useGetProvider = () => {
5007
+ return useMutation3({
5008
+ mutationFn: (data) => {
5009
+ return auth_service_default.getProviders(data?.db);
5010
+ }
5011
+ });
5012
+ };
5013
+ var use_get_provider_default = useGetProvider;
5014
+
5015
+ // src/hooks/auth/use-isvalid-token.ts
5016
+ import { useMutation as useMutation4 } from "@tanstack/react-query";
5017
+ var useIsValidToken = () => {
5018
+ return useMutation4({
5019
+ mutationFn: (token) => {
5020
+ return auth_service_default.isValidToken(token);
5021
+ }
5022
+ });
5023
+ };
5024
+ var use_isvalid_token_default = useIsValidToken;
5025
+
5026
+ // src/hooks/auth/use-login-credential.tsx
5027
+ import { useMutation as useMutation5 } from "@tanstack/react-query";
5028
+
5029
+ // src/services/auth-service/backup.ts
5030
+ import { useCallback as useCallback2 } from "react";
5031
+ function useAuthService() {
5032
+ const { env: env2 } = useEnv();
5033
+ const login = useCallback2(
5034
+ async (body) => {
5035
+ const payload = Object.fromEntries(
5036
+ Object.entries({
5037
+ username: body.email,
5038
+ password: body.password,
5039
+ grant_type: env2?.config?.grantType || "",
5040
+ client_id: env2?.config?.clientId || "",
5041
+ client_secret: env2?.config?.clientSecret || ""
5042
+ }).filter(([_, value]) => !!value)
5043
+ );
5044
+ const encodedData = new URLSearchParams(payload).toString();
5045
+ return env2?.requests?.post(body.path, encodedData, {
5046
+ headers: {
5047
+ "Content-Type": "application/x-www-form-urlencoded"
5048
+ }
5049
+ });
5050
+ },
5051
+ [env2]
5052
+ );
5053
+ const forgotPassword = useCallback2(
5054
+ async (email) => {
5055
+ const bodyData = {
5056
+ login: email,
5057
+ url: `${window.location.origin}/reset-password`
5058
+ };
5059
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
5060
+ headers: {
5061
+ "Content-Type": "application/json"
5062
+ }
5063
+ });
5064
+ },
5065
+ [env2]
5066
+ );
5067
+ const forgotPasswordSSO = useCallback2(
5068
+ async ({
5069
+ email,
5070
+ with_context,
5071
+ method
5072
+ }) => {
5073
+ const body = {
5074
+ method,
5075
+ kwargs: {
5076
+ vals: {
5077
+ email
5078
+ }
5079
+ },
5080
+ with_context
5081
+ };
5082
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
5083
+ headers: {
5084
+ "Content-Type": "application/json"
5085
+ }
5086
+ });
5087
+ },
5088
+ [env2]
5089
+ );
5090
+ const resetPassword = useCallback2(
5091
+ async (data, token) => {
5092
+ const bodyData = {
5093
+ token,
5094
+ password: data.password,
5095
+ new_password: data.confirmPassword
5096
+ };
5097
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
5098
+ headers: {
5099
+ "Content-Type": "application/json"
5100
+ }
5101
+ });
5102
+ },
5103
+ [env2]
5104
+ );
5105
+ const resetPasswordSSO = useCallback2(
5106
+ async ({
5107
+ method,
5108
+ password,
5109
+ with_context
5110
+ }) => {
5111
+ const bodyData = {
5112
+ method,
5113
+ kwargs: {
5114
+ vals: {
5115
+ password
5116
+ }
5117
+ },
5118
+ with_context
5119
+ };
5120
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3356
5121
  headers: {
3357
5122
  "Content-Type": "application/json"
3358
5123
  }
3359
5124
  });
3360
5125
  },
3361
- [env]
5126
+ [env2]
3362
5127
  );
3363
5128
  const updatePassword = useCallback2(
3364
5129
  async (data, token) => {
@@ -3367,30 +5132,30 @@ function useAuthService() {
3367
5132
  old_password: data.oldPassword,
3368
5133
  new_password: data.newPassword
3369
5134
  };
3370
- return env?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
5135
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3371
5136
  headers: {
3372
5137
  "Content-Type": "application/json"
3373
5138
  }
3374
5139
  });
3375
5140
  },
3376
- [env]
5141
+ [env2]
3377
5142
  );
3378
5143
  const isValidToken = useCallback2(
3379
5144
  async (token) => {
3380
5145
  const bodyData = {
3381
5146
  token
3382
5147
  };
3383
- return env?.requests?.post("/check_token" /* TOKEN */, bodyData, {
5148
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3384
5149
  headers: {
3385
5150
  "Content-Type": "application/json"
3386
5151
  }
3387
5152
  });
3388
5153
  },
3389
- [env]
5154
+ [env2]
3390
5155
  );
3391
5156
  const isValidActionToken = useCallback2(
3392
5157
  async (actionToken, path) => {
3393
- return env?.requests?.post(
5158
+ return env2?.requests?.post(
3394
5159
  path,
3395
5160
  {},
3396
5161
  {
@@ -3402,7 +5167,7 @@ function useAuthService() {
3402
5167
  }
3403
5168
  );
3404
5169
  },
3405
- [env]
5170
+ [env2]
3406
5171
  );
3407
5172
  const loginSocial = useCallback2(
3408
5173
  async ({
@@ -3410,7 +5175,7 @@ function useAuthService() {
3410
5175
  state,
3411
5176
  access_token
3412
5177
  }) => {
3413
- return env?.requests?.post(
5178
+ return env2?.requests?.post(
3414
5179
  "/token/generate" /* GENTOKEN_SOCIAL */,
3415
5180
  { state, access_token },
3416
5181
  {
@@ -3420,23 +5185,23 @@ function useAuthService() {
3420
5185
  }
3421
5186
  );
3422
5187
  },
3423
- [env]
5188
+ [env2]
3424
5189
  );
3425
5190
  const getProviders = useCallback2(
3426
5191
  async (db) => {
3427
- return env?.requests?.get("/oauth/providers", { params: { db } });
5192
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3428
5193
  },
3429
- [env]
5194
+ [env2]
3430
5195
  );
3431
5196
  const getAccessByCode = useCallback2(
3432
5197
  async (code) => {
3433
5198
  const data = new URLSearchParams();
3434
5199
  data.append("code", code);
3435
5200
  data.append("grant_type", "authorization_code");
3436
- data.append("client_id", env?.config?.clientId || "");
3437
- data.append("redirect_uri", env?.config?.redirectUri || "");
3438
- return env?.requests?.post(
3439
- `${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
5201
+ data.append("client_id", env2?.config?.clientId || "");
5202
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
5203
+ return env2?.requests?.post(
5204
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3440
5205
  data,
3441
5206
  {
3442
5207
  headers: {
@@ -3445,12 +5210,12 @@ function useAuthService() {
3445
5210
  }
3446
5211
  );
3447
5212
  },
3448
- [env]
5213
+ [env2]
3449
5214
  );
3450
5215
  const logout = useCallback2(
3451
5216
  async (data) => {
3452
5217
  console.log(data);
3453
- return env?.requests?.post(
5218
+ return env2?.requests?.post(
3454
5219
  "/logout" /* LOGOUT */,
3455
5220
  {},
3456
5221
  {
@@ -3462,7 +5227,7 @@ function useAuthService() {
3462
5227
  }
3463
5228
  );
3464
5229
  },
3465
- [env]
5230
+ [env2]
3466
5231
  );
3467
5232
  return {
3468
5233
  login,
@@ -3510,7 +5275,7 @@ function EnvProvider({
3510
5275
  localStorageUtils: localStorageUtil = localStorageUtils(),
3511
5276
  sessionStorageUtils: sessionStorageUtil = sessionStorageUtils()
3512
5277
  }) {
3513
- const [env, setEnvState] = useState2({
5278
+ const [env2, setEnvState] = useState2({
3514
5279
  ...initialEnvState,
3515
5280
  localStorageUtils: localStorageUtil,
3516
5281
  sessionStorageUtils: sessionStorageUtil
@@ -3518,7 +5283,7 @@ function EnvProvider({
3518
5283
  const setupEnv = useCallback3(
3519
5284
  (envConfig) => {
3520
5285
  const updatedEnv = {
3521
- ...env,
5286
+ ...env2,
3522
5287
  ...envConfig,
3523
5288
  localStorageUtils: localStorageUtil,
3524
5289
  sessionStorageUtils: sessionStorageUtil
@@ -3527,7 +5292,7 @@ function EnvProvider({
3527
5292
  setEnvState({ ...updatedEnv, requests });
3528
5293
  return updatedEnv;
3529
5294
  },
3530
- [env, localStorageUtil, sessionStorageUtil]
5295
+ [env2, localStorageUtil, sessionStorageUtil]
3531
5296
  );
3532
5297
  const setUid2 = useCallback3((uid) => {
3533
5298
  setEnvState((prev) => ({
@@ -3584,7 +5349,7 @@ function EnvProvider({
3584
5349
  EnvContext.Provider,
3585
5350
  {
3586
5351
  value: {
3587
- env,
5352
+ env: env2,
3588
5353
  setupEnv,
3589
5354
  setUid: setUid2,
3590
5355
  setLang: setLang2,
@@ -3609,8 +5374,8 @@ function useEnv() {
3609
5374
 
3610
5375
  // src/hooks/auth/use-login-credential.tsx
3611
5376
  var useLoginCredential = () => {
3612
- const { env } = useEnv();
3613
- console.log("useLoginCredential called", env, new Error().stack);
5377
+ const { env: env2 } = useEnv();
5378
+ console.log("useLoginCredential called", env2, new Error().stack);
3614
5379
  const { login } = useAuthService();
3615
5380
  return useMutation5({
3616
5381
  mutationFn: (data) => {
@@ -3622,189 +5387,1173 @@ var use_login_credential_default = useLoginCredential;
3622
5387
 
3623
5388
  // src/hooks/auth/use-login-socical.ts
3624
5389
  import { useMutation as useMutation6 } from "@tanstack/react-query";
5390
+ var useLoginSocial = () => {
5391
+ return useMutation6({
5392
+ mutationFn: (data) => {
5393
+ return auth_service_default.loginSocial(data);
5394
+ }
5395
+ });
5396
+ };
5397
+ var use_login_socical_default = useLoginSocial;
3625
5398
 
3626
5399
  // src/hooks/auth/use-reset-password.ts
3627
5400
  import { useMutation as useMutation7 } from "@tanstack/react-query";
5401
+ var useResetPassword = () => {
5402
+ return useMutation7({
5403
+ mutationFn: (request) => {
5404
+ return auth_service_default.resetPassword(request.data, request.token);
5405
+ }
5406
+ });
5407
+ };
5408
+ var use_reset_password_default = useResetPassword;
3628
5409
 
3629
5410
  // src/hooks/auth/use-reset-password-sso.ts
3630
5411
  import { useMutation as useMutation8 } from "@tanstack/react-query";
5412
+ var useResetPasswordSSO = () => {
5413
+ return useMutation8({
5414
+ mutationFn: ({
5415
+ method,
5416
+ password,
5417
+ with_context
5418
+ }) => {
5419
+ return auth_service_default.resetPasswordSSO({
5420
+ method,
5421
+ password,
5422
+ with_context
5423
+ });
5424
+ }
5425
+ });
5426
+ };
5427
+ var use_reset_password_sso_default = useResetPasswordSSO;
3631
5428
 
3632
5429
  // src/hooks/auth/use-update-password.ts
3633
5430
  import { useMutation as useMutation9 } from "@tanstack/react-query";
5431
+ var useUpdatePassword = () => {
5432
+ return useMutation9({
5433
+ mutationFn: (request) => {
5434
+ return auth_service_default.updatePassword(request.data, request.token);
5435
+ }
5436
+ });
5437
+ };
5438
+ var use_update_password_default = useUpdatePassword;
3634
5439
 
3635
5440
  // src/hooks/auth/use-logout.ts
3636
5441
  import { useMutation as useMutation10 } from "@tanstack/react-query";
5442
+ var useLogout = () => {
5443
+ return useMutation10({
5444
+ mutationFn: (data) => {
5445
+ return auth_service_default.logout(data);
5446
+ }
5447
+ });
5448
+ };
5449
+ var use_logout_default = useLogout;
3637
5450
 
3638
5451
  // src/hooks/auth/use-get-access-by-code.ts
3639
5452
  import { useMutation as useMutation11 } from "@tanstack/react-query";
5453
+ var useGetAccessByCode = () => {
5454
+ return useMutation11({
5455
+ mutationFn: ({ code }) => {
5456
+ return auth_service_default.getAccessByCode(code);
5457
+ }
5458
+ });
5459
+ };
5460
+ var use_get_access_by_code_default = useGetAccessByCode;
3640
5461
 
3641
5462
  // src/hooks/auth/use-validate-action-token.ts
3642
5463
  import { useMutation as useMutation12 } from "@tanstack/react-query";
5464
+ var useValidateActionToken = () => {
5465
+ return useMutation12({
5466
+ mutationFn: ({
5467
+ actionToken,
5468
+ path
5469
+ }) => {
5470
+ return auth_service_default.isValidActionToken(actionToken, path);
5471
+ }
5472
+ });
5473
+ };
5474
+ var use_validate_action_token_default = useValidateActionToken;
3643
5475
 
3644
5476
  // src/hooks/company/use-get-company-info.ts
3645
5477
  import { useMutation as useMutation13 } from "@tanstack/react-query";
5478
+ var useGetCompanyInfo = () => {
5479
+ return useMutation13({
5480
+ mutationFn: (id) => company_service_default.getInfoCompany(id)
5481
+ });
5482
+ };
5483
+ var use_get_company_info_default = useGetCompanyInfo;
3646
5484
 
3647
5485
  // src/hooks/company/use-get-current-company.ts
3648
5486
  import { useMutation as useMutation14 } from "@tanstack/react-query";
5487
+ var useGetCurrentCompany = () => {
5488
+ return useMutation14({
5489
+ mutationFn: () => company_service_default.getCurrentCompany()
5490
+ });
5491
+ };
5492
+ var use_get_current_company_default = useGetCurrentCompany;
3649
5493
 
3650
5494
  // src/hooks/company/use-get-list-company.ts
3651
5495
  import { useQuery } from "@tanstack/react-query";
5496
+ var useGetListCompany = (companyIDs = []) => {
5497
+ const companySpec = {
5498
+ id: {},
5499
+ name: {}
5500
+ };
5501
+ const getListParams = {
5502
+ model: "res.company" /* COMPANY */,
5503
+ ids: companyIDs,
5504
+ specification: companySpec
5505
+ };
5506
+ return useQuery({
5507
+ queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
5508
+ queryFn: () => model_service_default.getList(getListParams),
5509
+ refetchOnWindowFocus: false
5510
+ });
5511
+ };
5512
+ var use_get_list_company_default = useGetListCompany;
3652
5513
 
3653
5514
  // src/hooks/excel/use-export-excel.ts
3654
5515
  import { useMutation as useMutation15 } from "@tanstack/react-query";
5516
+ var useExportExcel = () => {
5517
+ return useMutation15({
5518
+ mutationFn: ({
5519
+ model,
5520
+ domain,
5521
+ ids,
5522
+ fields,
5523
+ type,
5524
+ importCompat,
5525
+ context,
5526
+ groupby
5527
+ }) => excel_service_default.exportExcel({
5528
+ model,
5529
+ domain,
5530
+ ids,
5531
+ fields,
5532
+ type,
5533
+ importCompat,
5534
+ context,
5535
+ groupby
5536
+ })
5537
+ });
5538
+ };
5539
+ var use_export_excel_default = useExportExcel;
3655
5540
 
3656
5541
  // src/hooks/excel/use-get-field-export.ts
3657
5542
  import { useMutation as useMutation16 } from "@tanstack/react-query";
5543
+ var useGetFieldExport = () => {
5544
+ return useMutation16({
5545
+ mutationFn: ({
5546
+ ids,
5547
+ model,
5548
+ isShow,
5549
+ parentField,
5550
+ fieldType,
5551
+ parentName,
5552
+ prefix,
5553
+ name,
5554
+ context,
5555
+ importCompat
5556
+ }) => excel_service_default.getFieldExport({
5557
+ ids,
5558
+ model,
5559
+ isShow,
5560
+ parentField,
5561
+ fieldType,
5562
+ parentName,
5563
+ prefix,
5564
+ name,
5565
+ context,
5566
+ importCompat
5567
+ })
5568
+ });
5569
+ };
5570
+ var use_get_field_export_default = useGetFieldExport;
3658
5571
 
3659
5572
  // src/hooks/excel/use-get-file-excel.ts
3660
5573
  import { useQuery as useQuery2 } from "@tanstack/react-query";
5574
+ var useGetFileExcel = ({ model }) => {
5575
+ return useQuery2({
5576
+ queryKey: [],
5577
+ queryFn: () => excel_service_default.getFileExcel({
5578
+ model
5579
+ }).then((res) => {
5580
+ if (res) {
5581
+ return res;
5582
+ }
5583
+ return [];
5584
+ }),
5585
+ refetchOnWindowFocus: false
5586
+ });
5587
+ };
5588
+ var use_get_file_excel_default = useGetFileExcel;
3661
5589
 
3662
5590
  // src/hooks/excel/use-parse-preview.ts
3663
5591
  import { useMutation as useMutation17 } from "@tanstack/react-query";
5592
+ var useParsePreview = () => {
5593
+ return useMutation17({
5594
+ mutationFn: ({
5595
+ id,
5596
+ selectedSheet,
5597
+ isHeader,
5598
+ context
5599
+ }) => excel_service_default.parsePreview({
5600
+ id,
5601
+ selectedSheet,
5602
+ isHeader,
5603
+ context
5604
+ })
5605
+ });
5606
+ };
5607
+ var use_parse_preview_default = useParsePreview;
3664
5608
 
3665
5609
  // src/hooks/excel/use-upload-file.ts
3666
5610
  import { useMutation as useMutation18 } from "@tanstack/react-query";
5611
+ var useUploadFile = () => {
5612
+ return useMutation18({
5613
+ mutationFn: ({ formData }) => excel_service_default.uploadFile({
5614
+ formData
5615
+ })
5616
+ });
5617
+ };
5618
+ var use_upload_file_default = useUploadFile;
3667
5619
 
3668
5620
  // src/hooks/excel/use-upload-id-file.ts
3669
5621
  import { useMutation as useMutation19 } from "@tanstack/react-query";
5622
+ var useUploadIdFile = () => {
5623
+ return useMutation19({
5624
+ mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
5625
+ formData
5626
+ })
5627
+ });
5628
+ };
5629
+ var use_upload_id_file_default = useUploadIdFile;
3670
5630
 
3671
5631
  // src/hooks/excel/uss-execute-import.ts
3672
5632
  import { useMutation as useMutation20 } from "@tanstack/react-query";
5633
+ var useExecuteImport = () => {
5634
+ return useMutation20({
5635
+ mutationFn: ({
5636
+ fields,
5637
+ columns,
5638
+ idFile,
5639
+ options,
5640
+ dryrun,
5641
+ context
5642
+ }) => excel_service_default.executeImport({
5643
+ fields,
5644
+ columns,
5645
+ idFile,
5646
+ options,
5647
+ dryrun,
5648
+ context
5649
+ })
5650
+ });
5651
+ };
5652
+ var uss_execute_import_default = useExecuteImport;
3673
5653
 
3674
5654
  // src/hooks/form/use-change-status.ts
3675
5655
  import { useMutation as useMutation21 } from "@tanstack/react-query";
5656
+ var useChangeStatus = () => {
5657
+ return useMutation21({
5658
+ mutationFn: ({ data }) => {
5659
+ return form_service_default.changeStatus({
5660
+ data
5661
+ });
5662
+ }
5663
+ });
5664
+ };
5665
+ var use_change_status_default = useChangeStatus;
3676
5666
 
3677
5667
  // src/hooks/form/use-delete-comment.ts
3678
5668
  import { useMutation as useMutation22 } from "@tanstack/react-query";
5669
+ var useDeleteComment = () => {
5670
+ return useMutation22({
5671
+ mutationFn: ({ data }) => form_service_default.deleteComment({
5672
+ data
5673
+ })
5674
+ });
5675
+ };
5676
+ var use_delete_comment_default = useDeleteComment;
3679
5677
 
3680
5678
  // src/hooks/form/use-get-comment.ts
3681
5679
  import { useQuery as useQuery3 } from "@tanstack/react-query";
5680
+ var useGetComment = ({ data, queryKey }) => {
5681
+ return useQuery3({
5682
+ queryKey,
5683
+ queryFn: () => form_service_default.getComment({ data }).then((res) => {
5684
+ if (res) {
5685
+ return res;
5686
+ }
5687
+ }),
5688
+ enabled: !!data.thread_id && !isNaN(data.thread_id),
5689
+ refetchOnWindowFocus: false
5690
+ });
5691
+ };
5692
+ var use_get_comment_default = useGetComment;
3682
5693
 
3683
5694
  // src/hooks/form/use-get-form-view.ts
3684
5695
  import { useQuery as useQuery4 } from "@tanstack/react-query";
5696
+ var useGetFormView = ({
5697
+ data,
5698
+ queryKey,
5699
+ enabled
5700
+ }) => {
5701
+ return useQuery4({
5702
+ queryKey,
5703
+ queryFn: () => form_service_default.getFormView({ data }).then((res) => {
5704
+ if (res) {
5705
+ return res;
5706
+ }
5707
+ }),
5708
+ enabled,
5709
+ refetchOnWindowFocus: false
5710
+ });
5711
+ };
5712
+ var use_get_form_view_default = useGetFormView;
3685
5713
 
3686
5714
  // src/hooks/form/use-get-image.ts
3687
5715
  import { useQuery as useQuery5 } from "@tanstack/react-query";
5716
+ var useGetImage = ({
5717
+ data,
5718
+ queryKey,
5719
+ src
5720
+ }) => {
5721
+ return useQuery5({
5722
+ queryKey,
5723
+ queryFn: () => form_service_default.getImage({ data }).then((res) => {
5724
+ if (res) {
5725
+ return res;
5726
+ }
5727
+ }),
5728
+ enabled: !src && !isBase64File(src),
5729
+ refetchOnWindowFocus: false
5730
+ });
5731
+ };
5732
+ var use_get_image_default = useGetImage;
3688
5733
 
3689
5734
  // src/hooks/form/use-send-comment.ts
3690
5735
  import { useMutation as useMutation23 } from "@tanstack/react-query";
5736
+ var useSendComment = () => {
5737
+ return useMutation23({
5738
+ mutationFn: ({ data }) => form_service_default.sentComment({
5739
+ data
5740
+ })
5741
+ });
5742
+ };
5743
+ var use_send_comment_default = useSendComment;
3691
5744
 
3692
5745
  // src/hooks/form/use-upload-image.ts
3693
5746
  import { useMutation as useMutation24 } from "@tanstack/react-query";
5747
+ var useUploadImage = () => {
5748
+ return useMutation24({
5749
+ mutationFn: ({ data }) => form_service_default.uploadImage({
5750
+ data
5751
+ })
5752
+ });
5753
+ };
5754
+ var use_upload_image_default = useUploadImage;
3694
5755
 
3695
5756
  // src/hooks/model/use-delete.ts
3696
5757
  import { useMutation as useMutation25 } from "@tanstack/react-query";
5758
+ var useDelete = () => {
5759
+ return useMutation25({
5760
+ mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
5761
+ });
5762
+ };
5763
+ var use_delete_default = useDelete;
3697
5764
 
3698
5765
  // src/hooks/model/use-get-all.ts
3699
5766
  import { useQuery as useQuery6 } from "@tanstack/react-query";
5767
+ var useGetAll = ({ data, queryKey, viewResponse }) => {
5768
+ return useQuery6({
5769
+ queryKey,
5770
+ queryFn: () => model_service_default.getAll({ data }).then((res) => {
5771
+ if (res) {
5772
+ return res;
5773
+ }
5774
+ }),
5775
+ enabled: !!data.specification && !!data.model && !!data.domain && !!viewResponse,
5776
+ refetchOnWindowFocus: false
5777
+ // placeholderData: keepPreviousData,
5778
+ });
5779
+ };
5780
+ var use_get_all_default = useGetAll;
3700
5781
 
3701
5782
  // src/hooks/model/use-get-conversion-rate.ts
3702
5783
  import { useQuery as useQuery7 } from "@tanstack/react-query";
5784
+ var useGetConversionRate = () => {
5785
+ return useQuery7({
5786
+ queryKey: ["currency-rate"],
5787
+ queryFn: () => model_service_default.getConversionRate().then((res) => {
5788
+ if (res) {
5789
+ return res;
5790
+ }
5791
+ }),
5792
+ enabled: true
5793
+ });
5794
+ };
5795
+ var use_get_conversion_rate_default = useGetConversionRate;
3703
5796
 
3704
5797
  // src/hooks/model/use-get-currency.ts
3705
5798
  import { useQuery as useQuery8 } from "@tanstack/react-query";
5799
+ var useGetCurrency = () => {
5800
+ return useQuery8({
5801
+ queryKey: ["currency"],
5802
+ queryFn: () => model_service_default.getCurrency().then((res) => {
5803
+ if (res) {
5804
+ return res;
5805
+ }
5806
+ }),
5807
+ enabled: true
5808
+ });
5809
+ };
5810
+ var use_get_currency_default = useGetCurrency;
3706
5811
 
3707
5812
  // src/hooks/model/use-get-detail.ts
3708
5813
  import { useMutation as useMutation26 } from "@tanstack/react-query";
5814
+ var useGetDetail = () => {
5815
+ return useMutation26({
5816
+ mutationFn: ({
5817
+ model,
5818
+ ids,
5819
+ specification,
5820
+ context
5821
+ }) => model_service_default.getDetail({
5822
+ model,
5823
+ ids,
5824
+ specification,
5825
+ context
5826
+ })
5827
+ });
5828
+ };
5829
+ var use_get_detail_default = useGetDetail;
3709
5830
 
3710
5831
  // src/hooks/model/use-get-field-onchange.ts
3711
5832
  import { useQuery as useQuery9 } from "@tanstack/react-query";
5833
+ var useGetFieldOnChange = ({ model }) => {
5834
+ return useQuery9({
5835
+ queryKey: [`field-onchange-${model}`, model],
5836
+ queryFn: () => model_service_default.getListFieldsOnchange({
5837
+ model
5838
+ }).then((res) => {
5839
+ if (res) {
5840
+ return res;
5841
+ }
5842
+ }),
5843
+ refetchOnWindowFocus: false,
5844
+ staleTime: Infinity
5845
+ });
5846
+ };
5847
+ var use_get_field_onchange_default = useGetFieldOnChange;
3712
5848
 
3713
5849
  // src/hooks/model/use-get-list-my-bank-account.ts
3714
5850
  import { useQuery as useQuery10 } from "@tanstack/react-query";
5851
+ var useGetListMyBankAccount = ({
5852
+ domain,
5853
+ spectification,
5854
+ model
5855
+ }) => {
5856
+ return useQuery10({
5857
+ queryKey: ["bank-account", model, domain],
5858
+ queryFn: () => model_service_default.getListMyBankAccount({
5859
+ domain,
5860
+ spectification,
5861
+ model
5862
+ }).then((res) => {
5863
+ if (res) {
5864
+ return res;
5865
+ }
5866
+ }),
5867
+ enabled: true
5868
+ });
5869
+ };
5870
+ var use_get_list_my_bank_account_default = useGetListMyBankAccount;
5871
+
5872
+ // src/models/base-model/index.ts
5873
+ var BaseModel = class {
5874
+ name;
5875
+ view;
5876
+ actContext;
5877
+ fields;
5878
+ constructor(init) {
5879
+ this.name = init.name;
5880
+ this.view = init.view;
5881
+ this.actContext = init.actContext;
5882
+ this.fields = init.fields;
5883
+ }
5884
+ getSpecificationByFields({
5885
+ fields = [],
5886
+ specification = {},
5887
+ modelsData,
5888
+ model,
5889
+ modelRoot
5890
+ }) {
5891
+ if (Array.isArray(fields)) {
5892
+ let spec = { ...specification };
5893
+ fields.forEach((field) => {
5894
+ if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
5895
+ if (modelsData?.[model]?.[field?.name]) {
5896
+ if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
5897
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5898
+ const modelRelation = modelsData?.[relation];
5899
+ if (modelRelation) {
5900
+ spec[field?.name] = {
5901
+ fields: {}
5902
+ };
5903
+ if (modelRoot && modelRoot === relation) {
5904
+ spec[field?.name].fields = { id: {} };
5905
+ } else {
5906
+ spec[field?.name].fields = this.getSpecificationByFields({
5907
+ fields: Object.values(modelRelation),
5908
+ specification: {},
5909
+ modelsData,
5910
+ model: relation,
5911
+ modelRoot: model
5912
+ });
5913
+ }
5914
+ } else {
5915
+ spec[field?.name] = {
5916
+ fields: {
5917
+ id: {},
5918
+ display_name: {}
5919
+ }
5920
+ };
5921
+ }
5922
+ } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
5923
+ spec[field?.name] = {
5924
+ fields: {
5925
+ id: {},
5926
+ display_name: {},
5927
+ ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
5928
+ ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
5929
+ ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
5930
+ }
5931
+ };
5932
+ } else {
5933
+ spec[field?.name] = {};
5934
+ }
5935
+ }
5936
+ } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
5937
+ const specGroup = this.getSpecificationByFields({
5938
+ fields: field?.fields,
5939
+ specification: spec,
5940
+ modelsData,
5941
+ model
5942
+ });
5943
+ spec = { ...spec, ...specGroup };
5944
+ } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
5945
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5946
+ const specTreee = this.getSpecificationByFields({
5947
+ fields: field?.fields,
5948
+ specification: {},
5949
+ modelsData,
5950
+ model: relation,
5951
+ modelRoot: model
5952
+ });
5953
+ spec = { ...spec, [field?.name]: { fields: specTreee } };
5954
+ }
5955
+ });
5956
+ return spec;
5957
+ } else {
5958
+ console.warn("fields is not array");
5959
+ }
5960
+ }
5961
+ getTreeProps() {
5962
+ const props = this.view?.views?.list || {};
5963
+ return props;
5964
+ }
5965
+ getTreeFields() {
5966
+ const fields = this.view?.views?.list?.fields || [];
5967
+ return fields;
5968
+ }
5969
+ getSpecification() {
5970
+ const specInit = {};
5971
+ const modelData = this.view?.models || {};
5972
+ const specification = this.getSpecificationByFields({
5973
+ fields: this.fields,
5974
+ specification: specInit,
5975
+ modelsData: modelData,
5976
+ model: this.name,
5977
+ modelRoot: ""
5978
+ });
5979
+ return specification;
5980
+ }
5981
+ };
5982
+ var base_model_default = BaseModel;
5983
+
5984
+ // src/hooks/model/use-model.ts
5985
+ var useModel = () => {
5986
+ const initModel = (modelData) => {
5987
+ switch (modelData?.name) {
5988
+ default:
5989
+ return new base_model_default(modelData);
5990
+ }
5991
+ };
5992
+ return {
5993
+ initModel
5994
+ };
5995
+ };
5996
+ var use_model_default = useModel;
5997
+
5998
+ // src/hooks/model/use-odoo-data-transform.ts
5999
+ var useOdooDataTransform = () => {
6000
+ return {
6001
+ toDataJS: model_service_default.toDataJS,
6002
+ parseORM: model_service_default.parseORMOdoo
6003
+ };
6004
+ };
6005
+ var use_odoo_data_transform_default = useOdooDataTransform;
3715
6006
 
3716
6007
  // src/hooks/model/use-onchange-form.ts
3717
6008
  import { useMutation as useMutation27 } from "@tanstack/react-query";
6009
+ var useOnChangeForm = () => {
6010
+ return useMutation27({
6011
+ mutationFn: ({
6012
+ ids,
6013
+ model,
6014
+ specification,
6015
+ context,
6016
+ object,
6017
+ fieldChange
6018
+ }) => model_service_default.onChange({
6019
+ ids,
6020
+ model,
6021
+ specification,
6022
+ context,
6023
+ object,
6024
+ fieldChange
6025
+ })
6026
+ });
6027
+ };
6028
+ var use_onchange_form_default = useOnChangeForm;
3718
6029
 
3719
6030
  // src/hooks/model/use-save.ts
3720
6031
  import { useMutation as useMutation28 } from "@tanstack/react-query";
6032
+ var useSave = () => {
6033
+ return useMutation28({
6034
+ mutationFn: ({
6035
+ ids,
6036
+ model,
6037
+ data,
6038
+ specification,
6039
+ context,
6040
+ path
6041
+ }) => model_service_default.save({ ids, model, data, specification, context, path })
6042
+ });
6043
+ };
6044
+ var use_save_default = useSave;
3721
6045
 
3722
6046
  // src/hooks/user/use-get-profile.ts
3723
6047
  import { useMutation as useMutation29 } from "@tanstack/react-query";
6048
+ var useGetProfile = (path) => {
6049
+ return useMutation29({
6050
+ mutationFn: () => user_service_default.getProfile(path)
6051
+ });
6052
+ };
6053
+ var use_get_profile_default = useGetProfile;
3724
6054
 
3725
6055
  // src/hooks/user/use-get-user.ts
3726
6056
  import { useMutation as useMutation30 } from "@tanstack/react-query";
6057
+ var useGetUser = () => {
6058
+ return useMutation30({
6059
+ mutationFn: ({ id, context }) => user_service_default.getUser({
6060
+ id,
6061
+ context
6062
+ })
6063
+ });
6064
+ };
6065
+ var use_get_user_default = useGetUser;
3727
6066
 
3728
6067
  // src/hooks/user/use-switch-locale.ts
3729
6068
  import { useMutation as useMutation31 } from "@tanstack/react-query";
6069
+ var useSwitchLocale = () => {
6070
+ return useMutation31({
6071
+ mutationFn: ({ data }) => {
6072
+ return user_service_default.switchUserLocale({
6073
+ id: data.id,
6074
+ values: data.values
6075
+ });
6076
+ }
6077
+ });
6078
+ };
6079
+ var use_switch_locale_default = useSwitchLocale;
3730
6080
 
3731
6081
  // src/hooks/view/use-button.ts
3732
6082
  import { useMutation as useMutation32 } from "@tanstack/react-query";
6083
+ var useButton = () => {
6084
+ return useMutation32({
6085
+ mutationFn: ({
6086
+ model,
6087
+ ids,
6088
+ context,
6089
+ method
6090
+ }) => action_service_default.callButton({
6091
+ model,
6092
+ ids,
6093
+ context,
6094
+ method
6095
+ }),
6096
+ onSuccess: (response) => {
6097
+ return response;
6098
+ }
6099
+ });
6100
+ };
6101
+ var use_button_default = useButton;
3733
6102
 
3734
6103
  // src/hooks/view/use-duplicate-record.ts
3735
6104
  import { useMutation as useMutation33 } from "@tanstack/react-query";
6105
+ var useDuplicateRecord = () => {
6106
+ return useMutation33({
6107
+ mutationFn: ({
6108
+ id,
6109
+ model,
6110
+ context
6111
+ }) => action_service_default.duplicateRecord({
6112
+ id,
6113
+ model,
6114
+ context
6115
+ })
6116
+ });
6117
+ };
6118
+ var use_duplicate_record_default = useDuplicateRecord;
3736
6119
 
3737
6120
  // src/hooks/view/use-get-action-detail.ts
3738
6121
  import { useQuery as useQuery11 } from "@tanstack/react-query";
6122
+ var useGetActionDetail = ({
6123
+ aid,
6124
+ context,
6125
+ enabled,
6126
+ id,
6127
+ model,
6128
+ queryKey
6129
+ }) => {
6130
+ const data = {
6131
+ id,
6132
+ model: model ?? "",
6133
+ context
6134
+ };
6135
+ return useQuery11({
6136
+ queryKey,
6137
+ queryFn: async () => {
6138
+ if (aid) {
6139
+ const res = await view_service_default.getActionDetail(aid, context);
6140
+ if (res && res.length > 0) {
6141
+ return res[0];
6142
+ }
6143
+ } else {
6144
+ const res = await form_service_default.getFormView({ data });
6145
+ return res;
6146
+ }
6147
+ },
6148
+ enabled,
6149
+ refetchOnWindowFocus: false,
6150
+ staleTime: Infinity
6151
+ });
6152
+ };
6153
+ var use_get_action_detail_default = useGetActionDetail;
3739
6154
 
3740
6155
  // src/hooks/view/use-get-calendar.ts
3741
6156
  import { useQuery as useQuery12 } from "@tanstack/react-query";
6157
+ var useGetCalendar = (listDataProps, queryKey, enabled) => {
6158
+ return useQuery12({
6159
+ queryKey,
6160
+ queryFn: () => model_service_default.getListCalendar({ data: listDataProps }).then((res) => {
6161
+ if (res) {
6162
+ return res;
6163
+ }
6164
+ return [];
6165
+ }),
6166
+ enabled,
6167
+ refetchOnWindowFocus: false,
6168
+ staleTime: 0
6169
+ });
6170
+ };
6171
+ var use_get_calendar_default = useGetCalendar;
3742
6172
 
3743
6173
  // src/hooks/view/use-get-groups.ts
3744
6174
  import { useQuery as useQuery13 } from "@tanstack/react-query";
6175
+ var useGetGroups = ({
6176
+ model,
6177
+ width_context
6178
+ }) => {
6179
+ return useQuery13({
6180
+ queryKey: [model, width_context],
6181
+ queryFn: () => kanban_service_default.getGroups({
6182
+ model,
6183
+ width_context
6184
+ }).then((res) => {
6185
+ if (res) {
6186
+ return res;
6187
+ }
6188
+ return [];
6189
+ }),
6190
+ refetchOnWindowFocus: false
6191
+ });
6192
+ };
6193
+ var use_get_groups_default = useGetGroups;
3745
6194
 
3746
6195
  // src/hooks/view/use-get-list-data.ts
3747
6196
  import { useQuery as useQuery14 } from "@tanstack/react-query";
6197
+ var useGetListData = (listDataProps, queryKey, enabled) => {
6198
+ return useQuery14({
6199
+ queryKey,
6200
+ queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
6201
+ if (res) {
6202
+ return res;
6203
+ }
6204
+ return [];
6205
+ }),
6206
+ enabled,
6207
+ refetchOnWindowFocus: false,
6208
+ staleTime: 0
6209
+ });
6210
+ };
6211
+ var use_get_list_data_default = useGetListData;
3748
6212
 
3749
6213
  // src/hooks/view/use-get-menu.ts
3750
6214
  import { useQuery as useQuery15 } from "@tanstack/react-query";
6215
+ var useGetMenu = (context, enabled) => {
6216
+ return useQuery15({
6217
+ queryKey: ["menus" /* MENU */, context],
6218
+ queryFn: () => view_service_default.getMenu(context).then((res) => {
6219
+ if (res && res?.records && res?.records?.length > 0) {
6220
+ return res?.records;
6221
+ }
6222
+ return [];
6223
+ }),
6224
+ refetchOnWindowFocus: false,
6225
+ staleTime: Infinity,
6226
+ enabled
6227
+ });
6228
+ };
6229
+ var use_get_menu_default = useGetMenu;
3751
6230
 
3752
6231
  // src/hooks/view/use-get-print-report.ts
3753
6232
  import { useMutation as useMutation34 } from "@tanstack/react-query";
6233
+ var useGetPrintReport = () => {
6234
+ return useMutation34({
6235
+ mutationFn: ({ id }) => action_service_default.getPrintReportName({
6236
+ id
6237
+ })
6238
+ });
6239
+ };
6240
+ var use_get_print_report_default = useGetPrintReport;
3754
6241
 
3755
6242
  // src/hooks/view/use-get-progress-bar.ts
3756
6243
  import { useQuery as useQuery16 } from "@tanstack/react-query";
6244
+ var useGetProGressBar = ({
6245
+ field,
6246
+ color,
6247
+ model,
6248
+ width_context
6249
+ }) => {
6250
+ return useQuery16({
6251
+ queryKey: [],
6252
+ queryFn: () => kanban_service_default.getProgressBar({
6253
+ field,
6254
+ color,
6255
+ model,
6256
+ width_context
6257
+ }).then((res) => {
6258
+ if (res) {
6259
+ return res;
6260
+ }
6261
+ return [];
6262
+ }),
6263
+ refetchOnWindowFocus: false
6264
+ });
6265
+ };
6266
+ var use_get_progress_bar_default = useGetProGressBar;
3757
6267
 
3758
6268
  // src/hooks/view/use-get-selection.ts
3759
6269
  import { useQuery as useQuery17 } from "@tanstack/react-query";
6270
+ var useGetSelection = ({
6271
+ data,
6272
+ queryKey,
6273
+ enabled
6274
+ }) => {
6275
+ return useQuery17({
6276
+ queryKey,
6277
+ queryFn: () => view_service_default.getSelectionItem({ data }),
6278
+ enabled,
6279
+ refetchOnWindowFocus: false
6280
+ });
6281
+ };
6282
+ var use_get_selection_default = useGetSelection;
3760
6283
 
3761
6284
  // src/hooks/view/use-get-view.ts
3762
6285
  import { useQuery as useQuery18 } from "@tanstack/react-query";
6286
+ var useGetView = (viewParams, actData) => {
6287
+ return useQuery18({
6288
+ queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
6289
+ queryFn: () => view_service_default.getView(viewParams),
6290
+ enabled: !!actData,
6291
+ refetchOnWindowFocus: false,
6292
+ staleTime: Infinity
6293
+ });
6294
+ };
6295
+ var use_get_view_default = useGetView;
3763
6296
 
3764
6297
  // src/hooks/view/use-load-action.ts
3765
6298
  import { useMutation as useMutation35 } from "@tanstack/react-query";
6299
+ var useLoadAction = () => {
6300
+ return useMutation35({
6301
+ mutationFn: ({
6302
+ idAction,
6303
+ context
6304
+ }) => {
6305
+ return action_service_default.loadAction({
6306
+ idAction,
6307
+ context
6308
+ });
6309
+ }
6310
+ });
6311
+ };
6312
+ var use_load_action_default = useLoadAction;
3766
6313
 
3767
6314
  // src/hooks/view/use-load-message.ts
3768
6315
  import { useQuery as useQuery19 } from "@tanstack/react-query";
6316
+ var useLoadMessage = () => {
6317
+ return useQuery19({
6318
+ queryKey: [`load-message-failure`],
6319
+ queryFn: () => view_service_default.loadMessages(),
6320
+ refetchOnWindowFocus: false
6321
+ });
6322
+ };
6323
+ var use_load_message_default = useLoadMessage;
3769
6324
 
3770
6325
  // src/hooks/view/use-print.ts
3771
6326
  import { useMutation as useMutation36 } from "@tanstack/react-query";
6327
+ var usePrint = () => {
6328
+ return useMutation36({
6329
+ mutationFn: ({ id, report, db }) => action_service_default.print({
6330
+ id,
6331
+ report,
6332
+ db
6333
+ })
6334
+ });
6335
+ };
6336
+ var use_print_default = usePrint;
3772
6337
 
3773
6338
  // src/hooks/view/use-remove-row.ts
3774
6339
  import { useMutation as useMutation37 } from "@tanstack/react-query";
6340
+ var useRemoveRow = () => {
6341
+ return useMutation37({
6342
+ mutationFn: ({
6343
+ model,
6344
+ ids,
6345
+ context
6346
+ }) => action_service_default.removeRows({
6347
+ model,
6348
+ ids,
6349
+ context
6350
+ })
6351
+ });
6352
+ };
6353
+ var use_remove_row_default = useRemoveRow;
3775
6354
 
3776
6355
  // src/hooks/view/use-resequence.ts
3777
6356
  import { useQuery as useQuery20 } from "@tanstack/react-query";
6357
+ var useGetResequence = (model, resIds, context, offset) => {
6358
+ return useQuery20({
6359
+ queryKey: [],
6360
+ queryFn: () => view_service_default.getResequence({
6361
+ model,
6362
+ ids: resIds,
6363
+ context,
6364
+ offset
6365
+ }),
6366
+ enabled: false,
6367
+ refetchOnWindowFocus: false
6368
+ });
6369
+ };
6370
+ var use_resequence_default = useGetResequence;
3778
6371
 
3779
6372
  // src/hooks/view/use-run-action.ts
3780
6373
  import { useMutation as useMutation38 } from "@tanstack/react-query";
6374
+ var useRunAction = () => {
6375
+ return useMutation38({
6376
+ mutationFn: ({
6377
+ idAction,
6378
+ context
6379
+ }) => action_service_default.runAction({
6380
+ idAction,
6381
+ context
6382
+ })
6383
+ });
6384
+ };
6385
+ var use_run_action_default = useRunAction;
3781
6386
 
3782
6387
  // src/hooks/view/use-signin-sso.ts
3783
6388
  import { useMutation as useMutation39 } from "@tanstack/react-query";
6389
+ var useSignInSSO = () => {
6390
+ return useMutation39({
6391
+ mutationFn: ({
6392
+ redirect_uri,
6393
+ state,
6394
+ client_id,
6395
+ response_type,
6396
+ path
6397
+ }) => {
6398
+ return view_service_default.signInSSO({
6399
+ redirect_uri,
6400
+ state,
6401
+ client_id,
6402
+ response_type,
6403
+ path
6404
+ });
6405
+ }
6406
+ });
6407
+ };
6408
+ var use_signin_sso_default = useSignInSSO;
3784
6409
 
3785
6410
  // src/hooks/view/use-verify-2FA.ts
3786
6411
  import { useMutation as useMutation40 } from "@tanstack/react-query";
6412
+ var useVerify2FA = () => {
6413
+ return useMutation40({
6414
+ mutationFn: ({
6415
+ method,
6416
+ with_context,
6417
+ code,
6418
+ device,
6419
+ location
6420
+ }) => {
6421
+ return view_service_default.verify2FA({
6422
+ method,
6423
+ with_context,
6424
+ code,
6425
+ device,
6426
+ location
6427
+ });
6428
+ }
6429
+ });
6430
+ };
6431
+ var use_verify_2FA_default = useVerify2FA;
3787
6432
 
3788
6433
  // src/hooks/view/uset-get-2FA-method.ts
3789
6434
  import { useMutation as useMutation41 } from "@tanstack/react-query";
6435
+ var useGet2FAMethods = () => {
6436
+ return useMutation41({
6437
+ mutationFn: ({
6438
+ method,
6439
+ with_context
6440
+ }) => {
6441
+ return view_service_default.get2FAMethods({
6442
+ method,
6443
+ with_context
6444
+ });
6445
+ }
6446
+ });
6447
+ };
6448
+ var uset_get_2FA_method_default = useGet2FAMethods;
3790
6449
 
3791
6450
  // src/hooks/view/use-get-fields-view-security.ts
3792
6451
  import { useMutation as useMutation42 } from "@tanstack/react-query";
6452
+ var useGetFieldsViewSecurity = () => {
6453
+ return useMutation42({
6454
+ mutationFn: ({
6455
+ method,
6456
+ token,
6457
+ views
6458
+ }) => {
6459
+ return view_service_default.getFieldsViewSecurity({
6460
+ method,
6461
+ token,
6462
+ views
6463
+ });
6464
+ }
6465
+ });
6466
+ };
6467
+ var use_get_fields_view_security_default = useGetFieldsViewSecurity;
3793
6468
 
3794
6469
  // src/hooks/view/use-grant-access.ts
3795
6470
  import { useMutation as useMutation43 } from "@tanstack/react-query";
6471
+ var useGrantAccess = () => {
6472
+ return useMutation43({
6473
+ mutationFn: ({
6474
+ redirect_uri,
6475
+ state,
6476
+ client_id,
6477
+ scopes
6478
+ }) => {
6479
+ return view_service_default.grantAccess({
6480
+ redirect_uri,
6481
+ state,
6482
+ client_id,
6483
+ scopes
6484
+ });
6485
+ }
6486
+ });
6487
+ };
6488
+ var use_grant_access_default = useGrantAccess;
3796
6489
 
3797
6490
  // src/hooks/view/use-remove-totp-setup.ts
3798
6491
  import { useMutation as useMutation44 } from "@tanstack/react-query";
6492
+ var useRemoveTotpSetup = () => {
6493
+ return useMutation44({
6494
+ mutationFn: ({ method, token }) => {
6495
+ return view_service_default.removeTotpSetUp({
6496
+ method,
6497
+ token
6498
+ });
6499
+ }
6500
+ });
6501
+ };
6502
+ var use_remove_totp_setup_default = useRemoveTotpSetup;
3799
6503
 
3800
6504
  // src/hooks/view/use-request-setup-totp.ts
3801
6505
  import { useMutation as useMutation45 } from "@tanstack/react-query";
6506
+ var useRequestSetupTotp = () => {
6507
+ return useMutation45({
6508
+ mutationFn: ({ method, token }) => {
6509
+ return view_service_default.requestSetupTotp({
6510
+ method,
6511
+ token
6512
+ });
6513
+ }
6514
+ });
6515
+ };
6516
+ var use_request_setup_totp_default = useRequestSetupTotp;
3802
6517
 
3803
6518
  // src/hooks/view/use-settings-web-read-2fa.ts
3804
6519
  import { useMutation as useMutation46 } from "@tanstack/react-query";
6520
+ var useSettingsWebRead2fa = () => {
6521
+ return useMutation46({
6522
+ mutationFn: ({
6523
+ method,
6524
+ token,
6525
+ kwargs,
6526
+ model
6527
+ }) => {
6528
+ return view_service_default.settingsWebRead2fa({
6529
+ method,
6530
+ model,
6531
+ kwargs,
6532
+ token
6533
+ });
6534
+ }
6535
+ });
6536
+ };
6537
+ var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
3805
6538
 
3806
6539
  // src/hooks/view/use-verify-totp.ts
3807
6540
  import { useMutation as useMutation47 } from "@tanstack/react-query";
6541
+ var useVerifyTotp = () => {
6542
+ return useMutation47({
6543
+ mutationFn: ({
6544
+ method,
6545
+ action_token,
6546
+ code
6547
+ }) => {
6548
+ return view_service_default.verifyTotp({
6549
+ method,
6550
+ action_token,
6551
+ code
6552
+ });
6553
+ }
6554
+ });
6555
+ };
6556
+ var use_verify_totp_default = useVerifyTotp;
3808
6557
 
3809
6558
  // src/provider/version-gate-provider.tsx
3810
6559
  import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
@@ -3842,10 +6591,100 @@ var VersionGate = ({ children }) => {
3842
6591
  }, [queryClient]);
3843
6592
  return ready ? /* @__PURE__ */ jsx5(Fragment, { children }) : null;
3844
6593
  };
6594
+
6595
+ // src/provider/service-provider.tsx
6596
+ import { createContext as createContext2, useContext as useContext2 } from "react";
6597
+ import { jsx as jsx6 } from "react/jsx-runtime";
6598
+ var ServiceContext = createContext2(null);
6599
+ var ServiceProvider = ({
6600
+ children
6601
+ }) => {
6602
+ const services = {
6603
+ useForgotPassword: use_forgot_password_default,
6604
+ useForgotPasswordSSO: use_forgotpassword_sso_default,
6605
+ useGetProvider: use_get_provider_default,
6606
+ useIsValidToken: use_isvalid_token_default,
6607
+ useLoginCredential: use_login_credential_default,
6608
+ useLoginSocial: use_login_socical_default,
6609
+ useResetPassword: use_reset_password_default,
6610
+ useResetPasswordSSO: use_reset_password_sso_default,
6611
+ useUpdatePassword: use_update_password_default,
6612
+ useLogout: use_logout_default,
6613
+ useGetAccessByCode: use_get_access_by_code_default,
6614
+ useValidateActionToken: use_validate_action_token_default,
6615
+ useGetCompanyInfo: use_get_company_info_default,
6616
+ useGetCurrentCompany: use_get_current_company_default,
6617
+ useGetListCompany: use_get_list_company_default,
6618
+ useExecuteImport: uss_execute_import_default,
6619
+ useExportExcel: use_export_excel_default,
6620
+ useGetFieldExport: use_get_field_export_default,
6621
+ useGetFileExcel: use_get_file_excel_default,
6622
+ useParsePreview: use_parse_preview_default,
6623
+ useUploadFile: use_upload_file_default,
6624
+ useUploadIdFile: use_upload_id_file_default,
6625
+ useChangeStatus: use_change_status_default,
6626
+ useDeleteComment: use_delete_comment_default,
6627
+ useGetComment: use_get_comment_default,
6628
+ useGetFormView: use_get_form_view_default,
6629
+ useGetImage: use_get_image_default,
6630
+ useSendComment: use_send_comment_default,
6631
+ useUploadImage: use_upload_image_default,
6632
+ useDelete: use_delete_default,
6633
+ useGetAll: use_get_all_default,
6634
+ useGetConversionRate: use_get_conversion_rate_default,
6635
+ useGetCurrency: use_get_currency_default,
6636
+ useGetDetail: use_get_detail_default,
6637
+ useGetFieldOnChange: use_get_field_onchange_default,
6638
+ useGetListMyBankAccount: use_get_list_my_bank_account_default,
6639
+ useModel: use_model_default,
6640
+ useOdooDataTransform: use_odoo_data_transform_default,
6641
+ useOnChangeForm: use_onchange_form_default,
6642
+ useSave: use_save_default,
6643
+ useGetProfile: use_get_profile_default,
6644
+ useGetUser: use_get_user_default,
6645
+ useSwitchLocale: use_switch_locale_default,
6646
+ useButton: use_button_default,
6647
+ useDuplicateRecord: use_duplicate_record_default,
6648
+ useGet2FAMethods: uset_get_2FA_method_default,
6649
+ useGetActionDetail: use_get_action_detail_default,
6650
+ useGetCalendar: use_get_calendar_default,
6651
+ useGetGroups: use_get_groups_default,
6652
+ useGetListData: use_get_list_data_default,
6653
+ useGetMenu: use_get_menu_default,
6654
+ useGetPrintReport: use_get_print_report_default,
6655
+ useGetProGressBar: use_get_progress_bar_default,
6656
+ useGetResequence: use_resequence_default,
6657
+ useGetSelection: use_get_selection_default,
6658
+ useGetView: use_get_view_default,
6659
+ useLoadAction: use_load_action_default,
6660
+ useLoadMessage: use_load_message_default,
6661
+ usePrint: use_print_default,
6662
+ useRemoveRow: use_remove_row_default,
6663
+ useRunAction: use_run_action_default,
6664
+ useSignInSSO: use_signin_sso_default,
6665
+ useVerify2FA: use_verify_2FA_default,
6666
+ useGetFieldsViewSecurity: use_get_fields_view_security_default,
6667
+ useGrantAccess: use_grant_access_default,
6668
+ useRemoveTotpSetup: use_remove_totp_setup_default,
6669
+ useRequestSetupTotp: use_request_setup_totp_default,
6670
+ useSettingsWebRead2fa: use_settings_web_read_2fa_default,
6671
+ useVerifyTotp: use_verify_totp_default
6672
+ };
6673
+ return /* @__PURE__ */ jsx6(ServiceContext.Provider, { value: services, children });
6674
+ };
6675
+ var useService = () => {
6676
+ const context = useContext2(ServiceContext);
6677
+ if (!context) {
6678
+ throw new Error("useService must be used within a ServiceProvider");
6679
+ }
6680
+ return context;
6681
+ };
3845
6682
  export {
3846
6683
  EnvProvider,
3847
6684
  MainProvider,
3848
6685
  ReactQueryProvider,
6686
+ ServiceProvider,
3849
6687
  VersionGate,
3850
- useEnv
6688
+ useEnv,
6689
+ useService
3851
6690
  };