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