@fctc/interface-logic 2.3.3 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/provider.mjs CHANGED
@@ -667,7 +667,8 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
667
667
  UriConstants2["LOAD_ACTION"] = `/load_action`;
668
668
  UriConstants2["REPORT_PATH"] = `/report`;
669
669
  UriConstants2["RUN_ACTION_PATH"] = `/run_action`;
670
- UriConstants2["UPLOAD_FILE_PATH"] = `/upload/file`;
670
+ UriConstants2["UPLOAD_FILE_EXCEL_PATH"] = `/upload/file`;
671
+ UriConstants2["UPLOAD_FILE_PATH"] = `/web/binary/upload_attachment`;
671
672
  UriConstants2["GET_MESSAGE"] = `/chatter/thread/messages`;
672
673
  UriConstants2["SENT_MESSAGE"] = `/chatter/message/post`;
673
674
  UriConstants2["UPLOAD_IMAGE"] = `/mail/attachment/upload`;
@@ -675,6 +676,7 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
675
676
  UriConstants2["IMAGE_PATH"] = `/web/image`;
676
677
  UriConstants2["LOAD_MESSAGE"] = `/load_message_failures`;
677
678
  UriConstants2["TOKEN"] = `/check_token`;
679
+ UriConstants2["VALIDATE_ACTION_TOKEN"] = `/action-token/validate`;
678
680
  UriConstants2["CREATE_UPDATE_PATH"] = `/create_update`;
679
681
  UriConstants2["TWOFA_METHOD_PATH"] = `/id/api/v2/call`;
680
682
  UriConstants2["SIGNIN_SSO"] = `/signin-sso/oauth`;
@@ -2848,15 +2850,21 @@ function useActionService() {
2848
2850
  const loadAction = useCallback(
2849
2851
  async ({
2850
2852
  idAction,
2851
- context
2853
+ context,
2854
+ service
2852
2855
  }) => {
2853
2856
  const jsonData = {
2854
2857
  action_id: idAction,
2855
2858
  with_context: { ...context }
2856
2859
  };
2857
- return env.requests.post("/load_action" /* LOAD_ACTION */, jsonData, {
2858
- headers: { "Content-Type": "application/json" }
2859
- });
2860
+ return env.requests.post(
2861
+ "/load_action" /* LOAD_ACTION */,
2862
+ jsonData,
2863
+ {
2864
+ headers: { "Content-Type": "application/json" }
2865
+ },
2866
+ service
2867
+ );
2860
2868
  },
2861
2869
  [env]
2862
2870
  );
@@ -2865,7 +2873,8 @@ function useActionService() {
2865
2873
  model,
2866
2874
  ids = [],
2867
2875
  context,
2868
- method
2876
+ method,
2877
+ service
2869
2878
  }) => {
2870
2879
  try {
2871
2880
  const jsonData = {
@@ -2874,9 +2883,14 @@ function useActionService() {
2874
2883
  ids,
2875
2884
  with_context: context
2876
2885
  };
2877
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2878
- headers: { "Content-Type": "application/json" }
2879
- });
2886
+ return env.requests.post(
2887
+ "/call" /* CALL_PATH */,
2888
+ jsonData,
2889
+ {
2890
+ headers: { "Content-Type": "application/json" }
2891
+ },
2892
+ service
2893
+ );
2880
2894
  } catch (error) {
2881
2895
  console.error("Error when calling button action:", error);
2882
2896
  throw error;
@@ -2888,7 +2902,8 @@ function useActionService() {
2888
2902
  async ({
2889
2903
  model,
2890
2904
  ids,
2891
- context
2905
+ context,
2906
+ service
2892
2907
  }) => {
2893
2908
  const jsonData = {
2894
2909
  model,
@@ -2896,9 +2911,14 @@ function useActionService() {
2896
2911
  ids,
2897
2912
  with_context: context
2898
2913
  };
2899
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2900
- headers: { "Content-Type": "application/json" }
2901
- });
2914
+ return env.requests.post(
2915
+ "/call" /* CALL_PATH */,
2916
+ jsonData,
2917
+ {
2918
+ headers: { "Content-Type": "application/json" }
2919
+ },
2920
+ service
2921
+ );
2902
2922
  },
2903
2923
  [env]
2904
2924
  );
@@ -2906,7 +2926,8 @@ function useActionService() {
2906
2926
  async ({
2907
2927
  model,
2908
2928
  id,
2909
- context
2929
+ context,
2930
+ service
2910
2931
  }) => {
2911
2932
  const jsonData = {
2912
2933
  model,
@@ -2914,9 +2935,14 @@ function useActionService() {
2914
2935
  ids: id,
2915
2936
  with_context: context
2916
2937
  };
2917
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
2918
- headers: { "Content-Type": "application/json" }
2919
- });
2938
+ return env.requests.post(
2939
+ "/call" /* CALL_PATH */,
2940
+ jsonData,
2941
+ {
2942
+ headers: { "Content-Type": "application/json" }
2943
+ },
2944
+ service
2945
+ );
2920
2946
  },
2921
2947
  [env]
2922
2948
  );
@@ -2959,15 +2985,21 @@ function useActionService() {
2959
2985
  const runAction = useCallback(
2960
2986
  async ({
2961
2987
  idAction,
2962
- context
2988
+ context,
2989
+ service
2963
2990
  }) => {
2964
2991
  const jsonData = {
2965
2992
  action_id: idAction,
2966
2993
  with_context: { ...context }
2967
2994
  };
2968
- return env.requests.post("/run_action" /* RUN_ACTION_PATH */, jsonData, {
2969
- headers: { "Content-Type": "application/json" }
2970
- });
2995
+ return env.requests.post(
2996
+ "/run_action" /* RUN_ACTION_PATH */,
2997
+ jsonData,
2998
+ {
2999
+ headers: { "Content-Type": "application/json" }
3000
+ },
3001
+ service
3002
+ );
2971
3003
  },
2972
3004
  [env]
2973
3005
  );
@@ -3110,18 +3142,15 @@ function useAuthService() {
3110
3142
  [env]
3111
3143
  );
3112
3144
  const isValidActionToken = useCallback2(
3113
- async (actionToken, path) => {
3114
- return env?.requests?.post(
3115
- path,
3116
- {},
3117
- {
3118
- headers: {
3119
- "Content-Type": "application/json"
3120
- },
3121
- useActionToken: true,
3122
- actionToken
3123
- }
3124
- );
3145
+ async (actionToken) => {
3146
+ const bodyData = {};
3147
+ return env?.requests?.post("/action-token/validate" /* VALIDATE_ACTION_TOKEN */, bodyData, {
3148
+ headers: {
3149
+ "Content-Type": "application/json"
3150
+ },
3151
+ useActionToken: true,
3152
+ actionToken
3153
+ });
3125
3154
  },
3126
3155
  [env]
3127
3156
  );
@@ -3157,13 +3186,14 @@ function useAuthService() {
3157
3186
  data.append("client_id", env?.config?.clientId || "");
3158
3187
  data.append("redirect_uri", env?.config?.redirectUri || "");
3159
3188
  return env?.requests?.post(
3160
- `${env?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3189
+ "/token" /* TOKEN_BY_CODE */,
3161
3190
  data,
3162
3191
  {
3163
3192
  headers: {
3164
3193
  "Content-Type": "application/x-www-form-urlencoded"
3165
3194
  }
3166
- }
3195
+ },
3196
+ "id"
3167
3197
  );
3168
3198
  },
3169
3199
  [env]
@@ -3246,15 +3276,15 @@ function useCompanyService() {
3246
3276
  import { useCallback as useCallback4 } from "react";
3247
3277
  function useExcelService() {
3248
3278
  const { env } = useEnv();
3249
- const uploadFile = useCallback4(
3279
+ const uploadFileExcel = useCallback4(
3250
3280
  async ({ formData }) => {
3251
- return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData);
3281
+ return env.requests.post("/upload/file" /* UPLOAD_FILE_EXCEL_PATH */, formData);
3252
3282
  },
3253
3283
  [env]
3254
3284
  );
3255
3285
  const uploadIdFile = useCallback4(
3256
3286
  async ({ formData }) => {
3257
- return env.requests.post("/upload/file" /* UPLOAD_FILE_PATH */, formData, {
3287
+ return env.requests.post("/upload/file" /* UPLOAD_FILE_EXCEL_PATH */, formData, {
3258
3288
  headers: {
3259
3289
  "Content-Type": "multipart/form-data"
3260
3290
  }
@@ -3402,7 +3432,7 @@ function useExcelService() {
3402
3432
  [env]
3403
3433
  );
3404
3434
  return {
3405
- uploadFile,
3435
+ uploadFileExcel,
3406
3436
  uploadIdFile,
3407
3437
  parsePreview,
3408
3438
  executeImport,
@@ -3497,6 +3527,12 @@ function useFormService() {
3497
3527
  },
3498
3528
  [env]
3499
3529
  );
3530
+ const uploadFile = useCallback5(
3531
+ async ({ formData }) => {
3532
+ return env.requests.post("/web/binary/upload_attachment" /* UPLOAD_FILE_PATH */, formData);
3533
+ },
3534
+ [env]
3535
+ );
3500
3536
  const getFormView = useCallback5(
3501
3537
  async ({ data }) => {
3502
3538
  const jsonData = {
@@ -3549,7 +3585,8 @@ function useFormService() {
3549
3585
  getImage,
3550
3586
  uploadImage,
3551
3587
  getFormView,
3552
- changeStatus
3588
+ changeStatus,
3589
+ uploadFile
3553
3590
  };
3554
3591
  }
3555
3592
 
@@ -3682,7 +3719,7 @@ function useModelService() {
3682
3719
  });
3683
3720
  }, [env]);
3684
3721
  const getAll = useCallback7(
3685
- async ({ data }) => {
3722
+ async ({ data, service }) => {
3686
3723
  const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3687
3724
  fields: data.fields,
3688
3725
  groupby: data.groupby
@@ -3703,11 +3740,16 @@ function useModelService() {
3703
3740
  ...jsonReadGroup
3704
3741
  }
3705
3742
  };
3706
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3707
- headers: {
3708
- "Content-Type": "application/json"
3709
- }
3710
- });
3743
+ return env.requests.post(
3744
+ "/call" /* CALL_PATH */,
3745
+ jsonData,
3746
+ {
3747
+ headers: {
3748
+ "Content-Type": "application/json"
3749
+ }
3750
+ },
3751
+ service
3752
+ );
3711
3753
  },
3712
3754
  [env]
3713
3755
  );
@@ -3775,7 +3817,13 @@ function useModelService() {
3775
3817
  [env]
3776
3818
  );
3777
3819
  const getDetail = useCallback7(
3778
- async ({ ids = [], model, specification, context }) => {
3820
+ async ({
3821
+ ids = [],
3822
+ model,
3823
+ specification,
3824
+ context,
3825
+ service
3826
+ }) => {
3779
3827
  const jsonData = {
3780
3828
  model,
3781
3829
  method: "web_read" /* WEB_READ */,
@@ -3785,11 +3833,16 @@ function useModelService() {
3785
3833
  specification
3786
3834
  }
3787
3835
  };
3788
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3789
- headers: {
3790
- "Content-Type": "application/json"
3791
- }
3792
- });
3836
+ return env.requests.post(
3837
+ "/call" /* CALL_PATH */,
3838
+ jsonData,
3839
+ {
3840
+ headers: {
3841
+ "Content-Type": "application/json"
3842
+ }
3843
+ },
3844
+ service
3845
+ );
3793
3846
  },
3794
3847
  [env]
3795
3848
  );
@@ -3800,7 +3853,8 @@ function useModelService() {
3800
3853
  data = {},
3801
3854
  specification = {},
3802
3855
  context = {},
3803
- path
3856
+ path,
3857
+ service
3804
3858
  }) => {
3805
3859
  const jsonData = {
3806
3860
  model,
@@ -3812,26 +3866,36 @@ function useModelService() {
3812
3866
  specification
3813
3867
  }
3814
3868
  };
3815
- return env.requests.post(path ?? "/call" /* CALL_PATH */, jsonData, {
3816
- headers: {
3817
- "Content-Type": "application/json"
3818
- }
3819
- });
3869
+ return env.requests.post(
3870
+ path ?? "/call" /* CALL_PATH */,
3871
+ jsonData,
3872
+ {
3873
+ headers: {
3874
+ "Content-Type": "application/json"
3875
+ }
3876
+ },
3877
+ service
3878
+ );
3820
3879
  },
3821
3880
  [env]
3822
3881
  );
3823
3882
  const deleteApi = useCallback7(
3824
- async ({ ids = [], model }) => {
3883
+ async ({ ids = [], model, service }) => {
3825
3884
  const jsonData = {
3826
3885
  model,
3827
3886
  method: "unlink" /* UNLINK */,
3828
3887
  ids
3829
3888
  };
3830
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3831
- headers: {
3832
- "Content-Type": "application/json"
3833
- }
3834
- });
3889
+ return env.requests.post(
3890
+ "/call" /* CALL_PATH */,
3891
+ jsonData,
3892
+ {
3893
+ headers: {
3894
+ "Content-Type": "application/json"
3895
+ }
3896
+ },
3897
+ service
3898
+ );
3835
3899
  },
3836
3900
  [env]
3837
3901
  );
@@ -3842,7 +3906,8 @@ function useModelService() {
3842
3906
  object,
3843
3907
  specification,
3844
3908
  context,
3845
- fieldChange
3909
+ fieldChange,
3910
+ service
3846
3911
  }) => {
3847
3912
  const jsonData = {
3848
3913
  model,
@@ -3855,25 +3920,35 @@ function useModelService() {
3855
3920
  specification
3856
3921
  ]
3857
3922
  };
3858
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3859
- headers: {
3860
- "Content-Type": "application/json"
3861
- }
3862
- });
3923
+ return env.requests.post(
3924
+ "/call" /* CALL_PATH */,
3925
+ jsonData,
3926
+ {
3927
+ headers: {
3928
+ "Content-Type": "application/json"
3929
+ }
3930
+ },
3931
+ service
3932
+ );
3863
3933
  },
3864
3934
  [env]
3865
3935
  );
3866
3936
  const getListFieldsOnchange = useCallback7(
3867
- async ({ model }) => {
3937
+ async ({ model, service }) => {
3868
3938
  const jsonData = {
3869
3939
  model,
3870
3940
  method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
3871
3941
  };
3872
- return env.requests.post("/call" /* CALL_PATH */, jsonData, {
3873
- headers: {
3874
- "Content-Type": "application/json"
3875
- }
3876
- });
3942
+ return env.requests.post(
3943
+ "/call" /* CALL_PATH */,
3944
+ jsonData,
3945
+ {
3946
+ headers: {
3947
+ "Content-Type": "application/json"
3948
+ }
3949
+ },
3950
+ service
3951
+ );
3877
3952
  },
3878
3953
  [env]
3879
3954
  );
@@ -4033,7 +4108,8 @@ function useViewService() {
4033
4108
  views,
4034
4109
  context = {},
4035
4110
  options = {},
4036
- aid
4111
+ aid,
4112
+ service
4037
4113
  }) => {
4038
4114
  const defaultOptions = {
4039
4115
  load_filters: true,
@@ -4049,16 +4125,22 @@ function useViewService() {
4049
4125
  },
4050
4126
  with_context: context
4051
4127
  };
4052
- return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4053
- headers: {
4054
- "Content-Type": "application/json"
4055
- }
4056
- });
4128
+ return env?.requests?.post(
4129
+ "/call" /* CALL_PATH */,
4130
+ jsonDataView,
4131
+ {
4132
+ headers: {
4133
+ "Content-Type": "application/json"
4134
+ }
4135
+ },
4136
+ service
4137
+ );
4057
4138
  },
4058
4139
  [env]
4059
4140
  );
4060
4141
  const getMenu = useCallback9(
4061
- async (context, specification) => {
4142
+ async (context, specification, domain) => {
4143
+ console.log("domain", domain);
4062
4144
  const jsonData = {
4063
4145
  model: "ir.ui.menu" /* MENU */,
4064
4146
  method: "web_search_read" /* WEB_SEARCH_READ */,
@@ -4066,7 +4148,7 @@ function useViewService() {
4066
4148
  with_context: context,
4067
4149
  kwargs: {
4068
4150
  specification,
4069
- domain: [
4151
+ domain: domain ?? [
4070
4152
  "&",
4071
4153
  ["is_display", "=", true],
4072
4154
  "&",
@@ -4136,7 +4218,7 @@ function useViewService() {
4136
4218
  [env]
4137
4219
  );
4138
4220
  const getSelectionItem = useCallback9(
4139
- async ({ data }) => {
4221
+ async ({ data, service }) => {
4140
4222
  const jsonData = {
4141
4223
  model: data.model,
4142
4224
  ids: [],
@@ -4154,11 +4236,16 @@ function useViewService() {
4154
4236
  }
4155
4237
  }
4156
4238
  };
4157
- return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
4158
- headers: {
4159
- "Content-Type": "application/json"
4160
- }
4161
- });
4239
+ return env?.requests.post(
4240
+ "/call" /* CALL_PATH */,
4241
+ jsonData,
4242
+ {
4243
+ headers: {
4244
+ "Content-Type": "application/json"
4245
+ }
4246
+ },
4247
+ service
4248
+ );
4162
4249
  },
4163
4250
  [env]
4164
4251
  );
@@ -4451,7 +4538,6 @@ var sessionStorageUtils = () => {
4451
4538
  // src/configs/axios-client.ts
4452
4539
  var axiosClient = {
4453
4540
  init(config) {
4454
- console.log("config", config);
4455
4541
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
4456
4542
  const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
4457
4543
  const db = config?.db;
@@ -4470,21 +4556,25 @@ var axiosClient = {
4470
4556
  };
4471
4557
  const instance = axios.create({
4472
4558
  adapter: axios.defaults.adapter,
4473
- baseURL: config.baseUrl,
4559
+ baseURL: config?.baseUrl,
4474
4560
  timeout: 5e4,
4475
4561
  paramsSerializer: (params) => new URLSearchParams(params).toString()
4476
4562
  });
4477
4563
  instance.interceptors.request.use(async (config2) => {
4478
4564
  const { useRefreshToken, useActionToken, actionToken } = config2;
4565
+ let token = null;
4479
4566
  if (useActionToken && actionToken) {
4480
- config2.headers["Action-Token"] = actionToken;
4567
+ token = actionToken;
4568
+ } else {
4569
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4570
+ token = await getToken?.();
4571
+ }
4572
+ if (token) {
4573
+ config2.headers["Authorization"] = `Bearer ${token}`;
4481
4574
  }
4482
4575
  if (database) {
4483
4576
  config2.headers["DATABASE"] = database;
4484
4577
  }
4485
- console.log("database", database);
4486
- const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
4487
- const token = await getToken?.();
4488
4578
  if (token) config2.headers["Authorization"] = `Bearer ${token}`;
4489
4579
  return config2;
4490
4580
  }, Promise.reject);
@@ -4540,7 +4630,7 @@ var axiosClient = {
4540
4630
  );
4541
4631
  return new Promise(function(resolve) {
4542
4632
  axios.post(
4543
- `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
4633
+ `${config?.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
4544
4634
  payload,
4545
4635
  {
4546
4636
  headers: {
@@ -4608,20 +4698,47 @@ var axiosClient = {
4608
4698
  function formatUrl(url, db2) {
4609
4699
  return url + (db2 ? "?db=" + db2 : "");
4610
4700
  }
4701
+ const getBaseUrl = (baseUrl, serviceName) => {
4702
+ const service = serviceName || config?.default_service;
4703
+ return config?.default_service === "" ? `${baseUrl.replace(/\/$/, "")}/api/v2` : `${baseUrl.replace(/\/$/, "")}/${service}/api/v2`;
4704
+ };
4611
4705
  const responseBody = (response) => response;
4612
4706
  const requests = {
4613
- get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
4614
- post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
4615
- post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
4616
- responseType: "arraybuffer",
4617
- headers: {
4618
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
4619
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
4707
+ get: (url, headers, serviceName) => instance.get(
4708
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4709
+ headers
4710
+ ).then(responseBody),
4711
+ post: (url, body, headers, serviceName) => instance.post(
4712
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4713
+ body,
4714
+ headers
4715
+ ).then(responseBody),
4716
+ post_excel: (url, body, headers, serviceName) => instance.post(
4717
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4718
+ body,
4719
+ {
4720
+ responseType: "arraybuffer",
4721
+ headers: {
4722
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
4723
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
4724
+ ...headers
4725
+ }
4620
4726
  }
4621
- }).then(responseBody),
4622
- put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
4623
- patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
4624
- delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
4727
+ ).then(responseBody),
4728
+ put: (url, body, headers, serviceName) => instance.put(
4729
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4730
+ body,
4731
+ headers
4732
+ ).then(responseBody),
4733
+ patch: (url, body, headers, serviceName) => instance.patch(
4734
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4735
+ body,
4736
+ headers
4737
+ ).then(responseBody),
4738
+ delete: (url, headers, serviceName) => instance.delete(
4739
+ formatUrl(getBaseUrl(config?.baseUrl, serviceName) + url, db),
4740
+ headers
4741
+ ).then(responseBody)
4625
4742
  };
4626
4743
  return requests;
4627
4744
  }
@@ -4905,11 +5022,8 @@ import { useMutation as useMutation12 } from "@tanstack/react-query";
4905
5022
  var useValidateActionToken = () => {
4906
5023
  const { isValidActionToken } = useAuthService();
4907
5024
  return useMutation12({
4908
- mutationFn: ({
4909
- actionToken,
4910
- path
4911
- }) => {
4912
- return isValidActionToken(actionToken, path);
5025
+ mutationFn: ({ actionToken }) => {
5026
+ return isValidActionToken(actionToken);
4913
5027
  }
4914
5028
  });
4915
5029
  };
@@ -5055,17 +5169,17 @@ var useParsePreview = () => {
5055
5169
  };
5056
5170
  var use_parse_preview_default = useParsePreview;
5057
5171
 
5058
- // src/hooks/excel/use-upload-file.ts
5172
+ // src/hooks/excel/use-upload-file-excel.ts
5059
5173
  import { useMutation as useMutation18 } from "@tanstack/react-query";
5060
- var useUploadFile = () => {
5061
- const { uploadFile } = useExcelService();
5174
+ var useUploadFileExcel = () => {
5175
+ const { uploadFileExcel } = useExcelService();
5062
5176
  return useMutation18({
5063
- mutationFn: ({ formData }) => uploadFile({
5177
+ mutationFn: ({ formData }) => uploadFileExcel({
5064
5178
  formData
5065
5179
  })
5066
5180
  });
5067
5181
  };
5068
- var use_upload_file_default = useUploadFile;
5182
+ var use_upload_file_excel_default = useUploadFileExcel;
5069
5183
 
5070
5184
  // src/hooks/excel/use-upload-id-file.ts
5071
5185
  import { useMutation as useMutation19 } from "@tanstack/react-query";
@@ -5212,12 +5326,24 @@ var useUploadImage = () => {
5212
5326
  };
5213
5327
  var use_upload_image_default = useUploadImage;
5214
5328
 
5215
- // src/hooks/model/use-delete.ts
5329
+ // src/hooks/form/use-upload-file.ts
5216
5330
  import { useMutation as useMutation25 } from "@tanstack/react-query";
5331
+ var useUploadFile = () => {
5332
+ const { uploadFile } = useFormService();
5333
+ return useMutation25({
5334
+ mutationFn: ({ formData }) => uploadFile({
5335
+ formData
5336
+ })
5337
+ });
5338
+ };
5339
+ var use_upload_file_default = useUploadFile;
5340
+
5341
+ // src/hooks/model/use-delete.ts
5342
+ import { useMutation as useMutation26 } from "@tanstack/react-query";
5217
5343
  var useDelete = () => {
5218
5344
  const { deleteApi } = useModelService();
5219
- return useMutation25({
5220
- mutationFn: ({ ids, model }) => deleteApi({ ids, model })
5345
+ return useMutation26({
5346
+ mutationFn: ({ ids, model, service }) => deleteApi({ ids, model, service })
5221
5347
  });
5222
5348
  };
5223
5349
  var use_delete_default = useDelete;
@@ -5272,20 +5398,22 @@ var useGetCurrency = () => {
5272
5398
  var use_get_currency_default = useGetCurrency;
5273
5399
 
5274
5400
  // src/hooks/model/use-get-detail.ts
5275
- import { useMutation as useMutation26 } from "@tanstack/react-query";
5401
+ import { useMutation as useMutation27 } from "@tanstack/react-query";
5276
5402
  var useGetDetail = () => {
5277
5403
  const { getDetail } = useModelService();
5278
- return useMutation26({
5404
+ return useMutation27({
5279
5405
  mutationFn: ({
5280
5406
  model,
5281
5407
  ids,
5282
5408
  specification,
5283
- context
5409
+ context,
5410
+ service
5284
5411
  }) => getDetail({
5285
5412
  model,
5286
5413
  ids,
5287
5414
  specification,
5288
- context
5415
+ context,
5416
+ service
5289
5417
  })
5290
5418
  });
5291
5419
  };
@@ -5293,12 +5421,16 @@ var use_get_detail_default = useGetDetail;
5293
5421
 
5294
5422
  // src/hooks/model/use-get-field-onchange.ts
5295
5423
  import { useQuery as useQuery9 } from "@tanstack/react-query";
5296
- var useGetFieldOnChange = ({ model }) => {
5424
+ var useGetFieldOnChange = ({
5425
+ model,
5426
+ service
5427
+ }) => {
5297
5428
  const { getListFieldsOnchange } = useModelService();
5298
5429
  return useQuery9({
5299
5430
  queryKey: [`field-onchange-${model}`, model],
5300
5431
  queryFn: () => getListFieldsOnchange({
5301
- model
5432
+ model,
5433
+ service
5302
5434
  }).then((res) => {
5303
5435
  if (res) {
5304
5436
  return res;
@@ -5380,7 +5512,8 @@ var BaseModel = class {
5380
5512
  spec[field?.name] = {
5381
5513
  fields: {
5382
5514
  id: {},
5383
- display_name: {}
5515
+ display_name: {},
5516
+ ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
5384
5517
  }
5385
5518
  };
5386
5519
  }
@@ -5471,61 +5604,64 @@ var useOdooDataTransform = () => {
5471
5604
  var use_odoo_data_transform_default = useOdooDataTransform;
5472
5605
 
5473
5606
  // src/hooks/model/use-onchange-form.ts
5474
- import { useMutation as useMutation27 } from "@tanstack/react-query";
5607
+ import { useMutation as useMutation28 } from "@tanstack/react-query";
5475
5608
  var useOnChangeForm = () => {
5476
5609
  const { onChange } = useModelService();
5477
- return useMutation27({
5610
+ return useMutation28({
5478
5611
  mutationFn: ({
5479
5612
  ids,
5480
5613
  model,
5481
5614
  specification,
5482
5615
  context,
5483
5616
  object,
5484
- fieldChange
5617
+ fieldChange,
5618
+ service
5485
5619
  }) => onChange({
5486
5620
  ids,
5487
5621
  model,
5488
5622
  specification,
5489
5623
  context,
5490
5624
  object,
5491
- fieldChange
5625
+ fieldChange,
5626
+ service
5492
5627
  })
5493
5628
  });
5494
5629
  };
5495
5630
  var use_onchange_form_default = useOnChangeForm;
5496
5631
 
5497
5632
  // src/hooks/model/use-save.ts
5498
- import { useMutation as useMutation28 } from "@tanstack/react-query";
5633
+ import { useMutation as useMutation29 } from "@tanstack/react-query";
5499
5634
  var useSave = () => {
5500
5635
  const { save } = useModelService();
5501
- return useMutation28({
5636
+ return useMutation29({
5502
5637
  mutationFn: ({
5503
5638
  ids,
5504
5639
  model,
5505
5640
  data,
5506
5641
  specification,
5507
5642
  context,
5508
- path
5509
- }) => save({ ids, model, data, specification, context, path })
5643
+ path,
5644
+ service
5645
+ }) => save({ ids, model, data, specification, context, path, service })
5510
5646
  });
5511
5647
  };
5512
5648
  var use_save_default = useSave;
5513
5649
 
5514
5650
  // src/hooks/user/use-get-profile.ts
5515
- import { useMutation as useMutation29 } from "@tanstack/react-query";
5651
+ import { useMutation as useMutation30 } from "@tanstack/react-query";
5516
5652
  var useGetProfile = (path) => {
5517
5653
  const { getProfile } = useUserService();
5518
- return useMutation29({
5654
+ return useMutation30({
5519
5655
  mutationFn: () => getProfile(path)
5520
5656
  });
5521
5657
  };
5522
5658
  var use_get_profile_default = useGetProfile;
5523
5659
 
5524
5660
  // src/hooks/user/use-get-user.ts
5525
- import { useMutation as useMutation30 } from "@tanstack/react-query";
5661
+ import { useMutation as useMutation31 } from "@tanstack/react-query";
5526
5662
  var useGetUser = () => {
5527
5663
  const { getUser } = useUserService();
5528
- return useMutation30({
5664
+ return useMutation31({
5529
5665
  mutationFn: ({ id, context }) => getUser({
5530
5666
  id,
5531
5667
  context
@@ -5535,10 +5671,10 @@ var useGetUser = () => {
5535
5671
  var use_get_user_default = useGetUser;
5536
5672
 
5537
5673
  // src/hooks/user/use-switch-locale.ts
5538
- import { useMutation as useMutation31 } from "@tanstack/react-query";
5674
+ import { useMutation as useMutation32 } from "@tanstack/react-query";
5539
5675
  var useSwitchLocale = () => {
5540
5676
  const { switchUserLocale } = useUserService();
5541
- return useMutation31({
5677
+ return useMutation32({
5542
5678
  mutationFn: ({ data }) => {
5543
5679
  return switchUserLocale({
5544
5680
  id: data.id,
@@ -5550,20 +5686,22 @@ var useSwitchLocale = () => {
5550
5686
  var use_switch_locale_default = useSwitchLocale;
5551
5687
 
5552
5688
  // src/hooks/view/use-button.ts
5553
- import { useMutation as useMutation32 } from "@tanstack/react-query";
5689
+ import { useMutation as useMutation33 } from "@tanstack/react-query";
5554
5690
  var useButton = () => {
5555
5691
  const { callButton } = useActionService();
5556
- return useMutation32({
5692
+ return useMutation33({
5557
5693
  mutationFn: ({
5558
5694
  model,
5559
5695
  ids,
5560
5696
  context,
5561
- method
5697
+ method,
5698
+ service
5562
5699
  }) => callButton({
5563
5700
  model,
5564
5701
  ids,
5565
5702
  context,
5566
- method
5703
+ method,
5704
+ service
5567
5705
  }),
5568
5706
  onSuccess: (response) => {
5569
5707
  return response;
@@ -5573,18 +5711,20 @@ var useButton = () => {
5573
5711
  var use_button_default = useButton;
5574
5712
 
5575
5713
  // src/hooks/view/use-duplicate-record.ts
5576
- import { useMutation as useMutation33 } from "@tanstack/react-query";
5714
+ import { useMutation as useMutation34 } from "@tanstack/react-query";
5577
5715
  var useDuplicateRecord = () => {
5578
5716
  const { duplicateRecord } = useActionService();
5579
- return useMutation33({
5717
+ return useMutation34({
5580
5718
  mutationFn: ({
5581
5719
  id,
5582
5720
  model,
5583
- context
5721
+ context,
5722
+ service
5584
5723
  }) => duplicateRecord({
5585
5724
  id,
5586
5725
  model,
5587
- context
5726
+ context,
5727
+ service
5588
5728
  })
5589
5729
  });
5590
5730
  };
@@ -5667,11 +5807,11 @@ var use_get_groups_default = useGetGroups;
5667
5807
 
5668
5808
  // src/hooks/view/use-get-list-data.ts
5669
5809
  import { useQuery as useQuery14 } from "@tanstack/react-query";
5670
- var useGetListData = (listDataProps, queryKey, enabled) => {
5810
+ var useGetListData = (listDataProps, queryKey, enabled, service) => {
5671
5811
  const { getAll } = useModelService();
5672
5812
  return useQuery14({
5673
5813
  queryKey,
5674
- queryFn: () => getAll({ data: listDataProps }).then((res) => {
5814
+ queryFn: () => getAll({ data: listDataProps, service }).then((res) => {
5675
5815
  if (res) {
5676
5816
  return res;
5677
5817
  }
@@ -5686,11 +5826,11 @@ var use_get_list_data_default = useGetListData;
5686
5826
 
5687
5827
  // src/hooks/view/use-get-menu.ts
5688
5828
  import { useQuery as useQuery15 } from "@tanstack/react-query";
5689
- var useGetMenu = (context, specification, enabled) => {
5829
+ var useGetMenu = (context, specification, enabled, domain) => {
5690
5830
  const { getMenu } = useViewService();
5691
5831
  return useQuery15({
5692
5832
  queryKey: ["menus" /* MENU */, context],
5693
- queryFn: () => getMenu(context, specification).then((res) => {
5833
+ queryFn: () => getMenu(context, specification, domain).then((res) => {
5694
5834
  if (res && res?.records && res?.records?.length > 0) {
5695
5835
  return res?.records;
5696
5836
  }
@@ -5704,10 +5844,10 @@ var useGetMenu = (context, specification, enabled) => {
5704
5844
  var use_get_menu_default = useGetMenu;
5705
5845
 
5706
5846
  // src/hooks/view/use-get-print-report.ts
5707
- import { useMutation as useMutation34 } from "@tanstack/react-query";
5847
+ import { useMutation as useMutation35 } from "@tanstack/react-query";
5708
5848
  var useGetPrintReport = () => {
5709
5849
  const { getPrintReportName } = useActionService();
5710
- return useMutation34({
5850
+ return useMutation35({
5711
5851
  mutationFn: ({ id }) => getPrintReportName({
5712
5852
  id
5713
5853
  })
@@ -5747,12 +5887,13 @@ import { useQuery as useQuery17 } from "@tanstack/react-query";
5747
5887
  var useGetSelection = ({
5748
5888
  data,
5749
5889
  queryKey,
5750
- enabled
5890
+ enabled,
5891
+ service
5751
5892
  }) => {
5752
5893
  const { getSelectionItem } = useViewService();
5753
5894
  return useQuery17({
5754
5895
  queryKey,
5755
- queryFn: () => getSelectionItem({ data }),
5896
+ queryFn: () => getSelectionItem({ data, service }),
5756
5897
  enabled,
5757
5898
  refetchOnWindowFocus: false
5758
5899
  });
@@ -5774,17 +5915,19 @@ var useGetView = (viewParams, actData) => {
5774
5915
  var use_get_view_default = useGetView;
5775
5916
 
5776
5917
  // src/hooks/view/use-load-action.ts
5777
- import { useMutation as useMutation35 } from "@tanstack/react-query";
5918
+ import { useMutation as useMutation36 } from "@tanstack/react-query";
5778
5919
  var useLoadAction = () => {
5779
5920
  const { loadAction } = useActionService();
5780
- return useMutation35({
5921
+ return useMutation36({
5781
5922
  mutationFn: ({
5782
5923
  idAction,
5783
- context
5924
+ context,
5925
+ service
5784
5926
  }) => {
5785
5927
  return loadAction({
5786
5928
  idAction,
5787
- context
5929
+ context,
5930
+ service
5788
5931
  });
5789
5932
  }
5790
5933
  });
@@ -5804,10 +5947,10 @@ var useLoadMessage = () => {
5804
5947
  var use_load_message_default = useLoadMessage;
5805
5948
 
5806
5949
  // src/hooks/view/use-print.ts
5807
- import { useMutation as useMutation36 } from "@tanstack/react-query";
5950
+ import { useMutation as useMutation37 } from "@tanstack/react-query";
5808
5951
  var usePrint = () => {
5809
5952
  const { print } = useActionService();
5810
- return useMutation36({
5953
+ return useMutation37({
5811
5954
  mutationFn: ({ id, report, db }) => print({
5812
5955
  id,
5813
5956
  report,
@@ -5818,18 +5961,20 @@ var usePrint = () => {
5818
5961
  var use_print_default = usePrint;
5819
5962
 
5820
5963
  // src/hooks/view/use-remove-row.ts
5821
- import { useMutation as useMutation37 } from "@tanstack/react-query";
5964
+ import { useMutation as useMutation38 } from "@tanstack/react-query";
5822
5965
  var useRemoveRow = () => {
5823
5966
  const { removeRows } = useActionService();
5824
- return useMutation37({
5967
+ return useMutation38({
5825
5968
  mutationFn: ({
5826
5969
  model,
5827
5970
  ids,
5828
- context
5971
+ context,
5972
+ service
5829
5973
  }) => removeRows({
5830
5974
  model,
5831
5975
  ids,
5832
- context
5976
+ context,
5977
+ service
5833
5978
  })
5834
5979
  });
5835
5980
  };
@@ -5854,26 +5999,28 @@ var useGetResequence = (model, resIds, context, offset) => {
5854
5999
  var use_resequence_default = useGetResequence;
5855
6000
 
5856
6001
  // src/hooks/view/use-run-action.ts
5857
- import { useMutation as useMutation38 } from "@tanstack/react-query";
6002
+ import { useMutation as useMutation39 } from "@tanstack/react-query";
5858
6003
  var useRunAction = () => {
5859
6004
  const { runAction } = useActionService();
5860
- return useMutation38({
6005
+ return useMutation39({
5861
6006
  mutationFn: ({
5862
6007
  idAction,
5863
- context
6008
+ context,
6009
+ service
5864
6010
  }) => runAction({
5865
6011
  idAction,
5866
- context
6012
+ context,
6013
+ service
5867
6014
  })
5868
6015
  });
5869
6016
  };
5870
6017
  var use_run_action_default = useRunAction;
5871
6018
 
5872
6019
  // src/hooks/view/use-signin-sso.ts
5873
- import { useMutation as useMutation39 } from "@tanstack/react-query";
6020
+ import { useMutation as useMutation40 } from "@tanstack/react-query";
5874
6021
  var useSignInSSO = () => {
5875
6022
  const { signInSSO } = useViewService();
5876
- return useMutation39({
6023
+ return useMutation40({
5877
6024
  mutationFn: ({
5878
6025
  redirect_uri,
5879
6026
  state,
@@ -5896,10 +6043,10 @@ var useSignInSSO = () => {
5896
6043
  var use_signin_sso_default = useSignInSSO;
5897
6044
 
5898
6045
  // src/hooks/view/use-verify-2FA.ts
5899
- import { useMutation as useMutation40 } from "@tanstack/react-query";
6046
+ import { useMutation as useMutation41 } from "@tanstack/react-query";
5900
6047
  var useVerify2FA = () => {
5901
6048
  const { verify2FA } = useViewService();
5902
- return useMutation40({
6049
+ return useMutation41({
5903
6050
  mutationFn: ({
5904
6051
  method,
5905
6052
  with_context,
@@ -5920,10 +6067,10 @@ var useVerify2FA = () => {
5920
6067
  var use_verify_2FA_default = useVerify2FA;
5921
6068
 
5922
6069
  // src/hooks/view/uset-get-2FA-method.ts
5923
- import { useMutation as useMutation41 } from "@tanstack/react-query";
6070
+ import { useMutation as useMutation42 } from "@tanstack/react-query";
5924
6071
  var useGet2FAMethods = () => {
5925
6072
  const { get2FAMethods } = useViewService();
5926
- return useMutation41({
6073
+ return useMutation42({
5927
6074
  mutationFn: ({
5928
6075
  method,
5929
6076
  with_context
@@ -5938,10 +6085,10 @@ var useGet2FAMethods = () => {
5938
6085
  var uset_get_2FA_method_default = useGet2FAMethods;
5939
6086
 
5940
6087
  // src/hooks/view/use-grant-access.ts
5941
- import { useMutation as useMutation42 } from "@tanstack/react-query";
6088
+ import { useMutation as useMutation43 } from "@tanstack/react-query";
5942
6089
  var useGrantAccess = () => {
5943
6090
  const { grantAccess } = useViewService();
5944
- return useMutation42({
6091
+ return useMutation43({
5945
6092
  mutationFn: ({
5946
6093
  redirect_uri,
5947
6094
  state,
@@ -5960,10 +6107,10 @@ var useGrantAccess = () => {
5960
6107
  var use_grant_access_default = useGrantAccess;
5961
6108
 
5962
6109
  // src/hooks/view/use-remove-totp-setup.ts
5963
- import { useMutation as useMutation43 } from "@tanstack/react-query";
6110
+ import { useMutation as useMutation44 } from "@tanstack/react-query";
5964
6111
  var useRemoveTotpSetup = () => {
5965
6112
  const { removeTotpSetUp } = useViewService();
5966
- return useMutation43({
6113
+ return useMutation44({
5967
6114
  mutationFn: ({ method, token }) => {
5968
6115
  return removeTotpSetUp({
5969
6116
  method,
@@ -5975,10 +6122,10 @@ var useRemoveTotpSetup = () => {
5975
6122
  var use_remove_totp_setup_default = useRemoveTotpSetup;
5976
6123
 
5977
6124
  // src/hooks/view/use-request-setup-totp.ts
5978
- import { useMutation as useMutation44 } from "@tanstack/react-query";
6125
+ import { useMutation as useMutation45 } from "@tanstack/react-query";
5979
6126
  var useRequestSetupTotp = () => {
5980
6127
  const { requestSetupTotp } = useViewService();
5981
- return useMutation44({
6128
+ return useMutation45({
5982
6129
  mutationFn: ({ method, token }) => {
5983
6130
  return requestSetupTotp({
5984
6131
  method,
@@ -5990,10 +6137,10 @@ var useRequestSetupTotp = () => {
5990
6137
  var use_request_setup_totp_default = useRequestSetupTotp;
5991
6138
 
5992
6139
  // src/hooks/view/use-settings-web-read-2fa.ts
5993
- import { useMutation as useMutation45 } from "@tanstack/react-query";
6140
+ import { useMutation as useMutation46 } from "@tanstack/react-query";
5994
6141
  var useSettingsWebRead2fa = () => {
5995
6142
  const { settingsWebRead2fa } = useViewService();
5996
- return useMutation45({
6143
+ return useMutation46({
5997
6144
  mutationFn: ({
5998
6145
  method,
5999
6146
  token,
@@ -6012,10 +6159,10 @@ var useSettingsWebRead2fa = () => {
6012
6159
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
6013
6160
 
6014
6161
  // src/hooks/view/use-verify-totp.ts
6015
- import { useMutation as useMutation46 } from "@tanstack/react-query";
6162
+ import { useMutation as useMutation47 } from "@tanstack/react-query";
6016
6163
  var useVerifyTotp = () => {
6017
6164
  const { verifyTotp } = useViewService();
6018
- return useMutation46({
6165
+ return useMutation47({
6019
6166
  mutationFn: ({
6020
6167
  method,
6021
6168
  action_token,
@@ -6058,7 +6205,7 @@ var ServiceProvider = ({
6058
6205
  useGetFieldExport: use_get_field_export_default,
6059
6206
  useGetFileExcel: use_get_file_excel_default,
6060
6207
  useParsePreview: use_parse_preview_default,
6061
- useUploadFile: use_upload_file_default,
6208
+ useUploadFileExcel: use_upload_file_excel_default,
6062
6209
  useUploadIdFile: use_upload_id_file_default,
6063
6210
  useChangeStatus: use_change_status_default,
6064
6211
  useDeleteComment: use_delete_comment_default,
@@ -6105,7 +6252,8 @@ var ServiceProvider = ({
6105
6252
  useRemoveTotpSetup: use_remove_totp_setup_default,
6106
6253
  useRequestSetupTotp: use_request_setup_totp_default,
6107
6254
  useSettingsWebRead2fa: use_settings_web_read_2fa_default,
6108
- useVerifyTotp: use_verify_totp_default
6255
+ useVerifyTotp: use_verify_totp_default,
6256
+ useUploadFile: use_upload_file_default
6109
6257
  };
6110
6258
  return /* @__PURE__ */ jsx6(ServiceContext.Provider, { value: services, children });
6111
6259
  };