@fctc/interface-logic 2.3.2 → 2.3.3

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